0
0
Fork 0

feat: minor updates

This commit is contained in:
Javier Segarra 2024-05-02 15:18:14 +02:00
parent 6323f165a0
commit c03875838f
3 changed files with 39 additions and 28 deletions

View File

@ -5,7 +5,7 @@ import { ref, reactive, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
// import { useDialogPluginComponent } from 'quasar'; // import { useDialogPluginComponent } from 'quasar';
import VnInput from 'src/components/common/VnInput.vue'; // import VnInput from 'src/components/common/VnInput.vue';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
const { t } = useI18n(); const { t } = useI18n();
@ -39,13 +39,13 @@ const defaultColumnAttrs = {
align: 'left', align: 'left',
sortable: true, sortable: true,
}; };
const getColumnInputEvents = (col) => { // const getColumnInputEvents = (col) => {
return col.columnFilter.type === 'select' // return col.columnFilter.type === 'select'
? { 'update:modelValue': () => applyColumnFilter(col) } // ? { 'update:modelValue': () => applyColumnFilter(col) }
: { // : {
'keyup.enter': () => applyColumnFilter(col), // 'keyup.enter': () => applyColumnFilter(col),
}; // };
}; // };
const applyColumnFilter = async (col) => { const applyColumnFilter = async (col) => {
try { try {
const paramKey = col.columnFilter?.filterParamKey || col.field; const paramKey = col.columnFilter?.filterParamKey || col.field;
@ -68,10 +68,12 @@ const statusConditionalValue = (row) => {
const total = [5, 6, 7, 8].reduce((acc, i) => acc + row[`match${i}`], 0); const total = [5, 6, 7, 8].reduce((acc, i) => acc + row[`match${i}`], 0);
const STATUS_VALUES = { 2: '$secondary', 3: 'positive', 4: 'warning' }; const STATUS_VALUES = { 2: '$secondary', 3: 'positive', 4: 'warning' };
const status = STATUS_VALUES[total - 2]; const status = STATUS_VALUES[total - 2];
if (!status) return 'not-match'; if (!status) return 'white';
return status; return status;
}; };
const conditionalValue = (tag) => (tag === 1 ? 'match' : 'not-match'); const conditionalValue = (tag) => (tag === 1 ? 'match' : 'not-match');
const conditionalValuePrice = ({ price2, priceOld }) =>
price2 > priceOld * 1.3 ? 'match' : 'not-match';
const columns = computed(() => [ const columns = computed(() => [
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
@ -89,8 +91,7 @@ const columns = computed(() => [
...defaultColumnAttrs, ...defaultColumnAttrs,
label: t('proposal.status'), label: t('proposal.status'),
name: 'status', name: 'status',
field: 'status', field: statusConditionalValue,
classes: statusConditionalValue,
}, },
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
@ -149,6 +150,7 @@ const columns = computed(() => [
label: t('proposal.price2'), label: t('proposal.price2'),
name: 'price2', name: 'price2',
field: 'price2', field: 'price2',
classes: ({ match8 }) => conditionalValuePrice(match8),
}, },
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
@ -180,8 +182,7 @@ const columns = computed(() => [
}, },
}" }"
auto-load auto-load
@on-fetch="(data) => (itemsProposal = data)" @on-fetch="(data) => (itemsProposal = data)" />
/>
<QTable <QTable
:rows="itemsProposal" :rows="itemsProposal"
:columns="columns" :columns="columns"
@ -211,11 +212,15 @@ const columns = computed(() => [
</QTr> </QTr>
</template> </template>
<template #body-cell-itemId="props"> <template #body-cell-status="{ value }">
<QTd class="col">{{ props }}</QTd> <QTd class="col" align="center">
</template> <div
</QTable></QCardSection :style="{ 'background-color': value }"
> style="height: 10px"
></div>
</QTd>
</template> </QTable
></QCardSection>
</QCard> </QCard>
</QDialog> </QDialog>
</template> </template>

View File

@ -12,14 +12,17 @@ itemDiary:
since: Since since: Since
warehouse: Warehouse warehouse: Warehouse
proposal: proposal:
itemFk: itemFk itemFk: Item
longName: longName longName: Name
subName: subName subName: Producer
value5: value5 value5: value5
value6: value6 value6: value6
value7: value7 value7: value7
value8: value8 value8: value8
available: available available: Available
minQuantity: minQuantity minQuantity: minQuantity
price2: price2 price2: price2
located: located located: Located
counter: Counter
groupingPrice: Grouping Price
itemOldPrice: itemOld Price

View File

@ -12,14 +12,17 @@ itemDiary:
since: Desde since: Desde
warehouse: Almacén warehouse: Almacén
proposal: proposal:
itemFk: itemFk itemFk: Item
longName: longName longName: Nombre
subName: subName subName: Productor
value5: value5 value5: value5
value6: value6 value6: value6
value7: value7 value7: value7
value8: value8 value8: value8
available: available available: Dispnible
minQuantity: minQuantity minQuantity: minQuantity
price2: price2 price2: price2
located: located located: Ubicado
counter: Contador
groupingPrice: Precio Grouping
itemOldPrice: Precio itemOld