#6321 - Negative ticket #158

Open
jsegarra wants to merge 220 commits from 6321_negative_tickets into dev
6 changed files with 271 additions and 123 deletions
Showing only changes of commit 6ef53e790a - Show all commits

View File

@ -72,4 +72,15 @@ function copyValueText() {
.info { .info {
margin-left: 5px; margin-left: 5px;
} }
.image {
display: flex;
flex-direction: row;
align-content: center;
align-items: center;
justify-content: flex-start;
& > .q-btn .value {
text-transform: uppercase;
}
}
</style> </style>

View File

@ -29,6 +29,7 @@ globals:
saveAndContinue: Guardar y continuar saveAndContinue: Guardar y continuar
remove: Eliminar remove: Eliminar
reset: Restaurar reset: Restaurar
refresh: Actualizar
close: Cerrar close: Cerrar
cancel: Cancelar cancel: Cancelar
clone: Clonar clone: Clonar

View File

@ -5,15 +5,19 @@ import VnPaginate from 'components/ui/VnPaginate.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import VnLv from 'src/components/ui/VnLv.vue';
const MATCH_VALUES = [5, 6, 7, 8];
const { t } = useI18n(); const { t } = useI18n();
const session = useSession(); const session = useSession();
const primaryColor = 'red'; const primaryColor = 'red';
const colorSpacer = '#ecf0f1'; const colorSpacer = '#ecf0f1';
const gradientStyle = computed(() => { const compatibilityItem = (value) => `${100 * (value / MATCH_VALUES.length)}%`;
return `linear-gradient(to right, ${primaryColor} ${compatibility.value}, ${colorSpacer} 10%)`; const gradientStyle = (value) =>
}); `linear-gradient(to right, ${primaryColor} ${compatibilityItem(
value
)}, ${colorSpacer} 10%)`;
const $props = defineProps({ const $props = defineProps({
item: { item: {
type: Object, type: Object,
@ -29,26 +33,24 @@ const $props = defineProps({
const proposalSelected = ref([]); const proposalSelected = ref([]);
const quantity = ref(-1); const quantity = ref(-1);
const token = session.getTokenMultimedia(); const token = session.getTokenMultimedia();
const index = ref(0); // const index = ref(0);
const currentTicket = computed(() => $props.tickets[index.value]); // const currentTicket = computed(() => $props.tickets[index.value]);
const showProposalDialog = ref(false); const showProposalDialog = ref(false);
const defaultColumnAttrs = { const defaultColumnAttrs = {
align: 'left', align: 'left',
sortable: true, sortable: true,
}; };
const compatibility = ref(null); // const compatibility = ref(null);
// const compatibility = computed(() => `linear-gradient(to right,red 10%, white 10%);`); // const compatibility = computed(() => `linear-gradient(to right,red 10%, white 10%);`);
const statusConditionalValue = (row) => { const statusConditionalValue = (row) => {
const values = [5, 6, 7, 8]; const total = MATCH_VALUES.reduce((acc, i) => acc + row[`match${i}`], 0);
const total = values.reduce((acc, i) => acc + row[`match${i}`], 0); // const STATUS_VALUES = { 1: 'white', 2: '$secondary', 3: 'positive', 4: 'warning' };
const STATUS_VALUES = { 1: 'white', 2: '$secondary', 3: 'positive', 4: 'warning' }; // const status = STATUS_VALUES[total];
const status = STATUS_VALUES[total]; // const compatibility = `${100 * (total / values.length)}%`;
compatibility.value = `${100 * (total / values.length)}%`; return total;
return { status, total, compatibility };
}; };
// const conditionalValue = (tag) => (tag === 1 ? 'match' : 'not-match'); // const conditionalValue = (tag) => (tag === 1 ? 'match' : 'not-match');
const conditionalValuePrice = (price) => const conditionalValuePrice = (price) => (price > 1.3 ? 'match' : 'not-match');
price > currentTicket.value.price * 1.3 ? 'match' : 'not-match';
// const changeTicket = (type, _index = 0) => { // const changeTicket = (type, _index = 0) => {
// const value = type ? 1 : -1; // const value = type ? 1 : -1;
// const nextIndex = index.value + value + _index; // const nextIndex = index.value + value + _index;
@ -75,6 +77,7 @@ const columns = computed(() => [
label: t('Compatibildiad'), label: t('Compatibildiad'),
name: 'status', name: 'status',
field: statusConditionalValue, field: statusConditionalValue,
sortable: true,
}, },
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
@ -84,7 +87,7 @@ const columns = computed(() => [
}, },
{ {
align: 'center', align: 'left',
sortable: true, sortable: true,
label: t('proposal.longName'), label: t('proposal.longName'),
name: 'longName', name: 'longName',
@ -124,11 +127,11 @@ const columns = computed(() => [
field: 'value8', field: 'value8',
classes: ({ match8 }) => conditionalValue(match8), classes: ({ match8 }) => conditionalValue(match8),
},*/ },*/
{ // {
...defaultColumnAttrs, // ...defaultColumnAttrs,
label: t('proposal.tags'), // label: t('proposal.tags'),
name: 'tags', // name: 'tags',
}, // },
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
@ -171,6 +174,8 @@ async function confirm() {
<QDialog ref="dialogRef" @hide="onDialogHide" v-model="showProposalDialog" full-width> <QDialog ref="dialogRef" @hide="onDialogHide" v-model="showProposalDialog" full-width>
<QCard class="q-pa-lg"> <QCard class="q-pa-lg">
<QCardSection class="row items-center q-pb-none"> <QCardSection class="row items-center q-pb-none">
<VnLv class="image">
<template #label>
<QImg <QImg
:src="`/api/Images/catalog/50x50/${item.id}/download?access_token=${token}`" :src="`/api/Images/catalog/50x50/${item.id}/download?access_token=${token}`"
spinner-color="primary" spinner-color="primary"
@ -180,23 +185,27 @@ async function confirm() {
class="image remove-bg" class="image remove-bg"
:alt="'asdads'" :alt="'asdads'"
/> />
</template>
<span class="text-h6">{{ item.longName }}</span> <template #value>
<span class="text" <QBtn flat class="link text-blue">
><sub>{{ item.longName }}</sub></span {{ item.longName }}
> <ItemDescriptorProxy :id="item.id" />
jsegarra marked this conversation as resolved
Review

30 ?

30 ?
Review

Lo habia reemplazado arroba y faltaba esta

Lo habia reemplazado arroba y faltaba esta
</QBtn>
<FetchedTags class="q-ml-md" :item="item" :max-length="5" />
</template>
</VnLv>
<QSpace /> <QSpace />
<QBtn icon="close" flat round dense v-close-popup /> <QBtn icon="close" flat round dense v-close-popup />
</QCardSection> </QCardSection>
<QCardSection class="row items-center justify-center column items-stretch"> <QCardSection class="row items-center justify-center column items-stretch">
<span class="text-h6 text-grey"> <span class="text-h6 text-grey">
<!-- {{ currentTicket }} --> <!-- {{ currentTicket }} -->
{{ <!-- {{
t('proposal.title', { t('proposal.title', {
ticketFk: currentTicket.ticketFk, ticketFk: currentTicket.ticketFk,
saleFk: currentTicket.saleFk, saleFk: currentTicket.saleFk,
}) })
}} }} -->
</span> </span>
</QCardSection> </QCardSection>
<QCardSection class="row items-center justify-center column items-stretch"> <QCardSection class="row items-center justify-center column items-stretch">
@ -251,7 +260,7 @@ async function confirm() {
</QTr> --> </QTr> -->
</template> </template>
<template #body-cell-longName="{ row, value }"> <template #body-cell-longName="{ row, value }">
<QTd align="right" class="text-primary"> <QTd align="left" class="text-primary">
<QTooltip> <QTooltip>
{{ row.id }} {{ row.id }}
</QTooltip> </QTooltip>
@ -262,30 +271,28 @@ async function confirm() {
height="50px" height="50px"
width="50px" width="50px"
class="image remove-bg" class="image remove-bg"
:alt="'asdads'" :alt="'asdads'" />
/>
<QBtn flat color="blue" dense>{{ value }}</QBtn> <QBtn flat color="blue" dense>{{ value }}</QBtn>
<ItemDescriptorProxy :id="row.id" /> <ItemDescriptorProxy :id="row.id" />
</QTd> <FetchedTags :item="row" :max-length="5"
/></QTd>
</template> </template>
<template #body-cell-status="{ value }"> <template #body-cell-status="{ value }">
<QTd class="col" align="center"> <QTd class="col" align="center">
<div <div
:style="{ background: gradientStyle }" :style="{ background: gradientStyle(value) }"
class="compatibility" class="compatibility"
> >
<QTooltip> <QTooltip>
{{ value }} {{ compatibilityItem(value) }}
</QTooltip> </QTooltip>
</div> </div>
</QTd> </QTd>
</template> </template>
<template #body-cell-tags="{ row }"> <!-- <template #body-cell-tags="{ row }">
<QTd class="col" align="center" <QTd class="col" align="center"> </QTd>
><FetchedTags :item="row" :max-length="5" </template> -->
/></QTd>
</template>
<template #body-cell-price2="{ row, value }"> <template #body-cell-price2="{ row, value }">
<QTd <QTd

View File

@ -88,6 +88,7 @@ itemType:
worker: Trabajador worker: Trabajador
category: Reino category: Reino
temperature: Temperatura temperature: Temperatura
itemProposal: Artículos similares
proposal: proposal:
title: Items de sustitución para los tickets seleccionados title: Items de sustitución para los tickets seleccionados
itemFk: Item itemFk: Item

View File

@ -0,0 +1,113 @@
<script setup>
import { ref, toRefs } from 'vue';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import useNotify from 'src/composables/useNotify';
import { useValidator } from 'src/composables/useValidator';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'components/common/VnSelect.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import FetchData from 'src/components/FetchData.vue';
import { watch } from 'vue';
import { onMounted } from 'vue';
const { t } = useI18n();
const columns = [
{
name: 'name',
required: true,
label: 'Dessert (100g serving)',
align: 'left',
field: (row) => row.name,
format: (val) => `${val}`,
sortable: true,
},
];
const rows = [
{
name: 'Frozen Yogurt',
calories: 159,
fat: 6.0,
carbs: 24,
protein: 4.0,
sodium: 87,
calcium: '14%',
iron: '1%',
},
];
</script>
<template>
<QBtn color="primary" icon="show_chart">
<QPopupProxy ref="popupProxyRef" style="max-width: none">
<QCard class="column q-pa-md">
<span class="text-body1 q-mb-sm">{{ t('Campaign consumption') }}</span>
<VnRow class="q-gutter-md q-mb-md" style="min-width: 70vw">
<QCard class="column q-pa-md vn-one">
<VnRow class="row q-gutter-md q-mb-md">
<span class="text-body1 q-mb-sm"
>Lineas a transferir</span
></VnRow
>
<QTable
flat
bordered
title="Treats"
:rows="rows"
:columns="columns"
row-key="name"
/>
</QCard>
<QCard class="column q-pa-md vn-one">
<VnRow class="row q-gutter-md q-mb-md">
<span class="text-body1 q-mb-sm"
>Ticket destinatario</span
></VnRow
>
<QTable
flat
bordered
title="Treats"
:rows="rows"
:columns="columns"
row-key="name"
/>
</QCard>
</VnRow>
<!-- <div class="q-mt-lg row justify-end">
<QBtn
:label="t('globals.cancel')"
color="primary"
flat
class="q-mr-md"
v-close-popup
/>
<QBtn
:label="t('globals.save')"
type="submit"
color="primary"
@click="onSubmit()"
/>
</div> -->
</QCard>
</QPopupProxy>
<QTooltip>{{ t('Campaign consumption') }}</QTooltip>
</QBtn>
</template>
<i18n>
en:
params:
valentinesDay: Valentine's Day
mothersDay: Mother's Day
allSaints: All Saints' Day
es:
params:
valentinesDay: Día de San Valentín
mothersDay: Día de la Madre
allSaints: Día de Todos los Santos
Campaign consumption: Consumo campaña
Campaign: Campaña
From: Desde
To: Hasta
</i18n>

View File

@ -8,7 +8,10 @@ import ChangeQuantityDialog from 'pages/Ticket/Negative/components/ChangeQuantit
import ChangeStateDialog from 'pages/Ticket/Negative/components/ChangeStateDialog.vue'; import ChangeStateDialog from 'pages/Ticket/Negative/components/ChangeStateDialog.vue';
import ItemProposal from 'pages/Item/components/ItemProposal.vue'; import ItemProposal from 'pages/Item/components/ItemProposal.vue';
import { useVnConfirm } from 'composables/useVnConfirm'; import { useVnConfirm } from 'composables/useVnConfirm';
import VnLv from 'src/components/ui/VnLv.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import TickerSplit from '../Card/TicketSplit.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
@ -20,7 +23,6 @@ import { useStateStore } from 'stores/useStateStore';
import { useDialogPluginComponent } from 'quasar'; import { useDialogPluginComponent } from 'quasar';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import ZoneDescriptorProxy from 'pages/Zone/Card/ZoneDescriptorProxy.vue'; import ZoneDescriptorProxy from 'pages/Zone/Card/ZoneDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
onMounted(() => { onMounted(() => {
stateStore.rightDrawer = false; stateStore.rightDrawer = false;
nextTick(() => { nextTick(() => {
@ -353,8 +355,8 @@ const split = async () => {
</QBtn></QBtnGroup </QBtn></QBtnGroup
> >
</Teleport> --> </Teleport> -->
<Teleport to="#st-data" v-if="stateStore?.isSubToolbarShown()"> <VnSubToolbar>
<QSpace /> <template #st-data>
<QBtnGroup push style="column-gap: 1px"> <QBtnGroup push style="column-gap: 1px">
<QBtn <QBtn
icon="refresh" icon="refresh"
@ -386,9 +388,11 @@ const split = async () => {
:disable="selectedRows.length < 2" :disable="selectedRows.length < 2"
> >
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('negative.itemProposal') }} {{ t('globals.refresh') }}
{{ t('negative.buttonsUpdate.itemProposal') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<TickerSplit></TickerSplit>
<QBtn <QBtn
color="primary" color="primary"
@click=" @click="
@ -406,21 +410,16 @@ const split = async () => {
{{ t('globals.split') }} {{ t('globals.split') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn icon="vn:item" color="primary" @click="showProposalDialog = true">
icon="vn:item"
color="primary"
:disable="selectedRows.length < 1"
@click="showProposalDialog = true"
>
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('Item proposal') }} {{ t('itemProposal') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</QBtnGroup> </QBtnGroup>
<QCheckbox v-model="showFree" :label="t('negative.detail.showFree')" /> <QCheckbox v-model="showFree" :label="t('negative.detail.showFree')" />
</Teleport> </template>
</VnSubToolbar>
<QPage> <QPage>
<VnSubToolbar />
<div class="full-width q-pa-md"> <div class="full-width q-pa-md">
<VnPaginate <VnPaginate
:data-key="URL_KEY" :data-key="URL_KEY"
@ -431,8 +430,10 @@ const split = async () => {
> >
<!-- :rows="rows" --> <!-- :rows="rows" -->
<template #body="{ rows }"> <template #body="{ rows }">
<!-- <VnRow style="align-items: center"> {{ item }}
<div>
<VnLv class="image">
<template #label>
<QImg <QImg
:src="`/api/Images/catalog/50x50/${entityId}/download?access_token=${token}`" :src="`/api/Images/catalog/50x50/${entityId}/download?access_token=${token}`"
spinner-color="primary" spinner-color="primary"
@ -442,8 +443,22 @@ const split = async () => {
class="image remove-bg" class="image remove-bg"
:alt="'asdads'" :alt="'asdads'"
/> />
</template>
<template #value>
<QBtn flat class="link text-blue">
{{ item.longName }}
<ItemDescriptorProxy :id="entityId" />
</QBtn>
<FetchedTags class="q-ml-md" :item="item" :max-length="5" />
</template>
</VnLv>
<!-- <ItemDescriptorProxy :id="entityId" />
<span class="text-h6">{{ item.longName }}</span> <span class="text-h6">{{ item.longName }}</span>
<span class="text-h6"
><sub>{{ item.longName }}</sub></span
> -->
<!-- <VnRow style="align-items: center">
<div>
</div> </div>
<QIcon name="arrow_right" size="lg" /> <QIcon name="arrow_right" size="lg" />
<VnSelectDialog action-icon="call_split"></VnSelectDialog <VnSelectDialog action-icon="call_split"></VnSelectDialog
@ -552,13 +567,13 @@ const split = async () => {
></QPage> ></QPage>
<ChangeStateDialog <ChangeStateDialog
ref="changeStateDialogRef" ref="changeStateDialogRef"
@hide="onDetailDialogHide" @hide="onDialogHide"
v-model="showChangeStateDialog" v-model="showChangeStateDialog"
:selected-rows="selectedRows" :selected-rows="selectedRows"
></ChangeStateDialog> ></ChangeStateDialog>
<ChangeQuantityDialog <ChangeQuantityDialog
ref="changeQuantityDialogRef" ref="changeQuantityDialogRef"
@hide="onDetailDialogHide" @hide="onDialogHide"
v-model="showChangeQuantityDialog" v-model="showChangeQuantityDialog"
:selected-rows="selectedRows" :selected-rows="selectedRows"
> >