update Area + Device
This commit is contained in:
33
views/area/_form.php
Normal file
33
views/area/_form.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model app\models\Area */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="area-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'code')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'pid')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>
|
||||
|
||||
<?= $form->field($model, 'created_at')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'modified_at')->textInput() ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
42
views/area/_search.php
Normal file
42
views/area/_search.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model app\models\AreaSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="area-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
'options' => [
|
||||
'data-pjax' => 1
|
||||
],
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id') ?>
|
||||
|
||||
<?= $form->field($model, 'code') ?>
|
||||
|
||||
<?= $form->field($model, 'pid') ?>
|
||||
|
||||
<?= $form->field($model, 'name') ?>
|
||||
|
||||
<?= $form->field($model, 'description') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'created_at') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'modified_at') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
21
views/area/create.php
Normal file
21
views/area/create.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model app\models\Area */
|
||||
|
||||
$this->title = 'Create Area';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Areas', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="area-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
41
views/area/index.php
Normal file
41
views/area/index.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\Pjax;
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel app\models\AreaSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = 'Areas';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="area-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php Pjax::begin(); ?>
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Create Area', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'id',
|
||||
'code',
|
||||
'pid',
|
||||
'name',
|
||||
'description:ntext',
|
||||
//'created_at',
|
||||
//'modified_at',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
<?php Pjax::end(); ?>
|
||||
</div>
|
||||
68
views/area/index.tpl
Normal file
68
views/area/index.tpl
Normal file
@@ -0,0 +1,68 @@
|
||||
{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\AreaAsset"}
|
||||
{AreaAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<div class="area-index">
|
||||
<div class="" style="font-size: 15px;">
|
||||
<label class="action-button" onclick="common.form(this, '');" data-href="{Url::to(['tree'])}">
|
||||
<i class="fa fa-sitemap fa-1-5x"></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 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="_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>
|
||||
{Pjax id="area-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',
|
||||
'pid',
|
||||
'name',
|
||||
'description:ntext',
|
||||
[
|
||||
'attribute' => 'created_at',
|
||||
'value' => \app\helpers\DepartmentGrid::createdAt()
|
||||
],
|
||||
[
|
||||
'attribute' => 'modified_at',
|
||||
'value' => \app\helpers\DepartmentGrid::modifiedAt()
|
||||
]
|
||||
]
|
||||
])}
|
||||
{/Pjax}
|
||||
</div>
|
||||
{/block}
|
||||
21
views/area/update.php
Normal file
21
views/area/update.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model app\models\Area */
|
||||
|
||||
$this->title = 'Update Area: ' . $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Areas', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
?>
|
||||
<div class="area-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
41
views/area/view.php
Normal file
41
views/area/view.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model app\models\Area */
|
||||
|
||||
$this->title = $model->name;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Areas', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="area-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Delete', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Are you sure you want to delete this item?',
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id',
|
||||
'code',
|
||||
'pid',
|
||||
'name',
|
||||
'description:ntext',
|
||||
'created_at',
|
||||
'modified_at',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
@@ -20,14 +20,14 @@
|
||||
<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">
|
||||
<input type="number" class="form-control" value="{$model->code|default:""}" name="Code" {if $model->code==1}disabled=""{/if}>
|
||||
</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">
|
||||
<select class="form-control" name="Pid" id="Pid" {if $model->code==1}disabled=""{/if}>
|
||||
{html_options options=$departmentArray selected=$model->pid|default:1}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -6,27 +6,27 @@
|
||||
{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
|
||||
<div class="" style="font-size: 15px;">
|
||||
<label class="action-button" onclick="common.form(this, '');" data-href="{Url::to(['tree'])}">
|
||||
<i class="fa fa-sitemap fa-1-5x"></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
|
||||
<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"></i> Tùy chỉnh
|
||||
<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"></i> Xóa
|
||||
<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"></i> Nhập
|
||||
<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"></i> Xuất
|
||||
<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"></i> Ghi nhận hệ thống
|
||||
<i class="fa fa-file fa-1-5x"></i> Ghi nhận hệ thống
|
||||
</label>
|
||||
</div>
|
||||
<div class="hidden">
|
||||
|
||||
7
views/department/tree.tpl
Normal file
7
views/department/tree.tpl
Normal file
@@ -0,0 +1,7 @@
|
||||
<div style="cursor: pointer;">
|
||||
<i class="fa fa-minus-square-o" onclick="common.tree(this);" data="1" data-stt="true"></i>
|
||||
<b class="tree tree-drop" data="0">{$root->code}-{$root->name}</b>
|
||||
<div id="sub-tree-1" style="padding-left: 20px;">
|
||||
{\app\widgets\Department::widget(["pid"=>1])}
|
||||
</div>
|
||||
</div>
|
||||
73
views/device/index.tpl
Normal file
73
views/device/index.tpl
Normal file
@@ -0,0 +1,73 @@
|
||||
{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="device-index">
|
||||
<div class="" style="font-size: 15px;">
|
||||
<label class="action-button" onclick="common.form(this, '');" data-href="{Url::to(['tree'])}">
|
||||
<i class="fa fa-sitemap fa-1-5x"></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 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="device-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()
|
||||
],
|
||||
'name',
|
||||
'ip_address',
|
||||
[
|
||||
'attribute' => 'created_at',
|
||||
'value' => \app\helpers\DepartmentGrid::createdAt()
|
||||
],
|
||||
[
|
||||
'attribute' => 'modified_at',
|
||||
'value' => \app\helpers\DepartmentGrid::modifiedAt()
|
||||
]
|
||||
]
|
||||
])}
|
||||
{/Pjax}
|
||||
</div>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user