forked from verdnatura/salix-front
Merge branch 'master' into Hotfix-TicketList
This commit is contained in:
commit
89661397fb
|
@ -8,9 +8,6 @@ import { useQuasar } from 'quasar';
|
||||||
import useNotify from 'src/composables/useNotify';
|
import useNotify from 'src/composables/useNotify';
|
||||||
|
|
||||||
import VnSmsDialog from 'src/components/common/VnSmsDialog.vue';
|
import VnSmsDialog from 'src/components/common/VnSmsDialog.vue';
|
||||||
import TicketCreateDialog from 'src/pages/Ticket/TicketCreateDialog.vue';
|
|
||||||
import OrderCreateDialog from 'src/pages/Order/Card/OrderCreateDialog.vue';
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
customer: {
|
customer: {
|
||||||
|
@ -44,13 +41,38 @@ const sendSms = async (payload) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const ticketCreateFormDialog = ref(null);
|
|
||||||
const openTicketCreateForm = () => {
|
const openTicketCreateForm = () => {
|
||||||
ticketCreateFormDialog.value.show();
|
const query = {
|
||||||
|
table: {
|
||||||
|
clientFk: $props.customer.id,
|
||||||
|
},
|
||||||
|
createForm: {
|
||||||
|
clientId: $props.customer.id,
|
||||||
|
addressId: $props.customer.defaultAddressFk,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
openWindow('ticket', query);
|
||||||
};
|
};
|
||||||
const orderCreateFormDialog = ref(null);
|
|
||||||
const openOrderCreateForm = () => {
|
const openOrderCreateForm = () => {
|
||||||
orderCreateFormDialog.value.show();
|
const query = {
|
||||||
|
table: {
|
||||||
|
clientFk: $props.customer.id,
|
||||||
|
},
|
||||||
|
createForm: {
|
||||||
|
clientFk: $props.customer.id,
|
||||||
|
addressId: $props.customer.defaultAddressFk,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
openWindow('order', query);
|
||||||
|
};
|
||||||
|
|
||||||
|
const openWindow = (type, { createForm, table }) => {
|
||||||
|
window.open(
|
||||||
|
`/#/${type}/list?createForm=${JSON.stringify(createForm)}&table=${JSON.stringify(
|
||||||
|
table
|
||||||
|
)}`,
|
||||||
|
'_blank'
|
||||||
|
);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -58,17 +80,11 @@ const openOrderCreateForm = () => {
|
||||||
<QItem v-ripple clickable @click="openTicketCreateForm()">
|
<QItem v-ripple clickable @click="openTicketCreateForm()">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('globals.pageTitles.createTicket') }}
|
{{ t('globals.pageTitles.createTicket') }}
|
||||||
<QDialog ref="ticketCreateFormDialog">
|
|
||||||
<TicketCreateDialog />
|
|
||||||
</QDialog>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-ripple clickable @click="openOrderCreateForm()">
|
<QItem v-ripple clickable @click="openOrderCreateForm()">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('globals.pageTitles.createOrder') }}
|
{{ t('globals.pageTitles.createOrder') }}
|
||||||
<QDialog ref="orderCreateFormDialog">
|
|
||||||
<OrderCreateDialog :client-fk="customer.id" />
|
|
||||||
</QDialog>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-ripple clickable>
|
<QItem v-ripple clickable>
|
||||||
|
|
|
@ -68,7 +68,6 @@ const columns = computed(() => [
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
where: { role: 'salesPerson' },
|
where: { role: 'salesPerson' },
|
||||||
optionFilter: 'firstName',
|
optionFilter: 'firstName',
|
||||||
useLike: false,
|
|
||||||
},
|
},
|
||||||
create: false,
|
create: false,
|
||||||
columnField: {
|
columnField: {
|
||||||
|
@ -429,9 +428,10 @@ function handleLocation(data, location) {
|
||||||
:params="{
|
:params="{
|
||||||
departmentCodes: ['VT', 'shopping'],
|
departmentCodes: ['VT', 'shopping'],
|
||||||
}"
|
}"
|
||||||
:fields="['id', 'nickname']"
|
:fields="['id', 'nickname', 'code']"
|
||||||
sort-by="nickname ASC"
|
sort-by="nickname ASC"
|
||||||
:use-like="false"
|
option-label="nickname"
|
||||||
|
option-value="id"
|
||||||
emit-value
|
emit-value
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, onMounted, ref } from 'vue';
|
||||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||||
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
@ -14,7 +14,6 @@ import OrderFilter from './Card/OrderFilter.vue';
|
||||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import { toDateTimeFormat } from 'src/filters/date';
|
import { toDateTimeFormat } from 'src/filters/date';
|
||||||
import { onMounted } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -142,8 +141,13 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
onMounted(() => {
|
||||||
async function fetchClientAddress(id, formData) {
|
if (!route.query.createForm) return;
|
||||||
|
const clientId = route.query.createForm;
|
||||||
|
const id = JSON.parse(clientId);
|
||||||
|
fetchClientAddress(id.clientFk);
|
||||||
|
});
|
||||||
|
async function fetchClientAddress(id, formData = {}) {
|
||||||
const { data } = await axios.get(`Clients/${id}`, {
|
const { data } = await axios.get(`Clients/${id}`, {
|
||||||
params: { filter: { include: { relation: 'addresses' } } },
|
params: { filter: { include: { relation: 'addresses' } } },
|
||||||
});
|
});
|
||||||
|
@ -170,13 +174,6 @@ const getDateColor = (date) => {
|
||||||
if (comparation == 0) return 'bg-warning';
|
if (comparation == 0) return 'bg-warning';
|
||||||
if (comparation < 0) return 'bg-success';
|
if (comparation < 0) return 'bg-success';
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
if (!route.query.createForm) return;
|
|
||||||
const clientId = route.query.createForm;
|
|
||||||
const id = JSON.parse(clientId);
|
|
||||||
fetchClientAddress(id.clientFk, id);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<OrderSearchbar />
|
<OrderSearchbar />
|
||||||
|
|
|
@ -19,7 +19,6 @@ import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
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 TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
|
||||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -87,10 +86,6 @@ async function changeState(value) {
|
||||||
function toTicketUrl(section) {
|
function toTicketUrl(section) {
|
||||||
return '#/ticket/' + entityId.value + '/' + section;
|
return '#/ticket/' + entityId.value + '/' + section;
|
||||||
}
|
}
|
||||||
function isOnTicketCard() {
|
|
||||||
const currentPath = route.path;
|
|
||||||
return currentPath.startsWith('/ticket');
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { computed, ref, onMounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
@ -24,6 +24,8 @@ import { toTimeFormat } from 'src/filters/date';
|
||||||
import InvoiceOutDescriptorProxy from '../InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
import InvoiceOutDescriptorProxy from '../InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
@ -40,16 +42,18 @@ from.setDate(from.getDate() - 7);
|
||||||
const to = Date.vnNew();
|
const to = Date.vnNew();
|
||||||
to.setHours(23, 59, 0, 0);
|
to.setHours(23, 59, 0, 0);
|
||||||
to.setDate(to.getDate() + 1);
|
to.setDate(to.getDate() + 1);
|
||||||
|
|
||||||
const userParams = {
|
const userParams = {
|
||||||
from: null,
|
from: null,
|
||||||
to: null,
|
to: null,
|
||||||
};
|
};
|
||||||
// Método para inicializar las variables desde la query string
|
onMounted(() => {
|
||||||
|
initializeFromQuery();
|
||||||
|
stateStore.rightDrawer = true;
|
||||||
|
if (!route.query.createForm) return;
|
||||||
|
onClientSelected(JSON.parse(route.query.createForm));
|
||||||
|
});
|
||||||
const initializeFromQuery = () => {
|
const initializeFromQuery = () => {
|
||||||
const query = route.query.table ? JSON.parse(route.query.table) : {};
|
const query = route.query.table ? JSON.parse(route.query.table) : {};
|
||||||
|
|
||||||
// Asigna los valores a las variables correspondientes
|
|
||||||
from.value = query.from || from.toISOString();
|
from.value = query.from || from.toISOString();
|
||||||
to.value = query.to || to.toISOString();
|
to.value = query.to || to.toISOString();
|
||||||
Object.assign(userParams, { from, to });
|
Object.assign(userParams, { from, to });
|
||||||
|
@ -206,13 +210,19 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('ticketList.summary'),
|
title: t('ticketList.summary'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
isPrimary: true,
|
action: (row, evt) => {
|
||||||
action: (row) => viewSummary(row.id, TicketSummary),
|
if (evt && evt.ctrlKey) {
|
||||||
|
const url = router.resolve({
|
||||||
|
params: { id: row.id },
|
||||||
|
name: 'TicketCard',
|
||||||
|
}).href;
|
||||||
|
window.open(url, '_blank');
|
||||||
|
} else viewSummary(row.id, TicketSummary);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function redirectToLines(id) {
|
function redirectToLines(id) {
|
||||||
const url = `#/ticket/${id}/sale`;
|
const url = `#/ticket/${id}/sale`;
|
||||||
window.open(url, '_blank');
|
window.open(url, '_blank');
|
||||||
|
@ -302,11 +312,6 @@ const getDateColor = (date) => {
|
||||||
if (comparation < 0) return 'bg-success';
|
if (comparation < 0) return 'bg-success';
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
initializeFromQuery();
|
|
||||||
stateStore.rightDrawer = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
async function makeInvoice(ticket) {
|
async function makeInvoice(ticket) {
|
||||||
const ticketsIds = ticket.map((item) => item.id);
|
const ticketsIds = ticket.map((item) => item.id);
|
||||||
const { data } = await axios.post(`Tickets/invoiceTicketsAndPdf`, { ticketsIds });
|
const { data } = await axios.post(`Tickets/invoiceTicketsAndPdf`, { ticketsIds });
|
||||||
|
@ -472,7 +477,7 @@ function setReference(data) {
|
||||||
urlCreate: 'Tickets/new',
|
urlCreate: 'Tickets/new',
|
||||||
title: t('ticketList.createTicket'),
|
title: t('ticketList.createTicket'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {},
|
formInitialData: { clientId: null },
|
||||||
}"
|
}"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
:order="['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id']"
|
:order="['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id']"
|
||||||
|
@ -616,6 +621,7 @@ function setReference(data) {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
required
|
||||||
@update:model-value="(client) => onClientSelected(data)"
|
@update:model-value="(client) => onClientSelected(data)"
|
||||||
:sort-by="'id ASC'"
|
:sort-by="'id ASC'"
|
||||||
>
|
>
|
||||||
|
@ -635,7 +641,7 @@ function setReference(data) {
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Addresses"
|
required
|
||||||
:label="t('ticket.create.address')"
|
:label="t('ticket.create.address')"
|
||||||
v-model="data.addressId"
|
v-model="data.addressId"
|
||||||
:options="addressesOptions"
|
:options="addressesOptions"
|
||||||
|
@ -680,6 +686,7 @@ function setReference(data) {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
required
|
||||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -693,7 +700,6 @@ function setReference(data) {
|
||||||
option-value="agencyModeFk"
|
option-value="agencyModeFk"
|
||||||
option-label="agencyMode"
|
option-label="agencyMode"
|
||||||
hide-selected
|
hide-selected
|
||||||
:disable="!data.clientId || !data.landed || !data.warehouseId"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
@ -829,7 +835,14 @@ function setReference(data) {
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</template>
|
</template>
|
||||||
|
<style scoped>
|
||||||
|
.disabled,
|
||||||
|
.disabled *,
|
||||||
|
[disabled],
|
||||||
|
[disabled] * {
|
||||||
|
cursor: pointer !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Search ticket: Buscar ticket
|
Search ticket: Buscar ticket
|
||||||
|
|
Loading…
Reference in New Issue