<?php
global $gdb;

$grid = new \gridEdit;
$grid -> gdb_opt          = $gdb;
$grid -> include_plugins  = true;
$grid -> title            = 'Zapisz menu';
$grid -> fields           = [
                              [
                                'db' => 'id',
                                'type' => 'hidden',
                                'value' => $this -> menu['id']
                              ],
                              [ 
                                'name' => 'Nazwa',
                                'db' => 'name',
                                'type' => 'text',
                                'value' => $this -> menu['name'],
                                'params' => [ 'class' => 'require' ]
                              ],
                              [
                                'name'    => 'Aktywne',
                                'db'      => 'status',
                                'type'    => 'input_switch',
                                'checked' => $this -> menu['status'] ? true : false,
                                'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ]
                              ]
                            ];
$grid -> actions          = [ 
                              'save' => [ 'url' => '/admin/pages/menu_save/', 'back_url' => '/admin/pages/view_list/' ], 
                              'cancel' => [ 'url' => '/admin/pages/view_list/' ] 
                            ];
$grid -> persist_edit     = true;
$grid -> id_param         = 'id';
echo $grid -> draw();
?>
<script type="text/javascript">
  $( document ).ready( function() 
  {
    disable_menu();
  });
</script>