diff --git a/backend/controllers/PriceController.php b/backend/controllers/PriceController.php index fb5b01c..e01da8d 100644 --- a/backend/controllers/PriceController.php +++ b/backend/controllers/PriceController.php @@ -84,7 +84,7 @@ $price = New Price(); $price->service_id = $service_id; $price_lang = new PriceLang(); - return $this->renderPartial('_add_price',[ + return $this->renderAjax('_add_price',[ 'lastId' => $lastId, 'price' => $price, 'price_lang' => $price_lang, diff --git a/backend/views/price/_add_price.php b/backend/views/price/_add_price.php index ce33c0c..089b593 100644 --- a/backend/views/price/_add_price.php +++ b/backend/views/price/_add_price.php @@ -6,9 +6,28 @@ * @var integer $service_id * @var array $languages */ + use artbox\core\admin\assets\Switchery; + use yii\web\View; use yii\widgets\ActiveForm; $form = new ActiveForm(); + + Switchery::register($this); + $js = <<< JS +$('.switchery').each(function(idx, elem) { + if (!$(this).data('switchery')){ + new Switchery(elem, { + color:'#46b749', + secondaryColor:'#e2e2e2' + }); + } + +}); + +JS; + + + $this->registerJs($js, View::POS_READY); ?>
@@ -19,6 +38,12 @@ echo $form->field($price_lang, '['.$lastId.']['.$key.']title')->label('Название '.$value['url']); } ?> + field($price, '['.$price->id.']status') + ->checkbox( + [ + 'class' => 'switchery', + ] + ) ?>
diff --git a/backend/views/price/index.php b/backend/views/price/index.php index 9d48f3a..f69fec9 100644 --- a/backend/views/price/index.php +++ b/backend/views/price/index.php @@ -7,11 +7,25 @@ */ use artbox\core\admin\assets\Select2; + use artbox\core\admin\assets\Switchery; use yii\helpers\Html; use yii\web\View; use yii\widgets\ActiveForm; use yiister\gentelella\widgets\Panel; + Switchery::register($this); + $js = <<< JS +$('.switchery').each(function(idx, elem) { + new Switchery(elem, { + color:'#46b749', + secondaryColor:'#e2e2e2' + }); +}); +$(".select_service").select2(); +JS; + + + $this->registerJs($js, View::POS_READY); ?>
field($value, '['.$price->id.']['.$value->language_id.']title')->label('Название '.$value->language->url); } ?> + + field($price, '['.$price->id.']status') + ->checkbox( + [ + 'class' => 'switchery', + ] + ) ?>
diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index 164b351..2f188d2 100644 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -421,26 +421,28 @@ $(document).ready(function() { $('nav').addClass('hide_') $('body').addClass('start-preloader') - window.onload = function () { - console.log('start onload'); - // - // $('body').addClass('end-preloader') - // $('nav').addClass('start') - // $('body').addClass('disabled-preloader') - - //альтернативный с задержкой выключения - setTimeout(function () { - $('body').addClass('end-preloader') - },2700); - setTimeout(function () { - console.log('start'); - $('nav').addClass('start'); - $('body').addClass('disabled-preloader') - },2700 + 2000) - } -}) \ No newline at end of file +}); + +window.onload = function () { + console.log('start onload'); + // + // $('body').addClass('end-preloader') + // $('nav').addClass('start') + // $('body').addClass('disabled-preloader') + + //альтернативный с задержкой выключения + setTimeout(function () { + $('body').addClass('end-preloader') + },2700); + + setTimeout(function () { + console.log('start'); + $('nav').addClass('start'); + $('body').addClass('disabled-preloader') + },2700 + 2000) +} \ No newline at end of file -- libgit2 0.21.4