cập nhật tính năng quản trị phòng ban

This commit is contained in:
2020-10-07 17:29:30 +07:00
parent 586be80cf6
commit 2d15fc1c14
22 changed files with 1041 additions and 72 deletions

42
views/department/form.tpl Normal file
View File

@@ -0,0 +1,42 @@
<style>
.input-group-addon{
width: 140px;
text-align: left;
}
.input-group{
width: 100%;
}
.select2{
width: 100% !important;
}
</style>
<div class="form-group" id="name">
<div class="input-group">
<div class="input-group-addon">Tên phòng ban <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" id="code">
<div class="input-group">
<div class="input-group-addon">Mã phòng ban <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">
<div class="input-group">
<div class="input-group-addon">Trực thuộc <i class="text-red">*</i></div>
<select class="form-control" name="Pid" id="Pid">
{html_options options=$departmentArray selected=$model->pid|default:1}
</select>
</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>

View File

@@ -0,0 +1,42 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th style="width: 5%;">#</th>
<th style="width: 5%;" class="text-center">
<input type='checkbox' value='0' class='checkbox-department-import' checked="" id='checkall-department-import'>
</th>
<th>Mã phòng ban</th>
<th>Tên phòng ban</th>
<th>Trực thuộc</th>
<th>Trạng thái</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-department-import' class='checkbox-department-import'>
{/if}
</td>
<td>{$d.A}</td>
<td>{$d.B}</td>
<td>{$d.C}</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>

View File

@@ -0,0 +1,78 @@
{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\DepartmentAsset"}
{DepartmentAsset::register($this)|void}
{block name='content'}
<div class="department-index">
<div class="">
<label class="action-button">
<i class="fa fa-sitemap"></i> Cây thư mục
</label>
<label class="action-button" onclick="common.form(this, 'department');" data-href="{Url::to(['create'])}">
<i class="fa fa-plus-square"></i> Thêm
</label>
<label class="action-button" onclick="_form(this);" data-href="{Url::to(['update'])}">
<i class="fa fa-edit"></i> Tùy chỉnh
</label>
<label class="action-button" onclick="_delete(this);" data-href="{Url::to(['delete'])}">
<i class="fa fa-trash"></i> Xóa
</label>
<label class="action-button" onclick="$('#file').trigger('click');">
<i class="fa fa-upload"></i> Nhập
</label>
<label class="action-button" onclick="_export(this);" data-href="{Url::to(['export'])}">
<i class="fa fa-download"></i> Xuất
</label>
<label class="action-button" onclick="_logs(this);" data-href="{Url::to(['logs'])}">
<i class="fa fa-file"></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="department-list"}
{GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'layout'=> \app\helpers\DepartmentGrid::getLayout(),
'tableOptions' => [
'class' => 'table table-striped table-bordered table-hover',
'style' => 'background:#fff;min-width:700px;'
],
'rowOptions' => \app\helpers\DepartmentGrid::rows(),
'columns' => [
[
'class' => 'yii\grid\SerialColumn',
'contentOptions' => ['class' => 'text-center'],
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%']
],
[
'header' => "<input type='checkbox' value='0' class='checkbox-department' id='checkall-department'>",
'format' => 'raw',
'contentOptions' => ['class' => 'text-center'],
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%'],
'value' => \app\helpers\DepartmentGrid::checkbox()
],
'code',
'name',
[
'attribute' => 'pid',
'filter' => $departmentArray,
'value' => \app\helpers\DepartmentGrid::pid($departmentArray)
],
[
'attribute' => 'created_at',
'value' => \app\helpers\DepartmentGrid::createdAt()
],
[
'attribute' => 'modified_at',
'value' => \app\helpers\DepartmentGrid::modifiedAt()
]
]
])}
{/Pjax}
</div>
{/block}

23
views/department/logs.tpl Normal file
View File

@@ -0,0 +1,23 @@
<table style="width: 100%;" class="table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>Người dùng</th>
<th>Thời gian</th>
<th>Hành động</th>
<th>Chi tiết</th>
</tr>
</thead>
<tbody>
{$count=1}
{foreach from=$logs item=l}
<tr>
<td>{$count++}</td>
<td>{$userArray[$l->user_id]|default:""}</td>
<td>{$l->time|date_format:"%H:%M:%S %d/%m/%Y"}</td>
<td>{$l->action}</td>
<td>{$l->description}</td>
</tr>
{/foreach}
</tbody>
</table>