$((function(){var a=$("#gridContainer").dxDataGrid({dataSource:customers,allowColumnReordering:!0,allowColumnResizing:!0,keyExpr:"cid",showBorders:!0,paging:{pageSize:15},selection:{mode:"multiple"},searchPanel:{visible:!0},groupPanel:{visible:!0},columnAutoWidth:!0,columnChooser:{enabled:!0,allowSearch:!0},columns:[{dataField:"cname",caption:_globals.language.customer_name},{dataField:"address",caption:_globals.language.address,width:170},{dataField:"mobile",caption:_globals.language.mobile,width:125},{dataField:"email",caption:_globals.language.email},{dataField:"company_name",caption:_globals.language.company_name},{dataField:"company_type",caption:_globals.language.company_type,visible:!1},{dataField:"created_at",caption:_globals.language.created_at,dataType:"date",visible:!1},{dataField:"updated_at",caption:_globals.language.updated_at,dataType:"date",visible:!1}],masterDetail:{enabled:!0,template:function(a,e){e.data;$("<div>").addClass("master-detail-caption").text(_globals.language.car_info).appendTo(a),$("<div>").dxDataGrid({columnAutoWidth:!0,showBorders:!0,paging:{pageSize:5},selection:{mode:"single"},columnChooser:{enabled:!0,allowSearch:!0},columns:[{dataField:"plate",caption:_globals.language.plate},{dataField:"cartype",caption:_globals.language.cartype},{dataField:"carid",caption:_globals.language.carid,visible:!1},{dataField:"carname",caption:_globals.language.carname},{dataField:"color",caption:_globals.language.color,visible:!1},{dataField:"colorname",caption:_globals.language.colorname},{dataField:"cmac",caption:_globals.language.mac,visible:!1},{dataField:"cvin",caption:_globals.language.vin,visible:!1},{dataField:"carmoel",caption:_globals.language.carmodel,visible:!1},{dataField:"ccode",caption:"code",visible:!1}],dataSource:new DevExpress.data.DataSource({store:new DevExpress.data.ArrayStore({key:"_id",data:cars}),filter:["ccode","=",e.key]})}).appendTo(a)}},onToolbarPreparing:function(o){o.component;o.toolbarOptions.items.unshift({location:"after",widget:"dxButton",options:{icon:"map",displayExpr:"name",splitButton:!0,dropDownOptions:{width:150},onClick:function(o){e(a.getSelectedRowsData())}}})}}).dxDataGrid("instance");function e(a){if(a.length>0){var e='<div id="map"></div>',l=DevExpress.ui.dialog.custom({title:_globals.language.map,messageHtml:e,buttons:[{text:_globals.language.close,onClick:function(a){return{buttonText:a.component.option("text")}}}]});l.show().done((function(a){})),o(a)}else DevExpress.ui.notify(_globals.language.customers_choose,"error",1e3)}function o(a){var e=[],o=$("#map").dxMap({provider:"bing",key:{},zoom:14,height:440,width:"100%",type:"roadmap",controls:!0,markerIconSrc:"svg/car.svg",markers:e}).dxMap("instance");l(a,o)}function l(a,e){a.forEach((function(a){a.address.length>5&&e.addMarker({location:a.address+" - VIET NAM",tooltip:a.cname}).done((function(a){}))}))}}));