Aggiungi DefinePlugin per la gestione dell'ambiente e aggiorna gli URL API per la produzione
This commit is contained in:
@@ -16,16 +16,16 @@ let prescrizione;
|
||||
let def_config;
|
||||
let lang = navigator.language.split('-')[0] != 'it' ? 'en' : 'it';
|
||||
const hidden_fields = {};
|
||||
let API = 'http://localhost/api/';
|
||||
let CRM_URL = 'http://localhost/prescrizioni/';
|
||||
let CFG_URL = 'http://localhost/config-predefinite/';
|
||||
let API = 'https://lto.test/api/';
|
||||
let CRM_URL = 'https://lto.test/prescrizioni/';
|
||||
let CFG_URL = 'https://lto.test/config-predefinite-tads/';
|
||||
|
||||
//if(process.env.NODE_ENV === 'production'){
|
||||
if(process.env.NODE_ENV === 'production'){
|
||||
API = 'https://setup.allineatoriinvisibili.it/api/';
|
||||
CRM_URL = 'https://setup.allineatoriinvisibili.it/prescrizioni/';
|
||||
CFG_URL = 'https://setup.allineatoriinvisibili.it/config-predefinite/';
|
||||
CFG_URL = 'https://setup.allineatoriinvisibili.it/config-predefinite-tads/';
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
const assetDir = './assets/'
|
||||
const anteprimaDir = assetDir+'images/anteprima_finiture/';
|
||||
@@ -108,7 +108,7 @@ export const init = async (_scene, _cameraControls) => {
|
||||
let edit = url.searchParams.get("edit");
|
||||
|
||||
|
||||
let force_lang = url.searchParams.get("lang");
|
||||
let force_lang = url.searchParams.get("lang") || localStorage.getItem('lang');
|
||||
if(force_lang != null){
|
||||
lang = force_lang;
|
||||
}else{
|
||||
@@ -118,18 +118,20 @@ export const init = async (_scene, _cameraControls) => {
|
||||
|
||||
if(id != null){
|
||||
if(type != null && type == 'default'){
|
||||
def_config = await (await fetch(API+'frontend/def-config/'+id)).json();
|
||||
fetch(API+'frontend/def-config-tads/'+id).then(res => res.json()).then(data => {
|
||||
console.log(data);
|
||||
})
|
||||
|
||||
def_config = await (await fetch(API+'frontend/def-config-tads/'+id)).json();
|
||||
|
||||
$(".btn-torna-prescrizione").addClass('d-none');
|
||||
$(".btn-torna-prescrizione-modal").addClass('d-none');
|
||||
|
||||
if(demo_mode != null){
|
||||
|
||||
$(".btn-salva").addClass('d-none');
|
||||
$(".btn-torna-prescrizione").addClass('d-none');
|
||||
}else{
|
||||
$(".btn-torna-config-modal,.btn-torna-indietro").removeClass('d-none').on('click', ()=>{ location.href = CFG_URL })
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +141,7 @@ export const init = async (_scene, _cameraControls) => {
|
||||
let cfg = configurazione[k];
|
||||
$("#"+cfg.field.id).val(cfg.value);
|
||||
$("#"+cfg.field.id).trigger('change');
|
||||
//updateConfig(cfg.field, cfg.value, cfg.label)
|
||||
updateConfig(cfg.field, cfg.value, cfg.label)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@@ -150,7 +152,7 @@ export const init = async (_scene, _cameraControls) => {
|
||||
let ed_config = null;
|
||||
|
||||
if(id_config != null){
|
||||
ed_config = await (await fetch(API+'frontend/def-config/'+id_config)).json();
|
||||
ed_config = await (await fetch(API+'frontend/def-config-tads/'+id_config)).json();
|
||||
}
|
||||
|
||||
prescrizione = await (await fetch(API+'frontend/config/'+id)).json();
|
||||
@@ -174,7 +176,7 @@ export const init = async (_scene, _cameraControls) => {
|
||||
|
||||
$("#"+cfg.field.id).val(cfg.value);
|
||||
$("#"+cfg.field.id).trigger('change');
|
||||
//updateConfig(cfg.field, cfg.value, cfg.label)
|
||||
updateConfig(cfg.field, cfg.value, cfg.label)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,7 +447,7 @@ const salvaConfigurazione = async () => {
|
||||
let toSend = {configurazione: config, configurazione_html: config_html.innerHTML}
|
||||
|
||||
if(def_config != null){
|
||||
url = API+'frontend/save-def-config';
|
||||
url = API+'frontend/save-def-config-tads';
|
||||
toSend.id = def_config.id;
|
||||
}else{
|
||||
toSend.prescrizione_id = prescrizione.id;
|
||||
@@ -497,5 +499,7 @@ window.appendLang = (lang) => {
|
||||
}else{
|
||||
window.location.href += '?lang='+lang;
|
||||
}
|
||||
|
||||
localStorage.setItem('lang', lang);
|
||||
|
||||
}
|
||||
@@ -342,7 +342,7 @@ export const loadModels = async (config) => {
|
||||
|
||||
}
|
||||
|
||||
console.log("Active objs:", activeObjs);
|
||||
//console.log("Active objs:", activeObjs);
|
||||
|
||||
mainGroup.traverse((el) => {
|
||||
if(el.isMesh && el.userData.type != 'arcata') el.visible = false;
|
||||
|
||||
Reference in New Issue
Block a user