
    vg                         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mZ  G d	 d
ej"                        Z G d dej"                        Zy)z

forms.py
    )Mapping)Any)forms)	ErrorListrender_to_string)gettext_lazy)AuditTagHorillaAuditInfoc                   X    e Zd ZdZ ej
                  d ed            Z ej
                   ej                  dddd	      d ed
            Z	 ej                  d ed            Z ej                  ej                  j                         d ed            Zd fdZd Z xZS )HistoryFormz
    HistoryForm
    FzUpdation title)requiredlabelz
Enter textoh-input w-1002)placeholderclassrowsattrszUpdation description)widgetr   r   zUpdation highlightzUpdation tag)querysetr   r   c                 n   t        |   |i | i | _        | j                  d   j                  j
                  j                  ddi       | j                  d   j                  j
                  j                  ddi       | j                  d   j                  j
                  j                  dd	d
d       y )Nhistory_titler   r   history_highlightstylezdisplay:blockhistory_tagszoh-select oh--dynamic-select-2z
width:100%auditDynamicTag)r   r   zdata-ajax-name)super__init__initialfieldsr   r   update)selfargskwargs	__class__s      '/var/www/horilla/horilla_audit/forms.pyr    zHistoryForm.__init__$   s    $)&)O$++1188'CS9TU'(//55<<g=WXN#**00779%"3	
    c                 &    d| i}t        d|      }|S )zS
        Render the form fields as HTML table rows with Bootstrap styling.
        formz$horilla_audit/horilla_audit_log.htmlr   )r$   r%   r&   context
table_htmls        r(   as_history_modalzHistoryForm.as_history_modal1   s      4.%&LgV
r)   )returnN)__name__
__module____qualname____doc__r   	CharField_r   Textareahistory_descriptionBooleanFieldr   ModelMultipleChoiceFieldr
   objectsallr   r    r.   __classcell__r'   s   @r(   r   r      s     $EOOU!<L:MNM)%//u~~".9ISVW
 &' +**a 45 2511!!%%'%q?PL
r)   r   c                   &     e Zd Zg dZ fdZ xZS )HistoryTrackingFieldsForm)	idemployee_idr:   mobilecontract_end_dateadditional_infois_from_onboardingis_directly_converted
experiencec           	      |   ddl m} t        t        |   |i | |j
                  j                         D cg c]>  }t        |d      r0|j                  | j                  vr|j                  |j                  f@ }}t        j                  |dt        j                  ddd      	      | j                  d
<   y c c}w )Nr   )EmployeeWorkInformationverbose_nameFz/oh-select oh-select-2 select2-hidden-accessiblezheight:270px;)r   r   r   )choicesr   r   tracking_fields)employee.modelsrI   r   r?   r    _meta
get_fieldshasattrnameexcluded_fieldsrJ   r   MultipleChoiceFieldSelectMultipler"   )r$   r%   r&   modelfieldfield_choicesr'   s         r(   r    z"HistoryTrackingFieldsForm.__init__G   s    D'7HH //1
un-%**DDXDX2X ZZ++,
 

 */)B)B!''N,	*
%&
s   AB9)r0   r1   r2   rR   r    r<   r=   s   @r(   r?   r?   :   s    
O
 
r)   r?   N)r3   collections.abcr   typingr   djangor   django.forms.utilsr   django.template.loaderr   django.utils.translationr	   r5   horilla_audit.modelsr
   r   Formr   r?    r)   r(   <module>ra      sB    $   ( 3 6 ;'%** 'T


 
r)   