update Staff full CRUD
This commit is contained in:
@@ -62,18 +62,18 @@ class CommonGrid {
|
||||
};
|
||||
}
|
||||
|
||||
public static function checkbox($type) {
|
||||
return function($model) use ($type) {
|
||||
if ($model->id == 1)
|
||||
public static function checkbox($type, $haveRoot = true) {
|
||||
return function($model) use ($type, $haveRoot) {
|
||||
if ($model->id == 1 && $haveRoot)
|
||||
return "";
|
||||
return "<input type='checkbox' value='{$model->id}' name='checkbox-{$type}' class='checkbox-{$type}'>";
|
||||
};
|
||||
}
|
||||
|
||||
public static function rows($type) {
|
||||
return function($model, $index, $widget, $grid) use ($type) {
|
||||
public static function rows($type, $bigSize = false) {
|
||||
return function($model, $index, $widget, $grid) use ($type, $bigSize) {
|
||||
return [
|
||||
"ondblclick" => "common.form(this, '{$type}');",
|
||||
"ondblclick" => "common.form(this, '{$type}', {$bigSize});",
|
||||
"style" => "cursor: pointer;",
|
||||
"data" => [
|
||||
"href" => Url::to(["update", "id" => $model->id])
|
||||
|
||||
31
helpers/StaffGrid.php
Normal file
31
helpers/StaffGrid.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\helpers;
|
||||
|
||||
class StaffGrid extends CommonGrid {
|
||||
|
||||
public static function department($array) {
|
||||
return function($model) use ($array) {
|
||||
return isset($array[$model->department_id]) ? $array[$model->department_id] : "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function gender($array) {
|
||||
return function($model) use ($array) {
|
||||
return isset($array[$model->gender]) ? $array[$model->gender] : "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function birthday() {
|
||||
return function($model) {
|
||||
return date("d/m/Y", $model->birthday);
|
||||
};
|
||||
}
|
||||
|
||||
public static function dateIn() {
|
||||
return function($model) {
|
||||
return date("d/m/Y", $model->date_in);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user