diff --git a/controllers/DepartmentController.php b/controllers/DepartmentController.php
index 5f2bb63b..5ed26d25 100644
--- a/controllers/DepartmentController.php
+++ b/controllers/DepartmentController.php
@@ -101,7 +101,7 @@ class DepartmentController extends Controller {
"form" => $this->renderPartial("form", [
"model" => $model,
"url" => Url::to(["update", "id" => $id]),
- "departmentArray" => Department::departmentArray()
+ "departmentArray" => Department::departmentArrayWithOut($id)
])
];
}
@@ -250,7 +250,7 @@ class DepartmentController extends Controller {
'http' => [
'header' => "Content-Type: application/json",
'method' => "POST",
- 'content' => json_encode(["DeviceIP" => "192.168.1.201"])
+ 'content' => json_encode(["DeviceIP" => "192.168.1.200"])
]
]));
return var_dump($test);
diff --git a/helpers/AreaGrid.php b/helpers/AreaGrid.php
deleted file mode 100644
index 639b53ae..00000000
--- a/helpers/AreaGrid.php
+++ /dev/null
@@ -1,13 +0,0 @@
-pid]) ? $departmentArray[$model->pid] : "";
- };
- }
-
-}
diff --git a/helpers/DepartmentGrid.php b/helpers/DepartmentGrid.php
deleted file mode 100644
index 6bff3f08..00000000
--- a/helpers/DepartmentGrid.php
+++ /dev/null
@@ -1,13 +0,0 @@
-pid]) ? $departmentArray[$model->pid] : "";
- };
- }
-
-}
diff --git a/models/Department.php b/models/Department.php
index 39fe5ba6..3ef55f79 100644
--- a/models/Department.php
+++ b/models/Department.php
@@ -57,6 +57,15 @@ class Department extends \yii\db\ActiveRecord {
return $results;
}
+ public static function departmentArrayWithOut($id) {
+ $lists = self::find()->andWhere(["<>", "id", $id])->all();
+ $results = [];
+ foreach ($lists as $key => $value) {
+ $results[$value->code] = $value->name;
+ }
+ return $results;
+ }
+
public function create($data) {
$r = $this->load([
"code" => $data["Code"],
diff --git a/views/area/form.tpl b/views/area/form.tpl
new file mode 100644
index 00000000..6ce4f072
--- /dev/null
+++ b/views/area/form.tpl
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/views/department/index.tpl b/views/department/index.tpl
index 18b6e6c4..1109383b 100644
--- a/views/department/index.tpl
+++ b/views/department/index.tpl
@@ -37,12 +37,12 @@
{GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
- 'layout'=> \app\helpers\DepartmentGrid::getLayout(),
+ 'layout'=> \app\helpers\CommonGrid::getLayout(),
'tableOptions' => [
'class' => 'table table-striped table-bordered table-hover',
'style' => 'background:#fff;min-width:700px;'
],
- 'rowOptions' => \app\helpers\DepartmentGrid::rows("department"),
+ 'rowOptions' => \app\helpers\CommonGrid::rows("department"),
'columns' => [
[
'class' => 'yii\grid\SerialColumn',
@@ -54,22 +54,22 @@
'format' => 'raw',
'contentOptions' => ['class' => 'text-center'],
'headerOptions' => ['class' => 'text-center', 'style' => 'width:3%'],
- 'value' => \app\helpers\DepartmentGrid::checkbox("department")
+ 'value' => \app\helpers\CommonGrid::checkbox("department")
],
'code',
'name',
[
'attribute' => 'pid',
'filter' => $departmentArray,
- 'value' => \app\helpers\DepartmentGrid::pid($departmentArray)
+ 'value' => \app\helpers\CommonGrid::pid($departmentArray)
],
[
'attribute' => 'created_at',
- 'value' => \app\helpers\DepartmentGrid::createdAt()
+ 'value' => \app\helpers\CommonGrid::createdAt()
],
[
'attribute' => 'modified_at',
- 'value' => \app\helpers\DepartmentGrid::modifiedAt()
+ 'value' => \app\helpers\CommonGrid::modifiedAt()
]
]
])}
diff --git a/web/js/common.js b/web/js/common.js
index b0c10482..1e1c2ee6 100644
--- a/web/js/common.js
+++ b/web/js/common.js
@@ -172,6 +172,20 @@ common.dateTimePickerHour = function (id) {
format: 'HH:mm'
});
};
+common.dateTimePickerById = function (id, format) {
+ $('#' + id).datetimepicker({
+ locale: 'vi',
+ ignoreReadonly: true,
+ format: format
+ });
+};
+common.dateTimePickerByClass = function (cls, format) {
+ $('.' + cls).datetimepicker({
+ locale: 'vi',
+ ignoreReadonly: true,
+ format: format
+ });
+};
common.checkAll = function (id, cls) {
$('#' + id).on('ifChecked', function (event) {
$('.' + cls).iCheck('check');