update manage schedule

This commit is contained in:
2022-09-26 09:43:12 +07:00
parent ac0588b711
commit 33e439de8f
16 changed files with 677 additions and 25 deletions

View File

@@ -20,6 +20,24 @@ class ListManagementGrid {
};
}
public static function layout($default = 20, $hiddenText = false) {
$pageSize = [10, 20, 50, 100];
$options = [];
foreach ($pageSize as $key => $value) {
$selected = "";
if (Yii::$app->request->get("per-page") && Yii::$app->request->get("per-page") == $value)
$selected = "selected";
if (!Yii::$app->request->get("per-page") && $value == $default)
$selected = "selected";
$options[] = "<option value='" . $value . "' {$selected}>" . $value . "</options>";
}
$select = "<select style='width:80px;' onchange='common.changePerPage(this);'>" . implode("", $options) . "</select>";
$text = "";
if (!$hiddenText)
$text = "Hiển thị&nbsp;&nbsp;&nbsp;";
return "{items}<div class='row'><div class='col-md-6'>{summary}</div><div class='col-md-6'><div class='row'><div class='col-md-9 text-right'>{pager}</div><div class='col-md-3'>" . $text . $select . "</div></div></div></div>";
}
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>";
}
@@ -86,4 +104,25 @@ class ListManagementGrid {
};
}
public static function schedule() {
return function($model) {
$schedules = $model->schedule;
$html = "<ul style='padding-left:10px;'>";
foreach ($schedules as $key => $value) {
$btnEdit = "<i class='fa fa-edit text-green' onclick='formEditSchedule(this);' data-href='" . Url::to(['/list-management/edit-schedule', 'id' => $value->id]) . "'></i>";
$btnDelete = "<i class='fa fa-remove text-red' onclick='formDeleteSchedule(this);' data-href='" . Url::to(['/list-management/delete-schedule', 'id' => $value->id]) . "'></i>";
$btn = "<span class='btn-schedule'>" . $btnEdit . " " . $btnDelete . "</span>";
$html .= "<li class='schedule-item'>[" . $value->from_time . "-" . $value->to_time . "] " . $value->from_date . " - " . $value->to_date . " " . $btn . "</li>";
}
$html .= "</ul>";
return $html;
};
}
public static function check() {
return function($model) {
return "<input type='checkbox' value='' name='' onclick='choose(this);'>";
};
}
}