Compare commits
1 Commits
BiFacePro2
...
dev_DTD_ol
| Author | SHA1 | Date | |
|---|---|---|---|
| b3bca79f55 |
@@ -84,7 +84,7 @@ class ApiController extends Controller {
|
|||||||
$ip = "https://dev-dc.beetai.com";
|
$ip = "https://dev-dc.beetai.com";
|
||||||
if ($server_ip)
|
if ($server_ip)
|
||||||
$ip = $server_ip->data;
|
$ip = $server_ip->data;
|
||||||
if ($this->is_connected() && $logs) {
|
if ($this->is_connected($ip) && $logs) {
|
||||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||||
$id_camera = 209;
|
$id_camera = 209;
|
||||||
if ($device_id)
|
if ($device_id)
|
||||||
@@ -104,7 +104,6 @@ class ApiController extends Controller {
|
|||||||
'camera_id' => strval($id_camera),
|
'camera_id' => strval($id_camera),
|
||||||
'frametime' => date("Y-m-d H:i:s", $time),
|
'frametime' => date("Y-m-d H:i:s", $time),
|
||||||
'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
|
'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
|
||||||
'idObject' => $staffInfo ? $staffInfo->staff_id : "",
|
|
||||||
"person_id" => "123",
|
"person_id" => "123",
|
||||||
"timezone" => "+7"
|
"timezone" => "+7"
|
||||||
])
|
])
|
||||||
@@ -237,7 +236,7 @@ class ApiController extends Controller {
|
|||||||
$str = preg_replace("/(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)/", "U", $str);
|
$str = preg_replace("/(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)/", "U", $str);
|
||||||
$str = preg_replace("/(Ỳ|Ý|Ỵ|Ỷ|Ỹ)/", "Y", $str);
|
$str = preg_replace("/(Ỳ|Ý|Ỵ|Ỷ|Ỹ)/", "Y", $str);
|
||||||
$str = preg_replace("/(Đ)/", "D", $str);
|
$str = preg_replace("/(Đ)/", "D", $str);
|
||||||
//$str = str_replace(" ", "-", str_replace("&*#39;","",$str));
|
//$str = str_replace(" ", "-", str_replace("&*#39;","",$str));
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,7 +353,6 @@ class ApiController extends Controller {
|
|||||||
'camera_id' => strval($id_camera),
|
'camera_id' => strval($id_camera),
|
||||||
'frametime' => date("Y-m-d H:i:s", $value->time),
|
'frametime' => date("Y-m-d H:i:s", $value->time),
|
||||||
'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
|
'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
|
||||||
'idObject' => $staffInfo ? $staffInfo->staff_id : "",
|
|
||||||
"person_id" => "123",
|
"person_id" => "123",
|
||||||
"timezone" => "+7"
|
"timezone" => "+7"
|
||||||
])
|
])
|
||||||
@@ -371,7 +369,7 @@ class ApiController extends Controller {
|
|||||||
|
|
||||||
function is_connected($ip = "google.com") {
|
function is_connected($ip = "google.com") {
|
||||||
$connected = @fsockopen($ip, 80);
|
$connected = @fsockopen($ip, 80);
|
||||||
//website, port (try 80 or 443)
|
//website, port (try 80 or 443)
|
||||||
if ($connected) {
|
if ($connected) {
|
||||||
$is_conn = true; //action when connected
|
$is_conn = true; //action when connected
|
||||||
fclose($connected);
|
fclose($connected);
|
||||||
@@ -491,9 +489,9 @@ class ApiController extends Controller {
|
|||||||
if ($this->check512()) {
|
if ($this->check512()) {
|
||||||
$currentCache = json_decode(file_get_contents("http://localhost:2305/current-cache"), true);
|
$currentCache = json_decode(file_get_contents("http://localhost:2305/current-cache"), true);
|
||||||
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
||||||
$updating->data = "true";
|
$updating->data = "true";
|
||||||
} else {
|
} else {
|
||||||
$updating->data = "false";
|
$updating->data = "false";
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
$updating->data = "false";
|
$updating->data = "false";
|
||||||
@@ -503,188 +501,4 @@ class ApiController extends Controller {
|
|||||||
return ["data" => "reset updating flag"];
|
return ["data" => "reset updating flag"];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionCheckLogs() {
|
|
||||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
|
||||||
$ip = "https://dev-dc.beetai.com";
|
|
||||||
if ($server_ip)
|
|
||||||
$ip = $server_ip->data;
|
|
||||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
|
||||||
$id_camera = 209;
|
|
||||||
if ($device_id)
|
|
||||||
$id_camera = intval($device_id->data);
|
|
||||||
|
|
||||||
$datas = json_decode(file_get_contents($ip . "/api/model/get_log_model", false, stream_context_create([
|
|
||||||
'http' => [
|
|
||||||
'header' => "Content-Type: application/json",
|
|
||||||
'method' => "POST",
|
|
||||||
'content' => json_encode([
|
|
||||||
"idCamera" => $id_camera
|
|
||||||
])
|
|
||||||
]
|
|
||||||
])), true);
|
|
||||||
if ($datas['status'] == 10000) {
|
|
||||||
$logs = $datas['data'];
|
|
||||||
$infomation = [];
|
|
||||||
foreach ($logs as $key => $value) {
|
|
||||||
if ($value['action'] == "insert_image")
|
|
||||||
$this->insertImage($value['images'][0], $value['id'], $value['files_name'][0]);
|
|
||||||
|
|
||||||
if ($value['action'] == "remove_image")
|
|
||||||
$this->removeImage($value['id'], $value['files_name'][0]);
|
|
||||||
|
|
||||||
if ($value['action'] == "insert_info")
|
|
||||||
$this->insertInfo($value);
|
|
||||||
|
|
||||||
if ($value['action'] == "remove_info")
|
|
||||||
$this->removeInfo($value);
|
|
||||||
|
|
||||||
if ($value['action'] == "reset_all") {
|
|
||||||
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
|
||||||
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
|
||||||
array_map('unlink', glob("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/*.*"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (in_array($value['action'], ['insert_image', 'remove_image', 'insert_info', 'remove_info', 'reset_all'])) {
|
|
||||||
$infomation[] = [
|
|
||||||
"obj_Log" => $value['obj_Log'],
|
|
||||||
"action" => $value['action'],
|
|
||||||
"idCamera" => $id_camera
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (count($infomation) > 0)
|
|
||||||
file_get_contents($ip . "/api/model/set_log_model", false, stream_context_create([
|
|
||||||
'http' => [
|
|
||||||
'header' => "Content-Type: application/json",
|
|
||||||
'method' => "POST",
|
|
||||||
'content' => json_encode([
|
|
||||||
"infomation" => $infomation
|
|
||||||
])
|
|
||||||
]
|
|
||||||
]));
|
|
||||||
file_get_contents("http://localhost:2305/update-feature?total=" . ListManagement::find()->count());
|
|
||||||
}
|
|
||||||
Yii::$app->response->format = "json";
|
|
||||||
return ["data" => "check logs"];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function insertImage($image, $staff_id, $files_name) {
|
|
||||||
$model = ListManagement::findOne(['staff_id' => $staff_id]);
|
|
||||||
|
|
||||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
|
||||||
$targetPath = $RootFolder . "/face";
|
|
||||||
FileHelper::createDirectory($targetPath, 0777);
|
|
||||||
$ft = [];
|
|
||||||
$currentArr = [];
|
|
||||||
$currentImg = json_decode($model->image, true);
|
|
||||||
if ($currentImg) {
|
|
||||||
foreach ($currentImg as $key => $value) {
|
|
||||||
if (isset($value['serverKey']))
|
|
||||||
$currentArr[] = $value['serverKey'];
|
|
||||||
}
|
|
||||||
$ft = $currentImg;
|
|
||||||
}
|
|
||||||
if (!in_array($files_name, $currentArr)) {
|
|
||||||
$fileName = "face_" . $staff_id . "_" . common::generateRandomString() . "_" . time() . ".png";
|
|
||||||
$img = false;
|
|
||||||
try {
|
|
||||||
$img = file_get_contents(str_replace("&", "&", $image));
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if ($img && $img !== "null") {
|
|
||||||
$fileTarget = $targetPath . "/" . $fileName;
|
|
||||||
if (!$this->resizeImg($img, $fileTarget)) {
|
|
||||||
file_put_contents($fileTarget, $img);
|
|
||||||
}
|
|
||||||
$features = json_decode(common::requestToEngine("/get-feature", [
|
|
||||||
"image_paths" => [
|
|
||||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
|
||||||
],
|
|
||||||
"type" => "128"
|
|
||||||
]), true);
|
|
||||||
$ft[] = [
|
|
||||||
"serverKey" => $files_name,
|
|
||||||
"url" => $fileName,
|
|
||||||
"urlOld" => $fileName,
|
|
||||||
"features" => $features['results'][0]['feature'],
|
|
||||||
"features512" => []
|
|
||||||
];
|
|
||||||
$model->image = json_encode($ft);
|
|
||||||
$model->last_modified = time();
|
|
||||||
$model->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeImage($staff_id, $files_name) {
|
|
||||||
$model = ListManagement::findOne(['staff_id' => $staff_id]);
|
|
||||||
$images = json_decode($model->image, true);
|
|
||||||
$ft = [];
|
|
||||||
foreach ($images as $key => $value) {
|
|
||||||
if ($value['serverKey'] !== $files_name)
|
|
||||||
$ft[] = $value;
|
|
||||||
else
|
|
||||||
unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']);
|
|
||||||
}
|
|
||||||
$model->image = json_encode($ft);
|
|
||||||
$model->last_modified = time();
|
|
||||||
$model->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function insertInfo($data) {
|
|
||||||
$model = ListManagement::findOne(['staff_id' => $data['id']]);
|
|
||||||
if ($model) {
|
|
||||||
$model->name = $data['name'];
|
|
||||||
$model->abbreviated_name = $data['abbreviated_name'];
|
|
||||||
$model->code = $data['code'];
|
|
||||||
$model->address = $data['department'];
|
|
||||||
$model->last_modified = time();
|
|
||||||
$model->save();
|
|
||||||
} else {
|
|
||||||
$model = new ListManagement();
|
|
||||||
$model->create([
|
|
||||||
'staff_id' => $data['id'],
|
|
||||||
'code' => $data['code'],
|
|
||||||
'type' => 'wl',
|
|
||||||
'name' => $data['name'],
|
|
||||||
'image' => json_encode([]),
|
|
||||||
'gender' => "Male",
|
|
||||||
'birthday' => "",
|
|
||||||
'telephone' => "",
|
|
||||||
'address' => $data['department'],
|
|
||||||
'abbreviated_name' => $data['abbreviated_name'],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeInfo($data) {
|
|
||||||
$model = ListManagement::findOne(['staff_id' => $data['id']]);
|
|
||||||
if ($model) {
|
|
||||||
$images = json_decode($model->image, true);
|
|
||||||
foreach ($images as $k => $v) {
|
|
||||||
unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $v['url']);
|
|
||||||
}
|
|
||||||
$model->delete();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function resizeImg($img, $fileTarget) {
|
|
||||||
$im = imagecreatefromstring($img);
|
|
||||||
$width = imagesx($im);
|
|
||||||
$height = imagesy($im);
|
|
||||||
$newwidth = 224;
|
|
||||||
$newheight = 224;
|
|
||||||
if ($width > $newwidth && $height > $newheight) {
|
|
||||||
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
|
||||||
imagecopyresized($thumb, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
|
||||||
imagejpeg($thumb, $fileTarget);
|
|
||||||
imagedestroy($thumb);
|
|
||||||
imagedestroy($im);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,28 +340,6 @@ class ConfigController extends Controller {
|
|||||||
file_get_contents("http://localhost:2305/update-feature");
|
file_get_contents("http://localhost:2305/update-feature");
|
||||||
} catch (\Exception $exc) {
|
} catch (\Exception $exc) {
|
||||||
|
|
||||||
}
|
|
||||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
|
||||||
$ip = "https://dev-dc.beetai.com";
|
|
||||||
if ($server_ip)
|
|
||||||
$ip = $server_ip->data;
|
|
||||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
|
||||||
$id_camera = 209;
|
|
||||||
if ($device_id)
|
|
||||||
$id_camera = intval($device_id->data);
|
|
||||||
try {
|
|
||||||
file_get_contents($ip . "/api/model/reset_log_model", false, stream_context_create([
|
|
||||||
'http' => [
|
|
||||||
'header' => "Content-Type: application/json",
|
|
||||||
'method' => "POST",
|
|
||||||
'content' => json_encode([
|
|
||||||
"idCamera" => $id_camera,
|
|
||||||
"isCloud" => 0
|
|
||||||
])
|
|
||||||
]
|
|
||||||
]));
|
|
||||||
} catch (Exception $ex) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Url::to(['/config']);
|
return Url::to(['/config']);
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ class ListManagementController extends Controller {
|
|||||||
];
|
];
|
||||||
$listManagement->type = $data['type'];
|
$listManagement->type = $data['type'];
|
||||||
$listManagement->name = $data['name'];
|
$listManagement->name = $data['name'];
|
||||||
$listManagement->abbreviated_name = $data['abbreviated_name'];
|
|
||||||
$listManagement->gender = $data['gender'];
|
$listManagement->gender = $data['gender'];
|
||||||
$listManagement->birthday = $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U');
|
$listManagement->birthday = $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U');
|
||||||
$listManagement->telephone = $data['telephone'];
|
$listManagement->telephone = $data['telephone'];
|
||||||
@@ -207,7 +206,6 @@ class ListManagementController extends Controller {
|
|||||||
"type" => $ListManagement->type,
|
"type" => $ListManagement->type,
|
||||||
"code" => $ListManagement->code,
|
"code" => $ListManagement->code,
|
||||||
"name" => $ListManagement->name,
|
"name" => $ListManagement->name,
|
||||||
"abbreviated_name" => $ListManagement->abbreviated_name,
|
|
||||||
"gender" => $ListManagement->gender,
|
"gender" => $ListManagement->gender,
|
||||||
"birthday" => date("d/m/Y", $ListManagement->birthday),
|
"birthday" => date("d/m/Y", $ListManagement->birthday),
|
||||||
"telephone" => $ListManagement->telephone,
|
"telephone" => $ListManagement->telephone,
|
||||||
@@ -252,7 +250,6 @@ class ListManagementController extends Controller {
|
|||||||
$model->code = $data['code'];
|
$model->code = $data['code'];
|
||||||
$model->type = $data['type'];
|
$model->type = $data['type'];
|
||||||
$model->name = $data['name'];
|
$model->name = $data['name'];
|
||||||
$model->abbreviated_name = $data['abbreviated_name'];
|
|
||||||
$model->gender = $data['gender'];
|
$model->gender = $data['gender'];
|
||||||
$model->birthday = $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U');
|
$model->birthday = $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U');
|
||||||
$model->telephone = $data['telephone'];
|
$model->telephone = $data['telephone'];
|
||||||
@@ -417,14 +414,13 @@ class ListManagementController extends Controller {
|
|||||||
'method' => "POST",
|
'method' => "POST",
|
||||||
'content' => json_encode([
|
'content' => json_encode([
|
||||||
"id_camera" => $id_camera,
|
"id_camera" => $id_camera,
|
||||||
"ids_staff" => [],
|
"ids_staff" => []
|
||||||
"objs_staff" => []
|
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
])), true);
|
])), true);
|
||||||
$filters = [];
|
$filters = [];
|
||||||
foreach ($datas['data'] as $key => $value) {
|
foreach ($datas['data'] as $key => $value) {
|
||||||
$filters[$value['id']] = $value['code'] . " - " . $value['name'] . " - " . $value['department'];
|
$filters[$value['code']] = $value['code'] . " - " . $value['name'] . " - " . $value['department'];
|
||||||
}
|
}
|
||||||
Yii::$app->response->format = "json";
|
Yii::$app->response->format = "json";
|
||||||
return [
|
return [
|
||||||
@@ -444,115 +440,107 @@ class ListManagementController extends Controller {
|
|||||||
return $time[1] + $time[0];
|
return $time[1] + $time[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function extractFeature($images, $files_name, $staff_id, $currentImg = false) {
|
|
||||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
|
||||||
$targetPath = $RootFolder . "/face";
|
|
||||||
FileHelper::createDirectory($targetPath, 0777);
|
|
||||||
$extractFeature = [];
|
|
||||||
$ft = [];
|
|
||||||
$currentArr = [];
|
|
||||||
if ($currentImg) {
|
|
||||||
foreach ($currentImg as $key => $value) {
|
|
||||||
if (isset($value['serverKey']))
|
|
||||||
$currentArr[] = $value['serverKey'];
|
|
||||||
}
|
|
||||||
$ft = $currentImg;
|
|
||||||
}
|
|
||||||
foreach ($images as $key => $value) {
|
|
||||||
if ($key < Yii::$app->params['maxPicture'] && !in_array($files_name[$key], $currentArr)) {
|
|
||||||
$fileName = "face_" . $staff_id . "_" . common::generateRandomString() . "_" . time() . ".png";
|
|
||||||
$start = $this->getCurrentTime();
|
|
||||||
$img = false;
|
|
||||||
try {
|
|
||||||
$img = file_get_contents(str_replace("&", "&", $value));
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
$finish = $this->getCurrentTime();
|
|
||||||
$temp["getIMG"] = round(($finish - $start), 4);
|
|
||||||
if ($img && $img !== "null") {
|
|
||||||
$fileTarget = $targetPath . "/" . $fileName;
|
|
||||||
$start = $this->getCurrentTime();
|
|
||||||
if (!$this->resizeImg($img, $fileTarget)) {
|
|
||||||
file_put_contents($fileTarget, $img);
|
|
||||||
}
|
|
||||||
$finish = $this->getCurrentTime();
|
|
||||||
$temp["saveIMG"] = round(($finish - $start), 4);
|
|
||||||
$start = $this->getCurrentTime();
|
|
||||||
$features = json_decode(common::requestToEngine("/get-feature", [
|
|
||||||
"image_paths" => [
|
|
||||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
|
||||||
],
|
|
||||||
"type" => "128"
|
|
||||||
]), true);
|
|
||||||
$finish = $this->getCurrentTime();
|
|
||||||
$temp["extract"] = round(($finish - $start), 4);
|
|
||||||
$ft[] = [
|
|
||||||
"serverKey" => $files_name[$key],
|
|
||||||
"url" => $fileName,
|
|
||||||
"urlOld" => $fileName,
|
|
||||||
"features" => $features['results'][0]['feature'],
|
|
||||||
"features512" => []//isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : []
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$extractFeature[] = $temp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [
|
|
||||||
"time" => $extractFeature,
|
|
||||||
"features" => $ft
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function actionSyncFeature() {
|
public function actionSyncFeature() {
|
||||||
if (Yii::$app->request->post()) {
|
if (Yii::$app->request->post()) {
|
||||||
Yii::$app->response->format = "json";
|
Yii::$app->response->format = "json";
|
||||||
$processTime = [];
|
$processTime = [];
|
||||||
$totalStart = $this->getCurrentTime();
|
$totalStart = $this->getCurrentTime();
|
||||||
$totals = intval(Yii::$app->request->post("totals"));
|
$totals = intval(Yii::$app->request->post("totals"));
|
||||||
|
// $server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||||
|
// $ip = "https://dev-dc.beetai.com";
|
||||||
|
// if ($server_ip)
|
||||||
|
// $ip = $server_ip->data;
|
||||||
|
// $device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||||
|
// $id_camera = 209;
|
||||||
|
// if ($device_id)
|
||||||
|
// $id_camera = intval($device_id->data);
|
||||||
|
// $start = $this->getCurrentTime();
|
||||||
|
// $res = json_decode(file_get_contents($ip . "/api/oem/get_all_image", false, stream_context_create([
|
||||||
|
// 'http' => [
|
||||||
|
// 'header' => "Content-Type: application/json",
|
||||||
|
// 'method' => "POST",
|
||||||
|
// 'content' => json_encode([
|
||||||
|
// "id_camera" => $id_camera,
|
||||||
|
// "ids_staff" => [strval(Yii::$app->request->post("id"))]
|
||||||
|
// ])
|
||||||
|
// ]
|
||||||
|
// ])), true);
|
||||||
|
// $finish = $this->getCurrentTime();
|
||||||
|
// $processTime["requestToAPI"] = round(($finish - $start), 4);
|
||||||
|
|
||||||
$data = Yii::$app->request->post("id"); //$res['data'][0];
|
$data = Yii::$app->request->post("id"); //$res['data'][0];
|
||||||
|
$ft = [];
|
||||||
|
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||||
|
$targetPath = $RootFolder . "/face";
|
||||||
|
FileHelper::createDirectory($targetPath, 0777);
|
||||||
|
$extractFeature = [];
|
||||||
|
if (isset($data['images'])) {
|
||||||
|
foreach ($data['images'] as $key => $value) {
|
||||||
|
if ($key < Yii::$app->params['maxPicture']) {
|
||||||
|
$fileName = "face_" . common::generateRandomString() . "_" . time() . ".png";
|
||||||
|
$start = $this->getCurrentTime();
|
||||||
|
$img = false;
|
||||||
|
try {
|
||||||
|
$img = file_get_contents(str_replace("&", "&", $value));
|
||||||
|
// $img = file_get_contents($value);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
$finish = $this->getCurrentTime();
|
||||||
|
$temp["getIMG"] = round(($finish - $start), 4);
|
||||||
|
if ($img && $img !== "null") {
|
||||||
|
$fileTarget = $targetPath . "/" . $fileName;
|
||||||
|
$start = $this->getCurrentTime();
|
||||||
|
if (!$this->resizeImg($img, $fileTarget)) {
|
||||||
|
file_put_contents($fileTarget, $img);
|
||||||
|
}
|
||||||
|
$finish = $this->getCurrentTime();
|
||||||
|
$temp["saveIMG"] = round(($finish - $start), 4);
|
||||||
|
$start = $this->getCurrentTime();
|
||||||
|
$features = json_decode(common::requestToEngine("/get-feature", [
|
||||||
|
"image_paths" => [
|
||||||
|
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
||||||
|
],
|
||||||
|
"type" => "128"
|
||||||
|
]), true);
|
||||||
|
$finish = $this->getCurrentTime();
|
||||||
|
$temp["extract"] = round(($finish - $start), 4);
|
||||||
|
$ft[] = [
|
||||||
|
"url" => $fileName,
|
||||||
|
"urlOld" => $fileName,
|
||||||
|
"features" => $features['results'][0]['feature'],
|
||||||
|
"features512" => []//isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$extractFeature[] = $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$processTime["extractFeature"] = $extractFeature;
|
||||||
$start = $this->getCurrentTime();
|
$start = $this->getCurrentTime();
|
||||||
$model = ListManagement::findOne(['staff_id' => $data['id']]);
|
$model = ListManagement::findOne(['code' => $data['idStaff']]);
|
||||||
$finish = $this->getCurrentTime();
|
$finish = $this->getCurrentTime();
|
||||||
$processTime["getLM"] = round(($finish - $start), 4);
|
$processTime["getLM"] = round(($finish - $start), 4);
|
||||||
$ft = [];
|
|
||||||
if ($model) {
|
if ($model) {
|
||||||
if (isset($data['images'])) {
|
|
||||||
$extractFeature = $this->extractFeature($data['images'], $data['files_name'], $data['id'], json_decode($model->image, true));
|
|
||||||
$processTime["extractFeature"] = $extractFeature['time'];
|
|
||||||
$ft = $extractFeature['features'];
|
|
||||||
}
|
|
||||||
$model->abbreviated_name = $data['abbreviated_name'];
|
|
||||||
$model->code = $data['code'];
|
|
||||||
$model->name = $data['name'];
|
$model->name = $data['name'];
|
||||||
$model->address = $data['department'];
|
$model->address = $data['department'];
|
||||||
$model->image = json_encode($ft);
|
$model->image = json_encode($ft);
|
||||||
$model->last_modified = time();
|
$model->last_modified = time();
|
||||||
$model->save();
|
$model->save();
|
||||||
// if ($totals <= 10)
|
if ($totals <= 10)
|
||||||
// common::updateFeature([
|
common::updateFeature([
|
||||||
// "cmd" => "update",
|
"cmd" => "update",
|
||||||
// "id" => $model->id,
|
"id" => $model->id,
|
||||||
// "name" => common::convert_vi_to_en($model->name),
|
"name" => common::convert_vi_to_en($model->name),
|
||||||
// "features" => $model->allFeatures
|
"features" => $model->allFeatures
|
||||||
// ]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
if (isset($data['images'])) {
|
|
||||||
$extractFeature = $this->extractFeature($data['images'], $data['files_name'], $data['id']);
|
|
||||||
$processTime["extractFeature"] = $extractFeature['time'];
|
|
||||||
$ft = $extractFeature['features'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$start = $this->getCurrentTime();
|
$start = $this->getCurrentTime();
|
||||||
$model = new ListManagement();
|
$model = new ListManagement();
|
||||||
$model->create([
|
$model->create([
|
||||||
'code' => strval($data['code']),
|
'code' => strval($data['idStaff']),
|
||||||
'type' => "wl",
|
'type' => "wl",
|
||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
'abbreviated_name' => $data['abbreviated_name'],
|
|
||||||
'staff_id' => $data['id'],
|
|
||||||
'image' => json_encode($ft),
|
'image' => json_encode($ft),
|
||||||
'gender' => "Male",
|
'gender' => "Male",
|
||||||
'birthday' => "",
|
'birthday' => "",
|
||||||
@@ -561,17 +549,17 @@ class ListManagementController extends Controller {
|
|||||||
]);
|
]);
|
||||||
$finish = $this->getCurrentTime();
|
$finish = $this->getCurrentTime();
|
||||||
$processTime["insertDB"] = round(($finish - $start), 4);
|
$processTime["insertDB"] = round(($finish - $start), 4);
|
||||||
// if ($totals <= 10)
|
if ($totals <= 10)
|
||||||
// common::updateFeature([
|
common::updateFeature([
|
||||||
// "cmd" => "create",
|
"cmd" => "create",
|
||||||
// "id" => $model->id,
|
"id" => $model->id,
|
||||||
// "name" => common::convert_vi_to_en($model->name),
|
"name" => common::convert_vi_to_en($model->name),
|
||||||
// "features" => $model->allFeatures
|
"features" => $model->allFeatures
|
||||||
// ]);
|
]);
|
||||||
}
|
}
|
||||||
$totalFinish = $this->getCurrentTime();
|
$totalFinish = $this->getCurrentTime();
|
||||||
$processTime["total"] = round(($totalFinish - $totalStart), 4);
|
$processTime["total"] = round(($totalFinish - $totalStart), 4);
|
||||||
$processTime["id"] = strval($data['code']);
|
$processTime["id"] = strval($data['idStaff']);
|
||||||
return $processTime; //["status" => true];
|
return $processTime; //["status" => true];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -668,8 +656,7 @@ class ListManagementController extends Controller {
|
|||||||
"gender" => $staff->gender,
|
"gender" => $staff->gender,
|
||||||
"birthday" => date("d/m/Y", $staff->birthday),
|
"birthday" => date("d/m/Y", $staff->birthday),
|
||||||
"telephone" => $staff->telephone,
|
"telephone" => $staff->telephone,
|
||||||
"department" => $staff->address,
|
"department" => $staff->address
|
||||||
"abbreviated_name" => $staff->abbreviated_name
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -680,7 +667,7 @@ class ListManagementController extends Controller {
|
|||||||
$datas = ListManagement::find()->orderBy(["code" => SORT_ASC])->all();
|
$datas = ListManagement::find()->orderBy(["code" => SORT_ASC])->all();
|
||||||
$filters = [];
|
$filters = [];
|
||||||
foreach ($datas as $key => $value) {
|
foreach ($datas as $key => $value) {
|
||||||
$filters[$value->staff_id] = $value->code . " - " . $value->name . " - " . $value->address;
|
$filters[$value->code] = $value->code . " - " . $value->name . " - " . $value->address;
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
"title" => "<i class='fa fa-upload'></i> Đồng bộ lên máy chủ",
|
"title" => "<i class='fa fa-upload'></i> Đồng bộ lên máy chủ",
|
||||||
@@ -704,25 +691,18 @@ class ListManagementController extends Controller {
|
|||||||
if ($device_id)
|
if ($device_id)
|
||||||
$id_camera = intval($device_id->data);
|
$id_camera = intval($device_id->data);
|
||||||
|
|
||||||
$StaffInfo = ListManagement::findOne(["staff_id" => Yii::$app->request->post("id")]);
|
$StaffInfo = ListManagement::findOne(["code" => Yii::$app->request->post("id")]);
|
||||||
$lsImgs = json_decode($StaffInfo->image, true);
|
$lsImgs = json_decode($StaffInfo->image, true);
|
||||||
$images = [];
|
$images = [];
|
||||||
foreach ($lsImgs as $key => $value) {
|
foreach ($lsImgs as $key => $value) {
|
||||||
if (!isset($value['serverKey']) || (isset($value['serverKey']) && $value['serverKey'] == "")) {
|
try {
|
||||||
try {
|
$images[] = base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']));
|
||||||
$images[] = base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']));
|
} catch (\Exception $e) {
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($images) == 0)
|
|
||||||
return ["status" => true, "text" => "Dữ liệu không đổi"];
|
|
||||||
|
|
||||||
$items = [
|
$items = [
|
||||||
"id" => $StaffInfo->staff_id,
|
|
||||||
"name" => $StaffInfo->name,
|
"name" => $StaffInfo->name,
|
||||||
"abbreviated_name" => $StaffInfo->abbreviated_name,
|
|
||||||
"code" => $StaffInfo->code,
|
"code" => $StaffInfo->code,
|
||||||
"department" => $StaffInfo->address,
|
"department" => $StaffInfo->address,
|
||||||
"birthday" => date("Y-m-d", $StaffInfo->birthday),
|
"birthday" => date("Y-m-d", $StaffInfo->birthday),
|
||||||
@@ -742,14 +722,6 @@ class ListManagementController extends Controller {
|
|||||||
])
|
])
|
||||||
]
|
]
|
||||||
])), true);
|
])), true);
|
||||||
if ($res['status'] == 10000) {
|
|
||||||
$resData = $res['data'];
|
|
||||||
for ($i = 0; $i < count($lsImgs); $i++) {
|
|
||||||
$lsImgs[$i]['serverKey'] = isset($resData[$i]) ? $resData[$i] : "";
|
|
||||||
}
|
|
||||||
$StaffInfo->image = json_encode($lsImgs);
|
|
||||||
$StaffInfo->save();
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class CaptureLogsGrid {
|
|||||||
public static function rows() {
|
public static function rows() {
|
||||||
return function($model, $index, $widget, $grid) {
|
return function($model, $index, $widget, $grid) {
|
||||||
$confidence = json_decode($model->confidence, true);
|
$confidence = json_decode($model->confidence, true);
|
||||||
$person = \app\models\ListManagement::findOne($confidence['id1']);
|
$person = isset($confidence['id1']) ? \app\models\ListManagement::findOne($confidence['id1']) : false;
|
||||||
$images = false;
|
$images = false;
|
||||||
if ($person) {
|
if ($person) {
|
||||||
$images = json_decode($person->image, true);
|
$images = json_decode($person->image, true);
|
||||||
@@ -110,7 +110,7 @@ class CaptureLogsGrid {
|
|||||||
"img" => "/data/uploads/face/" . $model->image,
|
"img" => "/data/uploads/face/" . $model->image,
|
||||||
"confidence" => json_encode([
|
"confidence" => json_encode([
|
||||||
"name" => $person ? $person->name : "",
|
"name" => $person ? $person->name : "",
|
||||||
"score" => $confidence['percent1'],
|
"score" => isset($confidence['percent1']) ? $confidence['percent1'] : "",
|
||||||
"img" => isset($images[0]) ? "/data/uploads/face/" . $images[0]['url'] : ""
|
"img" => isset($images[0]) ? "/data/uploads/face/" . $images[0]['url'] : ""
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -8,11 +8,9 @@ use Yii;
|
|||||||
* This is the model class for table "list_management".
|
* This is the model class for table "list_management".
|
||||||
*
|
*
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $staff_id
|
|
||||||
* @property string $code
|
* @property string $code
|
||||||
* @property string $type
|
* @property string $type
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $abbreviated_name
|
|
||||||
* @property string $image
|
* @property string $image
|
||||||
* @property string $gender
|
* @property string $gender
|
||||||
* @property int $birthday
|
* @property int $birthday
|
||||||
@@ -35,7 +33,7 @@ class ListManagement extends \yii\db\ActiveRecord {
|
|||||||
*/
|
*/
|
||||||
public function rules() {
|
public function rules() {
|
||||||
return [
|
return [
|
||||||
[['type', 'name', 'gender', 'telephone', 'address', 'image', 'code', 'abbreviated_name', 'staff_id'], 'string'],
|
[['type', 'name', 'gender', 'telephone', 'address', 'image', 'code'], 'string'],
|
||||||
[['birthday', 'time', 'last_modified'], 'integer'],
|
[['birthday', 'time', 'last_modified'], 'integer'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -55,15 +53,12 @@ class ListManagement extends \yii\db\ActiveRecord {
|
|||||||
'telephone' => 'Điện thoại',
|
'telephone' => 'Điện thoại',
|
||||||
'address' => 'Đơn vị',
|
'address' => 'Đơn vị',
|
||||||
'time' => 'Thời gian đăng kí',
|
'time' => 'Thời gian đăng kí',
|
||||||
'last_modified' => 'Last Modified',
|
'last_modified' => 'Last Modified'
|
||||||
'abbreviated_name' => 'Tên hiển thị',
|
|
||||||
'staff_id' => 'ID'
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create($data) {
|
public function create($data) {
|
||||||
$r = $this->load([
|
$r = $this->load([
|
||||||
'staff_id' => $data['staff_id'],
|
|
||||||
'code' => $data['code'],
|
'code' => $data['code'],
|
||||||
'type' => $data['type'],
|
'type' => $data['type'],
|
||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
@@ -72,7 +67,6 @@ class ListManagement extends \yii\db\ActiveRecord {
|
|||||||
'birthday' => $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U'),
|
'birthday' => $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U'),
|
||||||
'telephone' => $data['telephone'],
|
'telephone' => $data['telephone'],
|
||||||
'address' => $data['address'],
|
'address' => $data['address'],
|
||||||
'abbreviated_name' => $data['abbreviated_name'],
|
|
||||||
'time' => time(),
|
'time' => time(),
|
||||||
'last_modified' => time()
|
'last_modified' => time()
|
||||||
], '');
|
], '');
|
||||||
@@ -108,7 +102,7 @@ class ListManagement extends \yii\db\ActiveRecord {
|
|||||||
$res = [];
|
$res = [];
|
||||||
$ls = self::find()->all();
|
$ls = self::find()->all();
|
||||||
foreach ($ls as $key => $value) {
|
foreach ($ls as $key => $value) {
|
||||||
$res[] = $value->staff_id;
|
$res[] = $value->code;
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,12 +128,6 @@
|
|||||||
<input type="text" name="Name">
|
<input type="text" name="Name">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4 text-right">Tên hiển thị</div>
|
|
||||||
<div class="col-md-8">
|
|
||||||
<input type="text" name="AbbreviatedName">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 text-right">Giới tính</div>
|
<div class="col-md-4 text-right">Giới tính</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
|
|||||||
@@ -66,10 +66,7 @@
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'name',
|
'attribute' => 'name',
|
||||||
'headerOptions' => ['class' => 'text-center']
|
'contentOptions' => ['class' => 'text-center'],
|
||||||
],
|
|
||||||
[
|
|
||||||
'attribute' => 'abbreviated_name',
|
|
||||||
'headerOptions' => ['class' => 'text-center']
|
'headerOptions' => ['class' => 'text-center']
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -89,6 +86,12 @@
|
|||||||
'headerOptions' => ['class' => 'text-center'],
|
'headerOptions' => ['class' => 'text-center'],
|
||||||
'value' => \app\helpers\ListManagementGrid::time()
|
'value' => \app\helpers\ListManagementGrid::time()
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'birthday',
|
||||||
|
'contentOptions' => ['class' => 'text-center'],
|
||||||
|
'headerOptions' => ['class' => 'text-center'],
|
||||||
|
'value' => \app\helpers\ListManagementGrid::birthday()
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'telephone',
|
'attribute' => 'telephone',
|
||||||
'contentOptions' => ['class' => 'text-center'],
|
'contentOptions' => ['class' => 'text-center'],
|
||||||
@@ -215,22 +218,22 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 200px;position: absolute;" id="menu" class="hidden">
|
<div style="width: 300px;position: absolute;" id="menu" class="hidden">
|
||||||
<div class="panel panel-info">
|
<div class="panel panel-info">
|
||||||
<div class="panel-heading text-bold">
|
<div class="panel-heading text-bold">
|
||||||
Thao tác
|
Operation menu
|
||||||
<i class="fa fa-remove pull-right" style="cursor: pointer;" onclick="_closeMenu();"></i>
|
<i class="fa fa-remove pull-right" style="cursor: pointer;" onclick="_closeMenu();"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body text-center">
|
<div class="panel-body text-center">
|
||||||
<button onclick="_formModified(this);" data-href='{Url::to(["/list-management/form-update"])}'>Sửa</button>
|
<button onclick="_formModified(this);" data-href='{Url::to(["/list-management/form-update"])}'>Modified list</button>
|
||||||
<button onclick="_delete(this);" data-href="{Url::to(["/list-management/delete"])}">Xóa</button>
|
<button onclick="_delete(this);" data-href="{Url::to(["/list-management/delete"])}">Delete list</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 500px;position: absolute;right:0;top: 250px;" id='form' class="hidden">
|
<div style="width: 500px;position: absolute;right:0;top: 250px;" id='form' class="hidden">
|
||||||
<div class="panel panel-info">
|
<div class="panel panel-info">
|
||||||
<div class="panel-heading text-bold">
|
<div class="panel-heading text-bold">
|
||||||
Quản lý mẫu
|
List management
|
||||||
<i class="fa fa-remove pull-right" style="cursor: pointer;" onclick="_close();"></i>
|
<i class="fa fa-remove pull-right" style="cursor: pointer;" onclick="_close();"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
@@ -245,7 +248,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 text-right">Danh sách</div>
|
<div class="col-md-4 text-right">Type</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<select style="width: 100%;height: 26px;" name="Type">
|
<select style="width: 100%;height: 26px;" name="Type">
|
||||||
{html_options options=$typeArray}
|
{html_options options=$typeArray}
|
||||||
@@ -262,19 +265,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 text-right">Tên</div>
|
<div class="col-md-4 text-right">Name</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<input type="text" name="Name">
|
<input type="text" name="Name">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 text-right">Tên hiển thị</div>
|
<div class="col-md-4 text-right">Gender</div>
|
||||||
<div class="col-md-8">
|
|
||||||
<input type="text" name="AbbreviatedName">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4 text-right">Giới tính</div>
|
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<select style="width: 100%;height: 26px;" name="Gender">
|
<select style="width: 100%;height: 26px;" name="Gender">
|
||||||
{html_options options=$genderArray}
|
{html_options options=$genderArray}
|
||||||
@@ -282,19 +279,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 text-right">Ngày sinh</div>
|
<div class="col-md-4 text-right">Birthday</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<input type="text" name="Birthday" id="birthday">
|
<input type="text" name="Birthday" id="birthday">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 text-right">Điện thoại</div>
|
<div class="col-md-4 text-right">Telephone</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<input type="text" name="Telephone">
|
<input type="text" name="Telephone">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 text-right">Đơn vị</div>
|
<div class="col-md-4 text-right">Department</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<input type="text" name="Address">
|
<input type="text" name="Address">
|
||||||
</div>
|
</div>
|
||||||
@@ -303,8 +300,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<input type="hidden" value="" name="ListManagementID">
|
<input type="hidden" value="" name="ListManagementID">
|
||||||
<button onclick="_update(this);" data-href='{Url::to(["/list-management/update"])}' id="save-btn">Lưu</button>
|
<button onclick="_update(this);" data-href='{Url::to(["/list-management/update"])}' id="save-btn">Save</button>
|
||||||
<button onclick="_close();">Hủy</button>
|
<button onclick="_close();">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,24 +22,23 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>Tên</th>
|
<th>Tên</th>
|
||||||
<th>Tên hiển thị</th>
|
|
||||||
<th>Đơn vị</th>
|
<th>Đơn vị</th>
|
||||||
<th>Hình ảnh đăng kí</th>
|
<th>Hình ảnh đăng kí</th>
|
||||||
|
<th>Code</th>
|
||||||
<th>Company ID</th>
|
<th>Company ID</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="sync-lists">
|
<tbody id="sync-lists">
|
||||||
{foreach from=$datas item=arr}
|
{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)}">
|
<tr id="filters-{$arr.code}" onclick="choooseToSync(this);" style="cursor: pointer;" class="filters {if !in_array($arr.idStaff,$allID)}not-in-list{/if}" data-stt="false" data-id="{trim($arr.idStaff)}">
|
||||||
<td>
|
<td>
|
||||||
<div id="full-data-{trim($arr.id)}" class="hidden">{json_encode($arr)}</div>
|
<div id="full-data-{trim($arr.idStaff)}" class="hidden">{json_encode($arr)}</div>
|
||||||
{$arr.code}
|
{$arr.idStaff}
|
||||||
{if in_array($arr.id,$allID)}
|
{if in_array($arr.idStaff,$allID)}
|
||||||
<i class="fa fa-check-circle text-green"></i>
|
<i class="fa fa-check-circle text-green"></i>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td>{$arr.name}</td>
|
<td>{$arr.name}</td>
|
||||||
<td>{$arr.abbreviated_name}</td>
|
|
||||||
<td>{$arr.department}</td>
|
<td>{$arr.department}</td>
|
||||||
<td>
|
<td>
|
||||||
{foreach from=$arr.images item=img key=k}
|
{foreach from=$arr.images item=img key=k}
|
||||||
@@ -50,6 +49,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</td>
|
</td>
|
||||||
|
<td>{$arr.code}</td>
|
||||||
<td>{$arr.id_company}</td>
|
<td>{$arr.id_company}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>Tên</th>
|
<th>Tên</th>
|
||||||
<th>Tên hiển thị</th>
|
|
||||||
<th>Giới tính</th>
|
<th>Giới tính</th>
|
||||||
<th>Hình ảnh đăng kí</th>
|
<th>Hình ảnh đăng kí</th>
|
||||||
<th>Ngày sinh</th>
|
<th>Ngày sinh</th>
|
||||||
@@ -32,10 +31,9 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody id="sync-lists">
|
<tbody id="sync-lists">
|
||||||
{foreach from=$datas item=arr}
|
{foreach from=$datas item=arr}
|
||||||
<tr id="filters-{$arr.staff_id}" class="filters" onclick="choooseToSync(this);" style="cursor: pointer;" data-stt="false" data-id="{$arr->staff_id}">
|
<tr id="filters-{$arr.code}" class="filters" onclick="choooseToSync(this);" style="cursor: pointer;" data-stt="false" data-id="{$arr->code}">
|
||||||
<td>{$arr->code}</td>
|
<td>{$arr->code}</td>
|
||||||
<td>{$arr->name}</td>
|
<td>{$arr->name}</td>
|
||||||
<td>{$arr.abbreviated_name}</td>
|
|
||||||
<td>{$arr->gender}</td>
|
<td>{$arr->gender}</td>
|
||||||
<td>
|
<td>
|
||||||
{$images = json_decode($arr->image, true)}
|
{$images = json_decode($arr->image, true)}
|
||||||
|
|||||||
@@ -43,11 +43,6 @@ function _save(e) {
|
|||||||
alert("Hãy nhập tên!");
|
alert("Hãy nhập tên!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var abbreviated_name = $("input[name='AbbreviatedName']").val();
|
|
||||||
if (abbreviated_name === "") {
|
|
||||||
alert("Hãy nhập tên hiển thị!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
common.modalBlock(true);
|
common.modalBlock(true);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: $(e).attr("data-href"),
|
url: $(e).attr("data-href"),
|
||||||
@@ -55,7 +50,6 @@ function _save(e) {
|
|||||||
data: {
|
data: {
|
||||||
code: code,
|
code: code,
|
||||||
name: name,
|
name: name,
|
||||||
abbreviated_name: abbreviated_name,
|
|
||||||
type: $("select[name='Type']").val(),
|
type: $("select[name='Type']").val(),
|
||||||
gender: $("select[name='Gender']").val(),
|
gender: $("select[name='Gender']").val(),
|
||||||
birthday: $("input[name='Birthday']").val(),
|
birthday: $("input[name='Birthday']").val(),
|
||||||
@@ -90,7 +84,6 @@ function chooseStaff(e) {
|
|||||||
success: function (data) {
|
success: function (data) {
|
||||||
common.modalBlock(false);
|
common.modalBlock(false);
|
||||||
$("input[name='Name']").val(data.name);
|
$("input[name='Name']").val(data.name);
|
||||||
$("input[name='AbbreviatedName']").val(data.abbreviated_name);
|
|
||||||
$("select[name='Gender']").val(data.gender);
|
$("select[name='Gender']").val(data.gender);
|
||||||
$("input[name='Birthday']").val(data.birthday);
|
$("input[name='Birthday']").val(data.birthday);
|
||||||
$("input[name='Telephone']").val(data.telephone);
|
$("input[name='Telephone']").val(data.telephone);
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ function _formModified(e) {
|
|||||||
$("select[name='Type']").val(data.type);
|
$("select[name='Type']").val(data.type);
|
||||||
$("select[name='Code']").val(data.code);
|
$("select[name='Code']").val(data.code);
|
||||||
$("input[name='Name']").val(data.name);
|
$("input[name='Name']").val(data.name);
|
||||||
$("input[name='AbbreviatedName']").val(data.abbreviated_name);
|
|
||||||
$("select[name='Gender']").val(data.gender);
|
$("select[name='Gender']").val(data.gender);
|
||||||
$("input[name='Birthday']").val(data.birthday);
|
$("input[name='Birthday']").val(data.birthday);
|
||||||
$("input[name='Telephone']").val(data.telephone);
|
$("input[name='Telephone']").val(data.telephone);
|
||||||
@@ -95,11 +94,6 @@ function _update(e) {
|
|||||||
alert("Hãy nhập tên!");
|
alert("Hãy nhập tên!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var abbreviated_name = $("input[name='AbbreviatedName']").val();
|
|
||||||
if (abbreviated_name === "") {
|
|
||||||
alert("Hãy nhập tên hiển thị!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
common.modalBlock(true);
|
common.modalBlock(true);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: $(e).attr("data-href"),
|
url: $(e).attr("data-href"),
|
||||||
@@ -107,7 +101,6 @@ function _update(e) {
|
|||||||
data: {
|
data: {
|
||||||
code: code,
|
code: code,
|
||||||
name: name,
|
name: name,
|
||||||
abbreviated_name: abbreviated_name,
|
|
||||||
type: $("select[name='Type']").val(),
|
type: $("select[name='Type']").val(),
|
||||||
gender: $("select[name='Gender']").val(),
|
gender: $("select[name='Gender']").val(),
|
||||||
birthday: $("input[name='Birthday']").val(),
|
birthday: $("input[name='Birthday']").val(),
|
||||||
@@ -593,12 +586,12 @@ function filters(e) {
|
|||||||
if (id === "") {
|
if (id === "") {
|
||||||
$(".filters").removeClass("hidden");
|
$(".filters").removeClass("hidden");
|
||||||
$(".btn-select").removeClass("hidden");
|
$(".btn-select").removeClass("hidden");
|
||||||
// checkAllSync(false);
|
checkAllSync(false);
|
||||||
} else {
|
} else {
|
||||||
$(".filters").addClass("hidden");
|
$(".filters").addClass("hidden");
|
||||||
$("#filters-" + id).removeClass("hidden");
|
$("#filters-" + id).removeClass("hidden");
|
||||||
$(".btn-select").addClass("hidden");
|
$(".btn-select").addClass("hidden");
|
||||||
// checkAllSync(false);
|
checkAllSync(false);
|
||||||
choooseToSync($("#filters-" + id));
|
choooseToSync($("#filters-" + id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -607,7 +600,7 @@ function removeFilters() {
|
|||||||
$(".filters").removeClass("hidden");
|
$(".filters").removeClass("hidden");
|
||||||
$(".btn-select").removeClass("hidden");
|
$(".btn-select").removeClass("hidden");
|
||||||
$("#filter-from-server").val('').trigger('change');
|
$("#filter-from-server").val('').trigger('change');
|
||||||
// checkAllSync(false);
|
checkAllSync(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTotalFeature() {
|
function getTotalFeature() {
|
||||||
|
|||||||
Reference in New Issue
Block a user