{% extends 'att/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:'dept_name', width:140, title: "{% trans 'report_column_departmentName' %}"}
  ,{field:'position_name', title: "{% trans 'report_column_positionName' %}"}
  ,{field:'att_date', title: "{% trans 'report_column_attendanceDate' %}", width:100, sort:true}
  ,{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:'clock_in_old', title: "{% trans 'report_column_clockInTime' %}", templet: function(obj){
    if(obj.late && obj.late.length > 0 && obj.late != '0.0' && obj.late != obj.break_late){
      return '<span style="color: #DC143C;">'+ obj.clock_in_old +'</span>'
    }else{
      return obj.clock_in_old
    }
  }}
  ,{field:'clock_out_old', title: "{% trans 'report_column_clockOutTime' %}", templet: function(obj){
    if(obj.early_leave && obj.early_leave.length > 0 && obj.early_leave != '0.0' && obj.early_leave != obj.break_early){
      return '<span style="color: #00CD66;">'+ obj.clock_out_old +'</span>'
    }else{
      return obj.clock_out_old
    }
  }}
  ,{field:'actual_wt', title: "{% trans 'report_column_actualWorkedTime' %}", width:80}
  ,{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:'total_ot', title: "{% trans 'report_column_total_ot' %}"}
  ,{field:'late', title: "{% trans 'report_column_lateDuration' %}"}
  ,{field:'early_leave', title: "{% trans 'report_column_earlyLeaveDuration' %}", width:100}
  ,{field:'total_worked', title: "{% trans 'report_column_totalWorkedDuration' %}", width:100}
  ,{field:'attendance_status', title: "{% trans 'report_column_attendance_status' %}"}
  ,{field:'punch_set', title: "{% trans 'report_column_punchTime_daily_report' %}"}
  {% if mask_enable %}
  ,{field:'displayed_mask', title: "{% trans 'report_column_displayed_mask' %}", templet: function(obj){
      if(obj.displayed_mask){
        mask_flag = obj.displayed_mask
        if(mask_flag=='Yes'){
          return '<span style="color: #00CD66;">Yes</span>'
        }else if(mask_flag=='No'){
          return '<span style="color: #ff0000;">No</span>'
        }else{
          return ''
        }
      }else{
        return ''
      }
    }}
    {% endif %}
    ,{field:'in_temp', title: "{% trans 'report_column_in_temp' %}", templet: function(obj){
      result = '';
      if(obj.in_temp){
        result = obj.in_temp
        if(obj.in_temp_color){
          result = '<' + 'span style="color:' + obj.in_temp_color + ';">' + obj.in_temp + '<' + '/span>'
        }
      }
      return result
    }}
    ,{field:'out_temp', title: "{% trans 'report_column_out_temp' %}", templet: function(obj){
      result = '';
      if(obj.out_temp){
        result = obj.out_temp
        if(obj.out_temp_color){
          result = '<' + 'span style="color:' + obj.out_temp_color + ';">' + obj.out_temp + '<' + '/span>'
        }
      }
      return result
    }}
  ]]
  ,method: "get"
  ,url: "/att/api/dailyDetailsReport/"
  });
{% endblock %}