feat(TicketSummary): add ticketDescritporMenu
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Alex Moreno 2024-11-18 10:49:30 +01:00
parent 03490b7f3a
commit 09aad5914f
3 changed files with 50 additions and 33 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,6 +1,6 @@
<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';
@ -31,7 +31,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 +68,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 +86,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 +176,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 +256,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 +299,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 +319,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 +342,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,
});
@ -374,7 +380,7 @@ async function uploadDocuware(force) {
:url="
route.path.startsWith('/ticket')
? `Tickets/${ticketId}/isEditable`
: `Tickets/${ticket}/isEditable`
: `Tickets/${ticket.id}/isEditable`
"
auto-load
@on-fetch="handleFetchData"
@ -396,8 +402,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">