<?php
    /**
     * @var \common\models\PriceLang $price_lang;
     * @var \common\models\Price $price
     * @var integer $lastId;
     * @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);
    ?>
<div class="form-group-33-wr">
<div class="form-group-33">
    <?php echo $form->field($price, '['.$lastId.']service_id')->hiddenInput()->label(false)?>
    <?php echo $form->field($price, '['.$lastId.']price')?>
    <?php
        foreach ($languages as $key => $value){
            echo $form->field($price_lang, '['.$lastId.']['.$key.']title')->label('Название '.$value['url']);
        }
    ?>
    <?= $form->field($price, '['.$lastId.']status')
             ->checkbox(
                 [
                     'class' => 'switchery',
                 ]
             ) ?>
  <a class="delete-variant delete-url remove-img-2 btn-danger btn" href="#"></a>
</div>
</div>
