
    si}                         d Z ddlmZ ddlmZ ddlmZ ddlmZ	 ddl
mZ ddlmZ ddlmZ dd	lmZ dd
lmZmZ ddlmZ ddlmZ ddlmZmZmZmZ  eed       G d de             Z eed       G d de             Z eed       G d de             Z  eed       G d de             Z! eed       G d de             Z"y)z
Late come and early out page
    )Any)reverse)method_decorator)gettext_lazy)LateComeEarlyOutFilter)LateComeEarlyOutExportForm)AttendanceLateComeEarlyOut)PenaltyFilter)filtersubordinatesis_reportingmanager)PenaltyAccounts)login_required)HorillaDetailedViewHorillaListViewHorillaNavViewTemplateViewdispatch)namec                       e Zd ZdZdZy)LateComeAndEarlyOutz!
    Late come and early out
    z8cbv/late_come_and_early_out/late_come_and_early_out.htmlN)__name__
__module____qualname____doc__template_name     J/var/www/python-projects/worksol/attendance/cbv/late_come_and_early_out.pyr   r      s     OMr   r   c                       e Zd ZdZdgZdeddf fdZ fdZdZe	Z
eZ ed	      d
df ed      df ed      df ed      df ed      df ed      df ed      df ed      df ed      df ed      dfg
ZddiZg dZ xZS ) LateComeAndEarlyOutListz
    List view
    late_early_idkwargsreturnNc                 .   t        |   di | t        d      | _        d| _        | j
                  j                  j                  d      sBt        | j
                        s-| j
                  j                  j                  d      sd | _	        y d| _	        y )Nlate-come-early-out-searchzlate-container!attendance.chanage_penaltyaccount2perms.attendance.delete_attendancelatecomeearlyoutactions_columnr   )
super__init__r   
search_urlview_idrequestuserhas_permr   action_method)selfr"   	__class__s     r   r*   z LateComeAndEarlyOutList.__init__+   sy    "6"!">?'!!**+NO'5LL%%..D "&D!1Dr   c                     t         |          }|}|j                  | j                  j                        }t        | j                  |d      }||z  }|S )N)employee_id__employee_user_idz*attendance.view_attendancelatecomeearlyout)r)   get_querysetfilterr-   r.   r   )r1   querysetreportsself_reportsr2   s       r   r5   z$LateComeAndEarlyOutList.get_queryset:   sV    7')T\\EVEVW$LL'#O
  ')r   z
                hx-get='{late_come_detail}?instance_ids={ordered_ids}'
                hx-target="#genericModalBody"
                data-target="#genericModal"
                data-toggle="oh-modal-toggle"
                Employeeemployee_idemployee_id__get_avatarTypeget_typeAttendance Dateattendance_id__attendance_dateCheck-In"attendance_id__attendance_clock_inIn Date'attendance_id__attendance_clock_in_date	Check-Out#attendance_id__attendance_clock_outOut Date(attendance_id__attendance_clock_out_dateMin Hourattendance_id__minimum_hourAt Work%attendance_id__attendance_worked_hour
Penalitiespenalities_columnz[
                             style ="width:170px !important"
                             )	)r:   employee_id__get_full_namer<   )r=   r>   )r?   r@   )rA   rB   )rC   rD   )rE   rF   )rG   rH   )rK   rL   )rI   rJ   )r   r   r   r   filter_keys_to_remover   r*   r5   	row_attrsr	   modelr   filter_class_columnsheader_attrssortby_mapping__classcell__r2   s   @r   r    r    #   s     --2 2 2I 'E)L	
:'@A	
6J	
	?@	
:<=	
9@A	
;>?	
:BC	
:56	
9>?	
<-.G 	 !L
Nr   r    c                   2    e Zd ZdZdeddf fdZ ed      Z e       Z	dZ
dZd	Zd
 ed      fd ed      fd ed      fd ed      fd ed      fd ed      fd ed      fd ed      fd ed      fd ed      fd ed      fd  ed!      fgZ xZS )"LateComeAndEarlyOutListNavz
    Nav bar
    r"   r#   Nc                    t        |   di | t        d      | _        t	        d      dt        d       ddg}| j
                  j                  j                  d      s%| j
                  j                  j                  d      r|j                  t	        d	      d
d       | j
                  j                  j                  d      s<t        | j
                        s'| j
                  j                  j                  d      sd }|| _
        y )Nr%   Exportzw
                data-toggle="oh-modal-toggle"
                data-target="#attendanceExport"
                hx-get="zlate-come-and-early-out-exportzm"
                hx-target="#attendanceExportForm"
                style="cursor: pointer;"
                )actionattrsr&   r'   Deletez
                    onclick="
                    lateComeBulkDelete();
                    "
                    data-action = "delete"
                    style="cursor: pointer; color:red !important"
                    r   )r)   r*   r   r+   rT   r-   r.   r/   appendr   actions)r1   r"   rb   r2   s      r   r*   z#LateComeAndEarlyOutListNav.__init__s   s    "6"!">? H+ !!ABC D	
 <<%%/
\\''@
 NNk	 !!**+NO'5LL%%..D Gr   zLate Come/Early Out z2cbv/late_come_and_early_out/late_early_filter.htmlformz#listContainerr;   r:   typer=   r@   r?   attendance_id__shift_idShiftattendance_id__work_type_id	Work TyperJ   zMinimum Hour#attendance_id__employee_id__countryCountryDattendance_id__employee_id__employee_work_info__reporting_manager_idzReporting Manager=attendance_id__employee_id__employee_work_info__department_id
Department?attendance_id__employee_id__employee_work_info__job_position_idzJob Position@attendance_id__employee_id__employee_work_info__employee_type_idzEmployment Type:attendance_id__employee_id__employee_work_info__company_idCompany)r   r   r   r   r   r*   rT   	nav_titler   filter_instancefilter_body_templatefilter_form_context_namesearch_swap_targetgroup_by_fieldsrX   rY   s   @r   r[   r[   m   s    + + +Z ()I,.OO%) 
*&	6	)1->+?@	"AgJ/	&+7	&.(9:	.)=R!"	

 LlO	

 Nn	

 O 	
 
Fq|T1Or   r[   c                   ,     e Zd ZdZdZdef fdZ xZS )LateEarlyExportViewz
    For  export records
    z2cbv/late_come_and_early_out/late_early_export.htmlr"   c                     t        |   di |}t        j                  j	                         }t
        }t        |      }||d<   ||d<   |S )N)r7   export_formexportr   )r)   get_context_datar	   objectsallr   r   )r1   r"   contextdatar{   r|   r2   s         r   r}   z$LateEarlyExportView.get_context_data   sQ    '*4V4)115570'6!,"r   )r   r   r   r   r   r   r}   rX   rY   s   @r   ry   ry      s!     IM  r   ry   c                      e Zd ZdZeZ ed      ZddddZ ed      df ed	      d
f ed      df ed      df ed      df ed      df ed      df ed      df ed      df ed      df ed      df ed      dfgZ	dZ
y )!LateComeEarlyOutDetailViewz
    Detail View
    DetailsrO   late_come_subtitler<   )titlesubtitleavatarr=   r>   r?   r@   rA   rB   zChen-in DaterD   rE   rF   zCheck-out DaterH   rI   rJ   rK   rL   rf   re   rh   rg   zAttendance Validatedattendance_validated_checkrM   rN   detail_actionsN)r   r   r   r   r	   rR   rT   r   headerbodyr0   r   r   r   r   r      s     'EiLE .(+F 
6J	
	?@	
:<=	
>	EF	
;>?	
	HI	
:56	
9>?	
7./	
;67	
!	"$@A	
<-.D %Mr   r   N)#r   typingr   django.urlsr   django.utils.decoratorsr   django.utils.translationr   rT   attendance.filtersr   attendance.formsr   attendance.modelsr	   base.filtersr
   base.methodsr   r   base.modelsr   horilla_views.cbv_methodsr   horilla_views.generic.cbv.viewsr   r   r   r   r   r    r[   ry   r   r   r   r   <module>r      s      4 6 5 7 8 & @ ' 4  .z2O, O 3O .z2Fo F 3FR .z2Q Q 3Qh .z2,  3" .z2%!4 % 3%r   