fixed saving and modifying parts

This commit is contained in:
2025-08-25 18:08:33 +04:00
parent 24cda34681
commit a87423d879
2 changed files with 36 additions and 10 deletions
+5
View File
@@ -266,6 +266,9 @@ $(document).ready(function () {
const iddatadb = $("#partsModal").data("iddatadb");
const isMix = partDescription.startsWith("Mix") ? "Y" : "N";
// არსებული part-id row-დან (თუ უკვე არსებობს)
const partId = $row.data("part-id") || null;
if (partDescription && iddatadb) {
$saveLoading.show();
$saveStatus.hide();
@@ -277,6 +280,7 @@ $(document).ready(function () {
iddatadb: iddatadb,
parts: [
{
id: partId, // გავგზავნე part-ის ID (თუ არის)
part_number: partNumber,
part_description: partDescription,
mix: isMix,
@@ -286,6 +290,7 @@ $(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);
}