- aggiornamenti guida RIS, FAQ
- Editor HTML aggiunto CSS e Script - Statistiche - CRISBalanceBar - Inizio Sync... (ma disattivato)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2324,6 +2324,7 @@ export const colmyUserGroup = [
|
||||
required: false,
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit,
|
||||
visible: false,
|
||||
sortable: false,
|
||||
}),
|
||||
AddCol({
|
||||
name: 'visibility',
|
||||
@@ -2508,6 +2509,7 @@ export const colmyGoods = [
|
||||
required: false,
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit,
|
||||
visible: false,
|
||||
sortable: false,
|
||||
}),
|
||||
AddCol({
|
||||
name: 'idShipping',
|
||||
|
||||
@@ -4232,7 +4232,7 @@ export const tools = {
|
||||
},
|
||||
|
||||
sitename() {
|
||||
return this.getappname()
|
||||
return this.getappname();
|
||||
},
|
||||
|
||||
getproc() {
|
||||
@@ -4681,9 +4681,9 @@ export const tools = {
|
||||
return def;
|
||||
}
|
||||
},
|
||||
getCookieBool(mytok: any, def?: any) {
|
||||
getCookieBool(mytok: any, def?: any): boolean {
|
||||
const ris = Cookies.get(mytok);
|
||||
if (ris === 'null') return def;
|
||||
if (ris === 'null' || ris === undefined || ris === null) return def;
|
||||
|
||||
return ris === '1' ? true : false;
|
||||
},
|
||||
@@ -11430,14 +11430,29 @@ export const tools = {
|
||||
.replace(/[ \t]{2,}/g, ' '); // 2+ spazi → 1 spazio (MA non newline) },
|
||||
},
|
||||
// Nel tuo file tools.ts o dove hai le utility
|
||||
convertHTMLForElement(htmlText: string, usacomeHTML?: boolean): string {
|
||||
convertHTMLForElement(
|
||||
htmlText: string,
|
||||
usacomeHTML?: boolean,
|
||||
customCss?: string
|
||||
): string {
|
||||
if (!htmlText) return '';
|
||||
|
||||
if (!usacomeHTML) {
|
||||
return htmlText;
|
||||
}
|
||||
|
||||
return this.converteSpaziMultipliIn1solo(htmlText);
|
||||
let str = this.converteSpaziMultipliIn1solo(htmlText);
|
||||
|
||||
if (customCss) {
|
||||
str = `
|
||||
<style scoped>
|
||||
${customCss}
|
||||
</style>
|
||||
${str}
|
||||
`;
|
||||
}
|
||||
|
||||
return str;
|
||||
},
|
||||
|
||||
convertinbspInSpazi(str: string) {
|
||||
@@ -11459,7 +11474,7 @@ export const tools = {
|
||||
},
|
||||
|
||||
isGruppoMacro() {
|
||||
return this.getIdApp() === this.IDAPP_MACRO
|
||||
return this.getIdApp() === this.IDAPP_MACRO;
|
||||
},
|
||||
|
||||
// FINE !
|
||||
|
||||
@@ -56,6 +56,8 @@ import { useCatalogStore } from './CatalogStore';
|
||||
|
||||
const stateConnDefault = 'online';
|
||||
|
||||
const USASYNC = false;
|
||||
|
||||
async function getConfig(id: any) {
|
||||
return globalroutines('read', 'config', null, id);
|
||||
}
|
||||
@@ -1271,8 +1273,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
// console.log('loadAfterLogin')
|
||||
this.clearDataAfterLoginOnlyIfActiveConnection();
|
||||
|
||||
await userStore.loadListaEditori();
|
||||
await userStore.loadListaReferenti();
|
||||
if (tools.isGruppoMacro()) {
|
||||
await userStore.loadListaEditori();
|
||||
await userStore.loadListaReferenti();
|
||||
}
|
||||
|
||||
await globalroutines('readall', 'config', null);
|
||||
|
||||
@@ -2245,6 +2249,21 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
// User not exist !!
|
||||
}
|
||||
|
||||
|
||||
if (USASYNC) {
|
||||
// ============================================
|
||||
// 3. CARICA TABELLE SYNC DA CACHE
|
||||
// ============================================
|
||||
await this.loadSyncTablesFromCache();
|
||||
|
||||
// ============================================
|
||||
// 4. SYNC IN BACKGROUND (non blocca UI)
|
||||
// ============================================
|
||||
if (res.data._syncTables && res.data._syncTables.length > 0) {
|
||||
this.syncTablesInBackground(res.data._syncTables);
|
||||
}
|
||||
}
|
||||
|
||||
Products.init();
|
||||
|
||||
// const isLogged = localStorage.getItem(toolsext.localStorage.username)
|
||||
@@ -2306,6 +2325,49 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return { ris: false, status };
|
||||
},
|
||||
|
||||
// ============================================
|
||||
// NUOVI METODI PER SYNC
|
||||
// ============================================
|
||||
async loadSyncTablesFromCache() {
|
||||
const SyncService = (await import('@src/services/SyncService')).default;
|
||||
|
||||
// Carica da cache locale (veloce, mostra subito)
|
||||
this.resps = (await SyncService.loadFromCache('resps')) || [];
|
||||
this.workers = (await SyncService.loadFromCache('workers')) || [];
|
||||
this.groups = (await SyncService.loadFromCache('groups')) || [];
|
||||
this.mygroups = (await SyncService.loadFromCache('mygroups')) || [];
|
||||
|
||||
const Products = useProducts();
|
||||
Products.products = (await SyncService.loadFromCache('products')) || [];
|
||||
Products.cart = (await SyncService.loadFromCache('cart')) || {
|
||||
items: [],
|
||||
totalPrice: 0,
|
||||
totalQty: 0,
|
||||
userId: '',
|
||||
};
|
||||
Products.orders = (await SyncService.loadFromCache('orderscart')) || [];
|
||||
},
|
||||
|
||||
async syncTablesInBackground(syncTables: any) {
|
||||
const SyncService = (await import('@src/services/SyncService')).default;
|
||||
const idapp = tools.getEnv('VITE_APP_ID');
|
||||
|
||||
console.log('🔄 Sync in background:', syncTables);
|
||||
|
||||
try {
|
||||
// Sync tutte le tabelle indicate
|
||||
const result = await SyncService.syncAll(idapp, syncTables);
|
||||
|
||||
if (result.success) {
|
||||
console.log('✓ Sync completato');
|
||||
// Ricarica dati aggiornati negli store
|
||||
await this.loadSyncTablesFromCache();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Sync background failed:', error);
|
||||
}
|
||||
},
|
||||
|
||||
getProvinceByProv(provstr: string) {
|
||||
const recprov = this.provinces.find((rec: any) => rec.prov === provstr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user