| 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>( � @ s� d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl m
Z
d dlmZ d dl
mZ d d lmZ d d
lmZ e �e�Ze �d�ZG dd
� d
e�ZG dd� de�ZdS )� N)�Thread)�settings)�messages)�EmailMessage)�Q)�render_to_string)�gettext)�ConfiguredEmailBackend)� mark_safe�djangoc s0 e Zd Zdd� Zd
dd�Zd� fdd �Z� ZS )�LeaveMailSendThreadc C sB t �| � || _|| _|| _|�� | _|�� rd| _d S d| _d S )N�https�http) r �__init__�request�
leave_request�type�get_host�host� is_secure�protocol)�selfr r r � r �/var/www/erp/leave/threading.pyr s
zLeaveMailSendThread.__init__�#c
C s* t �d� t� }|j}| jr+z| jjj�� � d| jjjj� d�}W n t � t
� Y tjdt
tj�d � }d}|dkrAt|�} |D ]O}
|
r�td| |
||||d ��}t||d
t|
t�r^|
n|
jg|gd�}d|_t �|� z|�� t �d
� W qC t� | jdt|
t�r�|
n|
�� � �� Y qCqCd S )Nz&Executed send mail function at 28 linez <�>r � r
r z/base/mail_templates/leave_request_template.html)�link�instancer r �subject�contentzinfo@growthnatives.com)r �body�
from_email�to�reply_to�htmlz&after sending mail function at 65 linezMail not sent to )�logger�infor �$dynamic_from_email_with_display_namer �user�employee_get�
get_full_name�email�error� Exceptionr �BASE_URL�len�intr r �
isinstance�str�content_subtype�sendr )
r r r �
recipients�leave_request_id�
email_backend�display_email_namer r r � recipient�html_messager, r r r �
send_email sT
&���
���zLeaveMailSendThread.send_email�returnNc s� ddl m} t� �� | jdkr�t�d� | jj}| jj j
}| jj}| jj}| jj
}| jj�� }| jj}|j�� } td|�� � d|� d|�d�� d |�d�� d
|dkrUdnd
� d|�� � d|� d��}
d}| D ]}|j j
dkr~|d|j j
� d|�� � d�7 }qg|d7 }t|
� d|� ��}
|� d|� �}ddg}| �||
|g| | jj� t�d� t|
� d|� ��}|� d�}| �|||g| jj� d S | jdkr�| jj}| jj�� }d}d|� d �}| �|||g| jj� d S | jd!k�r
| jj}| jj�� }d"}d#|� d �}| �|||g| jj� d S | jd$k�rF| jj}| jj�� }d%|� d&|� d �}
d'}| �||
|g| jj� d(|� d �}d)}| �|||g| jj� d S )*Nr )�AvailableLeaver z(Executed mail thread function at 73 linea>
<h4 style="margin:10px 0 5px 0;">Details:</h4>
<table border=1 style="border-collapse: collapse; width: 90%; border-color:#dddddd; text-align:left; font-size:12px;">
<tr>
<th style="padding: 4px;">Employee</th>
<td style="padding: 4px;">z�</td>
</tr>
<tr>
<th style="padding: 4px;">Leave Type</th>
<td style="padding: 4px;">z�</td>
</tr>
<tr>
<th style="padding: 4px;">From Date</th>
<td style="padding: 4px;">z%d-%m-%Yz�</td>
</tr>
<tr>
<th style="padding: 4px;">To Date</th>
<td style="padding: 4px;">z�</td>
</tr>
<tr>
<th style="padding: 4px;">Status</th>
<td style="padding: 4px;">�approvedzApproved by LeadzPending for Lead's Approvalz�</td>
</tr>
<tr>
<th style="padding: 4px;">Leave Approver</th>
<td style="padding: 4px;">z�</td>
</tr>
<tr>
<th style="padding: 4px;">Reason</th>
<td style="padding: 4px;">z=</td>
</tr>
</table>
a <h4 style="margin:15px 0 5px 0;">All Leaves</h4><table border=1 style="width: 90%; border-collapse: collapse; border-color:#dddddd; text-align:left; font-size:12px;"><tr><th style="padding: 4px;">Leave Type</th><th style="padding: 4px;">Leave Taken</th></tr>zLeave Without Payz<tr><td style="padding: 4px;">z</td><td style="padding: 4px;">z
</td></tr>z</table>� z requested by zgeeta.patial@growthnatives.comzanju.yadav@growthnatives.comz!after executing send email at 142z request created successfully�approvez0The Leave request has been successfully approvedz�This is to inform you that the leave request has been approved. If you have any questions or require further information, feel free to reach out to the �.�rejectz#The Leave request has been rejectedz�This is to inform you that the leave request has been rejected. If you have any questions or require further information, feel free to reach out to the �cancelzKThis is to inform you that a leave request has been requested to cancel by z�. Take the necessary actions for the leave request. Should you have any additional information or updates, please feel free to communicate directly with the zLeave request cancellationa6 This is to inform you that a cancellation request created for your leave request has been successfully logged into our system. The manager will now take the necessary actions to address the leave request. Should you have any additional information or updates, please feel free to communicate directly with the z$Leave request cancellation requested)�leave.modelsr>