throw new \Exception(Json::encode($timetableFactModel->getErrors()));
}
+ Yii::$app->session->setFlash('success', "Факт смены был создан");
+
return $this->controller->redirect('/timetable/add-fact-hand');
}
} else {
[
'and',
['<=', 'datetime_start', date('Y-m-d H:i:s', strtotime("+6 hour", strtotime($model->shift_start)))],
- ['>=', 'datetime_end', date('Y-m-d H:i:s', strtotime("+6 hour", strtotime($model->shift_start)))],
+ ['>=', 'datetime_end', date('Y-m-d H:i:s', strtotime("-6 hour", strtotime($model->shift_start)))],
],
[
'and',
- ['<=', 'datetime_start', date('Y-m-d H:i:s', strtotime("-6 hour", strtotime($model->shift_end)))],
+ ['<=', 'datetime_start', date('Y-m-d H:i:s', strtotime("+6 hour", strtotime($model->shift_end)))],
['>=', 'datetime_end', date('Y-m-d H:i:s', strtotime("-6 hour", strtotime($model->shift_end)))],
- ],
- [
- 'and',
- ['>=', 'datetime_start', date('Y-m-d H:i:s', strtotime("+6 hour", strtotime($model->shift_start)))],
- ['<=', 'datetime_end', date('Y-m-d H:i:s', strtotime("-6 hour", strtotime($model->shift_end)))],
- ],
+ ]
])->andWhere(['admin_id' => $model->admin_id])->all();
$checkIns = AdminCheckin::find()->where(['admin_id' => $model->admin_id])
<?php $form = ActiveForm::begin(['enableClientScript' => false]) ?>
+ <?php if (Yii::$app->session->hasFlash('success')): ?>
+ <div class="alert alert-success alert-dismissable">
+ <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
+ <?= Yii::$app->session->getFlash('success') ?>
+ </div>
+ <?php endif; ?>
+
<div class="row">
<div class="col-12">
Сотрудник: <div style="display:inline-block"><?= $form->field($model, 'admin_id')->dropDownList($admins)->label(false) ?></div>
<br>
<span style="text-decoration: underline; color: blue;" title="Выберите кликом из Смены (/timetable/fact, /timetable/plan):">plan_id</span>: <div style="display:inline-block"><?= $form->field($model, 'plan_id')->textInput(['type' => 'number'])->label(false) ?></div>
<span style="text-decoration: underline; color: blue;" title="Выберите кликом из Смены (/timetable/fact, /timetable/plan):">tabel</span>: <div style="display:inline-block"><?= $form->field($model, 'tabel')->textInput(['type' => 'number'])->label(false) ?></div>
- <span style="text-decoration: underline; color: blue;" title="Выберите кликом из Смены (/timetable/fact, /timetable/plan):">admin_group_id</span>: <div style="display:inline-block"><?= $form->field($model, 'admin_group_id')->dropDownList($adminGroups)->label(false) ?></div>
+ <span style="text-decoration: underline; color: blue;" title="Выберите кликом из Смены (/timetable/fact, /timetable/plan):">Должность в которой сотрудник работал на смене(admin_group_id)</span>: <div style="display:inline-block"><?= $form->field($model, 'admin_group_id')->dropDownList($adminGroups)->label(false) ?></div>
<br>
Начало смены: <div style="display:inline-block"><?= $form->field($model, 'shift_start')->widget(DateTimePicker::class, [
'language' => 'ru',
<?php if ($allowAdd): ?>
<?= Html::submitButton('Создать факт и чикины', ['class' => 'btn btn-danger btn-sm', 'name' => 'action', 'value' => 'createFact'])?>
<?= Html::submitButton('Создать факт и чикин (открыть смену)', ['class' => 'btn btn-danger btn-sm', 'name' => 'action', 'value' => 'createFactOpenShift'])?>
+ <br>
<span style="text-decoration: underline; color: blue;" title="Выберите кликом из Смены-Факта (/timetable-fact):">timetable_fact_id</span>: <div style="display:inline-block"><?= $form->field($model, 'timetable_fact_id')->textInput(['type' => 'number'])->label(false) ?></div>
<?= Html::submitButton('Создать чикин (закрыть смену)', ['class' => 'btn btn-danger btn-sm', 'name' => 'action', 'value' => 'createFactCloseShift'])?>
<?php endif; ?>