galleria prodotto
This commit is contained in:
@@ -112,7 +112,7 @@ function getIterableStream(stream: NodeJS.ReadableStream): AsyncIterable<any> {
|
||||
}
|
||||
|
||||
// Funzione helper per inviare la richiesta HTTP
|
||||
async function Request(type, path, payload, responsedata = {}, options = {}) {
|
||||
async function Request(type: string, path: string, payload: any, responsedata = {}, options: any = {}) {
|
||||
const userStore = useUserStore();
|
||||
const globalStore = useGlobalStore();
|
||||
const baseURL = globalStore.getServerHost();
|
||||
|
||||
@@ -122,7 +122,7 @@ export const Api = {
|
||||
}
|
||||
},
|
||||
|
||||
async checkTokenScaduto(status, evitaloop, url, method, mydata, setAuthToken = false) {
|
||||
async checkTokenScaduto(status: number, evitaloop: boolean, url: string, method: string, mydata: any, setAuthToken: boolean = false) {
|
||||
const userStore = useUserStore();
|
||||
|
||||
if (status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||
@@ -167,7 +167,7 @@ export const Api = {
|
||||
},
|
||||
|
||||
// Base per la chiamata con gestione degli errori e retry
|
||||
async SendReqBase(url, method, mydata, setAuthToken = false, evitaloop = false, myformdata, responsedata, options) {
|
||||
async SendReqBase(url: string, method: string, mydata: any, setAuthToken = false, evitaloop = false, myformdata: any, responsedata: any, options: any) {
|
||||
const mydataout = {
|
||||
...mydata,
|
||||
keyappid: import.meta.env.VITE_PAO_APP_ID,
|
||||
@@ -199,7 +199,7 @@ export const Api = {
|
||||
}
|
||||
|
||||
// Verifica sul token (funzione custom)
|
||||
const ret = await this.checkTokenScaduto(res.status, evitaloop, url, method, mydata, setAuthToken);
|
||||
const ret: any = await this.checkTokenScaduto(res.status, evitaloop, url, method, mydata, setAuthToken);
|
||||
if (ret) return ret;
|
||||
|
||||
if (tools.isDebug()) console.log(' ----> ', res);
|
||||
@@ -214,7 +214,7 @@ export const Api = {
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
const ret = await this.checkTokenScaduto(error.status, evitaloop, url, method, mydataout, setAuthToken);
|
||||
const ret: any = await this.checkTokenScaduto(error.status, evitaloop, url, method, mydataout, setAuthToken);
|
||||
if (ret) return ret;
|
||||
|
||||
console.error('Errore nella richiesta:', error);
|
||||
@@ -255,7 +255,7 @@ export const Api = {
|
||||
},
|
||||
|
||||
// Funzione che gestisce la chiamata con retry
|
||||
async SendReq(url, method, mydata, setAuthToken = false, evitaloop = false, retryCount = 1, retryDelay = 5000, myformdata = null, responsedata = null, options = null) {
|
||||
async SendReq(url: string, method: string, mydata: any, setAuthToken = false, evitaloop = false, retryCount = 1, retryDelay = 5000, myformdata = null, responsedata = null, options = null) {
|
||||
try {
|
||||
return await this.SendReqBase(url, method, mydata, setAuthToken, evitaloop, myformdata, responsedata, options);
|
||||
} catch (error) {
|
||||
|
||||
@@ -463,9 +463,10 @@ export const costanti = {
|
||||
password: 512,
|
||||
listimages: 1024,
|
||||
exact: 2048,
|
||||
image: 3000,
|
||||
imagerec: 3000,
|
||||
pdf: 3050,
|
||||
image_and_filename: 3100,
|
||||
imgfile_sfuso: 3150,
|
||||
imgcard: 3500,
|
||||
coordinates: 3800,
|
||||
select_by_server: 4000,
|
||||
|
||||
@@ -130,7 +130,7 @@ export const colTableRaccoltaCataloghi = [
|
||||
AddCol({
|
||||
name: 'foto_raccolta',
|
||||
label_trans: 'racccat.foto_raccolta',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
fieldtype: costanti.FieldType.imagerec,
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
@@ -186,7 +186,7 @@ export const colTableCatalogList = [
|
||||
AddCol({
|
||||
name: 'foto_collana',
|
||||
label_trans: 'cataloglist.foto_collana',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
fieldtype: costanti.FieldType.imagerec,
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
@@ -254,7 +254,7 @@ export const colTableCatalogList = [
|
||||
AddCol({
|
||||
name: 'img_bordata',
|
||||
label_trans: 'cataloglist.img_bordata',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
fieldtype: costanti.FieldType.imagerec,
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
@@ -262,7 +262,7 @@ export const colTableCatalogList = [
|
||||
AddCol({
|
||||
name: 'img_intro',
|
||||
label_trans: 'cataloglist.img_intro',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
fieldtype: costanti.FieldType.imagerec,
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
@@ -282,7 +282,7 @@ export const colTableCatalogList = [
|
||||
AddCol({
|
||||
name: 'img_bordata_stampa',
|
||||
label_trans: 'cataloglist.img_bordata_stampa',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
fieldtype: costanti.FieldType.imagerec,
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
@@ -290,7 +290,7 @@ export const colTableCatalogList = [
|
||||
AddCol({
|
||||
name: 'img_intro_stampa',
|
||||
label_trans: 'cataloglist.img_intro_stampa',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
fieldtype: costanti.FieldType.imagerec,
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
@@ -371,7 +371,7 @@ export const colIText = [
|
||||
AddCol({ name: 'line_height', label_trans: 'catalogo.line_height', fieldtype: costanti.FieldType.number }),
|
||||
]
|
||||
export const colmyIImg = [
|
||||
AddCol({ name: 'imagefile', label_trans: 'iimg.imagefile', fieldtype: costanti.FieldType.image }),
|
||||
AddCol({ name: 'imagefile', label_trans: 'iimg.imagefile', fieldtype: costanti.FieldType.imagerec }),
|
||||
AddCol({ name: 'fit', label_trans: 'iimg.fit', fieldtype: costanti.FieldType.string }),
|
||||
]
|
||||
|
||||
@@ -504,7 +504,7 @@ export const colmyelems = [
|
||||
AddCol({
|
||||
name: 'image',
|
||||
label_trans: 'myelems.image',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
fieldtype: costanti.FieldType.imagerec,
|
||||
}),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
@@ -1737,7 +1737,7 @@ export const colAttivita = [
|
||||
AddCol({
|
||||
name: 'logo',
|
||||
label_trans: 'attivita.logo',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
fieldtype: costanti.FieldType.imagerec,
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
@@ -2699,6 +2699,21 @@ export const colTableVariazioni = [
|
||||
AddCol({ name: 'eta', label_trans: 'catalogo.eta', fieldtype: costanti.FieldType.string }),
|
||||
]
|
||||
|
||||
export const colTableProductInfosShort = [
|
||||
AddCol({ name: 'code', label_trans: 'products.code', required: true }),
|
||||
AddCol({ name: 'name', label_trans: 'products.name' }),
|
||||
AddCol({ name: 'description', label_trans: 'products.description', fieldtype: costanti.FieldType.html }),
|
||||
AddCol({ name: 'imagefile', label_trans: 'products.img', fieldtype: costanti.FieldType.imgfile_sfuso, path: 'products/' }),
|
||||
AddCol({
|
||||
name: 'idCatProds',
|
||||
label_trans: 'products.category',
|
||||
fieldtype: costanti.FieldType.multiselect,
|
||||
jointable: 'catprods',
|
||||
}),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
|
||||
export const colTableProductInfos = [
|
||||
AddCol({ name: 'code', label_trans: 'products.code', required: true }),
|
||||
AddCol({ name: 'codice_EAN', label_trans: 'products.codice_EAN' }),
|
||||
@@ -2768,6 +2783,20 @@ export const colTableOrdersCart = [
|
||||
AddCol({ name: 'status', label_trans: 'orderscart.status', fieldtype: costanti.FieldType.number }),
|
||||
]
|
||||
|
||||
export const colTableProdShort = [
|
||||
AddCol({ name: 'active', label_trans: 'products.active', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'name', label_trans: 'products.name' }),
|
||||
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: costanti.FieldType.number, required: true }),
|
||||
AddCol({ name: 'price_acquistato', label_trans: 'products.price_acquistato', fieldtype: costanti.FieldType.number, required: true }),
|
||||
AddCol({
|
||||
name: 'idProductInfo',
|
||||
label_trans: 'products.productInfo',
|
||||
fieldtype: costanti.FieldType.select,
|
||||
jointable: 'productinfos',
|
||||
}),
|
||||
|
||||
]
|
||||
|
||||
export const colTableProducts = [
|
||||
AddCol({ name: 'active', label_trans: 'products.active', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'isbn', label_trans: 'products.isbn' }),
|
||||
|
||||
@@ -8937,7 +8937,7 @@ export const tools = {
|
||||
}
|
||||
},
|
||||
|
||||
getDirectoryGall(myrow: any, table: string, path: string) {
|
||||
getDirectoryGall(myrow: any, table: string, path: string, fieldtype: number = 0) {
|
||||
const userStore = useUserStore();
|
||||
|
||||
// console.log('getDirectoryGall', myrow)
|
||||
@@ -10178,7 +10178,7 @@ export const tools = {
|
||||
let eseguito = false;
|
||||
|
||||
// if (table === 'myelems') {
|
||||
if (type === costanti.FieldType.image && newval.imagefile) {
|
||||
if (type === costanti.FieldType.imagerec && newval.imagefile) {
|
||||
let myval = newval.imagefile;
|
||||
await setValDb(
|
||||
$q,
|
||||
|
||||
Reference in New Issue
Block a user