1037 lines
53 KiB
JavaScript
1037 lines
53 KiB
JavaScript
|
||
|
||
$('.activer').on('change',
|
||
function(e) {
|
||
e.preventDefault();
|
||
$('.search').click();
|
||
|
||
});
|
||
|
||
//var a = window.location.href;
|
||
//var res = a.split("#")[1];
|
||
//if (res == "false") {
|
||
// $.Notification.autoHideNotify('error', 'top center', 'پیام سیستم ', " ابتدا یکی از فیلد های کارگاه، کارفرما، پرسنل را انتخاب نموده و سپس جستجو را بزنید ");
|
||
//}
|
||
|
||
|
||
|
||
//if (document.getElementById("activing").selectedIndex == 1) {
|
||
// $('.deact').remove();
|
||
// $('.act').append(
|
||
// ' <a class="btn btn-success pull-right m-rl-5 rad react" onclick="reActiveAll()">' + '<i class="fa faSize fa-rotate-left"></i>' + ' </a>'
|
||
// );
|
||
//}
|
||
//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"]]
|
||
// });
|
||
// });
|
||
//} else {
|
||
// $(document).ready(function() {
|
||
// $('#datatable').dataTable(
|
||
// {
|
||
// "lengthMenu": [[-1, 10, 50, 100, 25], ["All", 10, 50, 100, 25]]
|
||
// }
|
||
// );
|
||
// });
|
||
//}
|
||
|
||
|
||
$('.search').on('click',
|
||
function() {
|
||
const html = ` <div id="waiting" style="padding-right: 10px">
|
||
<i class="ion-loading-a" style="font-size: 16px"> </i> در حال بارگذاری...
|
||
</div>`;
|
||
|
||
var myTable = $("#datatable_wrapper");
|
||
myTable.remove();
|
||
$('#mainPanel').append(html);
|
||
|
||
});
|
||
|
||
$(document).ready(function() {
|
||
|
||
$('.search').click();
|
||
$(".personel-select").select2({
|
||
|
||
language: "fa",
|
||
dir: "rtl",
|
||
|
||
|
||
});
|
||
});
|
||
|
||
$('#workshops').on('select2:open',
|
||
function(e) {
|
||
if ($('#workshops option').length == 1) {
|
||
|
||
$.ajax({
|
||
contentType: 'charset=utf-8',
|
||
dataType: 'json',
|
||
type: 'GET',
|
||
url: WorkshopMainListurl,
|
||
headers: { "RequestVerificationToken": $(AntiForgeryToken).val() },
|
||
|
||
success: function(response) {
|
||
$('#workshops').empty().append('<option selected="selected" value="0" > کارگاه</option>');
|
||
$.each(response.mylist,
|
||
function(i, item) {
|
||
$('#workshops').append($('<option>',
|
||
{
|
||
value: item.id,
|
||
text: item.workshopFullName,
|
||
}));
|
||
});
|
||
|
||
$('#workshops').select2('close');
|
||
$('#workshops').select2('open');
|
||
}
|
||
});
|
||
|
||
|
||
}
|
||
});
|
||
|
||
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: PersonelMainListurl,
|
||
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 = `<li data-employeeId="${item.id}" class="btn btn-block opt" onclick="selectItem(${item.id}, '${item.employeeFullName}');" >${item.employeeFullName}</li>`;
|
||
searchResul.append(li);
|
||
|
||
});
|
||
} else {//result NotFounded
|
||
|
||
$(".noResult").remove();
|
||
container.show();
|
||
let noResult = `<li class="btn btn-block noResult" style="background-color: #ffffff;border-radius: 10px;text-align: right;padding: 2px 5px">نتیجه ای یافت نشد</li>`;
|
||
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);
|
||
}
|
||
}
|
||
});
|
||
|
||
$('#employer').on('select2:open',
|
||
function(e) {
|
||
|
||
if ($('#employer option').length == 1) {
|
||
|
||
$.ajax({
|
||
contentType: 'charset=utf-8',
|
||
dataType: 'json',
|
||
type: 'GET',
|
||
url: EmployerMainListUrl,
|
||
headers: { "RequestVerificationToken": $(AntiForgeryToken).val() },
|
||
success: function(response) {
|
||
$('#employer').empty().append('<option selected="selected" value="0" > کارفرما</option>');
|
||
$.each(response.mylist,
|
||
function(i, item) {
|
||
$('#employer').append($('<option>',
|
||
{
|
||
value: item.id,
|
||
text: item.fullName,
|
||
}));
|
||
});
|
||
$('#employer').select2('close');
|
||
$('#employer').select2('open');
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
//------------new Change---------------
|
||
$("#empSearch").keypress(function (event) {
|
||
if (event.keyCode === 13) {
|
||
if ($("#SearchModel_EmployeeId").val() == "0")
|
||
$("#SearchModel_EmployeeName").val($("#empSearch").val())
|
||
$("#btnSearch").click();
|
||
}
|
||
});
|
||
$(".btn-searchCheckout").click(function () {
|
||
if ($("#SearchModel_EmployeeId").val() == "0")
|
||
$("#SearchModel_EmployeeName").val($("#empSearch").val())
|
||
|
||
var workshopId = $("#workshops").val();
|
||
var year = $("#SearchModel_Year").val();
|
||
var month = $("#SearchModel_Month").val();
|
||
|
||
if (year.trim() != "" && workshopId != "0" && month.trim()!="")
|
||
{
|
||
$("#sercheSignCheck").val("true");
|
||
}
|
||
if (year.trim() != "" && workshopId != "0" ) {
|
||
$("#sercheDeleteCheck").val("true");
|
||
}
|
||
$("#btnSearch").click();
|
||
});
|
||
|
||
function deleteAll() {
|
||
$('.sweet-alert').removeClass("successSwall");
|
||
$('.sweet-alert').removeClass("errorSwall");
|
||
|
||
var workshopId = Number($("#workshops").val());
|
||
var year = $("#SearchModel_Year").val();
|
||
var month = $("#SearchModel_Month").val();
|
||
if (year.trim() == "" && workshopId == "0") {
|
||
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"
|
||
});
|
||
}
|
||
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"
|
||
});
|
||
|
||
}
|
||
else if (document.getElementById("sercheDeleteCheck").value != "true") {
|
||
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: DeleteAllCheckoutsurl,
|
||
headers: { "RequestVerificationToken": $(AntiForgeryToken).val() },
|
||
data: { "ids": ids, "workshopId" : workshopId },
|
||
success: function (response) {
|
||
console.log(response);
|
||
$(".alarm").removeClass('alarm');
|
||
|
||
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');
|
||
}
|
||
}
|
||
else if (response.successDelete) {
|
||
swal({
|
||
title: "حذف تصفیه حساب های انتخاب شده با موفقیت انجام شد.",
|
||
text: "",
|
||
type: "success",
|
||
showCancelButton: true,
|
||
confirmButtonColor: "#DD6B55",
|
||
confirmButtonText: "بستن",
|
||
//cancelButtonText: "خیر",
|
||
closeOnConfirm: true,
|
||
customClass: "successSwall"
|
||
},
|
||
function (isConfirm) {
|
||
if (isConfirm) {
|
||
$(".btn-searchCheckout").click();
|
||
}
|
||
});
|
||
|
||
}
|
||
else if (!response.successDelete) {
|
||
swal({
|
||
title: "حذف تصفیه حساب های انتخاب شده با خطا مواجه شد ",
|
||
text: "",
|
||
type: "warning",
|
||
showCancelButton: true,
|
||
confirmButtonColor: "#DD6B55",
|
||
//confirmButtonText: "بستن",
|
||
cancelButtonText: "بستن",
|
||
closeOnConfirm: false,
|
||
closeOnCancel: true,
|
||
customClass: "errorSwall"
|
||
});
|
||
}
|
||
|
||
},
|
||
failure: function (response) {
|
||
//console.log(5, response);
|
||
}
|
||
});
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
|
||
function rotatingShiftReport(id){
|
||
|
||
console.log(Number(id));
|
||
var checkoutId=Number(id);
|
||
$.ajax({
|
||
|
||
dataType: 'json',
|
||
type: 'POST',
|
||
url: RotatngShiftReportUrl,
|
||
headers: { "RequestVerificationToken": $(AntiForgeryToken).val() },
|
||
data: { "checkoutId": checkoutId},
|
||
success: function (response) {
|
||
console.log(response);
|
||
if (response.isSuccedded) {
|
||
|
||
}
|
||
|
||
},
|
||
failure: function (response) {
|
||
console.log(5, response)
|
||
}
|
||
});
|
||
}
|
||
|
||
function deleteCheckout(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: DeleteCheckoutUrl,
|
||
headers: { "RequestVerificationToken": $(AntiForgeryToken).val() },
|
||
data: { "id": id },
|
||
success: function (response) {
|
||
console.log(response);
|
||
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-searchCheckout").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($("#workshops").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) {
|
||
//$.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: SignatureAllUrl,
|
||
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('<a class="myLinkSign" name="foo1" value="' + ids[index] + '" style="font-size: 20px" href="#">' +
|
||
'<i class= "ion-checkmark-circled" style = "color:#1f9c11" > </i>' +
|
||
'<input type = "hidden" value = "' + ids[index] + '" name = "signed" >' +
|
||
'</a>');
|
||
}
|
||
$('.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($("#workshops").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 != "true") {
|
||
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: DeleteAllSignatureUrl,
|
||
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('<a class="myLinkSign" name="foo2" value="' + ids[index] + '" style="font-size: 20px" href="#">' +
|
||
'<i class= "ion-ios7-circle-outline" style = "color: #dd3632" > </i>' +
|
||
'<input type = "hidden" value = "' + ids[index] + '" name = "unsigned" >' +
|
||
'</a>');
|
||
}
|
||
$('.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---------------
|
||
|
||
|
||
|