8231_testToMaster_2448 #997
|
@ -23,7 +23,7 @@ defineExpose({ states });
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
|
<FetchData url="ClaimStates" @on-fetch="(data) => (states = data)" auto-load />
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
|
|
@ -16,12 +16,9 @@ import { useAcl } from 'src/composables/useAcl';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import { toTimeFormat } from 'filters/date.js';
|
import { toTimeFormat } from 'filters/date.js';
|
||||||
|
|
||||||
const $props = defineProps({
|
const formData = defineModel({
|
||||||
formData: {
|
type: Object,
|
||||||
type: Object,
|
required: true,
|
||||||
required: true,
|
|
||||||
default: () => ({}),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['updateForm']);
|
const emit = defineEmits(['updateForm']);
|
||||||
|
@ -40,7 +37,6 @@ const agenciesOptions = ref([]);
|
||||||
const zonesOptions = ref([]);
|
const zonesOptions = ref([]);
|
||||||
const addresses = ref([]);
|
const addresses = ref([]);
|
||||||
const zoneSelectRef = ref();
|
const zoneSelectRef = ref();
|
||||||
const formData = ref($props.formData);
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => formData.value,
|
() => formData.value,
|
||||||
|
@ -69,47 +65,28 @@ const zoneWhere = computed(() => {
|
||||||
: {};
|
: {};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getLanded = async (params) => {
|
async function getLanded(params) {
|
||||||
try {
|
getDate(`Agencies/getLanded`, params);
|
||||||
const validParams =
|
}
|
||||||
shipped.value && addressId.value && agencyModeId.value && warehouseId.value;
|
|
||||||
if (!validParams) return;
|
|
||||||
|
|
||||||
formData.value.zoneFk = null;
|
async function getShipped(params) {
|
||||||
zonesOptions.value = [];
|
getDate(`Agencies/getShipped`, params);
|
||||||
const { data } = await axios.get(`Agencies/getLanded`, { params });
|
}
|
||||||
if (data) {
|
|
||||||
formData.value.zoneFk = data.zoneFk;
|
async function getDate(query, params) {
|
||||||
formData.value.landed = data.landed;
|
for (const param in params) {
|
||||||
formData.value.shipped = params.shipped;
|
if (!params[param]) return;
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
const getShipped = async (params) => {
|
formData.value.zoneFk = null;
|
||||||
try {
|
zonesOptions.value = [];
|
||||||
const validParams =
|
const { data } = await axios.get(query, { params });
|
||||||
landed.value && addressId.value && agencyModeId.value && warehouseId.value;
|
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||||
if (!validParams) return;
|
|
||||||
|
|
||||||
formData.value.zoneFk = null;
|
formData.value.zoneFk = data.zoneFk;
|
||||||
zonesOptions.value = [];
|
if (data.landed) formData.value.landed = data.landed;
|
||||||
const { data } = await axios.get(`Agencies/getShipped`, { params });
|
if (data.shipped) formData.value.shipped = data.shipped;
|
||||||
if (data) {
|
}
|
||||||
formData.value.zoneFk = data.zoneFk;
|
|
||||||
formData.value.landed = params.landed;
|
|
||||||
formData.value.shipped = data.shipped;
|
|
||||||
} else {
|
|
||||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onChangeZone = async (zoneId) => {
|
const onChangeZone = async (zoneId) => {
|
||||||
formData.value.agencyModeFk = null;
|
formData.value.agencyModeFk = null;
|
||||||
|
@ -177,18 +154,26 @@ const clientId = computed({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const landed = computed({
|
function addDateParams(obj) {
|
||||||
get: () => formData.value?.landed,
|
return {
|
||||||
set: (val) => {
|
...obj,
|
||||||
formData.value.landed = val;
|
...{
|
||||||
getShipped({
|
|
||||||
landed: val,
|
|
||||||
addressFk: formData.value?.addressFk,
|
addressFk: formData.value?.addressFk,
|
||||||
agencyModeFk: formData.value?.agencyModeFk,
|
agencyModeFk: formData.value?.agencyModeFk,
|
||||||
warehouseFk: formData.value?.warehouseFk,
|
warehouseFk: formData.value?.warehouseFk,
|
||||||
});
|
},
|
||||||
},
|
};
|
||||||
});
|
}
|
||||||
|
|
||||||
|
async function setLanded(landed) {
|
||||||
|
if (!landed) return;
|
||||||
|
getShipped(addDateParams({ landed }));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setShipped(shipped) {
|
||||||
|
if (!shipped) return;
|
||||||
|
getLanded(addDateParams({ shipped }));
|
||||||
|
}
|
||||||
|
|
||||||
const agencyModeId = computed({
|
const agencyModeId = computed({
|
||||||
get: () => formData.value.agencyModeFk,
|
get: () => formData.value.agencyModeFk,
|
||||||
|
@ -236,21 +221,6 @@ const warehouseId = computed({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const shipped = computed({
|
|
||||||
get: () => formData.value?.shipped,
|
|
||||||
set: (val) => {
|
|
||||||
if (new Date(formData.value?.shipped).toDateString() != val.toDateString())
|
|
||||||
val.setHours(0, 0, 0, 0);
|
|
||||||
formData.value.shipped = val;
|
|
||||||
getLanded({
|
|
||||||
shipped: val,
|
|
||||||
addressFk: formData.value?.addressFk,
|
|
||||||
agencyModeFk: formData.value?.agencyModeFk,
|
|
||||||
warehouseFk: formData.value?.warehouseFk,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const onFormModelInit = () => {
|
const onFormModelInit = () => {
|
||||||
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
|
if (formData.value?.clientFk) clientAddressesList(formData.value?.clientFk);
|
||||||
};
|
};
|
||||||
|
@ -451,18 +421,21 @@ async function getZone(options) {
|
||||||
v-model="formData.shipped"
|
v-model="formData.shipped"
|
||||||
:required="true"
|
:required="true"
|
||||||
:rules="validate('ticketList.shipped')"
|
:rules="validate('ticketList.shipped')"
|
||||||
|
@update:model-value="setShipped"
|
||||||
/>
|
/>
|
||||||
<VnInputTime
|
<VnInputTime
|
||||||
:label="t('basicData.shippedHour')"
|
:label="t('basicData.shippedHour')"
|
||||||
v-model="formData.shipped"
|
v-model="formData.shipped"
|
||||||
:required="true"
|
:required="true"
|
||||||
:rules="validate('basicData.shippedHour')"
|
:rules="validate('basicData.shippedHour')"
|
||||||
|
@update:model-value="setShipped"
|
||||||
/>
|
/>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('basicData.landed')"
|
:label="t('basicData.landed')"
|
||||||
v-model="formData.landed"
|
v-model="formData.landed"
|
||||||
:required="true"
|
:required="true"
|
||||||
:rules="validate('basicData.landed')"
|
:rules="validate('basicData.landed')"
|
||||||
|
@update:model-value="setLanded"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</QForm>
|
</QForm>
|
||||||
|
|
|
@ -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';
|
||||||
|
@ -18,12 +18,13 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import TicketFilter from './TicketFilter.vue';
|
import TicketFilter from './TicketFilter.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
import ZoneDescriptorProxy from '../Zone/Card/ZoneDescriptorProxy.vue';
|
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||||
import { toTimeFormat } from 'src/filters/date';
|
import { toTimeFormat } from 'src/filters/date';
|
||||||
import InvoiceOutDescriptorProxy from '../InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
import InvoiceOutDescriptorProxy from 'src/pages/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,23 +41,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,
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initializeFromQuery();
|
initializeFromQuery();
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
if (!route.query.createForm) return;
|
if (!route.query.createForm) return;
|
||||||
onClientSelected(JSON.parse(route.query.createForm));
|
onClientSelected(JSON.parse(route.query.createForm));
|
||||||
});
|
});
|
||||||
// Método para inicializar las variables desde la query string
|
|
||||||
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 });
|
||||||
|
@ -213,13 +209,19 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('components.smartCard.viewSummary'),
|
title: t('components.smartCard.viewSummary'),
|
||||||
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');
|
||||||
|
@ -456,24 +458,24 @@ function setReference(data) {
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="Ticket"
|
data-key="TicketList"
|
||||||
:label="t('Search ticket')"
|
:label="t('Search ticket')"
|
||||||
:info="t('You can search by ticket id or alias')"
|
:info="t('You can search by ticket id or alias')"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<TicketFilter data-key="Ticket" />
|
<TicketFilter data-key="TicketList" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="Ticket"
|
data-key="TicketList"
|
||||||
url="Tickets/filter"
|
url="Tickets/filter"
|
||||||
:create="{
|
:create="{
|
||||||
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']"
|
||||||
|
@ -575,17 +577,17 @@ function setReference(data) {
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-stateFk="{ row }">
|
<template #column-stateFk="{ row }">
|
||||||
<span v-if="getColor(row)">
|
<span v-if="row.refFk">
|
||||||
<QChip :class="getColor(row)" dense square>
|
|
||||||
{{ row.state }}
|
|
||||||
</QChip>
|
|
||||||
</span>
|
|
||||||
<span v-else-if="row.state === 'Entregado'">
|
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row.refFk }}
|
{{ row.refFk }}
|
||||||
<InvoiceOutDescriptorProxy :id="row.invoiceOutId" />
|
<InvoiceOutDescriptorProxy :id="row.invoiceOutId" />
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
<span v-else-if="getColor(row)">
|
||||||
|
<QChip :class="getColor(row)" dense square>
|
||||||
|
{{ row.state }}
|
||||||
|
</QChip>
|
||||||
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ row.state }}
|
{{ row.state }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -617,6 +619,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'"
|
||||||
>
|
>
|
||||||
|
@ -643,6 +646,7 @@ function setReference(data) {
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
hide-selected
|
hide-selected
|
||||||
map-options
|
map-options
|
||||||
|
required
|
||||||
:disable="!data.clientId"
|
:disable="!data.clientId"
|
||||||
:sort-by="'isActive DESC'"
|
:sort-by="'isActive DESC'"
|
||||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
|
@ -693,6 +697,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>
|
||||||
|
@ -706,7 +711,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>
|
||||||
|
@ -842,7 +846,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