{{##def.renderWeekTotal:dayRange: {{ var sum = { availabilityTime: 0, drivingTime: 0, restTime: 0,workingTime: 0 }; }} {{ for(var i = dayRange[0];i < dayRange[1];i++) { }} {{ var currentItem = list[i]; }} {{ sum.availabilityTime += currentItem.availabilityTime; }} {{ sum.drivingTime += currentItem.drivingTime; }} {{ sum.restTime += currentItem.restTime; }} {{ sum.workingTime += currentItem.workingTime; }} {{ } }} #}} {{ function fixMonthYearDisplay(){ var date = new Date(); var firstMonthCounter = 0; var lastMonthCounter = 0; var differentMonthCount = _.uniq(list,function(item){ date.setTime(item.date); return date.getMonth(); }); if(differentMonthCount.length > 1){ _.each(list,function(element, index, list){ var currentMonth; var firstMonth; var lastMonth; date.setTime(element.date); currentMonth = date.getMonth(); date.setTime(differentMonthCount[0].date); firstMonth = date.getMonth(); date.setTime(differentMonthCount[1].date); lastMonth = date.getMonth(); if(currentMonth == firstMonth){ firstMonthCounter++; }else if(currentMonth == lastMonth){ lastMonthCounter++; } }); if(firstMonthCounter > lastMonthCounter){ return date.setTime(differentMonthCount[0].date); }else if(lastMonthCounter > firstMonthCounter){ return date.setTime(differentMonthCount[1].date); } } return json.currentDate; } }} {{ function formatWeekNumber(weekNumber){ return weekNumber < 10 ? "0" + weekNumber : weekNumber; } }}
{{ var list = json.driverWorkingHoursList; }} {{ var date = new Date(); }} {{ date.setDate(date.getDate() - ((date.getDay() || 7) - 1) + 6); }} {{ date.setHours(23,59,59,999); }} {{ var maxNextDate = date.valueOf(); }} {{ date.setTime(json.currentDate); }} {{ var nextMonthDate = date.setMonth(date.getMonth() + 1); }} {{ var lastYear = list[0]; }} {{ date.setTime(json.currentDate); }} {{ var nextYearDate = date.setFullYear(date.getFullYear() + 1); }} {{ date.setTime(json.currentDate); }} {{ var lastYearDate = date.setFullYear(date.getFullYear() - 1); }} {{ date.setTime(json.currentDate); }} {{ var lastMonthDate = date.setMonth(date.getMonth() - 1); }} {{ date.setTime(json.currentDate); }} {{ var nextWeekDate = date.setDate(date.getDate() + 7); }} {{ var disabledNextYearClass = nextYearDate > maxNextDate ? "disabled":""; }} {{ var disabledNextMonthClass = nextMonthDate > maxNextDate ? "disabled":""; }} {{ var disabledNextWeekClass = nextWeekDate > maxNextDate ? "disabled":""; }}
{{ fixMonthYearDisplay(); }} {{=$.datepicker.formatDate("M yy" , new Date(fixMonthYearDisplay()))}}
{{ for(var i=0;i < 7;i++) { }} {{var currentItem = list[i];}} {{ } }} {{ for(var i=7;i < 14;i++) { }} {{var currentItem = list[i];}} {{ } }}
Mon Tue Wed Thu Fri Sat Sun Week Total
{{=$.datepicker.formatDate("dd" , new Date(currentItem.date))}}
  • {{=helper.formatMillisecondsToHM(currentItem.workingTime)}}
  • {{=helper.formatMillisecondsToHM(currentItem.drivingTime)}}
  • {{=helper.formatMillisecondsToHM(currentItem.restTime)}}
  • {{=helper.formatMillisecondsToHM(currentItem.availabilityTime)}}
{{#def.renderWeekTotal:{0:0,1:7} }}
{{=$.datepicker.formatDate("dd" , new Date(list[i].date))}}
  • {{=helper.formatMillisecondsToHM(currentItem.workingTime)}}
  • {{=helper.formatMillisecondsToHM(currentItem.drivingTime)}}
  • {{=helper.formatMillisecondsToHM(currentItem.restTime)}}
  • {{=helper.formatMillisecondsToHM(currentItem.availabilityTime)}}
    {{#def.renderWeekTotal:{0:7,1:14} }}