feat: minor updates
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

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

View File

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

View File

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