Merge branch 'master' into hotfix-orderTickets
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Alex Moreno 2024-11-18 12:30:22 +00:00
commit f3ca51aab4
4 changed files with 60 additions and 48 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

@ -4,7 +4,7 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { toCurrency, toPercentage, toDate } from 'src/filters'; import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue'; import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
@ -25,16 +25,16 @@ const $props = defineProps({
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const customer = computed(() => summary.value.entity); const customer = computed(() => summary.value.entity);
const summary = ref(); const summary = ref();
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount);
const balanceDue = computed(() => { const balanceDue = computed(() => {
return ( const amount = defaulterAmount.value;
customer.value && if (!amount || amount < 0) {
customer.value.defaulters.length && return null;
customer.value.defaulters[0].amount }
); return amount;
}); });
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : '')); const balanceDueWarning = computed(() => (defaulterAmount.value ? 'negative' : ''));
const claimRate = computed(() => { const claimRate = computed(() => {
return customer.value.claimsRatio?.claimingRate ?? 0; return customer.value.claimsRatio?.claimingRate ?? 0;
@ -281,7 +281,7 @@ const sumRisk = ({ clientRisks }) => {
<VnLv <VnLv
v-if="entity.defaulters" v-if="entity.defaulters"
:label="t('customer.summary.balanceDue')" :label="t('customer.summary.balanceDue')"
:value="toCurrency(balanceDue)" :value="dashOrCurrency(balanceDue)()"
:class="balanceDueWarning" :class="balanceDueWarning"
:info="t('customer.summary.balanceDueInfo')" :info="t('customer.summary.balanceDueInfo')"
/> />

View File

@ -1,9 +1,9 @@
<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 { useRouter } from 'vue-router';
import { usePrintService } from 'composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
import SendEmailDialog from 'components/common/SendEmailDialog.vue'; import SendEmailDialog from 'components/common/SendEmailDialog.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
@ -23,7 +23,6 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
const route = useRoute();
const { push, currentRoute } = useRouter(); const { push, currentRoute } = useRouter();
const { dialog, notify } = useQuasar(); const { dialog, notify } = useQuasar();
@ -31,7 +30,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 +67,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 +85,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 +175,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 +255,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 +298,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 +318,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 +341,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,
}); });
@ -371,11 +376,7 @@ async function uploadDocuware(force) {
</script> </script>
<template> <template>
<FetchData <FetchData
:url=" :url="`Tickets/${ticketId}/isEditable`"
route.path.startsWith('/ticket')
? `Tickets/${ticketId}/isEditable`
: `Tickets/${ticket}/isEditable`
"
auto-load auto-load
@on-fetch="handleFetchData" @on-fetch="handleFetchData"
/> />
@ -396,8 +397,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,7 +117,8 @@ function toTicketUrl(section) {
{{ entity.nickname }} {{ entity.nickname }}
</div> </div>
</template> </template>
<template #header-right> <template #header-right="{ entity }">
<div>
<QBtnDropdown <QBtnDropdown
ref="stateBtnDropdownRef" ref="stateBtnDropdownRef"
color="black" color="black"
@ -134,6 +136,17 @@ function toTicketUrl(section) {
@update:model-value="changeState" @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">