fixed saving and modifying parts
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user