Commit 98f4fd016b5764f640a02db719ca509c94673a7d
1 parent
6b45a2aa
Layout fix
Showing
3 changed files
with
45 additions
and
13 deletions
Show diff stats
frontend/views/basket/modal_items.php
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | <div class="form-title uppercase">Запрос на просчет</div> |
21 | 21 | <?php |
22 | 22 | $form = ActiveForm::begin([ |
23 | - 'id' => 'basket_form', | |
23 | + 'id' => 'basket_form', | |
24 | 24 | 'fieldConfig' => [ |
25 | 25 | 'template' => '{label}{input}', |
26 | 26 | ], |
... | ... | @@ -48,7 +48,17 @@ |
48 | 48 | ->textInput(); |
49 | 49 | if(!empty( $models )) { |
50 | 50 | ?> |
51 | - <div class="form-product-wr"> | |
51 | + <div class="form-product-wr<?php switch(count($models)) { | |
52 | + case 0: | |
53 | + echo ' product_0'; | |
54 | + break; | |
55 | + case 1: | |
56 | + echo ' product_1'; | |
57 | + break; | |
58 | + case 2: | |
59 | + echo ' product_2'; | |
60 | + break; | |
61 | + } ?>"> | |
52 | 62 | <div class="style scrollbar_"> |
53 | 63 | <table> |
54 | 64 | <?php |
... | ... | @@ -75,7 +85,7 @@ |
75 | 85 | <span><?php echo $model->sku; ?></span> |
76 | 86 | </a> |
77 | 87 | </td> |
78 | - <td class="remove_" data-id="<?=$model->product_variant_id;?>"></td> | |
88 | + <td class="remove_" data-id="<?= $model->product_variant_id; ?>"></td> | |
79 | 89 | </tr> |
80 | 90 | <?php |
81 | 91 | } |
... | ... | @@ -85,17 +95,19 @@ |
85 | 95 | </div> |
86 | 96 | <?php |
87 | 97 | } |
88 | - echo $form->field($order, 'comment', ['options' => ['class' => 'input-wr']])->label('Комментарий')->textarea(); | |
89 | - ?> | |
90 | - <div class="input-wr"> | |
91 | - <a class="_more_" href="#">продолжить выбор</a> | |
92 | - <div class="button-wr"> | |
93 | - <?php | |
94 | - echo Html::submitButton('Отправить'); | |
95 | - ?> | |
96 | - </div> | |
98 | + echo $form->field($order, 'comment', [ 'options' => [ 'class' => 'input-wr' ] ]) | |
99 | + ->label('Комментарий') | |
100 | + ->textarea(); | |
101 | + ?> | |
102 | + <div class="input-wr"> | |
103 | + <a class="_more_" href="#">продолжить выбор</a> | |
104 | + <div class="button-wr"> | |
105 | + <?php | |
106 | + echo Html::submitButton('Отправить'); | |
107 | + ?> | |
97 | 108 | </div> |
98 | - <?php | |
109 | + </div> | |
110 | + <?php | |
99 | 111 | $form::end(); |
100 | 112 | ?> |
101 | 113 | <?php /* | ... | ... |
frontend/web/css/style.min.css
... | ... | @@ -1119,6 +1119,7 @@ ul.main-menu li:first-child ul li a:before {display: none;} |
1119 | 1119 | float: left; |
1120 | 1120 | margin-top: 40px; |
1121 | 1121 | } |
1122 | +.form-product-wr.product_0 {display: none;} | |
1122 | 1123 | .form-product-wr.product_1 {height: 75px;} |
1123 | 1124 | .form-product-wr.product_2 {height: 155px;} |
1124 | 1125 | ... | ... |
frontend/web/js/script.js
... | ... | @@ -365,7 +365,26 @@ $( |
365 | 365 | { |
366 | 366 | var product_variant_id = $(this).data('id'); |
367 | 367 | basket.remove(product_variant_id); |
368 | + var container = $(this).parents('table'); | |
369 | + var scroller = $(this).parents('.form-product-wr'); | |
368 | 370 | var tr = $(this).parents('tr').first().remove(); |
371 | + if($(container).find('tr').length === 1) { | |
372 | + $(scroller).removeClass('product_2'); | |
373 | + $(scroller).removeClass('product_0'); | |
374 | + $(scroller).addClass('product_1'); | |
375 | + } else if($(container).find('tr').length === 2) { | |
376 | + $(scroller).removeClass('product_1'); | |
377 | + $(scroller).removeClass('product_0'); | |
378 | + $(scroller).addClass('product_2'); | |
379 | + } else if($(container).find('tr').length === 0) { | |
380 | + $(scroller).removeClass('product_1'); | |
381 | + $(scroller).removeClass('product_2'); | |
382 | + $(scroller).addClass('product_0'); | |
383 | + } else { | |
384 | + $(scroller).removeClass('product_2'); | |
385 | + $(scroller).removeClass('product_1'); | |
386 | + $(scroller).removeClass('product_0'); | |
387 | + } | |
369 | 388 | } |
370 | 389 | ); |
371 | 390 | } | ... | ... |