fix employee upload picture bug

This commit is contained in:
2025-03-21 18:16:34 +03:30
parent e73672e114
commit d2d629d750
3 changed files with 87 additions and 63 deletions

View File

@@ -340,6 +340,17 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo
return createDefaultEmployee;
}
if (_customizeWorkshopEmployeeSettingsRepository.Exists(x =>
x.WorkshopId == command.WorkshopId && command.EmployeeIds.First()== x.EmployeeId &&
x.CustomizeWorkshopGroupSettingId == command.GroupId))
{
var employeeSettings = _customizeWorkshopEmployeeSettingsRepository
.GetByEmployeeIdAndWorkshopIdIncludeGroupSettings(command.WorkshopId,command.EmployeeIds.First());
_customizeWorkshopEmployeeSettingsRepository.Remove(employeeSettings.id);
_customizeWorkshopEmployeeSettingsRepository.SaveChanges();
}
List<CustomizeWorkshopEmployeeSettingsShift> shiftCollection = new List<CustomizeWorkshopEmployeeSettingsShift>();
List<CustomizeRotatingShift> rotatingShift = [];

View File

@@ -15,7 +15,10 @@
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]is[3019]#@ATt;TrustServerCertificate=true;"
//local
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;"
//"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;"
//mahan Docker
"MesbahDb": "Data Source=localhost,5069;Initial Catalog=mesbah_db;User ID=sa;Password=YourPassword123;TrustServerCertificate=True;"
},
"GoogleRecaptchaV3": {
"SiteKey": "6Lfhp_AnAAAAAB79WkrMoHd1k8ir4m8VvfjE7FTH",

View File

@@ -388,7 +388,6 @@ async function set() {
const detection1 = await faceapi.detectSingleFace(img1).withFaceLandmarks().withFaceDescriptor();
const detection2 = await faceapi.detectSingleFace(img2).withFaceLandmarks().withFaceDescriptor();
console.log(detection1);
const distance = faceapi.euclideanDistance(detection1.descriptor, detection2.descriptor);
if (distance > 0.45) {
$('.alert-msg').show();
@@ -398,7 +397,6 @@ async function set() {
$('.alert-msg p').text('');
}, 4000);
return;
}
//var command = $('#create-form').serializeArray();
@@ -1299,6 +1297,11 @@ function timeValidCheck(value) {
$(document).ready(function () {
loadWorkshopSettingList();
var selectedValueBy_LoadWorkshopSettingList = $('#workshopSettingSelect').val();
if (selectedValueBy_LoadWorkshopSettingList != 0) {
loadWorkshopSettingSelectAjax(selectedValueBy_LoadWorkshopSettingList);
}
if ($("#workshopSettingSelect").val() === "0") {
$('#next-step').addClass('disable');
} else {
@@ -1374,24 +1377,32 @@ function loadWorkshopSettingList() {
}
$('#workshopSettingSelect').on('change', function () {
let htmlElement = '';
var id = Number($(this).val());
loadWorkshopSettingSelectAjax(id)
});
function loadWorkshopSettingSelectAjax(idSelected) {
var id = Number(idSelected);
let htmlElement = '';
if (id == 0) {
$('#footer-section').hide();
}
if ($("#workshopSettingSelect").val() === "0") {
$('#stepWorkTimeOptionRadio').hide();
$('#step_workTimeOptionNull').show();
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').hide();
$('#step_workTimeOptionWithoutGroup').hide();
$('#next-step').addClass('disable');
} else {
$('#next-step').removeClass('disable');
}
if (id === 0) {
$('#stepWorkTimeOptionRadio').hide();
$('#step_workTimeOptionNull').show();
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').hide();
$('#step_workTimeOptionWithoutGroup').hide();
$('#next-step').addClass('disable');
} else {
$('#next-step').removeClass('disable');
}
$.ajax({
async: false,
@@ -1402,19 +1413,19 @@ $('#workshopSettingSelect').on('change', function () {
success: function (response) {
const workshopSettingGroupSelecting = response.data;
var regularShiftsIndex = 0;
var rotatingShiftsIndex = 0;
var regularShiftsIndex = 0;
var rotatingShiftsIndex = 0;
if (workshopSettingGroupSelecting.groupSettings.length > 0) {
workshopSettingGroupSelecting.groupSettings.forEach(function (itemGroupSettings) {
if (itemGroupSettings.id === id) {
if ($('#workshopSettingSelect').find(':selected').data('name-group') === "بدون گروه") {
$('#stepWorkTimeOptionRadio').hide();
$('#step_workTimeOptionNull').hide();
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').hide();
$('#stepWorkTimeOptionRadio').hide();
$('#step_workTimeOptionNull').hide();
$('#step_workTimeOption').hide();
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').hide();
$('#step_workTimeOptionWithoutGroup').show();
$('#footer-section').hide();
} else {
@@ -1525,7 +1536,7 @@ $('#workshopSettingSelect').on('change', function () {
$('#step_workTimeOptionIrregular').hide();
$('#step_workTimeOptionIrregular').html(loadIrregularHtml());
updateAddButtonText(regularShiftsIndex);
if ((regularShiftsIndex) === 3) {
@@ -1534,8 +1545,8 @@ $('#workshopSettingSelect').on('change', function () {
$(".btnAddTimeWork").show();
}
// Update Remove button enable/disable state
updateRemoveButtons();
loadCleaveClasses();
updateRemoveButtons();
loadCleaveClasses();
} else if (itemGroupSettings.workshopShiftStatus === 1) {
@@ -1548,8 +1559,8 @@ $('#workshopSettingSelect').on('change', function () {
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionIrregular').show();
$('#footer-section').show();
// Irregular Shift
const rawStartTime = itemGroupSettings.irregularShift.startTime;
const rawEndTime = itemGroupSettings.irregularShift.endTime;
@@ -1611,13 +1622,13 @@ $('#workshopSettingSelect').on('change', function () {
$('#step_workTimeOption').hide();
$('#step_workTimeOption').html(loadRegularHtml());
$('#step_workTimeOptionRotatingShift').hide();
$('#step_workTimeOptionRotatingShift').html(loadRotatingHtml());
$('#step_workTimeOptionIrregular').show();
$('#step_workTimeOptionIrregular').html(htmlElement);
updateIrregularButton();
loadCleaveClasses();
@@ -1735,29 +1746,29 @@ $('#workshopSettingSelect').on('change', function () {
$('#step_workTimeOptionNull').hide();
$('#step_workTimeOptionWithoutGroup').hide();
$('#stepWorkTimeOptionRadio').show();
$('#step_workTimeOption').hide();
$('#step_workTimeOption').html(loadRegularHtml());
$('#step_workTimeOption').html(loadRegularHtml());
$('#step_workTimeOptionRotatingShift').show();
$('#appendChildTimeWorkHtmlRS').html(htmlElement);
$('#step_workTimeOptionIrregular').hide();
$('#step_workTimeOptionIrregular').html(loadIrregularHtml());
$('#step_workTimeOptionIrregular').html(loadIrregularHtml());
updateAddButtonTextRS(rotatingShiftsIndex);
if ((rotatingShiftsIndex) === 4) {
$(".btnAddTimeWorkRS").hide();
} else {
$(".btnAddTimeWorkRS").show();
}
$(".btnAddTimeWorkRS").show();
}
// Update Remove button enable/disable state
updateRemoveButtonsRS();
updateRemoveButtonsRS();
loadCleaveClasses();
}
}
}
@@ -1766,16 +1777,16 @@ $('#workshopSettingSelect').on('change', function () {
$('#GroupId').val(itemGroupSettings.id);
$('#BreakTimeFirst').prop('checked', (itemGroupSettings.breakTime.breakTimeType === 2 ? true : false));
$('#BreakTimeFirst').prop('checked', (itemGroupSettings.breakTime.breakTimeType === 2 ? true : false));
$('#BreakTime').prop('checked', (itemGroupSettings.breakTime.breakTimeType === 1 ? true : false));
if (itemGroupSettings.breakTime.hasBreakTimeValue) {
let breakTimeValue = itemGroupSettings.breakTime.breakTimeValue;
let formattedBreakTime = breakTimeValue.substring(0, 5);
if (itemGroupSettings.breakTime.hasBreakTimeValue) {
let breakTimeValue = itemGroupSettings.breakTime.breakTimeValue;
let formattedBreakTime = breakTimeValue.substring(0, 5);
let [hour, minute] = breakTimeValue.split(':');
$('#hour').val(hour);
$('#min').val(minute);
$('#hour').val(hour);
$('#min').val(minute);
$('#TimeOnly').val(formattedBreakTime);
$('#computeTime').removeClass('disable');
@@ -1785,20 +1796,20 @@ $('#workshopSettingSelect').on('change', function () {
} else {
$('#hour').val("00");
$('#min').val("00");
$('#min').val("00");
$('#TimeOnly').val('');
$('#computeTime').addClass('disable');
// console.log($('hour='+ $('#hour').val()));
// console.log('min='+ $('#min').val());
}
}
$('#Friday1').prop('checked', (itemGroupSettings.fridayWork === 0 ? true : false));
$('#Friday2').prop('checked', (itemGroupSettings.fridayWork === 1 ? true : false));
$('#Friday1').prop('checked', (itemGroupSettings.fridayWork === 0 ? true : false));
$('#Friday2').prop('checked', (itemGroupSettings.fridayWork === 1 ? true : false));
$('#HolidayWork1').prop('checked', (itemGroupSettings.holidayWork === 0 ? true : false));
$('#HolidayWork2').prop('checked', (itemGroupSettings.holidayWork === 1 ? true : false));
$('#HolidayWork1').prop('checked', (itemGroupSettings.holidayWork === 0 ? true : false));
$('#HolidayWork2').prop('checked', (itemGroupSettings.holidayWork === 1 ? true : false));
}
@@ -1807,17 +1818,17 @@ $('#workshopSettingSelect').on('change', function () {
if ($('.groupBox').length === 3) {
$('.btnAddTimeWork').closest('div').css("display", "none");
} else {
$('.btnAddTimeWork').closest('div').css("display", "flex");
if ($('.groupBox').length === 3) {
$('.btnAddTimeWork').closest('div').css("display", "none");
} else {
$('.btnAddTimeWork').closest('div').css("display", "flex");
}
if ($('.groupBoxRS').length === 4) {
$('.btnAddTimeWorkRS').closest('div').css("display", "none");
} else {
$('.btnAddTimeWorkRS').closest('div').css("display", "flex");
}
if ($('.groupBoxRS').length === 4) {
$('.btnAddTimeWorkRS').closest('div').css("display", "none");
} else {
$('.btnAddTimeWorkRS').closest('div').css("display", "flex");
}
@@ -1840,8 +1851,7 @@ $('#workshopSettingSelect').on('change', function () {
console.log('Error fetching roll call data:', err);
}
});
});
}
function loadCleaveClasses(){