677 lines
24 KiB
JavaScript
677 lines
24 KiB
JavaScript
var urlPathname = location.pathname;
|
|
|
|
$(document).ready(function () {
|
|
|
|
$("#modalWorkshopFullname").text($('#caseHistoryWorkshopFullname').text());
|
|
$('.btn-register').addClass('disable');
|
|
|
|
$(".form-control-date").each(function () {
|
|
let element = $(this);
|
|
element.on('input', function () {
|
|
let value = convertPersianNumbersToEnglish(element.val());
|
|
element.val(value);
|
|
});
|
|
|
|
new Cleave(this, {
|
|
delimiters: ['/', '/'],
|
|
blocks: [4, 2, 2],
|
|
numericOnly: true
|
|
});
|
|
|
|
//new Cleave(this, {
|
|
// date: true,
|
|
// delimiter: '/',
|
|
// datePattern: ['Y', 'm', 'd']
|
|
//});
|
|
});
|
|
|
|
$(".dateTime").each(function () {
|
|
let element = $(this);
|
|
element.on('input', function () {
|
|
let value = convertPersianNumbersToEnglish(element.val());
|
|
element.val(value);
|
|
});
|
|
|
|
new Cleave(this, {
|
|
time: true,
|
|
timePattern: ['h', 'm']
|
|
});
|
|
});
|
|
|
|
$(".dateTimeIrregular").each(function () {
|
|
let element = $(this);
|
|
element.on('input', function () {
|
|
let value = convertPersianNumbersToEnglish(element.val());
|
|
element.val(value);
|
|
});
|
|
|
|
new Cleave(this, {
|
|
time: true,
|
|
timePattern: ['h', 'm']
|
|
});
|
|
});
|
|
|
|
// updateDateInput(0);
|
|
|
|
$(".btnAddTimeWork").on("click", function () {
|
|
var currentCount = $('.groupBox').length;
|
|
var $inputs = $('.dateTime');
|
|
var $inputsDate = $('.form-control-date');
|
|
var allFilled = true;
|
|
|
|
$inputsDate.each(function () {
|
|
if ($(this).val() === '') {
|
|
allFilled = false;
|
|
$('.btn-register').addClass('disable');
|
|
showAlert('ابتدا تاریخ و ساعت شروع و پایان را وارد نمائید.', $(this));
|
|
}
|
|
});
|
|
|
|
$inputs.each(function () {
|
|
if ($(this).val() === '') {
|
|
allFilled = false;
|
|
$('.btn-register').addClass('disable');
|
|
showAlert('ابتدا تاریخ و ساعت شروع و پایان را وارد نمائید.', $(this));
|
|
}
|
|
});
|
|
|
|
if (!allFilled) {
|
|
return false;
|
|
}
|
|
|
|
|
|
if (currentCount < 5) {
|
|
var namePlacementPersian = "";
|
|
|
|
switch (currentCount + 1) {
|
|
case 2:
|
|
namePlacementPersian = "دوم";
|
|
break;
|
|
case 3:
|
|
namePlacementPersian = "سوم";
|
|
break;
|
|
case 4:
|
|
namePlacementPersian = "چهارم";
|
|
break;
|
|
case 5:
|
|
namePlacementPersian = "پنجم";
|
|
break;
|
|
default:
|
|
}
|
|
|
|
var timeWorkHtml = `
|
|
<div class="groupBox">
|
|
<div class="d-flex align-items-end align-items-md-center justify-content-between">
|
|
<div class="timeWorkTitle d-none d-md-block">
|
|
نوبت ${namePlacementPersian}
|
|
</div>
|
|
|
|
<div class="d-flex align-items-end align-items-md-center justify-content-between gap-2">
|
|
<div class="d-flex flex-md-row flex-column align-items-center justify-content-between gap-1 mainDate">
|
|
<span class="startDatetxt">-</span>
|
|
<input type="text" class="form-control text-center form-control-date StartDate" name="Command.RollCallRecords[${currentCount}].StartDate" placeholder="0000/00/00" style="direction: ltr;">
|
|
</div>
|
|
<input type="text" class="form-control text-center cusDateTime dateTime StartTime" name="Command.RollCallRecords[${currentCount}].StartTime" placeholder="00:00" style="direction: ltr;">
|
|
</div>
|
|
|
|
<div class="mx-2 position-relative">
|
|
<div class="timeWorkTitle position-absolute d-block d-md-none" style="width: auto;bottom: 43px;right: -10px;">
|
|
نوبت ${namePlacementPersian}
|
|
</div>
|
|
<div>الی</div>
|
|
</div>
|
|
|
|
<div class="d-flex align-items-end align-items-md-center justify-content-between gap-2">
|
|
<input type="text" class="form-control text-center cusDateTime dateTime EndTime" name="Command.RollCallRecords[${currentCount}].EndTime" placeholder="00:00" style="direction: ltr;">
|
|
<div class="d-flex flex-md-row flex-column align-items-center justify-content-between gap-1 mainDate">
|
|
<input type="text" class="order-2 order-md-0 form-control text-center form-control-date EndDate" name="Command.RollCallRecords[${currentCount}].EndDate" placeholder="0000/00/00" style="direction: ltr;">
|
|
<span class="order-1 order-md-0 endDatetxt">-</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="removeBtn ms-2">
|
|
<button type="button" class="btnRemoveTimeWork">
|
|
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<circle cx="11" cy="11" r="8.25" stroke="white"/>
|
|
<path d="M6.875 11H15.125" stroke="white"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
|
|
$('#appendChildTimeWorkHtml').append(timeWorkHtml);
|
|
|
|
const newStartDateInput = $(`input[name="Command.RollCallRecords[${currentCount}].StartDate"]`);
|
|
const newEndDateInput = $(`input[name="Command.RollCallRecords[${currentCount}].EndDate"]`);
|
|
const newStartTimeInput = $(`input[name="Command.RollCallRecords[${currentCount}].StartTime"]`);
|
|
const newEndTimeInput = $(`input[name="Command.RollCallRecords[${currentCount}].EndTime"]`);
|
|
|
|
newStartDateInput.on('input', function () {
|
|
const value = convertPersianNumbersToEnglish($(this).val());
|
|
$(this).val(value);
|
|
});
|
|
newEndDateInput.on('input', function () {
|
|
const value = convertPersianNumbersToEnglish($(this).val());
|
|
$(this).val(value);
|
|
});
|
|
|
|
newStartTimeInput.on('input', function () {
|
|
const value = convertPersianNumbersToEnglish($(this).val());
|
|
$(this).val(value);
|
|
});
|
|
|
|
newEndTimeInput.on('input', function () {
|
|
const value = convertPersianNumbersToEnglish($(this).val());
|
|
$(this).val(value);
|
|
});
|
|
|
|
|
|
new Cleave(newStartDateInput[0], {
|
|
delimiters: ['/', '/'],
|
|
blocks: [4, 2, 2],
|
|
numericOnly: true
|
|
});
|
|
|
|
//new Cleave(newStartDateInput[0], {
|
|
// date: true,
|
|
// delimiter: '/',
|
|
// datePattern: ['Y', 'm', 'd']
|
|
//});
|
|
|
|
|
|
new Cleave(newEndDateInput[0], {
|
|
delimiters: ['/', '/'],
|
|
blocks: [4, 2, 2],
|
|
numericOnly: true
|
|
});
|
|
|
|
//new Cleave(newEndDateInput[0], {
|
|
// date: true,
|
|
// delimiter: '/',
|
|
// datePattern: ['Y', 'm', 'd']
|
|
//});
|
|
|
|
new Cleave(newStartTimeInput[0], {
|
|
time: true,
|
|
timePattern: ['h', 'm']
|
|
});
|
|
|
|
new Cleave(newEndTimeInput[0], {
|
|
time: true,
|
|
timePattern: ['h', 'm']
|
|
});
|
|
|
|
updateAddButtonText(currentCount + 1);
|
|
|
|
if (currentCount + 1 === 5) {
|
|
$(".btnAddTimeWork").hide();
|
|
}
|
|
|
|
// Update Remove button enable/disable state
|
|
updateRemoveButtons();
|
|
}
|
|
});
|
|
|
|
$(document).on("click", ".btnRemoveTimeWork", function () {
|
|
$(this).closest(".groupBox").remove();
|
|
var currentCount = $('.groupBox').length;
|
|
|
|
updateAddButtonText(currentCount);
|
|
|
|
if (currentCount < 5) {
|
|
$(".btnAddTimeWork").show();
|
|
}
|
|
|
|
// Update Remove button enable/disable state
|
|
updateRemoveButtons();
|
|
|
|
fetchTotalsRollCall();
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
const $boxes = $('.irrregularContent');
|
|
const $forwardArrow = $('#nextBox').parent().find('svg path:first-child');
|
|
const $backwardArrow = $('#prevBox').parent().find('svg path:first-child');
|
|
let currentIndex = 0;
|
|
|
|
const updateBoxes = () => {
|
|
$boxes.each((index, box) => {
|
|
const $box = $(box);
|
|
if (index < currentIndex) {
|
|
// Previous boxes
|
|
$box.css({
|
|
transform: 'translateX(-100%)',
|
|
opacity: 0,
|
|
position: 'absolute',
|
|
});
|
|
} else if (index === currentIndex) {
|
|
// Current box
|
|
$box.addClass('active').css({
|
|
transform: 'translateX(0)',
|
|
opacity: 1,
|
|
position: 'relative',
|
|
});
|
|
} else {
|
|
// Next boxes
|
|
$box.css({
|
|
transform: 'translateX(100%)',
|
|
opacity: 0,
|
|
position: 'absolute',
|
|
});
|
|
}
|
|
});
|
|
|
|
if (currentIndex === 0) {
|
|
$backwardArrow.attr('fill', '#D9D9D9');
|
|
$forwardArrow.attr('fill', '#2DBDBD');
|
|
} else if (currentIndex === $boxes.length - 1) {
|
|
$backwardArrow.attr('fill', '#2DBDBD');
|
|
$forwardArrow.attr('fill', '#D9D9D9');
|
|
} else {
|
|
$backwardArrow.attr('fill', '#2DBDBD');
|
|
$forwardArrow.attr('fill', '#2DBDBD');
|
|
}
|
|
};
|
|
|
|
$('#nextBox').on('click', function () {
|
|
if (currentIndex < $boxes.length - 1) {
|
|
currentIndex++;
|
|
updateBoxes();
|
|
}
|
|
});
|
|
|
|
$('#prevBox').on('click', function () {
|
|
if (currentIndex > 0) {
|
|
currentIndex--;
|
|
updateBoxes();
|
|
}
|
|
});
|
|
|
|
updateBoxes();
|
|
//--------------------------------------------------------------
|
|
|
|
|
|
fetchTotalsRollCall();
|
|
});
|
|
function updateRemoveButtons() {
|
|
$(".btnRemoveTimeWork").addClass("disable");
|
|
$(".btnRemoveTimeWork").last().removeClass("disable");
|
|
}
|
|
|
|
//function updateDateInput(daysToAdd) {
|
|
// var today = new Date();
|
|
// today.setDate(today.getDate() + daysToAdd);
|
|
// var jalaaliDate = jalaali.toJalaali(today);
|
|
// var formattedDate = jalaaliDate.jy + '/' + (jalaaliDate.jm < 10 ? '0' + jalaaliDate.jm : jalaaliDate.jm) + '/' + (jalaaliDate.jd < 10 ? '0' + jalaaliDate.jd : jalaaliDate.jd);
|
|
// $('.form-control-date').val(formattedDate);
|
|
//}
|
|
|
|
//updateAddButtonText(1);
|
|
function updateAddButtonText(currentCount) {
|
|
if (currentCount === 1) {
|
|
$('.btnAppendChildTimeWork').text('افزودن نوبت دوم');
|
|
} else if (currentCount === 2) {
|
|
$('.btnAppendChildTimeWork').text('افزودن نوبت سوم');
|
|
} else if (currentCount === 3) {
|
|
$('.btnAppendChildTimeWork').text('افزودن نوبت چهارم');
|
|
} else if (currentCount === 4) {
|
|
$('.btnAppendChildTimeWork').text('افزودن نوبت پنجم');
|
|
}
|
|
|
|
let allFilled = true;
|
|
$('.form-control-date').each(function () {
|
|
const value = $(this).val().trim();
|
|
if (value === "" || !dateValidCheck(value)) {
|
|
allFilled = false;
|
|
return false; // Break the loop
|
|
}
|
|
});
|
|
|
|
$('.dateTime').each(function () {
|
|
const value = $(this).val().trim();
|
|
if (value === "" || !timeValidCheck(value)) {
|
|
allFilled = false;
|
|
return false; // Break the loop
|
|
}
|
|
});
|
|
|
|
if (allFilled) {
|
|
$('.btn-register').removeClass('disable');
|
|
} else {
|
|
$('.btn-register').addClass('disable');
|
|
}
|
|
}
|
|
|
|
$(document).on('keyup', ".dateTime, .form-control-date", function () {
|
|
let $input = $(this);
|
|
let value = $input.val();
|
|
let lengthValue = value.length;
|
|
let currentCount = $('.groupBox').length;
|
|
|
|
const $groupBox = $input.closest('.groupBox');
|
|
|
|
const startDate = $groupBox.find('.StartDate').val();
|
|
const startTime = $groupBox.find('[name*="StartTime"]').val();
|
|
const endDate = $groupBox.find('.EndDate').val();
|
|
const endTime = $groupBox.find('[name*="EndTime"]').val();
|
|
|
|
// Validate input based on the field type
|
|
if ($input.hasClass('form-control-date')) {
|
|
// Date validation logic
|
|
if (lengthValue >= 10) {
|
|
if (!dateValidCheck(value)) {
|
|
showAlert('تاریخ را به درستی وارد نمائید', $input);
|
|
} else {
|
|
clearAlert($input);
|
|
dayOfWeekLoad(this, value);
|
|
}
|
|
} else {
|
|
if ($input.hasClass('StartDate')) {
|
|
$groupBox.find('.startDatetxt').text('-');
|
|
} else if ($input.hasClass('EndDate')) {
|
|
$groupBox.find('.endDatetxt').text('-');
|
|
}
|
|
}
|
|
} else if ($input.hasClass('dateTime')) {
|
|
if (lengthValue >= 5) {
|
|
if (!timeValidCheck(value)) {
|
|
showAlert('ساعت را به درستی وارد نمائید', $input);
|
|
} else {
|
|
clearAlert($input);
|
|
}
|
|
}
|
|
}
|
|
|
|
//if (startDate.length >= 10 && endDate.length >= 10) {
|
|
// if (!validateDates(startDate, endDate)) {
|
|
// showAlert('حضور غیاب در حال ویرایش را نمیتوانید بیشتر از یک روز از ثبت حضور غیاب عقب تر یا جلو تر ببرید', $input);
|
|
// }
|
|
//}
|
|
|
|
if (startDate.length >= 10 && startTime.length >= 5 && endDate.length >= 10 && endTime.length >= 5) {
|
|
//totalWorkingDataLoad(startDate, startTime, endDate, endTime, $groupBox);
|
|
fetchTotalsRollCall();
|
|
}
|
|
|
|
updateAddButtonText(currentCount);
|
|
});
|
|
|
|
//function validateDates(startDate, endDate) {
|
|
// return itemsEditableDatesData.some(entry => entry.startFa === startDate && entry.endFa === endDate);
|
|
//}
|
|
|
|
function dayOfWeekLoad(input, value) {
|
|
var dayOfWeekUrl = ``;
|
|
if (urlPathname.indexOf('/Client/Company/WorkFlow/RollCall') > -1) {
|
|
dayOfWeekUrl = dayOfWeekDataWorkFlowUrl;
|
|
} else {
|
|
dayOfWeekUrl = dayOfWeekDataUrl;
|
|
}
|
|
|
|
$.ajax({
|
|
url: dayOfWeekUrl,
|
|
type: 'GET',
|
|
data: { dateFa: value },
|
|
success: function (response) {
|
|
if (response.success) {
|
|
const $groupBox = $(input).closest('.groupBox');
|
|
if ($(input).hasClass('StartDate')) {
|
|
$groupBox.find('.startDatetxt').text(response.message);
|
|
} else if ($(input).hasClass('EndDate')) {
|
|
$groupBox.find('.endDatetxt').text(response.message);
|
|
}
|
|
} else {
|
|
$('.alert-msg').show();
|
|
$('.alert-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-msg').hide();
|
|
$('.alert-msg p').text('');
|
|
}, 3500);
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
}
|
|
});
|
|
}
|
|
function totalWorkingDataLoad(startDateVal, startTimeVal, endDateVal, endTimeVal, $groupBox) {
|
|
$.ajax({
|
|
url: totalWorkingDataUrl,
|
|
type: 'GET',
|
|
data: { startDate: startDateVal, startTime: startTimeVal, endDate: endDateVal, endTime: endTimeVal },
|
|
success: function (response) {
|
|
if (response) {
|
|
//$groupBox.find('.ti').text(response.message);
|
|
} else {
|
|
$('.alert-msg').show();
|
|
$('.alert-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-msg').hide();
|
|
$('.alert-msg p').text('');
|
|
}, 3500);
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
}
|
|
});
|
|
}
|
|
|
|
function showAlert(message, inputElement) {
|
|
inputElement.addClass("errored");
|
|
$('.alert-msg').show().find('p').text(message);
|
|
setTimeout(function () {
|
|
clearAlert(inputElement);
|
|
}, 3500);
|
|
}
|
|
|
|
function clearAlert(inputElement) {
|
|
inputElement.removeClass("errored");
|
|
$('.alert-msg').hide().find('p').text('');
|
|
}
|
|
|
|
function timeValidCheck(value) {
|
|
const timePattern = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
return timePattern.test(value);
|
|
}
|
|
|
|
function dateValidCheck(value) {
|
|
const datePattern = /^\d{4}\/(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])$/;
|
|
return datePattern.test(value);
|
|
}
|
|
|
|
$('.btn-register').click(function () {
|
|
|
|
var urlPostEditRollCall = ``;
|
|
if (urlPathname.indexOf('/Client/Company/WorkFlow/RollCall') > -1) {
|
|
urlPostEditRollCall = saveRollCallWorkTimeFromWorkFlowAjax;
|
|
} else {
|
|
urlPostEditRollCall = saveRollCallWorkTimeAjax;
|
|
}
|
|
|
|
var dateFa = $('#dateFa').val().replaceAll("/", "");
|
|
var dateEmployeeID = $('#employeeID').val() + '-' + dateFa;
|
|
|
|
var loading = $('.btn-register .spinner-loading');
|
|
var data = $('#create-form').serialize();
|
|
$.ajax({
|
|
async: false,
|
|
dataType: 'json',
|
|
type: 'POST',
|
|
url: urlPostEditRollCall,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
data: data,
|
|
success: function (response) {
|
|
if (response.success) {
|
|
loading.show();
|
|
$('.alert-success-msg').show();
|
|
$('.alert-success-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-success-msg').hide();
|
|
$('.alert-success-msg p').text('');
|
|
loading.hide();
|
|
}, 2000);
|
|
|
|
if (urlPathname.indexOf('/Client/Company/WorkFlow/RollCall') > -1) {
|
|
_RefreshCountMenu();
|
|
CountWorkFlowOfAbsentAndCut();
|
|
//LoadWorkFlowsCutList();
|
|
//loadWorkFlowsAbsentsList();
|
|
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
|
//loadUndefinedRollCallsList();
|
|
//loadOverlappingLeavesList();
|
|
|
|
//var menuActive = $('#navbar-animmenu li.active').data('menu');
|
|
//switch (menuActive) {
|
|
// case "absent":
|
|
// loadWorkFlowsAbsentsList();
|
|
// break;
|
|
// case "cut":
|
|
// LoadWorkFlowsCutList();
|
|
// break;
|
|
// case "lunchBreak":
|
|
// loadWorkFlowEmployeesWithoutLunchBreakList();
|
|
// break;
|
|
// case "undefined":
|
|
// loadUndefinedRollCallsList();
|
|
// break;
|
|
// case "overlappingLeave":
|
|
// loadOverlappingLeavesList();
|
|
// break;
|
|
// default:
|
|
//}
|
|
|
|
var menuActive = $('#navbar-animmenu li.active').data('menu');
|
|
switch (menuActive) {
|
|
case "absent":
|
|
/*loadWorkFlowsAbsentsList();*/
|
|
$(`[data-absent-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`absent_${dateFa}`);
|
|
updateMainWorkFlow(`absentMain_${dateFa}`);
|
|
break;
|
|
case "cut":
|
|
//LoadWorkFlowsCutList();
|
|
$(`[data-cut-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`cut_${dateFa}`);
|
|
updateMainWorkFlow(`cutMain_${dateFa}`);
|
|
break;
|
|
case "lunchBreak":
|
|
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
|
$(`[data-break-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`break_${dateFa}`);
|
|
updateMainWorkFlow(`breakMain_${dateFa}`);
|
|
break;
|
|
case "undefined":
|
|
//loadUndefinedRollCallsList();
|
|
$(`[data-undefined-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`undefined_${dateFa}`);
|
|
updateMainWorkFlow(`undefinedMain_${dateFa}`);
|
|
break;
|
|
case "overlappingLeave":
|
|
//loadOverlappingLeavesList();
|
|
$(`[data-leave-employee-date="${dateEmployeeID}"]`).remove();
|
|
updateIndexesWorkFlow(`leave_${dateFa}`);
|
|
updateMainWorkFlow(`leaveMain_${dateFa}`);
|
|
break;
|
|
default:
|
|
}
|
|
|
|
$('#MainModal').modal('hide');
|
|
}
|
|
|
|
if (urlPathname.indexOf('/Client/Company/RollCall/CaseHistory') > -1) {
|
|
hasData = true;
|
|
dateIndex = 0;
|
|
dateEmployeeIndex = null;
|
|
$('#caseHistoryLoadData').html('');
|
|
caseHistoryLoadAjax();
|
|
loadUntilHeightExceeds();
|
|
$('#MainModal').modal('hide');
|
|
}
|
|
|
|
//window.location.reload();
|
|
|
|
} else {
|
|
$('.alert-msg').show();
|
|
$('.alert-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-msg').hide();
|
|
$('.alert-msg p').text('');
|
|
loading.hide();
|
|
}, 3500);
|
|
}
|
|
},
|
|
error: function (err) {
|
|
loading.hide();
|
|
console.log(err);
|
|
}
|
|
});
|
|
});
|
|
|
|
function toggleHeightControl() {
|
|
if ($('#employeeSelectAddModal').val() !== '0' && $('.form-control-date').val().length >= 10) {
|
|
$('.heightControll').removeClass('disable');
|
|
} else {
|
|
$('.heightControll').addClass('disable');
|
|
}
|
|
}
|
|
|
|
function getTimeWorkData() {
|
|
var rollCalls = [];
|
|
|
|
$('.groupBox').each(function () {
|
|
var startDate = $(this).find('.StartDate').val();
|
|
var startTime = $(this).find('.StartTime').val();
|
|
var endDate = $(this).find('.EndDate').val();
|
|
var endTime = $(this).find('.EndTime').val();
|
|
|
|
const calculateRollCallsTotalDuration = {};
|
|
calculateRollCallsTotalDuration.StartDateFa = startDate;
|
|
calculateRollCallsTotalDuration.StartTime = startTime;
|
|
calculateRollCallsTotalDuration.EndDateFa = endDate;
|
|
calculateRollCallsTotalDuration.EndTime = endTime;
|
|
|
|
rollCalls.push(calculateRollCallsTotalDuration);
|
|
});
|
|
|
|
return rollCalls;
|
|
}
|
|
|
|
function fetchTotalsRollCall() {
|
|
const employeeId = $('#employeeSelectAddModal').val();
|
|
const dateFa = $('.form-control-date-main').val();
|
|
|
|
var calculateRollCallUrl = ``;
|
|
if (urlPathname.indexOf('/Client/Company/WorkFlow/RollCall') > -1) {
|
|
calculateRollCallUrl = calculateRollCallsTotalDurationDataWorkFlowUrl;
|
|
} else {
|
|
calculateRollCallUrl = calculateRollCallsTotalDurationDataUrl;
|
|
}
|
|
|
|
if (employeeId !== '0' && dateFa !== '') {
|
|
var rollCalls = getTimeWorkData();
|
|
$.ajax({
|
|
dataType: 'json',
|
|
type: 'POST',
|
|
url: calculateRollCallUrl,
|
|
data: { rollCalls },
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
if (response) {
|
|
$('#resultCalculateRollCallsTotal').show();
|
|
$('#resultCalculateRollCallsTotal').text(response.result);
|
|
} else {
|
|
$('#resultCalculateRollCallsTotal').hide();
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
}
|
|
});
|
|
}
|
|
} |