<?
global $db;

ob_start();
  echo \Html::input( [
                'name' => 'group_id',
                'id' => 'name',
                'value' => $this -> category ? $this -> category['group_id'] : $this -> group_id,
                'type' => 'hidden'
              ] );
  echo \Html::input( [
                'label'   => 'Nazwa',
                'name'    => 'name',
                'id'      => 'name',
                'value'   => $this -> category['name'],
                'class'   => 'require',
                'inline'  => true
              ] );

$out = ob_get_clean();

$grid = new \gridEdit;
$grid -> id               = 'category-edit';
$grid -> gdb_opt          = $gdb;
$grid -> include_plugins  = true;
$grid -> title            = \S::get( 'parent-id' ) ? 'edycja <strong>podkategorii</strong>' : 'edycja <strong>kategorii</strong>';
$grid -> title_small      = \S::get( 'parent-id' ) ? 'Zarządzaj ustawieniami podkategorii' : 'Zarządzaj ustawieniami kategorii';
$grid -> fields           = [
                              [
                                'db' => 'id',
                                'type' => 'hidden',
                                'value' => $this -> category['id']
                              ], [
                                'db' => 'parent_id',
                                'type' => 'hidden',
                                'value' => $this -> category['id'] ? $this -> category['parent_id'] : \S::get( 'parent-id' )
                              ]
                            ];
$grid -> external_code    = $out;
$grid -> actions          = [
                              'save' => [ 'url' => '/finances/category_save/', 'back_url' => '/finances/main_view/' ],
                              'cancel' => [ 'url' => '/finances/main_view/' ]
                            ];
$grid -> persist_edit     = true;
$grid -> id_param         = 'id';
echo $grid -> draw();
?>