From 776dd7a1036a3fd052c139023d7e08c297acaf25 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 14 Jun 2017 16:16:21 +0300 Subject: [PATCH] -Added status 'waiting' --- common/modules/product/views/variant/_form.php | 289 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------- frontend/views/catalog/product.php | 3 ++- 2 files changed, 176 insertions(+), 116 deletions(-) diff --git a/common/modules/product/views/variant/_form.php b/common/modules/product/views/variant/_form.php index 1fcde25..88d8f98 100755 --- a/common/modules/product/views/variant/_form.php +++ b/common/modules/product/views/variant/_form.php @@ -1,18 +1,21 @@ registerJs($js, View::POS_LOAD); + + $this->registerJs($js, View::POS_LOAD); ?>
- - 'dynamic-form', - 'options' => ['enctype' => 'multipart/form-data'] - ]); ?> - - field($model, 'name')->textInput(['maxlength' => true]) ?> - - field($model, 'product_id')->hiddenInput()->label(false); ?> - - field($model, 'sku')->textarea(); ?> - field($model, 'price')->textarea(); ?> - field($model, 'price_old')->textarea(); ?> - field($model, 'image')->widget(\kartik\file\FileInput::classname(), [ - 'model' => $model, - 'attribute' => 'image', - 'options' => [ - 'accept' => 'image/*', - 'multiple' => true - ], - 'pluginOptions' => [ - 'allowedFileExtensions' => ['jpg','gif','png'], - 'initialPreview' => $model->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage($model->imageUrl, 'products') : '', - 'overwriteInitial' => true, - 'showRemove' => true, - 'showUpload' => false, - ], - ]); ?> - - 'dynamicform_wrapper', // required: only alphanumeric characters plus "_" [A-Za-z0-9_] - 'widgetBody' => '.container-items', // required: css class selector - 'widgetItem' => '.item', // required: css class - 'limit' => 10, // the maximum times, an element can be added (default 999) - 'min' => 0, // 0 or 1 (default 1) - 'insertButton' => '.add-item', // css class - 'deleteButton' => '.remove-item', // css class - 'model' => $stocks[0], - 'formId' => 'dynamic-form', - 'formFields' => [ - 'quantity', - 'name', - ], - ]); ?> - -
-
-

- Склады - -

-
-
-
- $stock): ?> -
-
- isNewRecord) { - echo Html::activeHiddenInput($stock, "[{$i}]stock_id"); - } - ?> -
-
- field($stock, "[{$i}]quantity")->textInput(['maxlength' => true]) ?> -
-
- field($stock, "[{$i}]name")->textInput(['maxlength' => true]) ?> -
-
- -
-
-
-
- -
-
-
- - - field($model, 'product_unit_id')->dropDownList( - ArrayHelper::map(\common\modules\product\models\ProductUnit::find()->all(), 'product_unit_id', 'name'), + + Yii::t('product', 'Unit'), - ])->label(Yii::t('product', 'Unit')) ?> + 'id' => 'dynamic-form', + 'options' => [ 'enctype' => 'multipart/form-data' ], + ] + ); ?> + + field($model, 'name') + ->textInput([ 'maxlength' => true ]) ?> + + field($model, 'product_id') + ->hiddenInput() + ->label(false); ?> + + field($model, 'sku') + ->textarea(); ?> + + field($model, 'status') + ->dropDownList( + [ + 0 => 'В наличии / под заказ', + 1 => 'снят с производства', + 2 => 'в ожидании', + ] + )->label('Статус') ?> + + field($model, 'price') + ->textarea(); ?> + field($model, 'price_old') + ->textarea(); ?> + field($model, 'image') + ->widget( + \kartik\file\FileInput::classname(), + [ + 'model' => $model, + 'attribute' => 'image', + 'options' => [ + 'accept' => 'image/*', + 'multiple' => true, + ], + 'pluginOptions' => [ + 'allowedFileExtensions' => [ + 'jpg', + 'gif', + 'png', + ], + 'initialPreview' => $model->imageUrl ? \common\components\artboximage\ArtboxImageHelper::getImage( + $model->imageUrl, + 'products' + ) : '', + 'overwriteInitial' => true, + 'showRemove' => true, + 'showUpload' => false, + ], + ] + ); ?> - - all() as $group) :?> - field($model, 'options')->checkboxList( - ArrayHelper::map($group->options, 'tax_option_id', 'ValueRenderFlash'), + true, - 'unselect' => null, + 'widgetContainer' => 'dynamicform_wrapper', + // required: only alphanumeric characters plus "_" [A-Za-z0-9_] + 'widgetBody' => '.container-items', + // required: css class selector + 'widgetItem' => '.item', + // required: css class + 'limit' => 10, + // the maximum times, an element can be added (default 999) + 'min' => 0, + // 0 or 1 (default 1) + 'insertButton' => '.add-item', + // css class + 'deleteButton' => '.remove-item', + // css class + 'model' => $stocks[ 0 ], + 'formId' => 'dynamic-form', + 'formFields' => [ + 'quantity', + 'name', + ], ] - )->label($group->name);?> - - - -
- isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> + ); ?> + +
+
+

+ Склады + +

- +
+
+ $stock): ?> +
+
+ isNewRecord) { + echo Html::activeHiddenInput($stock, "[{$i}]stock_id"); + } + ?> +
+
+ field($stock, "[{$i}]quantity") + ->textInput([ 'maxlength' => true ]) ?> +
+
+ field($stock, "[{$i}]name") + ->textInput([ 'maxlength' => true ]) ?> +
+
+ +
+
+
+
+ +
+
+
+ + + field($model, 'product_unit_id') + ->dropDownList( + ArrayHelper::map( + \common\modules\product\models\ProductUnit::find() + ->all(), + 'product_unit_id', + 'name' + ), + [ + 'prompt' => Yii::t('product', 'Unit'), + ] + ) + ->label(Yii::t('product', 'Unit')) ?> + + + all() as $group) : ?> + field($model, 'options') + ->checkboxList( + ArrayHelper::map($group->options, 'tax_option_id', 'ValueRenderFlash'), + [ + 'multiple' => true, + 'unselect' => null, + ] + ) + ->label($group->name); ?> + + + +
+ isNewRecord ? Yii::t('product', 'Create') : Yii::t('product', 'Update'), + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] + ) ?> +
+
diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php index c452f03..48747fe 100755 --- a/frontend/views/catalog/product.php +++ b/frontend/views/catalog/product.php @@ -13,7 +13,6 @@ use yii\bootstrap\ActiveForm; use yii\bootstrap\Html; use yii\helpers\Url; - use yii\helpers\VarDumper; use yii\web\View; use yii\widgets\MaskedInput; use frontend\assets\FlipclockAsset; @@ -227,6 +226,8 @@ variant->status == 1){?> снят с производства + variant->status == 2) {?> + в ожидании variant->stock > 0) {?> в наличии -- libgit2 0.21.4