feat: substitution icons
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-07-04 09:39:27 +02:00
parent 8714be1fa7
commit 189784872f
3 changed files with 44 additions and 123 deletions

View File

@ -1,17 +1,14 @@
<script setup> <script setup>
import { computed, nextTick, onMounted, onUnmounted, ref, toRefs } from 'vue'; import { computed, nextTick, onMounted, onUnmounted, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox, useQuasar } from 'quasar'; import { QBtn, QCheckbox } from 'quasar';
import axios from 'axios'; import axios from 'axios';
import HandleSplited from 'pages/Ticket/Negative/components/HandleSplited.vue';
import ChangeQuantityDialog from 'pages/Ticket/Negative/components/ChangeQuantityDialog.vue'; import ChangeQuantityDialog from 'pages/Ticket/Negative/components/ChangeQuantityDialog.vue';
import ChangeStateDialog from 'pages/Ticket/Negative/components/ChangeStateDialog.vue'; import ChangeStateDialog from 'pages/Ticket/Negative/components/ChangeStateDialog.vue';
import ItemProposal from 'pages/Item/components/ItemProposal.vue'; import ItemProposal from 'pages/Item/components/ItemProposal.vue';
import { useVnConfirm } from 'composables/useVnConfirm';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import TickerSplit from '../Card/TicketSplit.vue';
import TicketTransfer from '../Card/TicketTransfer.vue'; import TicketTransfer from '../Card/TicketTransfer.vue';
import TicketMassiveUpdate from '../Card/TicketMassiveUpdate.vue'; import TicketMassiveUpdate from '../Card/TicketMassiveUpdate.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
@ -26,46 +23,26 @@ import { useDialogPluginComponent } from 'quasar';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import ZoneDescriptorProxy from 'pages/Zone/Card/ZoneDescriptorProxy.vue'; import ZoneDescriptorProxy from 'pages/Zone/Card/ZoneDescriptorProxy.vue';
const { openConfirmationModal } = useVnConfirm();
const { t } = useI18n(); const { t } = useI18n();
const URL_KEY = 'Tickets/ItemLack'; const URL_KEY = 'Tickets/ItemLack';
const editableStates = ref([]); const editableStates = ref([]);
const { notify } = useNotify(); const { notify } = useNotify();
const stateStore = useStateStore(); const stateStore = useStateStore();
const proposalDialogRef = ref(); const proposalDialogRef = ref();
const splitDialogRef = ref();
const changeStateDialogRef = ref(); const changeStateDialogRef = ref();
const changeQuantityDialogRef = ref(); const changeQuantityDialogRef = ref();
const showSplitDialog = ref(false);
const showProposalDialog = ref(false); const showProposalDialog = ref(false);
const showChangeQuantityDialog = ref(false); const showChangeQuantityDialog = ref(false);
const showChangeStateDialog = ref(false);
const componentIsRendered = ref(false); const componentIsRendered = ref(false);
const showFree = ref(true); const showFree = ref(true);
const resultSplit = ref([]);
const selectedRows = ref([]); const selectedRows = ref([]);
const session = useSession(); const session = useSession();
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import VnRow from 'src/components/ui/VnRow.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
const route = useRoute(); const route = useRoute();
const token = session.getTokenMultimedia(); const token = session.getTokenMultimedia();
const itemLack = ref(null); const itemLack = ref(null);
const originalRowDataCopy = ref(null); const originalRowDataCopy = ref(null);
// const $props = defineProps({
// item: {
// type: Number,
// required: true,
// },
// filter: {
// type: Object,
// required: false,
// default: () => {
// true;
// },
// },
// });
onMounted(() => { onMounted(() => {
stateStore.rightDrawer = false; stateStore.rightDrawer = false;
nextTick(() => { nextTick(() => {
@ -86,11 +63,6 @@ const getInputEvents = (colField, props) => ({
const saveChange = async (field, { rowIndex, row }) => { const saveChange = async (field, { rowIndex, row }) => {
try { try {
switch (field) { switch (field) {
// case 'split':
// showSplitDialog.value =true
// // await split({ simple: true }, [row]);
// break;
case 'code': case 'code':
await axios.post(`Tickets/state`, { await axios.post(`Tickets/state`, {
ticketFk: row.ticketFk, ticketFk: row.ticketFk,
@ -119,10 +91,6 @@ function isComponentVn(col) {
return tableColumnComponents?.value[col.name]?.component === 'span' ?? false; return tableColumnComponents?.value[col.name]?.component === 'span' ?? false;
} }
// const onDetailDialogHide = (evt) => {
// if (evt?.type === 'refresh') ticketDetailRef.value.reload();
// };
const tableColumnComponents = computed(() => ({ const tableColumnComponents = computed(() => ({
status: { status: {
component: 'span', component: 'span',
@ -195,7 +163,7 @@ const tableColumnComponents = computed(() => ({
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'status', name: 'status',
align: 'center', align: 'left',
sortable: false, sortable: false,
}, },
{ {
@ -251,46 +219,13 @@ const columns = computed(() => [
style: 'width: 100px', style: 'width: 100px',
}, },
]); ]);
const { dialogRef, onDialogHide } = useDialogPluginComponent();
// const { filter } = toRefs($props);
const emit = defineEmits([...useDialogPluginComponent.emits, 'selection', 'close']); const emit = defineEmits([...useDialogPluginComponent.emits, 'selection', 'close']);
function rowsHasSelected(selection) { function rowsHasSelected(selection) {
emit( emit('selection', selection);
'selection',
selection
//.map(({ ticketFk }) => ticketFk)
);
} }
const itemLackForm = ref(); const itemLackForm = ref();
// const split = async ({ simple }, data = []) => {
// openConfirmationModal(
// t('negative.detail.split.confirmSplitSelected'),
// t('negative.detail.split.splitQuestion'),
// null,
// () => {
// showSplitDialog.value = true;
// resultSplit.value = [{}];
// // const body = simple ? data : selectedRows.value;
// // axios.post(`Tickets/split`, body).then((data) => {
// // resultSplit.value = data;
// // });
// }
// );
// };
// const split = async ({ simple }, data = []) => {
// openConfirmationModal(
// t('negative.modalSplit.title'),
// t('splitQuestion'),
// () => {
// const body = simple ? data : selectedRows.value;
// axios.post(`Tickets/split`, body).then((data) => {
// resultSplit.value = data;
// });
// }
// );
// };
const reload = async () => { const reload = async () => {
itemLackForm.value.fetch(); itemLackForm.value.fetch();
}; };
@ -315,25 +250,7 @@ const handleRows = (rows) => {
if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0); if (showFree.value) return rows.filter(({ alertLevel }) => alertLevel === 0);
return rows.sort(freeFirst); return rows.sort(freeFirst);
}; };
const quasar = useQuasar();
const split = async () => {
const body = selectedRows.value;
// const {data} = await axios.post(`Tickets/split`, body);
// resultSplit.value = data;
resultSplit.value = [
{ ticket: 32, newTicket: 1000005, status: 'split' },
{ ticket: 32, newTicket: 1000006, status: 'noSplit' },
{ ticket: 32, newTicket: 1000007, status: 'error' },
];
quasar.dialog({
component: HandleSplited,
componentProps: {
tickets: resultSplit.value,
},
});
};
const itemProposalEvt = ({ itemProposal }) => { const itemProposalEvt = ({ itemProposal }) => {
itemProposalSelected.value = itemProposal; itemProposalSelected.value = itemProposal;
replaceItem(); replaceItem();
@ -391,18 +308,6 @@ const replaceItem = () => {
" "
auto-load auto-load
/> />
<!-- <Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()">
<QBtnGroup push style="column-gap: 1px"
><QBtn
:label="t('proposal.replace')"
@click="emit('close')"
color="primary"
icon="save"
>
<QTooltip>{{ t('globals.cancel') }}</QTooltip>
</QBtn></QBtnGroup
>
</Teleport> -->
<VnSubToolbar> <VnSubToolbar>
<template #st-data> <template #st-data>
<QBtnGroup push style="column-gap: 1px"> <QBtnGroup push style="column-gap: 1px">
@ -494,7 +399,6 @@ const replaceItem = () => {
@on-fetch="copyOriginalRowsData" @on-fetch="copyOriginalRowsData"
auto-load auto-load
> >
<!-- :rows="rows" -->
<template #body="{ rows }"> <template #body="{ rows }">
<VnLv class="q-mb-lg image"> <VnLv class="q-mb-lg image">
<template #label> <template #label>
@ -523,17 +427,6 @@ const replaceItem = () => {
<FetchedTags class="q-ml-md" :item="item" :max-length="5" /> <FetchedTags class="q-ml-md" :item="item" :max-length="5" />
</template> </template>
</VnLv> </VnLv>
<!-- <ItemDescriptorProxy :id="entityId" />
<span class="text-h6">{{ item.longName }}</span>
<span class="text-h6"
><sub>{{ item.longName }}</sub></span
> -->
<!-- <VnRow style="align-items: center">
<div>
</div>
<QIcon name="arrow_right" size="lg" />
<VnSelectDialog action-icon="call_split"></VnSelectDialog
></VnRow> -->
<TransitionGroup name="list" tag="div"> <TransitionGroup name="list" tag="div">
<QTable <QTable
ref="tableRef" ref="tableRef"
@ -549,15 +442,30 @@ const replaceItem = () => {
<template #body="props"> <template #body="props">
<QTr> <QTr>
<QTd> <QTd>
<!-- <QIcon
v-if="resultSplit.length > 0"
:name="getIcon(props.key, 'name')"
:color="getIcon(props.key, 'color')"
class="fill-icon q-mr-sm"
size="xs"
style="font-weight: bold"
/> -->
<QCheckbox v-model="props.selected" /> <QCheckbox v-model="props.selected" />
<QIcon
v-if="props.row.substitutionAllowed === 1"
name="help"
size="xs"
color="primary"
>
<QTooltip>{{
t('Disabled substitution')
}}</QTooltip>
</QIcon>
<QIcon
v-if="
props.row.obserbationTypeCode ===
'substitution'
"
name="help"
size="xs"
color="primary"
>
<QTooltip>{{
t('Substitution Observation')
}}</QTooltip>
</QIcon>
</QTd> </QTd>
<QTd v-for="col in props.cols" :key="col.name"> <QTd v-for="col in props.cols" :key="col.name">
<template <template

View File

@ -50,6 +50,7 @@ const originDialogRef = ref();
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'date', name: 'date',
align: 'left',
label: t('negative.date'), label: t('negative.date'),
field: 'timed', field: 'timed',
format: ({ timed }) => toDate(timed), format: ({ timed }) => toDate(timed),
@ -59,6 +60,7 @@ const columns = computed(() => [
}, },
{ {
name: 'timed', name: 'timed',
align: 'left',
label: t('negative.timed'), label: t('negative.timed'),
field: 'timed', field: 'timed',
format: ({ timed }) => toHour(timed), format: ({ timed }) => toHour(timed),
@ -67,12 +69,14 @@ const columns = computed(() => [
}, },
{ {
name: 'itemFk', name: 'itemFk',
align: 'left',
label: t('negative.id'), label: t('negative.id'),
field: ({ itemFk }) => itemFk, field: ({ itemFk }) => itemFk,
sortable: true, sortable: true,
}, },
{ {
name: 'longName', name: 'longName',
align: 'left',
label: t('negative.longName'), label: t('negative.longName'),
field: ({ longName }) => longName, field: ({ longName }) => longName,
columnField: { columnField: {
@ -85,20 +89,20 @@ const columns = computed(() => [
}, },
}, },
}, },
sortable: true, sortable: true,
headerStyle: 'width: 350px', headerStyle: 'width: 350px',
cardVisible: true, cardVisible: true,
}, },
{ {
name: 'producer', name: 'producer',
align: 'left',
label: t('negative.supplier'), label: t('negative.supplier'),
field: ({ producer }) => dashIfEmpty(producer), field: ({ producer }) => dashIfEmpty(producer),
sortable: true, sortable: true,
}, },
{ {
name: 'inkFk', name: 'inkFk',
align: 'left',
label: t('negative.colour'), label: t('negative.colour'),
field: ({ inkFk }) => inkFk, field: ({ inkFk }) => inkFk,
sortable: true, sortable: true,
@ -106,6 +110,7 @@ const columns = computed(() => [
}, },
{ {
name: 'size', name: 'size',
align: 'left',
label: t('negative.size'), label: t('negative.size'),
field: ({ size }) => size, field: ({ size }) => size,
sortable: true, sortable: true,
@ -113,6 +118,7 @@ const columns = computed(() => [
}, },
{ {
name: 'category', name: 'category',
align: 'left',
label: t('negative.origen'), label: t('negative.origen'),
field: ({ category }) => dashIfEmpty(category), field: ({ category }) => dashIfEmpty(category),
sortable: true, sortable: true,
@ -120,6 +126,7 @@ const columns = computed(() => [
}, },
{ {
name: 'lack', name: 'lack',
align: 'left',
label: t('negative.lack'), label: t('negative.lack'),
field: ({ lack }) => lack, field: ({ lack }) => lack,
@ -128,8 +135,8 @@ const columns = computed(() => [
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'right',
name: 'tableActions', name: 'tableActions',
align: 'left',
actions: [ actions: [
{ {
title: t('Client ticket list'), title: t('Client ticket list'),

View File

@ -58,7 +58,13 @@ const update = async () => {
<QSelect <QSelect
:label="t('globals.reason')" :label="t('globals.reason')"
v-model="reason" v-model="reason"
:options="['FALTAS', 'CONTENEDOR', 'ENTRADAS', 'OVERBOOKING']" :options="[
'FALTAS',
'CONTENEDOR',
'ENTRADAS',
'OVERBOOKING',
'SUSTITUCION',
]"
/> />
</QCardSection> </QCardSection>
<QCardActions align="right"> <QCardActions align="right">