Explorar o código

лот-фикс полей, показ файлов при редактировании

ks hai 3 meses
pai
achega
b566acfca3
Modificáronse 2 ficheiros con 19 adicións e 2 borrados
  1. 5 2
      models/Lots.php
  2. 14 0
      views/lots/_admin.php

+ 5 - 2
models/Lots.php

@@ -68,7 +68,7 @@ class Lots extends ActiveRecord
             [['aukname','user_id', 'name', 'description', 'start_price', 'step', 'category_id', 'member_docs', 'date'], 'required'],
             [['type_id','dogovor_id','user_id', 'category_id', 'status', 'lot_lock', 'docs_id', 'nds', 'num', 'unitId', 'count'], 'integer'],
             [['start_price', 'step'], 'number'],
-            [['serialize_data','type_id','dogovor_id','date', 'auction_date', 'bidding_date', 'address', 'step_down', 'time_step_down', 'notes', 'description'], 'safe'],
+            [['serialize_data', 'payment_term', 'payment_order', 'member_require', 'term_procedure','requisites_id', 'type_id','dogovor_id','date', 'auction_date', 'bidding_date', 'address', 'step_down', 'time_step_down', 'notes', 'description'], 'safe'],
             [['name', 'delivery_term', 'delivery_time', 'requires', 'member_docs', 'delivery_time', 'delivery_term', 'requires'], 'string', 'max' => 800],
             [['price_per_one'], 'number', 'integerOnly' => false],
             [['files'], 'image'],
@@ -148,6 +148,9 @@ class Lots extends ActiveRecord
         // }
 
         //$this->serialize_data
+
+        // echo '<pre>';print_r($this);echo '</pre>'; exit;
+        
         $this->member_docs = "NULL";
 
         return parent::save($validate, $attr);
@@ -187,7 +190,7 @@ class Lots extends ActiveRecord
             ->where([
                 'b.type' => $type,
                 'b.user_id' => Yii::$app->user->id,
-                'bd.auction_id' => $this->auction->id,
+                'bd.auction_id' => isset($this->auction) ? $this->auction->id : 0,
             ])
             ->select('b.id')
             ->scalar();

+ 14 - 0
views/lots/_admin.php

@@ -271,6 +271,13 @@ $time_change = Html::button(
             'options' => ['multiple' => false,],
         ])->label(Yii::t('app','ProjectDogovor ID')); ?>
 
+        <?php if ($model->dogovor_id): ?>
+            <a href="/files/download?id=<?=$model->dogovor_id ?>" class="btn btn-success btn-block" target="_blank">
+                Переглянути завантажений договір
+            </a>
+            <hr>
+        <?php endif; ?>        
+
         <?= $form->field($model, 'bidding_date')->widget(DateTimePicker::className(),[
             'name' => 'bidding_date',
             'type' => DateTimePicker::TYPE_COMPONENT_PREPEND,
@@ -409,6 +416,13 @@ $time_change = Html::button(
         ],
     ])->label(Yii::t('app','DopDocumentation ID')); ?>
 
+    <?php if ($model->docs_id): ?>
+        <a href="/files/download?id=<?=$model->docs_id ?>" class="btn btn-success btn-block" target="_blank">
+            Переглянути завантажену додаткову документацію
+        </a>
+        <hr>
+    <?php endif; ?>    
+
     <?= $form->field($model, 'payment_term')->textInput(['maxlength' => true]) ?>
 
     <?= $form->field($model, 'member_require')->textarea(/*['maxlength' => 5000, 'rows' => 50, 'cols' => 100]*/) ?>