From 6ef53e790acc829e60f20f2be55baa8590a8894d Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 17 Jun 2024 12:19:57 +0200 Subject: [PATCH] feat: itemProposal and LackDetail --- src/components/ui/VnLv.vue | 11 ++ src/i18n/locale/es.yml | 1 + src/pages/Item/components/ItemProposal.vue | 103 ++++++----- src/pages/Item/locale/es.yml | 1 + src/pages/Ticket/Card/TicketSplit.vue | 113 ++++++++++++ .../Ticket/Negative/TicketLackDetail.vue | 165 ++++++++++-------- 6 files changed, 271 insertions(+), 123 deletions(-) create mode 100644 src/pages/Ticket/Card/TicketSplit.vue diff --git a/src/components/ui/VnLv.vue b/src/components/ui/VnLv.vue index 3220bce6a..9cf31c8f0 100644 --- a/src/components/ui/VnLv.vue +++ b/src/components/ui/VnLv.vue @@ -72,4 +72,15 @@ function copyValueText() { .info { 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; + } +} diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml index c12f87050..d8c6c6b50 100644 --- a/src/i18n/locale/es.yml +++ b/src/i18n/locale/es.yml @@ -29,6 +29,7 @@ globals: saveAndContinue: Guardar y continuar remove: Eliminar reset: Restaurar + refresh: Actualizar close: Cerrar cancel: Cancelar clone: Clonar diff --git a/src/pages/Item/components/ItemProposal.vue b/src/pages/Item/components/ItemProposal.vue index 153d825ad..b220dc5d7 100644 --- a/src/pages/Item/components/ItemProposal.vue +++ b/src/pages/Item/components/ItemProposal.vue @@ -5,15 +5,19 @@ import VnPaginate from 'components/ui/VnPaginate.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import FetchedTags from 'components/ui/FetchedTags.vue'; 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 session = useSession(); const primaryColor = 'red'; const colorSpacer = '#ecf0f1'; -const gradientStyle = computed(() => { - return `linear-gradient(to right, ${primaryColor} ${compatibility.value}, ${colorSpacer} 10%)`; -}); +const compatibilityItem = (value) => `${100 * (value / MATCH_VALUES.length)}%`; +const gradientStyle = (value) => + `linear-gradient(to right, ${primaryColor} ${compatibilityItem( + value + )}, ${colorSpacer} 10%)`; + const $props = defineProps({ item: { type: Object, @@ -29,26 +33,24 @@ const $props = defineProps({ const proposalSelected = ref([]); const quantity = ref(-1); const token = session.getTokenMultimedia(); -const index = ref(0); -const currentTicket = computed(() => $props.tickets[index.value]); +// const index = ref(0); +// const currentTicket = computed(() => $props.tickets[index.value]); const showProposalDialog = ref(false); const defaultColumnAttrs = { align: 'left', sortable: true, }; -const compatibility = ref(null); +// const compatibility = ref(null); // const compatibility = computed(() => `linear-gradient(to right,red 10%, white 10%);`); const statusConditionalValue = (row) => { - const values = [5, 6, 7, 8]; - const total = values.reduce((acc, i) => acc + row[`match${i}`], 0); - const STATUS_VALUES = { 1: 'white', 2: '$secondary', 3: 'positive', 4: 'warning' }; - const status = STATUS_VALUES[total]; - compatibility.value = `${100 * (total / values.length)}%`; - return { status, total, compatibility }; + const total = MATCH_VALUES.reduce((acc, i) => acc + row[`match${i}`], 0); + // const STATUS_VALUES = { 1: 'white', 2: '$secondary', 3: 'positive', 4: 'warning' }; + // const status = STATUS_VALUES[total]; + // const compatibility = `${100 * (total / values.length)}%`; + return total; }; // const conditionalValue = (tag) => (tag === 1 ? 'match' : 'not-match'); -const conditionalValuePrice = (price) => - price > currentTicket.value.price * 1.3 ? 'match' : 'not-match'; +const conditionalValuePrice = (price) => (price > 1.3 ? 'match' : 'not-match'); // const changeTicket = (type, _index = 0) => { // const value = type ? 1 : -1; // const nextIndex = index.value + value + _index; @@ -75,6 +77,7 @@ const columns = computed(() => [ label: t('Compatibildiad'), name: 'status', field: statusConditionalValue, + sortable: true, }, { ...defaultColumnAttrs, @@ -84,7 +87,7 @@ const columns = computed(() => [ }, { - align: 'center', + align: 'left', sortable: true, label: t('proposal.longName'), name: 'longName', @@ -124,11 +127,11 @@ const columns = computed(() => [ field: 'value8', classes: ({ match8 }) => conditionalValue(match8), },*/ - { - ...defaultColumnAttrs, - label: t('proposal.tags'), - name: 'tags', - }, + // { + // ...defaultColumnAttrs, + // label: t('proposal.tags'), + // name: 'tags', + // }, { ...defaultColumnAttrs, @@ -171,32 +174,38 @@ async function confirm() { - - - {{ item.longName }} - {{ item.longName }} + + + + - {{ + @@ -251,7 +260,7 @@ async function confirm() { --> - +