Merge branch 'dev' into 8316-invoiceInCardWithVnCardBeta
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
b47d022f94
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { computed, ref, watch } from 'vue';
|
import { computed, ref, useAttrs, watch } from 'vue';
|
||||||
import { useRouter, onBeforeRouteLeave } from 'vue-router';
|
import { useRouter, onBeforeRouteLeave } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
@ -17,6 +17,7 @@ const quasar = useQuasar();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { validate } = useValidator();
|
const { validate } = useValidator();
|
||||||
|
const $attrs = useAttrs();
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
model: {
|
model: {
|
||||||
|
@ -113,9 +114,11 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
async function fetch(data) {
|
async function fetch(data) {
|
||||||
resetData(data);
|
const keyData = $attrs['key-data'];
|
||||||
emit('onFetch', data);
|
const rows = keyData ? data[keyData] : data;
|
||||||
return data;
|
resetData(rows);
|
||||||
|
emit('onFetch', rows);
|
||||||
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetData(data) {
|
function resetData(data) {
|
||||||
|
|
|
@ -75,6 +75,7 @@ const focus = () => {
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
focus,
|
focus,
|
||||||
|
vnInputRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mixinRules = [
|
const mixinRules = [
|
||||||
|
|
|
@ -94,8 +94,8 @@ function checkIsMain() {
|
||||||
/>
|
/>
|
||||||
<div :id="searchbarId"></div>
|
<div :id="searchbarId"></div>
|
||||||
</slot>
|
</slot>
|
||||||
<RightAdvancedMenu :is-main-section="isMainSection">
|
<RightAdvancedMenu :is-main-section="isMainSection && rightFilter">
|
||||||
<template #advanced-menu v-if="$slots[advancedMenuSlot] || rightFilter">
|
<template #advanced-menu v-if="$slots[advancedMenuSlot]">
|
||||||
<slot :name="advancedMenuSlot">
|
<slot :name="advancedMenuSlot">
|
||||||
<VnTableFilter
|
<VnTableFilter
|
||||||
v-if="rightFilter && columns"
|
v-if="rightFilter && columns"
|
||||||
|
|
|
@ -78,6 +78,10 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
keyData: {
|
||||||
|
type: String,
|
||||||
|
default: undefined,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch', 'onPaginate', 'onChange']);
|
const emit = defineEmits(['onFetch', 'onPaginate', 'onChange']);
|
||||||
|
@ -255,7 +259,7 @@ defineExpose({
|
||||||
:disable="disableInfiniteScroll || !store.hasMoreData"
|
:disable="disableInfiniteScroll || !store.hasMoreData"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
>
|
>
|
||||||
<slot name="body" :rows="store.data"></slot>
|
<slot name="body" :rows="keyData ? store.data[keyData] : store.data"></slot>
|
||||||
<div v-if="isLoading" class="spinner info-row q-pa-md text-center">
|
<div v-if="isLoading" class="spinner info-row q-pa-md text-center">
|
||||||
<QSpinner color="primary" size="md" />
|
<QSpinner color="primary" size="md" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -202,6 +202,7 @@ export function useArrayData(key, userOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function toArray(str = []) {
|
function toArray(str = []) {
|
||||||
|
if (!str) return [];
|
||||||
if (Array.isArray(str)) return str;
|
if (Array.isArray(str)) return str;
|
||||||
if (typeof str === 'string') return str.split(',').map((item) => item.trim());
|
if (typeof str === 'string') return str.split(',').map((item) => item.trim());
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,8 @@ const filterClientFindOne = {
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox :label="t('Unpaid client')" v-model="data.unpaid" />
|
<QCheckbox :label="t('Unpaid client')" v-model="data.unpaid"
|
||||||
|
data-cy="UnpaidCheckBox" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md" v-show="data.unpaid">
|
<VnRow class="row q-gutter-md q-mb-md" v-show="data.unpaid">
|
||||||
|
|
|
@ -11,14 +11,14 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
||||||
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const dataRef = ref(null);
|
const dataRef = ref(null);
|
||||||
|
|
||||||
const balanceDueTotal = ref(0);
|
|
||||||
const selected = ref([]);
|
const selected = ref([]);
|
||||||
|
const arrayData = useArrayData('CustomerDefaulter');
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -165,26 +165,37 @@ const viewAddObservation = (rowsSelected) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFetch = async (data) => {
|
|
||||||
balanceDueTotal.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
function exprBuilder(param, value) {
|
function exprBuilder(param, value) {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'clientFk':
|
|
||||||
return { [`d.${param}`]: value };
|
|
||||||
case 'creditInsurance':
|
|
||||||
case 'amount':
|
|
||||||
case 'workerFk':
|
|
||||||
case 'departmentFk':
|
|
||||||
case 'countryFk':
|
|
||||||
case 'payMethod':
|
|
||||||
case 'salesPersonFk':
|
case 'salesPersonFk':
|
||||||
|
case 'creditInsurance':
|
||||||
|
case 'countryFk':
|
||||||
|
return { [`c.${param}`]: value };
|
||||||
|
case 'payMethod':
|
||||||
|
return { [`c.payMethodFk`]: value };
|
||||||
|
case 'workerFk':
|
||||||
|
return { [`co.${param}`]: value };
|
||||||
|
case 'departmentFk':
|
||||||
|
return { [`wd.${param}`]: value };
|
||||||
|
case 'amount':
|
||||||
|
case 'clientFk':
|
||||||
return { [`d.${param}`]: value };
|
return { [`d.${param}`]: value };
|
||||||
case 'created':
|
case 'created':
|
||||||
return { 'd.created': { between: dateRange(value) } };
|
return { 'd.created': { between: dateRange(value) } };
|
||||||
case 'defaulterSinced':
|
case 'defaulterSinced':
|
||||||
return { 'd.defaulterSinced': { between: dateRange(value) } };
|
return { 'd.defaulterSinced': { between: dateRange(value) } };
|
||||||
|
case 'isWorker': {
|
||||||
|
if (value == undefined) return;
|
||||||
|
const search = value ? 'worker' : { neq: 'worker' };
|
||||||
|
return { 'c.businessTypeFk': search };
|
||||||
|
}
|
||||||
|
case 'hasRecovery': {
|
||||||
|
if (value == undefined) return;
|
||||||
|
const search = value ? null : { neq: null };
|
||||||
|
return { 'r.finished': search };
|
||||||
|
}
|
||||||
|
case 'observation':
|
||||||
|
return { 'co.text': { like: `%${value}%` } };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -192,7 +203,7 @@ function exprBuilder(param, value) {
|
||||||
<template>
|
<template>
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
<template #st-data>
|
<template #st-data>
|
||||||
<CustomerBalanceDueTotal :amount="balanceDueTotal" />
|
<CustomerBalanceDueTotal :amount="arrayData.store.data?.amount" />
|
||||||
</template>
|
</template>
|
||||||
<template #st-actions>
|
<template #st-actions>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -211,8 +222,6 @@ function exprBuilder(param, value) {
|
||||||
url="Defaulters/filter"
|
url="Defaulters/filter"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
@on-fetch="onFetch"
|
|
||||||
:use-model="true"
|
|
||||||
:table="{
|
:table="{
|
||||||
'row-key': 'clientFk',
|
'row-key': 'clientFk',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
|
@ -221,6 +230,7 @@ function exprBuilder(param, value) {
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
auto-load
|
auto-load
|
||||||
:order="['amount DESC']"
|
:order="['amount DESC']"
|
||||||
|
key-data="defaulters"
|
||||||
>
|
>
|
||||||
<template #column-clientFk="{ row }">
|
<template #column-clientFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { onBeforeMount, ref } from 'vue';
|
import { onBeforeMount, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
@ -13,11 +13,12 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||||
import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const quasar = useQuasar();
|
||||||
const urlUpdate = ref('');
|
const urlUpdate = ref('');
|
||||||
const agencyModes = ref([]);
|
const agencyModes = ref([]);
|
||||||
const incoterms = ref([]);
|
const incoterms = ref([]);
|
||||||
|
@ -83,8 +84,26 @@ const deleteNote = (id, index) => {
|
||||||
notes.value.splice(index, 1);
|
notes.value.splice(index, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDataSaved = async () => {
|
const updateAddress = async (data) => {
|
||||||
let payload = {
|
await axios.patch(urlUpdate.value, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateAddressTicket = async () => {
|
||||||
|
urlUpdate.value += '?updateObservations=true';
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateObservations = async (payload) => {
|
||||||
|
await axios.post('AddressObservations/crud', payload);
|
||||||
|
notes.value = [];
|
||||||
|
deletes.value = [];
|
||||||
|
toCustomerAddress();
|
||||||
|
};
|
||||||
|
async function updateAll({ data, payload }) {
|
||||||
|
await updateObservations(payload);
|
||||||
|
await updateAddress(data);
|
||||||
|
}
|
||||||
|
function getPayload() {
|
||||||
|
return {
|
||||||
creates: notes.value.filter((note) => note.$isNew),
|
creates: notes.value.filter((note) => note.$isNew),
|
||||||
deletes: deletes.value,
|
deletes: deletes.value,
|
||||||
updates: notes.value
|
updates: notes.value
|
||||||
|
@ -101,14 +120,40 @@ const onDataSaved = async () => {
|
||||||
where: { id: note.id },
|
where: { id: note.id },
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
await axios.post('AddressObservations/crud', payload);
|
async function handleDialog(data) {
|
||||||
notes.value = [];
|
const payload = getPayload();
|
||||||
deletes.value = [];
|
const body = { data, payload };
|
||||||
|
if (payload.updates.length) {
|
||||||
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t(
|
||||||
|
'confirmTicket'
|
||||||
|
),
|
||||||
|
message: t('confirmDeletionMessage'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(async () => {
|
||||||
|
await updateAddressTicket();
|
||||||
|
await updateAll(body);
|
||||||
toCustomerAddress();
|
toCustomerAddress();
|
||||||
};
|
})
|
||||||
|
.onCancel(async () => {
|
||||||
|
await updateAll(body);
|
||||||
|
toCustomerAddress();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
updateAll(body);
|
||||||
|
toCustomerAddress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const toCustomerAddress = () => {
|
const toCustomerAddress = () => {
|
||||||
|
notes.value = [];
|
||||||
|
deletes.value = [];
|
||||||
router.push({
|
router.push({
|
||||||
name: 'CustomerAddress',
|
name: 'CustomerAddress',
|
||||||
params: {
|
params: {
|
||||||
|
@ -143,7 +188,7 @@ function handleLocation(data, location) {
|
||||||
:observe-form-changes="false"
|
:observe-form-changes="false"
|
||||||
:url-update="urlUpdate"
|
:url-update="urlUpdate"
|
||||||
:url="`Addresses/${route.params.addressId}`"
|
:url="`Addresses/${route.params.addressId}`"
|
||||||
@on-data-saved="onDataSaved()"
|
:save-fn="handleDialog"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #moreActions>
|
<template #moreActions>
|
||||||
|
@ -336,4 +381,9 @@ es:
|
||||||
Remove note: Eliminar nota
|
Remove note: Eliminar nota
|
||||||
Longitude: Longitud
|
Longitude: Longitud
|
||||||
Latitude: Latitud
|
Latitude: Latitud
|
||||||
|
confirmTicket: ¿Desea modificar también los estados de todos los tickets que están a punto de ser servidos?
|
||||||
|
confirmDeletionMessage: Si le das a aceptar, se modificaran todas las notas de los ticket a futuro
|
||||||
|
en:
|
||||||
|
confirmTicket: Do you also want to modify the states of all the tickets that are about to be served?
|
||||||
|
confirmDeletionMessage: If you click accept, all the notes of the future tickets will be modified
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { describe, it, expect, vi, afterEach } from 'vitest';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
|
||||||
|
|
||||||
|
vi.mock('axios');
|
||||||
|
|
||||||
|
describe('getAddresses', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fetch addresses with correct parameters for a valid clientId', async () => {
|
||||||
|
const clientId = '12345';
|
||||||
|
|
||||||
|
await getAddresses(clientId);
|
||||||
|
|
||||||
|
expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, {
|
||||||
|
params: {
|
||||||
|
filter: JSON.stringify({
|
||||||
|
fields: ['nickname', 'street', 'city', 'id'],
|
||||||
|
where: { isActive: true },
|
||||||
|
order: 'nickname ASC',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return undefined when clientId is not provided', async () => {
|
||||||
|
await getAddresses(undefined);
|
||||||
|
|
||||||
|
expect(axios.get).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,41 @@
|
||||||
|
import { describe, it, expect, vi, afterEach } from 'vitest';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { getClient } from 'src/pages/Customer/composables/getClient';
|
||||||
|
|
||||||
|
vi.mock('axios');
|
||||||
|
|
||||||
|
describe('getClient', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
const generateParams = (clientId) => ({
|
||||||
|
params: {
|
||||||
|
filter: JSON.stringify({
|
||||||
|
include: {
|
||||||
|
relation: 'defaultAddress',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'agencyModeFk'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
where: { id: clientId },
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fetch client data with correct parameters for a valid clientId', async () => {
|
||||||
|
const clientId = '12345';
|
||||||
|
|
||||||
|
await getClient(clientId);
|
||||||
|
|
||||||
|
expect(axios.get).toHaveBeenCalledWith('Clients', generateParams(clientId));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return undefined when clientId is not provided', async () => {
|
||||||
|
const clientId = undefined;
|
||||||
|
|
||||||
|
await getClient(clientId);
|
||||||
|
|
||||||
|
expect(axios.get).toHaveBeenCalledWith('Clients', generateParams(clientId));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,14 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export async function getAddresses(clientId) {
|
||||||
|
if (!clientId) return;
|
||||||
|
const filter = {
|
||||||
|
fields: ['nickname', 'street', 'city', 'id'],
|
||||||
|
where: { isActive: true },
|
||||||
|
order: 'nickname ASC',
|
||||||
|
};
|
||||||
|
const params = { filter: JSON.stringify(filter) };
|
||||||
|
return await axios.get(`Clients/${clientId}/addresses`, {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,15 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export async function getClient(clientId) {
|
||||||
|
const filter = {
|
||||||
|
include: {
|
||||||
|
relation: 'defaultAddress',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'agencyModeFk'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
where: { id: clientId },
|
||||||
|
};
|
||||||
|
const params = { filter: JSON.stringify(filter) };
|
||||||
|
return await axios.get('Clients', { params });
|
||||||
|
};
|
|
@ -272,7 +272,6 @@ const createInvoiceInCorrection = async () => {
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
{{ console.log('opt: ', opt) }}
|
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel
|
<QItemLabel
|
||||||
>{{ opt.id }} -
|
>{{ opt.id }} -
|
||||||
|
|
|
@ -272,11 +272,12 @@ const onDenyAccept = (_, responseData) => {
|
||||||
<template #column-achieved="{ row }">
|
<template #column-achieved="{ row }">
|
||||||
<span>
|
<span>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
ref="achievedRef"
|
||||||
type="number"
|
type="number"
|
||||||
v-model.number="row.saleQuantity"
|
v-model.number="row.saleQuantity"
|
||||||
:disable="!row.itemFk || row.isOk != null"
|
:disable="!row.itemFk || row.isOk != null"
|
||||||
@blur="changeQuantity(row)"
|
@blur="changeQuantity(row)"
|
||||||
@keyup.enter="changeQuantity(row)"
|
@keyup.enter="$refs.achievedRef.vnInputRef.blur()"
|
||||||
dense
|
dense
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const dataKey = 'AgencyList';
|
||||||
function navigate(id) {
|
function navigate(id) {
|
||||||
router.push({ path: `/agency/${id}` });
|
router.push({ path: `/agency/${id}` });
|
||||||
}
|
}
|
||||||
|
@ -67,26 +68,28 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSection
|
||||||
:info="t('You can search by name')"
|
:data-key
|
||||||
:label="t('Search agency')"
|
:columns="columns"
|
||||||
data-key="AgencyList"
|
prefix="agency"
|
||||||
:expr-builder="exprBuilder"
|
:right-filter="false"
|
||||||
/>
|
:array-data-props="{
|
||||||
<div class="list-container">
|
url: 'Agencies',
|
||||||
<div class="list">
|
order: 'name',
|
||||||
|
exprBuilder,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #body>
|
||||||
<VnTable
|
<VnTable
|
||||||
data-key="AgencyList"
|
:data-key
|
||||||
url="Agencies"
|
|
||||||
order="name"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
redirect="agency"
|
redirect="route/agency"
|
||||||
default-mode="card"
|
default-mode="card"
|
||||||
/>
|
/>
|
||||||
</div>
|
</template>
|
||||||
</div>
|
</VnSection>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.list {
|
.list {
|
||||||
|
@ -104,8 +107,6 @@ const columns = computed(() => [
|
||||||
es:
|
es:
|
||||||
isOwn: Tiene propietario
|
isOwn: Tiene propietario
|
||||||
isAnyVolumeAllowed: Permite cualquier volumen
|
isAnyVolumeAllowed: Permite cualquier volumen
|
||||||
Search agency: Buscar agencia
|
|
||||||
You can search by name: Puedes buscar por nombre
|
|
||||||
en:
|
en:
|
||||||
isOwn: Has owner
|
isOwn: Has owner
|
||||||
isAnyVolumeAllowed: Allows any volume
|
isAnyVolumeAllowed: Allows any volume
|
||||||
|
|
|
@ -1,17 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import AgencyDescriptor from 'pages/Route/Agency/Card/AgencyDescriptor.vue';
|
import AgencyDescriptor from 'pages/Route/Agency/Card/AgencyDescriptor.vue';
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCardBeta from 'src/components/common/VnCardBeta.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCardBeta data-key="Agency" base-url="Agencies" :descriptor="AgencyDescriptor" />
|
||||||
data-key="Agency"
|
|
||||||
base-url="Agencies"
|
|
||||||
:descriptor="AgencyDescriptor"
|
|
||||||
search-data-key="AgencyList"
|
|
||||||
:searchbar-props="{
|
|
||||||
url: 'Agencies',
|
|
||||||
label: 'agency.searchBar.label',
|
|
||||||
info: 'agency.searchBar.info',
|
|
||||||
}"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
import { describe, it, expect, vi, afterEach } from 'vitest';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
|
||||||
|
|
||||||
|
vi.mock('axios');
|
||||||
|
|
||||||
|
describe('getAgencies', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
const generateParams = (formData) => ({
|
||||||
|
params: {
|
||||||
|
warehouseFk: formData.warehouseId,
|
||||||
|
addressFk: formData.addressId,
|
||||||
|
landed: formData.landed,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fetch agencies data with correct parameters for valid formData', async () => {
|
||||||
|
const formData = {
|
||||||
|
warehouseId: '123',
|
||||||
|
addressId: '456',
|
||||||
|
landed: 'true',
|
||||||
|
};
|
||||||
|
|
||||||
|
await getAgencies(formData);
|
||||||
|
|
||||||
|
expect(axios.get).toHaveBeenCalledWith('Agencies/getAgenciesWithWarehouse', generateParams(formData));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not call API when formData is missing required landed field', async () => {
|
||||||
|
const formData = { warehouseId: '123', addressId: '456' };
|
||||||
|
|
||||||
|
await getAgencies(formData);
|
||||||
|
|
||||||
|
expect(axios.get).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not call API when formData is missing required addressId field', async () => {
|
||||||
|
const formData = { warehouseId: '123', landed: 'true' };
|
||||||
|
|
||||||
|
await getAgencies(formData);
|
||||||
|
|
||||||
|
expect(axios.get).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not call API when formData is missing required warehouseId field', async () => {
|
||||||
|
const formData = { addressId: '456', landed: 'true' };
|
||||||
|
|
||||||
|
await getAgencies(formData);
|
||||||
|
|
||||||
|
expect(axios.get).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export async function getAgencies(formData) {
|
||||||
|
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
||||||
|
let params = {
|
||||||
|
warehouseFk: formData.warehouseId,
|
||||||
|
addressFk: formData.addressId,
|
||||||
|
landed: formData.landed,
|
||||||
|
};
|
||||||
|
|
||||||
|
return await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
agency:
|
agency:
|
||||||
|
search: Search agency
|
||||||
|
searchInfo: You can search by name
|
||||||
isOwn: Own
|
isOwn: Own
|
||||||
isAnyVolumeAllowed: Any volume allowed
|
isAnyVolumeAllowed: Any volume allowed
|
||||||
notification:
|
notification:
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
agency:
|
agency:
|
||||||
|
search: Buscar agencia
|
||||||
|
searchInfo: Puedes buscar por nombre
|
||||||
isOwn: Propio
|
isOwn: Propio
|
||||||
isAnyVolumeAllowed: Cualquier volumen
|
isAnyVolumeAllowed: Cualquier volumen
|
||||||
removeItem: Agencia eliminada correctamente
|
removeItem: Agencia eliminada correctamente
|
||||||
|
|
|
@ -1,19 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
|
||||||
import RouteDescriptor from 'pages/Route/Card/RouteDescriptor.vue';
|
import RouteDescriptor from 'pages/Route/Card/RouteDescriptor.vue';
|
||||||
import RouteFilter from './RouteFilter.vue';
|
import VnCardBeta from 'src/components/common/VnCardBeta.vue';
|
||||||
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCardBeta data-key="Route" base-url="Routes" :descriptor="RouteDescriptor" />
|
||||||
data-key="Route"
|
|
||||||
base-url="Routes"
|
|
||||||
:descriptor="RouteDescriptor"
|
|
||||||
:filter-panel="RouteFilter"
|
|
||||||
search-data-key="RouteList"
|
|
||||||
>
|
|
||||||
<template #searchbar>
|
|
||||||
<RouteSearchbar />
|
|
||||||
</template>
|
|
||||||
</VnCard>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,19 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||||
import RoadmapDescriptor from 'pages/Route/Roadmap/RoadmapDescriptor.vue';
|
import RoadmapDescriptor from 'pages/Route/Roadmap/RoadmapDescriptor.vue';
|
||||||
import RoadmapFilter from 'pages/Route/Roadmap/RoadmapFilter.vue';
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCardBeta data-key="Roadmap" base-url="Roadmaps" :descriptor="RoadmapDescriptor" />
|
||||||
data-key="Roadmap"
|
|
||||||
base-url="Roadmaps"
|
|
||||||
:descriptor="RoadmapDescriptor"
|
|
||||||
:filter-panel="RoadmapFilter"
|
|
||||||
search-data-key="RoadmapList"
|
|
||||||
:searchbar-props="{
|
|
||||||
url: 'Roadmaps',
|
|
||||||
label: 'Search roadmap',
|
|
||||||
info: 'You can search by roadmap id or customer name',
|
|
||||||
}"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -18,22 +18,6 @@ const props = defineProps({
|
||||||
const emit = defineEmits(['search']);
|
const emit = defineEmits(['search']);
|
||||||
|
|
||||||
const supplierList = ref([]);
|
const supplierList = ref([]);
|
||||||
const exprBuilder = (param, value) => {
|
|
||||||
switch (param) {
|
|
||||||
case 'tractorPlate':
|
|
||||||
case 'trailerPlate':
|
|
||||||
case 'driverName':
|
|
||||||
case 'phone':
|
|
||||||
return { [param]: { like: `%${value}%` } };
|
|
||||||
case 'supplierFk':
|
|
||||||
case 'price':
|
|
||||||
return { [param]: value };
|
|
||||||
case 'from':
|
|
||||||
return { etd: { gte: value } };
|
|
||||||
case 'to':
|
|
||||||
return { etd: { lte: value } };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -48,7 +32,6 @@ const exprBuilder = (param, value) => {
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
:expr-builder="exprBuilder"
|
|
||||||
@search="emit('search')"
|
@search="emit('search')"
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
|
|
|
@ -3,17 +3,16 @@ import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import { toHour } from 'src/filters';
|
import { toHour } from 'src/filters';
|
||||||
|
|
||||||
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
|
||||||
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
|
||||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const tableRef = ref([]);
|
const tableRef = ref([]);
|
||||||
|
const dataKey = 'RouteList';
|
||||||
const routeFilter = {
|
const routeFilter = {
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -110,18 +109,23 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<RouteSearchbar />
|
<VnSection
|
||||||
<RightMenu>
|
:data-key
|
||||||
<template #right-panel>
|
:columns="columns"
|
||||||
<RouteFilter data-key="RouteList" />
|
prefix="route"
|
||||||
|
:array-data-props="{
|
||||||
|
url: 'Routes/filter',
|
||||||
|
userFilter: routeFilter,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #advanced-menu>
|
||||||
|
<RouteFilter :data-key />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
<template #body>
|
||||||
<VnTable
|
<VnTable
|
||||||
data-key="RouteList"
|
:data-key
|
||||||
url="Routes/filter"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:filter="routeFilter"
|
|
||||||
redirect="route"
|
redirect="route"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Routes',
|
urlCreate: 'Routes',
|
||||||
|
@ -138,4 +142,6 @@ const columns = computed(() => [
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
</template>
|
||||||
|
</VnSection>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -15,11 +15,14 @@ import RoadmapSummary from 'pages/Route/Roadmap/RoadmapSummary.vue';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInputTime from 'src/components/common/VnInputTime.vue';
|
import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||||
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
import RoadmapFilter from './Roadmap/RoadmapFilter.vue';
|
||||||
|
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const selectedRows = ref([]);
|
const selectedRows = ref([]);
|
||||||
|
const dataKey = 'RoadmapList';
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -128,14 +131,28 @@ function confirmRemove() {
|
||||||
})
|
})
|
||||||
.onOk(() => tableRef.value++);
|
.onOk(() => tableRef.value++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function exprBuilder(param, value) {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
|
||||||
|
case 'tractorPlate':
|
||||||
|
case 'trailerPlate':
|
||||||
|
case 'driverName':
|
||||||
|
case 'phone':
|
||||||
|
return { [param]: { like: `%${value}%` } };
|
||||||
|
case 'supplierFk':
|
||||||
|
case 'price':
|
||||||
|
return { [param]: value };
|
||||||
|
case 'from':
|
||||||
|
return { etd: { gte: value } };
|
||||||
|
case 'to':
|
||||||
|
return { etd: { lte: value } };
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
|
||||||
data-key="RoadmapList"
|
|
||||||
:label="t('Search roadmaps')"
|
|
||||||
:info="t('You can search by roadmap reference')"
|
|
||||||
/>
|
|
||||||
<QDialog v-model="isCloneDialogOpen">
|
<QDialog v-model="isCloneDialogOpen">
|
||||||
<QCard style="min-width: 350px">
|
<QCard style="min-width: 350px">
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
|
@ -177,12 +194,24 @@ function confirmRemove() {
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
|
<VnSection
|
||||||
|
:data-key
|
||||||
|
:columns="columns"
|
||||||
|
prefix="route.roadmap"
|
||||||
|
:array-data-props="{
|
||||||
|
url: 'roadmaps',
|
||||||
|
exprBuilder,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #advanced-menu>
|
||||||
|
<RoadmapFilter :dataKey />
|
||||||
|
</template>
|
||||||
|
<template #body>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="RoadmapList"
|
:data-key
|
||||||
url="roadmaps"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:right-search="true"
|
:right-search="false"
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
v-model:selected="selectedRows"
|
v-model:selected="selectedRows"
|
||||||
|
@ -210,6 +239,8 @@ function confirmRemove() {
|
||||||
<VnInputTime v-model="data.etd" />
|
<VnInputTime v-model="data.etd" />
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
</template>
|
||||||
|
</VnSection>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
route:
|
route:
|
||||||
|
roadmap:
|
||||||
|
search: Search roadmap
|
||||||
|
searchInfo: You can search by roadmap reference
|
||||||
params:
|
params:
|
||||||
etd: ETD
|
etd: ETD
|
||||||
tractorPlate: Plate
|
tractorPlate: Plate
|
||||||
|
@ -36,6 +39,8 @@ route:
|
||||||
Summary: Summary
|
Summary: Summary
|
||||||
Route is closed: Route is closed
|
Route is closed: Route is closed
|
||||||
Route is not served: Route is not served
|
Route is not served: Route is not served
|
||||||
|
search: Search route
|
||||||
|
searchInfo: You can search by route reference
|
||||||
cmr:
|
cmr:
|
||||||
list:
|
list:
|
||||||
results: results
|
results: results
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
route:
|
route:
|
||||||
|
roadmap:
|
||||||
|
search: Buscar troncales
|
||||||
|
searchInfo: Puedes buscar por referencia del troncal
|
||||||
params:
|
params:
|
||||||
agencyModeName: Agencia Ruta
|
agencyModeName: Agencia Ruta
|
||||||
agencyAgreement: Agencia Acuerdo
|
agencyAgreement: Agencia Acuerdo
|
||||||
|
@ -37,6 +40,8 @@ route:
|
||||||
Summary: Resumen
|
Summary: Resumen
|
||||||
Route is closed: La ruta está cerrada
|
Route is closed: La ruta está cerrada
|
||||||
Route is not served: La ruta no está servida
|
Route is not served: La ruta no está servida
|
||||||
|
search: Buscar rutas
|
||||||
|
searchInfo: Puedes buscar por referencia de la ruta
|
||||||
cmr:
|
cmr:
|
||||||
list:
|
list:
|
||||||
results: resultados
|
results: resultados
|
||||||
|
|
|
@ -16,6 +16,8 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||||
import { useAcl } from 'src/composables/useAcl';
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
|
||||||
|
import { getClient } from 'src/pages/Customer/composables/getClient';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
ticket: {
|
ticket: {
|
||||||
|
@ -40,7 +42,10 @@ const { openReport, sendEmail } = usePrintService();
|
||||||
const ticketSummary = useArrayData('TicketSummary');
|
const ticketSummary = useArrayData('TicketSummary');
|
||||||
const { ticket } = toRefs(props);
|
const { ticket } = toRefs(props);
|
||||||
const ticketId = computed(() => props.ticket.id ?? currentRoute.value.params.id);
|
const ticketId = computed(() => props.ticket.id ?? currentRoute.value.params.id);
|
||||||
const client = ref();
|
const client = ref(null);
|
||||||
|
const address = ref(null);
|
||||||
|
const addressesOptions = ref([]);
|
||||||
|
const selectedClient = ref();
|
||||||
const showTransferDialog = ref(false);
|
const showTransferDialog = ref(false);
|
||||||
const showTurnDialog = ref(false);
|
const showTurnDialog = ref(false);
|
||||||
const showChangeTimeDialog = ref(false);
|
const showChangeTimeDialog = ref(false);
|
||||||
|
@ -52,6 +57,31 @@ const weight = ref();
|
||||||
const hasDocuwareFile = ref();
|
const hasDocuwareFile = ref();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const canRestoreTicket = ref(false);
|
const canRestoreTicket = ref(false);
|
||||||
|
|
||||||
|
const onClientSelected = async(clientId) =>{
|
||||||
|
client.value = clientId;
|
||||||
|
await fetchClient();
|
||||||
|
await fetchAddresses();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAddressSelected = (addressId) => {
|
||||||
|
address.value = addressId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchClient = async () => {
|
||||||
|
const { data } = await getClient(client.value)
|
||||||
|
const [retrievedClient] = data;
|
||||||
|
selectedClient.value = retrievedClient;
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchAddresses = async () => {
|
||||||
|
const { data } = await getAddresses(client.value);
|
||||||
|
addressesOptions.value = data;
|
||||||
|
|
||||||
|
const { defaultAddress } = selectedClient.value;
|
||||||
|
address.value = defaultAddress.id;
|
||||||
|
};
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
clone: async () => {
|
clone: async () => {
|
||||||
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
||||||
|
@ -260,17 +290,14 @@ async function makeInvoice() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function transferClient(client) {
|
async function transferClient() {
|
||||||
const params = {
|
const params = {
|
||||||
clientFk: client,
|
clientFk: client.value,
|
||||||
|
addressFk: address.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await axios.patch(
|
await axios.patch( `Tickets/${ticketId.value}/transferClient`, params );
|
||||||
`Tickets/${ticketId.value}/transferClient`,
|
window.location.reload();
|
||||||
params
|
|
||||||
);
|
|
||||||
|
|
||||||
if (data) window.location.reload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addTurn(day) {
|
async function addTurn(day) {
|
||||||
|
@ -446,7 +473,7 @@ async function ticketToRestore() {
|
||||||
</QItem>
|
</QItem>
|
||||||
<QDialog ref="dialogRef" v-model="showTransferDialog">
|
<QDialog ref="dialogRef" v-model="showTransferDialog">
|
||||||
<FormPopup
|
<FormPopup
|
||||||
@on-submit="transferClient(client)"
|
@on-submit="transferClient()"
|
||||||
:title="t('Transfer client')"
|
:title="t('Transfer client')"
|
||||||
:custom-submit-button-label="t('Transfer client')"
|
:custom-submit-button-label="t('Transfer client')"
|
||||||
:default-cancel-button="false"
|
:default-cancel-button="false"
|
||||||
|
@ -454,10 +481,11 @@ async function ticketToRestore() {
|
||||||
<template #form-inputs>
|
<template #form-inputs>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Clients"
|
url="Clients"
|
||||||
:fields="['id', 'name']"
|
:fields="['id', 'name', 'defaultAddressFk']"
|
||||||
v-model="client"
|
v-model="client"
|
||||||
:label="t('Client')"
|
:label="t('Client')"
|
||||||
auto-load
|
auto-load
|
||||||
|
@update:model-value="() => onClientSelected(client)"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -470,6 +498,29 @@ async function ticketToRestore() {
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
|
<VnSelect
|
||||||
|
:disable="!client"
|
||||||
|
:options="addressesOptions"
|
||||||
|
:fields="['id', 'nickname']"
|
||||||
|
option-value="id"
|
||||||
|
option-label="nickname"
|
||||||
|
v-model="address"
|
||||||
|
:label="t('ticketList.addressNickname')"
|
||||||
|
auto-load
|
||||||
|
:hint="!client ? t('Select a client to enable') : ''"
|
||||||
|
@update:model-value="() => onAddressSelected(address)"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ `#${scope.opt.id} - ` }}
|
||||||
|
{{ scope.opt.nickname }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
</template>
|
</template>
|
||||||
</FormPopup>
|
</FormPopup>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
|
@ -814,4 +865,5 @@ es:
|
||||||
Are you sure you want to restore the ticket?: ¿Seguro que quieres restaurar el ticket?
|
Are you sure you want to restore the ticket?: ¿Seguro que quieres restaurar el ticket?
|
||||||
You are going to restore this ticket: Vas a restaurar este ticket
|
You are going to restore this ticket: Vas a restaurar este ticket
|
||||||
Ticket restored: Ticket restaurado
|
Ticket restored: Ticket restaurado
|
||||||
|
Select a client to enable: Selecciona un cliente para habilitar
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -9,9 +9,11 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
import { getClient } from 'src/pages/Customer/composables/getClient';
|
||||||
|
import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
|
||||||
|
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
|
||||||
|
|
||||||
import { useState } from 'composables/useState';
|
import { useState } from 'composables/useState';
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -37,33 +39,13 @@ onBeforeMount(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchClient = async (formData) => {
|
const fetchClient = async (formData) => {
|
||||||
const filter = {
|
const { data } = await getClient(formData.clientId);
|
||||||
include: {
|
|
||||||
relation: 'defaultAddress',
|
|
||||||
scope: {
|
|
||||||
fields: ['id', 'agencyModeFk'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
where: { id: formData.clientId },
|
|
||||||
};
|
|
||||||
const params = { filter: JSON.stringify(filter) };
|
|
||||||
const { data } = await axios.get('Clients', { params });
|
|
||||||
const [client] = data;
|
const [client] = data;
|
||||||
selectedClient.value = client;
|
selectedClient.value = client;
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAddresses = async (formData) => {
|
const fetchAddresses = async (formData) => {
|
||||||
if (!formData.clientId) return;
|
const { data } = await getAddresses(formData.clientId);
|
||||||
|
|
||||||
const filter = {
|
|
||||||
fields: ['nickname', 'street', 'city', 'id'],
|
|
||||||
where: { isActive: true },
|
|
||||||
order: 'nickname ASC',
|
|
||||||
};
|
|
||||||
const params = { filter: JSON.stringify(filter) };
|
|
||||||
const { data } = await axios.get(`Clients/${formData.clientId}/addresses`, {
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
addressesOptions.value = data;
|
addressesOptions.value = data;
|
||||||
|
|
||||||
const { defaultAddress } = selectedClient.value;
|
const { defaultAddress } = selectedClient.value;
|
||||||
|
@ -76,15 +58,7 @@ const onClientSelected = async (formData) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAvailableAgencies = async (formData) => {
|
const fetchAvailableAgencies = async (formData) => {
|
||||||
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
const { data } = await getAgencies(formData);
|
||||||
let params = {
|
|
||||||
warehouseFk: formData.warehouseId,
|
|
||||||
addressFk: formData.addressId,
|
|
||||||
landed: formData.landed,
|
|
||||||
};
|
|
||||||
|
|
||||||
const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
|
||||||
|
|
||||||
agenciesOptions.value = data;
|
agenciesOptions.value = data;
|
||||||
|
|
||||||
const defaultAgency = agenciesOptions.value.find(
|
const defaultAgency = agenciesOptions.value.find(
|
||||||
|
|
|
@ -9,9 +9,11 @@ import FetchData from 'components/FetchData.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
|
import { getClient } from 'src/pages/Customer/composables/getClient';
|
||||||
|
import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
|
||||||
|
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
|
||||||
|
|
||||||
import { useState } from 'composables/useState';
|
import { useState } from 'composables/useState';
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -37,33 +39,13 @@ onBeforeMount(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchClient = async (formData) => {
|
const fetchClient = async (formData) => {
|
||||||
const filter = {
|
const { data } = await getClient(formData.clientId);
|
||||||
include: {
|
|
||||||
relation: 'defaultAddress',
|
|
||||||
scope: {
|
|
||||||
fields: ['id', 'agencyModeFk'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
where: { id: formData.clientId },
|
|
||||||
};
|
|
||||||
const params = { filter: JSON.stringify(filter) };
|
|
||||||
const { data } = await axios.get('Clients', { params });
|
|
||||||
const [client] = data;
|
const [client] = data;
|
||||||
selectedClient.value = client;
|
selectedClient.value = client;
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAddresses = async (formData) => {
|
const fetchAddresses = async (formData) => {
|
||||||
if (!formData.clientId) return;
|
const { data } = await getAddresses(formData.clientId);
|
||||||
|
|
||||||
const filter = {
|
|
||||||
fields: ['nickname', 'street', 'city', 'id'],
|
|
||||||
where: { isActive: true },
|
|
||||||
order: 'nickname ASC',
|
|
||||||
};
|
|
||||||
const params = { filter: JSON.stringify(filter) };
|
|
||||||
const { data } = await axios.get(`Clients/${formData.clientId}/addresses`, {
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
addressesOptions.value = data;
|
addressesOptions.value = data;
|
||||||
|
|
||||||
const { defaultAddress } = selectedClient.value;
|
const { defaultAddress } = selectedClient.value;
|
||||||
|
@ -76,15 +58,7 @@ const onClientSelected = async (formData) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAvailableAgencies = async (formData) => {
|
const fetchAvailableAgencies = async (formData) => {
|
||||||
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
const { data } = await getAgencies(formData);
|
||||||
let params = {
|
|
||||||
warehouseFk: formData.warehouseId,
|
|
||||||
addressFk: formData.addressId,
|
|
||||||
landed: formData.landed,
|
|
||||||
};
|
|
||||||
|
|
||||||
const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
|
||||||
|
|
||||||
agenciesOptions.value = data;
|
agenciesOptions.value = data;
|
||||||
|
|
||||||
const defaultAgency = agenciesOptions.value.find(
|
const defaultAgency = agenciesOptions.value.find(
|
||||||
|
|
|
@ -22,6 +22,9 @@ import { toTimeFormat } from 'src/filters/date';
|
||||||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||||
import VnSection from 'src/components/common/VnSection.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
import { getClient } from 'src/pages/Customer/composables/getClient';
|
||||||
|
import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
|
||||||
|
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -237,15 +240,7 @@ const onClientSelected = async (formData) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAvailableAgencies = async (formData) => {
|
const fetchAvailableAgencies = async (formData) => {
|
||||||
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
const { data } = await getAgencies(formData);
|
||||||
let params = {
|
|
||||||
warehouseFk: formData.warehouseId,
|
|
||||||
addressFk: formData.addressId,
|
|
||||||
landed: formData.landed,
|
|
||||||
};
|
|
||||||
|
|
||||||
const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
|
||||||
|
|
||||||
agenciesOptions.value = data;
|
agenciesOptions.value = data;
|
||||||
|
|
||||||
const defaultAgency = agenciesOptions.value.find(
|
const defaultAgency = agenciesOptions.value.find(
|
||||||
|
@ -257,34 +252,13 @@ const fetchAvailableAgencies = async (formData) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchClient = async (formData) => {
|
const fetchClient = async (formData) => {
|
||||||
const filter = {
|
const { data } = await getClient(formData.clientId);
|
||||||
include: {
|
|
||||||
relation: 'defaultAddress',
|
|
||||||
scope: {
|
|
||||||
fields: ['id', 'agencyModeFk'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
where: { id: formData.clientId },
|
|
||||||
};
|
|
||||||
const params = { filter: JSON.stringify(filter) };
|
|
||||||
const { data } = await axios.get('Clients', { params });
|
|
||||||
const [client] = data;
|
const [client] = data;
|
||||||
selectedClient.value = client;
|
selectedClient.value = client;
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAddresses = async (formData) => {
|
const fetchAddresses = async (formData) => {
|
||||||
if (!formData.clientId) return;
|
const { data } = await getAddresses(formData.clientId);
|
||||||
|
|
||||||
const filter = {
|
|
||||||
fields: ['nickname', 'street', 'city', 'id', 'isActive'],
|
|
||||||
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
|
|
||||||
};
|
|
||||||
const params = { filter: JSON.stringify(filter) };
|
|
||||||
const { data } = await axios.get(`Clients/${formData.clientId}/addresses`, {
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
addressesOptions.value = data;
|
|
||||||
|
|
||||||
addressesOptions.value = data;
|
addressesOptions.value = data;
|
||||||
|
|
||||||
const { defaultAddress } = selectedClient.value;
|
const { defaultAddress } = selectedClient.value;
|
||||||
|
|
|
@ -1,25 +1,13 @@
|
||||||
import { RouterView } from 'vue-router';
|
import { RouterView } from 'vue-router';
|
||||||
|
|
||||||
export default {
|
const agencyCard = {
|
||||||
path: '/agency',
|
path: ':id',
|
||||||
name: 'Agency',
|
|
||||||
meta: {
|
|
||||||
title: 'agency',
|
|
||||||
icon: 'garage_home',
|
|
||||||
moduleName: 'Agency',
|
|
||||||
},
|
|
||||||
component: RouterView,
|
|
||||||
redirect: { name: 'AgencyCard' },
|
|
||||||
menus: {
|
|
||||||
main: [],
|
|
||||||
card: ['AgencyBasicData', 'AgencyModes', 'AgencyWorkCenters', 'AgencyLog'],
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '/agency/:id',
|
|
||||||
name: 'AgencyCard',
|
name: 'AgencyCard',
|
||||||
component: () => import('src/pages/Route/Agency/Card/AgencyCard.vue'),
|
component: () => import('src/pages/Route/Agency/Card/AgencyCard.vue'),
|
||||||
redirect: { name: 'AgencySummary' },
|
redirect: { name: 'AgencySummary' },
|
||||||
|
meta: {
|
||||||
|
menu: ['AgencyBasicData', 'AgencyModes', 'AgencyWorkCenters', 'AgencyLog'],
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'AgencySummary',
|
name: 'AgencySummary',
|
||||||
|
@ -28,8 +16,7 @@ export default {
|
||||||
title: 'summary',
|
title: 'summary',
|
||||||
icon: 'view_list',
|
icon: 'view_list',
|
||||||
},
|
},
|
||||||
component: () =>
|
component: () => import('src/pages/Route/Agency/Card/AgencySummary.vue'),
|
||||||
import('src/pages/Route/Agency/Card/AgencySummary.vue'),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'AgencyBasicData',
|
name: 'AgencyBasicData',
|
||||||
|
@ -38,8 +25,7 @@ export default {
|
||||||
title: 'basicData',
|
title: 'basicData',
|
||||||
icon: 'vn:settings',
|
icon: 'vn:settings',
|
||||||
},
|
},
|
||||||
component: () =>
|
component: () => import('pages/Route/Agency/Card/AgencyBasicData.vue'),
|
||||||
import('pages/Route/Agency/Card/AgencyBasicData.vue'),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'workCenter',
|
path: 'workCenter',
|
||||||
|
@ -54,9 +40,7 @@ export default {
|
||||||
title: 'workCenters',
|
title: 'workCenters',
|
||||||
},
|
},
|
||||||
component: () =>
|
component: () =>
|
||||||
import(
|
import('src/pages/Route/Agency/Card/AgencyWorkcenter.vue'),
|
||||||
'src/pages/Route/Agency/Card/AgencyWorkcenter.vue'
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -87,6 +71,43 @@ export default {
|
||||||
component: () => import('src/pages/Route/Agency/Card/AgencyLog.vue'),
|
component: () => import('src/pages/Route/Agency/Card/AgencyLog.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Agency',
|
||||||
|
path: '/agency',
|
||||||
|
meta: {
|
||||||
|
title: 'agency',
|
||||||
|
icon: 'garage_home',
|
||||||
|
moduleName: 'Agency',
|
||||||
|
},
|
||||||
|
component: RouterView,
|
||||||
|
redirect: { name: 'RouteMain' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'AgencyMain',
|
||||||
|
path: '',
|
||||||
|
component: () => import('src/components/common/VnModule.vue'),
|
||||||
|
redirect: { name: 'AgencyIndexMain' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'AgencyIndexMain',
|
||||||
|
path: '',
|
||||||
|
redirect: { name: 'AgencyList' },
|
||||||
|
component: () => import('src/pages/Route/Agency/AgencyList.vue'),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'AgencyList',
|
||||||
|
path: 'list',
|
||||||
|
meta: {
|
||||||
|
title: 'list',
|
||||||
|
icon: 'view_list',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
agencyCard,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,8 +12,6 @@ import Supplier from './supplier';
|
||||||
import Travel from './travel';
|
import Travel from './travel';
|
||||||
import Order from './order';
|
import Order from './order';
|
||||||
import Entry from './entry';
|
import Entry from './entry';
|
||||||
import roadmap from './roadmap';
|
|
||||||
import Agency from './agency';
|
|
||||||
import Zone from './zone';
|
import Zone from './zone';
|
||||||
import Account from './account';
|
import Account from './account';
|
||||||
import Monitor from './monitor';
|
import Monitor from './monitor';
|
||||||
|
@ -33,8 +31,6 @@ export default [
|
||||||
Order,
|
Order,
|
||||||
invoiceIn,
|
invoiceIn,
|
||||||
Entry,
|
Entry,
|
||||||
roadmap,
|
|
||||||
Agency,
|
|
||||||
Zone,
|
Zone,
|
||||||
Account,
|
Account,
|
||||||
Monitor,
|
Monitor,
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
import { RouterView } from 'vue-router';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
path: '/route/roadmap',
|
|
||||||
name: 'Roadmap',
|
|
||||||
meta: {
|
|
||||||
title: 'roadmap',
|
|
||||||
icon: 'vn:troncales',
|
|
||||||
moduleName: 'Roadmap',
|
|
||||||
},
|
|
||||||
component: RouterView,
|
|
||||||
redirect: { name: 'RouteMain' },
|
|
||||||
menus: {
|
|
||||||
card: ['RoadmapBasicData', 'RoadmapStops'],
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
name: 'RouteRoadmapCard',
|
|
||||||
path: ':id',
|
|
||||||
component: () => import('src/pages/Route/Roadmap/RoadmapCard.vue'),
|
|
||||||
redirect: { name: 'RoadmapSummary' },
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
name: 'RoadmapSummary',
|
|
||||||
path: 'summary',
|
|
||||||
meta: {
|
|
||||||
title: 'summary',
|
|
||||||
icon: 'open_in_new',
|
|
||||||
},
|
|
||||||
component: () => import('pages/Route/Roadmap/RoadmapSummary.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'RoadmapBasicData',
|
|
||||||
path: 'basic-data',
|
|
||||||
meta: {
|
|
||||||
title: 'basicData',
|
|
||||||
icon: 'vn:settings',
|
|
||||||
},
|
|
||||||
component: () => import('pages/Route/Roadmap/RoadmapBasicData.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'RoadmapStops',
|
|
||||||
path: 'stops',
|
|
||||||
meta: {
|
|
||||||
title: 'stops',
|
|
||||||
icon: 'vn:lines',
|
|
||||||
},
|
|
||||||
component: () => import('pages/Route/Roadmap/RoadmapStops.vue'),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
|
@ -1,110 +1,13 @@
|
||||||
import { RouterView } from 'vue-router';
|
import { RouterView } from 'vue-router';
|
||||||
|
|
||||||
export default {
|
const routeCard = {
|
||||||
path: '/route',
|
|
||||||
name: 'Route',
|
|
||||||
meta: {
|
|
||||||
title: 'routes',
|
|
||||||
icon: 'vn:delivery',
|
|
||||||
moduleName: 'Route',
|
|
||||||
},
|
|
||||||
component: RouterView,
|
|
||||||
redirect: { name: 'RouteMain' },
|
|
||||||
menus: {
|
|
||||||
main: [
|
|
||||||
'RouteList',
|
|
||||||
'RouteExtendedList',
|
|
||||||
'RouteAutonomous',
|
|
||||||
'RouteRoadmap',
|
|
||||||
'CmrList',
|
|
||||||
'AgencyList',
|
|
||||||
],
|
|
||||||
card: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '/route',
|
|
||||||
name: 'RouteMain',
|
|
||||||
component: () => import('src/components/common/VnModule.vue'),
|
|
||||||
redirect: { name: 'RouteList' },
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'list',
|
|
||||||
name: 'RouteList',
|
|
||||||
meta: {
|
|
||||||
title: 'RouteList',
|
|
||||||
icon: 'view_list',
|
|
||||||
},
|
|
||||||
component: () => import('src/pages/Route/RouteList.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'extended-list',
|
|
||||||
name: 'RouteExtendedList',
|
|
||||||
meta: {
|
|
||||||
title: 'RouteExtendedList',
|
|
||||||
icon: 'format_list_bulleted',
|
|
||||||
},
|
|
||||||
component: () => import('src/pages/Route/RouteExtendedList.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'create',
|
|
||||||
name: 'RouteCreate',
|
|
||||||
meta: {
|
|
||||||
title: 'routeCreate',
|
|
||||||
icon: 'add',
|
|
||||||
},
|
|
||||||
component: () => import('src/pages/Route/Card/RouteForm.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'agency-term',
|
|
||||||
name: 'RouteAutonomous',
|
|
||||||
meta: {
|
|
||||||
title: 'autonomous',
|
|
||||||
icon: 'vn:agency-term',
|
|
||||||
},
|
|
||||||
component: () => import('src/pages/Route/RouteAutonomous.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'roadmap',
|
|
||||||
name: 'RouteRoadmap',
|
|
||||||
meta: {
|
|
||||||
title: 'RouteRoadmap',
|
|
||||||
icon: 'vn:troncales',
|
|
||||||
},
|
|
||||||
component: () => import('src/pages/Route/RouteRoadmap.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'cmr',
|
|
||||||
name: 'CmrList',
|
|
||||||
meta: {
|
|
||||||
title: 'cmrsList',
|
|
||||||
icon: 'fact_check',
|
|
||||||
},
|
|
||||||
component: () => import('src/pages/Route/Cmr/CmrList.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/agency',
|
|
||||||
redirect: { name: 'AgencyList' },
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'list',
|
|
||||||
name: 'AgencyList',
|
|
||||||
meta: {
|
|
||||||
title: 'agencyList',
|
|
||||||
icon: 'list',
|
|
||||||
},
|
|
||||||
component: () =>
|
|
||||||
import('src/pages/Route/Agency/AgencyList.vue'),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'RouteCard',
|
name: 'RouteCard',
|
||||||
path: ':id',
|
path: ':id',
|
||||||
component: () => import('src/pages/Route/Card/RouteCard.vue'),
|
component: () => import('src/pages/Route/Card/RouteCard.vue'),
|
||||||
redirect: { name: 'RouteSummary' },
|
redirect: { name: 'RouteSummary' },
|
||||||
|
meta: {
|
||||||
|
menu: ['RouteBasicData', 'RouteTickets', 'RouteLog'],
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'RouteBasicData',
|
name: 'RouteBasicData',
|
||||||
|
@ -143,6 +46,241 @@ export default {
|
||||||
component: () => import('src/pages/Route/RouteLog.vue'),
|
component: () => import('src/pages/Route/RouteLog.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const agencyCard = {
|
||||||
|
path: ':id',
|
||||||
|
name: 'AgencyCard',
|
||||||
|
component: () => import('src/pages/Route/Agency/Card/AgencyCard.vue'),
|
||||||
|
redirect: { name: 'AgencySummary' },
|
||||||
|
meta: {
|
||||||
|
menu: ['AgencyBasicData', 'AgencyModes', 'AgencyWorkCenters', 'AgencyLog'],
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'AgencySummary',
|
||||||
|
path: 'summary',
|
||||||
|
meta: {
|
||||||
|
title: 'summary',
|
||||||
|
icon: 'view_list',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/Agency/Card/AgencySummary.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'AgencyBasicData',
|
||||||
|
path: 'basic-data',
|
||||||
|
meta: {
|
||||||
|
title: 'basicData',
|
||||||
|
icon: 'vn:settings',
|
||||||
|
},
|
||||||
|
component: () => import('pages/Route/Agency/Card/AgencyBasicData.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'workCenter',
|
||||||
|
name: 'AgencyWorkCenterCard',
|
||||||
|
redirect: { name: 'AgencyWorkCenters' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
name: 'AgencyWorkCenters',
|
||||||
|
meta: {
|
||||||
|
icon: 'apartment',
|
||||||
|
title: 'workCenters',
|
||||||
|
},
|
||||||
|
component: () =>
|
||||||
|
import('src/pages/Route/Agency/Card/AgencyWorkcenter.vue'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'modes',
|
||||||
|
name: 'AgencyModesCard',
|
||||||
|
redirect: { name: 'AgencyModes' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
name: 'AgencyModes',
|
||||||
|
meta: {
|
||||||
|
icon: 'format_list_bulleted',
|
||||||
|
title: 'modes',
|
||||||
|
},
|
||||||
|
component: () =>
|
||||||
|
import('src/pages/Route/Agency/Card/AgencyModes.vue'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'AgencyLog',
|
||||||
|
path: 'log',
|
||||||
|
meta: {
|
||||||
|
title: 'log',
|
||||||
|
icon: 'history',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/Agency/Card/AgencyLog.vue'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const roadmapCard = {
|
||||||
|
path: ':id',
|
||||||
|
name: 'RoadmapCard',
|
||||||
|
component: () => import('src/pages/Route/Roadmap/RoadmapCard.vue'),
|
||||||
|
redirect: { name: 'RoadmapSummary' },
|
||||||
|
meta: {
|
||||||
|
menu: ['RoadmapBasicData', 'RoadmapStops'],
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'RoadmapSummary',
|
||||||
|
path: 'summary',
|
||||||
|
meta: {
|
||||||
|
title: 'summary',
|
||||||
|
icon: 'open_in_new',
|
||||||
|
},
|
||||||
|
component: () => import('pages/Route/Roadmap/RoadmapSummary.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'RoadmapBasicData',
|
||||||
|
path: 'basic-data',
|
||||||
|
meta: {
|
||||||
|
title: 'basicData',
|
||||||
|
icon: 'vn:settings',
|
||||||
|
},
|
||||||
|
component: () => import('pages/Route/Roadmap/RoadmapBasicData.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'RoadmapStops',
|
||||||
|
path: 'stops',
|
||||||
|
meta: {
|
||||||
|
title: 'stops',
|
||||||
|
icon: 'vn:lines',
|
||||||
|
},
|
||||||
|
component: () => import('pages/Route/Roadmap/RoadmapStops.vue'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Route',
|
||||||
|
path: '/route',
|
||||||
|
meta: {
|
||||||
|
title: 'routes',
|
||||||
|
icon: 'vn:delivery',
|
||||||
|
moduleName: 'Route',
|
||||||
|
menu: [
|
||||||
|
'RouteList',
|
||||||
|
'RouteExtendedList',
|
||||||
|
'RouteAutonomous',
|
||||||
|
'RouteRoadmap',
|
||||||
|
'CmrList',
|
||||||
|
'AgencyList',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
component: RouterView,
|
||||||
|
redirect: { name: 'RouteMain' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'RouteMain',
|
||||||
|
path: '',
|
||||||
|
component: () => import('src/components/common/VnModule.vue'),
|
||||||
|
redirect: { name: 'RouteIndexMain' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
name: 'RouteIndexMain',
|
||||||
|
redirect: { name: 'RouteList' },
|
||||||
|
component: () => import('src/pages/Route/RouteList.vue'),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'RouteList',
|
||||||
|
path: 'list',
|
||||||
|
meta: {
|
||||||
|
title: 'list',
|
||||||
|
icon: 'view_list',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
routeCard,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'extended-list',
|
||||||
|
name: 'RouteExtendedList',
|
||||||
|
meta: {
|
||||||
|
title: 'RouteExtendedList',
|
||||||
|
icon: 'format_list_bulleted',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/RouteExtendedList.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'create',
|
||||||
|
name: 'RouteCreate',
|
||||||
|
meta: {
|
||||||
|
title: 'routeCreate',
|
||||||
|
icon: 'add',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/Card/RouteForm.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'agency-term',
|
||||||
|
name: 'RouteAutonomous',
|
||||||
|
meta: {
|
||||||
|
title: 'autonomous',
|
||||||
|
icon: 'vn:agency-term',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/RouteAutonomous.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'roadmap',
|
||||||
|
name: 'RouteRoadmap',
|
||||||
|
redirect: { name: 'RoadmapList' },
|
||||||
|
meta: {
|
||||||
|
title: 'RouteRoadmap',
|
||||||
|
icon: 'vn:troncales',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/RouteRoadmap.vue'),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'RoadmapList',
|
||||||
|
path: 'list',
|
||||||
|
meta: {
|
||||||
|
title: 'list',
|
||||||
|
icon: 'view_list',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
roadmapCard,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'cmr',
|
||||||
|
name: 'CmrList',
|
||||||
|
meta: {
|
||||||
|
title: 'cmrsList',
|
||||||
|
icon: 'fact_check',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/Cmr/CmrList.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'agency',
|
||||||
|
name: 'RouteAgency',
|
||||||
|
redirect: { name: 'AgencyList' },
|
||||||
|
meta: {
|
||||||
|
title: 'agency',
|
||||||
|
icon: 'garage_home',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Route/Agency/AgencyList.vue'),
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'AgencyList',
|
||||||
|
path: 'list',
|
||||||
|
meta: {
|
||||||
|
title: 'list',
|
||||||
|
icon: 'view_list',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
agencyCard,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,8 +12,6 @@ import travel from './modules/travel';
|
||||||
import shelving from 'src/router/modules/shelving';
|
import shelving from 'src/router/modules/shelving';
|
||||||
import order from 'src/router/modules/order';
|
import order from 'src/router/modules/order';
|
||||||
import entry from 'src/router/modules/entry';
|
import entry from 'src/router/modules/entry';
|
||||||
import roadmap from 'src/router/modules/roadmap';
|
|
||||||
import agency from 'src/router/modules/agency';
|
|
||||||
import zone from 'src/router/modules/zone';
|
import zone from 'src/router/modules/zone';
|
||||||
import account from './modules/account';
|
import account from './modules/account';
|
||||||
import monitor from 'src/router/modules/monitor';
|
import monitor from 'src/router/modules/monitor';
|
||||||
|
@ -82,9 +80,7 @@ const routes = [
|
||||||
route,
|
route,
|
||||||
supplier,
|
supplier,
|
||||||
travel,
|
travel,
|
||||||
roadmap,
|
|
||||||
entry,
|
entry,
|
||||||
agency,
|
|
||||||
zone,
|
zone,
|
||||||
account,
|
account,
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe('Client list', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('Client list create new client', () => {
|
it('Client list create new client', () => {
|
||||||
cy.addBtnClick();
|
cy.addBtnClick();
|
||||||
const randomInt = Math.floor(Math.random() * 90) + 10;
|
const randomInt = Math.floor(Math.random() * 90) + 10;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('Client unpaid', () => {
|
describe('Client unpaid', () => {
|
||||||
|
const UnpaidCheckBox = '[data-cy="UnpaidCheckBox"]';
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1280, 720);
|
cy.viewport(1280, 720);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
|
@ -7,7 +8,7 @@ describe('Client unpaid', () => {
|
||||||
it('Should add unpaid', () => {
|
it('Should add unpaid', () => {
|
||||||
cy.visit('#/customer/1102/others/unpaid');
|
cy.visit('#/customer/1102/others/unpaid');
|
||||||
cy.get('.q-card').should('be.visible');
|
cy.get('.q-card').should('be.visible');
|
||||||
cy.get('.q-checkbox__inner').click();
|
cy.get(UnpaidCheckBox).click();
|
||||||
cy.dataCy('customerUnpaidAmount').find('input').type('100');
|
cy.dataCy('customerUnpaidAmount').find('input').type('100');
|
||||||
cy.dataCy('customerUnpaidDate').find('input').type('01/01/2001');
|
cy.dataCy('customerUnpaidDate').find('input').type('01/01/2001');
|
||||||
cy.get('.q-btn-group > .q-btn--standard').click();
|
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||||
|
|
|
@ -2,7 +2,7 @@ describe('AgencyWorkCenter', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/agency/11/workCenter`);
|
cy.visit(`/#/route/agency/11/workCenter`);
|
||||||
});
|
});
|
||||||
const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
|
const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
|
||||||
const workCenterCombobox = 'input[role="combobox"]';
|
const workCenterCombobox = 'input[role="combobox"]';
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
describe('RoadMap', () => {
|
describe('RoadMap', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/route/roadmap`);
|
cy.visit(`/#/route/roadmap`);
|
||||||
});
|
});
|
||||||
it('Route list create roadmap and redirect', () => {
|
it('Route list create roadmap and redirect', () => {
|
||||||
cy.addBtnClick();
|
cy.addBtnClick();
|
||||||
cy.get('input[name="name"]').eq(1).type('roadMapTestOne{enter}');
|
cy.get('input[name="name"]').type('roadMapTestOne{enter}');
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
cy.get('.q-notification__message').should('have.text', 'Data created');
|
||||||
cy.url().should('include', '/summary');
|
cy.url().should('include', '/summary');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue