calculate delivery date fix

This commit is contained in:
Michał Zieliński
2025-08-30 13:15:50 +02:00
parent eab6fc87b1
commit be27602ca3
2 changed files with 204 additions and 196 deletions

View File

@@ -15,7 +15,7 @@ $(document).ready(
window.onbeforeunload = confirmExit;
// prevent submit by enter press
lockEnter();
// parent info
$("#delivery_date").on('inputchange', function () {
calculateDate($("#delivery_date").val());
});
@@ -157,6 +157,7 @@ $(document).ready(
}
});
AddSearchRecord();
calculateDate($("#delivery_date").val());
$(".loading_panel").css("display", "none");
});
// handle save
@@ -187,7 +188,6 @@ check_form = function(formname,event) {
$("#position_list").val(JSON.stringifyNoSecurity(items));
if (check_form_(formname) === true) {
return true;
} else {
@@ -196,6 +196,7 @@ check_form = function(formname,event) {
return false;
}
};
function confirmExit() {
return "";
}

View File

@@ -23,6 +23,13 @@ switch ($_POST['job']) {
function calculateDate($date){
$date = new Datetime($date);
$date->modify('-1 day');
$tmp['date']=$date->format("d.m.Y");
$tmp['date_day']=date('N', strtotime($tmp['date']));
if($tmp['date_day']==7){
$date->modify('-2 day');
} else if($tmp['date_day']==6){
$date->modify('-1 day');
}
$tmp['date']=$date->format("d.m.Y");
echo json_encode($tmp);
return '';