update dổi tên cửa realtime
This commit is contained in:
parent
a57039f7d0
commit
72dfa46c94
|
@ -640,7 +640,17 @@ class DeviceController extends Controller {
|
|||
$model->modified_at = time();
|
||||
$model->save();
|
||||
}
|
||||
return $id;
|
||||
$doors = Door::find()->andWhere(["device_id" => $model->device_id])->all();
|
||||
$ls = [];
|
||||
foreach ($doors as $key => $value) {
|
||||
$ls[] = $value->name;
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
return [
|
||||
"id" => $id,
|
||||
"device_id" => $model->device_id,
|
||||
"form" => implode("<br>", $ls)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ class DeviceGrid extends CommonGrid {
|
|||
return [
|
||||
'class' => 'text-center',
|
||||
'onclick' => "common.form(this, '', true);",
|
||||
'data-href' => Url::to(['doors', 'id' => $model->id])
|
||||
'data-href' => Url::to(['doors', 'id' => $model->id]),
|
||||
'id' => 'device-ls-' . $model->id
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -528,11 +528,12 @@ function editDoor(e) {
|
|||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
var id = parseInt(data);
|
||||
var id = parseInt(data.id);
|
||||
$("#name-text-" + id).html(name);
|
||||
$("#duration-text-" + id).html(duration);
|
||||
$(".real-" + id).removeClass("hidden");
|
||||
$(".edit-" + id).addClass("hidden");
|
||||
$("#device-ls-" + data.device_id).html(data.form);
|
||||
notification.success("Đã lưu thông tin", 2000);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user