const _repairing="#ecec46",_washing="#0df8e3",_waiting="#41cb41",_ended="#45a7fc";$(window).load((function(){$("#btn-show").append($("<div/>").dxButton({text:_globals.language.visit})).append($("<div/>").css({"background-color":_repairing}).dxButton({text:_globals.language.repairing})).append($("<div/>").css({"background-color":_washing}).dxButton({text:_globals.language.washing})).append($("<div/>").css({"background-color":_waiting}).dxButton({text:_globals.language.waiting})).append($("<div/>").css({"background-color":_ended}).dxButton({text:_globals.language.ended}));var t=$("#dxData").dxScheduler({dataSource:a(todayVisitData),views:[{type:"timelineDay",groupOrientation:"vertical",cellDuration:30,intervalCount:1}],currentView:"timelineDay",showCurrentTimeIndicator:!0,shadeUntilCurrentTime:!0,currentDate:new Date,crossScrollingEnabled:!0,firstDayOfWeek:0,height:$(window).height()-50,startDayHour:7,endDayHour:18,cellDuration:60,editing:{allowAdding:!1,allowDeleting:!1,allowDragging:!1,allowResizing:!1,allowUpdating:!1},textExpr:"customerName",groups:["compartmentID"],resources:[{fieldExpr:"CVDV",displayExpr:"name",dataSource:_data.cvdvs,label:"CVDV"},{fieldExpr:"purposeID",displayExpr:"title",dataSource:_data.purposes,useColorAsDefault:!0,label:"purposeID"},{fieldExpr:"compartmentID",displayExpr:"title",dataSource:_data.carcompartments,label:"compartmentID"},{allowMultiple:!0,fieldExpr:"compartmentStatus",displayExpr:"compartmentStatus",dataSource:[{id:1,compartmentStatus:1,color:_waiting},{id:2,compartmentStatus:2,color:_waiting},{id:3,compartmentStatus:3,color:_waiting},{id:4,compartmentStatus:4,color:_waiting}],label:"compartmentStatus",useColorAsDefault:!0}],appointmentTooltipTemplate:function(t){var a=_repairing;return 2==t.appointmentData.compartmentStatus&&(a=_washing),3==t.appointmentData.compartmentStatus&&(a=_waiting),4==t.appointmentData.compartmentStatus&&(a=_ended),"undefined"!==typeof t.appointmentData.image&&""!==t.appointmentData.image||(t.appointmentData.image="/img/noimg.jpg"),$("<div style='text-align:left;padding:2px;color:black;background-color:"+a+"'><img style='width:100px;float:right'; src="+t.appointmentData.image+" /><div class='customerName'>"+t.appointmentData.customerName+"</div><div class='plate'> SX: "+t.appointmentData.plate+"</div><div class='purpose'> M\u1ee5c \u0111\xedch: "+t.appointmentData.purpose+"</div><div class='deliveryTime'> Tr\u1ea3 xe:"+t.appointmentData.deliveryTime+"</div></div>")},appointmentTemplate:function(t){var a=_repairing;return 2==t.appointmentData.compartmentStatus&&(a=_washing),3==t.appointmentData.compartmentStatus&&(a=_waiting),4==t.appointmentData.compartmentStatus&&(a=_ended),$("<div style='padding:2px;color:black;background-color:"+a+"' class='customer'><div class='customerName'>"+t.appointmentData.customerName+"</div><div class='plate'> SX: "+t.appointmentData.plate+"</div></div>")},onAppointmentFormOpening:function(t){t.cancel=!0}}).dxScheduler("instance");function a(t){return todayVisitData.forEach(t=>{t.startDate=new Date(t.dateTime),t.endDate=new Date(t.deliveryTime),t.color=_waiting}),todayVisitData}function e(){try{todayVisitData=_globals.apiPostDataList("visit-customers/getTimelineData",{branchID:_data.branchs[0].id,fromDate:new Date("2020/09/30"),toDate:new Date}),t.option("dataSource",a(todayVisitData))}catch(e){}}setInterval(e,5e3)}));