o
    h&D                     @   s0  d dl mZ d dlmZ d dlZd dlmZ G dd dejZdZ	dZ
d	Zd
Ze	dfe
dfed	fed
ffZdZG dd deZG dd dejZdZd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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(Zd)ZG d*d+ d+ejZ G d,d- d-ejZ!G d.d/ d/ejZ"G d0d1 d1ejZ#G d2d3 d3ejZ$G d4d5 d5ejZ%G d6d7 d7ejZ&G d8d9 d9e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 )@    )models)AbstractUserN)RichTextFieldc                   @   s^   e Zd ZdZejddZejddddZejdddZ	ejddd	Z
G d
d dZdd ZdS )
DepartmentzF
     Department Employee belongs to. eg. Transport, Engineering.
    }   
max_lengthTr   nullblankCreated)verbose_nameauto_now_addUpdated)r   auto_nowc                   @      e Zd ZdZdZddgZdS )zDepartment.Metar   DepartmentsnamecreatedN__name__
__module____qualname__r   verbose_name_pluralordering r   r   $/var/www/html/humari/myapp/models.pyMeta       r   c                 C      | j S Nr   selfr   r   r   __str__      zDepartment.__str__N)r   r   r   __doc__r   	CharFieldr   descriptionDateTimeFieldr   updatedr   r$   r   r   r   r   r      s    r   z	Full-Timez	Part-TimeContractIntern   c                   @   s  e Zd ZejdddddZejddddZejdd	Zejdddd
Z	ej
ddddZejdddddZejddddZejddddZejddeedddZejdddZejeejdddZejdejddddZejdejddddZejdejddddZejdddZejdddZej ddddZ!ejdddZ"ej#de$dddZ%dZ&d d!gZ'd"d# Z(e)d$d% Z*e)d&d' Z+e)d(d) Z,e)d*d+ Z-d,d- Z.d.S )/User_Profiled   FT)r   uniquer   r
   Email   )r   r   r0      r   r   r   r
   profile_pics	upload_tor   r
   
   )r   r
   r   r0   2   r	   zEmployee Type   )r   defaultchoicesr   r
   r   r
   	on_deleter
   r   r#   employee_managerr?   r
   r   related_nameemployee_team_leaderemployee_hrr
   r   r;   r
   r   zLeave days per year counter)r   r;   r
   r   email	full_nameusernamec                 C   s   | j r| j S | jS r    )rH   rG   r"   r   r   r   r$   B   s   zUser_Profile.__str__c                 C   s$   t j j}| jj}|r|| S d S r    )datetimedatetodayyeardate_of_birth)r#   current_yeardateofbirth_yearr   r   r   get_ageH   s
   zUser_Profile.get_agec                 C   s   | j r	| j dS d S )Nz%A,%d %B)birthdaystrftimer"   r   r   r   get_pretty_birthdayO   s   z User_Profile.get_pretty_birthdayc                 C   s   | j jtj jkS )z?
        returns True, if birthday is today else False
        rR   dayrJ   rK   rL   r"   r   r   r   birthday_todayX   s   zUser_Profile.birthday_todayc                 C   s   | j jtj jk S )z
        Check if Birthday has already been celebrated ie in the Past     ie. 4th May  & today 8th May 4 < 8 -> past else present or future rU   r"   r   r   r   days_check_date_fadea   s   z!User_Profile.days_check_date_fadec                 C   sT   t j }|j}| j}t ||j|j}|r(|| jdkr&t|| jd S dS dS )zI
        This method counts days to birthday -> 2 day's or 1 day
           z day'sz	 tomorrowN)	rJ   rK   rL   rM   rR   monthrV   daysstr)r#   rL   rO   rR   future_date_of_birthr   r   r   birthday_counterj   s   
zUser_Profile.birthday_counterN)/r   r   r   r   r'   rI   
EmailFieldrG   rH   organisation	FileFieldprofile_picphoneemployee_id	job_title	FULL_TIMEEMPLOYEETYPEemployee_typeIntegerField
experiance
ForeignKeyr   CASCADE
departmentSET_NULLmanagerteam_leaderhr	DateFieldrN   	TextFieldaddressBooleanField	agreement	date_joinPositiveIntegerFieldDAYSleave_in_yearUSERNAME_FIELDREQUIRED_FIELDSr$   propertyrQ   rT   rW   rX   r^   r   r   r   r   r.   *   s@    



r.   c                   @   s   e Zd ZejedejdddZejddddddZ	ejd	d
ddddZ
ejddddddZejdddddddZejddddZejddddZejddddZG dd dZdd ZdS )Bankz&select employee(s) to add bank accountTF)	help_textr?   r
   r   zName of Bankr    )r   r   r
   r   zAccount Numberzemployee account numberr-   )r   r   r   r
   Branchz"which branch was the account issuezStarting Salaryz&This is the initial salary of employee      )r   
max_digitsdecimal_placesr
   r   r/   r4   r   r   r   r
   r   r   r   r
   c                   @   r   )z	Bank.Metar~   Banksz-namez-accountNr   r   r   r   r   r      r   r   c                 C   s   d | jS )Nz{0})formatr   r"   r   r   r   r$      s   zBank.__str__N)r   r   r   r   rk   r.   rl   employeer'   r   accountbranchDecimalFieldsalarycountryr)   r   r*   r   r$   r   r   r   r   r~      s    r~   ))2024r   )2025r   )2026r   )2027r   )2028r   )2029r   )2030r   )2031r   )2032r   )2033r   )2034r   )2035r   ))Januaryr   )Februaryr   )Marchr   )Aprilr   )Mayr   )Juner   )Julyr   )Augustr   )	Septemberr   )Octoberr   )Novemberr   )Decemberr   c                   @   s  e Zd ZejeejdddZejddde	dZ
ejdddedZejdddZejddddZejddd	Zejddd	Zejddd	Zejd
ddddZejddd	ZejdddddZejddddZejddddZejdddddZejddddZejddddZdd ZdS )PayrollTFr>   r9   r   r   r
   r<   r=   r-   rF   rE   r8   r   )r   r   r
   r   r   zsalary slipr7   r
   r   r/   r4      r   r   r   r   c                 C   s$   | j jr| j j dS | j j dS )Nz	's Salary)r   rH   rG   r"   r   r   r   r$      s   zPayroll.__str__N)r   r   r   r   rk   r.   rl   r   r'   MONTHSrZ   YEARSrM   ri   basic_salary
total_dayspresent_daysmedicalpfr   bonusconvence
net_salaryra   salary_slipr   taxr)   r   r*   r$   r   r   r   r   r      s$    r   c                   @   sD   e Zd ZejeejddddZejddZ	ej
eddZd	d
 ZdS )ProjectTFproject_userrA   r2   r   project_employees)rB   c                 C   r   r    )project_namer"   r   r   r   r$      r%   zProject.__str__N)r   r   r   r   rk   r.   rl   userr'   r   ManyToManyField	employeesr$   r   r   r   r   r      s
    r   c                   @   s   e Zd ZejeejdZejddZ	ej
dddZejddZej
dddZejddddZej
dddddZejdddddZd	d
 ZdS )EmployeeAttendance)r?   Fr;   TrE      r	   r   r   r
   r   c                 C      | j jS r    r   rH   r"   r   r   r   r$         zEmployeeAttendance.__str__N)r   r   r   r   rk   r.   rl   r   ru   is_inr)   in_timeis_outout_timer'   day_typer*   rr   r   r$   r   r   r   r   r      s    r   c                   @   s8   e Zd ZejeejdddZejddddZ	dd Z
dS )Health_BenefitTr>   r2   r	   c                 C   s   | j  S r    )provider_namer"   r   r   r   r$      r   zHealth_Benefit.__str__N)r   r   r   r   rk   r.   rl   r   r'   r   r$   r   r   r   r   r      s    r   c                   @   sD   e Zd ZejeejddddZe Z	ej
dddddZdd ZdS )	FeedbackTfeedback_employee)r?   r   r
   rB   Fr   c                 C      | j j dS )Nz's Feedbackr   r"   r   r   r   r$         zFeedback.__str__N)r   r   r   r   rk   r.   rl   r   rs   feedback_textr)   r   r$   r   r   r   r   r      s
    r   c                   @   sj   e Zd ZejeejdddZejddZ	ejddZ
e Ze Ze ZejdddddZdd	 Zd
S )TrainingTr?   r   r
   r/   r   r2   Fr   c                 C   r   )Nz's Training & sessions)r   r`   r"   r   r   r   r$      r   zTraining.__str__N)r   r   r   r   rk   r.   rl   r   r'   trainertitlers   r(   rr   rK   	TimeFieldtimer)   r   r$   r   r   r   r   r      s    r   c                   @   sJ   e Zd ZejeejdddZejddddZ	ej
dddddZdd Zd	S )
SubscriptionTr   r2   r4   Fr   c                 C   s   | j j d| j S )N-)r   rI   planr"   r   r   r   r$     s   zSubscription.__str__N)r   r   r   r   rk   r.   rl   r   r'   r   r)   r   r$   r   r   r   r   r     s
    r   c                   @   s   e Zd ZejeejdddZejdddZ	ej
ddddZejdddZej
ddddZej
ddddZej
ddddZej
ddddZejd	dddd
Zdd ZdS )NotificationTr   rE   r3   r	   r=   r9   r4   Fr   c                 C   r   r    )messager"   r   r   r   r$     r%   zNotification.__str__N)r   r   r   r   rk   r.   rl   r   rs   r   r'   r`   ri   leavepolicytrainingr   notification_usersr)   r   r$   r   r   r   r   r   
  s    r   c                   @   sH   e Zd ZejeejdddZejeejdddZ	ej
ddZdd ZdS )mark_read_notificationsTr   Fr   c                 C   r   r    )notifr   r"   r   r   r   r$     r   zmark_read_notifications.__str__N)r   r   r   r   rk   r   rl   r   r.   r   ru   statusr$   r   r   r   r   r     s
    r   c                   @   s,   e Zd ZejeejdddZedddZ	dS )privacy_policyTr   rE   N)
r   r   r   r   rk   r.   rl   r   r   policy_textr   r   r   r   r          r   c                   @   s,   e Zd ZejeejdddZeje	dZ
dS )HandbookTr   r   N)r   r   r   r   rk   r.   rl   r   	JSONFieldlist
equipmentsr   r   r   r   r   $  r   r   ))Lowr   )Mediumr   )Highr   )Criticalr   ))Newr   )	Requestedr   )	In Reviewr   )Approvedr   )Activer   )
Deprecatedr   )Disqualifiedr   c                   @   s   e Zd ZejeejdddZejddddZ	ej
ddddZejdddZejdddZejedddd	Zejd
ddedZejd
ddedZejddddZejddddZejddddZejddddZdd ZdS )VendorTr   r/   r	   zvendor logor   rE   zcompany employees+)r   r
   rB   r9   r   r3   r4   r2   r   r   r   r   c                 C   r   r    r!   r"   r   r   r   r$   I  r%   zVendor.__str__N)r   r   r   r   rk   r.   rl   r   r'   r   ra   vendor_logoURLFieldwebsiters   servicesr   internal_stakeholdersCRITICALITYcriticalitySTATUSr   complaint_withvendor_typer)   r   r*   r$   r   r   r   r   r   9  s    r   c                   @   sF   e Zd ZejeejdddZejeejdddZ	ej
dddddZdS )training_readTr   r   )r   r   r
   r   N)r   r   r   r   rk   r   rl   r   r.   r   r)   r   r   r   r   r   r  L  s    r  c                   @   @   e Zd ZejeejdddZejddddZ	ej
ddddZdS )education_certeficatesTr   	documentsr6   r/   r4   N)r   r   r   r   rk   r.   rl   r   ra   	educationr'   r   r   r   r   r   r  Q      r  c                   @   r  )employement_certeficatesTr   r  r6   r/   r4   N)r   r   r   r   rk   r.   rl   r   ra   employementr'   r   r   r   r   r   r  W  r  r  c                   @   r  )id_documentsTr   r  r6   r/   r4   N)r   r   r   r   rk   r.   rl   r   ra   id_documentr'   r   r   r   r   r   r	  ]  r  r	  c                   @   r  )criminal_documentsTr   r  r6   r/   r4   N)r   r   r   r   rk   r.   rl   r   ra   criminalr'   r   r   r   r   r   r  c  r  r  c                   @   r  )credit_documentsTr   r  r6   r/   r4   N)r   r   r   r   rk   r.   rl   r   ra   creditr'   r   r   r   r   r   r  i  r  r  c                   @   s   e Zd ZejeejdddZejdddZ	ej
ddddZejdddZej
ddddZejdddZej
ddddZejdddZej
ddddZejdddZej
ddddZdd ZdS )	background_checkTr   r=   F)r;   r   r
   c                 C   r   )Nz-background statusr   r"   r   r   r   r$   |  r   zbackground_check.__str__N)r   r   r   r   rk   r.   rl   r   rs   r  ru   employement_checkr  education_checkr	  id_checkcriminal_backgroundcrminal_checkr  credit_checkr$   r   r   r   r   r  o  s    r  c                   @   sF   e Zd ZejeejdddZejdddZ	ej
ddddZdd ZdS )	job_descriptionTr   r=   r   r   c                 C   r   )Nz job descriptionr   r"   r   r   r   r$     r   zjob_description.__str__N)r   r   r   r   rk   r.   rl   r   rs   r(   r)   r   r$   r   r   r   r   r    s
    r  c                   @   st   e Zd ZejeejdddZejddddZ	ej
ddddZejddddZej
ddddZejddZdd	 Zd
S )company_agreementsTr   
agreementsr6   r/   r4   r   c                 C   r   Nz
-agreement)r   r`   r"   r   r   r   r$     r   zcompany_agreements.__str__N)r   r   r   r   rk   r.   rl   r   ra   employee_handbookr'   title_employee_handbookconfidential_agreementtitle_confidential_agreementr)   
created_atr$   r   r   r   r   r    s    r  c                   @   s`   e Zd ZejeejdddZejddddZ	ej
ddddZejddZejdd	Zd
d ZdS )employee_agreementsTr   zemployee-agreementsr6   r/   r4   Fr   r  c                 C   r   r  r   r"   r   r   r   r$     r   zemployee_agreements.__str__N)r   r   r   r   rk   r.   rl   r   ra   r  r'   r  ru   is_signr)   r  r$   r   r   r   r   r     s    r   )+	django.dbr   django.contrib.auth.modelsr   rJ   ckeditor.fieldsr   Modelr   rf   	PART_TIMECONTRACTINTERNrg   ry   r.   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r	  r  r  r  r  r  r   r   r   r   r   <module>   sV    Y	
