diff --git a/public/userarea/annotationsModal.js b/public/userarea/annotationsModal.js
index 05e4dc3..15bdb4b 100644
--- a/public/userarea/annotationsModal.js
+++ b/public/userarea/annotationsModal.js
@@ -18,6 +18,8 @@ $(document).ready(function () {
let descriptionTextbox = null;
let markerObjects = {};
let partsListData = [];
+ // DIMENSIONE GLOBALE MARKER
+ let globalMarkerSize = 24;
// ===================
// MODAL INITIALIZATION
@@ -67,6 +69,9 @@ $(document).ready(function () {
});
}
modal.show();
+ // Inizializza slider dimensione marker
+ $("#markerSizeSlider").val(globalMarkerSize);
+ $("#markerSizeValue").text(globalMarkerSize + "px");
// Debug: Verifica presenza elementi DOM
console.log(
@@ -128,6 +133,7 @@ $(document).ready(function () {
}
descriptionTextbox = null;
markerObjects = {};
+ globalMarkerSize = 24;
$("#photoSelectorContainerAnnotations").empty().hide();
$("#samplePhotoAnnotations").attr("src", "");
$("#partsListAnnotations").empty();
@@ -144,6 +150,16 @@ $(document).ready(function () {
$(":focus").blur();
});
+ // SLIDER DIMENSIONE MARKER
+ $(document)
+ .off("input", "#markerSizeSlider")
+ .on("input", "#markerSizeSlider", function () {
+ globalMarkerSize = parseInt($(this).val());
+ $("#markerSizeValue").text(globalMarkerSize + "px");
+ updateMarkers();
+ markUnsaved();
+ });
+
// ===================
// PHOTO LOADERS
// ===================
@@ -465,113 +481,80 @@ $(document).ready(function () {
);
// ===================
- // BACK TO PARTS MODAL
+ // TORNA AL MODALE PARTI (modal_partsTable.php)
// ===================
$(document)
.off("click.backToParts", "#backToPartsBtnAnnotations")
.on("click.backToParts", "#backToPartsBtnAnnotations", function (e) {
e.preventDefault();
e.stopPropagation();
- console.log(
- "Evento click su #backToPartsBtnAnnotations, ID elemento:",
- $(this).attr("id"),
- );
- if (!$("#backToPartsBtnAnnotations").length) {
- console.error(
- "Pulsante #backToPartsBtnAnnotations non trovato nel DOM.",
- );
- const errorMsg = $(
- '
Errore: Pulsante #backToPartsBtnAnnotations non trovato nel DOM.
',
- );
- $("#annotationsModal .modal-body").prepend(errorMsg);
- setTimeout(function () {
- errorMsg.fadeOut(500, function () {
- $(this).remove();
- });
- }, 5000);
- return;
- }
- // Controlla modifiche non salvate
if (
unsavedChanges &&
!confirm(
"Hai modifiche non salvate. Vuoi davvero tornare al modale delle parti?",
)
) {
- console.log(
- "Tornare al modale delle parti annullato a causa di modifiche non salvate.",
- );
return;
}
- // Chiudi annotationsModal
- const annotationsModalElement =
- document.getElementById("annotationsModal");
- const annotationsModal = bootstrap.Modal.getInstance(
- annotationsModalElement,
- );
- if (annotationsModal) {
- annotationsModal.hide();
- } else {
- console.error(
- "Impossibile trovare l'istanza del modale #annotationsModal.",
- );
- }
-
- // Apri partsModal
const iddatadb = $("#annotationsModal").data("iddatadb");
const idquotations = $("#annotationsModal").data("idquotations");
const trfHeader = $("#trfHeaderAnnotations").text();
- console.log("Apertura partsModal con:", {
+
+ // CHIUDI MODALE ANNOTAZIONI IN MODO SICURO
+ const annotationsModalElement =
+ document.getElementById("annotationsModal");
+ if (annotationsModalElement) {
+ const modalInstance = bootstrap.Modal.getInstance(
+ annotationsModalElement,
+ );
+ if (modalInstance) {
+ modalInstance.hide();
+ } else {
+ $(annotationsModalElement).modal("hide"); // fallback jQuery
+ }
+ }
+ console.log("Torno a modal_partsTable.php con:", {
iddatadb,
idquotations,
trfHeader,
});
+ // CARICA E APRI MODALE PARTI
+ $.get(
+ "modal_partsTable.php",
+ {
+ iddatadb: iddatadb || "",
+ idquotations: idquotations || "",
+ trfHeader: trfHeader,
+ },
+ function (data) {
+ // Rimuovi vecchio modale (con ID corretto)
+ $("#partsTableModal").remove();
+ $(".modal-backdrop").remove();
- const partsModalElement = document.getElementById("partsModal");
- if (!partsModalElement) {
- console.error("Elemento #partsModal non trovato nel DOM.");
- const errorMsg = $(
- 'Errore: Il modale delle parti non è presente nel DOM.
',
+ // Aggiungi nuovo modale
+ $("body").append(data);
+
+ // Apri con Bootstrap 5
+ const partsModalElement =
+ document.getElementById("partsTableModal");
+ if (partsModalElement) {
+ const modal = new bootstrap.Modal(partsModalElement, {
+ backdrop: true,
+ keyboard: true,
+ focus: true,
+ });
+ modal.show();
+ }
+ },
+ ).fail(function (xhr) {
+ console.error("Errore caricamento modale parti:", xhr);
+ alert(
+ "Errore 404: modal_partsTable.php non trovato o errore server.",
);
- $("#annotationsModal .modal-body").prepend(errorMsg);
- setTimeout(function () {
- errorMsg.fadeOut(500, function () {
- $(this).remove();
- });
- }, 5000);
- return;
- }
-
- let partsModal = bootstrap.Modal.getInstance(partsModalElement);
- if (!partsModal) {
- partsModal = new bootstrap.Modal(partsModalElement, {
- backdrop: true,
- keyboard: true,
- focus: true,
- });
- }
-
- // Inizializza il modale delle parti
- if (typeof window.initPartsModal === "function") {
- window.initPartsModal(iddatadb, idquotations, trfHeader);
- partsModal.show();
- console.log("partsModal aperto con successo.");
- } else {
- console.error("Funzione initPartsModal non definita.");
- const errorMsg = $(
- 'Errore: Funzione initPartsModal non trovata.
',
- );
- $("#annotationsModal .modal-body").prepend(errorMsg);
- setTimeout(function () {
- errorMsg.fadeOut(500, function () {
- $(this).remove();
- });
- }, 5000);
- }
+ });
});
-
// ===================
// PARTS LIST
// ===================
@@ -892,8 +875,8 @@ $(document).ready(function () {
return;
}
- const radius = 12;
- const fontSize = 16;
+ const radius = globalMarkerSize / 2;
+ const fontSize = Math.max(10, Math.round(globalMarkerSize * 0.65));
const markerColor =
marker.color || partColors[marker.partNumber] || "#ff0000";
@@ -1013,7 +996,7 @@ $(document).ready(function () {
scaleY: 1,
backgroundColor: "transparent",
fontFamily: "Arial",
- fontSize: 24,
+ fontSize: Math.max(16, Math.round(globalMarkerSize * 0.8)),
fill: "#000000",
padding: 10,
editable: false,
diff --git a/public/userarea/modal_annotations.php b/public/userarea/modal_annotations.php
index 85203c7..fcc66e6 100644
--- a/public/userarea/modal_annotations.php
+++ b/public/userarea/modal_annotations.php
@@ -1,14 +1,23 @@
-
+
-
+
+
Elenco Parti
@@ -16,15 +25,17 @@
-
+
-
+
+
+
Foto del Campione
-
+
@@ -216,4 +227,32 @@
transform: translateX(-50%);
z-index: 3000;
}
+
+ /* Stile per lo slider */
+ #markerSizeSlider {
+ -webkit-appearance: none;
+ height: 6px;
+ border-radius: 3px;
+ background: #ddd;
+ outline: none;
+ }
+
+ #markerSizeSlider::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ width: 16px;
+ height: 16px;
+ border-radius: 50%;
+ background: #007bff;
+ cursor: pointer;
+ }
+
+ #markerSizeSlider::-moz-range-thumb {
+ width: 16px;
+ height: 16px;
+ border-radius: 50%;
+ background: #007bff;
+ cursor: pointer;
+ border: none;
+ }
\ No newline at end of file
diff --git a/public/userarea/quotations.php b/public/userarea/quotations.php
index 96a6d52..f2d9b43 100644
--- a/public/userarea/quotations.php
+++ b/public/userarea/quotations.php
@@ -399,14 +399,18 @@ if (isset($_GET['edit_id'])) {
-
-
+
+
+
+
-
+
+
+
-
+