89 lines
2.4 KiB
PHP
89 lines
2.4 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";
|
|
$image = $model->plate_image_in;
|
|
return Html::img(Yii::$app->request->hostInfo . "/AIParking_Intops_Server/web/data/uploads/" . $image, [
|
|
'class' => "img-thumbnail",
|
|
"style" => $style
|
|
]);
|
|
} else {
|
|
return "";
|
|
}
|
|
};
|
|
}
|
|
|
|
public static function cardId() {
|
|
return function($model) {
|
|
if ($model->card_id != 0) {
|
|
return sprintf("%06d", $model->card_id);
|
|
} else {
|
|
return "<i class='text-red'>Thẻ đã bị xóa!</i>";
|
|
}
|
|
};
|
|
}
|
|
|
|
public static function plateOut() {
|
|
return function($model) {
|
|
if ($model->time_out) {
|
|
$style = "width:100px";
|
|
$image = $model->plate_image_out;
|
|
return Html::img(Yii::$app->request->hostInfo . "/AIParking_Intops_Server/web/data/uploads/" . $image, [
|
|
'class' => "img-thumbnail",
|
|
"style" => $style
|
|
]);
|
|
} 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 "";
|
|
}
|
|
};
|
|
}
|
|
|
|
}
|