
    si                     L   d Z ddlmZ ddlmZmZmZ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 dd	lmZ dd
lmZ ddlmZ ddlmZ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y)z
Dashboard of onboarding
    )Any)	CharFieldCountQValue)CastConcat)reverse)method_decorator)gettext_lazy)login_required)HorillaListView)all_manager_can_enter)OnboardingTaskFilter)CandidateTaskOnboardingTaskdispatch)namez onboarding.change_onboardingtaskc                        e Zd ZdZeZdZeZ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gZdddddddZ fdZdeddf fdZ xZS )MyOnboardingTaskListz5
    List view for onboarding tasks in dashboard
    Fz
                hx-get="{get_detail_url}"
                hx-target="#taskModalBody"
                data-target="#taskModal"
                data-toggle="oh-modal-toggle"
                Tasktask_title_countTodo
todo_count	Scheduledscheduled_countOngoingongoing_countStuckstuck_countDone
done_countzW
                          style = "width:100px !important "
                          zU
                          style = "width:55px !important"
                          zV
                          style = "width:55px !important;"
                          zU
                          style = "width:60px !important"
                          zU
                          style = "width:65px !important"
                          )r   r   r   r   r    r"   c                 L   t         |          }| j                  j                  j                  j
                  }|j                  |dd      j                         j                  t        dt        d      d      t        dt        d      d      t        dt        d	      d      t        dt        d
      d      t        dt        d      d      t        dt        d      t        t        dd      t                     t        d      t                           }|S )NTF)employee_id__idcandidates__is_active"candidates__recruitment_id__closedcandidatetasktodo)candidatetask__status)filterdistinct	scheduledongoingstuckdone
task_titlez ()r+   ))output_field)r   r   r   r    r"   r   )superget_querysetrequestuseremployee_getidr*   r+   annotater   r   r	   r   r   r   )selfquerysetemployee_id	__class__s      </var/www/python-projects/worksol/onboarding/cbv/dashboard.pyr4   z!MyOnboardingTaskList.get_querysetF   s   7')ll''4477OO +&*38  
 XZX #6:!
 !&#;?!!
 $#9=!
 "#7;!
 !#6:!
 "( $K>	L#J!*"5  ! 	V     kwargsreturnNc                 R    t        |   di | d| _        t        d      | _        y )NmyOnboardingztask-report-onboarding )r3   __init__view_idr
   
search_url)r:   r@   r=   s     r>   rE   zMyOnboardingTaskList.__init__v   s'    "6"%!":;r?   )__name__
__module____qualname____doc__r   modelbulk_select_optionr   filter_class	row_attrs_columnsheader_attrsr4   r   rE   __classcell__r=   s   @r>   r   r      s    
 E'LI 
6&'	
6L!	
;*+	
9'	
7]#	
6L!G!L*.`< < < <r?   r   zonboarding.view_candidatetaskc                   f     e Zd ZdZeZdZdZ ed      df ed      dfgZ	de
f fd	Z fd
Z xZS ) MyOnboardingCandidatesSingleViewz8
    Single view of my onboarding task in dashboard
    Nz%cbv/dashboard/my_onboarding_task.html
Candidaatecandidate_id__nameStatus
status_colr@   c                     t        |   di |}| j                  j                  j	                  d      }t
        j                  j                  |      }||d<   |S )Ntask_idonboarding_task_id__idcandidate_tasksrD   )r3   get_context_datar5   GETgetr   objectsr*   )r:   r@   contextr\   r_   r=   s        r>   r`   z1MyOnboardingCandidatesSingleView.get_context_data   sX    '*4V4,,""&&y1'//66g6V%4!"r?   c                     t         |          }| j                  j                  j	                  d      }|j                  |      }|S )Nr\   r]   )r3   r4   r5   ra   rb   r*   )r:   r;   r\   r=   s      r>   r4   z-MyOnboardingCandidatesSingleView.get_queryset   s?    7'),,""&&y1??'?Br?   )rH   rI   rJ   rK   r   rL   rM   template_namerP   rQ   r   r`   r4   rS   rT   s   @r>   rV   rV   |   sR    
 E;M 
<./	
8l#G
  r?   rV   N)rK   typingr   django.db.modelsr   r   r   r   django.db.models.functionsr   r	   django.urlsr
   django.utils.decoratorsr   django.utils.translationr   rP   horilla_views.cbv_methodsr   horilla_views.generic.cbv.viewsr   onboarding.cbv_decoratorsr   onboarding.filtersr   onboarding.modelsr   r   r   rV   rD   r?   r>   <module>rr      s     7 7 3  4 6 4 ; ; 3 ; .z2<=Ja<? a< 3a<H .z29:  3r?   