[UPDT] EMPLOYEE : Employee work info updation issue fixes in individual and bulk update and new database issues fixes

This commit is contained in:
Horilla
2024-05-16 14:26:44 +05:30
parent 9f468a4e64
commit a247b9ec3e
10 changed files with 338 additions and 298 deletions

View File

@@ -301,27 +301,57 @@ class EmployeeWorkInformationForm(ModelForm):
if isinstance(field, forms.ModelChoiceField) and field.label in field_names: if isinstance(field, forms.ModelChoiceField) and field.label in field_names:
if field.label is not None: if field.label is not None:
field_name = field_names.get(field.label) field_name = field_names.get(field.label)
if field.queryset.model != Employee and field_name: # print(field.label)
translated_label = _(field.label) if field.label == "Department":
empty_label = _("---Choose {label}---").format( if field.queryset.model != Employee and field_name:
label=translated_label translated_label = _(field.label)
) empty_label = _("---Choose {label}---").format(
self.fields[label] = forms.ChoiceField( label=translated_label
choices=[("", empty_label)] )
+ list(field.queryset.values_list("id", f"{field_name}")), self.fields[label] = forms.ChoiceField(
required=field.required, choices=[("", empty_label)]
label=translated_label, + list(
initial=field.initial, field.queryset.values_list("id", f"{field_name}")
widget=forms.Select( ),
attrs={ required=field.required,
"class": "oh-select oh-select-2 select2-hidden-accessible", label=translated_label,
"onchange": f'onDynamicCreate(this.value,"{urls.get(field.label)}");', initial=field.initial,
} widget=forms.Select(
), attrs={
) "class": "oh-select oh-select-2 select2-hidden-accessible",
self.fields[label].choices += [ "onchange": f'onDynamicCreateDep(this.value,"{urls.get(field.label)}");',
("create", _("Create New {} ").format(translated_label)) }
] ),
)
self.fields[label].choices += [
("create", _("Create New {} ").format(translated_label))
]
else:
if field.queryset.model != Employee and field_name:
translated_label = _(field.label)
empty_label = _("---Choose {label}---").format(
label=translated_label
)
self.fields[label] = forms.ChoiceField(
choices=[("", empty_label)]
+ list(
field.queryset.values_list("id", f"{field_name}")
),
required=field.required,
label=translated_label,
initial=field.initial,
widget=forms.Select(
attrs={
"class": "oh-select oh-select-2 select2-hidden-accessible",
"onchange": f'onDynamicCreate(this.value,"{urls.get(field.label)}");',
}
),
)
self.fields[label].choices += [
("create", _("Create New {} ").format(translated_label))
]
def clean(self): def clean(self):
cleaned_data = super().clean() cleaned_data = super().clean()

View File

@@ -80,7 +80,7 @@
<hr class="mt-5 mb-3"> <hr class="mt-5 mb-3">
<div class="w-100 d-flex align-items-center justify-content-end"> <div class="w-100 d-flex align-items-center justify-content-end">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--w-100-resp"> <button type="submit" class="oh-btn oh-btn--secondary oh-btn--w-100-resp">
{% trans "Save Changes" %} {% trans "Save" %}
</button> </button>
</div> </div>
</form> </form>

View File

@@ -177,14 +177,12 @@
</div> </div>
</div> </div>
</div> </div>
<hr class="mt-5 mb-3 d-flex flex-row-reverse w-100" /> <hr class="mt-5 mb-3">
<div class="row d-flex flex-row-reverse"> <div class="w-100 d-flex align-items-center justify-content-end">
<div class="col-lg-2 "> <button type="submit" class="oh-btn oh-btn--secondary oh-btn--w-100-resp">
<button type="submit" class="oh-btn oh-btn--secondary"> {% trans "Save" %}
{% trans "Save Changes" %} </button>
</button>
</div> </div>
</div>
</form> </form>
</div> </div>
</div> </div>

View File

@@ -1,84 +1,86 @@
{% load i18n %} {% load i18n %}
<div class="oh-general__tab-target oh-profile-section mb-4 d-none" id="bank"> <div class="oh-wrapper">
<div class="oh-profile-section__card"> <div class="oh-general__tab-target oh-profile-section mb-4 d-none" id="bank">
<form method='post' action="" > <div class="oh-profile-section__card">
<div id="bankMessage"> <form method='post' action="" >
</div> <div id="bankMessage">
{% csrf_token %} </div>
<div class="row"> {% csrf_token %}
<div class="col-12 col-sm-12 col-md-12 col-lg-6"> <div class="row">
<div class="oh-input-group"> <div class="col-12 col-sm-12 col-md-12 col-lg-6">
<label class="oh-label" for="{{bank_form.bank_name.id_for_label}}">{% trans "Bank Name" %}</label>
{{bank_form.bank_name}}
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{bank_form.account_number.id_for_label}}">{% trans "Account Number" %}</label>
{{bank_form.account_number}}
{{bank_form.account_number.errors}}
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{bank_form.branch.id_for_label}}">{% trans "Branch" %}</label>
{{bank_form.branch}}
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{bank_form.any_other_code1.id_for_label}}">{% trans "Bank Code" %} #1</label>
{{bank_form.any_other_code1}}
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group">
<label class="oh-label" for="{{bank_form.address.id_for_label}}">{% trans "Bank Address" %}</label>
{{bank_form.address}}
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<label class="oh-label" for="country">{% trans "Country" %}</label>
<select name="country" class="oh-select-2 w-100 country" id="country">
<option value="{{bank_form.instance.country}}" selected>{{bank_form.instance.county}}</option>
</select>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group"> <div class="oh-input-group">
<label class="oh-label" for="state">{% trans "State" %}</label> <label class="oh-label" for="{{bank_form.bank_name.id_for_label}}">{% trans "Bank Name" %}</label>
<select name="state" class="oh-select-2 w-100 country" id="state"> {{bank_form.bank_name}}
<option value="{{bank_form.instance.state}}" selected>{{bank_form.instance.state}}</option> </div>
</select> </div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{bank_form.account_number.id_for_label}}">{% trans "Account Number" %}</label>
{{bank_form.account_number}}
{{bank_form.account_number.errors}}
</div>
</div> </div>
</div> </div>
</div> <div class="row">
<div class="row"> <div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group"> <div class="oh-input-group">
<label class="oh-label" for="{{bank_form.city.id_for_label}}">{% trans "City" %}</label> <label class="oh-label" for="{{bank_form.branch.id_for_label}}">{% trans "Branch" %}</label>
{{bank_form.city}} {{bank_form.branch}}
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{bank_form.any_other_code1.id_for_label}}">{% trans "Bank Code" %} #1</label>
{{bank_form.any_other_code1}}
</div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6"> <div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group"> <div class="oh-input-group">
<label class="oh-label" for="{{bank_form.any_other_code2.id_for_label}}">{% trans "Bank Code" %} #2</label> <label class="oh-label" for="{{bank_form.address.id_for_label}}">{% trans "Bank Address" %}</label>
{{bank_form.any_other_code2}} {{bank_form.address}}
</div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<label class="oh-label" for="country">{% trans "Country" %}</label>
<select name="country" class="oh-select-2 w-100 country" id="country">
<option value="{{bank_form.instance.country}}" selected>{{bank_form.instance.county}}</option>
</select>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="state">{% trans "State" %}</label>
<select name="state" class="oh-select-2 w-100 country" id="state">
<option value="{{bank_form.instance.state}}" selected>{{bank_form.instance.state}}</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{bank_form.city.id_for_label}}">{% trans "City" %}</label>
{{bank_form.city}}
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{bank_form.any_other_code2.id_for_label}}">{% trans "Bank Code" %} #2</label>
{{bank_form.any_other_code2}}
</div>
</div>
</div>
<hr class="mt-5 mb-3">
<div class="w-100 d-flex align-items-center justify-content-end">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--w-100-resp">
{% trans "Save" %}
</button>
</div>
</form>
</div> </div>
<hr class="mt-5 mb-3"> </div>
<div class="w-100 d-flex align-items-center justify-content-end">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--w-100-resp">
{% trans "Save Changes" %}
</button>
</div>
</form>
</div> </div>
</div> </div>
</div>

View File

@@ -195,13 +195,11 @@
</div> </div>
</div> </div>
</div> </div>
<hr class="mt-5 mb-3 d-flex flex-row-reverse" /> <hr class="mt-5 mb-3">
<div class="row d-flex flex-row-reverse"> <div class="w-100 d-flex align-items-center justify-content-end">
<div class="col-lg-2"> <button type="submit" class="oh-btn oh-btn--secondary oh-btn--w-100-resp">
<button type="submit" class="oh-btn oh-btn--secondary"> {% trans "Save" %}
{% trans "Save Changes" %}
</button> </button>
</div>
</div> </div>
</form> </form>
</div> </div>

View File

@@ -1,224 +1,233 @@
{% load i18n %} {% load i18n %}
<div class="oh-wrapper">
<div
class="oh-general__tab-target oh-profile-section mb-4 d-none"
id="work"
data-select2-id="select2-data-work"
>
<div <div
class="oh-modal" class="oh-general__tab-target oh-profile-section mb-4 d-none"
id="dynamicCreateModal" id="work"
role="dialog" data-select2-id="select2-data-work"
aria-hidden="true"
> >
<div <div
class="oh-modal__dialog" class="oh-modal"
style="max-width: 550px" id="dynamicCreateModal"
id="dynamicCreateModalBody" role="dialog"
></div> aria-hidden="true"
</div> >
<span <div
name="" class="oh-modal__dialog"
id="dynamicDept" style="max-width: 550px"
style="display: none" id="dynamicCreateModalBody"
data-toggle="oh-modal-toggle" ></div>
data-target="#dynamicCreateModal" </div>
hx-get="{% url 'department-creation' %}?dynamic=true" <span
hx-target="#dynamicCreateModalBody" name=""
></span> id="dynamicDept"
<span style="display: none"
name="" data-toggle="oh-modal-toggle"
id="dynamicJobPosition" data-target="#dynamicCreateModal"
style="display: none" hx-get="{% url 'department-creation' %}?dynamic=true"
data-toggle="oh-modal-toggle" hx-target="#dynamicCreateModalBody"
data-target="#dynamicCreateModal" ></span>
hx-get="{% url 'job-position-creation' %}?dynamic=true" <span
hx-target="#dynamicCreateModalBody" name=""
></span> id="dynamicJobPosition"
<span style="display: none"
name="" data-toggle="oh-modal-toggle"
id="dynamicJobRole" data-target="#dynamicCreateModal"
style="display: none" hx-get="{% url 'job-position-creation' %}?dynamic=true"
data-toggle="oh-modal-toggle" hx-target="#dynamicCreateModalBody"
data-target="#dynamicCreateModal" ></span>
hx-get="{% url 'job-role-create' %}?dynamic=true" <span
hx-target="#dynamicCreateModalBody" name=""
></span> id="dynamicJobRole"
<span style="display: none"
name="" data-toggle="oh-modal-toggle"
id="dynamicWorkType" data-target="#dynamicCreateModal"
style="display: none" hx-get="{% url 'job-role-create' %}?dynamic=true"
data-toggle="oh-modal-toggle" hx-target="#dynamicCreateModalBody"
data-target="#dynamicCreateModal" ></span>
hx-get="{% url 'work-type-create' %}?dynamic=true" <span
hx-target="#dynamicCreateModalBody" name=""
></span> id="dynamicWorkType"
<span style="display: none"
name="" data-toggle="oh-modal-toggle"
id="dynamicEmployeeType" data-target="#dynamicCreateModal"
style="display: none" hx-get="{% url 'work-type-create' %}?dynamic=true"
data-toggle="oh-modal-toggle" hx-target="#dynamicCreateModalBody"
data-target="#dynamicCreateModal" ></span>
hx-get="{% url 'employee-type-create' %}?dynamic=true" <span
hx-target="#dynamicCreateModalBody" name=""
></span> id="dynamicEmployeeType"
<span style="display: none"
name="" data-toggle="oh-modal-toggle"
id="dynamicShift" data-target="#dynamicCreateModal"
style="display: none" hx-get="{% url 'employee-type-create' %}?dynamic=true"
data-toggle="oh-modal-toggle" hx-target="#dynamicCreateModalBody"
data-target="#dynamicCreateModal" ></span>
hx-get="{% url 'employee-shift-create' %}?dynamic=true" <span
hx-target="#dynamicCreateModalBody" name=""
></span> id="dynamicShift"
<div class="oh-profile-section__card" data-select2-id="select2-data-29-vht3"> style="display: none"
<div id="workMessage"></div> data-toggle="oh-modal-toggle"
<form method="post" action=""> data-target="#dynamicCreateModal"
{{history_form.as_history_modal}} {% csrf_token %} hx-get="{% url 'employee-shift-create' %}?dynamic=true"
<div class="row" data-select2-id="select2-data-27-19z8"> hx-target="#dynamicCreateModalBody"
<div class="col-12 col-sm-12 col-md-12 col-lg-6"> ></span>
<div class="oh-input-group"> <div class="oh-profile-section__card" data-select2-id="select2-data-29-vht3">
<label class="oh-label" for="{{work_form.department_id.id_for_label}}">{% trans "Department" %}</label> <div id="workMessage"></div>
{{work_form.department_id}} <form method="post" action="">
</div> {{history_form.as_history_modal}} {% csrf_token %}
</div> <div class="row" data-select2-id="select2-data-27-19z8">
<div <div class="col-12 col-sm-12 col-md-12 col-lg-6">
class="col-12 col-sm-12 col-md-12 col-lg-6"
data-select2-id="select2-data-26-o2rs"
>
<div class="oh-input-group" data-select2-id="select2-data-25-5380">
<label class="oh-label" for="{{work_form.job_position_id.id_for_label}}">{% trans "Job Position" %}</label>
{{work_form.job_position_id}}
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group"> <div class="oh-input-group">
<label class="oh-label" for="{{work_form.job_role_id.id_for_label}}">{% trans "Job Role" %}</label> <label class="oh-label" for="{{work_form.department_id.id_for_label}}">{% trans "Department" %}</label>
{{work_form.job_role_id}} {{work_form.department_id}}
</div>
</div>
<div
class="col-12 col-sm-12 col-md-12 col-lg-6"
data-select2-id="select2-data-26-o2rs"
>
<div class="oh-input-group" data-select2-id="select2-data-25-5380">
<label class="oh-label" for="{{work_form.job_position_id.id_for_label}}">{% trans "Job Position" %}</label>
{{work_form.job_position_id}}
</div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6"> <div class="row">
<div class="oh-input-group"> <div class="col-12 col-sm-12 col-md-12 col-lg-6">
<label class="oh-label" for="{{work_form.shift_id.id_for_label}}">{% trans "Shift Information" %}</label> <div class="oh-input-group">
{{work_form.shift_id}} <label class="oh-label" for="{{work_form.job_role_id.id_for_label}}">{% trans "Job Role" %}</label>
{{work_form.job_role_id}}
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{work_form.shift_id.id_for_label}}">{% trans "Shift Information" %}</label>
{{work_form.shift_id}}
</div>
</div> </div>
</div> </div>
</div> <div class="row" data-select2-id="select2-data-27-95a0">
<div class="row" data-select2-id="select2-data-27-95a0"> <div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="col-12 col-sm-12 col-md-12 col-lg-6"> <div class="oh-input-group">
<div class="oh-input-group"> <label class="oh-label" for="{{work_form.work_type_id.id_for_label}}">{% trans "Work Type" %}</label>
<label class="oh-label" for="{{work_form.work_type_id.id_for_label}}">{% trans "Work Type" %}</label> {{work_form.work_type_id}}
{{work_form.work_type_id}} </div>
</div>
<div
class="col-12 col-sm-12 col-md-12 col-lg-6"
data-select2-id="select2-data-26-u84a"
>
<div class="oh-input-group" data-select2-id="select2-data-25-5l0x">
<label class="oh-label" for="{{work_form.employee_type_id.id_for_label}}">{% trans "Employee Type" %}</label>
{{work_form.employee_type_id}}
</div>
</div> </div>
</div> </div>
<div <div class="row" data-select2-id="select2-data-39-3q9c">
class="col-12 col-sm-12 col-md-12 col-lg-6" <div
data-select2-id="select2-data-26-u84a" class="col-12 col-sm-12 col-md-12 col-lg-6"
> data-select2-id="select2-data-38-ofph"
<div class="oh-input-group" data-select2-id="select2-data-25-5l0x"> >
<label class="oh-label" for="{{work_form.employee_type_id.id_for_label}}">{% trans "Employee Type" %}</label> <div class="oh-input-group" data-select2-id="select2-data-37-p4f9">
{{work_form.employee_type_id}} <label class="oh-label" for="{{work_form.reporting_manager_id.id_for_label}}">{% trans "Reporting Manager" %}</label>
{{work_form.reporting_manager_id}}
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{work_form.company_id.id_for_label}}">{% trans "Company" %}</label>
{{work_form.company_id}}
</div>
</div> </div>
</div> </div>
</div> <div class="row">
<div class="row" data-select2-id="select2-data-39-3q9c"> <div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div <div class="oh-input-group">
class="col-12 col-sm-12 col-md-12 col-lg-6" <label class="oh-label" for="{{work_form.location.id_for_label}}">{% trans "Work Location" %}</label>
data-select2-id="select2-data-38-ofph" {{work_form.location}}
> </div>
<div class="oh-input-group" data-select2-id="select2-data-37-p4f9"> </div>
<label class="oh-label" for="{{work_form.reporting_manager_id.id_for_label}}">{% trans "Reporting Manager" %}</label> <div class="col-12 col-sm-12 col-md-12 col-lg-6">
{{work_form.reporting_manager_id}} <div class="oh-input-group">
<label class="oh-label" for="{{work_form.email.id_for_label}}" for="workEmail"
>{% trans "Work Email" %}</label
>
{{work_form.email}}
</div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6"> <div class="row">
<div class="oh-input-group"> <div class="col-12 col-sm-12 col-md-12 col-lg-6">
<label class="oh-label" for="{{work_form.company_id.id_for_label}}">{% trans "Company" %}</label> <div class="oh-input-group">
{{work_form.company_id}} <label class="oh-label" for="{{work_form.date_joining.id_for_label}}" for="startDate"
>{% trans "Joining Date" %}</label
>
{{work_form.date_joining}}
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{work_form.contract_end_date.id_for_label}}" for="endDate"
>{% trans "Contract End Date" %}</label
>
{{work_form.contract_end_date}}
</div>
</div> </div>
</div> </div>
</div> <div class="row">
<div class="row"> <div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="col-12 col-sm-12 col-md-12 col-lg-6"> <div class="oh-input-group">
<div class="oh-input-group"> <label class="oh-label" for="{{work_form.basic_salary.id_for_label}}">{% trans "Basic Salary" %}</label>
<label class="oh-label" for="{{work_form.location.id_for_label}}">{% trans "Work Location" %}</label> {{work_form.basic_salary}}
{{work_form.location}} </div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{work_form.salary_hour.id_for_label}}" for="workEmail"
>{% trans "Salary Per Hour" %}</label
>
{{work_form.salary_hour}}
</div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{work_form.email.id_for_label}}" for="workEmail"
>{% trans "Work Email" %}</label
>
{{work_form.email}}
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{work_form.date_joining.id_for_label}}" for="startDate"
>{% trans "Joining Date" %}</label
>
{{work_form.date_joining}}
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{work_form.contract_end_date.id_for_label}}" for="endDate"
>{% trans "Contract End Date" %}</label
>
{{work_form.contract_end_date}}
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{work_form.basic_salary.id_for_label}}">{% trans "Basic Salary" %}</label>
{{work_form.basic_salary}}
</div>
</div>
<div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for="{{work_form.salary_hour.id_for_label}}" for="workEmail"
>{% trans "Salary Per Hour" %}</label
>
{{work_form.salary_hour}}
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-6"> <div class="col-12 col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group"> <div class="oh-input-group">
<label class="oh-label" for="{{work_form.tags.id_for_label}}">{% trans "Employee tag" %}</label> <label class="oh-label" for="{{work_form.tags.id_for_label}}">{% trans "Employee tag" %}</label>
{{work_form.tags}} {{work_form.tags}}
</div>
</div> </div>
</div> </div>
</div>
<hr class="mt-5 mb-3" /> <hr class="mt-5 mb-3" />
<div class="w-100 d-flex align-items-center justify-content-end"> <div class="w-100 d-flex align-items-center justify-content-end">
<button <button
type="submit" type="submit"
class="oh-btn oh-btn--secondary oh-btn--w-100-resp" class="oh-btn oh-btn--secondary oh-btn--w-100-resp"
> >
{% trans "Save Changes" %} {% trans "Save" %}
</button> </button>
</div> </div>
</form> </form>
</div>
</div> </div>
</div> </div>
<script> <script>
function onDynamicCreate(value, id) { function onDynamicCreate(value, id) {
if (value == "create") { if (value == "create") {
$(id).click(); $(id).click();
} }
}
function onDynamicCreateDep(value, id) {
if (value == "create") {
$(id).click();
}
else { else {
var departmentId = value; // Get the selected department ID var departmentId = value; // Get the selected department ID
console.log('---------------------------')
console.log(departmentId)
// Make AJAX request to fetch available job positions for the selected department // Make AJAX request to fetch available job positions for the selected department
$.ajax({ $.ajax({
@@ -239,6 +248,7 @@
text: value text: value
})); }));
}); });
$('#id_job_position_id').change();
} }
}); });
} }

View File

@@ -58,6 +58,7 @@
text: value text: value
})); }));
}); });
$('#id_job_position_id').change();
} }
}); });

View File

@@ -27,7 +27,7 @@
{% trans "Allowances" %} {% trans "Allowances" %}
</div> </div>
</div> </div>
{% if perms.payroll.add_allowance %} {% if perms.payroll.add_allowance and active_contracts %}
<button title="Add Bonus" class="oh-btn oh-btn--secondary-outline oh-stop-prop oh-accordion-meta__btn p-2" title="Add" hx-get="{% url "add-bonus" %}?employee_id={{employee.id}}" hx-target="#addBonusModalBody" data-target="#addBonusModal" data-toggle="oh-modal-toggle"> <button title="Add Bonus" class="oh-btn oh-btn--secondary-outline oh-stop-prop oh-accordion-meta__btn p-2" title="Add" hx-get="{% url "add-bonus" %}?employee_id={{employee.id}}" hx-target="#addBonusModalBody" data-target="#addBonusModal" data-toggle="oh-modal-toggle">
<ion-icon class="md hydrated" name="add-outline" role="img" aria-label="add outline"></ion-icon> <ion-icon class="md hydrated" name="add-outline" role="img" aria-label="add outline"></ion-icon>
</button> </button>

View File

@@ -1,7 +1,7 @@
{% load static %} {% load i18n %} {% load static %} {% load i18n %}
{% load audit_filters %} {% load audit_filters %}
<div class="row"> <div class="row">
{% if history %} {% if employee.employee_work_info.tracking %}
{% for history in employee.employee_work_info.tracking %} {% for history in employee.employee_work_info.tracking %}
<div class="oh-history__container"> <div class="oh-history__container">
<div class="oh-history_date oh-card__title oh-card__title--sm fw-bold me-2"> <div class="oh-history_date oh-card__title oh-card__title--sm fw-bold me-2">

View File

@@ -1090,7 +1090,8 @@ def employee_view(request):
update_fields = BulkUpdateFieldForm() update_fields = BulkUpdateFieldForm()
data_dict = parse_qs(previous_data) data_dict = parse_qs(previous_data)
get_key_instances(Employee, data_dict) get_key_instances(Employee, data_dict)
emp = Employee.objects.all() emp = Employee.objects.filter()
return render( return render(
request, request,
"employee_personal_info/employee_view.html", "employee_personal_info/employee_view.html",