diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/createleave.js b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/createleave.js
index 53202cb3..0a70be67 100644
--- a/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/createleave.js
+++ b/ServiceHost/wwwroot/AssetsClient/pages/Employees/js/createleave.js
@@ -33,7 +33,7 @@ $(document).ready(function () {
document.getElementById("MainModal").style.visibility = "visible";
$('#employeeSelectList').on('change', function () {
- $('#rotatingShiftSection').hide();
+ $('#rotatingShiftSection').addClass('disable');
$('#HasRollCall').val(false);
previousStartDate = "";
$('#SelectedShift_StartTime').val('');
@@ -53,9 +53,9 @@ $(document).ready(function () {
const dateRegex = /^\d{4}\/\d{2}\/\d{2}$/;
if (dateRegex.test(startDateValue) && startDateValue !== previousStartDate) {
previousStartDate = startDateValue;
- rotatingShift(startDateValue);
}
}
+ rotatingShift();
});
$('#rotatingShift').on('change', function () {
@@ -82,6 +82,7 @@ $(document).ready(function () {
$(document).on("change", ".LeaveType", function () {
if ($('#paid').is(':checked')) {
$('#dailyType').css('visibility', 'visible');
+ rotatingShift();
}
if ($('#sick').is(':checked')) {
@@ -91,6 +92,7 @@ $(document).ready(function () {
$('#end_date_estehghaghi').show();
$('.time_paid').hide();
}
+ rotatingShift();
}
});
@@ -99,11 +101,13 @@ $(document).ready(function () {
if ($('#daily').is(':checked')) {
$('#end_date_estehghaghi').show();
$('.time_paid').hide();
+ rotatingShift();
}
if ($('#hourly').is(':checked')) {
$('#end_date_estehghaghi').hide();
$('.time_paid').show();
+ rotatingShift();
}
});
//******************** شرط استحقاقی و استعلاجی ********************
@@ -643,36 +647,46 @@ function ajaxPersonals() {
});
}
-function rotatingShift(startDateValue) {
- ajaxService.get(hasRotatingShiftAjax, { employeeId: currentEmployeeId, startDateTime: startDateValue })
- .then(response => {
- $('#HasRollCall').val(response.hasRollCall);
- if (response.hasRollCall) {
- $('#rotatingShiftSection').show();
- var shiftsList = response.shifts;
- var shiftsOptionsHtml = '';
+function rotatingShift() {
+ var startDateValue = $('#StartLeave').val();
+ $('#rotatingShiftSection').addClass('disable');
- shiftsList.forEach(function (item) {
- shiftsOptionsHtml += ``;
- });
- $('#rotatingShift').html(shiftsOptionsHtml);
- } else {
- $('#rotatingShiftSection').hide();
+ if ($('#paid').is(':checked') && $('#daily').is(':checked') && startDateValue.length === 10) {
- if (response.message) {
- $('#StartLeave').addClass('errored');
- $('.alert-msg').show();
- $('.alert-msg p').text(response.message);
- setTimeout(function () {
- $('.alert-msg').hide();
- $('.alert-msg p').text("");
- $('#StartLeave').removeClass("errored");
- }, 3500);
+ ajaxService.get(hasRotatingShiftAjax, { employeeId: currentEmployeeId, startDateTime: startDateValue })
+ .then(response => {
+ $('#HasRollCall').val(response.hasRollCall);
+
+ if (response.hasRollCall) {
+ $('#rotatingShiftSection').removeClass('disable');
+
+ var shiftsList = response.shifts;
+ var shiftsOptionsHtml = '';
+
+ shiftsList.forEach(function (item) {
+ shiftsOptionsHtml += ``;
+ });
+ $('#rotatingShift').html(shiftsOptionsHtml);
+ } else {
+ $('#rotatingShiftSection').addClass('disable');
+
+ if (response.message) {
+ $('#StartLeave').addClass('errored');
+ $('.alert-msg').show();
+ $('.alert-msg p').text(response.message);
+ setTimeout(function () {
+ $('.alert-msg').hide();
+ $('.alert-msg p').text("");
+ $('#StartLeave').removeClass("errored");
+ },
+ 3500);
+ }
}
- }
- });
-
+ });
+ } else {
+ $('#rotatingShiftSection').addClass('disable');
+ }
}
\ No newline at end of file
diff --git a/ServiceHost/wwwroot/AssetsClient/pages/Index/js/LeaveCreate.js b/ServiceHost/wwwroot/AssetsClient/pages/Index/js/LeaveCreate.js
index ddbf06f0..a24c47bc 100644
--- a/ServiceHost/wwwroot/AssetsClient/pages/Index/js/LeaveCreate.js
+++ b/ServiceHost/wwwroot/AssetsClient/pages/Index/js/LeaveCreate.js
@@ -23,7 +23,7 @@ $(document).ready(function () {
});
$('#employeeSelect').on('change', function () {
- $('#rotatingShiftSection').hide();
+ $('#rotatingShiftSection').addClass('disable');
$('#HasRollCall').val(false);
previousStartDate = "";
$('#SelectedShift_StartTime').val('');
@@ -43,9 +43,9 @@ $(document).ready(function () {
const dateRegex = /^\d{4}\/\d{2}\/\d{2}$/;
if (dateRegex.test(startDateValue) && startDateValue !== previousStartDate) {
previousStartDate = startDateValue;
- rotatingShift(startDateValue);
}
}
+ rotatingShift();
});
$('#rotatingShift').on('change', function () {
@@ -59,6 +59,7 @@ $(document).ready(function () {
$(document).on("change", ".LeaveType", function () {
if ($('#paid').is(':checked')) {
$('#dailyType').css('visibility', 'visible');
+ rotatingShift();
}
if ($('#sick').is(':checked')) {
@@ -68,6 +69,7 @@ $(document).ready(function () {
$('#end_date_estehghaghi').show();
$('.time_paid').hide();
}
+ rotatingShift();
}
});
@@ -76,11 +78,13 @@ $(document).ready(function () {
if ($('#daily').is(':checked')) {
$('#end_date_estehghaghi').show();
$('.time_paid').hide();
+ rotatingShift();
}
if ($('#hourly').is(':checked')) {
$('#end_date_estehghaghi').hide();
$('.time_paid').show();
+ rotatingShift();
}
});
//******************** شرط استحقاقی و استعلاجی ********************
@@ -736,36 +740,45 @@ function ajaxPersonals() {
});
}
-function rotatingShift(startDateValue) {
+function rotatingShift() {
+ var startDateValue = $('#StartLeave').val();
+ $('#rotatingShiftSection').addClass('disable');
+
+ if ($('#paid').is(':checked') && $('#daily').is(':checked') && startDateValue.length === 10) {
- ajaxService.get(hasRotatingShiftAjax, { employeeId: currentEmployeeId, startDateTime: startDateValue })
- .then(response => {
- $('#HasRollCall').val(response.hasRollCall);
+ ajaxService.get(hasRotatingShiftAjax, { employeeId: currentEmployeeId, startDateTime: startDateValue })
+ .then(response => {
+ $('#HasRollCall').val(response.hasRollCall);
- if (response.hasRollCall) {
- $('#rotatingShiftSection').show();
+ if (response.hasRollCall) {
+ $('#rotatingShiftSection').removeClass('disable');
- var shiftsList = response.shifts;
- var shiftsOptionsHtml = '';
+ var shiftsList = response.shifts;
+ var shiftsOptionsHtml = '';
- shiftsList.forEach(function (item) {
- shiftsOptionsHtml += ``;
- });
- $('#rotatingShift').html(shiftsOptionsHtml);
- } else {
- $('#rotatingShiftSection').hide();
+ shiftsList.forEach(function(item) {
+ shiftsOptionsHtml += ``;
+ });
+ $('#rotatingShift').html(shiftsOptionsHtml);
+ } else {
+ $('#rotatingShiftSection').addClass('disable');
- if (response.message) {
- $('#StartLeave').addClass('errored');
- $('.alert-msg').show();
- $('.alert-msg p').text(response.message);
- setTimeout(function () {
- $('.alert-msg').hide();
- $('.alert-msg p').text("");
- $('#StartLeave').removeClass("errored");
- }, 3500);
+ if (response.message) {
+ $('#StartLeave').addClass('errored');
+ $('.alert-msg').show();
+ $('.alert-msg p').text(response.message);
+ setTimeout(function() {
+ $('.alert-msg').hide();
+ $('.alert-msg p').text("");
+ $('#StartLeave').removeClass("errored");
+ },
+ 3500);
+ }
}
- }
- });
+ });
+ } else {
+ $('#rotatingShiftSection').addClass('disable');
+ }
}
\ No newline at end of file
diff --git a/ServiceHost/wwwroot/AssetsClient/pages/WorkFlow/js/LeaveCreate.js b/ServiceHost/wwwroot/AssetsClient/pages/WorkFlow/js/LeaveCreate.js
index a4340afb..d4d8a553 100644
--- a/ServiceHost/wwwroot/AssetsClient/pages/WorkFlow/js/LeaveCreate.js
+++ b/ServiceHost/wwwroot/AssetsClient/pages/WorkFlow/js/LeaveCreate.js
@@ -5,10 +5,21 @@ $(document).ready(function () {
$('.loading').hide();
- document.getElementById("MainModal").style.visibility = "visible";
+ $(".select2Option").select2({
+ language: "fa",
+ dir: "rtl",
+ dropdownParent: $('#MainModal'),
+ templateResult: function (data, container) {
+ if (data.element) {
+ $(container).addClass($(data.element).attr("class"));
+ }
+ return data.text;
+ }
+ });
+
+ document.getElementById("MainModal").style.visibility = "visible";
+ rotatingShift();
- var startLeaveInput = $('#StartLeave').val();
- rotatingShift(startLeaveInput);
$('#StartLeave').on('keyup', function () {
const startDateValue = $(this).val();
@@ -16,9 +27,9 @@ $(document).ready(function () {
const dateRegex = /^\d{4}\/\d{2}\/\d{2}$/;
if (dateRegex.test(startDateValue) && startDateValue !== previousStartDate) {
previousStartDate = startDateValue;
- rotatingShift(startDateValue);
}
}
+ rotatingShift();
});
$('#rotatingShift').on('change', function () {
@@ -32,6 +43,7 @@ $(document).ready(function () {
$(document).on("change", ".LeaveType", function () {
if ($('#paid').is(':checked')) {
$('#dailyType').css('visibility', 'visible');
+ rotatingShift();
}
if ($('#sick').is(':checked')) {
@@ -41,6 +53,7 @@ $(document).ready(function () {
$('#end_date_estehghaghi').show();
$('.time_paid').hide();
}
+ rotatingShift();
}
});
@@ -49,11 +62,13 @@ $(document).ready(function () {
if ($('#daily').is(':checked')) {
$('#end_date_estehghaghi').show();
$('.time_paid').hide();
+ rotatingShift();
}
if ($('#hourly').is(':checked')) {
$('#end_date_estehghaghi').hide();
$('.time_paid').show();
+ rotatingShift();
}
});
//******************** شرط استحقاقی و استعلاجی ********************
@@ -701,36 +716,47 @@ $(document).ready(function () {
});
});
-function rotatingShift(startDateValue) {
+
+
+function rotatingShift() {
var currentEmployeeId = $('#employeeId').val();
- ajaxService.get(hasRotatingShiftAjax, { employeeId: currentEmployeeId, startDateTime: startDateValue })
- .then(response => {
- $('#HasRollCall').val(response.hasRollCall);
- console.log(response);
- if (response.hasRollCall) {
- $('#rotatingShiftSection').show();
+ var startDateValue = $('#StartLeave').val();
+ $('#rotatingShiftSection').addClass('disable');
- var shiftsList = response.shifts;
- var shiftsOptionsHtml = '';
+ if ($('#paid').is(':checked') && $('#daily').is(':checked') && startDateValue.length === 10) {
- shiftsList.forEach(function (item) {
- shiftsOptionsHtml += ``;
- });
- $('#rotatingShift').html(shiftsOptionsHtml);
- } else {
- $('#rotatingShiftSection').hide();
+ ajaxService.get(hasRotatingShiftAjax, { employeeId: currentEmployeeId, startDateTime: startDateValue })
+ .then(response => {
+ console.log(response)
+ $('#HasRollCall').val(response.hasRollCall);
- if (response.message) {
- $('#StartLeave').addClass('errored');
- $('.alert-msg').show();
- $('.alert-msg p').text(response.message);
- setTimeout(function () {
- $('.alert-msg').hide();
- $('.alert-msg p').text("");
- $('#StartLeave').removeClass("errored");
- }, 3500);
+ if (response.hasRollCall) {
+ $('#rotatingShiftSection').removeClass('disable');
+
+ var shiftsList = response.shifts;
+ var shiftsOptionsHtml = '';
+
+ shiftsList.forEach(function (item) {
+ shiftsOptionsHtml += ``;
+ });
+ $('#rotatingShift').html(shiftsOptionsHtml);
+ } else {
+ $('#rotatingShiftSection').addClass('disable');
+
+ if (response.message) {
+ $('#StartLeave').addClass('errored');
+ $('.alert-msg').show();
+ $('.alert-msg p').text(response.message);
+ setTimeout(function () {
+ $('.alert-msg').hide();
+ $('.alert-msg p').text("");
+ $('#StartLeave').removeClass("errored");
+ },
+ 3500);
+ }
}
- }
- });
-
+ });
+ } else {
+ $('#rotatingShiftSection').addClass('disable');
+ }
}
\ No newline at end of file