0
0
Fork 0

Merge branch 'dev' of https://gitea.verdnatura.es/hyervoni/salix-front-mindshore into feature/SupplierSubmodules

This commit is contained in:
William Buezas 2024-01-05 08:27:23 -03:00
commit edb1c1c71a
62 changed files with 1913 additions and 775 deletions

View File

@ -4,8 +4,8 @@ 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 emit = defineEmits(['onDataSaved']); const emit = defineEmits(['onDataSaved']);
@ -22,41 +22,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
@ -89,43 +77,10 @@ const closeForm = () => {
<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 = () => {
emit('onDataSaved'); emit('onDataSaved');
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,15 +24,12 @@ 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 = () => {
emit('onDataSaved'); emit('onDataSaved');
closeForm();
}; };
const onCityCreated = async () => { const onCityCreated = async () => {
@ -42,10 +39,6 @@ const onCityCreated = async () => {
const onProvinceCreated = async () => { const onProvinceCreated = async () => {
await provincesFetchDataRef.value.fetch(); await provincesFetchDataRef.value.fetch();
}; };
const closeForm = () => {
if (closeButton.value) closeButton.value.click();
};
</script> </script>
<template> <template>
@ -66,20 +59,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
@ -134,44 +122,10 @@ 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> </template>
</FormModel>
</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:

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 = () => {
emit('onDataSaved'); emit('onDataSaved');
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

@ -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 }

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 = () => {
emit('onDataSaved');
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()"
>
<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

@ -1,11 +1,10 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref, computed } from 'vue'; import { ref, computed, onMounted } from 'vue';
import FetchData from 'components/FetchData.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: {
@ -24,17 +23,12 @@ 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);
const user = state.getUser(); const user = state.getUser();
const initialUserConfigViewData = ref(null); const initialUserConfigViewData = ref(null);
const userConfigFilter = {
where: {
tableCode: $props.tableCode,
userFk: user.id,
},
};
const formattedCols = ref([]); const formattedCols = ref([]);
@ -43,16 +37,12 @@ const areAllChecksMarked = computed(() => {
}); });
const setUserConfigViewData = (data) => { const setUserConfigViewData = (data) => {
initialUserConfigViewData.value = data; if (!data) return;
if (data.length === 0) 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[0].configuration[col], active: data[col],
}; }));
return obj;
});
emitSavedConfig(); emitSavedConfig();
}; };
@ -60,40 +50,101 @@ const toggleMarkAll = (val) => {
formattedCols.value.forEach((col) => (col.active = val)); formattedCols.value.forEach((col) => (col.active = val));
}; };
const saveConfig = async () => { const fetchViewConfigData = async () => {
try { try {
const data = { const userConfigFilter = {
id: initialUserConfigViewData.value[0].id, where: {
userFk: 9,
tableCode: $props.tableCode, tableCode: $props.tableCode,
configuration: {}, userFk: user.id,
},
}; };
formattedCols.value.forEach((col) => { const userViewConfigResponse = await axios.get('UserConfigViews', {
data.configuration[col.name] = col.active; params: { filter: userConfigFilter },
}); });
await axios.patch('UserConfigViews', data); if (userViewConfigResponse.data && userViewConfigResponse.data.length > 0) {
initialUserConfigViewData.value = userViewConfigResponse.data[0];
setUserConfigViewData(userViewConfigResponse.data[0].configuration);
return;
}
const defaultConfigFilter = {
where: {
tableCode: $props.tableCode,
},
};
const defaultViewConfigResponse = await axios.get('DefaultViewConfigs', {
params: { filter: defaultConfigFilter },
});
if (defaultViewConfigResponse.data && defaultViewConfigResponse.data.length > 0) {
setUserConfigViewData(defaultViewConfigResponse.data[0].columns);
return;
}
} catch (err) {
console.err('Error fetching config view data');
}
};
const saveConfig = async () => {
try {
const params = {};
const configuration = {};
formattedCols.value.forEach((col) => {
const { name, active } = col;
configuration[name] = active;
});
// Si existe una view config del usuario hacemos un update si no la creamos
if (initialUserConfigViewData.value) {
params.updates = [
{
data: {
configuration: configuration,
},
where: {
id: initialUserConfigViewData.value.id,
},
},
];
} else {
params.creates = [
{
userFk: user.value.id,
tableCode: $props.tableCode,
tableConfig: $props.tableCode,
configuration: configuration,
},
];
}
const response = await axios.post('UserConfigViews/crud', params);
if (response.data && 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');
} }
}; };
const emitSavedConfig = () => { const emitSavedConfig = () => {
const filteredCols = formattedCols.value.filter((col) => col.active); const filteredCols = formattedCols.value.filter((col) => col.active);
const mappedCols = filteredCols.map((col) => col.name); const mappedCols = filteredCols.map((col) => col.name);
emit('onConfigSaved', mappedCols); emit('onConfigSaved', mappedCols);
}; };
onMounted(async () => {
await fetchViewConfigData();
});
</script> </script>
<template> <template>
<fetch-data
v-if="user"
url="UserConfigViews"
:filter="userConfigFilter"
@on-fetch="(data) => setUserConfigViewData(data)"
auto-load
/>
<QBtn color="primary" icon="view_column"> <QBtn color="primary" icon="view_column">
<QPopupProxy ref="popupProxyRef"> <QPopupProxy ref="popupProxyRef">
<QCard class="column q-pa-md"> <QCard class="column q-pa-md">
@ -108,7 +159,7 @@ const emitSavedConfig = () => {
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
@ -123,6 +174,7 @@ const emitSavedConfig = () => {
}}</QBtn> }}</QBtn>
</QCard> </QCard>
</QPopupProxy> </QPopupProxy>
<QTooltip>{{ t('Visible columns') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
@ -138,3 +190,9 @@ const emitSavedConfig = () => {
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

@ -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

@ -49,7 +49,7 @@ const toggleForm = () => {
<QIcon <QIcon
@click.stop.prevent="toggleForm()" @click.stop.prevent="toggleForm()"
name="add" name="add"
size="19px" size="xs"
class="add-icon" class="add-icon"
/> />
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale"> <QDialog v-model="showForm" transition-show="scale" transition-hide="scale">

View File

@ -87,13 +87,14 @@ 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
name="close" name="close"
@click.stop="value = null" @click.stop="value = null"
class="cursor-pointer" class="cursor-pointer"
size="18px" size="xs"
/> />
</template> </template>
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName"> <template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">

View File

@ -41,7 +41,7 @@ const props = defineProps({
}, },
}); });
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,
@ -116,6 +116,7 @@ const tags = computed(() => {
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) {

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

@ -156,9 +156,7 @@ export function useArrayData(key, userOptions) {
delete store.userParams[param]; delete store.userParams[param];
delete params[param]; delete params[param];
if (store.filter?.where) { if (store.filter?.where) {
delete store.filter.where[ delete store.filter.where[Object.keys(exprBuilder ? exprBuilder(param) : param)[0]];
Object.keys(exprBuilder ? exprBuilder(param) : param)[0]
];
if (Object.keys(store.filter.where).length === 0) { if (Object.keys(store.filter.where).length === 0) {
delete store.filter.where; delete store.filter.where;
} }

View File

@ -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: ' *';
}

8
src/filters/dateRange.js Normal file
View File

@ -0,0 +1,8 @@
export default function dateRange(value) {
const minHour = new Date(value);
minHour.setHours(0, 0, 0, 0);
const maxHour = new Date(value);
maxHour.setHours(23, 59, 59, 59);
return [minHour, maxHour];
}

View File

@ -7,6 +7,7 @@ import toCurrency from './toCurrency';
import toPercentage from './toPercentage'; import toPercentage from './toPercentage';
import toLowerCamel from './toLowerCamel'; import toLowerCamel from './toLowerCamel';
import dashIfEmpty from './dashIfEmpty'; import dashIfEmpty from './dashIfEmpty';
import dateRange from './dateRange';
export { export {
toLowerCase, toLowerCase,
@ -18,4 +19,5 @@ export {
toCurrency, toCurrency,
toPercentage, toPercentage,
dashIfEmpty, dashIfEmpty,
dateRange,
}; };

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,6 +62,7 @@ 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'
}, },
errors: { errors: {
statusUnauthorized: 'Access denied', statusUnauthorized: 'Access denied',
@ -113,9 +113,23 @@ export default {
webPayments: 'Web Payments', webPayments: 'Web Payments',
extendedList: 'Extended list', extendedList: 'Extended list',
notifications: 'Notifications', notifications: 'Notifications',
defaulter: 'Defaulter',
createCustomer: 'Create customer', createCustomer: 'Create customer',
summary: 'Summary', summary: 'Summary',
basicData: 'Basic Data', basicData: 'Basic data',
fiscalData: 'Fiscal data',
billingData: 'Billing data',
consignees: 'Consignees',
notes: 'Notes',
credits: 'Credits',
greuges: 'Greuges',
balance: 'Balance',
recoveries: 'Recoveries',
webAccess: 'Web access',
log: 'Log',
sms: 'Sms',
creditManagement: 'Credit management',
others: 'Others',
}, },
list: { list: {
phone: 'Phone', phone: 'Phone',
@ -605,6 +619,7 @@ export default {
basicData: 'Basic Data', basicData: 'Basic Data',
catalog: 'Catalog', catalog: 'Catalog',
volume: 'Volume', volume: 'Volume',
lines: 'Lines',
}, },
field: { field: {
salesPersonFk: 'Sales Person', salesPersonFk: 'Sales Person',

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,6 +62,7 @@ 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'
}, },
errors: { errors: {
statusUnauthorized: 'Acceso denegado', statusUnauthorized: 'Acceso denegado',
@ -113,9 +113,23 @@ export default {
webPayments: 'Pagos Web', webPayments: 'Pagos Web',
extendedList: 'Listado extendido', extendedList: 'Listado extendido',
notifications: 'Notificaciones', notifications: 'Notificaciones',
defaulter: 'Morosos',
createCustomer: 'Crear cliente', createCustomer: 'Crear cliente',
basicData: 'Datos básicos',
summary: 'Resumen', summary: 'Resumen',
basicData: 'Datos básicos',
fiscalData: 'Datos fiscales',
billingData: 'Forma de pago',
consignees: 'Consignatarios',
notes: 'Notas',
credits: 'Créditos',
greuges: 'Greuges',
balance: 'Balance',
recoveries: 'Recobros',
webAccess: 'Acceso web',
log: 'Historial',
sms: 'Sms',
creditManagement: 'Gestión de crédito',
others: 'Otros',
}, },
list: { list: {
phone: 'Teléfono', phone: 'Teléfono',
@ -513,6 +527,7 @@ export default {
basicData: 'Datos básicos', basicData: 'Datos básicos',
catalog: 'Catálogo', catalog: 'Catálogo',
volume: 'Volumen', volume: 'Volumen',
lines: 'Líneas',
}, },
field: { field: {
salesPersonFk: 'Comercial', salesPersonFk: 'Comercial',

View File

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

View File

@ -0,0 +1,3 @@
<template>
<div class="flex justify-center">Billing data</div>
</template>

View File

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

View File

@ -0,0 +1,3 @@
<template>
<div class="flex justify-center">Credit management</div>
</template>

View File

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

View File

@ -0,0 +1,3 @@
<template>
<div class="flex justify-center">Fiscal data</div>
</template>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,3 @@
<template>
<div class="flex justify-center">Web access</div>
</template>

View File

@ -0,0 +1,51 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { toCurrency } from 'filters/index';
const $props = defineProps({
amount: {
type: Number,
required: true,
},
});
const { t } = useI18n();
</script>
<template>
<div class="card_balance q-px-md q-py-sm q-my-sm">
<h6 class="title_balance text-center">{{ t('Total') }}</h6>
<div class="row">
<p class="key_balance">{{ t('Balance due') }}:&ensp;</p>
<b class="value_balance">
{{ toCurrency($props.amount) }}
</b>
</div>
</div>
</template>
<style lang="scss">
.card_balance {
border: 1px solid black;
}
.title_balance {
color: var(--vn-text);
margin-top: 0;
margin-bottom: 0;
}
.key_balance {
color: var(--vn-label);
margin-bottom: 0;
}
.value_balance {
color: var(--vn-text);
margin-bottom: 0;
}
</style>
<i18n>
es:
Total: Total
Balance due: Saldo vencido
</i18n>

View File

@ -0,0 +1,252 @@
<script setup>
import { ref, computed, onBeforeMount } from 'vue';
import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox } from 'quasar';
import { toCurrency, toDate } from 'filters/index';
import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore';
import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const { t } = useI18n();
const stateStore = useStateStore();
const arrayData = ref(null);
const balanceDueTotal = ref(0);
onBeforeMount(async () => {
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
);
console.log(balanceDueTotal.value);
stateStore.rightDrawer = true;
});
const rows = computed(() => arrayData.value.store.data);
const selected = ref([]);
const workerId = ref(0);
const customerId = ref(0);
const tableColumnComponents = {
client: {
component: QBtn,
props: () => ({ flat: true, color: 'blue' }),
event: ({ row }) => selectCustomerId(row.clientFk),
},
isWorker: {
component: QCheckbox,
props: ({ value }) => ({
disable: true,
'model-value': Boolean(value),
}),
event: () => {},
},
salesperson: {
component: QBtn,
props: () => ({ flat: true, color: 'blue' }),
event: ({ row }) => selectWorkerId(row.salesPersonFk),
},
country: {
component: 'span',
props: () => {},
event: () => {},
},
paymentMethod: {
component: 'span',
props: () => {},
event: () => {},
},
balance: {
component: 'span',
props: () => {},
event: () => {},
},
author: {
component: QBtn,
props: () => ({ flat: true, color: 'blue' }),
event: ({ row }) => selectWorkerId(row.workerFk),
},
lastObservation: {
component: 'span',
props: () => {},
event: () => {},
},
date: {
component: 'span',
props: () => {},
event: () => {},
},
credit: {
component: 'span',
props: () => {},
event: () => {},
},
from: {
component: 'span',
props: () => {},
event: () => {},
},
};
const columns = computed(() => [
{
align: 'left',
field: 'clientName',
label: t('Client'),
name: 'client',
},
{
align: 'left',
field: 'isWorker',
label: t('Is worker'),
name: 'isWorker',
},
{
align: 'left',
field: 'salesPersonName',
label: t('Salesperson'),
name: 'salesperson',
},
{
align: 'left',
field: 'country',
label: t('Country'),
name: 'country',
},
{
align: 'left',
field: 'payMethod',
label: t('P. Method'),
name: 'paymentMethod',
},
{
align: 'left',
field: ({ amount }) => toCurrency(amount),
label: t('Balance D.'),
name: 'balance',
},
{
align: 'left',
field: 'workerName',
label: t('Author'),
name: 'author',
},
{
align: 'left',
field: 'observation',
label: t('Last observation'),
name: 'lastObservation',
},
{
align: 'left',
field: ({ created }) => toDate(created),
label: t('L. O. Date'),
name: 'date',
},
{
align: 'left',
field: ({ creditInsurance }) => toCurrency(creditInsurance),
label: t('Credit I.'),
name: 'credit',
},
{
align: 'left',
field: ({ defaulterSinced }) => toDate(defaulterSinced),
label: t('From'),
name: 'from',
},
]);
const selectCustomerId = (id) => {
workerId.value = 0;
customerId.value = id;
};
const selectWorkerId = (id) => {
customerId.value = 0;
workerId.value = id;
};
</script>
<template>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<CustomerNotificationsFilter data-key="CustomerDefaulter" />
</QScrollArea>
</QDrawer>
<QToolbar class="bg-vn-dark">
<div id="st-data">
<CustomerBalanceDueTotal :amount="balanceDueTotal" />
</div>
<QSpace />
<div id="st-actions"></div>
</QToolbar>
<QPage class="column items-center q-pa-md">
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 0 }"
:rows="rows"
class="full-width q-mt-md"
hide-bottom
row-key="id"
selection="multiple"
v-model:selected="selected"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
class="col-content"
v-bind="tableColumnComponents[props.col.name].props(props)"
@click="tableColumnComponents[props.col.name].event(props)"
>
{{ props.value }}
<WorkerDescriptorProxy v-if="workerId" :id="workerId" />
<CustomerDescriptorProxy v-else :id="customerId" />
</component>
</QTr>
</QTd>
</template>
</QTable>
</QPage>
</template>
<style lang="scss" scoped>
.col-content {
border-radius: 4px;
padding: 6px;
}
</style>
<i18n>
es:
Client: Cliente
Is worker: Es trabajador
Salesperson: Comercial
Country: País
P. Method: F. Pago
Balance D.: Saldo V.
Author: Autor
Last observation: Última observación
L. O. Date: Fecha Ú. O.
Credit I.: Crédito A.
From: Desde
</i18n>

View File

@ -0,0 +1,238 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const clients = ref();
const salespersons = ref();
const countries = ref();
const authors = ref();
</script>
<template>
<FetchData @on-fetch="(data) => (clients = data)" auto-load url="Clients" />
<FetchData
:filter="{ where: { role: 'salesPerson' } }"
@on-fetch="(data) => (salespersons = data)"
auto-load
url="Workers/activeWithInheritedRole"
/>
<FetchData @on-fetch="(data) => (countries = data)" auto-load url="Countries" />
<FetchData
@on-fetch="(data) => (authors = data)"
auto-load
url="Workers/activeWithInheritedRole"
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params }">
<QList dense class="list">
<QItem class="q-mb-sm q-mt-sm">
<QItemSection v-if="clients">
<VnSelectFilter
:input-debounce="0"
:label="t('Client')"
:options="clients"
dense
emit-value
hide-selected
map-options
option-label="name"
option-value="clientTypeFk"
outlined
rounded
use-input
v-model="params.clientFk"
/>
</QItemSection>
<QItemSection v-else>
<QSkeleton class="full-width" type="QInput" />
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection v-if="salespersons">
<VnSelectFilter
:input-debounce="0"
:label="t('Salesperson')"
:options="salespersons"
dense
emit-value
hide-selected
map-options
option-label="name"
option-value="id"
outlined
rounded
use-input
v-model="params.salesPersonFk"
/>
</QItemSection>
<QItemSection v-else>
<QSkeleton class="full-width" type="QInput" />
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection v-if="countries">
<VnSelectFilter
:input-debounce="0"
:label="t('Country')"
:options="countries"
dense
emit-value
hide-selected
map-options
option-label="country"
option-value="id"
outlined
rounded
use-input
v-model="params.countryFk"
/>
</QItemSection>
<QItemSection v-else>
<QSkeleton class="full-width" type="QInput" />
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('P. Method')"
is-outlined
v-model="params.paymentMethod"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('Balance D.')"
is-outlined
v-model="params.balance"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection v-if="authors">
<VnSelectFilter
:input-debounce="0"
:label="t('Author')"
:options="authors"
dense
emit-value
hide-selected
map-options
option-label="name"
option-value="id"
outlined
rounded
use-input
v-model="params.workerFk"
/>
</QItemSection>
<QItemSection v-else>
<QSkeleton class="full-width" type="QInput" />
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('L. O. Date')"
is-outlined
v-model="params.date"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('Credit I.')"
is-outlined
v-model="params.credit"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInputDate
:label="t('From')"
is-outlined
v-model="params.defaulterSinced"
/>
</QItemSection>
</QItem>
<QSeparator />
</QList>
</template>
</VnFilterPanel>
</template>
<style scoped>
.list {
width: 256px;
}
.list * {
max-width: 100%;
}
</style>
<i18n>
en:
params:
clientFk: Client
salesPersonFk: Salesperson
countryFk: Country
paymentMethod: P. Method
balance: Balance D.
workerFk: Author
date: L. O. Date
credit: Credit I.
defaulterSinced: From
es:
params:
clientFk: Cliente
salesPersonFk: Comercial
countryFk: País
paymentMethod: F. Pago
balance: Saldo V.
workerFk: Autor
date: Fecha Ú. O.
credit: Crédito A.
defaulterSinced: Desde
Client: Cliente
Salesperson: Comercial
Country: País
P. Method: F. Pago
Balance D.: Saldo V.
Author: Autor
L. O. Date: Fecha Ú. O.
Credit I.: Crédito A.
From: Desde
</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

@ -4,7 +4,7 @@ import { useRouter } from 'vue-router';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import CustomerSummaryDialog from './Card/CustomerSummaryDialog.vue'; import CustomerSummaryDialog from '../Card/CustomerSummaryDialog.vue';
const { t } = useI18n(); const { t } = useI18n();
const quasar = useQuasar(); const quasar = useQuasar();

View File

@ -7,6 +7,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue'; import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import { dateRange } from 'src/filters';
const props = defineProps({ const props = defineProps({
dataKey: { dataKey: {
@ -32,6 +33,48 @@ const sageTransactionTypesOptions = ref([]);
const visibleColumnsSet = computed(() => new Set(props.visibleColumns)); const visibleColumnsSet = computed(() => new Set(props.visibleColumns));
const exprBuilder = (param, value) => {
switch (param) {
case 'created':
return {
'c.created': {
between: dateRange(value),
},
};
case 'id':
case 'name':
case 'socialName':
case 'fi':
case 'credit':
case 'creditInsurance':
case 'phone':
case 'mobile':
case 'street':
case 'city':
case 'postcode':
case 'email':
case 'isActive':
case 'isVies':
case 'isTaxDataChecked':
case 'isEqualizated':
case 'isFreezed':
case 'hasToInvoice':
case 'hasToInvoiceByAddress':
case 'isToBeMailed':
case 'hasSepaVnl':
case 'hasLcr':
case 'hasCoreVnl':
case 'countryFk':
case 'provinceFk':
case 'salesPersonFk':
case 'businessTypeFk':
case 'payMethodFk':
case 'sageTaxTypeFk':
case 'sageTransactionTypeFk':
return { [`c.${param}`]: value };
}
};
const shouldRenderColumn = (colName) => { const shouldRenderColumn = (colName) => {
return visibleColumnsSet.value.has(colName); return visibleColumnsSet.value.has(colName);
}; };
@ -88,7 +131,11 @@ const shouldRenderColumn = (colName) => {
auto-load auto-load
@on-fetch="(data) => (sageTransactionTypesOptions = data)" @on-fetch="(data) => (sageTransactionTypesOptions = data)"
/> />
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:expr-builder="exprBuilder"
>
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong <strong

View File

@ -8,7 +8,7 @@ import { useArrayData } from 'composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; 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';
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -57,8 +57,7 @@ const tableColumnComponents = {
}, },
}; };
const columns = computed(() => { const columns = computed(() => [
return [
{ {
align: 'left', align: 'left',
field: 'id', field: 'id',
@ -89,8 +88,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;
@ -121,11 +119,6 @@ const selectCustomerId = (id) => {
selection="multiple" selection="multiple"
v-model:selected="selected" v-model:selected="selected"
> >
<template #top>
<div v-if="rows" class="full-width flex justify-end">
{{ `${rows.length} ${t('route.cmr.list.results')}` }}
</div>
</template>
<template #body-cell="props"> <template #body-cell="props">
<QTd :props="props"> <QTd :props="props">
<QTr :props="props" class="cursor-pointer"> <QTr :props="props" class="cursor-pointer">
@ -148,7 +141,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

@ -4,8 +4,8 @@ import { useI18n } from 'vue-i18n';
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 VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -15,18 +15,18 @@ const props = defineProps({
}, },
}); });
const clients = ref();
const cities = ref(); const cities = ref();
const clients = ref();
</script> </script>
<template> <template>
<FetchData <FetchData
url="Clients"
:filter="{ where: { role: 'socialName' } }" :filter="{ where: { role: 'socialName' } }"
@on-fetch="(data) => (clients = data)" @on-fetch="(data) => (clients = data)"
auto-load auto-load
url="Clients"
/> />
<FetchData url="Towns" @on-fetch="(data) => (cities = data)" auto-load /> <FetchData @on-fetch="(data) => (cities = data)" auto-load url="Towns" />
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -41,8 +41,8 @@ const cities = ref();
<QItemSection> <QItemSection>
<VnInput <VnInput
:label="t('Identifier')" :label="t('Identifier')"
v-model="params.identifier"
is-outlined is-outlined
v-model="params.identifier"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
@ -53,20 +53,20 @@ const cities = ref();
</QItemSection> </QItemSection>
<QItemSection v-if="clients"> <QItemSection v-if="clients">
<VnSelectFilter <VnSelectFilter
:input-debounce="0"
:label="t('Social name')" :label="t('Social name')"
v-model="params.socialName"
@update:model-value="searchFn()"
:options="clients" :options="clients"
option-value="socialName" @update:model-value="searchFn()"
option-label="socialName"
emit-value
map-options
use-input
hide-selected
dense dense
emit-value
hide-selected
map-options
option-label="socialName"
option-value="socialName"
outlined outlined
rounded rounded
:input-debounce="0" use-input
v-model="params.socialName"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
@ -77,33 +77,33 @@ const cities = ref();
</QItemSection> </QItemSection>
<QItemSection v-if="cities"> <QItemSection v-if="cities">
<VnSelectFilter <VnSelectFilter
:input-debounce="0"
:label="t('City')" :label="t('City')"
v-model="params.city"
@update:model-value="searchFn()"
:options="cities" :options="cities"
option-value="name" @update:model-value="searchFn()"
option-label="name"
emit-value
map-options
use-input
hide-selected
dense dense
emit-value
hide-selected
map-options
option-label="name"
option-value="name"
outlined outlined
rounded rounded
:input-debounce="0" use-input
v-model="params.city"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection>
<VnInput :label="t('Phone')" v-model="params.phone" is-outlined /> <VnInput :label="t('Phone')" is-outlined v-model="params.phone" />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem class="q-mb-sm"> <QItem class="q-mb-sm">
<QItemSection> <QItemSection>
<VnInput :label="t('Email')" v-model="params.email" is-outlined /> <VnInput :label="t('Email')" is-outlined v-model="params.email" />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QSeparator /> <QSeparator />

View File

@ -7,7 +7,7 @@ import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
import CustomerDescriptorProxy from './Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import { toDate, toCurrency } from 'filters/index'; import { toDate, toCurrency } from 'filters/index';
import CustomerPaymentsFilter from './CustomerPaymentsFilter.vue'; import CustomerPaymentsFilter from './CustomerPaymentsFilter.vue';

View File

@ -60,13 +60,14 @@ const companiesOptions = ref([]);
<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 +84,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 +92,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 +113,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 +121,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 +132,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

@ -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

@ -255,7 +255,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

@ -21,16 +21,27 @@ 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 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) => {
@ -65,32 +76,35 @@ 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 setCategoryList = (data) => {
<FetchData categoryList.value = (data || [])
url="ItemCategories"
limit="30"
auto-load
@on-fetch="
(data) => {
categoryList = (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"
@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 +118,18 @@ function exprBuilder(param, value) {
<span>{{ formatFn(tag.value) }}</span> <span>{{ formatFn(tag.value) }}</span>
</div> </div>
</template> </template>
<template #body="{ params }"> <template #body="{ params, searchFn }">
<QList dense> <QList dense>
<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) }}
@ -140,7 +151,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">

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();
@ -70,7 +72,7 @@ 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>

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,7 +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';
const DEFAULT_ITEMS = 0;
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -60,9 +63,20 @@ 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);
</script> </script>
<template> <template>
<FetchData
:url="`Orders/${entityId}/getTotal`"
@on-fetch="(response) => (total = response)"
auto-load
/>
<CardDescriptor <CardDescriptor
ref="descriptor" ref="descriptor"
:url="`Orders/${entityId}`" :url="`Orders/${entityId}`"
@ -79,13 +93,7 @@ const setData = (entity) => {
<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>
@ -98,8 +106,11 @@ const setData = (entity) => {
<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
<VnLv :label="t('order.summary.total')" :value="toCurrency(entity?.total)" /> :label="t('order.summary.items')"
:value="(entity?.rows?.length || DEFAULT_ITEMS).toString()"
/>
<VnLv :label="t('order.summary.total')" :value="toCurrency(total)" />
</template> </template>
<template #actions="{ entity }"> <template #actions="{ entity }">
<QCardActions> <QCardActions>

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

@ -78,7 +78,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">

View File

@ -20,12 +20,6 @@ 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) {
switch (param) {
case 'search':
return { 'i.name': { like: `%${value}%` } };
}
}
</script> </script>
<template> <template>
@ -35,8 +29,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">
@ -70,6 +64,9 @@ function exprBuilder(param, value) {
> >
<template #body="{ rows }"> <template #body="{ rows }">
<div class="catalog-list"> <div class="catalog-list">
<div v-if="rows && !rows?.length" class="no-result">
{{ t('globals.noResults') }}
</div>
<OrderCatalogItem v-for="row in rows" :key="row.id" :item="row" /> <OrderCatalogItem v-for="row in rows" :key="row.id" :item="row" />
</div> </div>
</template> </template>
@ -78,7 +75,7 @@ function exprBuilder(param, value) {
</QPage> </QPage>
</template> </template>
<style lang="scss"> <style lang="scss" scoped>
.card-list { .card-list {
width: 100%; width: 100%;
} }
@ -90,4 +87,11 @@ function exprBuilder(param, value) {
justify-content: center; justify-content: center;
gap: 16px; gap: 16px;
} }
.no-result {
font-size: 24px;
font-weight: bold;
color: var(--vn-label);
text-align: center;
}
</style> </style>

View File

@ -0,0 +1,288 @@
<script setup>
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { ref } from 'vue';
import { useQuasar } from 'quasar';
import VnPaginate from 'components/ui/VnPaginate.vue';
import FetchData from 'components/FetchData.vue';
import VnLv from 'components/ui/VnLv.vue';
import CardList from 'components/ui/CardList.vue';
import FetchedTags from 'components/ui/FetchedTags.vue';
import VnConfirm from 'components/ui/VnConfirm.vue';
import { toCurrency, toDate } from 'src/filters';
import { useSession } from 'composables/useSession';
import axios from 'axios';
const route = useRoute();
const { t } = useI18n();
const session = useSession();
const quasar = useQuasar();
const token = session.getToken();
const orderSummary = ref({
total: null,
vat: null,
});
const componentKey = ref(0);
const refresh = () => {
componentKey.value += 1;
};
function confirmRemove(item) {
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('confirmDeletion'),
message: t('confirmDeletionMessage'),
promise: async () => remove(item),
},
});
}
async function remove(item) {
await axios.post('OrderRows/removes', {
actualOrderId: route.params.id,
rows: [item.id],
});
quasar.notify({
message: t('globals.dataDeleted'),
type: 'positive',
});
refresh();
}
async function confirmOrder() {
await axios.post(`Orders/${route.params.id}/confirm`);
quasar.notify({
message: t('globals.confirm'),
type: 'positive',
});
}
</script>
<template>
<FetchData
:key="componentKey"
:url="`Orders/${route.params.id}/getTotal`"
@on-fetch="(data) => (orderSummary.total = data)"
auto-load
/>
<FetchData
:key="componentKey"
:url="`Orders/${route.params.id}/getVAT`"
@on-fetch="(data) => (orderSummary.vat = data)"
auto-load
/>
<QPage :key="componentKey" class="column items-center q-pa-md">
<div class="card-list">
<div v-if="!orderSummary.total" class="no-result">
{{ t('globals.noResults') }}
</div>
<QCard v-else class="order-lines-summary q-pa-lg">
<p class="header text-right block">
{{ t('summary') }}
</p>
<VnLv
v-if="orderSummary.vat && orderSummary.total"
:label="t('subtotal')"
:value="toCurrency(orderSummary.total - orderSummary.vat)"
/>
<VnLv
v-if="orderSummary.vat"
:label="t('VAT')"
:value="toCurrency(orderSummary?.vat)"
/>
<VnLv
v-if="orderSummary.total"
:label="t('total')"
:value="toCurrency(orderSummary?.total)"
/>
</QCard>
<VnPaginate
data-key="OrderLines"
url="OrderRows"
:limit="20"
auto-load
:filter="{
include: [
{
relation: 'item',
},
{
relation: 'warehouse',
},
],
where: { orderFk: route.params.id },
}"
>
<template #body="{ rows }">
<div class="catalog-list q-mt-xl">
<CardList
v-for="row in rows"
:key="row.id"
:id="row.id"
:title="row?.item?.name"
class="cursor-inherit"
>
<template #title>
<div class="flex items-center">
<div class="image-wrapper q-mr-md">
<QImg
:src="`/api/Images/catalog/50x50/${row?.item?.id}/download?access_token=${token}`"
spinner-color="primary"
:ratio="1"
height="50"
width="50"
class="image"
/>
</div>
<div
class="title text-primary text-weight-bold text-h5"
>
{{ row?.item?.name }}
</div>
<QChip class="q-chip-color" outline size="sm">
{{ t('ID') }}: {{ row.id }}
</QChip>
</div>
</template>
<template #list-items>
<div class="q-mb-sm">
<span class="text-uppercase subname">
{{ row.item.subName }}
</span>
<fetched-tags :item="row.item" :max-length="5" />
</div>
<VnLv :label="t('item')" :value="String(row.item.id)" />
<VnLv
:label="t('warehouse')"
:value="row.warehouse.name"
/>
<VnLv
:label="t('shipped')"
:value="toDate(row.shipped)"
/>
<VnLv
:label="t('quantity')"
:value="String(row.quantity)"
/>
<VnLv
:label="t('price')"
:value="toCurrency(row.price)"
/>
<VnLv
:label="t('amount')"
:value="toCurrency(row.price * row.quantity)"
/>
</template>
<template #actions>
<QBtn
:label="t('remove')"
@click.stop="confirmRemove(row)"
color="primary"
style="margin-top: 15px"
/>
</template>
</CardList>
</div>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[20, 20]">
<QBtn fab icon="check" color="primary" @click="confirmOrder()" />
<QTooltip>
{{ t('confirm') }}
</QTooltip>
</QPageSticky>
</QPage>
</template>
<style lang="scss">
.order-lines-summary {
.vn-label-value {
display: flex;
justify-content: flex-end;
gap: 2%;
.label {
color: var(--vn-label);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.value {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
</style>
<style lang="scss" scoped>
.card-list {
width: 100%;
max-width: 60em;
}
.header {
color: $primary;
font-weight: bold;
margin-bottom: 25px;
font-size: 20px;
display: inline-block;
}
.image-wrapper {
height: 50px;
width: 50px;
.image {
border-radius: 50%;
}
}
.subname {
color: var(--vn-label);
}
.no-result {
font-size: 24px;
font-weight: bold;
color: var(--vn-label);
text-align: center;
}
</style>
<i18n>
en:
summary: Summary
subtotal: Subtotal
VAT: VAT
total: Total
item: Item
warehouse: Warehouse
shipped: Shipped
quantity: Quantity
price: Price
amount: Amount
remove: Remove
confirmDeletion: Confirm deletion,
confirmDeletionMessage: Are you sure you want to delete this item?
confirm: Confirm
es:
summary: Resumen
subtotal: Subtotal
VAT: IVA
total: Total
item: Artículo
warehouse: Almacén
shipped: F. envío
quantity: Cantidad
price: Precio
amount: Importe
remove: Eliminar
confirmDeletion: Confirmar eliminación,
confirmDeletionMessage: Seguro que quieres eliminar este artículo?
confirm: Confirmar
</i18n>

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);
@ -34,14 +36,17 @@ const loadVolumes = async (rows) => {
/> />
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<div class="card-list"> <div class="card-list">
<QCard class="order-volume-summary q-pa-lg"> <div
v-if="!volumeSummary?.totalVolume && !volumeSummary?.totalBoxes"
class="no-result"
>
{{ t('globals.noResults') }}
</div>
<QCard v-else class="order-volume-summary q-pa-lg">
<p class="header text-right block"> <p class="header text-right block">
{{ t('summary') }} {{ t('summary') }}
</p> </p>
<VnLv <VnLv :label="t('total')" :value="`${volumeSummary?.totalVolume} m³`" />
:label="t('total')"
:value="`${volumeSummary?.totalVolume} m³`"
/>
<VnLv <VnLv
:label="t('boxes')" :label="t('boxes')"
:value="`${dashIfEmpty(volumeSummary?.totalBoxes)} U`" :value="`${dashIfEmpty(volumeSummary?.totalBoxes)} U`"
@ -128,6 +133,13 @@ const loadVolumes = async (rows) => {
font-size: 20px; font-size: 20px;
display: inline-block; display: inline-block;
} }
.no-result {
font-size: 24px;
font-weight: bold;
color: var(--vn-label);
text-align: center;
}
</style> </style>
<i18n> <i18n>
en: en:

View File

@ -150,7 +150,7 @@ function downloadPdfs() {
<QIcon <QIcon
name="visibility" name="visibility"
color="primary" color="primary"
size="2em" size="md"
class="q-mr-sm q-ml-sm" class="q-mr-sm q-ml-sm"
/> />
<QTooltip> <QTooltip>

View File

@ -53,7 +53,7 @@ const isAdministrative = computed(() => {
> >
<template #header-left> <template #header-left>
<a v-if="isAdministrative" class="header link" :href="supplierUrl"> <a v-if="isAdministrative" class="header link" :href="supplierUrl">
<QIcon name="open_in_new" color="white" size="25px" /> <QIcon name="open_in_new" color="white" size="sm" />
</a> </a>
</template> </template>
<template #header> <template #header>

View File

@ -195,7 +195,7 @@ const openEntryDescriptor = () => {};
> >
<template #header-left> <template #header-left>
<a class="header link" :href="travelUrl"> <a class="header link" :href="travelUrl">
<QIcon name="open_in_new" color="white" size="25px" /> <QIcon name="open_in_new" color="white" size="sm" />
</a> </a>
</template> </template>
<template #header> <template #header>

View File

@ -103,8 +103,7 @@ const tableColumnComponents = {
}, },
}; };
const columns = computed(() => { const columns = computed(() => [
return [
{ {
label: 'id', label: 'id',
field: 'id', field: 'id',
@ -206,8 +205,7 @@ const columns = computed(() => {
format: (value) => toDate(value.substring(0, 10)), format: (value) => toDate(value.substring(0, 10)),
showValue: true, showValue: true,
}, },
]; ]);
});
async function getData() { async function getData() {
await arrayData.fetch({ append: false }); await arrayData.fetch({ append: false });
@ -395,7 +393,7 @@ onMounted(async () => {
<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;
} }
.secondary-row { .secondary-row {

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';

View File

@ -309,8 +309,8 @@ function exceedMaxHeight(pos) {
</div> </div>
</div> </div>
<div class="q-mb-sm wheels"> <div class="q-mb-sm wheels">
<QIcon color="grey-6" name="trip_origin" size="3rem" /> <QIcon color="grey-6" name="trip_origin" size="xl" />
<QIcon color="grey-6" name="trip_origin" size="3rem" /> <QIcon color="grey-6" name="trip_origin" size="xl" />
</div> </div>
<QDialog <QDialog
v-model="colorPickerActive" v-model="colorPickerActive"

View File

@ -15,8 +15,24 @@ export default {
'CustomerPayments', 'CustomerPayments',
'CustomerExtendedList', 'CustomerExtendedList',
'CustomerNotifications', 'CustomerNotifications',
'CustomerDefaulter',
],
card: [
'CustomerBasicData',
'CustomerFiscalData',
'CustomerBillingData',
'CustomerConsignees',
'CustomerNotes',
'CustomerCredits',
'CustomerGreuges',
'CustomerBalance',
'CustomerRecoveries',
'CustomerWebAccess',
'CustomerLog',
'CustomerSms',
'CustomerCreditManagement',
'CustomerOthers',
], ],
card: ['CustomerBasicData'],
}, },
children: [ children: [
{ {
@ -49,7 +65,8 @@ export default {
title: 'webPayments', title: 'webPayments',
icon: 'vn:onlinepayment', icon: 'vn:onlinepayment',
}, },
component: () => import('src/pages/Customer/CustomerPayments.vue'), component: () =>
import('src/pages/Customer/Payments/CustomerPayments.vue'),
}, },
{ {
path: 'extendedList', path: 'extendedList',
@ -59,7 +76,9 @@ export default {
icon: 'vn:client', icon: 'vn:client',
}, },
component: () => component: () =>
import('src/pages/Customer/CustomerExtendedList.vue'), import(
'src/pages/Customer/ExtendedList/CustomerExtendedList.vue'
),
}, },
{ {
path: 'notifications', path: 'notifications',
@ -69,7 +88,19 @@ export default {
icon: 'notifications', icon: 'notifications',
}, },
component: () => component: () =>
import('src/pages/Customer/CustomerNotifications.vue'), import(
'src/pages/Customer/Notifications/CustomerNotifications.vue'
),
},
{
path: 'defaulter',
name: 'CustomerDefaulter',
meta: {
title: 'defaulter',
icon: 'vn:risk',
},
component: () =>
import('src/pages/Customer/Defaulter/CustomerDefaulter.vue'),
}, },
], ],
}, },
@ -99,6 +130,132 @@ export default {
component: () => component: () =>
import('src/pages/Customer/Card/CustomerBasicData.vue'), import('src/pages/Customer/Card/CustomerBasicData.vue'),
}, },
{
path: 'fiscal-data',
name: 'CustomerFiscalData',
meta: {
title: 'fiscalData',
icon: 'vn:dfiscales',
},
component: () =>
import('src/pages/Customer/Card/CustomerFiscalData.vue'),
},
{
path: 'billing-data',
name: 'CustomerBillingData',
meta: {
title: 'billingData',
icon: 'vn:payment',
},
component: () =>
import('src/pages/Customer/Card/CustomerBillingData.vue'),
},
{
path: 'consignees',
name: 'CustomerConsignees',
meta: {
title: 'consignees',
icon: 'vn:delivery',
},
component: () =>
import('src/pages/Customer/Card/CustomerConsignees.vue'),
},
{
path: 'notes',
name: 'CustomerNotes',
meta: {
title: 'notes',
icon: 'vn:notes',
},
component: () => import('src/pages/Customer/Card/CustomerNotes.vue'),
},
{
path: 'credits',
name: 'CustomerCredits',
meta: {
title: 'credits',
icon: 'vn:credit',
},
component: () =>
import('src/pages/Customer/Card/CustomerCredits.vue'),
},
{
path: 'greuges',
name: 'CustomerGreuges',
meta: {
title: 'greuges',
icon: 'vn:greuge',
},
component: () =>
import('src/pages/Customer/Card/CustomerGreuges.vue'),
},
{
path: 'balance',
name: 'CustomerBalance',
meta: {
title: 'balance',
icon: 'vn:invoice',
},
component: () =>
import('src/pages/Customer/Card/CustomerBalance.vue'),
},
{
path: 'recoveries',
name: 'CustomerRecoveries',
meta: {
title: 'recoveries',
icon: 'vn:recovery',
},
component: () =>
import('src/pages/Customer/Card/CustomerRecoveries.vue'),
},
{
path: 'web-access',
name: 'CustomerWebAccess',
meta: {
title: 'webAccess',
icon: 'vn:web',
},
component: () =>
import('src/pages/Customer/Card/CustomerWebAccess.vue'),
},
{
path: 'log',
name: 'CustomerLog',
meta: {
title: 'log',
icon: 'vn:History',
},
component: () => import('src/pages/Customer/Card/CustomerLog.vue'),
},
{
path: 'sms',
name: 'CustomerSms',
meta: {
title: 'sms',
icon: 'sms',
},
component: () => import('src/pages/Customer/Card/CustomerSms.vue'),
},
{
path: 'credit-management',
name: 'CustomerCreditManagement',
meta: {
title: 'creditManagement',
icon: 'paid',
},
component: () =>
import('src/pages/Customer/Card/CustomerCreditManagement.vue'),
},
{
path: 'others',
name: 'CustomerOthers',
meta: {
title: 'others',
icon: 'pending',
},
component: () => import('src/pages/Customer/Card/CustomerOthers.vue'),
},
], ],
}, },
], ],

View File

@ -11,7 +11,7 @@ export default {
redirect: { name: 'OrderMain' }, redirect: { name: 'OrderMain' },
menus: { menus: {
main: ['OrderList'], main: ['OrderList'],
card: ['OrderBasicData', 'OrderCatalog', 'OrderVolume'], card: ['OrderBasicData', 'OrderCatalog', 'OrderVolume', 'OrderLines'],
}, },
children: [ children: [
{ {
@ -81,6 +81,15 @@ export default {
}, },
component: () => import('src/pages/Order/OrderVolume.vue'), component: () => import('src/pages/Order/OrderVolume.vue'),
}, },
{
name: 'OrderLines',
path: 'line',
meta: {
title: 'lines',
icon: 'vn:lines',
},
component: () => import('src/pages/Order/OrderLines.vue'),
},
], ],
}, },
], ],

View File

@ -1,11 +1,10 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest'; import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper'; import { createWrapper, axios } from 'app/test/vitest/helper';
import CustomerPayments from 'pages/Customer/CustomerPayments.vue'; import CustomerPayments from 'src/pages/Customer/Payments/CustomerPayments.vue';
describe('CustomerPayments', () => { describe('CustomerPayments', () => {
let vm; let vm;
beforeAll(() => { beforeAll(() => {
vm = createWrapper(CustomerPayments, { vm = createWrapper(CustomerPayments, {
global: { global: {
@ -13,7 +12,7 @@ describe('CustomerPayments', () => {
mocks: { mocks: {
fetch: vi.fn(), fetch: vi.fn(),
}, },
} },
}).vm; }).vm;
}); });
@ -28,11 +27,10 @@ describe('CustomerPayments', () => {
await vm.confirmTransaction({ id: 1 }); await vm.confirmTransaction({ id: 1 });
expect(vm.quasar.notify).toHaveBeenCalledWith( expect(vm.quasar.notify).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
message: 'Payment confirmed', message: 'Payment confirmed',
type: 'positive' type: 'positive',
}) })
); );
}); });