feat(TicketSummary): add ticketDescritporMenu #956

Merged
alexm merged 3 commits from hotFix_ticketSummary_add_ticketDescriptorMenu into master 2024-11-18 10:11:43 +00:00
3 changed files with 51 additions and 39 deletions

View File

@ -98,7 +98,7 @@ function existSummary(routes) {
<slot name="header" :entity="entity" dense>
<VnLv :label="`${entity.id} -`" :value="entity.name" />
</slot>
<slot name="header-right">
<slot name="header-right" :entity="entity">
<span></span>
</slot>
</div>

View File

@ -1,9 +1,9 @@
<script setup>
import axios from 'axios';
import { ref, toRefs } from 'vue';
import { computed, ref, toRefs } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { useRouter } from 'vue-router';
import { usePrintService } from 'composables/usePrintService';
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import VnConfirm from 'components/ui/VnConfirm.vue';
@ -23,7 +23,6 @@ const props = defineProps({
required: true,
},
});
const route = useRoute();
const { push, currentRoute } = useRouter();
const { dialog, notify } = useQuasar();
@ -31,7 +30,7 @@ const { t } = useI18n();
const { openReport, sendEmail } = usePrintService();
const ticketSummary = useArrayData('TicketSummary');
const { ticket } = toRefs(props);
const ticketId = currentRoute.value.params.id;
const ticketId = computed(() => props.ticket.id ?? currentRoute.value.params.id);
const client = ref();
const showTransferDialog = ref(false);
const showTurnDialog = ref(false);
@ -68,7 +67,7 @@ const actions = {
setWeight: async () => {
try {
const invoiceIds = (
await axios.post(`Tickets/${ticketId}/setWeight`, {
await axios.post(`Tickets/${ticketId.value}/setWeight`, {
weight: weight.value,
})
).data;
@ -86,7 +85,7 @@ const actions = {
},
remove: async () => {
try {
await axios.post(`Tickets/${ticketId}/setDeleted`);
await axios.post(`Tickets/${ticketId.value}/setDeleted`);
notify({ message: t('Ticket deleted'), type: 'positive' });
notify({
@ -176,14 +175,14 @@ function showSmsDialog(template, customData) {
}
async function showSmsDialogWithChanges() {
const query = `TicketLogs/${ticketId}/getChanges`;
const query = `TicketLogs/${ticketId.value}/getChanges`;
const response = await axios.get(query);
showSmsDialog('orderChanges', { changes: response.data });
}
async function sendSms(body) {
await axios.post(`Tickets/${ticketId}/sendSms`, body);
await axios.post(`Tickets/${ticketId.value}/sendSms`, body);
notify({
message: 'Notification sent',
type: 'positive',
@ -256,7 +255,10 @@ async function transferClient(client) {
clientFk: client,
};
const { data } = await axios.patch(`Tickets/${ticketId}/transferClient`, params);
const { data } = await axios.patch(
`Tickets/${ticketId.value}/transferClient`,
params
);
if (data) window.location.reload();
}
@ -296,7 +298,10 @@ async function changeShippedHour(time) {
shipped: time,
};
const { data } = await axios.post(`Tickets/${ticketId}/updateEditableTicket`, params);
const { data } = await axios.post(
`Tickets/${ticketId.value}/updateEditableTicket`,
params
);
if (data) window.location.reload();
}
@ -313,7 +318,7 @@ function openRecalculateDialog() {
}
async function recalculateComponents() {
await axios.post(`Tickets/${ticketId}/recalculateComponents`);
await axios.post(`Tickets/${ticketId.value}/recalculateComponents`);
notify({
message: t('Data saved'),
type: 'positive',
@ -336,11 +341,11 @@ async function handleInvoiceOutData() {
}
async function docuwareDownload() {
await axios.get(`Tickets/${ticketId}/docuwareDownload`);
await axios.get(`Tickets/${ticketId.value}/docuwareDownload`);
}
async function hasDocuware() {
const { data } = await axios.post(`Docuwares/${ticketId}/checkFile`, {
const { data } = await axios.post(`Docuwares/${ticketId.value}/checkFile`, {
fileCabinet: 'deliveryNote',
signed: true,
});
@ -371,11 +376,7 @@ async function uploadDocuware(force) {
</script>
<template>
<FetchData
:url="
route.path.startsWith('/ticket')
? `Tickets/${ticketId}/isEditable`
: `Tickets/${ticket}/isEditable`
"
:url="`Tickets/${ticketId}/isEditable`"
auto-load
@on-fetch="handleFetchData"
/>
@ -396,8 +397,6 @@ async function uploadDocuware(force) {
<VnSelect
url="Clients"
:fields="['id', 'name']"
option-label="name"
option-value="id"
v-model="client"
:label="t('Client')"
auto-load

View File

@ -20,6 +20,7 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
const route = useRoute();
const { notify } = useNotify();
@ -116,7 +117,8 @@ function toTicketUrl(section) {
{{ entity.nickname }}
</div>
</template>
<template #header-right>
<template #header-right="{ entity }">
<div>
<QBtnDropdown
ref="stateBtnDropdownRef"
color="black"
@ -134,6 +136,17 @@ function toTicketUrl(section) {
@update:model-value="changeState"
/>
</QBtnDropdown>
<QBtn color="white" dense flat icon="more_vert" round size="md">
<QTooltip>
{{ t('components.cardDescriptor.moreOptions') }}
</QTooltip>
<QMenu>
<QList>
<TicketDescriptorMenu :ticket="entity" />
</QList>
</QMenu>
</QBtn>
</div>
</template>
<template #body="{ entity }">
<QCard class="vn-one">