var EcommerceOrdersView=function(){var handleInvoices=function(){var grid=new Datatable();grid.init({src:$("#datatable_invoices"),onSuccess:function(grid){},onError:function(grid){},loadingMessage:'Loading...',dataTable:{"lengthMenu":[[10,20,50,100,150,-1],[19,20,50,100,150,"All"]],"pageLength":10,"ajax":{"url":"demo/ecommerce_order_invoices.php",},"order":[[1,"asc"]]}});grid.getTableWrapper().on('click','.table-group-action-submit',function(e){e.preventDefault();var action=$(".table-group-action-input",grid.getTableWrapper());if(action.val()!=""&&grid.getSelectedRowsCount()>0){ grid.setAjaxParam("customActionType","group_action");grid.setAjaxParam("customActionName",action.val());grid.setAjaxParam("id",grid.getSelectedRows());grid.getDataTable().ajax.reload();grid.clearAjaxParams();}else if(action.val()==""){Metronic.alert({type:'danger',icon:'warning',message:'Please select an action',container:grid.getTableWrapper(),place:'prepend'});}else if(grid.getSelectedRowsCount()===0){Metronic.alert({type:'danger',icon:'warning',message:'No record selected',container:grid.getTableWrapper(),place:'prepend'});}});}
var handleCreditMemos=function(){var grid=new Datatable();grid.init({src:$("#datatable_credit_memos"),onSuccess:function(grid){},onError:function(grid){},loadingMessage:'Loading...',dataTable:{//-
"lengthMenu":[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],"pageLength":10,"ajax":{"url":"demo/ecommerce_order_credit_memos.php",},"columnDefs":[{'orderable':true,'targets':[0]}],"order":[[0,"asc"]]}});}
var handleShipment=function(){var grid=new Datatable();grid.init({src:$("#datatable_shipment"),onSuccess:function(grid){},onError:function(grid){},loadingMessage:'Loading...',dataTable:{"lengthMenu":[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],"pageLength":10,"ajax":{"url":"demo/ecommerce_order_shipment.php",},"columnDefs":[{'orderable':true,'targets':[0]}], "order":[[0,"asc"]]}});}
var handleHistory=function(){var grid=new Datatable();grid.init({src:$("#datatable_history"),onSuccess:function(grid){},onError:function(grid){},loadingMessage:'Loading...',dataTable:{"lengthMenu":[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],"pageLength":10,"ajax":{"url":"demo/ecommerce_order_history.php",},"columnDefs":[{'orderable':true,'targets':[0]}],"order":[[0,"asc"]]}});grid.getTableWrapper().on('click','.table-group-action-submit',function(e){e.preventDefault();var action=$(".table-group-action-input",grid.getTableWrapper());if(action.val()!=""&&grid.getSelectedRowsCount()>0){grid.setAjaxParam("customActionType","group_action");grid.setAjaxParam("customActionName",action.val());grid.setAjaxParam("id",grid.getSelectedRows());grid.getDataTable().ajax.reload();grid.clearAjaxParams();}else if(action.val()==""){Metronic.alert({type:'danger',icon:'warning',message:'Please select an action',container:grid.getTableWrapper(),place:'prepend'});}else if(grid.getSelectedRowsCount()===0){Metronic.alert({type:'danger',icon:'warning',message:'No record selected',container:grid.getTableWrapper(),place:'prepend'});}});}
var initPickers=function(){$('.date-picker').datepicker({rtl:Metronic.isRTL(),autoclose:true});$(".datetime-picker").datetimepicker({isRTL:Metronic.isRTL(),autoclose:true,todayBtn:true,pickerPosition:(Metronic.isRTL()?"bottom-right":"bottom-left"),minuteStep:10});}
return{init:function(){initPickers();handleInvoices();handleCreditMemos();handleShipment();handleHistory();}};}();