email da inviare ai clienti ...
This commit is contained in:
8
src/components/CCart/CCart.scss
Executable file
8
src/components/CCart/CCart.scss
Executable file
@@ -0,0 +1,8 @@
|
||||
$heightBtn: 100%;
|
||||
|
||||
.card .product-image {
|
||||
height: 300px;
|
||||
}
|
||||
.insert{
|
||||
cursor:pointer;
|
||||
}
|
||||
267
src/components/CCart/CCart.ts
Executable file
267
src/components/CCart/CCart.ts
Executable file
@@ -0,0 +1,267 @@
|
||||
import { defineComponent, onMounted, ref, computed } from 'vue'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useProducts } from '@store/Products'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { costanti } from '@costanti'
|
||||
import { ICart, IOrder, IOrderCart, IProduct, IShareWithUs } from '@src/model/Products'
|
||||
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
|
||||
import { CSingleCart } from '../CSingleCart'
|
||||
import { CTitleBanner } from '@components'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CCart',
|
||||
props: {
|
||||
iscash: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
idOrdersCart: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
|
||||
},
|
||||
components: { CSingleCart, CTitleBanner },
|
||||
setup(props) {
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const productStore = useProducts()
|
||||
const $router = useRouter()
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n();
|
||||
|
||||
const mycart = ref(<ICart>{})
|
||||
const myrec = ref(<any[string]>[])
|
||||
const oldrec = ref(<any[string]>[])
|
||||
const note = ref('')
|
||||
const endload = ref(false)
|
||||
const recOrderCart = ref(<IOrderCart>{})
|
||||
|
||||
const search = ref('')
|
||||
|
||||
const statusnow = computed(() => (): number => {
|
||||
if (recOrderCart.value) {
|
||||
return recOrderCart.value.status
|
||||
}
|
||||
return 0
|
||||
})
|
||||
|
||||
function mounted() {
|
||||
// Inizializza
|
||||
load()
|
||||
}
|
||||
|
||||
function getOrdersCart() {
|
||||
if (props.iscash) {
|
||||
return productStore.getOrdersCartById(props.idOrdersCart)
|
||||
} else {
|
||||
return productStore.getCart()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getItemsCart() {
|
||||
const cart = getOrdersCart()
|
||||
return cart.items || null
|
||||
}
|
||||
|
||||
function getNumItems(): number {
|
||||
const cart = getOrdersCart()
|
||||
if (!!cart.items)
|
||||
return cart.items.length || 0
|
||||
else
|
||||
return 0
|
||||
}
|
||||
|
||||
function getCart(): ICart {
|
||||
return getOrdersCart()
|
||||
}
|
||||
|
||||
function getNote() {
|
||||
const cart = getOrdersCart()
|
||||
return cart.note
|
||||
}
|
||||
|
||||
function change_field(fieldname: string) {
|
||||
if (myrec.value[fieldname] !== oldrec.value[fieldname]) {
|
||||
myrec.value[fieldname] = oldrec.value[fieldname]
|
||||
|
||||
const mydata = {
|
||||
[fieldname]: myrec.value[fieldname]
|
||||
}
|
||||
|
||||
const aggiorna = fieldname !== 'status'
|
||||
tools.saveFieldToServer($q, 'carts', mycart.value._id, mydata, aggiorna)
|
||||
oldrec.value[fieldname] = myrec.value[fieldname]
|
||||
}
|
||||
}
|
||||
|
||||
function myTotalPrice(): string {
|
||||
if (productStore.cart && productStore.cart.totalPrice) {
|
||||
return productStore.cart.totalPrice.toFixed(2)
|
||||
} else {
|
||||
return '0'
|
||||
}
|
||||
}
|
||||
|
||||
function myTotalQty(): number {
|
||||
if (productStore.cart) {
|
||||
return productStore.cart.totalQty!
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
async function load() {
|
||||
mycart.value = getCart()
|
||||
myrec.value = Object.keys(mycart)
|
||||
oldrec.value = myrec.value
|
||||
note.value = mycart.value.note!
|
||||
|
||||
let options = {};
|
||||
|
||||
if (mycart.value) {
|
||||
recOrderCart.value = await productStore.CreateOrdersCart({ cart_id: mycart.value._id, status: 0, note: note.value })
|
||||
}
|
||||
|
||||
console.log('myrec', myrec.value)
|
||||
|
||||
endload.value = true
|
||||
}
|
||||
|
||||
function CanBeShipped() {
|
||||
return productStore.cart.items ? productStore.cart.items.filter((rec: any) => rec.order.product.canBeShipped).length : false
|
||||
}
|
||||
|
||||
function CanBeBuyOnline() {
|
||||
return productStore.cart.items ? productStore.cart.items.filter((rec: any) => rec.order.product.canBeBuyOnline).length : false
|
||||
}
|
||||
|
||||
function getnumsteps() {
|
||||
let numsteps = 1
|
||||
|
||||
if (CanBeShipped())
|
||||
numsteps++
|
||||
if (CanBeBuyOnline())
|
||||
numsteps++
|
||||
|
||||
return numsteps
|
||||
}
|
||||
|
||||
function docheckout() {
|
||||
|
||||
// Può essere spedito?
|
||||
|
||||
if (CanBeShipped()) {
|
||||
// mostra form di spedizione
|
||||
}
|
||||
|
||||
if (CanBeBuyOnline()) {
|
||||
// mostra form di acquisto Online
|
||||
}
|
||||
}
|
||||
|
||||
function completeOrder() {
|
||||
$q.dialog({
|
||||
message: t('ecomm.conferma_acq', { qty: myTotalQty() }),
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
cancel: {
|
||||
label: t('dialog.cancel')
|
||||
},
|
||||
title: t('ecomm.order')
|
||||
}).onOk(async () => {
|
||||
const status = shared_consts.OrderStatus.CHECKOUT_SENT
|
||||
|
||||
recOrderCart.value = await productStore.CreateOrdersCart({ cart_id: mycart.value._id, status, note: note.value })
|
||||
|
||||
// statusnow.value = myordercart ? myordercart.status : 0
|
||||
|
||||
if (recOrderCart.value.status === status) {
|
||||
tools.showPositiveNotif($q, t('ecomm.ord_confirmed'))
|
||||
setTimeout(() => {
|
||||
$router.push('/orderinfo')
|
||||
}, 2000)
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('ecomm.ord_not_confirmed'))
|
||||
}
|
||||
// change_field('status')
|
||||
// change_field('status')
|
||||
})
|
||||
}
|
||||
|
||||
function getActualIdStorehouse(myprod: IProduct) {
|
||||
// Ottieni il negozio attualmente selezionato:
|
||||
// Se ce n'è solo 1 allora prendi quello !
|
||||
if (myprod.storehouses.length === 1) {
|
||||
return myprod.storehouses[0]._id
|
||||
} else {
|
||||
// Ottieni il negozio attualmente scelto !
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
function getActualGasordine(myprod: IProduct) {
|
||||
// Ottieni il negozio attualmente selezionato:
|
||||
// Se ce n'è solo 1 allora prendi quello !
|
||||
if (myprod.gasordines.length === 1) {
|
||||
return myprod.gasordines[0]._id
|
||||
} else {
|
||||
// Ottieni il gasordine attualmente scelto !
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
async function insertArticolo() {
|
||||
let lowerSearchText = search.value.trim();
|
||||
|
||||
const myprod = productStore.getProductByCode(lowerSearchText);
|
||||
if (myprod && myprod.active) {
|
||||
let myorder: IOrder = {
|
||||
quantity: 1, quantitypreordered: 0,
|
||||
TotalPriceProduct: 0, price: 0,
|
||||
idStorehouse: getActualIdStorehouse(myprod),
|
||||
idGasordine: getActualGasordine(myprod),
|
||||
}
|
||||
await productStore.addtoCartBase({ $q, t, id: myprod._id, order: myorder, addqty: true })
|
||||
search.value = ''
|
||||
load()
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
userStore,
|
||||
costanti,
|
||||
tools,
|
||||
toolsext,
|
||||
completeOrder,
|
||||
getNumItems,
|
||||
myTotalPrice,
|
||||
getItemsCart,
|
||||
getNote,
|
||||
change_field,
|
||||
note,
|
||||
statusnow,
|
||||
shared_consts,
|
||||
myTotalQty,
|
||||
recOrderCart,
|
||||
mycart,
|
||||
endload,
|
||||
search,
|
||||
insertArticolo,
|
||||
}
|
||||
}
|
||||
})
|
||||
52
src/components/CCart/CCart.vue
Executable file
52
src/components/CCart/CCart.vue
Executable file
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" />
|
||||
<div v-if="endload">
|
||||
<div v-if="recOrderCart" class="panel">
|
||||
<div>
|
||||
<div class="container">
|
||||
<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" />
|
||||
</div>
|
||||
</div>
|
||||
<q-separator></q-separator>
|
||||
<div class="col-6 q-mr-sm" style="text-align: right">
|
||||
<span class="text-grey q-mr-xs">{{ $t('ecomm.totale') }}:</span>
|
||||
<span class="text-subtitle1 q-mr-sm">€ {{ myTotalPrice() }}</span>
|
||||
</div>
|
||||
|
||||
<q-input v-if="getNumItems() > 0" v-model="note" style="max-width: 400px" :label="$t('ecomm.note')" filled dense
|
||||
debounce="1000" autogrow @input="change_field('note')">
|
||||
</q-input>
|
||||
|
||||
<br />
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<q-btn v-if="recOrderCart &&
|
||||
recOrderCart.status < shared_consts.OrderStatus.CHECKOUT_SENT
|
||||
" rounded icon="fas fa-shopping-cart" color="green" :label="$t('ecomm.completa_ord')" class="q-mb-sm"
|
||||
:disabled="myTotalQty() < 1" @click="completeOrder()"></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else style="text-align: center" class="text-grey">
|
||||
{{ $t('ecomm.carrello_vuoto') }}
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="q-gutter-y-md column text-center q-mx-auto" style="width: 350px; max-width: 100%">
|
||||
<q-input filled stack-label dense :label="$t('ecomm.code_add_to_cart')" v-model="search" class="q-ml-md"
|
||||
@keyup.enter="insertArticolo()">
|
||||
<template v-slot:append>
|
||||
<q-icon class="insert" name="fas fa-shopping-cart" color="green" @click="insertArticolo()" />
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CCart.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CCart';
|
||||
</style>
|
||||
1
src/components/CCart/index.ts
Executable file
1
src/components/CCart/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CCart} from './CCart.vue'
|
||||
12
src/components/COrdersCart/COrdersCart.scss
Executable file
12
src/components/COrdersCart/COrdersCart.scss
Executable file
@@ -0,0 +1,12 @@
|
||||
$heightBtn: 100%;
|
||||
|
||||
.card .product-image {
|
||||
height: 300px;
|
||||
}
|
||||
.insert{
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.numorder{
|
||||
font-weight: bold;
|
||||
}
|
||||
206
src/components/COrdersCart/COrdersCart.ts
Executable file
206
src/components/COrdersCart/COrdersCart.ts
Executable file
@@ -0,0 +1,206 @@
|
||||
import { defineComponent, onMounted, ref, computed } from 'vue'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useProducts } from '@store/Products'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { costanti } from '@costanti'
|
||||
import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IShareWithUs } from '@src/model/Products'
|
||||
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
|
||||
import { CSingleCart } from '../CSingleCart'
|
||||
import { CTitleBanner } from '@components'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'COrdersCart',
|
||||
props: {
|
||||
iscash: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
idOrdersCart: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
|
||||
},
|
||||
components: { CSingleCart, CTitleBanner },
|
||||
setup(props) {
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const productStore = useProducts()
|
||||
const $router = useRouter()
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n();
|
||||
|
||||
const myrec = ref(<any[string]>[])
|
||||
const oldrec = ref(<any[string]>[])
|
||||
const note = ref('')
|
||||
const endload = ref(false)
|
||||
const recOrderCart = ref(<IOrderCart>{})
|
||||
|
||||
const search = ref('')
|
||||
|
||||
const statusnow = computed(() => (): number => {
|
||||
if (recOrderCart.value) {
|
||||
return recOrderCart.value.status
|
||||
}
|
||||
return 0
|
||||
})
|
||||
|
||||
function mounted() {
|
||||
// Inizializza
|
||||
load()
|
||||
}
|
||||
|
||||
function getItems(): IBaseOrder[] | [] {
|
||||
return recOrderCart.value.items ?? []
|
||||
}
|
||||
|
||||
function getNumItems(): number {
|
||||
const itemsord = getItems()
|
||||
if (itemsord)
|
||||
return itemsord.length || 0
|
||||
else
|
||||
return 0
|
||||
}
|
||||
|
||||
function change_field(fieldname: string) {
|
||||
if (myrec.value[fieldname] !== oldrec.value[fieldname]) {
|
||||
myrec.value[fieldname] = oldrec.value[fieldname]
|
||||
|
||||
const mydata = {
|
||||
[fieldname]: myrec.value[fieldname]
|
||||
}
|
||||
|
||||
const aggiorna = false
|
||||
tools.saveFieldToServer($q, 'orderscarts', recOrderCart.value._id, mydata, aggiorna)
|
||||
oldrec.value[fieldname] = myrec.value[fieldname]
|
||||
}
|
||||
}
|
||||
|
||||
function myTotalPrice(): string {
|
||||
if (recOrderCart.value) {
|
||||
return recOrderCart.value.totalPrice.toFixed(2)
|
||||
} else {
|
||||
return '0'
|
||||
}
|
||||
}
|
||||
|
||||
function myTotalQty(): number {
|
||||
if (recOrderCart.value) {
|
||||
return recOrderCart.value.totalQty
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
function load() {
|
||||
recOrderCart.value = productStore.getOrdersCartById(props.idOrdersCart)
|
||||
if (recOrderCart.value) {
|
||||
oldrec.value = myrec.value
|
||||
note.value = recOrderCart.value.note!
|
||||
}
|
||||
endload.value = true
|
||||
}
|
||||
|
||||
function CanBeShipped() {
|
||||
return recOrderCart.value.items ? recOrderCart.value.items.filter((rec: any) => rec.order.product.canBeShipped).length : false
|
||||
}
|
||||
|
||||
function CanBeBuyOnline() {
|
||||
return recOrderCart.value.items ? recOrderCart.value.items.filter((rec: any) => rec.order.product.canBeBuyOnline).length : false
|
||||
}
|
||||
|
||||
function getnumsteps() {
|
||||
let numsteps = 1
|
||||
|
||||
if (CanBeShipped())
|
||||
numsteps++
|
||||
if (CanBeBuyOnline())
|
||||
numsteps++
|
||||
|
||||
return numsteps
|
||||
}
|
||||
|
||||
function docheckout() {
|
||||
|
||||
// Può essere spedito?
|
||||
|
||||
if (CanBeShipped()) {
|
||||
// mostra form di spedizione
|
||||
}
|
||||
|
||||
if (CanBeBuyOnline()) {
|
||||
// mostra form di acquisto Online
|
||||
}
|
||||
}
|
||||
|
||||
function getActualIdStorehouse(myprod: IProduct) {
|
||||
// Ottieni il negozio attualmente selezionato:
|
||||
// Se ce n'è solo 1 allora prendi quello !
|
||||
if (myprod.storehouses.length === 1) {
|
||||
return myprod.storehouses[0]._id
|
||||
} else {
|
||||
// Ottieni il negozio attualmente scelto !
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
function getActualGasordine(myprod: IProduct) {
|
||||
// Ottieni il negozio attualmente selezionato:
|
||||
// Se ce n'è solo 1 allora prendi quello !
|
||||
if (myprod.gasordines.length === 1) {
|
||||
return myprod.gasordines[0]._id
|
||||
} else {
|
||||
// Ottieni il gasordine attualmente scelto !
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
async function insertArticolo() {
|
||||
let lowerSearchText = search.value.trim();
|
||||
|
||||
const myprod = productStore.getProductByCode(lowerSearchText);
|
||||
if (myprod && myprod.active) {
|
||||
let myorder: IOrder = {
|
||||
quantity: 1, quantitypreordered: 0,
|
||||
TotalPriceProduct: 0, price: 0,
|
||||
idStorehouse: getActualIdStorehouse(myprod),
|
||||
idGasordine: getActualGasordine(myprod),
|
||||
}
|
||||
await productStore.addtoCartBase({ $q, t, id: myprod._id, order: myorder, addqty: true })
|
||||
search.value = ''
|
||||
load()
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
userStore,
|
||||
costanti,
|
||||
tools,
|
||||
toolsext,
|
||||
getNumItems,
|
||||
myTotalPrice,
|
||||
getItems,
|
||||
change_field,
|
||||
note,
|
||||
statusnow,
|
||||
shared_consts,
|
||||
myTotalQty,
|
||||
recOrderCart,
|
||||
endload,
|
||||
search,
|
||||
insertArticolo,
|
||||
t,
|
||||
}
|
||||
}
|
||||
})
|
||||
93
src/components/COrdersCart/COrdersCart.vue
Executable file
93
src/components/COrdersCart/COrdersCart.vue
Executable file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" />
|
||||
<div v-if="endload && recOrderCart.numorder > 0">
|
||||
<div v-if="recOrderCart" class="panel">
|
||||
<div class="numorder">
|
||||
{{ t('orderscart.numero_ordine') }}: {{ recOrderCart.numorder }}
|
||||
</div>
|
||||
<div class="user">
|
||||
{{ t('orderscart.nome') }}:
|
||||
{{
|
||||
recOrderCart.user
|
||||
? tools.getNomeUtenteByRecUser(recOrderCart.user)
|
||||
: ''
|
||||
}}
|
||||
</div>
|
||||
<div
|
||||
v-if="recOrderCart.items && recOrderCart.items.length > 0"
|
||||
class="container"
|
||||
>
|
||||
<div
|
||||
class="q-pa-sm col items-start q-gutter-xs"
|
||||
v-for="(itemorder, index) in recOrderCart.items"
|
||||
:key="index"
|
||||
>
|
||||
<CSingleCart
|
||||
:order="itemorder.order"
|
||||
:showall="false"
|
||||
:idOrdersCart="recOrderCart._id"
|
||||
:editmode="tools.isManager()"
|
||||
:nomodif="true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator></q-separator>
|
||||
<div class="col-6 q-mr-sm" style="text-align: right">
|
||||
<span class="text-grey q-mr-xs">{{ t('ecomm.totale') }}:</span>
|
||||
<span class="text-subtitle1 q-mr-sm">€ {{ myTotalPrice() }}</span>
|
||||
</div>
|
||||
|
||||
<q-input
|
||||
v-if="tools.isManager() && getNumItems() > 0"
|
||||
v-model="note"
|
||||
style="max-width: 400px"
|
||||
:label="t('ecomm.note')"
|
||||
filled
|
||||
dense
|
||||
debounce="1000"
|
||||
autogrow
|
||||
@input="change_field('note')"
|
||||
>
|
||||
</q-input>
|
||||
<q-label v-else> Note: {{ note }} </q-label>
|
||||
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
<div v-else style="text-align: center" class="text-grey">
|
||||
{{ t('ecomm.carrello_vuoto') }}
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div
|
||||
v-if="tools.isManager()"
|
||||
class="q-gutter-y-md column text-center q-mx-auto"
|
||||
style="width: 350px; max-width: 100%"
|
||||
>
|
||||
<q-input
|
||||
filled
|
||||
stack-label
|
||||
dense
|
||||
:label="t('ecomm.code_add_to_cart')"
|
||||
v-model="search"
|
||||
class="q-ml-md"
|
||||
@keyup.enter="insertArticolo()"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon
|
||||
class="insert"
|
||||
name="fas fa-shopping-cart"
|
||||
color="green"
|
||||
@click="insertArticolo()"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./COrdersCart.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './COrdersCart';
|
||||
</style>
|
||||
1
src/components/COrdersCart/index.ts
Executable file
1
src/components/COrdersCart/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as COrdersCart} from './COrdersCart.vue'
|
||||
@@ -9,7 +9,6 @@ import { useProducts } from '@store/Products'
|
||||
import { useI18n } from '@src/boot/i18n'
|
||||
import { useQuasar } from 'quasar'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CSingleCart',
|
||||
props: {
|
||||
@@ -17,11 +16,21 @@ export default defineComponent({
|
||||
type: Object as PropType<IOrder>,
|
||||
required: true,
|
||||
},
|
||||
editmode: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
showall: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
idOrdersCart: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
nomodif: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
@@ -93,7 +102,12 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function removeFromCard() {
|
||||
products.removeFromCart({ order: order.value })
|
||||
if (props.idOrdersCart) {
|
||||
//
|
||||
} else {
|
||||
products.removeFromCart({ order: order.value })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getRisparmio(): string {
|
||||
|
||||
@@ -41,7 +41,27 @@
|
||||
})
|
||||
"
|
||||
></q-btn>
|
||||
<div v-if="showall" :class="`q-mx-sm text-blue-14 qta` ">
|
||||
<div v-if="editmode">
|
||||
<q-input
|
||||
v-model="order.quantity"
|
||||
autofocus
|
||||
debounce="500"
|
||||
borderless
|
||||
rounded
|
||||
dense
|
||||
:label="$t('products.quantity')"
|
||||
></q-input>
|
||||
<q-input
|
||||
v-model="order.quantitypreordered"
|
||||
autofocus
|
||||
debounce="500"
|
||||
borderless
|
||||
rounded
|
||||
dense
|
||||
:label="$t('ecomm.preord')"
|
||||
></q-input>
|
||||
</div>
|
||||
<div v-else-if="showall" :class="`q-mx-sm text-blue-14 qta` ">
|
||||
{{ order.quantity + order.quantitypreordered }}
|
||||
</div>
|
||||
|
||||
@@ -99,7 +119,7 @@
|
||||
<q-item-label>
|
||||
<div class="col-1">
|
||||
<q-btn
|
||||
v-if="!nomodif"
|
||||
v-if="!nomodif && editmode"
|
||||
icon="fas fa-trash"
|
||||
color="negative"
|
||||
round
|
||||
|
||||
Reference in New Issue
Block a user