fix: Include single sample photo in save operation when no photos selected
This commit is contained in:
parent
03771e3ca8
commit
6ec0c2062e
@ -1842,14 +1842,22 @@ $(document).ready(function () {
|
|||||||
$(this).find(".save-loading").show();
|
$(this).find(".save-loading").show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let photoList = $('#photoSelector option').map(function () {
|
||||||
|
return this.value?.split('/')?.pop();
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
if (!photoList.length) {
|
||||||
|
let path = $('#samplePhoto').attr("src")?.split('/')?.pop();
|
||||||
|
|
||||||
|
if (path) photoList = [path];
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "save_parts_photo_iddatadb.php",
|
url: "save_parts_photo_iddatadb.php",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
iddatadb: $("#partsModal").data("iddatadb"),
|
iddatadb: $("#partsModal").data("iddatadb"),
|
||||||
photoList: $('#photoSelector option').map(function () {
|
photoList,
|
||||||
return this.value?.split('/')?.pop();
|
|
||||||
}).get(),
|
|
||||||
partIds: $('#partsTableBody tr').map(function () {
|
partIds: $('#partsTableBody tr').map(function () {
|
||||||
return $(this).data("part-id");
|
return $(this).data("part-id");
|
||||||
}).get(),
|
}).get(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user