update CRUD list-management

This commit is contained in:
2020-12-04 10:11:56 +07:00
parent efb4113001
commit 6030ccd0a5
11 changed files with 428 additions and 43 deletions

View File

@@ -42,10 +42,23 @@ class ListManagementGrid {
public static function image() {
return function($model) {
return Html::img("/BiFace/data/uploads/face/" . $model->image, [
"class" => "img-thumbnail",
"style" => "width: 150px;height:150px;"
]);
$images = json_decode($model->image, true);
$return = [];
foreach ($images as $key => $value) {
$removeBtn = Html::button("<i class='fa fa-remove'></i>", [
"class" => "btn btn-danger btn-xs",
"style" => "position:absolute;top:0;right:0;visibility: hidden;",
"onclick" => "_deleteFeature(this);",
"data-img" => $value['url'],
"data-id" => $model->id,
"data-href" => Url::to(["/list-management/delete-feature"])
]);
$return[] = "<div class='feature-img'>" . Html::img("/BiFace/data/uploads/face/" . $value['url'], [
"class" => "img-thumbnail",
"style" => "width: 100px;height:100px;"
]) . $removeBtn . "</div>";
}
return implode("&nbsp;", $return);
};
}
@@ -58,11 +71,10 @@ class ListManagementGrid {
public static function rows() {
return function($model, $index, $widget, $grid) {
return [
"ondblclick" => "_form(this);",
"ondblclick" => "_menu(this);",
"style" => "cursor: pointer;",
"data" => [
"id" => $model->id,
"img" => "/BiFace/data/uploads/face/" . $model->image
"id" => $model->id
]
];
};