forked from verdnatura/salix-front
Merge branch 'dev' into 7055-testFilterItemForm
This commit is contained in:
commit
6a01c9b746
|
@ -198,6 +198,7 @@ async function fetch() {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
state.set(modelValue, {});
|
state.set(modelValue, {});
|
||||||
originalData.value = {};
|
originalData.value = {};
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,12 +104,14 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
|
|
||||||
store.hasMoreData = limit && response.data.length >= limit;
|
store.hasMoreData = limit && response.data.length >= limit;
|
||||||
|
|
||||||
processData(response.data, { map: !!store.mapKey, append });
|
if (!append && !isDialogOpened() && updateRouter) {
|
||||||
if (!append && !isDialogOpened()) updateRouter && updateStateParams();
|
if (updateStateParams(response.data)?.redirect) return;
|
||||||
|
}
|
||||||
store.isLoading = false;
|
store.isLoading = false;
|
||||||
canceller = null;
|
canceller = null;
|
||||||
|
|
||||||
|
processData(response.data, { map: !!store.mapKey, append });
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +241,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
if (Object.values(store.userParams).length) await fetch({});
|
if (Object.values(store.userParams).length) await fetch({});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateStateParams() {
|
function updateStateParams(data) {
|
||||||
if (!route?.path) return;
|
if (!route?.path) return;
|
||||||
const newUrl = { path: route.path, query: { ...(route.query ?? {}) } };
|
const newUrl = { path: route.path, query: { ...(route.query ?? {}) } };
|
||||||
if (store?.searchUrl)
|
if (store?.searchUrl)
|
||||||
|
@ -256,15 +258,15 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
const { path } = matches.at(-1);
|
const { path } = matches.at(-1);
|
||||||
|
|
||||||
const to =
|
const to =
|
||||||
store?.data?.length === 1
|
data?.length === 1
|
||||||
? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`)
|
? path.replace(/\/(list|:id)|-list/, `/${data[0].id}`)
|
||||||
: path.replace(/:id.*/, '');
|
: path.replace(/:id.*/, '');
|
||||||
|
|
||||||
if (route.path != to) {
|
if (route.path != to) {
|
||||||
const pushUrl = { path: to };
|
const pushUrl = { path: to };
|
||||||
if (to.endsWith('/list') || to.endsWith('/'))
|
if (to.endsWith('/list') || to.endsWith('/'))
|
||||||
pushUrl.query = newUrl.query;
|
pushUrl.query = newUrl.query;
|
||||||
return router.push(pushUrl);
|
return router.push(pushUrl) && { redirect: true };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export default function toDateHourMin(date) {
|
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',
|
timeZone: 'Europe/Madrid',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: '2-digit',
|
month: '2-digit',
|
||||||
|
@ -7,5 +8,4 @@ export default function toDateHourMin(date) {
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
});
|
});
|
||||||
return dateHour;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export default function toDateHourMinSec(date) {
|
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',
|
timeZone: 'Europe/Madrid',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
month: '2-digit',
|
month: '2-digit',
|
||||||
|
@ -8,5 +9,4 @@ export default function toDateHourMinSec(date) {
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
second: '2-digit',
|
second: '2-digit',
|
||||||
});
|
});
|
||||||
return dateHour;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,10 @@ InvoiceIn:
|
||||||
country: Country
|
country: Country
|
||||||
params:
|
params:
|
||||||
search: Id or supplier name
|
search: Id or supplier name
|
||||||
account: Ledger account
|
|
||||||
correctingFk: Rectificative
|
|
||||||
correctedFk: Corrected
|
correctedFk: Corrected
|
||||||
isBooked: Is booked
|
isBooked: Is booked
|
||||||
|
invoicein:
|
||||||
|
params:
|
||||||
|
account: Ledger account
|
||||||
|
correctingFk: Rectificative
|
||||||
|
|
|
@ -42,6 +42,9 @@ InvoiceIn:
|
||||||
country: País
|
country: País
|
||||||
params:
|
params:
|
||||||
search: Id o nombre proveedor
|
search: Id o nombre proveedor
|
||||||
|
correctedFk: Rectificada
|
||||||
|
invoicein:
|
||||||
|
params:
|
||||||
account: Cuenta contable
|
account: Cuenta contable
|
||||||
correctingFk: Rectificativa
|
correctingFk: Rectificativa
|
||||||
correctedFk: Rectificada
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ const getUrl = (section) => `#/supplier/${entityId.value}/${section}`;
|
||||||
:url="`Suppliers/${entityId}/getSummary`"
|
:url="`Suppliers/${entityId}/getSummary`"
|
||||||
@on-fetch="(data) => setData(data)"
|
@on-fetch="(data) => setData(data)"
|
||||||
data-key="SupplierSummary"
|
data-key="SupplierSummary"
|
||||||
|
module-name="Supplier"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<span>{{ supplier.id }} - {{ supplier.name }}</span>
|
<span>{{ supplier.id }} - {{ supplier.name }}</span>
|
||||||
|
|
|
@ -201,7 +201,7 @@ const getExpeditionState = async (expedition) => {
|
||||||
|
|
||||||
const openGrafana = (expeditionFk) => {
|
const openGrafana = (expeditionFk) => {
|
||||||
useOpenURL(
|
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"
|
v-if="entry.isCustomInspectionRequired"
|
||||||
name="warning"
|
name="warning"
|
||||||
color="negative"
|
color="negative"
|
||||||
size="xs"
|
size="md"
|
||||||
:title="t('requiresInspection')"
|
:title="t('requiresInspection')"
|
||||||
>
|
>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
|
@ -627,7 +627,7 @@ const getColor = (percentage) => {
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="entry.evaNotes"
|
v-if="entry.evaNotes"
|
||||||
icon="comment"
|
icon="comment"
|
||||||
size="sm"
|
size="md"
|
||||||
flat
|
flat
|
||||||
color="primary"
|
color="primary"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,68 +1,28 @@
|
||||||
|
src/pages/Worker/Card/WorkerPBX.vue
|
||||||
|
|
||||||
<script setup>
|
<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 FormModel from 'src/components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
|
||||||
import VnInput from 'src/components/common/VnInput.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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FormModel
|
<FormModel
|
||||||
ref="workerPBXForm"
|
model="WorkerPbx"
|
||||||
:filter="filter"
|
:url="`Workers/${$route.params.id}/sip`"
|
||||||
:url="`Workers/${route.params.id}`"
|
|
||||||
url-update="Sips"
|
url-update="Sips"
|
||||||
auto-load
|
|
||||||
:mapper="
|
:mapper="
|
||||||
() => ({
|
({ userFk, extension }) => ({
|
||||||
userFk: +route.params.id,
|
userFk,
|
||||||
extension,
|
extension,
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
model="DeviceProductionUser"
|
auto-load
|
||||||
@on-fetch="onFetch"
|
|
||||||
>
|
>
|
||||||
<template #form="{}">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('worker.summary.sipExtension')"
|
:label="$t('worker.summary.sipExtension')"
|
||||||
v-model="extension"
|
v-model="data.extension"
|
||||||
@update:model-value="updateModelValue"
|
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -345,7 +345,7 @@ const getMailStates = async (date) => {
|
||||||
const prevMonth = month == 1 ? 12 : month - 1;
|
const prevMonth = month == 1 ? 12 : month - 1;
|
||||||
const params = {
|
const params = {
|
||||||
month,
|
month,
|
||||||
year: selectedDateYear.value,
|
year: date.getFullYear(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const curMonthStates = (await axios.get(url, { params })).data;
|
const curMonthStates = (await axios.get(url, { params })).data;
|
||||||
|
|
|
@ -102,8 +102,7 @@ const getWorkWeekElements = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const paintWorkWeeks = async () => {
|
const paintWorkWeeks = async () => {
|
||||||
for (var i = 0; i < workWeeksElements.value.length; i++) {
|
for (const element of workWeeksElements.value) {
|
||||||
const element = workWeeksElements.value[i];
|
|
||||||
const week = Number(element.innerHTML);
|
const week = Number(element.innerHTML);
|
||||||
const weekState = workerTimeControlMailsMap.value.get(week);
|
const weekState = workerTimeControlMailsMap.value.get(week);
|
||||||
const { className, title } = stateClasses[weekState] || {};
|
const { className, title } = stateClasses[weekState] || {};
|
||||||
|
|
|
@ -4,7 +4,7 @@ import WorkerDepartmentTree from './WorkerDepartmentTree.vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSection data-key="WorkerDepartment">
|
<VnSection data-key="WorkerDepartment" :search-bar="false">
|
||||||
<template #body>
|
<template #body>
|
||||||
<div class="flex flex-center q-pa-md">
|
<div class="flex flex-center q-pa-md">
|
||||||
<WorkerDepartmentTree />
|
<WorkerDepartmentTree />
|
||||||
|
|
Loading…
Reference in New Issue