Commit 724308f66ba39181f101a97976593356be23bfa7
1 parent
ef7fccae
add status to price
Showing
4 changed files
with
67 additions
and
19 deletions
Show diff stats
backend/controllers/PriceController.php
| ... | ... | @@ -84,7 +84,7 @@ |
| 84 | 84 | $price = New Price(); |
| 85 | 85 | $price->service_id = $service_id; |
| 86 | 86 | $price_lang = new PriceLang(); |
| 87 | - return $this->renderPartial('_add_price',[ | |
| 87 | + return $this->renderAjax('_add_price',[ | |
| 88 | 88 | 'lastId' => $lastId, |
| 89 | 89 | 'price' => $price, |
| 90 | 90 | 'price_lang' => $price_lang, | ... | ... |
backend/views/price/_add_price.php
| ... | ... | @@ -6,9 +6,28 @@ |
| 6 | 6 | * @var integer $service_id |
| 7 | 7 | * @var array $languages |
| 8 | 8 | */ |
| 9 | + use artbox\core\admin\assets\Switchery; | |
| 10 | + use yii\web\View; | |
| 9 | 11 | use yii\widgets\ActiveForm; |
| 10 | 12 | |
| 11 | 13 | $form = new ActiveForm(); |
| 14 | + | |
| 15 | + Switchery::register($this); | |
| 16 | + $js = <<< JS | |
| 17 | +$('.switchery').each(function(idx, elem) { | |
| 18 | + if (!$(this).data('switchery')){ | |
| 19 | + new Switchery(elem, { | |
| 20 | + color:'#46b749', | |
| 21 | + secondaryColor:'#e2e2e2' | |
| 22 | + }); | |
| 23 | + } | |
| 24 | + | |
| 25 | +}); | |
| 26 | + | |
| 27 | +JS; | |
| 28 | + | |
| 29 | + | |
| 30 | + $this->registerJs($js, View::POS_READY); | |
| 12 | 31 | ?> |
| 13 | 32 | <div class="form-group-33-wr"> |
| 14 | 33 | <div class="form-group-33"> |
| ... | ... | @@ -19,6 +38,12 @@ |
| 19 | 38 | echo $form->field($price_lang, '['.$lastId.']['.$key.']title')->label('Название '.$value['url']); |
| 20 | 39 | } |
| 21 | 40 | ?> |
| 41 | + <?= $form->field($price, '['.$price->id.']status') | |
| 42 | + ->checkbox( | |
| 43 | + [ | |
| 44 | + 'class' => 'switchery', | |
| 45 | + ] | |
| 46 | + ) ?> | |
| 22 | 47 | <a class="delete-variant delete-url remove-img-2 btn-danger btn" href="#"></a> |
| 23 | 48 | </div> |
| 24 | 49 | </div> | ... | ... |
backend/views/price/index.php
| ... | ... | @@ -7,11 +7,25 @@ |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | use artbox\core\admin\assets\Select2; |
| 10 | + use artbox\core\admin\assets\Switchery; | |
| 10 | 11 | use yii\helpers\Html; |
| 11 | 12 | use yii\web\View; |
| 12 | 13 | use yii\widgets\ActiveForm; |
| 13 | 14 | use yiister\gentelella\widgets\Panel; |
| 15 | + Switchery::register($this); | |
| 16 | + $js = <<< JS | |
| 17 | +$('.switchery').each(function(idx, elem) { | |
| 18 | + new Switchery(elem, { | |
| 19 | + color:'#46b749', | |
| 20 | + secondaryColor:'#e2e2e2' | |
| 21 | + }); | |
| 22 | +}); | |
| 14 | 23 | |
| 24 | +$(".select_service").select2(); | |
| 25 | +JS; | |
| 26 | + | |
| 27 | + | |
| 28 | + $this->registerJs($js, View::POS_READY); | |
| 15 | 29 | ?> |
| 16 | 30 | <div class='adm-index'> |
| 17 | 31 | <?php |
| ... | ... | @@ -95,6 +109,13 @@ JS; |
| 95 | 109 | echo $form->field($value, '['.$price->id.']['.$value->language_id.']title')->label('Название '.$value->language->url); |
| 96 | 110 | } |
| 97 | 111 | ?> |
| 112 | + | |
| 113 | + <?= $form->field($price, '['.$price->id.']status') | |
| 114 | + ->checkbox( | |
| 115 | + [ | |
| 116 | + 'class' => 'switchery', | |
| 117 | + ] | |
| 118 | + ) ?> | |
| 98 | 119 | <a class="delete-variant delete-url remove-img-2 btn-danger btn" href="#"></a> |
| 99 | 120 | </div> |
| 100 | 121 | ... | ... |
frontend/web/js/script.js
| ... | ... | @@ -421,26 +421,28 @@ $(document).ready(function() { |
| 421 | 421 | $('nav').addClass('hide_') |
| 422 | 422 | $('body').addClass('start-preloader') |
| 423 | 423 | |
| 424 | - window.onload = function () { | |
| 425 | - console.log('start onload'); | |
| 426 | - // | |
| 427 | - // $('body').addClass('end-preloader') | |
| 428 | - // $('nav').addClass('start') | |
| 429 | - // $('body').addClass('disabled-preloader') | |
| 430 | - | |
| 431 | - //альтернативный с задержкой выключения | |
| 432 | - setTimeout(function () { | |
| 433 | - $('body').addClass('end-preloader') | |
| 434 | - },2700); | |
| 435 | 424 | |
| 436 | - setTimeout(function () { | |
| 437 | - console.log('start'); | |
| 438 | - $('nav').addClass('start'); | |
| 439 | - $('body').addClass('disabled-preloader') | |
| 440 | - },2700 + 2000) | |
| 441 | - } | |
| 442 | 425 | |
| 443 | 426 | |
| 444 | 427 | |
| 445 | 428 | |
| 446 | -}) | |
| 447 | 429 | \ No newline at end of file |
| 430 | +}); | |
| 431 | + | |
| 432 | +window.onload = function () { | |
| 433 | + console.log('start onload'); | |
| 434 | + // | |
| 435 | + // $('body').addClass('end-preloader') | |
| 436 | + // $('nav').addClass('start') | |
| 437 | + // $('body').addClass('disabled-preloader') | |
| 438 | + | |
| 439 | + //альтернативный с задержкой выключения | |
| 440 | + setTimeout(function () { | |
| 441 | + $('body').addClass('end-preloader') | |
| 442 | + },2700); | |
| 443 | + | |
| 444 | + setTimeout(function () { | |
| 445 | + console.log('start'); | |
| 446 | + $('nav').addClass('start'); | |
| 447 | + $('body').addClass('disabled-preloader') | |
| 448 | + },2700 + 2000) | |
| 449 | +} | |
| 448 | 450 | \ No newline at end of file | ... | ... |