PCB lista categorie

This commit is contained in:
Surya Paolo
2023-11-28 14:12:45 +01:00
parent b29caade62
commit 2314b07428
14 changed files with 216 additions and 78 deletions

View File

@@ -208,7 +208,6 @@
:maxlength="col.maxlength ? col.maxlength : undefined"
:disable="disable"
:readonly="disable"
:hint="hint"
:type="
col.fieldtype === costanti.FieldType.crypted
? `password`

View File

@@ -5,14 +5,6 @@ const msg_website_it = {
description: '',
keywords: '',
},
products: {
quantity: 'Quantità',
quantityAvailable: 'Disponibili',
weight: 'Peso',
stars: 'Voto',
color: 'Colore',
theme: 'Tema',
},
hours: {
descr: 'Descrizione',
date: 'Data',
@@ -40,6 +32,7 @@ const msg_website_it = {
products: 'Prodotti',
productslist: 'Lista Prodotti',
collabora: 'Collabora',
categories: 'Categorie',
storehouses: 'Magazzino',
departments: 'Uffici',
orders: 'Ordini Ricevuti',

View File

@@ -1,7 +0,0 @@
export interface ICategory {
id?: number,
descr_it?: string
descr_en?: string
descr_es?: string
campo2bool: boolean
}

View File

@@ -1,7 +1,7 @@
import { IAction } from '@src/model/Projects'
import { IFriends, IGroupShort, IMyGroup, IPaymentType } from '@src/model/UserStore'
import {
IDepartment, IProducer, IShareWithUs, IStorehouse,
IDepartment, IProducer, IShareWithUs, IStorehouse, ICategory
} from '@src/model/Products'
import { IUserFields, IUserProfile } from '@src/model/UserStore'
@@ -434,6 +434,7 @@ export interface IGlobalState {
producers: IProducer[],
storehouses: IStorehouse[],
departments: IDepartment[],
categories: ICategory[],
sharewithus: IShareWithUs[],
groups: IGroup[],
resps: IResp[],

View File

@@ -80,6 +80,12 @@ export interface IDepartment {
username?: string,
}
export interface ICategory {
_id?: any
name: string,
img?: string,
}
export interface IStorehouse {
_id?: any
idapp?: string

View File

@@ -6,7 +6,6 @@ export * from './signup-option'
export * from './key-value'
// export * from './payload'
export * from './Categories'
export * from './Todos'
export * from './Projects'

View File

View File

@@ -0,0 +1,34 @@
import { colTablecategories } from '@src/store/Modules/fieldsTable'
import { CImgText } from '../../../components/CImgText/index'
import { defineComponent } from 'vue'
import { CCard } from '@/components/CCard'
import { CMyPage } from '@/components/CMyPage'
import { CTitleBanner } from '@/components/CTitleBanner'
import { CGridTableRec } from '@/components/CGridTableRec'
import MixinMetaTags from '../../../mixins/mixin-metatags'
export default defineComponent({
name: 'CategoriesPage',
components: { CImgText, CCard, CMyPage, CTitleBanner, CGridTableRec },
setup() {
const pagination = {
sortBy: 'name',
descending: false,
page: 2,
rowsPerPage: 5
// rowsNumber: xx if getting data from a server
}
const { setmeta } = MixinMetaTags()
return {
colTablecategories,
setmeta,
}
}
})

View File

@@ -0,0 +1,31 @@
<template>
<CMyPage title="Categorie" imgbackground="images/produttori.jpg" sizes="max-height: 120px">
<span>{{
setmeta({
title: 'Categorie',
description: '',
keywords: '',
})
}}
</span>
<div class="q-ma-sm q-gutter-sm q-pa-xs">
<CTitleBanner title="Categorie"></CTitleBanner>
<CGridTableRec
prop_mytable="categorys"
prop_mytitle="Categorie"
:prop_mycolumns="colTablecategories"
prop_colkey="name"
nodataLabel="Nessuna Categoria"
noresultLabel="Il filtro selezionato non ha trovato nessun risultato">
</CGridTableRec>
</div>
</CMyPage>
</template>
<script lang="ts" src="./categories.ts">
</script>
<style lang="scss" scoped>
@import 'categories.scss';
</style>

View File

@@ -114,6 +114,34 @@ function getRoutesAd(site: ISites) {
onlyManager: true,
onlyEditor: true
},
{
active: true,
order: 31,
path: '/admin/ecommerce/orders',
materialIcon: 'fas fa-file-alt',
name: 'pages.orders',
component: () => import('@/rootgen/admin/orders/orders.vue'),
inmenu: true,
submenu: true,
level_parent: 0,
level_child: 0.5,
onlyManager: true,
onlyEditor: true
},
{
active: true,
order: 32,
path: '/admin/ecommerce/categories',
materialIcon: 'fas fa-file-alt',
name: 'pages.categories',
component: () => import('@/rootgen/admin/categories/categories.vue'),
inmenu: true,
submenu: true,
level_parent: 0,
level_child: 0.5,
onlyManager: true,
onlyEditor: true
},
]
@@ -160,6 +188,14 @@ function getRoutesAd(site: ISites) {
component: () => import('@/rootgen/admin/orders/orders.vue'),
infooter: false,
},
{
active: true,
order: 36,
path: '/admin/ecommerce/categories',
name: 'pages.categories',
component: () => import('@/rootgen/admin/categories/categories.vue'),
infooter: false,
},
]

View File

@@ -43,6 +43,29 @@ const msg_it = {
aportador_him: 'Invitato da',
myactivities: 'Attività',
},
products: {
name: 'Nome',
active: 'Attivo',
code: 'Codice',
description: 'Descrizione',
icon: 'Icona',
img: 'Img',
department: 'Ufficio',
producer: 'Produttore',
category: 'Categorie',
price: 'Prezzo',
after_price: 'Dopo il Prezzo',
size: 'Dimensioni',
canBeShipped: 'Può essere spedito',
canBeBuyOnline: 'Acquistabile On Line',
date: 'Data',
quantity: 'Quantità',
quantityAvailable: 'Disponibili',
weight: 'Peso',
stars: 'Voto',
color: 'Colore',
theme: 'Tema',
},
otherpages: {
myactivities: 'Attività',
myactivities2: 'Mie Attività',

View File

@@ -396,6 +396,13 @@ export const colTabledepartments = [
AddCol(DuplicateRec),
]
export const colTablecategories = [
AddCol({ name: 'name', label_trans: 'categories.name' }),
AddCol({ name: 'img', label_trans: 'categories.img' }),
AddCol(DeleteRec),
AddCol(DuplicateRec),
]
export const colTableStorehouse = [
AddCol({ name: 'name', label_trans: 'store.name' }),
AddCol({ name: 'description', label_trans: 'store.description' }),
@@ -1924,7 +1931,12 @@ export const colTableProducts = [
jointable: 'departments',
}),
// AddCol({ name: 'department', label_trans: 'products.department' }),
AddCol({ name: 'category', label_trans: 'products.category' }),
AddCol({
name: 'category',
label_trans: 'products.category',
fieldtype: costanti.FieldType.multiselect,
jointable: 'categorys',
}),
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'after_price', label_trans: 'products.after_price' }),
AddCol({ name: 'color', label_trans: 'products.color' }),
@@ -3466,6 +3478,13 @@ export const fieldsTable = {
colkey: 'username',
collabel: 'name',
},
{
value: 'categorys',
label: 'Categorie',
columns: colTablecategories,
colkey: '_id',
collabel: 'name',
},
{
value: 'storehouses',
label: 'Magazzini',

View File

@@ -120,6 +120,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
workers: [],
storehouses: [],
departments: [],
categories: [],
sharewithus: [],
TIMER: null,
TIMEOUT: null,
@@ -300,6 +301,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'resps') ris = state.resps
else if (table === 'workers') ris = state.workers
else if (table === 'departments') ris = state.departments
else if (table === 'categorys') ris = state.categories
else if (table === 'sharewithus') ris = state.sharewithus
else if (table === 'paymenttypes') ris = state.paymenttypes
else if (table === 'circuits') ris = circuitStore.listcircuits
@@ -1512,6 +1514,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
this.resps = (res.data.resps) ? [...res.data.resps] : []
this.workers = (res.data.workers) ? [...res.data.workers] : []
this.departments = (res.data.departments) ? [...res.data.departments] : []
this.categories = (res.data.categories) ? [...res.data.categories] : []
this.levels = (res.data.levels) ? [...res.data.levels] : []
this.skills = (res.data.skills) ? [...res.data.skills] : []
this.goods = (res.data.goods) ? [...res.data.goods] : []

View File

@@ -43,7 +43,7 @@ export default defineComponent({
return cart.items || null
}
function getNumItems() {
function getNumItems(): number {
const cart = productStore.getCart()
if (!!cart.items)
return cart.items.length || 0
@@ -51,7 +51,7 @@ export default defineComponent({
return 0
}
function getCart() {
function getCart(): ICart {
return productStore.getCart()
}
@@ -70,21 +70,21 @@ export default defineComponent({
const aggiorna = fieldname !== 'status'
tools.saveFieldToServer($q, 'carts', mycart.value._id, mydata, aggiorna)
myrec.value = oldrec.value
oldrec.value[fieldname] = myrec.value[fieldname]
}
}
function myTotalPrice() {
function myTotalPrice(): string {
if (productStore.cart && productStore.cart.totalPrice) {
return productStore.cart.totalPrice.toFixed(2)
} else {
return 0
return '0'
}
}
function myTotalQty() {
function myTotalQty(): number {
if (productStore.cart) {
return productStore.cart.totalQty
return productStore.cart.totalQty!
} else {
return 0
}
@@ -93,6 +93,7 @@ export default defineComponent({
async function load() {
mycart.value = getCart()
myrec.value = Object.keys(mycart)
oldrec.value = myrec.value
note.value = mycart.value.note!
if (mycart.value)