Commit 71161f15299b58b82882f3b8aef5eccd0626dfdd

Authored by Volodymyr
1 parent 96c82e64

add type to product

backend/views/product/_form.php
... ... @@ -50,7 +50,12 @@
50 50  
51 51 <?= $form->field($model, 'status')
52 52 ->checkbox() ?>
53   -
  53 +
  54 + <?= $form->field($model, 'type')
  55 + ->dropDownList(
  56 + ['Отображать во всех', 'Для компаний', 'Для частных лиц']
  57 +
  58 + ) ?>
54 59 <div class="form-group">
55 60 <?= Html::submitButton(
56 61 $model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'),
... ...
common/models/Product.php
... ... @@ -9,6 +9,10 @@ use yii\db\ActiveRecord;
9 9  
10 10 class Product extends ActiveRecord
11 11 {
  12 + const TYPE_BOTH = 0;
  13 + const TYPE_COMPANY = 1;
  14 + const TYPE_PRIVATE = 2;
  15 +
12 16 /**
13 17 * @inheritdoc
14 18 */
... ... @@ -53,6 +57,7 @@ class Product extends ActiveRecord
53 57 [
54 58 'sort',
55 59 'image_id',
  60 + 'type',
56 61 ],
57 62 'integer',
58 63 ],
... ... @@ -75,6 +80,7 @@ class Product extends ActiveRecord
75 80 'status' => Yii::t('core', 'Status'),
76 81 'sort' => Yii::t('core', 'Sort'),
77 82 'price' => Yii::t('app', 'Price'),
  83 + 'type' => 'Тип продукта для главной',
78 84 // 'image_mini_id' => Yii::t('core', 'Image Mini'),
79 85  
80 86 ];
... ...
console/migrations/m220412_144550_create_product_table.php
... ... @@ -19,6 +19,7 @@ class m220412_144550_create_product_table extends Migration
19 19 'sku' =>$this->string(255),
20 20 'price' =>$this->string(255),
21 21 'image_id' => $this->integer(),
  22 + 'type' => $this->smallInteger(),
22 23 ]);
23 24 $this->addForeignKey(
24 25 'fk-product-image_id',
... ...
frontend/views/site/index.php
... ... @@ -563,4 +563,55 @@
563 563 <section class="index-map">
564 564 <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2541.835332126824!2d30.647180415730542!3d50.42553957947196!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x40d4c5184ae56b5f%3A0x90a021df035746cc!2z0YPQuy4g0KHQuNC80YTQtdGA0L7Qv9C-0LvRjNGB0LrQsNGPLCAxMywg0JrQuNC10LIsIDAyMDAw!5e0!3m2!1sru!2sua!4v1625051795776!5m2!1sru!2sua" width="100%" height="380" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
565 565 </section>
566   -</div>
567 566 \ No newline at end of file
  567 +</div>
  568 +
  569 +<!-- Modal -->
  570 +<div class="modal fade" id="cardProduct" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  571 + <div class="modal-dialog modal-lg">
  572 + <div class="modal-content kb-modal-wrapper">
  573 + <div class="card-content">
  574 + <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  575 + <div class="container">
  576 + <div class="row">
  577 + <div class="col-md-4 modal-left">
  578 + <div class="product-image">
  579 + <img src="./img/product.png" alt="Промышленная солнечная электростанция 2 МВт &#34;Под ключ&#34;">
  580 + </div>
  581 + </div>
  582 + <div class="col-md-8 modal-right">
  583 + <div class="product-code">Код товара 9000</div>
  584 + <div class="product-title">Промышленная солнечная электростанция 2 МВт "Под ключ"</div>
  585 + <div class="product-body">Промышленная солнечная электростанция устанавливается в целях продажи электроэнергии по "зеленому" тарифу для промышленных станций. Стоимость продажи электроэнергии по "зеленому" тарифу прописана законом Украины "Про электроэнергию" и составляет 0.1637 €/кВт∙ч для промышленных станций, установленных на крыше.</div>
  586 + <form class="modal-form" method="POST" action="/action">
  587 + <input type="hidden" name="product_code" value="9000">
  588 + <div class="product-counter">
  589 + <label class="kb-input">
  590 + <div class="product-counter__label">Количество</div>
  591 + <div class="product-counter__input">
  592 + <input type="number" name="amount" autocomplete="off">
  593 + <div class="product-counter__actions">
  594 + <a class="product-counter__increment"></a>
  595 + <a class="product-counter__decrement"></a>
  596 + </div>
  597 + </div>
  598 + <div class="product-counter__value" data-currency="$" data-price="1740000.00">1232</div>
  599 + </label>
  600 + </div>
  601 + <div class="modal-form__inner">
  602 + <label class="kb-input">
  603 + <div class="label-title">Телефон</div>
  604 + <input type="tel" name="phone_number" autocomplete="off" required>
  605 + </label>
  606 + <div class="submit-button-wr">
  607 + <button type="submit" class="btn big-yellow">Отправить</button>
  608 + </div>
  609 + </div>
  610 + </form>
  611 +
  612 + </div>
  613 + </div>
  614 + </div>
  615 + </div>
  616 + </div>
  617 + </div>
  618 +</div>
... ...