update filter person loss image

This commit is contained in:
dongpd 2022-07-13 15:02:36 +07:00
parent 45c9a9f4f1
commit 4a08ad05df
7 changed files with 75 additions and 24 deletions

View File

@ -445,13 +445,15 @@ class ListManagementController extends Controller {
foreach ($datas['data'] as $key => $value) {
$filters[$value['id']] = $value['code'] . " - " . $value['name'] . " - " . $value['department'];
}
$deviceDatas = ListManagement::getAllID();
Yii::$app->response->format = "json";
return [
"title" => "<i class='fa fa-download'></i> " . Yii::t("app", "DONG_BO_TU_MAY_CHU"),
"form" => $this->renderPartial("list-server", [
"datas" => $datas['data'],
"filters" => $filters,
"allID" => ListManagement::getAllID()
"personImage" => $deviceDatas["imgCountArr"],
"allID" => $deviceDatas["idArr"]
])
];
}
@ -555,13 +557,13 @@ class ListManagementController extends Controller {
$model->image = json_encode($ft);
$model->last_modified = time();
$model->save();
// if ($totals <= 10)
// common::updateFeature([
// "cmd" => "update",
// "id" => $model->id,
// "name" => common::convert_vi_to_en($model->name),
// "features" => $model->allFeatures
// ]);
if ($totals <= 10)
common::updateFeature([
"cmd" => "update",
"id" => $model->id,
"name" => common::convert_vi_to_en($model->name),
"features" => $model->allFeatures
]);
} else {
if (isset($data['images'])) {
$extractFeature = $this->extractFeature($data['images'], $data['files_name'], $data['id']);
@ -587,13 +589,13 @@ class ListManagementController extends Controller {
]);
$finish = $this->getCurrentTime();
$processTime["insertDB"] = round(($finish - $start), 4);
// if ($totals <= 10)
// common::updateFeature([
// "cmd" => "create",
// "id" => $model->id,
// "name" => common::convert_vi_to_en($model->name),
// "features" => $model->allFeatures
// ]);
if ($totals <= 10)
common::updateFeature([
"cmd" => "create",
"id" => $model->id,
"name" => common::convert_vi_to_en($model->name),
"features" => $model->allFeatures
]);
}
$totalFinish = $this->getCurrentTime();
$processTime["total"] = round(($totalFinish - $totalStart), 4);

View File

@ -136,5 +136,6 @@ return [
"MAT_KHAU" => "Password",
"RESET_THIET_BI_LOI" => "Error connecting to the server. Please check your internet connection and try again.",
"THU_LAI" => "Try again",
"TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG" => "Incorrect username or password."
"TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG" => "Incorrect username or password.",
"DOI_TUONG_CHUA_DU_ANH_MAU" => "Object does not have enough images"
];

View File

@ -136,5 +136,6 @@ return [
"MAT_KHAU" => "パスワード",
"RESET_THIET_BI_LOI" => "サーバーへの接続中にエラーが発生しました。インターネット接続を確認して、もう一度お試しください",
"THU_LAI" => "再試行",
"TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG" => "ユーザーネームまたはパスワードが違います"
"TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG" => "ユーザーネームまたはパスワードが違います",
"DOI_TUONG_CHUA_DU_ANH_MAU" => "オブジェクトに十分な画像がありません"
];

View File

@ -136,5 +136,6 @@ return [
"MAT_KHAU" => "Mật khẩu",
"RESET_THIET_BI_LOI" => "Lỗi kết nối đến server. Hãy kiểm tra lại kết nối internet và thử lại.",
"THU_LAI" => "Thử lại",
"TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG" => "Tên đăng nhập hoặc mật khẩu không đúng."
"TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG" => "Tên đăng nhập hoặc mật khẩu không đúng.",
"DOI_TUONG_CHUA_DU_ANH_MAU" => "Đối tượng chưa đủ ảnh mẫu"
];

View File

@ -110,12 +110,18 @@ class ListManagement extends \yii\db\ActiveRecord {
}
public static function getAllID() {
$res = [];
$idArr = [];
$imgCountArr = [];
$ls = self::find()->all();
foreach ($ls as $key => $value) {
$res[] = $value->staff_id;
$idArr[] = $value->staff_id;
$images = json_decode($value->image, true);
$imgCountArr[$value->staff_id] = count($images);
}
return $res;
return [
"idArr" => $idArr,
"imgCountArr" => $imgCountArr
];
}
public static function staffArray() {

View File

@ -15,6 +15,11 @@
</div>
</div>
</div>
<div class="col-md-8 text-right">
<button class="btn btn-default btn-select" id="btnCheckLossImage" onclick="filtersLossImage(this);">
{Yii::t("app", "DOI_TUONG_CHUA_DU_ANH_MAU")}
</button>
</div>
</div>
<div style="max-height: 750px;overflow-y: auto;">
<table class="table table-bordered table-striped">
@ -29,8 +34,16 @@
</tr>
</thead>
<tbody id="sync-lists">
{$totalDevice=0}
{$totalCloud=0}
{foreach from=$datas item=arr}
<tr id="filters-{$arr.id}" onclick="choooseToSync(this);" style="cursor: pointer;" class="filters {if !in_array($arr.id,$allID)}not-in-list{/if}" data-stt="false" data-id="{trim($arr.id)}">
{$totalImg=0}
{if isset($personImage[$arr.id])}
{$totalImg=$personImage[$arr.id]}
{/if}
{$totalDevice=$totalDevice+$totalImg}
{$totalCloud=$totalCloud+count($arr.images)}
<tr id="filters-{$arr.id}" onclick="choooseToSync(this);" style="cursor: pointer;" class="filters {if $totalImg!==count($arr.images)}loss-image{/if} {if !in_array($arr.id,$allID)}not-in-list{/if}" data-stt="false" data-id="{trim($arr.id)}">
<td>
<div id="full-data-{trim($arr.id)}" class="hidden">{json_encode($arr)}</div>
{$arr.code}
@ -38,7 +51,11 @@
<i class="fa fa-check-circle text-green"></i>
{/if}
</td>
<td>{$arr.name}</td>
<td>
<b class="text-green">[{$totalImg}]</b>
<b class="text-red">[{count($arr.images)}]</b>
{$arr.name}
</td>
<td>{$arr.abbreviated_name}</td>
<td>{$arr.department}</td>
<td>
@ -56,6 +73,8 @@
</tbody>
</table>
</div>
<b class="text-green" id="totalDevice">[{$totalDevice}]</b>
<b class="text-red" id="totalCloud">[{$totalCloud}]</b>
<br>
<div class="row">
<div class="col-md-2">

View File

@ -361,6 +361,8 @@ function checkAllSync(stt) {
}
function checkAllNotInList() {
$(".filters").addClass("hidden");
$(".not-in-list").removeClass("hidden");
$("#sync-lists").find("tr").removeClass("success").attr("data-stt", "false");
$(".not-in-list").addClass("success").attr("data-stt", "true");
$("#totals-choose").html($(".not-in-list").length);
@ -431,6 +433,8 @@ function _syncFromServerForm(e) {
$("#filter-from-server").select2({
placeholder: $("input[name='TIM_KIEM_THEO_ID_HOAC_TEN']").val()
});
if (parseInt($("#totalDevice").html()) != parseInt($("#totalCloud").html()))
$("#btnCheckLossImage").addClass("hidden");
},
error: function (jqXHR, textStatus, errorThrown) {
common.modalBlock(false);
@ -650,3 +654,20 @@ function reGenFeature(e) {
}
});
}
function filtersLossImage(e) {
if ($(e).hasClass("btn-danger")) {
$(e).addClass("btn-default").removeClass("btn-danger");
$(".filters").removeClass("hidden");
$("#sync-lists").find("tr").removeClass("success").attr("data-stt", "false");
$("#totals-choose").html("0");
} else {
$(e).removeClass("btn-default").addClass("btn-danger");
$(".filters").addClass("hidden");
$(".loss-image").removeClass("hidden");
$("#sync-lists").find("tr").removeClass("success").attr("data-stt", "false");
$(".loss-image").addClass("success").attr("data-stt", "true");
$("#totals-choose").html($(".loss-image").length);
}
}