Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.06 KB | None | 0 0
  1. <?php
  2. use common\models\product\Item;
  3. use yii\widgets\ActiveForm;
  4. use yii\helpers\Html;
  5. use yii\helpers\ArrayHelper;
  6. use backend\modules\product\models\Delivery;
  7. use backend\modules\product\models\Brand;
  8. use common\models\photo\Album;
  9. use backend\modules\core\widgets\UriWidget\UriWidget;
  10. ?>
  11.  
  12. <div class="">
  13.     <div class="crud-create">
  14.         <h1 id="description"><?= $title; ?> </h1>
  15.         <div class="crud-form" id="crud-form">
  16.  
  17.             <?php $form = ActiveForm::begin([
  18.                 'id' => 'id_form',
  19.                 'enableAjaxValidation'=>true,
  20.             ]); ?>
  21.  
  22.             <ul class="nav nav-tabs" role="tablist">
  23.                 <li class="active"><a href="#items" role="tab" data-toggle="tab"><?= Yii::t('admin', 'Item');?></a></li>
  24.                 <li><a href="#meta" role="tab" data-toggle="tab"><?= Yii::t('admin', 'Meta')?></a></li>
  25.             </ul>
  26.  
  27.             <!-- Tab panes -->
  28.             <div class="tab-content">
  29.                 <div class="tab-pane active" id="items">
  30.  
  31.                     <?= $form->field($model, 'category_id')->dropDownList($categ, ['prompt'=>Yii::t('admin', 'Choose category'), 'class'=>'form-control', 'id'=>'item-category'])?>
  32.                    
  33.                     <?php if($master){
  34.                             echo ($form->field($model, 'master_id')->dropDownList([],['prompt'=>Yii::t('admin', 'Choose master product'), 'class'=>'form-control', 'id'=>'item', 'disabled'=>'disabled']));
  35.                         }
  36.                     ?>
  37.                    
  38.                     <?= $form->field($model, 'articul')->textInput(); ?>
  39.                    
  40.                     <?= $form->field($model, 'title')->textInput(); ?>
  41.                    
  42.                     <?= $form->field($model, 'uri')->widget(UriWidget::className(), [
  43.                         'options' => [
  44.                             'class' => 'form-control',
  45.                         ],
  46.                         'nameModel'       => call_user_func(array(get_class($model), 'className')),
  47.                         'donorAttribute'  => 'title',
  48.                     ]); ?>
  49.                    
  50.                     <?= $form->field($model, 'small_description')->textArea(['rows' => '5']); ?>
  51.                    
  52.                     <?= $form->field($model, 'description')->textArea(['rows'=>'10']); ?>
  53.                    
  54.                     <?= $form->field($model, 'price')->textInput(); ?>
  55.                    
  56.                     <?= $form->field($model, 'count')->textInput(); ?>
  57.                    
  58.                     <?= $form->field($model, 'discount')->dropDownList($model->getDiscounts(), ['prompt' => Yii::t('admin', 'Choose discount')]); ?>
  59.  
  60.                     <?= $form->field($model, 'action_price')->textInput(); ?>
  61.                    
  62.                     <?= $form->field($model, 'date_start_action')->widget('trntv\yii\datetime\DateTimeWidget', [
  63.                         'clientOptions' => [
  64.                             'sideBySide' => TRUE,
  65.                         ],
  66.                     ]); ?>
  67.  
  68.                     <?= $form->field($model, 'date_finish_action')->widget('trntv\yii\datetime\DateTimeWidget', [
  69.                         'clientOptions' => [
  70.                             'sideBySide' => TRUE,
  71.                         ],
  72.                     ]); ?>
  73.  
  74.                     <?php if ($model->preview) : ?>
  75.                                
  76.                                 <div class="row">
  77.                                     <div class="col-lg-3">
  78.                                         <img src="<?= $model->getPreview(); ?>" alt="" class="img-responsive">
  79.                                     </div>
  80.                                 </div>
  81.  
  82.                             <?php endif; ?>
  83.                    
  84.                     <?= $form->field($model, 'preview')->fileInput(); ?>
  85.                    
  86.                     <?php
  87.                         if ($master) {
  88.                             echo($form->field($model, 'delivery_id')->dropDownList(ArrayHelper::map(Delivery::find()->all(), 'id', 'title'), ['prompt' => Yii::t('admin', 'Choose delivery'), 'class' => 'myHide form-control']));
  89.  
  90.                             echo($form->field($model, 'brand_id')->dropDownList(ArrayHelper::map(Brand::find()->all(), 'id', 'title'), ['prompt' => Yii::t('admin', 'Choose brand'), 'class'=>'myHide form-control']));  
  91.  
  92.                         } else {
  93.                             echo($form->field($model, 'delivery_id')->dropDownList(ArrayHelper::map(Delivery::find()->all(), 'id', 'title'), ['prompt' => Yii::t('admin', 'Choose delivery'), 'class' => 'updateHide form-control']));
  94.  
  95.                             echo($form->field($model, 'brand_id')->dropDownList(ArrayHelper::map(Brand::find()->all(), 'id', 'title'), ['prompt' => Yii::t('admin', 'Choose brand'), 'class'=>'updateHide form-control']));
  96.                         }
  97.                     ?>
  98.                    
  99.                     <?= $form->field($model, 'photo_album_id')->dropDownList(ArrayHelper::map(Album::find()->all(), 'id', 'name'), ['prompt' => Yii::t('admin', 'Choose Album')]); ?>
  100.  
  101.                     <?= $form->field($model, 'availability')->dropDownList(Item::getAvailabeList(), ['prompt'=>Yii::t('admin', 'Choose availability'), 'class'=>'form-control'])?>
  102.  
  103.                     <?= $form->field($model, 'active')->checkbox(); ?>
  104.  
  105.                 </div>
  106.                 <div class="tab-pane" id="meta">
  107.  
  108.                     <?= $form->field($model, 'meta_title')->textInput(); ?>
  109.                    
  110.                     <?= $form->field($model, 'meta_description')->textArea(['rows' => '10']); ?>
  111.                    
  112.                     <?= $form->field($model, 'meta_keywords')->textArea(['rows'=>'10']); ?>
  113.  
  114.                 </div>
  115.             </div>
  116.             <div class="form-group">
  117.  
  118.                 <?= Html::submitButton(Yii::t('common', 'Update'), ['class' => 'btn btn-success']); ?>
  119.  
  120.             </div>
  121.  
  122.             <?php ActiveForm::end(); ?>
  123.  
  124.         </div>
  125.     </div>
  126. </div>
  127. <div class="hide" id ='updateMaster' data ="<?= $master?>"></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement