[UPDT] ATTENDANCE: Updation in attendance account js file for select instances

This commit is contained in:
Horilla
2024-02-21 16:38:10 +05:30
parent 8718ad7204
commit b683ca1e4a
5 changed files with 41 additions and 20 deletions

View File

@@ -68,7 +68,7 @@ class ModelForm(forms.ModelForm):
widget = field.widget
if isinstance(widget, (forms.DateInput)):
field.initial = datetime.date.today()
if isinstance(
widget, (forms.NumberInput, forms.EmailInput, forms.TextInput)
):
@@ -116,18 +116,19 @@ class ModelForm(forms.ModelForm):
attrs={"type": "time", "class": "oh-input w-100"}
)
try:
self.fields["employee_id"].initial = request.user.employee_get
try:
self.fields["employee_id"].initial = request.user.employee_get
except:
pass
try:
self.fields["company_id"].initial = request.user.employee_get.get_company
try:
self.fields["company_id"].initial = (
request.user.employee_get.get_company
)
except:
pass
class AttendanceUpdateForm(ModelForm):
"""
This model form is used to direct save the validated query dict to attendance model
@@ -670,6 +671,8 @@ class NewRequestForm(AttendanceRequestForm):
excluded_fields = [
"id",
"attendance_id__employee_id",
"in_datetime",
"out_datetime",
"requested_data",
"at_work_second",
"approved_overtime_second",

View File

@@ -149,12 +149,14 @@ function tickCheckboxes() {
languageCode = code;
var message = rowMessages[languageCode];
if (selectedCount > 0) {
$("#unselectAllInstances").css("display", "inline-flex");
$("#exportAccounts").css("display", "inline-flex");
$("#selectedShow").css("display", "inline-flex");
$("#selectedShow").text(selectedCount + " -" + message);
} else {
$("#selectedShow").css("display", "none");
$("#unselectAllInstances").css("display", "none");
$("#exportAccounts").css("display", "none");
$("#selectedShow").css("display", "none");
}
});
}
@@ -176,12 +178,14 @@ function tickactivityCheckboxes() {
languageCode = code;
var message = rowMessages[languageCode];
if (selectedCount > 0) {
$("#unselectAllActivity").css("display", "inline-flex");
$("#exportActivity").css("display", "inline-flex");
$("#selectedShowActivity").css("display", "inline-flex");
$("#selectedShowActivity").text(selectedCount + " -" + message);
} else {
$("#selectedShowActivity").css("display", "none");
$("#unselectAllActivity").css("display", "none");
$("#exportActivity").css("display", "none");
$("#selectedShowActivity").css("display", "none");
}
});
}
@@ -214,8 +218,9 @@ function ticklatecomeCheckboxes() {
}
function selectAllHourAcconts() {
$("#selectedShow").show();
$("#unselectAllInstances").show();
$("#exportAccounts").show();
$("#selectedShow").show();
$("#selectedInstances").attr("data-clicked", 1);
$("#selectedShow").removeAttr("style");
@@ -316,9 +321,11 @@ function addingHourAccountsIds() {
$("#selectedInstances").attr("data-ids", JSON.stringify(ids));
if (selectedCount === 0) {
$("#selectedShow").css("display", "none");
$("#unselectAllInstances").css("display", "none");
$("#exportAccounts").css("display", "none");
$("#selectedShow").css("display", "none");
} else {
$("#unselectAllInstances").css("display", "inline-flex");
$("#exportAccounts").css("display", "inline-flex");
$("#selectedShow").css("display", "inline-flex");
$("#selectedShow").text(selectedCount + " - " + message);
@@ -355,6 +362,8 @@ function unselectAllHourAcconts() {
$("#selectedInstances").attr("data-ids", JSON.stringify([]));
count = [];
$("#unselectAllInstances").hide();
$("#exportAccounts").hide();
tickCheckboxes(count);
},
error: function (xhr, status, error) {
@@ -422,9 +431,11 @@ function addingActivityIds() {
$("#selectedActivity").attr("data-ids", JSON.stringify(ids));
if (selectedCount === 0) {
$("#selectedShowActivity").css("display", "none");
$("#unselectAllActivity").css("display", "none");
$("#exportActivity").css("display", "none");
$("#selectedShowActivity").css("display", "none");
} else {
$("#unselectAllActivity").css("display", "inline-flex");
$("#exportActivity").css("display", "inline-flex");
$("#selectedShowActivity").css("display", "inline-flex");
$("#selectedShowActivity").text(selectedCount + " - " + message);

View File

@@ -10,10 +10,10 @@
<div class="oh-checkpoint-badge text-success mb-2" id="selectAllInstances" style="cursor: pointer;">
{% trans "Select All Records" %}
</div>
<div class="oh-checkpoint-badge text-secondary mb-2" id="unselectAllInstances" style="cursor: pointer;">
<div class="oh-checkpoint-badge text-secondary mb-2" id="unselectAllInstances" style="cursor: pointer;display:none;">
{% trans "Unselect All Records" %}
</div>
<div class="oh-checkpoint-badge text-info mb-2" id="exportAccounts" style="cursor: pointer;">
<div class="oh-checkpoint-badge text-info mb-2" id="exportAccounts" style="cursor: pointer;display:none;">
{% trans "Export Records" %}
</div>
<div class="oh-checkpoint-badge text-danger mb-2" id="selectedShow" >

View File

@@ -222,19 +222,23 @@ aria-hidden="true"
<script>
$(document).ready(function () {
$("#selectAllInstances").show();
$("#unselectAllInstances").show();
$(".all-hour-account-row").change(function () {
if ($('.all-hour-account').is(":checked")) {
$(".all-hour-account").prop("checked", false);
}
addingHourAccountsIds();
$("#selectedShow").show();
$("#unselectAllInstances").show();
$("#exportAccounts").show();
$("#selectedShow").show();
});
$(".all-hour-account").change(function () {
addingHourAccountsIds();
$("#selectedShow").show();
$("#unselectAllInstances").show();
$("#exportAccounts").show();
$("#selectedShow").show();
});
$("#selectAllInstances").click(function () {

View File

@@ -184,19 +184,22 @@
$(document).ready(function () {
$("#selectAllInstances").show();
$("#unselectAllInstances").show();
$(".all-hour-account-row").change(function () {
if ($('.all-hour-account').is(":checked")) {
$(".all-hour-account").prop("checked", false);
}
addingHourAccountsIds();
$("#selectedShow").show();
$("#unselectAllInstances").show();
$("#exportAccounts").show();
$("#selectedShow").show();
});
$(".all-hour-account").change(function () {
addingHourAccountsIds();
$("#selectedShow").show();
$("#unselectAllInstances").show();
$("#exportAccounts").show();
$("#selectedShow").show();
});
$("#selectAllInstances").click(function () {