From 2049d8b2eb056fb64570e447182995ad8b5e67fb Mon Sep 17 00:00:00 2001 From: SamSys Date: Tue, 13 May 2025 17:48:18 +0330 Subject: [PATCH 1/3] Sepration Contracts Index js --- .../Pages/Company/Contracts/Index.cshtml | 1549 +---------------- .../AssetsAdmin/page/Contracts/js/index.js | 1490 ++++++++++++++++ 2 files changed, 1506 insertions(+), 1533 deletions(-) create mode 100644 ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/index.js diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Index.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/Index.cshtml index bf0a9739..3b7456d7 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Index.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Contracts/Index.cshtml @@ -8,7 +8,7 @@ //string act = "active"; int i = 1; - + string adminVersion = _0_Framework.Application.Version.AdminVersion; } @{ @@ -845,1543 +845,26 @@ -@* *@ - - - - - - - - - - - - + + } diff --git a/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/index.js b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/index.js new file mode 100644 index 00000000..b8f91f26 --- /dev/null +++ b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/index.js @@ -0,0 +1,1490 @@ + + + $(document).ready(function() { + + $(".datepicker-container").hide(); + if ($('#datatable tbody tr .employee-operations').length > 0) { + $(window).on('resize', function () { + if ($(window).width() < 768) { + locateButtonContainerMobile(); + } + //if ($(window).width() > 768) { + // locateButtonContainer(); + //} + }); + $(document).on("click", function (event) { + var target = $(event.target); + if (!target.closest(".buttons-container").length + && !target.is(".employee-operations") + && !target.is("#createLegal") + && !target.is("#createLegal *") + && !target.is("#LegalDetails") + && !target.is("#LegalDetails *") + && !target.is("#legalEdit") + && !target.is("#legalEdit *") + && !target.is("#createActual") + && !target.is("#createActual *") + && !target.is("#actualDetails") + && !target.is("#actualDetails *") + && !target.is("#actualEdit") + && !target.is("#actualEdit *") + ) { + $(".buttons-container").removeClass("active").addClass("reverse"); + $(".more-buttons").removeClass("active"); + setTimeout(function () { + $(".buttons-container").removeClass("reverse").css("display", "none"); + }, 200); + } + }); + $(".employee-operations").on("click", function () { + if ($(window).width() < 768) { + locateButtonContainerMobile(); + } + //if ($(window).width() > 768) { + // locateButtonContainer(); + //} + var buttonsContainer = $(this).next(".buttons-container"); + if (buttonsContainer.hasClass("active")) { + buttonsContainer.removeClass("active").addClass("reverse"); + $(this).closest(".more-buttons").removeClass("active"); + setTimeout(function () { + buttonsContainer.removeClass("reverse").css("display", "none"); + }, 200); + } else { + buttonsContainer.removeClass("reverse").addClass("active").css("display", "flex"); + $(this).closest(".more-buttons").addClass("active"); + } + + $(".buttons-container").not(buttonsContainer).removeClass("active reverse").css("display", "none"); + $(".more-buttons").not($(this).closest(".more-buttons")).removeClass("active"); + }); + } + }) + + //function locateButtonContainer() { + // var beforePosition = $(".screen-view .employee-operations").position(); + // var containerWidth = $('.screen-view .buttons-container').outerWidth(); + // var containerHeight = $('.screen-view .buttons-container').outerHeight(); + // var containerLeft = beforePosition.left + $(".screen-view .employee-operations").outerWidth() + 20; + // var containerTop = beforePosition.top + ($(".screen-view .employee-operations").outerHeight() / 2) - (containerHeight / 2); + // $('.screen-view .buttons-container').css({ + // left: containerLeft, + // top: containerTop + // }); + //} + function locateButtonContainerMobile() { + var beforePosition = $(".mobile-view .employee-operations").position(); + var containerWidth = $('.mobile-view .buttons-container').outerWidth(); + var containerHeight = $('.mobile-view .buttons-container').outerHeight(); + var containerLeft = beforePosition.left + $(".mobile-view .employee-operations").outerWidth() + 20; + var containerTop = beforePosition.top + ($(".mobile-view .employee-operations").outerHeight() / 2) - (containerHeight / 2); + $('.mobile-view .buttons-container').css({ + left: containerLeft, + top: containerTop + }); + } + + + var container = $('#emp'); + var searchBox = $('#empSearch'); + var hiddenInputVal = $('.sendEmployeeId'); + var searchResul = $('.searchResult'); + var mixContainerAndSerchResult = $('#emp , .searchResult'); + + container.hide(); + var liList; + var liPointer; + let count = 0; + + //close search Employee when click on body + $(document).on('click', function (event) { + if (!$(event.target).closest(container).length) { + container.hide(); + } + }); + //select option by mouse + function selectItem(id, employeeFullName) { + searchBox.val(employeeFullName); + hiddenInputVal.val(id); + container.hide(); + searchBox.addClass("selectedOption"); + }; + //search by Ajax + searchBox.on('keyup keypress', + function(e) { + + //------chageByHeydari------- + if($(this).val()=='') + { + $("#SearchModel_EmployeeId").val("0"); + $("#SearchModel_EmployeeName").val(''); + } + //------EndchageByHeydari------- + + + + //stop submit form with enter + var keyCode = e.keyCode || e.which; + if (keyCode === 13) { + e.preventDefault(); + if(count > 0 && count <= liList.length) { + liPointer.click(); + } + return false; + } + + searchBox.removeClass("selectedOption"); + + + let searchText = $(this).val(); + hiddenInputVal.val(0); + + if (searchText.length > 1) { + + $.ajax({ + async: false, + contentType: 'charset=utf-8', + dataType: 'json', + type: 'GET', + url: personelMainListAjaxUrl, + data: { "searchEmployee": searchText }, + headers: { "RequestVerificationToken": $(antiForgeryToken).val() }, + + success: function(response) { + $(".opt").remove(); + if (response.mylist.length > 0) {//result Founded + + $(".noResult").remove(); + container.show(); + $.each(response.mylist, + function(i, item) { + let li = `
  • ${item.employeeFullName}
  • `; + searchResul.append(li); + + }); + } else {//result NotFounded + + $(".noResult").remove(); + container.show(); + let noResult = `
  • نتیجه ای یافت نشد
  • `; + searchResul.append(noResult); + } + }// endOfSuccess + + }); //endOfAjax + + } else { + container.hide(); + count =0; + } + //keyboard Arrow Key Select And Enter + liList = $('#emp ul li'); + mixContainerAndSerchResult.animate({ + scrollTop: $(liList.eq(0)).offset().top - container.offset().top + container.scrollTop() + }, + 50); + if (e.which === 40) {// if ArrowUp + if (count > 0 && count <= liList.length) { + + liPointer.removeClass('keyboardSelected'); + console.log(count + "plusOne"); + liList.eq(count).addClass('keyboardSelected'); + liPointer = liList.eq(count); + if (count > 4) { + //ScrollDown + mixContainerAndSerchResult.animate({ + scrollTop: $(liPointer).offset().top - container.offset().top + container.scrollTop() + }, + 50); + } + count += 1; + + } else { + + liList.eq(0).addClass("keyboardSelected"); + liPointer = liList.eq(0); + count = 1; + } + }else if(e.which === 38) {//if ArrowDown + if(count > 0 && count <= liList.length) { + liPointer.removeClass('keyboardSelected'); + count -= 1; + liList.eq(count).addClass('keyboardSelected'); + liPointer = liList.eq(count); + //ScrollUp + mixContainerAndSerchResult.animate({ + scrollTop: $(liPointer).offset().top - container.offset().top + container.scrollTop() + }, + 50); + } + } + }); + + + + $('.activer').on('change', + function (e) { + e.preventDefault(); + $('.search').click(); + + }); + + + + + + if (document.getElementById("activing").selectedIndex == 1) { + $('.deact').remove(); + $('.act').append( + ' ' + '' + ' ' + ); + } + if (document.getElementById("activing").selectedIndex == 2) { + $('.deact').remove(); + + + } + $('.persianDateInputa').persianDatepicker({ + format: 'YYYY/MM/DD', + initialValueType: 'persian', + initialValue: false, + /* 'position': [-270, 25],*/ + autoClose: true, + + calendar: { + persian: { + leapYearMode: 'astronomical' + } + } + + }); + $('.persianDateInputb').persianDatepicker({ + format: 'YYYY/MM/DD', + initialValueType: 'persian', + + initialValue: false, + /*'position': [-270, 25],*/ + autoClose: true, + + calendar: { + persian: { + leapYearMode: 'astronomical' + } + } + }); + + + + if (document.getElementById("sercheCheck").value == "false") { + $(document).ready(function () { + $('#datatable').dataTable({ + "lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]], + "aoColumnDefs": [ + { "bSortable": false, "aTargets": [ 9, 10 ] } + + ] + }); + }); + } else { + $(document).ready(function () { + $('#datatable').dataTable( + { + "lengthMenu": [[-1, 10, 50, 100, 25], ["All", 10, 50, 100, 25]], + "aoColumnDefs": [ + { "bSortable": false, "aTargets": [ 9, 10 ] } + + ] + } + ); + }); + } + + + + + + + function selectori(source) { + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + if (document.getElementById("sercheCheck").value == "true") { + checkboxes = document.getElementsByName('foo'); + for (var i = 0, n = checkboxes.length; i < n; i++) { + checkboxes[i].checked = source.checked; + } + } + else if(document.getElementById("sercheCheck").value == "false") { + + $("#checkSelect").prop("checked",false) + swal({ + title: "لطفا در قسمت جستجوی قرارداد یکی از آیتمهای کارگاه،سال یا ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + } + + + + + $('#printAll').on('click', + function () { + + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + + $(".alarm").removeClass('alarm'); + + var workshopId = $("#SearchModel_WorkshopIds").val(); + var year = $("#SearchModel_Year").val(); + var month = $("#SearchModel_Month").val(); + if (year.trim() == "" && workshopId == "0" && $('#sercheCheck').val() === "false") { + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال را انتخاب کنید "); + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و سال را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else{ + + let ids = []; + $("input[name=foo]:checked").each(function () { + var id = $(this).val(); + ids.push(id); + }); + + + // console.log(ids.length); + if (ids.length > 0) { + + if ($('#sercheCheck').val() === "true") { + + var idlist = ""; + $('.foo').each(function() { + if ($(this).is(":checked")) { + + var a = $(this).val(); + var b = a + "+"; + idlist += b; + + } + }); + + var url = contractPrintAllUrl; + window.location.href = url +'?idlist='+ idlist; + + + } + else if($('#sercheCheck').val() === "false") + { + swal({ + title: "لطفا در قسمت جستجوی قرارداد حداقل یکی از آیتمهای کارگاه یا پرسنل را انتخاب نموده و سپس جستجو را کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " لطفا در قسمت جستجوی قرارداد حداقل یکی از آیتمهای کارگاه یا پرسنل را انتخاب نموده و سپس جستجو را کلیک کنید "); + } + } + else { + swal({ + title: "هیچ قراردادی انتخاب نشده است ", + text: "لطفا از تیک های سمت راست جدول، قراردادهای مورد نظر را انتخاب کنید.", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " هیچ قراردادی انتخاب نشده است "); + } + + } + }); + + + function deactiveAll() { + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + swal({ + title: "آیا حذف این قراردادها اطمینان دارید؟", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: false + }, function (isConfirm) { + if (isConfirm) { + let checkboxes2 = document.getElementsByName('foo'); + let url3b = ''; + for (var i2 = 0, n2 = checkboxes2.length; i2 < n2; i2++) { + if (checkboxes2[i2].checked == true) { + var u2 = '&ids=' + checkboxes2[i2].value; + url3b = url3b + u2; + } + } + + let url2B = groupDeActiveUrl; + + window.location.href = url2B + url3b; + + + } + + + }); + //if (document.getElementById("checkSelect").checked == false) { + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " هیچ قراردادی انتخاب نشده است "); + //} else { + // if (document.getElementById("sercheCheck").value == "true") { + // } else if (document.getElementById("sercheCheck").value == "false") { + // console.log(document.getElementById("sercheCheck").value); + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " لطفا در قسمت جستجوی قرارداد حداقل یکی از آیتمهای کارگاه یا پرسنل را انتخاب نموده و سپس جستجو را کلیک کنید "); + // } + //} + + + } + + + + + $('.singleDelet').on("click", + function(parameters) { + + }); + function reActiveAll() { + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + swal({ + title: "آیا فعال نمودن این قراردادها اطمینان دارید؟", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: false + }, function (isConfirm) { + if (isConfirm) { + var checkboxes2 = document.getElementsByName('foo'); + let url3B = ''; + for (var i2 = 0, n2 = checkboxes2.length; i2 < n2; i2++) { + if (checkboxes2[i2].checked == true) { + var u2 = '&ids=' + checkboxes2[i2].value; + url3B = url3B + u2; + } + } + + let url2B = groupReActiveUrl; + + window.location.href = url2B + url3B; + + + + } + + + }); + //if (document.getElementById("checkSelect").checked == false) { + + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " هیچ قراردادی انتخاب نشده است "); + + + //} else { + + // if (document.getElementById("sercheCheck").value == "false") { + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " لطفا در قسمت جستجوی قرارداد حداقل یکی از آیتمهای کارگاه یا پرسنل را انتخاب نموده و سپس جستجو را کلیک کنید "); + + // } else if (document.getElementById("sercheCheck").value == "true") { + + + + // } + + + //} + + + } + + + + function SignatureSelect() { + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + if (document.getElementById("sercheCheck").value == "false") { + + swal({ + title: "لطفا در قسمت جستجوی قرارداد حداقل یکی از آیتمهای کارگاه یا پرسنل را انتخاب نموده و سپس جستجو را کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.notify('error', 'top center', 'پیام سیستم ', " لطفا در قسمت جستجوی قرارداد حداقل یکی از آیتمهای کارگاه یا پرسنل را انتخاب نموده و سپس جستجو را کلیک کنید "); + } else if (document.getElementById("sercheCheck").value == "true") { + + swal({ + title: "آیا از امضاء نمودن این قراردادها اطمینان دارید؟", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: false + }, function (isConfirm) { + if (isConfirm) { + /* $("a.dell").click();*/ + checkboxes2 = document.getElementsByName('unsigned'); + var url3b = ''; + for (var i2 = 0, n2 = checkboxes2.length; i2 < n2; i2++) { + + var u2 = '&ids=' + checkboxes2[i2].value; + url3b = url3b + u2; + + } + + var url2b = groupSignUrl; + + window.location.href = url2b + url3b; + + + } else { + + } + + + }); + + } + + } + + + function SignatureSelect2() { + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + if (document.getElementById("sercheCheck").value == "false") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد حداقل یکی از آیتمهای کارگاه،سال یا ماه را انتخاب نموده و سپس روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " لطفا در قسمت جستجوی قرارداد حداقل یکی از آیتمهای کارگاه یا پرسنل را انتخاب نموده و سپس جستجو را کلیک کنید "); + } else if (document.getElementById("sercheCheck").value == "true") { + + swal({ + title: "آیا حذف امضاء این قراردادها اطمینان دارید؟", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: false + }, function (isConfirm) { + if (isConfirm) { + /* $("a.dell").click();*/ + checkboxes2 = document.getElementsByName('signed'); + var url3b = ''; + for (var i2 = 0, n2 = checkboxes2.length; i2 < n2; i2++) { + + var u2 = '&ids=' + checkboxes2[i2].value; + url3b = url3b + u2; + + } + + var url2b = groupUnSignUrl; + + window.location.href = url2b + url3b; + + + } else { + + } + + + }); + + + + } + + } + + + + $(document).ready(function() { + $('.myLinkSign').click(function (event) { + if ($(this).hasClass("disabled") === false) { + signAjax(event, this); + } + + }); + }); + function signAjax(event, element) { + event.preventDefault(); + + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + if ($(element).find('input[name="unsigned"]').length > 0) {// اگر بدون امضاء بود به امضاء دار تبدیل شود + + + var signId = $(element).find('input[name="unsigned"]').val(); + + + $.ajax({ + contentType: 'charset=utf-8', + dataType: 'json', + type: 'GET', + url: signAjaxUrl, + headers: { "RequestVerificationToken": $(antiForgeryToken).val() }, + data: { "Id": signId }, + success: function (response) { + $(".alarm").removeClass('alarm'); + var items2 = []; + $.each(response, function (key, val) { + items2.push({ id: key, vall: val }); + + }); + let check = items2[0].vall; + if (check === true) { + $(element).find('i').replaceWith(''); + + // تغییر name در تگ input + $(element).find('input[name="unsigned"]').attr('name', 'signed'); + + } + } + }); + + } else if ($(element).find('input[name="signed"]').length > 0) {//اگر امضاء شده بود به بدون امضاء تبدیل شود + + + var unsignId = $(element).find('input[name="signed"]').val(); + + $.ajax({ + contentType: 'charset=utf-8', + dataType: 'json', + type: 'GET', + url: unSignAjaxUrl, + headers: { "RequestVerificationToken": $(antiForgeryToken).val() }, + data: { "Id": unsignId }, + success: function (response) { + $(".alarm").removeClass('alarm'); + var items2 = []; + $.each(response, function (key, val) { + items2.push({ id: key, vall: val }); + + }); + let check = items2[0].vall; + if (check === true) { + $(element).find('i').replaceWith(''); + + // تغییر name در تگ input + $(element).find('input[name="signed"]').attr('name', 'unsigned'); + + } + } + }); + } + + + } + + + //------------new Change--------------- + + $(".btn-searchContract").click(function () { + if ($("#SearchModel_EmployeeId").val()=="0") + $("#SearchModel_EmployeeName").val($("#empSearch").val()) + $("#btnSearch").click(); + }); + + + + function deleteAll() { + + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + var workshopId = Number($("#SearchModel_WorkshopIds").val()); + var year = $("#SearchModel_Year").val(); + var month = $("#SearchModel_Month").val(); + if (year.trim() == "" && workshopId == "0") { + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال را انتخاب کنید "); + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و سال را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else if (year.trim() == "" && workshopId != "0") { + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم سال را انتخاب کنید "); + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتم سال را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else if (year.trim() != "" && workshopId == "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتم کارگاه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم کارگاه را انتخاب کنید "); + } + else{ + let ids = []; + $("input[name=foo]:checked").each(function () { + var id = $(this).val(); + ids.push(id); + }); + if (ids.length == 0) { + swal({ + title: "هیچ قراردادی انتخاب نشده است ", + text: "لطفا از تیک های سمت راست جدول، قراردادهای مورد نظر را انتخاب کنید.", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " هیچ قراردادی انتخاب نشده است "); + } + else if (document.getElementById("sercheDeleteCheck").value == "false") { + swal({ + title: "لطفا روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else { + swal({ + title: "آیا حذف قراردادهای انتخاب شده اطمینان دارید؟", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: false, + closeOnCancel: true + }, function (isConfirm) { + if (isConfirm) { + $.ajax({ + async:false, + dataType: 'json', + type: 'POST', + url: deleteAllContarctsAjaxUrl, + headers: { "RequestVerificationToken": $(antiForgeryToken).val() }, + data: { "ids": ids, "workshopId": workshopId }, + success: function (response) { + console.log(response); + $(".alarm").removeClass('alarm'); + if (response.hasCheckout) { + + for (var index = 0; index < response.checkoutList.length; index++) { + $("#tr_" + response.checkoutList[index]).addClass('alarm'); + } + swal({ + title: "به دلیل داشتن تصفیه حساب در خصوص قراردادهای انتخاب شده، حذف موارد امکان پذیر نمی باشد.", + text: "برای حذف قراردادهای انتخابی، ابتدا تصفیه حساب های مربوط به این قراردادها را حذف نمایید.", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: true, + closeOnCancel: true, + customClass: "warningSwall" + }); + //$.Notification.notify('error', 'top center', 'پیام سیستم ', "به دلیل داشتن تصفیه حساب در قراردادهای مشخص شده حذف امکان پذیر نمی باشد،ابتدا تصفیه حساب قراردادهای موردنظر را حذف نمایید"); + } + else if (response.hasSignature) { + swal({ + title: "این قراردادها به امضای طرفین رسیده است. ", + text: "برای حذف قراردادها، ابتدا تیک مربوط به امضای قراردادها را حذف نمایید.", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + closeOnCancel: true, + customClass: "errorSwall" + }); + for (var index = 0; index < response.signatureList.length; index++) { + $("#td_" + response.signatureList[index]).addClass('alarm'); + } + //$.Notification.notify('error', 'top center', 'پیام سیستم ', "به دلیل داشتن امضا در قراردادهای مشخص شده حذف امکان پذیر نمی باشد،ابتدا امضای قراردادهای موردنظر را حذف نمایید"); + } + else if (response.successDelete) { + swal({ + title: "حذف قراردادهای انتخاب شده با موفقیت انجام شد.", + text: "", + type: "success", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بستن", + //cancelButtonText: "خیر", + closeOnConfirm: true, + customClass: "successSwall" + }, + function (isConfirm) { + if (isConfirm) { + $(".btn-searchContract").click(); + } + }); + + } + else if (!response.successDelete) { + swal({ + title: "حذف قراردادهای انتخاب شده با خطا مواجه شد ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + closeOnCancel: true, + customClass: "errorSwall" + }); + // $.Notification.notify('error', 'top center', 'پیام سیستم ', "حذف قراردادهای انتخاب شده با خطا مواجه شد."); + } + }, + failure: function (response) { + //console.log(5, response); + } + }); + } + }); + } + } + } + + function removeContract(element,id) { + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + swal({ + title: "توجه داشته باشید با تایید این پیام، اطلاعات لیست مورد نظر بطور کامل از بانک اطلاعاتی حذف خواهد شد.", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: false, + closeOnCancel: true + }, function (isConfirm) { + if (isConfirm) { + $(".alarm").removeClass('alarm'); + $.ajax({ + async: false, + dataType: 'json', + type: 'POST', + url: deleteContarctsAjaxUrl, + headers: { "RequestVerificationToken": $(antiForgeryToken).val() }, + data: { "id": id }, + success: function (response) { + console.log(response); + if (response.hasCheckout) { + $("#tr_" + id).addClass('alarm'); + swal({ + title: "به دلیل داشتن تصفیه حساب در خصوص قرارداد، حذف امکان پذیر نمی باشد.", + text: "برای حذف قرارداد، ابتدا تصفیه حساب های مربوط به این قرارداد را حذف نمایید.", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: true, + closeOnCancel: true, + customClass: "warningSwall" + }); + //$.Notification.notify('error', 'top center', 'پیام سیستم ', "به دلیل داشتن تصفیه حساب در قراردادهای مشخص شده حذف امکان پذیر نمی باشد،ابتدا تصفیه حساب قراردادهای موردنظر را حذف نمایید"); + } + else if (response.hasSignature) { + swal({ + title: "این قرارداد به امضای طرفین رسیده است. ", + text: "برای حذف قرارداد، ابتدا تیک مربوط به امضای قرارداد را حذف نمایید.", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + closeOnCancel: true, + customClass: "errorSwall" + }); + $("#td_" + id).addClass('alarm'); + } + else if (response.successDelete) { + swal({ + title: "حذف قرارداد با موفقیت انجام شد.", + text: "", + type: "success", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بستن", + //cancelButtonText: "خیر", + closeOnConfirm: true, + customClass: "successSwall" + }, + function (isConfirm) { + if (isConfirm) { + $(".btn-searchContract").click(); + } + }); + + } + else if (!response.successDelete) { + swal({ + title: "حذف قرارداد با خطا مواجه شد ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + closeOnCancel: true, + customClass: "errorSwall" + }); + // $.Notification.notify('error', 'top center', 'پیام سیستم ', "حذف قراردادهای انتخاب شده با خطا مواجه شد."); + } + }, + failure: function (response) { + console.log(5, response) + } + }); + } + }); + } + + function resetNumber(){ + $('#datatable').find('tbody tr').each(function (index) { + $(this).find('td:eq(0)').text(index + 1); + }); + + } + function signatureAll() { + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + var workshopId = Number($("#SearchModel_WorkshopIds").val()); + var year = $("#SearchModel_Year").val(); + var month = $("#SearchModel_Month").val(); + var employeeSearch = $("#empSearch").val(); + + //if (employeeSearch != '' && workshopId != "0") { + // در صورتیکه پرسنل و کارگاه سرچ شد، نیاز به انتخاب سال و ماه نباشد + // swal({ + // title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه، سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + // text: "", + // type: "warning", + // showCancelButton: true, + // confirmButtonColor: "#DD6B55", + // //confirmButtonText: "بستن", + // cancelButtonText: "بستن", + // closeOnConfirm: false, + // customClass: "errorSwall" + // }); + // } + // else{ + if (year.trim() == "" && month.trim() == "" && workshopId == "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه، سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال , ماه را انتخاب کنید "); + } + else if (year.trim() == "" && month.trim() == "" && workshopId != "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای سال و ماه را انتخاب کنید "); + } + else if (year.trim() != "" && month.trim() == "" && workshopId == "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و ماه را انتخاب کنید "); + } + else if (year.trim() == "" && month.trim() != "" && workshopId == "0") { + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال را انتخاب کنید "); + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و سال را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else if (year.trim() != "" && month.trim() == "" && workshopId != "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتم ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم ماه را انتخاب کنید "); + } + else if (year.trim() != "" && month.trim() != "" && workshopId == "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتم کارگاه را انتخاب نموده و روی کلید جستجو کلیک کنید ",//"ابتدا آیتم کارگاه را انتخاب کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم کارگاه را انتخاب کنید "); + } + else if (year.trim() == "" && month.trim() != "" && workshopId != "0") { + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم سال را انتخاب کنید "); + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتم سال را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else { + let ids = []; + $("input[name=foo]:checked").each(function () { + var id = $(this).val(); + ids.push(id); + }); + if (ids.length == 0) { + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " هیچ قراردادی انتخاب نشده است "); + swal({ + title: "هیچ قراردادی انتخاب نشده است ", + text: "لطفا از تیک های سمت راست جدول، قراردادهای مورد نظر را انتخاب کنید.", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + + } + else if (document.getElementById("sercheSignCheck").value == "false") { + swal({ + title: "لطفا روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else { + swal({ + title: "آیا امضای قراردادهای انتخاب شده اطمینان دارید؟", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: false, + closeOnCancel: true + }, function (isConfirm) { + if (isConfirm) { + $(".alarm").removeClass('alarm'); + $.ajax({ + async: false, + dataType: 'json', + type: 'POST', + url: signatureAllAjaxUrl, + headers: { "RequestVerificationToken": $(antiForgeryToken).val() }, + data: { "ids": ids, "workshopId" : workshopId}, + success: function (response) { + console.log(response); + if(response.isSuccedded){ + swal({ + title: "امضای قراردادهای انتخاب شده با موفقیت انجام شد ", + text: "", + type: "success", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بستن", + cancelButtonText: "خیر", + closeOnConfirm: true, + customClass: "successSwall" + }, + function(isConfirm) { + if (isConfirm) { + for (var index = 0; index < ids.length; index++) { + $("#td_" + ids[index]).html('' + + ' ' + + '' + + ''); + } + $('.myLinkSign').click(function (event) { + signAjax(event, this); + }); + } + }); + } + //$.Notification.notify('success', 'top center', 'پیام سیستم ', " امضای قراردادهای انتخاب شده با موفقیت انجام شد."); + else + //$.Notification.notify('error', 'top center', 'پیام سیستم ', " امضای قراردادهای انتخاب شده با خطا مواجه شد."); + { + swal({ + title: "امضای قراردادهای انتخاب شده با خطا مواجه شد ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + } + , + failure: function (response) { + //console.log(5, response); + } + }); + } + }); + } + } + // } + + } + + function deleteAllSignature() { + $('.sweet-alert').removeClass("successSwall"); + $('.sweet-alert').removeClass("errorSwall"); + var workshopId = Number($("#SearchModel_WorkshopIds").val()); + var year = $("#SearchModel_Year").val(); + var month = $("#SearchModel_Month").val(); + if (year.trim() == "" && month.trim() == "" && workshopId == "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه، سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال , ماه را انتخاب کنید "); + } + else if (year.trim() == "" && month.trim() == "" && workshopId != "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای سال و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای سال و ماه را انتخاب کنید "); + } + else if (year.trim() != "" && month.trim() == "" && workshopId == "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و ماه را انتخاب کنید "); + } + else if (year.trim() == "" && month.trim() != "" && workshopId == "0") { + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتمهای کارگاه و سال را انتخاب کنید "); + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتمهای کارگاه و سال را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else if (year.trim() != "" && month.trim() == "" && workshopId != "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتم ماه را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم ماه را انتخاب کنید "); + } + else if (year.trim() != "" && month.trim() != "" && workshopId == "0") { + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتم کارگاه را انتخاب نموده و روی کلید جستجو کلیک کنید ",//"ابتدا آیتم کارگاه را انتخاب کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم کارگاه را انتخاب کنید "); + } + else if (year.trim() == "" && month.trim() != "" && workshopId != "0") { + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا آیتم سال را انتخاب کنید "); + swal({ + title: "لطفا در قسمت جستجوی قرارداد آیتم سال را انتخاب نموده و روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else { + let ids = []; + $("input[name=foo]:checked").each(function () { + var id = $(this).val(); + ids.push(id); + }); + if (ids.length == 0) { + swal({ + title: "هیچ قراردادی انتخاب نشده است ", + text: "لطفا از تیک های سمت راست جدول، قراردادهای مورد نظر را انتخاب کنید.", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + //$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " هیچ قراردادی انتخاب نشده است "); + } + else if (document.getElementById("sercheSignCheck").value == "false") { + swal({ + title: "لطفا روی کلید جستجو کلیک کنید ", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + else { + swal({ + title: "آیا از حذف امضای قراردادهای انتخاب شده اطمینان دارید؟", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: false, + closeOnCancel: true + }, function (isConfirm) { + if (isConfirm) { + $(".alarm").removeClass('alarm'); + $.ajax({ + async: false, + dataType: 'json', + type: 'POST', + url: deleteAllSignatureAjaxUrl, + headers: { "RequestVerificationToken": $(antiForgeryToken).val() }, + data: { "ids": ids, "workshopId" : workshopId}, + success: function (response) { + if(response.isSuccedded) + { + //$.Notification.notify('success', 'top center', 'پیام سیستم ', "حذف امضای قراردادهای انتخاب شده با موفقیت انجام شد."); + swal({ + title: "حذف امضای قراردادهای انتخاب شده با موفقیت انجام شد ", + text: "", + type: "success", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بستن", + //cancelButtonText: "خیر", + closeOnConfirm: true, + customClass: "successSwall" + }, + function(isConfirm) { + if (isConfirm) { + for (var index = 0; index < ids.length; index++) { + $("#td_" + ids[index]).html('' + + ' '+ + '' + + ''); + } + $('.myLinkSign').click(function (event) { + signAjax(event, this); + }); + } + }); + + } + else + { + swal({ + title: "حذف امضای قراردادهای انتخاب شده با خطا مواجه شد", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + //confirmButtonText: "بستن", + cancelButtonText: "بستن", + closeOnConfirm: false, + customClass: "errorSwall" + }); + } + + } + , + failure: function (response) { + //console.log(5, response); + } + }); + } + }); + } + } + } + $("#empSearch").keypress(function (event) { + if (event.keyCode === 13) { + if ($("#SearchModel_EmployeeId").val() == "0") + $("#SearchModel_EmployeeName").val($("#empSearch").val()) + $("#btnSearch").click(); + } + }); + + //------------End new Change--------------- + + \ No newline at end of file From bb2802002abfc2567788dced70bfac76bd6f680e Mon Sep 17 00:00:00 2001 From: SamSys Date: Tue, 13 May 2025 17:59:27 +0330 Subject: [PATCH 2/3] delete some No Useable file in Admin\Contracts --- .../Pages/Company/Contracts/Create.cshtml | 1921 ----------------- .../Admin/Pages/Company/Contracts/Edit.cshtml | 1706 --------------- .../Company/Contracts/EditLeftWork.cshtml | 148 -- .../Contracts/EnterLeftWorkDate.cshtml | 150 -- .../Pages/Company/Contracts/Extension.cshtml | 1885 ---------------- .../Pages/Company/Contracts/LeftWork.cshtml | 388 ---- 6 files changed, 6198 deletions(-) delete mode 100644 ServiceHost/Areas/Admin/Pages/Company/Contracts/Create.cshtml delete mode 100644 ServiceHost/Areas/Admin/Pages/Company/Contracts/Edit.cshtml delete mode 100644 ServiceHost/Areas/Admin/Pages/Company/Contracts/EditLeftWork.cshtml delete mode 100644 ServiceHost/Areas/Admin/Pages/Company/Contracts/EnterLeftWorkDate.cshtml delete mode 100644 ServiceHost/Areas/Admin/Pages/Company/Contracts/Extension.cshtml delete mode 100644 ServiceHost/Areas/Admin/Pages/Company/Contracts/LeftWork.cshtml diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Create.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/Create.cshtml deleted file mode 100644 index 6d8c774b..00000000 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Create.cshtml +++ /dev/null @@ -1,1921 +0,0 @@ -@model CompanyManagment.App.Contracts.Contract.CreateContract -@*@inject CompanyManagment.App.Contracts.Contract.ComputingViewModel computingViewModel;*@ -@{ - - - - -} - - - - - - - - - - - - - - -@*--> -@**@ - - -@* - *@ \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Edit.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/Edit.cshtml deleted file mode 100644 index 700df88a..00000000 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Edit.cshtml +++ /dev/null @@ -1,1706 +0,0 @@ -@model CompanyManagment.App.Contracts.Contract.EditContract -@*@inject CompanyManagment.App.Contracts.Contract.ComputingViewModel computingViewModel;*@ -@{ - - @**@ - - - - -} - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditLeftWork.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditLeftWork.cshtml deleted file mode 100644 index c5717d99..00000000 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditLeftWork.cshtml +++ /dev/null @@ -1,148 +0,0 @@ -@model CompanyManagment.App.Contracts.LeftWork.EditLeftWork -@{ -} - - - - - \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/EnterLeftWorkDate.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/EnterLeftWorkDate.cshtml deleted file mode 100644 index 04664658..00000000 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/EnterLeftWorkDate.cshtml +++ /dev/null @@ -1,150 +0,0 @@ -@model CompanyManagment.App.Contracts.LeftWork.EditLeftWork -@{ -} - - - - - - \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Extension.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/Extension.cshtml deleted file mode 100644 index a76c5236..00000000 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/Extension.cshtml +++ /dev/null @@ -1,1885 +0,0 @@ -@model CompanyManagment.App.Contracts.Contract.ExtensionViewModel - - -@{ - - -} -@{ - - - - - - - - - -} -@{ - -} -
    - - - -
    - - - - - - - - - - - -@**@ -@**@ - - - - - - \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/LeftWork.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/LeftWork.cshtml deleted file mode 100644 index fe5e0ebf..00000000 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/LeftWork.cshtml +++ /dev/null @@ -1,388 +0,0 @@ -@model CompanyManagment.App.Contracts.LeftWork.CreateLeftWork -@{ - var i = 1; - - -} -@{ - - -} - - - - - - - - - - - - \ No newline at end of file From 521aa9b6eea7502a383a38826873b058ea33a5d3 Mon Sep 17 00:00:00 2001 From: SamSys Date: Tue, 13 May 2025 18:34:50 +0330 Subject: [PATCH 3/3] Sepration js Admin\Contracts All --- .../Company/Contracts/EditPaidLeave.cshtml | 410 +------------- .../Pages/Company/Contracts/EditSick.cshtml | 341 +----------- .../Pages/Company/Contracts/PaidLeave.cshtml | 502 +----------------- .../Pages/Company/Contracts/SickLeave.cshtml | 361 +------------ .../page/Contracts/js/editPaidLeave.js | 405 ++++++++++++++ .../page/Contracts/js/editSickLeave.js | 339 ++++++++++++ .../page/Contracts/js/paidLeave.js | 492 +++++++++++++++++ .../page/Contracts/js/sickLeave.js | 361 +++++++++++++ 8 files changed, 1615 insertions(+), 1596 deletions(-) create mode 100644 ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/editPaidLeave.js create mode 100644 ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/editSickLeave.js create mode 100644 ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/paidLeave.js create mode 100644 ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/sickLeave.js diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditPaidLeave.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditPaidLeave.cshtml index c72a3c3f..9933ffe4 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditPaidLeave.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditPaidLeave.cshtml @@ -1,6 +1,7 @@ @model CompanyManagment.App.Contracts.Leave.EditLeave @{ - //int i = 1; + + string adminVersion = _0_Framework.Application.Version.AdminVersion; } @{ + - - $('#save').on('click', - function() { - $("#descriptionAcceptedCheck").on("change", - function() { - $('#descriptionAcceptedCheck').removeClass('errored'); - }); - - const IsAcceptedCheck = $('#IsAccepted').is(':checked'); - const descriptionAcceptedCheck = $('#descriptionAcceptedCheck').val(); - if (!IsAcceptedCheck && descriptionAcceptedCheck.length === 0) { - $('#descriptionAcceptedCheck').addClass('errored'); - $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا توضیحات در صورت عدم موافقت را پر کنید."); - return; - } - - if ($('.errored').length < 1 && $('.invalidTime').length < 1) { - $('#editFinaly').click(); - } - }); - $(".date").mask("0000/00/00"); - $('.date').on('input', - function() { - const startDate = this.value; - if (startDate.length == 10) { - const submitcheck = dateValidcheck(this); - if (submitcheck) { - - $(this).removeClass('errored'); - if ($('#startLeave').val() != '' && $('#endLeave').val() != '') { - computeDays(); - } - - } else { - $(this).addClass('errored'); - - } - - } else { - $(this).addClass('errored'); - } - }); - /////////////////Time Input Validatet///////////////// - - $('#StartHoure').on("keyup", - function() { - const isValid = /^([2][0-3]|[1][0-9]|[0-9]|[0][0-9])([:][0-5][0-9])$/.test($(this).val()); - if (isValid) { - $(this).addClass("validTime"); - $(this).removeClass("invalidTime"); - if (!$('#EndHours').hasClass('invalidTime') && $('#EndHours').val() != null) { - computeHourse(); - } - } else { - $(this).removeClass("validTime"); - $(this).addClass("invalidTime"); - } - }); - $('#EndHours').on("keyup", - function() { - const isValid = /^([2][0-3]|[1][0-9]|[0-9]|[0][0-9])([:][0-5][0-9])$/.test($(this).val()); - if (isValid) { - $(this).addClass("validTime"); - $(this).removeClass("invalidTime"); - if (!$('#StartHoure').hasClass('invalidTime') && $('#StartHoure').val() != null) { - computeHourse(); - } - } else { - $(this).removeClass("validTime"); - $(this).addClass("invalidTime"); - } - }); - - function computeHourse() { - $('.res').remove(); - $.ajax({ - /* contentType: 'charset=utf-8',*/ - async: false, - dataType: 'json', - type: 'GET', - url: '@Url.Page("/Company/Contracts/Index", "ComputeLeavHourse")', - headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, - data: { "startHours": $('#StartHoure').val(), "endHourse": $('#EndHours').val() }, - success: function(response) { - const res = `  :  ${response.res}`; - $('.sumHours').append(res); - }, - failure: function(response) { - console.log(5, response); - } - }); - } - - function computeDays() { - $('.resultDays').remove(); - $.ajax({ - /* contentType: 'charset=utf-8',*/ - async: false, - dataType: 'json', - type: 'GET', - url: '@Url.Page("/Company/Contracts/Index", "ComputeLeavdays")', - headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, - data: { "startDay": $('#startLeave').val(), "endDay": $('#endLeave').val() }, - success: function(response) { - const res = `  :  ${response.res}`; - $('.sumDays').append(res); - }, - failure: function(response) { - console.log(5, response); - } - }); - } - - function dateValidcheck(inputField1) { - - const persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g]; - const arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g]; - const fixNumbers = function(str) { - if (typeof str === 'string') { - for (let i = 0; i < 10; i++) { - str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); - } - } - return str; - }; - const getdate = inputField1.value; - - let m1, m2; - let y1, y2, y3, y4; - let d1, d2; - let s1, s2; - for (let i = 0; i < getdate.length; i++) { - if (i === 0) { - y1 = fixNumbers(getdate[i]); - } - if (i === 1) { - y2 = fixNumbers(getdate[i]); - } - if (i === 2) { - y3 = fixNumbers(getdate[i]); - } - if (i === 3) { - y4 = fixNumbers(getdate[i]); - } - if (i === 4) { - s1 = fixNumbers(getdate[i]); - } - if (i === 5) { - m1 = fixNumbers(getdate[i]); - } - if (i === 6) { - m2 = fixNumbers(getdate[i]); - } - if (i === 7) { - s2 = fixNumbers(getdate[i]); - } - if (i === 8) { - d1 = fixNumbers(getdate[i]); - } - if (i === 9) { - d2 = fixNumbers(getdate[i]); - } - - } - const yRes = y1 + y2 + y3 + y4; - const year = parseInt(yRes); - const mRes = m1 + m2; - const month = parseInt(mRes); - const dRes = d1 + d2; - const day = parseInt(dRes); - const fixResult = yRes + s1 + mRes + s2 + dRes; - const test1 = checkEnValid(inputField1.value); - - const isValid = /^([1][3-4][0-9][0-9][/])([0][1-9]|[1][0-2])([/])([0][1-9]|[1-2][0-9]|[3][0-1])$/.test(fixResult); - - - if (isValid && test1) { - // inputField1.style.backgroundColor = '#a6e9a6'; - start1valid = true; - - - } else { - - if (inputField1.value != "") { - // inputField1.style.backgroundColor = '#f94c4c'; - $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا تاریخ را بصورت صحیح وارد کنید"); - start1valid = false; - } - - - } - return start1valid; - - } - - function checkEnValid(fixDate1) { - - let persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], - arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g], - fixNumbers = function(str) { - if (typeof str === 'string') { - for (let i = 0; i < 10; i++) { - str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); - } - } - return str; - }; - let getdate = fixDate1; - - let m1, m2; - let y1, y2, y3, y4; - let d1, d2; - for (let i = 0; i < getdate.length; i++) { - if (i === 0) { - y1 = fixNumbers(getdate[i]); - } - if (i === 1) { - y2 = fixNumbers(getdate[i]); - } - if (i === 2) { - y3 = fixNumbers(getdate[i]); - } - if (i === 3) { - y4 = fixNumbers(getdate[i]); - } - if (i === 5) { - m1 = fixNumbers(getdate[i]); - } - if (i === 6) { - m2 = fixNumbers(getdate[i]); - } - if (i === 8) { - d1 = fixNumbers(getdate[i]); - } - if (i === 9) { - d2 = fixNumbers(getdate[i]); - } - - } - let yRes = y1 + y2 + y3 + y4; - let year = parseInt(yRes); - let mRes = m1 + m2; - let month = parseInt(mRes); - let dRes = d1 + d2; - let day = parseInt(dRes); - let kabiseh = false; - if (month <= 6 && day > 31) { - return false; - } else if (month > 6 && month < 12 && day > 30) { - return false; - } else if (month === 12) { - - switch (year) { - case 1346: - kabiseh = true; - break; - case 1350: - kabiseh = true; - break; - case 1354: - kabiseh = true; - break; - case 1358: - kabiseh = true; - break; - case 1362: - kabiseh = true; - break; - case 1366: - kabiseh = true; - break; - case 1370: - kabiseh = true; - break; - case 1375: - kabiseh = true; - break; - case 1379: - kabiseh = true; - break; - case 1383: - kabiseh = true; - break; - case 1387: - kabiseh = true; - break; - case 1391: - kabiseh = true; - break; - case 1395: - kabiseh = true; - break; - case 1399: - kabiseh = true; - break; - case 1403: - kabiseh = true; - break; - case 1408: - kabiseh = true; - break; - case 1412: - kabiseh = true; - break; - case 1416: - kabiseh = true; - break; - case 1420: - kabiseh = true; - break; - case 1424: - kabiseh = true; - break; - case 1428: - kabiseh = true; - break; - case 1432: - kabiseh = true; - break; - case 1436: - kabiseh = true; - break; - case 1441: - kabiseh = true; - break; - case 1445: - kabiseh = true; - break; - default: - kabiseh = false; - - } - if (kabiseh == true && day > 30) { - return false; - } else if (kabiseh == false && day > 29) { - return false; - } else { - return true; - } - } else { - return true; - } - - - } - - - \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditSick.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditSick.cshtml index fb140d63..cdd992b4 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditSick.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Contracts/EditSick.cshtml @@ -1,6 +1,7 @@ @model CompanyManagment.App.Contracts.Leave.EditLeave @{ + string adminVersion = _0_Framework.Application.Version.AdminVersion; - - // timeValid = true; - - - // } else { - // inputField.style.backgroundColor = '#f94c4c'; - // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا ساعت را بصورت صحیح وارد کنید"); - // timeValid = false; - // } - // return isValid; - - // } - - - \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Contracts/SickLeave.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Contracts/SickLeave.cshtml index 93e9f3b5..a1061e38 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Contracts/SickLeave.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Contracts/SickLeave.cshtml @@ -1,7 +1,7 @@ @model CompanyManagment.App.Contracts.Leave.CreateLeave @{ var i = 1; - + string adminVersion = _0_Framework.Application.Version.AdminVersion; } @{ @@ -281,363 +281,8 @@ - - $('#save').on('click', - function() { - - $("#descriptionAcceptedCheck").on("change", - function() { - $('#descriptionAcceptedCheck').removeClass('errored'); - }); - - const IsAcceptedCheck = $('#IsAccepted').is(':checked'); - const descriptionAcceptedCheck = $('#descriptionAcceptedCheck').val(); - if (!IsAcceptedCheck && descriptionAcceptedCheck.length === 0) { - $('#descriptionAcceptedCheck').addClass('errored'); - $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا توضیحات در صورت عدم موافقت را پر کنید."); - return; - } - - if ($('.errored').length < 1) { - $('#saveFinaly').click(); - } - }); - $(".date").mask("0000/00/00"); - $('.date').on('input', - function() { - const startDate = this.value; - if (startDate.length == 10) { - const submitcheck = dateValidcheck(this); - if (submitcheck) { - - $(this).removeClass('errored'); - if ($('#startLeave').val() != '' && $('#endLeave').val() != '') { - computeDays(); - } - - } else { - $(this).addClass('errored'); - - } - - } else { - $(this).addClass('errored'); - } - }); - - function dateValidcheck(inputField1) { - - const persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g]; - const arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g]; - const fixNumbers = function(str) { - if (typeof str === 'string') { - for (let i = 0; i < 10; i++) { - str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); - } - } - return str; - }; - const getdate = inputField1.value; - - let m1, m2; - let y1, y2, y3, y4; - let d1, d2; - let s1, s2; - for (let i = 0; i < getdate.length; i++) { - if (i === 0) { - y1 = fixNumbers(getdate[i]); - } - if (i === 1) { - y2 = fixNumbers(getdate[i]); - } - if (i === 2) { - y3 = fixNumbers(getdate[i]); - } - if (i === 3) { - y4 = fixNumbers(getdate[i]); - } - if (i === 4) { - s1 = fixNumbers(getdate[i]); - } - if (i === 5) { - m1 = fixNumbers(getdate[i]); - } - if (i === 6) { - m2 = fixNumbers(getdate[i]); - } - if (i === 7) { - s2 = fixNumbers(getdate[i]); - } - if (i === 8) { - d1 = fixNumbers(getdate[i]); - } - if (i === 9) { - d2 = fixNumbers(getdate[i]); - } - } - const yRes = y1 + y2 + y3 + y4; - const year = parseInt(yRes); - const mRes = m1 + m2; - const month = parseInt(mRes); - const dRes = d1 + d2; - const day = parseInt(dRes); - const fixResult = yRes + s1 + mRes + s2 + dRes; - const test1 = checkEnValid(inputField1.value); - - const isValid = /^([1][3-4][0-9][0-9][/])([0][1-9]|[1][0-2])([/])([0][1-9]|[1-2][0-9]|[3][0-1])$/.test(fixResult); - - if (isValid && test1) { - // inputField1.style.backgroundColor = '#a6e9a6'; - start1valid = true; - } else { - if (inputField1.value != "") { - // inputField1.style.backgroundColor = '#f94c4c'; - $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا تاریخ را بصورت صحیح وارد کنید"); - start1valid = false; - } - } - return start1valid; - } - - function checkEnValid(fixDate1) { - - let persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], - arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g], - fixNumbers = function(str) { - if (typeof str === 'string') { - for (let i = 0; i < 10; i++) { - str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); - } - } - return str; - }; - let getdate = fixDate1; - - let m1, m2; - let y1, y2, y3, y4; - let d1, d2; - for (let i = 0; i < getdate.length; i++) { - if (i === 0) { - y1 = fixNumbers(getdate[i]); - } - if (i === 1) { - y2 = fixNumbers(getdate[i]); - } - if (i === 2) { - y3 = fixNumbers(getdate[i]); - } - if (i === 3) { - y4 = fixNumbers(getdate[i]); - } - if (i === 5) { - m1 = fixNumbers(getdate[i]); - } - if (i === 6) { - m2 = fixNumbers(getdate[i]); - } - if (i === 8) { - d1 = fixNumbers(getdate[i]); - } - if (i === 9) { - d2 = fixNumbers(getdate[i]); - } - - } - let yRes = y1 + y2 + y3 + y4; - let year = parseInt(yRes); - let mRes = m1 + m2; - let month = parseInt(mRes); - let dRes = d1 + d2; - let day = parseInt(dRes); - let kabiseh = false; - if (month <= 6 && day > 31) { - return false; - } else if (month > 6 && month < 12 && day > 30) { - return false; - } else if (month === 12) { - - switch (year) { - case 1346: - kabiseh = true; - break; - case 1350: - kabiseh = true; - break; - case 1354: - kabiseh = true; - break; - case 1358: - kabiseh = true; - break; - case 1362: - kabiseh = true; - break; - case 1366: - kabiseh = true; - break; - case 1370: - kabiseh = true; - break; - case 1375: - kabiseh = true; - break; - case 1379: - kabiseh = true; - break; - case 1383: - kabiseh = true; - break; - case 1387: - kabiseh = true; - break; - case 1391: - kabiseh = true; - break; - case 1395: - kabiseh = true; - break; - case 1399: - kabiseh = true; - break; - case 1403: - kabiseh = true; - break; - case 1408: - kabiseh = true; - break; - case 1412: - kabiseh = true; - break; - case 1416: - kabiseh = true; - break; - case 1420: - kabiseh = true; - break; - case 1424: - kabiseh = true; - break; - case 1428: - kabiseh = true; - break; - case 1432: - kabiseh = true; - break; - case 1436: - kabiseh = true; - break; - case 1441: - kabiseh = true; - break; - case 1445: - kabiseh = true; - break; - default: - kabiseh = false; - - } - if (kabiseh == true && day > 30) { - return false; - } else if (kabiseh == false && day > 29) { - return false; - } else { - return true; - } - } else { - return true; - } - } - - \ No newline at end of file diff --git a/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/editPaidLeave.js b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/editPaidLeave.js new file mode 100644 index 00000000..4a817af6 --- /dev/null +++ b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/editPaidLeave.js @@ -0,0 +1,405 @@ + + $(document).ready(function() { + const IsAcceptedCheck = $('#IsAccepted').is(':checked'); + if (IsAcceptedCheck) { + $('#descriptionAcceptedCheck').removeClass('errored'); + $('#descriptionAcceptedCheck').addClass('disable-input'); + $("#descriptionAcceptedCheck").prop('disabled', true); + } else { + $('#descriptionAcceptedCheck').removeClass('disable-input'); + $("#descriptionAcceptedCheck").prop('disabled', false); + } + }); + + $(document).ready( + function() { + computeHourse(); + const saati = $('input:radio[class="saati"]'); + const roozane = $('input:radio[class="roozane"]'); + if ($(roozane).is(':checked') && $(roozane).val() == 'روزانه') { + + $("#hours").val(''); + $("#hours").attr("disabled", "disabled"); + $("#endLeave").removeAttr("disabled"); + $("#saati").css("visibility", "hidden"); + $('.hourses').css({ + display: "none" + }); + $('.sumHourseDiv').hide(); + $('.sumDaysDiv').show(); + $('.res').remove(); + $('.validTime').removeClass("validTime"); + } else if ($(saati).is(':checked') && $(saati).val() == 'ساعتی') { + + $("#endLeave").val(''); + $("#endLeave").attr("disabled", "disabled"); + $("#endLeave").hide(); + $('.endLeaveLabal').hide(); + $('.hourses').css({ + display: "flex" + }); + $("#hours").removeAttr("disabled"); + $('.sumHourseDiv').show(); + $('#roozaneh').hide(); + $('.sumDaysDiv').hide(); + } + }); + + + + computeDays(); + + $('#save').on('click', + function() { + $("#descriptionAcceptedCheck").on("change", + function() { + $('#descriptionAcceptedCheck').removeClass('errored'); + }); + + const IsAcceptedCheck = $('#IsAccepted').is(':checked'); + const descriptionAcceptedCheck = $('#descriptionAcceptedCheck').val(); + if (!IsAcceptedCheck && descriptionAcceptedCheck.length === 0) { + $('#descriptionAcceptedCheck').addClass('errored'); + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا توضیحات در صورت عدم موافقت را پر کنید."); + return; + } + + if ($('.errored').length < 1 && $('.invalidTime').length < 1) { + $('#editFinaly').click(); + } + }); + $(".date").mask("0000/00/00"); + $('.date').on('input', + function() { + const startDate = this.value; + if (startDate.length == 10) { + const submitcheck = dateValidcheck(this); + if (submitcheck) { + + $(this).removeClass('errored'); + if ($('#startLeave').val() != '' && $('#endLeave').val() != '') { + computeDays(); + } + + } else { + $(this).addClass('errored'); + + } + + } else { + $(this).addClass('errored'); + } + }); + /////////////////Time Input Validatet///////////////// + + $('#StartHoure').on("keyup", + function() { + const isValid = /^([2][0-3]|[1][0-9]|[0-9]|[0][0-9])([:][0-5][0-9])$/.test($(this).val()); + if (isValid) { + $(this).addClass("validTime"); + $(this).removeClass("invalidTime"); + if (!$('#EndHours').hasClass('invalidTime') && $('#EndHours').val() != null) { + computeHourse(); + } + } else { + $(this).removeClass("validTime"); + $(this).addClass("invalidTime"); + } + }); + $('#EndHours').on("keyup", + function() { + const isValid = /^([2][0-3]|[1][0-9]|[0-9]|[0][0-9])([:][0-5][0-9])$/.test($(this).val()); + if (isValid) { + $(this).addClass("validTime"); + $(this).removeClass("invalidTime"); + if (!$('#StartHoure').hasClass('invalidTime') && $('#StartHoure').val() != null) { + computeHourse(); + } + } else { + $(this).removeClass("validTime"); + $(this).addClass("invalidTime"); + } + }); + + function computeHourse() { + $('.res').remove(); + $.ajax({ + /* contentType: 'charset=utf-8',*/ + async: false, + dataType: 'json', + type: 'GET', + url: computeLeavHourseAjaxUrl, + headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, + data: { "startHours": $('#StartHoure').val(), "endHourse": $('#EndHours').val() }, + success: function(response) { + const res = `  :  ${response.res}`; + $('.sumHours').append(res); + }, + failure: function(response) { + console.log(5, response); + } + }); + } + + function computeDays() { + $('.resultDays').remove(); + $.ajax({ + /* contentType: 'charset=utf-8',*/ + async: false, + dataType: 'json', + type: 'GET', + url: computeLeavDaysAjaxUrl, + headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, + data: { "startDay": $('#startLeave').val(), "endDay": $('#endLeave').val() }, + success: function(response) { + const res = `  :  ${response.res}`; + $('.sumDays').append(res); + }, + failure: function(response) { + console.log(5, response); + } + }); + } + + function dateValidcheck(inputField1) { + + const persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g]; + const arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g]; + const fixNumbers = function(str) { + if (typeof str === 'string') { + for (let i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + const getdate = inputField1.value; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + let s1, s2; + for (let i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 4) { + s1 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 7) { + s2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + + } + const yRes = y1 + y2 + y3 + y4; + const year = parseInt(yRes); + const mRes = m1 + m2; + const month = parseInt(mRes); + const dRes = d1 + d2; + const day = parseInt(dRes); + const fixResult = yRes + s1 + mRes + s2 + dRes; + const test1 = checkEnValid(inputField1.value); + + const isValid = /^([1][3-4][0-9][0-9][/])([0][1-9]|[1][0-2])([/])([0][1-9]|[1-2][0-9]|[3][0-1])$/.test(fixResult); + + + if (isValid && test1) { + // inputField1.style.backgroundColor = '#a6e9a6'; + start1valid = true; + + + } else { + + if (inputField1.value != "") { + // inputField1.style.backgroundColor = '#f94c4c'; + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا تاریخ را بصورت صحیح وارد کنید"); + start1valid = false; + } + + + } + return start1valid; + + } + + function checkEnValid(fixDate1) { + + let persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], + arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g], + fixNumbers = function(str) { + if (typeof str === 'string') { + for (let i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + let getdate = fixDate1; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + for (let i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + + } + let yRes = y1 + y2 + y3 + y4; + let year = parseInt(yRes); + let mRes = m1 + m2; + let month = parseInt(mRes); + let dRes = d1 + d2; + let day = parseInt(dRes); + let kabiseh = false; + if (month <= 6 && day > 31) { + return false; + } else if (month > 6 && month < 12 && day > 30) { + return false; + } else if (month === 12) { + + switch (year) { + case 1346: + kabiseh = true; + break; + case 1350: + kabiseh = true; + break; + case 1354: + kabiseh = true; + break; + case 1358: + kabiseh = true; + break; + case 1362: + kabiseh = true; + break; + case 1366: + kabiseh = true; + break; + case 1370: + kabiseh = true; + break; + case 1375: + kabiseh = true; + break; + case 1379: + kabiseh = true; + break; + case 1383: + kabiseh = true; + break; + case 1387: + kabiseh = true; + break; + case 1391: + kabiseh = true; + break; + case 1395: + kabiseh = true; + break; + case 1399: + kabiseh = true; + break; + case 1403: + kabiseh = true; + break; + case 1408: + kabiseh = true; + break; + case 1412: + kabiseh = true; + break; + case 1416: + kabiseh = true; + break; + case 1420: + kabiseh = true; + break; + case 1424: + kabiseh = true; + break; + case 1428: + kabiseh = true; + break; + case 1432: + kabiseh = true; + break; + case 1436: + kabiseh = true; + break; + case 1441: + kabiseh = true; + break; + case 1445: + kabiseh = true; + break; + default: + kabiseh = false; + + } + if (kabiseh == true && day > 30) { + return false; + } else if (kabiseh == false && day > 29) { + return false; + } else { + return true; + } + } else { + return true; + } + + + } + + + + $(document).ready(function() { + setTimeout(function() { + + window.location.hash = "##"; + }, + 1000); + }); diff --git a/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/editSickLeave.js b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/editSickLeave.js new file mode 100644 index 00000000..b601fa3a --- /dev/null +++ b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/editSickLeave.js @@ -0,0 +1,339 @@ + + $(document).ready(function() { + const IsAcceptedCheck = $('#IsAccepted').is(':checked'); + if (IsAcceptedCheck) { + $('#descriptionAcceptedCheck').removeClass('errored'); + $('#descriptionAcceptedCheck').addClass('disable-input'); + $("#descriptionAcceptedCheck").prop('disabled', true); + } else { + $('#descriptionAcceptedCheck').removeClass('disable-input'); + $("#descriptionAcceptedCheck").prop('disabled', false); + } + }); + + $('#save').on('click', + function() { + $("#descriptionAcceptedCheck").on("change", + function() { + $('#descriptionAcceptedCheck').removeClass('errored'); + }); + + const IsAcceptedCheck = $('#IsAccepted').is(':checked'); + const descriptionAcceptedCheck = $('#descriptionAcceptedCheck').val(); + if (!IsAcceptedCheck && descriptionAcceptedCheck.length === 0) { + $('#descriptionAcceptedCheck').addClass('errored'); + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا توضیحات در صورت عدم موافقت را پر کنید."); + return; + } + + if ($('.errored').length < 1) { + $('#editFinaly').click(); + } + }); + $(".date").mask("0000/00/00"); + $('.date').on('input', + function() { + const startDate = this.value; + if (startDate.length == 10) { + const submitcheck = dateValidcheck(this); + if (submitcheck) { + + $(this).removeClass('errored'); + if ($('#startLeave').val() != '' && $('#endLeave').val() != '') { + computeDays(); + } + + } else { + $(this).addClass('errored'); + + } + + } else { + $(this).addClass('errored'); + } + + + }); + + function dateValidcheck(inputField1) { + + const persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g]; + const arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g]; + const fixNumbers = function(str) { + if (typeof str === 'string') { + for (let i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + const getdate = inputField1.value; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + let s1, s2; + for (let i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 4) { + s1 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 7) { + s2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + + } + const yRes = y1 + y2 + y3 + y4; + const year = parseInt(yRes); + const mRes = m1 + m2; + const month = parseInt(mRes); + const dRes = d1 + d2; + const day = parseInt(dRes); + const fixResult = yRes + s1 + mRes + s2 + dRes; + const test1 = checkEnValid(inputField1.value); + + const isValid = /^([1][3-4][0-9][0-9][/])([0][1-9]|[1][0-2])([/])([0][1-9]|[1-2][0-9]|[3][0-1])$/.test(fixResult); + + + if (isValid && test1) { + // inputField1.style.backgroundColor = '#a6e9a6'; + start1valid = true; + + + } else { + + if (inputField1.value != "") { + // inputField1.style.backgroundColor = '#f94c4c'; + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا تاریخ را بصورت صحیح وارد کنید"); + start1valid = false; + } + + + } + return start1valid; + + } + + function checkEnValid(fixDate1) { + + let persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], + arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g], + fixNumbers = function(str) { + if (typeof str === 'string') { + for (let i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + let getdate = fixDate1; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + for (let i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + + } + let yRes = y1 + y2 + y3 + y4; + let year = parseInt(yRes); + let mRes = m1 + m2; + let month = parseInt(mRes); + let dRes = d1 + d2; + let day = parseInt(dRes); + let kabiseh = false; + if (month <= 6 && day > 31) { + return false; + } else if (month > 6 && month < 12 && day > 30) { + return false; + } else if (month === 12) { + + switch (year) { + case 1346: + kabiseh = true; + break; + case 1350: + kabiseh = true; + break; + case 1354: + kabiseh = true; + break; + case 1358: + kabiseh = true; + break; + case 1362: + kabiseh = true; + break; + case 1366: + kabiseh = true; + break; + case 1370: + kabiseh = true; + break; + case 1375: + kabiseh = true; + break; + case 1379: + kabiseh = true; + break; + case 1383: + kabiseh = true; + break; + case 1387: + kabiseh = true; + break; + case 1391: + kabiseh = true; + break; + case 1395: + kabiseh = true; + break; + case 1399: + kabiseh = true; + break; + case 1403: + kabiseh = true; + break; + case 1408: + kabiseh = true; + break; + case 1412: + kabiseh = true; + break; + case 1416: + kabiseh = true; + break; + case 1420: + kabiseh = true; + break; + case 1424: + kabiseh = true; + break; + case 1428: + kabiseh = true; + break; + case 1432: + kabiseh = true; + break; + case 1436: + kabiseh = true; + break; + case 1441: + kabiseh = true; + break; + case 1445: + kabiseh = true; + break; + default: + kabiseh = false; + + } + if (kabiseh == true && day > 30) { + return false; + } else if (kabiseh == false && day > 29) { + return false; + } else { + return true; + } + } else { + return true; + } + + + } + + + $(document).ready(function() { + computeDays(); + const saati = $('input:radio[class="saati"]'); + const roozane = $('input:radio[class="roozane"]'); + if ($(roozane).is(':checked') && $(roozane).val() == 'روزانه') { + $("#hours").val(''); + $("#hours").attr("disabled", "disabled"); + $("#endLeave").removeAttr("disabled"); + $("#saati").css("visibility", "hidden"); + $('.hourses').css({ + display: "none" + }); + $('.sumHourseDiv').hide(); + $('.sumDaysDiv').show(); + $('.res').remove(); + $('.validTime').removeClass("validTime"); + } + }); + + function computeDays() { + $('.resultDays').remove(); + $.ajax({ + /* contentType: 'charset=utf-8',*/ + async: false, + dataType: 'json', + type: 'GET', + url: computeLeavDaysAjaxUrl, + headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, + data: { "startDay": $('#startLeave').val(), "endDay": $('#endLeave').val() }, + success: function(response) { + const res = `  :  ${response.res}`; + $('.sumDays').append(res); + }, + failure: function(response) { + console.log(5, response); + } + }); + } + + $(document).ready(function() { + setTimeout(function() { + + window.location.hash = "##"; + }, + 1000); + }); + + diff --git a/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/paidLeave.js b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/paidLeave.js new file mode 100644 index 00000000..9323c87e --- /dev/null +++ b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/paidLeave.js @@ -0,0 +1,492 @@ + + + $(document).ready(function() { + $(document).on("change", + "#IsAccepted", + function() { + const IsAcceptedCheck = $('#IsAccepted').is(':checked'); + if (IsAcceptedCheck) { + $('#descriptionAcceptedCheck').removeClass('errored'); + $('#descriptionAcceptedCheck').addClass('disable-input'); + $("#descriptionAcceptedCheck").prop('disabled', true); + } else { + $('#descriptionAcceptedCheck').removeClass('disable-input'); + $("#descriptionAcceptedCheck").prop('disabled', false); + } + }); + }); + + $('#save').on('click', + function() { + + $("#descriptionAcceptedCheck").on("change", + function() { + $('#descriptionAcceptedCheck').removeClass('errored'); + }); + + const IsAcceptedCheck = $('#IsAccepted').is(':checked'); + const descriptionAcceptedCheck = $('#descriptionAcceptedCheck').val(); + if (!IsAcceptedCheck && descriptionAcceptedCheck.length === 0) { + $('#descriptionAcceptedCheck').addClass('errored'); + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا توضیحات در صورت عدم موافقت را پر کنید."); + return; + } + + if ($('.errored').length < 1) { + $('#saveFinaly').click(); + } else { + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا خطاها را برطرف کنید"); + } + }); + $(".date").mask("0000/00/00"); + $('.date').on('input', + function() { + const startDate = this.value; + if (startDate.length == 10) { + const submitcheck = dateValidcheck(this); + if (submitcheck) { + + $(this).removeClass('errored'); + if ($('#startLeave').val() != '' && $('#endLeave').val() != '') { + computeDays(); + } + + + } else { + $(this).addClass('errored'); + + } + + } else { + $(this).addClass('errored'); + } + + + }); + + function dateValidcheck(inputField1) { + + const persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g]; + const arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g]; + const fixNumbers = function(str) { + if (typeof str === 'string') { + for (let i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + const getdate = inputField1.value; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + let s1, s2; + for (let i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 4) { + s1 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 7) { + s2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + + } + const yRes = y1 + y2 + y3 + y4; + const year = parseInt(yRes); + const mRes = m1 + m2; + const month = parseInt(mRes); + const dRes = d1 + d2; + const day = parseInt(dRes); + const fixResult = yRes + s1 + mRes + s2 + dRes; + const test1 = checkEnValid(inputField1.value); + + const isValid = /^([1][3-4][0-9][0-9][/])([0][1-9]|[1][0-2])([/])([0][1-9]|[1-2][0-9]|[3][0-1])$/.test(fixResult); + + + if (isValid && test1) { + // inputField1.style.backgroundColor = '#a6e9a6'; + start1valid = true; + + + } else { + + if (inputField1.value != "") { + // inputField1.style.backgroundColor = '#f94c4c'; + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا تاریخ را بصورت صحیح وارد کنید"); + start1valid = false; + } + + + } + return start1valid; + + } + + function checkEnValid(fixDate1) { + + let persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], + arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g], + fixNumbers = function(str) { + if (typeof str === 'string') { + for (let i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + let getdate = fixDate1; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + for (let i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + + } + let yRes = y1 + y2 + y3 + y4; + let year = parseInt(yRes); + let mRes = m1 + m2; + let month = parseInt(mRes); + let dRes = d1 + d2; + let day = parseInt(dRes); + let kabiseh = false; + if (month <= 6 && day > 31) { + return false; + } else if (month > 6 && month < 12 && day > 30) { + return false; + } else if (month === 12) { + + switch (year) { + case 1346: + kabiseh = true; + break; + case 1350: + kabiseh = true; + break; + case 1354: + kabiseh = true; + break; + case 1358: + kabiseh = true; + break; + case 1362: + kabiseh = true; + break; + case 1366: + kabiseh = true; + break; + case 1370: + kabiseh = true; + break; + case 1375: + kabiseh = true; + break; + case 1379: + kabiseh = true; + break; + case 1383: + kabiseh = true; + break; + case 1387: + kabiseh = true; + break; + case 1391: + kabiseh = true; + break; + case 1395: + kabiseh = true; + break; + case 1399: + kabiseh = true; + break; + case 1403: + kabiseh = true; + break; + case 1408: + kabiseh = true; + break; + case 1412: + kabiseh = true; + break; + case 1416: + kabiseh = true; + break; + case 1420: + kabiseh = true; + break; + case 1424: + kabiseh = true; + break; + case 1428: + kabiseh = true; + break; + case 1432: + kabiseh = true; + break; + case 1436: + kabiseh = true; + break; + case 1441: + kabiseh = true; + break; + case 1445: + kabiseh = true; + break; + default: + kabiseh = false; + + } + if (kabiseh == true && day > 30) { + return false; + } else if (kabiseh == false && day > 29) { + return false; + } else { + return true; + } + } else { + return true; + } + + + } + + + + $("#hours").attr("disabled", "disabled"); + + $('input:radio[name="PaidLeaveType"]').change( + function() { + if ($(this).is(':checked') && $(this).val() == 'روزانه') { + + $("#hours").val(''); + $("#hours").attr("disabled", "disabled"); + $("#endLeave").removeAttr("disabled"); + $('.endLeaveLabal').show(); + $('#StartHoure').removeClass("invalidTime"); + $('#StartHoure').val(''); + $('#EndHours').removeClass("invalidTime"); + $('#EndHours').val(''); + $("#endLeave").show(); + $('.hourses').css({ + display: "none" + }); + $('.sumHourseDiv').hide(); + $('.sumDaysDiv').show(); + $('.res').remove(); + $('.validTime').removeClass("validTime"); + } else if ($(this).is(':checked') && $(this).val() == 'ساعتی') { + + $("#endLeave").val(''); + $("#endLeave").attr("disabled", "disabled"); + $("#endLeave").hide(); + $('.endLeaveLabal').hide(); + + $('.hourses').css({ + display: "flex" + }); + $("#hours").removeAttr("disabled"); + $('.sumHourseDiv').show(); + $('.sumDaysDiv').hide(); + } + }); + /////////////////Time Input Validatet///////////////// + + $('#StartHoure').on("keyup", + function() { + const isValid = /^([2][0-3]|[1][0-9]|[0-9]|[0][0-9])([:][0-5][0-9])$/.test($(this).val()); + if (isValid) { + $(this).addClass("validTime"); + $(this).removeClass("invalidTime"); + if ($('#EndHours').hasClass('validTime') && $('#EndHours').val() != null) { + computeHourse(); + } + } else { + $(this).removeClass("validTime"); + $(this).addClass("invalidTime"); + } + }); + $('#EndHours').on("keyup", + function() { + const isValid = /^([2][0-3]|[1][0-9]|[0-9]|[0][0-9])([:][0-5][0-9])$/.test($(this).val()); + if (isValid) { + $(this).addClass("validTime"); + $(this).removeClass("invalidTime"); + if ($('#StartHoure').hasClass('validTime') && $('#StartHoure').val() != null) { + computeHourse(); + } + } else { + $(this).removeClass("validTime"); + $(this).addClass("invalidTime"); + } + }); + + function computeHourse() { + $('.res').remove(); + $.ajax({ + /* contentType: 'charset=utf-8',*/ + async: false, + dataType: 'json', + type: 'GET', + url: computeLeavHourseAjaxUrl, + headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, + data: { "startHours": $('#StartHoure').val(), "endHourse": $('#EndHours').val() }, + success: function(response) { + const res = `  :  ${response.res}`; + $('.sumHours').append(res); + }, + failure: function(response) { + console.log(5, response); + } + }); + } + + function computeDays() { + $('.resultDays').remove(); + $.ajax({ + /* contentType: 'charset=utf-8',*/ + async: false, + dataType: 'json', + type: 'GET', + url: computeLeavDaysAjaxUrl, + headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, + data: { "startDay": $('#startLeave').val(), "endDay": $('#endLeave').val() }, + success: function(response) { + const res = `  :  ${response.res}`; + $('.sumDays').append(res); + }, + failure: function(response) { + console.log(5, response); + } + }); + } + // function validateHM(inputField) { + // /*var isValid = /^\d{1}?\d{1}:\d{1}?\d{1}$/.test(inputField.value);*/ + // var isValid = /^([2][0-3]|[1][0-9]|[0-9]|[0][0-9])([:][0-5][0-9])$/.test(inputField.value); + // let isEmpty = inputField.value; + + // if (isValid || isEmpty == "") { + // if (isEmpty != "") { + // inputField.style.backgroundColor = '#a6e9a6'; + // } else { + // inputField.style.backgroundColor = '#fff'; + // } + + + // timeValid = true; + + + // } else { + // inputField.style.backgroundColor = '#f94c4c'; + // $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا ساعت را بصورت صحیح وارد کنید"); + // timeValid = false; + // } + // return isValid; + + // } + + + //Edit Leave + function checkIfValidToEdit(id) { + var leaveId = Number(id); + + $.ajax({ + /* contentType: 'charset=utf-8',*/ + // async: false, + dataType: 'json', + type: 'GET', + url: checkIfValidToEditAjaxUrl, + headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, + data: { "id": leaveId }, + success: function(response) { + if (response.validToEdit) { + + const goTo = `#showmodal=/Admin/Company/Contracts?id=${leaveId}&handler=EditPaidLeave`; + console.log(goTo); + window.location.href = goTo; + } else { + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "در بازه زمانی این مرخصی و یا بعد از آن فیش حقوقی وجود دارد"); + } + }, + failure: function(response) { + console.log(5, response); + } + }); + + } + + //remove Leave + $('.RemoveLeftWork').on("click", + function() { + const id = $(this).closest("div").find("input[name='LeftworkId']").val(); + $('#LeftId').val(id); + + + swal({ + title: "آیا حذف این سابقه مرخصی اطمینان دارید؟", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: true, + closeOnCancel: true + }, + function(isConfirm) { + if (isConfirm) { + + $('#sendFinaly').click(); + + } + + + }); + }); + diff --git a/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/sickLeave.js b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/sickLeave.js new file mode 100644 index 00000000..d3cd1280 --- /dev/null +++ b/ServiceHost/wwwroot/AssetsAdmin/page/Contracts/js/sickLeave.js @@ -0,0 +1,361 @@ + + + $('.RemoveLeftWork').on("click", + function() { + const id = $(this).closest("div").find("input[name='LeftworkId']").val(); + $('#LeftId').val(id); + + swal({ + title: "آیا حذف این سابقه مرخصی اطمینان دارید؟", + text: "", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "بله", + cancelButtonText: "خیر", + closeOnConfirm: true, + closeOnCancel: true + }, + function(isConfirm) { + if (isConfirm) { + $('#sendFinaly').click(); + } + }); + }); + + + + + $(document).ready(function() { + $(document).on("change", + "#IsAccepted", + function() { + const IsAcceptedCheck = $('#IsAccepted').is(':checked'); + if (IsAcceptedCheck) { + $('#descriptionAcceptedCheck').removeClass('errored'); + $('#descriptionAcceptedCheck').addClass('disable-input'); + $("#descriptionAcceptedCheck").prop('disabled', true); + } else { + $('#descriptionAcceptedCheck').removeClass('disable-input'); + $("#descriptionAcceptedCheck").prop('disabled', false); + } + }); + }); + + $('#save').on('click', + function() { + + $("#descriptionAcceptedCheck").on("change", + function() { + $('#descriptionAcceptedCheck').removeClass('errored'); + }); + + const IsAcceptedCheck = $('#IsAccepted').is(':checked'); + const descriptionAcceptedCheck = $('#descriptionAcceptedCheck').val(); + if (!IsAcceptedCheck && descriptionAcceptedCheck.length === 0) { + $('#descriptionAcceptedCheck').addClass('errored'); + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا توضیحات در صورت عدم موافقت را پر کنید."); + return; + } + + if ($('.errored').length < 1) { + $('#saveFinaly').click(); + } + }); + $(".date").mask("0000/00/00"); + $('.date').on('input', + function() { + const startDate = this.value; + if (startDate.length == 10) { + const submitcheck = dateValidcheck(this); + if (submitcheck) { + + $(this).removeClass('errored'); + if ($('#startLeave').val() != '' && $('#endLeave').val() != '') { + computeDays(); + } + + } else { + $(this).addClass('errored'); + + } + + } else { + $(this).addClass('errored'); + } + }); + + function dateValidcheck(inputField1) { + + const persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g]; + const arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g]; + const fixNumbers = function(str) { + if (typeof str === 'string') { + for (let i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + const getdate = inputField1.value; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + let s1, s2; + for (let i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 4) { + s1 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 7) { + s2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + } + const yRes = y1 + y2 + y3 + y4; + const year = parseInt(yRes); + const mRes = m1 + m2; + const month = parseInt(mRes); + const dRes = d1 + d2; + const day = parseInt(dRes); + const fixResult = yRes + s1 + mRes + s2 + dRes; + const test1 = checkEnValid(inputField1.value); + + const isValid = /^([1][3-4][0-9][0-9][/])([0][1-9]|[1][0-2])([/])([0][1-9]|[1-2][0-9]|[3][0-1])$/.test(fixResult); + + if (isValid && test1) { + // inputField1.style.backgroundColor = '#a6e9a6'; + start1valid = true; + } else { + if (inputField1.value != "") { + // inputField1.style.backgroundColor = '#f94c4c'; + $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', "لطفا تاریخ را بصورت صحیح وارد کنید"); + start1valid = false; + } + } + return start1valid; + } + + function checkEnValid(fixDate1) { + + let persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g], + arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g], + fixNumbers = function(str) { + if (typeof str === 'string') { + for (let i = 0; i < 10; i++) { + str = str.replace(persianNumbers[i], i).replace(arabicNumbers[i], i); + } + } + return str; + }; + let getdate = fixDate1; + + let m1, m2; + let y1, y2, y3, y4; + let d1, d2; + for (let i = 0; i < getdate.length; i++) { + if (i === 0) { + y1 = fixNumbers(getdate[i]); + } + if (i === 1) { + y2 = fixNumbers(getdate[i]); + } + if (i === 2) { + y3 = fixNumbers(getdate[i]); + } + if (i === 3) { + y4 = fixNumbers(getdate[i]); + } + if (i === 5) { + m1 = fixNumbers(getdate[i]); + } + if (i === 6) { + m2 = fixNumbers(getdate[i]); + } + if (i === 8) { + d1 = fixNumbers(getdate[i]); + } + if (i === 9) { + d2 = fixNumbers(getdate[i]); + } + + } + let yRes = y1 + y2 + y3 + y4; + let year = parseInt(yRes); + let mRes = m1 + m2; + let month = parseInt(mRes); + let dRes = d1 + d2; + let day = parseInt(dRes); + let kabiseh = false; + if (month <= 6 && day > 31) { + return false; + } else if (month > 6 && month < 12 && day > 30) { + return false; + } else if (month === 12) { + + switch (year) { + case 1346: + kabiseh = true; + break; + case 1350: + kabiseh = true; + break; + case 1354: + kabiseh = true; + break; + case 1358: + kabiseh = true; + break; + case 1362: + kabiseh = true; + break; + case 1366: + kabiseh = true; + break; + case 1370: + kabiseh = true; + break; + case 1375: + kabiseh = true; + break; + case 1379: + kabiseh = true; + break; + case 1383: + kabiseh = true; + break; + case 1387: + kabiseh = true; + break; + case 1391: + kabiseh = true; + break; + case 1395: + kabiseh = true; + break; + case 1399: + kabiseh = true; + break; + case 1403: + kabiseh = true; + break; + case 1408: + kabiseh = true; + break; + case 1412: + kabiseh = true; + break; + case 1416: + kabiseh = true; + break; + case 1420: + kabiseh = true; + break; + case 1424: + kabiseh = true; + break; + case 1428: + kabiseh = true; + break; + case 1432: + kabiseh = true; + break; + case 1436: + kabiseh = true; + break; + case 1441: + kabiseh = true; + break; + case 1445: + kabiseh = true; + break; + default: + kabiseh = false; + + } + if (kabiseh == true && day > 30) { + return false; + } else if (kabiseh == false && day > 29) { + return false; + } else { + return true; + } + } else { + return true; + } + } + + + $('input:radio[name="PaidLeaveType"]').change(function() { + if ($(this).is(':checked') && $(this).val() == 'روزانه') { + $("#hours").val(''); + $("#hours").attr("disabled", "disabled"); + $("#endLeave").removeAttr("disabled"); + $('.endLeaveLabal').show(); + $('#StartHoure').removeClass("invalidTime"); + $('#StartHoure').val(''); + $('#EndHours').removeClass("invalidTime"); + $('#EndHours').val(''); + $("#endLeave").show(); + $('.hourses').css({ + display: "none" + }); + $('.sumHourseDiv').hide(); + $('.sumDaysDiv').show(); + $('.res').remove(); + $('.validTime').removeClass("validTime"); + } + }); + + function computeDays() { + $('.resultDays').remove(); + $.ajax({ + /* contentType: 'charset=utf-8',*/ + async: false, + dataType: 'json', + type: 'GET', + url: computeLeavDaysAjaxUrl, + headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() }, + data: { "startDay": $('#startLeave').val(), "endDay": $('#endLeave').val() }, + success: function(response) { + const res = `  :  ${response.res}`; + $('.sumDays').append(res); + }, + failure: function(response) { + console.log(5, response); + } + }); + } + + $(document).ready(function() { + setTimeout(function() { + + window.location.hash = "##"; + }, + 1000); + }); + +