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> <slot name="header" :entity="entity" dense>
<VnLv :label="`${entity.id} -`" :value="entity.name" /> <VnLv :label="`${entity.id} -`" :value="entity.name" />
</slot> </slot>
<slot name="header-right"> <slot name="header-right" :entity="entity">
<span></span> <span></span>
</slot> </slot>
</div> </div>

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { ref, toRefs } from 'vue'; import { computed, ref, toRefs } from 'vue';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
@ -31,7 +31,7 @@ const { t } = useI18n();
const { openReport, sendEmail } = usePrintService(); const { openReport, sendEmail } = usePrintService();
const ticketSummary = useArrayData('TicketSummary'); const ticketSummary = useArrayData('TicketSummary');
const { ticket } = toRefs(props); const { ticket } = toRefs(props);
const ticketId = currentRoute.value.params.id; const ticketId = computed(() => props.ticket.id ?? currentRoute.value.params.id);
const client = ref(); const client = ref();
const showTransferDialog = ref(false); const showTransferDialog = ref(false);
const showTurnDialog = ref(false); const showTurnDialog = ref(false);
@ -68,7 +68,7 @@ const actions = {
setWeight: async () => { setWeight: async () => {
try { try {
const invoiceIds = ( const invoiceIds = (
await axios.post(`Tickets/${ticketId}/setWeight`, { await axios.post(`Tickets/${ticketId.value}/setWeight`, {
weight: weight.value, weight: weight.value,
}) })
).data; ).data;
@ -86,7 +86,7 @@ const actions = {
}, },
remove: async () => { remove: async () => {
try { try {
await axios.post(`Tickets/${ticketId}/setDeleted`); await axios.post(`Tickets/${ticketId.value}/setDeleted`);
notify({ message: t('Ticket deleted'), type: 'positive' }); notify({ message: t('Ticket deleted'), type: 'positive' });
notify({ notify({
@ -176,14 +176,14 @@ function showSmsDialog(template, customData) {
} }
async function showSmsDialogWithChanges() { async function showSmsDialogWithChanges() {
const query = `TicketLogs/${ticketId}/getChanges`; const query = `TicketLogs/${ticketId.value}/getChanges`;
const response = await axios.get(query); const response = await axios.get(query);
showSmsDialog('orderChanges', { changes: response.data }); showSmsDialog('orderChanges', { changes: response.data });
} }
async function sendSms(body) { async function sendSms(body) {
await axios.post(`Tickets/${ticketId}/sendSms`, body); await axios.post(`Tickets/${ticketId.value}/sendSms`, body);
notify({ notify({
message: 'Notification sent', message: 'Notification sent',
type: 'positive', type: 'positive',
@ -256,7 +256,10 @@ async function transferClient(client) {
clientFk: 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(); if (data) window.location.reload();
} }
@ -296,7 +299,10 @@ async function changeShippedHour(time) {
shipped: 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(); if (data) window.location.reload();
} }
@ -313,7 +319,7 @@ function openRecalculateDialog() {
} }
async function recalculateComponents() { async function recalculateComponents() {
await axios.post(`Tickets/${ticketId}/recalculateComponents`); await axios.post(`Tickets/${ticketId.value}/recalculateComponents`);
notify({ notify({
message: t('Data saved'), message: t('Data saved'),
type: 'positive', type: 'positive',
@ -336,11 +342,11 @@ async function handleInvoiceOutData() {
} }
async function docuwareDownload() { async function docuwareDownload() {
await axios.get(`Tickets/${ticketId}/docuwareDownload`); await axios.get(`Tickets/${ticketId.value}/docuwareDownload`);
} }
async function hasDocuware() { async function hasDocuware() {
const { data } = await axios.post(`Docuwares/${ticketId}/checkFile`, { const { data } = await axios.post(`Docuwares/${ticketId.value}/checkFile`, {
fileCabinet: 'deliveryNote', fileCabinet: 'deliveryNote',
signed: true, signed: true,
}); });
@ -374,7 +380,7 @@ async function uploadDocuware(force) {
:url=" :url="
route.path.startsWith('/ticket') route.path.startsWith('/ticket')
? `Tickets/${ticketId}/isEditable` ? `Tickets/${ticketId}/isEditable`
: `Tickets/${ticket}/isEditable` : `Tickets/${ticket.id}/isEditable`
" "
auto-load auto-load
@on-fetch="handleFetchData" @on-fetch="handleFetchData"
@ -396,8 +402,6 @@ async function uploadDocuware(force) {
<VnSelect <VnSelect
url="Clients" url="Clients"
:fields="['id', 'name']" :fields="['id', 'name']"
option-label="name"
option-value="id"
v-model="client" v-model="client"
:label="t('Client')" :label="t('Client')"
auto-load 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 ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue'; import VnToSummary from 'src/components/ui/VnToSummary.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
const route = useRoute(); const route = useRoute();
const { notify } = useNotify(); const { notify } = useNotify();
@ -116,24 +117,36 @@ function toTicketUrl(section) {
{{ entity.nickname }} {{ entity.nickname }}
</div> </div>
</template> </template>
<template #header-right> <template #header-right="{ entity }">
<QBtnDropdown <div>
ref="stateBtnDropdownRef" <QBtnDropdown
color="black" ref="stateBtnDropdownRef"
text-color="white" color="black"
:label="t('globals.changeState')" text-color="white"
:disable="!isEditable()" :label="t('globals.changeState')"
> :disable="!isEditable()"
<VnSelect >
:options="editableStates" <VnSelect
hide-selected :options="editableStates"
option-label="name" hide-selected
option-value="code" option-label="name"
hide-dropdown-icon option-value="code"
focus-on-mount hide-dropdown-icon
@update:model-value="changeState" focus-on-mount
/> @update:model-value="changeState"
</QBtnDropdown> />
</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>
<template #body="{ entity }"> <template #body="{ entity }">
<QCard class="vn-one"> <QCard class="vn-one">