update: lấy dữ liệu mã thẻ từ thiết bị, mở cửa từ phần mềm
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
namespace app\helpers;
|
||||
|
||||
use app\models\Door;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
|
||||
class DeviceGrid extends CommonGrid {
|
||||
|
||||
public static function status($array) {
|
||||
@@ -30,4 +34,20 @@ 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;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user