o
    ayhW                     @   s   d dl mZ ddlmZmZmZmZmZmZ G dd dej	Z
G dd dej	ZG dd	 d	ej	ZG d
d dej	ZG dd dej	ZG dd dej	ZdS )    )forms   )EmployeeLeave
AttendancePayroll
Department	Deductionc                   @      e Zd ZG dd dZdS )EmployeeFormc                   @   s   e Zd ZeZg dZejddidejddidejddidejddddej	ddidej
ddidejddidejddidejddidejddidd
Zd	S )
zEmployeeForm.Meta)
first_name	last_nameemailphoneaddressnational_idemergency_contact_nameemergency_contact_phone
department	job_titleemployment_typeemployee_categoryemployment_status	hire_datesalary	is_activebankbranchaccount_numberprofile_photoid_scan_frontid_scan_backadditional_documentsclassform-controlattrsdate)typer#   zform-check-input)
r   r   r   r   r   r   r   r    r!   r"   N)__name__
__module____qualname__r   modelfieldsr   Select	DateInputNumberInputCheckboxInputClearableFileInputwidgets r4   r4   !/var/www/html/kangema/hr/forms.pyMeta   s    

r6   Nr)   r*   r+   r6   r4   r4   r4   r5   r          r   c                   @   r
   )	LeaveFormc                   @   s\   e Zd ZeZg dZejddidejddddejddddej	ddd	ddZ
d
S )zLeaveForm.Meta)employee
start_dateend_datereasonr#   zform-control rounded-pillr%   r'   r#   r(   zform-control rounded   )r#   rowsN)r)   r*   r+   r   r,   r-   r   r.   r/   Textarear3   r4   r4   r4   r5   r6   !   s    
r6   Nr7   r4   r4   r4   r5   r9       r8   r9   c                   @   r
   )AttendanceFormc                   @   s   e Zd ZeZg dZdS )zAttendanceForm.Meta)r:   r'   statusN)r)   r*   r+   r   r,   r-   r4   r4   r4   r5   r6   -   s    r6   Nr7   r4   r4   r4   r5   rB   ,   r8   rB   c                       sJ   e Zd Zejej ejddiddZ	G dd dZ
 fddZ  ZS )	PayrollFormr#   r$   r%   )querysetwidgetc                   @   sP   e Zd ZeZg dZejddddejddidejddide	 dZ
dS )	zPayrollForm.Meta)r:   r'   basic_salarybonus
deductionsr$   r'   r>   r%   r#   )r'   rG   rH   rI   N)r)   r*   r+   r   r,   r-   r   r/   r0   CheckboxSelectMultipler3   r4   r4   r4   r5   r6   6   s    
r6   c              	      s   t  j|i | d| jv rIz.t| jd}tjj|d| jd _	t
| dr7| jjr:| jjj| jd _W d S W d S W d S  ttfyH   Y d S w | jjri| jjrktjj| jjd| jd _	| jjj| jd _d S d S d S )Nr:   )employee_idrI   instancerG   )r:   )super__init__dataintgetr	   objectsfilterr-   rE   hasattrrL   r:   r   initial
ValueError	TypeErrorpk)selfargskwargsrK   	__class__r4   r5   rN   A   s   
zPayrollForm.__init__)r)   r*   r+   r   ModelChoiceFieldr   rR   allr.   r:   r6   rN   __classcell__r4   r4   r\   r5   rD   2   s    rD   c                   @   r
   )DepartmentFormc                   @   s.   e Zd ZeZdgZdejdddddiZdS )zDepartmentForm.Metanamer$   zEnter department nameTr#   placeholderrequiredr%   N)	r)   r*   r+   r   r,   r-   r   	TextInputr3   r4   r4   r4   r5   r6   Q   s    r6   Nr7   r4   r4   r4   r5   ra   P   r8   ra   c                   @   r
   )DeductionFormc                	   @   sV   e Zd ZeZg dZejddddejdddddej	dddd	dd
ddZ
dS )zDeductionForm.Meta)r:   r=   amountr$   T)r#   re   r%   z%e.g., Late arrival, Uniform deductionrc   z0.01z0.00)r#   stepminrd   re   N)r)   r*   r+   r	   r,   r-   r   r.   rf   r0   r3   r4   r4   r4   r5   r6   ^   s(    
r6   Nr7   r4   r4   r4   r5   rg   ]   r8   rg   N)djangor   modelsr   r   r   r   r   r	   	ModelFormr   r9   rB   rD   ra   rg   r4   r4   r4   r5   <module>   s     