AIParking_Intops_Server/helpers/VehicleGrid.php
2020-02-01 16:47:12 +07:00

75 lines
2.1 KiB
PHP

<?php
namespace app\helpers;
use Yii;
use yii\helpers\Html;
use yii\helpers\Url;
class VehicleGrid {
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 driver() {
return function($model) {
$ls = explode("/", $model->driver);
return implode("</br>", $ls);
};
}
public static function telephone() {
return function($model) {
$ls = explode("/", $model->telephone);
return implode("</br>", $ls);
};
}
public static function card() {
return function($model) {
$ls = explode("/", $model->indentity_card);
return implode("</br>", $ls);
};
}
public static function update() {
return function($url, $model) {
return Html::button("<i class='fa fa-pencil'></i>", [
"class" => "btn btn-success btn-xs",
"data" => [
"toggle" => "tooltip",
"href" => Url::to(['update', 'id' => $model->id])
],
"title" => "Chỉnh sửa",
"onclick" => "_form(this);"
]);
};
}
public static function delete() {
return function($url, $model) {
return Html::a('<i class="fa fa-trash"></i>', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger btn-xs',
'title' => "Xóa",
'data' => [
'toggle' => 'tooltip',
'confirm' => "Bạn có chắc chắn muốn xóa thông tin xe này không?",
'method' => 'post'
]
]);
};
}
}