forked from verdnatura/salix-front
Merge branch 'dev' into 7677_vnLocation_perf
This commit is contained in:
commit
e4adbfa9f7
|
@ -5,8 +5,10 @@ import useNotify from 'src/composables/useNotify.js';
|
|||
|
||||
const session = useSession();
|
||||
const { notify } = useNotify();
|
||||
const baseUrl = '/api/';
|
||||
|
||||
axios.defaults.baseURL = '/api/';
|
||||
axios.defaults.baseURL = baseUrl;
|
||||
const axiosNoError = axios.create({ baseURL: baseUrl });
|
||||
|
||||
const onRequest = (config) => {
|
||||
const token = session.getToken();
|
||||
|
@ -79,5 +81,7 @@ const onResponseError = (error) => {
|
|||
|
||||
axios.interceptors.request.use(onRequest, onRequestError);
|
||||
axios.interceptors.response.use(onResponse, onResponseError);
|
||||
axiosNoError.interceptors.request.use(onRequest);
|
||||
axiosNoError.interceptors.response.use(onResponse);
|
||||
|
||||
export { onRequest, onResponseError };
|
||||
export { onRequest, onResponseError, axiosNoError };
|
||||
|
|
|
@ -67,9 +67,13 @@ const mixinRules = [
|
|||
requiredFieldRule,
|
||||
...($attrs.rules ?? []),
|
||||
(val) => {
|
||||
const { min } = vnInputRef.value.$attrs;
|
||||
const { min, max } = vnInputRef.value.$attrs;
|
||||
if (!min) return null;
|
||||
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
||||
if (!max) return null;
|
||||
if (max > 0) {
|
||||
if (Math.floor(val) > max) return t('inputMax', { value: max });
|
||||
}
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
@ -116,8 +120,10 @@ const mixinRules = [
|
|||
<i18n>
|
||||
en:
|
||||
inputMin: Must be more than {value}
|
||||
inputMax: Must be less than {value}
|
||||
es:
|
||||
inputMin: Debe ser mayor a {value}
|
||||
inputMax: Debe ser menor a {value}
|
||||
</i18n>
|
||||
<style lang="scss">
|
||||
.q-field__append {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { onMounted, watch, computed, ref } from 'vue';
|
||||
import { date } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useAttrs } from 'vue';
|
||||
|
||||
const model = defineModel({ type: [String, Date] });
|
||||
const $props = defineProps({
|
||||
|
@ -14,29 +15,19 @@ const $props = defineProps({
|
|||
default: true,
|
||||
},
|
||||
});
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
const { validations } = useValidator();
|
||||
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
||||
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||
|
||||
const dateFormat = 'DD/MM/YYYY';
|
||||
const isPopupOpen = ref();
|
||||
const hover = ref();
|
||||
const mask = ref();
|
||||
const $attrs = useAttrs();
|
||||
|
||||
onMounted(() => {
|
||||
// fix quasar bug
|
||||
mask.value = '##/##/####';
|
||||
});
|
||||
|
||||
const styleAttrs = computed(() => {
|
||||
return $props.isOutlined
|
||||
? {
|
||||
dense: true,
|
||||
outlined: true,
|
||||
rounded: true,
|
||||
}
|
||||
: {};
|
||||
});
|
||||
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
||||
|
||||
const formattedDate = computed({
|
||||
get() {
|
||||
|
@ -48,16 +39,13 @@ const formattedDate = computed({
|
|||
let newDate;
|
||||
if (value) {
|
||||
// parse input
|
||||
if (value.includes('/')) {
|
||||
if (value.length == 6) value = value + new Date().getFullYear();
|
||||
if (value.length >= 10) {
|
||||
if (value.includes('/') && value.length >= 10) {
|
||||
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
|
||||
value = date.formatDate(
|
||||
new Date(value).toISOString(),
|
||||
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
||||
);
|
||||
}
|
||||
}
|
||||
const [year, month, day] = value.split('-').map((e) => parseInt(e));
|
||||
newDate = new Date(year, month - 1, day);
|
||||
if (model.value) {
|
||||
|
@ -79,12 +67,25 @@ const formattedDate = computed({
|
|||
const popupDate = computed(() =>
|
||||
model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
// fix quasar bug
|
||||
mask.value = '##/##/####';
|
||||
});
|
||||
watch(
|
||||
() => model.value,
|
||||
(val) => (formattedDate.value = val),
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
const styleAttrs = computed(() => {
|
||||
return $props.isOutlined
|
||||
? {
|
||||
dense: true,
|
||||
outlined: true,
|
||||
rounded: true,
|
||||
}
|
||||
: {};
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -96,9 +97,10 @@ watch(
|
|||
placeholder="dd/mm/aaaa"
|
||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||
:class="{ required: $attrs.required }"
|
||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||
:rules="mixinRules"
|
||||
:clearable="false"
|
||||
@click="isPopupOpen = true"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #append>
|
||||
<QIcon
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, ref, useAttrs } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { date } from 'quasar';
|
||||
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
const { validations } = useValidator();
|
||||
const $attrs = useAttrs();
|
||||
const model = defineModel({ type: String });
|
||||
const props = defineProps({
|
||||
timeOnly: {
|
||||
|
@ -16,8 +18,8 @@ const props = defineProps({
|
|||
});
|
||||
const initialDate = ref(model.value ?? Date.vnNew());
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
||||
|
||||
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
||||
const dateFormat = 'HH:mm';
|
||||
const isPopupOpen = ref();
|
||||
const hover = ref();
|
||||
|
@ -74,9 +76,10 @@ function dateToTime(newDate) {
|
|||
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||
:class="{ required: $attrs.required }"
|
||||
style="min-width: 100px"
|
||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||
:rules="mixinRules"
|
||||
@click="isPopupOpen = false"
|
||||
type="time"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template #append>
|
||||
<QIcon
|
||||
|
|
|
@ -20,6 +20,8 @@ onMounted(() => (stateStore.leftDrawer = $props.leftDrawer));
|
|||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<RouterView></RouterView>
|
||||
<QPage>
|
||||
<RouterView />
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<script setup>
|
||||
import { ref, toRefs, computed, watch, onMounted } from 'vue';
|
||||
import { ref, toRefs, computed, watch, onMounted, useAttrs } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
||||
|
||||
const $props = defineProps({
|
||||
|
@ -82,10 +83,11 @@ const $props = defineProps({
|
|||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const { validations } = useValidator();
|
||||
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||
const $attrs = useAttrs();
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => val ?? t('globals.fieldRequired');
|
||||
|
||||
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
||||
const { optionLabel, optionValue, optionFilter, optionFilterValue, options, modelValue } =
|
||||
toRefs($props);
|
||||
const myOptions = ref([]);
|
||||
|
@ -248,8 +250,9 @@ const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
|||
ref="vnSelectRef"
|
||||
lazy-rules
|
||||
:class="{ required: $attrs.required }"
|
||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||
:rules="mixinRules"
|
||||
virtual-scroll-slice-size="options.length"
|
||||
hide-bottom-space
|
||||
>
|
||||
<template v-if="isClearable" #append>
|
||||
<QIcon
|
||||
|
|
|
@ -286,6 +286,14 @@ globals:
|
|||
createInvoiceIn: Create invoice in
|
||||
myAccount: My account
|
||||
noOne: No one
|
||||
params:
|
||||
clientFk: Client id
|
||||
salesPersonFk: Sales person
|
||||
warehouseFk: Warehouse
|
||||
provinceFk: Province
|
||||
from: From
|
||||
To: To
|
||||
stateFk: State
|
||||
errors:
|
||||
statusUnauthorized: Access denied
|
||||
statusInternalServerError: An internal server error has ocurred
|
||||
|
|
|
@ -290,6 +290,14 @@ globals:
|
|||
createInvoiceIn: Crear factura recibida
|
||||
myAccount: Mi cuenta
|
||||
noOne: Nadie
|
||||
params:
|
||||
clientFk: Id cliente
|
||||
salesPersonFk: Comercial
|
||||
warehouseFk: Almacén
|
||||
provinceFk: Provincia
|
||||
from: Desde
|
||||
To: Hasta
|
||||
stateFk: Estado
|
||||
errors:
|
||||
statusUnauthorized: Acceso denegado
|
||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||
|
|
|
@ -116,7 +116,7 @@ const entriesTableColumns = computed(() => [
|
|||
{{ col.value }}
|
||||
</QTd>
|
||||
<QBtn
|
||||
icon="print"
|
||||
icon="visibility"
|
||||
v-if="props.row.stickers > 0"
|
||||
:loading="isLoading"
|
||||
@click="
|
||||
|
@ -126,7 +126,7 @@ const entriesTableColumns = computed(() => [
|
|||
"
|
||||
unelevated
|
||||
>
|
||||
<QTooltip>{{ t('printLabel') }}</QTooltip>
|
||||
<QTooltip>{{ t('viewLabel') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QTr>
|
||||
</template>
|
||||
|
|
|
@ -11,4 +11,4 @@ shipped: Shipped
|
|||
fromShipped: Shipped(from)
|
||||
toShipped: Shipped(to)
|
||||
printLabels: Print stickers
|
||||
printLabel: Print sticker
|
||||
viewLabel: View sticker
|
||||
|
|
|
@ -15,4 +15,4 @@ shipped: F. salida
|
|||
fromShipped: F. salida(desde)
|
||||
toShipped: F. salida(hasta)
|
||||
printLabels: Imprimir etiquetas
|
||||
printLabel: Imprimir etiqueta
|
||||
viewLabel: Ver etiqueta
|
||||
|
|
|
@ -76,53 +76,28 @@ const columns = computed(() => [
|
|||
name: 'rate2',
|
||||
...defaultColumnAttrs,
|
||||
cardVisible: true,
|
||||
columnField: {
|
||||
class: 'expand',
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
columnFilter: {
|
||||
class: 'expand',
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.packingPrice'),
|
||||
field: 'rate3',
|
||||
name: 'rate3',
|
||||
...defaultColumnAttrs,
|
||||
cardVisible: true,
|
||||
columnField: {
|
||||
class: 'expand',
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
columnFilter: {
|
||||
class: 'expand',
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
label: t('item.fixedPrice.minPrice'),
|
||||
field: 'minPrice',
|
||||
columnClass: 'shrink',
|
||||
name: 'minPrice',
|
||||
...defaultColumnAttrs,
|
||||
cardVisible: true,
|
||||
columnField: {
|
||||
class: 'expand',
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
columnFilter: {
|
||||
class: 'expand',
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('item.fixedPrice.started'),
|
||||
field: 'started',
|
||||
|
@ -162,17 +137,10 @@ const columns = computed(() => [
|
|||
name: 'warehouseFk',
|
||||
...defaultColumnAttrs,
|
||||
columnClass: 'shrink',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
},
|
||||
columnField: {
|
||||
component: 'select',
|
||||
class: 'expand',
|
||||
},
|
||||
attrs: {
|
||||
|
||||
options: warehousesOptions,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
|
@ -518,29 +486,35 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</span>
|
||||
<span class="subName">{{ row.subName }}</span>
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
<FetchedTags style="width: max-content; max-width: 220px" :item="row" />
|
||||
<FetchedTags :item="row" />
|
||||
</template>
|
||||
<template #column-rate2="props">
|
||||
<QTd class="col">
|
||||
<VnInput
|
||||
mask="###.##"
|
||||
type="currency"
|
||||
style="width: 75px"
|
||||
v-model.number="props.row.rate2"
|
||||
v-on="getRowUpdateInputEvents(props)"
|
||||
>
|
||||
<template #append>€</template>
|
||||
</VnInput>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-rate3="props">
|
||||
<QTd class="col">
|
||||
<VnInput
|
||||
mask="###.##"
|
||||
style="width: 75px"
|
||||
type="currency"
|
||||
v-model.number="props.row.rate3"
|
||||
v-on="getRowUpdateInputEvents(props)"
|
||||
>
|
||||
<template #append>€</template>
|
||||
</VnInput>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-minPrice="props">
|
||||
<QTd class="col">
|
||||
<div class="row" style="width: 115px">
|
||||
<div class="row">
|
||||
<QCheckbox
|
||||
:model-value="props.row.hasMinPrice"
|
||||
@update:model-value="updateMinPrice($event, props)"
|
||||
|
@ -549,6 +523,8 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
/>
|
||||
<VnInput
|
||||
class="col"
|
||||
type="currency"
|
||||
mask="###.##"
|
||||
:disable="props.row.hasMinPrice === 1"
|
||||
v-model.number="props.row.minPrice"
|
||||
v-on="getRowUpdateInputEvents(props)"
|
||||
|
@ -577,6 +553,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
/>
|
||||
</template>
|
||||
<template #column-warehouseFk="props">
|
||||
<QTd class="col">
|
||||
<VnSelect
|
||||
style="max-width: 150px"
|
||||
:options="warehousesOptions"
|
||||
|
@ -586,6 +563,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
v-model="props.row.warehouseFk"
|
||||
v-on="getRowUpdateInputEvents(props, false, 'select')"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-deleteAction="{ row, rowIndex }">
|
||||
<QIcon
|
||||
|
|
|
@ -40,7 +40,7 @@ const handleScopeDays = (params, days, callback) => {
|
|||
<VnFilterPanel
|
||||
:data-key="dataKey"
|
||||
:search-button="true"
|
||||
:hidden-tags="['from', 'to']"
|
||||
:hidden-tags="['from', 'to', 'search']"
|
||||
:custom-tags="['scopeDays']"
|
||||
:unremovable-params="['from', 'to', 'scopeDays']"
|
||||
>
|
||||
|
@ -64,7 +64,7 @@ const handleScopeDays = (params, days, callback) => {
|
|||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.clientFk')"
|
||||
:label="t('globals.params.clientFk')"
|
||||
v-model="params.clientFk"
|
||||
is-outlined
|
||||
/>
|
||||
|
@ -105,7 +105,7 @@ const handleScopeDays = (params, days, callback) => {
|
|||
outlined
|
||||
dense
|
||||
rounded
|
||||
:label="t('params.salesPersonFk')"
|
||||
:label="t('globals.params.salesPersonFk')"
|
||||
v-model="params.salesPersonFk"
|
||||
url="Workers/search"
|
||||
:params="{ departmentCodes: ['VT'] }"
|
||||
|
@ -158,7 +158,7 @@ const handleScopeDays = (params, days, callback) => {
|
|||
outlined
|
||||
dense
|
||||
rounded
|
||||
:label="t('params.stateFk')"
|
||||
:label="t('globals.params.stateFk')"
|
||||
v-model="params.stateFk"
|
||||
url="States"
|
||||
is-outlined
|
||||
|
@ -184,7 +184,7 @@ const handleScopeDays = (params, days, callback) => {
|
|||
outlined
|
||||
dense
|
||||
rounded
|
||||
:label="t('params.warehouseFk')"
|
||||
:label="t('globals.params.warehouseFk')"
|
||||
v-model="params.warehouseFk"
|
||||
:options="warehouses"
|
||||
/>
|
||||
|
@ -196,7 +196,7 @@ const handleScopeDays = (params, days, callback) => {
|
|||
outlined
|
||||
dense
|
||||
rounded
|
||||
:label="t('params.provinceFk')"
|
||||
:label="t('globals.params.provinceFk')"
|
||||
v-model="params.provinceFk"
|
||||
url="Provinces"
|
||||
/>
|
||||
|
@ -235,22 +235,15 @@ const handleScopeDays = (params, days, callback) => {
|
|||
<i18n>
|
||||
en:
|
||||
params:
|
||||
clientFk: Client id
|
||||
orderFk: Order id
|
||||
scopeDays: Days onward
|
||||
nickname: Nickname
|
||||
salesPersonFk: Sales person
|
||||
refFk: Invoice
|
||||
agencyModeFk: Agency
|
||||
stateFk: State
|
||||
groupedStates: Grouped State
|
||||
warehouseFk: Warehouse
|
||||
provinceFk: Province
|
||||
myTeam: My team
|
||||
problems: With problems
|
||||
pending: Pending
|
||||
from: From
|
||||
to: To
|
||||
alertLevel: Grouped State
|
||||
FREE: Free
|
||||
DELIVERED: Delivered
|
||||
|
@ -261,22 +254,15 @@ en:
|
|||
|
||||
es:
|
||||
params:
|
||||
clientFk: Id cliente
|
||||
orderFk: Id cesta
|
||||
scopeDays: Días en adelante
|
||||
nickname: Nombre mostrado
|
||||
salesPersonFk: Comercial
|
||||
refFk: Factura
|
||||
agencyModeFk: Agencia
|
||||
stateFk: Estado
|
||||
groupedStates: Estado agrupado
|
||||
warehouseFk: Almacén
|
||||
provinceFk: Provincia
|
||||
myTeam: Mi equipo
|
||||
problems: Con problemas
|
||||
pending: Pendiente
|
||||
from: Desde
|
||||
To: Hasta
|
||||
alertLevel: Estado agrupado
|
||||
FREE: Libre
|
||||
DELIVERED: Servido
|
||||
|
|
|
@ -3,7 +3,7 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
|||
</script>
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="SalesMonitorTickets"
|
||||
data-key="saleMonitorTickets"
|
||||
url="SalesMonitors/salesFilter"
|
||||
:redirect="false"
|
||||
:label="$t('searchBar.label')"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { onMounted, ref, computed, onBeforeMount, nextTick, reactive } from 'vue';
|
||||
import { axiosNoError } from 'src/boot/axios';
|
||||
|
||||
import FetchData from 'components/FetchData.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 axios from 'axios';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
@ -63,13 +63,16 @@ const selectedCalendarDates = ref([]);
|
|||
const selectedDateFormatted = ref(toDateString(defaultDate.value));
|
||||
|
||||
const arrayData = useArrayData('workerData');
|
||||
|
||||
const acl = useAcl();
|
||||
const worker = computed(() => arrayData.store?.data);
|
||||
|
||||
const isHr = computed(() => useRole().hasAny(['hr']));
|
||||
|
||||
const canSend = computed(() => useAcl().hasAny('WorkerTimeControl', 'sendMail', 'WRITE'));
|
||||
|
||||
const canSend = computed(() =>
|
||||
acl.hasAny([{ model: 'WorkerTimeControl', props: 'sendMail', accessType: 'WRITE' }])
|
||||
);
|
||||
const canUpdate = computed(() =>
|
||||
acl.hasAny([
|
||||
{ model: 'WorkerTimeControl', props: 'updateMailState', accessType: 'WRITE' },
|
||||
])
|
||||
);
|
||||
const isHimself = computed(() => user.value.id === Number(route.params.id));
|
||||
|
||||
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 () => {
|
||||
try {
|
||||
const filter = {
|
||||
where: {
|
||||
workerFk: route.params.id,
|
||||
year: selectedDate.value ? selectedDate.value?.getFullYear() : null,
|
||||
const where = {
|
||||
year: selectedDate.value.getFullYear(),
|
||||
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 (!data.length) {
|
||||
state.value = null;
|
||||
} else {
|
||||
const [mail] = data;
|
||||
if (!mail) state.value = null;
|
||||
else {
|
||||
state.value = mail.state;
|
||||
reason.value = mail.reason;
|
||||
}
|
||||
|
||||
await canBeResend();
|
||||
canResend.value = !!(
|
||||
await axiosNoError.get('WorkerTimeControlMails/count', { params: { where } })
|
||||
).data.count;
|
||||
} catch (err) {
|
||||
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) => {
|
||||
for (const weekDay of weekDays.value) {
|
||||
if (data) {
|
||||
|
@ -449,7 +426,7 @@ onMounted(async () => {
|
|||
<div>
|
||||
<QBtnGroup push class="q-gutter-x-sm" flat>
|
||||
<QBtn
|
||||
v-if="isHimself && state"
|
||||
v-if="canUpdate && state"
|
||||
:label="t('Satisfied')"
|
||||
color="primary"
|
||||
type="submit"
|
||||
|
@ -457,7 +434,7 @@ onMounted(async () => {
|
|||
@click="isSatisfied()"
|
||||
/>
|
||||
<QBtn
|
||||
v-if="isHimself && state"
|
||||
v-if="canUpdate && state"
|
||||
:label="t('Not satisfied')"
|
||||
color="primary"
|
||||
type="submit"
|
||||
|
@ -468,7 +445,7 @@ onMounted(async () => {
|
|||
</QBtnGroup>
|
||||
<QBtnGroup push class="q-gutter-x-sm q-ml-none" flat>
|
||||
<QBtn
|
||||
v-if="reason && state && (isHimself || isHr)"
|
||||
v-if="reason && state && canUpdate"
|
||||
:label="t('Reason')"
|
||||
color="primary"
|
||||
type="submit"
|
||||
|
|
|
@ -23,7 +23,7 @@ describe('EntryDms', () => {
|
|||
expect(value).to.have.length(newFileTd++);
|
||||
const newRowSelector = `tbody > :nth-child(${newFileTd})`;
|
||||
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
|
||||
const newDescription = 'entry id 1 modified';
|
||||
|
@ -38,7 +38,7 @@ describe('EntryDms', () => {
|
|||
cy.saveCard();
|
||||
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 summaryHeader = '.summaryHeader > div';
|
||||
const weight = 25;
|
||||
const weightValue = ':nth-child(10) > .value > span';
|
||||
const weightValue = '.summaryBody.row :nth-child(1) > :nth-child(9) > .value > span';
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.viewport(1920, 1080);
|
||||
|
|
Loading…
Reference in New Issue