Update index size in EcmActions

This commit is contained in:
Michał Zieliński
2025-07-24 18:35:47 +02:00
parent 5b11710b1b
commit 70c01af843

View File

@@ -12,21 +12,12 @@ $(document).ready(function () {
//$('#cost_hour').attr('disabled','disabled'); //$('#cost_hour').attr('disabled','disabled');
startCat = $('#category').find(":selected").val(); startCat = $('#category').find(":selected").val();
startIndex = $('#indeks').val(); startIndex = $('#indeks').val();
if ($('#indeks').val() == '') {
categoryChange();
}
$("#cost_action").change(function () { $("#cost_action").change(function () {
cost_actionChange(); cost_actionChange();
}); });
$("#cost_hour").change(function () { $("#cost_hour").change(function () {
cost_hourChange(); cost_hourChange();
}); });
$('#category').change(function () {
categoryChange();
});
$('#indeks').change(function () {
indeksChange();
});
$('#cost_other').change(function () { $('#cost_other').change(function () {
cost_otherChange(); cost_otherChange();
}); });
@@ -200,44 +191,10 @@ function categoryChange() {
} }
} }
function indeksChange() {
var checkindeks = $.trim($("#indeks").val()).toUpperCase();
if (checkindeks.length > 0) {
if (checkindeks.length > 10) {
checkindeks = checkindeks.substring(0, 10);
}
$("#indeks").val(checkindeks);
var condition = false;
var category = $('#category').find(":selected").val();
$.ajax({
type: "POST",
url: "index.php?module=EcmActions&action=indeksIncrement&to_pdf=1",
dataType: "json",
async: false,
data: {
job: "checkIndeks",
indeks: checkindeks,
category: category,
},
success: function (data) {
condition = data;
}
});
if (condition) {
alert("Podany indeks dla danej kategorii już istnieje");
$("#indeks").val('');
}
} else {
alert("Indeks nie może być pusty");
}
}
function indeksChek(){ function indeksChek(){
var checkindeks = $.trim($("#indeks").val()).toUpperCase(); var checkindeks = $.trim($("#indeks").val()).toUpperCase();
if (checkindeks.length > 0) { if (checkindeks.length > 0) {
if (checkindeks.length > 10) {
checkindeks = checkindeks.substring(0, 10);
}
$("#indeks").val(checkindeks); $("#indeks").val(checkindeks);
var condition = false; var condition = false;
var category = $('#category').find(":selected").val(); var category = $('#category').find(":selected").val();
@@ -269,7 +226,7 @@ function updateTime() {
var seconds = parseInt($("#seconds").val()); var seconds = parseInt($("#seconds").val());
var tmp = hours + minutes + seconds; var tmp = hours + minutes + seconds;
$("#time").val(tmp); $("#time").val(tmp);
var time = tmp; var time = tmp;
var cost_hour = UnformatNumber($("#cost_hour").val())*100; var cost_hour = UnformatNumber($("#cost_hour").val())*100;
if (isNaN(cost_hour) || cost_hour == 'NaN,NaN') { if (isNaN(cost_hour) || cost_hour == 'NaN,NaN') {
@@ -281,7 +238,7 @@ function updateTime() {
} }
var tmp = ((cost_hour_h*time)/100).toFixed(2); var tmp = ((cost_hour_h*time)/100).toFixed(2);
$("#cost_action").val(FormatNumber(tmp)); $("#cost_action").val(FormatNumber(tmp));
var tmp2 = (((cost_netto_s*time)/100)).toFixed(2); var tmp2 = (((cost_netto_s*time)/100)).toFixed(2);
$("#cost_other").val(FormatNumber(tmp2)); $("#cost_other").val(FormatNumber(tmp2));
} }