{* Smarty *}

{literal}
<script type="text/javascript">
//<![CDATA[
$(function BuildGrid(){
  $("#GridDemandsUsers").jqGrid('jqGridImport',{imptype:"jsonstring", impstring:window.localStorage.getItem("{/literal}{$smarty.session.SessionAuth.id}-GridDemandsUsers{literal}")});
  $("#GridDemandsUsers").jqGrid({
    caption:"{/literal}'{$MS_SP->Sp_LangMessage.GridsCaptions.DemandsUsers}'{literal} {/literal}{$ArrSvt.svt_buxname}{literal}",
    datatype: "json",
    url:"{/literal}{$MS_SP->Sp_PathTop}{$MS_SP->Sp_PathToSite}/AjaxServer/DemandsForUsersList.ajax.php{literal}",
    colNames:[{/literal}
      '{$MS_SP->Sp_LangMessage.GridsColNames.action}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.demands_id}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.date}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.status}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.svttype_name}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.svt_name}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.svt_buxname}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.svt_invnum}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.svt_serialnum}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.users_fio_dependfrom}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.demands_intdocnum}',
      '{$MS_SP->Sp_LangMessage.GridsColNames.demands_intdocdate}'{literal}
    ],
    colModel:[
      {name:'demands_action', index:'demands_action', width:60, sortable:false, search:false},
      {name:'demands_id', index:'demands_id', width:55},
      {name:'demands_date', index:'demands_date', width:60, align:"right", sorttype:'date', datefmt: 'dd.mm.YYYY', formatter: 'date', 
        searchoptions:{
          dataInit:function(el){ 
            $(el).prop("VarGridName", 'GridDemandsUsers');
            GridDatepickerSetParam(el);
          }
        }
      },
      {name:'sprstatus_name', index:'sprstatus_name', width:100},
      {name:'svttype_name', index:'svttype_name', width:90},
      {name:'svt_name', index:'svt_name',	width:100},
      {name:'svt_buxname', index:'svt_buxname',	width:120},
      {name:'svt_invnum', index:'svt_invnum', width:60},
      {name:'svt_serialnum', index:'svt_serialnum', width:90},
      {name:'e.users_fio', index:'e.users_fio', width:100},
      {name:'demands_intdocnum', index:'demands_intdocnum', width:85},
      {name:'demands_intdocdate', index:'demands_intdocdate', width:100, align:"right", sorttype:'date', datefmt: 'dd.mm.YYYY', formatter: 'date', 
        searchoptions:{
          dataInit:function(el){ 
            $(el).prop("VarGridName", 'GridDemandsUsers');
            GridDatepickerSetParam(el);
          }
        }
      }
    ],
    rowNum:100,
    rowList:[10,25,100,500],
    pager: "#GridDemandsUsersPager",
    sortname: 'sprstatus_order, demands_id',
    sortorder: "desc",
    viewrecords: true,
    rownumbers: true,
    width: "100%",
    height: 290,
    postData: {"svt_id":"{/literal}{$ArrSvt.svt_id}{literal}"}
  });
  
  $("#GridDemandsUsers").jqGrid('navGrid','#GridDemandsUsersPager', {edit:false,add:false,del:false});
  $("#GridDemandsUsers").jqGrid("navButtonAdd","#GridDemandsUsersPager",{
    caption: "",
    title: "{/literal}{$MS_SP->Sp_LangMessage.GridsButtons.ColumnChooser}{literal}",
    buttonicon :'ui-icon-transfer-e-w',
    onClickButton : function (){
      $("#GridDemandsUsers").jqGrid('columnChooser');
    }
  });
  $("#GridDemandsUsers").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false});
});

//]]>
</script>
{/literal}

<div id="GridDemandsUsersWrapper" class="ui-widget-content ui-corner-all">
  <table id="GridDemandsUsers"><tr><td></td></tr></table>
  <div id="GridDemandsUsersPager"></div>
  <div id="t_toolbar1"></div>
</div>