forked from verdnatura/salix-front
Merge branch 'dev' into 7017_formModel_validations
This commit is contained in:
commit
603fb1de71
|
@ -5,8 +5,10 @@ import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
const baseUrl = '/api/';
|
||||||
|
|
||||||
axios.defaults.baseURL = '/api/';
|
axios.defaults.baseURL = baseUrl;
|
||||||
|
const axiosNoError = axios.create({ baseURL: baseUrl });
|
||||||
|
|
||||||
const onRequest = (config) => {
|
const onRequest = (config) => {
|
||||||
const token = session.getToken();
|
const token = session.getToken();
|
||||||
|
@ -79,5 +81,7 @@ const onResponseError = (error) => {
|
||||||
|
|
||||||
axios.interceptors.request.use(onRequest, onRequestError);
|
axios.interceptors.request.use(onRequest, onRequestError);
|
||||||
axios.interceptors.response.use(onResponse, onResponseError);
|
axios.interceptors.response.use(onResponse, onResponseError);
|
||||||
|
axiosNoError.interceptors.request.use(onRequest);
|
||||||
|
axiosNoError.interceptors.response.use(onResponse);
|
||||||
|
|
||||||
export { onRequest, onResponseError };
|
export { onRequest, onResponseError, axiosNoError };
|
||||||
|
|
|
@ -285,6 +285,14 @@ globals:
|
||||||
createInvoiceIn: Create invoice in
|
createInvoiceIn: Create invoice in
|
||||||
myAccount: My account
|
myAccount: My account
|
||||||
noOne: No one
|
noOne: No one
|
||||||
|
params:
|
||||||
|
clientFk: Client id
|
||||||
|
salesPersonFk: Sales person
|
||||||
|
warehouseFk: Warehouse
|
||||||
|
provinceFk: Province
|
||||||
|
from: From
|
||||||
|
To: To
|
||||||
|
stateFk: State
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Access denied
|
statusUnauthorized: Access denied
|
||||||
statusInternalServerError: An internal server error has ocurred
|
statusInternalServerError: An internal server error has ocurred
|
||||||
|
|
|
@ -289,6 +289,14 @@ globals:
|
||||||
createInvoiceIn: Crear factura recibida
|
createInvoiceIn: Crear factura recibida
|
||||||
myAccount: Mi cuenta
|
myAccount: Mi cuenta
|
||||||
noOne: Nadie
|
noOne: Nadie
|
||||||
|
params:
|
||||||
|
clientFk: Id cliente
|
||||||
|
salesPersonFk: Comercial
|
||||||
|
warehouseFk: Almacén
|
||||||
|
provinceFk: Provincia
|
||||||
|
from: Desde
|
||||||
|
To: Hasta
|
||||||
|
stateFk: Estado
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Acceso denegado
|
statusUnauthorized: Acceso denegado
|
||||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||||
|
|
|
@ -116,7 +116,7 @@ const entriesTableColumns = computed(() => [
|
||||||
{{ col.value }}
|
{{ col.value }}
|
||||||
</QTd>
|
</QTd>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="print"
|
icon="visibility"
|
||||||
v-if="props.row.stickers > 0"
|
v-if="props.row.stickers > 0"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@click="
|
@click="
|
||||||
|
@ -126,7 +126,7 @@ const entriesTableColumns = computed(() => [
|
||||||
"
|
"
|
||||||
unelevated
|
unelevated
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('printLabel') }}</QTooltip>
|
<QTooltip>{{ t('viewLabel') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -11,4 +11,4 @@ shipped: Shipped
|
||||||
fromShipped: Shipped(from)
|
fromShipped: Shipped(from)
|
||||||
toShipped: Shipped(to)
|
toShipped: Shipped(to)
|
||||||
printLabels: Print stickers
|
printLabels: Print stickers
|
||||||
printLabel: Print sticker
|
viewLabel: View sticker
|
||||||
|
|
|
@ -15,4 +15,4 @@ shipped: F. salida
|
||||||
fromShipped: F. salida(desde)
|
fromShipped: F. salida(desde)
|
||||||
toShipped: F. salida(hasta)
|
toShipped: F. salida(hasta)
|
||||||
printLabels: Imprimir etiquetas
|
printLabels: Imprimir etiquetas
|
||||||
printLabel: Imprimir etiqueta
|
viewLabel: Ver etiqueta
|
||||||
|
|
|
@ -40,7 +40,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
:hidden-tags="['from', 'to']"
|
:hidden-tags="['from', 'to', 'search']"
|
||||||
:custom-tags="['scopeDays']"
|
:custom-tags="['scopeDays']"
|
||||||
:unremovable-params="['from', 'to', 'scopeDays']"
|
:unremovable-params="['from', 'to', 'scopeDays']"
|
||||||
>
|
>
|
||||||
|
@ -64,7 +64,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('params.clientFk')"
|
:label="t('globals.params.clientFk')"
|
||||||
v-model="params.clientFk"
|
v-model="params.clientFk"
|
||||||
is-outlined
|
is-outlined
|
||||||
/>
|
/>
|
||||||
|
@ -105,7 +105,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
:label="t('params.salesPersonFk')"
|
:label="t('globals.params.salesPersonFk')"
|
||||||
v-model="params.salesPersonFk"
|
v-model="params.salesPersonFk"
|
||||||
url="Workers/search"
|
url="Workers/search"
|
||||||
:params="{ departmentCodes: ['VT'] }"
|
:params="{ departmentCodes: ['VT'] }"
|
||||||
|
@ -158,7 +158,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
:label="t('params.stateFk')"
|
:label="t('globals.params.stateFk')"
|
||||||
v-model="params.stateFk"
|
v-model="params.stateFk"
|
||||||
url="States"
|
url="States"
|
||||||
is-outlined
|
is-outlined
|
||||||
|
@ -184,7 +184,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
:label="t('params.warehouseFk')"
|
:label="t('globals.params.warehouseFk')"
|
||||||
v-model="params.warehouseFk"
|
v-model="params.warehouseFk"
|
||||||
:options="warehouses"
|
:options="warehouses"
|
||||||
/>
|
/>
|
||||||
|
@ -196,7 +196,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
:label="t('params.provinceFk')"
|
:label="t('globals.params.provinceFk')"
|
||||||
v-model="params.provinceFk"
|
v-model="params.provinceFk"
|
||||||
url="Provinces"
|
url="Provinces"
|
||||||
/>
|
/>
|
||||||
|
@ -235,22 +235,15 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
params:
|
params:
|
||||||
clientFk: Client id
|
|
||||||
orderFk: Order id
|
orderFk: Order id
|
||||||
scopeDays: Days onward
|
scopeDays: Days onward
|
||||||
nickname: Nickname
|
nickname: Nickname
|
||||||
salesPersonFk: Sales person
|
|
||||||
refFk: Invoice
|
refFk: Invoice
|
||||||
agencyModeFk: Agency
|
agencyModeFk: Agency
|
||||||
stateFk: State
|
|
||||||
groupedStates: Grouped State
|
groupedStates: Grouped State
|
||||||
warehouseFk: Warehouse
|
|
||||||
provinceFk: Province
|
|
||||||
myTeam: My team
|
myTeam: My team
|
||||||
problems: With problems
|
problems: With problems
|
||||||
pending: Pending
|
pending: Pending
|
||||||
from: From
|
|
||||||
to: To
|
|
||||||
alertLevel: Grouped State
|
alertLevel: Grouped State
|
||||||
FREE: Free
|
FREE: Free
|
||||||
DELIVERED: Delivered
|
DELIVERED: Delivered
|
||||||
|
@ -261,22 +254,15 @@ en:
|
||||||
|
|
||||||
es:
|
es:
|
||||||
params:
|
params:
|
||||||
clientFk: Id cliente
|
|
||||||
orderFk: Id cesta
|
orderFk: Id cesta
|
||||||
scopeDays: Días en adelante
|
scopeDays: Días en adelante
|
||||||
nickname: Nombre mostrado
|
nickname: Nombre mostrado
|
||||||
salesPersonFk: Comercial
|
|
||||||
refFk: Factura
|
refFk: Factura
|
||||||
agencyModeFk: Agencia
|
agencyModeFk: Agencia
|
||||||
stateFk: Estado
|
|
||||||
groupedStates: Estado agrupado
|
groupedStates: Estado agrupado
|
||||||
warehouseFk: Almacén
|
|
||||||
provinceFk: Provincia
|
|
||||||
myTeam: Mi equipo
|
myTeam: Mi equipo
|
||||||
problems: Con problemas
|
problems: Con problemas
|
||||||
pending: Pendiente
|
pending: Pendiente
|
||||||
from: Desde
|
|
||||||
To: Hasta
|
|
||||||
alertLevel: Estado agrupado
|
alertLevel: Estado agrupado
|
||||||
FREE: Libre
|
FREE: Libre
|
||||||
DELIVERED: Servido
|
DELIVERED: Servido
|
||||||
|
|
|
@ -3,7 +3,7 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="SalesMonitorTickets"
|
data-key="saleMonitorTickets"
|
||||||
url="SalesMonitors/salesFilter"
|
url="SalesMonitors/salesFilter"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
:label="$t('searchBar.label')"
|
:label="$t('searchBar.label')"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { onMounted, ref, computed, onBeforeMount, nextTick, reactive } from 'vue';
|
import { onMounted, ref, computed, onBeforeMount, nextTick, reactive } from 'vue';
|
||||||
|
import { axiosNoError } from 'src/boot/axios';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import WorkerTimeHourChip from 'pages/Worker/Card/WorkerTimeHourChip.vue';
|
import WorkerTimeHourChip from 'pages/Worker/Card/WorkerTimeHourChip.vue';
|
||||||
|
@ -12,7 +13,6 @@ import WorkerTimeControlCalendar from 'pages/Worker/Card/WorkerTimeControlCalend
|
||||||
|
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useRole } from 'src/composables/useRole';
|
|
||||||
import { useAcl } from 'src/composables/useAcl';
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
@ -63,13 +63,16 @@ const selectedCalendarDates = ref([]);
|
||||||
const selectedDateFormatted = ref(toDateString(defaultDate.value));
|
const selectedDateFormatted = ref(toDateString(defaultDate.value));
|
||||||
|
|
||||||
const arrayData = useArrayData('workerData');
|
const arrayData = useArrayData('workerData');
|
||||||
|
const acl = useAcl();
|
||||||
const worker = computed(() => arrayData.store?.data);
|
const worker = computed(() => arrayData.store?.data);
|
||||||
|
const canSend = computed(() =>
|
||||||
const isHr = computed(() => useRole().hasAny(['hr']));
|
acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }])
|
||||||
|
);
|
||||||
const canSend = computed(() => useAcl().hasAny('WorkerTimeControl', 'sendMail', 'WRITE'));
|
const canUpdate = computed(() =>
|
||||||
|
acl.hasAny([
|
||||||
|
{ model: 'WorkerTimeControl', props: 'updateMailState', accessType: 'WRITE' },
|
||||||
|
])
|
||||||
|
);
|
||||||
const isHimself = computed(() => user.value.id === Number(route.params.id));
|
const isHimself = computed(() => user.value.id === Number(route.params.id));
|
||||||
|
|
||||||
const columns = computed(() => {
|
const columns = computed(() => {
|
||||||
|
@ -257,58 +260,32 @@ const fetchHours = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchWorkerTimeControlMails = async (filter) => {
|
|
||||||
try {
|
|
||||||
const { data } = await axios.get('WorkerTimeControlMails', {
|
|
||||||
params: { filter: JSON.stringify(filter) },
|
|
||||||
});
|
|
||||||
|
|
||||||
return data;
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching worker time control mails');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchWeekData = async () => {
|
const fetchWeekData = async () => {
|
||||||
try {
|
const where = {
|
||||||
const filter = {
|
year: selectedDate.value.getFullYear(),
|
||||||
where: {
|
|
||||||
workerFk: route.params.id,
|
|
||||||
year: selectedDate.value ? selectedDate.value?.getFullYear() : null,
|
|
||||||
week: selectedWeekNumber.value,
|
week: selectedWeekNumber.value,
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
try {
|
||||||
|
const mail = (
|
||||||
|
await axiosNoError.get(`Workers/${route.params.id}/mail`, {
|
||||||
|
params: { filter: { where } },
|
||||||
|
})
|
||||||
|
).data[0];
|
||||||
|
|
||||||
const data = await fetchWorkerTimeControlMails(filter);
|
if (!mail) state.value = null;
|
||||||
if (!data.length) {
|
else {
|
||||||
state.value = null;
|
|
||||||
} else {
|
|
||||||
const [mail] = data;
|
|
||||||
state.value = mail.state;
|
state.value = mail.state;
|
||||||
reason.value = mail.reason;
|
reason.value = mail.reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
await canBeResend();
|
canResend.value = !!(
|
||||||
|
await axiosNoError.get('WorkerTimeControlMails/count', { params: { where } })
|
||||||
|
).data.count;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching week data');
|
console.error('Error fetching week data');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const canBeResend = async () => {
|
|
||||||
canResend.value = false;
|
|
||||||
|
|
||||||
const filter = {
|
|
||||||
where: {
|
|
||||||
year: selectedDate.value.getFullYear(),
|
|
||||||
week: selectedWeekNumber.value,
|
|
||||||
},
|
|
||||||
limit: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
const data = await fetchWorkerTimeControlMails(filter);
|
|
||||||
if (data.length) canResend.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setHours = (data) => {
|
const setHours = (data) => {
|
||||||
for (const weekDay of weekDays.value) {
|
for (const weekDay of weekDays.value) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -449,7 +426,7 @@ onMounted(async () => {
|
||||||
<div>
|
<div>
|
||||||
<QBtnGroup push class="q-gutter-x-sm" flat>
|
<QBtnGroup push class="q-gutter-x-sm" flat>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="isHimself && state"
|
v-if="canUpdate && state"
|
||||||
:label="t('Satisfied')"
|
:label="t('Satisfied')"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
@ -457,7 +434,7 @@ onMounted(async () => {
|
||||||
@click="isSatisfied()"
|
@click="isSatisfied()"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="isHimself && state"
|
v-if="canUpdate && state"
|
||||||
:label="t('Not satisfied')"
|
:label="t('Not satisfied')"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
@ -468,7 +445,7 @@ onMounted(async () => {
|
||||||
</QBtnGroup>
|
</QBtnGroup>
|
||||||
<QBtnGroup push class="q-gutter-x-sm q-ml-none" flat>
|
<QBtnGroup push class="q-gutter-x-sm q-ml-none" flat>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="reason && state && (isHimself || isHr)"
|
v-if="reason && state && canUpdate"
|
||||||
:label="t('Reason')"
|
:label="t('Reason')"
|
||||||
color="primary"
|
color="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe('EntryDms', () => {
|
||||||
expect(value).to.have.length(newFileTd++);
|
expect(value).to.have.length(newFileTd++);
|
||||||
const newRowSelector = `tbody > :nth-child(${newFileTd})`;
|
const newRowSelector = `tbody > :nth-child(${newFileTd})`;
|
||||||
cy.waitForElement(newRowSelector);
|
cy.waitForElement(newRowSelector);
|
||||||
cy.validateRow(newRowSelector, [u, u, u, u, 'ENTRADA ID 1']);
|
cy.validateRow(newRowSelector, [u, u, u, u, u, 'ENTRADA ID 1']);
|
||||||
|
|
||||||
//Edit new dms
|
//Edit new dms
|
||||||
const newDescription = 'entry id 1 modified';
|
const newDescription = 'entry id 1 modified';
|
||||||
|
@ -38,7 +38,7 @@ describe('EntryDms', () => {
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
|
|
||||||
cy.validateRow(newRowSelector, [u, u, u, u, newDescription]);
|
cy.validateRow(newRowSelector, [u, u, u, u, u, newDescription]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe('Ticket descriptor', () => {
|
||||||
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
|
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
|
||||||
const summaryHeader = '.summaryHeader > div';
|
const summaryHeader = '.summaryHeader > div';
|
||||||
const weight = 25;
|
const weight = 25;
|
||||||
const weightValue = ':nth-child(10) > .value > span';
|
const weightValue = '.summaryBody.row :nth-child(1) > :nth-child(9) > .value > span';
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
|
|
Loading…
Reference in New Issue