test: refs #7073 add unit tests for VnDms component #1198
|
@ -198,6 +198,7 @@ async function fetch() {
|
|||
} catch (e) {
|
||||
state.set(modelValue, {});
|
||||
originalData.value = {};
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,12 +104,14 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
|
||||
store.hasMoreData = limit && response.data.length >= limit;
|
||||
|
||||
processData(response.data, { map: !!store.mapKey, append });
|
||||
if (!append && !isDialogOpened()) updateRouter && updateStateParams();
|
||||
|
||||
if (!append && !isDialogOpened() && updateRouter) {
|
||||
if (updateStateParams(response.data)?.redirect) return;
|
||||
}
|
||||
store.isLoading = false;
|
||||
canceller = null;
|
||||
|
||||
processData(response.data, { map: !!store.mapKey, append });
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -239,7 +241,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
if (Object.values(store.userParams).length) await fetch({});
|
||||
}
|
||||
|
||||
function updateStateParams() {
|
||||
function updateStateParams(data) {
|
||||
if (!route?.path) return;
|
||||
const newUrl = { path: route.path, query: { ...(route.query ?? {}) } };
|
||||
if (store?.searchUrl)
|
||||
|
@ -256,15 +258,15 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
const { path } = matches.at(-1);
|
||||
|
||||
const to =
|
||||
store?.data?.length === 1
|
||||
? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`)
|
||||
data?.length === 1
|
||||
? path.replace(/\/(list|:id)|-list/, `/${data[0].id}`)
|
||||
: path.replace(/:id.*/, '');
|
||||
|
||||
if (route.path != to) {
|
||||
const pushUrl = { path: to };
|
||||
if (to.endsWith('/list') || to.endsWith('/'))
|
||||
pushUrl.query = newUrl.query;
|
||||
return router.push(pushUrl);
|
||||
return router.push(pushUrl) && { redirect: true };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
export default function toDateHourMin(date) {
|
||||
const dateHour = new Date(date).toLocaleDateString('es-ES', {
|
||||
if (!date) return date;
|
||||
return new Date(date).toLocaleDateString('es-ES', {
|
||||
timeZone: 'Europe/Madrid',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
|
@ -7,5 +8,4 @@ export default function toDateHourMin(date) {
|
|||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
return dateHour;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
export default function toDateHourMinSec(date) {
|
||||
const dateHour = new Date(date).toLocaleDateString('es-ES', {
|
||||
if (!date) return date;
|
||||
return new Date(date).toLocaleDateString('es-ES', {
|
||||
timeZone: 'Europe/Madrid',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
|
@ -8,5 +9,4 @@ export default function toDateHourMinSec(date) {
|
|||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
});
|
||||
return dateHour;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
<script setup>
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||
import ClaimDescriptor from './ClaimDescriptor.vue';
|
||||
import ClaimFilter from '../ClaimFilter.vue';
|
||||
import filter from './ClaimFilter.js';
|
||||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
<VnCardBeta
|
||||
data-key="Claim"
|
||||
base-url="Claims"
|
||||
:descriptor="ClaimDescriptor"
|
||||
:filter-panel="ClaimFilter"
|
||||
search-data-key="ClaimList"
|
||||
:filter="filter"
|
||||
:searchbar-props="{
|
||||
url: 'Claims/filter',
|
||||
label: 'Search claim',
|
||||
info: 'You can search by claim id or customer name',
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate } from 'filters/index';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import ClaimFilter from './ClaimFilter.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import ClaimSummary from './Card/ClaimSummary.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import ZoneDescriptorProxy from '../Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const dataKey = 'ClaimList';
|
||||
|
||||
const claimFilterRef = ref();
|
||||
const columns = computed(() => [
|
||||
|
@ -125,23 +125,25 @@ const STATE_COLOR = {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="ClaimList"
|
||||
:label="t('Search claim')"
|
||||
:info="t('You can search by claim id or customer name')"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<VnSection
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
prefix="claim"
|
||||
:array-data-props="{
|
||||
url: 'Claims/filter',
|
||||
order: ['cs.priority ASC', 'created ASC'],
|
||||
}"
|
||||
>
|
||||
<template #rightMenu>
|
||||
<ClaimFilter data-key="ClaimList" ref="claimFilterRef" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<template #body>
|
||||
<VnTable
|
||||
data-key="ClaimList"
|
||||
url="Claims/filter"
|
||||
:order="['cs.priority ASC', 'created ASC']"
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
redirect="claim"
|
||||
:right-search="false"
|
||||
auto-load
|
||||
>
|
||||
<template #column-clientFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
|
@ -161,12 +163,12 @@ const STATE_COLOR = {
|
|||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
</VnSection>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search claim: Buscar reclamación
|
||||
You can search by claim id or customer name: Puedes buscar por id de la reclamación o nombre del cliente
|
||||
params:
|
||||
stateCode: Estado
|
||||
en:
|
||||
|
|
|
@ -44,3 +44,5 @@ claim:
|
|||
fileDescription: 'Claim id {claimId} from client {clientName} id {clientId}'
|
||||
noData: 'There are no images/videos, click here or drag and drop the file'
|
||||
dragDrop: Drag and drop it here
|
||||
search: Search claims
|
||||
searchInfo: You can search by claim id or customer name
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
Search claim: Buscar reclamación
|
||||
You can search by claim id or customer name: Puedes buscar por id de la reclamación o nombre del cliente
|
||||
claim:
|
||||
customer: Cliente
|
||||
code: Código
|
||||
|
@ -46,3 +44,5 @@ claim:
|
|||
fileDescription: 'ID de reclamación {claimId} del cliente {clientName} con ID {clientId}'
|
||||
noData: 'No hay imágenes/videos, haz clic aquí o arrastra y suelta el archivo'
|
||||
dragDrop: Arrastra y suelta aquí
|
||||
search: Buscar reclamación
|
||||
searchInfo: Puedes buscar por ID de la reclamación o nombre del cliente
|
||||
|
|
|
@ -44,7 +44,10 @@ InvoiceIn:
|
|||
country: Country
|
||||
params:
|
||||
search: Id or supplier name
|
||||
account: Ledger account
|
||||
correctingFk: Rectificative
|
||||
correctedFk: Corrected
|
||||
isBooked: Is booked
|
||||
invoicein:
|
||||
params:
|
||||
account: Ledger account
|
||||
correctingFk: Rectificative
|
||||
|
|
@ -42,6 +42,9 @@ InvoiceIn:
|
|||
country: País
|
||||
params:
|
||||
search: Id o nombre proveedor
|
||||
correctedFk: Rectificada
|
||||
invoicein:
|
||||
params:
|
||||
account: Cuenta contable
|
||||
correctingFk: Rectificativa
|
||||
correctedFk: Rectificada
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ const getUrl = (section) => `#/supplier/${entityId.value}/${section}`;
|
|||
:url="`Suppliers/${entityId}/getSummary`"
|
||||
@on-fetch="(data) => setData(data)"
|
||||
data-key="SupplierSummary"
|
||||
module-name="Supplier"
|
||||
>
|
||||
<template #header>
|
||||
<span>{{ supplier.id }} - {{ supplier.name }}</span>
|
||||
|
|
|
@ -201,7 +201,7 @@ const getExpeditionState = async (expedition) => {
|
|||
|
||||
const openGrafana = (expeditionFk) => {
|
||||
useOpenURL(
|
||||
`https://grafana.verdnatura.es/d/d552ab74-85b4-4e7f-a279-fab7cd9c6124/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}`
|
||||
`https://grafana.verdnatura.es/d/de1njb6p5answd/control-de-expediciones?orgId=1&var-expeditionFk=${expeditionFk}`
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -597,7 +597,7 @@ const getColor = (percentage) => {
|
|||
v-if="entry.isCustomInspectionRequired"
|
||||
name="warning"
|
||||
color="negative"
|
||||
size="xs"
|
||||
size="md"
|
||||
:title="t('requiresInspection')"
|
||||
>
|
||||
</QIcon>
|
||||
|
@ -627,7 +627,7 @@ const getColor = (percentage) => {
|
|||
<QBtn
|
||||
v-if="entry.evaNotes"
|
||||
icon="comment"
|
||||
size="sm"
|
||||
size="md"
|
||||
flat
|
||||
color="primary"
|
||||
>
|
||||
|
|
|
@ -1,68 +1,28 @@
|
|||
src/pages/Worker/Card/WorkerPBX.vue
|
||||
|
||||
<script setup>
|
||||
import { watch, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
import FormModel from 'src/components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const state = useState();
|
||||
const route = useRoute();
|
||||
const workerPBXForm = ref();
|
||||
const extension = ref(null);
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'sip',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
() => state.set('extension', null)
|
||||
);
|
||||
|
||||
const onFetch = (data) => {
|
||||
state.set('extension', data?.sip?.extension);
|
||||
extension.value = state.get('extension');
|
||||
};
|
||||
|
||||
const updateModelValue = (data) => {
|
||||
state.set('extension', data);
|
||||
workerPBXForm.value.hasChanges = true;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormModel
|
||||
ref="workerPBXForm"
|
||||
:filter="filter"
|
||||
:url="`Workers/${route.params.id}`"
|
||||
model="WorkerPbx"
|
||||
:url="`Workers/${$route.params.id}/sip`"
|
||||
url-update="Sips"
|
||||
auto-load
|
||||
:mapper="
|
||||
() => ({
|
||||
userFk: +route.params.id,
|
||||
({ userFk, extension }) => ({
|
||||
userFk,
|
||||
extension,
|
||||
})
|
||||
"
|
||||
model="DeviceProductionUser"
|
||||
@on-fetch="onFetch"
|
||||
auto-load
|
||||
>
|
||||
<template #form="{}">
|
||||
<VnRow>
|
||||
<template #form="{ data }">
|
||||
<VnInput
|
||||
:label="t('worker.summary.sipExtension')"
|
||||
v-model="extension"
|
||||
@update:model-value="updateModelValue"
|
||||
:label="$t('worker.summary.sipExtension')"
|
||||
v-model="data.extension"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</template>
|
||||
|
|
|
@ -345,7 +345,7 @@ const getMailStates = async (date) => {
|
|||
const prevMonth = month == 1 ? 12 : month - 1;
|
||||
const params = {
|
||||
month,
|
||||
year: selectedDateYear.value,
|
||||
year: date.getFullYear(),
|
||||
};
|
||||
|
||||
const curMonthStates = (await axios.get(url, { params })).data;
|
||||
|
|
|
@ -102,8 +102,7 @@ const getWorkWeekElements = () => {
|
|||
};
|
||||
|
||||
const paintWorkWeeks = async () => {
|
||||
for (var i = 0; i < workWeeksElements.value.length; i++) {
|
||||
const element = workWeeksElements.value[i];
|
||||
for (const element of workWeeksElements.value) {
|
||||
const week = Number(element.innerHTML);
|
||||
const weekState = workerTimeControlMailsMap.value.get(week);
|
||||
const { className, title } = stateClasses[weekState] || {};
|
||||
|
|
|
@ -4,7 +4,7 @@ import WorkerDepartmentTree from './WorkerDepartmentTree.vue';
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<VnSection data-key="WorkerDepartment">
|
||||
<VnSection data-key="WorkerDepartment" :search-bar="false">
|
||||
<template #body>
|
||||
<div class="flex flex-center q-pa-md">
|
||||
<WorkerDepartmentTree />
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
import { RouterView } from 'vue-router';
|
||||
|
||||
export default {
|
||||
name: 'Claim',
|
||||
path: '/claim',
|
||||
const claimCard = {
|
||||
name: 'ClaimCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Claim/Card/ClaimCard.vue'),
|
||||
redirect: { name: 'ClaimSummary' },
|
||||
meta: {
|
||||
title: 'claims',
|
||||
icon: 'vn:claims',
|
||||
moduleName: 'Claim',
|
||||
keyBinding: 'r',
|
||||
},
|
||||
component: RouterView,
|
||||
redirect: { name: 'ClaimMain' },
|
||||
menus: {
|
||||
main: ['ClaimList'],
|
||||
card: [
|
||||
menu: [
|
||||
'ClaimBasicData',
|
||||
'ClaimLines',
|
||||
'ClaimPhotos',
|
||||
|
@ -25,31 +18,8 @@ export default {
|
|||
},
|
||||
children: [
|
||||
{
|
||||
name: 'ClaimMain',
|
||||
path: '',
|
||||
component: () => import('src/components/common/VnModule.vue'),
|
||||
redirect: { name: 'ClaimList' },
|
||||
children: [
|
||||
{
|
||||
name: 'ClaimList',
|
||||
path: 'list',
|
||||
meta: {
|
||||
title: 'list',
|
||||
icon: 'view_list',
|
||||
},
|
||||
component: () => import('src/pages/Claim/ClaimList.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'ClaimCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Claim/Card/ClaimCard.vue'),
|
||||
redirect: { name: 'ClaimSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'ClaimSummary',
|
||||
path: 'summary',
|
||||
name: 'ClaimSummary',
|
||||
meta: {
|
||||
title: 'summary',
|
||||
icon: 'launch',
|
||||
|
@ -57,8 +27,8 @@ export default {
|
|||
component: () => import('src/pages/Claim/Card/ClaimSummary.vue'),
|
||||
},
|
||||
{
|
||||
name: 'ClaimBasicData',
|
||||
path: 'basic-data',
|
||||
name: 'ClaimBasicData',
|
||||
meta: {
|
||||
title: 'basicData',
|
||||
icon: 'vn:settings',
|
||||
|
@ -67,8 +37,8 @@ export default {
|
|||
component: () => import('src/pages/Claim/Card/ClaimBasicData.vue'),
|
||||
},
|
||||
{
|
||||
name: 'ClaimLines',
|
||||
path: 'lines',
|
||||
name: 'ClaimLines',
|
||||
meta: {
|
||||
title: 'lines',
|
||||
icon: 'vn:details',
|
||||
|
@ -76,8 +46,8 @@ export default {
|
|||
component: () => import('src/pages/Claim/Card/ClaimLines.vue'),
|
||||
},
|
||||
{
|
||||
name: 'ClaimPhotos',
|
||||
path: 'photos',
|
||||
name: 'ClaimPhotos',
|
||||
meta: {
|
||||
title: 'photos',
|
||||
icon: 'image',
|
||||
|
@ -85,8 +55,8 @@ export default {
|
|||
component: () => import('src/pages/Claim/Card/ClaimPhoto.vue'),
|
||||
},
|
||||
{
|
||||
name: 'ClaimNotes',
|
||||
path: 'notes',
|
||||
name: 'ClaimNotes',
|
||||
meta: {
|
||||
title: 'notes',
|
||||
icon: 'draft',
|
||||
|
@ -94,8 +64,8 @@ export default {
|
|||
component: () => import('src/pages/Claim/Card/ClaimNotes.vue'),
|
||||
},
|
||||
{
|
||||
name: 'ClaimDevelopment',
|
||||
path: 'development',
|
||||
name: 'ClaimDevelopment',
|
||||
meta: {
|
||||
title: 'development',
|
||||
icon: 'vn:traceability',
|
||||
|
@ -110,8 +80,8 @@ export default {
|
|||
component: () => import('src/pages/Claim/Card/ClaimDevelopment.vue'),
|
||||
},
|
||||
{
|
||||
name: 'ClaimAction',
|
||||
path: 'action',
|
||||
name: 'ClaimAction',
|
||||
meta: {
|
||||
title: 'action',
|
||||
icon: 'vn:actions',
|
||||
|
@ -119,8 +89,8 @@ export default {
|
|||
component: () => import('src/pages/Claim/Card/ClaimAction.vue'),
|
||||
},
|
||||
{
|
||||
name: 'ClaimLog',
|
||||
path: 'log',
|
||||
name: 'ClaimLog',
|
||||
meta: {
|
||||
title: 'log',
|
||||
icon: 'history',
|
||||
|
@ -128,6 +98,45 @@ export default {
|
|||
component: () => import('src/pages/Claim/Card/ClaimLog.vue'),
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'Claim',
|
||||
path: '/claim',
|
||||
meta: {
|
||||
title: 'claims',
|
||||
icon: 'vn:claims',
|
||||
moduleName: 'Claim',
|
||||
keyBinding: 'r',
|
||||
menu: ['ClaimList'],
|
||||
},
|
||||
component: RouterView,
|
||||
redirect: { name: 'ClaimMain' },
|
||||
children: [
|
||||
{
|
||||
name: 'ClaimMain',
|
||||
path: '',
|
||||
component: () => import('src/components/common/VnModule.vue'),
|
||||
redirect: { name: 'ClaimIndexMain' },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'ClaimIndexMain',
|
||||
redirect: { name: 'ClaimList' },
|
||||
component: () => import('src/pages/Claim/ClaimList.vue'),
|
||||
children: [
|
||||
{
|
||||
name: 'ClaimList',
|
||||
path: 'list',
|
||||
meta: {
|
||||
title: 'list',
|
||||
icon: 'view_list',
|
||||
},
|
||||
},
|
||||
claimCard,
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue