[UPDT] PAYROLL: Accept attr for attachment in payroll forms

This commit is contained in:
Horilla
2024-08-31 16:11:27 +05:30
parent 1c2f45644e
commit c9ffa9f35a
3 changed files with 12 additions and 6 deletions

View File

@@ -729,6 +729,7 @@ class ReimbursementForm(ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
exclude_fields = []
if not self.instance.pk:
self.initial["allowance_on"] = str(datetime.date.today())
@@ -766,6 +767,7 @@ class ReimbursementForm(ModelForm):
attrs={"type": "date", "class": "oh-input w-100"}
)
self.fields["attachment"] = MultipleFileField(label="Attachements")
self.fields["attachment"].widget.attrs["accept"] = ".jpg, .jpeg, .png, .pdf"
# deleting fields based on type
type = None

View File

@@ -141,6 +141,9 @@ class ContractForm(ModelForm):
first = PayrollGeneralSetting.objects.first()
if first and self.instance.pk is None:
self.initial["notice_period_in_days"] = first.notice_period
self.fields["contract_document"].widget.attrs[
"accept"
] = ".jpg, .jpeg, .png, .pdf"
def as_p(self):
"""
@@ -183,6 +186,7 @@ class reimbursementCommentForm(ModelForm):
super().__init__(*args, **kwargs)
self.fields["files"] = MultipleFileField(label="files")
self.fields["files"].required = False
self.fields["files"].widget.attrs["accept"] = ".jpg, .jpeg, .png, .pdf"
def as_p(self):
"""

View File

@@ -60,9 +60,9 @@
<div class="oh-faq-card" id="requestCard{{ req.id }}">
<div class="d-flex justify-content-between">
<div style="margin-bottom: 10px">
<div class="loan-type" style="display: inline; background:hsl(58.85deg 100% 80.93%);">
{% comment %} <div class="loan-type" style="display: inline; background:hsl(58.85deg 100% 80.93%);">
{{ req.get_type_display }}
</div>
</div> {% endcomment %}
<div class="loan-type"
style="display: inline;
{% if req.status == "approved" %}background:#9acd3245; {% elif req.status == "rejected" %}
@@ -347,9 +347,9 @@
<div class="oh-faq-card" id="requestCard{{ req.id }}">
<div class="d-flex justify-content-between">
<div style="margin-bottom: 10px">
<div class="loan-type" style="display: inline; background:hsl(58.85deg 100% 80.93%);">
{% comment %} <div class="loan-type" style="display: inline; background:hsl(58.85deg 100% 80.93%);">
{{ req.get_type_display }}
</div>
</div> {% endcomment %}
<div class="loan-type"
style="display: inline;
{% if req.status == "approved" %}background:#9acd3245; {% elif req.status == "rejected" %}
@@ -630,9 +630,9 @@
<div class="oh-faq-card" id="requestCard{{ req.id }}">
<div class="d-flex justify-content-between">
<div style="margin-bottom: 10px">
<div class="loan-type" style="display: inline; background:hsl(58.85deg 100% 80.93%);">
{% comment %} <div class="loan-type" style="display: inline; background:hsl(58.85deg 100% 80.93%);">
{{ req.get_type_display }}
</div>
</div> {% endcomment %}
<div class="loan-type"
style="display: inline;
{% if req.status == "approved" %}background:#9acd3245; {% elif req.status == "rejected" %}