- edit campi prodotti
- edit ordini
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="q-pa-sm col items-start q-gutter-xs" v-for="(itemorder, index) in getItemsCart()" :key="index">
|
<div class="q-pa-sm col items-start q-gutter-xs" v-for="(itemorder, index) in getItemsCart()" :key="index">
|
||||||
<CSingleCart :order="itemorder.order" :showall="true" />
|
<CSingleCart :order="itemorder.order" :idOrdersCart="recOrderCart._id" :showall="true" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<q-separator></q-separator>
|
<q-separator></q-separator>
|
||||||
|
|||||||
@@ -172,6 +172,12 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function azzera() {
|
||||||
|
saveit.value = true
|
||||||
|
showDateTimeScroller.value = false
|
||||||
|
emit('savetoclose', null, valueprec.value)
|
||||||
|
}
|
||||||
|
|
||||||
created()
|
created()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -190,6 +196,7 @@ export default defineComponent({
|
|||||||
mydate,
|
mydate,
|
||||||
mytime,
|
mytime,
|
||||||
tools,
|
tools,
|
||||||
|
azzera,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -79,6 +79,10 @@
|
|||||||
}
|
}
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
<q-card-actions align="center">
|
||||||
|
<q-btn icon="fas fa-trash"
|
||||||
|
@click="azzera"></q-btn>
|
||||||
<div class="row justify-center">
|
<div class="row justify-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
:label="$t('dialog.cancel')"
|
:label="$t('dialog.cancel')"
|
||||||
@@ -90,7 +94,7 @@
|
|||||||
v-close-popup
|
v-close-popup
|
||||||
></q-btn>
|
></q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</q-card-actions>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-popup-proxy>
|
</q-popup-proxy>
|
||||||
<q-popup-proxy
|
<q-popup-proxy
|
||||||
|
|||||||
@@ -8,8 +8,11 @@ import { CCopyBtn } from '@/components/CCopyBtn'
|
|||||||
import { CSingleCart } from '@/components/CSingleCart'
|
import { CSingleCart } from '@/components/CSingleCart'
|
||||||
import { CTitleBanner } from '@/components/CTitleBanner'
|
import { CTitleBanner } from '@/components/CTitleBanner'
|
||||||
|
|
||||||
|
import { useI18n } from '@src/boot/i18n'
|
||||||
|
|
||||||
import MixinUsers from '../../mixins/mixin-users'
|
import MixinUsers from '../../mixins/mixin-users'
|
||||||
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CMyCart',
|
name: 'CMyCart',
|
||||||
props: {},
|
props: {},
|
||||||
@@ -18,6 +21,7 @@ export default defineComponent({
|
|||||||
setup() {
|
setup() {
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
const products = useProducts()
|
const products = useProducts()
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
const { getnumItemsCart } = MixinUsers()
|
const { getnumItemsCart } = MixinUsers()
|
||||||
|
|
||||||
@@ -70,6 +74,7 @@ export default defineComponent({
|
|||||||
getnumItemsCart,
|
getnumItemsCart,
|
||||||
existsOrders,
|
existsOrders,
|
||||||
globalStore,
|
globalStore,
|
||||||
|
t,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<q-separator></q-separator>
|
<q-separator></q-separator>
|
||||||
<div id="mybody">
|
<div id="mybody">
|
||||||
<div v-for="(rec, index) in ordersCart" :key="index" class="col">
|
<div v-for="(rec, index) in ordersCart" :key="index" class="col">
|
||||||
<CSingleCart :order="rec.order" :showall="false"> </CSingleCart>
|
<CSingleCart :order="rec.order" :showall="false" :idOrdersCart="ordersCart ? ordersCart._id: ''"> </CSingleCart>
|
||||||
</div>
|
</div>
|
||||||
</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">
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
rounded
|
rounded
|
||||||
icon="fas fa-shopping-cart"
|
icon="fas fa-shopping-cart"
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="$t('ecomm.btn_cassa')"
|
:label="t('ecomm.btn_cassa')"
|
||||||
@click="globalStore.rightCartOpen = false"
|
@click="globalStore.rightCartOpen = false"
|
||||||
class="q-mb-sm"
|
class="q-mb-sm"
|
||||||
to="/checkout"
|
to="/checkout"
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
rounded
|
rounded
|
||||||
icon="fas fa-clipboard-list"
|
icon="fas fa-clipboard-list"
|
||||||
color="positive"
|
color="positive"
|
||||||
:label="$t('ecomm.btn_ordini')"
|
:label="t('ecomm.btn_ordini')"
|
||||||
class="q-mb-sm"
|
class="q-mb-sm"
|
||||||
@click="globalStore.rightCartOpen = false"
|
@click="globalStore.rightCartOpen = false"
|
||||||
to="/orderinfo"
|
to="/orderinfo"
|
||||||
|
|||||||
24
src/components/CMyValueDb/CMyValueDb.scss
Executable file
24
src/components/CMyValueDb/CMyValueDb.scss
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
.colmodif {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.colmodif:hover {
|
||||||
|
background-color: #a8f0ff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colsel {
|
||||||
|
background-color: #81b8ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cldisable{
|
||||||
|
color: gray !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clinput{
|
||||||
|
@media (max-width: 500px) {
|
||||||
|
display: flex;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
194
src/components/CMyValueDb/CMyValueDb.ts
Executable file
194
src/components/CMyValueDb/CMyValueDb.ts
Executable file
@@ -0,0 +1,194 @@
|
|||||||
|
import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
|
||||||
|
import { useQuasar } from 'quasar'
|
||||||
|
import { useI18n } from '@/boot/i18n'
|
||||||
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
|
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||||
|
import { tools } from '@store/Modules/tools'
|
||||||
|
import { costanti } from '@costanti'
|
||||||
|
import { CMyPopupEdit } from '@/components/CMyPopupEdit'
|
||||||
|
import { IColGridTable, IOperators, ISpecialField } from 'model'
|
||||||
|
import MixinBase from '@/mixins/mixin-base'
|
||||||
|
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'CMyValueDb',
|
||||||
|
emits: ['save'],
|
||||||
|
props: {
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
hint: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
mykey: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
mysubkey: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
specialField: {
|
||||||
|
type: Object as PropType<ISpecialField>,
|
||||||
|
required: false,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
filter: {
|
||||||
|
type: [String, Function],
|
||||||
|
required: false,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
indrec: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: -1,
|
||||||
|
},
|
||||||
|
maxlength: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
minlength: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
mysubsubkey: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
serv: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
canModify: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
disable: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
jointable: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: 'settings',
|
||||||
|
},
|
||||||
|
myimg: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
rec: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
mycol: {
|
||||||
|
type: Object as PropType<IColGridTable> | undefined,
|
||||||
|
required: false,
|
||||||
|
default: () => {
|
||||||
|
return { }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
idmain: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
tablesel: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
pickup: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: { CMyPopupEdit },
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const $q = useQuasar()
|
||||||
|
const { t } = useI18n()
|
||||||
|
const globalStore = useGlobalStore()
|
||||||
|
|
||||||
|
const col = ref(<IColGridTable>{
|
||||||
|
name: 'test', fieldtype: 0, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView, visible: true, maxlength: props.maxlength, minlength: props.minlength
|
||||||
|
})
|
||||||
|
const row = ref({})
|
||||||
|
|
||||||
|
const { setValDb, getValDb } = MixinBase()
|
||||||
|
|
||||||
|
function showandsel(row: any, col: any, newval: any, valinitial: any) {
|
||||||
|
console.log('showandsel CMyFieldDb', row, col, newval)
|
||||||
|
|
||||||
|
if (newval !== valinitial) {
|
||||||
|
setValDb($q, props.mykey, newval, props.type, props.serv, props.table, props.mysubkey, props.id, props.indrec, props.mysubsubkey, props.specialField)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function save(newval: any) {
|
||||||
|
emit('save', newval)
|
||||||
|
}
|
||||||
|
|
||||||
|
function withBorder() {
|
||||||
|
if (col.value)
|
||||||
|
return col.value.fieldtype !== costanti.FieldType.onlydate && col.value.fieldtype !== costanti.FieldType.date
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
function mounted() {
|
||||||
|
if (props.rec) {
|
||||||
|
row.value = props.rec
|
||||||
|
}
|
||||||
|
if (props.mycol && props.mycol.name !== '') {
|
||||||
|
col.value = props.mycol
|
||||||
|
} else {
|
||||||
|
// console.log('Tab = ', props.table, 'key=', props.mykey, 'mycolProp', props.mycol)
|
||||||
|
col.value = fieldsTable.getColByTable(props.table, props.mykey)
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log('COL = ', col.value, 'MyCol passed', props.mycol)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(mounted)
|
||||||
|
|
||||||
|
return {
|
||||||
|
tools,
|
||||||
|
costanti,
|
||||||
|
fieldsTable,
|
||||||
|
globalStore,
|
||||||
|
col,
|
||||||
|
row,
|
||||||
|
showandsel,
|
||||||
|
withBorder,
|
||||||
|
save,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
78
src/components/CMyValueDb/CMyValueDb.vue
Executable file
78
src/components/CMyValueDb/CMyValueDb.vue
Executable file
@@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<div class="text-center">
|
||||||
|
<div class="row items-center justify-center q-gutter-xs q-ma-xs">
|
||||||
|
<div :class="` `" :style="withBorder() ? `` : ``">
|
||||||
|
<div v-if="title && type === costanti.FieldType.string" class="q-ma-xs">
|
||||||
|
<q-field
|
||||||
|
rounded
|
||||||
|
outlined
|
||||||
|
:bg-color="$q.dark.isActive ? '' : 'blue-4'"
|
||||||
|
dense
|
||||||
|
style="min-width: 110px"
|
||||||
|
>
|
||||||
|
<template v-slot:control>
|
||||||
|
<div class="centermydiv">
|
||||||
|
<div v-if="myimg" class="text-center">
|
||||||
|
<q-img
|
||||||
|
:src="myimg"
|
||||||
|
class="text-center"
|
||||||
|
style="height: 50px; width: 50px"
|
||||||
|
:alt="title"
|
||||||
|
>
|
||||||
|
</q-img>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="self-center full-width no-outline text-center"
|
||||||
|
tabindex="0"
|
||||||
|
>
|
||||||
|
{{ title }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</q-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<CMyPopupEdit
|
||||||
|
debounce="1000"
|
||||||
|
:fielddb="true"
|
||||||
|
v-bind="$attrs"
|
||||||
|
:rec="rec"
|
||||||
|
:isrec="!!rec"
|
||||||
|
:table="table"
|
||||||
|
:hint="title"
|
||||||
|
:title="title"
|
||||||
|
:field="mykey"
|
||||||
|
:filter="filter"
|
||||||
|
:subfield="mysubkey"
|
||||||
|
:specialField="specialField"
|
||||||
|
:mysubsubkey="mysubsubkey"
|
||||||
|
:indrec="indrec"
|
||||||
|
:type="type"
|
||||||
|
:serv="serv"
|
||||||
|
:disable="disable"
|
||||||
|
:jointable="jointable"
|
||||||
|
:myimg="myimg"
|
||||||
|
:canModify="canModify"
|
||||||
|
:canEdit="true"
|
||||||
|
:id="id"
|
||||||
|
:idmain="idmain"
|
||||||
|
:mycol="col ? col : {}"
|
||||||
|
:tablesel="tablesel"
|
||||||
|
:pickup="pickup"
|
||||||
|
v-model:row="row"
|
||||||
|
minuteinterval="1"
|
||||||
|
@showandsave="showandsel"
|
||||||
|
@save="save"
|
||||||
|
>
|
||||||
|
</CMyPopupEdit>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" src="./CMyValueDb.ts">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@import './CMyValueDb.scss';
|
||||||
|
</style>
|
||||||
1
src/components/CMyValueDb/index.ts
Executable file
1
src/components/CMyValueDb/index.ts
Executable file
@@ -0,0 +1 @@
|
|||||||
|
export {default as CMyValueDb} from './CMyValueDb.vue'
|
||||||
@@ -102,6 +102,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function load() {
|
function load() {
|
||||||
|
endload.value = false
|
||||||
recOrderCart.value = productStore.getOrdersCartById(props.idOrdersCart)
|
recOrderCart.value = productStore.getOrdersCartById(props.idOrdersCart)
|
||||||
if (recOrderCart.value) {
|
if (recOrderCart.value) {
|
||||||
oldrec.value = myrec.value
|
oldrec.value = myrec.value
|
||||||
@@ -181,6 +182,16 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateOrdersCart(paramstoupdate: any) {
|
||||||
|
productStore.updateOrdersCartById(props.idOrdersCart, paramstoupdate)
|
||||||
|
}
|
||||||
|
|
||||||
|
function ordersUpdated() {
|
||||||
|
console.log('ordersUpdated')
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onMounted(mounted)
|
onMounted(mounted)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -200,6 +211,8 @@ export default defineComponent({
|
|||||||
endload,
|
endload,
|
||||||
search,
|
search,
|
||||||
insertArticolo,
|
insertArticolo,
|
||||||
|
updateOrdersCart,
|
||||||
|
ordersUpdated,
|
||||||
t,
|
t,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
:idOrdersCart="recOrderCart._id"
|
:idOrdersCart="recOrderCart._id"
|
||||||
:editmode="tools.isManager()"
|
:editmode="tools.isManager()"
|
||||||
:nomodif="true"
|
:nomodif="true"
|
||||||
|
@update="ordersUpdated()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -126,4 +126,8 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-card__section--vert{
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { useQuasar } from 'quasar'
|
|||||||
import { CTitleBanner } from '../CTitleBanner'
|
import { CTitleBanner } from '../CTitleBanner'
|
||||||
import { CCardState } from '../CCardState'
|
import { CCardState } from '../CCardState'
|
||||||
import { CCopyBtn } from '../CCopyBtn'
|
import { CCopyBtn } from '../CCopyBtn'
|
||||||
|
import { CMyValueDb } from '../CMyValueDb'
|
||||||
|
|
||||||
import { func_tools, toolsext } from '@store/Modules/toolsext'
|
import { func_tools, toolsext } from '@store/Modules/toolsext'
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ import { useProducts } from '@store/Products'
|
|||||||
import { shared_consts } from '@src/common/shared_vuejs'
|
import { shared_consts } from '@src/common/shared_vuejs'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
import { costanti } from '@costanti'
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CProductCard',
|
name: 'CProductCard',
|
||||||
props: {
|
props: {
|
||||||
@@ -41,7 +43,7 @@ export default defineComponent({
|
|||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: { CTitleBanner, CCardState, CCopyBtn },
|
components: { CTitleBanner, CCardState, CCopyBtn, CMyValueDb },
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const $q = useQuasar()
|
const $q = useQuasar()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -51,6 +53,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
const listord = ref(<IOrderCart[]>[])
|
const listord = ref(<IOrderCart[]>[])
|
||||||
const sumval = ref(0)
|
const sumval = ref(0)
|
||||||
|
const editOn = ref(false)
|
||||||
|
|
||||||
const site = ref(globalStore.site)
|
const site = ref(globalStore.site)
|
||||||
|
|
||||||
@@ -93,6 +96,13 @@ export default defineComponent({
|
|||||||
return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
|
return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
watch(() => editOn.value, (to: any, from: any) => {
|
||||||
|
if (!editOn.value)
|
||||||
|
ricarica()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
/*const myproduct = computed((): IProduct => {
|
/*const myproduct = computed((): IProduct => {
|
||||||
console.log('getproduct computed')
|
console.log('getproduct computed')
|
||||||
const ris = products.getProduct(props.code)
|
const ris = products.getProduct(props.code)
|
||||||
@@ -180,6 +190,30 @@ export default defineComponent({
|
|||||||
// products.updateQuantityAvailable(myproduct.value._id)
|
// products.updateQuantityAvailable(myproduct.value._id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function ricarica() {
|
||||||
|
endload.value = false
|
||||||
|
const prod = await products.loadProductById(myproduct.value._id)
|
||||||
|
if (prod) {
|
||||||
|
myproduct.value = prod
|
||||||
|
}
|
||||||
|
load()
|
||||||
|
endload.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateproductmodif() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
myproduct.value = products.getProductById(props.id)
|
||||||
|
|
||||||
|
recgasordineSelected.value = myproduct.value.gasordines.find((rec: any) => rec._id === gasordineSelected.value)
|
||||||
|
|
||||||
|
updateLabel()
|
||||||
|
} catch (e) {
|
||||||
|
console.error('err', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getStorehouses() {
|
function getStorehouses() {
|
||||||
if (!myproduct.value)
|
if (!myproduct.value)
|
||||||
return []
|
return []
|
||||||
@@ -223,7 +257,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
function checkifCartDisable() {
|
function checkifCartDisable() {
|
||||||
// return !myorder.idStorehouse
|
// return !myorder.idStorehouse
|
||||||
return false
|
return isOrdineChiuso()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getQtyWarn() {
|
function getQtyWarn() {
|
||||||
@@ -288,6 +322,11 @@ export default defineComponent({
|
|||||||
timerLabelScadenza.value = ''
|
timerLabelScadenza.value = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isOrdineChiuso() {
|
||||||
|
return recgasordineSelected.value && recgasordineSelected.value.dataora_chiusura_ordini &&
|
||||||
|
tools.getCountDown(recgasordineSelected.value.dataora_chiusura_ordini) === ''
|
||||||
|
}
|
||||||
|
|
||||||
function startTimer() {
|
function startTimer() {
|
||||||
// Update the timer label every second
|
// Update the timer label every second
|
||||||
timerInterval.value = setInterval(() => updateTimerLabel(), 1000);
|
timerInterval.value = setInterval(() => updateTimerLabel(), 1000);
|
||||||
@@ -350,7 +389,7 @@ export default defineComponent({
|
|||||||
openlistorders.value = true
|
openlistorders.value = true
|
||||||
sumval.value = products.getSumQtyOrderProductInOrdersCart(myproduct.value._id)
|
sumval.value = products.getSumQtyOrderProductInOrdersCart(myproduct.value._id)
|
||||||
|
|
||||||
listord.value = arrordersCart.value.filter((ordercart: IOrderCart) => ordercart.items!.reduce((accumulator, item) => {
|
listord.value = arrordersCart.value.filter((orderscart: IOrderCart) => orderscart.items!.reduce((accumulator, item) => {
|
||||||
return accumulator + item.order.quantity
|
return accumulator + item.order.quantity
|
||||||
}, 0))
|
}, 0))
|
||||||
}
|
}
|
||||||
@@ -359,7 +398,7 @@ export default defineComponent({
|
|||||||
openlistorders.value = true
|
openlistorders.value = true
|
||||||
sumval.value = products.getSumQtyPreOrderInOrdersCart(myproduct.value._id)
|
sumval.value = products.getSumQtyPreOrderInOrdersCart(myproduct.value._id)
|
||||||
|
|
||||||
listord.value = arrordersCart.value.filter((ordercart: IOrderCart) => ordercart.items!.reduce((accumulator, item) => {
|
listord.value = arrordersCart.value.filter((orderscart: IOrderCart) => orderscart.items!.reduce((accumulator, item) => {
|
||||||
return accumulator + item.order.quantitypreordered
|
return accumulator + item.order.quantitypreordered
|
||||||
}, 0))
|
}, 0))
|
||||||
}
|
}
|
||||||
@@ -460,6 +499,13 @@ export default defineComponent({
|
|||||||
onTouchEnd,
|
onTouchEnd,
|
||||||
$router,
|
$router,
|
||||||
naviga,
|
naviga,
|
||||||
|
globalStore,
|
||||||
|
editOn,
|
||||||
|
costanti,
|
||||||
|
updateproduct,
|
||||||
|
updateproductmodif,
|
||||||
|
isOrdineChiuso,
|
||||||
|
ricarica,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -87,9 +87,19 @@
|
|||||||
class="text-black q-ml-xs text-h8"
|
class="text-black q-ml-xs text-h8"
|
||||||
v-if="myproduct.productInfo.unit"
|
v-if="myproduct.productInfo.unit"
|
||||||
>
|
>
|
||||||
{{ tools.getWeightByUnit(myproduct.productInfo.unit, true, myproduct.productInfo.weight) }}
|
|
||||||
{{
|
{{
|
||||||
tools.getUnitsMeasure(myproduct.productInfo.unit, true, myproduct.productInfo.weight)
|
tools.getWeightByUnit(
|
||||||
|
myproduct.productInfo.unit,
|
||||||
|
true,
|
||||||
|
myproduct.productInfo.weight
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
{{
|
||||||
|
tools.getUnitsMeasure(
|
||||||
|
myproduct.productInfo.unit,
|
||||||
|
true,
|
||||||
|
myproduct.productInfo.weight
|
||||||
|
)
|
||||||
}}</span
|
}}</span
|
||||||
>
|
>
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
@@ -270,7 +280,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
||||||
<q-card-section v-if="myproduct.note">
|
<q-card-section v-if="myproduct.note" class="q-pa-none">
|
||||||
<q-item>
|
<q-item>
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-icon color="black" name="fas fa-book" />
|
<q-icon color="black" name="fas fa-book" />
|
||||||
@@ -429,13 +439,21 @@
|
|||||||
<span v-if="getpercqtaraggiunta() >= 1">{{
|
<span v-if="getpercqtaraggiunta() >= 1">{{
|
||||||
t('ecomm.offerta_gas_raggiunta', {
|
t('ecomm.offerta_gas_raggiunta', {
|
||||||
qta: myproduct.qtyToReachForGas,
|
qta: myproduct.qtyToReachForGas,
|
||||||
unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true, myproduct.productInfo.weight),
|
unit: tools.getUnitsMeasure(
|
||||||
|
myproduct.productInfo.unit,
|
||||||
|
true,
|
||||||
|
myproduct.productInfo.weight
|
||||||
|
),
|
||||||
})
|
})
|
||||||
}}</span>
|
}}</span>
|
||||||
<span v-else>{{
|
<span v-else>{{
|
||||||
t('ecomm.offerta_gas', {
|
t('ecomm.offerta_gas', {
|
||||||
qta: myproduct.qtyToReachForGas,
|
qta: myproduct.qtyToReachForGas,
|
||||||
unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true, myproduct.productInfo.weight),
|
unit: tools.getUnitsMeasure(
|
||||||
|
myproduct.productInfo.unit,
|
||||||
|
true,
|
||||||
|
myproduct.productInfo.weight
|
||||||
|
),
|
||||||
})
|
})
|
||||||
}}</span>
|
}}</span>
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
@@ -496,16 +514,35 @@
|
|||||||
<q-icon color="blue" name="fas fa-hourglass-half" />
|
<q-icon color="blue" name="fas fa-hourglass-half" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
|
||||||
<q-item-section>
|
<q-item-section v-if="!!recgasordineSelected.dataora_chiusura_ordini">
|
||||||
<q-item-label class="subtit_prod">
|
<q-item-label class="subtit_prod">
|
||||||
{{ t('gas.dataora_chiusura_ordini') }}
|
{{ t('gas.dataora_chiusura_ordini') }}
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
<q-item-label class="countdown_scadenza">
|
<q-item-label class="countdown_scadenza">
|
||||||
{{ timerLabelScadenza }}
|
<span v-if="timerLabelScadenza">{{ timerLabelScadenza }}</span>
|
||||||
|
<span v-else-if="isOrdineChiuso()">{{
|
||||||
|
t('ecomm.ordine_scaduto', {
|
||||||
|
date: tools.getstrshortDateTime(
|
||||||
|
recgasordineSelected.dataora_chiusura_ordini
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}}</span>
|
||||||
|
<CMyValueDb
|
||||||
|
v-if="editOn"
|
||||||
|
:title="t('gas.dataora_chiusura_ordini')"
|
||||||
|
table="gasordines"
|
||||||
|
:id="recgasordineSelected._id"
|
||||||
|
:rec="recgasordineSelected"
|
||||||
|
mykey="dataora_chiusura_ordini"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.date"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item v-if="labelDataArrivoMerce">
|
<q-item v-if="labelDataArrivoMerce || editOn">
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-icon color="red" name="fas fa-shipping-fast" />
|
<q-icon color="red" name="fas fa-shipping-fast" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
@@ -515,11 +552,25 @@
|
|||||||
{{ t('gas.data_arrivo_merce') }}
|
{{ t('gas.data_arrivo_merce') }}
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
<q-item-label class="countdown_scadenza">
|
<q-item-label class="countdown_scadenza">
|
||||||
{{ labelDataArrivoMerce }}
|
<CMyValueDb
|
||||||
|
v-if="editOn"
|
||||||
|
:title="t('gas.data_arrivo_merce')"
|
||||||
|
table="gasordines"
|
||||||
|
:id="recgasordineSelected._id"
|
||||||
|
:rec="recgasordineSelected"
|
||||||
|
mykey="data_arrivo_merce"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.date"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
<div v-else>
|
||||||
|
{{ labelDataArrivoMerce }}
|
||||||
|
</div>
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item v-if="labelDataRitiro">
|
<q-item v-if="labelDataRitiro || editOn">
|
||||||
<q-item-section avatar>
|
<q-item-section avatar>
|
||||||
<q-icon color="green" name="fas fa-people-carry" />
|
<q-icon color="green" name="fas fa-people-carry" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
@@ -529,7 +580,21 @@
|
|||||||
{{ t('gas.dataora_ritiro') }}
|
{{ t('gas.dataora_ritiro') }}
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
<q-item-label class="countdown_scadenza">
|
<q-item-label class="countdown_scadenza">
|
||||||
{{ labelDataRitiro }}
|
<CMyValueDb
|
||||||
|
v-if="editOn"
|
||||||
|
:title="t('gas.dataora_ritiro')"
|
||||||
|
table="gasordines"
|
||||||
|
:id="recgasordineSelected._id"
|
||||||
|
:rec="recgasordineSelected"
|
||||||
|
mykey="dataora_ritiro"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.date"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
<div v-else>
|
||||||
|
{{ labelDataRitiro }}
|
||||||
|
</div>
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
@@ -563,6 +628,122 @@
|
|||||||
<div class="no-outline label-qta text-center" tabindex="0">
|
<div class="no-outline label-qta text-center" tabindex="0">
|
||||||
{{ myorder.quantity + myorder.quantitypreordered }}
|
{{ myorder.quantity + myorder.quantitypreordered }}
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="editOn">
|
||||||
|
<CMyValueDb
|
||||||
|
:title="t('products.note')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="note"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.string"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
|
||||||
|
<div v-if="!isOrdGas()">
|
||||||
|
<CMyValueDb
|
||||||
|
:title="t('products.stockQty')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="stockQty"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.number"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
<CMyValueDb
|
||||||
|
:title="t('products.stockBloccatiQty')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="stockBloccatiQty"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.number"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
<CMyValueDb
|
||||||
|
:title="t('products.bookedQtyOrdered')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="bookedQtyOrdered"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.number"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
<CMyValueDb
|
||||||
|
:title="t('products.bookedQtyConfirmed')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="bookedQtyConfirmed"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.number"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
</div>
|
||||||
|
<q-separator> </q-separator>
|
||||||
|
<div v-if="isOrdGas()">
|
||||||
|
<CMyValueDb
|
||||||
|
:title="t('products.maxbookableGASQty')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="maxbookableGASQty"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.number"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
<CMyValueDb
|
||||||
|
:title="t('products.bookableGASBloccatiQty')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="bookableGASBloccatiQty"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.number"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
<CMyValueDb
|
||||||
|
:title="t('ecomm.bookedGASQtyOrdered')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="bookedGASQtyOrdered"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.number"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
<CMyValueDb
|
||||||
|
:title="t('products.bookedGASQtyConfirmed')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="bookedGASQtyConfirmed"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.number"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<q-btn
|
||||||
|
rounded
|
||||||
|
icon="fas fa-sync-alt"
|
||||||
|
color="primary"
|
||||||
|
:label="t('ecomm.ricarica')"
|
||||||
|
@click="ricarica()"
|
||||||
|
></q-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</q-field>
|
</q-field>
|
||||||
|
|
||||||
@@ -597,6 +778,26 @@
|
|||||||
></q-btn>
|
></q-btn>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
<q-toggle
|
||||||
|
v-if="tools.isManager()"
|
||||||
|
v-model="editOn"
|
||||||
|
color="green"
|
||||||
|
icon="fas fa-pencil-alt"
|
||||||
|
dense
|
||||||
|
>
|
||||||
|
</q-toggle>
|
||||||
|
<CMyValueDb
|
||||||
|
v-if="editOn"
|
||||||
|
:title="t('ecomm.active')"
|
||||||
|
table="products"
|
||||||
|
:id="myproduct._id"
|
||||||
|
:rec="myproduct"
|
||||||
|
mykey="active"
|
||||||
|
debounce="1000"
|
||||||
|
:save="updateproductmodif()"
|
||||||
|
:type="costanti.FieldType.boolean"
|
||||||
|
>
|
||||||
|
</CMyValueDb>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
<q-dialog v-model="openlistorders">
|
<q-dialog v-model="openlistorders">
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: { CTitleBanner, CCardState, CCopyBtn },
|
components: { CTitleBanner, CCardState, CCopyBtn },
|
||||||
setup(props) {
|
setup(props, { emit }) {
|
||||||
const products = useProducts()
|
const products = useProducts()
|
||||||
const order = toRef(props, 'order')
|
const order = toRef(props, 'order')
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -110,8 +110,9 @@ export default defineComponent({
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateOrder(val: any) {
|
async function updateOrder(paramstoupdate: any) {
|
||||||
|
await products.updateOrderByOrder(props.idOrdersCart, order.value._id, paramstoupdate)
|
||||||
|
emit('update')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRisparmio(): string {
|
function getRisparmio(): string {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
v-if="order.product.productInfo.unit"
|
v-if="order.product.productInfo.unit"
|
||||||
>
|
>
|
||||||
{{ tools.getWeightTotalByOrder(order) }}
|
{{ tools.getWeightTotalByOrder(order) }}
|
||||||
{{ tools.getUnitsMeasure(order.product.productInfo.unit, true) }}
|
{{ tools.getUnitsMeasure(order.product.productInfo.unit, true, order.product.productInfo.weight) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="row q-mb-xs no-wrap items-center centeritems">
|
<div class="row q-mb-xs no-wrap items-center centeritems">
|
||||||
<q-btn
|
<q-btn
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
borderless
|
borderless
|
||||||
rounded
|
rounded
|
||||||
dense
|
dense
|
||||||
:label="$t('products.quantity')"
|
:label="t('products.quantity')"
|
||||||
></q-input>
|
></q-input>
|
||||||
<q-input
|
<q-input
|
||||||
v-model="order.quantitypreordered"
|
v-model="order.quantitypreordered"
|
||||||
@@ -58,11 +58,22 @@
|
|||||||
borderless
|
borderless
|
||||||
rounded
|
rounded
|
||||||
dense
|
dense
|
||||||
@update:model-value="updateOrder"
|
:label="t('ecomm.preord')"
|
||||||
:label="$t('ecomm.preord')"
|
|
||||||
></q-input>
|
></q-input>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="showall" :class="`q-mx-sm text-blue-14 qta` ">
|
<div v-if="tools.isManager">
|
||||||
|
<q-btn
|
||||||
|
outline
|
||||||
|
rounded
|
||||||
|
dense
|
||||||
|
color="green"
|
||||||
|
icon="fas fa-redo"
|
||||||
|
:label="t('orderscart.update_order')"
|
||||||
|
@click="updateOrder({quantitypreordered: order.quantitypreordered, quantity: order.quantity})"
|
||||||
|
>
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="showall" :class="`q-mx-sm text-blue-14 qta`">
|
||||||
{{ order.quantity + order.quantitypreordered }}
|
{{ order.quantity + order.quantitypreordered }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -86,7 +97,7 @@
|
|||||||
<q-item-label>
|
<q-item-label>
|
||||||
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
|
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
|
||||||
<span class="prezzo_singolo">
|
<span class="prezzo_singolo">
|
||||||
{{ (order.quantity + order.quantitypreordered) }} x €
|
{{ order.quantity + order.quantitypreordered }} x €
|
||||||
{{ order.price ? order.price : 0 }}
|
{{ order.price ? order.price : 0 }}
|
||||||
</span>
|
</span>
|
||||||
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
|
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
|
||||||
@@ -103,8 +114,8 @@
|
|||||||
>€
|
>€
|
||||||
{{
|
{{
|
||||||
(
|
(
|
||||||
(order.price * order.quantity) +
|
order.price * order.quantity +
|
||||||
(order.price * order.quantitypreordered)
|
order.price * order.quantitypreordered
|
||||||
).toFixed(2)
|
).toFixed(2)
|
||||||
}}</span
|
}}</span
|
||||||
>)</span
|
>)</span
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ import MixinMetaTags from '@src/mixins/mixin-metatags'
|
|||||||
import { useUserStore } from '@store/UserStore'
|
import { useUserStore } from '@store/UserStore'
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
import { useQuasar } from 'quasar'
|
import { useQuasar } from 'quasar'
|
||||||
import { IDataPass, ISpecialField } from '@model'
|
import { IDataPass, IProducer, IProduct, ISpecialField } from '@model'
|
||||||
import { tools } from '../store/Modules/tools'
|
import { tools } from '../store/Modules/tools'
|
||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti'
|
||||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||||
|
|
||||||
|
import { useProducts } from '@store/Products'
|
||||||
|
|
||||||
// You can declare a mixin as the same style as components.
|
// You can declare a mixin as the same style as components.
|
||||||
export default function () {
|
export default function () {
|
||||||
function showNotif(msg: string) {
|
function showNotif(msg: string) {
|
||||||
@@ -183,6 +185,14 @@ export default function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (table === 'products') {
|
||||||
|
const productStore = useProducts()
|
||||||
|
const idprod = productStore.products.findIndex((rec: IProduct) => rec._id === id)
|
||||||
|
if (idprod >= 0 && key) {
|
||||||
|
productStore.products[idprod][key as keyof IProduct] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log('mydatatosave', mydatatosave)
|
console.log('mydatatosave', mydatatosave)
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ export interface IUserFields {
|
|||||||
numinvitati?: number
|
numinvitati?: number
|
||||||
numinvitatiattivi?: number
|
numinvitatiattivi?: number
|
||||||
cart?: ICart
|
cart?: ICart
|
||||||
ordercart?: IOrderCart
|
orderscart?: IOrderCart
|
||||||
calcstat?: ICalcStat|null
|
calcstat?: ICalcStat|null
|
||||||
|
|
||||||
account?: IAccount
|
account?: IAccount
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ const msg_it = {
|
|||||||
ricevo_dono_long: 'Evviva!!!<br><strong>QUESTO MOVIMENTO È REALE E POSSIBILE SE LO FACCIAMO FUNZIONARE TUTTI INSIEME !</strong>',
|
ricevo_dono_long: 'Evviva!!!<br><strong>QUESTO MOVIMENTO È REALE E POSSIBILE SE LO FACCIAMO FUNZIONARE TUTTI INSIEME !</strong>',
|
||||||
},
|
},
|
||||||
dialog: {
|
dialog: {
|
||||||
|
azzera: 'Azzera',
|
||||||
continue: 'Continuare',
|
continue: 'Continuare',
|
||||||
close: 'Chiudi',
|
close: 'Chiudi',
|
||||||
copyclipboard: 'Copiato negli appunti',
|
copyclipboard: 'Copiato negli appunti',
|
||||||
@@ -1713,6 +1714,8 @@ const msg_it = {
|
|||||||
offerta_gas_raggiunta: 'Complimenti! Gli ordini hanno superato il minimo quantitativo di {qta} {unit}',
|
offerta_gas_raggiunta: 'Complimenti! Gli ordini hanno superato il minimo quantitativo di {qta} {unit}',
|
||||||
note: 'Note',
|
note: 'Note',
|
||||||
apriordine: 'Vedi Ordine',
|
apriordine: 'Vedi Ordine',
|
||||||
|
ordine_scaduto: 'l\'Ordine è stato chiuso il {date}!',
|
||||||
|
ricarica: 'Ricarica',
|
||||||
},
|
},
|
||||||
gas: {
|
gas: {
|
||||||
name: 'Ordine Gas',
|
name: 'Ordine Gas',
|
||||||
@@ -1735,6 +1738,7 @@ const msg_it = {
|
|||||||
sendmail_test: 'Invia Email TEST',
|
sendmail_test: 'Invia Email TEST',
|
||||||
email_sent: '{inviate} email inviate !',
|
email_sent: '{inviate} email inviate !',
|
||||||
email_not_send: 'Email non inviata',
|
email_not_send: 'Email non inviata',
|
||||||
|
update_order: 'Aggiorna Ordine',
|
||||||
},
|
},
|
||||||
cash: {
|
cash: {
|
||||||
creatorUserId: 'Creatore',
|
creatorUserId: 'Creatore',
|
||||||
|
|||||||
@@ -8259,18 +8259,18 @@ export const tools = {
|
|||||||
let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
|
let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
|
||||||
let mystr = ''
|
let mystr = ''
|
||||||
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) {
|
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) {
|
||||||
unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.GRAMMI)
|
unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.GRAMMI)
|
||||||
}
|
}
|
||||||
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) {
|
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) {
|
||||||
unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.MILLILITRI)
|
unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.MILLILITRI)
|
||||||
}
|
}
|
||||||
mystr = unitrec ? (short ? unitrec.short : unitrec.label) : ''
|
mystr = unitrec ? (short ? unitrec.short : unitrec.label) : ''
|
||||||
return mystr
|
return mystr
|
||||||
},
|
},
|
||||||
|
|
||||||
getWeightByUnit(unit: number, short: boolean, weight: number|undefined) {
|
getWeightByUnit(unit: number, short: boolean, weight: number | undefined) {
|
||||||
let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
|
let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit)
|
||||||
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) {
|
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) {
|
||||||
return weight * 1000
|
return weight * 1000
|
||||||
}
|
}
|
||||||
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) {
|
if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) {
|
||||||
@@ -8323,18 +8323,22 @@ export const tools = {
|
|||||||
// Calculate the difference in milliseconds
|
// Calculate the difference in milliseconds
|
||||||
const countdown = targetTime - currentDate.getTime();
|
const countdown = targetTime - currentDate.getTime();
|
||||||
|
|
||||||
// Convert milliseconds to seconds
|
if (countdown > 0) {
|
||||||
const countdownInSeconds = Math.floor(countdown / 1000);
|
// Convert milliseconds to seconds
|
||||||
|
const countdownInSeconds = Math.floor(countdown / 1000);
|
||||||
|
|
||||||
const days = Math.floor(countdownInSeconds / (60 * 60 * 24));
|
const days = Math.floor(countdownInSeconds / (60 * 60 * 24));
|
||||||
const hours = Math.floor((countdownInSeconds % (60 * 60 * 24)) / (60 * 60));
|
const hours = Math.floor((countdownInSeconds % (60 * 60 * 24)) / (60 * 60));
|
||||||
const minutes = Math.floor((countdownInSeconds % (60 * 60)) / 60);
|
const minutes = Math.floor((countdownInSeconds % (60 * 60)) / 60);
|
||||||
const seconds = countdownInSeconds % 60;
|
const seconds = countdownInSeconds % 60;
|
||||||
|
|
||||||
const gg = days > 0 ? 'giorni' : ''
|
const gg = days > 0 ? 'giorni' : ''
|
||||||
const strgg = gg ? `${days} giorni` : ''
|
const strgg = gg ? `${days} giorni` : ''
|
||||||
|
|
||||||
return (`${strgg} ${this.pad(hours)}:${this.pad(minutes)}:${this.pad(seconds)}`);
|
return (`${strgg} ${this.pad(hours)}:${this.pad(minutes)}:${this.pad(seconds)}`);
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -303,8 +303,8 @@ export const useProducts = defineStore('Products', {
|
|||||||
getOrdersCartByIdProduct: (state: IProductsState) => (idproduct: string): IOrderCart[] | [] => {
|
getOrdersCartByIdProduct: (state: IProductsState) => (idproduct: string): IOrderCart[] | [] => {
|
||||||
try {
|
try {
|
||||||
if (state.orders) {
|
if (state.orders) {
|
||||||
const ris = state.orders.filter((ordercart: IOrderCart) => {
|
const ris = state.orders.filter((orderscart: IOrderCart) => {
|
||||||
return ordercart.items!.some(item => {
|
return orderscart.items!.some(item => {
|
||||||
if (item.order)
|
if (item.order)
|
||||||
return (item.order.idProduct === idproduct)
|
return (item.order.idProduct === idproduct)
|
||||||
&& (item.order.status! < shared_consts.OrderStatus.CHECKOUT_SENT)
|
&& (item.order.status! < shared_consts.OrderStatus.CHECKOUT_SENT)
|
||||||
@@ -322,8 +322,8 @@ export const useProducts = defineStore('Products', {
|
|||||||
getOrdersCartInAttesaByIdProduct: (state: IProductsState) => (idproduct: string): IOrderCart[] | [] => {
|
getOrdersCartInAttesaByIdProduct: (state: IProductsState) => (idproduct: string): IOrderCart[] | [] => {
|
||||||
try {
|
try {
|
||||||
if (state.orders) {
|
if (state.orders) {
|
||||||
const ris = state.orders.filter((ordercart: IOrderCart) => {
|
const ris = state.orders.filter((orderscart: IOrderCart) => {
|
||||||
return ordercart.items!.some(item => {
|
return orderscart.items!.some(item => {
|
||||||
if (item.order)
|
if (item.order)
|
||||||
return (item.order.idProduct === idproduct)
|
return (item.order.idProduct === idproduct)
|
||||||
&& (item.order.status! <= shared_consts.OrderStatus.CHECKOUT_SENT)
|
&& (item.order.status! <= shared_consts.OrderStatus.CHECKOUT_SENT)
|
||||||
@@ -435,24 +435,100 @@ export const useProducts = defineStore('Products', {
|
|||||||
return ris
|
return ris
|
||||||
},
|
},
|
||||||
|
|
||||||
async loadProduct({ code }: { code: any }) {
|
async updateOrderByOrder(idOrdersCart: string, idOrder: string, paramstoupdate: any) {
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const globalStore = useGlobalStore()
|
||||||
|
|
||||||
|
// console.log('loadProducts')
|
||||||
|
|
||||||
|
if (!globalStore.site.confpages.enableEcommerce)
|
||||||
|
return null
|
||||||
|
|
||||||
|
console.log('updateOrderByOrder', 'userid=', userStore.my._id)
|
||||||
|
|
||||||
|
let ris = null
|
||||||
|
|
||||||
|
ris = await Api.SendReq('/orders/updateord', 'POST', { idOrdersCart, idOrder, paramstoupdate })
|
||||||
|
.then((res) => {
|
||||||
|
let myorderscart = res.data.orderscart
|
||||||
|
if (res) {
|
||||||
|
myorderscart = res.data && res.data.orderscart ? res.data.orderscart : null
|
||||||
|
if (myorderscart) {
|
||||||
|
const idord = this.orders.findIndex((ord: IOrderCart) => ord._id === myorderscart._id)
|
||||||
|
if (idord >= 0) {
|
||||||
|
console.log('aggiorna ordine')
|
||||||
|
this.orders[idord] = {...myorderscart}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return myorderscart
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log('error updateOrderByOrder', error)
|
||||||
|
userStore.setErrorCatch(error)
|
||||||
|
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, toolsext.ERR_GENERICO, error)
|
||||||
|
})
|
||||||
|
|
||||||
|
// ApiTables.aftercalling(ris, checkPending, 'categories')
|
||||||
|
|
||||||
|
return ris
|
||||||
|
},
|
||||||
|
|
||||||
|
async updateOrdersCartById(idOrdersCart: string, paramstoupdate: any) {
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const globalStore = useGlobalStore()
|
||||||
|
|
||||||
|
// console.log('loadProducts')
|
||||||
|
|
||||||
|
if (!globalStore.site.confpages.enableEcommerce)
|
||||||
|
return null
|
||||||
|
|
||||||
|
console.log('updateOrdersCartById', 'userid=', userStore.my._id)
|
||||||
|
|
||||||
|
let ris = null
|
||||||
|
|
||||||
|
ris = await Api.SendReq('/orders/update', 'POST', { idOrdersCart, paramstoupdate })
|
||||||
|
.then((res) => {
|
||||||
|
let myorderscart = res.data.orderscart
|
||||||
|
if (res) {
|
||||||
|
if (myorderscart) {
|
||||||
|
const idord = this.orders.findIndex((ord: IOrderCart) => ord._id === myorderscart._id)
|
||||||
|
if (idord >= 0) {
|
||||||
|
console.log('aggiorna orderscart')
|
||||||
|
this.orders[idord] = myorderscart
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return myorderscart
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log('error updateOrderByOrder', error)
|
||||||
|
userStore.setErrorCatch(error)
|
||||||
|
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, toolsext.ERR_GENERICO, error)
|
||||||
|
})
|
||||||
|
|
||||||
|
// ApiTables.aftercalling(ris, checkPending, 'categories')
|
||||||
|
|
||||||
|
return ris
|
||||||
|
},
|
||||||
|
|
||||||
|
async loadProductById(id: string) {
|
||||||
|
|
||||||
console.log('loadProduct', code)
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
|
|
||||||
if (!globalStore.site.confpages.enableEcommerce)
|
if (!globalStore.site.confpages.enableEcommerce)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
console.log('getProduct', 'code', code)
|
|
||||||
|
|
||||||
// if (userStore.my._id === '') {
|
// if (userStore.my._id === '') {
|
||||||
// return new Types.AxiosError(0, null, 0, '')
|
// return new Types.AxiosError(0, null, 0, '')
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let ris = null
|
let ris = null
|
||||||
|
|
||||||
ris = await Api.SendReq('/products/' + code, 'POST', { code })
|
ris = await Api.SendReq('/products/id/' + id, 'GET', null)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log('product', res.data.product)
|
console.log('product', res.data.product)
|
||||||
if (res.data.product) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
|
if (res.data.product) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
|
||||||
|
|||||||
@@ -221,8 +221,8 @@ export default defineComponent({
|
|||||||
function updateorders() {
|
function updateorders() {
|
||||||
myorderscart.value = getOrdersCart()
|
myorderscart.value = getOrdersCart()
|
||||||
if (myorderscart.value) {
|
if (myorderscart.value) {
|
||||||
for (const ordercart of myorderscart.value) {
|
for (const orderscart of myorderscart.value) {
|
||||||
myarrrec.value[ordercart._id] = Object.keys(ordercart)
|
myarrrec.value[orderscart._id] = Object.keys(orderscart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -300,14 +300,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<div v-for="(ordercart, index) in getOrdersCart" :key="index">
|
<div v-for="(orderscart, index) in getOrdersCart" :key="index">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{{ ordercart.numorder }}<br>
|
{{ orderscart.numorder }}<br>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="q-pa-sm col items-start q-gutter-xs" v-for="(itemorder, index) in ordercart.items" :key="index">
|
<div class="q-pa-sm col items-start q-gutter-xs" v-for="(itemorder, index) in orderscart.items" :key="index">
|
||||||
|
|
||||||
<CSingleCart :order="itemorder.order" :showall="true" :nomodif="true"/>
|
<CSingleCart :order="itemorder.order" :showall="true" :nomodif="true"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -315,14 +315,14 @@
|
|||||||
<q-separator></q-separator>
|
<q-separator></q-separator>
|
||||||
<div class="col-6 q-mr-sm" style="text-align: right">
|
<div class="col-6 q-mr-sm" style="text-align: right">
|
||||||
<span class="text-grey q-mr-xs">Totale:</span> <span
|
<span class="text-grey q-mr-xs">Totale:</span> <span
|
||||||
class="text-subtitle1 q-mr-sm ">€ {{ ordercart.totalPrice.toFixed(2) }}</span>
|
class="text-subtitle1 q-mr-sm ">€ {{ orderscart.totalPrice.toFixed(2) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-input v-model="ordercart.note" style="max-width: 400px;" label="Note aggiuntive:"
|
<q-input v-model="orderscart.note" style="max-width: 400px;" label="Note aggiuntive:"
|
||||||
filled dense
|
filled dense
|
||||||
debounce="1000"
|
debounce="1000"
|
||||||
autogrow
|
autogrow
|
||||||
@input="change_field(ordercart.id, 'note')">
|
@input="change_field(orderscart.id, 'note')">
|
||||||
</q-input>
|
</q-input>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
Reference in New Issue
Block a user