Initial commit
Couldnt keep the history unfortunately.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="content shadow p-4 mb-4">
|
||||
<?= $this->partial('../app/views/partials/message.php'); ?>
|
||||
|
||||
<h3>Create</h3>
|
||||
|
||||
<form action="<?= $this->url; ?>" method="post">
|
||||
<?php foreach($this->attributes as $key => $attribute) { ?>
|
||||
<?php
|
||||
if ($attribute[3] == 1) { continue; }
|
||||
if ($attribute[2] == 1) { $required = 'required'; } else { $required = ''; }
|
||||
|
||||
$name = $attribute[0];
|
||||
$title = ucfirst($attribute[0]);
|
||||
$title = str_replace('_', ' ', $title);
|
||||
$autofocus = $key == 0 ? 'autofocus' : '';
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="<?= $name; ?>"><?= $title;?></label><br>
|
||||
<?php if ($attribute[1] == 'text') { ?>
|
||||
|
||||
<input type="text" class="form-control"
|
||||
<?= $autofocus; ?>
|
||||
<?= $required; ?>
|
||||
name="<?= $name; ?>"
|
||||
placeholder="<?= $title; ?>">
|
||||
|
||||
<?php } else if ($attribute[1] == 'textarea') { ?>
|
||||
|
||||
<textarea id="summernote" rows="18" cols="1" class="form-control"
|
||||
<?= $autofocus; ?>
|
||||
<?= $required; ?>
|
||||
name="<?= $name; ?>"
|
||||
placeholder="<?= $title; ?>"
|
||||
></textarea>
|
||||
|
||||
<?php } else if ($attribute[1] == 'checkbox') { ?>
|
||||
|
||||
<input type="hidden" name="<?= $name; ?>" value="0">
|
||||
<input type="checkbox" name="<?= $name; ?>" value="1">
|
||||
|
||||
<?php } else if ($attribute[1] == 'dropdown') { ?>
|
||||
|
||||
<select name="<?= $name; ?>" class="custom-select">
|
||||
<?php foreach($this->dropdownData[$key] as $dropdownKey => $value) { ?>
|
||||
<option value="<?= $dropdownKey; ?>"><?= $value; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<button type="submit" class="btn btn-dark">Create</button>
|
||||
|
||||
<input type="hidden" name="_token" value="<?= $this->csrfToken; ?>" />
|
||||
</form>
|
||||
|
||||
<div class="pb-5"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,66 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="content shadow p-4 mb-4">
|
||||
<?= $this->partial('../app/views/partials/message.php'); ?>
|
||||
|
||||
<h3>Edit</h3>
|
||||
|
||||
<form id="form-edit" action="<?= $this->url; ?>" method="post">
|
||||
<?php foreach($this->attributes as $key => $attribute) { ?>
|
||||
<?php
|
||||
if ($attribute[3] == 1) { continue; }
|
||||
if ($attribute[2] == 1) { $required = 'required'; } else { $required = ''; }
|
||||
|
||||
$name = $attribute[0];
|
||||
$title = ucfirst($attribute[0]);
|
||||
$title = str_replace('_', ' ', $title);
|
||||
$autofocus = $key == 0 ? 'autofocus' : '';
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label for="<?= $name; ?>"><?= $title;?></label><br>
|
||||
<?php if ($attribute[1] == 'text') { ?>
|
||||
|
||||
<input type="text" class="form-control"
|
||||
<?= $autofocus; ?>
|
||||
<?= $required; ?>
|
||||
name="<?= $name; ?>"
|
||||
placeholder="<?= $title; ?>"
|
||||
value="<?= ($this->escape)($this->model->$name); ?>">
|
||||
|
||||
<?php } else if ($attribute[1] == 'textarea') { ?>
|
||||
|
||||
<textarea id="summernote" rows="18" cols="1" class="form-control"
|
||||
<?= $autofocus; ?>
|
||||
<?= $required; ?>
|
||||
name="<?= $name; ?>"
|
||||
placeholder="<?= $title; ?>"
|
||||
><?= ($this->escape)($this->model->$name); ?></textarea>
|
||||
|
||||
<?php } else if ($attribute[1] == 'checkbox') { ?>
|
||||
|
||||
<input type="hidden" name="<?= $name; ?>" value="0">
|
||||
<input type="checkbox" name="<?= $name; ?>" value="1"
|
||||
<?= $this->model->$name == '1' ? 'checked' : ''; ?>>
|
||||
|
||||
<?php } else if ($attribute[1] == 'dropdown') { ?>
|
||||
|
||||
<select name="<?= $name; ?>" class="custom-select">
|
||||
<?php foreach($this->dropdownData[$key] as $dropdownKey => $value) { ?>
|
||||
<option value="<?= $dropdownKey; ?>"
|
||||
<?= $this->model->$name == $dropdownKey ? 'selected' : ''; ?>>
|
||||
<?= $value; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<input type="hidden" name="_token" value="<?= $this->csrfToken; ?>" />
|
||||
</form>
|
||||
<button class="js-edit btn btn-dark" href="<?= $this->url . '/' . $this->model->id; ?>">Edit</button>
|
||||
|
||||
<div class="pb-5"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,71 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="content shadow p-4 mb-4">
|
||||
<?= $this->partial('../app/views/partials/message.php'); ?>
|
||||
|
||||
<h3><?= $this->title; ?></h3>
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<?php foreach($this->attributes as $attribute) { ?>
|
||||
<?php
|
||||
if ($attribute[3] == 1) { continue; }
|
||||
|
||||
$title = ucfirst($attribute[0]);
|
||||
$title = str_replace('_', ' ', $title);
|
||||
?>
|
||||
<th><?= $title; ?></th>
|
||||
<?php } ?>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->rows as $key => $row) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?= $this->url . '/' . $row['id']; ?>">
|
||||
<?= $key + 1; ?>
|
||||
</a>
|
||||
</td>
|
||||
<?php foreach($this->attributes as $attribute) { ?>
|
||||
<?php
|
||||
// Skip filtered
|
||||
if ($attribute[3] == 1) { continue; }
|
||||
?>
|
||||
<td>
|
||||
<?php $value = $row[$attribute[0]]; ?>
|
||||
<?php if ($attribute[1] == 'checkbox' && is_numeric($value)) { ?>
|
||||
<i class="fa <?= $value ? 'fa-check text-success' : 'fa-times text-danger'; ?>"></i>
|
||||
<?php } else { ?>
|
||||
<?= ($this->escape)(substr($value, 0, 47)); ?>
|
||||
<?= strlen($value) > 47 ? '...' : ''; ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td>
|
||||
<a href="<?= $this->url . '/' . $row['id']; ?>/edit">
|
||||
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||
</a>
|
||||
<a class="js-delete" href="<?= $this->url . '/' . $row['id']; ?>" data-token="<?= $this->csrfToken; ?>">
|
||||
<i class="fa fa-trash text-danger" aria-hidden="true"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?= $this->partial('../app/views/partials/pagination.php'); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<a class="btn btn-dark" href="<?= $this->url ?>/create">New <?= $this->title; ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pb-5"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,40 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="content shadow p-4 mb-4">
|
||||
<h3><?= _exists([$this->model->title]) ? ($this->escape)($this->model->title) : 'Show'; ?></h3>
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr class="d-flex">
|
||||
<th class="col-4">Column</th>
|
||||
<th class="col-8">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->attributes as $attribute) { ?>
|
||||
<?php
|
||||
// Skip filtered
|
||||
if ($attribute[3] == 1) { continue; }
|
||||
|
||||
$title = ucfirst($attribute[0]);
|
||||
$title = str_replace('_', ' ', $title);
|
||||
?>
|
||||
<tr class="d-flex">
|
||||
<td class="col-4"><?= $title; ?></td>
|
||||
<td class="col-8">
|
||||
<?php $value = $this->model->{$attribute[0]}; ?>
|
||||
<?php if ($attribute[1] == 'checkbox' && is_numeric($value)) { ?>
|
||||
<i class="fa <?= $value ? 'fa-check text-success' : 'fa-times text-danger'; ?>"></i>
|
||||
<?php } else { ?>
|
||||
<?= ($this->escape)($value); ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="pb-5"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user