Merge branch '7202-AddCustomAgentFkColumn' of https://gitea.verdnatura.es/verdnatura/salix-front into 7202-AddCustomAgentFkColumn
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
0c09240e48
|
@ -1,35 +1,42 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelectProvince from 'components/VnSelectProvince.vue';
|
import VnSelectProvince from 'components/VnSelectProvince.vue';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
import FormModelPopup from './FormModelPopup.vue';
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved']);
|
const emit = defineEmits(['onDataSaved']);
|
||||||
|
const $props = defineProps({
|
||||||
|
countryFk: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
provinceSelected: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
provinces: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const cityFormData = reactive({
|
const cityFormData = ref({
|
||||||
name: null,
|
name: null,
|
||||||
provinceFk: null,
|
provinceFk: null,
|
||||||
});
|
});
|
||||||
|
onMounted(() => {
|
||||||
const provincesOptions = ref([]);
|
cityFormData.value.provinceFk = $props.provinceSelected;
|
||||||
|
});
|
||||||
const onDataSaved = (...args) => {
|
const onDataSaved = (...args) => {
|
||||||
emit('onDataSaved', ...args);
|
emit('onDataSaved', ...args);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
@on-fetch="(data) => (provincesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
url="Provinces"
|
|
||||||
/>
|
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
:title="t('New city')"
|
:title="t('New city')"
|
||||||
:subtitle="t('Please, ensure you put the correct data!')"
|
:subtitle="t('Please, ensure you put the correct data!')"
|
||||||
|
@ -41,11 +48,16 @@ const onDataSaved = (...args) => {
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Name')"
|
:label="t('Names')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('city.name')"
|
:rules="validate('city.name')"
|
||||||
/>
|
/>
|
||||||
<VnSelectProvince v-model="data.provinceFk" />
|
<VnSelectProvince
|
||||||
|
:province-selected="$props.provinceSelected"
|
||||||
|
:country-fk="$props.countryFk"
|
||||||
|
v-model="data.provinceFk"
|
||||||
|
:provinces="$props.provinces"
|
||||||
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModelPopup>
|
</FormModelPopup>
|
||||||
|
|
|
@ -63,17 +63,27 @@ function setTown(newTown, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setProvince(id, data) {
|
async function setProvince(id, data) {
|
||||||
await provincesFetchDataRef.value.fetch();
|
|
||||||
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
||||||
if (!newProvince) return;
|
if (!newProvince) return;
|
||||||
|
|
||||||
data.countryFk = newProvince.countryFk;
|
data.countryFk = newProvince.countryFk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function onProvinceCreated(data) {
|
||||||
|
await provincesFetchDataRef.value.fetch({
|
||||||
|
where: { countryFk: postcodeFormData.countryFk },
|
||||||
|
});
|
||||||
|
postcodeFormData.provinceFk.value = data.id;
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [postcodeFormData.countryFk],
|
() => [postcodeFormData.countryFk],
|
||||||
async (newCountryFk) => {
|
async (newCountryFk, oldValueFk) => {
|
||||||
if (newCountryFk) {
|
if (!!oldValueFk[0] && newCountryFk[0] !== oldValueFk[0]) {
|
||||||
|
postcodeFormData.provinceFk = null;
|
||||||
|
postcodeFormData.townFk = null;
|
||||||
|
}
|
||||||
|
if ((newCountryFk, newCountryFk !== postcodeFormData.countryFk)) {
|
||||||
await provincesFetchDataRef.value.fetch({
|
await provincesFetchDataRef.value.fetch({
|
||||||
where: {
|
where: {
|
||||||
countryFk: newCountryFk[0],
|
countryFk: newCountryFk[0],
|
||||||
|
@ -93,7 +103,7 @@ watch(
|
||||||
watch(
|
watch(
|
||||||
() => postcodeFormData.provinceFk,
|
() => postcodeFormData.provinceFk,
|
||||||
async (newProvinceFk) => {
|
async (newProvinceFk) => {
|
||||||
if (newProvinceFk) {
|
if (newProvinceFk[0] && newProvinceFk[0] !== postcodeFormData.provinceFk) {
|
||||||
await townsFetchDataRef.value.fetch({
|
await townsFetchDataRef.value.fetch({
|
||||||
where: { provinceFk: newProvinceFk[0] },
|
where: { provinceFk: newProvinceFk[0] },
|
||||||
});
|
});
|
||||||
|
@ -140,10 +150,12 @@ async function handleCountries(data) {
|
||||||
:label="t('Postcode')"
|
:label="t('Postcode')"
|
||||||
v-model="data.code"
|
v-model="data.code"
|
||||||
:rules="validate('postcode.code')"
|
:rules="validate('postcode.code')"
|
||||||
|
clearable
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('City')"
|
:label="t('City')"
|
||||||
@update:model-value="(value) => setTown(value, data)"
|
@update:model-value="(value) => setTown(value, data)"
|
||||||
|
:tooltip="t('Create city')"
|
||||||
v-model="data.townFk"
|
v-model="data.townFk"
|
||||||
:options="townsOptions"
|
:options="townsOptions"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
@ -151,7 +163,7 @@ async function handleCountries(data) {
|
||||||
:rules="validate('postcode.city')"
|
:rules="validate('postcode.city')"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
clearable
|
:clearable="true"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -166,6 +178,9 @@ async function handleCountries(data) {
|
||||||
</template>
|
</template>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateNewCityForm
|
<CreateNewCityForm
|
||||||
|
:country-fk="data.countryFk"
|
||||||
|
:province-selected="data.provinceFk"
|
||||||
|
:provinces="provincesOptions"
|
||||||
@on-data-saved="
|
@on-data-saved="
|
||||||
(_, requestResponse) =>
|
(_, requestResponse) =>
|
||||||
onCityCreated(requestResponse, data)
|
onCityCreated(requestResponse, data)
|
||||||
|
@ -176,9 +191,13 @@ async function handleCountries(data) {
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelectProvince
|
<VnSelectProvince
|
||||||
:country-fk="postcodeFormData.countryFk"
|
:country-fk="data.countryFk"
|
||||||
|
:province-selected="data.provinceFk"
|
||||||
@update:model-value="(value) => setProvince(value, data)"
|
@update:model-value="(value) => setProvince(value, data)"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
|
:clearable="true"
|
||||||
|
:provinces="provincesOptions"
|
||||||
|
@on-province-created="onProvinceCreated"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Country')"
|
:label="t('Country')"
|
||||||
|
@ -197,6 +216,7 @@ async function handleCountries(data) {
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
New postcode: Nuevo código postal
|
New postcode: Nuevo código postal
|
||||||
|
Create city: Crear población
|
||||||
Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos!
|
Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos!
|
||||||
City: Población
|
City: Población
|
||||||
Province: Provincia
|
Province: Provincia
|
||||||
|
|
|
@ -16,7 +16,16 @@ const provinceFormData = reactive({
|
||||||
name: null,
|
name: null,
|
||||||
autonomyFk: null,
|
autonomyFk: null,
|
||||||
});
|
});
|
||||||
|
const $props = defineProps({
|
||||||
|
countryFk: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
provinces: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
});
|
||||||
const autonomiesOptions = ref([]);
|
const autonomiesOptions = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (dataSaved, requestResponse) => {
|
const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
|
@ -31,6 +40,11 @@ const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
<FetchData
|
<FetchData
|
||||||
@on-fetch="(data) => (autonomiesOptions = data)"
|
@on-fetch="(data) => (autonomiesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
|
:filter="{
|
||||||
|
where: {
|
||||||
|
countryFk: $props.countryFk,
|
||||||
|
},
|
||||||
|
}"
|
||||||
url="Autonomies/location"
|
url="Autonomies/location"
|
||||||
/>
|
/>
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
|
|
|
@ -8,18 +8,27 @@ import FetchData from 'components/FetchData.vue';
|
||||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onProvinceCreated']);
|
const emit = defineEmits(['onProvinceCreated']);
|
||||||
const provinceFk = defineModel({ type: Number });
|
|
||||||
watch(provinceFk, async () => await provincesFetchDataRef.value.fetch());
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
countryFk: {
|
countryFk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
provinceSelected: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
provinces: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
const provinceFk = defineModel({ type: Number, default: null });
|
||||||
|
|
||||||
const { validate } = useValidator();
|
const { validate } = useValidator();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const provincesOptions = ref();
|
const provincesOptions = ref($props.provinces);
|
||||||
|
provinceFk.value = $props.provinceSelected;
|
||||||
const provincesFetchDataRef = ref();
|
const provincesFetchDataRef = ref();
|
||||||
|
|
||||||
async function onProvinceCreated(_, data) {
|
async function onProvinceCreated(_, data) {
|
||||||
|
@ -27,16 +36,6 @@ async function onProvinceCreated(_, data) {
|
||||||
provinceFk.value = data.id;
|
provinceFk.value = data.id;
|
||||||
emit('onProvinceCreated', data);
|
emit('onProvinceCreated', data);
|
||||||
}
|
}
|
||||||
watch(
|
|
||||||
() => $props.countryFk,
|
|
||||||
async (newProvinceFk) => {
|
|
||||||
if (newProvinceFk) {
|
|
||||||
await provincesFetchDataRef.value.fetch({
|
|
||||||
where: { countryFk: newProvinceFk },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
async function handleProvinces(data) {
|
async function handleProvinces(data) {
|
||||||
provincesOptions.value = data;
|
provincesOptions.value = data;
|
||||||
}
|
}
|
||||||
|
@ -45,14 +44,19 @@ async function handleProvinces(data) {
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="provincesFetchDataRef"
|
ref="provincesFetchDataRef"
|
||||||
:filter="{ include: { relation: 'country' } }"
|
:filter="{
|
||||||
|
include: { relation: 'country' },
|
||||||
|
where: {
|
||||||
|
countryFk: $props.countryFk,
|
||||||
|
},
|
||||||
|
}"
|
||||||
@on-fetch="handleProvinces"
|
@on-fetch="handleProvinces"
|
||||||
auto-load
|
|
||||||
url="Provinces"
|
url="Provinces"
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('Province')"
|
:label="t('Province')"
|
||||||
:options="provincesOptions"
|
:options="$props.provinces"
|
||||||
|
:tooltip="t('Create province')"
|
||||||
hide-selected
|
hide-selected
|
||||||
v-model="provinceFk"
|
v-model="provinceFk"
|
||||||
:rules="validate && validate('postcode.provinceFk')"
|
:rules="validate && validate('postcode.provinceFk')"
|
||||||
|
@ -67,11 +71,15 @@ async function handleProvinces(data) {
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateNewProvinceForm @on-data-saved="onProvinceCreated" />
|
<CreateNewProvinceForm
|
||||||
|
:country-fk="$props.countryFk"
|
||||||
|
@on-data-saved="onProvinceCreated"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnSelectDialog>
|
</VnSelectDialog>
|
||||||
</template>
|
</template>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Province: Provincia
|
Province: Provincia
|
||||||
|
Create province: Crear provincia
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -317,8 +317,8 @@ defineExpose({
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleOnDataSaved(_) {
|
function handleOnDataSaved(_, res) {
|
||||||
if (_.onDataSaved) _.onDataSaved(this);
|
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
|
||||||
else $props.create.onDataSaved(_);
|
else $props.create.onDataSaved(_);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -771,6 +771,16 @@ es:
|
||||||
color: var(--vn-text-color);
|
color: var(--vn-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-table--dark .q-table__bottom,
|
||||||
|
.q-table--dark thead,
|
||||||
|
.q-table--dark tr {
|
||||||
|
border-color: var(--vn-section-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-table__container > div:first-child {
|
||||||
|
background-color: var(--vn-page-color);
|
||||||
|
}
|
||||||
|
|
||||||
.grid-three {
|
.grid-three {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(400px, max-content));
|
grid-template-columns: repeat(auto-fit, minmax(400px, max-content));
|
||||||
|
|
|
@ -140,12 +140,6 @@ const mixinRules = [
|
||||||
.q-field__control {
|
.q-field__control {
|
||||||
height: unset;
|
height: unset;
|
||||||
}
|
}
|
||||||
.q-field__control.relative-position.row.no-wrap
|
|
||||||
> .q-field__control-container
|
|
||||||
> input.q-field__native
|
|
||||||
~ div.q-field__label {
|
|
||||||
height: 41px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.q-field--labeled {
|
.q-field--labeled {
|
||||||
.q-field__native,
|
.q-field__native,
|
||||||
|
|
|
@ -12,6 +12,16 @@ const props = defineProps({
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const locationProperties = [
|
||||||
|
'postcode',
|
||||||
|
(obj) =>
|
||||||
|
obj.city
|
||||||
|
? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
|
||||||
|
: null,
|
||||||
|
(obj) => obj.country?.name,
|
||||||
|
];
|
||||||
|
|
||||||
const formatLocation = (obj, properties) => {
|
const formatLocation = (obj, properties) => {
|
||||||
const parts = properties.map((prop) => {
|
const parts = properties.map((prop) => {
|
||||||
if (typeof prop === 'string') {
|
if (typeof prop === 'string') {
|
||||||
|
@ -29,17 +39,10 @@ const formatLocation = (obj, properties) => {
|
||||||
return filteredParts.join(', ');
|
return filteredParts.join(', ');
|
||||||
};
|
};
|
||||||
|
|
||||||
const locationProperties = [
|
|
||||||
'postcode',
|
|
||||||
(obj) =>
|
|
||||||
obj.city
|
|
||||||
? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
|
|
||||||
: null,
|
|
||||||
(obj) => obj.country?.name,
|
|
||||||
];
|
|
||||||
const modelValue = ref(
|
const modelValue = ref(
|
||||||
props.location ? formatLocation(props.location, locationProperties) : null
|
props.location ? formatLocation(props.location, locationProperties) : null
|
||||||
);
|
);
|
||||||
|
|
||||||
function showLabel(data) {
|
function showLabel(data) {
|
||||||
const dataProperties = [
|
const dataProperties = [
|
||||||
'code',
|
'code',
|
||||||
|
@ -70,6 +73,7 @@ const handleModelValue = (data) => {
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
clearable
|
clearable
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
|
:tooltip="t('Create new location')"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateNewPostcode
|
<CreateNewPostcode
|
||||||
|
@ -102,7 +106,9 @@ const handleModelValue = (data) => {
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
search_by_postalcode: Search by postalcode, town, province or country
|
search_by_postalcode: Search by postalcode, town, province or country
|
||||||
|
Create new location: Create new location
|
||||||
es:
|
es:
|
||||||
Location: Ubicación
|
Location: Ubicación
|
||||||
|
Create new location: Crear nueva ubicación
|
||||||
search_by_postalcode: Buscar por código postal, ciudad o país
|
search_by_postalcode: Buscar por código postal, ciudad o país
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -406,6 +406,7 @@ watch(
|
||||||
:skeleton="false"
|
:skeleton="false"
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="setLogTree"
|
@on-fetch="setLogTree"
|
||||||
|
search-url="logs"
|
||||||
>
|
>
|
||||||
<template #body>
|
<template #body>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -18,6 +18,7 @@ const contactChannels = ref([]);
|
||||||
const title = ref();
|
const title = ref();
|
||||||
const handleSalesModelValue = (val) => ({
|
const handleSalesModelValue = (val) => ({
|
||||||
or: [
|
or: [
|
||||||
|
{ id: val },
|
||||||
{ name: val },
|
{ name: val },
|
||||||
{ nickname: { like: '%' + val + '%' } },
|
{ nickname: { like: '%' + val + '%' } },
|
||||||
{ code: { like: `${val}%` } },
|
{ code: { like: `${val}%` } },
|
||||||
|
|
|
@ -93,6 +93,7 @@ function handleLocation(data, location) {
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
|
:roles-allowed-to-create="['deliveryAssistant', 'administrative']"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:location="data"
|
:location="data"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
|
|
|
@ -13,6 +13,7 @@ import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
import VnRow from 'src/components/ui/VnRow.vue';
|
import VnRow from 'src/components/ui/VnRow.vue';
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const grafanaUrl = 'https://grafana.verdnatura.es';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -429,10 +429,9 @@ function handleLocation(data, location) {
|
||||||
:params="{
|
:params="{
|
||||||
departmentCodes: ['VT', 'shopping'],
|
departmentCodes: ['VT', 'shopping'],
|
||||||
}"
|
}"
|
||||||
option-label="nickname"
|
|
||||||
option-value="id"
|
|
||||||
:fields="['id', 'nickname']"
|
:fields="['id', 'nickname']"
|
||||||
sort-by="nickname ASC"
|
sort-by="nickname ASC"
|
||||||
|
:use-like="false"
|
||||||
emit-value
|
emit-value
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { toCurrency, toDate, dateRange } from 'filters/index';
|
import { toCurrency, toDate, dateRange } from 'filters/index';
|
||||||
import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
|
|
||||||
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
|
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
|
||||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
@ -11,7 +10,6 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
||||||
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -192,11 +190,6 @@ function exprBuilder(param, value) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RightMenu>
|
|
||||||
<template #right-panel>
|
|
||||||
<CustomerNotificationsFilter data-key="CustomerDefaulter" />
|
|
||||||
</template>
|
|
||||||
</RightMenu>
|
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
<template #st-data>
|
<template #st-data>
|
||||||
<CustomerBalanceDueTotal :amount="balanceDueTotal" />
|
<CustomerBalanceDueTotal :amount="balanceDueTotal" />
|
||||||
|
|
|
@ -84,6 +84,7 @@ function handleLocation(data, location) {
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
|
:roles-allowed-to-create="['deliveryAssistant']"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:location="
|
:location="
|
||||||
data.postalCode
|
data.postalCode
|
||||||
|
|
|
@ -52,7 +52,22 @@ function handleLocation(data, location) {
|
||||||
:url-update="`Suppliers/${route.params.id}/updateFiscalData`"
|
:url-update="`Suppliers/${route.params.id}/updateFiscalData`"
|
||||||
model="supplier"
|
model="supplier"
|
||||||
:filter="{
|
:filter="{
|
||||||
fields: ['id', 'name', 'city', 'postCode', 'countryFk', 'provinceFk'],
|
fields: [
|
||||||
|
'id',
|
||||||
|
'nif',
|
||||||
|
'city',
|
||||||
|
'name',
|
||||||
|
'account',
|
||||||
|
'postCode',
|
||||||
|
'countryFk',
|
||||||
|
'provinceFk',
|
||||||
|
'sageTaxTypeFk',
|
||||||
|
'sageWithholdingFk',
|
||||||
|
'sageTransactionTypeFk',
|
||||||
|
'supplierActivityFk',
|
||||||
|
'healthRegister',
|
||||||
|
'street',
|
||||||
|
],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'province',
|
relation: 'province',
|
||||||
|
@ -146,6 +161,7 @@ function handleLocation(data, location) {
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
|
:roles-allowed-to-create="['deliveryAssistant', 'administrative']"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:location="{
|
:location="{
|
||||||
postcode: data.postCode,
|
postcode: data.postCode,
|
||||||
|
|
|
@ -53,7 +53,7 @@ const tableRef = ref([]);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
async () => await getSales()
|
() => tableRef.value.reload()
|
||||||
);
|
);
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
@ -161,15 +161,6 @@ const onSalesFetched = (salesData) => {
|
||||||
for (let sale of salesData) sale.amount = getSaleTotal(sale);
|
for (let sale of salesData) sale.amount = getSaleTotal(sale);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSales = async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await axios.get(`Tickets/${route.params.id}/getSales`);
|
|
||||||
onSalesFetched(data);
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error fetching sales', err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSaleTotal = (sale) => {
|
const getSaleTotal = (sale) => {
|
||||||
if (sale.quantity == null || sale.price == null) return null;
|
if (sale.quantity == null || sale.price == null) return null;
|
||||||
|
|
||||||
|
@ -181,7 +172,7 @@ const getSaleTotal = (sale) => {
|
||||||
|
|
||||||
const resetChanges = async () => {
|
const resetChanges = async () => {
|
||||||
arrayData.fetch({ append: false });
|
arrayData.fetch({ append: false });
|
||||||
getSales();
|
tableRef.value.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateQuantity = async (sale) => {
|
const updateQuantity = async (sale) => {
|
||||||
|
@ -434,8 +425,6 @@ const setTransferParams = async () => {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
getConfig();
|
getConfig();
|
||||||
getSales();
|
|
||||||
getItems();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
@ -443,11 +432,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
const items = ref([]);
|
const items = ref([]);
|
||||||
const newRow = ref({});
|
const newRow = ref({});
|
||||||
|
|
||||||
async function getItems() {
|
|
||||||
const { data } = await axios.get(`Items/withName`);
|
|
||||||
items.value = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateItem = (row) => {
|
const updateItem = (row) => {
|
||||||
const selectedItem = items.value.find((item) => item.id === row.itemFk);
|
const selectedItem = items.value.find((item) => item.id === row.itemFk);
|
||||||
if (selectedItem) {
|
if (selectedItem) {
|
||||||
|
@ -623,6 +607,7 @@ watch(
|
||||||
:column-search="false"
|
:column-search="false"
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
auto-load
|
auto-load
|
||||||
|
@on-fetch="onSalesFetched"
|
||||||
:create="{
|
:create="{
|
||||||
onDataSaved: handleOnDataSave,
|
onDataSaved: handleOnDataSave,
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import RouteDescriptorProxy from 'pages/Route/Card/RouteDescriptorProxy.vue';
|
import RouteDescriptorProxy from 'pages/Route/Card/RouteDescriptorProxy.vue';
|
||||||
import { onMounted, ref, computed } from 'vue';
|
import { onMounted, ref, computed } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { dashIfEmpty, toDate, toCurrency } from 'src/filters';
|
import { dashIfEmpty, toDate, toCurrency } from 'src/filters';
|
||||||
|
@ -12,6 +12,8 @@ import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescripto
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
import { getUrl } from 'src/composables/getUrl';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
@ -19,8 +21,7 @@ import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -38,6 +39,8 @@ const ticket = computed(() => summaryRef.value?.entity);
|
||||||
const editableStates = ref([]);
|
const editableStates = ref([]);
|
||||||
const ticketUrl = ref();
|
const ticketUrl = ref();
|
||||||
const grafanaUrl = 'https://grafana.verdnatura.es';
|
const grafanaUrl = 'https://grafana.verdnatura.es';
|
||||||
|
const stateBtnDropdownRef = ref();
|
||||||
|
const descriptorData = useArrayData('ticketData');
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/';
|
ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/';
|
||||||
|
@ -64,15 +67,19 @@ function isEditable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeState(value) {
|
async function changeState(value) {
|
||||||
if (!ticket.value.id) return;
|
try {
|
||||||
|
stateBtnDropdownRef.value.hide();
|
||||||
const formData = {
|
const formData = {
|
||||||
ticketFk: ticket.value.id,
|
ticketFk: entityId.value,
|
||||||
code: value,
|
code: value,
|
||||||
};
|
};
|
||||||
|
|
||||||
await axios.post(`Tickets/state`, formData);
|
await axios.post(`Tickets/state`, formData);
|
||||||
router.go(route.fullPath);
|
notify('globals.dataSaved', 'positive');
|
||||||
|
summaryRef.value?.fetch();
|
||||||
|
descriptorData.fetch({});
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error changing ticket state', err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNoteValue(description) {
|
function getNoteValue(description) {
|
||||||
|
@ -125,6 +132,7 @@ function toTicketUrl(section) {
|
||||||
</template>
|
</template>
|
||||||
<template #header-right>
|
<template #header-right>
|
||||||
<QBtnDropdown
|
<QBtnDropdown
|
||||||
|
ref="stateBtnDropdownRef"
|
||||||
color="black"
|
color="black"
|
||||||
text-color="white"
|
text-color="white"
|
||||||
:label="t('ticket.summary.changeState')"
|
:label="t('ticket.summary.changeState')"
|
||||||
|
@ -137,7 +145,7 @@ function toTicketUrl(section) {
|
||||||
option-value="code"
|
option-value="code"
|
||||||
hide-dropdown-icon
|
hide-dropdown-icon
|
||||||
focus-on-mount
|
focus-on-mount
|
||||||
@update:model-value="changeState(item.code)"
|
@update:model-value="changeState"
|
||||||
/>
|
/>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -214,6 +214,7 @@ async function autofillBic(worker) {
|
||||||
<VnInput v-model="data.name" :label="t('worker.create.webUser')" />
|
<VnInput v-model="data.name" :label="t('worker.create.webUser')" />
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.email"
|
v-model="data.email"
|
||||||
|
type="email"
|
||||||
:label="t('worker.create.personalEmail')"
|
:label="t('worker.create.personalEmail')"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
@ -262,6 +263,7 @@ async function autofillBic(worker) {
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnLocation
|
<VnLocation
|
||||||
|
:roles-allowed-to-create="['deliveryAssistant']"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:options="postcodesOptions"
|
:options="postcodesOptions"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
|
|
|
@ -44,23 +44,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
|
||||||
<Teleport to="#actions-append">
|
|
||||||
<div class="row q-gutter-x-sm">
|
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
@click="stateStore.toggleRightDrawer()"
|
|
||||||
round
|
|
||||||
dense
|
|
||||||
icon="dock_to_left"
|
|
||||||
>
|
|
||||||
<QTooltip bottom anchor="bottom right">
|
|
||||||
{{ t('globals.collapseMenu') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
</div>
|
|
||||||
</Teleport>
|
|
||||||
</template>
|
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea class="fit text-grey-8">
|
<QScrollArea class="fit text-grey-8">
|
||||||
<ZoneEventsPanel
|
<ZoneEventsPanel
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, computed, watch, onUnmounted } from 'vue';
|
import { onMounted, ref, computed, watch, onUnmounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
@ -144,7 +144,8 @@ watch(storeData, async (val) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const reFetch = async () => {
|
const reFetch = async () => {
|
||||||
await arrayData.fetch({ append: false });
|
const { data } = await arrayData.fetch({ append: false });
|
||||||
|
nodes.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
@ -182,6 +183,16 @@ onUnmounted(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<VnInput
|
||||||
|
v-if="showSearchBar"
|
||||||
|
v-model="store.userParams.search"
|
||||||
|
:placeholder="$t('globals.search')"
|
||||||
|
@update:model-value="reFetch()"
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
<QTree
|
<QTree
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
:nodes="nodes"
|
:nodes="nodes"
|
||||||
|
|
|
@ -59,7 +59,7 @@ export default {
|
||||||
component: () => import('src/pages/Entry/EntryLatestBuys.vue'),
|
component: () => import('src/pages/Entry/EntryLatestBuys.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'stock-bought',
|
path: 'stock-Bought',
|
||||||
name: 'EntryStockBought',
|
name: 'EntryStockBought',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'reserves',
|
title: 'reserves',
|
||||||
|
|
|
@ -48,6 +48,25 @@ describe('VnLocation', () => {
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
|
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
|
||||||
).should('have.length', 1);
|
).should('have.length', 1);
|
||||||
});
|
});
|
||||||
|
it('should pass selected country', () => {
|
||||||
|
// Select a country
|
||||||
|
const country = 'Ecuador';
|
||||||
|
const province = 'Province five';
|
||||||
|
cy.selectOption(
|
||||||
|
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
|
||||||
|
country
|
||||||
|
);
|
||||||
|
cy.selectOption(
|
||||||
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
||||||
|
province
|
||||||
|
);
|
||||||
|
cy.get(
|
||||||
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) > .q-icon`
|
||||||
|
).click();
|
||||||
|
cy.get(
|
||||||
|
`#q-portal--dialog--4 > .q-dialog > ${createForm.prefix} > .vn-row > .q-select > ${createForm.sufix} > :nth-child(1) input`
|
||||||
|
).should('have.value', province);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('Worker Create', () => {
|
describe('Worker Create', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
Loading…
Reference in New Issue