forked from verdnatura/salix-front
Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix-front into test
This commit is contained in:
commit
1e7f2b3f4d
|
@ -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>
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useRoute } from 'vue-router';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
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 VnLv from 'src/components/ui/VnLv.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 customer = computed(() => summary.value.entity);
|
||||
const summary = ref();
|
||||
|
||||
const defaulterAmount = computed(() => customer.value.defaulters[0]?.amount);
|
||||
const balanceDue = computed(() => {
|
||||
return (
|
||||
customer.value &&
|
||||
customer.value.defaulters.length &&
|
||||
customer.value.defaulters[0].amount
|
||||
);
|
||||
const amount = defaulterAmount.value;
|
||||
if (!amount || amount < 0) {
|
||||
return null;
|
||||
}
|
||||
return amount;
|
||||
});
|
||||
|
||||
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
||||
const balanceDueWarning = computed(() => (defaulterAmount.value ? 'negative' : ''));
|
||||
|
||||
const claimRate = computed(() => {
|
||||
return customer.value.claimsRatio?.claimingRate ?? 0;
|
||||
|
@ -281,7 +281,7 @@ const sumRisk = ({ clientRisks }) => {
|
|||
<VnLv
|
||||
v-if="entity.defaulters"
|
||||
:label="t('customer.summary.balanceDue')"
|
||||
:value="toCurrency(balanceDue)"
|
||||
:value="dashOrCurrency(balanceDue)()"
|
||||
:class="balanceDueWarning"
|
||||
:info="t('customer.summary.balanceDueInfo')"
|
||||
/>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,24 +117,36 @@ function toTicketUrl(section) {
|
|||
{{ entity.nickname }}
|
||||
</div>
|
||||
</template>
|
||||
<template #header-right>
|
||||
<QBtnDropdown
|
||||
ref="stateBtnDropdownRef"
|
||||
color="black"
|
||||
text-color="white"
|
||||
:label="t('globals.changeState')"
|
||||
:disable="!isEditable()"
|
||||
>
|
||||
<VnSelect
|
||||
:options="editableStates"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
hide-dropdown-icon
|
||||
focus-on-mount
|
||||
@update:model-value="changeState"
|
||||
/>
|
||||
</QBtnDropdown>
|
||||
<template #header-right="{ entity }">
|
||||
<div>
|
||||
<QBtnDropdown
|
||||
ref="stateBtnDropdownRef"
|
||||
color="black"
|
||||
text-color="white"
|
||||
:label="t('globals.changeState')"
|
||||
:disable="!isEditable()"
|
||||
>
|
||||
<VnSelect
|
||||
:options="editableStates"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
hide-dropdown-icon
|
||||
focus-on-mount
|
||||
@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">
|
||||
|
|
Loading…
Reference in New Issue