

<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<?
global $db;

ob_start();
?>
  <div id="settings-tabs">
    <ul class="resp-tabs-list settings-tabs">
      <li><i class="fa fa-file"></i>Treść</li>
    </ul>
    <div class="resp-tabs-container settings-tabs">
      <div>
        <div id="languages-main">
          <ul class="resp-tabs-list languages-main htabs">
            <? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
              <? if ( $lg['status'] ):?>
                <li><?= $lg['name'];?></a></li>
              <? endif;?>
            <? endforeach; endif;?>
          </ul>
          <div class="resp-tabs-container languages-main">
            <? if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
              <? if ( $lg['status'] ):?>
                <div>
                  <?= \Html::input(
                      array(
                        'label'   => 'Tekst',
                        'name'    => 'text[' . $lg['id'] . ']',
                        'id'      => 'text_' . $lg['id'],
                        'value'   => $this -> unit['languages'][ $lg['id'] ]['text'],
                        'inline'  => true
                      )
                  );?>
                </div>
              <? endif;?>
            <? endforeach; endif;?>
          </div>
          <div class="clear"></div>
        </div>
      </div>
    </div>
  </div>
<?
$out = ob_get_clean();

$grid = new \gridEdit;
$grid -> id               = 'unit-edit';
$grid -> gdb_opt          = $gdb;
$grid -> include_plugins  = true;
$grid -> title            = 'Edycja jednostki miary';
$grid -> fields           = [
                              [
                                'db' => 'id',
                                'type' => 'hidden',
                                'value' => $this -> unit['id']
                              ]
                            ];
$grid -> actions          = [
                              'save'   => [ 'url' => '/admin/dictionaries/unit_save/', 'back_url' => '/admin/dictionaries/view_list/' ],
                              'cancel' => [ 'url' => '/admin/dictionaries/view_list/' ]
                            ];
$grid -> external_code    = $out;
$grid -> persist_edit     = true;
$grid -> id_param         = 'id';

echo $grid -> draw();
?>
<script type="text/javascript">
  $( function()
  {
    disable_menu();

    $( '#settings-tabs' ).easyResponsiveTabs({
      width: 'auto',
      fit: true,
      tabidentify: 'settings-tabs',
      type: 'vertical'
    });

    $( '#languages-main' ).easyResponsiveTabs({
      width: 'auto',
      fit: true,
      tabidentify: 'languages-main'
    });

  });
</script>
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>