
    si                        d 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 ddlmZmZ dd	lmZmZmZ dd
lmZ ddlmZ  e	ed       e	 ed      d       G d de                    Z e	ed       e	 ed      d       G d de                    Z e	ed       e	 ed      d       G d de                    Zy)z
Onboarding candidate view.
    )Any)Q)reversereverse_lazy)method_decorator)gettext_lazy)HorillaMailTemplate)login_requiredpermission_required)HorillaListViewHorillaNavViewTemplateView)CandidateFilter)	Candidatedispatch)namezcandidate.view_candidate)permc                   ,     e Zd ZdZdZdef fdZ xZS )OnboardingCandidatesViewz$
    onboarding candidates view
    z4cbv/onboarding_candidates/onboarding_candidates.htmlkwargsc                     t        |   di |}t        j                  j	                  ddd      }t
        j                  j                         }||d<   ||d<   |S )NTF)	is_activehiredrecruitment_id__closedmail_templateshired_candidates )superget_context_datar   objectsfilterr	   all)selfr   contextr   r   	__class__s        H/var/www/python-projects/worksol/onboarding/cbv/onboarding_candidates.pyr   z)OnboardingCandidatesView.get_context_data    sk    '*4V4$,,33#( 4 

 -4488:$2 !&6"#    )__name__
__module____qualname____doc__template_namer   r   __classcell__r%   s   @r&   r   r      s!     KM
 
 
r'   r   c                        e Zd ZdZg dZdeddf fdZ fdZeZ	e
Zg dZd	d
iZdZd ed      dfd ed      dfd ed      dfd ed      dfgZg dZdZ xZS )OnboardingCandidatesListz
    List view
    )joining_dateprobation_endjob_position_idrecruitment_idr   returnNc                 D    t        |   di | t        d      | _        y )Nonboarding-candidates-listr   )r   __init__r   
search_urlr#   r   r%   s     r&   r8   z!OnboardingCandidatesList.__init__;   s     "6"!">?r'   c                    t        | d      sit        | 	         }|j                  dd      j                  t	        d      t	        d      z        j                         j                  d      | _        | j                  S )	NquerysetTF)r   r   )r   r   )stage_id__stage_typez-id)getattrr   get_querysetr!   r   distinctorder_byr<   )r#   r<   r%   s     r&   r?   z%OnboardingCandidatesList.get_queryset?   sn    tZ(w+-H"+0    w(GGHhuo M }}r'   ))r   r   
get_avatarEmail
last_emailzDate of joiningdate_of_joiningzProbation endsprobation_date)Job positionr3   )Recruitmentr4   )zOffer letteroffer_letteractionzstyle='width: 350px;'actionszjoining--dotzJoining Setz
            onclick="
                $('#applyFilter').closest('form').find('[name=joining_set]').val('true');
                $('[name=portal_sent]').val('unknown').change();
                $('#applyFilter').click();

            "
            znot-joining--dotzJoining Not-Setz
            onclick="
                $('#applyFilter').closest('form').find('[name=joining_set]').val('false');
                $('[name=portal_sent]').val('unknown').change();
                $('#applyFilter').click();

            "
            znot-portal--dotzPortal Not-Sentz
            onclick="
                $('#applyFilter').closest('form').find('[name=portal_sent]').val('false');
                $('[name=joining_set]').val('unknown').change();
                $('#applyFilter').click();
            "
            zportal--dotzPortal Sendz
            onclick="
                $('#applyFilter').closest('form').find('[name=portal_sent]').val('true');
                $('[name=joining_set]').val('unknown').change();
                $('#applyFilter').click();

            "
            ))r   r   rC   rF   )rJ   job_position_id__job_position)rK   recruitment_id__titlerH   zW
                onclick="window.location.href='{get_individual_url}'"
                )r(   r)   r*   r+   bulk_update_fieldsr   r8   r?   r   modelr   filter_classcolumnsheader_attrsaction_method_row_status_indicationssortby_mapping	row_attrsr-   r.   s   @r&   r0   r0   -   s    @ @ @ E"LG 	)L M m	
  	
  
	
 m	
I0dNIr'   r0   c                       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g	Z ed      ddgZ xZS )OnboardingCandidatesNavz
    Nav bar
    r   r5   Nc                 l    t        |   di | t        d      | _        dt	        d       d| _        y )Nr7   z'
                                href="zcandidate-createz2?onboarding=True"
                                r   )r   r8   r   r9   r   create_attrsr:   s     r&   r8   z OnboardingCandidatesNav.__init__   sA    "6"!">?!''34F'G&H I!$r'   zHired Candidatesz%cbv/onboarding_candidates/filter.htmlformz#listContainerr4   rK   r3   rJ   countryCountrystage_idStager1   zJoining Dater2   zProbation Endoffer_letter_statuszOffer Letter Status$rejected_candidate__reject_reason_idzRejected Reason%skillzonecandidate_set__skill_zone_idz
Skill ZonezSend Portalz

                    data-target="#addAttachments"
                    data-toggle="oh-modal-toggle"
                    id="send-port"
                    )rM   attrs)r(   r)   r*   r+   r   r8   rW   	nav_titler   filter_instancefilter_body_templatefilter_form_context_namesearch_swap_targetgroup_by_fieldsrN   r-   r.   s   @r&   r\   r\      s    $ $ $ $%I%'OB%) 
1]+,	An-.	AiL!	QwZ 	>*+	!O,-	"7 89	/3D1EF	0!L/B
O &	

Gr'   r\   N)r+   typingr   django.db.modelsr   django.urlsr   r   django.utils.decoratorsr   django.utils.translationr   rW   base.modelsr	   horilla_views.cbv_methodsr
   r   horilla_views.generic.cbv.viewsr   r   r   recruitment.filtersr   recruitment.modelsr   r   r0   r\   r   r'   r&   <module>rx      s      - 4 6 + I 
 0 ( .z2%+EFZX|  Y 3( .z2%+EFZXm m Y 3m` .z2%+EFZX(n ( Y 3(r'   