From b785509ff2ab4f0482a573370c4e7fcdde35e5d3 Mon Sep 17 00:00:00 2001 From: marina Date: Thu, 13 Jun 2024 13:13:43 +0300 Subject: [PATCH] =?utf8?q?ERP-5=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?utf8?q?=D1=82=D0=B0=D1=82=D1=8C=20=D1=84=D0=B0=D0=BA=D1=82=D0=B8=D1=87?= =?utf8?q?=D0=B5=D1=81=D0=BA=D0=B8=D0=B9=20=D0=BF=D0=BB=D0=B0=D0=BD=20?= =?utf8?q?=D0=BF=D0=BE=20=D1=81=D0=BE=D1=82=D1=80=D1=83=D0=B4=D0=BD=D0=B8?= =?utf8?q?=D0=BA=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../timetable/StartShiftStepOneAction.php | 5 +++- .../views/timetable/start_shift_step_one.php | 25 +++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/erp24/actions/timetable/StartShiftStepOneAction.php b/erp24/actions/timetable/StartShiftStepOneAction.php index 26ed5bee..47c3ac22 100755 --- a/erp24/actions/timetable/StartShiftStepOneAction.php +++ b/erp24/actions/timetable/StartShiftStepOneAction.php @@ -3,6 +3,7 @@ declare(strict_types=1); namespace yii_app\actions\timetable; +use app\records\TimetableFactModel; use yii\base\Action; use yii\helpers\ArrayHelper; use yii_app\records\Admin; @@ -49,11 +50,13 @@ class StartShiftStepOneAction extends Action if ($modelTypeId == AdminCheckin::TYPE_END) { $adminStores = CityStore::getNames([$lastCheckin->store_id]); + $lastCheckinFact = TimetableFactModel::findOne(['checkin_start_id' => $lastCheckin->id]); + $shiftArray = $lastCheckinFact ? ['id' => $lastCheckinFact->shift_id, 'name' => $lastCheckinFact->shift->name] : []; } else { $adminStores = ArrayHelper::map($userModel->getStores(), 'id', 'name'); + $shiftArray = ArrayHelper::map(Shift::find()->all(), 'id', 'name'); } - $shiftArray = ArrayHelper::map(Shift::find()->all(), 'id', 'name'); return $this->controller->render('/timetable/start_shift_step_one.php', [ 'userModel' => $userModel, diff --git a/erp24/views/timetable/start_shift_step_one.php b/erp24/views/timetable/start_shift_step_one.php index 598e345a..ad702cfd 100644 --- a/erp24/views/timetable/start_shift_step_one.php +++ b/erp24/views/timetable/start_shift_step_one.php @@ -117,14 +117,23 @@ use yii_app\forms\timetable\StartForm; -
-
Тип смены
- "form-select", - 'aria-label' => "Пример выбора по умолчанию", - ]) ?> -
-
+
+
Тип смены
+ type_id) || $lastCheckin->isEnd() || $userModel->adminGroup->isRoaming()) { + echo Html::dropDownList('shift_id', null, $shiftArray, [ + 'class' => "form-select", + 'aria-label' => "Пример выбора по умолчанию", + ]); + } else { + echo $shiftArray['name']; + echo Html::hiddenInput('shift_id', $shiftArray['id']); + } + + ?> + +
+
'btn btn-bd-primary ps-3 pe-3 mt-2']); ?> -- 2.39.5