{* Smarty *}

{literal}
<script type="text/javascript">
//<![CDATA[

$(function(){
  $("#DemandsUsers").tabs();
});

$(function(){
  $("#GridStructureSvtById").jqGrid({
    caption:"СВТ {/literal}{$ArrStructureOrganization.structureorganization_title}{literal}",
    datatype: "json",
    url:"{/literal}{$MS_SP->Sp_PathTop}{$MS_SP->Sp_PathToSite}/AjaxServer/SvtForStructureList.ajax.php{literal}",
    colNames:['Действие','Наименование сет.','Наименование бух.','Тип СВТ','Инв. №','Сер. №','Пользователь'],
    colModel:[
      {name:'svt_action', index:'svt_action', width:60, sortable:false, search:false},
      {name:'svt_name', index:'svt_name', width:80},
      {name:'svt_buxname', index:'svt_buxname', width:180},
      {name:'svttype_name', index:'svttype_name', width:100},
      {name:'svt_invnum', index:'svt_invnum', width:55},
      {name:'svt_serialnum', index:'svt_serialnum', width:65},
      {name:'users_fio', index:'users_fio', width:100}
    ],
    rowNum:100,
    rowList:[10,25,100,500],
    pager: "#GridStructureSvtByIdPager",
    sortname: 'svt_buxname',
    sortorder: "asc",
    viewrecords: true,
    rownumbers: true,
    width: 750,
    height: 290,
    postData: {"structureorganization_id": "{/literal}{$smarty.get.UrlId}{literal}"}
  });
  
  $("#GridStructureSvtById").jqGrid('navGrid','#GridStructureSvtByIdPager', {edit:false,add:false,del:false});
  $("#GridStructureSvtById").jqGrid("navButtonAdd","#GridStructureSvtByIdPager",{
    caption: "",
    title: "Порядок столбцов",
    buttonicon :'ui-icon-transfer-e-w',
    onClickButton : function (){
      $("#GridStructureSvtById").jqGrid('columnChooser');
    }
  });
  $("#GridStructureSvtById").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false});
});

$(function(){
  $("#GridDemands").jqGrid({
    caption:"История заявок {/literal}{$ArrStructureOrganization.structureorganization_title}{literal}",
    datatype: "json",
    url:"{/literal}{$MS_SP->Sp_PathTop}{$MS_SP->Sp_PathToSite}/AjaxServer/DemandsForUsersList.ajax.php{literal}",
    colNames:['Действие','№ заявки','Дата','Статус','Наименование сет.','Наименование бух.','Тип СВТ','Инв. №','Сер. №','Заявка от','№ служ. записки','Дата служ. записки'],
    colModel:[
      {name:'demands_action', index:'demands_action', width:60, sortable:false, search:false},
      {name:'demands_id', index:'demands_id', width:80},
      {name:'demands_date', index:'demands_date', width:80, align:"right", sorttype:'date', datefmt: 'dd.mm.YYYY', formatter: 'date', 
        searchoptions:{
          dataInit:function(el){ 
            $(el).prop("VarGridName", 'GridDemands');
            GridDatepickerSetParam(el);
          }
        }
      },
      {name:'sprstatus_name', index:'sprstatus_name', width:80},
      {name:'svt_name', index:'svt_name', width:80},
      {name:'svt_buxname', index:'svt_buxname', width:180},
      {name:'svttype_name', index:'svttype_name', width:100},
      {name:'svt_invnum', index:'svt_invnum', width:55},
      {name:'svt_serialnum', index:'svt_serialnum', width:65},
      {name:'e.users_fio', index:'e.users_fio', width:100},
      {name:'demands_intdocnum', index:'demands_intdocnum', width:80},
      {name:'demands_intdocdate', index:'demands_intdocdate', width:80, align:"right", sorttype:'date', datefmt: 'dd.mm.YYYY', formatter: 'date', 
        searchoptions:{
          dataInit:function(el){ 
            $(el).prop("VarGridName", 'GridDemands');
            GridDatepickerSetParam(el);
          }
        }
      }
    ],
    rowNum:100,
    rowList:[10,25,100,500],
    pager: "#GridDemandsPager",
    sortname: 'demands_id',
    sortorder: "desc",
    viewrecords: true,
    rownumbers: true,
    width: 750,
    height: 290,
    postData: {"structureorganization_id": "{/literal}{$smarty.get.UrlId}{literal}"}
  });
  
  $("#GridDemands").jqGrid('navGrid','#GridDemandsPager', {edit:false,add:false,del:false});
  $("#GridDemands").jqGrid("navButtonAdd","#GridDemandsPager",{
    caption: "",
    title: "Порядок столбцов",
    buttonicon :'ui-icon-transfer-e-w',
    onClickButton : function (){
      $("#GridDemands").jqGrid('columnChooser');
    }
  });
  $("#GridDemands").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false});
});
//]]>
</script>
{/literal}

<div id="DemandsUsers">
  <ul>
    <li><a href="#DemandsNew">Оформить новую заявку</a></li>
    <li><a href="#DemandsHistory">История заявок</a></li>
  </ul>
  <div id="DemandsNew">
    <table id="GridStructureSvtById"><tr><td></td></tr></table>
    <div id="GridStructureSvtByIdPager"></div>
  </div>
  <div id="DemandsHistory">
    <table id="GridDemands"><tr><td></td></tr></table>
    <div id="GridDemandsPager"></div>
  </div>
</div>