354 lines
14 KiB
JavaScript
354 lines
14 KiB
JavaScript
var lengthMenu = 0;
|
|
var loadFunctionLeftWork = true;
|
|
|
|
loadMenuAnime();
|
|
$(document).ready(function () {
|
|
CountWorkFlow();
|
|
loadWorkshopsForLeftWorkTemp();
|
|
|
|
$("#clickStartDateTab").click(function () {
|
|
if (loadFunctionLeftWork) {
|
|
loadWorkshopsForLeftWorkTemp();
|
|
}
|
|
});
|
|
});
|
|
|
|
function loadMenuAnime() {
|
|
var tabsNewAnim = $('#navbar-animmenu');
|
|
var selectorNewAnim = $('#navbar-animmenu').find('li').length;
|
|
var activeItemNewAnim = tabsNewAnim.find('.active');
|
|
var activeHeightNewAnimHeight = activeItemNewAnim.innerHeight();
|
|
var itemPosNewAnimTop = activeItemNewAnim.position();
|
|
$(".verti-selector").css({
|
|
"top": itemPosNewAnimTop.top + "px",
|
|
"height": activeHeightNewAnimHeight + "px"
|
|
});
|
|
|
|
$('.active').each(function () {
|
|
var targetForm = $(this).data('target');
|
|
$('#' + targetForm).show();
|
|
});
|
|
|
|
if (lengthMenu === 1) {
|
|
if ($('.main-navbar li').hasClass('lastRole')) {
|
|
$('.verti-selector .top').addClass('last-role');
|
|
$('#hideCircle').css('border-radius', '25px 0 0 0');
|
|
} else {
|
|
$('.verti-selector .top').removeClass('last-role');
|
|
$('#hideCircle').css('border-radius', '0 0 0 0');
|
|
}
|
|
}
|
|
|
|
$("#navbar-animmenu").on("click", "li", function (e) {
|
|
if ($(this).hasClass('lastRole')) {
|
|
//$('.verti-selector .top').addClass('last-role');
|
|
$('#hideCircle').css('border-radius', '25px 0 0 0');
|
|
} else {
|
|
//$('.verti-selector .top').removeClass('last-role');
|
|
$('#hideCircle').css('border-radius', '0 0 0 0');
|
|
}
|
|
|
|
$('#navbar-animmenu ul li').removeClass("active");
|
|
$(this).addClass('active');
|
|
|
|
var activeHeightNewAnimHeight = $(this).innerHeight();
|
|
var itemPosNewAnimTop = $(this).position();
|
|
$(".verti-selector").css({
|
|
"top": itemPosNewAnimTop.top + "px",
|
|
"height": activeHeightNewAnimHeight + "px"
|
|
});
|
|
|
|
$('.form-section').hide();
|
|
$('.accountListHead').text($(this).find('a').text());
|
|
var targetForm = $(this).data('target');
|
|
$('#' + targetForm).show();
|
|
});
|
|
|
|
//$("#navbar-animmenu").on("click", "li", function (e) {
|
|
// var targetForm = $(this).data('target');
|
|
// $('#navbar-animmenu ul li').removeClass("active");
|
|
// $(this).addClass('active');
|
|
|
|
// var activeHeightNewAnimHeight = $(this).innerHeight();
|
|
// var itemPosNewAnimTop = $(this).position();
|
|
|
|
// $(".verti-selector").stop(true, true).animate({
|
|
// "top": itemPosNewAnimTop.top + "px",
|
|
// "height": activeHeightNewAnimHeight + "px"
|
|
// }, 300); // انیمیشن با مدت زمان 300 میلیثانیه
|
|
|
|
// $('.form-section').fadeOut(200);
|
|
// $('#' + targetForm).fadeIn(300); // انیمیشن تغییر صفحه
|
|
//});
|
|
}
|
|
|
|
$(document).on('click', ".openActionMain", function () {
|
|
$('.toggle').not($(this).find('.toggle')).removeClass('open');
|
|
|
|
$(this).next().find(".operations-btns-main").slideToggle(500);
|
|
$(".operations-btns-main").not($(this).next().find(".operations-btns-main")).slideUp(500);
|
|
|
|
$(this).find('.toggle').toggleClass('open');
|
|
});
|
|
|
|
$(document).on('click', ".openAction", function () {
|
|
if (window.matchMedia('(max-width: 768px)').matches) {
|
|
$(this).next().find(".operations-btns").slideToggle(500);
|
|
$(".operations-btns").not($(this).next().find(".operations-btns")).slideUp(500);
|
|
}
|
|
});
|
|
|
|
async function loadWorkshopsForLeftWorkTemp() {
|
|
$('#loadingSkeletonStartDate').show();
|
|
var mainIndexNum = 1;
|
|
|
|
var html = ``;
|
|
$.ajax({
|
|
async: true,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadWorkshopsForLeftWorkTempUrl,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
|
|
$('#loadingSkeletonStartDate').hide();
|
|
|
|
if (response.success) {
|
|
if (data.length > 0) {
|
|
data.forEach(function (item) {
|
|
html += `
|
|
<div id="Main_${item.workshopId}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeesForLeftWorkTemp('${item.workshopId}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
|
<div class="col-2 col-md-4 text-start">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center" style="background: #deffff;margin: 0 10px 0 0;">
|
|
${mainIndexNum++}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-8 col-md-4 text-center d-flex">
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-end">
|
|
<span>${item.workshopName}</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 text-start">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span>${item.employerName}</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 text-center">
|
|
<div class="Rtable-cell column-heading text-center justify-content-center">
|
|
<span class="number-of-count" id="EmployeeCountOfWorkshop_${item.workshopId}">${item.leftWorkEmployeesCount}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-2 col-md-4 text-end">
|
|
<span class="toggle">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M15 18L9 12L15 6" stroke-width="2" stroke-linecap="round" />
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
</div>`;
|
|
|
|
html += `<div class="w-100 operation-div">
|
|
<div id="LeftWorkEmployee_${item.workshopId}" class="operations-btns-main workshopID_${item.workshopId}" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
|
</div></div>`;
|
|
});
|
|
|
|
} else {
|
|
html += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
$('#loadStartDateWorkFlow').html(html);
|
|
loadFunctionLeftWork = false;
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
function loadEmployeesForLeftWorkTemp(id) {
|
|
var html = ``;
|
|
$.ajax({
|
|
async: true,
|
|
contentType: 'charset=utf-8',
|
|
dataType: 'json',
|
|
type: 'GET',
|
|
url: loadEmployeesForLeftWorkTempUrl,
|
|
data: { 'workshopId': id },
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
var data = response.data;
|
|
|
|
if (response.success) {
|
|
if (data.length > 0) {
|
|
|
|
data.forEach(function (item, i) {
|
|
html += `<div></div>
|
|
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-employee-id="${item.employeeId}">
|
|
<div class="Rtable-cell width1">
|
|
<div class="Rtable-cell--heading d-none">
|
|
ردیف
|
|
</div>
|
|
<div class="Rtable-cell--content">
|
|
<span class="d-flex justify-content-center align-items-center justify-content-center table-number">
|
|
${i + 1}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width2">
|
|
<div class="Rtable-cell--heading d-none">نام پرسنل</div>
|
|
<div class="Rtable-cell--content employee-name">
|
|
${item.employeeName}
|
|
<p class="m-0 mt-2 d-block d-md-none"></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width3 d-none d-md-block">
|
|
<div class="Rtable-cell--content text-center">
|
|
<div class="d-flex justify-content-center ms-1">
|
|
|
|
|
|
${item.leftWorkDate}
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width4 d-none d-md-block">
|
|
<div class="Rtable-cell--content text-center">
|
|
<div class="d-flex justify-content-center ms-1">
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width5 d-none d-md-block">
|
|
<div class="Rtable-cell--content text-center">
|
|
<div class="d-flex justify-content-center ms-1">
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="Rtable-cell width6 d-none d-md-block">
|
|
<div class="Rtable-cell--content text-center">
|
|
<div class="d-md-none d-none">پیغام: </div>
|
|
<div class="d-flex justify-content-center ms-1">
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="Rtable-cell position-relative width7 bg-filter d-flex justify-content-end">
|
|
<div class="Rtable-cell--content text-center d-block d-md-flex align-items-center gap-1 h-100">
|
|
|
|
<button class="btn-workflow-rollcall-edit position-relative" onclick="showModalLeftWork(${item.employeeId}, '${id}')">
|
|
<span class="mx-1">عملیات</span>
|
|
</button>
|
|
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
});
|
|
|
|
} else {
|
|
html += `<div class="container-fluid">
|
|
<div class="row p-lg-2 p-auto">
|
|
<div class="text-center bg-white d-flex align-items-center justify-content-center w-100">
|
|
<div class="">
|
|
<img src="/assetsclient/images/empty.png" alt="" class="img-fluid" />
|
|
<h5>اطلاعاتی وجود ندارد.</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
$(`.workshopID_${id}`).html(html);
|
|
}
|
|
},
|
|
failure: function (response) {
|
|
console.log(response);
|
|
}
|
|
});
|
|
}
|
|
|
|
function showModalLeftWork(employeeId, workshopId) {
|
|
var goTo = `#showmodal=/AdminNew/Company/WorkFlow/EmployeesLeftWork?handler=LeftWork&employeeId=${employeeId}&workshopId=${workshopId}`;
|
|
window.location.href = goTo;
|
|
}
|
|
|
|
async function CountWorkFlow() {
|
|
|
|
$.ajax({
|
|
dataType: 'json',
|
|
type: 'Get',
|
|
url: loadLeftWorkCount,
|
|
headers: { "RequestVerificationToken": antiForgeryToken },
|
|
success: function (response) {
|
|
if (response.success) {
|
|
$('.spinner-grow').hide();
|
|
|
|
$('#CountLeftDateLoading').hide();
|
|
if (response.dataLeftWorkCount === 0) {
|
|
$('#CountLeftDate').hide();
|
|
} else {
|
|
$('#CountLeftDate').text(response.dataLeftWorkCount);
|
|
$('#CountLeftDate').show();
|
|
}
|
|
|
|
} else {
|
|
$('.alert-msg').show();
|
|
$('.alert-msg p').text(response.message);
|
|
setTimeout(function () {
|
|
$('.alert-msg').hide();
|
|
$('.alert-msg p').text('');
|
|
}, 3500);
|
|
}
|
|
},
|
|
error: function (err) {
|
|
console.log(err);
|
|
}
|
|
});
|
|
}
|
|
|
|
function updateIndexesWorkFlow(dateDiv) {
|
|
let index = 1;
|
|
|
|
$(`#${dateDiv} .employee-row:visible .table-number`).each(function () {
|
|
$(this).text(index++);
|
|
});
|
|
}
|
|
|
|
function updateMainWorkFlow() {
|
|
let index = 1;
|
|
|
|
$(`#loadStartDateWorkFlow .Rtable-cell.width1 .table-number`).each(function () {
|
|
$(this).text(index++);
|
|
});
|
|
} |