update thống kê
This commit is contained in:
62
helpers/LogsGrid.php
Normal file
62
helpers/LogsGrid.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\helpers;
|
||||
|
||||
class LogsGrid extends CommonGrid {
|
||||
|
||||
public static function time() {
|
||||
return function($model) {
|
||||
return date("H:i:s d/m/Y", $model->time);
|
||||
};
|
||||
}
|
||||
|
||||
public static function device($array) {
|
||||
return function($model) use ($array) {
|
||||
return isset($array[$model->device_id]) ? $array[$model->device_id] : "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function door($array) {
|
||||
return function($model) use ($array) {
|
||||
return isset($array[$model->device_id]) ? $array[$model->device_id] . "-" . $model->door_id : "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function state($array) {
|
||||
return function($model) use ($array) {
|
||||
return isset($array[$model->in_out_state]) ? $array[$model->in_out_state] : "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function eventType($array) {
|
||||
return function($model) use ($array) {
|
||||
return isset($array[$model->event_type]) ? $array[$model->event_type] : "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function name() {
|
||||
return function($model) {
|
||||
$staff = $model->staff;
|
||||
return $staff ? $staff->name : "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function department($array) {
|
||||
return function($model) use ($array) {
|
||||
$staff = $model->staff;
|
||||
if ($staff)
|
||||
return isset($array[$staff->department_id]) ? $array[$staff->department_id] : "";
|
||||
return "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function rowsColor() {
|
||||
return function($model, $index, $widget, $grid) {
|
||||
$color = "orange";
|
||||
if ($model->event_type == 0)
|
||||
$color = "green";
|
||||
return ["class" => "text-" . $color];
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user