diff --git a/config/web.php b/config/web.php index 08b6c38b..8b142538 100644 --- a/config/web.php +++ b/config/web.php @@ -48,7 +48,7 @@ $config = [ ], 'assetManager' => [ 'class' => 'app\\components\\AssetManager', - 'appendVersion' => '1.0.11', + 'appendVersion' => '1.0.12', 'bundles' => [ 'dmstr\web\AdminLteAsset' => [ 'skin' => 'skin-blue', diff --git a/controllers/AssignController.php b/controllers/AssignController.php index daf65d1f..49c4510c 100644 --- a/controllers/AssignController.php +++ b/controllers/AssignController.php @@ -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() + ]); + } + } + } diff --git a/models/Door.php b/models/Door.php index 01f95bda..dd734f57 100644 --- a/models/Door.php +++ b/models/Door.php @@ -67,4 +67,8 @@ class Door extends \yii\db\ActiveRecord { return $results; } + public function getDevice() { + return Device::findOne($this->device_id); + } + } diff --git a/views/assign/device.tpl b/views/assign/device.tpl new file mode 100644 index 00000000..2b0e890b --- /dev/null +++ b/views/assign/device.tpl @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/views/assign/index.tpl b/views/assign/index.tpl index 5a8348cd..a82fbb2b 100644 --- a/views/assign/index.tpl +++ b/views/assign/index.tpl @@ -24,7 +24,7 @@ overflow: scroll; } {*#schedule-search-staff::-webkit-scrollbar { - display: none; + display: none; }*} #create-schedule-main{ border-left: 1px solid #cecece; @@ -37,6 +37,7 @@ } +
@@ -116,16 +117,35 @@ | Cửa | Thiết bị | +Khu vực | +|
---|---|---|---|---|
+ | + | + + | ++ + | |
{$door->name} | -{$deviceArray[$door->device_id]} | +{$device->name} | +{$areaArray[$device->area_id]|default:""} |