Refactor PVC models and update tests

- Updated the PVC models in the database and adjusted the tests accordingly to reflect the new model counts and codes.
- Removed deprecated models from the JSON data for PVC systems.
- Added new GLB models for "scorrevole_sf_3_ante" and "scorrevole_sf_4_ante".
- Enhanced the development scripts to streamline the build process for both frontends.
- Updated documentation to reflect changes in the development environment and deployment process.
- Improved the styling of texture radio options for better visibility.
- Fixed URL handling in the configurator to ensure proper routing and API calls.
This commit is contained in:
2026-10-20 18:40:59 +02:00
parent b6a32edfe6
commit 0dfda3a338
33 changed files with 339 additions and 366 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
// Base URL dell'API Laravel: impostata in build (import.meta.env.VITE_PREVENTIVI_API_BASE, da
// .env/.env.production — vedi root del repo), sovrascrivibile a runtime con window.PREVENTIVI_API_BASE
// senza dover rebuildare (es. per un hotfix). Nessuna delle due impostata → fallback dev locale.
// Base URL dell'API Laravel. Il configuratore è servito dallo stesso backend (/configuratore/),
// quindi di default l'API è sulla stessa origine. Sovrascrivibile a build time con
// import.meta.env.VITE_PREVENTIVI_API_BASE o a runtime con window.PREVENTIVI_API_BASE.
export const API_BASE =
(typeof window.PREVENTIVI_API_BASE === 'string' && window.PREVENTIVI_API_BASE) ||
import.meta.env.VITE_PREVENTIVI_API_BASE ||
'http://localhost:8000/api';
`${window.location.origin}/api`;
+15
View File
@@ -257,6 +257,21 @@ const buildListaModelli = (modelli, modello, categoria, sistema) => {
});
$('.lista-modelli').html(html);
// Porta in vista il modello selezionato: le icone si caricano in modo asincrono e ne cambiano la
// larghezza, quindi si ricalcola anche a ogni load (solo scroll orizzontale, niente scrollIntoView
// che scorrerebbe anche la pagina/iframe).
const scrollToSelected = () => {
document.querySelectorAll('.lista-modelli').forEach(lista => {
const sel = lista.querySelector('img.selected');
if (!sel) return;
const item = sel.closest('.btn-categoria');
const delta = item.getBoundingClientRect().left - lista.getBoundingClientRect().left;
lista.scrollLeft += delta - (lista.clientWidth - item.offsetWidth) / 2;
});
};
scrollToSelected();
$('.lista-modelli img').one('load', scrollToSelected);
}
const buildSelect = (options, parent) => {
+4 -5
View File
@@ -25,12 +25,11 @@ window.GLTFLoader = GLTFLoader; // Used by APP Scripts.
// --- Integrazione backend preventivi ---
const CART_TOKEN_KEY = 'kreios_cart_token';
// URL dell'app cliente (checkout): richiesto all'API invece di essere indovinato, perché la
// porta Vite dell'app cliente può cambiare (es. se 5199 è già occupata). Fallback locale se
// il backend non è raggiungibile.
// URL dell'app cliente (checkout): richiesto all'API (APP_FRONTEND_CLIENTE_URL). Fallback: la pagina
// /preventivo servita dallo stesso backend del configuratore.
let appClienteUrl =
(typeof window.APP_CLIENTE_URL === 'string' && window.APP_CLIENTE_URL) ||
'http://localhost:5199';
`${window.location.origin}/preventivo`;
const configReady = (async () => {
try {
@@ -66,7 +65,7 @@ window.mostraLinkPreventivo = (token, count) => {
// diverse in dev/prod): lo passiamo qui come parametro, così il link "torna al configuratore"
// nella pagina di conferma può essere generato dinamicamente invece di essere hardcoded.
const ritorno = encodeURIComponent(window.location.href);
let href = `${appClienteUrl}/?token=${encodeURIComponent(token)}&ritorno=${ritorno}`;
let href = `${appClienteUrl.replace(/\/+$/, '')}/?token=${encodeURIComponent(token)}&ritorno=${ritorno}`;
// Se il cliente è loggato nel configuratore, passiamo il suo token anche al checkout
// così può precompilare l'anagrafica già salvata (vedi AuthGate.getToken()).
const clienteToken = AuthGate.getToken();