0
0
Fork 0

Merge branch 'dev' into bugfix/travel-cards

This commit is contained in:
Kevin Martinez 2024-01-16 11:53:33 +00:00
commit 3e272537aa
133 changed files with 5370 additions and 1754 deletions

View File

@ -5,15 +5,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2352.01] - 2023-12-28 ## [2400.01] - 2024-01-04
### Added ### Added
- (carros) => Se añade contador de carros. #6545
- (Reclamaciones) => Se añade la sección para hacer acciones sobre una reclamación. #5654
### Changed
### Fixed
- (Reclamaciones) => Se corrige el color de la barra según el tema y el evento de actualziar cantidades #6334
### Changed
### Fixed
## [2350.01] - 2023-12-14
### Added
- (Carros) => Se añade contador de carros. #6545
- (Reclamaciones) => Se añade la sección para hacer acciones sobre una reclamación. #5654
### Changed
### Fixed
- (Reclamaciones) => Se corrige el color de la barra según el tema y el evento de actualziar cantidades #6334
## [2253.01] - 2023-01-05 ## [2253.01] - 2023-01-05

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "23.52.01", "version": "24.02.01",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "salix-front", "name": "salix-front",
"version": "23.52.01", "version": "24.02.01",
"dependencies": { "dependencies": {
"@quasar/cli": "^2.3.0", "@quasar/cli": "^2.3.0",
"@quasar/extras": "^1.16.4", "@quasar/extras": "^1.16.4",

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-front", "name": "salix-front",
"version": "23.52.01", "version": "24.02.01",
"description": "Salix frontend", "description": "Salix frontend",
"productName": "Salix", "productName": "Salix",
"author": "Verdnatura", "author": "Verdnatura",

View File

@ -1,10 +1,11 @@
<script setup> <script setup>
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import { useQuasar } from 'quasar'; import { useQuasar, Dark } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
const quasar = useQuasar(); const quasar = useQuasar();
const { availableLocales, locale, fallbackLocale } = useI18n(); const { availableLocales, locale, fallbackLocale } = useI18n();
Dark.set(true);
onMounted(() => { onMounted(() => {
let userLang = window.navigator.language; let userLang = window.navigator.language;

View File

@ -4,8 +4,15 @@ import { useI18n } from 'vue-i18n';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FormModelPopup from './FormModelPopup.vue';
const props = defineProps({
showEntityField: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(['onDataSaved']); const emit = defineEmits(['onDataSaved']);
@ -22,41 +29,29 @@ const countriesFilter = {
fields: ['id', 'country', 'code'], fields: ['id', 'country', 'code'],
}; };
const closeButton = ref(null);
const countriesOptions = ref([]); const countriesOptions = ref([]);
const loading = ref(false);
const onDataSaved = (data) => { const onDataSaved = (data) => {
emit('onDataSaved', data); emit('onDataSaved', data);
closeForm();
};
const closeForm = () => {
if (closeButton.value) closeButton.value.click();
}; };
</script> </script>
<template> <template>
<FetchData <FetchData
url="Countries" url="Countries"
@on-fetch="(data) => (countriesOptions = data)"
:filter="countriesFilter" :filter="countriesFilter"
auto-load auto-load
@on-fetch="(data) => (countriesOptions = data)"
/> />
<FormModel <FormModelPopup
:form-initial-data="bankEntityFormData"
:observe-form-changes="false"
:default-actions="false"
url-create="bankEntities" url-create="bankEntities"
model="bankEntity" model="bankEntity"
:title="t('title')"
:subtitle="t('subtitle')"
:form-initial-data="bankEntityFormData"
@on-data-saved="onDataSaved($event)" @on-data-saved="onDataSaved($event)"
> >
<template #form="{ data, validate }"> <template #form-inputs="{ data, validate }">
<span ref="closeButton" class="close-icon" v-close-popup>
<QIcon name="close" size="sm" />
</span>
<h1 class="title">{{ t('title') }}</h1>
<p class="q-mb-md">{{ t('subtitle') }}</p>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<QInput <QInput
@ -85,47 +80,14 @@ const closeForm = () => {
:rules="validate('bankEntity.countryFk')" :rules="validate('bankEntity.countryFk')"
/> />
</div> </div>
<div class="col"> <div v-if="showEntityField" class="col">
<QInput :label="t('id')" v-model="data.id" /> <QInput :label="t('id')" v-model="data.id" />
</div> </div>
</VnRow> </VnRow>
<div class="q-mt-lg row justify-end">
<QBtn
:label="t('globals.save')"
type="submit"
color="primary"
:disabled="loading"
:loading="loading"
/>
<QBtn
:label="t('globals.cancel')"
type="reset"
color="primary"
flat
class="q-ml-sm"
:disabled="loading"
:loading="loading"
v-close-popup
/>
</div>
</template> </template>
</FormModel> </FormModelPopup>
</template> </template>
<style lang="scss" scoped>
.close-icon {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
.title {
font-size: 17px;
font-weight: bold;
line-height: 20px;
}
</style>
<i18n> <i18n>
en: en:
title: New bank entity title: New bank entity

View File

@ -6,7 +6,7 @@ import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import FormModel from 'components/FormModel.vue'; import FormModelPopup from './FormModelPopup.vue';
const emit = defineEmits(['onDataSaved']); const emit = defineEmits(['onDataSaved']);
@ -17,17 +17,10 @@ const cityFormData = reactive({
provinceFk: null, provinceFk: null,
}); });
const closeButton = ref(null);
const isLoading = ref(false);
const provincesOptions = ref([]); const provincesOptions = ref([]);
const onDataSaved = () => { const onDataSaved = (dataSaved) => {
emit('onDataSaved'); emit('onDataSaved', dataSaved);
closeForm();
};
const closeForm = () => {
if (closeButton.value) closeButton.value.click();
}; };
</script> </script>
@ -37,20 +30,15 @@ const closeForm = () => {
auto-load auto-load
url="Provinces" url="Provinces"
/> />
<FormModel <FormModelPopup
:title="t('New city')"
:subtitle="t('Please, ensure you put the correct data!')"
:form-initial-data="cityFormData" :form-initial-data="cityFormData"
:observe-form-changes="false"
:default-actions="false"
url-create="towns" url-create="towns"
model="city" model="city"
@on-data-saved="onDataSaved()" @on-data-saved="onDataSaved($event)"
> >
<template #form="{ data, validate }"> <template #form-inputs="{ data, validate }">
<span ref="closeButton" class="close-icon" v-close-popup>
<QIcon name="close" size="sm" />
</span>
<h1 class="title">{{ t('New city') }}</h1>
<p>{{ t('Please, ensure you put the correct data!') }}</p>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnInput <VnInput
@ -71,43 +59,10 @@ const closeForm = () => {
/> />
</div> </div>
</VnRow> </VnRow>
<div class="q-mt-lg row justify-end">
<QBtn
:label="t('globals.save')"
type="submit"
color="primary"
:disabled="isLoading"
:loading="isLoading"
/>
<QBtn
:label="t('globals.cancel')"
type="reset"
color="primary"
flat
class="q-ml-sm"
:disabled="isLoading"
:loading="isLoading"
v-close-popup
/>
</div>
</template> </template>
</FormModel> </FormModelPopup>
</template> </template>
<style lang="scss" scoped>
.close-icon {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
.title {
font-size: 17px;
font-weight: bold;
line-height: 20px;
}
</style>
<i18n> <i18n>
es: es:
New city: Nueva ciudad New city: Nueva ciudad

View File

@ -6,10 +6,10 @@ import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import FormModel from 'components/FormModel.vue';
import CreateNewCityForm from './CreateNewCityForm.vue'; import CreateNewCityForm from './CreateNewCityForm.vue';
import CreateNewProvinceForm from './CreateNewProvinceForm.vue'; import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
import VnSelectCreate from 'components/common/VnSelectCreate.vue'; import VnSelectCreate from 'components/common/VnSelectCreate.vue';
import FormModelPopup from './FormModelPopup.vue';
const emit = defineEmits(['onDataSaved']); const emit = defineEmits(['onDataSaved']);
@ -24,27 +24,28 @@ const postcodeFormData = reactive({
const townsFetchDataRef = ref(null); const townsFetchDataRef = ref(null);
const provincesFetchDataRef = ref(null); const provincesFetchDataRef = ref(null);
const closeButton = ref(null);
const countriesOptions = ref([]); const countriesOptions = ref([]);
const isLoading = ref(false);
const provincesOptions = ref([]); const provincesOptions = ref([]);
const townsLocationOptions = ref([]); const townsLocationOptions = ref([]);
const onDataSaved = () => { const onDataSaved = (dataSaved) => {
emit('onDataSaved'); emit('onDataSaved', dataSaved);
closeForm();
}; };
const onCityCreated = async () => { const onCityCreated = async ({ name, provinceFk }, formData) => {
await townsFetchDataRef.value.fetch(); await townsFetchDataRef.value.fetch();
formData.townFk = townsLocationOptions.value.find((town) => town.name === name).id;
formData.provinceFk = provinceFk;
formData.countryFk = provincesOptions.value.find(
(province) => province.id === provinceFk
).countryFk;
}; };
const onProvinceCreated = async () => { const onProvinceCreated = async ({ name }, formData) => {
await provincesFetchDataRef.value.fetch(); await provincesFetchDataRef.value.fetch();
}; formData.provinceFk = provincesOptions.value.find(
(province) => province.name === name
const closeForm = () => { ).id;
if (closeButton.value) closeButton.value.click();
}; };
</script> </script>
@ -66,20 +67,15 @@ const closeForm = () => {
auto-load auto-load
url="Countries" url="Countries"
/> />
<FormModel <FormModelPopup
:form-initial-data="postcodeFormData"
:observe-form-changes="false"
:default-actions="false"
url-create="postcodes" url-create="postcodes"
model="postcode" model="postcode"
@on-data-saved="onDataSaved()" :title="t('New postcode')"
:subtitle="t('Please, ensure you put the correct data!')"
:form-initial-data="postcodeFormData"
@on-data-saved="onDataSaved($event)"
> >
<template #form="{ data, validate }"> <template #form-inputs="{ data, validate }">
<span ref="closeButton" class="close-icon" v-close-popup>
<QIcon name="close" size="sm" />
</span>
<h1 class="title">{{ t('New postcode') }}</h1>
<p>{{ t('Please, ensure you put the correct data!') }}</p>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnInput <VnInput
@ -100,7 +96,9 @@ const closeForm = () => {
:roles-allowed-to-create="['deliveryAssistant']" :roles-allowed-to-create="['deliveryAssistant']"
> >
<template #form> <template #form>
<CreateNewCityForm @on-data-saved="onCityCreated($event)" /> <CreateNewCityForm
@on-data-saved="onCityCreated($event, data)"
/>
</template> </template>
</VnSelectCreate> </VnSelectCreate>
</div> </div>
@ -119,7 +117,7 @@ const closeForm = () => {
> >
<template #form> <template #form>
<CreateNewProvinceForm <CreateNewProvinceForm
@on-data-saved="onProvinceCreated($event)" @on-data-saved="onProvinceCreated($event, data)"
/> />
</template> </template>
</VnSelectCreate> </VnSelectCreate>
@ -134,50 +132,16 @@ const closeForm = () => {
v-model="data.countryFk" v-model="data.countryFk"
:rules="validate('postcode.countryFk')" :rules="validate('postcode.countryFk')"
/> />
</div> </div> </VnRow
</VnRow> ></template>
<div class="q-mt-lg row justify-end"> </FormModelPopup>
<QBtn
:label="t('globals.save')"
type="submit"
color="primary"
:disabled="isLoading"
:loading="isLoading"
/>
<QBtn
:label="t('globals.cancel')"
type="reset"
color="primary"
flat
class="q-ml-sm"
:disabled="isLoading"
:loading="isLoading"
v-close-popup
/>
</div>
</template>
</FormModel>
</template> </template>
<style lang="scss" scoped>
.close-icon {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
.title {
font-size: 17px;
font-weight: bold;
line-height: 20px;
}
</style>
<i18n> <i18n>
es: es:
New postcode: Nuevo código postal New postcode: Nuevo código postal
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: Ciudad City: Población
Province: Provincia Province: Provincia
Country: País Country: País
Postcode: Código postal Postcode: Código postal

View File

@ -6,7 +6,7 @@ import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import FormModel from 'components/FormModel.vue'; import FormModelPopup from './FormModelPopup.vue';
const emit = defineEmits(['onDataSaved']); const emit = defineEmits(['onDataSaved']);
@ -17,17 +17,10 @@ const provinceFormData = reactive({
autonomyFk: null, autonomyFk: null,
}); });
const closeButton = ref(null);
const isLoading = ref(false);
const autonomiesOptions = ref([]); const autonomiesOptions = ref([]);
const onDataSaved = () => { const onDataSaved = (dataSaved) => {
emit('onDataSaved'); emit('onDataSaved', dataSaved);
closeForm();
};
const closeForm = () => {
if (closeButton.value) closeButton.value.click();
}; };
</script> </script>
@ -37,20 +30,15 @@ const closeForm = () => {
auto-load auto-load
url="Autonomies" url="Autonomies"
/> />
<FormModel <FormModelPopup
:form-initial-data="provinceFormData" :title="t('New province')"
:observe-form-changes="false" :subtitle="t('Please, ensure you put the correct data!')"
:default-actions="false"
url-create="provinces" url-create="provinces"
model="province" model="province"
@on-data-saved="onDataSaved()" :form-initial-data="provinceFormData"
@on-data-saved="onDataSaved($event)"
> >
<template #form="{ data, validate }"> <template #form-inputs="{ data, validate }">
<span ref="closeButton" class="close-icon" v-close-popup>
<QIcon name="close" size="sm" />
</span>
<h1 class="title">{{ t('New province') }}</h1>
<p>{{ t('Please, ensure you put the correct data!') }}</p>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnInput <VnInput
@ -71,47 +59,13 @@ const closeForm = () => {
/> />
</div> </div>
</VnRow> </VnRow>
<div class="q-mt-lg row justify-end">
<QBtn
:label="t('globals.save')"
type="submit"
color="primary"
:disabled="isLoading"
:loading="isLoading"
/>
<QBtn
:label="t('globals.cancel')"
type="reset"
color="primary"
flat
class="q-ml-sm"
:disabled="isLoading"
:loading="isLoading"
v-close-popup
/>
</div>
</template> </template>
</FormModel> </FormModelPopup>
</template> </template>
<style lang="scss" scoped>
.close-icon {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
.title {
font-size: 17px;
font-weight: bold;
line-height: 20px;
}
</style>
<i18n> <i18n>
es: es:
New postcode: Nuevo código postal New province: Nueva provincia
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!
Name: Nombre Name: Nombre
Autonomy: Autonomía Autonomy: Autonomía

View File

@ -225,15 +225,19 @@ function getDifferences(obj1, obj2) {
delete obj2.$index; delete obj2.$index;
for (let key in obj1) { for (let key in obj1) {
if (obj2[key] && obj1[key] !== obj2[key]) { if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
diff[key] = obj2[key]; diff[key] = obj2[key];
} }
} }
for (let key in obj2) { for (let key in obj2) {
if (obj1[key] === undefined || obj1[key] !== obj2[key]) { if (
obj1[key] === undefined ||
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])
) {
diff[key] = obj2[key]; diff[key] = obj2[key];
} }
} }
return diff; return diff;
} }

View File

@ -30,7 +30,7 @@ const $props = defineProps({
params: { params: {
type: Object, type: Object,
default: null, default: null,
} },
}); });
const emit = defineEmits(['onFetch']); const emit = defineEmits(['onFetch']);
@ -42,9 +42,9 @@ onMounted(async () => {
} }
}); });
async function fetch() { async function fetch(fetchFilter = {}) {
try { try {
const filter = Object.assign({}, $props.filter); // eslint-disable-line vue/no-dupe-keys const filter = Object.assign(fetchFilter, $props.filter); // eslint-disable-line vue/no-dupe-keys
if ($props.where) filter.where = $props.where; if ($props.where) filter.where = $props.where;
if ($props.sortBy) filter.order = $props.sortBy; if ($props.sortBy) filter.order = $props.sortBy;
if ($props.limit) filter.limit = $props.limit; if ($props.limit) filter.limit = $props.limit;

View File

@ -97,9 +97,7 @@ const startFormWatcher = () => {
watch( watch(
() => formData.value, () => formData.value,
(val) => { (val) => {
if (!isResetting.value && val) { hasChanges.value = !isResetting.value && val;
hasChanges.value = true;
}
isResetting.value = false; isResetting.value = false;
}, },
{ deep: true } { deep: true }
@ -137,12 +135,11 @@ async function save() {
await axios.patch($props.urlUpdate || $props.url, body); await axios.patch($props.urlUpdate || $props.url, body);
} }
emit('onDataSaved', formData.value); emit('onDataSaved', formData.value);
originalData.value = JSON.parse(JSON.stringify(formData.value));
hasChanges.value = false;
} catch (err) { } catch (err) {
notify('errors.create', 'negative'); notify('errors.create', 'negative');
} }
originalData.value = JSON.parse(JSON.stringify(formData.value));
hasChanges.value = false;
isLoading.value = false; isLoading.value = false;
} }

View File

@ -0,0 +1,107 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FormModel from 'components/FormModel.vue';
const emit = defineEmits(['onDataSaved']);
const $props = defineProps({
title: {
type: String,
default: '',
},
subtitle: {
type: String,
default: '',
},
url: {
type: String,
default: '',
},
model: {
type: String,
default: '',
},
filter: {
type: Object,
default: null,
},
urlCreate: {
type: String,
default: null,
},
formInitialData: {
type: Object,
default: () => {},
},
});
const { t } = useI18n();
const closeButton = ref(null);
const isLoading = ref(false);
const onDataSaved = (dataSaved) => {
emit('onDataSaved', dataSaved);
closeForm();
};
const closeForm = () => {
if (closeButton.value) closeButton.value.click();
};
</script>
<template>
<FormModel
:form-initial-data="formInitialData"
:observe-form-changes="false"
:default-actions="false"
:url-create="urlCreate"
:model="model"
@on-data-saved="onDataSaved($event)"
>
<template #form="{ data, validate }">
<span ref="closeButton" class="close-icon" v-close-popup>
<QIcon name="close" size="sm" />
</span>
<h1 class="title">{{ title }}</h1>
<p>{{ subtitle }}</p>
<slot name="form-inputs" :data="data" :validate="validate" />
<div class="q-mt-lg row justify-end">
<QBtn
:label="t('globals.save')"
type="submit"
color="primary"
:disabled="isLoading"
:loading="isLoading"
/>
<QBtn
:label="t('globals.cancel')"
type="reset"
color="primary"
flat
class="q-ml-sm"
:disabled="isLoading"
:loading="isLoading"
v-close-popup
/>
</div>
</template>
</FormModel>
</template>
<style lang="scss" scoped>
.title {
font-size: 17px;
font-weight: bold;
line-height: 20px;
}
.close-icon {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
</style>

View File

@ -24,11 +24,8 @@ const pinnedModulesRef = ref();
</script> </script>
<template> <template>
<QHeader class="bg-dark" color="white" elevated> <QHeader color="white" elevated>
<QToolbar <QToolbar class="q-py-sm q-px-md">
class="q-py-sm q-px-md"
:class="{ 'q-gutter-x-sm': !quasar.platform.is.mobile }"
>
<QBtn @click="stateStore.toggleLeftDrawer()" icon="menu" round dense flat> <QBtn @click="stateStore.toggleLeftDrawer()" icon="menu" round dense flat>
<QTooltip bottom anchor="bottom right"> <QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }} {{ t('globals.collapseMenu') }}
@ -108,6 +105,9 @@ const pinnedModulesRef = ref();
.searchbar { .searchbar {
width: max-content; width: max-content;
} }
.q-header {
background-color: var(--vn-dark);
}
</style> </style>
<i18n> <i18n>
en: en:

View File

@ -1,17 +1,18 @@
<script setup> <script setup>
import { onMounted, computed } from 'vue'; import { onMounted, computed } from 'vue';
import { Dark, Quasar } from 'quasar'; import { Dark, Quasar, useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { localeEquivalence } from "src/i18n/index";
const state = useState(); const state = useState();
const session = useSession(); const session = useSession();
const router = useRouter(); const router = useRouter();
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const quasar = useQuasar();
const userLocale = computed({ const userLocale = computed({
get() { get() {
@ -20,13 +21,11 @@ const userLocale = computed({
set(value) { set(value) {
locale.value = value; locale.value = value;
if (value === 'en') value = 'en-GB'; value = localeEquivalence[value] ?? value
// FIXME: Dynamic imports from absolute paths are not compatible with vite:
// https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations
try { try {
const langList = import.meta.glob('../../node_modules/quasar/lang/*.mjs'); /* @vite-ignore */
langList[`../../node_modules/quasar/lang/${value}.mjs`]().then((lang) => { import(`../../node_modules/quasar/lang/${value}.mjs`).then((lang) => {
Quasar.lang.set(lang.default); Quasar.lang.set(lang.default);
}); });
} catch (error) { } catch (error) {
@ -81,6 +80,14 @@ function logout() {
session.destroy(); session.destroy();
router.push('/login'); router.push('/login');
} }
function copyUserToken(){
navigator.clipboard.writeText(session.getToken());
quasar.notify({
type: 'positive',
message: t('components.userPanel.copyToken'),
});
}
</script> </script>
<template> <template>
@ -122,7 +129,8 @@ function logout() {
<div class="text-subtitle1 q-mt-md"> <div class="text-subtitle1 q-mt-md">
<strong>{{ user.nickname }}</strong> <strong>{{ user.nickname }}</strong>
</div> </div>
<div class="text-subtitle3 text-grey-7 q-mb-xs">@{{ user.name }}</div> <div class="text-subtitle3 text-grey-7 q-mb-xs copyUserToken" @click="copyUserToken()" >@{{ user.name }}
</div>
<QBtn <QBtn
id="logout" id="logout"
@ -143,4 +151,10 @@ function logout() {
.panel { .panel {
width: 150px; width: 150px;
} }
.copyUserToken {
&:hover{
cursor: alias;
}
}
</style> </style>

View File

@ -4,6 +4,7 @@ import { ref, computed, onMounted } from 'vue';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import axios from 'axios'; import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
const $props = defineProps({ const $props = defineProps({
allColumns: { allColumns: {
@ -22,6 +23,7 @@ const $props = defineProps({
const emit = defineEmits(['onConfigSaved']); const emit = defineEmits(['onConfigSaved']);
const { notify } = useNotify();
const state = useState(); const state = useState();
const { t } = useI18n(); const { t } = useI18n();
const popupProxyRef = ref(null); const popupProxyRef = ref(null);
@ -36,14 +38,11 @@ const areAllChecksMarked = computed(() => {
const setUserConfigViewData = (data) => { const setUserConfigViewData = (data) => {
if (!data) return; if (!data) return;
formattedCols.value = $props.allColumns.map((col) => {
// Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config // Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config
const obj = { formattedCols.value = $props.allColumns.map((col) => ({
name: col, name: col,
active: data[col], active: data[col],
}; }));
return obj;
});
emitSavedConfig(); emitSavedConfig();
}; };
@ -51,41 +50,35 @@ const toggleMarkAll = (val) => {
formattedCols.value.forEach((col) => (col.active = val)); formattedCols.value.forEach((col) => (col.active = val));
}; };
const getConfig = async (url, filter) => {
const response = await axios.get(url, {
params: { filter: filter },
});
return response.data && response.data.length > 0 ? response.data[0] : null;
};
const fetchViewConfigData = async () => { const fetchViewConfigData = async () => {
try { try {
const userConfigFilter = { const userConfigFilter = {
where: { where: { tableCode: $props.tableCode, userFk: user.id },
tableCode: $props.tableCode,
userFk: user.id,
},
}; };
const userConfig = await getConfig('UserConfigViews', userConfigFilter);
const userViewConfigResponse = await axios.get('UserConfigViews', { if (userConfig) {
params: { filter: userConfigFilter }, initialUserConfigViewData.value = userConfig;
}); setUserConfigViewData(userConfig.configuration);
if (userViewConfigResponse.data && userViewConfigResponse.data.length > 0) {
initialUserConfigViewData.value = userViewConfigResponse.data[0];
setUserConfigViewData(userViewConfigResponse.data[0].configuration);
return; return;
} }
const defaultConfigFilter = { const defaultConfigFilter = { where: { tableCode: $props.tableCode } };
where: { const defaultConfig = await getConfig('DefaultViewConfigs', defaultConfigFilter);
tableCode: $props.tableCode,
},
};
const defaultViewConfigResponse = await axios.get('DefaultViewConfigs', { if (defaultConfig) {
params: { filter: defaultConfigFilter }, setUserConfigViewData(defaultConfig.columns);
});
if (defaultViewConfigResponse.data && defaultViewConfigResponse.data.length > 0) {
setUserConfigViewData(defaultViewConfigResponse.data[0].columns);
return; return;
} }
} catch (err) { } catch (err) {
console.err('Error fetching config view data'); console.err('Error fetching config view data', err);
} }
}; };
@ -95,7 +88,8 @@ const saveConfig = async () => {
const configuration = {}; const configuration = {};
formattedCols.value.forEach((col) => { formattedCols.value.forEach((col) => {
configuration[col.name] = col.active; const { name, active } = col;
configuration[name] = active;
}); });
// Si existe una view config del usuario hacemos un update si no la creamos // Si existe una view config del usuario hacemos un update si no la creamos
@ -126,16 +120,18 @@ const saveConfig = async () => {
initialUserConfigViewData.value = response.data[0]; initialUserConfigViewData.value = response.data[0];
} }
emitSavedConfig(); emitSavedConfig();
notify('globals.dataSaved', 'positive');
popupProxyRef.value.hide(); popupProxyRef.value.hide();
} catch (err) { } catch (err) {
console.error('Error saving user view config'); console.error('Error saving user view config', err);
} }
}; };
const emitSavedConfig = () => { const emitSavedConfig = () => {
const filteredCols = formattedCols.value.filter((col) => col.active); const activeColumns = formattedCols.value
const mappedCols = filteredCols.map((col) => col.name); .filter((col) => col.active)
emit('onConfigSaved', mappedCols); .map((col) => col.name);
emit('onConfigSaved', activeColumns);
}; };
onMounted(async () => { onMounted(async () => {
@ -157,7 +153,7 @@ onMounted(async () => {
class="q-mb-sm" class="q-mb-sm"
/> />
<div <div
v-if="allColumns.length !== 0 && formattedCols.length !== 0" v-if="allColumns.length > 0 && formattedCols.length > 0"
class="checks-layout" class="checks-layout"
> >
<QCheckbox <QCheckbox
@ -172,6 +168,7 @@ onMounted(async () => {
}}</QBtn> }}</QBtn>
</QCard> </QCard>
</QPopupProxy> </QPopupProxy>
<QTooltip>{{ t('Visible columns') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
@ -187,3 +184,9 @@ onMounted(async () => {
grid-template-columns: repeat(3, 200px); grid-template-columns: repeat(3, 200px);
} }
</style> </style>
<i18n>
es:
Check the columns you want to see: Marca las columnas que quieres ver
Visible columns: Columnas visibles
</i18n>

View File

@ -69,6 +69,10 @@ function getBreadcrumb(param) {
> div { > div {
flex-wrap: nowrap; flex-wrap: nowrap;
} }
&--last,
&__separator {
color: var(--vn-label);
}
} }
@media (max-width: $breakpoint-md) { @media (max-width: $breakpoint-md) {
.q-breadcrumbs { .q-breadcrumbs {

View File

@ -40,6 +40,7 @@ const styleAttrs = computed(() => {
v-model="value" v-model="value"
v-bind="{ ...$attrs, ...styleAttrs }" v-bind="{ ...$attrs, ...styleAttrs }"
type="text" type="text"
:class="{ required: $attrs.required }"
> >
<template v-if="$slots.prepend" #prepend> <template v-if="$slots.prepend" #prepend>
<slot name="prepend" /> <slot name="prepend" />

View File

@ -12,8 +12,8 @@ import { useValidator } from 'src/composables/useValidator';
import VnAvatar from '../ui/VnAvatar.vue'; import VnAvatar from '../ui/VnAvatar.vue';
import VnJsonValue from '../common/VnJsonValue.vue'; import VnJsonValue from '../common/VnJsonValue.vue';
import FetchData from '../FetchData.vue'; import FetchData from '../FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnSelectFilter from './VnSelectFilter.vue'; import VnSelectFilter from './VnSelectFilter.vue';
import VnUserLink from '../ui/VnUserLink.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const validationsStore = useValidator(); const validationsStore = useValidator();
@ -421,15 +421,15 @@ setLogTree();
> >
<div class="timeline"> <div class="timeline">
<div class="user-avatar"> <div class="user-avatar">
<VnUserLink v-if="userLog.user.image" :worker-id="userLog.user.id">
<template #link>
<VnAvatar <VnAvatar
class="cursor-pointer" :class="{ 'cursor-pointer': userLog.user.id }"
:worker="userLog.user.id" :worker-id="userLog.user.id"
:title="userLog.user.nickname" :title="userLog.user.nickname"
/> />
<WorkerDescriptorProxy </template>
v-if="userLog.user.image" </VnUserLink>
:id="userLog.user.id"
/>
</div> </div>
<div class="arrow bg-panel" v-if="byRecord"></div> <div class="arrow bg-panel" v-if="byRecord"></div>
<div class="line"></div> <div class="line"></div>
@ -704,7 +704,7 @@ setLogTree();
class="q-pa-xs row items-center" class="q-pa-xs row items-center"
> >
<QItemSection class="col-3 items-center"> <QItemSection class="col-3 items-center">
<VnAvatar :worker="opt.id" /> <VnAvatar :worker-id="opt.id" />
</QItemSection> </QItemSection>
<QItemSection class="col-9 justify-center"> <QItemSection class="col-9 justify-center">
<span>{{ opt.name }}</span> <span>{{ opt.name }}</span>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref, toRefs, computed } from 'vue'; import { ref, toRefs, computed, watch } from 'vue';
const emit = defineEmits(['update:modelValue', 'update:options']); const emit = defineEmits(['update:modelValue', 'update:options']);
const $props = defineProps({ const $props = defineProps({
@ -23,13 +23,31 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
defaultFilter: {
type: Boolean,
default: true,
},
}); });
const { optionLabel } = toRefs($props); const { optionLabel, options } = toRefs($props);
const myOptions = ref([]); const myOptions = ref([]);
const myOptionsOriginal = computed(() => $props.options); const myOptionsOriginal = ref([]);
const vnSelectRef = ref(null); const vnSelectRef = ref();
const value = computed({
get() {
return $props.modelValue;
},
set(value) {
emit('update:modelValue', value);
},
});
function setOptions(data) {
myOptions.value = JSON.parse(JSON.stringify(data));
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
}
setOptions(options.value);
const filter = (val, options) => { const filter = (val, options) => {
const search = val.toString().toLowerCase(); const search = val.toString().toLowerCase();
@ -53,6 +71,7 @@ const filter = (val, options) => {
const filterHandler = (val, update) => { const filterHandler = (val, update) => {
update( update(
() => { () => {
if ($props.defaultFilter)
myOptions.value = filter(val, myOptionsOriginal.value); myOptions.value = filter(val, myOptionsOriginal.value);
}, },
(ref) => { (ref) => {
@ -64,13 +83,8 @@ const filterHandler = (val, update) => {
); );
}; };
const value = computed({ watch(options, (newValue) => {
get() { setOptions(newValue);
return $props.modelValue;
},
set(value) {
emit('update:modelValue', value);
},
}); });
</script> </script>
@ -87,6 +101,7 @@ const value = computed({
hide-selected hide-selected
fill-input fill-input
ref="vnSelectRef" ref="vnSelectRef"
:class="{ required: $attrs.required }"
> >
<template v-if="isClearable" #append> <template v-if="isClearable" #append>
<QIcon <QIcon

View File

@ -62,7 +62,7 @@ async function getData() {
filter: $props.filter, filter: $props.filter,
skip: 0, skip: 0,
}); });
const { data } = await arrayData.fetch({ append: false }); const { data } = await arrayData.fetch({ append: false, updateRouter: false });
entity.value = data; entity.value = data;
emit('onFetch', data); emit('onFetch', data);
} }

View File

@ -9,6 +9,7 @@ const $props = defineProps({
isSelected: { type: Boolean, default: false }, isSelected: { type: Boolean, default: false },
title: { type: String, default: null }, title: { type: String, default: null },
showCheckbox: { type: Boolean, default: false }, showCheckbox: { type: Boolean, default: false },
hasInfoIcons: { type: Boolean, default: false },
}); });
const emit = defineEmits(['toggleCardCheck']); const emit = defineEmits(['toggleCardCheck']);
@ -39,6 +40,9 @@ const toggleCardCheck = (item) => {
</div> </div>
</slot> </slot>
<div class="card-list-body"> <div class="card-list-body">
<div v-if="hasInfoIcons" class="column q-mr-md q-gutter-y-xs">
<slot name="info-icons" />
</div>
<div class="list-items row flex-wrap-wrap"> <div class="list-items row flex-wrap-wrap">
<slot name="list-items" /> <slot name="list-items" />
</div> </div>

View File

@ -97,7 +97,7 @@ watch(props, async () => {
flex: 2; flex: 2;
} }
> .q-card.vn-three { > .q-card.vn-three {
flex: 3; flex: 4;
} }
> .q-card.vn-max { > .q-card.vn-max {
width: 100%; width: 100%;
@ -116,17 +116,17 @@ watch(props, async () => {
margin-top: 5px; margin-top: 5px;
.label { .label {
color: var(--vn-label); color: var(--vn-label);
width: 10em; width: 8em;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
margin-right: 10px; margin-right: 10px;
flex-grow: 0;
flex-shrink: 0;
} }
.value { .value {
color: var(--vn-text); color: var(--vn-text);
width: max-content;
overflow: hidden; overflow: hidden;
white-space: nowrap;
} }
} }
.header { .header {

View File

@ -1,7 +1,8 @@
<script setup> <script setup>
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
const $props = defineProps({ const $props = defineProps({
worker: { type: Number, required: true }, workerId: { type: Number, required: true },
description: { type: String, default: null }, description: { type: String, default: null },
}); });
const session = useSession(); const session = useSession();
@ -11,7 +12,7 @@ const token = session.getToken();
<div class="avatar-picture column items-center"> <div class="avatar-picture column items-center">
<QAvatar color="orange"> <QAvatar color="orange">
<QImg <QImg
:src="`/api/Images/user/160x160/${$props.worker}/download?access_token=${token}`" :src="`/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`"
spinner-color="white" spinner-color="white"
/> />
</QAvatar> </QAvatar>

View File

@ -4,6 +4,8 @@ import { useI18n } from 'vue-i18n';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import toDate from 'filters/toDate'; import toDate from 'filters/toDate';
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
dataKey: { dataKey: {
@ -39,9 +41,13 @@ const props = defineProps({
type: Array, type: Array,
default: () => [], default: () => [],
}, },
customTags: {
type: Array,
default: () => [],
},
}); });
const emit = defineEmits(['refresh', 'clear', 'search', 'init']); const emit = defineEmits(['refresh', 'clear', 'search', 'init', 'remove']);
const arrayData = useArrayData(props.dataKey, { const arrayData = useArrayData(props.dataKey, {
exprBuilder: props.exprBuilder, exprBuilder: props.exprBuilder,
@ -104,18 +110,26 @@ async function clearFilters() {
emit('clear'); emit('clear');
} }
const tags = computed(() => { const tagsList = computed(() =>
return Object.entries(userParams.value) Object.entries(userParams.value)
.filter(([key, value]) => value && !(props.hiddenTags || []).includes(key)) .filter(([key, value]) => value && !(props.hiddenTags || []).includes(key))
.map(([key, value]) => ({ .map(([key, value]) => ({
label: key, label: key,
value: value, value: value,
})); }))
}); );
const tags = computed(() =>
tagsList.value.filter((tag) => !(props.customTags || []).includes(tag.label))
);
const customTags = computed(() =>
tagsList.value.filter((tag) => (props.customTags || []).includes(tag.label))
);
async function remove(key) { async function remove(key) {
userParams.value[key] = null; userParams.value[key] = null;
await search(); await search();
emit('remove', key);
} }
function formatValue(value) { function formatValue(value) {
@ -171,21 +185,17 @@ function formatValue(value) {
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<div <div
v-if="tags.length === 0" v-if="tagsList.length === 0"
class="text-grey font-xs text-center full-width" class="text-grey font-xs text-center full-width"
> >
{{ t(`No filters applied`) }} {{ t(`No filters applied`) }}
</div> </div>
<div> <div>
<QChip <VnFilterPanelChip
:key="chip.label"
@remove="remove(chip.label)"
class="text-dark"
color="primary"
icon="label"
:removable="!unremovableParams.includes(chip.label)"
size="sm"
v-for="chip of tags" v-for="chip of tags"
:key="chip.label"
:removable="!unremovableParams.includes(chip.label)"
@remove="remove(chip.label)"
> >
<slot name="tags" :tag="chip" :format-fn="formatValue"> <slot name="tags" :tag="chip" :format-fn="formatValue">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -193,7 +203,15 @@ function formatValue(value) {
<span>"{{ chip.value }}"</span> <span>"{{ chip.value }}"</span>
</div> </div>
</slot> </slot>
</QChip> </VnFilterPanelChip>
<slot
v-if="$slots.customTags"
name="customTags"
:params="userParams"
:tags="customTags"
:format-fn="formatValue"
:search-fn="search"
/>
</div> </div>
</QItem> </QItem>
<QSeparator /> <QSeparator />

View File

@ -0,0 +1,7 @@
<script setup></script>
<template>
<QChip class="text-dark" color="primary" icon="label" size="sm" v-bind="$attrs">
<slot />
</QChip>
</template>

View File

@ -5,7 +5,7 @@ import { dashIfEmpty } from 'src/filters';
const $props = defineProps({ const $props = defineProps({
label: { type: String, default: null }, label: { type: String, default: null },
value: { value: {
type: [String, Boolean], type: [String, Boolean, Number],
default: null, default: null,
}, },
info: { type: String, default: null }, info: { type: String, default: null },
@ -13,6 +13,13 @@ const $props = defineProps({
}); });
const isBooleanValue = computed(() => typeof $props.value === 'boolean'); const isBooleanValue = computed(() => typeof $props.value === 'boolean');
</script> </script>
<style scoped>
.label,
.value {
white-space: pre-line;
word-wrap: break-word;
}
</style>
<template> <template>
<div class="vn-label-value"> <div class="vn-label-value">
<div v-if="$props.label || $slots.label" class="label"> <div v-if="$props.label || $slots.label" class="label">

View File

@ -1,11 +1,11 @@
<script setup> <script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue'; import VnAvatar from 'src/components/ui/VnAvatar.vue';
import { toDateHour } from 'src/filters'; import { toDateHour } from 'src/filters';
import { ref } from 'vue'; import { ref } from 'vue';
import axios from 'axios'; import axios from 'axios';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnPaginate from './VnPaginate.vue'; import VnPaginate from './VnPaginate.vue';
import VnUserLink from '../ui/VnUserLink.vue';
const $props = defineProps({ const $props = defineProps({
id: { type: String, required: true }, id: { type: String, required: true },
@ -28,7 +28,7 @@ async function insert() {
} }
</script> </script>
<template> <template>
<div class="column items-center"> <div class="column items-center full-height">
<VnPaginate <VnPaginate
:data-key="$props.url" :data-key="$props.url"
:url="$props.url" :url="$props.url"
@ -42,13 +42,14 @@ async function insert() {
<QCard class="q-pa-md q-mb-md" v-for="(note, index) in rows" :key="index"> <QCard class="q-pa-md q-mb-md" v-for="(note, index) in rows" :key="index">
<QCardSection horizontal> <QCardSection horizontal>
<slot name="picture"> <slot name="picture">
<VnAvatar :worker="note.workerFk" /> <VnAvatar :descriptor="false" :worker-id="note.workerFk" />
</slot> </slot>
<QItem class="full-width justify-between items-start"> <QItem class="full-width justify-between items-start">
<span class="link"> <VnUserLink
{{ `${note.worker.firstName} ${note.worker.lastName}` }} :name="`${note.worker.firstName} ${note.worker.lastName}`"
<WorkerDescriptorProxy :id="note.worker.id" /> :worker-id="note.worker.id"
</span> />
<slot name="actions"> <slot name="actions">
{{ toDateHour(note.created) }} {{ toDateHour(note.created) }}
</slot> </slot>
@ -115,6 +116,10 @@ async function insert() {
<style lang="scss" scoped> <style lang="scss" scoped>
.q-card { .q-card {
max-width: 80em; max-width: 80em;
&__section {
word-wrap: break-word;
}
} }
.q-dialog .q-card { .q-dialog .q-card {
width: 400px; width: 400px;

View File

@ -168,7 +168,12 @@ async function onLoad(...params) {
</QCard> </QCard>
</div> </div>
</div> </div>
<QInfiniteScroll v-if="store.data" @load="onLoad" :offset="offset" class="full-width"> <QInfiniteScroll
v-if="store.data"
@load="onLoad"
:offset="offset"
class="full-width full-height overflow-auto"
>
<slot name="body" :rows="store.data"></slot> <slot name="body" :rows="store.data"></slot>
<div v-if="isLoading" class="info-row q-pa-md text-center"> <div v-if="isLoading" class="info-row q-pa-md text-center">
<QSpinner color="orange" size="md" /> <QSpinner color="orange" size="md" />

114
src/components/ui/VnSms.vue Normal file
View File

@ -0,0 +1,114 @@
<script setup>
import { onBeforeMount } from 'vue';
import { date } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnAvatar from '../ui/VnAvatar.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({
url: { type: String, default: null },
where: { type: Object, default: () => {} },
});
const filter = {
fields: ['smsFk'],
include: {
relation: 'sms',
scope: {
fields: [
'senderFk',
'sender',
'destination',
'message',
'statusCode',
'status',
'created',
],
include: {
relation: 'sender',
scope: {
fields: ['name'],
},
},
},
},
};
onBeforeMount(() => (filter.where = $props.where));
function formatNumber(number) {
if (number.length <= 10) return number;
return number.slice(0, 4) + ' ' + number.slice(4);
}
</script>
<template>
<div class="column items-center">
<div class="list">
<VnPaginate
:data-key="$props.url"
:url="$props.url"
:filter="filter"
order="smsFk DESC"
:offset="100"
:limit="5"
auto-load
>
<template #body="{ rows }">
<QCard
flat
bordered
class="card q-pa-md q-mb-sm smsCard"
v-for="row of rows"
:key="row.smsFk"
>
<QItem>
<QItemSection side top>
<VnUserLink :worker-id="row.sms?.senderFk">
<template #link>
<VnAvatar
:worker-id="row.sms?.senderFk"
class="cursor-pointer"
:title="row.sms?.sender?.name"
/>
</template>
</VnUserLink>
</QItemSection>
<QSeparator />
<QItemSection>
<QItemLabel caption>{{
formatNumber(row.sms.destination)
}}</QItemLabel>
<QItemLabel>{{ row.sms.message }}</QItemLabel>
</QItemSection>
<QItemSection side>
<QItemLabel caption>{{
date.formatDate(
row.sms.created,
'YYYY-MM-DD HH:mm:ss'
)
}}</QItemLabel>
<QItemLabel class="row center">
<QChip
:color="
row.sms.status == 'OK'
? 'positive'
: 'negative'
"
>
{{ row.sms.status }}
</QChip>
</QItemLabel>
</QItemSection>
</QItem>
</QCard>
</template>
</VnPaginate>
</div>
</div>
</template>
<style lang="scss" scoped>
.q-item__section--side {
align-items: center;
}
</style>

View File

@ -0,0 +1,21 @@
<script setup>
import { onMounted, onUnmounted, ref } from 'vue';
import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore();
onMounted(() => {
stateStore.toggleSubToolbar();
});
onUnmounted(() => {
stateStore.toggleSubToolbar();
});
</script>
<template>
<QToolbar class="bg-vn-dark justify-end">
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
</template>

View File

@ -53,10 +53,11 @@ const fetchNodeLeaves = async (nodeKey) => {
}; };
const removeNode = (node) => { const removeNode = (node) => {
const { id, parentFk } = node;
quasar quasar
.dialog({ .dialog({
title: 'Are you sure you want to delete it?', title: t('Are you sure you want to delete it?'),
message: 'Delete department', message: t('Delete department'),
ok: { ok: {
push: true, push: true,
color: 'primary', color: 'primary',
@ -65,9 +66,9 @@ const removeNode = (node) => {
}) })
.onOk(async () => { .onOk(async () => {
try { try {
await axios.post(`/Departments/${node.id}/removeChild`, node.id); await axios.post(`/Departments/${id}/removeChild`, id);
notify('department.departmentRemoved', 'positive'); notify(t('department.departmentRemoved'), 'positive');
await fetchNodeLeaves(node.parentFk); await fetchNodeLeaves(parentFk);
} catch (err) { } catch (err) {
console.log('Error removing department'); console.log('Error removing department');
} }
@ -85,7 +86,7 @@ const onNodeCreated = async () => {
const redirectToDepartmentSummary = (id) => { const redirectToDepartmentSummary = (id) => {
if (!id) return; if (!id) return;
router.push({ name: 'DepartmentSummary', params: { id: id } }); router.push({ name: 'DepartmentSummary', params: { id } });
}; };
</script> </script>
@ -99,22 +100,22 @@ const redirectToDepartmentSummary = (id) => {
v-model:expanded="expanded" v-model:expanded="expanded"
@update:expanded="onNodeExpanded($event)" @update:expanded="onNodeExpanded($event)"
> >
<template #default-header="prop"> <template #default-header="{ node }">
<div <div
class="row justify-between full-width q-pr-md cursor-pointer" class="row justify-between full-width q-pr-md cursor-pointer"
@click.stop="redirectToDepartmentSummary(prop.node.id)" @click.stop="redirectToDepartmentSummary(node.id)"
> >
<span class="text-uppercase"> <span class="text-uppercase">
{{ prop.node.name }} {{ node.name }}
</span> </span>
<div class="row justify-between" style="max-width: max-content"> <div class="row justify-between" style="max-width: max-content">
<QIcon <QIcon
v-if="prop.node.id" v-if="node.id"
name="delete" name="delete"
color="primary" color="primary"
size="sm" size="sm"
class="q-pr-xs cursor-pointer" class="q-pr-xs cursor-pointer"
@click.stop="removeNode(prop.node)" @click.stop="removeNode(node)"
> >
<QTooltip> <QTooltip>
{{ t('Remove') }} {{ t('Remove') }}
@ -125,7 +126,7 @@ const redirectToDepartmentSummary = (id) => {
color="primary" color="primary"
size="sm" size="sm"
class="cursor-pointer" class="cursor-pointer"
@click.stop="showCreateNodeForm(prop.node.id)" @click.stop="showCreateNodeForm(node.id)"
> >
<QTooltip> <QTooltip>
{{ t('Create') }} {{ t('Create') }}

View File

@ -0,0 +1,21 @@
<script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import { useI18n } from 'vue-i18n';
const $props = defineProps({
name: { type: String, default: null },
workerId: { type: Number, default: null },
defaultName: { type: Boolean, default: false },
});
const { t } = useI18n();
</script>
<template>
<slot name="link">
<span :class="{ link: $props.workerId }">
{{ $props.defaultName ? $props.name ?? t('globals.system') : $props.name }}
</span>
</slot>
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
</template>
<style scoped></style>

View File

@ -58,7 +58,7 @@ export function useArrayData(key, userOptions) {
} }
} }
async function fetch({ append = false }) { async function fetch({ append = false, updateRouter = true }) {
if (!store.url) return; if (!store.url) return;
cancelRequest(); cancelRequest();
@ -90,7 +90,7 @@ export function useArrayData(key, userOptions) {
Object.assign(params, userParams); Object.assign(params, userParams);
store.isLoading = true; store.isLoading = true;
store.currentFilter = params;
const response = await axios.get(store.url, { const response = await axios.get(store.url, {
signal: canceller.signal, signal: canceller.signal,
params, params,
@ -100,15 +100,12 @@ export function useArrayData(key, userOptions) {
hasMoreData.value = response.data.length === limit; hasMoreData.value = response.data.length === limit;
if (append === true) { if (append) {
if (!store.data) store.data = []; if (!store.data) store.data = [];
for (const row of response.data) store.data.push(row); for (const row of response.data) store.data.push(row);
} } else {
if (append === false) {
store.data = response.data; store.data = response.data;
updateRouter && updateStateParams();
updateStateParams();
} }
store.isLoading = false; store.isLoading = false;

View File

@ -16,7 +16,7 @@ export function useUserConfig() {
return data; return data;
} catch (error) { } catch (error) {
notify('globals.errors.userConfig', 'negative'); notify('errors.userConfig', 'negative');
console.error('Error fetching user config:', error); console.error('Error fetching user config:', error);
} }
} }

View File

@ -17,9 +17,9 @@ a {
// Removes chrome autofill background // Removes chrome autofill background
input:-webkit-autofill, input:-webkit-autofill,
select:-webkit-autofill { select:-webkit-autofill {
color: $input-text-color !important; color: var(--vn-text) ;
font-family: $typography-font-family; font-family: $typography-font-family;
-webkit-text-fill-color: $input-text-color !important; -webkit-text-fill-color: var(--vn-text) ;
-webkit-background-clip: text !important; -webkit-background-clip: text !important;
background-clip: text !important; background-clip: text !important;
} }
@ -53,3 +53,8 @@ body.body--dark {
color: var(--vn-text); color: var(--vn-text);
border-radius: 8px; border-radius: 8px;
} }
/* Estilo para el asterisco en campos requeridos */
.q-field.required .q-field__label:after {
content: ' *';
}

View File

@ -49,7 +49,6 @@ export default {
microsip: 'Open in MicroSIP', microsip: 'Open in MicroSIP',
noSelectedRows: `You don't have any line selected`, noSelectedRows: `You don't have any line selected`,
downloadCSVSuccess: 'CSV downloaded successfully', downloadCSVSuccess: 'CSV downloaded successfully',
// labels compartidos entre vistas
reference: 'Reference', reference: 'Reference',
agency: 'Agency', agency: 'Agency',
wareHouseOut: 'Warehouse Out', wareHouseOut: 'Warehouse Out',
@ -63,7 +62,8 @@ export default {
selectRows: 'Select all { numberRows } row(s)', selectRows: 'Select all { numberRows } row(s)',
allRows: 'All { numberRows } row(s)', allRows: 'All { numberRows } row(s)',
markAll: 'Mark all', markAll: 'Mark all',
noResults: 'No results' noResults: 'No results',
system: 'System',
}, },
errors: { errors: {
statusUnauthorized: 'Access denied', statusUnauthorized: 'Access denied',
@ -110,6 +110,7 @@ export default {
customer: { customer: {
pageTitles: { pageTitles: {
customers: 'Customers', customers: 'Customers',
create: 'Create',
list: 'List', list: 'List',
webPayments: 'Web Payments', webPayments: 'Web Payments',
extendedList: 'Extended list', extendedList: 'Extended list',
@ -266,6 +267,42 @@ export default {
}, },
list: { list: {
newEntry: 'New entry', newEntry: 'New entry',
landed: 'Landed',
invoiceNumber: 'Invoice number',
supplier: 'Supplier',
booked: 'Booked',
confirmed: 'Confirmed',
ordered: 'Ordered',
},
summary: {
commission: 'Commission',
currency: 'Currency',
company: 'Company',
reference: 'Reference',
invoiceNumber: 'Invoice number',
ordered: 'Ordered',
confirmed: 'Confirmed',
booked: 'Booked',
raid: 'Raid',
excludedFromAvailable: 'Inventory',
travelReference: 'Reference',
travelAgency: 'Agency',
travelShipped: 'Shipped',
travelWarehouseOut: 'Warehouse Out',
travelDelivered: 'Delivered',
travelLanded: 'Landed',
travelWarehouseIn: 'Warehouse In',
travelReceived: 'Received',
buys: 'Buys',
quantity: 'Quantity',
stickers: 'Stickers',
package: 'Package',
weight: 'Weight',
packing: 'Packing',
grouping: 'Grouping',
buyingValue: 'Buying value',
import: 'Import',
pvp: 'PVP',
}, },
}, },
ticket: { ticket: {
@ -876,6 +913,71 @@ export default {
create: { create: {
supplierName: 'Supplier name', supplierName: 'Supplier name',
}, },
basicData: {
alias: 'Alias',
workerFk: 'Responsible',
isSerious: 'Verified',
isActive: 'Active',
isPayMethodChecked: 'PayMethod checked',
note: 'Notes',
},
fiscalData: {
name: 'Social name *',
nif: 'Tax number *',
account: 'Account',
sageTaxTypeFk: 'Sage tax type',
sageWithholdingFk: 'Sage withholding',
sageTransactionTypeFk: 'Sage transaction type',
supplierActivityFk: 'Supplier activity',
healthRegister: 'Health register',
street: 'Street',
postcode: 'Postcode',
city: 'City *',
provinceFk: 'Province',
country: 'Country',
isTrucker: 'Trucker',
isVies: 'Vies',
},
billingData: {
payMethodFk: 'Billing data',
payDemFk: 'Payment deadline',
payDay: 'Pay day',
},
accounts: {
iban: 'Iban',
bankEntity: 'Bank entity',
beneficiary: 'Beneficiary',
},
contacts: {
name: 'Name',
phone: 'Phone',
mobile: 'Mobile',
email: 'Email',
observation: 'Notes',
},
addresses: {
street: 'Street',
postcode: 'Postcode',
phone: 'Phone',
name: 'Name',
city: 'City',
province: 'Province',
mobile: 'Mobile',
},
agencyTerms: {
agencyFk: 'Agency',
minimumM3: 'Minimum M3',
packagePrice: 'Package Price',
kmPrice: 'Km Price',
m3Price: 'M3 Price',
routePrice: 'Route price',
minimumKm: 'Minimum Km',
},
consumption: {
entry: 'Entry',
date: 'Date',
reference: 'Reference',
},
}, },
travel: { travel: {
pageTitles: { pageTitles: {
@ -915,6 +1017,7 @@ export default {
components: { components: {
topbar: {}, topbar: {},
userPanel: { userPanel: {
copyToken: 'Token copied to clipboard',
settings: 'Settings', settings: 'Settings',
logOut: 'Log Out', logOut: 'Log Out',
}, },

View File

@ -48,7 +48,6 @@ export default {
dateFormat: 'es-ES', dateFormat: 'es-ES',
noSelectedRows: `No tienes ninguna línea seleccionada`, noSelectedRows: `No tienes ninguna línea seleccionada`,
microsip: 'Abrir en MicroSIP', microsip: 'Abrir en MicroSIP',
// labels compartidos entre vistas
downloadCSVSuccess: 'Descarga de CSV exitosa', downloadCSVSuccess: 'Descarga de CSV exitosa',
reference: 'Referencia', reference: 'Referencia',
agency: 'Agencia', agency: 'Agencia',
@ -63,7 +62,8 @@ export default {
selectRows: 'Seleccionar las { numberRows } filas(s)', selectRows: 'Seleccionar las { numberRows } filas(s)',
allRows: 'Todo { numberRows } filas(s)', allRows: 'Todo { numberRows } filas(s)',
markAll: 'Marcar todo', markAll: 'Marcar todo',
noResults: 'Sin resultados' noResults: 'Sin resultados',
system: 'Sistema',
}, },
errors: { errors: {
statusUnauthorized: 'Acceso denegado', statusUnauthorized: 'Acceso denegado',
@ -110,6 +110,7 @@ export default {
customer: { customer: {
pageTitles: { pageTitles: {
customers: 'Clientes', customers: 'Clientes',
create: 'Crear',
list: 'Listado', list: 'Listado',
webPayments: 'Pagos Web', webPayments: 'Pagos Web',
extendedList: 'Listado extendido', extendedList: 'Listado extendido',
@ -264,6 +265,42 @@ export default {
}, },
list: { list: {
newEntry: 'Nueva entrada', newEntry: 'Nueva entrada',
landed: 'F. entrega',
invoiceNumber: 'Núm. factura',
supplier: 'Proveedor',
booked: 'Asentado',
confirmed: 'Confirmado',
ordered: 'Pedida',
},
summary: {
commission: 'Comisión',
currency: 'Moneda',
company: 'Empresa',
reference: 'Referencia',
invoiceNumber: 'Núm. factura',
ordered: 'Pedida',
confirmed: 'Confirmado',
booked: 'Asentado',
raid: 'Redada',
excludedFromAvailable: 'Inventario',
travelReference: 'Referencia',
travelAgency: 'Agencia',
travelShipped: 'F. envio',
travelWarehouseOut: 'Alm. salida',
travelDelivered: 'Enviada',
travelLanded: 'F. entrega',
travelWarehouseIn: 'Alm. entrada',
travelReceived: 'Recibida',
buys: 'Compras',
quantity: 'Cantidad',
stickers: 'Etiquetas',
package: 'Embalaje',
weight: 'Peso',
packing: 'Packing',
grouping: 'Grouping',
buyingValue: 'Coste',
import: 'Importe',
pvp: 'PVP',
}, },
}, },
ticket: { ticket: {
@ -857,7 +894,7 @@ export default {
payDeadline: 'Plazo de pago', payDeadline: 'Plazo de pago',
payDay: 'Día de pago', payDay: 'Día de pago',
account: 'Cuenta', account: 'Cuenta',
fiscalData: 'Data fiscal', fiscalData: 'Datos fiscales',
sageTaxType: 'Tipo de impuesto Sage', sageTaxType: 'Tipo de impuesto Sage',
sageTransactionType: 'Tipo de transacción Sage', sageTransactionType: 'Tipo de transacción Sage',
sageWithholding: 'Retención sage', sageWithholding: 'Retención sage',
@ -875,6 +912,71 @@ export default {
create: { create: {
supplierName: 'Nombre del proveedor', supplierName: 'Nombre del proveedor',
}, },
basicData: {
alias: 'Alias',
workerFk: 'Responsable',
isSerious: 'Verificado',
isActive: 'Activo',
isPayMethodChecked: 'Método de pago validado',
note: 'Notas',
},
fiscalData: {
name: 'Razón social *',
nif: 'NIF/CIF *',
account: 'Cuenta',
sageTaxTypeFk: 'Tipo de impuesto sage',
sageWithholdingFk: 'Retención sage',
sageTransactionTypeFk: 'Tipo de transacción sage',
supplierActivityFk: 'Actividad proveedor',
healthRegister: 'Pasaporte sanitario',
street: 'Calle',
postcode: 'Código postal',
city: 'Población *',
provinceFk: 'Provincia',
country: 'País',
isTrucker: 'Transportista',
isVies: 'Vies',
},
billingData: {
payMethodFk: 'Forma de pago',
payDemFk: 'Plazo de pago',
payDay: 'Día de pago',
},
accounts: {
iban: 'Iban',
bankEntity: 'Entidad bancaria',
beneficiary: 'Beneficiario',
},
contacts: {
name: 'Nombre',
phone: 'Teléfono',
mobile: 'Móvil',
email: 'Email',
observation: 'Notas',
},
addresses: {
street: 'Dirección',
postcode: 'Código postal',
phone: 'Teléfono',
name: 'Nombre',
city: 'Población',
province: 'Provincia',
mobile: 'Móvil',
},
agencyTerms: {
agencyFk: 'Agencia',
minimumM3: 'M3 mínimos',
packagePrice: 'Precio bulto',
kmPrice: 'Precio Km',
m3Price: 'Precio M3',
routePrice: 'Precio ruta',
minimumKm: 'Km mínimos',
},
consumption: {
entry: 'Entrada',
date: 'Fecha',
reference: 'Referencia',
},
}, },
travel: { travel: {
pageTitles: { pageTitles: {
@ -914,6 +1016,7 @@ export default {
components: { components: {
topbar: {}, topbar: {},
userPanel: { userPanel: {
copyToken: 'Token copiado al portapapeles',
settings: 'Configuración', settings: 'Configuración',
logOut: 'Cerrar sesión', logOut: 'Cerrar sesión',
}, },

View File

@ -1,6 +1,8 @@
import en from './en'; import en from './en';
import es from './es'; import es from './es';
export const localeEquivalence = {
'en':'en-GB'
}
export default { export default {
en: en, en: en,
es: es, es: es,

View File

@ -1,7 +1,6 @@
<script setup> <script setup>
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import Navbar from 'src/components/NavBar.vue'; import Navbar from 'src/components/NavBar.vue';
const quasar = useQuasar(); const quasar = useQuasar();
</script> </script>

View File

@ -26,6 +26,7 @@ const userLocale = computed({
} }
}, },
}); });
const darkMode = computed({ const darkMode = computed({
get() { get() {
return Dark.isActive; return Dark.isActive;

View File

@ -127,11 +127,14 @@ async function updateDestination(claimDestinationFk, row, options = {}) {
} }
async function regularizeClaim() { async function regularizeClaim() {
const query = `Claims/${claimId}/regularizeClaim`; await axios.post(`Claims/${claimId}/regularizeClaim`);
await axios.post(query);
if (claim.value.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2) {
await claimRef.value.fetch(); await claimRef.value.fetch();
await arrayData.fetch({ append: false });
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
if (claim.value.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2) {
quasar quasar
.dialog({ .dialog({
component: VnConfirm, component: VnConfirm,
@ -141,29 +144,19 @@ async function regularizeClaim() {
}, },
}) })
.onOk(async () => await onUpdateGreugeAccept()); .onOk(async () => await onUpdateGreugeAccept());
} else {
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
} }
await arrayData.fetch({ append: false });
}
async function updateGreuge(greuges) {
const { data } = await axios.post(`Greuges`, greuges);
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
return data;
} }
async function onUpdateGreugeAccept() { async function onUpdateGreugeAccept() {
const greugeTypeFreightId = await getGreugeTypeId(); const greugeTypeFreightId = (
const freightPickUpPrice = await getGreugeConfig(); await axios.get(`GreugeTypes/findOne`, {
filter: { where: { code: 'freightPickUp' } },
})
).data.id;
const freightPickUpPrice = (await axios.get(`GreugeConfigs/findOne`)).data
.freightPickUpPrice;
await updateGreuge({ await axios.post(`Greuges`, {
clientFk: claim.value.clientFk, clientFk: claim.value.clientFk,
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(), description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
amount: freightPickUpPrice, amount: freightPickUpPrice,
@ -176,19 +169,6 @@ async function onUpdateGreugeAccept() {
}); });
} }
async function getGreugeTypeId() {
const params = { filter: { where: { code: 'freightPickUp' } } };
const query = `GreugeTypes/findOne`;
const { data } = await axios.get(query, { params });
return data.id;
}
async function getGreugeConfig() {
const query = `GreugeConfigs/findOne`;
const { data } = await axios.get(query);
return data.freightPickUpPrice;
}
async function save(data) { async function save(data) {
const query = `Claims/${claimId}/updateClaimAction`; const query = `Claims/${claimId}/updateClaimAction`;
await axios.patch(query, data); await axios.patch(query, data);
@ -302,6 +282,8 @@ async function importToNewRefundTicket() {
selection="multiple" selection="multiple"
v-model:selected="selectedRows" v-model:selected="selectedRows"
:grid="$q.screen.lt.md" :grid="$q.screen.lt.md"
:pagination="{ rowsPerPage: 0 }"
:hide-bottom="true"
> >
<template #body-cell-ticket="{ value }"> <template #body-cell-ticket="{ value }">
<QTd align="center"> <QTd align="center">
@ -355,7 +337,23 @@ async function importToNewRefundTicket() {
</QItemSection> </QItemSection>
<QItemSection side> <QItemSection side>
<QItemLabel v-if="column.name === 'destination'"> <QItemLabel v-if="column.name === 'destination'">
{{ column.value.description }} <VnSelectFilter
v-model="props.row.claimDestinationFk"
:options="destinationTypes"
option-label="description"
option-value="id"
:autofocus="true"
dense
input-debounce="0"
hide-selected
@update:model-value="
(value) =>
updateDestination(
value,
props.row
)
"
/>
</QItemLabel> </QItemLabel>
<QItemLabel v-else> <QItemLabel v-else>
{{ column.value }} {{ column.value }}
@ -437,25 +435,6 @@ async function importToNewRefundTicket() {
</QCardActions> </QCardActions>
</QCard> </QCard>
</QDialog> </QDialog>
<!-- <QDialog v-model="dialogGreuge">
<QCardSection>
<QItem class="q-pa-sm">
<span class="q-pa-sm q-dialog__title text-white">
{{ t('dialogGreuge title') }}
</span>
<QBtn class="q-pa-sm" icon="close" flat round dense v-close-popup />
</QItem>
<QCardActions class="justify-end q-mr-sm">
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
<QBtn
:label="t('globals.save')"
color="primary"
v-close-popup
@click="onUpdateGreugeAccept"
/>
</QCardActions>
</QCardSection>
</QDialog> -->
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.slider-container { .slider-container {

View File

@ -7,8 +7,8 @@ import { computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import ClaimDescriptor from './ClaimDescriptor.vue'; import ClaimDescriptor from './ClaimDescriptor.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { onMounted } from 'vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -41,11 +41,7 @@ const entityId = computed(() => {
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -4,14 +4,12 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue'; import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -118,18 +116,18 @@ const setData = (entity) => {
:value="entity.worker.user.name" :value="entity.worker.user.name"
> >
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ entity.worker.user.name }} :name="entity.worker.user.name"
<WorkerDescriptorProxy :id="entity.worker.user.id" /> :worker-id="entity.worker.id"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('claim.card.commercial')"> <VnLv :label="t('claim.card.commercial')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ entity.client?.salesPersonUser?.name }} :name="entity.client?.salesPersonUser?.name"
<WorkerDescriptorProxy :id="entity.client?.salesPersonFk" /> :worker-id="entity.client?.salesPersonFk"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv

View File

@ -1,13 +1,11 @@
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import CrudModel from 'components/CrudModel.vue'; import CrudModel from 'components/CrudModel.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import { getUrl } from 'composables/getUrl';
import { tMobile } from 'composables/tMobile'; import { tMobile } from 'composables/tMobile';
import router from 'src/router';
const route = useRoute(); const route = useRoute();
@ -21,11 +19,6 @@ const claimRedeliveries = ref([]);
const workers = ref([]); const workers = ref([]);
const selected = ref([]); const selected = ref([]);
const saveButtonRef = ref(); const saveButtonRef = ref();
let salixUrl;
onMounted(async () => {
salixUrl = await getUrl(`claim/${route.params.id}`);
});
const developmentsFilter = { const developmentsFilter = {
fields: [ fields: [
@ -54,6 +47,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'description', optionLabel: 'description',
tabIndex: 1, tabIndex: 1,
align: 'left',
}, },
{ {
name: 'claimResult', name: 'claimResult',
@ -66,6 +60,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'description', optionLabel: 'description',
tabIndex: 2, tabIndex: 2,
align: 'left',
}, },
{ {
name: 'claimResponsible', name: 'claimResponsible',
@ -78,6 +73,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'description', optionLabel: 'description',
tabIndex: 3, tabIndex: 3,
align: 'left',
}, },
{ {
name: 'worker', name: 'worker',
@ -89,6 +85,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'nickname', optionLabel: 'nickname',
tabIndex: 4, tabIndex: 4,
align: 'left',
}, },
{ {
name: 'claimRedelivery', name: 'claimRedelivery',
@ -101,6 +98,7 @@ const columns = computed(() => [
optionValue: 'id', optionValue: 'id',
optionLabel: 'description', optionLabel: 'description',
tabIndex: 5, tabIndex: 5,
align: 'left',
}, },
]); ]);
</script> </script>
@ -158,6 +156,7 @@ const columns = computed(() => [
hide-pagination hide-pagination
v-model:selected="selected" v-model:selected="selected"
:grid="$q.screen.lt.md" :grid="$q.screen.lt.md"
table-header-class="text-left"
> >
<template #body-cell="{ row, col }"> <template #body-cell="{ row, col }">
<QTd <QTd
@ -165,7 +164,6 @@ const columns = computed(() => [
@keyup.ctrl.enter.stop="claimDevelopmentForm.saveChanges()" @keyup.ctrl.enter.stop="claimDevelopmentForm.saveChanges()"
> >
<VnSelectFilter <VnSelectFilter
:label="col.label"
v-model="row[col.model]" v-model="row[col.model]"
:options="col.options" :options="col.options"
:option-value="col.optionValue" :option-value="col.optionValue"

View File

@ -43,17 +43,20 @@ async function onFetchClaim(data) {
fetchMana(); fetchMana();
} }
const amount = ref(0); const amount = ref();
const amountClaimed = ref(0); const amountClaimed = ref();
async function onFetch(rows) { async function onFetch(rows) {
amount.value = 0;
amountClaimed.value = 0;
if (!rows || !rows.length) return; if (!rows || !rows.length) return;
amount.value = rows.reduce( amount.value = rows.reduce(
(acumulator, { sale }) => acumulator + sale.price * sale.quantity, (accumulator, { sale }) => accumulator + sale.price * sale.quantity,
0 0
); );
amountClaimed.value = rows.reduce( amountClaimed.value = rows.reduce(
(acumulator, line) => acumulator + line.sale.price * line.quantity, (accumulator, line) => accumulator + line.sale.price * line.quantity,
0 0
); );
} }
@ -189,6 +192,7 @@ function showImportDialog() {
save-url="ClaimBeginnings/crud" save-url="ClaimBeginnings/crud"
:filter="linesFilter" :filter="linesFilter"
@on-fetch="onFetch" @on-fetch="onFetch"
@save-changes="onFetch"
v-model:selected="selected" v-model:selected="selected"
:default-save="false" :default-save="false"
:default-reset="false" :default-reset="false"

View File

@ -8,6 +8,10 @@ const state = useState();
const user = state.getUser(); const user = state.getUser();
const id = route.params.id; const id = route.params.id;
const $props = defineProps({
addNote: { type: Boolean, default: true },
});
const claimFilter = { const claimFilter = {
where: { claimFk: id }, where: { claimFk: id },
fields: ['created', 'workerFk', 'text'], fields: ['created', 'workerFk', 'text'],
@ -27,7 +31,7 @@ const body = {
<template> <template>
<div class="column items-center"> <div class="column items-center">
<VnNotes <VnNotes
:add-note="true" :add-note="$props.addNote"
:id="id" :id="id"
url="claimObservations" url="claimObservations"
:filter="claimFilter" :filter="claimFilter"

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, ref, computed } from 'vue'; import { onMounted, ref, computed, watch } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toDate, toCurrency } from 'src/filters'; import { toDate, toCurrency } from 'src/filters';
@ -7,8 +7,9 @@ import CardSummary from 'components/ui/CardSummary.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import ClaimNotes from 'src/pages/Claim/Card/ClaimNotes.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -26,12 +27,26 @@ const entityId = computed(() => $props.id || route.params.id);
const claimUrl = ref(); const claimUrl = ref();
const salixUrl = ref(); const salixUrl = ref();
const claimDmsRef = ref();
const claimDmsFilter = ref({
include: [
{
relation: 'dms',
},
],
where: { claimFk: entityId.value },
});
onMounted(async () => { onMounted(async () => {
salixUrl.value = await getUrl(''); salixUrl.value = await getUrl('');
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`; claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
}); });
watch(entityId, async (id) => {
claimDmsFilter.value.where = { claimFk: id };
await claimDmsRef.value.fetch();
});
const detailsColumns = ref([ const detailsColumns = ref([
{ {
name: 'item', name: 'item',
@ -118,7 +133,7 @@ const developmentColumns = ref([
{ {
name: 'worker', name: 'worker',
label: 'claim.summary.worker', label: 'claim.summary.worker',
field: (row) => row.worker.user.nickname, field: (row) => row.worker?.user.nickname,
sortable: true, sortable: true,
}, },
{ {
@ -131,18 +146,9 @@ const developmentColumns = ref([
const claimDms = ref([]); const claimDms = ref([]);
const multimediaDialog = ref(); const multimediaDialog = ref();
const multimediaSlide = ref(); const multimediaSlide = ref();
const claimDmsFilter = ref({
include: [
{
relation: 'dms',
},
],
where: { claimFk: entityId.value },
});
function setClaimDms(data) { function setClaimDms(data) {
if (!data) return; claimDms.value = [];
data.forEach((media) => { data.forEach((media) => {
claimDms.value.push({ claimDms.value.push({
isVideo: media.dms.contentType == 'video/mp4', isVideo: media.dms.contentType == 'video/mp4',
@ -165,6 +171,7 @@ function openDialog(dmsId) {
@on-fetch="(data) => setClaimDms(data)" @on-fetch="(data) => setClaimDms(data)"
limit="20" limit="20"
auto-load auto-load
ref="claimDmsRef"
/> />
<CardSummary ref="summary" :url="`Claims/${entityId}/getSummary`"> <CardSummary ref="summary" :url="`Claims/${entityId}/getSummary`">
<template #header="{ entity: { claim } }"> <template #header="{ entity: { claim } }">
@ -189,30 +196,30 @@ function openDialog(dmsId) {
</VnLv> </VnLv>
<VnLv :label="t('claim.summary.assignedTo')"> <VnLv :label="t('claim.summary.assignedTo')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ claim.worker.user.nickname }} :name="claim.worker?.user?.nickname"
<WorkerDescriptorProxy :id="claim.workerFk" /> :worker-id="claim.workerFk"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('claim.summary.attendedBy')"> <VnLv :label="t('claim.summary.attendedBy')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ claim.client.salesPersonUser.name }} :name="claim.client?.salesPersonUser?.name"
<WorkerDescriptorProxy :id="claim.client.salesPersonFk" /> :worker-id="claim.client?.salesPersonFk"
</span> />
</template> </template>
</VnLv> </VnLv>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-max claimVnNotes">
<a class="header" :href="claimUrl + 'note/index'"> <a class="header" :href="`#/claim/${entityId}/notes`">
{{ t('claim.summary.notes') }} {{ t('claim.summary.notes') }}
<QIcon name="open_in_new" color="primary" /> <QIcon name="open_in_new" color="primary" />
</a> </a>
<!-- Use VnNotes and maybe VirtualScroll--> <ClaimNotes :add-note="false" style="height: 350px" order="created ASC" />
</QCard> </QCard>
<QCard class="vn-max" v-if="salesClaimed.length > 0"> <QCard class="vn-max" v-if="salesClaimed.length > 0">
<a class="header" :href="claimUrl + 'note/index'"> <a class="header" :href="`#/claim/${entityId}/lines`">
{{ t('claim.summary.details') }} {{ t('claim.summary.details') }}
<QIcon name="open_in_new" color="primary" /> <QIcon name="open_in_new" color="primary" />
</a> </a>
@ -306,20 +313,6 @@ function openDialog(dmsId) {
/> />
</div> </div>
</QCard> </QCard>
<!-- <QCardSection class="q-pa-md" v-if="observations.length > 0">
<h6>{{ t('claim.summary.notes') }}</h6>
<div class="note-list" v-for="note in observations" :key="note.id">
<div class="note-caption">
<span
>{{ note.worker.firstName }} {{ note.worker.lastName }}
</span>
<span>{{ toDate(note.created) }}</span>
</div>
<div class="note-text">
<span>{{ note.text }}</span>
</div>
</div>
</QCardSection> -->
<QDialog <QDialog
v-model="multimediaDialog" v-model="multimediaDialog"
transition-show="slide-up" transition-show="slide-up"
@ -362,6 +355,13 @@ function openDialog(dmsId) {
</template> </template>
</CardSummary> </CardSummary>
</template> </template>
<style lang="scss">
.claimVnNotes {
.q-card {
max-width: 100%;
}
}
</style>
<style lang="scss" scoped> <style lang="scss" scoped>
.q-dialog__inner--minimized > div { .q-dialog__inner--minimized > div {
max-width: 80%; max-width: 80%;

View File

@ -11,7 +11,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue'; import CardList from 'src/components/ui/CardList.vue';
import ClaimSummaryDialog from './Card/ClaimSummaryDialog.vue'; import ClaimSummaryDialog from './Card/ClaimSummaryDialog.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter(); const router = useRouter();
@ -38,15 +38,6 @@ function viewSummary(id) {
}, },
}); });
} }
function viewDescriptor(id) {
quasar.dialog({
component: CustomerDescriptorProxy,
componentProps: {
id,
},
});
}
</script> </script>
<template> <template>
@ -84,7 +75,7 @@ function viewDescriptor(id) {
<VnPaginate <VnPaginate
data-key="ClaimList" data-key="ClaimList"
url="Claims/filter" url="Claims/filter"
order="id DESC" order="claimStateFk"
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">
@ -106,10 +97,10 @@ function viewDescriptor(id) {
</VnLv> </VnLv>
<VnLv :label="t('claim.list.assignedTo')" @click.stop> <VnLv :label="t('claim.list.assignedTo')" @click.stop>
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ row.workerName }} :name="row.workerName"
<WorkerDescriptorProxy :id="row.workerFk" /> :worker-id="row.workerFk"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv <VnLv

View File

@ -1,3 +1,121 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
const { t } = useI18n();
const route = useRoute();
const payMethods = ref([]);
const bankEntitiesOptions = ref([]);
const onBankEntityCreated = (data) => {
bankEntitiesOptions.value.push(data);
};
</script>
<template> <template>
<div class="flex justify-center">Billing data</div> <fetch-data @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
<FetchData
@on-fetch="(data) => (bankEntitiesOptions = data)"
auto-load
url="BankEntities"
/>
<FormModel
:url-update="`Clients/${route.params.id}`"
:url="`Clients/${route.params.id}/getCard`"
auto-load
model="customer"
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Billing data')"
:options="payMethods"
hide-selected
option-label="name"
option-value="id"
v-model="data.payMethod"
/>
</div>
<div class="col">
<VnInput
:label="t('Due day')"
:rules="validate('client.socialName')"
v-model="data.dueDay"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('IBAN')" v-model="data.iban" />
</div>
<div class="col">
<VnSelectCreate
:label="t('Swift / BIC')"
:options="bankEntitiesOptions"
:roles-allowed-to-create="['salesAssistant', 'hr']"
:rules="validate('Worker.bankEntity')"
hide-selected
option-label="name"
option-value="id"
v-model="data.bankEntityFk"
>
<template #form>
<CreateBankEntityForm
@on-data-saved="onBankEntityCreated($event)"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel
>{{ scope.opt.bic }}
{{ scope.opt.name }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelectCreate>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox :label="t('Received LCR')" v-model="data.hasLcr" />
</div>
<div class="col">
<QCheckbox
:label="t('VNL core received')"
v-model="data.hasCoreVnl"
/>
</div>
<div class="col">
<QCheckbox :label="t('VNL B2B received')" v-model="data.hasSepaVnl" />
</div>
</VnRow>
</template>
</FormModel>
</template> </template>
<i18n>
es:
Billing data: Forma de pago
Due day: Vencimiento
IBAN: IBAN
Swift / BIC: Swift / BIC
Received LCR: Recibido LCR
VNL core received: Recibido core VNL
VNL B2B received: Recibido B2B VNL
</i18n>

View File

@ -5,6 +5,7 @@ import { useRoute } from 'vue-router';
import CustomerDescriptor from './CustomerDescriptor.vue'; import CustomerDescriptor from './CustomerDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const route = useRoute(); const route = useRoute();
@ -28,11 +29,7 @@ const { t } = useI18n();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -1,3 +1,121 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnLv from 'src/components/ui/VnLv.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const provincesLocation = ref([]);
const setProvince = (provinceFk) => {
const result = provincesLocation.value.filter(
(province) => province.id === provinceFk
);
return result[0]?.name || '';
};
const toCustomerConsigneeCreate = () => {
router.push({ name: 'CustomerConsigneeCreate' });
};
const toCustomerConsigneeEdit = () => {
router.push({ name: 'CustomerConsigneeEdit' });
};
</script>
<template> <template>
<div class="flex justify-center">Consignees</div> <FetchData
@on-fetch="(data) => (provincesLocation = data)"
auto-load
url="Provinces/location"
/>
<QCard class="q-pa-lg">
<VnPaginate
data-key="CustomerConsignees"
:url="`Clients/${route.params.id}/addresses`"
order="id"
auto-load
>
<template #body="{ rows }">
<QCard
v-for="(item, index) in rows"
:key="index"
:class="{
'consignees-card': true,
'q-mb-md': index < rows.length - 1,
}"
@click="toCustomerConsigneeEdit()"
>
<div class="consignees-card-icon">
<QIcon name="star" size="md" color="primary" />
</div>
<div>
<div class="text-weight-bold q-mb-sm">
{{ item.nickname }} - #{{ item.id }}
</div>
<div>{{ item.street }}</div>
<div>
{{ item.postalCode }} - {{ item.city }},
{{ setProvince(item.provinceFk) }}
</div>
<div class="flex">
<QCheckbox
:label="t('Is equalizated')"
v-model="item.isEqualizated"
class="q-mr-lg"
/>
<QCheckbox
:label="t('Is logiflora allowed')"
v-model="item.isLogifloraAllowed"
/>
</div>
</div>
</QCard>
<QPageSticky :offset="[18, 18]">
<QBtn
@click.stop="toCustomerConsigneeCreate()"
color="primary"
fab
icon="add"
/>
<QTooltip>
{{ t('New consignee') }}
</QTooltip>
</QPageSticky>
</template>
</VnPaginate>
</QCard>
</template> </template>
<style lang="scss" scoped>
.consignees-card {
border: 2px solid var(--vn-light-gray);
border-radius: 10px;
padding: 10px;
display: flex;
cursor: pointer;
&:hover {
background-color: var(--vn-light-gray);
}
}
.consignees-card-icon {
margin: 0 15px 0 5px;
display: flex;
align-items: center;
}
</style>
<i18n>
es:
Is equalizated: Recargo de equivalencia
Is logiflora allowed: Compra directa en Holanda
New consignee: Nuevo consignatario
</i18n>

View File

@ -4,9 +4,9 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import useCardDescription from 'src/composables/useCardDescription'; import useCardDescription from 'src/composables/useCardDescription';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -44,10 +44,10 @@ const setData = (entity) => (data.value = useCardDescription(entity.name, entity
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv v-if="entity.salesPersonUser" :label="t('customer.card.salesPerson')"> <VnLv v-if="entity.salesPersonUser" :label="t('customer.card.salesPerson')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ entity.salesPersonUser.name }} :name="entity.salesPersonUser?.name"
<WorkerDescriptorProxy :id="entity.salesPersonFk" /> :worker-id="entity.salesPersonFk"
</span> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('customer.card.credit')" :value="toCurrency(entity.credit)" /> <VnLv :label="t('customer.card.credit')" :value="toCurrency(entity.credit)" />

View File

@ -1,3 +1,295 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
const { t } = useI18n();
const route = useRoute();
const townsFetchDataRef = ref(null);
const postcodeFetchDataRef = ref(null);
const typesTaxes = ref([]);
const typesTransactions = ref([]);
const citiesLocationOptions = ref([]);
const provincesLocationOptions = ref([]);
const countriesOptions = ref([]);
const postcodesOptions = ref([]);
const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formData) => {
await postcodeFetchDataRef.value.fetch();
await townsFetchDataRef.value.fetch();
formData.postcode = code;
formData.provinceFk = provinceFk;
formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
formData.countryFk = countryFk;
};
</script>
<template> <template>
<div class="flex justify-center">Fiscal data</div> <fetch-data auto-load @on-fetch="(data) => (typesTaxes = data)" url="SageTaxTypes" />
<fetch-data
auto-load
@on-fetch="(data) => (typesTransactions = data)"
url="SageTransactionTypes"
/>
<FetchData
ref="townsFetchDataRef"
@on-fetch="(data) => (citiesLocationOptions = data)"
auto-load
url="Towns/location"
/>
<FetchData
@on-fetch="(data) => (provincesLocationOptions = data)"
auto-load
url="Provinces/location"
/>
<FetchData
@on-fetch="(data) => (countriesOptions = data)"
auto-load
url="Countries"
/>
<FetchData
ref="postcodeFetchDataRef"
url="Postcodes/location"
@on-fetch="(data) => (postcodesOptions = data)"
auto-load
/>
<FormModel
:url-update="`Clients/${route.params.id}/updateFiscalData`"
:url="`Clients/${route.params.id}/getCard`"
auto-load
model="customer"
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput
:label="t('Social name')"
:required="true"
:rules="validate('client.socialName')"
v-model="data.socialName"
/>
</div>
<div class="col">
<VnInput :label="t('Tax number')" v-model="data.fi" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('Street')" v-model="data.street" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Sage tax type')"
:options="typesTaxes"
hide-selected
option-label="vat"
option-value="id"
v-model="data.sageTaxTypeFk"
/>
</div>
<div class="col">
<VnSelectFilter
:label="t('Sage transaction type')"
:options="typesTransactions"
hide-selected
option-label="vat"
option-value="id"
v-model="data.sageTransactionTypeFk"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectCreate
:label="t('Postcode')"
:options="postcodesOptions"
:roles-allowed-to-create="['deliveryAssistant']"
:rules="validate('Worker.postcode')"
hide-selected
option-label="code"
option-value="code"
v-model="data.postcode"
>
<template #form>
<CustomerCreateNewPostcode
@on-data-saved="onPostcodeCreated($event, data)"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel>{{ scope.opt.code }}</QItemLabel>
<QItemLabel caption
>{{ scope.opt.code }} -
{{ scope.opt.town.name }} ({{
scope.opt.town.province.name
}},
{{
scope.opt.town.province.country.country
}})</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelectCreate>
</div>
<div class="col">
<VnSelectFilter
:label="t('City')"
:options="citiesLocationOptions"
hide-selected
option-label="name"
option-value="name"
v-model="data.city"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt.name }}</QItemLabel>
<QItemLabel caption>
{{
`${scope.opt.name}, ${scope.opt.province.name} (${scope.opt.province.country.country})`
}}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Province')"
:options="provincesLocationOptions"
hide-selected
option-label="name"
option-value="id"
v-model="data.provinceFk"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{
`${scope.opt.name} (${scope.opt.country.country})`
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</div>
<div class="col">
<VnSelectFilter
:label="t('Country')"
:options="countriesOptions"
hide-selected
option-label="country"
option-value="id"
v-model="data.countryFk"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox :label="t('Active')" v-model="data.isActive" />
</div>
<div class="col">
<QCheckbox :label="t('Frozen')" v-model="data.isFreezed" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox :label="t('Has to invoice')" v-model="data.hasToInvoice" />
</div>
<div class="col">
<QCheckbox :label="t('Vies')" v-model="data.isVies" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox
:label="t('Notify by email')"
v-model="data.isToBeMailed"
/>
</div>
<div class="col">
<QCheckbox
:label="t('Invoice by address')"
v-model="data.hasToInvoiceByAddress"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox
:label="t('Is equalizated')"
v-model="data.isEqualizated"
/>
</div>
<div class="col">
<QCheckbox
:label="t('Verified data')"
v-model="data.isTaxDataChecked"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox
:label="t('Incoterms authorization')"
v-model="data.hasIncoterms"
/>
</div>
<div class="col">
<QCheckbox
:label="t('Electronic invoice')"
v-model="data.hasElectronicInvoice"
/>
</div>
</VnRow>
</template>
</FormModel>
</template> </template>
<i18n>
es:
Social name: Razón social
Tax number: NIF / CIF
Street: Dirección fiscal
Sage tax type: Tipo de impuesto Sage
Sage transaction type: Tipo de transacción Sage
Postcode: Código postal
City: Población
Province: Provincia
Country: País
Active: Activo
Frozen: Congelado
Has to invoice: Factura
Vies: Vies
Notify by email: Notificar vía e-mail
Invoice by address: Facturar por consignatario
Is equalizated: Recargo de equivalencia
Verified data: Datos comprobados
Incoterms authorization: Autorización incoterms
Electronic invoice: Factura electrónica
</i18n>

View File

@ -1,3 +1,17 @@
<script setup>
import { useRoute } from 'vue-router';
import VnSms from 'src/components/ui/VnSms.vue';
const route = useRoute();
const id = route.params.id;
const where = {
clientFk: id,
ticketFk: null,
};
</script>
<template> <template>
<div class="flex justify-center">Sms</div> <div class="column items-center">
<VnSms url="clientSms" :where="where" />
</div>
</template> </template>

View File

@ -8,6 +8,7 @@ import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue'; import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
@ -29,6 +30,7 @@ const newClientForm = reactive({
}); });
const postcodeFetchDataRef = ref(null); const postcodeFetchDataRef = ref(null);
const townsFetchDataRef = ref(null);
const workersOptions = ref([]); const workersOptions = ref([]);
const businessTypesOptions = ref([]); const businessTypesOptions = ref([]);
const citiesLocationOptions = ref([]); const citiesLocationOptions = ref([]);
@ -36,8 +38,13 @@ const provincesLocationOptions = ref([]);
const countriesOptions = ref([]); const countriesOptions = ref([]);
const postcodesOptions = ref([]); const postcodesOptions = ref([]);
const onPostcodeCreated = async () => { const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formData) => {
postcodeFetchDataRef.value.fetch(); await postcodeFetchDataRef.value.fetch();
await townsFetchDataRef.value.fetch();
formData.postcode = code;
formData.provinceFk = provinceFk;
formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
formData.countryFk = countryFk;
}; };
</script> </script>
@ -59,6 +66,7 @@ const onPostcodeCreated = async () => {
url="BusinessTypes" url="BusinessTypes"
/> />
<FetchData <FetchData
ref="townsFetchDataRef"
@on-fetch="(data) => (citiesLocationOptions = data)" @on-fetch="(data) => (citiesLocationOptions = data)"
auto-load auto-load
url="Towns/location" url="Towns/location"
@ -74,14 +82,9 @@ const onPostcodeCreated = async () => {
url="Countries" url="Countries"
/> />
<QPage> <QPage>
<QToolbar class="bg-vn-dark"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FormModel <FormModel
:form-initial-data="newClientForm" :form-initial-data="newClientForm"
:observe-form-changes="false"
model="client" model="client"
url-create="Clients/createWithUser" url-create="Clients/createWithUser"
> >
@ -148,7 +151,7 @@ const onPostcodeCreated = async () => {
> >
<template #form> <template #form>
<CustomerCreateNewPostcode <CustomerCreateNewPostcode
@on-data-saved="onPostcodeCreated($event)" @on-data-saved="onPostcodeCreated($event, data)"
/> />
</template> </template>
<template #option="scope"> <template #option="scope">

View File

@ -14,9 +14,9 @@ const { t } = useI18n();
</script> </script>
<template> <template>
<div class="card_balance"> <div class="card_balance q-px-md q-py-sm q-my-sm">
<h6 class="title_balance">{{ t('Total') }}</h6> <h6 class="title_balance text-center">{{ t('Total') }}</h6>
<div style="display: flex"> <div class="row">
<p class="key_balance">{{ t('Balance due') }}:&ensp;</p> <p class="key_balance">{{ t('Balance due') }}:&ensp;</p>
<b class="value_balance"> <b class="value_balance">
{{ toCurrency($props.amount) }} {{ toCurrency($props.amount) }}
@ -28,21 +28,18 @@ const { t } = useI18n();
<style lang="scss"> <style lang="scss">
.card_balance { .card_balance {
border: 1px solid black; border: 1px solid black;
margin: 7px;
padding: 5px 7px;
} }
.title_balance { .title_balance {
color: white; color: var(--vn-text);
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
text-align: center;
} }
.key_balance { .key_balance {
color: grey; color: var(--vn-label);
margin-bottom: 0; margin-bottom: 0;
} }
.value_balance { .value_balance {
color: white; color: var(--vn-text);
margin-bottom: 0; margin-bottom: 0;
} }
</style> </style>

View File

@ -2,7 +2,7 @@
import { ref, computed, onBeforeMount } from 'vue'; import { ref, computed, onBeforeMount } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox } from 'quasar'; import { QBtn, QCheckbox, useQuasar } from 'quasar';
import { toCurrency, toDate } from 'filters/index'; import { toCurrency, toDate } from 'filters/index';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
@ -12,53 +12,37 @@ 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';
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
const quasar = useQuasar();
const arrayData = ref(null); const arrayData = ref(null);
const balanceDueTotal = ref(0); const balanceDueTotal = ref(0);
const customerId = ref(0);
onBeforeMount(async () => { const selected = ref([]);
arrayData.value = useArrayData('CustomerDefaulter', { const workerId = ref(0);
url: 'Defaulters/filter',
limit: 0,
});
await arrayData.value.fetch({ append: false });
balanceDueTotal.value = arrayData.value.store.data.reduce(
(accumulator, currentValue) => {
return accumulator + (currentValue['amount'] || 0);
},
0
);
console.log(balanceDueTotal.value);
stateStore.rightDrawer = true;
});
const rows = computed(() => arrayData.value.store.data); const rows = computed(() => arrayData.value.store.data);
const selected = ref([]);
const worderId = ref(0);
const customerId = ref(0);
const tableColumnComponents = { const tableColumnComponents = {
client: { client: {
component: QBtn, component: QBtn,
props: () => ({ flat: true, color: 'blue' }), props: () => ({ flat: true, color: 'blue' }),
event: (prop) => selectClientId(prop.row.clientFk), event: ({ row }) => selectCustomerId(row.clientFk),
}, },
isWorker: { isWorker: {
component: QCheckbox, component: QCheckbox,
props: (prop) => ({ props: ({ row }) => ({
disable: true, disable: true,
'model-value': Boolean(prop.value), 'model-value': Boolean(row.selected),
}), }),
event: () => {},
}, },
salesperson: { salesperson: {
component: QBtn, component: QBtn,
props: () => ({ flat: true, color: 'blue' }), props: () => ({ flat: true, color: 'blue' }),
event: (prop) => selectSalespersonId(prop.row.salesPersonFk), event: ({ row }) => selectWorkerId(row.salesPersonFk),
}, },
country: { country: {
component: 'span', component: 'span',
@ -78,7 +62,7 @@ const tableColumnComponents = {
author: { author: {
component: QBtn, component: QBtn,
props: () => ({ flat: true, color: 'blue' }), props: () => ({ flat: true, color: 'blue' }),
event: (prop) => selectAuthorId(prop.row.workerFk), event: ({ row }) => selectWorkerId(row.workerFk),
}, },
lastObservation: { lastObservation: {
component: 'span', component: 'span',
@ -102,8 +86,7 @@ const tableColumnComponents = {
}, },
}; };
const columns = computed(() => { const columns = computed(() => [
return [
{ {
align: 'left', align: 'left',
field: 'clientName', field: 'clientName',
@ -136,7 +119,7 @@ const columns = computed(() => {
}, },
{ {
align: 'left', align: 'left',
field: (row) => toCurrency(row.amount), field: ({ amount }) => toCurrency(amount),
label: t('Balance D.'), label: t('Balance D.'),
name: 'balance', name: 'balance',
}, },
@ -154,38 +137,65 @@ const columns = computed(() => {
}, },
{ {
align: 'left', align: 'left',
field: (row) => toDate(row.created), field: ({ created }) => toDate(created),
label: t('L. O. Date'), label: t('L. O. Date'),
name: 'date', name: 'date',
}, },
{ {
align: 'left', align: 'left',
field: (row) => toCurrency(row.creditInsurance), field: ({ creditInsurance }) => toCurrency(creditInsurance),
label: t('Credit I.'), label: t('Credit I.'),
name: 'credit', name: 'credit',
}, },
{ {
align: 'left', align: 'left',
field: (row) => toDate(row.defaulterSinced), field: ({ defaulterSinced }) => toDate(defaulterSinced),
label: t('From'), label: t('From'),
name: 'from', name: 'from',
}, },
]; ]);
onBeforeMount(() => {
getArrayData();
}); });
const selectClientId = (id) => { const getArrayData = async () => {
worderId.value = 0; arrayData.value = useArrayData('CustomerDefaulter', {
url: 'Defaulters/filter',
limit: 0,
});
await arrayData.value.fetch({ append: false });
balanceDueTotal.value = arrayData.value.store.data.reduce(
(accumulator, currentValue) => {
return accumulator + (currentValue['amount'] || 0);
},
0
);
stateStore.rightDrawer = true;
};
const selectCustomerId = (id) => {
workerId.value = 0;
customerId.value = id; customerId.value = id;
}; };
const selectSalespersonId = (id) => { const selectWorkerId = (id) => {
customerId.value = 0; customerId.value = 0;
worderId.value = id; workerId.value = id;
}; };
const selectAuthorId = (id) => { const viewAddObservation = (rowsSelected) => {
customerId.value = 0; quasar.dialog({
worderId.value = id; component: CustomerDefaulterAddObservation,
componentProps: {
clients: rowsSelected,
promise: refreshData,
},
});
};
const refreshData = () => {
getArrayData();
}; };
</script> </script>
@ -197,11 +207,17 @@ const selectAuthorId = (id) => {
</QDrawer> </QDrawer>
<QToolbar class="bg-vn-dark"> <QToolbar class="bg-vn-dark">
<div id="st-data"> <div id="st-data" class="row">
<CustomerBalanceDueTotal :amount="balanceDueTotal" /> <CustomerBalanceDueTotal :amount="balanceDueTotal" />
<div class="flex items-center q-ml-lg">
<QBtn
color="primary"
icon="vn:notes"
:disabled="!selected.length"
@click.stop="viewAddObservation(selected)"
/>
</div>
</div> </div>
<QSpace />
<div id="st-actions"></div>
</QToolbar> </QToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
@ -211,7 +227,7 @@ const selectAuthorId = (id) => {
:rows="rows" :rows="rows"
class="full-width q-mt-md" class="full-width q-mt-md"
hide-bottom hide-bottom
row-key="id" row-key="clientFk"
selection="multiple" selection="multiple"
v-model:selected="selected" v-model:selected="selected"
> >
@ -226,7 +242,7 @@ const selectAuthorId = (id) => {
> >
{{ props.value }} {{ props.value }}
<WorkerDescriptorProxy v-if="worderId" :id="worderId" /> <WorkerDescriptorProxy v-if="workerId" :id="workerId" />
<CustomerDescriptorProxy v-else :id="customerId" /> <CustomerDescriptorProxy v-else :id="customerId" />
</component> </component>
</QTr> </QTr>
@ -239,7 +255,7 @@ const selectAuthorId = (id) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.col-content { .col-content {
border-radius: 4px; border-radius: 4px;
padding: 6px 6px 6px 6px; padding: 6px;
} }
</style> </style>

View File

@ -0,0 +1,100 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { useQuasar } from 'quasar';
import VnRow from 'components/ui/VnRow.vue';
const $props = defineProps({
clients: {
type: Array,
required: true,
},
promise: {
type: Function,
required: true,
},
});
const { t } = useI18n();
const quasar = useQuasar();
const newObservation = ref(null);
const onSubmit = async () => {
try {
const data = $props.clients.map((item) => {
return { clientFk: item.clientFk, text: newObservation.value };
});
await axios.post('ClientObservations', data);
const payload = {
defaulters: $props.clients,
observation: newObservation.value,
};
await axios.post('Defaulters/observationEmail', payload);
await $props.promise();
quasar.notify({
message: t('globals.dataSaved'),
type: 'positive',
});
} catch (error) {
quasar.notify({
message: t(`${error.message}`),
type: 'negative',
});
}
};
</script>
<template>
<QDialog ref="dialogRef">
<QCard class="q-pa-md q-mb-md">
<QCardSection>
<QForm @submit="onSubmit()" class="q-pa-sm">
<div>
{{
t('Add observation to all selected clients', {
numberClients: t($props.clients.length),
})
}}
</div>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QInput
:label="t('Message')"
type="textarea"
v-model="newObservation"
/>
</div>
</VnRow>
<div class="q-mt-lg row justify-end">
<QBtn
:label="t('globals.cancel')"
color="primary"
flat
class="q-mr-md"
v-close-popup
/>
<QBtn
:label="t('globals.save')"
type="submit"
color="primary"
v-close-popup
/>
</div>
</QForm>
</QCardSection>
</QCard>
</QDialog>
</template>
<i18n>
es:
Add observation to all selected clients: Añadir observación a { numberClients } cliente(s) seleccionado(s)
Message: Mensaje
</i18n>

View File

@ -262,8 +262,7 @@ const tableColumnComponents = {
}, },
}; };
const columns = computed(() => { const columns = computed(() => [
return [
{ {
align: 'left', align: 'left',
field: '', field: '',
@ -469,8 +468,7 @@ const columns = computed(() => {
label: '', label: '',
name: 'actions', name: 'actions',
}, },
]; ]);
});
const stopEventPropagation = (event, col) => { const stopEventPropagation = (event, col) => {
if (!['id', 'salesPersonFk'].includes(col.name)) return; if (!['id', 'salesPersonFk'].includes(col.name)) return;
@ -565,6 +563,6 @@ const selectSalesPersonId = (id) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.col-content { .col-content {
border-radius: 4px; border-radius: 4px;
padding: 6px 6px 6px 6px; padding: 6px;
} }
</style> </style>

View File

@ -613,6 +613,5 @@ const shouldRenderColumn = (colName) => {
<i18n> <i18n>
es: es:
Identifier: Identificador
Social name: Razón social Social name: Razón social
</i18n> </i18n>

View File

@ -9,6 +9,7 @@ import { useStateStore } from 'stores/useStateStore';
import CustomerNotificationsFilter from './CustomerNotificationsFilter.vue'; import CustomerNotificationsFilter from './CustomerNotificationsFilter.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -57,8 +58,7 @@ const tableColumnComponents = {
}, },
}; };
const columns = computed(() => { const columns = computed(() => [
return [
{ {
align: 'left', align: 'left',
field: 'id', field: 'id',
@ -89,8 +89,7 @@ const columns = computed(() => {
label: t('Email'), label: t('Email'),
name: 'email', name: 'email',
}, },
]; ]);
});
const selectCustomerId = (id) => { const selectCustomerId = (id) => {
selectedCustomerId.value = id; selectedCustomerId.value = id;
@ -104,11 +103,7 @@ const selectCustomerId = (id) => {
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QToolbar class="bg-vn-dark"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable
@ -143,7 +138,7 @@ const selectCustomerId = (id) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.col-content { .col-content {
border-radius: 4px; border-radius: 4px;
padding: 6px 6px 6px 6px; padding: 6px;
} }
</style> </style>

View File

@ -123,8 +123,7 @@ function stateColor(row) {
</QDrawer> </QDrawer>
<QPage class="column items-center q-pa-md customer-payments"> <QPage class="column items-center q-pa-md customer-payments">
<div class="card-list"> <div class="card-list">
<QToolbar class="q-pa-none"> <QToolbar class="q-pa-none justify-end">
<QToolbarTitle>{{ t('Web Payments') }}</QToolbarTitle>
<QBtn <QBtn
@click="arrayData.refresh()" @click="arrayData.refresh()"
:loading="isLoading" :loading="isLoading"
@ -133,7 +132,7 @@ function stateColor(row) {
class="q-mr-sm" class="q-mr-sm"
round round
dense dense
></QBtn> />
<QBtn @click="grid = !grid" icon="list" color="primary" round dense> <QBtn @click="grid = !grid" icon="list" color="primary" round dense>
<QTooltip>{{ t('Change view') }}</QTooltip> <QTooltip>{{ t('Change view') }}</QTooltip>
</QBtn> </QBtn>

View File

@ -0,0 +1,258 @@
<script setup>
import { onBeforeMount, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import CustomsNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
const { t } = useI18n();
const route = useRoute();
const formInitialData = reactive({
isDefaultAddress: false,
nickname: null,
street: null,
postalCode: null,
city: null,
provinceFk: null,
agencyModeFk: null,
phone: null,
mobile: null,
incotermsFk: null,
customsAgentFk: null,
});
const townsFetchDataRef = ref(null);
const postcodeFetchDataRef = ref(null);
const agencyModes = ref([]);
const incoterms = ref([]);
const customsAgents = ref([]);
const citiesLocationOptions = ref([]);
const provincesLocationOptions = ref([]);
const postcodesOptions = ref([]);
const urlCreate = ref('');
onBeforeMount(() => {
urlCreate.value = `Clients/${route.params.id}/createAddress`;
});
const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
await postcodeFetchDataRef.value.fetch();
await townsFetchDataRef.value.fetch();
formData.postalCode = code;
formData.provinceFk = provinceFk;
formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
};
</script>
<template>
<FetchData
ref="postcodeFetchDataRef"
@on-fetch="(data) => (postcodesOptions = data)"
auto-load
url="Postcodes/location"
/>
<FetchData
ref="townsFetchDataRef"
@on-fetch="(data) => (citiesLocationOptions = data)"
auto-load
url="Towns/location"
/>
<FetchData
@on-fetch="(data) => (provincesLocationOptions = data)"
auto-load
url="Provinces/location"
/>
<fetch-data
@on-fetch="(data) => (agencyModes = data)"
auto-load
url="AgencyModes/isActive"
/>
<fetch-data @on-fetch="(data) => (incoterms = data)" auto-load url="Incoterms" />
<fetch-data
@on-fetch="(data) => (customsAgents = data)"
auto-load
url="CustomsAgents"
/>
<FormModel
:form-initial-data="formInitialData"
:observe-form-changes="false"
model="client"
:url-create="urlCreate"
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox :label="t('Default')" v-model="data.isDefaultAddress" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('Consignee')" v-model="data.nickname" />
</div>
<div class="col">
<VnInput :label="t('Street address')" v-model="data.street" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectCreate
:label="t('Postcode')"
:options="postcodesOptions"
:roles-allowed-to-create="['deliveryAssistant']"
:rules="validate('Worker.postcode')"
hide-selected
option-label="code"
option-value="code"
v-model="data.postalCode"
>
<template #form>
<CustomerCreateNewPostcode
@on-data-saved="onPostcodeCreated($event, data)"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel>{{ scope.opt.code }}</QItemLabel>
<QItemLabel caption>
{{ scope.opt.code }} -
{{ scope.opt.town.name }}
({{ scope.opt.town.province.name }},
{{ scope.opt.town.province.country.country }})
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectCreate>
</div>
<div class="col">
<!-- ciudades -->
<VnSelectFilter
:label="t('City')"
:options="citiesLocationOptions"
hide-selected
option-label="name"
option-value="name"
v-model="data.city"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt.name }}</QItemLabel>
<QItemLabel caption>
{{
`${scope.opt.name}, ${scope.opt.province.name} (${scope.opt.province.country.country})`
}}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Province')"
:options="provincesLocationOptions"
hide-selected
option-label="name"
option-value="id"
v-model="data.provinceFk"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{
`${scope.opt.name} (${scope.opt.country.country})`
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</div>
<div class="col">
<VnSelectFilter
:label="t('Agency')"
:options="agencyModes"
hide-selected
option-label="name"
option-value="id"
v-model="data.agencyModeFk"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('Phone')" v-model="data.phone" />
</div>
<div class="col">
<VnInput :label="t('Mobile')" v-model="data.mobile" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Incoterms')"
:options="incoterms"
hide-selected
option-label="name"
option-value="code"
v-model="data.incotermsFk"
/>
</div>
<div class="col">
<VnSelectCreate
:label="t('Customs agent')"
:options="customsAgents"
hide-selected
option-label="fiscalName"
option-value="id"
v-model="data.customsAgentFk"
>
<template #form>
<CustomsNewCustomsAgent />
</template>
</VnSelectCreate>
</div>
</VnRow>
</template>
</FormModel>
</template>
<style lang="scss" scoped>
.add-icon {
cursor: pointer;
background-color: $primary;
border-radius: 50px;
}
</style>
<i18n>
es:
Default: Predeterminado
Consignee: Consignatario
Street address: Dirección postal
Postcode: Código postal
City: Población
Province: Provincia
Agency: Agencia
Phone: Teléfono
Mobile: Movíl
Incoterms: Incoterms
Customs agent: Agente de aduanas
</i18n>

View File

@ -0,0 +1,3 @@
<template>
<div class="flex justify-center">Customer consignee edit</div>
</template>

View File

@ -0,0 +1,65 @@
<script setup>
import { reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FormModelPopup from 'src/components/FormModelPopup.vue';
const emit = defineEmits(['onDataSaved']);
const { t } = useI18n();
const initialData = reactive({
nif: null,
fiscalName: null,
street: null,
phone: null,
});
const onDataSaved = (dataSaved) => {
emit('onDataSaved', dataSaved);
};
</script>
<template>
<FormModelPopup
:title="t('New customs agent')"
url-create="CustomsAgents"
model="customer"
:form-initial-data="initialData"
@on-data-saved="onDataSaved($event)"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('NIF')" :required="true" v-model="data.nif" />
</div>
<div class="col">
<VnInput
:label="t('Fiscal name')"
:required="true"
v-model="data.fiscalName"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput :label="t('Street')" v-model="data.street" />
</div>
<div class="col">
<VnInput :label="t('Phone')" v-model="data.phone" />
</div>
</VnRow>
</template>
</FormModelPopup>
</template>
<i18n>
es:
New customs agent: Nuevo agente de aduanas
NIF: NIF
Fiscal name: Nombre fiscal
Street: Dirección fiscal
Phone: Teléfono
</i18n>

View File

@ -2,6 +2,7 @@
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import DepartmentDescriptor from 'pages/Department/Card/DepartmentDescriptor.vue'; import DepartmentDescriptor from 'pages/Department/Card/DepartmentDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
</script> </script>
@ -15,11 +16,8 @@ const stateStore = useStateStore();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md column items-center"> <div class="q-pa-md column items-center">
<RouterView></RouterView> <RouterView></RouterView>
</div> </div>

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
</script> </script>
@ -15,11 +16,8 @@ const stateStore = useStateStore();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -0,0 +1,379 @@
<script setup>
import { onMounted, ref, computed, onUpdated } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnRow from 'components/ui/VnRow.vue';
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import { toDate, toCurrency } from 'src/filters';
import { getUrl } from 'src/composables/getUrl';
import axios from 'axios';
onUpdated(() => summaryRef.value.fetch());
const route = useRoute();
const { t } = useI18n();
const $props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const entityId = computed(() => $props.id || route.params.id);
const summaryRef = ref();
const entry = ref();
const entryBuys = ref([]);
const entryUrl = ref();
onMounted(async () => {
entryUrl.value = (await getUrl('entry/')) + entityId.value;
});
const tableColumnComponents = {
quantity: {
component: () => 'span',
props: () => {},
},
stickers: {
component: () => 'span',
props: () => {},
event: () => {},
},
packagingFk: {
component: () => 'span',
props: () => {},
event: () => {},
},
weight: {
component: () => 'span',
props: () => {},
event: () => {},
},
packing: {
component: () => 'span',
props: () => {},
event: () => {},
},
grouping: {
component: () => 'span',
props: () => {},
event: () => {},
},
buyingValue: {
component: () => 'span',
props: () => {},
event: () => {},
},
amount: {
component: () => 'span',
props: () => {},
event: () => {},
},
pvp: {
component: () => 'span',
props: () => {},
event: () => {},
},
};
const entriesTableColumns = computed(() => {
return [
{
label: t('entry.summary.quantity'),
field: 'quantity',
name: 'quantity',
align: 'left',
},
{
label: t('entry.summary.stickers'),
field: 'stickers',
name: 'stickers',
align: 'left',
},
{
label: t('entry.summary.package'),
field: 'packagingFk',
name: 'packagingFk',
align: 'left',
},
{
label: t('entry.summary.weight'),
field: 'weight',
name: 'weight',
align: 'left',
},
{
label: t('entry.summary.packing'),
field: 'packing',
name: 'packing',
align: 'left',
},
{
label: t('entry.summary.grouping'),
field: 'grouping',
name: 'grouping',
align: 'left',
},
{
label: t('entry.summary.buyingValue'),
field: 'buyingValue',
name: 'buyingValue',
align: 'left',
format: (value) => toCurrency(value),
},
{
label: t('entry.summary.import'),
name: 'amount',
align: 'left',
format: (_, row) => toCurrency(row.buyingValue * row.quantity),
},
{
label: t('entry.summary.pvp'),
name: 'pvp',
align: 'left',
format: (_, row) => toCurrency(row.price2) + ' / ' + toCurrency(row.price3),
},
];
});
async function setEntryData(data) {
if (data) entry.value = data;
await fetchEntryBuys();
}
const fetchEntryBuys = async () => {
try {
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
if (data) entryBuys.value = data;
} catch (err) {
console.error('Error fetching entry buys');
}
};
</script>
<template>
<CardSummary
ref="summaryRef"
:url="`Entries/${entityId}/getEntry`"
@on-fetch="(data) => setEntryData(data)"
>
<template #header-left>
<a class="header link" :href="entryUrl">
<QIcon name="open_in_new" color="white" size="sm" />
</a>
</template>
<template #header>
<span>{{ entry.id }} - {{ entry.supplier.nickname }}</span>
</template>
<template #body>
<QCard class="vn-one">
<a class="header link" :href="entryUrl">
{{ t('globals.summary.basicData') }}
<QIcon name="open_in_new" color="primary" />
</a>
<VnRow>
<div class="col">
<VnLv
:label="t('entry.summary.commission')"
:value="entry.commission"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.currency')"
:value="entry.currency.name"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.company')"
:value="entry.company.code"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.reference')"
:value="entry.reference"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.invoiceNumber')"
:value="entry.invoiceNumber"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.ordered')"
:value="entry.isOrdered"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.confirmed')"
:value="entry.isConfirmed"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.booked')"
:value="entry.isBooked"
/>
</div>
<div class="col">
<VnLv :label="t('entry.summary.raid')" :value="entry.isRaid" />
</div>
<div class="col">
<VnLv
:label="t('entry.summary.excludedFromAvailable')"
:value="entry.isExcludedFromAvailable"
/>
</div>
</VnRow>
</QCard>
<QCard class="vn-one">
<a class="header link" :href="entryUrl">
{{ t('Travel data') }}
<QIcon name="open_in_new" color="primary" />
</a>
<VnRow>
<div class="col">
<VnLv :label="t('entry.summary.travelReference')">
<template #value>
<span class="link">
{{ entry.travel.ref }}
<TravelDescriptorProxy :id="entry.travel.id" />
</span>
</template>
</VnLv>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.travelAgency')"
:value="entry.travel.agency.name"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.travelShipped')"
:value="toDate(entry.travel.shipped)"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.travelWarehouseOut')"
:value="entry.travel.warehouseOut.name"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.travelDelivered')"
:value="entry.travel.isDelivered"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.travelLanded')"
:value="toDate(entry.travel.landed)"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.travelWarehouseIn')"
:value="entry.travel.warehouseIn.name"
/>
</div>
<div class="col">
<VnLv
:label="t('entry.summary.travelReceived')"
:value="entry.travel.isReceived"
/>
</div>
</VnRow>
</QCard>
<QCard class="vn-two" style="min-width: 100%">
<a class="header">
{{ t('entry.summary.buys') }}
</a>
<QTable
:rows="entryBuys"
:columns="entriesTableColumns"
hide-bottom
row-key="index"
class="full-width q-mt-md"
>
<template #body="{ cols, row, rowIndex }">
<QTr no-hover>
<QTd v-for="col in cols" :key="col.name">
<component
:is="tableColumnComponents[col.name].component(props)"
v-bind="tableColumnComponents[col.name].props(props)"
@click="tableColumnComponents[col.name].event(props)"
class="col-content"
>
<template
v-if="
col.name !== 'observation' &&
col.name !== 'isConfirmed'
"
>{{ col.value }}</template
>
<QTooltip v-if="col.toolTip">{{
col.toolTip
}}</QTooltip>
</component>
</QTd>
</QTr>
<QTr no-hover>
<QTd>
<span>{{ row.item.itemType.code }}</span>
</QTd>
<QTd>
<span>{{ row.item.id }}</span>
</QTd>
<QTd>
<span>{{ row.item.size }}</span>
</QTd>
<QTd>
<span>{{ toCurrency(row.item.minPrice) }}</span>
</QTd>
<QTd colspan="6">
<span>{{ row.item.concept }}</span>
<span v-if="row.item.subName" class="subName">
{{ row.item.subName }}
</span>
<fetched-tags :item="row.item" :max-length="5" />
</QTd>
</QTr>
<!-- Esta última row es utilizada para agregar un espaciado y así marcar una diferencia visual entre los diferentes buys -->
<QTr
v-if="rowIndex !== entryBuys.length - 1"
class="separation-row"
>
<QTd colspan="10" style="height: 24px" />
</QTr>
</template>
</QTable>
</QCard>
</template>
</CardSummary>
</template>
<style lang="scss" scoped>
.separation-row {
background-color: var(--vn-gray) !important;
}
</style>
<i18n>
es:
Travel data: 'Datos envío'
</i18n>

View File

@ -0,0 +1,29 @@
<script setup>
import { useDialogPluginComponent } from 'quasar';
import EntrySummary from './EntrySummary.vue';
const $props = defineProps({
id: {
type: Number,
required: true,
},
});
defineEmits([...useDialogPluginComponent.emits]);
const { dialogRef, onDialogHide } = useDialogPluginComponent();
</script>
<template>
<QDialog ref="dialogRef" @hide="onDialogHide">
<EntrySummary v-if="$props.id" :id="$props.id" />
</QDialog>
</template>
<style lang="scss">
.q-dialog .summary .header {
position: sticky;
z-index: $z-max;
top: 0;
}
</style>

View File

@ -7,6 +7,7 @@ import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue'; import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { toDate } from 'src/filters'; import { toDate } from 'src/filters';
@ -51,22 +52,19 @@ const companiesOptions = ref([]);
<!-- Agregar searchbar de entries --> <!-- Agregar searchbar de entries -->
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FormModel url-create="Entries" model="entry" :form-initial-data="newEntryForm"> <FormModel url-create="Entries" model="entry" :form-initial-data="newEntryForm">
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnSelectFilter <VnSelectFilter
:label="t('Supplier *')" :label="t('Supplier')"
class="full-width" class="full-width"
v-model="data.supplierFk" v-model="data.supplierFk"
:options="suppliersOptions" :options="suppliersOptions"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
hide-selected hide-selected
:required="true"
:rules="validate('entry.supplierFk')" :rules="validate('entry.supplierFk')"
> >
<template #option="scope"> <template #option="scope">
@ -83,7 +81,7 @@ const companiesOptions = ref([]);
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnSelectFilter <VnSelectFilter
:label="t('Travel *')" :label="t('Travel')"
class="full-width" class="full-width"
v-model="data.travelFk" v-model="data.travelFk"
:options="travelsOptionsOptions" :options="travelsOptionsOptions"
@ -91,6 +89,7 @@ const companiesOptions = ref([]);
option-label="warehouseInName" option-label="warehouseInName"
map-options map-options
hide-selected hide-selected
:required="true"
:rules="validate('entry.travelFk')" :rules="validate('entry.travelFk')"
> >
<template #option="scope"> <template #option="scope">
@ -111,7 +110,7 @@ const companiesOptions = ref([]);
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<VnSelectFilter <VnSelectFilter
:label="t('Company *')" :label="t('Company')"
class="full-width" class="full-width"
v-model="data.companyFk" v-model="data.companyFk"
:options="companiesOptions" :options="companiesOptions"
@ -119,6 +118,7 @@ const companiesOptions = ref([]);
option-label="code" option-label="code"
map-options map-options
hide-selected hide-selected
:required="true"
:rules="validate('entry.companyFk')" :rules="validate('entry.companyFk')"
/> />
</VnRow> </VnRow>
@ -129,7 +129,7 @@ const companiesOptions = ref([]);
<i18n> <i18n>
es: es:
Supplier *: Proveedor * Supplier: Proveedor
Travel *: Envío * Travel: Envío
Company *: Empresa * Company: Empresa
</i18n> </i18n>

View File

@ -1,22 +1,150 @@
<script setup> <script setup>
import { onMounted, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useQuasar } from 'quasar';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue';
import EntrySummaryDialog from './Card/EntrySummaryDialog.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'src/filters/index';
const stateStore = useStateStore();
const router = useRouter(); const router = useRouter();
const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
onMounted(async () => {
stateStore.rightDrawer = true;
});
onUnmounted(() => (stateStore.rightDrawer = false));
function navigate(id) {
router.push({ path: `/entry/${id}` });
}
const redirectToCreateView = () => { const redirectToCreateView = () => {
router.push({ name: 'EntryCreate' }); router.push({ name: 'EntryCreate' });
}; };
function viewSummary(id) {
quasar.dialog({
component: EntrySummaryDialog,
componentProps: {
id,
},
});
}
</script> </script>
<template> <template>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar">
<VnSearchbar
data-key="EntryList"
:label="t('Search entries')"
:info="t('You can search by entry reference')"
/>
</Teleport>
</template>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<div class="card-list">
<VnPaginate
data-key="EntryList"
url="Entries/filter"
order="landed DESC, id DESC"
auto-load
>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:title="row.reference"
@click="navigate(row.id)"
:id="row.id"
:has-info-icons="!!row.isExcludedFromAvailable || !!row.isRaid"
>
<template #info-icons>
<QIcon
v-if="row.isExcludedFromAvailable"
name="vn:inventory"
color="primary"
size="xs"
>
<QTooltip>{{ t('Inventory entry') }}</QTooltip>
</QIcon>
<QIcon
v-if="row.isRaid"
name="vn:web"
color="primary"
size="xs"
>
<QTooltip>{{ t('Virtual entry') }}</QTooltip>
</QIcon>
</template>
<template #list-items>
<VnLv
:label="t('entry.list.landed')"
:value="toDate(row.landed)"
/>
<VnLv
:label="t('entry.list.booked')"
:value="!!row.isBooked"
/>
<VnLv
:label="t('entry.list.invoiceNumber')"
:value="row.invoiceNumber"
/>
<VnLv
:label="t('entry.list.confirmed')"
:value="!!row.isConfirmed"
/>
<VnLv
:label="t('entry.list.supplier')"
:value="row.supplierName"
/>
<VnLv
:label="t('entry.list.ordered')"
:value="!!row.isOrdered"
/>
</template>
<template #actions>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id)"
color="primary"
type="submit"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" /> <QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
<QTooltip> <QTooltip>
{{ t('entry.list.newEntry') }} {{ t('entry.list.newEntry') }}
</QTooltip> </QTooltip>
</QPageSticky> </QPageSticky>
</QPage>
</template> </template>
<style lang="scss" scoped>
.card-list {
width: 100%;
max-width: 60em;
}
</style>
<i18n>
es:
Search entries: Buscar entradas
You can search by entry reference: Puedes buscar por referencia de la entrada
Inventory entry: Es inventario
Virtual entry: Es una redada
</i18n>

View File

@ -23,6 +23,7 @@ const userConfig = ref(null);
const suppliers = ref([]); const suppliers = ref([]);
const suppliersRef = ref(); const suppliersRef = ref();
const suppliersRefFilter = ref({ fields: ['id', 'nickname'], limit: 30 });
const currencies = ref([]); const currencies = ref([]);
const currenciesRef = ref(); const currenciesRef = ref();
const companies = ref([]); const companies = ref([]);
@ -130,13 +131,24 @@ async function upsert() {
}); });
} }
} }
function supplierRefFilter(val) {
let where = { limit: 30 };
let params = {};
let key = 'nickname';
if (new RegExp(/\d/g).test(val)) {
key = 'id';
}
params = { [key]: { like: `%${val}%` } };
where = Object.assign(where, params);
suppliersRef.value.fetch({ where });
}
</script> </script>
<template> <template>
<FetchData <FetchData
ref="suppliersRef" ref="suppliersRef"
url="Suppliers" url="Suppliers"
:filter="{ fields: ['id', 'nickname'] }"
limit="30"
@on-fetch="(data) => (suppliers = data)" @on-fetch="(data) => (suppliers = data)"
/> />
<FetchData <FetchData
@ -145,6 +157,7 @@ async function upsert() {
:filter="{ fields: ['id', 'code'] }" :filter="{ fields: ['id', 'code'] }"
order="code" order="code"
@on-fetch="(data) => (currencies = data)" @on-fetch="(data) => (currencies = data)"
auto-load
/> />
<FetchData <FetchData
ref="companiesRef" ref="companiesRef"
@ -152,6 +165,7 @@ async function upsert() {
:filter="{ fields: ['id', 'code'] }" :filter="{ fields: ['id', 'code'] }"
order="code" order="code"
@on-fetch="(data) => (companies = data)" @on-fetch="(data) => (companies = data)"
auto-load
/> />
<FetchData <FetchData
ref="dmsTypesRef" ref="dmsTypesRef"
@ -159,6 +173,7 @@ async function upsert() {
:filter="{ fields: ['id', 'name'] }" :filter="{ fields: ['id', 'name'] }"
order="name" order="name"
@on-fetch="(data) => (dmsTypes = data)" @on-fetch="(data) => (dmsTypes = data)"
auto-load
/> />
<FetchData <FetchData
ref="warehousesRef" ref="warehousesRef"
@ -166,11 +181,13 @@ async function upsert() {
:filter="{ fields: ['id', 'name'] }" :filter="{ fields: ['id', 'name'] }"
order="name" order="name"
@on-fetch="(data) => (warehouses = data)" @on-fetch="(data) => (warehouses = data)"
auto-load
/> />
<FetchData <FetchData
ref="allowTypesRef" ref="allowTypesRef"
url="DmsContainers/allowedContentTypes" url="DmsContainers/allowedContentTypes"
@on-fetch="(data) => (allowedContentTypes = data)" @on-fetch="(data) => (allowedContentTypes = data)"
auto-load
/> />
<FetchData <FetchData
url="UserConfigs/getUserConfig" url="UserConfigs/getUserConfig"
@ -189,7 +206,8 @@ async function upsert() {
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:input-debounce="100" :input-debounce="100"
@input-value="suppliersRef.fetch()" @input-value="supplierRefFilter"
:default-filter="false"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -406,7 +424,6 @@ async function upsert() {
:options="currencies" :options="currencies"
option-value="id" option-value="id"
option-label="code" option-label="code"
@input-value="currenciesRef.fetch()"
/> />
</div> </div>
<div class="col"> <div class="col">
@ -417,7 +434,6 @@ async function upsert() {
:options="companies" :options="companies"
option-value="id" option-value="id"
option-label="code" option-label="code"
@input-value="companiesRef.fetch()"
/> />
</div> </div>
</div> </div>
@ -459,7 +475,6 @@ async function upsert() {
:options="companies" :options="companies"
option-value="id" option-value="id"
option-label="code" option-label="code"
@input-value="companiesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
</QItem> </QItem>
@ -471,7 +486,6 @@ async function upsert() {
:options="warehouses" :options="warehouses"
option-value="id" option-value="id"
option-label="name" option-label="name"
@input-value="warehousesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
<VnSelectFilter <VnSelectFilter
@ -481,7 +495,6 @@ async function upsert() {
:options="dmsTypes" :options="dmsTypes"
option-value="id" option-value="id"
option-label="name" option-label="name"
@input-value="dmsTypesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
</QItem> </QItem>
@ -571,7 +584,6 @@ async function upsert() {
:options="companies" :options="companies"
option-value="id" option-value="id"
option-label="code" option-label="code"
@input-value="companiesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
</QItem> </QItem>
@ -583,7 +595,6 @@ async function upsert() {
:options="warehouses" :options="warehouses"
option-value="id" option-value="id"
option-label="name" option-label="name"
@input-value="warehousesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
<VnSelectFilter <VnSelectFilter
@ -593,7 +604,6 @@ async function upsert() {
:options="dmsTypes" :options="dmsTypes"
option-value="id" option-value="id"
option-label="name" option-label="name"
@input-value="dmsTypesRef.fetch()"
:rules="[requiredFieldRule]" :rules="[requiredFieldRule]"
/> />
</QItem> </QItem>

View File

@ -4,6 +4,7 @@ import { useStateStore } from 'stores/useStateStore';
import InvoiceInDescriptor from './InvoiceInDescriptor.vue'; import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { onMounted, watch } from 'vue'; import { onMounted, watch } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -74,11 +75,7 @@ onMounted(async () => {
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -0,0 +1,6 @@
<script setup>
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="InvoiceIn" />
</template>

View File

@ -203,7 +203,7 @@ function getLink(param) {
@on-fetch="(data) => setData(data)" @on-fetch="(data) => setData(data)"
> >
<template #header="{ entity: invoiceIn }"> <template #header="{ entity: invoiceIn }">
<div>{{ invoiceIn.id }} - {{ invoiceIn.supplier.name }}</div> <div>{{ invoiceIn.id }} - {{ invoiceIn.supplier?.name }}</div>
</template> </template>
<template #body="{ entity: invoiceIn }"> <template #body="{ entity: invoiceIn }">
<!--Basic Data--> <!--Basic Data-->
@ -216,7 +216,7 @@ function getLink(param) {
</QCardSection> </QCardSection>
<VnLv <VnLv
:label="t('invoiceIn.summary.supplier')" :label="t('invoiceIn.summary.supplier')"
:value="invoiceIn.supplier.name" :value="invoiceIn.supplier?.name"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.supplierRef')" :label="t('invoiceIn.summary.supplierRef')"
@ -224,7 +224,7 @@ function getLink(param) {
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.currency')" :label="t('invoiceIn.summary.currency')"
:value="invoiceIn.currency.code" :value="invoiceIn.currency?.code"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.docNumber')" :label="t('invoiceIn.summary.docNumber')"
@ -265,7 +265,7 @@ function getLink(param) {
</QCardSection> </QCardSection>
<VnLv <VnLv
:label="t('invoiceIn.summary.sage')" :label="t('invoiceIn.summary.sage')"
:value="invoiceIn.sageWithholding.withholding" :value="invoiceIn.sageWithholding?.withholding"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.vat')" :label="t('invoiceIn.summary.vat')"
@ -273,7 +273,7 @@ function getLink(param) {
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.company')" :label="t('invoiceIn.summary.company')"
:value="invoiceIn.company.code" :value="invoiceIn.company?.code"
/> />
<VnLv <VnLv
:label="t('invoiceIn.summary.booked')" :label="t('invoiceIn.summary.booked')"

View File

@ -84,9 +84,9 @@ function viewSummary(id) {
:key="row.id" :key="row.id"
:title="row.supplierRef" :title="row.supplierRef"
@click="navigate(row.id)" @click="navigate(row.id)"
:id="row.id"
> >
<template #list-items> <template #list-items>
<VnLv label="ID" :value="row.id" />
<VnLv <VnLv
:label="t('invoiceIn.list.supplierRef')" :label="t('invoiceIn.list.supplierRef')"
:value="row.supplierRef" :value="row.supplierRef"
@ -112,42 +112,34 @@ function viewSummary(id) {
:label="t('invoiceIn.list.amount')" :label="t('invoiceIn.list.amount')"
:value="toCurrency(row.amount)" :value="toCurrency(row.amount)"
/> />
<VnLv :label="t('invoiceIn.list.isBooked')"> <VnLv
<template #value> :label="t('invoiceIn.list.isBooked')"
<QCheckbox :value="!!row.isBooked"
class="no-pointer-events"
v-model="row.isBooked"
size="xs"
:true-value="1"
:false-value="0"
/> />
</template> </template>
</VnLv>
</template>
<template #actions> <template #actions>
<QBtn <QBtn
flat :label="t('components.smartCard.openCard')"
icon="arrow_circle_right"
@click.stop="navigate(row.id)" @click.stop="navigate(row.id)"
> class="bg-vn-dark"
<QTooltip> outline
{{ t('components.smartCard.openCard') }} type="reset"
</QTooltip> />
</QBtn>
<QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
<QTooltip>
{{ t('components.smartCard.openSummary') }}
</QTooltip>
</QBtn>
<QBtn <QBtn
flat :label="t('components.smartCard.openSummary')"
icon="cloud_download" @click.stop="viewSummary(row.id)"
color="primary"
type="submit"
class="q-mt-sm"
/>
<QBtn
:label="t('Download')"
class="q-mt-sm"
@click.stop="downloadFile(row.dmsFk)" @click.stop="downloadFile(row.dmsFk)"
> type="submit"
<QTooltip> color="primary"
{{ t('components.smartCard.downloadFile') }} />
</QTooltip>
</QBtn>
</template> </template>
</CardList> </CardList>
</template> </template>
@ -176,4 +168,5 @@ function viewSummary(id) {
es: es:
Search invoice: Buscar factura emitida Search invoice: Buscar factura emitida
You can search by invoice reference: Puedes buscar por referencia de la factura You can search by invoice reference: Puedes buscar por referencia de la factura
Download: Descargar
</i18n> </i18n>

View File

@ -4,6 +4,7 @@ import { useStateStore } from 'stores/useStateStore';
import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue'; import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
@ -26,11 +27,7 @@ const { t } = useI18n();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<div class="q-pa-md"><RouterView></RouterView></div> <div class="q-pa-md"><RouterView></RouterView></div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -49,8 +49,7 @@ const tableColumnComponents = {
}, },
}; };
const columns = computed(() => { const columns = computed(() => [
return [
{ label: 'Id', field: 'clientId', name: 'clientId', align: 'left' }, { label: 'Id', field: 'clientId', name: 'clientId', align: 'left' },
{ {
label: t('invoiceOut.globalInvoices.table.client'), label: t('invoiceOut.globalInvoices.table.client'),
@ -71,8 +70,7 @@ const columns = computed(() => {
align: 'left', align: 'left',
}, },
{ label: 'Error', field: 'message', name: 'message', align: 'left' }, { label: 'Error', field: 'message', name: 'message', align: 'left' },
]; ]);
});
const rows = computed(() => { const rows = computed(() => {
if (!errors && !errors.length > 0) return []; if (!errors && !errors.length > 0) return [];
@ -175,7 +173,7 @@ onUnmounted(() => {
.col-content { .col-content {
border-radius: 4px; border-radius: 4px;
padding: 6px 6px 6px 6px; padding: 6px;
} }
</style> </style>

View File

@ -4,13 +4,14 @@ import { useI18n } from 'vue-i18n';
import { QCheckbox, QBtn } from 'quasar'; import { QCheckbox, QBtn } from 'quasar';
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 InvoiceOutNegativeFilter from './InvoiceOutNegativeBasesFilter.vue'; import InvoiceOutNegativeFilter from './InvoiceOutNegativeBasesFilter.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js'; import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const invoiceOutGlobalStore = useInvoiceOutGlobalStore(); const invoiceOutGlobalStore = useInvoiceOutGlobalStore();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -187,9 +188,21 @@ const columns = computed(() => [
]); ]);
const downloadCSV = async () => { const downloadCSV = async () => {
const params = {}; // filter.value;
const filterParams = {
limit: 20,
where: {
and: [],
},
};
for (const param in params) {
if (params[param]) filterParams.where.and.push({ [param]: params[param] });
}
await invoiceOutGlobalStore.getNegativeBasesCsv( await invoiceOutGlobalStore.getNegativeBasesCsv(
arrayData.value.store.userParams.from, arrayData.value.store.userParams.from,
arrayData.value.store.userParams.to arrayData.value.store.userParams.to,
params
); );
}; };
@ -213,11 +226,7 @@ const selectWorkerId = (id) => {
<InvoiceOutNegativeFilter data-key="InvoiceOutNegative" /> <InvoiceOutNegativeFilter data-key="InvoiceOutNegative" />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QToolbar class="bg-vn-dark"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<QTable <QTable
:columns="columns" :columns="columns"
@ -243,8 +252,14 @@ const selectWorkerId = (id) => {
" "
>{{ props.value }} >{{ props.value }}
</template> </template>
<CustomerDescriptorProxy :id="selectedCustomerId" /> <CustomerDescriptorProxy
<WorkerDescriptorProxy :id="selectedWorkerId" /> v-if="props.col.name === 'clientId'"
:id="selectedCustomerId"
/>
<VnUserLink
v-if="props.col.name === 'comercial'"
:worker-id="selectedWorkerId"
/>
</component> </component>
</QTd> </QTd>
</template> </template>
@ -255,7 +270,7 @@ const selectWorkerId = (id) => {
<style lang="scss" scoped> <style lang="scss" scoped>
.col-content { .col-content {
border-radius: 4px; border-radius: 4px;
padding: 6px 6px 6px 6px; padding: 6px;
} }
</style> </style>

View File

@ -1,12 +0,0 @@
<script setup>
import OrderForm from 'pages/Order/Card/OrderForm.vue';
</script>
<template>
<QToolbar>
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<OrderForm />
</template>
<style lang="scss" scoped></style>

View File

@ -2,6 +2,7 @@
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue'; import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
</script> </script>
@ -15,9 +16,8 @@ const stateStore = useStateStore();
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>
<QPage> <QPage>
<div class="q-pa-md"> <VnSubToolbar />
<RouterView></RouterView> <RouterView></RouterView>
</div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>
</template> </template>

View File

@ -1,11 +1,14 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import axios from 'axios';
import VnInput from 'components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import axios from 'axios'; import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
import { useRoute } from 'vue-router';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -14,6 +17,10 @@ const props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
tags: {
type: Array,
required: true,
},
}); });
const categoryList = ref(null); const categoryList = ref(null);
@ -21,16 +28,41 @@ const selectedCategoryFk = ref(null);
const typeList = ref(null); const typeList = ref(null);
const selectedTypeFk = ref(null); const selectedTypeFk = ref(null);
const selectCategory = (params, category) => { const resetCategory = () => {
if (params.categoryFk === category?.id) {
selectedCategoryFk.value = null; selectedCategoryFk.value = null;
params.categoryFk = null;
typeList.value = null; typeList.value = null;
};
const selectedOrder = ref(null);
const orderList = [
{ way: 'ASC', name: 'Ascendant' },
{ way: 'DESC', name: 'Descendant' },
];
const selectedOrderField = ref(null);
const OrderFields = [
{ field: 'relevancy DESC, name', name: 'Relevancy', priority: 999 },
{ field: 'showOrder, price', name: 'Color and price', priority: 999 },
{ field: 'name', name: 'Name', priority: 999 },
{ field: 'price', name: 'Price', priority: 999 },
];
const clearFilter = (key) => {
if (key === 'categoryFk') {
resetCategory();
}
};
const selectCategory = (params, category, search) => {
if (params.categoryFk === category?.id) {
resetCategory();
params.categoryFk = null;
} else { } else {
selectedCategoryFk.value = category?.id; selectedCategoryFk.value = category?.id;
params.categoryFk = category?.id; params.categoryFk = category?.id;
loadTypes(category?.id); loadTypes(category?.id);
} }
search();
}; };
const loadTypes = async (categoryFk) => { const loadTypes = async (categoryFk) => {
@ -48,6 +80,11 @@ const onFilterInit = async ({ params }) => {
await loadTypes(params.categoryFk); await loadTypes(params.categoryFk);
selectedCategoryFk.value = params.categoryFk; selectedCategoryFk.value = params.categoryFk;
} }
if (params.orderBy) {
orderByParam.value = JSON.parse(params.orderBy);
selectedOrder.value = orderByParam.value?.way;
selectedOrderField.value = orderByParam.value?.field;
}
}; };
const selectedCategory = computed(() => const selectedCategory = computed(() =>
@ -65,32 +102,90 @@ function exprBuilder(param, value) {
case 'categoryFk': case 'categoryFk':
case 'typeFk': case 'typeFk':
return { [param]: value }; return { [param]: value };
case 'search':
return { 'i.name': { like: `%${value}%` } };
} }
} }
</script>
<template> const selectedTag = ref(null);
<FetchData const tagValues = ref([{}]);
url="ItemCategories" const tagOptions = ref(null);
limit="30" const isButtonDisabled = computed(
auto-load () => !selectedTag.value || tagValues.value.some((item) => !item.value)
@on-fetch=" );
(data) => {
categoryList = (data || []) const applyTagFilter = (params, search) => {
if (!tagValues.value?.length) {
params.tagGroups = null;
search();
return;
}
if (!params.tagGroups) {
params.tagGroups = [];
}
params.tagGroups.push(
JSON.stringify({
values: tagValues.value,
tagSelection: {
...selectedTag.value,
orgShowField: selectedTag.value.name,
},
tagFk: selectedTag.value.tagFk,
})
);
search();
selectedTag.value = null;
tagValues.value = [{}];
};
const removeTagChip = (selection, params, search) => {
if (params.tagGroups) {
params.tagGroups = (params.tagGroups || []).filter(
(value) => value !== selection
);
}
search();
};
const orderByParam = ref(null);
const onOrderFieldChange = (value, params, search) => {
const orderBy = Object.assign({}, orderByParam.value, { field: value.field });
params.orderBy = JSON.stringify(orderBy);
search();
};
const onOrderChange = (value, params, search) => {
const orderBy = Object.assign({}, orderByParam.value, { way: value.way });
params.orderBy = JSON.stringify(orderBy);
search();
};
const setCategoryList = (data) => {
categoryList.value = (data || [])
.filter((category) => category.display) .filter((category) => category.display)
.map((category) => ({ .map((category) => ({
...category, ...category,
icon: `vn:${(category.icon || '').split('-')[1]}`, icon: `vn:${(category.icon || '').split('-')[1]}`,
})); }));
};
const getCategoryClass = (category, params) => {
if (category.id === params?.categoryFk) {
return 'active';
} }
" };
/> </script>
<template>
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true"
:hidden-tags="['orderFk', 'orderBy']" :hidden-tags="['orderFk', 'orderBy']"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:custom-tags="['tagGroups']"
@init="onFilterInit" @init="onFilterInit"
@remove="clearFilter"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<strong v-if="tag.label === 'categoryFk'"> <strong v-if="tag.label === 'categoryFk'">
@ -104,21 +199,37 @@ function exprBuilder(param, value) {
<span>{{ formatFn(tag.value) }}</span> <span>{{ formatFn(tag.value) }}</span>
</div> </div>
</template> </template>
<template #body="{ params }"> <template #customTags="{ tags: customTags, params, searchFn }">
<QList dense> <template v-for="tag in customTags" :key="tag.label">
<template v-if="tag.label === 'tagGroups'">
<VnFilterPanelChip
v-for="chip in tag.value"
:key="chip"
removable
@remove="removeTagChip(chip, params, searchFn)"
>
<strong> {{ JSON.parse(chip).tagSelection?.name }}: </strong>
<span>{{
(JSON.parse(chip).values || [])
.map((item) => item.value)
.join(' | ')
}}</span>
</VnFilterPanelChip>
</template>
</template>
</template>
<template #body="{ params, searchFn }">
<QList dense style="max-width: 256px">
<QItem class="category-filter q-mt-md"> <QItem class="category-filter q-mt-md">
<div <div
v-for="category in categoryList" v-for="category in categoryList"
:key="category.name" :key="category.name"
:class="[ :class="['category', getCategoryClass(category, params)]"
'category',
category.id === params?.categoryFk && 'active',
]"
> >
<QIcon <QIcon
:name="category.icon" :name="category.icon"
class="category-icon" class="category-icon"
@click="selectCategory(params, category)" @click="selectCategory(params, category, searchFn)"
> >
<QTooltip> <QTooltip>
{{ t(category.name) }} {{ t(category.name) }}
@ -126,7 +237,7 @@ function exprBuilder(param, value) {
</QIcon> </QIcon>
</div> </div>
</QItem> </QItem>
<QItem class="q-mt-md"> <QItem class="q-my-md">
<QItemSection> <QItemSection>
<VnSelectFilter <VnSelectFilter
:label="t('params.type')" :label="t('params.type')"
@ -140,7 +251,12 @@ function exprBuilder(param, value) {
emit-value emit-value
use-input use-input
:disable="!selectedCategoryFk" :disable="!selectedCategoryFk"
@update:model-value="(value) => (selectedTypeFk = value)" @update:model-value="
(value) => {
selectedTypeFk = value;
searchFn();
}
"
> >
<template #option="{ itemProps, opt }"> <template #option="{ itemProps, opt }">
<QItem v-bind="itemProps"> <QItem v-bind="itemProps">
@ -155,6 +271,130 @@ function exprBuilder(param, value) {
</VnSelectFilter> </VnSelectFilter>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QSeparator />
<QItem class="q-my-md">
<QItemSection>
<VnSelectFilter
:label="t('params.order')"
v-model="selectedOrder"
:options="orderList || []"
option-value="way"
option-label="name"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="
(value) => onOrderChange(value, params, searchFn)
"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-md">
<QItemSection>
<VnSelectFilter
:label="t('params.order')"
v-model="selectedOrderField"
:options="OrderFields || []"
option-value="field"
option-label="name"
dense
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@update:model-value="
(value) => onOrderFieldChange(value, params, searchFn)
"
/>
</QItemSection>
</QItem>
<QSeparator />
<QItem class="q-mt-md">
<QItemSection>
<VnSelectFilter
:label="t('params.tag')"
v-model="selectedTag"
:options="props.tags || []"
option-value="id"
option-label="name"
dense
outlined
rounded
:emit-value="false"
use-input
/>
</QItemSection>
</QItem>
<QItem
v-for="(value, index) in tagValues"
:key="value"
class="q-mt-md filter-value"
>
<VnInput
v-if="selectedTag?.isFree"
v-model="value.value"
:label="t('params.value')"
is-outlined
class="filter-input"
/>
<VnSelectFilter
v-else
:label="t('params.value')"
v-model="value.value"
:options="tagOptions || []"
option-value="value"
option-label="value"
dense
outlined
rounded
emit-value
use-input
:disable="!selectedTag"
class="filter-input"
/>
<FetchData
v-if="selectedTag && !selectedTag.isFree"
:url="`Tags/${selectedTag?.id}/filterValue`"
limit="30"
auto-load
@on-fetch="(data) => (tagOptions = data)"
/>
<QIcon
name="delete"
class="filter-icon"
@click="(tagValues || []).splice(index, 1)"
/>
</QItem>
<QItem class="q-mt-lg">
<QIcon
name="add_circle"
class="filter-icon"
@click="tagValues.push({})"
/>
</QItem>
<QItem>
<QItemSection class="q-py-sm">
<QBtn
:label="t('Search')"
class="full-width"
color="primary"
dense
icon="search"
rounded
type="button"
unelevated
:disable="isButtonDisabled"
@click.stop="applyTagFilter(params, searchFn)"
/>
</QItemSection>
</QItem>
<QSeparator />
</QList> </QList>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
@ -182,12 +422,29 @@ function exprBuilder(param, value) {
.category-icon { .category-icon {
border-radius: 50%; border-radius: 50%;
background-color: var(--vn-label); background-color: var(--vn-light-gray);
font-size: 2.6rem; font-size: 2.6rem;
padding: 8px; padding: 8px;
cursor: pointer; cursor: pointer;
} }
} }
.filter-icon {
font-size: 24px;
color: $primary;
padding: 0 4px;
cursor: pointer;
}
.filter-input {
flex-shrink: 1;
min-width: 0;
}
.filter-value {
display: flex;
align-items: center;
}
</style> </style>
<i18n> <i18n>
@ -195,10 +452,16 @@ en:
params: params:
type: Type type: Type
orderBy: Order By orderBy: Order By
tag: Tag
value: Value
order: Order
es: es:
params: params:
type: Tipo type: Tipo
orderBy: Ordenar por orderBy: Ordenar por
tag: Etiqueta
value: Valor
order: Orden
Plant: Planta Plant: Planta
Flower: Flor Flower: Flor
Handmade: Confección Handmade: Confección

View File

@ -6,6 +6,8 @@ import OrderCatalogItemDialog from 'pages/Order/Card/OrderCatalogItemDialog.vue'
import toCurrency from '../../../filters/toCurrency'; import toCurrency from '../../../filters/toCurrency';
import { ref } from 'vue'; import { ref } from 'vue';
const DEFAULT_PRICE_KG = 0;
const session = useSession(); const session = useSession();
const token = session.getToken(); const token = session.getToken();
const { t } = useI18n(); const { t } = useI18n();
@ -22,7 +24,7 @@ const dialog = ref(null);
<template> <template>
<div class="container order-catalog-item overflow-hidden"> <div class="container order-catalog-item overflow-hidden">
<div class="card shadow-6 bg-dark"> <QCard class="card shadow-6">
<div class="img-wrapper"> <div class="img-wrapper">
<QImg <QImg
:src="`/api/Images/catalog/200x200/${item.id}/download?access_token=${token}`" :src="`/api/Images/catalog/200x200/${item.id}/download?access_token=${token}`"
@ -70,11 +72,11 @@ const dialog = ref(null);
</QIcon> </QIcon>
</div> </div>
<p v-if="item.priceKg" class="price-kg"> <p v-if="item.priceKg" class="price-kg">
{{ t('price-kg') }} {{ toCurrency(item.priceKg) || 1123 }} {{ t('price-kg') }} {{ toCurrency(item.priceKg) || DEFAULT_PRICE_KG }}
</p> </p>
</div> </div>
</div> </div>
</div> </QCard>
</div> </div>
</template> </template>

View File

@ -45,8 +45,7 @@ const addToOrder = async () => {
class="link" class="link"
@click=" @click="
() => { () => {
item.quantity = item.quantity += item.grouping;
Number(item.quantity) + item.grouping;
} }
" "
> >
@ -56,7 +55,7 @@ const addToOrder = async () => {
</td> </td>
<td class="text-right"> <td class="text-right">
<QInput <QInput
v-model="item.quantity" v-model.number="item.quantity"
type="number" type="number"
:step="item.grouping" :step="item.grouping"
min="0" min="0"

View File

@ -9,8 +9,10 @@ import useCardDescription from 'src/composables/useCardDescription';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import OrderDescriptorMenu from "pages/Order/Card/OrderDescriptorMenu.vue"; import OrderDescriptorMenu from 'pages/Order/Card/OrderDescriptorMenu.vue';
import FetchData from "components/FetchData.vue"; import FetchData from 'components/FetchData.vue';
const DEFAULT_ITEMS = 0;
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -61,6 +63,11 @@ const setData = (entity) => {
data.value = useCardDescription(entity.client.name, entity.id); data.value = useCardDescription(entity.client.name, entity.id);
state.set('ClaimDescriptor', entity); state.set('ClaimDescriptor', entity);
}; };
const getConfirmationValue = (isConfirmed) => {
return t(isConfirmed ? 'order.summary.confirmed' : 'order.summary.notConfirmed');
};
const total = ref(null); const total = ref(null);
</script> </script>
@ -86,13 +93,7 @@ const total = ref(null);
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv <VnLv
:label="t('order.summary.state')" :label="t('order.summary.state')"
:value=" :value="getConfirmationValue(entity.isConfirmed)"
t(
entity.isConfirmed
? 'order.summary.confirmed'
: 'order.summary.notConfirmed'
)
"
/> />
<VnLv :label="t('order.field.salesPersonFk')"> <VnLv :label="t('order.field.salesPersonFk')">
<template #value> <template #value>
@ -105,7 +106,10 @@ const total = ref(null);
<VnLv :label="t('order.summary.landed')" :value="toDate(entity?.landed)" /> <VnLv :label="t('order.summary.landed')" :value="toDate(entity?.landed)" />
<VnLv :label="t('order.field.agency')" :value="entity?.agencyMode?.name" /> <VnLv :label="t('order.field.agency')" :value="entity?.agencyMode?.name" />
<VnLv :label="t('order.summary.alias')" :value="entity?.address?.nickname" /> <VnLv :label="t('order.summary.alias')" :value="entity?.address?.nickname" />
<VnLv :label="t('order.summary.items')" :value="(entity?.rows?.length || 0).toString()" /> <VnLv
:label="t('order.summary.items')"
:value="(entity?.rows?.length || DEFAULT_ITEMS).toString()"
/>
<VnLv :label="t('order.summary.total')" :value="toCurrency(total)" /> <VnLv :label="t('order.summary.total')" :value="toCurrency(total)" />
</template> </template>
<template #actions="{ entity }"> <template #actions="{ entity }">

View File

@ -51,13 +51,13 @@ async function remove() {
<i18n> <i18n>
en: en:
deleteOrder: Delete order, deleteOrder: Delete order
confirmDeletion: Confirm deletion, confirmDeletion: Confirm deletion
confirmDeletionMessage: Are you sure you want to delete this order? confirmDeletionMessage: Are you sure you want to delete this order?
es: es:
deleteOrder: Eliminar pedido, deleteOrder: Eliminar pedido
confirmDeletion: Confirmar eliminación, confirmDeletion: Confirmar eliminación
confirmDeletionMessage: Seguro que quieres eliminar este pedido? confirmDeletionMessage: Seguro que quieres eliminar este pedido?
</i18n> </i18n>

View File

@ -9,6 +9,7 @@ import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -65,8 +66,8 @@ const fetchAgencyList = async (landed, addressFk) => {
}; };
const fetchOrderDetails = (order) => { const fetchOrderDetails = (order) => {
fetchAddressList(order?.addressFk) fetchAddressList(order?.addressFk);
fetchAgencyList(order?.landed, order?.addressFk) fetchAgencyList(order?.landed, order?.addressFk);
}; };
const orderMapper = (order) => { const orderMapper = (order) => {
@ -105,17 +106,14 @@ const orderFilter = {
</script> </script>
<template> <template>
<QToolbar>
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FetchData <FetchData
url="Clients" url="Clients"
@on-fetch="(data) => (clientList = data)" @on-fetch="(data) => (clientList = data)"
:filter="{ fields: ['id', 'name', 'defaultAddressFk'] }" :filter="{ fields: ['id', 'name', 'defaultAddressFk'] }"
auto-load auto-load
/> />
<VnSubToolbar v-if="isNew" />
<div class="q-pa-md">
<FormModel <FormModel
:url="!isNew ? `Orders/${route.params.id}` : null" :url="!isNew ? `Orders/${route.params.id}` : null"
:url-create="isNew ? 'Orders/new' : null" :url-create="isNew ? 'Orders/new' : null"
@ -206,4 +204,5 @@ const orderFilter = {
</VnRow> </VnRow>
</template> </template>
</FormModel> </FormModel>
</div>
</template> </template>

View File

@ -9,17 +9,14 @@ const { t } = useI18n();
<VnSearchbar <VnSearchbar
data-key="OrderList" data-key="OrderList"
url="Orders/filter" url="Orders/filter"
:label="t('search-order')" :label="t('Search order')"
:info="t('search-order-info')" :info="t('You can search orders by reference')"
/> />
</template> </template>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>
<i18n> <i18n>
en:
search-order: Search order
search-order-info: You can search orders by reference
es: es:
Search shelving: Buscar orden Search order: Buscar orden
You can search by shelving reference: Puedes buscar por referencia de la orden You can search orders by reference: Puedes buscar por referencia de la orden
</i18n> </i18n>

View File

@ -56,6 +56,8 @@ const detailsColumns = ref([
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()"> <Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
<OrderSearchbar /> <OrderSearchbar />
</Teleport> </Teleport>
<div class="q-pa-md">
<CardSummary ref="summary" :url="`Orders/${entityId}/summary`"> <CardSummary ref="summary" :url="`Orders/${entityId}/summary`">
<template #header="{ entity }"> <template #header="{ entity }">
{{ t('order.summary.basket') }} #{{ entity?.id }} - {{ t('order.summary.basket') }} #{{ entity?.id }} -
@ -78,7 +80,7 @@ const detailsColumns = ref([
/> />
<VnLv <VnLv
:label="t('order.summary.confirmed')" :label="t('order.summary.confirmed')"
:value="entity?.isConfirmed === 1" :value="Boolean(entity?.isConfirmed)"
/> />
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
@ -130,7 +132,9 @@ const detailsColumns = ref([
<span class="text-h6">{{ t('order.summary.subtotal') }}</span> <span class="text-h6">{{ t('order.summary.subtotal') }}</span>
</template> </template>
<template #value> <template #value>
<span class="text-h6">{{ toCurrency(entity?.subTotal) }}</span> <span class="text-h6">{{
toCurrency(entity?.subTotal)
}}</span>
</template> </template>
</VnLv> </VnLv>
<VnLv> <VnLv>
@ -177,11 +181,17 @@ const detailsColumns = ref([
<QTd key="description" :props="props" class="description"> <QTd key="description" :props="props" class="description">
<div class="name"> <div class="name">
<span>{{ props.row.item.name }}</span> <span>{{ props.row.item.name }}</span>
<span v-if="props.row.item.subName" class="subName"> <span
v-if="props.row.item.subName"
class="subName"
>
{{ props.row.item.subName }} {{ props.row.item.subName }}
</span> </span>
</div> </div>
<fetched-tags :item="props.row.item" :max-length="5" /> <fetched-tags
:item="props.row.item"
:max-length="5"
/>
</QTd> </QTd>
<QTd key="quantity" :props="props"> <QTd key="quantity" :props="props">
{{ props.row.quantity }} {{ props.row.quantity }}
@ -190,7 +200,9 @@ const detailsColumns = ref([
{{ props.row.price }} {{ props.row.price }}
</QTd> </QTd>
<QTd key="amount" :props="props"> <QTd key="amount" :props="props">
{{ toCurrency(props.row?.quantity * props.row?.price) }} {{
toCurrency(props.row?.quantity * props.row?.price)
}}
</QTd> </QTd>
</QTr> </QTr>
</template> </template>
@ -198,6 +210,7 @@ const detailsColumns = ref([
</QCard> </QCard>
</template> </template>
</CardSummary> </CardSummary>
</div>
</template> </template>
<style lang="scss"> <style lang="scss">
.cardSummary .summaryBody .vn-label-value.order-summary-address { .cardSummary .summaryBody .vn-label-value.order-summary-address {

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { onMounted, onUnmounted } from 'vue'; import {onMounted, onUnmounted, ref} from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
@ -20,11 +20,21 @@ const catalogParams = {
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }), orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
}; };
function exprBuilder(param, value) { const tags = ref([])
switch (param) {
case 'search': function extractTags(items) {
return { 'i.name': { like: `%${value}%` } }; const resultTags = [];
(items || []).forEach((item) => {
(item.tags || []).forEach((tag) => {
const index = resultTags.findIndex((item) => item.tagFk === tag.tagFk);
if (index === -1) {
resultTags.push({ ...tag, priority: 1 });
} else {
resultTags[index].priority += 1;
} }
});
});
tags.value = resultTags
} }
</script> </script>
@ -35,8 +45,8 @@ function exprBuilder(param, value) {
url="Orders/CatalogFilter" url="Orders/CatalogFilter"
:limit="50" :limit="50"
:user-params="catalogParams" :user-params="catalogParams"
:expr-builder="exprBuilder"
:static-params="['orderFk', 'orderBy']" :static-params="['orderFk', 'orderBy']"
:redirect="false"
/> />
</Teleport> </Teleport>
<Teleport v-if="stateStore.isHeaderMounted()" to="#actions-append"> <Teleport v-if="stateStore.isHeaderMounted()" to="#actions-append">
@ -56,7 +66,7 @@ function exprBuilder(param, value) {
</Teleport> </Teleport>
<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">
<OrderCatalogFilter data-key="OrderCatalogList" /> <OrderCatalogFilter data-key="OrderCatalogList" :tags="tags" />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
@ -67,6 +77,7 @@ function exprBuilder(param, value) {
:limit="50" :limit="50"
:user-params="catalogParams" :user-params="catalogParams"
auto-load auto-load
@on-fetch="extractTags"
> >
<template #body="{ rows }"> <template #body="{ rows }">
<div class="catalog-list"> <div class="catalog-list">

View File

@ -1,17 +1,19 @@
<script setup> <script setup>
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { useQuasar } from 'quasar';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import { ref } from 'vue';
import { toCurrency, toDate } from 'src/filters';
import CardList from 'components/ui/CardList.vue'; import CardList from 'components/ui/CardList.vue';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
import { useSession } from 'composables/useSession';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import { toCurrency, toDate } from 'src/filters';
import { useSession } from 'composables/useSession';
import axios from 'axios'; import axios from 'axios';
import { useQuasar } from 'quasar';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -23,6 +25,7 @@ const orderSummary = ref({
vat: null, vat: null,
}); });
const componentKey = ref(0); const componentKey = ref(0);
const order = ref(0);
const refresh = () => { const refresh = () => {
componentKey.value += 1; componentKey.value += 1;
@ -61,6 +64,12 @@ async function confirmOrder() {
</script> </script>
<template> <template>
<FetchData
:key="componentKey"
:url="`Orders/${route.params.id}`"
@on-fetch="(data) => (order = data)"
auto-load
/>
<FetchData <FetchData
:key="componentKey" :key="componentKey"
:url="`Orders/${route.params.id}/getTotal`" :url="`Orders/${route.params.id}/getTotal`"
@ -175,7 +184,7 @@ async function confirmOrder() {
:value="toCurrency(row.price * row.quantity)" :value="toCurrency(row.price * row.quantity)"
/> />
</template> </template>
<template #actions> <template #actions v-if="!order?.isConfirmed">
<QBtn <QBtn
:label="t('remove')" :label="t('remove')"
@click.stop="confirmRemove(row)" @click.stop="confirmRemove(row)"
@ -188,7 +197,7 @@ async function confirmOrder() {
</template> </template>
</VnPaginate> </VnPaginate>
</div> </div>
<QPageSticky :offset="[20, 20]"> <QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed">
<QBtn fab icon="check" color="primary" @click="confirmOrder()" /> <QBtn fab icon="check" color="primary" @click="confirmOrder()" />
<QTooltip> <QTooltip>
{{ t('confirm') }} {{ t('confirm') }}

View File

@ -1,15 +1,17 @@
<script setup> <script setup>
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import { ref } from 'vue';
import { dashIfEmpty } from 'src/filters';
import CardList from 'components/ui/CardList.vue'; import CardList from 'components/ui/CardList.vue';
import axios from 'axios';
import FetchedTags from 'components/ui/FetchedTags.vue'; import FetchedTags from 'components/ui/FetchedTags.vue';
import { dashIfEmpty } from 'src/filters';
import axios from 'axios';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const volumeSummary = ref(null); const volumeSummary = ref(null);

View File

@ -5,8 +5,8 @@ import { useI18n } from 'vue-i18n';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import useCardDescription from 'composables/useCardDescription'; import useCardDescription from 'composables/useCardDescription';
import WorkerDescriptorProxy from "pages/Worker/Card/WorkerDescriptorProxy.vue"; import ShelvingDescriptorMenu from 'pages/Shelving/Card/ShelvingDescriptorMenu.vue';
import ShelvingDescriptorMenu from "pages/Shelving/Card/ShelvingDescriptorMenu.vue"; import VnUserLink from 'src/components/ui/VnUserLink.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -57,14 +57,14 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
<VnLv :label="t('shelving.summary.parking')" :value="entity.parking?.code" /> <VnLv :label="t('shelving.summary.parking')" :value="entity.parking?.code" />
<VnLv v-if="entity.worker" :label="t('shelving.summary.worker')"> <VnLv v-if="entity.worker" :label="t('shelving.summary.worker')">
<template #value> <template #value>
<span class="link"> <VnUserLink
{{ entity.worker?.user?.nickname }} :name="entity.worker?.user?.nickname"
<WorkerDescriptorProxy :id="entity.worker?.id" /> :worker-id="entity.worker?.id"
</span> />
</template> </template>
</VnLv> </VnLv>
</template> </template>
<template #menu="{entity}"> <template #menu="{ entity }">
<ShelvingDescriptorMenu :shelving="entity" /> <ShelvingDescriptorMenu :shelving="entity" />
</template> </template>
</CardDescriptor> </CardDescriptor>

View File

@ -6,6 +6,7 @@ import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -59,11 +60,7 @@ const shelvingFilter = {
}; };
</script> </script>
<template> <template>
<QToolbar class="bg-vn-dark justify-end"> <VnSubToolbar />
<div id="st-data"></div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<FetchData <FetchData
url="Parkings" url="Parkings"
:filter="parkingFilter" :filter="parkingFilter"

View File

@ -1 +1,177 @@
<template>Supplier accounts</template> <script setup>
import { ref, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import CrudModel from 'components/CrudModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
import { useQuasar } from 'quasar';
const quasar = useQuasar();
const { notify } = useNotify();
const route = useRoute();
const { t } = useI18n();
const supplier = ref(null);
const supplierAccountRef = ref(null);
const wireTransferFk = ref(null);
const bankEntitiesOptions = ref([]);
const onBankEntityCreated = (data) => {
bankEntitiesOptions.value.push(data);
};
const onChangesSaved = () => {
if (supplier.value.payMethodFk !== wireTransferFk.value)
quasar
.dialog({
message: t('Do you want to change the pay method to wire transfer?'),
ok: {
push: true,
color: 'primary',
},
cancel: true,
})
.onOk(async () => {
await setWireTransfer();
});
};
const setWireTransfer = async () => {
try {
const params = {
id: route.params.id,
payMethodFk: wireTransferFk.value,
};
await axios.patch(`Suppliers/${route.params.id}`, params);
notify('globals.dataSaved', 'positive');
} catch (err) {
console.error('Error setting wire transfer', err);
}
};
onMounted(() => {
if (supplierAccountRef.value) supplierAccountRef.value.reload();
});
</script>
<template>
<FetchData
url="BankEntities"
@on-fetch="(data) => (bankEntitiesOptions = data)"
auto-load
/>
<FetchData
url="payMethods/findOne"
@on-fetch="(data) => (wireTransferFk = data.id)"
:filter="{ where: { code: 'wireTransfer' } }"
auto-load
/>
<FetchData
:url="`Suppliers/${route.params.id}`"
@on-fetch="(data) => (supplier = data)"
auto-load
/>
<CrudModel
data-key="SupplierAccount"
url="SupplierAccounts"
model="SupplierAccounts"
:filter="{
fields: ['id', 'supplierFk', 'iban', 'bankEntityFk', 'beneficiary'],
where: { supplierFk: route.params.id },
}"
ref="supplierAccountRef"
:default-remove="false"
:data-required="{ supplierFk: route.params.id }"
@save-changes="onChangesSaved()"
>
<template #body="{ rows }">
<QCard class="q-pa-md">
<VnRow
v-for="(row, index) in rows"
:key="index"
class="row q-gutter-md q-mb-md"
>
<div class="col">
<VnInput
:label="t('supplier.accounts.iban')"
v-model="row.iban"
/>
</div>
<div class="col">
<VnSelectCreate
:label="t('worker.create.bankEntity')"
v-model="row.bankEntityFk"
:options="bankEntitiesOptions"
option-label="name"
option-value="id"
hide-selected
>
<template #form>
<CreateBankEntityForm
@on-data-saved="onBankEntityCreated($event)"
:show-entity-field="false"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel
>{{ scope.opt.bic }}
{{ scope.opt.name }}</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelectCreate>
</div>
<div class="col">
<VnInput
:label="t('supplier.accounts.beneficiary')"
v-model="row.beneficiary"
/>
</div>
<div class="col-1 row justify-center items-center">
<QIcon
name="delete"
size="sm"
class="cursor-pointer"
color="primary"
@click="supplierAccountRef.remove([row])"
>
<QTooltip>
{{ t('Remove account') }}
</QTooltip>
</QIcon>
</div>
</VnRow>
<VnRow>
<QIcon
name="add"
size="sm"
class="cursor-pointer"
color="primary"
@click="supplierAccountRef.insert()"
>
<QTooltip>
{{ t('Add account') }}
</QTooltip>
</QIcon>
</VnRow>
</QCard>
</template>
</CrudModel>
</template>
<i18n>
es:
Do you want to change the pay method to wire transfer?: ¿Quieres modificar la forma de pago a transferencia?
Add account: Añadir cuenta
Remove account: Remover cuenta
</i18n>

View File

@ -1 +1,97 @@
<template>Supplier addresses</template> <script setup>
import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CardList from 'src/components/ui/CardList.vue';
import VnLv from 'src/components/ui/VnLv.vue';
const router = useRouter();
const route = useRoute();
const { t } = useI18n();
const addressesFilter = {
fields: [
'id',
'nickname',
'street',
'city',
'provinceFk',
'phone',
'mobile',
'postalCode',
],
order: ['nickname ASC'],
include: [
{
relation: 'province',
scope: {
fields: ['id', 'name'],
},
},
],
};
const redirectToCreateView = () => {
router.push({ name: 'SupplierAddressesCreate' });
};
const redirectToUpdateView = (addressData) => {
const stringifiedAddressData = JSON.stringify(addressData);
router.push({
name: 'SupplierAddressesCreate',
query: { addressData: stringifiedAddressData },
});
};
</script>
<template>
<QPage class="column items-center q-pa-md">
<div class="card-list">
<VnPaginate
data-key="SupplierAddress"
:url="`Suppliers/${route.params.id}/addresses`"
:filter="addressesFilter"
auto-load
>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:title="row.nickname"
:id="row.id"
@click="redirectToUpdateView(row)"
>
<template #list-items>
<VnLv
:label="t('supplier.addresses.street')"
:value="row.street"
/>
<VnLv
:label="t('supplier.addresses.postcode')"
:value="`${row.postalCode} - ${row.city}, ${row.province.name}`"
/>
<VnLv
:label="t('supplier.addresses.phone')"
:value="`${row.phone}, ${row.mobile}`"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
<QTooltip>
{{ t('supplier.list.newSupplier') }}
</QTooltip>
</QPageSticky>
</QPage>
</template>
<style lang="scss" scoped>
.card-list {
width: 100%;
max-width: 60em;
}
</style>

View File

@ -0,0 +1,182 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { reactive, ref, onMounted, onBeforeMount } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import FormModel from 'components/FormModel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
import VnRow from 'components/ui/VnRow.vue';
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const provincesOptions = ref([]);
const postcodesOptions = ref([]);
const townsLocationOptions = ref([]);
const viewAction = ref();
const updateAddressId = ref(null);
const newAddressForm = reactive({
nickname: null,
street: null,
postalCode: null,
city: null,
provinceFk: null,
phone: null,
mobile: null,
});
const onDataSaved = () => {
router.push({ name: 'SupplierAddresses' });
};
const updateAddressForm = (addressData) => {
for (let key in newAddressForm) {
if (key in addressData) {
newAddressForm[key] = addressData[key];
}
}
};
onBeforeMount(() => {
viewAction.value = route.query.addressData ? 'update' : 'create';
if (viewAction.value === 'create') newAddressForm.supplierFk = route.params.id;
});
onMounted(() => {
if (viewAction.value === 'update' && route.query.addressData) {
const addressData = JSON.parse(route.query.addressData);
updateAddressId.value = addressData.id;
updateAddressForm(addressData);
}
});
</script>
<template>
<FetchData
ref="postcodeFetchDataRef"
url="Postcodes/location"
@on-fetch="(data) => (postcodesOptions = data)"
auto-load
/>
<FetchData
ref="provincesFetchDataRef"
@on-fetch="(data) => (provincesOptions = data)"
auto-load
url="Provinces"
/>
<FetchData
ref="townsFetchDataRef"
@on-fetch="(data) => (townsLocationOptions = data)"
auto-load
url="Towns/location"
/>
<QPage>
<FormModel
model="supplierAddresses"
:form-initial-data="newAddressForm"
:url-update="
viewAction !== 'create' ? `SupplierAddresses/${updateAddressId}` : null
"
:url-create="viewAction === 'create' ? 'SupplierAddresses' : null"
:observe-form-changes="viewAction === 'create'"
@on-data-saved="onDataSaved()"
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput
v-model="data.nickname"
:label="t('supplier.addresses.name')"
/>
</div>
<div class="col">
<VnInput
v-model="data.street"
:label="t('supplier.addresses.street')"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectCreate
v-model="data.postalCode"
:label="t('supplier.addresses.postcode')"
:rules="validate('supplierAddress.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
option-label="code"
option-value="code"
hide-selected
>
<template #form>
<CustomerCreateNewPostcode
@on-data-saved="onPostcodeCreated($event)"
/>
</template>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection v-if="scope.opt">
<QItemLabel>{{ scope.opt.code }}</QItemLabel>
<QItemLabel caption
>{{ scope.opt.code }} -
{{ scope.opt.town.name }} ({{
scope.opt.town.province.name
}},
{{
scope.opt.town.province.country.country
}})</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelectCreate>
</div>
<div class="col">
<VnSelectFilter
:label="t('supplier.addresses.city')"
:options="townsLocationOptions"
v-model="data.city"
hide-selected
option-label="name"
option-value="id"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('supplier.addresses.province')"
:options="provincesOptions"
hide-selected
map-options
option-label="name"
option-value="id"
v-model="data.provinceFk"
/>
</div>
<div class="col">
<VnInput
v-model="data.phone"
:label="t('supplier.addresses.phone')"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput
v-model="data.mobile"
:label="t('supplier.addresses.mobile')"
/>
</div>
<div class="col" />
</VnRow>
</template>
</FormModel>
</QPage>
</template>

View File

@ -1 +1,139 @@
<template>Supplier agency term</template> <script setup>
import { ref, onMounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import CrudModel from 'components/CrudModel.vue';
import VnRow from 'components/ui/VnRow.vue';
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const supplierAgencyTermRef = ref(null);
const agenciesOptions = ref(null);
const supplierAgencyFilter = {
include: {
relation: 'agency',
scope: {
fields: ['id', 'name'],
},
},
where: { supplierFk: route.params.id },
};
const redirectToCreateView = () => {
router.push({ name: 'SupplierAgencyTermCreate' });
};
onMounted(() => {
if (supplierAgencyTermRef.value) supplierAgencyTermRef.value.reload();
});
</script>
<template>
<FetchData
url="Suppliers/freeAgencies"
@on-fetch="(data) => (agenciesOptions = data)"
auto-load
/>
<CrudModel
ref="supplierAgencyTermRef"
data-key="SupplierAgencyTerm"
save-url="SupplierAgencyTerms/crud"
url="SupplierAgencyTerms"
model="SupplierAgencyTerm"
primary-key="agencyFk"
:filter="supplierAgencyFilter"
:default-remove="false"
:data-required="{
supplierFk: route.params.id,
}"
>
<template #body="{ rows }">
<QCard class="q-pa-md">
<VnRow
v-for="(row, index) in rows"
:key="index"
class="row q-gutter-md q-mb-md"
>
<div class="col">
<QField :label="t('supplier.agencyTerms.agencyFk')" stack-label>
<template #control>
<div tabindex="0">
{{ row.agency?.name }}
</div>
</template>
</QField>
</div>
<div class="col">
<QInput
:label="t('supplier.agencyTerms.minimumM3')"
v-model.number="row.minimumM3"
type="number"
/>
</div>
<div class="col">
<QInput
:label="t('supplier.agencyTerms.packagePrice')"
v-model.number="row.packagePrice"
type="number"
/>
</div>
<div class="col">
<QInput
:label="t('supplier.agencyTerms.kmPrice')"
v-model.number="row.kmPrice"
type="number"
/>
</div>
<div class="col">
<QInput
:label="t('supplier.agencyTerms.m3Price')"
v-model.number="row.m3Price"
type="number"
/>
</div>
<div class="col">
<QInput
:label="t('supplier.agencyTerms.routePrice')"
v-model.number="row.routePrice"
type="number"
/>
</div>
<div class="col">
<QInput
:label="t('supplier.agencyTerms.minimumKm')"
v-model.number="row.minimumKm"
type="number"
/>
</div>
<div class="col-1 row justify-center items-center">
<QIcon
name="delete"
size="sm"
class="cursor-pointer"
color="primary"
@click="supplierAgencyTermRef.remove([row])"
>
<QTooltip>
{{ t('Remove row') }}
</QTooltip>
</QIcon>
</div>
</VnRow>
</QCard>
</template>
</CrudModel>
<QPageSticky :offset="[20, 20]">
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
<QTooltip>
{{ t('supplier.list.newSupplier') }}
</QTooltip>
</QPageSticky>
</template>
<i18n>
es:
Remove row: Eliminar fila
</i18n>

View File

@ -0,0 +1,113 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { reactive, ref } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
const { t } = useI18n();
const router = useRouter();
const route = useRoute();
const agenciesOptions = ref(null);
const newAgencyTermForm = reactive({
agencyFk: null,
minimumM3: null,
packagePrice: null,
kmPrice: null,
m3Price: null,
routePrice: null,
minimumKm: null,
supplierFk: route.params.id,
});
const onDataSaved = () => {
router.push({ name: 'SupplierAgencyTerm' });
};
</script>
<template>
<FetchData
url="Suppliers/freeAgencies"
@on-fetch="(data) => (agenciesOptions = data)"
auto-load
/>
<QPage>
<FormModel
model="supplierAgencyTerm"
:form-initial-data="newAgencyTermForm"
url-create="SupplierAgencyTerms"
:observe-form-changes="true"
@on-data-saved="onDataSaved()"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('supplier.agencyTerms.agencyFk')"
v-model="data.agencyFk"
:options="agenciesOptions"
option-label="name"
option-value="id"
hide-selected
rounded
/>
</div>
<div class="col">
<QInput
:label="t('supplier.agencyTerms.minimumM3')"
v-model.number="data.minimumM3"
type="number"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QInput
:label="t('supplier.agencyTerms.packagePrice')"
v-model.number="data.packagePrice"
type="number"
/>
</div>
<div class="col">
<QInput
:label="t('supplier.agencyTerms.kmPrice')"
v-model.number="data.kmPrice"
type="number"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QInput
:label="t('supplier.agencyTerms.m3Price')"
v-model.number="data.m3Price"
type="number"
/>
</div>
<div class="col">
<QInput
:label="t('supplier.agencyTerms.routePrice')"
v-model.number="data.routePrice"
type="number"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QInput
:label="t('supplier.agencyTerms.minimumKm')"
v-model.number="data.minimumKm"
type="number"
/>
</div>
<div class="col" />
</VnRow>
</template>
</FormModel>
</QPage>
</template>

View File

@ -1 +1,97 @@
<template>Supplier basic data</template> <script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const route = useRoute();
const { t } = useI18n();
const workersOptions = ref([]);
</script>
<template>
<FetchData
url="Workers/search"
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC', limit: 30 }"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<FormModel
:url="`Suppliers/${route.params.id}`"
:url-update="`Suppliers/${route.params.id}`"
model="supplier"
auto-load
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput
v-model="data.nickname"
:label="t('supplier.basicData.alias')"
:rules="validate('supplier.nickname')"
clearable
/>
</div>
<div class="col">
<VnSelectFilter
:label="t('supplier.basicData.workerFk')"
v-model="data.workerFk"
:options="workersOptions"
option-value="id"
option-label="name"
hide-selected
map-options
:rules="validate('supplier.workerFk')"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>
{{ scope.opt?.nickname }}, {{ scope.opt?.id }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox
v-model="data.isSerious"
:label="t('supplier.basicData.isSerious')"
/>
</div>
<div class="col">
<QCheckbox
v-model="data.isActive"
:label="t('supplier.basicData.isActive')"
/>
</div>
<div class="col">
<QCheckbox
v-model="data.isPayMethodChecked"
:label="t('supplier.basicData.isPayMethodChecked')"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QInput
:label="t('supplier.basicData.note')"
type="textarea"
v-model="data.note"
fill-input
autogrow
/>
</div>
</VnRow>
</template>
</FormModel>
</template>

Some files were not shown because too many files have changed in this diff Show More