This commit is contained in:
William Buezas 2024-06-13 13:56:19 -03:00
parent 89f6873b03
commit 975e8f06c0
6 changed files with 451 additions and 220 deletions

View File

@ -0,0 +1,34 @@
<script setup>
defineProps({
url: { type: String, required: true },
width: { type: String, default: '50px' },
height: { type: String, default: '50px' },
iconSize: { type: String, default: 'md' },
});
</script>
<template>
<QImg
:src="url"
:height="height"
:width="width"
:ratio="1"
spinner-color="primary"
style="border-radius: 50%"
>
<template #error>
<div class="icon-container">
<QIcon name="photo" :size="iconSize" style="opacity: 0.4" />
</div>
</template>
</QImg>
</template>
<style lang="scss" scoped>
.icon-container {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
</style>

View File

@ -1,6 +1,7 @@
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
export default function (value, fractionSize = 2) { export default function (value, fractionSize = 2) {
console.log('toPercentage value: ', value);
if (value == null || value === '') return; if (value == null || value === '') return;
const { locale } = useI18n(); const { locale } = useI18n();
@ -8,11 +9,8 @@ export default function (value, fractionSize = 2) {
const options = { const options = {
style: 'percent', style: 'percent',
minimumFractionDigits: fractionSize, minimumFractionDigits: fractionSize,
maximumFractionDigits: fractionSize maximumFractionDigits: fractionSize,
}; };
return new Intl.NumberFormat(locale, options) return new Intl.NumberFormat(locale, options).format(parseFloat(value));
.format(parseFloat(value)); }
}

View File

@ -1,121 +1,73 @@
<script setup> <script setup>
import { ref, onMounted, computed } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import VnInput from 'src/components/common/VnInput.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
const $props = defineProps({ const $props = defineProps({
id: { id: {
type: Number, type: String,
required: true, required: true,
}, },
type: { mana: {
type: String, type: Number,
default: 'price', // 'discount' or 'price default: null,
},
newPrice: {
type: Number,
default: 0,
}, },
}); });
const emit = defineEmits(['save', 'cancel']);
const { t } = useI18n(); const { t } = useI18n();
const { notify } = useNotify(); const QPopupProxyRef = ref(null);
const edit = ref({}); const save = () => {
const usesMana = ref(null); emit('save');
QPopupProxyRef.value.hide();
const inputLabel = computed(() => ($props.type === 'price' ? t('Price') : t('Discount')));
const getUsesMana = async () => {
const { data } = await axios.get('Sales/usesMana');
usesMana.value = data;
}; };
const getMana = async () => { const cancel = () => {
const { data } = await axios.get(`Tickets/${$props.id}/getSalesPersonMana`); emit('cancel');
edit.value.mana = data; QPopupProxyRef.value.hide();
await getUsesMana();
console.log('edit', edit.value);
// this.$.$applyAsync(() => {
// this.$.editDiscount.relocate();
// this.$.editPricePopover.relocate();
// });
}; };
const updatePrice = async () => {
try {
const sale = edit.value.sale;
const newPrice = edit.value.price;
if (newPrice != null && newPrice != sale.price) {
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
sale.price = newPrice;
edit.value = null;
notify('globals.dataSaved', 'positive');
// this.$http
// .post(query, { newPrice })
// .then((res) => {
// sale.price = res.data.price;
// this.edit = null;
// this.vnApp.showSuccess(this.$t('Data saved!'));
// })
// .finally(() => this.resetChanges());
}
await getMana();
} catch (err) {
console.error('Error updating price', err);
}
};
const getNewPrice = () => {
if (edit.value.sale) {
const sale = edit.value.sale;
let newDiscount = sale.discount;
let newPrice = edit.value.price || sale.price;
if (edit.value.discount != null) newDiscount = edit.value.discount;
if (edit.value.price != null) newPrice = edit.value.price;
const price = sale.quantity * newPrice;
const discount = (newDiscount * price) / 100;
return price - discount;
}
return 0;
};
onMounted(async () => {
await getMana();
});
</script> </script>
<template> <template>
<QPopupProxy> <QPopupProxy ref="QPopupProxyRef">
<div class="container"> <div class="container">
<QSpinner v-if="!edit.mana" color="orange" size="md" /> <QSpinner v-if="!$props.mana" color="orange" size="md" />
<div v-else> <div v-else>
<div class="header">Mana: {{ toCurrency(edit.mana) }}</div> <div class="header">Mana: {{ toCurrency($props.mana) }}</div>
<div class="q-pa-md"> <div class="q-pa-md">
<VnInput <slot />
v-model.number="edit.price"
:label="inputLabel"
@change="updatePrice(row)"
/>
<div class="column items-center q-mt-lg"> <div class="column items-center q-mt-lg">
<span class="text-primary">{{ t('New price') }}</span> <span class="text-primary">{{ t('New price') }}</span>
<span class="text-subtitle1">{{ <span class="text-subtitle1">{{
toCurrency(getNewPrice()) toCurrency($props.newPrice)
}}</span> }}</span>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<QBtn color="primary" class="no-border-radius" dense style="width: 50%"> <QBtn
color="primary"
class="no-border-radius"
dense
style="width: 50%"
@click="cancel()"
>
{{ t('globals.cancel') }} {{ t('globals.cancel') }}
</QBtn> </QBtn>
<QBtn color="primary" class="no-border-radius" dense style="width: 50%"> <QBtn
color="primary"
class="no-border-radius"
dense
style="width: 50%"
@click="save()"
>
{{ t('globals.save') }} {{ t('globals.save') }}
</QBtn> </QBtn>
</div> </div>
@ -144,7 +96,5 @@ onMounted(async () => {
<i18n> <i18n>
es: es:
Price: Precio
Discount: Descuento
New price: Nuevo precio New price: Nuevo precio
</i18n> </i18n>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref, computed, reactive, onUnmounted } from 'vue'; import { onMounted, ref, computed, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';
@ -8,20 +8,18 @@ import FetchedTags from 'components/ui/FetchedTags.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
// import ItemSummary from '../Item/Card/ItemSummary.vue';
import VnPaginate from 'components/ui/VnPaginate.vue';
import TicketEditManaProxy from './TicketEditMana.vue'; import TicketEditManaProxy from './TicketEditMana.vue';
import ItemPicture from 'src/components/ui/ItemPicture.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useSession } from 'composables/useSession'; import { useSession } from 'composables/useSession';
import { toCurrency, toPercentage } from 'src/filters'; import { toCurrency, toPercentage, dashIfEmpty } from 'src/filters';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useArrayData } from 'composables/useArrayData';
import { useVnConfirm } from 'composables/useVnConfirm'; import { useVnConfirm } from 'composables/useVnConfirm';
import axios from 'axios';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import axios from 'axios';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -29,16 +27,23 @@ const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia(); const token = getTokenMultimedia();
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const { openConfirmationModal } = useVnConfirm();
const { notify } = useNotify(); const { notify } = useNotify();
const { openConfirmationModal } = useVnConfirm();
const salesDataRef = ref(null); const salesDataRef = ref(null);
const editPriceProxyRef = ref(null);
const arrayData = useArrayData('ticketData');
const { store } = arrayData;
const ticketConfig = ref(null);
const isLocked = ref(false); const isLocked = ref(false);
const isTicketEditable = ref(false); const isTicketEditable = ref(false);
const salesOptions = ref([]); const sales = ref([]);
const allColumnNames = ref([]);
const itemsWithNameOptions = ref([]); const itemsWithNameOptions = ref([]);
const selectedSales = ref([]);
const mana = ref(null);
const manaCode = ref('mana'); const manaCode = ref('mana');
const ticketState = computed(() => store.data?.ticketState?.state?.code);
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -107,50 +112,56 @@ const columns = computed(() => [
field: 'amount', field: 'amount',
align: 'left', align: 'left',
sortable: true, sortable: true,
format: (val) => toCurrency(val),
}, },
{ {
label: t('ticketSale.packaging'), label: t('ticketSale.packaging'),
name: 'packaging', name: 'itemPackingTypeFk',
field: 'packaging', field: 'item',
align: 'left', align: 'left',
sortable: true, sortable: true,
format: (val) => dashIfEmpty(val?.itemPackingTypeFk),
}, },
{ {
label: '', label: '',
name: 'actions', name: 'history',
align: 'left', align: 'left',
columnFilter: null, columnFilter: null,
}, },
]); ]);
const redirectToItemCreate = () => { const getConfig = async () => {
router.push({ name: 'ItemCreate' }); let filter = {
fields: ['daysForWarningClaim'],
};
const { data } = await axios.get(`TicketConfigs`, { filter });
ticketConfig.value = data;
}; };
// const redirectToItemSummary = (id) => { const getSaleTotal = (sale) => {
// router.push({ name: 'ItemSummary', params: { id } }); if (sale.quantity == null || sale.price == null) return null;
// };
// const cloneItem = async (itemFk) => { const price = sale.quantity * sale.price;
// try { const discount = (sale.discount * price) / 100;
// const { data } = await axios.post(`Items/${itemFk}/clone`);
// if (!data) return;
// router.push({ name: 'ItemTags', params: { id: data.id } });
// } catch (err) {
// console.error('Error cloning item', err);
// }
// };
const resetChanges = async () => salesDataRef.value.fetch(); return price - discount;
};
const onSalesFetched = (salesData) => {
sales.value = salesData;
for (let sale of salesData) sale.amount = getSaleTotal(sale);
};
const resetChanges = async () => {
arrayData.fetch({ append: false });
salesDataRef.value.fetch();
};
const updateQuantity = async (sale) => { const updateQuantity = async (sale) => {
console.log('updateQuantity');
try { try {
const payload = { quantity: sale.quantity }; const payload = { quantity: sale.quantity };
await axios.post(`Sales/${sale.id}/updateQuantity`, payload); await axios.post(`Sales/${sale.id}/updateQuantity`, payload);
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
await resetChanges();
} catch (err) { } catch (err) {
console.error('Error updating quantity', err); console.error('Error updating quantity', err);
} }
@ -178,15 +189,15 @@ const addSale = async (sale) => {
sale.item = newSale.item; sale.item = newSale.item;
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
await resetChanges();
} catch (err) { } catch (err) {
console.error('Error adding sale', err); console.error('Error adding sale', err);
} }
}; };
const changeQuantity = (sale) => { const changeQuantity = (sale) => {
console.log('edit.quantity', edit.value.quantity);
console.log('sale.quantity', sale.quantity);
if (!sale.itemFk || sale.quantity == null) return; if (!sale.itemFk || sale.quantity == null) return;
if (!sale.id) return addSale(sale); if (!sale.id) return addSale(sale);
updateQuantity(sale); updateQuantity(sale);
@ -197,18 +208,165 @@ const updateConcept = async (sale) => {
const data = { newConcept: sale.concept }; const data = { newConcept: sale.concept };
await axios.post(`Sales/${sale.id}/updateConcept`, data); await axios.post(`Sales/${sale.id}/updateConcept`, data);
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
await resetChanges();
} catch (err) { } catch (err) {
console.error('Error updating concept', err); console.error('Error updating concept', err);
} }
}; };
const DEFAULT_EDIT = { price: null, discount: null, sale: null, sales: null };
const edit = ref({ ...DEFAULT_EDIT });
const usesMana = ref(null);
const getUsesMana = async () => {
const { data } = await axios.get('Sales/usesMana');
usesMana.value = data;
};
const getMana = async () => {
const { data } = await axios.get(`Tickets/${route.params.id}/getSalesPersonMana`);
mana.value = data;
await getUsesMana();
};
const selectedValidSales = () => {
if (!sales.value) return;
return selectedSales.value.filter((sale) => sale.id != undefined);
};
const onOpenEditPricePopover = async (sale) => {
await getMana();
edit.value = {
sale: JSON.parse(JSON.stringify(sale)),
price: sale.price,
};
};
const onOpenEditDiscountPopover = async (sale) => {
await getMana();
if (isLocked.value) return;
if (sale) {
edit.value = {
sale: JSON.parse(JSON.stringify(sale)),
discount: sale.discount,
};
} else {
edit.value = {
discount: null,
sales: selectedValidSales(),
};
}
};
const updatePrice = async (sale) => {
try {
const newPrice = edit.value.price;
if (newPrice != null && newPrice != sale.price) {
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
sale.price = newPrice;
edit.value = { ...DEFAULT_EDIT };
notify('globals.dataSaved', 'positive');
}
await getMana();
} catch (err) {
console.error('Error updating price', err);
}
};
const changeDiscount = (sale) => {
const newDiscount = edit.value.discount;
if (newDiscount != null && newDiscount != sale.discount) updateDiscount([sale]);
};
const updateDiscount = async (sales) => {
const saleIds = sales.map((sale) => sale.id);
const params = {
salesIds: saleIds,
newDiscount: edit.value.discount,
manaCode: manaCode.value,
};
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
notify('globals.dataSaved', 'positive');
for (let sale of sales) sale.discount = edit.value.discount;
edit.value = { ...DEFAULT_EDIT };
};
const getNewPrice = computed(() => {
if (edit.value?.sale) {
const sale = edit.value.sale;
let newDiscount = sale.discount;
let newPrice = edit.value.price || sale.price;
if (edit.value.discount != null) newDiscount = edit.value.discount;
if (edit.value.price != null) newPrice = edit.value.price;
const price = sale.quantity * newPrice;
const discount = (newDiscount * price) / 100;
return price - discount;
}
return 0;
});
const newOrderFromTicket = async () => {
try {
const { data } = await axios.post(`Orders/newFromTicket`, {
ticketFk: Number(route.params.id),
});
const routeData = router.resolve({ name: 'OrderCatalog', params: { id: data } });
window.open(routeData.href, '_blank');
} catch (err) {
console.error('Error creating new order', err);
}
};
const goToLog = (saleId) => {
//TODO: Redireccionar cuando exista la vista TicketLog
// router.push({
// name: 'TicketLog',
// params: {
// originId: route.params.id,
// changedModel: 'Sale',
// changedModelId: saleId,
// },
// });
};
const changeTicketState = async (val) => {
try {
const params = { ticketFk: route.params.id, code: val };
await axios.post('Tickets/state', params);
notify('globals.dataSaved', 'positive');
await resetChanges();
} catch (err) {
console.error('Error changing ticket state', err);
}
};
const removeSelectedSales = () => {
selectedSales.value.forEach((sale) => {
const index = sales.value.indexOf(sale);
sales.value.splice(index, 1);
});
};
const removeSales = async () => {
try {
const sales = selectedValidSales();
const params = { sales: sales, ticketId: store.data.id };
await axios.post('Sales/deleteSales', params);
removeSelectedSales();
notify('globals.dataSaved', 'positive');
} catch (err) {
console.error('Error deleting sales', err);
}
};
const insertRow = () => sales.value.push({ ...DEFAULT_EDIT });
onMounted(async () => { onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
const filteredColumns = columns.value.filter( await getConfig();
(col) => col.name !== 'picture' && col.name !== 'actions'
);
allColumnNames.value = filteredColumns.map((col) => col.name);
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
@ -229,7 +387,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
ref="salesDataRef" ref="salesDataRef"
:url="`Tickets/${route.params.id}/getSales`" :url="`Tickets/${route.params.id}/getSales`"
auto-load auto-load
@on-fetch="(data) => (salesOptions = data)" @on-fetch="(data) => onSalesFetched(data)"
/> />
<FetchData <FetchData
url="Items/withName" url="Items/withName"
@ -238,33 +396,73 @@ onUnmounted(() => (stateStore.rightDrawer = false));
@on-fetch="(data) => (itemsWithNameOptions = data)" @on-fetch="(data) => (itemsWithNameOptions = data)"
/> />
<VnSubToolbar> <VnSubToolbar>
<template #st-data> </template> <template #st-actions>
<QBtnGroup push class="q-gutter-x-sm" flat>
<QBtn
color="primary"
icon="delete"
:disable="!isTicketEditable || !selectedSales.length"
@click="
openConfirmationModal(
t('Continue anyway?'),
t('You are going to delete lines of the ticket'),
removeSales
)
"
>
<QTooltip>{{ t('Remove lines') }}</QTooltip>
</QBtn>
<QBtn
:label="t('ticketSale.ok')"
color="primary"
:disable="!isTicketEditable || ticketState === 'OK'"
@click="changeTicketState('OK')"
>
<QTooltip>{{ t(`Change ticket state to 'Ok'`) }}</QTooltip>
</QBtn>
</QBtnGroup>
</template>
</VnSubToolbar> </VnSubToolbar>
<RightMenu> <RightMenu>
<template #right-panel> <template #right-panel>
<ItemListFilter data-key="ItemList" /> <div
class="q-pa-md q-mb-md q-ma-md color-vn-text"
style="border: 2px solid black"
>
<QCardSection class="justify-center text-subtitle1" horizontal>
<span class="q-mr-xs color-vn-label"
>{{ t('ticketSale.subtotal') }}:
</span>
<span>{{ toCurrency(store.data?.totalWithoutVat) }}</span>
</QCardSection>
<QCardSection class="justify-center text-subtitle1" horizontal>
<span class="q-mr-xs color-vn-label">
{{ t('ticketSale.tax') }}:
</span>
<span>{{
toCurrency(store.data?.totalWithVat - store.data?.totalWithoutVat)
}}</span>
</QCardSection>
<QCardSection
class="justify-center text-weight-bold text-subtitle1"
horizontal
>
<span class="q-mr-xs color-vn-label">
{{ t('ticketSale.total') }}:
</span>
<span>{{ toCurrency(store.data?.totalWithVat) }}</span>
</QCardSection>
</div>
</template> </template>
</RightMenu> </RightMenu>
<!-- <VnPaginate
ref="paginateRef"
data-key="ItemList"
url="Items/filter"
:order="['isActive DESC', 'name', 'id']"
:limit="12"
:expr-builder="exprBuilder"
:user-params="params"
:keep-opts="['userParams']"
:offset="50"
auto-load
>
<template #body="{ rows }"> -->
<QTable <QTable
:rows="salesOptions" :rows="sales"
:columns="columns" :columns="columns"
row-key="id" row-key="id"
:pagination="{ rowsPerPage: 0 }" :pagination="{ rowsPerPage: 0 }"
class="full-width q-mt-md" class="full-width q-mt-md"
selection="multiple" selection="multiple"
v-model:selected="selectedSales"
:no-data-label="t('globals.noResults')" :no-data-label="t('globals.noResults')"
> >
<template #body-cell-statusIcons="{ row }"> <template #body-cell-statusIcons="{ row }">
@ -275,7 +473,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
> >
<QIcon color="primary" name="vn:claims" size="xs"> <QIcon color="primary" name="vn:claims" size="xs">
<QTooltip> <QTooltip>
{{ t('ticket.summary.unavailable') }}: {{ t('ticketSale.claim') }}:
{{ row.claim?.claimFk }} {{ row.claim?.claimFk }}
</QTooltip> </QTooltip>
</QIcon> </QIcon>
@ -287,7 +485,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QIcon> </QIcon>
<QIcon v-if="row.reserved" color="primary" name="vn:reserva" size="xs"> <QIcon v-if="row.reserved" color="primary" name="vn:reserva" size="xs">
<QTooltip> <QTooltip>
{{ t('ticket.summary.reserved') }} {{ t('ticketSale.reserved') }}
</QTooltip> </QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
@ -297,7 +495,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
size="xs" size="xs"
> >
<QTooltip> <QTooltip>
{{ t('ticket.summary.itemShortage') }} {{ t('ticketSale.noVisible') }}
</QTooltip> </QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
@ -307,20 +505,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
size="xs" size="xs"
> >
<QTooltip> <QTooltip>
{{ t('ticket.summary.hasComponentLack') }} {{ t('ticketSale.hasComponentLack') }}
</QTooltip> </QTooltip>
</QIcon> </QIcon>
</QTd> </QTd>
</template> </template>
<template #body-cell-picture="{ row }"> <template #body-cell-picture="{ row }">
<QTd> <QTd>
<QImg <ItemPicture
:src="`/api/Images/catalog/50x50/${row.itemFk}/download?access_token=${token}`" :url="`/api/Images/catalog/50x50/${row.itemFk}/download?access_token=${token}`"
spinner-color="primary"
:ratio="1"
height="50px"
width="50px"
style="border-radius: 50%"
/> />
</QTd> </QTd>
</template> </template>
@ -352,6 +545,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
hide-selected hide-selected
option-label="name" option-label="name"
option-value="id" option-value="id"
@update:model-value="changeQuantity(row)"
v-model="row.itemFk" v-model="row.itemFk"
> >
<template #option="scope"> <template #option="scope">
@ -367,7 +561,14 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</template> </template>
<template #body-cell-quantity="{ row }"> <template #body-cell-quantity="{ row }">
<QTd @click.stop> <QTd @click.stop>
<VnInput v-model.number="row.quantity" @change="changeQuantity(row)" /> <VnInput
v-if="isTicketEditable"
v-model.number="row.quantity"
@keyup.enter="changeQuantity(row)"
@blur="changeQuantity(row)"
@focus="edit.quantity = row.quantity"
/>
<span v-else>{{ row.quantity }}</span>
</QTd> </QTd>
</template> </template>
<template #body-cell-item="{ row }"> <template #body-cell-item="{ row }">
@ -375,76 +576,100 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<div class="column"> <div class="column">
<span>{{ row.concept }}</span> <span>{{ row.concept }}</span>
<span class="color-vn-label">{{ row.item?.subName }}</span> <span class="color-vn-label">{{ row.item?.subName }}</span>
<FetchedTags :item="row.item" :max-length="6" /> <FetchedTags v-if="row.item" :item="row.item" :max-length="6" />
<QPopupProxy v-if="row.id && isTicketEditable">
<VnInput v-model="row.concept" @change="updateConcept(row)" />
</QPopupProxy>
</div> </div>
<QPopupProxy>
<VnInput v-model="row.concept" @change="updateConcept(row)" />
</QPopupProxy>
</QTd> </QTd>
</template> </template>
<template #body-cell-price="{ row }"> <template #body-cell-price="{ row }">
<QTd @click.stop> <QTd>
<QBtn flat color="primary" dense> <template v-if="isTicketEditable && row.id">
{{ toCurrency(row.price) }} <QBtn flat color="primary" dense @click="onOpenEditPricePopover(row)">
</QBtn> {{ toCurrency(row.price) }}
<TicketEditManaProxy </QBtn>
:id="route.params.id" <TicketEditManaProxy
@reset-changes="resetChanges()" ref="editPriceProxyRef"
/> :mana="mana"
:new-price="getNewPrice"
@save="updatePrice(row)"
@cancel="updatePrice(row)"
>
<VnInput
v-model.number="edit.price"
:label="t('ticketSale.price')"
type="number"
/>
</TicketEditManaProxy>
</template>
<span v-else>{{ toCurrency(row.price) }}</span>
</QTd> </QTd>
</template> </template>
<template #body-cell-discount="{ row }"> <template #body-cell-discount="{ row }">
<QTd @click.stop> <QTd>
<QBtn flat color="primary" dense> <template v-if="!isLocked && row.id">
{{ toPercentage(row.discount) }} <QBtn
</QBtn> flat
<TicketEditManaProxy color="primary"
:id="route.params.id" dense
@reset-changes="resetChanges()" @click="onOpenEditDiscountPopover(row)"
/> >
{{ toPercentage(row.discount / 100) }}
</QBtn>
<TicketEditManaProxy
:mana="mana"
:new-price="getNewPrice"
@save="changeDiscount(row)"
@cancel="changeDiscount(row)"
>
<VnInput
v-model.number="edit.discount"
:label="t('ticketSale.discount')"
type="number"
/>
</TicketEditManaProxy>
</template>
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
</QTd> </QTd>
</template> </template>
<!-- <template #body-cell-actions="{ row }"> <template #body-cell-history="{ row }">
<QTd> <QTd v-if="row.hasLogs">
<QIcon <QBtn
@click.stop=" @click.stop="goToLog(row.id)"
openConfirmationModal( color="primary"
t(`All it's properties will be copied`), icon="history"
t('Do you want to clone this item?'), size="md"
() => cloneItem(row.id) flat
) >
" <QTooltip class="text-no-wrap">
class="q-ml-sm" {{ t('ticketSale.history') }}
color="primary" </QTooltip>
name="vn:clone" </QBtn>
size="sm" </QTd>
> </template>
<QTooltip> <template #bottom-row>
{{ t('globals.clone') }} <QBtn
</QTooltip> class="cursor-pointer fill-icon q-ml-md q-my-lg"
</QIcon> color="primary"
<QIcon icon="add_circle"
@click.stop="viewSummary(row.id, ItemSummary)" size="md"
class="q-ml-md" round
color="primary" flat
name="preview" :disable="!isTicketEditable"
size="sm" @click="insertRow()"
> >
<QTooltip class="text-no-wrap"> <QTooltip>
{{ t('Preview') }} {{ t('Add item') }}
</QTooltip> </QTooltip>
</QIcon> </QBtn>
</QTd> </template>
</template> -->
</QTable> </QTable>
<pre>{{ salesOptions }}</pre>
<!-- </template>
</VnPaginate> -->
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]">
<QBtn @click="redirectToItemCreate()" color="primary" fab icon="add" /> <QBtn @click="newOrderFromTicket()" color="primary" fab icon="add" />
<QTooltip class="text-no-wrap"> <QTooltip class="text-no-wrap">
{{ t('New item') }} {{ t('Add item to basket') }}
</QTooltip> </QTooltip>
</QPageSticky> </QPageSticky>
</template> </template>
@ -452,4 +677,10 @@ onUnmounted(() => (stateStore.rightDrawer = false));
<i18n> <i18n>
es: es:
New item: Nuevo artículo New item: Nuevo artículo
Add item to basket: Añadir artículo a la cesta
Change ticket state to 'Ok': Cambiar estado del ticket a 'Ok'
Remove lines: Eliminar líneas
Continue anyway?: ¿Continuar de todas formas?
You are going to delete lines of the ticket: Vas a eliminar lineas del ticket
Add item: Añadir artículo
</i18n> </i18n>

View File

@ -8,3 +8,12 @@ ticketSale:
discount: Disc discount: Disc
amount: Amount amount: Amount
packaging: Packaging packaging: Packaging
subtotal: Subtotal
tax: VAT
total: Total
history: History
claim: Claim
reserved: Reserved
noVisible: Not visible
hasComponentLack: Component lack
ok: Ok

View File

@ -8,5 +8,14 @@ ticketSale:
item: Artículo item: Artículo
price: Precio price: Precio
discount: Dto discount: Dto
amount: Cantidad amount: Importe
packaging: Encajado packaging: Encajado
subtotal: Subtotal
tax: IVA
total: Total
history: Historial
claim: Reclamación
reserved: Reservado
noVisible: No visible
hasComponentLack: Faltan componentes
ok: Ok