feat: refs #6321 updates requested

This commit is contained in:
Javier Segarra 2025-02-06 00:33:43 +01:00
parent d8bc37b627
commit b8f2df59cd
6 changed files with 35 additions and 26 deletions

View File

@ -30,6 +30,9 @@ const $props = defineProps({
}, },
}); });
const proposalSelected = ref([]); const proposalSelected = ref([]);
const ticketConfig = ref({});
const proposalTableRef = ref(null);
const sale = computed(() => $props.sales[0]); const sale = computed(() => $props.sales[0]);
const saleFk = computed(() => sale.value.saleFk); const saleFk = computed(() => sale.value.saleFk);
const filter = computed(() => ({ const filter = computed(() => ({
@ -37,11 +40,14 @@ const filter = computed(() => ({
sales: saleFk.value, sales: saleFk.value,
})); }));
const proposalTableRef = ref(null);
const defaultColumnAttrs = { const defaultColumnAttrs = {
align: 'center', align: 'center',
sortable: false, sortable: false,
}; };
const emit = defineEmits(['onDialogClosed', 'itemReplaced']);
const conditionalValuePrice = (price) => (price > 1.3 ? 'match' : 'not-match');
const columns = computed(() => [ const columns = computed(() => [
{ {
...defaultColumnAttrs, ...defaultColumnAttrs,
@ -175,9 +181,17 @@ const statusConditionalValue = (row) => {
return 100 * (value / matches.length); return 100 * (value / matches.length);
}; };
const emit = defineEmits(['onDialogClosed', 'itemReplaced']); const isSelectionAvailable = (itemProposal) => {
const { price2 } = itemProposal;
const conditionalValuePrice = (price) => (price > 1.3 ? 'match' : 'not-match'); const salePrice = sale.value.price;
const byPrice = (100 * price2) / salePrice > ticketConfig.value.lackAlertPrice;
if (byPrice) {
return byPrice;
}
const byQuantity =
(100 * itemProposal.available) / Math.abs($props.itemLack.lack) < 30;
return byQuantity;
};
async function change({ itemFk: substitutionFk }) { async function change({ itemFk: substitutionFk }) {
try { try {
@ -202,18 +216,7 @@ async function change({ itemFk: substitutionFk }) {
console.error(error); console.error(error);
} }
} }
const ticketConfig = ref({});
const isSelectionAvailable = (itemProposal) => {
const { price2 } = itemProposal;
const salePrice = sale.value.price;
const byPrice = (100 * price2) / salePrice > ticketConfig.value.lackAlertPrice;
if (byPrice) {
return byPrice;
}
const byQuantity =
(100 * itemProposal.available) / Math.abs($props.itemLack.lack) < 30;
return byQuantity;
};
async function handleTicketConfig(data) { async function handleTicketConfig(data) {
ticketConfig.value = data[0]; ticketConfig.value = data[0];
} }

View File

@ -14,7 +14,7 @@ import TicketLackTable from './TicketLackTable.vue';
import VnPopupProxy from 'src/components/common/VnPopupProxy.vue'; import VnPopupProxy from 'src/components/common/VnPopupProxy.vue';
import ItemProposalProxy from 'src/pages/Item/components/ItemProposalProxy.vue'; import ItemProposalProxy from 'src/pages/Item/components/ItemProposalProxy.vue';
import { useQuasar } from 'quasar'; import { date, useQuasar } from 'quasar';
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const editableStates = ref([]); const editableStates = ref([]);
@ -65,7 +65,13 @@ const showItemProposal = () => {
}) })
.onOk(itemProposalEvt); .onOk(itemProposalEvt);
}; };
const filterTable = { stateFk: 0, warehouseFk: useState().getUser().value.warehouseFk }; const filterTable = {
scopeDays: 2,
showType: true,
alertLevelCode: 'FREE',
date: Date.vnNew(),
warehouseFk: useState().getUser().value.warehouseFk,
};
</script> </script>
<template> <template>

View File

@ -95,13 +95,13 @@ const columns = computed(() => [
name: 'alertLevelCode', name: 'alertLevelCode',
label: t('negative.detail.state'), label: t('negative.detail.state'),
columnFilter: { columnFilter: {
name: 'stateFk', name: 'alertLevelCode',
component: 'select', component: 'select',
attrs: { attrs: {
url: 'AlertLevels', url: 'AlertLevels',
fields: ['id', 'code'], fields: ['name', 'code'],
optionLabel: 'code', optionLabel: 'code',
optionValue: 'id', optionValue: 'code',
}, },
}, },
columnClass: 'expand', columnClass: 'expand',
@ -265,14 +265,14 @@ function onBuysFetched(data) {
<QTooltip>{{ t('negative.detail.hasToIgnore') }}</QTooltip> <QTooltip>{{ t('negative.detail.hasToIgnore') }}</QTooltip>
</QIcon> </QIcon>
<QIcon <QIcon
v-if="row.hasSubstitution" v-if="row.hasObservation"
name="change_circle" name="change_circle"
color="primary" color="primary"
class="cursor-pointer" class="cursor-pointer"
size="xs" size="xs"
> >
<QTooltip>{{ <QTooltip>{{
t('negative.detail.hasSubstitution') t('negative.detail.hasObservation')
}}</QTooltip> </QIcon }}</QTooltip> </QIcon
><QIcon ><QIcon
v-if="row.isRookie" v-if="row.isRookie"

View File

@ -239,7 +239,7 @@ negative:
isRookie: 'Is rookie' isRookie: 'Is rookie'
turno: 'Turn line' turno: 'Turn line'
isBasket: 'Basket' isBasket: 'Basket'
hasSubstitution: 'Has substitution' hasObservation: 'Has substitution'
hasToIgnore: VIP hasToIgnore: VIP
modal: modal:
changeItem: changeItem:

View File

@ -267,7 +267,7 @@ negative:
isRookie: 'Cliente nuevo' isRookie: 'Cliente nuevo'
turno: 'Linea turno' turno: 'Linea turno'
isBasket: 'Cesta' isBasket: 'Cesta'
hasSubstitution: 'Tiene sustitución' hasObservation: 'Tiene sustitución'
hasToIgnore: VIP hasToIgnore: VIP
modal: modal:
changeItem: changeItem:

View File

@ -28,7 +28,7 @@ describe('Ticket Lack detail', () => {
isRookie: 1, isRookie: 1,
turno: 1, turno: 1,
peticionCompra: 1, peticionCompra: 1,
hasSubstitution: 1, hasObservation: 1,
hasToIgnore: 1, hasToIgnore: 1,
isBasket: 1, isBasket: 1,
minTimed: 0, minTimed: 0,