employeeOptions bug fixed
This commit is contained in:
@@ -49,10 +49,10 @@ public class EmployeeComputeOptionsRepository : RepositoryBase<long, EmployeeCom
|
||||
ComputeOptions = getFromWorkshop.ComputeOptions,
|
||||
YearsOptions = getFromWorkshop.YearsOptions,
|
||||
BonusesOptions= getFromWorkshop.BonusesOptions,
|
||||
CreateCheckout = true,
|
||||
CreateContract = true,
|
||||
SignCheckout = true,
|
||||
SignContract = true
|
||||
CreateCheckout = getFromWorkshop.CreateCheckout,
|
||||
CreateContract = getFromWorkshop.CreateContract,
|
||||
SignCheckout = getFromWorkshop.SignCheckout,
|
||||
SignContract = getFromWorkshop.SignContract
|
||||
};
|
||||
|
||||
result = fromWorkshop;
|
||||
|
||||
@@ -133,15 +133,15 @@
|
||||
@if (@item.ContractPerson)
|
||||
{
|
||||
<div>
|
||||
<label for="FailureCreateContract_@item.EmployeeId" style="display: flex; align-items: center; gap: 5px;">
|
||||
<input type="checkbox" id="FailureCreateContract_@item.EmployeeId" @(!item.CreateContract ? "checked" : "") />
|
||||
عدم ایجاد قرارداد
|
||||
<label for="FailureCreateContract_@item.EmployeeId" style="display: flex; align-items: center; gap: 5px;">
|
||||
<input class="real-checkbox" type="checkbox" data-employeeId="@item.EmployeeId" id="FailureCreateContract_@item.EmployeeId" @(item.CreateContract ? "checked" : "") />
|
||||
ایجاد قرارداد
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="FailureSignContract_@item.EmployeeId" style="display: flex; align-items: center; gap: 5px;">
|
||||
<input type="checkbox" id="FailureSignContract_@item.EmployeeId" @(!item.SignContract ? "checked" : "") />
|
||||
عدم امضا قرارداد
|
||||
<label for="FailureSignContract_@item.EmployeeId" style="display: flex; align-items: center; gap: 5px;">
|
||||
<input class="real-checkbox" data-employeeId="@item.EmployeeId" type="checkbox" id="FailureSignContract_@item.EmployeeId" @(item.SignContract ? "checked" : "") />
|
||||
امضا قرارداد
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
@@ -151,15 +151,15 @@
|
||||
@if (@item.ContractPerson)
|
||||
{
|
||||
<div>
|
||||
<label for="FailureCreateCheckout_@item.EmployeeId" style="display: flex; align-items: center; gap: 5px;">
|
||||
<input type="checkbox" id="FailureCreateCheckout_@item.EmployeeId" @(!item.CreateCheckout ? "checked" : "") />
|
||||
عدم ایجاد تصفیه حساب
|
||||
<label for="FailureCreateCheckout_@item.EmployeeId" style="display: flex; align-items: center; gap: 5px;">
|
||||
<input class="real-checkbox" data-employeeId="@item.EmployeeId" type="checkbox" id="FailureCreateCheckout_@item.EmployeeId" @(item.CreateCheckout ? "checked" : "") />
|
||||
ایجاد تصفیه حساب
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label for="FailureSignCheckout_@item.EmployeeId" style="display: flex; align-items: center; gap: 5px;">
|
||||
<input type="checkbox" id="FailureSignCheckout_@item.EmployeeId" @(!item.SignCheckout ? "checked" : "") />
|
||||
عدم امضا تصفیه حساب
|
||||
<label for="FailureSignCheckout_@item.EmployeeId" style="display: flex; align-items: center; gap: 5px;">
|
||||
<input class="real-checkbox" data-employeeId="@item.EmployeeId" type="checkbox" id="FailureSignCheckout_@item.EmployeeId" @(item.SignCheckout ? "checked" : "") />
|
||||
امضا تصفیه حساب
|
||||
</label>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -49,10 +49,9 @@ namespace ServiceHost.Areas.Admin.Pages.Company.ConnectedPersonnels
|
||||
foreach (var item in result)
|
||||
{
|
||||
var option = new EmployeeComputeOptionsViewModel();
|
||||
if (item.ContractPerson)
|
||||
{
|
||||
|
||||
option = _employeeComputeOptionsApplication.GetEmployeeOptions(workshopID, item.EmployeeId);
|
||||
}
|
||||
|
||||
|
||||
var finalResult = new ConnectedPersonnelViewModel()
|
||||
{
|
||||
@@ -66,13 +65,14 @@ namespace ServiceHost.Areas.Admin.Pages.Company.ConnectedPersonnels
|
||||
InsurancetLeft = item.InsurancetLeft,
|
||||
Black = item.Black,
|
||||
StartWork = item.StartWork,
|
||||
BonusesOptions = item.ContractPerson ? option.BonusesOptions : "null",
|
||||
ComputeOptions = item.ContractPerson ? option.ComputeOptions : "null",
|
||||
YearsOptions = item.ContractPerson ? option.YearsOptions : "null",
|
||||
CreateContract = item.ContractPerson ? option.CreateContract :false,
|
||||
CreateCheckout = item.ContractPerson ? option.CreateCheckout : false,
|
||||
SignContract = item.ContractPerson ? option.SignContract : false,
|
||||
SignCheckout = item.ContractPerson ? option.SignCheckout : false
|
||||
BonusesOptions = option.BonusesOptions,
|
||||
ComputeOptions = option.ComputeOptions,
|
||||
YearsOptions = option.YearsOptions,
|
||||
CreateContract = option.CreateContract,
|
||||
CreateCheckout = option.CreateCheckout,
|
||||
SignContract = option.SignContract,
|
||||
SignCheckout = option.SignCheckout,
|
||||
|
||||
};
|
||||
|
||||
final.Add(finalResult);
|
||||
|
||||
@@ -341,34 +341,60 @@ $(document).ready(function () {
|
||||
// const employeeId = this.id.split('_')[1];
|
||||
// handleCheckboxLogic1(employeeId);
|
||||
//});
|
||||
$('.real-checkbox').on('change', function () {
|
||||
let employeeId = Number($(this).attr("data-employeeId"));
|
||||
|
||||
const $CreateContract = $(`#FailureCreateContract_${employeeId}`);
|
||||
const $SignContract = $(`#FailureSignContract_${employeeId}`);
|
||||
const $CreateCheckout = $(`#FailureCreateCheckout_${employeeId}`);
|
||||
const $SignCheckout = $(`#FailureSignCheckout_${employeeId}`);
|
||||
|
||||
$('[id^="FailureCreateContract_"]').each(function () {
|
||||
const employeeId = this.id.split('_')[1];
|
||||
if (!$CreateContract.is(':checked')) {
|
||||
$SignContract.prop('checked', false);
|
||||
$CreateCheckout.prop('checked', false);
|
||||
}
|
||||
|
||||
const $notCreateContract = document.getElementById(`FailureCreateContract_${employeeId}`);
|
||||
const $notSignContract = document.getElementById(`FailureSignContract_${employeeId}`);
|
||||
const $notCreateCheckout = document.getElementById(`FailureCreateCheckout_${employeeId}`);
|
||||
const $notSignCheckout = document.getElementById(`FailureSignCheckout_${employeeId}`);
|
||||
|
||||
$notCreateContract.addEventListener("change", () => handler());
|
||||
$notSignContract.addEventListener("change", () => handler());
|
||||
$notCreateCheckout.addEventListener("change", () => handler());
|
||||
$notSignCheckout.addEventListener("change", () => handler());
|
||||
//// تعریف روابط
|
||||
//$createContract.addChild($signContract);
|
||||
//$createContract.addChild($createCheckout);
|
||||
//$createCheckout.addChild($signCheckout);
|
||||
function handler() {
|
||||
if ($notCreateContract.checked) {
|
||||
$notSignContract.checked = true;
|
||||
$notCreateCheckout.checked = true;
|
||||
}
|
||||
|
||||
if ($notCreateCheckout.checked) {
|
||||
$notSignCheckout.checked = true;
|
||||
}
|
||||
if (!$CreateCheckout.is(':checked')) {
|
||||
$SignCheckout.prop('checked', false);
|
||||
}
|
||||
});
|
||||
//$('[id^="FailureCreateContract_"]').each(function () {
|
||||
// const employeeId = this.id.split('_')[1];
|
||||
|
||||
// const $notCreateContract = document.getElementById(`FailureCreateContract_${employeeId}`);
|
||||
// const $notSignContract = document.getElementById(`FailureSignContract_${employeeId}`);
|
||||
// const $notCreateCheckout = document.getElementById(`FailureCreateCheckout_${employeeId}`);
|
||||
// const $notSignCheckout = document.getElementById(`FailureSignCheckout_${employeeId}`);
|
||||
|
||||
// $notCreateContract.addEventListener("change", () => handler());
|
||||
// $notSignContract.addEventListener("change", () => handler());
|
||||
// $notCreateCheckout.addEventListener("change", () => handler());
|
||||
// $notSignCheckout.addEventListener("change", () => handler());
|
||||
// //// تعریف روابط
|
||||
// //$createContract.addChild($signContract);
|
||||
// //$createContract.addChild($createCheckout);
|
||||
// //$createCheckout.addChild($signCheckout);
|
||||
|
||||
// if (!$CreateContract.is(':checked')) {
|
||||
// $SignContract.prop('checked', false);
|
||||
// $CreateCheckout.prop('checked', false);
|
||||
// }
|
||||
|
||||
// if (!$CreateCheckout.is(':checked')) {
|
||||
// $SignCheckout.prop('checked', false);
|
||||
// }
|
||||
// function handler() {
|
||||
// if ($notCreateContract.checked) {
|
||||
// $notSignContract.checked = false;
|
||||
// $notCreateCheckout.checked = false;
|
||||
// $notSignCheckout.checked = false;
|
||||
// }
|
||||
|
||||
// if ($notCreateCheckout.checked) {
|
||||
// $notSignCheckout.checked = false;
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
});
|
||||
|
||||
function save(EmployeeId) {
|
||||
@@ -379,10 +405,10 @@ function save(EmployeeId) {
|
||||
command.BonusesOptions = $('[data-BonusesOptions="' + EmployeeId + '"]').val();
|
||||
command.YearsOptions = $('[data-YearsOptions="' + EmployeeId + '"]').val();
|
||||
|
||||
command.CreateContract = !$(`#FailureCreateContract_${EmployeeId}`).prop("checked");
|
||||
command.SignContract = !$(`#FailureSignContract_${EmployeeId}`).prop("checked");
|
||||
command.CreateCheckout = !$(`#FailureCreateCheckout_${EmployeeId}`).prop("checked");
|
||||
command.SignCheckout = !$(`#FailureSignCheckout_${EmployeeId}`).prop("checked");
|
||||
command.CreateContract = $(`#FailureCreateContract_${EmployeeId}`).prop("checked");
|
||||
command.SignContract = $(`#FailureSignContract_${EmployeeId}`).prop("checked");
|
||||
command.CreateCheckout = $(`#FailureCreateCheckout_${EmployeeId}`).prop("checked");
|
||||
command.SignCheckout = $(`#FailureSignCheckout_${EmployeeId}`).prop("checked");
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
|
||||
Reference in New Issue
Block a user