[UPDT] LEAVE: Add data-action=delete for delete option in dropdown action button
This commit is contained in:
@@ -38,11 +38,11 @@ var rejectLeaveRequests = {
|
||||
fr: "Vous souhaitez rejeter les demandes de congés sélectionnées ?",
|
||||
};
|
||||
|
||||
var noRowMessages = {
|
||||
var noRowLeaveMessages = {
|
||||
ar: "لم يتم تحديد أي صفوف.",
|
||||
de: "Es wurden keine Zeilen ausgewählt.",
|
||||
es: "No se han seleccionado filas.",
|
||||
en: "No rows have been selected.",
|
||||
en: "No rows have been selected to delete",
|
||||
fr: "Aucune ligne n'a été sélectionnée.",
|
||||
};
|
||||
|
||||
@@ -304,7 +304,7 @@ $("#leaveRequestsBulkApprove").click(function (e) {
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var confirmMessage = approveLeaveRequests[languageCode];
|
||||
var textMessage = noRowMessages[languageCode];
|
||||
var textMessage = noRowLeaveMessages[languageCode];
|
||||
ids = JSON.parse($("#selectedLeaverequests").attr("data-ids"));
|
||||
if (ids.length === 0) {
|
||||
Swal.fire({
|
||||
@@ -338,7 +338,7 @@ $("#idBulkRejectReason").click(function (e) {
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var confirmMessage = rejectLeaveRequests[languageCode];
|
||||
var textMessage = noRowMessages[languageCode];
|
||||
var textMessage = noRowLeaveMessages[languageCode];
|
||||
ids = JSON.parse($("#selectedLeaverequests").attr("data-ids"));
|
||||
var rejectReason = $("#id_reject_reason").val();
|
||||
if (ids.length === 0) {
|
||||
@@ -366,13 +366,13 @@ $("#idBulkRejectReason").click(function (e) {
|
||||
});
|
||||
});
|
||||
|
||||
$("#leaverequestbulkDelete").click(function (e) {
|
||||
$("#leaveRequestBulkDelete").click(function (e) {
|
||||
e.preventDefault();
|
||||
var languageCode = null;
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var confirmMessage = deleteLeaveRequestMessages[languageCode];
|
||||
var textMessage = noRowMessages[languageCode];
|
||||
var textMessage = noRowLeaveMessages[languageCode];
|
||||
ids = [];
|
||||
ids.push($("#selectedLeaverequests").attr("data-ids"));
|
||||
ids = JSON.parse($("#selectedLeaverequests").attr("data-ids"));
|
||||
@@ -576,7 +576,7 @@ $("#userrequestbulkDelete").click(function (e) {
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var confirmMessage = deleteLeaveRequestMessages[languageCode];
|
||||
var textMessage = noRowMessages[languageCode];
|
||||
var textMessage = noRowLeaveMessages[languageCode];
|
||||
ids = [];
|
||||
ids.push($("#selectedUserrequests").attr("data-ids"));
|
||||
ids = JSON.parse($("#selectedUserrequests").attr("data-ids"));
|
||||
|
||||
@@ -1,267 +1,273 @@
|
||||
var rowMessages = {
|
||||
ar: " تم الاختيار",
|
||||
de: " Ausgewählt",
|
||||
es: " Seleccionado",
|
||||
en: " Selected",
|
||||
fr: " Sélectionné",
|
||||
ar: " تم الاختيار",
|
||||
de: " Ausgewählt",
|
||||
es: " Seleccionado",
|
||||
en: " Selected",
|
||||
fr: " Sélectionné",
|
||||
};
|
||||
|
||||
var deleteDaysMessages = {
|
||||
ar: "هل تريد حقًا حذف جميع العطل المحددة؟",
|
||||
de: "Möchten Sie wirklich alle ausgewählten Feiertage löschen?",
|
||||
es: "¿Realmente quieres eliminar todas las vacaciones seleccionadas?",
|
||||
en: "Do you really want to delete all the selected restrict days?",
|
||||
fr: "Voulez-vous vraiment supprimer toutes les vacances sélectionnées?",
|
||||
ar: "هل تريد حقًا حذف جميع العطل المحددة؟",
|
||||
de: "Möchten Sie wirklich alle ausgewählten Feiertage löschen?",
|
||||
es: "¿Realmente quieres eliminar todas las vacaciones seleccionadas?",
|
||||
en: "Do you really want to delete all the selected restrict days?",
|
||||
fr: "Voulez-vous vraiment supprimer toutes les vacances sélectionnées?",
|
||||
};
|
||||
|
||||
var noRowsDeleteMessages = {
|
||||
ar: "لم تتم تحديد صفوف لحذف العطلات.",
|
||||
de: "Es wurden keine Zeilen zum Löschen von Feiertagen ausgewählt.",
|
||||
es: "No se han seleccionado filas para eliminar las vacaciones.",
|
||||
en: "No rows are selected for deleting restrict days.",
|
||||
fr: "Aucune ligne n'a été sélectionnée pour supprimer les vacances.",
|
||||
ar: "لم تتم تحديد صفوف لحذف العطلات.",
|
||||
de: "Es wurden keine Zeilen zum Löschen von Feiertagen ausgewählt.",
|
||||
es: "No se han seleccionado filas para eliminar las vacaciones.",
|
||||
en: "No rows are selected for deleting restrict days.",
|
||||
fr: "Aucune ligne n'a été sélectionnée pour supprimer les vacances.",
|
||||
};
|
||||
|
||||
function getCurrentLanguageCode(callback) {
|
||||
var languageCode = $("#main-section-data").attr("data-lang");
|
||||
var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"];
|
||||
if (allowedLanguageCodes.includes(languageCode)) {
|
||||
callback(languageCode);
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/employee/get-language-code/",
|
||||
success: function (response) {
|
||||
var ajaxLanguageCode = response.language_code;
|
||||
$("#main-section-data").attr("data-lang", ajaxLanguageCode);
|
||||
callback(
|
||||
allowedLanguageCodes.includes(ajaxLanguageCode)
|
||||
? ajaxLanguageCode
|
||||
: "en"
|
||||
);
|
||||
},
|
||||
error: function () {
|
||||
callback("en");
|
||||
},
|
||||
});
|
||||
}
|
||||
var languageCode = $("#main-section-data").attr("data-lang");
|
||||
var allowedLanguageCodes = ["ar", "de", "es", "en", "fr"];
|
||||
if (allowedLanguageCodes.includes(languageCode)) {
|
||||
callback(languageCode);
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/employee/get-language-code/",
|
||||
success: function (response) {
|
||||
var ajaxLanguageCode = response.language_code;
|
||||
$("#main-section-data").attr("data-lang", ajaxLanguageCode);
|
||||
callback(
|
||||
allowedLanguageCodes.includes(ajaxLanguageCode)
|
||||
? ajaxLanguageCode
|
||||
: "en"
|
||||
);
|
||||
},
|
||||
error: function () {
|
||||
callback("en");
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function makeDaysListUnique(list) {
|
||||
return Array.from(new Set(list));
|
||||
return Array.from(new Set(list));
|
||||
}
|
||||
|
||||
function tickRestrictDaysCheckboxes() {
|
||||
var ids = JSON.parse($("#selectedRestrictDays").attr("data-ids") || "[]");
|
||||
uniqueIds = makeDaysListUnique(ids);
|
||||
toggleHighlight(uniqueIds);
|
||||
click = $("#selectedRestrictDays").attr("data-clicked");
|
||||
if (click === "1") {
|
||||
$(".all-restrict-days").prop("checked", true);
|
||||
}
|
||||
uniqueIds.forEach(function (id) {
|
||||
$("#" + id).prop("checked", true);
|
||||
});
|
||||
var selectedCount = uniqueIds.length;
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var message = rowMessages[languageCode];
|
||||
if (selectedCount > 0) {
|
||||
$("#unselectAllRestrictDays").css("display", "inline-flex");
|
||||
// $("#exportRestrictDays").css("display", "inline-flex");
|
||||
$("#showSelectedDays").css("display", "inline-flex");
|
||||
$("#showSelectedDays").text(selectedCount + " -" + message);
|
||||
} else {
|
||||
$("#unselectAllRestrictDays").css("display", "none ");
|
||||
$("#showSelectedDays").css("display", "none");
|
||||
// $("#exportRestrictDays").css("display", "none");
|
||||
var ids = JSON.parse($("#selectedRestrictDays").attr("data-ids") || "[]");
|
||||
uniqueIds = makeDaysListUnique(ids);
|
||||
toggleHighlight(uniqueIds);
|
||||
click = $("#selectedRestrictDays").attr("data-clicked");
|
||||
if (click === "1") {
|
||||
$(".all-restrict-days").prop("checked", true);
|
||||
}
|
||||
});
|
||||
uniqueIds.forEach(function (id) {
|
||||
$("#" + id).prop("checked", true);
|
||||
});
|
||||
var selectedCount = uniqueIds.length;
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var message = rowMessages[languageCode];
|
||||
if (selectedCount > 0) {
|
||||
$("#unselectAllRestrictDays").css("display", "inline-flex");
|
||||
// $("#exportRestrictDays").css("display", "inline-flex");
|
||||
$("#showSelectedDays").css("display", "inline-flex");
|
||||
$("#showSelectedDays").text(selectedCount + " -" + message);
|
||||
} else {
|
||||
$("#unselectAllRestrictDays").css("display", "none ");
|
||||
$("#showSelectedDays").css("display", "none");
|
||||
// $("#exportRestrictDays").css("display", "none");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addingRestrictDayIds() {
|
||||
var ids = JSON.parse($("#selectedRestrictDays").attr("data-ids") || "[]");
|
||||
var selectedCount = 0;
|
||||
$(".all-restrict-days-row").each(function () {
|
||||
if ($(this).is(":checked")) {
|
||||
ids.push(this.id);
|
||||
} else {
|
||||
var index = ids.indexOf(this.id);
|
||||
if (index > -1) {
|
||||
ids.splice(index, 1);
|
||||
$(".all-restrict-days").prop("checked", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
ids = makeDaysListUnique(ids);
|
||||
toggleHighlight(ids);
|
||||
selectedCount = ids.length;
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var message = rowMessages[languageCode];
|
||||
$("#selectedRestrictDays").attr("data-ids", JSON.stringify(ids));
|
||||
if (selectedCount === 0) {
|
||||
$("#showSelectedDays").css("display", "none");
|
||||
// $("#exportRestrictDays").css("display", "none");
|
||||
$("#unselectAllRestrictDays").css("display", "none");
|
||||
} else {
|
||||
$("#unselectAllRestrictDays").css("display", "inline-flex");
|
||||
// $("#exportRestrictDays").css("display", "inline-flex");
|
||||
$("#showSelectedDays").css("display", "inline-flex");
|
||||
$("#showSelectedDays").text(selectedCount + " - " + message);
|
||||
}
|
||||
});
|
||||
var ids = JSON.parse($("#selectedRestrictDays").attr("data-ids") || "[]");
|
||||
var selectedCount = 0;
|
||||
$(".all-restrict-days-row").each(function () {
|
||||
if ($(this).is(":checked")) {
|
||||
ids.push(this.id);
|
||||
} else {
|
||||
var index = ids.indexOf(this.id);
|
||||
if (index > -1) {
|
||||
ids.splice(index, 1);
|
||||
$(".all-restrict-days").prop("checked", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
ids = makeDaysListUnique(ids);
|
||||
toggleHighlight(ids);
|
||||
selectedCount = ids.length;
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var message = rowMessages[languageCode];
|
||||
$("#selectedRestrictDays").attr("data-ids", JSON.stringify(ids));
|
||||
if (selectedCount === 0) {
|
||||
$("#showSelectedDays").css("display", "none");
|
||||
// $("#exportRestrictDays").css("display", "none");
|
||||
$("#unselectAllRestrictDays").css("display", "none");
|
||||
} else {
|
||||
$("#unselectAllRestrictDays").css("display", "inline-flex");
|
||||
// $("#exportRestrictDays").css("display", "inline-flex");
|
||||
$("#showSelectedDays").css("display", "inline-flex");
|
||||
$("#showSelectedDays").text(selectedCount + " - " + message);
|
||||
}
|
||||
});
|
||||
}
|
||||
function updateParentCheckbox() {
|
||||
var parentTable = $(this).closest(".oh-sticky-table");
|
||||
var body = parentTable.find(".oh-sticky-table__tbody");
|
||||
var parentCheckbox = parentTable.find(".all-restrict-days");
|
||||
parentCheckbox.prop(
|
||||
"checked",
|
||||
body.find(".all-restrict-days-row:checked").length ===
|
||||
body.find(".all-restrict-days-row").length
|
||||
);
|
||||
addingRestrictDayIds();
|
||||
var parentTable = $(this).closest(".oh-sticky-table");
|
||||
var body = parentTable.find(".oh-sticky-table__tbody");
|
||||
var parentCheckbox = parentTable.find(".all-restrict-days");
|
||||
parentCheckbox.prop(
|
||||
"checked",
|
||||
body.find(".all-restrict-days-row:checked").length ===
|
||||
body.find(".all-restrict-days-row").length
|
||||
);
|
||||
addingRestrictDayIds();
|
||||
}
|
||||
function toggleAllCheckboxes(e) {
|
||||
var is_checked = $(this).is(":checked");
|
||||
if (is_checked) {
|
||||
$(".all-restrict-days-row")
|
||||
.prop("checked", true)
|
||||
.closest(".oh-sticky-table__tr")
|
||||
.addClass("highlight-selected");
|
||||
} else {
|
||||
$(".all-restrict-days-row")
|
||||
.prop("checked", false)
|
||||
.closest(".oh-sticky-table__tr")
|
||||
.removeClass("highlight-selected");
|
||||
}
|
||||
addingRestrictDayIds();
|
||||
var is_checked = $(this).is(":checked");
|
||||
if (is_checked) {
|
||||
$(".all-restrict-days-row")
|
||||
.prop("checked", true)
|
||||
.closest(".oh-sticky-table__tr")
|
||||
.addClass("highlight-selected");
|
||||
} else {
|
||||
$(".all-restrict-days-row")
|
||||
.prop("checked", false)
|
||||
.closest(".oh-sticky-table__tr")
|
||||
.removeClass("highlight-selected");
|
||||
}
|
||||
addingRestrictDayIds();
|
||||
}
|
||||
|
||||
function selectAllRestrictDays() {
|
||||
$("#selectedRestrictDays").attr("data-clicked", 1);
|
||||
$("#showSelectedDays").removeAttr("style");
|
||||
var savedFilters = JSON.parse(localStorage.getItem("savedFilters"));
|
||||
var ajaxData =
|
||||
savedFilters && savedFilters["filterData"]
|
||||
? { page: "all", filter: JSON.stringify(savedFilters["filterData"]) }
|
||||
: { page: "all" };
|
||||
var ajaxUrl =
|
||||
savedFilters && savedFilters["filterData"]
|
||||
? "/leave/restrict-day-select-filter"
|
||||
: "/leave/restrict-day-select";
|
||||
$("#selectedRestrictDays").attr("data-clicked", 1);
|
||||
$("#showSelectedDays").removeAttr("style");
|
||||
var savedFilters = JSON.parse(localStorage.getItem("savedFilters"));
|
||||
var ajaxData =
|
||||
savedFilters && savedFilters["filterData"]
|
||||
? { page: "all", filter: JSON.stringify(savedFilters["filterData"]) }
|
||||
: { page: "all" };
|
||||
var ajaxUrl =
|
||||
savedFilters && savedFilters["filterData"]
|
||||
? "/leave/restrict-day-select-filter"
|
||||
: "/leave/restrict-day-select";
|
||||
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
data: ajaxData,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var restrictDayIds = response.restrict_day_ids;
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
data: ajaxData,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var restrictDayIds = response.restrict_day_ids;
|
||||
|
||||
if (!Array.isArray(restrictDayIds)) {
|
||||
console.error("restrictDayIds is not an array:", restrictDayIds);
|
||||
return;
|
||||
}
|
||||
if (!Array.isArray(restrictDayIds)) {
|
||||
console.error("restrictDayIds is not an array:", restrictDayIds);
|
||||
return;
|
||||
}
|
||||
|
||||
restrictDayIds.forEach(function (dayId) {
|
||||
$("#" + dayId).prop("checked", true);
|
||||
});
|
||||
restrictDayIds.forEach(function (dayId) {
|
||||
$("#" + dayId).prop("checked", true);
|
||||
});
|
||||
|
||||
var previousIds = $("#selectedRestrictDays").attr("data-ids") || "[]";
|
||||
var allIds = Array.from(
|
||||
new Set([...restrictDayIds, ...JSON.parse(previousIds)])
|
||||
);
|
||||
var previousIds = $("#selectedRestrictDays").attr("data-ids") || "[]";
|
||||
var allIds = Array.from(
|
||||
new Set([...restrictDayIds, ...JSON.parse(previousIds)])
|
||||
);
|
||||
|
||||
$("#selectedRestrictDays").attr("data-ids", JSON.stringify(allIds));
|
||||
$("#selectedRestrictDays").attr("data-ids", JSON.stringify(allIds));
|
||||
|
||||
var count = makeDaysListUnique(restrictDayIds);
|
||||
tickRestrictDaysCheckboxes(count);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error:", error);
|
||||
},
|
||||
});
|
||||
var count = makeDaysListUnique(restrictDayIds);
|
||||
tickRestrictDaysCheckboxes(count);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error:", error);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function unselectAllRestrictDays() {
|
||||
$("#selectedRestrictDays").attr("data-clicked", 0);
|
||||
$("#selectedRestrictDays").attr("data-clicked", 0);
|
||||
|
||||
var savedFilters = JSON.parse(localStorage.getItem("savedFilters"));
|
||||
var ajaxData =
|
||||
savedFilters && savedFilters["filterData"]
|
||||
? { page: "all", filter: JSON.stringify(savedFilters["filterData"]) }
|
||||
: { page: "all" };
|
||||
var ajaxUrl =
|
||||
savedFilters && savedFilters["filterData"]
|
||||
? "/leave/restrict-day-select-filter"
|
||||
: "/leave/restrict-day-select";
|
||||
var savedFilters = JSON.parse(localStorage.getItem("savedFilters"));
|
||||
var ajaxData =
|
||||
savedFilters && savedFilters["filterData"]
|
||||
? { page: "all", filter: JSON.stringify(savedFilters["filterData"]) }
|
||||
: { page: "all" };
|
||||
var ajaxUrl =
|
||||
savedFilters && savedFilters["filterData"]
|
||||
? "/leave/restrict-day-select-filter"
|
||||
: "/leave/restrict-day-select";
|
||||
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
data: ajaxData,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var restrictDayIds = response.restrict_day_ids;
|
||||
if (!Array.isArray(restrictDayIds)) {
|
||||
console.error("restrict_day_ids is not an array:", restrictDayIds);
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
data: ajaxData,
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var restrictDayIds = response.restrict_day_ids;
|
||||
if (!Array.isArray(restrictDayIds)) {
|
||||
console.error("restrict_day_ids is not an array:", restrictDayIds);
|
||||
return;
|
||||
}
|
||||
|
||||
restrictDayIds.forEach(function (dayId) {
|
||||
$("#" + dayId)
|
||||
.prop("checked", false)
|
||||
.closest(".oh-sticky-table__tr")
|
||||
.removeClass("highlight-selected");
|
||||
});
|
||||
$(".all-restrict-days").prop("checked", false);
|
||||
restrictDayIds.forEach(function (dayId) {
|
||||
$("#" + dayId)
|
||||
.prop("checked", false)
|
||||
.closest(".oh-sticky-table__tr")
|
||||
.removeClass("highlight-selected");
|
||||
});
|
||||
$(".all-restrict-days").prop("checked", false);
|
||||
|
||||
var previousIds = $("#selectedRestrictDays").attr("data-ids") || "[]";
|
||||
var remainingIds = JSON.parse(previousIds).filter(
|
||||
(id) => !restrictDayIds.includes(id)
|
||||
);
|
||||
var previousIds = $("#selectedRestrictDays").attr("data-ids") || "[]";
|
||||
var remainingIds = JSON.parse(previousIds).filter(
|
||||
(id) => !restrictDayIds.includes(id)
|
||||
);
|
||||
|
||||
$("#selectedRestrictDays").attr("data-ids", JSON.stringify(remainingIds));
|
||||
$("#selectedRestrictDays").attr("data-ids", JSON.stringify(remainingIds));
|
||||
|
||||
var count = makeDaysListUnique(remainingIds);
|
||||
tickRestrictDaysCheckboxes(count);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error:", error);
|
||||
},
|
||||
});
|
||||
var count = makeDaysListUnique(remainingIds);
|
||||
tickRestrictDaysCheckboxes(count);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error("Error:", error);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
$("#bulkRestrictedDaysDelete").click(function (e) {
|
||||
var languageCode = null;
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var confirmMessage = deleteDaysMessages[languageCode];
|
||||
var textMessage = noRowsDeleteMessages[languageCode];
|
||||
ids = JSON.parse($("#selectedRestrictDays").attr("data-ids"));
|
||||
if (ids.length === 0) {
|
||||
Swal.fire({
|
||||
text: textMessage,
|
||||
icon: "warning",
|
||||
confirmButtonText: "Close",
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
text: confirmMessage,
|
||||
icon: "question",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#008000",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Confirm",
|
||||
}).then(function (result) {
|
||||
if (result.isConfirmed) {
|
||||
var hxVals = JSON.stringify(ids);
|
||||
$("#bulkDeleteSpan").attr("hx-vals", `{"ids":${hxVals}}`);
|
||||
$("#bulkDeleteSpan").click();
|
||||
var languageCode = null;
|
||||
getCurrentLanguageCode(function (code) {
|
||||
languageCode = code;
|
||||
var confirmMessage = deleteDaysMessages[languageCode];
|
||||
var textMessage = noRowsDeleteMessages[languageCode];
|
||||
try {
|
||||
var ids = JSON.parse($("#selectedRestrictDays").attr("data-ids"));
|
||||
} catch (e) {
|
||||
|
||||
var ids = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (ids.length === 0) {
|
||||
Swal.fire({
|
||||
text: textMessage,
|
||||
icon: "warning",
|
||||
confirmButtonText: "Close",
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
text: confirmMessage,
|
||||
icon: "question",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#008000",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Confirm",
|
||||
}).then(function (result) {
|
||||
if (result.isConfirmed) {
|
||||
var hxVals = JSON.stringify(ids);
|
||||
$("#bulkDeleteSpan").attr("hx-vals", `{"ids":${hxVals}}`);
|
||||
$("#bulkDeleteSpan").click();
|
||||
$("#selectedRestrictDays").attr("data-ids", "");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -222,6 +222,7 @@
|
||||
<a
|
||||
href="#"
|
||||
id="bulkAssignedLeavesDelete"
|
||||
data-action="delete"
|
||||
class="oh-dropdown__link oh-dropdown__link--danger"
|
||||
>{% trans "Delete" %}</a
|
||||
>
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
</li>
|
||||
{% if perms.leave.delete_leaverequest or request.user|is_reportingmanager %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a href="#" id="leaverequestbulkDelete" class="oh-dropdown__link oh-dropdown__link--danger">{% trans "Delete" %}</a>
|
||||
<a href="#" id="leaveRequestBulkDelete" data-action="delete" class="oh-dropdown__link oh-dropdown__link--danger">{% trans "Delete" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
@@ -1,257 +1,192 @@
|
||||
{% load i18n %} {% load static %} {% include 'filter_tags.html' %}
|
||||
|
||||
<span
|
||||
id="bulkDeleteSpan"
|
||||
hx-post="{% url 'restrict-days-bulk-delete' %}?{{pd}}"
|
||||
hx-target="#restrictday"
|
||||
></span>
|
||||
<span id="bulkDeleteSpan" hx-post="{% url 'restrict-days-bulk-delete' %}?{{pd}}" hx-target="#restrictDays"></span>
|
||||
|
||||
{% if messages %}
|
||||
<div class="oh-wrapper">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated {{ message.tags }}">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if restrictday %}
|
||||
{% if perms.leave.add_restrictleave %}
|
||||
<div class="oh-checkpoint-badge text-success mb-2"
|
||||
id="selectAllRestrictDays" style="cursor: pointer"
|
||||
>
|
||||
{% trans "Select All Days" %}
|
||||
</div>
|
||||
<div class="oh-checkpoint-badge text-secondary mb-2"
|
||||
id="unselectAllRestrictDays" style="cursor: pointer; display: none"
|
||||
>
|
||||
{% trans "Unselect All Days" %}
|
||||
</div>
|
||||
{% comment %} <div class="oh-checkpoint-badge text-info mb-2"
|
||||
id="exportRestrictDays" style="cursor: pointer; display: none"
|
||||
>
|
||||
{% trans "Export Days" %}
|
||||
</div> {% endcomment %}
|
||||
<div class="oh-checkpoint-badge text-danger mb-2"
|
||||
id="showSelectedDays" style="display: none"
|
||||
></div>
|
||||
{% endif %}
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table oh-table--sortable">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th" style="width: 10px">
|
||||
<div class="centered-div">
|
||||
<input
|
||||
id="allRestricDays"
|
||||
type="checkbox"
|
||||
title="{% trans 'Select All' %}"
|
||||
class="oh-input oh-input__checkbox all-restrict-days"
|
||||
/>
|
||||
<div class="oh-wrapper">
|
||||
{% for message in messages %}
|
||||
<div class="oh-alert-container">
|
||||
<div class="oh-alert oh-alert--animated {{ message.tags }}">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="oh-sticky-table__th {% if request.sort_option.order == '-title' %}arrow-up {% elif request.sort_option.order == 'title' %}arrow-down {% else %}arrow-up-down {% endif %}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&sortby=title"
|
||||
hx-target="#restrictday"
|
||||
>
|
||||
{% trans "Title" %}
|
||||
</div>
|
||||
<div
|
||||
class="oh-sticky-table__th {% if request.sort_option.order == '-start_date' %}arrow-up {% elif request.sort_option.order == 'start_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&sortby=start_date"
|
||||
hx-target="#restrictday"
|
||||
>
|
||||
{% trans "Start Date" %}
|
||||
</div>
|
||||
<div
|
||||
class="oh-sticky-table__th {% if request.sort_option.order == '-end_date' %}arrow-up {% elif request.sort_option.order == 'end_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&sortby=end_date"
|
||||
hx-target="#restrictday"
|
||||
>
|
||||
{% trans "End Date" %}
|
||||
</div>
|
||||
<div
|
||||
class="oh-sticky-table__th {% if request.sort_option.order == '-department' %}arrow-up {% elif request.sort_option.order == 'department' %}arrow-down {% else %}arrow-up-down {% endif %}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&sortby=department"
|
||||
hx-target="#restrictday"
|
||||
>
|
||||
{% trans "Department" %}
|
||||
</div>
|
||||
<div
|
||||
class="oh-sticky-table__th"
|
||||
hx-target="#restrictday"
|
||||
>
|
||||
{% trans "Job Position" %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Description" %}</div>
|
||||
{% if perms.leave.change_restrictleave or perms.leave.delete_restrictleave %}
|
||||
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for day in restrictday %}
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__sd">
|
||||
<div class="centered-div">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="{{day.id}}"
|
||||
onchange="highlightRow($(this))"
|
||||
class="oh-input oh-input__checkbox all-restrict-days-row"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td sticky">{{day.title}}</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{day.start_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{day.end_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{{day.department}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{% if day.job_position.all %}
|
||||
{% for i in day.job_position.all %}
|
||||
<span class="d-flex">{{forloop.counter}}. {{i}}</span>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
All
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{{day.description}}
|
||||
</div>
|
||||
{% if perms.leave.change_restrictleave or perms.leave.delete_restrictleave %}
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-btn-group">
|
||||
{% if perms.leave.change_restrictleave %}
|
||||
<button
|
||||
class="oh-btn oh-btn--light-bkg w-100"
|
||||
title="{% trans 'Edit' %}"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectUpdateModal"
|
||||
hx-get="{% url 'restrict-update' day.id %}?{{pd}}"
|
||||
hx-target="#objectUpdateModalTarget"
|
||||
>
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %} {% if perms.leave.delete_restrictleave %}
|
||||
<a
|
||||
class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100"
|
||||
id="delete-link"
|
||||
hx-confirm="{% trans 'Are you sure you want to delete?' %}"
|
||||
hx-post="{% url 'restrict-delete' day.id %}?{{pd}}"
|
||||
hx-target="#restrictday"
|
||||
title="{% trans 'Delete' %}"
|
||||
>
|
||||
<ion-icon name="trash-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oh-pagination" data-pd="{{pd}}">
|
||||
<span class="oh-pagination__page">
|
||||
{% trans "Page" %} {{ restrictday.number }} {% trans "of" %} {{ restrictday.paginator.num_pages }}.
|
||||
</span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
|
||||
<input
|
||||
type="number"
|
||||
name="page"
|
||||
class="oh-pagination__input"
|
||||
value="{{restrictday.number}}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}"
|
||||
hx-target="#restrictday"
|
||||
min="1"
|
||||
/>
|
||||
<span class="oh-pagination__label"
|
||||
>{% trans "of" %} {{restrictday.paginator.num_pages}}</span
|
||||
>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if restrictday.has_previous %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-target="#restrictday"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&page=1"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "First" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-target="#restrictday"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&page={{ restrictday.previous_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Previous" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %} {% if restrictday.has_next %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-target="#restrictday"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&page={{ restrictday.next_page_number }}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Next" %}</a
|
||||
>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a
|
||||
hx-target="#restrictday"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&page={{ restrictday.paginator.num_pages }}"
|
||||
class="oh-pagination__link"
|
||||
>{% trans "Last" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
tickRestrictDaysCheckboxes();
|
||||
$("#selectAllRestrictDays").click(selectAllRestrictDays);
|
||||
$(".all-restrict-days-row").change(updateParentCheckbox);
|
||||
$(".all-restrict-days").change(toggleAllCheckboxes);
|
||||
$("#unselectAllRestrictDays").click(unselectAllRestrictDays);
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<!--start of empty page -->
|
||||
<div
|
||||
style="
|
||||
height: 70vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
"
|
||||
class=""
|
||||
>
|
||||
<div style="" class="oh-404">
|
||||
<img
|
||||
style="display: block; width: 150px; height: 150px; margin: 10px auto"
|
||||
src="{% static 'images/ui/restrict.png' %}"
|
||||
class="mb-4"
|
||||
alt=""
|
||||
/>
|
||||
<h3 style="font-size: 20px" class="oh-404__subtitle">
|
||||
{% trans "No restricted date available." %}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of empty page -->
|
||||
{% endif %}
|
||||
|
||||
{% if restrictday %}
|
||||
{% if perms.leave.add_restrictleave %}
|
||||
<div class="oh-checkpoint-badge text-success mb-2" id="selectAllRestrictDays" style="cursor: pointer">
|
||||
{% trans "Select All Days" %}
|
||||
</div>
|
||||
<div class="oh-checkpoint-badge text-secondary mb-2" id="unselectAllRestrictDays"
|
||||
style="cursor: pointer; display: none">
|
||||
{% trans "Unselect All Days" %}
|
||||
</div>
|
||||
{% comment %} <div class="oh-checkpoint-badge text-info mb-2" id="exportRestrictDays"
|
||||
style="cursor: pointer; display: none">
|
||||
{% trans "Export Days" %}
|
||||
</div> {% endcomment %}
|
||||
<div class="oh-checkpoint-badge text-danger mb-2" id="showSelectedDays" style="display: none"></div>
|
||||
{% endif %}
|
||||
|
||||
<div class="oh-sticky-table">
|
||||
<div class="oh-sticky-table__table oh-table--sortable">
|
||||
<div class="oh-sticky-table__thead">
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__th" style="width: 10px">
|
||||
<div class="centered-div">
|
||||
<input id="allRestricDays" type="checkbox" title="{% trans 'Select All' %}"
|
||||
class="oh-input oh-input__checkbox all-restrict-days" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__th {% if request.sort_option.order == '-title' %}arrow-up {% elif request.sort_option.order == 'title' %}arrow-down {% else %}arrow-up-down {% endif %}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&sortby=title" hx-target="#restrictDays">
|
||||
{% trans "Title" %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__th {% if request.sort_option.order == '-start_date' %}arrow-up {% elif request.sort_option.order == 'start_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&sortby=start_date" hx-target="#restrictDays">
|
||||
{% trans "Start Date" %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__th {% if request.sort_option.order == '-end_date' %}arrow-up {% elif request.sort_option.order == 'end_date' %}arrow-down {% else %}arrow-up-down {% endif %}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&sortby=end_date" hx-target="#restrictDays">
|
||||
{% trans "End Date" %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__th {% if request.sort_option.order == '-department' %}arrow-up {% elif request.sort_option.order == 'department' %}arrow-down {% else %}arrow-up-down {% endif %}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&sortby=department" hx-target="#restrictDays">
|
||||
{% trans "Department" %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__th" hx-target="#restrictDays">
|
||||
{% trans "Job Position" %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__th">{% trans "Description" %}</div>
|
||||
{% if perms.leave.change_restrictleave or perms.leave.delete_restrictleave %}
|
||||
<div class="oh-sticky-table__th">{% trans "Actions" %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__tbody">
|
||||
{% for day in restrictday %}
|
||||
<div class="oh-sticky-table__tr">
|
||||
<div class="oh-sticky-table__sd">
|
||||
<div class="centered-div">
|
||||
<input type="checkbox" id="{{day.id}}" onchange="highlightRow($(this))"
|
||||
class="oh-input oh-input__checkbox all-restrict-days-row" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-sticky-table__td sticky">{{day.title}}</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{day.start_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td dateformat_changer">
|
||||
{{day.end_date}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{{day.department}}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{% if day.job_position.all %}
|
||||
{% for i in day.job_position.all %}
|
||||
<span class="d-flex">{{forloop.counter}}. {{i}}</span>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% trans "All" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="oh-sticky-table__td">
|
||||
{{day.description}}
|
||||
</div>
|
||||
{% if perms.leave.change_restrictleave or perms.leave.delete_restrictleave %}
|
||||
<div class="oh-sticky-table__td">
|
||||
<div class="oh-btn-group">
|
||||
{% if perms.leave.change_restrictleave %}
|
||||
<button class="oh-btn oh-btn--light-bkg w-100" title="{% trans 'Edit' %}"
|
||||
data-toggle="oh-modal-toggle" data-target="#objectUpdateModal"
|
||||
hx-get="{% url 'restrict-update' day.id %}?{{pd}}" hx-target="#objectUpdateModalTarget">
|
||||
<ion-icon name="create-outline"></ion-icon>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if perms.leave.delete_restrictleave %}
|
||||
<a class="oh-btn oh-btn--danger-outline oh-btn--light-bkg w-100" id="delete-link"
|
||||
hx-confirm="{% trans 'Are you sure you want to delete?' %}"
|
||||
hx-post="{% url 'restrict-delete' day.id %}?{{pd}}" hx-target="#restrictDays"
|
||||
title="{% trans 'Delete' %}">
|
||||
<ion-icon name="trash-outline"></ion-icon>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oh-pagination" data-pd="{{pd}}">
|
||||
<span class="oh-pagination__page">
|
||||
{% trans "Page" %} {{ restrictday.number }} {% trans "of" %} {{ restrictday.paginator.num_pages }}.
|
||||
</span>
|
||||
<nav class="oh-pagination__nav">
|
||||
<div class="oh-pagination__input-container me-3">
|
||||
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
|
||||
<input type="number" name="page" class="oh-pagination__input" value="{{restrictday.number}}"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}" hx-target="#restrictDays" min="1" />
|
||||
<span class="oh-pagination__label">{% trans "of" %} {{restrictday.paginator.num_pages}}</span>
|
||||
</div>
|
||||
<ul class="oh-pagination__items">
|
||||
{% if restrictday.has_previous %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a hx-target="#restrictDays" hx-get="{% url 'restrict-filter' %}?{{pd}}&page=1"
|
||||
class="oh-pagination__link">{% trans "First" %}</a>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a hx-target="#restrictDays"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&page={{ restrictday.previous_page_number }}"
|
||||
class="oh-pagination__link">{% trans "Previous" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if restrictday.has_next %}
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a hx-target="#restrictDays"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&page={{ restrictday.next_page_number }}"
|
||||
class="oh-pagination__link">{% trans "Next" %}</a>
|
||||
</li>
|
||||
<li class="oh-pagination__item oh-pagination__item--wide">
|
||||
<a hx-target="#restrictDays"
|
||||
hx-get="{% url 'restrict-filter' %}?{{pd}}&page={{ restrictday.paginator.num_pages }}"
|
||||
class="oh-pagination__link">{% trans "Last" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
tickRestrictDaysCheckboxes();
|
||||
$("#selectAllRestrictDays").click(selectAllRestrictDays);
|
||||
$(".all-restrict-days-row").change(updateParentCheckbox);
|
||||
$(".all-restrict-days").change(toggleAllCheckboxes);
|
||||
$("#unselectAllRestrictDays").click(unselectAllRestrictDays);
|
||||
});
|
||||
</script>
|
||||
|
||||
{% else %}
|
||||
<!--start of empty page -->
|
||||
<div style="
|
||||
height: 70vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
" class="">
|
||||
<div style="" class="oh-404">
|
||||
<img style="display: block; width: 150px; height: 150px; margin: 10px auto"
|
||||
src="{% static 'images/ui/restrict.png' %}" class="mb-4" alt="" />
|
||||
<h3 style="font-size: 20px" class="oh-404__subtitle">
|
||||
{% trans "No restricted date available." %}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of empty page -->
|
||||
{% endif %}
|
||||
|
||||
@@ -1,64 +1,54 @@
|
||||
{% load i18n %}
|
||||
<form hx-get="{% url 'restrict-filter' %}" hx-target="#restrictday" id="filterForm" onsubmit="event.preventDefault()">
|
||||
<div
|
||||
class="oh-dropdown__menu oh-dropdown__menu--right oh-dropdown__filter p-4"
|
||||
x-show="open"
|
||||
@click.outside="open = false"
|
||||
style="display: none"
|
||||
>
|
||||
<div class="oh-dropdown__filter-body">
|
||||
<div class="oh-accordion">
|
||||
<div class="oh-accordion-header">{% trans "Restrict Leaves" %}</div>
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{ form.from_date.id_for_label }}">{% trans "From Date" %}</label>
|
||||
{{form.from_date}}
|
||||
</div>
|
||||
<form hx-get="{% url 'restrict-filter' %}" hx-target="#restrictDays" id="filterForm" onsubmit="event.preventDefault()">
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right oh-dropdown__filter p-4" x-show="open"
|
||||
@click.outside="open = false" style="display: none">
|
||||
<div class="oh-dropdown__filter-body">
|
||||
<div class="oh-accordion">
|
||||
<div class="oh-accordion-header">{% trans "Restrict Leaves" %}</div>
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{ form.from_date.id_for_label }}">{% trans "From Date" %}</label>
|
||||
{{form.from_date}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{ form.to_date.id_for_label }}">{% trans "To Date" %}</label>
|
||||
{{form.to_date}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{ form.to_date.id_for_label }}">{% trans "To Date" %}</label>
|
||||
{{form.to_date}}
|
||||
</div>
|
||||
<div class="oh-accordion">
|
||||
<div class="oh-accordion-header"
|
||||
onclick="event.stopImmediatePropagation();$(this).parent().toggleClass('oh-accordion--show');">
|
||||
{% trans "Work Information" %}
|
||||
</div>
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{ form.department.id_for_label }}">{% trans "Department" %}</label>
|
||||
{{form.department}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{ form.job_position.id_for_label }}">{% trans "Job Position" %}</label>
|
||||
{{form.job_position}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh-accordion">
|
||||
<div
|
||||
class="oh-accordion-header"
|
||||
onclick="event.stopImmediatePropagation();$(this).parent().toggleClass('oh-accordion--show');"
|
||||
>
|
||||
{% trans "Work Information" %}
|
||||
<div class="oh-dropdown__filter-footer">
|
||||
<button class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton" type="submit">
|
||||
{% trans "Filter" %}
|
||||
</button>
|
||||
</div>
|
||||
<div class="oh-accordion-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{ form.department.id_for_label }}">{% trans "Department" %}</label>
|
||||
{{form.department}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
<div class="oh-input-group">
|
||||
<label class="oh-label" for="{{ form.job_position.id_for_label }}">{% trans "Job Position" %}</label>
|
||||
{{form.job_position}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="oh-dropdown__filter-footer">
|
||||
<button
|
||||
class="oh-btn oh-btn--secondary oh-btn--small w-100 filterButton"
|
||||
type="submit"
|
||||
>
|
||||
{% trans "Filter" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -9,15 +9,11 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<script>
|
||||
setTimeout(() => {
|
||||
$(".oh-modal__close").click();
|
||||
}, 1000);
|
||||
</script>
|
||||
<span hx-get="{% url 'restrict-filter' %}?{{pd}}" hx-target="#restrictDays" hx-trigger="load"></span>
|
||||
{% endif %}
|
||||
<div class="oh-modal__dialog-header">
|
||||
<span class="oh-modal__dialog-title" id="editDialogDialog">{% trans "Create Restricted Day" %}</span>
|
||||
<button class="oh-modal__close" aria-label="Close" {% if messages %} hx-get="{% url 'restrict-filter' %}?{{pd}}" hx-target="#restrictday" {% endif %}>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -9,15 +9,11 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<script>
|
||||
setTimeout(() => {
|
||||
$(".oh-modal__close").click();
|
||||
}, 1000);
|
||||
</script>
|
||||
<span hx-get="{% url 'restrict-filter' %}?{{pd}}" hx-target="#restrictDays" hx-trigger="load"></span>
|
||||
{% endif %}
|
||||
<div class="oh-modal__dialog-header pb-0">
|
||||
<div class="oh-modal__dialog-header">
|
||||
<span class="oh-modal__dialog-title" id="editDialogDialog">{% trans "Update Restricted Day" %}</span>
|
||||
<button class="oh-modal__close" aria-label="Close" {% if messages %} hx-get="{% url 'restrict-filter' %}?{{pd}}" hx-target="#restrictday" {% endif %}>
|
||||
<button class="oh-modal__close" aria-label="Close">
|
||||
<ion-icon name="close-outline"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,155 +1,105 @@
|
||||
{% extends 'index.html' %} {% block content %} {% load static %} {% load i18n %}
|
||||
<!-- start of nav bar -->
|
||||
<section class="oh-wrapper oh-main__topbar" x-data="{searchShow: false}">
|
||||
<!-- start of title -->
|
||||
<div class="oh-main__titlebar oh-main__titlebar--left">
|
||||
<h1 class="oh-main__titlebar-title fw-bold">
|
||||
{% trans "Restricted Days" %}
|
||||
</h1>
|
||||
<a
|
||||
class="oh-main__titlebar-search-toggle"
|
||||
role="button"
|
||||
aria-label="Toggle Search"
|
||||
@click="searchShow = !searchShow"
|
||||
>
|
||||
<ion-icon
|
||||
name="search-outline"
|
||||
class="oh-main__titlebar-serach-icon"
|
||||
></ion-icon>
|
||||
</a>
|
||||
</div>
|
||||
<!-- end of title -->
|
||||
|
||||
<div class="oh-main__titlebar oh-main__titlebar--right">
|
||||
{% if restrictday %}
|
||||
<!-- start of search -->
|
||||
<div
|
||||
class="oh-input-group oh-input__search-group"
|
||||
:class="searchShow ? 'oh-input__search-group--show' : ''"
|
||||
>
|
||||
<ion-icon
|
||||
name="search-outline"
|
||||
class="oh-input-group__icon oh-input-group__icon--left"
|
||||
></ion-icon>
|
||||
<input
|
||||
id="searchRestrictedDays"
|
||||
type="text"
|
||||
class="oh-input oh-input__icon"
|
||||
aria-label="Search Input"
|
||||
placeholder="{% trans 'Search' %}"
|
||||
name="search"
|
||||
hx-get="{% url 'restrict-filter' %}"
|
||||
hx-trigger="keyup"
|
||||
hx-target="#restrictday"
|
||||
/>
|
||||
<!-- start of title -->
|
||||
<div class="oh-main__titlebar oh-main__titlebar--left">
|
||||
<h1 class="oh-main__titlebar-title fw-bold">
|
||||
{% trans "Restricted Days" %}
|
||||
</h1>
|
||||
<a class="oh-main__titlebar-search-toggle" role="button" aria-label="Toggle Search"
|
||||
@click="searchShow = !searchShow">
|
||||
<ion-icon name="search-outline" class="oh-main__titlebar-serach-icon"></ion-icon>
|
||||
</a>
|
||||
</div>
|
||||
<!-- end of search -->
|
||||
<!-- end of title -->
|
||||
|
||||
<!-- start of Nav bar buttons -->
|
||||
<div class="oh-main__titlebar-button-container">
|
||||
<!-- start of filter -->
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button class="oh-btn ml-2" @click="open = !open">
|
||||
<ion-icon name="filter" class="mr-1"></ion-icon>{% trans "Filter" %}
|
||||
<div id="filterCount"></div>
|
||||
</button>
|
||||
{% include "leave/restrict/restrict_filter.html" %}
|
||||
</div>
|
||||
<!-- end of filter -->
|
||||
<!-- start of Actions -->
|
||||
{% if perms.leave.add_restrictleave or perms.leave.delete_restrictleave %}
|
||||
<div class="oh-dropdown ml-2" x-data="{open: false}">
|
||||
<button
|
||||
class="oh-btn oh-btn--dropdown"
|
||||
@click="open = !open"
|
||||
@click.outside="open = false"
|
||||
>
|
||||
{% trans "Actions" %}
|
||||
</button>
|
||||
<div
|
||||
class="oh-dropdown__menu oh-dropdown__menu--right"
|
||||
x-show="open"
|
||||
style="display: none"
|
||||
>
|
||||
<ul class="oh-dropdown__items">
|
||||
{% if perms.leave.delete_restrictleave %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a
|
||||
href="#"
|
||||
id="bulkRestrictedDaysDelete"
|
||||
class="oh-dropdown__link oh-dropdown__link--danger"
|
||||
>{% trans "Delete" %}</a
|
||||
>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %} {% endif %}
|
||||
<!-- end of actions -->
|
||||
<div class="oh-main__titlebar oh-main__titlebar--right">
|
||||
{% if restrictday %}
|
||||
<!-- start of search -->
|
||||
<div class="oh-input-group oh-input__search-group" :class="searchShow ? 'oh-input__search-group--show' : ''">
|
||||
<ion-icon name="search-outline" class="oh-input-group__icon oh-input-group__icon--left"></ion-icon>
|
||||
<input id="searchRestrictedDays" type="text" class="oh-input oh-input__icon" aria-label="Search Input"
|
||||
placeholder="{% trans 'Search' %}" name="search" hx-get="{% url 'restrict-filter' %}" hx-trigger="keyup"
|
||||
hx-target="#restrictDays" />
|
||||
</div>
|
||||
<!-- end of search -->
|
||||
|
||||
<!-- start of create -->
|
||||
{% if perms.leave.add_restrictleave %}
|
||||
<div class="oh-btn-group ml-2">
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button
|
||||
id="restrictDayCreateButton"
|
||||
class="oh-btn oh-btn--secondary oh-btn--shadow"
|
||||
data-toggle="oh-modal-toggle"
|
||||
data-target="#objectCreateModal"
|
||||
hx-get="{% url 'restrict-creation' %}"
|
||||
hx-target="#objectCreateModalTarget"
|
||||
>
|
||||
<ion-icon name="add-outline" class="me-1"></ion-icon>
|
||||
{% trans "Create" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- end of create -->
|
||||
<!-- start of Nav bar buttons -->
|
||||
<div class="oh-main__titlebar-button-container">
|
||||
<!-- start of filter -->
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button class="oh-btn ml-2" @click="open = !open">
|
||||
<ion-icon name="filter" class="mr-1"></ion-icon>{% trans "Filter" %}
|
||||
<div id="filterCount"></div>
|
||||
</button>
|
||||
{% include "leave/restrict/restrict_filter.html" %}
|
||||
</div>
|
||||
<!-- end of filter -->
|
||||
<!-- start of Actions -->
|
||||
{% if perms.leave.add_restrictleave or perms.leave.delete_restrictleave %}
|
||||
<div class="oh-dropdown ml-2" x-data="{open: false}">
|
||||
<button class="oh-btn oh-btn--dropdown" @click="open = !open" @click.outside="open = false">
|
||||
{% trans "Actions" %}
|
||||
</button>
|
||||
<div class="oh-dropdown__menu oh-dropdown__menu--right" x-show="open" style="display: none">
|
||||
<ul class="oh-dropdown__items">
|
||||
{% if perms.leave.delete_restrictleave %}
|
||||
<li class="oh-dropdown__item">
|
||||
<a href="#" id="bulkRestrictedDaysDelete" data-action="delete"
|
||||
class="oh-dropdown__link oh-dropdown__link--danger">{% trans "Delete" %}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<!-- end of actions -->
|
||||
|
||||
<!-- start of create -->
|
||||
{% if perms.leave.add_restrictleave %}
|
||||
<div class="oh-btn-group ml-2">
|
||||
<div class="oh-dropdown" x-data="{open: false}">
|
||||
<button id="restrictDayCreateButton" class="oh-btn oh-btn--secondary oh-btn--shadow"
|
||||
data-toggle="oh-modal-toggle" data-target="#objectCreateModal"
|
||||
hx-get="{% url 'restrict-creation' %}" hx-target="#objectCreateModalTarget">
|
||||
<ion-icon name="add-outline" class="me-1"></ion-icon>
|
||||
{% trans "Create" %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<!-- end of create -->
|
||||
</div>
|
||||
<!-- end of nav bar buttons -->
|
||||
</div>
|
||||
<!-- end of nav bar buttons -->
|
||||
</div>
|
||||
</section>
|
||||
<!-- end of nav bar -->
|
||||
|
||||
<div
|
||||
class="oh-checkpoint-badge mb-2"
|
||||
id="selectedRestrictDays"
|
||||
data-ids="[]"
|
||||
data-clicked=""
|
||||
style="display: none"
|
||||
>
|
||||
{% trans "Selected Holidays" %}
|
||||
<div class="oh-checkpoint-badge mb-2" id="selectedRestrictDays" data-ids="[]" data-clicked="" style="display: none">
|
||||
{% trans "Selected Holidays" %}
|
||||
</div>
|
||||
|
||||
<!--start of holiday display -->
|
||||
<div class="oh-wrapper" id="restrictday">
|
||||
{% if restrictday %} {% include 'leave/restrict/restrict.html' %} {% else %}
|
||||
<!--start of empty page -->
|
||||
<div
|
||||
style="
|
||||
height: 70vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
"
|
||||
class=""
|
||||
>
|
||||
<div style="" class="oh-404">
|
||||
<img
|
||||
style="display: block; width: 150px; height: 150px; margin: 10px auto"
|
||||
src="{% static 'images/ui/restrict.png' %}"
|
||||
class="mb-4"
|
||||
alt=""
|
||||
/>
|
||||
<h3 style="font-size: 20px" class="oh-404__subtitle">
|
||||
{% trans "No restricted date available." %}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of empty page -->
|
||||
{% endif %}
|
||||
<div class="oh-wrapper" id="restrictDays">
|
||||
{% if restrictday %} {% include 'leave/restrict/restrict.html' %} {% else %}
|
||||
<!--start of empty page -->
|
||||
<div style="
|
||||
height: 70vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
" class="">
|
||||
<div class="oh-404">
|
||||
<img style="display: block; width: 150px; height: 150px; margin: 10px auto"
|
||||
src="{% static 'images/ui/restrict.png' %}" class="mb-4" alt="" />
|
||||
<h3 style="font-size: 20px" class="oh-404__subtitle">
|
||||
{% trans "No restricted date available." %}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of empty page -->
|
||||
{% endif %}
|
||||
</div>
|
||||
<!-- end of Restricted Days display -->
|
||||
|
||||
|
||||
@@ -233,6 +233,7 @@
|
||||
<a
|
||||
href="#"
|
||||
id="userrequestbulkDelete"
|
||||
data-action="delete"
|
||||
class="oh-dropdown__link oh-dropdown__link--danger"
|
||||
>{% trans "Delete" %}</a
|
||||
>
|
||||
|
||||
@@ -1658,6 +1658,7 @@ def restrict_creation(request):
|
||||
form = RestrictLeaveForm(request.POST)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
form = RestrictLeaveForm()
|
||||
messages.success(request, _("Restricted day created successfully.."))
|
||||
if RestrictLeave.objects.filter().count() == 1:
|
||||
return HttpResponse("<script>window.location.reload();</script>")
|
||||
|
||||
Reference in New Issue
Block a user