@@ -265,7 +264,7 @@
}}
@@ -283,7 +282,7 @@
@@ -504,7 +504,7 @@
{{
tools.isEntrataByRecMov(row)
? t('movement.movin')
- : t('movement.movout')
+ : (tools.isUscitaByRecMov(row) ? t('movement.movout') : '')
}}
diff --git a/src/components/CGridTableUser/CGridTableUser.vue b/src/components/CGridTableUser/CGridTableUser.vue
index 1342e1b8..d50f83dc 100755
--- a/src/components/CGridTableUser/CGridTableUser.vue
+++ b/src/components/CGridTableUser/CGridTableUser.vue
@@ -154,7 +154,7 @@
color="green"
>
@@ -162,7 +162,7 @@
{{
tools.isEntrataByRecMov(row)
? t('movement.movin')
- : t('movement.movout')
+ : (tools.isUscitaByRecMov(row) ? t('movement.movout') : '')
}}
diff --git a/src/components/CMySelect/CMySelect.ts b/src/components/CMySelect/CMySelect.ts
index bfc2598f..fb8ef4e8 100755
--- a/src/components/CMySelect/CMySelect.ts
+++ b/src/components/CMySelect/CMySelect.ts
@@ -329,8 +329,8 @@ export default defineComponent({
if (props.addall) {
let myobj: any = {}
if (typeof props.optlab === 'string') {
- myobj[props.optlab] = '(Tutti)'
- myobj[props.optval] = costanti.FILTER_TUTTI
+ myobj = tools.setRecordByField(props.optlab, myobj, '(Tutti)')
+ myobj = tools.setRecordByField(props.optval, myobj, costanti.FILTER_TUTTI)
}
arrtempOpt.value.push(myobj)
@@ -495,8 +495,8 @@ export default defineComponent({
if (props.addall) {
let myobj: any = {}
if (typeof props.optlab === 'string') {
- myobj[props.optlab] = '(Tutti)'
- myobj[props.optval] = costanti.FILTER_TUTTI
+ myobj = tools.setRecordByField(props.optlab, myobj, '(Tutti)')
+ myobj = tools.setRecordByField(props.optval, myobj, costanti.FILTER_TUTTI)
}
if (myarr)
@@ -570,7 +570,17 @@ export default defineComponent({
if (val === '') {
valori.value = myarr
} else {
- valori.value = myarr.filter((v: any) => v[`${props.optlab}`].toLowerCase().indexOf(mystr) > -1)
+ let optlab: any = props.optlab ? '' + props.optlab : ''
+ if (optlab) {
+ valori.value = myarr.filter((v: any) => {
+ let mioval = tools.getRecordByField(optlab, v)
+ if (mioval)
+ return mioval.toLowerCase().indexOf(mystr) > -1
+ else
+ return false
+
+ })
+ }
}
}
@@ -604,8 +614,6 @@ export default defineComponent({
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr.trim(), filter: props.filter_extra })
}
-
-
if (myarr === null) {
console.log('@@@ VALORI VALUE XXX', valori.value)
valori.value = arrtempOpt.value
@@ -619,8 +627,8 @@ export default defineComponent({
if (props.addall) {
let myobj: any = {}
if (typeof props.optlab === 'string') {
- myobj[props.optlab] = '(Tutti)'
- myobj[props.optval] = costanti.FILTER_TUTTI
+ myobj = tools.setRecordByField(props.optlab, myobj, '(Tutti)')
+ myobj = tools.setRecordByField(props.optval, myobj, costanti.FILTER_TUTTI)
}
myarr = [myobj, ...myarr]
@@ -714,11 +722,11 @@ export default defineComponent({
} else {
done(recfound[myid], 'add-unique')
}
-
+
/* if (props.multiple || props.multiselect_by_server) {
console.log('arrout (2)', arrout)
changeval(arrout)
-
+
}
}*/
}
diff --git a/src/components/CMySelect/CMySelect.vue b/src/components/CMySelect/CMySelect.vue
index 665b1fa8..a2ee2709 100755
--- a/src/components/CMySelect/CMySelect.vue
+++ b/src/components/CMySelect/CMySelect.vue
@@ -50,7 +50,12 @@
:text-color="$q.dark.isActive ? `white` : `black`"
class="q-my-none q-ml-xs q-mr-none"
>
-
+
{{ scope.opt[fieldsTable.getLabelByTable(tablesel)] }}
@@ -58,18 +63,20 @@
-
- {{ opt[fieldsTable.getLabelByTable(tablesel)] }}
+ {{
+ opt[fieldsTable.getLabelByTable(tablesel)]
+ }}
-
+
-
-
+
+
+
@@ -105,7 +120,9 @@
- {{ tools.getValueByFunzOrVal(scope.opt,optlab) }}
+
+ {{ tools.getValueByFunzOrVal(scope.opt, optlab) }}
@@ -133,16 +150,15 @@
:options="valori"
:option-value="optval"
:option-label="optlab"
- :dense="dense">
-
+ :dense="dense"
+ >
-
-
+
+
-
+
{{ tools.getValueByFunzOrVal(scope.opt, optlab) }}
+ v-slot:option="{ itemProps, opt, selected, toggleOption }"
+ >
- {{ tools.getValueByFunzOrVal(opt,optlab) }}
- {{ opt['hint'] }}
+ {{
+ tools.getValueByFunzOrVal(opt, optlab)
+ }}
+ {{
+ opt['hint']
+ }}
-
+
-
-
+ :class="myclass ? myclass : 'combowidth'"
+ >
-
+
- {{ tools.getValueByFunzOrVal(scope.opt,optlab) }}
- {{ scope.opt['hint'] }}
+ {{
+ tools.getValueByFunzOrVal(scope.opt, optlab)
+ }}
+ {{
+ scope.opt['hint']
+ }}
-
-
diff --git a/src/components/CNotifAtTop/CNotifAtTop.vue b/src/components/CNotifAtTop/CNotifAtTop.vue
index ee6f2a67..43ae0110 100755
--- a/src/components/CNotifAtTop/CNotifAtTop.vue
+++ b/src/components/CNotifAtTop/CNotifAtTop.vue
@@ -2,11 +2,11 @@
diff --git a/src/css/app.scss b/src/css/app.scss
index 3d2aca4d..9b9500aa 100755
--- a/src/css/app.scss
+++ b/src/css/app.scss
@@ -381,7 +381,7 @@ h3 {
@media (max-width: 718px) {
// PER VERSIONE MOBILE
max-width: 400px;
- padding: 1rem 1rem;
+ padding: 0.5rem 0.5rem;
}
}
diff --git a/src/db/lang/ws_it.js b/src/db/lang/ws_it.js
index ab3d8ef2..c7366e95 100755
--- a/src/db/lang/ws_it.js
+++ b/src/db/lang/ws_it.js
@@ -1,9 +1,9 @@
const msg_website_it = {
ws: {
- sitename: 'Gruppo Macro',
- siteshortname: 'Gruppo Macro',
- description: '',
- keywords: '',
+ sitename: 'Riso',
+ siteshortname: 'RISO',
+ description: 'Siamo la Rete Italiana di Scambio Orizzontale, abbiamo creato questa piattaforma per metterla al servizio di chi vuole riscoprire il valore della condivisione e della cooperazione. Valori semplici e profondi che ci aiutano a ritrovare il Senso della Vita, perduto in questa società consumista, e riporti quei Sani Pricìpi Naturali ed Umani di Fratellanza che intere popolazioni antiche conoscevano bene.',
+ keywords: 'riso, piattaforma di scambio, rete italiana scambio orizzontale, riso app, riso piattaforma, scambio e baratto, momenta RIS',
},
hours: {
descr: 'Descrizione',
@@ -16,35 +16,23 @@ const msg_website_it = {
pages: {
home: 'Home',
profile: 'Profilo',
- install_site: 'Installa Sito',
profile2: 'ProfiloU',
mypage2: 'mypage2',
myservice2: 'myservice2',
myhosps2: 'myhosps2',
mygood2: 'mygood2',
- catalogo: 'Catalogo',
fundraising: 'Sostieni il Progetto',
notifs: 'Configura le Notifiche',
unsubscribe: 'Disiscriviti',
- unsubscribe_user: 'Disiscriviti User',
test: 'Test',
projects: 'Progetti',
report: 'Report Ore',
producer: 'Produttore',
orderinfo: 'Ordini Effettuati',
products: 'Prodotti',
- cash: 'Cassa',
- productInfos: 'Info Prodotti',
- listinoprodotti: 'Listino Prodotti',
productslist: 'Lista Prodotti',
collabora: 'Collabora',
- categories: 'Categorie',
storehouses: 'Magazzino',
- providers: 'Fornitori',
- catprods: 'Categorie',
- subcatprods: 'Sotto-Categorie',
- gasordine: 'Gas Ordine',
- scontisticas: 'Scontistica',
departments: 'Uffici',
orders: 'Ordini Ricevuti',
orders2: 'Ordini Ricevuti',
@@ -133,11 +121,9 @@ const msg_website_it = {
only_residenti: 'Solo Residenti',
only_consiglio: 'Solo Consiglieri',
color: 'Colore',
- gasordini: 'Gas Ordini',
- gestoreordini: 'Gestore Ordini',
},
msg: {
- myAppName: 'Più che Buono',
+ myAppName: 'Riso',
myAppDescription: 'Il primo Vero Social Libero, Equo e Solidale, dove Vive Consapevolezza e Aiuto Comunitario. Gratuito',
underconstruction: 'App in costruzione...',
myDescriz: '',
diff --git a/src/db/static_data.ts b/src/db/static_data.ts
index 91805981..efd77ed1 100755
--- a/src/db/static_data.ts
+++ b/src/db/static_data.ts
@@ -67,6 +67,28 @@ function getDynamicPages(site: ISites): IListRoutes[] {
inmenu: false,
infooter: false,
},
+ {
+ active: true,
+ order: 12,
+ path: '/goods',
+ materialIcon: 'fas fa-tshirt',
+ name: 'mypages.goods',
+ component: () => import('@/root/goods/goods.vue'),
+ meta: { requiresAuth: true },
+ inmenu: true,
+ infooter: true,
+ },
+ {
+ active: true,
+ order: 15,
+ path: '/services',
+ materialIcon: 'fas fa-house-user',
+ name: 'mypages.services',
+ component: () => import('@/root/services/services.vue'),
+ meta: { requiresAuth: true },
+ inmenu: true,
+ infooter: true,
+ },
{
active: true,
order: 15,
@@ -78,6 +100,17 @@ function getDynamicPages(site: ISites): IListRoutes[] {
inmenu: false,
infooter: false,
},
+ {
+ active: true,
+ order: 15,
+ path: '/hosps',
+ materialIcon: 'fas fa-bed',
+ name: 'mypages.hosp',
+ component: () => import('@/root/hosp/hosp.vue'),
+ meta: { requiresAuth: true },
+ inmenu: true,
+ infooter: true,
+ },
{
active: site.confpages && site.confpages.enableCircuits,
order: 16,
diff --git a/src/layouts/toolbar/coinsPopover/coinsPopover.ts b/src/layouts/toolbar/coinsPopover/coinsPopover.ts
index bb0aeef4..1d457187 100755
--- a/src/layouts/toolbar/coinsPopover/coinsPopover.ts
+++ b/src/layouts/toolbar/coinsPopover/coinsPopover.ts
@@ -109,17 +109,17 @@ export default defineComponent({
}
}
- function getlastnotif(username: string): any {
+ function getlastnotifcoins(username: string): any {
// Get msg for this chat
- if (notifStore.last_notifs)
- return notifStore.last_notifs.find((rec: INotif) => rec.dest === username)
+ if (notifStore.last_notifcoins)
+ return notifStore.last_notifcoins.find((rec: INotif) => rec.dest === username)
// return users_msg_saved[username]
}
function getlastdataread(username: string): any {
// Get msg for this
- let myrec = getlastnotif(username)
+ let myrec = getlastnotifcoins(username)
const lastdata: any = (myrec && myrec.lastdataread) ? myrec.lastdataread : tools.getLastDateReadReset()
let mydate = ''
@@ -143,7 +143,8 @@ export default defineComponent({
return notifStore.updateNotifDataFromServer({
username,
- lastdataread: getlastdataread(username)
+ lastdataread: getlastdataread(username),
+ qualinotif: shared_consts.QualiNotifs.CIRCUITS
}).then((ris) => {
notifStore.updateNotification = false
diff --git a/src/layouts/toolbar/coinsPopover/coinsPopover.vue b/src/layouts/toolbar/coinsPopover/coinsPopover.vue
index cab967b3..8f0a5238 100755
--- a/src/layouts/toolbar/coinsPopover/coinsPopover.vue
+++ b/src/layouts/toolbar/coinsPopover/coinsPopover.vue
@@ -55,6 +55,8 @@
+
+
-
+
@@ -163,13 +165,13 @@
-
+
{{ $t('notifs.read') }}
-
+
diff --git a/src/layouts/toolbar/notifPopover/notifPopover.ts b/src/layouts/toolbar/notifPopover/notifPopover.ts
index 5796b827..cda344b5 100755
--- a/src/layouts/toolbar/notifPopover/notifPopover.ts
+++ b/src/layouts/toolbar/notifPopover/notifPopover.ts
@@ -179,7 +179,8 @@ export default defineComponent({
return notifStore.updateNotifDataFromServer({
username: myusername,
- lastdataread: getlastdataread(myusername)
+ lastdataread: getlastdataread(myusername),
+ qualinotif: shared_consts.QualiNotifs.OTHERS
}).then((ris) => {
notifStore.updateNotification = false
diff --git a/src/layouts/toolbar/notifPopover/notifPopover.vue b/src/layouts/toolbar/notifPopover/notifPopover.vue
index dfe94abd..f0ca33e1 100755
--- a/src/layouts/toolbar/notifPopover/notifPopover.vue
+++ b/src/layouts/toolbar/notifPopover/notifPopover.vue
@@ -251,7 +251,7 @@
@@ -261,7 +261,7 @@
diff --git a/src/model/MessageStore.ts b/src/model/MessageStore.ts
index bb0cdde4..aad73000 100755
--- a/src/model/MessageStore.ts
+++ b/src/model/MessageStore.ts
@@ -114,6 +114,7 @@ export interface IMessageState {
export interface INotifState {
last_notifs: INotif[]
+ last_notifcoins: INotif[]
show_all: boolean
updateNotification: boolean
countNotif: number
diff --git a/src/model/Products.ts b/src/model/Products.ts
index 8f4d46b5..e24d06fe 100755
--- a/src/model/Products.ts
+++ b/src/model/Products.ts
@@ -58,6 +58,14 @@ export interface IVariazione {
eta?: string
}
+export interface IAuthor {
+ _id?: any
+ name?: string
+ surname?: string
+ bio?: string
+ img?: string
+}
+
export interface IProduct {
_id?: any
active?: boolean
@@ -133,6 +141,7 @@ export interface IOrder {
export interface IProductsState {
products: IProduct[]
+ authors: IAuthor[]
cart: ICart
orders: IOrderCart[]
catprods: ICatProd[]
diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js
index c3e410ce..c948e6cc 100755
--- a/src/statics/lang/it.js
+++ b/src/statics/lang/it.js
@@ -1427,7 +1427,8 @@ const msg_it = {
refuse_coins_qty: 'Rifiuta',
refuse_coins: 'Rifiuta RIS',
movements: 'Movimenti',
- ris_in_arrivo: '👉🏻 Ci sono RIS in Arrivo !',
+ ris_in_arrivo: '👉🏻 Apri, hai RIS da ricevere !',
+ mov_in_arrivo: '👉🏻 Apri {mov} transazioni in RIS!',
transaz: 'mov',
movements_made: 'Movimenti effettuati',
contocomunitario: 'Conto Comunitario',
diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts
index c3f51a8a..ab765e79 100755
--- a/src/store/Modules/fieldsTable.ts
+++ b/src/store/Modules/fieldsTable.ts
@@ -2098,6 +2098,7 @@ export const colTableOrdersCart = [
export const colTableProducts = [
AddCol({ name: 'active', label_trans: 'products.active', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'isbn', label_trans: 'products.isbn' }),
+ AddCol({ name: 'name', label_trans: 'products.name' }),
AddCol({
name: 'idProductInfo',
label_trans: 'products.productInfo',
@@ -3703,6 +3704,7 @@ export const fieldsTable = {
'countries',
'phones',
'cities',
+ 'products',
],
tableWithUsername: [
@@ -3767,7 +3769,7 @@ export const fieldsTable = {
label: 'Prodotti',
columns: colTableProducts,
colkey: '_id',
- collabel: '_id',
+ collabel: 'name',
},
{
value: 'orderscarts',
diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts
index 44e42e14..20760953 100644
--- a/src/store/Modules/tools.ts
+++ b/src/store/Modules/tools.ts
@@ -5806,6 +5806,9 @@ export const tools = {
if (res && res.arrrecnotif) {
notifStore.updateArrRecNotifFromServer(res.arrrecnotif)
}
+ if (res && res.arrrecnotifcoins) {
+ notifStore.updateArrRecNotifCoinsFromServer(res.arrrecnotifcoins)
+ }
if (res && res.userprofile) {
// console.log('updateMyData', res.userprofile)
@@ -7000,10 +7003,14 @@ export const tools = {
},
getValueByFunzOrVal(value: any, keyfunz: any) {
- if (typeof keyfunz === 'function') {
- return keyfunz(value)
- } else {
- return value[keyfunz]
+ try {
+ if (typeof keyfunz === 'function') {
+ return keyfunz(value)
+ } else {
+ return value[keyfunz]
+ }
+ } catch (e) {
+ return ''
}
},
@@ -7712,7 +7719,7 @@ export const tools = {
isTypeByRecMov(rec: IMovVisu) {
let type = costanti.TypeMov.Nessuno
- if (rec && rec.userfrom) {
+ if (rec && (rec.userfrom || rec.userto || rec.groupfrom || rec.groupto)) {
const userStore = useUserStore()
if (rec.userfrom && userStore.my.username === rec.userfrom.username) {
type = costanti.TypeMov.Uscita
@@ -7732,6 +7739,11 @@ export const tools = {
return this.isTypeByRecMov(rec) === costanti.TypeMov.Entrata
},
+ isUscitaByRecMov(rec: IMovVisu) {
+
+ return this.isTypeByRecMov(rec) === costanti.TypeMov.Uscita
+ },
+
getSymbolByCircuit(circuit: any) {
try {
if (circuit.symbol) {
@@ -8584,7 +8596,7 @@ export const tools = {
return color
},
- getIconByVersione (versione: number ) {
+ getIconByVersione(versione: number) {
let str = ''
if (versione === shared_consts.VERSIONE.NUOVO)
str = 'fas fa-book'
@@ -8615,8 +8627,42 @@ export const tools = {
// get the last 2 digit fraction part, of a decimal number
getDecPart2Digit(number: number) {
- return Math.round(number * 100) % 100
- }
+ return Math.round(number * 100) % 100
+ },
+
+ getRecordByField(field: any, record: any) {
+ let mioval = ''
+ if (field) {
+ const arrfields = field.split('.')
+ if (arrfields && arrfields.length > 0) {
+ try {
+ mioval = record[arrfields[0]][arrfields[1]]
+ } catch (e) {
+ return ''
+ }
+ } else {
+ mioval = record[field]
+ }
+ }
+ return mioval
+ },
+
+ setRecordByField(field: any, record: any, value: any) {
+ let mioval = ''
+ if (field) {
+ const arrfields = field.split('.')
+ if (arrfields && arrfields.length > 1) {
+ try {
+ record[arrfields[0]][arrfields[1]] = value
+ } catch (e) {
+ return record
+ }
+ } else {
+ record[field] = value
+ }
+ }
+ return record
+ },
// FINE !
diff --git a/src/store/NotifStore.ts b/src/store/NotifStore.ts
index 0860bfec..05f869cf 100755
--- a/src/store/NotifStore.ts
+++ b/src/store/NotifStore.ts
@@ -12,6 +12,7 @@ import { useUserStore } from '@store/UserStore'
export const useNotifStore = defineStore('NotifStore', {
state: (): INotifState => ({
last_notifs: [],
+ last_notifcoins: [],
show_all: true,
updateNotification: false,
countNotif: 0,
@@ -26,14 +27,14 @@ export const useNotifStore = defineStore('NotifStore', {
},
getlasts_coins: (mystate: INotifState) => (): INotif[] => {
- const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 20).filter((rec) => (mystate.show_all ? true : !rec.read) && (rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS)) : []
+ const ctrec = (mystate.last_notifcoins) ? mystate.last_notifcoins.filter((rec) => (mystate.show_all ? true : !rec.read) && (rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS)) : []
return (ctrec)
},
getnotifs_coinsreq: (mystate: INotifState) => (): INotif[] => {
- const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 20).filter((rec) => rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS && rec.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ && rec.status === shared_consts.CircuitsNotif.STATUS_NONE) : []
+ const ctrec = (mystate.last_notifcoins) ? mystate.last_notifcoins.filter((rec) => rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS && rec.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ && rec.status === shared_consts.CircuitsNotif.STATUS_NONE) : []
return (ctrec)
},
@@ -44,7 +45,7 @@ export const useNotifStore = defineStore('NotifStore', {
},
getnumCoinsUnread: (mystate: INotifState) => () => {
- const myarr = mystate.last_notifs.filter((notif) => !notif.read && (notif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS))
+ const myarr = mystate.last_notifcoins.filter((notif) => !notif.read && (notif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS))
return (tools.isArray(myarr) ? myarr.length : 0)
},
@@ -85,6 +86,18 @@ export const useNotifStore = defineStore('NotifStore', {
}
}
},
+ updateRecNotifCoins(recnotif: INotif) {
+ if (recnotif) {
+ const myrec = this.last_notifcoins.find((rec: any) => rec._id === recnotif._id)
+ if (myrec) {
+ myrec.status = recnotif.status
+ myrec.read = recnotif.read
+ myrec.descr = recnotif.descr
+
+ this.updateArrNotif()
+ }
+ }
+ },
updateArrRecNotifFromServer(arrrecnotif: INotif[]) {
// console.log('arrrecnotif', arrrecnotif)
if (arrrecnotif && arrrecnotif.length > 0) {
@@ -93,6 +106,14 @@ export const useNotifStore = defineStore('NotifStore', {
this.updateArrNotif()
}
},
+ updateArrRecNotifCoinsFromServer(arrrecnotifcoins: INotif[]) {
+ // console.log('arrrecnotif', arrrecnotif)
+ if (arrrecnotifcoins && arrrecnotifcoins.length > 0) {
+ this.last_notifcoins = arrrecnotifcoins
+
+ this.updateArrNotif()
+ }
+ },
async setBadgeIconApp() {
// Get our dummy count and update it,
@@ -129,12 +150,17 @@ export const useNotifStore = defineStore('NotifStore', {
})
},
- setRead(_id: string) {
+ setRead(_id: string, notifcoins: boolean) {
return Api.SendReq(`/sendnotif/set/${_id}/${process.env.APP_ID}`, 'GET', null)
.then((res) => {
// console.log('res', res)
if (res) {
- const rec = this.last_notifs.find((rec: any) => rec._id === _id)
+ let rec = null
+ if (!notifcoins)
+ rec = this.last_notifs.find((rec: any) => rec._id === _id)
+ else
+ rec = this.last_notifcoins.find((rec: any) => rec._id === _id)
+
if (rec) {
rec.read = true
}
@@ -148,12 +174,15 @@ export const useNotifStore = defineStore('NotifStore', {
})
},
- deleteRec(username: string, id: string) {
+ deleteRec(username: string, id: string, notifcoins: boolean) {
return Api.SendReq(`/sendnotif/del/${username}/${id}/${process.env.APP_ID}`, 'GET', null)
.then((res) => {
// console.log('res', res)
if (res) {
- this.last_notifs = this.last_notifs.filter((rec) => rec._id !== id)
+ if (!notifcoins)
+ this.last_notifs = this.last_notifs.filter((rec) => rec._id !== id)
+ else
+ this.last_notifcoins = this.last_notifcoins.filter((rec) => rec._id !== id)
}
this.updateArrNotif()
@@ -171,9 +200,9 @@ export const useNotifStore = defineStore('NotifStore', {
// console.log('res', res)
if (res) {
if (qualinotif === shared_consts.QualiNotifs.CIRCUITS)
- this.last_notifs = this.last_notifs.filter((rec: INotif) => rec.typedir !== shared_consts.TypeNotifs.TYPEDIR_CIRCUITS)
+ this.last_notifcoins = []
else if (qualinotif === shared_consts.QualiNotifs.OTHERS)
- this.last_notifs = this.last_notifs.filter((rec: INotif) => rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS)
+ this.last_notifs = []
this.updateArrNotif()
}
@@ -189,16 +218,22 @@ export const useNotifStore = defineStore('NotifStore', {
return ''
},
- async updateNotifDataFromServer({ username, lastdataread }: { username: string, lastdataread: Date }) {
+ async updateNotifDataFromServer({ username, lastdataread, qualinotif }: { username: string, lastdataread: Date, qualinotif: number }) {
// console.log('updateNotifDataFromServer', username, lastdataread)
- return Api.SendReq(`/sendnotif/${username}/${lastdataread}/${process.env.APP_ID}`, 'GET', null)
+ return Api.SendReq(`/sendnotif/${username}/${lastdataread}/${process.env.APP_ID}/${qualinotif}`, 'GET', null)
.then((res) => {
// console.log('res', res)
if (!!res.data && !!res.data.arrnotif) {
- this.last_notifs = res.data.arrnotif
+ if (qualinotif === shared_consts.QualiNotifs.CIRCUITS)
+ this.last_notifcoins = res.data.arrnotif
+ else
+ this.last_notifs = res.data.arrnotif
} else {
- this.last_notifs = []
+ if (qualinotif === shared_consts.QualiNotifs.CIRCUITS)
+ this.last_notifcoins = []
+ else
+ this.last_notifs = []
}
this.updateArrNotif()
tools.updateMyData(res.data.ris)
diff --git a/src/store/Products.ts b/src/store/Products.ts
index ea462c8d..1e558b0d 100755
--- a/src/store/Products.ts
+++ b/src/store/Products.ts
@@ -1,4 +1,4 @@
-import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine } from 'model'
+import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor } from 'model'
import { Api } from '@api'
import { serv_constants } from '@src/store/Modules/serv_constants'
@@ -107,6 +107,7 @@ export const useProducts = defineStore('Products', {
orders: [],
catprods: [],
catprods_gas: [],
+ authors: [],
subcatprods: [],
productInfos: [],
userActive: { username: '', name: '', surname: '', _id: '' },
@@ -123,6 +124,24 @@ export const useProducts = defineStore('Products', {
},
+ getAuthors: (state: IProductsState) => (): any[] => {
+ // Get the list of authors, for the q-select component using state.authors array
+ // [{name: xxx, value: _id }]
+
+ // add default value for q-select
+ const options = [
+ {
+ label: '[Tutti]',
+ value: '',
+ },
+ ...state.authors.map((rec: IAuthor) => {
+ return { label: rec.name + (rec.surname ? ' ' + rec.surname : ''), value: rec._id }
+ }),
+ ]
+ return options
+ },
+
+
getNumProdTot: (state: IProductsState) => (): number => {
return state.products.length
},
diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts
index 98e48e2a..f7722661 100755
--- a/src/store/UserStore.ts
+++ b/src/store/UserStore.ts
@@ -1647,6 +1647,9 @@ export const useUserStore = defineStore('UserStore', {
if (res && res.data.arrrecnotif) {
notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif)
}
+ if (res && res.data.arrrecnotifcoins) {
+ notifStore.updateArrRecNotifCoinsFromServer(res.data.arrrecnotifcoins)
+ }
if (res.data.useraccounts && res.data.useraccounts.length > 0) {
this.my.profile.useraccounts = res.data.useraccounts
}
@@ -1782,12 +1785,15 @@ export const useUserStore = defineStore('UserStore', {
return await Api.SendReq('/users/circuits/cmd', 'POST', { usernameOrig, circuitname, cmd, value, extrarec })
.then((res) => {
this.updateTables = true
+ const notifStore = useNotifStore()
if (res.data.recnotif) {
- const notifStore = useNotifStore()
-
- notifStore.updateRecNotif(res.data.recnotif)
-
- notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif)
+ if (res.data.recnotif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS) {
+ notifStore.updateRecNotifCoins(res.data.recnotif)
+ notifStore.updateArrRecNotifCoinsFromServer(res.data.arrrecnotifcoins)
+ } else {
+ notifStore.updateRecNotif(res.data.recnotif)
+ notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif)
+ }
}
return res.data
}).catch((error) => {
diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts
index ee588068..692aaeec 100644
--- a/src/store/globalStore.ts
+++ b/src/store/globalStore.ts
@@ -329,7 +329,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'storehouses') ris = state.storehouses
else if (table === 'providers') ris = state.providers
else if (table === 'productinfos') ris = Products.productInfos
- else if (table === 'product') ris = Products.products
+ // else if (table === 'products') ris = Products.products
else if (table === 'gasordines') ris = state.gasordines
else if (table === 'scontisticas') ris = state.scontisticas
else if (table === 'groups') ris = state.groups
@@ -339,6 +339,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'categorys') ris = state.categories
else if (table === 'catprods') ris = Products.catprods
else if (table === 'catprods_gas') ris = Products.catprods_gas
+ else if (table === 'authors') ris = Products.authors
else if (table === 'catais') ris = state.catAI
else if (table === 'queryais') ris = state.queryAIList
else if (table === 'sharewithus') ris = state.sharewithus
@@ -1573,6 +1574,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
Products.catprods = (res.data.catprods) ? [...res.data.catprods] : []
Products.catprods_gas = (res.data.catprods_gas) ? [...res.data.catprods_gas] : []
+ Products.authors = (res.data.authors) ? [...res.data.authors] : []
this.gasordines = (res.data.gasordines) ? [...res.data.gasordines] : []
this.scontisticas = (res.data.scontisticas) ? [...res.data.scontisticas] : []
diff --git a/src/views/ecommerce/catalogo/catalogo.ts b/src/views/ecommerce/catalogo/catalogo.ts
index 5301f1ac..547c469c 100755
--- a/src/views/ecommerce/catalogo/catalogo.ts
+++ b/src/views/ecommerce/catalogo/catalogo.ts
@@ -11,13 +11,16 @@ import { costanti } from '@costanti'
import { shared_consts } from '@/common/shared_vuejs'
import { CProductCard } from '@src/components/CProductCard'
+import { CMySelect } from '@src/components/CMySelect'
import { CCatalogoCard } from '@src/components/CCatalogoCard'
import { CSelectUserActive } from '@src/components/CSelectUserActive'
-import { IProduct } from '@src/model'
+import { IProduct, ISearchList } from 'model'
+
+import { fieldsTable } from '@store/Modules/fieldsTable'
export default defineComponent({
name: 'Catalogo',
- components: { CCatalogoCard, CProductCard, CSelectUserActive },
+ components: { CCatalogoCard, CProductCard, CSelectUserActive, CMySelect },
props: {},
setup() {
const userStore = useUserStore()
@@ -28,6 +31,7 @@ export default defineComponent({
const { t } = useI18n()
const search = ref('')
+ const optauthors = ref([])
const filter = ref({
author: '',
@@ -43,16 +47,27 @@ export default defineComponent({
const refreshpage = ref(false)
const show_hide = ref(false)
+ const mycolumns = ref([])
+
+ const searchList = ref([] as ISearchList[])
+
const arrProducts = ref([])
const numRecLoaded = ref(0)
-
// Create a ref for the component to fix
const componentToFixRef = ref(null);
const isFixed = ref(false);
+ const labelcombo = computed(() => (item: any) => {
+ let lab = item.label
+ if (item.showcount)
+ lab += ' (' + valoriopt.value(item, false, false).length + ')'
+ return lab
+ })
+
+
const arrLoaded = computed(() => {
if (arrProducts.value && numRecLoaded.value)
return arrProducts.value.slice(0, numRecLoaded.value)
@@ -86,6 +101,13 @@ export default defineComponent({
tools.scrollToTopValue(300)
}
})
+ watch(() => filter.value.author, (newval, oldval) => {
+
+ calcArrProducts()
+ if (tools.scrollTop() > 300) {
+ tools.scrollToTopValue(300)
+ }
+ })
watch(() => cosa.value, (newval, oldval) => {
tools.setCookie(tools.COOK_COSA_PRODOTTI, cosa.value.toString())
@@ -98,21 +120,24 @@ export default defineComponent({
// console.log('calcArrProducts')
refreshpage.value = true
- let arrprod = productStore.getProducts(cosa.value)
- let catstr = cat.value;
+ let arrprod = productStore.getProducts(cosa.value) || [];
+ let catstr = cat.value || '';
+ let filtroAuthor = filter.value.author || '';
let gasselstr = ''
if (cosa.value === shared_consts.PROD.GAS) {
- gasselstr = idGasSel.value
+ gasselstr = idGasSel.value || '';
}
- let lowerSearchText = search.value.toLowerCase().trim();
- if ((!lowerSearchText || (lowerSearchText && lowerSearchText.length < 2)) && !catstr && (!gasselstr && (cosa.value !== shared_consts.PROD.GAS))) {
+ let lowerSearchText = (search.value || '').toLowerCase().trim();
+ lowerSearchText = lowerSearchText.replace(/[-@:=]/g, '');
+ if ((!lowerSearchText || (lowerSearchText && lowerSearchText.length < 2)) && !catstr && !filtroAuthor && (!gasselstr && (cosa.value !== shared_consts.PROD.GAS))) {
} else {
arrprod = arrprod.filter((product: IProduct) => {
if (product && product.productInfo) {
- let lowerName = product.productInfo.name!.toLowerCase();
- let hasCategoria = !catstr || (catstr && product.productInfo.idCatProds?.includes(catstr));
+ let lowerName = (product.productInfo.name || '').toLowerCase();
+ let hasCategoria = !catstr || (catstr && (product.productInfo.idCatProds || []).includes(catstr));
+ let hasAuthor = !filtroAuthor || (filtroAuthor && (product.productInfo.idAuthors || []).includes(filtroAuthor));
let productgassel = true
if (gasselstr || (cosa.value === shared_consts.PROD.GAS)) {
@@ -121,12 +146,15 @@ export default defineComponent({
// Use a regular expression to match whole words
let codeMatch = new RegExp(`\\b${lowerSearchText}\\b`, 'i');
- let nameMatch = new RegExp(`\\b(?=.*\\b${lowerSearchText.split(/\s+/).map(word => `(${word})\\b`).join('.*\\b')}\\b)`, 'i');
+ // let nameMatch = new RegExp(`\\b(?=.*\\b${lowerSearchText.split(/\s+/).map(word => `(${word})\\b`).join('.*\\b')}\\b)`, 'i');
// Check if all words in lowerSearchText are present in lowerName
let allWordsPresent = lowerSearchText.split(/\s+/).every(word => new RegExp(`\\b${word}\\b`, 'i').test(lowerName));
- return (codeMatch.test(product.productInfo.code!) || allWordsPresent) && hasCategoria && productgassel;
+ return (codeMatch.test(product.productInfo.code || '') || allWordsPresent) && hasCategoria && hasAuthor && productgassel;
+ } else {
+ console.error('product or product.productInfo is null');
+ return false;
}
});
}
@@ -136,6 +164,7 @@ export default defineComponent({
refreshpage.value = false
}
+
/*function getProducts() {
let arrprod = productStore.getProducts(cosa.value)
if (!search.value) {
@@ -155,6 +184,26 @@ export default defineComponent({
async function mounted() {
loadpage.value = false
await productStore.loadProducts()
+
+ mycolumns.value = fieldsTable.getArrColsByTable('products')
+
+ searchList.value = [
+ {
+ label: 'Ricerca',
+ table: 'products',
+ key: 'titolo',
+ type: costanti.FieldType.select_by_server,
+ value: '',
+ addall: true,
+ arrvalue: [],
+ useinput: true,
+ filter: null,
+ tablesel: 'products',
+ },
+ ]
+
+ optauthors.value = productStore.getAuthors()
+
cosa.value = tools.getCookie(tools.COOK_COSA_PRODOTTI, shared_consts.PROD.GAS, true)
if (cosa.value === shared_consts.PROD.TUTTI)
cosa.value = shared_consts.PROD.GAS
@@ -207,6 +256,42 @@ export default defineComponent({
}
}
+ function filterFn(val: any, update: any, abort: any) {
+ update(() => {
+ const needle = val.toLowerCase();
+ optauthors.value = productStore.getAuthors().filter(v => {
+ const authorName = v.label.toLowerCase();
+ const wordsToSearch = needle.split(' ');
+ return wordsToSearch.every((word: any) => {
+ if (word.length > 1) {
+ return authorName.includes(word);
+ } else {
+ return authorName.split(' ').some((namePart: any) => namePart.startsWith(word));
+ }
+ });
+ });
+ });
+ }
+
+ function selauthor(id: string, value: string) {
+ filter.value.author = id
+ }
+
+ function searchval(newval: any, table: any, tablesel: any) {
+ console.log('REFRR searchval', newval, table, 'tablesel', tablesel)
+ if (newval === '') {
+ search.value = ''
+ } else {
+ search.value = newval.name
+ }
+ }
+
+ const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => {
+ // console.log('valoriopt', item.table)
+ return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
+ })
+
+
onMounted(mounted)
return {
@@ -232,6 +317,15 @@ export default defineComponent({
numRecLoaded,
arrLoaded,
filter,
+ optauthors,
+ filterFn,
+ selauthor,
+ searchList,
+ fieldsTable,
+ searchval,
+ valoriopt,
+ labelcombo,
+ mycolumns,
}
}
})
diff --git a/src/views/ecommerce/catalogo/catalogo.vue b/src/views/ecommerce/catalogo/catalogo.vue
index 553d4371..ac1fd69a 100755
--- a/src/views/ecommerce/catalogo/catalogo.vue
+++ b/src/views/ecommerce/catalogo/catalogo.vue
@@ -167,21 +167,73 @@
>
+
+
+
+
+
+
-
-
+
+
+
@@ -237,6 +289,7 @@
quante_col: 'c2',
in_3d: false,
}"
+ @selauthor="selauthor"
/>