update sửa tên cửa

This commit is contained in:
2020-10-30 10:47:16 +07:00
parent cd943030c6
commit 28f23530d0
6 changed files with 116 additions and 17 deletions

View File

@@ -36,17 +36,23 @@ class DeviceGrid extends CommonGrid {
public static function openDoor() {
return function($model) {
$doors = Door::find()->andWhere(["device_id" => $model->id])->all();
$html = "";
foreach ($doors as $key => $value) {
$html .= Html::button($value->code, [
'class' => 'btn btn-info',
'data' => ['toggle' => 'tooltip', 'href' => Url::to(['open-door', 'id' => $model->id, 'door' => $value->code])],
'title' => \Yii::t('app', 'Mở cửa'),
'onclick' => "openDoor(this);"
]) . " ";
}
return $html;
$doors = Door::find()->andWhere(["device_id" => $model->id])->count();
return Html::button("<i class='fa fa-list'></i> Danh sách cửa " . Html::label($doors, "", ["class" => "label label-danger"]), [
'class' => 'btn btn-info',
'data' => [
'href' => Url::to(['doors', 'id' => $model->id])
],
'onclick' => "common.form(this, '');"
]);
// foreach ($doors as $key => $value) {
// $html .= Html::button($value->code, [
// 'class' => 'btn btn-info',
// 'data' => ['toggle' => 'tooltip', 'href' => Url::to(['open-door', 'id' => $model->id, 'door' => $value->code])],
// 'title' => \Yii::t('app', 'Mở cửa'),
// 'onclick' => "openDoor(this);"
// ]) . "&nbsp;";
// }
// return $html;
};
}