thay doi filter va Viet hoa

This commit is contained in:
dongpd 2020-12-29 14:28:08 +07:00
parent c9d0c24218
commit cb6c8fba32
12 changed files with 72 additions and 51 deletions

View File

@ -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")

View File

@ -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")

View File

@ -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 [

View File

@ -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ộ'
];
}

View File

@ -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() {

View File

@ -89,20 +89,24 @@
<input type="text" class="form-control datepicker" value="{$t|date_format:"H:i d/m/Y"}" name="To">
</div>
<div class="form-group">
<label class="control-label">Name</label>
<label class="control-label">ID</label>
<input type="text" class="form-control" value="{Yii::$app->request->get("id")}" name="IDSearch">
</div>
<div class="form-group">
<label class="control-label">Tên</label>
<input type="text" class="form-control" value="{Yii::$app->request->get("name")}" name="NameSearch">
</div>
<div class="form-group">
<label class="control-label">Type</label>
<label class="control-label">Loại</label>
<select class="form-control" name="TypeSearch">
<option value="all">All</option>
<option value="all">Tất cả</option>
{html_options options=$typeArray selected=Yii::$app->request->get("type")}
</select>
</div>
<div class="form-group">
<label class="control-label">Gender</label>
<label class="control-label">Giới tính</label>
<select class="form-control" name="GenderSearch">
<option value="all">All</option>
<option value="all">Tất cả</option>
{html_options options=$genderArray selected=Yii::$app->request->get("gender")}
</select>
</div>

View File

@ -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 @@
</div>
<div class="col-md-2" style="padding-right: 30px;">
<h4>Tìm kiếm dữ liệu</h4>
<div class="form-group">
<label class="control-label">Từ</label>
<input type="text" class="form-control datepicker" value="{$f|date_format:"H:i d/m/Y"}" name="From">
{*<div class="form-group">
<label class="control-label">Từ</label>
<input type="text" class="form-control datepicker" value="{$f|date_format:"H:i d/m/Y"}" name="From">
</div>
<div class="form-group">
<label class="control-label">Đến</label>
<input type="text" class="form-control datepicker" value="{$t|date_format:"H:i d/m/Y"}" name="To">
<label class="control-label">Đến</label>
<input type="text" class="form-control datepicker" value="{$t|date_format:"H:i d/m/Y"}" name="To">
</div>*}
<div class="form-group">
<label class="control-label">ID</label>
<input type="text" class="form-control" value="{Yii::$app->request->get("id")}" name="IDSearch">
</div>
<div class="form-group">
<label class="control-label">Name</label>
<label class="control-label">Tên</label>
<input type="text" class="form-control" value="{Yii::$app->request->get("name")}" name="NameSearch">
</div>
<div class="form-group">
<label class="control-label">Type</label>
<label class="control-label">Loại</label>
<select class="form-control" name="TypeSearch">
<option value="all">All</option>
<option value="all">Tất cả</option>
{html_options options=$typeArray selected=Yii::$app->request->get("type")}
</select>
</div>
<div class="form-group">
<label class="control-label">Gender</label>
<label class="control-label">Giới tính</label>
<select class="form-control" name="GenderSearch">
<option value="all">All</option>
<option value="all">Tất cả</option>
{html_options options=$genderArray selected=Yii::$app->request->get("gender")}
</select>
</div>

View File

@ -3,9 +3,9 @@
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Department</th>
<th>Registration Image</th>
<th>Tên</th>
<th>Đơn vị</th>
<th>Hình ảnh đăng kí</th>
<th>Code</th>
<th>Company ID</th>
</tr>

View File

@ -3,12 +3,12 @@
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Gender</th>
<th>Registration Image</th>
<th>Birthday</th>
<th>Telephone</th>
<th>Department</th>
<th>Tên</th>
<th>Giới tính</th>
<th>Hình ảnh đăng kí</th>
<th>Ngày sinh</th>
<th>Điện thoại</th>
<th>Đơn vị</th>
</tr>
</thead>
<tbody id="sync-lists">

View File

@ -3,14 +3,14 @@
<thead>
<tr>
<th>ID</th>
<th>Type</th>
<th>Name</th>
<th>Gender</th>
<th>Registration Image</th>
<th>Registration time</th>
<th>Birthday</th>
<th>Telephone</th>
<th>Department</th>
<th>Loại</th>
<th>Tên</th>
<th>Giới tính</th>
<th>Hình ảnh đăng kí</th>
<th>Thời gian đăng kí</th>
<th>Ngày sinh</th>
<th>Điện thoại</th>
<th>Đơn vị</th>
</tr>
</thead>
<tbody id="sync-lists">

View File

@ -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();

View File

@ -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();