{% extends 'staff/report/base.html' %}
{% load i18n %}
{% block opts_modify %}
  $.extend(opts, {
  cols: [[
  {field:'emp_code', width:120, title: "{% trans 'report_column_empCode' %}", sort:true}
  ,{field:'first_name', title: "{% trans 'report_column_firstName' %}"}
  ,{field:'last_name', title: "{% trans 'report_column_lastName' %}"}
  ,{field:'nick_name', title: "{% trans 'report_column_nickName' %}"}
  ,{field:'gender', title: "{% trans 'report_column_gender' %}"}
  ,{field:'dept_code', title: "{% trans 'report_column_departmentCode' %}", sort:true}
  ,{field:'dept_name', width:140, title: "{% trans 'report_column_departmentName' %}", sort:true}
  ,{field:'position_code', title: "{% trans 'report_column_positionCode' %}"}
  ,{field:'position_name', title: "{% trans 'report_column_positionName' %}"}
  ,{field:'att_date', title: "{% trans 'report_column_attendanceDate' %}", width:100, sort:true}
  ,{field:'weekday', width:80, title: "{% trans 'report_column_attendanceWeekday' %}", width:100}
  ,{field:'att_exception', title: "{% trans 'report_column_exception' %}"}
  ,{field:'timetable', title: "{% trans 'report_column_timeIntervalName' %}"}
  ,{field:'duration', title: "{% trans 'report_column_timetableDuration' %}"}
  ,{field:'check_in', title: "{% trans 'report_column_checkInTime' %}"}
  ,{field:'check_out', title: "{% trans 'report_column_checkOutTime' %}"}
  ,{field:'duty_duration', title: "{% trans 'report_column_attendanceDuration' %}"}
  ,{field:'work_day', title: "{% trans 'report_column_workDay' %}"}
  ,{field:'clock_in', title: "{% trans 'report_column_clockInTime' %}", templet: function(obj){
    if(obj.late && obj.late != obj.break_late){
      return '<span style="color: #DC143C;">'+ obj.clock_in +'</span>'
    }else{
      return obj.clock_in
    }
  }}
  ,{field:'clock_out', title: "{% trans 'report_column_clockOutTime' %}", templet: function(obj){
    if(obj.early_leave && obj.early_leave != obj.break_early){
      return '<span style="color: #00CD66;">'+ obj.clock_out +'</span>'
    }else{
      return obj.clock_out
    }
  }}
  ,{field:'total_time', title: "{% trans 'report_column_totalTimeDuration' %}", width:80}
  ,{field:'duty_wt', title: "{% trans 'report_column_dutyWorkedTime' %}", width:80}
  ,{field:'actual_wt', title: "{% trans 'report_column_actualWorkedTime' %}", width:80}
  ,{field:'unscheduled', title: "{% trans 'report_column_unscheduled' %}", width:80}
  ,{field:'remaining', title: "{% trans 'report_column_remaining' %}", width:80}
  ,{field:'break_out', title: "{% trans 'report_column_breakOutTime' %}"}
  ,{field:'break_in', title: "{% trans 'report_column_breakInTime' %}", templet: function(obj){
    if(obj.break_late || obj.break_early){
      return '<span style="color: #FF5722;">'+ obj.break_in +'</span>'
    }else if(obj.break_in){
      return obj.break_in
    }else{
      return ''
    }

  }}
  ,{field:'actual_break', title: "{% trans 'report_column_actualBreakTimeDuration' %}"}
  ,{field:'taken_break', title: "{% trans 'report_column_breakTime' %}"}
  ,{field:'late', title: "{% trans 'report_column_lateDuration' %}"}
  ,{field:'break_late', title: "{% trans 'report_column_breakLateDuration' %}"}
  ,{field:'early_leave', title: "{% trans 'report_column_earlyLeaveDuration' %}", width:100}
  ,{field:'break_early', title: "{% trans 'report_column_breakEarlyLeaveDuration' %}"}
  ,{field:'absent', title: "{% trans 'report_column_absentDuration' %}"}
  ,{field:'break_absent', title: "{% trans 'report_column_breakTimeAbsentDuration' %}"}
  ,{field:'leave', title: "{% trans 'report_column_leaveDuration' %}"}
  ,{field:'total_worked', title: "{% trans 'report_column_totalWorkedDuration' %}", width:100}
  ,{field:'normal_wt', title: "{% trans 'report_column_normalWorkTime' %}"}
  ,{field:'break_duration', title: "{% trans 'report_column_breakTimeDuration' %}"}
  ,{field:'normal_ot', title: "{% trans 'report_column_normalOvertime' %}"}
  ,{field:'weekend_ot', title: "{% trans 'report_column_weekendOvertime' %}"}
  ,{field:'holiday_ot', title: "{% trans 'report_column_holidayOvertime' %}"}
  ,{field:'ot_lv1', title: "{% trans 'report_column_overtimeLevel1' %}"}
  ,{field:'ot_lv2', title: "{% trans 'report_column_overtimeLevel2' %}"}
  ,{field:'ot_lv3', title: "{% trans 'report_column_overtimeLevel3' %}"}
  ]]
  ,method: "get"
  ,url: "/att/api/totalTimeCardReport/"
  });
{% endblock %}