aggiornamento scontistica, corretto errori

This commit is contained in:
Surya Paolo
2023-12-16 18:40:24 +01:00
parent 38f4c73ab3
commit fa544bc30c
10 changed files with 68 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ PROVA_PAOLO=""
LANG_DEFAULT="it" LANG_DEFAULT="it"
PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF" PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF"
MASTER_KEY="KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T" MASTER_KEY="KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T"
MONGODB_HOST="https://srv.piuchebuono.app:3000" MONGODB_HOST="https://piuchebuono.app:3000"
LOGO_REG='piuchebuono-logo-full.png' LOGO_REG='piuchebuono-logo-full.png'
TEST_NAME="" TEST_NAME=""
TEST_SURNAME="" TEST_SURNAME=""

View File

@@ -10,7 +10,7 @@ PROVA_PAOLO=""
LANG_DEFAULT="it" LANG_DEFAULT="it"
PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF" PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF"
MASTER_KEY="KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T" MASTER_KEY="KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T"
MONGODB_HOST="https://srv.piuchebuono.app:3001" MONGODB_HOST="https://piuchebuono.app:3001"
LOGO_REG='piuchebuono-logo-full.png' LOGO_REG='piuchebuono-logo-full.png'
TEST_NAME="" TEST_NAME=""
TEST_SURNAME="" TEST_SURNAME=""

View File

@@ -28,3 +28,8 @@
font-weight: bold; font-weight: bold;
font-size: 1.2rem; font-size: 1.2rem;
} }
.prod_sconti {
font-size: 1.1rem;
color: blue;
}

View File

@@ -51,6 +51,15 @@
myproduct.after_price myproduct.after_price
}}</span> }}</span>
</q-item-label> </q-item-label>
<q-item-label v-if="myproduct.scontisticas && myproduct.scontisticas.length > 0">
<div
class="prod_sconti"
v-for="(sconti, index) of myproduct.scontisticas"
:key="index"
>
{{ sconti.description }}
</div>
</q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@@ -129,8 +138,11 @@
tools.isManager() && myproduct.QuantitaOrdinateInAttesa > 0 tools.isManager() && myproduct.QuantitaOrdinateInAttesa > 0
" "
> >
{{ $t('ecomm.qta_in_attesa', {qty: myproduct.QuantitaOrdinateInAttesa }) }} {{
$t('ecomm.qta_in_attesa', {
qty: myproduct.QuantitaOrdinateInAttesa,
})
}}
</div> </div>
</div> </div>
</q-item-label> </q-item-label>

View File

@@ -7,6 +7,8 @@ export interface IProduct {
idProducer?: string, idProducer?: string,
idProvider?: string, idProvider?: string,
idStorehouses?: string[], idStorehouses?: string[],
idScontisticas?: string[],
scontisticas: IScontistica[],
producer?: IProducer, producer?: IProducer,
storehouses: IStorehouse[], storehouses: IStorehouse[],
provider?: IProvider, provider?: IProvider,
@@ -45,6 +47,7 @@ export interface IOrder {
idProducer?: string idProducer?: string
idProvider?: string idProvider?: string
idStorehouse?: string idStorehouse?: string
idScontisticas?: string[]
price?: number price?: number
after_price?: string after_price?: string
color?: string color?: string
@@ -55,6 +58,7 @@ export interface IOrder {
product?: IProduct product?: IProduct
producer?: IProducer producer?: IProducer
storehouse?: IStorehouse storehouse?: IStorehouse
scontisticas?: IScontistica[]
provider?: IProvider provider?: IProvider
date_created?: Date date_created?: Date
date_checkout?: Date date_checkout?: Date

View File

@@ -3566,7 +3566,7 @@ export const fieldsTable = {
label: 'Scontistica', label: 'Scontistica',
columns: colTableScontistica, columns: colTableScontistica,
colkey: '_id', colkey: '_id',
collabel: 'code', collabel: 'description',
}, },
{ {
value: 'sharewithus', value: 'sharewithus',

View File

@@ -44,7 +44,7 @@ export const useProducts = defineStore('Products', {
getProduct: (state: IProductsState) => (code: string): IProduct => { getProduct: (state: IProductsState) => (code: string): IProduct => {
const prod = state.products.find((prod: IProduct) => prod.code === code) const prod = state.products.find((prod: IProduct) => prod.code === code)
return prod ? prod : { storehouses: [] } return prod ? prod : { storehouses: [], scontisticas: [] }
}, },
getCart: (state: IProductsState) => (): ICart => { getCart: (state: IProductsState) => (): ICart => {
@@ -151,6 +151,8 @@ export const useProducts = defineStore('Products', {
active: false, active: false,
idProducer: '', idProducer: '',
idStorehouses: [], idStorehouses: [],
idScontisticas: [],
scontisticas: [],
idProvider: '', idProvider: '',
producer: {}, producer: {},
storehouses: [], storehouses: [],
@@ -191,7 +193,6 @@ export const useProducts = defineStore('Products', {
idapp: process.env.APP_ID, idapp: process.env.APP_ID,
idProduct: product._id, idProduct: product._id,
idProducer: product.idProducer, idProducer: product.idProducer,
idProvider: product.idProvider,
status: shared_consts.OrderStatus.IN_CART, status: shared_consts.OrderStatus.IN_CART,
price: product.price, price: product.price,
after_price: product.after_price, after_price: product.after_price,
@@ -201,7 +202,7 @@ export const useProducts = defineStore('Products', {
quantity: order.quantity, quantity: order.quantity,
idStorehouse: order.idStorehouse, idStorehouse: order.idStorehouse,
idScontisticas: product.idScontisticas,
} }
if (product.storehouses.length === 1) { if (product.storehouses.length === 1) {

View File

@@ -120,8 +120,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
resps: [], resps: [],
workers: [], workers: [],
storehouses: [], storehouses: [],
providers: [],
scontisticas: [], scontisticas: [],
providers: [],
departments: [], departments: [],
categories: [], categories: [],
sharewithus: [], sharewithus: [],

View File

@@ -10,6 +10,7 @@ import { useQuasar } from 'quasar'
import { costanti } from '@costanti' import { costanti } from '@costanti'
import { CProductCard } from '@src/components/CProductCard' import { CProductCard } from '@src/components/CProductCard'
import { IProduct } from '@src/model'
export default defineComponent({ export default defineComponent({
@@ -24,12 +25,24 @@ export default defineComponent({
const $q = useQuasar() const $q = useQuasar()
const { t } = useI18n() const { t } = useI18n()
const search = ref('')
function mounted() { function mounted() {
// Inizializza // Inizializza
productStore.loadProducts() productStore.loadProducts()
} }
function getProducts() { function getProducts() {
return productStore.getProducts() let arrprod = productStore.getProducts()
if (!search.value) {
return arrprod
}
let lowerSearchText = search.value.toLowerCase();
return arrprod.filter((product: IProduct) => {
let lowerName = product.name!.toLowerCase();
return product.code!.includes(search.value) || lowerName.includes(lowerSearchText);
});
} }
onMounted(mounted) onMounted(mounted)
@@ -40,6 +53,7 @@ export default defineComponent({
tools, tools,
toolsext, toolsext,
getProducts, getProducts,
search,
} }
} }
}) })

View File

@@ -2,9 +2,29 @@
<q-page> <q-page>
<div class="panel"> <div class="panel">
<div class="container"> <div class="container">
<div
class="q-gutter-y-md column text-center q-mx-auto"
style="width: 350px; max-width: 100%"
>
<q-input
filled
stack-label
label="Inserisci il codice o il testo"
v-model="search"
class="q-ml-md"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
</div>
<div class="row"> <div class="row">
<div class="q-pa-md row items-start q-gutter-md" v-for="(product, index) in getProducts()" :key="index"> <div
<CProductCard :code="product.code" :complete="false"/> class="q-pa-md row items-start q-gutter-md"
v-for="(product, index) in getProducts()"
:key="index"
>
<CProductCard :code="product.code" :complete="false" />
</div> </div>
</div> </div>
</div> </div>
@@ -13,7 +33,6 @@
</template> </template>
<script lang="ts" src="./productsList.ts"> <script lang="ts" src="./productsList.ts">
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>