diff --git a/controllers/OrderController.php b/controllers/OrderController.php index 07bd0ca..511cadb 100755 --- a/controllers/OrderController.php +++ b/controllers/OrderController.php @@ -136,16 +136,16 @@ return $this->redirect([ 'index' ]); } - public function actionDeleteProduct($id) - { - $model = OrderProduct::findOne($id); - $model->removed = true; - $orderId = $model->order_id; - if ($model->save()) { - $model->order->totalRecount(); - return $this->actionUpdate($orderId); - } - } + // public function actionDeleteProduct($id) + // { + // $model = OrderProduct::findOne($id); + // $model->removed = true; + // $orderId = $model->order_id; + // if ($model->save()) { + // $model->order->totalRecount(); + // return $this->actionUpdate($orderId); + // } + // } public function actionAdd() { @@ -330,7 +330,8 @@ $dataProvider = new ActiveDataProvider( [ 'query' => $model->getProducts() - ->joinWith('productVariant.product.brand'), + ->joinWith('productVariant.product.brand') + ->with('productVariant.variantStocks'), 'sort' => [ 'defaultOrder' => [ 'id' => SORT_ASC ] ], ] ); @@ -402,16 +403,19 @@ return $phone . $content . $result; } - // public function actionDeleteProduct($id, $order_id) - // { - // $model = OrderProduct::findOne($id); - // $model->delete(); - // \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; - // return [ - // 'result' => 'success', - // 'id' => $id, - // ]; - // } + public function actionDeleteProduct($id, $order_id) + { + $model = OrderProduct::findOne($id); + $model->removed = true; + $model->save(); + $order = Order::findOne($order_id); + $order->totalRecount(); + \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; + return [ + 'status' => 'success', + 'id' => $id, + ]; + } protected function findModel($id) { diff --git a/models/ProductVariant.php b/models/ProductVariant.php index 6e3f409..25db6bc 100755 --- a/models/ProductVariant.php +++ b/models/ProductVariant.php @@ -35,6 +35,7 @@ * @property Stock[] $stocks * @property TaxGroup[] $properties * @property TaxGroup[] $taxGroupsByLevel + * @property string $size * * From language behavior * * @property ProductVariantLang $lang * @property ProductVariantLang[] $langs @@ -70,7 +71,6 @@ public $customOption = []; - /** * @var int[] $options */ @@ -104,8 +104,8 @@ 'directory' => 'products', 'column' => 'image', 'links' => [ - 'product_id' => 'product_id', - 'id' => 'product_variant_id', + 'product_id' => 'product_id', + 'id' => 'product_variant_id', ], 'model' => ProductImage::className(), ], @@ -240,7 +240,7 @@ } else { $quantity = $this->getProductStocks() ->sum('quantity'); - if (empty( $quantity )) { + if (empty($quantity)) { $this->stock = 0; } else { $this->stock = (int) $quantity; @@ -279,7 +279,7 @@ return $this->hasMany(TaxOption::className(), [ 'id' => 'option_id' ]) ->viaTable('product_variant_option', [ 'product_variant_id' => 'id' ]); } - + /** * Get one variant's option whith needed conditions, or random if condition is empty * @@ -290,11 +290,9 @@ public function getOption(array $conditions = []) { $query = $this->hasOne(TaxOption::className(), [ 'id' => 'option_id' ]) - ->viaTable('product_variant_option', [ 'product_variant_id' => 'id' ]); - foreach ($conditions as $condition) - { - if (!empty($condition) && is_array($condition)) - { + ->viaTable('product_variant_option', [ 'product_variant_id' => 'id' ]); + foreach ($conditions as $condition) { + if (!empty($condition) && is_array($condition)) { $query->andFilterWhere($condition); } } @@ -333,7 +331,7 @@ { $this->options = $values; } - + /** * Get all TaxGroups for current ProductVariant filled with $customOptions that satisfy current ProductVariant * @@ -362,12 +360,11 @@ $query->andFilterWhere($condition); } } - foreach ( - $query->all() as $group) { + foreach ($query->all() as $group) { /** * @var TaxGroup $group */ - if (!empty( $options[ $group->id ] )) { + if (!empty($options[ $group->id ])) { $group->customOptions = $options[ $group->id ]; $groups[] = $group; } @@ -421,7 +418,7 @@ public function afterSave($insert, $changedAttributes) { parent::afterSave($insert, $changedAttributes); - if (!empty( $this->options )) { + if (!empty($this->options)) { $options = TaxOption::findAll($this->options); $this->unlinkAll('options', true); foreach ($options as $option) { @@ -429,7 +426,7 @@ } } - if (!empty( $this->stocks )) { + if (!empty($this->stocks)) { ProductStock::deleteAll([ 'product_variant_id' => $this->id ]); foreach ($this->stocks as $id => $quantity) { /** @@ -448,4 +445,25 @@ } } } + + /** + * @return string + */ + public function getSize() + { + $option = $this->getOptions() + ->with('lang') + ->joinWith('group') + ->where( + [ + 'tax_group.position' => 1, + ] + ) + ->one(); + if (empty($option)) { + return ''; + } else { + return $option->lang->value; + } + } } diff --git a/views/order/_form.php b/views/order/_form.php index 01cebe9..4092fb8 100755 --- a/views/order/_form.php +++ b/views/order/_form.php @@ -7,6 +7,7 @@ use backend\models\SmsTemplate; use common\models\User; use kartik\grid\GridView; + use kartik\grid\SerialColumn; use kartik\widgets\DatePicker; use kartik\widgets\Select2; use kartik\widgets\SwitchInput; @@ -15,8 +16,10 @@ use yii\bootstrap\ActiveForm; use yii\helpers\ArrayHelper; use artweb\artbox\ecommerce\models\Delivery; + use yii\helpers\StringHelper; use yii\web\View; use yii\web\JsExpression; + use yii\widgets\Pjax; /** * @var View $this @@ -39,7 +42,23 @@ $(document).on('submit', '#add-product-form', function(e) { data: addFormData, success: function (data) { if (data.status === "success") { - $.pjax.reload({container:"#order-products-grid"}); //Reload GridView + $.pjax.reload({container:"#order-products-grid"}); + } + }, + error: function () { + } + }); +}); +$(document).on('click', '.delete-button', function(e) { + e.preventDefault(); + var link = $(this).attr('href') + '&order_id=' + {$model->id}; + $.ajax({ + url: link, + type: "GET", + success: function (data) { + if (data.status === "success") { + $.pjax.reload({container:"#order-products-grid"}); + $('[data-toggle="popover"]').popover(); } }, error: function () { @@ -54,6 +73,11 @@ JS; $('#order-phone, #order-phone2').mask('+38(000)000-00-00', { placeholder: '+38(___)___-__-__' }); +$('[data-toggle="popover"]').popover(); +$(document).on('pjax:end', '#order-products-grid', function() { + $('[data-toggle="popover"]').popover(); + $.pjax.reload({container: '#total-cost'}); +}); JS; $this->registerJs($js, View::POS_READY); @@ -120,480 +144,538 @@ JS; 'main-form' ]); ?>
-
-
-
-
- - field($model, 'deadline') - ->widget( - DatePicker::className(), - [ - - ] - ) ?> - - isAdmin()) { - echo $form->field($model, 'pay') - ->widget( - SwitchInput::className(), - [ - 'name' => 'pay', - 'pluginOptions' => [ - 'onText' => \Yii::t('app', 'Оплачено'), - 'offText' => \Yii::t('app', 'Не оплачено'), - ], - ] - ); - } - ?> - - field($model, 'reason') - ->dropDownList( - Order::REASONS, - [ 'prompt' => 'Выберите причину' ] - ) ?> - - field($model, 'label') - ->dropDownList( - ArrayHelper::map( - Label::find() - ->asArray() - ->all(), - 'id', - 'label' - ), - [ 'prompt' => 'Выберите метку' ] - ); ?> - - field($model, 'name') ?> - - field($model, 'phone') - ->textInput([ 'readonly' => $user->isAdmin() ? false : true ]) ?> - - field($model, 'phone2') ?> - - field($model, 'email') - ->textInput([ 'readonly' => $user->isAdmin() ? false : true ]) ?> - - field( - $model, - 'numbercard' - ) - ->textInput([ 'readonly' => true ]) ?> - - field($model, 'comment') - ->textarea([ 'rows' => '3' ]) ?> - field($model, 'delivery') - ->dropDownList( - ArrayHelper::map( - Delivery::find() - ->joinWith('lang') - ->asArray() - ->all(), - 'id', - 'lang.title' - ), - [ 'prompt' => \Yii::t('app', 'Выберите доставку ...') ] - ) ?> - - isAdmin()) { - echo $form->field($model, 'manager_id') - ->dropDownList( - ArrayHelper::map( - User::find() - ->asArray() - ->all(), - 'id', - 'username' - ), - [ 'prompt' => \Yii::t('app', 'Менеджер') ] - ); - } - ?> - -

- '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', - ] - ); - } - ?> -
-
- +
+
+
+ + field($model, 'deadline') + ->widget( + DatePicker::className(), + [ + + ] + ) ?> + + isAdmin()) { + echo $form->field($model, 'pay') + ->widget( + SwitchInput::className(), [ - '1' => 'Первый номер', - '2' => 'Второй номер', + 'name' => 'pay', + 'pluginOptions' => [ + 'onText' => \Yii::t('app', 'Оплачено'), + 'offText' => \Yii::t('app', 'Не оплачено'), + ], ] ); - ?> -
-
- -
-
- - field($model, 'declaration') ?> - - field($model, 'stock') ?> - - field($model, 'consignment') ?> - - field($model, 'payment') - ->dropDownList( - ArrayHelper::map( - OrderPayment::find() - ->where([ 'status' => OrderPayment::ACTIVE ]) - ->asArray() - ->all(), - 'id', - 'short' - ), - [ 'prompt' => 'Способ оплаты ...' ] - ); ?> - - field($model, 'insurance') ?> - - field($model, 'amount_imposed') ?> - - field($model, 'shipping_by') - ->dropDownList( - ArrayHelper::getColumn(Order::SHIPPING_BY, 'label'), - [ 'prompt' => 'Оплата доставки ...' ] - ); ?> - - field($model, 'city') ?> - - field($model, 'adress') ?> - - field($model, 'body') - ->textarea([ 'rows' => '3' ]) ?> - - field($model, 'check') ?> - - field($model, 'sms') ?> - - field($model, 'delivery_cost') ?> - -
+ } + ?> + + field($model, 'reason') + ->dropDownList( + Order::REASONS, + [ 'prompt' => 'Выберите причину' ] + ) ?> + + field($model, 'label') + ->dropDownList( + ArrayHelper::map( + Label::find() + ->asArray() + ->all(), + 'id', + 'label' + ), + [ 'prompt' => 'Выберите метку' ] + ); ?> + + field($model, 'name') ?> + + field($model, 'phone') + ->textInput([ 'readonly' => $user->isAdmin() ? false : true ]) ?> + + field($model, 'phone2') ?> + + field($model, 'email') + ->textInput([ 'readonly' => $user->isAdmin() ? false : true ]) ?> + + field( + $model, + 'numbercard' + ) + ->textInput([ 'readonly' => true ]) ?> + + field($model, 'comment') + ->textarea([ 'rows' => '3' ]) ?> + field($model, 'delivery') + ->dropDownList( + ArrayHelper::map( + Delivery::find() + ->joinWith('lang') + ->asArray() + ->all(), + 'id', + 'lang.title' + ), + [ 'prompt' => \Yii::t('app', 'Выберите доставку ...') ] + ) ?> + + isAdmin()) { + echo $form->field($model, 'manager_id') + ->dropDownList( + ArrayHelper::map( + User::find() + ->asArray() + ->all(), + 'id', + 'username' + ), + [ 'prompt' => \Yii::t('app', 'Менеджер') ] + ); + } + ?> + +

+ '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', + ] + ); + } + ?> +
+
+ 'Первый номер', + '2' => 'Второй номер', + ] + ); + ?> +
+ +
+
+ + field($model, 'declaration') ?> + + field($model, 'stock') ?> + + field($model, 'consignment') ?> + + field($model, 'payment') + ->dropDownList( + ArrayHelper::map( + OrderPayment::find() + ->where([ 'status' => OrderPayment::ACTIVE ]) + ->asArray() + ->all(), + 'id', + 'short' + ), + [ 'prompt' => 'Способ оплаты ...' ] + ); ?> + + field($model, 'insurance') ?> + + field($model, 'amount_imposed') ?> + + field($model, 'shipping_by') + ->dropDownList( + ArrayHelper::getColumn(Order::SHIPPING_BY, 'label'), + [ 'prompt' => 'Оплата доставки ...' ] + ); ?> + + field($model, 'city') ?> + + field($model, 'adress') ?> + + field($model, 'body') + ->textarea([ 'rows' => '3' ]) ?> + + field($model, 'check') ?> + + field($model, 'sms') ?> + + field($model, 'delivery_cost') ?> + +
+


-
- $dataProvider, - 'rowOptions' => function($model) { - if ($model->removed) { - return [ 'class' => 'danger' ]; - } else { - return []; - } - }, - 'layout' => '{items}{pager}', - 'columns' => [ - 'id', - 'sku', - 'product_name', - 'productVariant.product.brand.lang.title', - 'productVariant.lang.title', - 'price', - [ - 'class' => 'kartik\grid\EditableColumn', - 'attribute' => 'count', - 'editableOptions' => [ - 'header' => \Yii::t('app', 'Количество'), - 'inputType' => kartik\editable\Editable::INPUT_SPIN, - 'options' => [ - 'pluginOptions' => [ - 'min' => 0, - 'max' => 5000, - ], - ], - 'pluginEvents' => [ - 'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }', - ], - ], - 'format' => [ - 'decimal', - 0, - ], - 'pageSummary' => false, - ], - 'sum_cost', - [ - 'class' => 'kartik\grid\EditableColumn', - 'attribute' => 'booking', - 'editableOptions' => [ - 'header' => \Yii::t('app', 'Бронь'), - 'inputType' => kartik\editable\Editable::INPUT_TEXT, - 'options' => [ - 'class' => 'booking-typeahead', - 'pluginOptions' => [ - 'min' => 0, - 'max' => 20, - ], - ], - 'pluginEvents' => [ - 'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }', - ], - ], - 'format' => [ - 'text', - ], - 'pageSummary' => false, - ], - [ - 'class' => 'kartik\grid\EditableColumn', - 'attribute' => 'status', - 'editableOptions' => [ - 'header' => \Yii::t('app', 'Статус'), - 'inputType' => kartik\editable\Editable::INPUT_TEXT, - 'options' => [ - 'class' => 'status-typeahead', - 'pluginOptions' => [ - 'min' => 0, - 'max' => 20, - ], - ], - 'pluginEvents' => [ - 'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }', - ], - ], - 'format' => [ - 'text', - ], - 'pageSummary' => false, - ], - [ - 'class' => 'kartik\grid\EditableColumn', - 'attribute' => 'return', - 'editableOptions' => [ - 'header' => \Yii::t('app', 'Возврат'), - 'inputType' => kartik\editable\Editable::INPUT_CHECKBOX, - 'options' => [], - 'pluginEvents' => [ - 'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }', - ], - ], - 'format' => [ - 'boolean', - ], - 'pageSummary' => false, - ], - [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{delete}', - 'buttons' => [ - 'delete' => function($url, $model) { - if ($model->removed) { - return ''; - } else { - return Html::a( - Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-trash' ]), - [ - 'delete-product', - 'id' => $model->id, - ], - [ - 'data' => [ - 'confirm' => 'Вы уверены, что хотите удалить этот элемент?', - 'method' => 'POST', - ], - ] - ); - } - }, - ], - ], - ], - 'responsive' => true, - 'hover' => true, - 'pjax' => true, - 'pjaxSettings' => [ - 'options' => [ - 'scrollTo' => 'false', - 'id' => 'order-products-grid', - ], - ], - ] - ); - ?> -
+
+ $dataProvider, + 'rowOptions' => function($model) { + if ($model->removed) { + return [ 'class' => 'danger' ]; + } else { + return []; + } + }, + 'layout' => '{items}{pager}', + 'columns' => [ + [ + 'class' => SerialColumn::className(), + ], + 'sku', + [ + 'attribute' => 'product_name', + 'content' => function($model) { + if (!empty($model->product_name)) { + return Html::a( + StringHelper::truncate($model->product_name, 10, '...'), + '#', + [ + 'data-toggle' => 'tooltip', + 'title' => $model->product_name, + 'onclick' => 'event.preventDefault();', + ] + ); + } else { + return ''; + } + }, + ], + 'productVariant.product.brand.lang.title', + [ + 'attribute' => 'productVariant.lang.title', + 'label' => \Yii::t('app', 'Цвет'), + 'content' => function($model) { + if (preg_match('@.*\.(png|jpg|gif)@i', $model->productVariant->lang->title)) { + return ''; + } else { + return $model->productVariant->lang->title; + } + }, + ], + 'productVariant.size', + 'price', + [ + 'class' => 'kartik\grid\EditableColumn', + 'attribute' => 'count', + 'editableOptions' => [ + 'header' => \Yii::t('app', 'Количество'), + 'inputType' => kartik\editable\Editable::INPUT_SPIN, + 'options' => [ + 'pluginOptions' => [ + 'min' => 0, + 'max' => 5000, + ], + ], + 'pluginEvents' => [ + 'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }', + ], + ], + 'format' => [ + 'decimal', + 0, + ], + 'pageSummary' => false, + ], + 'sum_cost', + [ + 'class' => 'kartik\grid\EditableColumn', + 'attribute' => 'booking', + 'editableOptions' => [ + 'header' => \Yii::t('app', 'Бронь'), + 'inputType' => kartik\editable\Editable::INPUT_TEXT, + 'options' => [ + 'class' => 'booking-typeahead', + 'pluginOptions' => [ + 'min' => 0, + 'max' => 20, + ], + ], + 'pluginEvents' => [ + 'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }', + ], + ], + 'format' => [ + 'text', + ], + 'pageSummary' => false, + ], + [ + 'class' => 'kartik\grid\EditableColumn', + 'attribute' => 'status', + 'editableOptions' => [ + 'header' => \Yii::t('app', 'Статус'), + 'inputType' => kartik\editable\Editable::INPUT_TEXT, + 'options' => [ + 'class' => 'status-typeahead', + 'pluginOptions' => [ + 'min' => 0, + 'max' => 20, + ], + ], + 'pluginEvents' => [ + 'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }', + ], + ], + 'format' => [ + 'text', + ], + 'pageSummary' => false, + ], + [ + 'class' => 'kartik\grid\EditableColumn', + 'attribute' => 'return', + 'editableOptions' => [ + 'header' => \Yii::t('app', 'Возврат'), + 'inputType' => kartik\editable\Editable::INPUT_CHECKBOX, + 'options' => [], + 'pluginEvents' => [ + 'editableSuccess' => 'function(event) { $.pjax.reload({container:"#order-products-grid"}); }', + ], + ], + 'format' => [ + 'boolean', + ], + 'pageSummary' => false, + ], + [ +// 'label' => \Yii::t('app', 'Склады'), + 'content' => function($model) { + $content = ''; + foreach ($model->productVariant->variantStocks as $stock) { + $content .= ''; + } + return Html::a( + '', + '#', + [ + 'onclick' => 'event.preventDefault();', + 'data-toggle' => 'popover', + 'data-placement' => 'left', + 'data-html' => 'true', + 'data-content' => $content . '
Складкол.
' . $stock->stock->title . '' . $stock->quantity . '
', + ] + ); + }, + ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{delete}', + 'buttons' => [ + 'delete' => function($url, $product) { + if ($product->removed) { + return ''; + } else { + return Html::a( + Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-trash' ]), + [ + 'delete-product', + 'id' => $product->id, + ], + [ + 'class' => 'delete-button', + // 'data' => [ + // 'confirm' => 'Вы уверены, что хотите удалить этот элемент?', + // 'method' => 'GET', + // ], + ] + ); + } + }, + ], + ], + ], + 'responsive' => true, + 'hover' => true, + 'pjax' => true, + 'pjaxSettings' => [ + 'options' => [ + 'scrollTo' => 'false', + 'id' => 'order-products-grid', + ], + ], + ] + ); + ?> +
-
-
- yii\helpers\Url::to([ 'add' ]), - 'id' => 'add-product-form', - ] - ); - $newOrderProduct = new OrderProduct(); - ?> -
- field($newOrderProduct, 'id') - ->widget( - Select2::className(), - [ - 'options' => [ 'placeholder' => 'Search for a product ...' ], - 'pluginOptions' => [ - 'allowClear' => true, - 'disabled' => $model->isNewRecord ? true : false, - 'minimumInputLength' => 3, - 'language' => [ - 'errorLoading' => new JsExpression( - "function () { return 'Waiting for results...'; }" - ), - ], - 'ajax' => [ - 'url' => \yii\helpers\Url::to([ 'find-product' ]), - 'dataType' => 'json', - 'data' => new JsExpression( - 'function(params) { return {q:params.term}; }' - ), - ], - 'escapeMarkup' => new JsExpression( - 'function (markup) { return markup; }' - ), - 'templateResult' => new JsExpression( - 'function(data) { return data.sku; }' + 'total-cost' ]); ?> +

Сумма заказа : total; ?>

+ +
+
+
+ yii\helpers\Url::to([ 'add' ]), + 'id' => 'add-product-form', + ] + ); + $newOrderProduct = new OrderProduct(); + ?> +
+ field($newOrderProduct, 'id') + ->widget( + Select2::className(), + [ + 'options' => [ 'placeholder' => 'Search for a product ...' ], + 'pluginOptions' => [ + 'allowClear' => true, + 'disabled' => $model->isNewRecord ? true : false, + 'minimumInputLength' => 3, + 'language' => [ + 'errorLoading' => new JsExpression( + "function () { return 'Waiting for results...'; }" ), - 'templateSelection' => new JsExpression( - 'function (data) { return data.sku; }' + ], + 'ajax' => [ + 'url' => \yii\helpers\Url::to([ 'find-product' ]), + 'dataType' => 'json', + 'data' => new JsExpression( + 'function(params) { return {q:params.term}; }' ), ], - ] - ); - - ?> -
-
- field( - $newOrderProduct, - 'count' - ) - ->input( - 'number', - [ - 'disabled' => $model->isNewRecord ? true : false, - ] - ); ?> -
-
- $model->isNewRecord ? 'btn btn-primary disabled' : 'btn btn-primary', - ] - ) ?> -
- field($newOrderProduct, 'order_id') - ->hiddenInput( + 'escapeMarkup' => new JsExpression( + 'function (markup) { return markup; }' + ), + 'templateResult' => new JsExpression( + 'function(data) { return data.sku; }' + ), + 'templateSelection' => new JsExpression( + 'function (data) { return data.sku; }' + ), + ], + ] + ); + + ?> +
+
+ field( + $newOrderProduct, + 'count' + ) + ->input( + 'number', [ - 'value' => $model->id, + 'disabled' => $model->isNewRecord ? true : false, ] - ) - ->label(false) ?> - + ); ?>
- -
-
- isNewRecord ? \Yii::t('app', 'Создать') : \Yii::t('app', 'Сохранить'), - [ - 'class' => $model->isNewRecord ? 'btn btn-success btn-lg' : 'btn btn-primary btn-lg', - 'id' => 'page-submit', - ] - ) ?> - $model->id, - ] - ), +
+ $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', + 'class' => $model->isNewRecord ? 'btn btn-primary disabled' : 'btn btn-primary', ] ) ?>
+ field($newOrderProduct, 'order_id') + ->hiddenInput( + [ + 'value' => $model->id, + ] + ) + ->label(false) ?> + +
+ +
+
+ isNewRecord ? \Yii::t('app', 'Создать') : \Yii::t('app', 'Сохранить'), + [ + 'class' => $model->isNewRecord ? 'btn btn-success btn-lg' : 'btn btn-primary btn-lg', + 'id' => 'page-submit', + ] + ) ?> + $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', + ] + ) ?> +

-- libgit2 0.21.4