feat: refs #6321 updates

This commit is contained in:
Javier Segarra 2025-01-28 14:04:56 +01:00
parent 9e6b174ae6
commit a46e5b07f9
5 changed files with 99 additions and 60 deletions

View File

@ -368,6 +368,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
<slot name="top-left"></slot> <slot name="top-left"></slot>
</template> </template>
<template #top-right v-if="!$props.withoutHeader"> <template #top-right v-if="!$props.withoutHeader">
<slot name="top-right"></slot>
<VnVisibleColumn <VnVisibleColumn
v-if="isTableMode" v-if="isTableMode"
v-model="splittedColumns.columns" v-model="splittedColumns.columns"

View File

@ -1,4 +1,3 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
@ -52,11 +51,7 @@ const exprBuilder = (param, value) => {
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection>
<VnInput <VnInput :label="t('Name')" v-model="params.name" is-outlined />
:label="t('globals.name')"
v-model="params.name"
is-outlined
/>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">

View File

@ -1,9 +1,19 @@
<script setup> <script setup>
import ItemProposal from './ItemProposal.vue'; import ItemProposal from './ItemProposal.vue';
import { ref } from 'vue'; import { ref } from 'vue';
const emit = defineEmits(['onDialogClosed', 'itemReplaced']);
const popupProxyRef = ref(null); const popupProxyRef = ref(null);
import { useDialogPluginComponent } from 'quasar';
const emit = defineEmits([
'onDialogClosed',
'itemReplaced',
'confirm',
'cancel',
...useDialogPluginComponent.emits,
]);
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } =
useDialogPluginComponent();
const $props = defineProps({ const $props = defineProps({
itemLack: { itemLack: {
type: Object, type: Object,
@ -23,19 +33,33 @@ const $props = defineProps({
}); });
</script> </script>
<template> <template>
<QPopupProxy ref="popupProxyRef" data-cy="itemProposalProxy"> <QDialog ref="dialogRef" full-width transition-show="scale" transition-hide="scale">
<QCard> <QCard>
<QCardSection class="row items-center q-pb-none">
<span class="text-h6 text-grey">{{ $t('Item proposal') }}</span>
<QSpace />
<QBtn icon="close" flat round dense v-close-popup />
</QCardSection>
<QCardSection> <QCardSection>
<!-- <VnImg :id="itemLack.id" class="rounded image-wrapper"></VnImg>
<QBtn flat class="link text-blue">
{{ itemLack.longName }}
<ItemDescriptorProxy :id="itemLack.id" />
</QBtn>
<FetchedTags :item="itemLack" />
</QCardSection>
<QCardSection class="q-pt-none"> -->
<ItemProposal <ItemProposal
v-bind="$props" v-bind="$props"
@item-replaced=" @item-replaced="
(data) => { (data) => {
emit('itemReplaced', data); emit('itemReplaced', data);
popupProxyRef.hide(); popupProxyRef.value.hide();
} }
" "
></ItemProposal ></ItemProposal
></QCardSection> ></QCardSection>
</QCard> </QCard>
</QPopupProxy> </QDialog>
</template> </template>

View File

@ -18,6 +18,8 @@ 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';
import { useQuasar } from 'quasar';
const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const editableStates = ref([]); const editableStates = ref([]);
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -104,6 +106,18 @@ const closeDialogs = (refs, evt) => {
changeStateDialogRef.value.hide(); changeStateDialogRef.value.hide();
}; };
const showItemProposal = () => {
quasar
.dialog({
component: ItemProposalProxy,
componentProps: {
itemLack: itemLack.value,
replaceAction: true,
sales: selectedRows.value,
},
})
.onOk(itemProposalEvt);
};
const filterTable = { stateFk: 0, warehouseFk: useState().getUser().value.warehouseFk }; const filterTable = { stateFk: 0, warehouseFk: useState().getUser().value.warehouseFk };
</script> </script>
@ -132,8 +146,17 @@ const filterTable = { stateFk: 0, warehouseFk: useState().getUser().value.wareho
@on-fetch="(data) => (itemLack = data[0])" @on-fetch="(data) => (itemLack = data[0])"
auto-load auto-load
/> />
<VnSubToolbar> <!-- <VnSubToolbar>
<template #st-data> <template #st-data> </template>
<template #st-actions> </template>
</VnSubToolbar> -->
<TicketLackTable
ref="tableRef"
:filter="filterTable"
@update:selection="({ value }, _) => (selectedRows = value)"
>
<template #top-right>
<QBtnGroup push class="q-mr-lg" style="column-gap: 1px">
<QBtn <QBtn
data-cy="transferLines" data-cy="transferLines"
color="primary" color="primary"
@ -153,26 +176,26 @@ const filterTable = { stateFk: 0, warehouseFk: useState().getUser().value.wareho
></TicketTransfer> ></TicketTransfer>
</QBtn> </QBtn>
<QBtn <QBtn
data-cy="itemProposal"
color="primary" color="primary"
@click="showProposalDialog = true" @click="showProposalDialog = true"
:disable="selectedRows.length < 1" :disable="selectedRows.length < 1"
> >
<QIcon name="import_export" class="rotate-90"></QIcon> <QIcon
<ItemProposalProxy name="import_export"
class="rotate-90"
@click="showItemProposal"
></QIcon>
<!-- <ItemProposalProxy
ref="proposalDialogRef" ref="proposalDialogRef"
:item-lack="itemLack" :item-lack="itemLack"
:replace-action="true" :replace-action="true"
:sales="selectedRows" :sales="selectedRows"
@item-replaced="itemProposalEvt" @item-replaced="itemProposalEvt"
></ItemProposalProxy> ></ItemProposalProxy> -->
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('itemProposal') }} {{ t('itemProposal') }}
</QTooltip> </QTooltip>
</QBtn> </QBtn>
</template>
<template #st-actions>
<QBtnGroup push style="column-gap: 1px">
<VnPopupProxy <VnPopupProxy
data-cy="changeItem" data-cy="changeItem"
icon="refresh" icon="refresh"
@ -215,15 +238,8 @@ const filterTable = { stateFk: 0, warehouseFk: useState().getUser().value.wareho
@update-quantity="popup.hide()" @update-quantity="popup.hide()"
:selected-rows="selectedRows" :selected-rows="selectedRows"
/></template> /></template>
</VnPopupProxy> </VnPopupProxy> </QBtnGroup
</QBtnGroup> ></template>
</template>
</VnSubToolbar>
<TicketLackTable
ref="tableRef"
:filter="filterTable"
@update:selection="({ value }, _) => (selectedRows = value)"
>
<template #top-left> <template #top-left>
<div style="display: flex; align-items: center" v-if="itemLack"> <div style="display: flex; align-items: center" v-if="itemLack">
<VnImg :id="itemLack.itemFk" class="rounded image-wrapper"></VnImg> <VnImg :id="itemLack.itemFk" class="rounded image-wrapper"></VnImg>

View File

@ -255,6 +255,9 @@ function onBuysFetched(data) {
<template #top-left> <template #top-left>
<slot name="top-left" /> <slot name="top-left" />
</template> </template>
<template #top-right>
<slot name="top-right" />
</template>
<template #column-status="{ row }"> <template #column-status="{ row }">
<QTd style="width: 150px"> <QTd style="width: 150px">