145 lines
4.7 KiB
PHP
145 lines
4.7 KiB
PHP
<?php
|
|
|
|
namespace app\helpers;
|
|
|
|
use Yii;
|
|
use yii\helpers\Html;
|
|
use yii\helpers\Url;
|
|
use app\models\common;
|
|
|
|
class LogsGrid {
|
|
|
|
public static function engineNameFunc() {
|
|
return function ($data) {
|
|
return $data->app->app_name;
|
|
};
|
|
}
|
|
|
|
public static function getLayout() {
|
|
return "{items}<div class='row'><div class='col-md-4'>{summary}</div><div class='col-md-8 text-right'>{pager}</div></div>";
|
|
}
|
|
|
|
public static function actionTemplate() {
|
|
return "{update} {delete}";
|
|
}
|
|
|
|
public static function plateIn() {
|
|
return function($model) {
|
|
if ($model->time_in) {
|
|
$style = "width:100px;cursor:pointer;";
|
|
$image = $model->plate_image_in;
|
|
return Html::img(Yii::$app->request->hostInfo . "/AIParking_Intops_Server/web/data/uploads/" . $image, [
|
|
'class' => "img-thumbnail",
|
|
"style" => $style,
|
|
"data" => [
|
|
"toggle" => "popover-hover",
|
|
"img" => Yii::$app->request->hostInfo . "/AIParking_Intops_Server/web/data/uploads/" . $model->frame_image_in,
|
|
"size" => "min"
|
|
],
|
|
"onclick" => "resizeImage(this);"
|
|
]);
|
|
} else {
|
|
return "";
|
|
}
|
|
};
|
|
}
|
|
|
|
public static function plateOut() {
|
|
return function($model) {
|
|
if ($model->time_out) {
|
|
$style = "width:100px;cursor:pointer;";
|
|
$image = $model->plate_image_out;
|
|
return Html::img(Yii::$app->request->hostInfo . "/AIParking_Intops_Server/web/data/uploads/" . $image, [
|
|
'class' => "img-thumbnail",
|
|
"style" => $style,
|
|
"data" => [
|
|
"toggle" => "popover-hover",
|
|
"img" => Yii::$app->request->hostInfo . "/AIParking_Intops_Server/web/data/uploads/" . $model->frame_image_out,
|
|
"size" => "min"
|
|
],
|
|
"onclick" => "resizeImage(this);"
|
|
]);
|
|
} else {
|
|
return "";
|
|
}
|
|
};
|
|
}
|
|
|
|
public static function timeIn() {
|
|
return function($model) {
|
|
if ($model->time_in) {
|
|
$common = new common();
|
|
return $common->formatTime($model->time_in, "H:i:s d/m/Y");
|
|
} else {
|
|
return "";
|
|
}
|
|
};
|
|
}
|
|
|
|
public static function timeOut() {
|
|
return function($model) {
|
|
if ($model->time_out) {
|
|
$common = new common();
|
|
return $common->formatTime($model->time_out, "H:i:s d/m/Y");
|
|
} else {
|
|
return "";
|
|
}
|
|
};
|
|
}
|
|
|
|
public static function driver() {
|
|
return function($model) {
|
|
$ls = explode("/", $model->vehicle->driver);
|
|
return implode("<br>", $ls);
|
|
};
|
|
}
|
|
|
|
public static function telephone() {
|
|
return function($model) {
|
|
$ls = explode("/", $model->vehicle->telephone);
|
|
return implode("<br>", $ls);
|
|
};
|
|
}
|
|
|
|
public static function cmt() {
|
|
return function($model) {
|
|
$ls = explode("/", $model->vehicle->indentity_card);
|
|
return implode("<br>", $ls);
|
|
};
|
|
}
|
|
|
|
public static function factory() {
|
|
return function($model) {
|
|
$text = $model->factory;
|
|
if ($model->factory == null)
|
|
$text = "<i class='text-red'>không có</i>";
|
|
|
|
$data = "<div style='cursor:pointer;' onclick='openForm(this, \"factory\");' data-id='{$model->id}' data-text='{$model->factory}'>{$text}</div>";
|
|
return $data;
|
|
};
|
|
}
|
|
|
|
public static function sealNo() {
|
|
return function($model) {
|
|
$text = $model->seal_no;
|
|
if ($model->seal_no == null)
|
|
$text = "<i class='text-red'>không có</i>";
|
|
|
|
$data = "<div style='cursor:pointer;' onclick='openForm(this, \"seal_no\");' data-id='{$model->id}' data-text='{$model->seal_no}'>{$text}</div>";
|
|
return $data;
|
|
};
|
|
}
|
|
|
|
public static function note() {
|
|
return function($model) {
|
|
$text = $model->note;
|
|
if ($model->note == null)
|
|
$text = "<i class='text-red'>không có</i>";
|
|
|
|
$data = "<div style='cursor:pointer;' onclick='openForm(this, \"note\");' data-id='{$model->id}' data-text='{$model->note}'>{$text}</div>";
|
|
return $data;
|
|
};
|
|
}
|
|
|
|
}
|