6321_negative_tickets #1371
|
@ -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 };
|
||||||
|
|
|
@ -67,9 +67,13 @@ const mixinRules = [
|
||||||
requiredFieldRule,
|
requiredFieldRule,
|
||||||
...($attrs.rules ?? []),
|
...($attrs.rules ?? []),
|
||||||
(val) => {
|
(val) => {
|
||||||
const { min } = vnInputRef.value.$attrs;
|
const { min, max } = vnInputRef.value.$attrs;
|
||||||
if (!min) return null;
|
if (!min) return null;
|
||||||
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
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>
|
</script>
|
||||||
|
@ -116,8 +120,10 @@ const mixinRules = [
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
inputMin: Must be more than {value}
|
inputMin: Must be more than {value}
|
||||||
|
inputMax: Must be less than {value}
|
||||||
es:
|
es:
|
||||||
inputMin: Debe ser mayor a {value}
|
inputMin: Debe ser mayor a {value}
|
||||||
|
inputMax: Debe ser menor a {value}
|
||||||
</i18n>
|
</i18n>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.q-field__append {
|
.q-field__append {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { onMounted, watch, computed, ref } from 'vue';
|
import { onMounted, watch, computed, ref } from 'vue';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useAttrs } from 'vue';
|
||||||
|
|
||||||
const model = defineModel({ type: [String, Date] });
|
const model = defineModel({ type: [String, Date] });
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -14,29 +15,19 @@ const $props = defineProps({
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
|
const { validations } = useValidator();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||||
|
|
||||||
const dateFormat = 'DD/MM/YYYY';
|
const dateFormat = 'DD/MM/YYYY';
|
||||||
const isPopupOpen = ref();
|
const isPopupOpen = ref();
|
||||||
const hover = ref();
|
const hover = ref();
|
||||||
const mask = ref();
|
const mask = ref();
|
||||||
|
const $attrs = useAttrs();
|
||||||
|
|
||||||
onMounted(() => {
|
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
||||||
// fix quasar bug
|
|
||||||
mask.value = '##/##/####';
|
|
||||||
});
|
|
||||||
|
|
||||||
const styleAttrs = computed(() => {
|
|
||||||
return $props.isOutlined
|
|
||||||
? {
|
|
||||||
dense: true,
|
|
||||||
outlined: true,
|
|
||||||
rounded: true,
|
|
||||||
}
|
|
||||||
: {};
|
|
||||||
});
|
|
||||||
|
|
||||||
const formattedDate = computed({
|
const formattedDate = computed({
|
||||||
get() {
|
get() {
|
||||||
|
@ -48,15 +39,12 @@ const formattedDate = computed({
|
||||||
let newDate;
|
let newDate;
|
||||||
if (value) {
|
if (value) {
|
||||||
// parse input
|
// parse input
|
||||||
if (value.includes('/')) {
|
if (value.includes('/') && value.length >= 10) {
|
||||||
if (value.length == 6) value = value + new Date().getFullYear();
|
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
|
||||||
if (value.length >= 10) {
|
value = date.formatDate(
|
||||||
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
|
new Date(value).toISOString(),
|
||||||
value = date.formatDate(
|
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
||||||
new Date(value).toISOString(),
|
);
|
||||||
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const [year, month, day] = value.split('-').map((e) => parseInt(e));
|
const [year, month, day] = value.split('-').map((e) => parseInt(e));
|
||||||
newDate = new Date(year, month - 1, day);
|
newDate = new Date(year, month - 1, day);
|
||||||
|
@ -79,12 +67,25 @@ const formattedDate = computed({
|
||||||
const popupDate = computed(() =>
|
const popupDate = computed(() =>
|
||||||
model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value
|
model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value
|
||||||
);
|
);
|
||||||
|
onMounted(() => {
|
||||||
|
// fix quasar bug
|
||||||
|
mask.value = '##/##/####';
|
||||||
|
});
|
||||||
watch(
|
watch(
|
||||||
() => model.value,
|
() => model.value,
|
||||||
(val) => (formattedDate.value = val),
|
(val) => (formattedDate.value = val),
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const styleAttrs = computed(() => {
|
||||||
|
return $props.isOutlined
|
||||||
|
? {
|
||||||
|
dense: true,
|
||||||
|
outlined: true,
|
||||||
|
rounded: true,
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -96,9 +97,10 @@ watch(
|
||||||
placeholder="dd/mm/aaaa"
|
placeholder="dd/mm/aaaa"
|
||||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
:rules="mixinRules"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
@click="isPopupOpen = true"
|
@click="isPopupOpen = true"
|
||||||
|
hide-bottom-space
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref, useAttrs } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
|
const { validations } = useValidator();
|
||||||
|
const $attrs = useAttrs();
|
||||||
const model = defineModel({ type: String });
|
const model = defineModel({ type: String });
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
timeOnly: {
|
timeOnly: {
|
||||||
|
@ -16,8 +18,8 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
const initialDate = ref(model.value ?? Date.vnNew());
|
const initialDate = ref(model.value ?? Date.vnNew());
|
||||||
const { t } = useI18n();
|
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 dateFormat = 'HH:mm';
|
||||||
const isPopupOpen = ref();
|
const isPopupOpen = ref();
|
||||||
const hover = ref();
|
const hover = ref();
|
||||||
|
@ -74,9 +76,10 @@ function dateToTime(newDate) {
|
||||||
v-bind="{ ...$attrs, ...styleAttrs }"
|
v-bind="{ ...$attrs, ...styleAttrs }"
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
style="min-width: 100px"
|
style="min-width: 100px"
|
||||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
:rules="mixinRules"
|
||||||
@click="isPopupOpen = false"
|
@click="isPopupOpen = false"
|
||||||
type="time"
|
type="time"
|
||||||
|
hide-bottom-space
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -2,21 +2,37 @@
|
||||||
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||||
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { ref } from 'vue';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const value = defineModel({ type: [String, Number, Object] });
|
const emit = defineEmits(['update:model-value', 'update:options']);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
location: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const modelValue = ref(
|
||||||
|
props.location
|
||||||
|
? `${props.location?.postcode} - ${props.location?.city}(${props.location?.province?.name}), ${props.location?.country?.name}`
|
||||||
|
: null
|
||||||
|
);
|
||||||
function showLabel(data) {
|
function showLabel(data) {
|
||||||
return `${data.code} - ${data.town}(${data.province}), ${data.country}`;
|
return `${data.code} - ${data.town}(${data.province}), ${data.country}`;
|
||||||
}
|
}
|
||||||
|
const handleModelValue = (data) => {
|
||||||
|
emit('update:model-value', data);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
v-model="value"
|
v-model="modelValue"
|
||||||
option-value="code"
|
|
||||||
option-filter-value="search"
|
option-filter-value="search"
|
||||||
:option-label="(opt) => showLabel(opt)"
|
:option-label="
|
||||||
|
(opt) => (typeof modelValue === 'string' ? modelValue : showLabel(opt))
|
||||||
|
"
|
||||||
url="Postcodes/filter"
|
url="Postcodes/filter"
|
||||||
|
@update:model-value="handleModelValue"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
:label="t('Location')"
|
:label="t('Location')"
|
||||||
:placeholder="t('search_by_postalcode')"
|
:placeholder="t('search_by_postalcode')"
|
||||||
|
@ -27,7 +43,14 @@ function showLabel(data) {
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateNewPostcode @on-data-saved="(newValue) => (value = newValue)" />
|
<CreateNewPostcode
|
||||||
|
@on-data-saved="
|
||||||
|
(newValue) => {
|
||||||
|
modelValue = newValue;
|
||||||
|
emit('update:model-value', newValue);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
|
|
@ -20,6 +20,8 @@ onMounted(() => (stateStore.leftDrawer = $props.leftDrawer));
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<QPageContainer>
|
<QPageContainer>
|
||||||
<RouterView></RouterView>
|
<QPage>
|
||||||
|
<RouterView />
|
||||||
|
</QPage>
|
||||||
</QPageContainer>
|
</QPageContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<script setup>
|
<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 { useI18n } from 'vue-i18n';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -86,10 +87,11 @@ const $props = defineProps({
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const { validations } = useValidator();
|
||||||
|
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||||
|
const $attrs = useAttrs();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const requiredFieldRule = (val) => val ?? t('globals.fieldRequired');
|
const mixinRules = [requiredFieldRule, ...($attrs.rules ?? [])];
|
||||||
|
|
||||||
const { optionLabel, optionValue, optionFilter, optionFilterValue, options, modelValue } =
|
const { optionLabel, optionValue, optionFilter, optionFilterValue, options, modelValue } =
|
||||||
toRefs($props);
|
toRefs($props);
|
||||||
const myOptions = ref([]);
|
const myOptions = ref([]);
|
||||||
|
@ -252,8 +254,9 @@ const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
||||||
ref="vnSelectRef"
|
ref="vnSelectRef"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
:rules="mixinRules"
|
||||||
virtual-scroll-slice-size="options.length"
|
virtual-scroll-slice-size="options.length"
|
||||||
|
hide-bottom-space
|
||||||
>
|
>
|
||||||
<template v-if="isClearable" #append>
|
<template v-if="isClearable" #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -110,6 +110,7 @@ globals:
|
||||||
weight: Weight
|
weight: Weight
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Login
|
logIn: Login
|
||||||
|
addressEdit: Update address
|
||||||
summary: Summary
|
summary: Summary
|
||||||
basicData: Basic data
|
basicData: Basic data
|
||||||
log: Logs
|
log: Logs
|
||||||
|
|
|
@ -112,6 +112,7 @@ globals:
|
||||||
weight: Peso
|
weight: Peso
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Inicio de sesión
|
logIn: Inicio de sesión
|
||||||
|
addressEdit: Modificar consignatario
|
||||||
summary: Resumen
|
summary: Resumen
|
||||||
basicData: Datos básicos
|
basicData: Datos básicos
|
||||||
log: Historial
|
log: Historial
|
||||||
|
|
|
@ -5,15 +5,12 @@ import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const addresses = ref([]);
|
const addresses = ref([]);
|
||||||
const client = ref(null);
|
const client = ref(null);
|
||||||
const provincesLocation = ref([]);
|
|
||||||
|
|
||||||
const addressFilter = {
|
const addressFilter = {
|
||||||
fields: [
|
fields: [
|
||||||
|
@ -41,7 +38,13 @@ const addressFilter = {
|
||||||
{
|
{
|
||||||
relation: 'province',
|
relation: 'province',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name', 'countryFk'],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'country',
|
||||||
|
scope: { fields: ['id', 'name'] },
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -83,13 +86,6 @@ const getClientData = async (id) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const setProvince = (provinceFk) => {
|
|
||||||
const result = provincesLocation.value.filter(
|
|
||||||
(province) => province.id === provinceFk
|
|
||||||
);
|
|
||||||
return result[0]?.name || '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const isDefaultAddress = (address) => {
|
const isDefaultAddress = (address) => {
|
||||||
return client?.value?.defaultAddressFk === address.id ? 1 : 0;
|
return client?.value?.defaultAddressFk === address.id ? 1 : 0;
|
||||||
};
|
};
|
||||||
|
@ -128,12 +124,6 @@ const toCustomerAddressEdit = (addressId) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
@on-fetch="(data) => (provincesLocation = data)"
|
|
||||||
auto-load
|
|
||||||
url="Provinces/location"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div class="full-width flex justify-center">
|
<div class="full-width flex justify-center">
|
||||||
<QCard class="card-width q-pa-lg" v-if="addresses.length">
|
<QCard class="card-width q-pa-lg" v-if="addresses.length">
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
|
@ -177,7 +167,7 @@ const toCustomerAddressEdit = (addressId) => {
|
||||||
<div>{{ item.street }}</div>
|
<div>{{ item.street }}</div>
|
||||||
<div>
|
<div>
|
||||||
{{ item.postalCode }} - {{ item.city }},
|
{{ item.postalCode }} - {{ item.city }},
|
||||||
{{ setProvince(item.provinceFk) }}
|
{{ item.province.name }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ item.phone }}
|
{{ item.phone }}
|
||||||
|
|
|
@ -94,7 +94,7 @@ function handleLocation(data, location) {
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.postcode"
|
:location="data"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
|
@ -177,7 +177,12 @@ function handleLocation(data, location) {
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.postalCode"
|
:location="{
|
||||||
|
postcode: data.postalCode,
|
||||||
|
city: data.city,
|
||||||
|
province: data.province,
|
||||||
|
country: data.province.country,
|
||||||
|
}"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
></VnLocation>
|
></VnLocation>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,7 +26,13 @@ const addressesFilter = {
|
||||||
{
|
{
|
||||||
relation: 'province',
|
relation: 'province',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name', 'countryFk'],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'country',
|
||||||
|
scope: { fields: ['id', 'name'] },
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -21,6 +21,7 @@ const newAddressForm = reactive({
|
||||||
provinceFk: null,
|
provinceFk: null,
|
||||||
phone: null,
|
phone: null,
|
||||||
mobile: null,
|
mobile: null,
|
||||||
|
province: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const onDataSaved = () => {
|
const onDataSaved = () => {
|
||||||
|
@ -84,7 +85,16 @@ function handleLocation(data, location) {
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.location"
|
:location="
|
||||||
|
data.postalCode
|
||||||
|
? {
|
||||||
|
postcode: data.postalCode,
|
||||||
|
city: data.city,
|
||||||
|
province: data.province,
|
||||||
|
country: data.province.country,
|
||||||
|
}
|
||||||
|
: null
|
||||||
|
"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
>
|
>
|
||||||
</VnLocation>
|
</VnLocation>
|
||||||
|
|
|
@ -19,8 +19,8 @@ const sageTransactionTypesOptions = ref([]);
|
||||||
const supplierActivitiesOptions = ref([]);
|
const supplierActivitiesOptions = ref([]);
|
||||||
|
|
||||||
function handleLocation(data, location) {
|
function handleLocation(data, location) {
|
||||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
const { town, label, provinceFk, countryFk } = location ?? {};
|
||||||
data.postCode = code;
|
data.postCode = label;
|
||||||
data.city = town;
|
data.city = town;
|
||||||
data.provinceFk = provinceFk;
|
data.provinceFk = provinceFk;
|
||||||
data.countryFk = countryFk;
|
data.countryFk = countryFk;
|
||||||
|
@ -51,6 +51,23 @@ function handleLocation(data, location) {
|
||||||
:url="`Suppliers/${route.params.id}`"
|
:url="`Suppliers/${route.params.id}`"
|
||||||
:url-update="`Suppliers/${route.params.id}/updateFiscalData`"
|
:url-update="`Suppliers/${route.params.id}/updateFiscalData`"
|
||||||
model="supplier"
|
model="supplier"
|
||||||
|
:filter="{
|
||||||
|
fields: ['id', 'name', 'city', 'postCode', 'countryFk', 'provinceFk'],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'province',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'country',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}"
|
||||||
auto-load
|
auto-load
|
||||||
:clear-store-on-unmount="false"
|
:clear-store-on-unmount="false"
|
||||||
>
|
>
|
||||||
|
@ -130,7 +147,12 @@ function handleLocation(data, location) {
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.postCode"
|
:location="{
|
||||||
|
postcode: data.postCode,
|
||||||
|
city: data.city,
|
||||||
|
province: data.province,
|
||||||
|
country: data.country,
|
||||||
|
}"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
>
|
>
|
||||||
</VnLocation>
|
</VnLocation>
|
||||||
|
|
|
@ -2,14 +2,13 @@
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import CardList from 'components/ui/CardList.vue';
|
|
||||||
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnRow from 'src/components/ui/VnRow.vue';
|
import VnRow from 'src/components/ui/VnRow.vue';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const arrayData = useArrayData('WagonTypeList');
|
const arrayData = useArrayData('WagonTypeList');
|
||||||
|
@ -17,7 +16,7 @@ const store = arrayData.store;
|
||||||
const dialog = ref();
|
const dialog = ref();
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const paginate = ref();
|
const tableRef = ref();
|
||||||
|
|
||||||
const initialData = computed(() => {
|
const initialData = computed(() => {
|
||||||
return {
|
return {
|
||||||
|
@ -25,10 +24,46 @@ const initialData = computed(() => {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
function reloadData() {
|
const columns = computed(() => [
|
||||||
initialData.value.name = null;
|
{
|
||||||
paginate.value.fetch();
|
align: 'left',
|
||||||
}
|
name: 'id',
|
||||||
|
label: t('ID'),
|
||||||
|
isId: true,
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'name',
|
||||||
|
label: t('Name'),
|
||||||
|
isTitle: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'divisible',
|
||||||
|
label: t('Divisible'),
|
||||||
|
cardVisible: true,
|
||||||
|
component: 'checkbox',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('components.smartCard.openCard'),
|
||||||
|
icon: 'arrow_forward',
|
||||||
|
isPrimary: true,
|
||||||
|
action: (row) => navigate(row.id, row.name),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('wagon.list.remove'),
|
||||||
|
icon: 'delete',
|
||||||
|
isPrimary: true,
|
||||||
|
action: (row) => remove(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
function navigate(id, name) {
|
function navigate(id, name) {
|
||||||
push({ path: `/wagon/type/${id}/edit`, query: { name } });
|
push({ path: `/wagon/type/${id}/edit`, query: { name } });
|
||||||
|
@ -41,51 +76,25 @@ async function remove(row) {
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
});
|
});
|
||||||
store.data.splice(store.data.indexOf(row), 1);
|
store.data.splice(store.data.indexOf(row), 1);
|
||||||
|
window.location.reload();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<div class="vn-card-list">
|
<VnTable
|
||||||
<VnPaginate
|
ref="tableRef"
|
||||||
ref="paginate"
|
data-key="WagonTypeList"
|
||||||
data-key="WagonTypeList"
|
url="WagonTypes"
|
||||||
url="WagonTypes"
|
:columns="columns"
|
||||||
order="id DESC"
|
auto-load
|
||||||
auto-load
|
order="id DESC"
|
||||||
>
|
:right-search="false"
|
||||||
<template #body="{ rows }">
|
:column-search="false"
|
||||||
<CardList
|
:default-mode="'card'"
|
||||||
v-for="row of rows"
|
:disable-option="{ table: true }"
|
||||||
:key="row.id"
|
>
|
||||||
:title="(row.name || '').toString()"
|
</VnTable>
|
||||||
:id="row.id"
|
|
||||||
@click="navigate(row.id, row.name)"
|
|
||||||
>
|
|
||||||
<template #list-items>
|
|
||||||
<QCheckbox
|
|
||||||
:label="t('Divisble')"
|
|
||||||
:model-value="row.divisible"
|
|
||||||
disable
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #actions>
|
|
||||||
<QBtn
|
|
||||||
:label="t('components.smartCard.openCard')"
|
|
||||||
@click.stop="navigate(row.id, row.name)"
|
|
||||||
outline
|
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
:label="t('wagon.list.remove')"
|
|
||||||
@click.stop="remove(row)"
|
|
||||||
color="primary"
|
|
||||||
style="margin-top: 15px"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</CardList>
|
|
||||||
</template>
|
|
||||||
</VnPaginate>
|
|
||||||
</div>
|
|
||||||
<QPageSticky :offset="[18, 18]">
|
<QPageSticky :offset="[18, 18]">
|
||||||
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add" shortcut="+">
|
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add" shortcut="+">
|
||||||
<QDialog ref="dialog">
|
<QDialog ref="dialog">
|
||||||
|
@ -94,7 +103,7 @@ async function remove(row) {
|
||||||
url-create="WagonTypes"
|
url-create="WagonTypes"
|
||||||
model="WagonType"
|
model="WagonType"
|
||||||
:form-initial-data="initialData"
|
:form-initial-data="initialData"
|
||||||
@on-data-saved="reloadData()"
|
@on-data-saved="window.location.reload()"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import CardList from 'components/ui/CardList.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import { computed } from 'vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const arrayData = useArrayData('WagonList');
|
const arrayData = useArrayData('WagonList');
|
||||||
|
@ -23,14 +24,56 @@ const filter = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'label',
|
||||||
|
label: t('Label'),
|
||||||
|
isTitle: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'plate',
|
||||||
|
label: t('wagon.list.plate'),
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'volume',
|
||||||
|
label: t('wagon.list.volume'),
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'name',
|
||||||
|
label: t('wagon.list.type'),
|
||||||
|
cardVisible: true,
|
||||||
|
format: (row) => row?.type?.name,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('components.smartCard.openCard'),
|
||||||
|
icon: 'arrow_forward',
|
||||||
|
isPrimary: true,
|
||||||
|
action: (row) => navigate(row.id),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('wagon.list.remove'),
|
||||||
|
icon: 'delete',
|
||||||
|
isPrimary: true,
|
||||||
|
action: (row) => remove(row),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
function navigate(id) {
|
function navigate(id) {
|
||||||
router.push({ path: `/wagon/${id}/edit` });
|
router.push({ path: `/wagon/${id}/edit` });
|
||||||
}
|
}
|
||||||
|
|
||||||
function create() {
|
|
||||||
router.push({ path: `/wagon/create` });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function remove(row) {
|
async function remove(row) {
|
||||||
try {
|
try {
|
||||||
await axios.delete(`Wagons/${row.id}`).then(async () => {
|
await axios.delete(`Wagons/${row.id}`).then(async () => {
|
||||||
|
@ -39,6 +82,7 @@ async function remove(row) {
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
});
|
});
|
||||||
store.data.splice(store.data.indexOf(row), 1);
|
store.data.splice(store.data.indexOf(row), 1);
|
||||||
|
window.location.reload();
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//
|
//
|
||||||
|
@ -48,53 +92,83 @@ async function remove(row) {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<div class="vn-card-list">
|
<VnTable
|
||||||
<VnPaginate
|
ref="tableRef"
|
||||||
data-key="WagonList"
|
data-key="WagonList"
|
||||||
url="/Wagons"
|
url="Wagons"
|
||||||
order="id DESC"
|
:filter="filter"
|
||||||
:filter="filter"
|
:columns="columns"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
order="id DESC"
|
||||||
<template #body="{ rows }">
|
:right-search="false"
|
||||||
<CardList
|
:column-search="false"
|
||||||
v-for="row of rows"
|
:default-mode="'card'"
|
||||||
:key="row.id"
|
:disable-option="{ table: true }"
|
||||||
:title="(row.label || '').toString()"
|
:create="{
|
||||||
:id="row.id"
|
urlCreate: 'Wagons',
|
||||||
@click="navigate(row.id)"
|
title: t('Create new wagon'),
|
||||||
>
|
onDataSaved: () => {
|
||||||
<template #list-items>
|
window.location.reload();
|
||||||
<VnLv
|
},
|
||||||
:label="t('wagon.list.plate')"
|
formInitialData: {},
|
||||||
:title-label="t('wagon.list.plate')"
|
}"
|
||||||
:value="row.plate"
|
>
|
||||||
/>
|
<template #more-create-dialog="{ data }">
|
||||||
<VnLv :label="t('wagon.list.volume')" :value="row?.volume" />
|
<VnInput
|
||||||
<VnLv
|
filled
|
||||||
:label="t('wagon.list.type')"
|
v-model="data.label"
|
||||||
:value="row?.type?.name"
|
:label="t('wagon.create.label')"
|
||||||
/>
|
type="number"
|
||||||
</template>
|
min="0"
|
||||||
<template #actions>
|
:rules="[(val) => !!val || t('wagon.warnings.labelNotEmpty')]"
|
||||||
<QBtn
|
/>
|
||||||
:label="t('components.smartCard.openCard')"
|
<VnInput
|
||||||
@click.stop="navigate(row.id)"
|
filled
|
||||||
outline
|
v-model="data.plate"
|
||||||
/>
|
:label="t('wagon.create.plate')"
|
||||||
<QBtn
|
:rules="[(val) => !!val || t('wagon.warnings.plateNotEmpty')]"
|
||||||
:label="t('wagon.list.remove')"
|
/>
|
||||||
@click.stop="remove(row)"
|
<VnInput
|
||||||
color="primary"
|
filled
|
||||||
style="margin-top: 15px"
|
v-model="data.volume"
|
||||||
/>
|
:label="t('wagon.create.volume')"
|
||||||
</template>
|
type="number"
|
||||||
</CardList>
|
min="0"
|
||||||
</template>
|
:rules="[(val) => !!val || t('wagon.warnings.volumeNotEmpty')]"
|
||||||
</VnPaginate>
|
/>
|
||||||
</div>
|
<VnSelect
|
||||||
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
url="WagonTypes"
|
||||||
<QBtn @click="create" fab icon="add" color="primary" shortcut="+" />
|
filled
|
||||||
</QPageSticky>
|
v-model="data.typeFk"
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
|
hide-selected
|
||||||
|
input-debounce="0"
|
||||||
|
option-label="name"
|
||||||
|
option-value="id"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
:label="t('wagon.create.type')"
|
||||||
|
:options="filteredWagonTypes"
|
||||||
|
:rules="[(val) => !!val || t('wagon.warnings.typeNotEmpty')]"
|
||||||
|
@filter="filterType"
|
||||||
|
>
|
||||||
|
<template v-if="data.typeFk" #append>
|
||||||
|
<QIcon
|
||||||
|
name="cancel"
|
||||||
|
@click.stop.prevent="data.typeFk = null"
|
||||||
|
class="cursor-pointer"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #no-option>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection class="text-grey">
|
||||||
|
{{ t('wagon.warnings.noData') }}
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</template>
|
||||||
|
</VnTable>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -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 () => {
|
||||||
|
const where = {
|
||||||
|
year: selectedDate.value.getFullYear(),
|
||||||
|
week: selectedWeekNumber.value,
|
||||||
|
};
|
||||||
try {
|
try {
|
||||||
const filter = {
|
const mail = (
|
||||||
where: {
|
await axiosNoError.get(`Workers/${route.params.id}/mail`, {
|
||||||
workerFk: route.params.id,
|
params: { filter: { where } },
|
||||||
year: selectedDate.value ? selectedDate.value?.getFullYear() : null,
|
})
|
||||||
week: selectedWeekNumber.value,
|
).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"
|
||||||
|
|
|
@ -194,7 +194,6 @@ async function autofillBic(worker) {
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:roles-allowed-to-create="['deliveryAssistant']"
|
||||||
v-model="data.location"
|
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
:disable="formData.isFreelance"
|
:disable="formData.isFreelance"
|
||||||
>
|
>
|
||||||
|
|
|
@ -264,7 +264,6 @@ async function autofillBic(worker) {
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:options="postcodesOptions"
|
:options="postcodesOptions"
|
||||||
v-model="data.location"
|
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
:disable="data.isFreelance"
|
:disable="data.isFreelance"
|
||||||
>
|
>
|
||||||
|
|
|
@ -175,7 +175,7 @@ export default {
|
||||||
path: 'edit',
|
path: 'edit',
|
||||||
name: 'CustomerAddressEdit',
|
name: 'CustomerAddressEdit',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'address-edit',
|
title: 'addressEdit',
|
||||||
},
|
},
|
||||||
component: () =>
|
component: () =>
|
||||||
import(
|
import(
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe('VnLocation', () => {
|
||||||
cy.get(inputLocation).click();
|
cy.get(inputLocation).click();
|
||||||
cy.get(inputLocation).clear();
|
cy.get(inputLocation).clear();
|
||||||
cy.get(inputLocation).type('al');
|
cy.get(inputLocation).type('al');
|
||||||
cy.get(locationOptions).should('have.length.at.least', 3);
|
cy.get(locationOptions).should('have.length.at.least', 4);
|
||||||
});
|
});
|
||||||
it('input filter location as "ecuador"', function () {
|
it('input filter location as "ecuador"', function () {
|
||||||
cy.get(inputLocation).click();
|
cy.get(inputLocation).click();
|
||||||
|
@ -33,11 +33,29 @@ describe('VnLocation', () => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 });
|
cy.visit('/#/supplier/567/fiscal-data', { timeout: 7000 });
|
||||||
cy.waitForElement('.q-form');
|
cy.waitForElement('.q-form');
|
||||||
cy.get(createLocationButton).click();
|
|
||||||
});
|
});
|
||||||
|
it('Fin by postalCode', () => {
|
||||||
|
const postCode = '46600';
|
||||||
|
const firstOption = '[role="listbox"] .q-item:nth-child(1)';
|
||||||
|
|
||||||
|
cy.get(inputLocation).click();
|
||||||
|
cy.get(inputLocation).clear();
|
||||||
|
cy.get(inputLocation).type(postCode);
|
||||||
|
cy.get(locationOptions).should('have.length.at.least', 2);
|
||||||
|
cy.get(firstOption).click();
|
||||||
|
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click();
|
||||||
|
cy.reload();
|
||||||
|
cy.waitForElement('.q-form');
|
||||||
|
cy.get(inputLocation).should(
|
||||||
|
'have.value',
|
||||||
|
'46600 - Valencia(Province one), España'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('Create postCode', () => {
|
it('Create postCode', () => {
|
||||||
const postCode = '1234475';
|
const postCode = '1234475';
|
||||||
const province = 'Valencia';
|
const province = 'Valencia';
|
||||||
|
cy.get(createLocationButton).click();
|
||||||
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
||||||
cy.get(dialogInputs).eq(0).clear();
|
cy.get(dialogInputs).eq(0).clear();
|
||||||
cy.get(dialogInputs).eq(0).type(postCode);
|
cy.get(dialogInputs).eq(0).type(postCode);
|
||||||
|
@ -54,6 +72,7 @@ describe('VnLocation', () => {
|
||||||
it('Create city', () => {
|
it('Create city', () => {
|
||||||
const postCode = '9011';
|
const postCode = '9011';
|
||||||
const province = 'Saskatchew';
|
const province = 'Saskatchew';
|
||||||
|
cy.get(createLocationButton).click();
|
||||||
cy.get(dialogInputs).eq(0).type(postCode);
|
cy.get(dialogInputs).eq(0).type(postCode);
|
||||||
// city create button
|
// city create button
|
||||||
cy.get(
|
cy.get(
|
||||||
|
|
Loading…
Reference in New Issue