diff --git a/controllers/OrderController.php b/controllers/OrderController.php index 6d75810..4d9458f 100755 --- a/controllers/OrderController.php +++ b/controllers/OrderController.php @@ -290,7 +290,7 @@ } $model = $this->findModel($id); - + /** * @var User $user */ @@ -388,7 +388,7 @@ throw new NotFoundHttpException('The requested page does not exist.'); } } - + public function actionExitOrder($id) { $this->unblockOrder($id); @@ -413,7 +413,10 @@ 'time' => $date, ]; } else { - return [ 'success' => false ]; + return [ + 'success' => false, + 'errors' => $model->errors, + ]; } } } diff --git a/models/Order.php b/models/Order.php index 8a27ba0..092d2ee 100755 --- a/models/Order.php +++ b/models/Order.php @@ -110,6 +110,7 @@ ], [ [ + 'shipping_by', 'created_at', 'updated_at', 'deleted_at', @@ -159,7 +160,6 @@ 'consignment', 'insurance', 'amount_imposed', - 'shipping_by', 'city', 'adress', 'status', diff --git a/models/OrderPayment.php b/models/OrderPayment.php index f76a3c5..23d3b5b 100644 --- a/models/OrderPayment.php +++ b/models/OrderPayment.php @@ -1,97 +1,98 @@ [ + 'class' => LanguageBehavior::className(), + 'objectLang' => OrderPaymentLang::className(), + 'ownerKey' => 'id', + 'langKey' => 'order_payment_id', + ], + ]; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ 'status' ], + 'integer', + ], + [ + [ 'status' ], + 'default', + 'value' => 1, + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => \Yii::t('app', 'ID'), + 'status' => \Yii::t('app', 'Статус'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOrderPaymentLangs() + { + return $this->hasMany(OrderPaymentLang::className(), [ 'order_payment_id' => 'id' ]); + } } - - - public function behaviors() - { - return [ - 'language' => [ - 'class' => LanguageBehavior::className(), - 'objectLang' => OrderPaymentLang::className(), - 'ownerKey' => 'id', - 'langKey' => 'order_payment_id', - ], - ]; - } - - /** - * @inheritdoc - */ - public function rules() - { - return [ - [['status'], 'integer'], - [ - [ 'status' ], - 'default', - 'value' => 1, - ], - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => \Yii::t('app','ID'), - 'status' => \Yii::t('app','Статус'), - ]; - } - - /** - * @return \yii\db\ActiveQuery - */ - public function getOrderPaymentLangs() - { - return $this->hasMany(OrderPaymentLang::className(), ['order_payment_id' => 'id']); - } -} diff --git a/views/order/_form.php b/views/order/_form.php index cf66cd0..5a1970b 100755 --- a/views/order/_form.php +++ b/views/order/_form.php @@ -92,37 +92,6 @@ JS;
-
- isNewRecord ? \Yii::t('app', 'Создать') : \Yii::t('app', 'Обновить'), - [ 'class' => $model->isNewRecord ? 'btn btn-success btn-lg' : 'btn btn-primary btn-lg' ] - ) ?> - $model->id, - ] - ), - [ - 'class' => $model->isNewRecord ? 'btn btn-info disabled btn-lg' : 'btn btn-info btn-lg', - 'target' => '_blank', - ] - ) ?> - $model->id, - ] - ), - [ - 'class' => $model->isNewRecord ? 'btn btn-info disabled btn-lg' : 'btn btn-info btn-lg', - ] - ) ?> -

@@ -196,6 +165,7 @@ JS; ) ?> user->identity->isAdmin()) { echo $form->field($model, 'manager_id') ->dropDownList( @@ -210,7 +180,60 @@ JS; ) ; } ?> + +

+ 'sms-template-selector', + 'name' => 'select-sms-template', + 'data' => ArrayHelper::map( + SmsTemplate::find() + ->asArray() + ->all(), + 'text', + 'title' + ), + 'options' => [ 'placeholder' => \Yii::t('app', 'Выберите шаблон') ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ] + ); + ?> +
+ 3, + 'id' => 'sms-text-area', + 'class' => 'form-control', + ] + ); + ?> +
+ isNewRecord) { + echo Html::button( + \Yii::t('app', 'Отправить'), + [ + 'class' => 'btn btn-warning disabled', + ] + ); + } else { + echo Html::button( + \Yii::t('app', 'Отправить'), + [ + 'class' => 'btn btn-warning', + 'id' => 'send-sms-action', + ] + ); + } + ?> +
@@ -258,10 +281,43 @@ JS;
+
+
+ isNewRecord ? \Yii::t('app', 'Создать') : \Yii::t('app', 'Обновить'), + [ 'class' => $model->isNewRecord ? 'btn btn-success btn-lg' : 'btn btn-primary btn-lg' ] + ) ?> + $model->id, + ] + ), + [ + 'class' => $model->isNewRecord ? 'btn btn-info disabled btn-lg' : 'btn btn-info btn-lg', + 'target' => '_blank', + ] + ) ?> + $model->id, + ] + ), + [ + 'class' => $model->isNewRecord ? 'btn btn-info disabled btn-lg' : 'btn btn-info btn-lg', + ] + ) ?> +
- - + +
+


-
-

-
- 'sms-template-selector', - 'name' => 'select-sms-template', - 'data' => ArrayHelper::map( - SmsTemplate::find() - ->asArray() - ->all(), - 'text', - 'title' - ), - 'options' => [ 'placeholder' => \Yii::t('app', 'Выберите шаблон') ], - 'pluginOptions' => [ - 'allowClear' => true, - ], - ] - ); - - ?> -
- 3, - 'id' => 'sms-text-area', - 'class' => 'form-control', - ] - ); - ?> -
- isNewRecord) { - echo Html::button( - \Yii::t('app', 'Отправить'), - [ - 'class' => 'btn btn-warning disabled', - ] - ); - } else { - echo Html::button( - \Yii::t('app', 'Отправить'), - [ - 'class' => 'btn btn-warning', - 'id' => 'send-sms-action', - ] - ); - } - ?> -
-
-- libgit2 0.21.4