Files
myprojplanet_vite/src/components/CSingleCart/CSingleCart.vue

195 lines
6.4 KiB
Vue
Raw Normal View History

2021-09-04 15:05:34 +02:00
<template>
2024-02-06 20:13:06 +01:00
<div v-if="order && order.product && order.product.productInfo" class="q-pa-xs q-gutter-xs">
<div v-if="order.product">
<q-item>
<q-item-section top thumbnail class="q-ml-none">
<img
2024-02-06 20:13:06 +01:00
v-if="order.product && order.product.productInfo && order.product.productInfo.img"
:src="`` + order.product.productInfo.img"
:alt="order.product.productInfo.name"
:class="myimgclass()"
/>
</q-item-section>
<q-item-section>
<q-item-label>
<div v-if="order.idGasordine" class="gasordine">
{{ products.getSingleGasordine(order, true) }}<br />
</div>
{{ order.product.productInfo.name }}
</q-item-label>
<q-item-label caption>
<div
class="text-black text-h8"
v-if="order.product.productInfo.unit"
>
{{ tools.getWeightTotalByOrder(order) }}
{{
tools.getUnitsMeasure(
order.product.productInfo.unit,
true,
order.product.productInfo.weight
)
}}
</div>
<div class="row q-mb-xs no-wrap items-center centeritems">
<q-btn
v-if="showall && !nomodif"
:disable="!products.enableSubQty(order)"
size="sm"
icon="fas fa-cart-arrow-down"
:color="products.enableSubQty(order) ? 'negative' : 'grey'"
@click="addsubqty(false, true)"
rounded
:label="
t('products.subcart', {
qta: products.qtaNextSub(order, order.product),
})
"
></q-btn>
2024-01-09 15:32:21 +01:00
<div v-if="editmode">
<q-input
v-if="enableQty"
v-model="orderQuantity"
2024-01-09 15:32:21 +01:00
autofocus
debounce="500"
borderless
rounded
dense
2024-01-13 00:29:02 +01:00
:label="t('products.quantity')"
2024-01-09 15:32:21 +01:00
></q-input>
<q-input
v-if="enableQtyPreordered"
v-model="orderQuantityPreordered"
2024-01-09 15:32:21 +01:00
autofocus
debounce="500"
borderless
rounded
densep
2024-01-13 00:29:02 +01:00
:label="t('ecomm.preord')"
2024-01-09 15:32:21 +01:00
></q-input>
</div>
<div v-if="editmode">
<q-input
v-model="orderTotalPriceProduct"
autofocus
debounce="500"
borderless
rounded
dense
@change="changeTotalPrice"
:label="t('orderscart.TotalPriceProduct')"
></q-input>
2024-01-13 00:29:02 +01:00
<q-btn
outline
rounded
dense
color="green"
icon="fas fa-redo"
:label="t('orderscart.update_order')"
@click="
updateOrder({
quantitypreordered: order.quantitypreordered,
quantity: order.quantity,
})
"
2024-01-13 00:29:02 +01:00
>
</q-btn>
</div>
<div v-else-if="showall" :class="`q-mx-sm text-blue-14 qta`">
{{ order.quantity + order.quantitypreordered }}
</div>
<q-btn
v-if="showall && !nomodif"
icon-right="fas fa-cart-plus"
color="positive"
:disable="!products.enableAddQty(order, order.product)"
rounded
size="sm"
:label="
t('products.addcart', {
qta: products.qtaNextAdd(order, order.product),
})
"
@click="addsubqty(true, false)"
>
</q-btn>
</div>
</q-item-label>
<q-item-label>
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
<span class="prezzo_singolo">
2024-01-13 00:29:02 +01:00
{{ order.quantity + order.quantitypreordered }} x
{{ order.price ? order.price : 0 }}
</span>
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
=
{{
order.TotalPriceProduct
? order.TotalPriceProduct.toFixed(2)
: 0
}}
</span>
<span v-if="tools.isManager() && order.TotalPriceProduct !== order.TotalPriceProductCalc"
:class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
(Calc:
{{
order.TotalPriceProductCalc
? order.TotalPriceProductCalc.toFixed(2)
: 0
}})
</span>
<span v-if="isApplicatoSconto()">
&nbsp;<span class="ordine_scontato"
>(<span class="barrato"
>
{{
(
(order.price * order.quantity) +
(order.price * order.quantitypreordered)
).toFixed(2)
}}</span
>)</span
>&nbsp;
</span>
<span v-if="isApplicatoSconto() && !editmode" class="ordine_scritta_sconto">{{
$t('ecomm.sconto_applicato', { risparmio: getRisparmio() })
}}</span>
</div>
</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label>
<div class="col-2">
<q-btn
v-if="!nomodif"
icon="fas fa-trash"
color="negative"
round
size="xs"
@click="removeFromCard"
>
</q-btn>
</div>
</q-item-label>
</q-item-section>
2023-12-21 01:34:39 +01:00
<!--<q-item-section side top>
<q-item-label caption>meta</q-item-label>
</q-item-section>
-->
</q-item>
2021-09-04 15:05:34 +02:00
</div>
</div>
</template>
<script lang="ts" src="./CSingleCart.ts">
</script>
<style lang="scss" scoped>
@import './CSingleCart.scss';
</style>