
<?
ob_start();
?>
<div id="settings-tabs">
  <ul class="resp-tabs-list settings-tabs">
    <li><i class="fa fa-wrench"></i>Ustawienia</li>
  </ul>
  <div class="resp-tabs-container settings-tabs">
    <div>
      <?= \Html::input( [
            'label' => 'Nazwa',
            'name'  => 'name',
            'id'    => 'name',
            'value' => $this -> set[ 'name' ],
        ] );
      ?>
      <?=
      \Html::input_switch( [
          'label'   => 'Aktywny',
          'name'    => 'status',
          'checked' => $this -> set[ 'status' ] == 1 ? true : false
      ] );
      ?>
      <div class="form-group row">
        <label class="col-lg-4 control-label">Produkty do kompletu:</label>
        <div class="col-lg-8">
          <select id="set_products_id" multiple name="set_products_id[]" placeholder="produkty do kompletu">
            <option value="">wybierz produkt...</option>
            <? foreach ( $this -> products as $key => $val ):?>
              <? if ( $key != $this -> product[ 'id' ] ):?>
                <option value="<?= $key;?>" <? if ( in_array( $key, $this -> set[ 'products' ] ) ):?>selected<? endif;?>><?= $val;?></option>
              <? endif;?>
            <? endforeach;?>
          </select>
        </div>
      </div>
    </div>
  </div>
</div>
<?
$out = ob_get_clean();

$grid = new \gridEdit;
$grid -> id = 'set-edit';
$grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja kompletu produktów: <u>' . '' . '</u>';
$grid -> fields = [
    [
        'db'    => 'id',
        'type'  => 'hidden',
        'value' => $this -> set[ 'id' ]
    ]
];
$grid -> actions = [
    'save'   => [ 'url' => '/admin/shop_product_sets/save/', 'back_url' => '/admin/shop_product_sets/view_list/' ],
    'cancel' => [ 'url' => '/admin/shop_product_sets/view_list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
$grid -> id_param = 'id';

echo $grid -> draw();
?>
<link type="text/css" rel="stylesheet" href="/libraries/selectize/css/selectize.css">
<link type="text/css" rel="stylesheet" href="/libraries/selectize/css/selectize.default.css">
<script type="text/javascript" src="/libraries/selectize/js/standalone/selectize.js"></script>
<script type="text/javascript">
  $( function()
  {
    $('#settings-tabs').easyResponsiveTabs({
      width: 'auto',
      fit: true,
      tabidentify: 'settings-tabs',
      type: 'vertical'
    });

    $('#set_products_id').selectize({
      maxItems: 999,
      plugins: ['remove_button']
    });
  });
</script>