0
0
Fork 0

feat: ItemProposal difference column

This commit is contained in:
Javier Segarra 2024-06-17 12:37:52 +02:00
parent 6ef53e790a
commit 20e439f31e
4 changed files with 50 additions and 6 deletions

View File

@ -0,0 +1,35 @@
<!-- src/components/StockValueDisplay.vue -->
<template>
<span :class="valueClass">
<QIcon :name="iconName" size="sm" class="value-icon" />
{{ formattedValue }}
</span>
</template>
<script setup>
import { computed } from 'vue';
import { useQuasar } from 'quasar';
const props = defineProps({
value: {
type: Number,
required: true,
},
});
const valueClass = computed(() => (props.value > 0 ? 'positive' : 'negative'));
const iconName = computed(() => (props.value > 0 ? 'arrow_upward' : 'arrow_downward'));
const formattedValue = computed(() => props.value);
</script>
<style scoped>
.positive {
color: green;
}
.negative {
color: red;
}
.value-icon {
margin-right: 4px;
}
</style>

View File

View File

@ -6,6 +6,9 @@ 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'; import VnLv from 'src/components/ui/VnLv.vue';
import { toCurrency } from 'filters/index';
import VnStockValueDisplay from 'src/components/ui/VnStockValueDisplay.vue';
const MATCH_VALUES = [5, 6, 7, 8]; const MATCH_VALUES = [5, 6, 7, 8];
const { t } = useI18n(); const { t } = useI18n();
const session = useSession(); const session = useSession();
@ -70,7 +73,7 @@ const columns = computed(() => [
...defaultColumnAttrs, ...defaultColumnAttrs,
label: t('proposal.difference'), label: t('proposal.difference'),
name: 'difference', name: 'difference',
field: (item) => 21, field: (item) => (item.id % 2 === 0 ? 10 : -10),
}, },
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
@ -301,9 +304,14 @@ async function confirm() {
:class="[conditionalValuePrice(value)]" :class="[conditionalValuePrice(value)]"
> >
<QTooltip> <QTooltip>
{{ row.price2 }}/{{ currentTicket.price }} {{ toCurrency(row.price2) }}
</QTooltip> </QTooltip>
{{ value }} {{ toCurrency(row.price2) }}
</QTd>
</template>
<template #body-cell-difference="{ value }">
<QTd class="col" align="left">
<VnStockValueDisplay :value="value" />
</QTd> </QTd>
</template> </template>
</QTable> </QTable>

View File

@ -98,11 +98,12 @@ proposal:
value6: value6 value6: value6
value7: value7 value7: value7
value8: value8 value8: value8
available: Dispnible available: Disponible
minQuantity: minQuantity minQuantity: Min. cantidad
price2: price2 price2: Precio
located: Ubicado located: Ubicado
counter: Contador counter: Contador
difference: Diferencial
groupingPrice: Precio Grouping groupingPrice: Precio Grouping
itemOldPrice: Precio itemOld itemOldPrice: Precio itemOld
status: Estado status: Estado