#6321 - Negative ticket #158

Open
jsegarra wants to merge 197 commits from 6321_negative_tickets into dev
3 changed files with 33 additions and 29 deletions
Showing only changes of commit 0a4da26d3d - Show all commits

View File

@ -171,7 +171,8 @@ onMounted(() => {
}); });
Review

formato

formato
const arrayDataKey = const arrayDataKey =
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label); $props.dataKey ??
($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label));
const arrayData = useArrayData(arrayDataKey, { const arrayData = useArrayData(arrayDataKey, {
url: $props.url, url: $props.url,
@ -220,7 +221,7 @@ async function fetchFilter(val) {
optionFilterValue.value ?? optionFilterValue.value ??
(new RegExp(/\d/g).test(val) (new RegExp(/\d/g).test(val)
? optionValue.value ? optionValue.value
: optionFilter.value ?? optionLabel.value); : (optionFilter.value ?? optionLabel.value));
let defaultWhere = {}; let defaultWhere = {};
if ($props.filterOptions.length) { if ($props.filterOptions.length) {
@ -239,7 +240,7 @@ async function fetchFilter(val) {
const { data } = await arrayData.applyFilter( const { data } = await arrayData.applyFilter(
{ filter: filterOptions }, { filter: filterOptions },
{ updateRouter: false } { updateRouter: false },
); );
setOptions(data); setOptions(data);
return data; return data;
@ -272,7 +273,7 @@ async function filterHandler(val, update) {
ref.setOptionIndex(-1); ref.setOptionIndex(-1);
ref.moveOptionSelection(1, true); ref.moveOptionSelection(1, true);
} }
} },
); );
} }
@ -308,7 +309,7 @@ function handleKeyDown(event) {
if (inputValue) { if (inputValue) {
const matchingOption = myOptions.value.find( const matchingOption = myOptions.value.find(
(option) => (option) =>
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase() option[optionLabel.value].toLowerCase() === inputValue.toLowerCase(),
); );
if (matchingOption) { if (matchingOption) {
@ -320,11 +321,11 @@ function handleKeyDown(event) {
} }
const focusableElements = document.querySelectorAll( const focusableElements = document.querySelectorAll(
'a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])' 'a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])',
); );
const currentIndex = Array.prototype.indexOf.call( const currentIndex = Array.prototype.indexOf.call(
focusableElements, focusableElements,
event.target event.target,
); );
if (currentIndex >= 0 && currentIndex < focusableElements.length - 1) { if (currentIndex >= 0 && currentIndex < focusableElements.length - 1) {
focusableElements[currentIndex + 1].focus(); focusableElements[currentIndex + 1].focus();
@ -333,8 +334,8 @@ function handleKeyDown(event) {
} }
function getCaption(opt) { function getCaption(opt) {
if (optionCaption.value === false) return; if (optionCaption.value === false && typeof optionCaption.value !== 'string') return;
return opt[optionCaption.value] || opt[optionValue.value]; return '' + (opt[optionCaption.value] || opt[optionValue.value]);
} }
</script> </script>

View File

@ -11,12 +11,10 @@ import { useStateStore } from 'stores/useStateStore';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import TicketLackTable from './TicketLackTable.vue'; import TicketLackTable from './TicketLackTable.vue';
import VnPopupProxy from 'src/components/common/VnPopupProxy.vue'; import VnPopupProxy from 'src/components/common/VnPopupProxy.vue';
import { useQuasar } from 'quasar'; import ItemProposalProxy from 'src/pages/Item/components/ItemProposalProxy.vue';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnImg from 'src/components/ui/VnImg.vue'; import VnImg from 'src/components/ui/VnImg.vue';
const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const editableStates = ref([]); const editableStates = ref([]);
@ -100,17 +98,10 @@ function onBuysFetched(data) {
Object.assign(item.value, data[0]); Object.assign(item.value, data[0]);
} }
const showItemProposal = () => { const closeDialogs = (refs, evt) => {
quasar changeItemDialogRef.value.hide();
.dialog({ changeQuantityDialogRef.value.hide();
component: ItemProposalProxy, changeStateDialogRef.value.hide();
componentProps: {
itemLack: itemLack.value,
replaceAction: true,
sales: selectedRows.value,
},
})
.onOk(itemProposalEvt);
}; };
</script> </script>
@ -220,16 +211,16 @@ const showItemProposal = () => {
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</QBtnGroup> </QBtnGroup>
<QCheckbox <!-- <QCheckbox
v-model="showFree" v-model="showFree"
data-cy="showFree" data-cy="showFree"
:label="t('negative.detail.showFree')" :label="t('negative.detail.showFree')"
/> /> -->
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<TicketLackTable <TicketLackTable
ref="tableRef" ref="tableRef"
:filter="{ alertLevel: showFree }" :filter="{ stateFk: 0 }"
@update:selection="({ value }, _) => (selectedRows = value)" @update:selection="({ value }, _) => (selectedRows = value)"
> >
<template #top-left> <template #top-left>

View File

@ -36,7 +36,7 @@ const filterLack = ref({
}, },
}, },
], ],
where: { alertLevel: 'FREE' }, where: { ...$props.filter },
order: 'ts.alertLevelCODE ASC', order: 'ts.alertLevelCODE ASC',
}); });
@ -73,6 +73,7 @@ const saveChange = async (field, { rowIndex, row }) => {
notify('globals.dataSaved', 'positive'); notify('globals.dataSaved', 'positive');
} catch (err) { } catch (err) {
console.error('Error saving changes', err); console.error('Error saving changes', err);
f;
} }
}; };
const entityId = computed(() => route.params.id); const entityId = computed(() => route.params.id);
@ -165,7 +166,17 @@ const columns = computed(() => [
{ {
name: 'alertLevelCode', name: 'alertLevelCode',
label: t('negative.detail.state'), label: t('negative.detail.state'),
columnFilter: {
name: 'stateFk',
component: 'select',
attrs: {
url: 'AlertLevels',
fields: ['id', 'code'],
optionLabel: 'code',
optionValue: 'id',
},
},
columnClass: 'expand',
align: 'left', align: 'left',
sortable: true, sortable: true,
}, },
@ -246,7 +257,9 @@ function onBuysFetched(data) {
:is-editable="true" :is-editable="true"
:row-click="false" :row-click="false"
:right-search="false" :right-search="false"
:right-search-icon="false"
v-model:selected="selectedRows" v-model:selected="selectedRows"
:disable-option="{ card: true }"
> >
<template #top-left> <template #top-left>
<slot name="top-left" /> <slot name="top-left" />
@ -263,7 +276,6 @@ function onBuysFetched(data) {
> >
<QTooltip>{{ t('negative.detail.isBasket') }}</QTooltip> <QTooltip>{{ t('negative.detail.isBasket') }}</QTooltip>
</QIcon> </QIcon>
<!-- -->
<QIcon <QIcon
v-if="row.hasToIgnore" v-if="row.hasToIgnore"
name="star" name="star"