feat: fix minor bugs
gitea/salix-front/pipeline/pr-master This commit is unstable
Details
gitea/salix-front/pipeline/pr-master This commit is unstable
Details
This commit is contained in:
parent
b32a889dfe
commit
510eab8af0
|
@ -28,6 +28,7 @@ const props = defineProps({
|
|||
|
||||
onMounted(() => {
|
||||
restoreTicket();
|
||||
hasDocuware();
|
||||
});
|
||||
|
||||
watch(
|
||||
|
|
|
@ -768,6 +768,7 @@ watch(
|
|||
v-model="row.itemFk"
|
||||
:use-like="false"
|
||||
@update:model-value="changeItem(row)"
|
||||
autofocus
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
|
|
@ -25,7 +25,13 @@ const splitSelectedRows = async () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<VnInputDate class="q-mr-sm" :label="$t('New date')" v-model="splitDate" clearable />
|
||||
<VnInputDate
|
||||
class="q-mr-sm"
|
||||
:label="$t('New date')"
|
||||
v-model="splitDate"
|
||||
clearable
|
||||
autofocus
|
||||
/>
|
||||
<QBtn class="q-mr-sm" color="primary" label="Split" @click="splitSelectedRows"></QBtn>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import TicketTransfer from './TicketTransfer.vue';
|
||||
import Split from './TicketSplit.vue';
|
||||
import TicketSplit from './TicketSplit.vue';
|
||||
const emit = defineEmits(['ticketTransferred']);
|
||||
|
||||
const $props = defineProps({
|
||||
|
@ -35,7 +35,7 @@ const transferRef = ref(null);
|
|||
<template>
|
||||
<QPopupProxy ref="popupProxyRef" data-cy="ticketTransferPopup">
|
||||
<div class="flex row items-center q-ma-lg" v-if="$props.split">
|
||||
<Split
|
||||
<TicketSplit
|
||||
ref="splitRef"
|
||||
@splitSelectedRows="splitSelectedRows"
|
||||
:ticket="$props.ticket"
|
||||
|
|
|
@ -124,7 +124,7 @@ const showItemProposal = () => {
|
|||
<QBtn
|
||||
color="primary"
|
||||
@click="showItemProposal"
|
||||
:disable="selectedRows.length < 1"
|
||||
:disable="!(selectedRows.length === 1)"
|
||||
data-cy="itemProposal"
|
||||
>
|
||||
<QIcon name="import_export" class="rotate-90" />
|
||||
|
@ -135,7 +135,7 @@ const showItemProposal = () => {
|
|||
<VnPopupProxy
|
||||
data-cy="changeItem"
|
||||
icon="sync"
|
||||
:disable="selectedRows.length < 1"
|
||||
:disable="!(selectedRows.length === 1)"
|
||||
:tooltip="t('negative.detail.modal.changeItem.title')"
|
||||
>
|
||||
<template #extraIcon> <QIcon name="vn:item" /> </template>
|
||||
|
@ -149,7 +149,7 @@ const showItemProposal = () => {
|
|||
<VnPopupProxy
|
||||
data-cy="changeState"
|
||||
icon="sync"
|
||||
:disable="selectedRows.length < 1"
|
||||
:disable="!(selectedRows.length === 1)"
|
||||
:tooltip="t('negative.detail.modal.changeState.title')"
|
||||
>
|
||||
<template #extraIcon> <QIcon name="vn:eye" /> </template>
|
||||
|
@ -163,7 +163,7 @@ const showItemProposal = () => {
|
|||
<VnPopupProxy
|
||||
data-cy="changeQuantity"
|
||||
icon="sync"
|
||||
:disable="selectedRows.length < 1"
|
||||
:disable="!(selectedRows.length === 1)"
|
||||
:tooltip="t('negative.detail.modal.changeQuantity.title')"
|
||||
@click="showChangeQuantityDialog = true"
|
||||
>
|
||||
|
|
|
@ -48,6 +48,7 @@ const updateItem = async () => {
|
|||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="newItem"
|
||||
autofocus
|
||||
>
|
||||
</VnSelect>
|
||||
</QCardSection>
|
||||
|
|
|
@ -44,6 +44,7 @@ const updateQuantity = async () => {
|
|||
:min="0"
|
||||
:label="$t('negative.detail.modal.changeQuantity.placeholder')"
|
||||
v-model="newQuantity"
|
||||
autofocus
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
|
|
|
@ -50,6 +50,7 @@ const updateState = async () => {
|
|||
:options="editableStates"
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
autofocus
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
|
|
|
@ -4,36 +4,53 @@ import { useI18n } from 'vue-i18n';
|
|||
|
||||
export function displayResults() {
|
||||
const { t } = useI18n();
|
||||
const notifyResults = (results, key, path = 'sale') =>
|
||||
results.forEach((result, index) => {
|
||||
if (result.status === 'fulfilled') {
|
||||
const data = JSON.parse(result.value.config.data);
|
||||
if (result.value.data.status === 'noSplit') {
|
||||
Notify.create({
|
||||
type: 'warning',
|
||||
message: `Ticket ${data[key]}: ${t('negative.split.noSplit')}`,
|
||||
});
|
||||
} else
|
||||
Notify.create({
|
||||
type: 'positive',
|
||||
message: t('globals.dataSaved'),
|
||||
actions: [
|
||||
{
|
||||
label: t('globals.openDetail'),
|
||||
color: 'white',
|
||||
handler: () => {
|
||||
useOpenURL(`#/ticket/${data[key]}/${path}`);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
const data = JSON.parse(result.reason.config.data);
|
||||
Notify.create({
|
||||
type: 'negative',
|
||||
message: `Ticket ${data[key]}: ${result.reason.response?.data?.error?.message ?? result.reason.message}`,
|
||||
});
|
||||
}
|
||||
|
||||
const createSuccessNotification = (id, path) => {
|
||||
Notify.create({
|
||||
type: 'positive',
|
||||
message: t('globals.dataSaved'),
|
||||
actions: [
|
||||
{
|
||||
label: t('globals.openDetail'),
|
||||
color: 'white',
|
||||
handler: () => useOpenURL(`#/ticket/${id}/${path}`),
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
const handleResult = (result, key, path) => {
|
||||
if (result.status !== 'fulfilled') {
|
||||
const data = JSON.parse(result.reason.config.data);
|
||||
const error =
|
||||
result.reason.response?.data?.error?.message ?? result.reason.message;
|
||||
Notify.create({
|
||||
type: 'negative',
|
||||
message: `Ticket ${data[key]}: ${error}`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const data = JSON.parse(result.value.config.data);
|
||||
let id = data[key];
|
||||
|
||||
if (result.value.data.status === 'noSplit') {
|
||||
Notify.create({
|
||||
type: 'warning',
|
||||
message: `Ticket ${id}: ${t('negative.split.noSplit')}`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.value.data.status === 'split') {
|
||||
id = result.value.data.newTicket;
|
||||
}
|
||||
|
||||
createSuccessNotification(id, path);
|
||||
};
|
||||
|
||||
const notifyResults = (results, key, path = 'sale') =>
|
||||
results.forEach((result) => handleResult(result, key, path));
|
||||
|
||||
return { notifyResults };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue