This commit is contained in:
SamSys
2025-05-14 19:57:01 +03:30
parent f7f44b98fb
commit bc36d8e151
3 changed files with 46 additions and 8 deletions

View File

@@ -848,6 +848,9 @@
var alertModalAjax = '@Url.Page("./AutoExtension", "AlertModal")';
var clockAjax = '@Url.Page("./AutoExtension", "Clock")';
var createContractAjax = '@Url.Page("./AutoExtension", "CreateContract")';
var EmployeesStartedWorkInSelectedPeriodAjaxUrl = '@Url.Page("./AutoExtension", "EmployeesStartedWorkInSelectedPeriod")';
</script>
<script src="~/AssetsAdmin/page/Workshop/js/AutoExtension.js"></script>

View File

@@ -167,15 +167,15 @@ public class AutoExtensionModel : PageModel
//Correction();
}
public IActionResult GetEmployeesStartedWorkInSelectedPeriod(long workshopId, string startDate)
public IActionResult OnPostEmployeesStartedWorkInSelectedPeriod(long workshopId, string startDate)
{
var start = startDate.ToGeorgianDateTime();
var end = ($"{startDate.FindeEndOfMonth()}").ToGeorgianDateTime();
var LeftWorkSerchModel = new LeftWorkSearchModel
var leftWorkSerchModel = new LeftWorkSearchModel
{
WorkshopId = workshopId
};
var leftWorkList = _leftWorkApplication.search(LeftWorkSerchModel);
var leftWorkList = _leftWorkApplication.search(leftWorkSerchModel);
if (leftWorkList.Count > 0)
{

View File

@@ -180,7 +180,7 @@ $('#firstCheckBtn').on('click',
$('#datatable tbody tr').each(function (i) {
let chekbox = $(this).find("input[name=selectItem]");
if (chekbox.is(":checked") == true) {
employeeId = $(this).attr("data-employeeId");;
employeeId = $(this).attr("data-employeeId");
start = $(this).find("input[name=contarctStart]").val();
startObj = $(this).find("input[name=contarctStart]");
end = $(this).find("input[name=contractEnd]").val();
@@ -745,18 +745,22 @@ $(".edate").keyup(function () {
$('#monthSelected').on('change',
function () {
console.log("ok");
const year = $("select[name=yearSelected]").val();
const month = $(this).val();
if (year === "0") {
$("select[name=yearSelected]").addClass("errored");
}
if (year != "0" && month != "0") {
const selectedDate = year + "/" + month + "/01";
const endDate = DateComputing(selectedDate);
$(".sdate").val(selectedDate);
$(".edate").val(endDate);
$('.sdate').removeClass("errored");
$('.edate').removeClass("errored");
SetStartAndEndDate(selectedDate, endDate);
}
});
@@ -777,6 +781,37 @@ $("select[name=yearSelected]").on('change',
});
function SetStartAndEndDate(selectedDate, endDate) {
const workshopId = Number($('#workshopId').val());
$.ajax({
dataType: 'json',
type: 'POST',
url: EmployeesStartedWorkInSelectedPeriodAjaxUrl,
data: { "workshopId": workshopId, "startDate": selectedDate },
headers: { "RequestVerificationToken": $('input[name="__RequestVerificationToken"]').val() },
success: function (response) {
if (response.funded) {
$('#datatable tbody tr').each(function (i) {
let employeeId = $(this).attr("data-employeeId");
});
} else {
$(".sdate").val(selectedDate);
$(".edate").val(endDate);
$('.sdate').removeClass("errored");
$('.edate').removeClass("errored");
}
},
failure: function (response) {
console.log(5, response);
}
}); //endOf Ajax
}
function DateComputing(selectedDate) {
var persianNumbers = [/۰/g, /۱/g, /۲/g, /۳/g, /۴/g, /۵/g, /۶/g, /۷/g, /۸/g, /۹/g],
arabicNumbers = [/٠/g, /١/g, /٢/g, /٣/g, /٤/g, /٥/g, /٦/g, /٧/g, /٨/g, /٩/g],