From cb6c8fba328139040813449ebe71ac05c6813c8d Mon Sep 17 00:00:00 2001 From: dongpd Date: Tue, 29 Dec 2020 14:28:08 +0700 Subject: [PATCH] thay doi filter va Viet hoa --- controllers/ControlLogsController.php | 4 +++- controllers/ListManagementController.php | 4 +++- helpers/ListManagementGrid.php | 6 ++++++ models/CaptureLogs.php | 10 ++++----- models/ListManagement.php | 20 +++++++++--------- views/control-logs/index.tpl | 14 +++++++----- views/list-management/index.tpl | 27 ++++++++++++++---------- views/list-management/list-server.tpl | 6 +++--- views/list-management/list-to-server.tpl | 12 +++++------ views/list-management/list.tpl | 16 +++++++------- web/js/control-logs.js | 1 + web/js/list-management.js | 3 ++- 12 files changed, 72 insertions(+), 51 deletions(-) diff --git a/controllers/ControlLogsController.php b/controllers/ControlLogsController.php index bb530417..c209ae30 100644 --- a/controllers/ControlLogsController.php +++ b/controllers/ControlLogsController.php @@ -31,7 +31,7 @@ class ControlLogsController extends Controller { ]; } - public function actionIndex($from = "", $to = "", $name = "", $type = "all", $gender = "all") { + public function actionIndex($from = "", $to = "", $name = "", $type = "all", $gender = "all", $id = "") { $f = date_format(date_create_from_format('H:i d/m/Y', "00:00 " . date("d/m/Y")), 'U'); $t = date_format(date_create_from_format('H:i d/m/Y', "23:59 " . date("d/m/Y")), 'U'); if ($from !== "" && $to !== "") { @@ -44,6 +44,8 @@ class ControlLogsController extends Controller { $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->query->andWhere(["<>", "capture_logs.staff_id", 0]); $dataProvider->query->andWhere(["BETWEEN", "capture_logs.time", $f, $t]); + if ($id !== "") + $dataProvider->query->andWhere(["LIKE", "list_management.code", $id]); if ($name !== "") $dataProvider->query->andWhere(["LIKE", "list_management.name", $name]); if ($type !== "all") diff --git a/controllers/ListManagementController.php b/controllers/ListManagementController.php index f90aef18..e4e04d37 100644 --- a/controllers/ListManagementController.php +++ b/controllers/ListManagementController.php @@ -31,7 +31,7 @@ class ListManagementController extends Controller { ]; } - public function actionIndex($from = "", $to = "", $name = "", $type = "all", $gender = "all") { + public function actionIndex($from = "", $to = "", $name = "", $type = "all", $gender = "all", $id = "") { $f = date_format(date_create_from_format('H:i d/m/Y', "00:00 " . date("d/m/Y")), 'U'); $t = date_format(date_create_from_format('H:i d/m/Y', "23:59 " . date("d/m/Y")), 'U'); $this->view->title = "List management"; @@ -42,6 +42,8 @@ class ListManagementController extends Controller { $t = date_format(date_create_from_format('H:i d/m/Y', $to), 'U'); $dataProvider->query->andWhere(["BETWEEN", "time", $f, $t]); } + if ($id !== "") + $dataProvider->query->andWhere(["LIKE", "code", $id]); if ($name !== "") $dataProvider->query->andWhere(["LIKE", "name", $name]); if ($type !== "all") diff --git a/helpers/ListManagementGrid.php b/helpers/ListManagementGrid.php index 508f9bb3..bfb7d232 100644 --- a/helpers/ListManagementGrid.php +++ b/helpers/ListManagementGrid.php @@ -68,6 +68,12 @@ class ListManagementGrid { }; } + public static function gender($genderArray) { + return function($model) use ($genderArray) { + return $genderArray[$model->gender]; + }; + } + public static function rows() { return function($model, $index, $widget, $grid) { return [ diff --git a/models/CaptureLogs.php b/models/CaptureLogs.php index cd53141d..b36da7cf 100644 --- a/models/CaptureLogs.php +++ b/models/CaptureLogs.php @@ -41,14 +41,14 @@ class CaptureLogs extends \yii\db\ActiveRecord { public function attributeLabels() { return [ 'id' => 'ID', - 'time' => 'Time', - 'image' => 'Live Image', + 'time' => 'Thời gian', + 'image' => 'Hình ảnh', 'status' => 'Status', 'remark' => 'Remark', 'staff_name' => "Name", - 'staff_image' => "Registration Image", - 'confidence' => 'Confidence', - 'sync_status' => 'Sync Status' + 'staff_image' => "Hình ảnh đăng kí", + 'confidence' => 'Độ tin cậy', + 'sync_status' => 'Trạng thái đồng bộ' ]; } diff --git a/models/ListManagement.php b/models/ListManagement.php index 5e3fb1a2..696c507c 100644 --- a/models/ListManagement.php +++ b/models/ListManagement.php @@ -45,14 +45,14 @@ class ListManagement extends \yii\db\ActiveRecord { return [ 'id' => 'ID', 'code' => 'ID', - 'type' => 'Type', - 'name' => 'Name', - 'image' => 'Registration Image', - 'gender' => 'Gender', - 'birthday' => 'Birthday', - 'telephone' => 'Telephone', - 'address' => 'Department', - 'time' => 'Registration time', + 'type' => 'Loại', + 'name' => 'Tên', + 'image' => 'Hình ảnh đăng kí', + 'gender' => 'Giới tính', + 'birthday' => 'Ngày sinh', + 'telephone' => 'Điện thoại', + 'address' => 'Đơn vị', + 'time' => 'Thời gian đăng kí', 'last_modified' => 'Last Modified' ]; } @@ -85,8 +85,8 @@ class ListManagement extends \yii\db\ActiveRecord { "bl" => "Blacklist" ]; public static $genderArray = [ - "Male" => "Male", - "Female" => "Female" + "Male" => "Nam", + "Female" => "Nữ" ]; public static function nameArray() { diff --git a/views/control-logs/index.tpl b/views/control-logs/index.tpl index bcbc0a02..04756ed4 100644 --- a/views/control-logs/index.tpl +++ b/views/control-logs/index.tpl @@ -89,20 +89,24 @@
- + + +
+
+
- +
- +
diff --git a/views/list-management/index.tpl b/views/list-management/index.tpl index 5a08a032..8cd4f2e8 100644 --- a/views/list-management/index.tpl +++ b/views/list-management/index.tpl @@ -68,7 +68,8 @@ [ 'attribute' => 'gender', 'contentOptions' => ['class' => 'text-center'], - 'headerOptions' => ['class' => 'text-center'] + 'headerOptions' => ['class' => 'text-center'], + 'value' => \app\helpers\ListManagementGrid::gender($genderArray) ], [ 'attribute' => 'image', @@ -109,29 +110,33 @@

Tìm kiếm dữ liệu

-
- - + {*
+ +
- - + + +
*} +
+ +
- +
- +
- +
diff --git a/views/list-management/list-server.tpl b/views/list-management/list-server.tpl index f7512378..e6a6d685 100644 --- a/views/list-management/list-server.tpl +++ b/views/list-management/list-server.tpl @@ -3,9 +3,9 @@ ID - Name - Department - Registration Image + Tên + Đơn vị + Hình ảnh đăng kí Code Company ID diff --git a/views/list-management/list-to-server.tpl b/views/list-management/list-to-server.tpl index 90c4daca..fe1ff849 100644 --- a/views/list-management/list-to-server.tpl +++ b/views/list-management/list-to-server.tpl @@ -3,12 +3,12 @@ ID - Name - Gender - Registration Image - Birthday - Telephone - Department + Tên + Giới tính + Hình ảnh đăng kí + Ngày sinh + Điện thoại + Đơn vị diff --git a/views/list-management/list.tpl b/views/list-management/list.tpl index 28025dd2..265398b8 100644 --- a/views/list-management/list.tpl +++ b/views/list-management/list.tpl @@ -3,14 +3,14 @@ ID - Type - Name - Gender - Registration Image - Registration time - Birthday - Telephone - Department + Loại + Tên + Giới tính + Hình ảnh đăng kí + Thời gian đăng kí + Ngày sinh + Điện thoại + Đơn vị diff --git a/web/js/control-logs.js b/web/js/control-logs.js index 9713f1db..6b8701a8 100644 --- a/web/js/control-logs.js +++ b/web/js/control-logs.js @@ -4,6 +4,7 @@ $(function () { function _search(e) { var location = $(e).attr("data-href") + "?from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val(); + location = location + "&id=" + $("input[name='IDSearch']").val(); location = location + "&name=" + $("input[name='NameSearch']").val(); location = location + "&type=" + $("select[name='TypeSearch']").val(); location = location + "&gender=" + $("select[name='GenderSearch']").val(); diff --git a/web/js/list-management.js b/web/js/list-management.js index e80b1ff0..52f794e4 100644 --- a/web/js/list-management.js +++ b/web/js/list-management.js @@ -19,7 +19,8 @@ $(function () { }); function _search(e) { - var location = $(e).attr("data-href") + "?from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val(); + var location = $(e).attr("data-href");// + "?from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val(); + location = location + "?id=" + $("input[name='IDSearch']").val(); location = location + "&name=" + $("input[name='NameSearch']").val(); location = location + "&type=" + $("select[name='TypeSearch']").val(); location = location + "&gender=" + $("select[name='GenderSearch']").val();