| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/erp/leave/__pycache__/ |
Upload File : |
o
hͦh.� � @ sZ d Z ddlZddlZddlZddlmZmZ ddlmZ ddlm Z ddl
mZ ddlm
Z
ddlmZ dd lmZ dd
lmZ ddlmZ ddlmZ dd
lmZmZ ddlmZmZ ddlm Z ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z< ded�fded�fgZ=dZ>G dd� de j�ZG dd � d e j�Z?G d!d"� d"e?�Z@G d#d$� d$e?�ZAd%d&� ZBd'd(� ZCG d)d*� d*e�ZDG d+d,� d,e�ZEG d-d.� d.e�ZFG d/d0� d0e)�ZGG d1d2� d2e�ZHG d3d4� d4e�ZIG d5d6� d6e�ZJg d7�ZKG d8d9� d9e jL�ZMG d:d;� d;e jL�ZNG d<d=� d=e�ZOG d>d?� d?e�ZPG d@dA� dAe jL�ZQG dBdC� dCe jL�ZRG dDdE� dEe(�ZSG dFdG� dGe�ZTG dHdI� dIe�ZUG dJdK� dKe�ZVG dLdM� dMe�ZWG dNdO� dOe�ZXe�YdP��r�dQdRlZm[Z[m\Z\ G dSdT� dTe�Z]G dUdV� dVe jL�Z^G dWdX� dXe�Z_dS dS )Yz�
This module provides Horilla ModelForms for creating and managing leave-related data,
including leave type, leave request, leave allocation request, holidays and company leaves.
� N)�date�datetime)�Any)�forms)�apps)�ValidationError)�Q)� ModelForm)� TextInput��render_to_string)�gettext_lazy)�filtersubordinatesemployeemodel�reload_queryset)�
CompanyLeaves�Holidays)�EmployeeFilter)�MultipleFileField)�Employee)�horilla_middlewares)�HorillaForm�HorillaModelForm)�HorillaMultiSelectField)�HorillaMultiSelectWidget)�calculate_requested_days�company_leave_dates_list�get_leave_day_attendance�holiday_dates_list�leave_requested_dates)�AvailableLeave�LeaveAllocationRequest�LeaveallocationrequestComment�LeaveRequest�LeaverequestComment�LeaverequestFile� LeaveType�
RestrictLeave�yes�Yes�no�Nog j�@c s e Zd ZdZ� fdd�Z� ZS )r z�
Customized ModelForm class with additional functionality for field customization
based on the type of widget and setting initial values based on the current request.
c sN t � j|i |�� ttjdd�}t| j� | j�� D ]j\}}|j}t |t
j�r6|jj�
ddi� t�� |_qt |t
jt
jt
jf�rM|jj�
d|jd�� qt |t
jf�r^|jj�
ddi� qt |t
j�rr|jj�
d|jdd d
�� qt |t
jt
jf�r�|jj�
ddi� qz
|jj| jd _W n Y z|jjj| jd
_W dS Y dS )a>
Initializes the ModelForm instance.
This method customizes field attributes such as CSS classes and placeholders
based on the type of widget. It also sets initial values for specific fields
based on the current request, particularly for 'employee_id' and 'company_id' fields.
�requestN�classz oh-input oh-calendar-input w-100�oh-input w-100�r, �placeholderz/oh-select oh-select-2 select2-hidden-accessible� �( �r, r/ �rows�cols�oh-switch__checkbox�employee_id�
company_id)�super�__init__�getattrr �_thread_localsr �fields�items�widget�
isinstancer � DateInput�attrs�updater �today�initial�NumberInput�
EmailInputr
�label�Select�Textarea�
CheckboxInput�CheckboxSelectMultiple�user�employee_get�get_company��self�args�kwargsr+ �
field_name�fieldr>