Merge remote-tracking branch 'origin/Fix/CWS/breakTime-validation-rotating-shifts'

This commit is contained in:
SamSys
2025-04-22 19:22:26 +03:30
4 changed files with 121 additions and 58 deletions

View File

@@ -47,7 +47,7 @@
<input type="radio" value="Regular" name="Command.workshopShiftStatus" id="organized" class="radio-workTimeOption">
<label for="organized" class="radio-label-workTimeOption w-100">منظم</label>
<input type="radio" value="Rotating" name="Command.workshopShiftStatus" id="rotating_shift" class="radio-workTimeOption">
<input type="radio" value="Rotating" name="Command.workshopShiftStatus" id="rotating_shift" class="radio-workTimeOption">
<label for="rotating_shift" class="radio-label-workTimeOption w-100">گردشی</label>
<input type="radio" value="Irregular" name="Command.workshopShiftStatus" id="disorganized" class="radio-workTimeOption">
@@ -210,7 +210,7 @@
else
{
<div class="col-1 d-flex align-items-center justify-content-end">
<button type="button" class="btnRemoveTimeWork">
<button type="button" class="btnRemoveTimeWorkRS">
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="11" cy="11" r="8.25" stroke="white" />
<path d="M6.875 11H15.125" stroke="white" />

View File

@@ -74,6 +74,19 @@
$('input[name="Command.IrregularShift.WorkshopIrregularShifts"]').prop('checked', false);
$('#irregularShiftsDateTime').addClass('disable');
$('.dateTimeIrregular').val('');
var currentCount = $('.groupBox').length;
if (currentCount >= 2) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
});
$("#rotating_shift").on("click", function () {
@@ -97,8 +110,7 @@
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').show();
});
switch (IsRegularWorkshop) {
case 0:
//radio btn
@@ -111,6 +123,20 @@
$('#step_workTimeOptionIrregular').hide();
// این مرحله هنگام چک کردن تعداد نوبت هستش
updateAddButtonText(indexShiftViewModel);
var currentCount = $('.groupBox').length;
if (currentCount >= 2) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
break;
case 1:
@@ -163,18 +189,17 @@
});
$('#BreakTime, #BreakTimeFirst').on('change', function () {
$('#BreakTime, #BreakTimeFirst').not(this).prop('checked', false);
var currentCount = 0;
if ($("#organized").is(":Checked")) {
var currentCount = $('.groupBox').length;
} else if ($("#rotating_shift").is(":Checked")) {
var currentCount = $('.groupBoxRS').length;
currentCount = $('.groupBox').length;
}
//else if ($("#rotating_shift").is(":Checked")) {
// var currentCount = $('.groupBoxRS').length;
//}
if (currentCount >= 2) {
showAlert('به دلیل داشتن 2 یا 3 نوبت، امکان فعال سازی ساعت استراحت ندارید', $(this));
showAlert('به دلیل داشتن 2 یا 3 نوبت، امکان فعال سازی ساعت استراحت ندارید', $('.break-time'));
$(this).prop('checked', false);
$("#hour").val("0");
$("#min").val("00");
@@ -342,17 +367,17 @@
return false;
}
if (currentCount >= 1) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
//if (currentCount >= 1) {
// $('#BreakTime').prop('checked', false);
// $('#BreakTimeFirst').prop('checked', false);
// $('#computeTimeText').text('');
// $("#hour").val("0");
// $("#min").val("00");
// $('#computeTime').addClass('disable');
// $("#TimeOnly").val('');
//} else {
// $('#computeTime').removeClass('disable');
//}
if (currentCount < 5) {

View File

@@ -78,6 +78,19 @@
$('input[name="IrregularShift.WorkshopIrregularShifts"]').prop('checked', false);
$('#irregularShiftsDateTime').addClass('disable');
$('.dateTimeIrregular').val('');
var currentCount = $('.groupBox').length;
if (currentCount >= 2) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
});
$("#rotating_shift").on("click", function () {
@@ -114,6 +127,20 @@
$('#step_workTimeOptionIrregular').hide();
// این مرحله هنگام چک کردن تعداد نوبت هستش
updateAddButtonText(indexShiftViewModel);
var currentCount = $('.groupBox').length;
if (currentCount >= 2) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
break;
case 1:
@@ -166,18 +193,17 @@
});
$('#BreakTime, #BreakTimeFirst').on('change', function () {
$('#BreakTime, #BreakTimeFirst').not(this).prop('checked', false);
var currentCount = 0;
if ($("#organized").is(":Checked")) {
var currentCount = $('.groupBox').length;
} else if ($("#rotating_shift").is(":Checked")) {
var currentCount = $('.groupBoxRS').length;
currentCount = $('.groupBox').length;
}
//else if ($("#rotating_shift").is(":Checked")) {
// var currentCount = $('.groupBoxRS').length;
//}
if (currentCount >= 2) {
showAlert('به دلیل داشتن 2 یا 3 نوبت، امکان فعال سازی ساعت استراحت ندارید', $(this));
showAlert('به دلیل داشتن 2 یا 3 نوبت، امکان فعال سازی ساعت استراحت ندارید', $('.break-time'));
$(this).prop('checked', false);
$("#hour").val("0");
$("#min").val("00");
@@ -347,17 +373,17 @@
return false;
}
if (currentCount >= 1) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
//if (currentCount >= 1) {
// $('#BreakTime').prop('checked', false);
// $('#BreakTimeFirst').prop('checked', false);
// $('#computeTimeText').text('');
// $("#hour").val("0");
// $("#min").val("00");
// $('#computeTime').addClass('disable');
// $("#TimeOnly").val('');
//} else {
// $('#computeTime').removeClass('disable');
//}
if (currentCount < 5) {

View File

@@ -73,6 +73,19 @@
$('input[name="IrregularShift.WorkshopIrregularShifts"]').prop('checked', false);
$('#irregularShiftsDateTime').addClass('disable');
$('.dateTimeIrregular').val('');
var currentCount = $('.groupBox').length;
if (currentCount >= 2) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
});
$("#rotating_shift").on("click", function () {
@@ -111,18 +124,17 @@
});
$('#BreakTime, #BreakTimeFirst').on('change', function () {
$('#BreakTime, #BreakTimeFirst').not(this).prop('checked', false);
var currentCount = 0;
if ($("#organized").is(":Checked")) {
var currentCount = $('.groupBox').length;
} else if ($("#rotating_shift").is(":Checked")) {
var currentCount = $('.groupBoxRS').length;
currentCount = $('.groupBox').length;
}
//else if ($("#rotating_shift").is(":Checked")) {
// var currentCount = $('.groupBoxRS').length;
//}
if (currentCount >= 2) {
showAlert('به دلیل داشتن 2 یا 3 نوبت، امکان فعال سازی ساعت استراحت ندارید', $(this));
showAlert('به دلیل داشتن 2 یا 3 نوبت، امکان فعال سازی ساعت استراحت ندارید', $('.break-time'));
$(this).prop('checked', false);
$("#hour").val("0");
$("#min").val("00");
@@ -290,17 +302,17 @@
return false;
}
if (currentCount >= 1) {
$('#BreakTime').prop('checked', false);
$('#BreakTimeFirst').prop('checked', false);
$('#computeTimeText').text('');
$("#hour").val("0");
$("#min").val("00");
$('#computeTime').addClass('disable');
$("#TimeOnly").val('');
} else {
$('#computeTime').removeClass('disable');
}
//if (currentCount >= 1) {
// $('#BreakTime').prop('checked', false);
// $('#BreakTimeFirst').prop('checked', false);
// $('#computeTimeText').text('');
// $("#hour").val("0");
// $("#min").val("00");
// $('#computeTime').addClass('disable');
// $("#TimeOnly").val('');
//} else {
// $('#computeTime').removeClass('disable');
//}
if (currentCount < 5) {