update filter dữ liệu cửa trong Cấp quyền truy cập
This commit is contained in:
@@ -11,6 +11,7 @@ use app\models\Device;
|
||||
use yii\web\Controller;
|
||||
use yii\filters\VerbFilter;
|
||||
use app\models\StaffSearch;
|
||||
use app\models\Area;
|
||||
|
||||
/**
|
||||
* DeviceController implements the CRUD actions for Device model.
|
||||
@@ -48,7 +49,8 @@ class AssignController extends Controller {
|
||||
"company" => Department::findOne(1),
|
||||
"scheduleArray" => Schedule::scheduleArray(),
|
||||
"doorLists" => Door::find()->all(),
|
||||
"deviceArray" => Device::deviceArray()
|
||||
"deviceArray" => Device::deviceArray(),
|
||||
"areaArray" => Area::areaArray()
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -120,4 +122,25 @@ class AssignController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function actionFilterArea() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$lists = Device::find()->andWhere(['area_id' => Yii::$app->request->post('area')])->all();
|
||||
$deviceArray = [];
|
||||
foreach ($lists as $key => $value) {
|
||||
$deviceArray[$value->id] = $value->name;
|
||||
}
|
||||
return $this->renderPartial("device", [
|
||||
"deviceArray" => $deviceArray
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionFilterAllDevice() {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
return $this->renderPartial("device", [
|
||||
"deviceArray" => Device::deviceArray()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user