if(Yii::$app->request->post('Zakaz')['srok_time'] != null ){
$model->srok =старая дата.' '.Yii::$app->request->post('Zakaz')['srok_time'];
}
public function actionCreate()
{
$model = new Zakaz();
$client = new Client();
$client->scenario = Client::SCENARIO_CREATE;
$telegram = new Telegram();
$tag = new ZakazTag();
$financy = new Financy();
$notification = new Notification();
if ($model->load(Yii::$app->request->post()) && $client->load(Yii::$app->request->post())) {
if(Yii::$app->request->post('Zakaz')['srok_time'] == null){
$model->srok = Yii::$app->request->post('Zakaz')['srok_date'].' '.date('H-i-s');;
}else{
$model->srok = Yii::$app->request->post('Zakaz')['srok_date'].' '.Yii::$app->request->post('Zakaz')['srok_time'];
}
if (Yii::$app->request->get('id')){
$model->id_client = ArrayHelper::getValue(Yii::$app->request->get(), 'id');
} else {
$model->id_client = ArrayHelper::getValue(Yii::$app->request->post('Client'), 'id');
}
$model->id_shop = $model->id_sotrud;
$model->file = UploadedFile::getInstance($model, 'file');
if ($model->file) {
$model->upload('create');
}
$model->changedUnread();
if ($model->validate() && $client->validate()){
if (!$model->save()) {
print_r($model->getErrors());
} else {
$arr = ArrayHelper::map($model->tags, 'id', 'id');
$post = Yii::$app->request->post('Zakaz')['tags_array'];
if ($post){
$tag->getZakazForm($post, $arr, $model->id_zakaz);
}
$financy->saveSum($model->fact_oplata, $model->id_zakaz, $model->oplata);
Yii::$app->session->addFlash('update', 'Успешно создан заказ '.$model->id_zakaz);
if (Yii::$app->user->id != User::USER_ADMIN ){
$notification->getByIdNotification(2, $model->id_zakaz);
$notification->getSaveNotification();
}
if($model->status == Zakaz::STATUS_DISAIN){
$notification->getByIdNotification(3, $model->id_zakaz);
$notification->getSaveNotification();
/* $telegram->message(User::USER_DISAYNER, 'Назначен заказ '.$model->prefics.' '.$model->description);*/
}
if ($model->status == Zakaz::STATUS_MASTER ){
$notification->getByIdNotification(4, $model->id_zakaz);
$notification->getSaveNotification();
/* $telegram->message(User::USER_MASTER, 'Назначен заказ '.$model->prefics.' '.$model->description);*/
}
/*$telegram->message(User::USER_ADMIN, 'Создан заказ '.$model->prefics.' '.$model->description);*/
}
if (Yii::$app->user->can('shop')) {
return $this->redirect(['shop']);
} elseif (Yii::$app->user->can('admin')) {
return $this->redirect(['admin']);
}
}
}
return $this->render('create', [
'model' => $model,
'client' => $client,
]);
}
<div class="col-xs-10">
<?= $form->field($test1, 'time_input')->widget(DateControl::className(),
[
'convertFormat' => true,
'type'=>DateControl::FORMAT_DATE,
'widgetOptions' => [
'pluginOptions' => [
'autoclose' => true,
],
'options' => ['placeholder' => 'Cрок']
],
])->label(false);?>
</div>
<div class="col-xs-10">
<?= $form->field($test2, 'time_input')->widget(DateControl::classname(), [
'type'=>DateControl::FORMAT_TIME,
'ajaxConversion'=>false,
'widgetOptions' => [
'pluginOptions' => [
'autoclose' => true
],
'options' => ['placeholder' => 'Время']
]
])->label(false);?>
</div>
<?php $datetime = $test1->data_input.' '.$test2->time_input ?>
<?php ActiveForm::begin(); ?>
$form->field($model, 'time_input')
<blockquote><?php echo date("H:i:s");;
$script = <<<JS
function show()
{
$.ajax({
type: "POST",
url: "admin",
cache: false,
success: function(html){
$("#content").html(html);
}
});
}
show();
setInterval('show()',10000);
JS;
$this->registerJs($script);
echo '<div id="content"></div>';
?></blockquote>