update Staff full CRUD
This commit is contained in:
95
views/staff/form.tpl
Normal file
95
views/staff/form.tpl
Normal file
@@ -0,0 +1,95 @@
|
||||
<style>
|
||||
.input-group-addon{
|
||||
width: 140px;
|
||||
text-align: left;
|
||||
}
|
||||
.input-group{
|
||||
width: 100%;
|
||||
}
|
||||
.select2{
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" id="code">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Mã nhân viên <i class="text-red">*</i></div>
|
||||
<input type="number" class="form-control" value="{$model->code|default:""}" name="Code">
|
||||
</div>
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group" id="name">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Tên nhân viên <i class="text-red">*</i></div>
|
||||
<input type="text" class="form-control" value="{$model->name|default:""}" name="Name">
|
||||
</div>
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Giới tính <i class="text-red">*</i></div>
|
||||
<select class="form-control" name="Gender">
|
||||
{html_options options=$genderArray selected=$model->gender|default:"M"}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Ngày sinh</div>
|
||||
<input type="text" class="form-control DatePicker" value="{$model->birthday|date_format:"%d/%m/%Y"}" name="BirthDay">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="email">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Email</div>
|
||||
<input type="text" class="form-control" value="{$model->email}" name="Email">
|
||||
</div>
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group" id="phone">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Điện thoại</div>
|
||||
<input type="text" class="form-control" value="{$model->phone}" name="Phone">
|
||||
</div>
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" id="card_number">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Mã thẻ</div>
|
||||
<input type="number" class="form-control" value="{$model->card_number|default:""}" name="CardNumber">
|
||||
</div>
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Phòng ban</div>
|
||||
<select class="form-control" name="Department" id="Department">
|
||||
{html_options options=$departmentArray selected=$model->department_id|default:0}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Ngày bắt đầu làm việc</div>
|
||||
<input type="text" class="form-control DatePicker" value="{$model->date_in|date_format:"%d/%m/%Y"}" name="DateIn">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Địa chỉ</div>
|
||||
<textarea class="form-control" rows="6" name="Address">{$model->address}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<button class="btn btn-primary" onclick="save(this);" data-href="{$url}">
|
||||
<i class="fa fa-floppy-o"></i> Lưu
|
||||
</button>
|
||||
<button class="btn btn-default" data-dismiss="modal">
|
||||
<span class="fa fa-remove"></span> Hủy
|
||||
</button>
|
||||
</div>
|
||||
55
views/staff/import.tpl
Normal file
55
views/staff/import.tpl
Normal file
@@ -0,0 +1,55 @@
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 3%;">#</th>
|
||||
<th style="width: 3%;" class="text-center">
|
||||
<input type='checkbox' value='0' class='checkbox-staff-import' checked="" id='checkall-staff-import'>
|
||||
</th>
|
||||
<th>Mã nhân viên</th>
|
||||
<th>Tên nhân viên</th>
|
||||
<th>Số thẻ</th>
|
||||
<th>Phòng ban</th>
|
||||
<th>Giới tính</th>
|
||||
<th>Ngày sinh</th>
|
||||
<th>Email</th>
|
||||
<th>Điện thoại</th>
|
||||
<th>Ngày bắt đầu làm việc</th>
|
||||
<th>Địa chỉ</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{$count=1}
|
||||
{foreach from=$data item=d key=k}
|
||||
{if $k>1}
|
||||
{$status=$model->checkStatusImport($d)}
|
||||
<tr {if !$status.status}class="warning"{/if}>
|
||||
<td>{$count++}</td>
|
||||
<td class="text-center">
|
||||
{if $status.status}
|
||||
<input type='checkbox' value='{json_encode($d)}' checked="" name='checkbox-staff-import' class='checkbox-staff-import'>
|
||||
{/if}
|
||||
</td>
|
||||
<td>{$d.A}</td>
|
||||
<td>{$d.B}</td>
|
||||
<td>{$d.C}</td>
|
||||
<td>{$d.D}</td>
|
||||
<td>{$d.E}</td>
|
||||
<td>{$d.F}</td>
|
||||
<td>{$d.G}</td>
|
||||
<td>{$d.H}</td>
|
||||
<td>{$d.I}</td>
|
||||
<td>{$d.J}</td>
|
||||
<td><i class="text-red">{$status.description}</i></td>
|
||||
</tr>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="text-right">
|
||||
<button class="btn btn-primary" onclick="_import(this);" data-href="{yii\helpers\Url::to(["import"])}">
|
||||
<i class="fa fa-floppy-o"></i> Lưu
|
||||
</button>
|
||||
<button class="btn btn-default" data-dismiss="modal">
|
||||
<span class="fa fa-remove"></span> Hủy
|
||||
</button>
|
||||
</div>
|
||||
84
views/staff/index.tpl
Normal file
84
views/staff/index.tpl
Normal file
@@ -0,0 +1,84 @@
|
||||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="yii\grid\GridView"}
|
||||
{use class="yii\widgets\Pjax" type="block"}
|
||||
{use class="app\assets\StaffAsset"}
|
||||
{StaffAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<div class="staff-index">
|
||||
<div class="" style="font-size: 15px;">
|
||||
<label class="action-button" onclick="common.form(this, 'staff', true);" data-href="{Url::to(['create'])}">
|
||||
<i class="fa fa-plus-square fa-1-5x"></i> Thêm
|
||||
</label>
|
||||
<label class="action-button" onclick="_form(this);" data-href="{Url::to(['update'])}">
|
||||
<i class="fa fa-edit fa-1-5x"></i> Tùy chỉnh
|
||||
</label>
|
||||
<label class="action-button" onclick="_delete(this);" data-href="{Url::to(['delete'])}">
|
||||
<i class="fa fa-trash fa-1-5x"></i> Xóa
|
||||
</label>
|
||||
<label class="action-button" onclick="$('#file').trigger('click');">
|
||||
<i class="fa fa-upload fa-1-5x"></i> Nhập
|
||||
</label>
|
||||
<label class="action-button" onclick="_export(this);" data-href="{Url::to(['export'])}">
|
||||
<i class="fa fa-download fa-1-5x"></i> Xuất
|
||||
</label>
|
||||
<label class="action-button" onclick="_logs(this);" data-href="{Url::to(['logs'])}">
|
||||
<i class="fa fa-file fa-1-5x"></i> Ghi nhận hệ thống
|
||||
</label>
|
||||
</div>
|
||||
<div class="hidden">
|
||||
<input type="file" name="file" id="file">
|
||||
<input type="hidden" value="{Url::to(['upload'])}" name="upload_file_url">
|
||||
</div>
|
||||
{Pjax id="staff-list"}
|
||||
{GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'layout'=> \app\helpers\CommonGrid::getLayout(),
|
||||
'tableOptions' => [
|
||||
'class' => 'table table-striped table-bordered table-hover',
|
||||
'style' => 'background:#fff;min-width:700px;'
|
||||
],
|
||||
'rowOptions' => \app\helpers\CommonGrid::rows("staff", true),
|
||||
'columns' => [
|
||||
[
|
||||
'class' => 'yii\grid\SerialColumn',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%']
|
||||
],
|
||||
[
|
||||
'header' => "<input type='checkbox' value='0' class='checkbox-staff' id='checkall-staff'>",
|
||||
'format' => 'raw',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%'],
|
||||
'value' => \app\helpers\CommonGrid::checkbox("staff", false)
|
||||
],
|
||||
'code',
|
||||
'name',
|
||||
'card_number',
|
||||
[
|
||||
'attribute' => 'department_id',
|
||||
'filter' => $departmentArray,
|
||||
'value' => \app\helpers\StaffGrid::department($departmentArray)
|
||||
],
|
||||
[
|
||||
'attribute' => 'gender',
|
||||
'filter' => $genderArray,
|
||||
'value' => \app\helpers\StaffGrid::gender($genderArray)
|
||||
],
|
||||
[
|
||||
'attribute' => 'birthday',
|
||||
'value' => \app\helpers\StaffGrid::birthday()
|
||||
],
|
||||
'email',
|
||||
'phone',
|
||||
[
|
||||
'attribute' => 'date_in',
|
||||
'value' => \app\helpers\StaffGrid::dateIn()
|
||||
],
|
||||
'address'
|
||||
]
|
||||
])}
|
||||
{/Pjax}
|
||||
</div>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user