- aggiornato carrello e bottoni sul catalogo
This commit is contained in:
@@ -23,33 +23,3 @@ $heightBtn: 100%;
|
||||
color: #d9534f; /* Rosso */
|
||||
font-weight: bold; /* Testo in grassetto */
|
||||
}
|
||||
|
||||
.sconto-label{
|
||||
font-weight: bold;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.sconto-text{
|
||||
font-weight: bold;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.table {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.table td {
|
||||
padding: 8px;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 1.2em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@@ -125,13 +125,6 @@ export default defineComponent({
|
||||
}
|
||||
});
|
||||
|
||||
const myTotalPriceCalc = computed((): string => {
|
||||
if (productStore.cart && productStore.cart.totalPriceCalc) {
|
||||
return productStore.cart.totalPriceCalc.toFixed(2);
|
||||
} else {
|
||||
return '0';
|
||||
}
|
||||
});
|
||||
const totalPriceIntero = computed((): string => {
|
||||
if (productStore.cart && productStore.cart.totalPriceIntero) {
|
||||
return productStore.cart.totalPriceIntero.toFixed(2);
|
||||
@@ -402,7 +395,6 @@ export default defineComponent({
|
||||
completeOrder,
|
||||
getNumItems,
|
||||
myTotalPrice,
|
||||
myTotalPriceCalc,
|
||||
totalPriceIntero,
|
||||
getItemsCart,
|
||||
getNote,
|
||||
|
||||
@@ -33,19 +33,19 @@
|
||||
v-if="totalPriceIntero"
|
||||
class="q-mr-sm"
|
||||
>
|
||||
<table class="table">
|
||||
<table class="table-price">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="label">{{ $t('ecomm.prezzointero') }}:</td>
|
||||
<td class="label-price">{{ $t('ecomm.prezzointero') }}:</td>
|
||||
<td
|
||||
class="value text-subtitle1"
|
||||
class="value-price text-subtitle1"
|
||||
:class="{ 'text-strike': myTotalPrice !== totalPriceIntero }"
|
||||
>
|
||||
€ {{ totalPriceIntero }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="recOrderCart.codice_sconto">
|
||||
<td class="label">{{ $t('ecomm.sconto_appl') }}:</td>
|
||||
<td class="label-price">{{ $t('ecomm.sconto_appl') }}:</td>
|
||||
<td>
|
||||
<div class="column items-center">
|
||||
<q-chip
|
||||
@@ -93,7 +93,7 @@
|
||||
|
||||
<tr>
|
||||
<td class="label">{{ $t('ecomm.totale_scontato') }}:</td>
|
||||
<td class="ordine_scontato_nuovo">€ {{ myTotalPrice }}</td>
|
||||
<td class="ordine_scontato_nuovo text-center">€ {{ myTotalPrice }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
import {
|
||||
computed,
|
||||
provide, defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch,
|
||||
} from 'vue'
|
||||
provide,
|
||||
defineComponent,
|
||||
onBeforeMount,
|
||||
onBeforeUnmount,
|
||||
onMounted,
|
||||
ref,
|
||||
toRef,
|
||||
toRefs,
|
||||
watch,
|
||||
} from 'vue';
|
||||
|
||||
import { tools } from '@tools'
|
||||
import { CMyFieldDb } from '@src/components/CMyFieldDb'
|
||||
import { costanti } from '@costanti'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { tools } from '@tools';
|
||||
import { CMyFieldDb } from '@src/components/CMyFieldDb';
|
||||
import { costanti } from '@costanti';
|
||||
import { useGlobalStore } from '@store/globalStore';
|
||||
import { useUserStore } from '@store/UserStore';
|
||||
|
||||
import { CTitlePage } from '@src/components/CTitlePage'
|
||||
import { CGridTableRec } from '@src/components/CGridTableRec'
|
||||
import type { IColGridTable, ISearchList } from 'model';
|
||||
import { IMyBacheca, IMySkill, ISkill } from 'model'
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { CTitlePage } from '@src/components/CTitlePage';
|
||||
import { CGridTableRec } from '@src/components/CGridTableRec';
|
||||
import type { ICatalog, IColGridTable, ISearchList } from 'model';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toolsext } from '@store/Modules/toolsext';
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CCatalogList',
|
||||
@@ -70,33 +76,37 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
components: {
|
||||
CMyFieldDb, CGridTableRec, CTitlePage,
|
||||
CMyFieldDb,
|
||||
CGridTableRec,
|
||||
CTitlePage,
|
||||
},
|
||||
setup(props, { attrs, slots, emit }) {
|
||||
const { t } = useI18n()
|
||||
const $q = useQuasar()
|
||||
const globalStore = useGlobalStore()
|
||||
const userStore = useUserStore()
|
||||
const { t } = useI18n();
|
||||
const $q = useQuasar();
|
||||
const globalStore = useGlobalStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const table = ref('catalogs')
|
||||
const table = ref('catalogs');
|
||||
|
||||
const arrfilterand: any = ref([])
|
||||
const filtercustom: any = ref([])
|
||||
const arrfilterand: any = ref([]);
|
||||
const filtercustom: any = ref([]);
|
||||
|
||||
const search = ref('')
|
||||
const myrecfiltertoggle = ref(tools.FILTER_ALL)
|
||||
const search = ref('');
|
||||
const myrecfiltertoggle = ref(tools.FILTER_ALL);
|
||||
|
||||
const prop_colkey = ref('')
|
||||
const col_title = ref('')
|
||||
const col_footer = ref('')
|
||||
const col_tabfooter = ref('')
|
||||
const prop_colkey = ref('');
|
||||
const col_title = ref('');
|
||||
const col_footer = ref('');
|
||||
const col_tabfooter = ref('');
|
||||
|
||||
const strextra = ref('')
|
||||
const myoptions = ref(<any>[])
|
||||
const strextra = ref('');
|
||||
const myoptions = ref(<any>[]);
|
||||
const newCatalog = ref(<any>{});
|
||||
|
||||
const col = ref(<IColGridTable[]>[])
|
||||
const col = ref(<IColGridTable[]>[]);
|
||||
|
||||
const myCatRef = ref(<any>null)
|
||||
const myCatRef = ref(<any>null);
|
||||
const showFormAddNewCatalog = ref(false);
|
||||
|
||||
/*
|
||||
const idSectorServizi = computed(() => {
|
||||
@@ -113,78 +123,100 @@ export default defineComponent({
|
||||
|
||||
*/
|
||||
|
||||
|
||||
function updatefilter(value: any) {
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
watch(() => myrecfiltertoggle.value, (value: any, oldval: any) => {
|
||||
updatefilter(value)
|
||||
},
|
||||
)
|
||||
watch(
|
||||
() => myrecfiltertoggle.value,
|
||||
(value: any, oldval: any) => {
|
||||
updatefilter(value);
|
||||
}
|
||||
);
|
||||
|
||||
const mypagination = computed(() => {
|
||||
return { sortBy: 'title', descending: false, page: 1, rowsNumber: 0, rowsPerPage: 10 }
|
||||
})
|
||||
return {
|
||||
sortBy: 'title',
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsNumber: 0,
|
||||
rowsPerPage: 10,
|
||||
};
|
||||
});
|
||||
|
||||
const showType = computed(() => {
|
||||
return costanti.SHOW_MYCARD
|
||||
})
|
||||
return costanti.SHOW_MYCARD;
|
||||
});
|
||||
|
||||
const hint = computed(() => {
|
||||
return 'digita un Argomento o Catalogo da cercare'
|
||||
})
|
||||
return 'digita un Argomento o Catalogo da cercare';
|
||||
});
|
||||
|
||||
const visuType = computed(() => {
|
||||
return false // $q.screen.gt.xs
|
||||
})
|
||||
return false; // $q.screen.gt.xs
|
||||
});
|
||||
|
||||
const noMsgRecord = computed(() => {
|
||||
return 'Nessun dato trovato con i filtri selezionati'
|
||||
})
|
||||
|
||||
return 'Nessun dato trovato con i filtri selezionati';
|
||||
});
|
||||
|
||||
function mounted() {
|
||||
const obj = tools.getParamsByTable(table.value);
|
||||
|
||||
const obj = tools.getParamsByTable(table.value)
|
||||
prop_colkey.value = obj.prop_colkey;
|
||||
col_title.value = obj.col_title;
|
||||
col_footer.value = obj.col_footer;
|
||||
col_tabfooter.value = obj.col_tabfooter;
|
||||
|
||||
filtercustom.value = [];
|
||||
|
||||
prop_colkey.value = obj.prop_colkey
|
||||
col_title.value = obj.col_title
|
||||
col_footer.value = obj.col_footer
|
||||
col_tabfooter.value = obj.col_tabfooter
|
||||
|
||||
filtercustom.value = []
|
||||
|
||||
col.value = fieldsTable.getArrColsByTable(table.value)
|
||||
col.value = fieldsTable.getArrColsByTable(table.value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function mySortFieldsAvailable() {
|
||||
if (table.value === toolsext.TABUSER) {
|
||||
return userStore.getSortFieldsAvailable()
|
||||
return userStore.getSortFieldsAvailable();
|
||||
}
|
||||
|
||||
return []
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
function doSearch() {
|
||||
//
|
||||
}
|
||||
|
||||
function clickButtBar(item: any) {
|
||||
if (myCatRef.value) {
|
||||
myCatRef.value.clickButtBar(item)
|
||||
myCatRef.value.clickButtBar(item);
|
||||
}
|
||||
|
||||
// emit('clickButtBar', item)
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
function addNewCatalog() {
|
||||
// Aggiungi un nuovo catalogo
|
||||
showFormAddNewCatalog.value = true;
|
||||
}
|
||||
|
||||
function addNewCatalogSave() {
|
||||
// Salva catalogo
|
||||
}
|
||||
|
||||
function checkPathExist() {
|
||||
const mypageexist = globalStore.mypage.find(
|
||||
(myrec) => myrec.path.toLowerCase() === newCatalog.path.toLowerCase()
|
||||
);
|
||||
if (mypageexist) {
|
||||
$q.notify({
|
||||
message: `La pagina ${newCatalog.path} esiste già`,
|
||||
color: 'red',
|
||||
position: 'top',
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(mounted);
|
||||
|
||||
return {
|
||||
t,
|
||||
@@ -211,6 +243,12 @@ export default defineComponent({
|
||||
clickButtBar,
|
||||
myCatRef,
|
||||
table,
|
||||
}
|
||||
addNewCatalog,
|
||||
showFormAddNewCatalog,
|
||||
addNewCatalogSave,
|
||||
newCatalog,
|
||||
checkPathExist,
|
||||
globalStore,
|
||||
};
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
<template>
|
||||
<div class="q-ma-xs">
|
||||
<div
|
||||
v-if="!tools.isUtente()"
|
||||
class="row justify-center"
|
||||
>
|
||||
<q-btn
|
||||
color="primary"
|
||||
icon="add"
|
||||
label="Nuovo Catalogo"
|
||||
@click="addNewCatalog"
|
||||
/>
|
||||
</div>
|
||||
<CGridTableRec
|
||||
v-if="col && col.length > 0"
|
||||
ref="myCatRef"
|
||||
@@ -29,7 +40,7 @@
|
||||
:defaultnewrec="tools.getdefaultnewrec(table)"
|
||||
labelBtnAddRow="NONE"
|
||||
:prop_SortFieldsAvailable="mySortFieldsAvailable()"
|
||||
labelBtnAddExtra="Aggiungi Catalogo"
|
||||
labelBtnAddExtra=""
|
||||
:extraparams="tools.extraparams(table, { myrecfiltertoggle })"
|
||||
:prop_showMap="false"
|
||||
:heightcarousel="heightcarousel"
|
||||
@@ -39,6 +50,61 @@
|
||||
>
|
||||
</CGridTableRec>
|
||||
</div>
|
||||
<q-dialog v-model="showFormAddNewCatalog">
|
||||
<q-card style="width: 700px; max-width: 80vw">
|
||||
<q-card-section>
|
||||
<div class="text-h6">Nuovo Catalogo</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-card-section class="q-pt-none">
|
||||
<q-form
|
||||
@submit="addNewCatalogSave"
|
||||
class="q-gutter-md"
|
||||
>
|
||||
<q-input
|
||||
filled
|
||||
v-model="newCatalog.title"
|
||||
label="Titolo del catalogo *"
|
||||
lazy-rules
|
||||
:rules="[(val) => (val && val.length > 0) || 'Inserire il titolo']"
|
||||
/>
|
||||
<q-input
|
||||
filled
|
||||
v-model="newCatalog.path"
|
||||
label="Nome della pagina *"
|
||||
@update:model-value="checkPathExist"
|
||||
lazy-rules
|
||||
:rules="[(val) => (val && val.length > 0) || 'Inserire il nome della pagina']"
|
||||
/>
|
||||
|
||||
<q-select
|
||||
filled
|
||||
v-model="newCatalog.template"
|
||||
:options="globalStore.getMyPagesOptionsTemplate()"
|
||||
label="Modello *"
|
||||
emit-value
|
||||
map-options
|
||||
:rules="[(val) => (val && val.length > 0) || 'Selezionare un modello']"
|
||||
/>
|
||||
|
||||
<div class="row justify-center">
|
||||
<q-btn
|
||||
label="Aggiungi"
|
||||
type="submit"
|
||||
color="primary"
|
||||
/>
|
||||
<q-btn
|
||||
label="Annulla"
|
||||
v-close-popup
|
||||
color="primary"
|
||||
flat
|
||||
class="q-ml-sm"
|
||||
/>
|
||||
</div>
|
||||
</q-form>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CCatalogList.ts"></script>
|
||||
|
||||
@@ -56,7 +56,8 @@
|
||||
'flex', // Classi comuni
|
||||
'image-container',
|
||||
{ 'shadow-2': options.in_3d && !optcatalogo.pdf }, // Classe condizionale
|
||||
scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO
|
||||
scheda.testo_right_attaccato.font?.posiz_text ===
|
||||
costanti.POSIZ_TESTO.IN_BASSO
|
||||
? ''
|
||||
: 'flex flex-row', // Layout flessibile
|
||||
]"
|
||||
@@ -83,7 +84,7 @@
|
||||
),
|
||||
}"
|
||||
>
|
||||
<div>
|
||||
<div style="position: relative">
|
||||
<a
|
||||
:href="myproduct.productInfo.link_macro"
|
||||
target="_blank"
|
||||
@@ -136,9 +137,34 @@
|
||||
: undefined,
|
||||
display: 'block',
|
||||
}"
|
||||
@click="click_opendetail()"
|
||||
/>
|
||||
@click.stop.prevent="naviga(`/product/` + myproduct._id)"
|
||||
>
|
||||
</q-img>
|
||||
</a>
|
||||
<div class="row no-wrap q-col-gutter-x-xs items-center semi-transparent" style="position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); z-index: 10">
|
||||
<div v-if="!optcatalogo.generazionePDFInCorso">
|
||||
<q-btn
|
||||
icon="fas fa-external-link-alt"
|
||||
color="primary"
|
||||
class="no-print"
|
||||
rounded
|
||||
size="sm"
|
||||
@click.stop.prevent="tools.openUrl(myproduct.productInfo.link_macro)"
|
||||
>
|
||||
</q-btn>
|
||||
</div>
|
||||
<div v-if="!optcatalogo.generazionePDFInCorso">
|
||||
<q-btn
|
||||
icon-right="fas fa-cart-plus"
|
||||
color="positive"
|
||||
class="no-print"
|
||||
rounded
|
||||
size="sm"
|
||||
@click.stop.prevent="addtoCart(true)"
|
||||
>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="
|
||||
(tools.isManager() || tools.isEditor()) &&
|
||||
@@ -229,7 +255,8 @@
|
||||
</q-item>-->
|
||||
<q-item
|
||||
v-if="
|
||||
!optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||
!optcatalogo.generazionePDFInCorso &&
|
||||
(editOn || options.show_edit_book)
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@@ -332,7 +359,8 @@
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="
|
||||
!optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||
!optcatalogo.generazionePDFInCorso &&
|
||||
(editOn || options.show_edit_book)
|
||||
"
|
||||
clickable
|
||||
v-close-popup
|
||||
@@ -346,7 +374,9 @@
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Visualizza dati Estrapolati (dal WEB Esterno)</q-item-label>
|
||||
<q-item-label
|
||||
>Visualizza dati Estrapolati (dal WEB Esterno)</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
@@ -392,7 +422,9 @@
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Visualizza su GM (con le Quantità in Magazzino)</q-item-label>
|
||||
<q-item-label
|
||||
>Visualizza su GM (con le Quantità in Magazzino)</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
@@ -410,14 +442,19 @@
|
||||
:idPage="idPage"
|
||||
>
|
||||
<div
|
||||
v-if="scheda.testo_right_attaccato.font?.posiz_text !== costanti.POSIZ_TESTO.IN_BASSO"
|
||||
v-if="
|
||||
scheda.testo_right_attaccato.font?.posiz_text !==
|
||||
costanti.POSIZ_TESTO.IN_BASSO
|
||||
"
|
||||
:style="{
|
||||
alignSelf:
|
||||
scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO
|
||||
scheda.testo_right_attaccato.font?.posiz_text ===
|
||||
costanti.POSIZ_TESTO.IN_BASSO
|
||||
? ''
|
||||
: 'center',
|
||||
marginTop:
|
||||
scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO
|
||||
scheda.testo_right_attaccato.font?.posiz_text ===
|
||||
costanti.POSIZ_TESTO.IN_BASSO
|
||||
? 'auto'
|
||||
: '0',
|
||||
}"
|
||||
@@ -436,17 +473,39 @@
|
||||
:value="myproduct.productInfo.code"
|
||||
:format="scheda.barcode.format"
|
||||
:fontsizeprop="scheda.barcode.font?.size"
|
||||
:gap="tools.adjustSize(optcatalogo, scheda.barcode.size?.gap, scheda, true)"
|
||||
:gap="
|
||||
tools.adjustSize(
|
||||
optcatalogo,
|
||||
scheda.barcode.size?.gap,
|
||||
scheda,
|
||||
true
|
||||
)
|
||||
"
|
||||
:width="
|
||||
parseInt(
|
||||
tools.adjustSize(optcatalogo, scheda.barcode.size?.width, scheda, true)
|
||||
tools.adjustSize(
|
||||
optcatalogo,
|
||||
scheda.barcode.size?.width,
|
||||
scheda,
|
||||
true
|
||||
)
|
||||
)
|
||||
"
|
||||
:widthlines="
|
||||
tools.adjustSize(optcatalogo, scheda.barcode.widthlines, scheda, true)
|
||||
tools.adjustSize(
|
||||
optcatalogo,
|
||||
scheda.barcode.widthlines,
|
||||
scheda,
|
||||
true
|
||||
)
|
||||
"
|
||||
:height="
|
||||
tools.adjustSize(optcatalogo, scheda.barcode.size?.height, scheda, false)
|
||||
tools.adjustSize(
|
||||
optcatalogo,
|
||||
scheda.barcode.size?.height,
|
||||
scheda,
|
||||
false
|
||||
)
|
||||
"
|
||||
:show_at_right="scheda.barcode?.show_at_right"
|
||||
>
|
||||
@@ -475,7 +534,10 @@
|
||||
</div>
|
||||
</CText>
|
||||
<div
|
||||
v-if="scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO"
|
||||
v-if="
|
||||
scheda.testo_right_attaccato.font?.posiz_text ===
|
||||
costanti.POSIZ_TESTO.IN_BASSO
|
||||
"
|
||||
class="flexible-width"
|
||||
:style="{
|
||||
marginTop: 'auto',
|
||||
@@ -495,17 +557,39 @@
|
||||
:value="myproduct.productInfo.code"
|
||||
:format="scheda.barcode.format"
|
||||
:fontsizeprop="scheda.barcode.font?.size"
|
||||
:gap="tools.adjustSize(optcatalogo, scheda.barcode.size?.gap, scheda, true)"
|
||||
:gap="
|
||||
tools.adjustSize(
|
||||
optcatalogo,
|
||||
scheda.barcode.size?.gap,
|
||||
scheda,
|
||||
true
|
||||
)
|
||||
"
|
||||
:width="
|
||||
parseInt(
|
||||
tools.adjustSize(optcatalogo, scheda.barcode.size?.width, scheda, true)
|
||||
tools.adjustSize(
|
||||
optcatalogo,
|
||||
scheda.barcode.size?.width,
|
||||
scheda,
|
||||
true
|
||||
)
|
||||
)
|
||||
"
|
||||
:widthlines="
|
||||
tools.adjustSize(optcatalogo, scheda.barcode.widthlines, scheda, true)
|
||||
tools.adjustSize(
|
||||
optcatalogo,
|
||||
scheda.barcode.widthlines,
|
||||
scheda,
|
||||
true
|
||||
)
|
||||
"
|
||||
:height="
|
||||
tools.adjustSize(optcatalogo, scheda.barcode.size?.height, scheda, false)
|
||||
tools.adjustSize(
|
||||
optcatalogo,
|
||||
scheda.barcode.size?.height,
|
||||
scheda,
|
||||
false
|
||||
)
|
||||
"
|
||||
:show_at_right="scheda.barcode.show_at_right"
|
||||
>
|
||||
@@ -623,7 +707,9 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<strong>{{ tools.getNomeUtenteEUsernameByRecUser(ordcart.user) }}</strong>
|
||||
<strong>{{
|
||||
tools.getNomeUtenteEUsernameByRecUser(ordcart.user)
|
||||
}}</strong>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<strong>{{ shared_consts.getStatusStr(ordcart.status) }}</strong>
|
||||
@@ -635,7 +721,8 @@
|
||||
>
|
||||
<span
|
||||
v-if="
|
||||
singleord.order.idProduct === myproduct._id && singleord.order.quantity > 0
|
||||
singleord.order.idProduct === myproduct._id &&
|
||||
singleord.order.quantity > 0
|
||||
"
|
||||
>
|
||||
{{ singleord.order.quantity }}</span
|
||||
@@ -670,7 +757,9 @@
|
||||
</q-dialog>
|
||||
|
||||
<q-dialog
|
||||
v-if="true && myproduct && myproduct.productInfo && myproduct.productInfo.link_scheda"
|
||||
v-if="
|
||||
true && myproduct && myproduct.productInfo && myproduct.productInfo.link_scheda
|
||||
"
|
||||
v-model="apriSchedaPDF"
|
||||
maximized
|
||||
>
|
||||
@@ -707,7 +796,9 @@
|
||||
</q-dialog>
|
||||
|
||||
<q-dialog
|
||||
v-if="false && myproduct && myproduct.productInfo && myproduct.productInfo.link_scheda"
|
||||
v-if="
|
||||
false && myproduct && myproduct.productInfo && myproduct.productInfo.link_scheda
|
||||
"
|
||||
v-model="apriSchedaPDF"
|
||||
fullscreen
|
||||
>
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { ref, onMounted, onBeforeMount, PropType, reactive, watch } from 'vue'
|
||||
import { CCardState } from '../CCardState'
|
||||
import { ref, onMounted, onBeforeMount, PropType, reactive, watch } from 'vue';
|
||||
import { CCardState } from '../CCardState';
|
||||
|
||||
import { computed, defineComponent } from 'vue'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useProducts } from '@store/Products'
|
||||
import { CCopyBtn } from '@src/components/CCopyBtn'
|
||||
import { CSingleCart } from '@src/components/CSingleCart'
|
||||
import { CTitleBanner } from '@src/components/CTitleBanner'
|
||||
import { computed, defineComponent } from 'vue';
|
||||
import { useGlobalStore } from '@store/globalStore';
|
||||
import { useProducts } from '@store/Products';
|
||||
import { CCopyBtn } from '@src/components/CCopyBtn';
|
||||
import { CSingleCart } from '@src/components/CSingleCart';
|
||||
import { CTitleBanner } from '@src/components/CTitleBanner';
|
||||
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import MixinUsers from '../../mixins/mixin-users'
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import MixinUsers from '../../mixins/mixin-users';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMyCart',
|
||||
@@ -19,55 +18,63 @@ export default defineComponent({
|
||||
components: { CTitleBanner, CCardState, CCopyBtn, CSingleCart },
|
||||
|
||||
setup() {
|
||||
const globalStore = useGlobalStore()
|
||||
const products = useProducts()
|
||||
const { t } = useI18n()
|
||||
const globalStore = useGlobalStore();
|
||||
const productStore = useProducts();
|
||||
const { t } = useI18n();
|
||||
|
||||
const { getnumItemsCart } = MixinUsers()
|
||||
const { getnumItemsCart } = MixinUsers();
|
||||
|
||||
const myCart = computed(() => products.cart)
|
||||
const myCart = computed(() => productStore.cart);
|
||||
const myTotalPrice = computed(() => {
|
||||
if (products.cart) {
|
||||
return products.cart.totalPrice
|
||||
if (productStore.cart) {
|
||||
return productStore.cart.totalPrice.toFixed(2);
|
||||
} else {
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const totalPriceIntero = computed((): string => {
|
||||
if (productStore.cart && productStore.cart.totalPriceIntero) {
|
||||
return productStore.cart.totalPriceIntero.toFixed(2);
|
||||
} else {
|
||||
return '0';
|
||||
}
|
||||
});
|
||||
|
||||
const ordersCart = computed(() => {
|
||||
if (!!products.cart) {
|
||||
return products.cart.items
|
||||
if (!!productStore.cart) {
|
||||
return productStore.cart.items;
|
||||
} else {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const numOrders = computed(() => {
|
||||
if (!!products.cart && products.cart.items) {
|
||||
return products.cart.items.length
|
||||
if (!!productStore.cart && productStore.cart.items) {
|
||||
return productStore.cart.items.length;
|
||||
} else {
|
||||
return 0
|
||||
return 0;
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
function closecart() {
|
||||
globalStore.rightCartOpen = false
|
||||
globalStore.rightCartOpen = false;
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
products.loadOrders()
|
||||
productStore.loadOrders();
|
||||
}
|
||||
|
||||
function existsOrders() {
|
||||
return products.getNumOrders() > 0
|
||||
return productStore.getNumOrders() > 0;
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
onMounted(mounted);
|
||||
|
||||
return {
|
||||
myCart,
|
||||
myTotalPrice,
|
||||
totalPriceIntero,
|
||||
ordersCart,
|
||||
numOrders,
|
||||
closecart,
|
||||
@@ -75,6 +82,6 @@ export default defineComponent({
|
||||
existsOrders,
|
||||
globalStore,
|
||||
t,
|
||||
}
|
||||
};
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
@@ -3,7 +3,13 @@
|
||||
<div id="mycontainer">
|
||||
<div class="myheader row justify-between">
|
||||
<div class="col-6">
|
||||
<q-btn class="q-mx-xs" round dense flat icon="fas fa-shopping-cart">
|
||||
<!--<q-btn
|
||||
class="q-mx-xs"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
icon="fas fa-shopping-cart"
|
||||
>
|
||||
<q-badge
|
||||
v-if="getnumItemsCart() > 0"
|
||||
color="red"
|
||||
@@ -12,25 +18,96 @@
|
||||
>
|
||||
{{ getnumItemsCart() }}
|
||||
</q-badge>
|
||||
</q-btn>
|
||||
</q-btn>-->
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right">
|
||||
<span v-if="myTotalPrice" class="text-grey q-mr-xs">Totale:</span>
|
||||
<span class="text-subtitle1 q-mr-sm"
|
||||
>€ {{ myTotalPrice ? myTotalPrice.toFixed(2) : 0 }}</span
|
||||
>
|
||||
<div
|
||||
v-if="totalPriceIntero"
|
||||
class="q-mr-sm"
|
||||
>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="label">{{ $t('ecomm.prezzointero') }}:</td>
|
||||
<td
|
||||
class="value text-subtitle1 text-right"
|
||||
:class="{ 'text-strike': myTotalPrice !== totalPriceIntero }"
|
||||
>
|
||||
€ {{ totalPriceIntero }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="myCart.codice_sconto">
|
||||
<td class="label">{{ $t('ecomm.sconto_appl') }}:</td>
|
||||
<td>
|
||||
<div class="column items-center">
|
||||
<q-chip
|
||||
square
|
||||
color="orange"
|
||||
text-color="white"
|
||||
size="md"
|
||||
icon="fas fa-tag"
|
||||
>
|
||||
<span class="sconto-text">{{ myCart.descr_sconto }}</span>
|
||||
</q-chip>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr v-if="!myCart.codice_sconto">
|
||||
<td class="label">{{ $t('ecomm.codice_sconto') }}:</td>
|
||||
<td>
|
||||
<q-input
|
||||
v-model="codice_sconto"
|
||||
:label="$t('ecomm.codice_sconto')"
|
||||
style="width: 200px"
|
||||
filled
|
||||
dense
|
||||
@keyup.enter="confermaCodiceSconto"
|
||||
/>
|
||||
<q-btn
|
||||
:disabled="!codice_sconto || codice_sconto.trim() === ''"
|
||||
:label="$t('ecomm.applica_sconto')"
|
||||
icon="fas fa-check-circle"
|
||||
color="primary"
|
||||
class="q-mt-sm self-center"
|
||||
@click="confermaCodiceSconto"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label">{{ $t('ecomm.totale_scontato') }}:</td>
|
||||
<td class="ordine_scontato_nuovo text-right">€ {{ myTotalPrice }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator></q-separator>
|
||||
<div id="mybody">
|
||||
<div v-for="(rec, index) in ordersCart" :key="index" class="col">
|
||||
<CSingleCart :order="rec.order" :showall="false" :idOrdersCart="ordersCart ? ordersCart._id: ''"> </CSingleCart>
|
||||
<div
|
||||
v-for="(rec, index) in ordersCart"
|
||||
:key="index"
|
||||
class="col"
|
||||
>
|
||||
<CSingleCart
|
||||
:order="rec.order"
|
||||
:showall="false"
|
||||
:idOrdersCart="ordersCart ? ordersCart._id : ''"
|
||||
>
|
||||
</CSingleCart>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="numOrders === 0" style="text-align: center" class="text-grey">
|
||||
<div
|
||||
v-if="numOrders === 0"
|
||||
style="text-align: center"
|
||||
class="text-grey"
|
||||
>
|
||||
{{ $t('ecomm.carrello_vuoto') }}
|
||||
</div>
|
||||
<div v-else style="text-align: center">
|
||||
<div
|
||||
v-else
|
||||
style="text-align: center"
|
||||
>
|
||||
<div class="text-center">
|
||||
<q-btn
|
||||
rounded
|
||||
@@ -50,7 +127,7 @@
|
||||
rounded
|
||||
outline
|
||||
icon="fas fa-clipboard-list"
|
||||
style="color: green;"
|
||||
style="color: green"
|
||||
:label="t('ecomm.btn_ordini')"
|
||||
class="q-mb-sm"
|
||||
@click="globalStore.rightCartOpen = false"
|
||||
@@ -62,8 +139,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMyCart.ts">
|
||||
</script>
|
||||
<script lang="ts" src="./CMyCart.ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CMyCart.scss';
|
||||
|
||||
@@ -349,7 +349,7 @@
|
||||
<div v-if="editOn" class="elemEdit">Cataloghi</div>
|
||||
<q-tabs v-if="tools.isEditor() || tools.isGrafico()" v-model="tabcatalogo" dense class="bg-green text-white">
|
||||
<q-tab name="griglia" icon="fas fa-eye" label="Griglia"> </q-tab>
|
||||
<q-tab name="statistiche" icon="fas fa-chart-pie" label="Statistiche"> </q-tab>
|
||||
<!--<q-tab name="statistiche" icon="fas fa-chart-pie" label="Statistiche"> </q-tab>-->
|
||||
<q-tab name="lista" icon="fas fa-list" label="Lista"> </q-tab>
|
||||
<q-tab name="tutorial" icon="fas fa-info" label="Tutorial"> </q-tab>
|
||||
</q-tabs>
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
icon="fas fa-trash-alt"
|
||||
/>
|
||||
<q-fab-action
|
||||
v-if="tools.canModifyThisRec(myrec, table) || tools.isManager() || editOn"
|
||||
v-if="tools.isAdmin()"
|
||||
@click="cmdExt(costanti.CMD_CLONE, myrec._id, null)"
|
||||
color="accent"
|
||||
:label="$t('event.duplicate')"
|
||||
|
||||
@@ -133,6 +133,10 @@ export default defineComponent({
|
||||
() => props.lista_prodotti,
|
||||
(newVal) => {
|
||||
internalProducts.value = [...newVal];
|
||||
internalProducts.value.forEach((p: IProduct) => {
|
||||
p.myorder = ProductStore.createMyOrder();
|
||||
});
|
||||
|
||||
}
|
||||
),
|
||||
{ deep: true };
|
||||
|
||||
@@ -8,6 +8,7 @@ import { CMyFieldDb } from '@src/components/CMyFieldDb'
|
||||
import { costanti } from '@costanti'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import { CTitlePage } from '@src/components/CTitlePage'
|
||||
import { CGridTableRec } from '@src/components/CGridTableRec'
|
||||
@@ -72,6 +73,7 @@ export default defineComponent({
|
||||
const $q = useQuasar()
|
||||
const globalStore = useGlobalStore()
|
||||
const userStore = useUserStore()
|
||||
const $router = useRouter()
|
||||
|
||||
const table = ref('raccoltacataloghis')
|
||||
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.ordine_scontato{
|
||||
color: gray;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.barrato {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ export default defineComponent({
|
||||
const orderQuantityPreordered = ref(<number | undefined>undefined);
|
||||
const orderTotalPriceProduct = ref(<number | undefined>undefined);
|
||||
|
||||
const showPointer = ref(false);
|
||||
const enableQty = ref(false);
|
||||
const endload = ref(false);
|
||||
const enableQtyPreordered = ref(false);
|
||||
@@ -241,6 +242,28 @@ export default defineComponent({
|
||||
enableChangeTotalPrice.value = true;
|
||||
}
|
||||
|
||||
const copyToClipboard = (text) => {
|
||||
navigator.clipboard
|
||||
.writeText(text)
|
||||
.then(() => {
|
||||
$q.notify({
|
||||
message: 'Codice copiato negli appunti!',
|
||||
color: 'positive',
|
||||
icon: 'check',
|
||||
position: 'top',
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Errore durante la copia:', err);
|
||||
$q.notify({
|
||||
message: 'Errore nella copia',
|
||||
color: 'negative',
|
||||
icon: 'error',
|
||||
position: 'top',
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(mounted);
|
||||
|
||||
return {
|
||||
@@ -264,6 +287,8 @@ export default defineComponent({
|
||||
endload,
|
||||
qtyInCart,
|
||||
getRispPerc,
|
||||
copyToClipboard,
|
||||
showPointer,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -44,7 +44,24 @@
|
||||
</span>
|
||||
</q-item-label>
|
||||
<q-item-label>
|
||||
{{ order.product.productInfo.code }}
|
||||
<q-chip
|
||||
dense
|
||||
outline
|
||||
icon="fas fa-barcode"
|
||||
color="primary"
|
||||
text-color="white"
|
||||
>
|
||||
<span
|
||||
style="cursor: pointer"
|
||||
@mouseenter="showPointer = true"
|
||||
@mouseleave="showPointer = false"
|
||||
@click="copyToClipboard(order.product.productInfo.code)"
|
||||
>
|
||||
<span :style="showPointer ? 'background-color: rgba(0,0,255,0.1)' : ''">
|
||||
{{ order.product.productInfo.code }}
|
||||
</span>
|
||||
</span>
|
||||
</q-chip>
|
||||
</q-item-label>
|
||||
|
||||
<q-item-label caption>
|
||||
@@ -200,7 +217,7 @@
|
||||
€
|
||||
{{ order.TotalPriceProduct ? order.TotalPriceProduct.toFixed(2) : 0 }}
|
||||
</span>
|
||||
<span v-if="isApplicatoSconto">
|
||||
<span v-if="isApplicatoSconto && showall">
|
||||
<span class="ordine_scontato"
|
||||
>(<span class="barrato"
|
||||
>€
|
||||
@@ -214,7 +231,7 @@
|
||||
>
|
||||
</span>
|
||||
<div
|
||||
v-if="isApplicatoSconto && !editmode"
|
||||
v-if="isApplicatoSconto && !editmode && showall"
|
||||
class="ordine_scritta_sconto"
|
||||
v-html="
|
||||
$t('ecomm.sconto_applicato', {
|
||||
@@ -222,8 +239,7 @@
|
||||
perc: getRispPerc,
|
||||
})
|
||||
"
|
||||
>
|
||||
</div>
|
||||
></div>
|
||||
</div>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
|
||||
@@ -145,7 +145,9 @@
|
||||
|
||||
<CSelectUserActive></CSelectUserActive>
|
||||
|
||||
<div v-if="tools.isLogged()" class="text-weight-bold text-cart">
|
||||
|
||||
<div v-if="tools.isLogged()" class="bg-primary text-white q-pa-sm q-mb-md" style="border-radius: 0px">
|
||||
<q-icon name="fas fa-shopping-cart" class="q-mr-sm" />
|
||||
{{ $t("ecomm.carrello_di", { user: products.userActive.username }) }}
|
||||
</div>
|
||||
<CMyCart v-if="isfinishLoading"></CMyCart>
|
||||
|
||||
@@ -2631,24 +2631,60 @@ body.body--dark {
|
||||
font-size: 1.1rem;
|
||||
font-weight: bold;
|
||||
color: green;
|
||||
background-color: #fff5ee; /* seashell color background */
|
||||
padding: 10px;
|
||||
background-image: linear-gradient(to right, #d5ffd5, #dfff06);
|
||||
/* gradiente di sfondo che va bene con il colore green per il testo */
|
||||
padding: 6px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ordine_scritta_sconto {
|
||||
font-size: 1.1rem;
|
||||
color:red;
|
||||
background-color: #fff5ee; /* seashell color background */
|
||||
padding: 4px;
|
||||
font-size: 1rem;
|
||||
color: red;
|
||||
background-color: #fff5ee;
|
||||
/* seashell color background */
|
||||
padding: 2px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.center-button {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.sconto-label {
|
||||
font-weight: bold;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.sconto-text {
|
||||
font-weight: bold;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.table-price {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.table-price td {
|
||||
padding: 8px;
|
||||
text-align: right;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.label-price {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.value-price {
|
||||
font-size: 1.2em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.ordine_scontato{
|
||||
color: gray;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
@@ -231,6 +231,7 @@ export interface IMyPage {
|
||||
content4?: string
|
||||
active?: boolean
|
||||
inmenu?: boolean
|
||||
isTemplate?: boolean
|
||||
color?: string
|
||||
elemsText?: IElemText[]
|
||||
onlyif_logged?: boolean
|
||||
|
||||
@@ -135,7 +135,7 @@ const msg_it = {
|
||||
description: 'Descrizione',
|
||||
perc_sconto: 'Sconto %',
|
||||
price: 'Prezzo',
|
||||
qta: 'Quantita',
|
||||
qta: 'Quantita Minima',
|
||||
comulativo: 'Cumulativo',
|
||||
applica: 'Applica',
|
||||
},
|
||||
@@ -1258,6 +1258,7 @@ const msg_it = {
|
||||
date_updated: 'Ult. Aggiornamento',
|
||||
},
|
||||
mypages: {
|
||||
isTemplate: 'E\' un modello',
|
||||
catAI: 'Categorie AI',
|
||||
toolsAI: 'Strumenti AI',
|
||||
aitools: 'Ricerca',
|
||||
|
||||
@@ -175,7 +175,7 @@ export const colTableRaccoltaCataloghi = [
|
||||
|
||||
export const colTableCatalogList = [
|
||||
AddCol({ name: 'active', label_trans: 'myelems.pubblica_online', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'title', label_trans: 'gallery.title' }),
|
||||
AddCol({ name: 'title', label_trans: 'gallery.title', dont_clone: true}),
|
||||
AddCol({
|
||||
name: 'foto_collana',
|
||||
label_trans: 'cataloglist.foto_collana',
|
||||
@@ -544,6 +544,7 @@ export const colmypage = [
|
||||
AddCol({ name: 'order', label_trans: 'pages.order', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'active', label_trans: 'pages.active', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'inmenu', label_trans: 'pages.inmenu', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'isTemplate', label_trans: 'pages.isTemplate', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'title', label_trans: 'pages.title' }),
|
||||
AddCol({ name: 'subtitle', label_trans: 'pages.subtitle' }),
|
||||
AddCol({ name: 'mainMenu', label_trans: 'pages.mainMenu', fieldtype: costanti.FieldType.boolean }),
|
||||
@@ -902,9 +903,9 @@ export const colTableScontistica = [
|
||||
AddCol({ name: 'description', label_trans: 'scontistica.description' }),
|
||||
AddCol({ name: 'qta', label_trans: 'scontistica.qta', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'perc_sconto', label_trans: 'scontistica.perc_sconto', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'applica', label_trans: 'products.applica', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'comulativo', label_trans: 'products.comulativo', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'price', label_trans: 'scontistica.price', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'applica', label_trans: 'scontistica.applica', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'comulativo', label_trans: 'scontistica.comulativo', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
|
||||
@@ -61,7 +61,7 @@ function getRecordOrdersCartEmpty(): IOrderCart {
|
||||
ricevuto: false,
|
||||
note: '',
|
||||
note_per_gestore: '',
|
||||
codice_sconto:'',
|
||||
codice_sconto: '',
|
||||
descr_sconto: '',
|
||||
note_per_admin: '',
|
||||
note_ordine_gas: '',
|
||||
@@ -1518,14 +1518,10 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
let ris = null;
|
||||
|
||||
ris = await Api.SendReq(
|
||||
'/cart/' + this.userActive._id + '/app_sc',
|
||||
'POST',
|
||||
{
|
||||
cart_id,
|
||||
code: codice_sconto,
|
||||
}
|
||||
)
|
||||
ris = await Api.SendReq('/cart/' + this.userActive._id + '/app_sc', 'POST', {
|
||||
cart_id,
|
||||
code: codice_sconto,
|
||||
})
|
||||
.then((res) => {
|
||||
this.updateDataProduct(res);
|
||||
|
||||
@@ -1545,7 +1541,6 @@ export const useProducts = defineStore('Products', {
|
||||
return ris;
|
||||
},
|
||||
|
||||
|
||||
async addtoCartBase({
|
||||
$q,
|
||||
t,
|
||||
@@ -1690,11 +1685,12 @@ export const useProducts = defineStore('Products', {
|
||||
},
|
||||
|
||||
enableSubQty(myorder: IOrder): boolean {
|
||||
let qty = myorder.quantity + myorder.quantitypreordered;
|
||||
let qty = myorder?.quantity + myorder?.quantitypreordered;
|
||||
return qty ? qty > 0 : false;
|
||||
},
|
||||
|
||||
CanDeleteIfSub(myorder: IOrder): boolean {
|
||||
if (!myorder) return false;
|
||||
let qty = myorder.quantity + myorder.quantitypreordered;
|
||||
|
||||
qty = qty - this.qtaNextSub(myorder, myorder.product!);
|
||||
@@ -1702,33 +1698,30 @@ export const useProducts = defineStore('Products', {
|
||||
},
|
||||
|
||||
enableAddQty(myorder: IOrder, myproduct: IProduct): boolean {
|
||||
if (!myorder) return false;
|
||||
|
||||
const globalStore = useGlobalStore();
|
||||
if (globalStore.site.ecomm && globalStore.site.ecomm.enablePreOrders) {
|
||||
return (
|
||||
(this.getQtyBookableAvailable(myproduct) > 0 &&
|
||||
(myproduct.maxBookableSinglePersQty === 0 ||
|
||||
myorder.quantitypreordered + 1 < myproduct.maxBookableSinglePersQty)) ||
|
||||
(this.getQtyAvailable(myproduct) > 0 &&
|
||||
(myproduct.maxBookableSinglePersQty === 0 ||
|
||||
!myproduct.maxBookableSinglePersQty ||
|
||||
myorder.quantity + 1 < myproduct.maxBookableSinglePersQty))
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
this.getQtyAvailable(myproduct) > 0 &&
|
||||
(myproduct.maxBookableSinglePersQty === 0 ||
|
||||
!myproduct.maxBookableSinglePersQty ||
|
||||
myorder.quantity + 1 < myproduct.maxBookableSinglePersQty)
|
||||
);
|
||||
}
|
||||
const maxAllowed = myproduct.maxBookableSinglePersQty || 0;
|
||||
const qtyAvailable = this.getQtyAvailable(myproduct);
|
||||
const qtyBookableAvailable = this.getQtyBookableAvailable(myproduct);
|
||||
|
||||
const canOrder =
|
||||
qtyAvailable > 0 &&
|
||||
((myorder.quantity + 1 <= maxAllowed && maxAllowed > 0) || maxAllowed === 0);
|
||||
const canPreOrder =
|
||||
globalStore.site.ecomm?.enablePreOrders &&
|
||||
qtyBookableAvailable > 0 &&
|
||||
myorder.quantitypreordered + 1 <= maxAllowed;
|
||||
|
||||
return canOrder || canPreOrder;
|
||||
},
|
||||
|
||||
qtaNextAdd(myorder: IOrder, myproduct: IProduct): number {
|
||||
let step = myproduct.minStepQty || 1;
|
||||
if (this.getQtyAvailable(myproduct) > 0) {
|
||||
if (myorder.quantity === 0) step = myproduct.minBuyQty;
|
||||
if (myorder?.quantity === 0) step = myproduct.minBuyQty;
|
||||
} else {
|
||||
if (myorder.quantitypreordered === 0) step = myproduct.minBuyQty;
|
||||
if (myorder?.quantitypreordered === 0) step = myproduct.minBuyQty;
|
||||
}
|
||||
|
||||
if (step === 0) {
|
||||
@@ -1742,9 +1735,9 @@ export const useProducts = defineStore('Products', {
|
||||
let step = myproduct.minStepQty;
|
||||
let minqta = myproduct.minBuyQty;
|
||||
if (this.getQtyAvailable(myproduct) > 0) {
|
||||
if (myorder.quantity === minqta) step = minqta;
|
||||
if (myorder?.quantity === minqta) step = minqta;
|
||||
} else {
|
||||
if (myorder.quantitypreordered === minqta) step = minqta;
|
||||
if (myorder?.quantitypreordered === minqta) step = minqta;
|
||||
}
|
||||
|
||||
return step;
|
||||
@@ -2596,8 +2589,9 @@ export const useProducts = defineStore('Products', {
|
||||
getFilePathByLinkIdTemplate(linkidTemplate: string) {
|
||||
try {
|
||||
const globalStore = useGlobalStore();
|
||||
const myelem = globalStore.myschedas.find((recscheda: IMyScheda) =>
|
||||
(recscheda: ISchedaSingola) => recscheda.scheda._id === linkidTemplate
|
||||
const myelem = globalStore.myschedas.find(
|
||||
(recscheda: IMyScheda) => (recscheda: ISchedaSingola) =>
|
||||
recscheda.scheda._id === linkidTemplate
|
||||
);
|
||||
if (myelem) {
|
||||
const idPage = myelem.idPageOrig;
|
||||
@@ -2631,7 +2625,12 @@ export const useProducts = defineStore('Products', {
|
||||
myorder.idGasordine = '';
|
||||
},
|
||||
|
||||
setMyOrder(myorder: IOrder, myproduct: IProduct, storeSelected: any = null, options: any = {setstore: false}) {
|
||||
setMyOrder(
|
||||
myorder: IOrder,
|
||||
myproduct: IProduct,
|
||||
storeSelected: any = null,
|
||||
options: any = { setstore: false }
|
||||
) {
|
||||
if (myproduct.storehouses && myproduct.storehouses.length === 1) {
|
||||
// Se solo 1 presente, metto fisso l'unico negozio !
|
||||
myorder.idStorehouse = myproduct.storehouses[0]._id;
|
||||
@@ -2653,8 +2652,6 @@ export const useProducts = defineStore('Products', {
|
||||
storeSelected = ord.idStorehouse;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -388,6 +388,16 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
const mypage = state.mypage.find((page) => `${page._id}` === idpage);
|
||||
return mypage;
|
||||
},
|
||||
|
||||
getMyPagesOptionsTemplate: (state: IGlobalState) => (): any[] => {
|
||||
return state.mypage
|
||||
.filter((page: IMyPage) => page.isTemplate === true)
|
||||
.map((page: IMyPage) => ({
|
||||
label: page.title,
|
||||
value: page._id,
|
||||
}));
|
||||
},
|
||||
|
||||
getPathByIdPage:
|
||||
(state: IGlobalState) =>
|
||||
(idpage: string): string => {
|
||||
@@ -2073,8 +2083,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
Products.publishers_sort_qty = [...res.data.publishers];
|
||||
Products.publishers_sort_qty.sort((a, b) => b.quanti - a.quanti);
|
||||
|
||||
// console.table(Products.publishers)
|
||||
// console.table(Products.publishers_sort_qty)
|
||||
// console.table(Products.publishers)
|
||||
// console.table(Products.publishers_sort_qty)
|
||||
|
||||
this.gasordines = res.data.gasordines ? [...res.data.gasordines] : [];
|
||||
this.scontisticas = res.data.scontisticas ? [...res.data.scontisticas] : [];
|
||||
@@ -2595,7 +2605,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('getServerHost', myserv);
|
||||
// console.log('getServerHost', myserv);
|
||||
|
||||
return myserv;
|
||||
} catch (e) {
|
||||
|
||||
@@ -2322,13 +2322,13 @@ export default defineComponent({
|
||||
router.push(path);
|
||||
}
|
||||
|
||||
function updateProducts(arr: any) {
|
||||
function updateProducts(arr: any, aggiorna?: boolean) {
|
||||
if (myCatalog.value) {
|
||||
if (
|
||||
myCatalog.value.lista_prodotti.length !== arr.length ||
|
||||
!myCatalog.value.lista_prodotti.every(
|
||||
(prod, index) => prod._id === arr[index]._id
|
||||
)
|
||||
) || aggiorna
|
||||
) {
|
||||
myCatalog.value.lista_prodotti = [...arr];
|
||||
|
||||
@@ -2352,7 +2352,7 @@ export default defineComponent({
|
||||
if (where === shared_consts.WHERE_INSERT.ONTOP) arr.unshift(element);
|
||||
else if (where === shared_consts.WHERE_INSERT.ONBOTTOM) arr.push(element);
|
||||
|
||||
updateProducts(arr);
|
||||
updateProducts(arr, true);
|
||||
|
||||
addnewProd.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user