fixed saving and modifying parts
This commit is contained in:
@@ -179,7 +179,7 @@ $(document).ready(function () {
|
||||
function addNewRow(nextPartNumber, isMix = false) {
|
||||
const description = isMix ? "Mix" : "";
|
||||
const newRow = `
|
||||
<tr data-part-id="new">
|
||||
<tr data-part-id="">
|
||||
<td><input type="number" class="form-control form-control-sm part-number" value="${nextPartNumber || 1}" style="width: 80px;"></td>
|
||||
<td><input type="text" class="form-control form-control-sm part-description" value="${description}" placeholder="Inserisci descrizione" style="width: 100%;"></td>
|
||||
<td>
|
||||
@@ -290,13 +290,14 @@ $(document).ready(function () {
|
||||
contentType: "application/json",
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
// თუ ახალია, backend-მა მოგვცა ახალი ID
|
||||
if (response.part_id) {
|
||||
$row.data("part-id", response.part_id);
|
||||
}
|
||||
$saveLoading.hide();
|
||||
$saveStatus.show();
|
||||
updatePartsList();
|
||||
// თუ ახალია, backend-მა მოგვცა ახალი ID
|
||||
if (response.part_id) {
|
||||
$row.attr("data-part-id", response.part_id);
|
||||
$row.data("part-id", response.part_id);
|
||||
}
|
||||
setTimeout(() => $saveStatus.hide(), 2000);
|
||||
} else {
|
||||
alert("Errore nel salvataggio: " + response.message);
|
||||
|
||||
Reference in New Issue
Block a user