- Generazione PDF e per Stampa
This commit is contained in:
@@ -4482,6 +4482,14 @@ export const tools = {
|
||||
return def
|
||||
}
|
||||
},
|
||||
getCookieBool(mytok: any, def?: any) {
|
||||
const ris = Cookies.get(mytok)
|
||||
if (ris === 'null')
|
||||
return def
|
||||
|
||||
return ris === '1' ? true : false
|
||||
|
||||
},
|
||||
|
||||
localStSetItem(item: string, value: string) {
|
||||
if (localStorage.getItem('cookie-id') === 'decline')
|
||||
@@ -4502,6 +4510,13 @@ export const tools = {
|
||||
return Cookies.set(mytok, value)
|
||||
},
|
||||
|
||||
setCookieBool(mytok: any, valbool: boolean) {
|
||||
if (localStorage.getItem('cookie-id') === 'decline')
|
||||
return null
|
||||
|
||||
return Cookies.set(mytok, valbool ? '1' : '0')
|
||||
},
|
||||
|
||||
removeCookie(mytok: any) {
|
||||
return Cookies.remove(mytok)
|
||||
},
|
||||
@@ -9846,11 +9861,13 @@ export const tools = {
|
||||
icon: 'fas fa-user'
|
||||
},
|
||||
{
|
||||
table: 'finto_active',
|
||||
visible: !this.isUtente(),
|
||||
label: 'Pubblicati OnLine',
|
||||
key: 'active',
|
||||
type: costanti.FieldType.boolean,
|
||||
value: this.isUtente() ? true: this.getCookie(this.COOK_SEARCH + costanti.FILTER_SEP + shared_consts.TABLES_CATALOG + costanti.FILTER_SEP + 'active', true),
|
||||
value: this.isUtente() ? true: this.getCookieBool(this.COOK_SEARCH + costanti.FILTER_SEP + 'finto_active' + costanti.FILTER_SEP + 'active', true),
|
||||
bool: true,
|
||||
keycookie: '',
|
||||
addall: true,
|
||||
arrvalue: [],
|
||||
@@ -9859,11 +9876,13 @@ export const tools = {
|
||||
icon: 'fas fa-globe'
|
||||
},
|
||||
{
|
||||
table: 'finto_isCatalogoGenerale',
|
||||
visible: !this.isUtente(),
|
||||
label: 'Solo Catalogo Generale',
|
||||
key: 'isCatalogoGenerale',
|
||||
type: costanti.FieldType.boolean,
|
||||
value: this.isUtente() ? isCatalogoGenerale: this.getCookie(this.COOK_SEARCH + costanti.FILTER_SEP + shared_consts.TABLES_CATALOG + costanti.FILTER_SEP + 'isCatalogoGenerale', isCatalogoGenerale),
|
||||
value: this.isUtente() ? isCatalogoGenerale: this.getCookieBool(this.COOK_SEARCH + costanti.FILTER_SEP + 'finto_isCatalogoGenerale' + costanti.FILTER_SEP + 'isCatalogoGenerale', isCatalogoGenerale),
|
||||
bool: true,
|
||||
keycookie: '',
|
||||
addall: true,
|
||||
arrvalue: [],
|
||||
@@ -9874,11 +9893,12 @@ export const tools = {
|
||||
{
|
||||
visible: !this.isUtente(),
|
||||
label: 'Dettagli',
|
||||
table: shared_consts.TABLES_CATALOG,
|
||||
table: 'finto_dettagli',
|
||||
key: 'dettagli',
|
||||
bool: true,
|
||||
notinsearch: true, // non usarlo nella ricerca filtro
|
||||
type: costanti.FieldType.boolean,
|
||||
value: this.isUtente() ? false: this.getCookie(this.COOK_SEARCH + costanti.FILTER_SEP + shared_consts.TABLES_CATALOG + costanti.FILTER_SEP + 'dettagli', true),
|
||||
value: this.isUtente() ? false: this.getCookieBool(this.COOK_SEARCH + costanti.FILTER_SEP + 'finto_dettagli' + costanti.FILTER_SEP + 'dettagli', true),
|
||||
keycookie: '',
|
||||
addall: true,
|
||||
arrvalue: [],
|
||||
|
||||
@@ -2538,6 +2538,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
file_out: string = '',
|
||||
print: boolean = false,
|
||||
optcatalogo: IOptCatalogo | null = null,
|
||||
salvasufiledascaricare
|
||||
) {
|
||||
try {
|
||||
if (!pdfFile) {
|
||||
@@ -2567,16 +2568,20 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
const response = await this.execConvertPDF(formData);
|
||||
|
||||
if (response) {
|
||||
const blob = new Blob([response], { type: 'application/pdf' });
|
||||
const downloadUrl = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = downloadUrl;
|
||||
link.setAttribute('download', filenameToDownload);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
if (salvasufiledascaricare) {
|
||||
const blob = new Blob([response], { type: 'application/pdf' });
|
||||
const downloadUrl = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = downloadUrl;
|
||||
link.setAttribute('download', filenameToDownload);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
|
||||
window.URL.revokeObjectURL(downloadUrl);
|
||||
window.URL.revokeObjectURL(downloadUrl);
|
||||
} else {
|
||||
return response
|
||||
}
|
||||
} else {
|
||||
console.error('No data returned from the server.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user