0
0
Fork 0

Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7283-itemMigration

This commit is contained in:
Carlos Satorres 2024-08-01 10:19:26 +02:00
commit 2604441c13
201 changed files with 2171 additions and 2925 deletions

View File

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

View File

@ -43,6 +43,15 @@ const onResponseError = (error) => {
}
switch (response?.status) {
case 422:
if (error.name == 'ValidationError')
message +=
' "' +
responseError.details.context +
'.' +
Object.keys(responseError.details.codes).join(',') +
'"';
break;
case 500:
message = 'errors.statusInternalServerError';
break;

View File

@ -1,28 +1,11 @@
import { getCurrentInstance } from 'vue';
const filterAvailableInput = (element) => {
return element.classList.contains('q-field__native') && !element.disabled;
};
const filterAvailableText = (element) => {
return (
element.__vueParentComponent.type.name === 'QInput' &&
element.__vueParentComponent?.attrs?.class !== 'vn-input-date'
);
};
export default {
mounted: function () {
const vm = getCurrentInstance();
if (vm.type.name === 'QForm') {
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
// AUTOFOCUS
const elementsArray = Array.from(this.$el.elements);
const availableInputs = elementsArray.filter(filterAvailableInput);
const firstInputElement = availableInputs.find(filterAvailableText);
if (firstInputElement) {
firstInputElement.focus();
}
// TODO: AUTOFOCUS IS NOT FOCUSING
const that = this;
this.$el.addEventListener('keyup', function (evt) {
if (evt.key === 'Enter') {

View File

@ -52,7 +52,7 @@ onMounted(async () => {
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('name')"
v-model="data.name"
@ -67,7 +67,7 @@ onMounted(async () => {
:rules="validate('bankEntity.bic')"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnSelect
:label="t('country')"

View File

@ -59,7 +59,7 @@ const onDataSaved = async (formData, requestResponse) => {
<QIcon name="warning" class="fill-icon q-mr-sm" size="md" />
{{ t('Invoicing in progress...') }}
</span>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Ticket')"
:options="ticketsOptions"
@ -99,7 +99,7 @@ const onDataSaved = async (formData, requestResponse) => {
/>
<VnInputDate :label="t('Max date')" v-model="data.maxShipped" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Serial')"
:options="invoiceOutSerialsOptions"
@ -117,7 +117,7 @@ const onDataSaved = async (formData, requestResponse) => {
v-model="data.taxArea"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('Reference')"
type="textarea"

View File

@ -4,8 +4,8 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectProvince from 'components/VnSelectProvince.vue';
import VnInput from 'components/common/VnInput.vue';
import FormModelPopup from './FormModelPopup.vue';
const emit = defineEmits(['onDataSaved']);
@ -19,8 +19,8 @@ const cityFormData = reactive({
const provincesOptions = ref([]);
const onDataSaved = (dataSaved) => {
emit('onDataSaved', dataSaved);
const onDataSaved = (...args) => {
emit('onDataSaved', ...args);
};
</script>
@ -36,24 +36,16 @@ const onDataSaved = (dataSaved) => {
:form-initial-data="cityFormData"
url-create="towns"
model="city"
@on-data-saved="onDataSaved($event)"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('Name')"
v-model="data.name"
:rules="validate('city.name')"
/>
<VnSelect
:label="t('Province')"
:options="provincesOptions"
hide-selected
option-label="name"
option-value="id"
v-model="data.provinceFk"
:rules="validate('city.provinceFk')"
/>
<VnSelectProvince v-model="data.provinceFk" />
</VnRow>
</template>
</FormModelPopup>

View File

@ -5,9 +5,9 @@ import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectProvince from 'src/components/VnSelectProvince.vue';
import VnInput from 'src/components/common/VnInput.vue';
import CreateNewCityForm from './CreateNewCityForm.vue';
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
import FormModelPopup from './FormModelPopup.vue';
@ -22,20 +22,17 @@ const postcodeFormData = reactive({
townFk: null,
});
const townsFetchDataRef = ref(null);
const provincesFetchDataRef = ref(null);
const countriesOptions = ref([]);
const provincesOptions = ref([]);
const townsLocationOptions = ref([]);
const town = ref({});
const onDataSaved = (formData) => {
function onDataSaved(formData) {
const newPostcode = {
...formData,
};
const townObject = townsLocationOptions.value.find(
({ id }) => id === formData.townFk
);
newPostcode.town = townObject?.name;
newPostcode.town = town.value.name;
newPostcode.townFk = town.value.id;
const provinceObject = provincesOptions.value.find(
({ id }) => id === formData.provinceFk
);
@ -43,39 +40,40 @@ const onDataSaved = (formData) => {
const countryObject = countriesOptions.value.find(
({ id }) => id === formData.countryFk
);
newPostcode.country = countryObject?.country;
newPostcode.country = countryObject?.name;
emit('onDataSaved', newPostcode);
};
}
const onCityCreated = async ({ name, provinceFk }, formData) => {
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;
};
async function onCityCreated(newTown, formData) {
newTown.province = provincesOptions.value.find(
(province) => province.id === newTown.provinceFk
);
formData.townFk = newTown;
setTown(newTown, formData);
}
const onProvinceCreated = async ({ name }, formData) => {
function setTown(newTown, data) {
if (!newTown) return;
town.value = newTown;
data.provinceFk = newTown.provinceFk;
data.countryFk = newTown.province.countryFk;
}
async function setProvince(id, data) {
await provincesFetchDataRef.value.fetch();
formData.provinceFk = provincesOptions.value.find(
(province) => province.name === name
).id;
};
const newProvince = provincesOptions.value.find((province) => province.id == id);
if (!newProvince) return;
data.countryFk = newProvince.countryFk;
}
</script>
<template>
<FetchData
ref="townsFetchDataRef"
@on-fetch="(data) => (townsLocationOptions = data)"
auto-load
url="Towns/location"
/>
<FetchData
ref="provincesFetchDataRef"
@on-fetch="(data) => (provincesOptions = data)"
auto-load
url="Provinces"
url="Provinces/location"
/>
<FetchData
@on-fetch="(data) => (countriesOptions = data)"
@ -88,10 +86,11 @@ const onProvinceCreated = async ({ name }, formData) => {
:title="t('New postcode')"
:subtitle="t('Please, ensure you put the correct data!')"
:form-initial-data="postcodeFormData"
:mapper="(data) => (data.townFk = data.townFk.id) && data"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('Postcode')"
v-model="data.code"
@ -99,38 +98,43 @@ const onProvinceCreated = async ({ name }, formData) => {
/>
<VnSelectDialog
:label="t('City')"
:options="townsLocationOptions"
url="Towns/location"
@update:model-value="(value) => setTown(value, data)"
v-model="data.townFk"
hide-selected
option-label="name"
option-value="id"
:rules="validate('postcode.city')"
:roles-allowed-to-create="['deliveryAssistant']"
:emit-value="false"
clearable
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
<QItemSection>
<QItemLabel>{{ opt.name }}</QItemLabel>
<QItemLabel caption>
{{ opt.province.name }},
{{ opt.province.country.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
<template #form>
<CreateNewCityForm @on-data-saved="onCityCreated($event, data)" />
<CreateNewCityForm
@on-data-saved="
(_, requestResponse) =>
onCityCreated(requestResponse, data)
"
/>
</template>
</VnSelectDialog>
</VnRow>
<VnRow class="row q-gutter-md q-mb-xl">
<VnSelectDialog
:label="t('Province')"
:options="provincesOptions"
hide-selected
option-label="name"
option-value="id"
<VnRow>
<VnSelectProvince
@update:model-value="(value) => setProvince(value, data)"
v-model="data.provinceFk"
:rules="validate('postcode.provinceFk')"
:roles-allowed-to-create="['deliveryAssistant']"
>
<template #form>
<CreateNewProvinceForm
@on-data-saved="onProvinceCreated($event, data)"
/>
</template> </VnSelectDialog
></VnRow>
<VnRow class="row q-gutter-md q-mb-xl"
><VnSelect
/>
<VnSelect
:label="t('Country')"
:options="countriesOptions"
hide-selected

View File

@ -19,8 +19,11 @@ const provinceFormData = reactive({
const autonomiesOptions = ref([]);
const onDataSaved = (dataSaved) => {
emit('onDataSaved', dataSaved);
const onDataSaved = (dataSaved, requestResponse) => {
requestResponse.autonomy = autonomiesOptions.value.find(
(autonomy) => autonomy.id == requestResponse.autonomyFk
);
emit('onDataSaved', dataSaved, requestResponse);
};
</script>
@ -28,7 +31,7 @@ const onDataSaved = (dataSaved) => {
<FetchData
@on-fetch="(data) => (autonomiesOptions = data)"
auto-load
url="Autonomies"
url="Autonomies/location"
/>
<FormModelPopup
:title="t('New province')"
@ -36,10 +39,10 @@ const onDataSaved = (dataSaved) => {
url-create="provinces"
model="province"
:form-initial-data="provinceFormData"
@on-data-saved="onDataSaved($event)"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('Name')"
v-model="data.name"
@ -53,7 +56,16 @@ const onDataSaved = (dataSaved) => {
option-value="id"
v-model="data.autonomyFk"
:rules="validate('province.autonomyFk')"
/>
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
<QItemSection>
<QItemLabel>{{ opt.name }}</QItemLabel>
<QItemLabel caption> {{ opt.country.name }} </QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnRow>
</template>
</FormModelPopup>

View File

@ -53,7 +53,7 @@ const onDataSaved = (dataSaved) => {
@on-data-saved="onDataSaved($event)"
>
<template #form-inputs="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('Identifier')"
v-model="data.thermographId"

View File

@ -1,7 +1,7 @@
<script setup>
import axios from 'axios';
import { computed, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { useRouter, onBeforeRouteLeave } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { useValidator } from 'src/composables/useValidator';
@ -97,6 +97,19 @@ defineExpose({
vnPaginateRef,
});
onBeforeRouteLeave((to, from, next) => {
if (hasChanges.value)
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('globals.unsavedPopup.title'),
message: t('globals.unsavedPopup.subtitle'),
promise: () => next(),
},
});
else next();
});
async function fetch(data) {
resetData(data);
emit('onFetch', data);

View File

@ -245,14 +245,14 @@ const makeRequest = async () => {
</div>
<div class="column">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QOptionGroup
:options="uploadMethodsOptions"
type="radio"
v-model="uploadMethodSelected"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QFile
v-if="uploadMethodSelected === 'computer'"
ref="inputFileRef"
@ -287,7 +287,7 @@ const makeRequest = async () => {
placeholder="https://"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Orientation')"
:options="viewportTypes"

View File

@ -82,7 +82,7 @@ const closeForm = () => {
<span class="title">{{ t('Edit') }}</span>
<span class="countLines">{{ ` ${rows.length} ` }}</span>
<span class="title">{{ t('buy(s)') }}</span>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Field to edit')"
:options="fieldsOptions"

View File

@ -151,7 +151,7 @@ const selectItem = ({ id }) => {
<QIcon name="close" size="sm" />
</span>
<h1 class="title">{{ t('Filter item') }}</h1>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput :label="t('entry.buys.name')" v-model="itemFilterParams.name" />
<VnInput :label="t('entry.buys.size')" v-model="itemFilterParams.size" />
<VnSelect

View File

@ -144,7 +144,7 @@ const selectTravel = ({ id }) => {
<QIcon name="close" size="sm" />
</span>
<h1 class="title">{{ t('Filter travels') }}</h1>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('entry.basicData.agency')"
:options="agenciesOptions"

View File

@ -15,7 +15,7 @@ const props = defineProps({
default: null,
},
warehouseFk: {
type: Boolean,
type: Number,
default: null,
},
});
@ -23,7 +23,7 @@ const props = defineProps({
const { t } = useI18n();
const regularizeFormData = reactive({
itemFk: props.itemFk,
itemFk: Number(props.itemFk),
warehouseFk: props.warehouseFk,
quantity: null,
});
@ -49,18 +49,19 @@ const onDataSaved = (data) => {
@on-data-saved="onDataSaved($event)"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QInput
:label="t('Type the visible quantity')"
v-model.number="data.quantity"
type="number"
autofocus
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnSelect
:label="t('Warehouse')"
v-model="data.warehouseFk"
v-model.number="data.warehouseFk"
:options="warehousesOptions"
option-value="id"
option-label="name"

View File

@ -118,13 +118,13 @@ const makeInvoice = async () => {
/>
<QDialog ref="dialogRef">
<FormPopup
@on-submit="makeInvoice()"
:title="t('Transfer invoice')"
:custom-submit-button-label="t('Transfer client')"
:default-cancel-button="false"
@on-submit="makeInvoice()"
:title="t('Transfer invoice')"
:custom-submit-button-label="t('Transfer client')"
:default-cancel-button="false"
>
<template #form-inputs>
<VnRow class="row q-gutter-md q-mb-md">
<template #form-inputs>
<VnRow>
<VnSelect
:label="t('Client')"
:options="clientsOptions"
@ -160,7 +160,7 @@ const makeInvoice = async () => {
:required="true"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Class')"
:options="siiTypeInvoiceOutsOptions"
@ -191,9 +191,12 @@ const makeInvoice = async () => {
:required="true"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div>
<QCheckbox :label="t('Bill destination client')" v-model="checked" />
<QCheckbox
:label="t('Bill destination client')"
v-model="checked"
/>
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
<QTooltip>{{ t('transferInvoiceInfo') }}</QTooltip>
</QIcon>

View File

@ -0,0 +1,59 @@
<script setup>
import { ref, watch } from 'vue';
import { useValidator } from 'src/composables/useValidator';
import { useI18n } from 'vue-i18n';
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
import FetchData from 'components/FetchData.vue';
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
const emit = defineEmits(['onProvinceCreated']);
const provinceFk = defineModel({ type: Number });
watch(provinceFk, async () => await provincesFetchDataRef.value.fetch());
const { validate } = useValidator();
const { t } = useI18n();
const provincesOptions = ref();
const provincesFetchDataRef = ref();
async function onProvinceCreated(_, data) {
await provincesFetchDataRef.value.fetch();
provinceFk.value = data.id;
emit('onProvinceCreated', data);
}
</script>
<template>
<FetchData
ref="provincesFetchDataRef"
:filter="{ include: { relation: 'country' } }"
@on-fetch="(data) => (provincesOptions = data)"
auto-load
url="Provinces"
/>
<VnSelectDialog
:label="t('Province')"
:options="provincesOptions"
hide-selected
v-model="provinceFk"
:rules="validate && validate('postcode.provinceFk')"
:roles-allowed-to-create="['deliveryAssistant']"
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
<QItemSection>
<QItemLabel>{{ opt.name }}</QItemLabel>
<QItemLabel caption> {{ opt.country.name }} </QItemLabel>
</QItemSection>
</QItem>
</template>
<template #form>
<CreateNewProvinceForm @on-data-saved="onProvinceCreated" />
</template>
</VnSelectDialog>
</template>
<i18n>
es:
Province: Provincia
</i18n>

View File

@ -35,7 +35,9 @@ function stopEventPropagation(event) {
dense
square
>
<span v-if="!col.chip.icon">{{ row[col.name] }}</span>
<span v-if="!col.chip.icon">
{{ col.format ? col.format(row) : row[col.name] }}
</span>
<QIcon v-else :name="col.chip.icon" color="primary-light" />
</QChip>
</span>

View File

@ -7,9 +7,11 @@ import { dashIfEmpty } from 'src/filters';
import VnSelect from 'components/common/VnSelect.vue';
import VnSelectCache from 'components/common/VnSelectCache.vue';
import VnInput from 'components/common/VnInput.vue';
import VnInputNumber from 'components/common/VnInputNumber.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnInputTime from 'components/common/VnInputTime.vue';
import VnComponent from 'components/common/VnComponent.vue';
import VnUserLink from 'components/ui/VnUserLink.vue';
const model = defineModel(undefined, { required: true });
const $props = defineProps({
@ -66,7 +68,7 @@ const defaultComponents = {
},
},
number: {
component: markRaw(VnInput),
component: markRaw(VnInputNumber),
attrs: {
disable: !$props.isEditable,
class: 'fit',
@ -98,14 +100,14 @@ const defaultComponents = {
},
checkbox: {
component: markRaw(QCheckbox),
attrs: (prop) => {
attrs: ({ model }) => {
const defaultAttrs = {
disable: !$props.isEditable,
'model-value': Boolean(prop),
'model-value': Boolean(model),
class: 'no-padding fit',
};
if (typeof prop == 'number') {
if (typeof model == 'number') {
defaultAttrs['true-value'] = 1;
defaultAttrs['false-value'] = 0;
}
@ -126,6 +128,9 @@ const defaultComponents = {
icon: {
component: markRaw(QIcon),
},
userLink: {
component: markRaw(VnUserLink),
},
};
const value = computed(() => {
@ -147,7 +152,7 @@ const col = computed(() => {
}
if (
(newColumn.name.startsWith('is') || newColumn.name.startsWith('has')) &&
!newColumn.component
newColumn.component == null
)
newColumn.component = 'checkbox';
if ($props.default && !newColumn.component) newColumn.component = $props.default;
@ -163,14 +168,14 @@ const components = computed(() => $props.components ?? defaultComponents);
v-if="col.before"
:prop="col.before"
:components="components"
:value="model"
:value="{ row, model }"
v-model="model"
/>
<VnComponent
v-if="col.component"
:prop="col"
:components="components"
:value="model"
:value="{ row, model }"
v-model="model"
/>
<span :title="value" v-else>{{ value }}</span>
@ -178,7 +183,7 @@ const components = computed(() => $props.components ?? defaultComponents);
v-if="col.after"
:prop="col.after"
:components="components"
:value="model"
:value="{ row, model }"
v-model="model"
/>
</div>

View File

@ -10,6 +10,8 @@ import VnInputDate from 'components/common/VnInputDate.vue';
import VnInputTime from 'components/common/VnInputTime.vue';
import VnTableColumn from 'components/VnTable/VnColumn.vue';
defineExpose({ addFilter });
const $props = defineProps({
column: {
type: Object,
@ -32,7 +34,7 @@ const model = defineModel(undefined, { required: true });
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
const columnFilter = computed(() => $props.column?.columnFilter);
const updateEvent = { 'update:modelValue': addFilter };
const updateEvent = { 'update:modelValue': addFilter, remove: () => addFilter(null) };
const enterEvent = {
'keyup.enter': () => addFilter(model.value),
remove: () => addFilter(null),
@ -45,7 +47,7 @@ const defaultAttrs = {
};
const forceAttrs = {
label: $props.showTitle ? '' : $props.column.label,
label: $props.showTitle ? '' : columnFilter.value?.label ?? $props.column.label,
};
const selectComponent = {
@ -75,6 +77,7 @@ const components = {
attrs: {
...defaultAttrs,
clearable: true,
type: 'number',
},
forceAttrs,
},

View File

@ -1,7 +1,7 @@
<script setup>
import { ref } from 'vue';
import { useArrayData } from 'composables/useArrayData';
const model = defineModel({ type: Object, required: true });
const model = defineModel({ type: Object });
const $props = defineProps({
name: {
type: String,
@ -56,7 +56,7 @@ defineExpose({ orderBy });
<span :title="label">{{ label }}</span>
<QChip
v-if="name"
:label="!vertical && model?.index"
:label="!vertical ? model?.index : ''"
:icon="
(model?.index || hover) && !vertical
? model?.direction == 'DESC'

View File

@ -37,6 +37,10 @@ const $props = defineProps({
type: [Function, Boolean],
default: null,
},
rowCtrlClick: {
type: [Function, Boolean],
default: null,
},
redirect: {
type: String,
default: null,
@ -92,9 +96,9 @@ const route = useRoute();
const router = useRouter();
const quasar = useQuasar();
const DEFAULT_MODE = 'card';
const CARD_MODE = 'card';
const TABLE_MODE = 'table';
const mode = ref(DEFAULT_MODE);
const mode = ref(CARD_MODE);
const selected = ref([]);
const hasParams = ref(false);
const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}');
@ -114,7 +118,7 @@ const tableModes = [
{
icon: 'grid_view',
title: t('grid view'),
value: DEFAULT_MODE,
value: CARD_MODE,
disable: $props.disableOption?.card,
},
];
@ -124,7 +128,10 @@ onBeforeMount(() => {
});
onMounted(() => {
mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode;
mode.value =
quasar.platform.is.mobile && !$props.disableOption?.card
? CARD_MODE
: $props.defaultMode;
stateStore.rightDrawer = true;
columnsVisibilitySkiped.value = [
...splittedColumns.value.columns
@ -171,13 +178,17 @@ function splitColumns(columns) {
};
for (const col of columns) {
if (col.name == 'tableActions') splittedColumns.value.actions = col;
if (col.name == 'tableActions') {
col.orderBy = false;
splittedColumns.value.actions = col;
}
if (col.chip) splittedColumns.value.chips.push(col);
if (col.isTitle) splittedColumns.value.title = col;
if (col.create) splittedColumns.value.create.push(col);
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
if ($props.isEditable && col.disable == null) col.disable = false;
if ($props.useModel) col.columnFilter = { ...col.columnFilter, inWhere: true };
if ($props.useModel && col.columnFilter != false)
col.columnFilter = { ...col.columnFilter, inWhere: true };
splittedColumns.value.columns.push(col);
}
// Status column
@ -202,6 +213,16 @@ const rowClickFunction = computed(() => {
return () => {};
});
const rowCtrlClickFunction = computed(() => {
if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick;
if ($props.redirect)
return (evt, { id }) => {
stopEventPropagation(evt);
window.open(`/#/${$props.redirect}/${id}`, '_blank');
};
return () => {};
});
function redirectFn(id) {
router.push({ path: `/${$props.redirect}/${id}` });
}
@ -212,6 +233,7 @@ function stopEventPropagation(event) {
}
function reload(params) {
selected.value = [];
CrudModelRef.value.reload(params);
}
@ -263,7 +285,9 @@ defineExpose({
<template #body>
<div
class="row no-wrap flex-center"
v-for="col of splittedColumns.columns"
v-for="col of splittedColumns.columns.filter(
(c) => c.columnFilter ?? true
)"
:key="col.id"
>
<VnTableFilter
@ -273,6 +297,10 @@ defineExpose({
:search-url="searchUrl"
/>
<VnTableOrder
v-if="
col?.columnFilter !== false &&
col?.name !== 'tableActions'
"
v-model="orders[col.name]"
:name="col.orderBy ?? col.name"
:data-key="$attrs['data-key']"
@ -285,11 +313,6 @@ defineExpose({
:params="params"
:columns="splittedColumns.columns"
/>
<slot
name="moreFilterPanel"
:params="params"
:columns="splittedColumns.columns"
/>
</template>
</VnFilterPanel>
</QScrollArea>
@ -300,6 +323,7 @@ defineExpose({
v-bind="$attrs"
:limit="20"
ref="CrudModelRef"
@on-fetch="(...args) => emit('onFetch', ...args)"
:search-url="searchUrl"
:disable-infinite-scroll="isTableMode"
@save-changes="reload"
@ -337,7 +361,7 @@ defineExpose({
<template #top-left v-if="!$props.withoutHeader">
<slot name="top-left"></slot>
</template>
<template #top-right>
<template #top-right v-if="!$props.withoutHeader">
<VnVisibleColumn
v-if="isTableMode"
v-model="splittedColumns.columns"
@ -361,11 +385,11 @@ defineExpose({
/>
</template>
<template #header-cell="{ col }">
<QTh v-if="col.visible ?? true" auto-width>
<QTh v-if="col.visible ?? true">
<div
class="column self-start q-ml-xs ellipsis"
:class="`text-${col?.align ?? 'left'}`"
style="height: 75px"
:style="$props.columnSearch ? 'height: 75px' : ''"
>
<div
class="row items-center no-wrap"
@ -386,6 +410,7 @@ defineExpose({
:data-key="$attrs['data-key']"
v-model="params[columnName(col)]"
:search-url="searchUrl"
class="full-width"
/>
</div>
</QTh>
@ -405,15 +430,25 @@ defineExpose({
</VnTableChip>
</QTd>
</template>
<template #body-cell="{ col, row }">
<template #body-cell="{ col, row, rowIndex }">
<!-- Columns -->
<QTd
auto-width
class="no-margin q-px-xs"
:class="[getColAlign(col), col.class, col.columnField?.class]"
:class="[getColAlign(col), col.columnClass]"
v-if="col.visible ?? true"
@click.ctrl="
($event) =>
rowCtrlClickFunction &&
rowCtrlClickFunction($event, row)
"
>
<slot :name="`column-${col.name}`" :col="col" :row="row">
<slot
:name="`column-${col.name}`"
:col="col"
:row="row"
:row-index="rowIndex"
>
<VnTableColumn
:column="col"
:row="row"
@ -443,6 +478,11 @@ defineExpose({
? 'text-primary-light'
: 'color-vn-text '
"
:style="`visibility: ${
(btn.show && btn.show(row)) ?? true
? 'visible'
: 'hidden'
}`"
@click="btn.action(row)"
/>
</QTd>
@ -500,7 +540,9 @@ defineExpose({
:class="$props.cardClass"
>
<div
v-for="col of splittedColumns.cardVisible"
v-for="(
col, index
) of splittedColumns.cardVisible"
:key="col.name"
class="fields"
>
@ -521,6 +563,7 @@ defineExpose({
:name="`column-${col.name}`"
:col="col"
:row="row"
:row-index="index"
>
<VnTableColumn
:column="col"
@ -580,16 +623,23 @@ defineExpose({
>
<template #form-inputs="{ data }">
<div class="grid-create">
<VnTableColumn
<slot
v-for="column of splittedColumns.create"
:key="column.name"
:column="column"
:row="{}"
default="input"
v-model="data[column.name]"
:show-label="true"
component-prop="columnCreate"
/>
:name="`column-create-${column.name}`"
:data="data"
:column-name="column.name"
:label="column.label"
>
<VnTableColumn
:column="column"
:row="{}"
default="input"
v-model="data[column.name]"
:show-label="true"
component-prop="columnCreate"
/>
</slot>
<slot name="more-create-dialog" :data="data" />
</div>
</template>

View File

@ -81,7 +81,7 @@ async function fetchViewConfigData() {
return;
}
} catch (err) {
console.err('Error fetching config view data', err);
console.error('Error fetching config view data', err);
}
}

View File

@ -84,7 +84,7 @@ const fetchViewConfigData = async () => {
setUserConfigViewData(defaultColumns);
}
} catch (err) {
console.err('Error fetching config view data', err);
console.error('Error fetching config view data', err);
}
};

View File

@ -17,24 +17,27 @@ const $props = defineProps({
},
});
let mixed;
const componentArray = computed(() => {
if (typeof $props.prop === 'object') return [$props.prop];
return $props.prop;
});
function mix(toComponent) {
if (mixed) return mixed;
const { component, attrs, event } = toComponent;
const customComponent = $props.components[component];
return {
mixed = {
component: customComponent?.component ?? component,
attrs: {
...toValueAttrs(attrs),
...toValueAttrs(customComponent?.attrs),
...toComponent,
...toValueAttrs(customComponent?.forceAttrs),
...toComponent,
...toValueAttrs(attrs),
},
event: event ?? customComponent?.event,
event: { ...customComponent?.event, ...event },
};
return mixed;
}
function toValueAttrs(attrs) {

View File

@ -0,0 +1,8 @@
<script setup>
import VnInput from 'src/components/common/VnInput.vue';
const model = defineModel({ type: [Number, String] });
</script>
<template>
<VnInput v-bind="$attrs" v-model.number="model" type="number" />
</template>

View File

@ -1,123 +1,33 @@
<script setup>
import { ref, toRefs, computed, watch, onMounted } from 'vue';
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
import FetchData from 'components/FetchData.vue';
const emit = defineEmits(['update:modelValue', 'update:options']);
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const postcodesOptions = ref([]);
const postcodesRef = ref(null);
const $props = defineProps({
modelValue: {
type: [String, Number, Object],
default: null,
},
options: {
type: Array,
default: () => [],
},
optionLabel: {
type: String,
default: '',
},
optionValue: {
type: String,
default: '',
},
filterOptions: {
type: Array,
default: () => [],
},
isClearable: {
type: Boolean,
default: true,
},
defaultFilter: {
type: Boolean,
default: true,
},
});
const { options } = toRefs($props);
const myOptions = ref([]);
const myOptionsOriginal = ref([]);
const value = computed({
get() {
return $props.modelValue;
},
set(value) {
emit(
'update:modelValue',
postcodesOptions.value.find((p) => p.code === value)
);
},
});
onMounted(() => {
locationFilter($props.modelValue);
});
function setOptions(data) {
myOptions.value = JSON.parse(JSON.stringify(data));
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
}
setOptions(options.value);
watch(options, (newValue) => {
setOptions(newValue);
});
const value = defineModel({ type: [String, Number, Object] });
function showLabel(data) {
return `${data.code} - ${data.town}(${data.province}), ${data.country}`;
}
function locationFilter(search = '') {
if (
search &&
(search.includes('undefined') || search.startsWith(`${$props.modelValue} - `))
)
return;
let where = { search };
postcodesRef.value.fetch({ filter: { where }, limit: 30 });
}
function handleFetch(data) {
postcodesOptions.value = data;
}
function onDataSaved(newPostcode) {
postcodesOptions.value.push(newPostcode);
value.value = newPostcode.code;
}
</script>
<template>
<FetchData
ref="postcodesRef"
url="Postcodes/filter"
@on-fetch="(data) => handleFetch(data)"
/>
<VnSelectDialog
v-if="postcodesRef"
:option-label="(opt) => showLabel(opt) ?? 'code'"
:option-value="(opt) => opt.code"
v-model="value"
:options="postcodesOptions"
option-value="code"
option-filter-value="search"
:option-label="(opt) => showLabel(opt)"
url="Postcodes/filter"
:use-like="false"
:label="t('Location')"
:placeholder="t('search_by_postalcode')"
@input-value="locationFilter"
:default-filter="false"
:input-debounce="300"
:class="{ required: $attrs.required }"
v-bind="$attrs"
clearable
:emit-value="false"
>
<template #form>
<CreateNewPostcode
@on-data-saved="onDataSaved"
/>
<CreateNewPostcode @on-data-saved="(newValue) => (value = newValue)" />
</template>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">

View File

@ -1,8 +1,16 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue';
import { onMounted } from 'vue';
const stateStore = useStateStore();
const $props = defineProps({
leftDrawer: {
type: Boolean,
default: true,
},
});
onMounted(() => (stateStore.leftDrawer = $props.leftDrawer));
</script>
<template>

View File

@ -2,7 +2,7 @@
import { ref, toRefs, computed, watch, onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
import FetchData from 'src/components/FetchData.vue';
const emit = defineEmits(['update:modelValue', 'update:options']);
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
const $props = defineProps({
modelValue: {
@ -25,9 +25,13 @@ const $props = defineProps({
type: String,
default: null,
},
optionFilterValue: {
type: String,
default: null,
},
url: {
type: String,
default: '',
default: null,
},
filterOptions: {
type: [Array],
@ -70,7 +74,8 @@ const $props = defineProps({
const { t } = useI18n();
const requiredFieldRule = (val) => val ?? t('globals.fieldRequired');
const { optionLabel, optionValue, optionFilter, options, modelValue } = toRefs($props);
const { optionLabel, optionValue, optionFilter, optionFilterValue, options, modelValue } =
toRefs($props);
const myOptions = ref([]);
const myOptionsOriginal = ref([]);
const vnSelectRef = ref();
@ -82,6 +87,7 @@ const value = computed({
return $props.modelValue;
},
set(value) {
setOptions(myOptionsOriginal.value);
emit('update:modelValue', value);
},
});
@ -113,7 +119,7 @@ function setOptions(data) {
}
function filter(val, options) {
const search = val.toString().toLowerCase();
const search = val?.toString()?.toLowerCase();
if (!search) return options;
@ -137,16 +143,19 @@ async function fetchFilter(val) {
if (!$props.url || !dataRef.value) return;
const { fields, sortBy, limit } = $props;
let key = optionFilter.value ?? optionLabel.value;
if (new RegExp(/\d/g).test(val)) key = optionValue.value;
const key =
optionFilterValue.value ??
(new RegExp(/\d/g).test(val)
? optionValue.value
: optionFilter.value ?? optionLabel.value);
const defaultWhere = $props.useLike
? { [key]: { like: `%${val}%` } }
: { [key]: val };
const where = { ...(val ? defaultWhere : {}), ...$props.where };
const fetchOptions = { where, order: sortBy, limit };
const fetchOptions = { where, limit };
if (fields) fetchOptions.fields = fields;
if (sortBy) fetchOptions.order = sortBy;
return dataRef.value.fetch(fetchOptions);
}
@ -159,7 +168,10 @@ async function filterHandler(val, update) {
let newOptions;
if (!$props.defaultFilter) return update();
if ($props.url) {
if (
$props.url &&
($props.limit || (!$props.limit && Object.keys(myOptions.value).length === 0))
) {
newOptions = await fetchFilter(val);
} else newOptions = filter(val, myOptionsOriginal.value);
update(
@ -174,6 +186,10 @@ async function filterHandler(val, update) {
}
);
}
function nullishToTrue(value) {
return value ?? true;
}
</script>
<template>
@ -192,12 +208,12 @@ async function filterHandler(val, update) {
:option-label="optionLabel"
:option-value="optionValue"
v-bind="$attrs"
emit-value
map-options
use-input
@filter="filterHandler"
hide-selected
fill-input
:emit-value="nullishToTrue($attrs['emit-value'])"
:map-options="nullishToTrue($attrs['map-options'])"
:use-input="nullishToTrue($attrs['use-input'])"
:hide-selected="nullishToTrue($attrs['hide-selected'])"
:fill-input="nullishToTrue($attrs['fill-input'])"
ref="vnSelectRef"
lazy-rules
:class="{ required: $attrs.required }"
@ -208,7 +224,12 @@ async function filterHandler(val, update) {
<QIcon
v-show="value"
name="close"
@click.stop="value = null"
@click.stop="
() => {
value = null;
emit('remove');
}
"
class="cursor-pointer"
size="xs"
/>

View File

@ -1,21 +1,12 @@
<script setup>
import { ref, computed } from 'vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import { useRole } from 'src/composables/useRole';
import VnSelect from 'src/components/common/VnSelect.vue';
const emit = defineEmits(['update:modelValue']);
const value = defineModel({ type: [String, Number, Object] });
const $props = defineProps({
modelValue: {
type: [String, Number, Object],
default: null,
},
options: {
type: Array,
default: () => [],
},
rolesAllowedToCreate: {
type: Array,
default: () => ['developer'],
@ -33,15 +24,6 @@ const $props = defineProps({
const role = useRole();
const showForm = ref(false);
const value = computed({
get() {
return $props.modelValue;
},
set(value) {
emit('update:modelValue', value);
},
});
const isAllowedToCreate = computed(() => {
return role.hasAny($props.rolesAllowedToCreate);
});
@ -52,7 +34,11 @@ const toggleForm = () => {
</script>
<template>
<VnSelect v-model="value" :options="options" v-bind="$attrs">
<VnSelect
v-model="value"
v-bind="$attrs"
@update:model-value="(...args) => emit('update:modelValue', ...args)"
>
<template v-if="isAllowedToCreate" #append>
<QIcon
@click.stop.prevent="toggleForm()"

View File

@ -7,7 +7,7 @@ defineProps({
</script>
<template>
<div :class="$q.screen.gt.md ? 'q-pb-lg' : 'q-pb-md'">
<div class="header-link">
<div class="header-link" :style="{ cursor: url ? 'pointer' : 'default' }">
<a :href="url" :class="url ? 'link' : 'color-vn-text'">
{{ text }}
<QIcon v-if="url" :name="icon" />

View File

@ -28,8 +28,8 @@ function handleKeyUp(event) {
}
async function insert() {
const body = $props.body;
Object.assign(body, { text: newNote.value });
await axios.post($props.url, body);
const newBody = { ...body, ...{ text: newNote.value } };
await axios.post($props.url, newBody);
await vnPaginateRef.value.fetch();
newNote.value = '';
}

View File

@ -115,8 +115,8 @@ watch(
);
watch(
() => props.url,
(url) => fetch({ url })
() => [props.url, props.filter],
([url, filter]) => fetch({ url, filter })
);
const addFilter = async (filter, params) => {

View File

@ -1,5 +1,8 @@
<script setup>
defineProps({ wrap: { type: Boolean, default: false } });
</script>
<template>
<div class="vn-row q-gutter-md q-mb-md">
<div class="vn-row q-gutter-md q-mb-md" :class="{ wrap }">
<slot></slot>
</div>
</template>

View File

@ -18,4 +18,3 @@ const { t } = useI18n();
</slot>
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
</template>
<style scoped></style>

View File

@ -153,6 +153,12 @@ select:-webkit-autofill {
background-color: var(--vn-section-color);
}
.q-table td[shrink] {
text-overflow: ellipsis;
overflow: hidden;
max-width: 80px;
}
.tr-header {
color: var(--vn-label-color);
}
@ -209,51 +215,49 @@ input::-webkit-inner-spin-button {
max-width: 100%;
}
/* ===== Scrollbar CSS ===== /
/ Firefox */
.q-table__container {
/* ===== Scrollbar CSS ===== /
/ Firefox */
* {
scrollbar-width: auto;
scrollbar-color: var(--vn-label-color) transparent;
}
* {
scrollbar-width: auto;
scrollbar-color: var(--vn-label-color) transparent;
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 10px;
height: 10px;
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 10px;
height: 10px;
}
*::-webkit-scrollbar-thumb {
background-color: var(--vn-label-color);
border-radius: 10px;
}
*::-webkit-scrollbar-thumb {
background-color: var(--vn-label-color);
border-radius: 10px;
}
*::-webkit-scrollbar-track {
background: transparent;
*::-webkit-scrollbar-track {
background: transparent;
}
}
.q-table {
thead,
tbody {
th {
.q-select {
max-width: 120px;
}
}
td {
padding: 1px 10px 1px 10px;
max-width: 100px;
div span {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
th,
td {
padding: 1px 10px 1px 10px;
max-width: 100px;
div span {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.expand {
max-width: 400px;
}
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.shrink {
max-width: 75px;
}
.expand {
max-width: 400px;
}
}

View File

@ -254,6 +254,9 @@ globals:
comment: Comment
observations: Observations
goToModuleIndex: Go to module index
unsavedPopup:
title: Unsaved changes will be lost
subtitle: Are you sure exit without saving?
errors:
statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred
@ -386,8 +389,8 @@ customer:
extendedList:
tableVisibleColumns:
id: Identifier
name: Comercial name
socialName: Business name
name: Name
socialName: Social name
fi: Tax number
salesPersonFk: Salesperson
credit: Credit
@ -997,18 +1000,6 @@ route:
shipped: Preparation date
viewCmr: View CMR
downloadCmrs: Download CMRs
columnLabels:
Id: Id
vehicle: Vehicle
description: Description
isServed: Served
worker: Worker
date: Date
started: Started
actions: Actions
agency: Agency
volume: Volume
finished: Finished
supplier:
list:
payMethod: Pay method

View File

@ -256,6 +256,9 @@ globals:
comment: Comentario
observations: Observaciones
goToModuleIndex: Ir al índice del módulo
unsavedPopup:
title: Los cambios que no haya guardado se perderán
subtitle: ¿Seguro que quiere salir sin guardar?
errors:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor
@ -385,7 +388,7 @@ customer:
extendedList:
tableVisibleColumns:
id: Identificador
name: Nombre Comercial
name: Nombre
socialName: Razón social
fi: NIF / CIF
salesPersonFk: Comercial
@ -978,18 +981,6 @@ route:
shipped: Fecha preparación
viewCmr: Ver CMR
downloadCmrs: Descargar CMRs
columnLabels:
Id: Id
vehicle: Vehículo
description: Descripción
isServed: Servida
worker: Trabajador
date: Fecha
started: Iniciada
actions: Acciones
agency: Agencia
volume: Volumen
finished: Finalizada
supplier:
list:
payMethod: Método de pago

View File

@ -34,12 +34,12 @@ const onDataSaved = ({ id }) => {
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput v-model="data.alias" :label="t('mailAlias.name')" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
v-model="data.description"

View File

@ -33,7 +33,7 @@ const aliasOptions = ref([]);
@on-submit="emit('onSubmitCreateAlias', aliasFormData)"
>
<template #form-inputs>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnSelect
:label="t('account.card.alias')"

View File

@ -10,12 +10,12 @@ const { t } = useI18n();
<template>
<FormModel :url="`VnRoles/${route.params.id}`" model="VnRole" auto-load>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput v-model="data.name" :label="t('role.card.name')" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
v-model="data.description"
@ -23,7 +23,7 @@ const { t } = useI18n();
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<QCheckbox :label="t('mailAlias.isPublic')" v-model="data.isPublic" />
</div>

View File

@ -21,12 +21,12 @@ const { t } = useI18n();
"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput v-model="data.name" :label="t('role.card.name')" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
v-model="data.description"

View File

@ -33,7 +33,7 @@ const rolesOptions = ref([]);
@on-submit="emit('onSubmitCreateSubrole', subRoleFormData)"
>
<template #form-inputs>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnSelect
:label="t('account.card.role')"

View File

@ -74,7 +74,7 @@ const statesFilter = {
:reload="true"
>
<template #form="{ data, validate, filter }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
v-model="data.client.name"
:label="t('claim.customer')"
@ -82,7 +82,7 @@ const statesFilter = {
/>
<VnInputDate v-model="data.created" :label="t('claim.created')" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('claim.assignedTo')"
v-model="data.workerFk"
@ -120,7 +120,7 @@ const statesFilter = {
>
</QSelect>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QInput
v-model.number="data.packages"
:label="t('globals.packages')"

View File

@ -44,7 +44,7 @@ const columns = computed(() => [
fields: ['id', 'name'],
},
},
class: 'expand',
columnClass: 'expand',
},
{
align: 'left',

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,120 +1,191 @@
<script setup>
import { computed, onBeforeMount, ref, watch } from 'vue';
import { computed, onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useRole } from 'src/composables/useRole';
import axios from 'axios';
import { QCheckbox, QBtn, useQuasar } from 'quasar';
import { useQuasar } from 'quasar';
import { toCurrency, toDate, toDateHourMin } from 'src/filters';
import { useState } from 'src/composables/useState';
import { useState } from 'composables/useState';
import { useStateStore } from 'stores/useStateStore';
import { useValidator } from 'src/composables/useValidator';
import { usePrintService } from 'src/composables/usePrintService';
import { useSession } from 'src/composables/useSession';
import { usePrintService } from 'composables/usePrintService';
import { useSession } from 'composables/useSession';
import { useVnConfirm } from 'composables/useVnConfirm';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import FetchData from 'components/FetchData.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import VnInput from 'components/common/VnInput.vue';
import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
import VnFilter from 'components/VnTable/VnFilter.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
const session = useSession();
const tokenMultimedia = session.getTokenMultimedia();
const { openConfirmationModal } = useVnConfirm();
const { sendEmail } = usePrintService();
const { t } = useI18n();
const { validate } = useValidator();
const { hasAny } = useRole();
const session = useSession();
const tokenMultimedia = session.getTokenMultimedia();
const quasar = useQuasar();
const route = useRoute();
const state = useState();
const stateStore = useStateStore();
const user = state.getUser();
const clientRisks = ref(null);
const clientRisksRef = ref(null);
const companiesOptions = ref([]);
const companyId = ref(null);
const receiptsRef = ref(null);
const receiptsData = ref([]);
const clientRisk = ref([]);
const tableRef = ref();
const companyId = ref();
const companyLastId = ref(user.value.companyFk);
const balances = ref([]);
const vnFilterRef = ref({});
const filter = computed(() => {
return {
clientId: route.params.id,
companyId: companyId.value ?? user.value.companyFk,
};
});
const filterCompanies = { order: ['code'] };
const userParams = {
clientId: route.params.id,
companyId: user.value.companyFk,
const companyFilterColumn = {
align: 'left',
name: 'companyId',
label: t('Company'),
component: 'select',
attrs: {
url: 'Companies',
optionLabel: 'code',
sortBy: 'code',
limit: 0,
},
columnFilter: {
event: {
remove: () => (companyId.value = null),
'update:modelValue': (newCompanyFk) => {
if (!newCompanyFk) return;
vnFilterRef.value.addFilter(newCompanyFk);
companyLastId.value = newCompanyFk;
},
blur: () =>
!companyId.value &&
(companyId.value = companyLastId.value ?? user.value.companyFk),
},
},
visible: false,
create: true,
};
const filter = {
include: { relation: 'company', scope: { fields: ['code'] } },
where: { clientFk: route.params.id, companyFk: user.value.companyFk },
const referenceColumn = {
align: 'left',
name: 'description',
label: t('Reference'),
};
const onlyCreate = {
visible: false,
columnFilter: false,
create: true,
};
const columns = computed(() => [
{
align: 'left',
field: 'payed',
format: (value) => toDate(value),
name: 'payed',
label: t('Date'),
name: 'date',
format: ({ payed }) => toDate(payed),
cardVisible: true,
create: true,
columnCreate: {
component: 'date',
},
},
{
align: 'left',
field: 'created',
format: (value) => toDateHourMin(value),
name: 'created',
label: t('Creation date'),
name: 'creationDate',
format: ({ created }) => toDateHourMin(created),
cardVisible: true,
},
{
align: 'left',
field: 'userName',
name: 'workerFk',
label: t('Employee'),
name: 'employee',
columnField: {
component: 'userLink',
attrs: ({ row }) => {
return {
workerId: row.workerFk,
name: row.userName,
};
},
},
cardVisible: true,
},
{ ...referenceColumn, isTitle: true, class: 'extend' },
companyFilterColumn,
{
align: 'left',
field: 'description',
label: t('Reference'),
name: 'reference',
},
{
align: 'left',
field: 'bankFk',
align: 'right',
name: 'bankFk',
label: t('Bank'),
name: 'bank',
cardVisible: true,
create: true,
},
{
align: 'right',
name: 'amountPaid',
label: t('Amount'),
component: 'number',
...onlyCreate,
},
{
align: 'right',
field: 'debit',
format: (value) => value && toCurrency(value),
label: t('Debit'),
name: 'debit',
label: t('Debit'),
format: ({ debit }) => debit && toCurrency(debit),
isId: true,
},
{
align: 'right',
field: 'credit',
format: (value) => value && toCurrency(value),
name: 'credit',
label: t('Havings'),
name: 'havings',
format: ({ credit }) => credit && toCurrency(credit),
cardVisible: true,
},
{
align: 'right',
field: 'balance',
format: (value) => value && toCurrency(value),
label: t('Balance'),
name: 'balance',
label: t('Balance'),
format: ({ balance }) => toCurrency(balance),
cardVisible: true,
},
{
align: 'left',
field: 'isConciliate',
name: 'isConciliate',
label: t('Conciliated'),
name: 'conciliated',
cardVisible: true,
},
{ ...referenceColumn, ...onlyCreate },
{
align: 'left',
field: 'totalWithVat',
label: '',
name: 'actions',
name: 'tableActions',
actions: [
{
title: t('globals.downloadPdf'),
icon: 'cloud_download',
show: (row) => row.isInvoice,
action: (row) => showBalancePdf(row),
},
{
title: t('Send compensation'),
icon: 'outgoing_mail',
show: (row) => !!row.isCompensation,
action: ({ id }) =>
openConfirmationModal(
t('Send compensation'),
t('Do you want to report compensation to the client by mail?'),
() => sendEmail(`Receipts/${id}/balance-compensation-email`)
),
},
],
},
]);
@ -123,254 +194,154 @@ onBeforeMount(() => {
companyId.value = user.value.companyFk;
});
watch(
() => route.params.id,
(newValue) => {
if (!newValue) return;
userParams.clientId = newValue;
filter.where.clientFk = newValue;
getData();
async function getClientRisk(reload = false) {
if (reload || !clientRisk.value?.length) {
const { data } = await axios.get(`clientRisks`, {
params: {
filter: JSON.stringify({
include: { relation: 'company', scope: { fields: ['code'] } },
where: { clientFk: route.params.id, companyFk: user.value.companyFk },
}),
},
});
clientRisk.value = data;
}
);
return clientRisk.value;
}
const getData = () => {
receiptsRef.value?.fetch();
clientRisksRef.value?.fetch();
};
const getCurrentBalance = () => {
const currentBalance = clientRisks.value.find((balance) => {
async function getCurrentBalance() {
const currentBalance = (await getClientRisk()).find((balance) => {
return balance.companyFk === companyId.value;
});
return currentBalance && currentBalance.amount;
};
}
const onFetch = (balances) => {
balances.forEach((balance, index) => {
async function onFetch(data) {
balances.value = [];
for (const [index, balance] of data.entries()) {
if (index === 0) {
balance.balance = getCurrentBalance();
} else {
let previousBalance = balances[index - 1];
balance.balance =
previousBalance.balance -
(previousBalance.debit - previousBalance.credit);
balance.balance = await getCurrentBalance();
continue;
}
});
receiptsData.value = balances;
};
const previousBalance = data[index - 1];
balance.balance =
previousBalance?.balance - (previousBalance?.debit - previousBalance?.credit);
}
balances.value = data;
}
// BORRAR COMPONENTE Y HACER CON VNTABLE
const showNewPaymentDialog = () => {
quasar.dialog({
component: CustomerNewPayment,
componentProps: {
companyId: companyId.value,
totalCredit: clientRisks.value[0]?.amount,
promise: getData,
totalCredit: clientRisk.value[0]?.amount,
promise: getClientRisk(true),
},
});
};
const updateCompanyId = (id) => {
if (id) {
companyId.value = id;
userParams.companyId = id;
filter.where.companyFk = id;
}
getData();
};
const saveFieldValue = async (row) => {
try {
const payload = { description: row.description };
await axios.patch(`Receipts/${row.id}`, payload);
} catch (err) {
return err;
}
};
const sendEmailAction = () => {
sendEmail(`Suppliers/${route.params.id}/campaign-metrics-email`);
};
const showBalancePdf = (balance) => {
const url = `api/InvoiceOuts/${balance.id}/download?access_token=${tokenMultimedia}`;
const showBalancePdf = ({ id }) => {
const url = `api/InvoiceOuts/${id}/download?access_token=${tokenMultimedia}`;
window.open(url, '_blank');
};
</script>
<template>
<FetchData
:filter="filter"
@on-fetch="(data) => (clientRisks = data)"
auto-load
ref="clientRisksRef"
url="ClientRisks"
/>
<FetchData
:filter="filterCompanies"
@on-fetch="(data) => (companiesOptions = data)"
auto-load
url="Companies"
/>
<VnPaginate
auto-load
<VnSubToolbar class="q-mb-md">
<template #st-data>
<div class="column justify-center q-px-md q-py-sm">
<span class="text-bold">{{ t('Total by company') }}</span>
<div class="row justify-center" v-if="clientRisk?.length">
{{ clientRisk[0].company.code }}:
{{ toCurrency(clientRisk[0].amount) }}
</div>
</div>
</template>
<template #st-actions>
<div>
<VnFilter
ref="vnFilterRef"
v-model="companyId"
data-key="CustomerBalance"
:column="companyFilterColumn"
search-url="balance"
/>
</div>
</template>
</VnSubToolbar>
<VnTable
ref="tableRef"
data-key="CustomerBalance"
url="Receipts/filter"
:user-params="userParams"
ref="receiptsRef"
search-url="balance"
:user-params="filter"
:columns="columns"
:right-search="false"
:is-editable="false"
:column-search="false"
@on-fetch="onFetch"
:create="{
urlCreate: `Clients/${route.params.id}/createReceipt`,
mapper: (data) => {
data.companyFk = data.companyId;
delete data.companyId;
return data;
},
title: t('New payment'),
onDataSaved: () => tableRef.reload(),
formInitialData: { companyId },
}"
auto-load
>
<template #body="{ rows }">
<QTable
:columns="columns"
:no-data-label="t('globals.noResults')"
:rows-per-page-options="[0]"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
>
<template #body-cell-employee="{ row }">
<QTd auto-width @click.stop>
<QBtn color="blue" flat no-caps>{{ row.userName }}</QBtn>
<WorkerDescriptorProxy :id="row.workerFk" />
</QTd>
</template>
<template #body-cell-reference="{ row }">
<QTd auto-width @click.stop v-if="row.isInvoice">
<QBtn color="blue" dense flat>
{{ t('bill', { ref: row.description }) }}
</QBtn>
<InvoiceOutDescriptorProxy :id="row.id" />
</QTd>
<QTd v-else>
<VnInput
@keyup.enter="saveFieldValue(row)"
autofocus
clearable
dense
v-model="row.description"
/>
</QTd>
</template>
<template #body-cell-conciliated="{ row }">
<QTd align="center">
<QCheckbox :model-value="row.isConciliate === 1" disable />
</QTd>
</template>
<template #body-cell-actions="{ row }">
<QTd align="center">
<QIcon
@click.stop="showDialog = true"
class="q-ml-md fill-icon"
color="primary"
name="outgoing_mail"
size="sm"
v-if="row.isCompensation"
>
<QTooltip>
{{ t('Send compensation') }}
</QTooltip>
</QIcon>
<QIcon
@click="showBalancePdf(row)"
class="q-ml-md fill-icon"
color="primary"
name="cloud_download"
size="sm"
v-if="row.hasPdf"
>
<QTooltip>
{{ t('globals.downloadPdf') }}
</QTooltip>
</QIcon>
<QDialog v-model="showDialog">
<QCard class="q-pa-sm">
<QCardSection>
<span
ref="closeButton"
class="flex justify-end color-vn-label"
v-close-popup
>
<QIcon name="close" size="sm" />
</span>
<div class="text-h6">
{{ t('Send compensation') }}
</div>
</QCardSection>
<QCardSection>
<div>
{{
t(
'Do you want to report compensation to the client by mail?'
)
}}
</div>
</QCardSection>
<QCardActions class="flex justify-end q-mb-sm">
<QBtn
:label="t('globals.cancel')"
color="primary"
flat
v-close-popup
/>
<QBtn
:label="t('globals.save')"
@click="sendEmailAction"
class="q-ml-sm"
color="primary"
/>
</QCardActions>
</QCard>
</QDialog>
</QTd>
</template>
</QTable>
<template #column-balance="{ rowIndex }">
{{ toCurrency(balances[rowIndex]?.balance) }}
</template>
</VnPaginate>
<QDrawer :width="256" show-if-above side="right" v-model="stateStore.rightDrawer">
<div class="q-mt-xl q-px-md">
<template #column-description="{ row }">
<div class="link" v-if="row.isInvoice">
{{ row.description }}
<InvoiceOutDescriptorProxy :id="row.description" />
</div>
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
{{ row.description }}
</span>
<QPopupEdit
v-model="row.description"
v-slot="scope"
@save="
(value) =>
value != row.description &&
axios.patch(`Receipts/${row.id}`, { description: value })
"
>
<VnInput
v-model="scope.value"
:disable="!hasAny(['administrative'])"
@keypress.enter="scope.set"
autofocus
/>
</QPopupEdit>
</template>
<template #column-create-bankFk="{ data, columnName, label }">
<VnSelect
:label="t('Company')"
:options="companiesOptions"
@update:model-value="updateCompanyId($event)"
hide-selected
option-label="code"
option-value="id"
v-model="companyId"
:rules="validate('entry.companyFk')"
/>
</div>
<QCard class="q-ma-md q-pa-md q-mt-lg" v-if="receiptsData?.length">
<QCardSection>
<div class="flex justify-center text-subtitle1 text-bold">
{{ t('Total by company') }}
</div>
<div class="flex justify-center">
<div class="q-mr-sm" v-if="clientRisks?.length">
{{ clientRisks[0].company.code }}:
</div>
<div v-if="clientRisks?.length">
{{ toCurrency(clientRisks[0].amount) }}
</div>
</div>
</QCardSection>
</QCard>
</QDrawer>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="showNewPaymentDialog()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New payment') }}
</QTooltip>
</QPageSticky>
url="Accountings"
:label="label"
:limit="0"
option-label="bank"
sort-by="id"
v-model="data[columnName]"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemLabel>
#{{ scope.opt?.id }}: {{ scope.opt?.bank }}
</QItemLabel>
</QItem>
</template>
</VnSelect>
</template>
</VnTable>
</template>
<i18n>
@ -393,3 +364,12 @@ es:
Send compensation: Enviar compensación
Do you want to report compensation to the client by mail?: ¿Desea informar de la compensación al cliente por correo?
</i18n>
<style lang="scss" scoped>
.dotted {
border: 1px dotted var(--vn-header-color);
}
.dotted:hover {
border: 1px dotted $primary;
}
</style>

View File

@ -8,66 +8,28 @@ import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnImg from 'src/components/ui/VnImg.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute();
const { t } = useI18n();
const workers = ref([]);
const workersCopy = ref([]);
const businessTypes = ref([]);
const contactChannels = ref([]);
function setWorkers(data) {
workers.value = data;
workersCopy.value = data;
}
const filterOptions = {
options: workers,
filterFn: (options, value) => {
const search = value.toLowerCase();
if (value === '') return workersCopy.value;
return options.value.filter((row) => {
const id = row.id;
const name = row.name.toLowerCase();
const idMatches = id === search;
const nameMatches = name.indexOf(search) > -1;
return idMatches || nameMatches;
});
},
};
</script>
<template>
<fetch-data
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
@on-fetch="setWorkers"
auto-load
/>
<fetch-data
<FetchData
url="ContactChannels"
@on-fetch="(data) => (contactChannels = data)"
auto-load
/>
<fetch-data
<FetchData
url="BusinessTypes"
@on-fetch="(data) => (businessTypes = data)"
auto-load
/>
<fetch-data
:filter="filter"
@on-fetch="(data) => (clients = data)"
auto-load
url="Clients"
/>
<FormModel :url="`Clients/${route.params.id}`" auto-load model="customer">
<template #form="{ data, validate, filter }">
<VnRow class="row q-gutter-md q-mb-md">
<template #form="{ data, validate }">
<VnRow>
<VnInput
:label="t('globals.name')"
:rules="validate('client.socialName')"
@ -75,7 +37,6 @@ const filterOptions = {
clearable
v-model="data.name"
/>
<QSelect
:input-debounce="0"
:label="t('customer.basicData.businessType')"
@ -88,7 +49,7 @@ const filterOptions = {
v-model="data.businessTypeFk"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('customer.basicData.contact')"
:rules="validate('client.contact')"
@ -111,7 +72,7 @@ const filterOptions = {
</template>
</VnInput>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('customer.basicData.phone')"
:rules="validate('client.phone')"
@ -125,31 +86,27 @@ const filterOptions = {
v-model="data.mobile"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<QSelect
:input-debounce="0"
:label="t('customer.basicData.salesPerson')"
:options="workers"
:rules="validate('client.salesPersonFk')"
@filter="(value, update) => filter(value, update, filterOptions)"
emit-value
map-options
option-label="name"
option-value="id"
use-input
<VnRow>
<VnSelect
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
option-filter="firstName"
v-model="data.salesPersonFk"
:label="t('customer.basicData.salesPerson')"
:rules="validate('client.salesPersonFk')"
:use-like="false"
>
<template #prepend>
<QAvatar color="orange">
<VnImg
v-if="data.salesPersonFk"
:id="user.id"
:id="data.salesPersonFk"
collection="user"
spinner-color="white"
/>
</QAvatar>
</template>
</QSelect>
</VnSelect>
<QSelect
v-model="data.contactChannelFk"
:options="contactChannels"
@ -162,7 +119,7 @@ const filterOptions = {
:input-debounce="0"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QSelect
:input-debounce="0"
:label="t('customer.basicData.previousClient')"

View File

@ -47,7 +47,7 @@ const getBankEntities = (data, formData) => {
model="customer"
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Billing data')"
:options="payMethods"
@ -59,7 +59,7 @@ const getBankEntities = (data, formData) => {
<VnInput :label="t('Due day')" clearable v-model="data.dueDay" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput :label="t('IBAN')" clearable v-model="data.iban">
<template #append>
<QIcon name="info" class="cursor-info">
@ -94,7 +94,7 @@ const getBankEntities = (data, formData) => {
</VnSelectDialog>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QCheckbox :label="t('Received LCR')" v-model="data.hasLcr" />
<QCheckbox :label="t('VNL core received')" v-model="data.hasCoreVnl" />
<QCheckbox :label="t('VNL B2B received')" v-model="data.hasSepaVnl" />

View File

@ -1,13 +1,14 @@
<script setup>
import { useI18n } from 'vue-i18n';
import CustomerConsumptionFilter from './CustomerConsumptionFilter.vue';
import { useStateStore } from 'src/stores/useStateStore';
const { t } = useI18n();
</script>
<template>
<h5 class="flex justify-center color-vn-label">
{{ t('Enter a new search') }}
</h5>
<Teleport to="#right-panel" v-if="useStateStore().isHeaderMounted()">
<CustomerConsumptionFilter data-key="CustomerConsumption" />
</Teleport>
</template>
<i18n>

View File

@ -0,0 +1,91 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { QItem } from 'quasar';
import VnSelect from 'src/components/common/VnSelect.vue';
import { QItemSection } from 'quasar';
const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } });
</script>
<template>
<VnFilterPanel :data-key="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 }">
<QItem>
<QItemSection>
<VnInput
:label="t('params.item')"
v-model="params.itemId"
is-outlined
lazy-rules
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
v-model="params.buyerId"
url="TicketRequests/getItemTypeWorker"
:label="t('params.buyer')"
option-value="id"
option-label="nickname"
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<!--It's required to include the relation category !! There's 413 records in production-->
<QItemSection>
<VnSelect
v-model="params.typeId"
url="ItemTypes"
:label="t('params.type')"
option-label="name"
option-value="id"
dense
outlined
rounded
>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
url="ItemCategories"
:label="t('params.category')"
option-label="name"
option-value="id"
v-model="params.categoryId"
dense
outlined
rounded
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
item: Item id
buyer: Buyer
type: Type
category: Category
es:
params:
item: Id artículo
buyer: Comprador
type: Tipo
category: Categoría
</i18n>

View File

@ -88,7 +88,7 @@ watch(
:url-create="`Clients/${route.params.id}/setRating`"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
:label="t('Rating')"

View File

@ -1,138 +1,88 @@
<script setup>
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { QBtn } from 'quasar';
import { useRoute } from 'vue-router';
import { toCurrency, toDateHourMin } from 'src/filters';
import FetchData from 'components/FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const rows = ref([]);
const filter = {
include: [
{
relation: 'worker',
scope: {
fields: ['id'],
include: { relation: 'user', scope: { fields: ['name'] } },
const filter = computed(() => {
return {
include: [
{
relation: 'worker',
scope: {
fields: ['id'],
include: { relation: 'user', scope: { fields: ['name'] } },
},
},
},
],
where: { clientFk: route.params.id },
order: ['created DESC'],
limit: 20,
};
const tableColumnComponents = {
created: {
component: 'span',
props: () => {},
event: () => {},
},
employee: {
component: QBtn,
props: () => ({ flat: true, color: 'blue', noCaps: true }),
event: () => {},
},
amount: {
component: 'span',
props: () => {},
event: () => {},
},
};
],
where: { clientFk: +route.params.id },
};
});
const tableRef = ref();
const tableData = ref([]);
const columns = computed(() => [
{
align: 'left',
field: 'created',
label: t('Since'),
name: 'created',
format: (value) => toDateHourMin(value),
label: t('Since'),
format: ({ created }) => toDateHourMin(created),
},
{
align: 'left',
field: (value) => value.worker.user.name,
label: t('Employee'),
name: 'employee',
},
{
align: 'left',
field: 'amount',
label: t('Credit'),
name: 'amount',
format: (value) => toCurrency(value),
format: ({ amount }) => toCurrency(amount),
},
{
label: t('Credit'),
name: 'credit',
create: true,
visible: false,
attrs: {
autofocus: true,
},
},
]);
const toCustomerCreditCreate = () => {
router.push({ name: 'CustomerCreditCreate' });
};
</script>
<template>
<FetchData
:filter="filter"
@on-fetch="(data) => (rows = data)"
auto-load
<VnTable
ref="tableRef"
data-key="ClientCredit"
url="ClientCredits"
/>
<div class="full-width flex justify-center">
<QCard class="card-width q-pa-lg">
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
v-if="rows?.length"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<component
:is="tableColumnComponents[props.col.name].component"
@click="
tableColumnComponents[props.col.name].event(props)
"
class="rounded-borders q-pa-sm"
v-bind="
tableColumnComponents[props.col.name].props(props)
"
>
{{ props.value }}
<WorkerDescriptorProxy
:id="props.row.workerFk"
v-if="props.col.name === 'employee'"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>
<h5 class="flex justify-center color-vn-label" v-else>
{{ t('globals.noResults') }}
</h5>
</QCard>
</div>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerCreditCreate()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New credit') }}
</QTooltip>
</QPageSticky>
search-url="credits"
:filter="filter"
:order="['created DESC']"
:columns="columns"
auto-load
:right-search="false"
:is-editable="false"
:use-model="true"
:column-search="false"
:disable-option="{ card: true }"
@on-fetch="(data) => (tableData = data)"
:create="{
urlUpdate: `Clients/${route.params.id}`,
title: t('New credit'),
onDataSaved: () => tableRef.reload(),
formInitialData: { credit: tableData.at(0)?.amount },
}"
>
<template #column-employee="{ row }">
<VnUserLink :name="row?.worker?.user?.name" :worker-id="row.worker?.id" />
</template>
</VnTable>
</template>
<i18n>
es:
Since: Desde

View File

@ -15,7 +15,6 @@ const route = useRoute();
const typesTaxes = ref([]);
const typesTransactions = ref([]);
const postcodesOptions = ref([]);
function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {};
@ -40,7 +39,7 @@ function handleLocation(data, location) {
model="customer"
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('Social name')"
:required="true"
@ -57,11 +56,11 @@ function handleLocation(data, location) {
<VnInput :label="t('Tax number')" clearable v-model="data.fi" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput :label="t('Street')" clearable v-model="data.street" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Sage tax type')"
:options="typesTaxes"
@ -91,22 +90,18 @@ function handleLocation(data, location) {
</VnSelect>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnLocation
:rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.postcode"
@update:model-value="(location) => handleLocation(data, location)"
>
</VnLocation>
/>
</VnRow>
<VnRow>
<QCheckbox :label="t('Active')" v-model="data.isActive" />
<QCheckbox :label="t('Frozen')" v-model="data.isFreezed" />
</VnRow>
<VnRow>
<QCheckbox :label="t('Has to invoice')" v-model="data.hasToInvoice" />
<div>

View File

@ -2,101 +2,86 @@
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { QBtn } from 'quasar';
import { useStateStore } from 'src/stores/useStateStore';
import { toCurrency } from 'src/filters';
import { toDateTimeFormat } from 'src/filters/date';
import FetchData from 'components/FetchData.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import VnTable from 'components/VnTable/VnTable.vue';
const { t } = useI18n();
const route = useRoute();
const stateStore = computed(() => useStateStore());
const rows = ref([]);
const totalAmount = ref();
const filter = {
include: [
{
relation: 'greugeType',
scope: {
fields: ['id', 'name'],
const tableRef = ref();
const filter = computed(() => {
return {
include: [
{
relation: 'greugeType',
scope: {
fields: ['id', 'name'],
},
},
},
{
relation: 'user',
scope: {
fields: ['id', 'name'],
{
relation: 'user',
scope: {
fields: ['id', 'name'],
},
},
],
where: {
clientFk: route.params.id,
},
],
order: 'shipped DESC, amount',
where: {
clientFk: `${route.params.id}`,
},
limit: 20,
};
const tableColumnComponents = {
date: {
component: 'span',
props: () => {},
event: () => {},
},
createdBy: {
component: QBtn,
props: () => ({ flat: true, color: 'blue', noCaps: true }),
event: () => {},
},
comment: {
component: 'span',
props: () => {},
event: () => {},
},
type: {
component: 'span',
props: () => {},
event: () => {},
},
amount: {
component: 'span',
props: () => {},
event: () => {},
},
};
};
});
const columns = computed(() => [
{
align: 'left',
field: 'shipped',
label: t('Date'),
name: 'date',
format: (value) => toDateTimeFormat(value),
name: 'shipped',
format: ({ shipped }) => toDateTimeFormat(shipped),
create: true,
columnCreate: {
component: 'date',
autofocus: true,
},
},
{
align: 'left',
field: (value) => value?.user?.name,
name: 'userFk',
label: t('Created by'),
name: 'createdBy',
component: 'userLink',
attrs: ({ row }) => {
return {
defaultName: true,
workerId: row.user?.id,
name: row.user?.name,
};
},
},
{
align: 'left',
field: 'description',
name: 'description',
label: t('Comment'),
name: 'comment',
create: true,
},
{
align: 'left',
field: (value) => value?.greugeType?.name,
name: 'greugeTypeFk',
format: ({ greugeType }) => greugeType?.name,
label: t('Type'),
name: 'type',
create: true,
columnCreate: {
component: 'select',
url: 'greugeTypes',
limit: 0,
},
},
{
align: 'left',
field: 'amount',
label: t('Amount'),
name: 'amount',
format: (value) => toCurrency(value),
label: t('Amount'),
format: ({ amount }) => toCurrency(amount),
create: true,
},
]);
@ -107,60 +92,33 @@ const setRows = (data) => {
</script>
<template>
<FetchData :filter="filter" @on-fetch="setRows" auto-load url="greuges" />
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="300" show-if-above>
<QCard class="full-width q-pa-sm">
<h6 class="flex justify-end q-my-lg q-pr-lg" v-if="totalAmount !== undefined">
<span class="color-vn-label q-mr-md">{{ t('Total') }}:</span>
{{ toCurrency(totalAmount) }}
</h6>
<QSkeleton v-else type="QInput" square />
</QCard>
</QDrawer>
<div class="full-width flex justify-center">
<QPage class="card-width q-pa-lg">
<QCard class="q-pa-sm q-mt-md">
<QTable
:columns="columns"
:no-data-label="t('globals.noResults')"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"
>
<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
:id="props.row.userFk"
v-if="props.col.name === 'createdBy'"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>
<VnTable
ref="tableRef"
data-key="Greuges"
url="Greuges"
search-url="greuges"
:filter="filter"
:order="['shipped DESC', 'amount']"
:columns="columns"
:right-search="false"
:is-editable="false"
:use-model="true"
:column-search="false"
@on-fetch="(data) => setRows(data)"
:create="{
urlCreate: `Greuges`,
title: t('New credit'),
onDataSaved: () => tableRef.reload(),
formInitialData: { shipped: new Date(), clientFk: route.params.id },
}"
auto-load
>
<template #top-left>
<QCard class="q-px-md q-py-sm">
{{ t('Total') }}: {{ toCurrency(totalAmount) }}
</QCard>
</QPage>
</div>
<QPageSticky :offset="[18, 18]">
<QBtn color="primary" fab icon="add" :to="{ name: 'CustomerGreugeCreate' }" />
<QTooltip>
{{ t('New greuge') }}
</QTooltip>
</QPageSticky>
</template>
</VnTable>
</template>
<style lang="scss">

View File

@ -1,14 +1,8 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { useRoute } from 'vue-router';
import VnNotes from 'src/components/ui/VnNotes.vue';
import { toDateTimeFormat } from 'src/filters/date';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const noteFilter = {
order: 'created DESC',
@ -16,68 +10,14 @@ const noteFilter = {
clientFk: `${route.params.id}`,
},
};
const toCustomerNoteCreate = () => {
router.push({ name: 'CustomerNoteCreate' });
};
</script>
<template>
<div class="full-width flex justify-center">
<QCard class="card-width q-pa-lg">
<VnPaginate
data-key="CustomerNotes"
url="clientObservations"
auto-load
:filter="noteFilter"
>
<template #body="{ rows }">
<div v-if="rows.length">
<QCard
v-for="(item, index) in rows"
:key="index"
class="q-pa-md q-rounded custom-border"
:class="{ 'q-mb-md': index < rows.length - 1 }"
>
<div class="flex justify-between">
<p class="color-vn-label">
{{ item.worker.user.nickname }}
</p>
<p class="color-vn-label">
{{ toDateTimeFormat(item?.created) }}
</p>
</div>
<h6 class="q-mt-xs q-mb-none">{{ item.text }}</h6>
</QCard>
</div>
<div v-else>
<h5 class="flex justify-center color-vn-label">
{{ t('globals.noResults') }}
</h5>
</div>
</template>
</VnPaginate>
</QCard>
</div>
<QPageSticky :offset="[18, 18]">
<QBtn @click.stop="toCustomerNoteCreate()" color="primary" fab icon="add" />
<QTooltip>
{{ t('New note') }}
</QTooltip>
</QPageSticky>
<VnNotes
url="clientObservations"
:add-note="true"
:filter="noteFilter"
:body="{ clientFk: route.params.id }"
style="overflow-y: auto"
/>
</template>
<style lang="scss">
.custom-border {
border: 2px solid var(--vn-accent-color);
border-radius: 10px;
padding: 10px;
}
</style>
<i18n>
es:
New note: Nueva nota
</i18n>

View File

@ -9,7 +9,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import CustomerSummaryTable from 'src/pages/Customer/components/CustomerSummaryTable.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import VnRow from 'src/components/ui/VnRow.vue';
const route = useRoute();
const { t } = useI18n();
@ -131,41 +131,33 @@ const creditWarning = computed(() => {
:url="`#/customer/${entityId}/fiscal-data`"
:text="t('customer.summary.fiscalData')"
/>
<QCheckbox
:label="t('customer.summary.isEqualizated')"
v-model="entity.isEqualizated"
:disable="true"
/>
<QCheckbox
:label="t('customer.summary.isActive')"
v-model="entity.isActive"
:disable="true"
/>
<QCheckbox
:label="t('customer.summary.invoiceByAddress')"
v-model="entity.hasToInvoiceByAddress"
:disable="true"
/>
<QCheckbox
:label="t('customer.summary.verifiedData')"
v-model="entity.isTaxDataChecked"
:disable="true"
/>
<QCheckbox
:label="t('customer.summary.hasToInvoice')"
v-model="entity.hasToInvoice"
:disable="true"
/>
<QCheckbox
:label="t('customer.summary.notifyByEmail')"
v-model="entity.isToBeMailed"
:disable="true"
/>
<QCheckbox
:label="t('customer.summary.vies')"
v-model="entity.isVies"
:disable="true"
/>
<VnRow>
<VnLv
:label="t('customer.summary.isEqualizated')"
:value="entity.isEqualizated"
/>
<VnLv
:label="t('customer.summary.isActive')"
:value="entity.isActive"
/>
</VnRow>
<VnRow>
<VnLv
:label="t('customer.summary.verifiedData')"
:value="entity.isTaxDataChecked"
/>
<VnLv
:label="t('customer.summary.hasToInvoice')"
:value="entity.hasToInvoice"
/>
</VnRow>
<VnRow>
<VnLv
:label="t('customer.summary.notifyByEmail')"
:value="entity.isToBeMailed"
/>
<VnLv :label="t('customer.summary.vies')" :value="entity.isVies" />
</VnRow>
</QCard>
<QCard class="vn-one">
<VnTitle
@ -178,23 +170,18 @@ const creditWarning = computed(() => {
/>
<VnLv :label="t('customer.summary.bankAccount')" :value="entity.iban" />
<VnLv :label="t('customer.summary.dueDay')" :value="entity.dueDay" />
<QCheckbox
style="padding: 0"
:label="t('customer.summary.hasLcr')"
v-model="entity.hasLcr"
:disable="true"
/>
<QCheckbox
:label="t('customer.summary.hasCoreVnl')"
v-model="entity.hasCoreVnl"
:disable="true"
/>
<VnRow class="q-mt-sm" wrap>
<VnLv :label="t('customer.summary.hasLcr')" :value="entity.hasLcr" />
<VnLv
:label="t('customer.summary.hasCoreVnl')"
:value="entity.hasCoreVnl"
/>
<QCheckbox
:label="t('customer.summary.hasB2BVnl')"
v-model="entity.hasSepaVnl"
:disable="true"
/>
<VnLv
:label="t('customer.summary.hasB2BVnl')"
:value="entity.hasSepaVnl"
/>
</VnRow>
</QCard>
<QCard class="vn-one" v-if="entity.defaultAddress">
<VnTitle

View File

@ -134,7 +134,7 @@ watch(
<div class="full-width flex justify-center">
<QCard class="card-width q-pa-lg">
<QForm>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<QCheckbox :label="t('Unpaid client')" v-model="unpaidClient" />
</div>

View File

@ -18,7 +18,6 @@ const initialData = reactive({
const workersOptions = ref([]);
const businessTypesOptions = ref([]);
const postcodesOptions = ref([]);
function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {};
@ -48,7 +47,7 @@ function handleLocation(data, location) {
url-create="Clients/createWithUser"
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QInput :label="t('Comercial name')" v-model="data.name" />
<VnSelect
:label="t('Salesperson')"
@ -59,7 +58,7 @@ function handleLocation(data, location) {
v-model="data.salesPersonFk"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Business type')"
:options="businessTypesOptions"
@ -70,32 +69,31 @@ function handleLocation(data, location) {
/>
<QInput v-model="data.fi" :label="t('Tax number')" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QInput
:label="t('Business name')"
:rules="validate('client.socialName')"
v-model="data.socialName"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QInput
:label="t('Street')"
:rules="validate('client.street')"
v-model="data.street"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnLocation
:rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.location"
@update:model-value="(location) => handleLocation(data, location)"
>
</VnLocation>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QInput v-model="data.userName" :label="t('Web user')" />
<QInput
:label="t('Email')"

View File

@ -15,7 +15,6 @@ import { toDate } from 'src/filters';
const { t } = useI18n();
const router = useRouter();
const postcodesOptions = ref([]);
const tableRef = ref();
const columns = computed(() => [
@ -42,9 +41,7 @@ const columns = computed(() => [
name: 'name',
isTitle: true,
create: true,
columnField: {
class: 'expand',
},
columnClass: 'expand',
},
{
align: 'left',
@ -52,9 +49,7 @@ const columns = computed(() => [
label: t('customer.extendedList.tableVisibleColumns.socialName'),
isTitle: true,
create: true,
columnField: {
class: 'expand',
},
columnClass: 'expand',
},
{
align: 'left',
@ -110,9 +105,9 @@ const columns = computed(() => [
component: null,
after: {
component: markRaw(VnLinkPhone),
attrs: (prop) => {
attrs: ({ model }) => {
return {
'phone-number': prop,
'phone-number': model,
};
},
},
@ -136,9 +131,7 @@ const columns = computed(() => [
columnFilter: {
inWhere: true,
},
columnField: {
class: 'expand',
},
columnClass: 'expand',
},
{
align: 'left',
@ -420,7 +413,6 @@ function handleLocation(data, location) {
<template #more-create-dialog="{ data }">
<VnLocation
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.location"
@update:model-value="(location) => handleLocation(data, location)"
/>

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,9 +1,8 @@
<script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { QBtn, QCheckbox, useQuasar } from 'quasar';
import { useQuasar } from 'quasar';
import { toCurrency, toDate, dateRange } from 'filters/index';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
@ -11,8 +10,9 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInput from 'src/components/common/VnInput.vue';
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
import axios from 'axios';
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
const { t } = useI18n();
const quasar = useQuasar();
@ -21,175 +21,139 @@ const dataRef = ref(null);
const balanceDueTotal = ref(0);
const selected = ref([]);
const tableColumnComponents = {
clientFk: {
component: QBtn,
props: () => ({ flat: true, class: 'link', noCaps: true }),
event: () => {},
},
isWorker: {
component: QCheckbox,
props: (prop) => ({
disable: true,
'model-value': Boolean(prop.value),
}),
event: () => {},
},
salesPerson: {
component: QBtn,
props: () => ({ flat: true, class: 'link', noCaps: true }),
event: () => {},
},
departmentName: {
component: 'span',
props: () => {},
event: () => {},
},
country: {
component: 'span',
props: () => {},
event: () => {},
},
payMethod: {
component: 'span',
props: () => {},
event: () => {},
},
balance: {
component: 'span',
props: () => {},
event: () => {},
},
author: {
component: QBtn,
props: () => ({ flat: true, class: 'link', noCaps: true }),
event: () => {},
},
lastObservation: {
component: 'span',
props: () => {},
event: () => {},
},
date: {
component: 'span',
props: () => {},
event: () => {},
},
credit: {
component: 'span',
props: () => {},
event: () => {},
},
from: {
component: 'span',
props: () => {},
event: () => {},
},
finished: {
component: QCheckbox,
props: (prop) => ({
disable: true,
'model-value': prop.value,
}),
event: () => {},
},
};
const columns = computed(() => [
{
align: 'left',
field: 'clientName',
label: t('Client'),
name: 'clientFk',
sortable: true,
label: t('Client'),
columnFilter: {
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'name'],
},
},
},
{
align: 'left',
field: ({ isWorker }) => Boolean(isWorker),
label: t('Is worker'),
name: 'isWorker',
label: t('Is worker'),
},
{
align: 'left',
field: 'salesPersonName',
name: 'salesPersonFk',
label: t('Salesperson'),
name: 'salesPerson',
sortable: true,
columnFilter: {
component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
where: { role: 'salesPerson' },
useLike: false,
optionValue: 'id',
optionLabel: 'name',
optionFilter: 'firstName',
},
},
},
{
align: 'left',
field: 'departmentName',
name: 'departmentFk',
label: t('Department'),
name: 'departmentName',
sortable: true,
columnFilter: {
component: 'select',
attrs: {
url: 'Departments',
fields: ['id', 'name'],
},
},
},
{
align: 'left',
field: 'country',
name: 'countryFk',
label: t('Country'),
name: 'country',
sortable: true,
format: ({ country }) => country,
columnFilter: {
component: 'select',
attrs: {
url: 'Countries',
fields: ['id', 'name'],
},
},
},
{
align: 'left',
field: 'payMethod',
label: t('P. Method'),
name: 'payMethod',
sortable: true,
tooltip: t('Pay method'),
label: t('P. Method'),
columnFilter: {
component: 'select',
attrs: {
url: 'Paymethods',
},
},
},
{
align: 'left',
field: ({ amount }) => toCurrency(amount),
name: 'amount',
label: t('Balance D.'),
name: 'balance',
sortable: true,
tooltip: t('Balance due'),
format: ({ amount }) => toCurrency(amount),
},
{
align: 'left',
field: 'workerName',
name: 'workerFk',
label: t('Author'),
name: 'author',
sortable: true,
tooltip: t('Worker who made the last observation'),
columnFilter: {
component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
useLike: false,
optionValue: 'id',
optionLabel: 'name',
optionFilter: 'firstName',
},
},
},
{
align: 'left',
field: 'observation',
name: 'observation',
label: t('Last observation'),
name: 'lastObservation',
sortable: true,
columnClass: 'expand',
},
{
align: 'left',
field: ({ created }) => toDate(created),
name: 'created',
label: t('L. O. Date'),
name: 'date',
sortable: true,
format: ({ created }) => toDate(created),
tooltip: t('Last observation date'),
columnFilter: {
component: 'date',
},
},
{
align: 'left',
field: ({ creditInsurance }) => toCurrency(creditInsurance),
name: 'creditInsurance',
format: ({ creditInsurance }) => toCurrency(creditInsurance),
label: t('Credit I.'),
name: 'credit',
sortable: true,
tooltip: t('Credit insurance'),
columnFilter: {
component: 'number',
},
},
{
align: 'left',
field: ({ defaulterSinced }) => toDate(defaulterSinced),
name: 'defaulterSinced',
format: ({ defaulterSinced }) => toDate(defaulterSinced),
label: t('From'),
name: 'from',
sortable: true,
columnFilter: {
component: 'date',
},
},
{
align: 'left',
field: 'finished',
label: t('Has recover'),
name: 'finished',
label: t('Has recovery'),
name: 'hasRecovery',
},
]);
@ -198,22 +162,12 @@ const viewAddObservation = (rowsSelected) => {
component: CustomerDefaulterAddObservation,
componentProps: {
clients: rowsSelected,
promise: async () => await dataRef.value.fetch(),
promise: async () => await dataRef.value.reload(),
},
});
};
const onFetch = async (data) => {
const recoveryData = await axios.get('Recoveries');
const recoveries = recoveryData.data.map(({ clientFk, finished }) => ({
clientFk,
finished,
}));
data.forEach((item) => {
const recovery = recoveries.find(({ clientFk }) => clientFk === item.clientFk);
item.finished = recovery?.finished === null;
});
balanceDueTotal.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
};
@ -229,7 +183,7 @@ function exprBuilder(param, value) {
case 'payMethod':
case 'salesPersonFk':
return { [`d.${param}`]: value };
case 'date':
case 'created':
return { 'd.created': { between: dateRange(value) } };
case 'defaulterSinced':
return { 'd.defaulterSinced': { between: dateRange(value) } };
@ -246,123 +200,64 @@ function exprBuilder(param, value) {
<VnSubToolbar>
<template #st-data>
<CustomerBalanceDueTotal :amount="balanceDueTotal" />
<div class="flex items-center q-ml-lg">
<QBtn
color="primary"
icon="vn:notes"
:disabled="!selected.length"
@click.stop="viewAddObservation(selected)"
>
<QTooltip>{{ t('Add observation') }}</QTooltip>
</QBtn>
</div>
</template>
<template #st-actions>
<QBtn
color="primary"
icon="vn:notes"
:disabled="!selected.length"
@click.stop="viewAddObservation(selected)"
>
<QTooltip>{{ t('Add observation') }}</QTooltip>
</QBtn>
</template>
</VnSubToolbar>
<QPage class="column items-center q-pa-md">
<VnPaginate
ref="dataRef"
@on-fetch="onFetch"
data-key="CustomerDefaulter"
:filter="filter"
:expr-builder="exprBuilder"
auto-load
url="Defaulters/filter"
>
<template #body="{ rows }">
<div class="q-pa-md">
<QTable
:columns="columns"
:rows="rows"
class="full-width"
row-key="clientFk"
selection="multiple"
v-model:selected="selected"
>
<template #header="props">
<QTr :props="props" class="bg" style="min-height: 200px">
<QTh>
<QCheckbox v-model="props.selected" />
</QTh>
<QTh
v-for="col in props.cols"
:key="col.name"
:props="props"
>
{{ t(col.label) }}
<QTooltip v-if="col.tooltip">{{
col.tooltip
}}</QTooltip>
</QTh>
</QTr>
</template>
<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
)
"
>
<template v-if="typeof props.value !== 'boolean'">
<div
v-if="
props.col.name === 'lastObservation'
"
>
<VnInput
type="textarea"
v-model="props.value"
readonly
dense
rows="2"
/>
</div>
<div v-else>{{ props.value }}</div>
</template>
<WorkerDescriptorProxy
:id="props.row.salesPersonFk"
v-if="props.col.name === 'salesPerson'"
/>
<WorkerDescriptorProxy
:id="props.row.workerFk"
v-if="props.col.name === 'author'"
/>
<CustomerDescriptorProxy
:id="props.row.clientFk"
v-if="props.col.name === 'client'"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>
</div>
</template>
</VnPaginate>
</QPage>
<VnTable
ref="dataRef"
data-key="CustomerDefaulter"
url="Defaulters/filter"
:expr-builder="exprBuilder"
:columns="columns"
@on-fetch="onFetch"
:use-model="true"
:table="{
'row-key': 'clientFk',
selection: 'multiple',
}"
v-model:selected="selected"
:disable-option="{ card: true }"
auto-load
:order="['amount DESC']"
>
<template #column-clientFk="{ row }">
<span class="link" @click.stop>
{{ row.clientName }}
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</template>
<template #column-observation="{ row }">
<VnInput type="textarea" v-model="row.observation" readonly dense rows="2" />
</template>
<template #column-salesPersonFk="{ row }">
<span class="link" @click.stop>
{{ row.salesPersonName }}
<WorkerDescriptorProxy :id="row.salesPersonFk" />
</span>
</template>
<template #column-departmentFk="{ row }">
<span class="link" @click.stop>
{{ row.departmentName }}
<DepartmentDescriptorProxy :id="row.departmentFk" />
</span>
</template>
<template #column-workerFk="{ row }">
<span class="link" @click.stop>
{{ row.workerName }}
<WorkerDescriptorProxy :id="row.workerFk" />
</span>
</template>
</VnTable>
</template>
<style lang="scss" scoped>
.col-content {
border-radius: 4px;
padding: 6px;
}
</style>
<i18n>
es:
Add observation: Añadir observación
@ -383,4 +278,5 @@ es:
Credit I.: Crédito A.
Credit insurance: Crédito asegurado
From: Desde
Has recovery: Tiene recobro
</i18n>

View File

@ -60,7 +60,7 @@ const onSubmit = async () => {
})
}}
</div>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QInput
:label="t('Message')"
type="textarea"

View File

@ -1,92 +1,92 @@
<script setup>
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { QBtn } from 'quasar';
import CustomerNotificationsFilter from './CustomerNotificationsFilter.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CustomerNotificationsCampaignConsumption from './CustomerNotificationsCampaignConsumption.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnTable from 'src/components/VnTable/VnTable.vue';
const { t } = useI18n();
const dataKey = 'CustomerNotifications';
const selected = ref([]);
const selectedCustomerId = ref(0);
const tableColumnComponents = {
id: {
component: QBtn,
props: () => ({ flat: true, color: 'blue' }),
event: (prop) => selectCustomerId(prop.row.id),
},
socialName: {
component: 'span',
props: () => {},
event: () => {},
},
city: {
component: 'span',
props: () => {},
event: () => {},
},
phone: {
component: 'span',
props: () => {},
event: () => {},
},
email: {
component: 'span',
props: () => {},
event: () => {},
},
};
const columns = computed(() => [
{
align: 'left',
field: 'id',
label: t('Identifier'),
name: 'id',
columnClass: 'shrink',
},
{
align: 'left',
field: 'socialName',
label: t('Social name'),
name: 'socialName',
columnFilter: {
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'socialName'],
optionLabel: 'socialName',
},
},
columnClass: 'expand',
isTitle: true,
},
{
align: 'left',
field: 'city',
label: t('City'),
name: 'city',
columnFilter: {
component: 'select',
attrs: {
url: 'Towns',
},
},
cardVisible: true,
},
{
align: 'left',
field: 'phone',
label: t('Phone'),
name: 'phone',
cardVisible: true,
},
{
align: 'left',
field: 'email',
label: t('Email'),
name: 'email',
cardVisible: true,
},
{
align: 'left',
name: 'fi',
label: t('Fi'),
visible: false,
},
{
align: 'left',
name: 'postcode',
label: t('Postcode'),
visible: false,
},
{
align: 'left',
label: t('customer.extendedList.tableVisibleColumns.salesPersonFk'),
name: 'salesPersonFk',
component: 'select',
attrs: {
url: 'Workers/activeWithInheritedRole',
fields: ['id', 'name'],
where: { role: 'salesPerson' },
optionFilter: 'firstName',
useLike: false,
},
visible: false,
},
]);
const selectCustomerId = (id) => {
selectedCustomerId.value = id;
};
</script>
<template>
<RightMenu>
<template #right-panel>
<CustomerNotificationsFilter data-key="CustomerNotifications" />
</template>
</RightMenu>
<VnSubToolbar class="justify-end">
<template #st-data>
<template #st-actions>
<CustomerNotificationsCampaignConsumption
:selected-rows="selected.length > 0"
:clients="selected"
@ -94,51 +94,26 @@ const selectCustomerId = (id) => {
/>
</template>
</VnSubToolbar>
<QPage class="column items-center q-pa-md">
<VnPaginate data-key="CustomerNotifications" url="Clients" auto-load>
<template #body="{ rows }">
<div class="q-pa-md">
<QTable
:columns="columns"
:rows="rows"
class="full-width q-mt-md"
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 }}
<CustomerDescriptorProxy
:id="selectedCustomerId"
/>
</component>
</QTr>
</QTd>
</template>
</QTable>
</div>
</template>
</VnPaginate>
</QPage>
<VnTable
:data-key="dataKey"
url="Clients"
:table="{
'row-key': 'id',
selection: 'multiple',
}"
v-model:selected="selected"
:right-search="true"
:columns="columns"
:use-model="true"
auto-load
>
<template #column-id="{ row }">
<span class="link">
{{ row.id }}
<CustomerDescriptorProxy :id="row.id" />
</span>
</template>
</VnTable>
</template>
<style lang="scss" scoped>

View File

@ -99,7 +99,7 @@ onMounted(async () => {
<QPopupProxy ref="popupProxyRef">
<QCard class="column q-pa-md">
<span class="text-body1 q-mb-sm">{{ t('Campaign consumption') }}</span>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:options="moreFields"
option-value="code"
@ -109,7 +109,7 @@ onMounted(async () => {
@update:model-value="campaignChange"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInputDate v-model="campaignParams.from" :label="t('From')" />
<VnInputDate v-model="campaignParams.to" :label="t('To')" />
</VnRow>

View File

@ -1,145 +0,0 @@
<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 VnSelect from 'components/common/VnSelect.vue';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
});
const cities = ref();
const clients = ref();
</script>
<template>
<FetchData
:filter="{ where: { role: 'socialName' } }"
@on-fetch="(data) => (clients = data)"
auto-load
url="Clients"
/>
<FetchData @on-fetch="(data) => (cities = data)" auto-load url="Towns" />
<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, searchFn }">
<QItem class="q-mb-sm q-mt-sm">
<QItemSection>
<VnInput
:label="t('Identifier')"
clearable
is-outlined
v-model="params.identifier"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection v-if="!clients">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="clients">
<VnSelect
:input-debounce="0"
:label="t('Social name')"
:options="clients"
@update:model-value="searchFn()"
dense
emit-value
hide-selected
map-options
option-label="socialName"
option-value="socialName"
outlined
rounded
use-input
v-model="params.socialName"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection v-if="!cities">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="cities">
<VnSelect
:input-debounce="0"
:label="t('City')"
:options="cities"
@update:model-value="searchFn()"
dense
emit-value
hide-selected
map-options
option-label="name"
option-value="name"
outlined
rounded
use-input
v-model="params.city"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('Phone')"
clearable
is-outlined
v-model="params.phone"
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('Email')"
clearable
is-outlined
type="email"
v-model="params.email"
/>
</QItemSection>
</QItem>
<QSeparator />
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
identifier: Identifier
socialName: Social name
city: City
phone: Phone
email: Email
es:
params:
identifier: Identificador
socialName: Razón social
city: Población
phone: Teléfono
email: Email
Identifier: Identificador
Social name: Razón social
City: Población
Phone: Teléfono
Email: Email
</i18n>

View File

@ -1,19 +1,18 @@
<script setup>
import axios from 'axios';
import { ref, computed } from 'vue';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { useArrayData } from 'composables/useArrayData';
import VnPaginate from 'components/ui/VnPaginate.vue';
import { toDate, toCurrency } from 'filters/index';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnConfirm from 'components/ui/VnConfirm.vue';
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
import { toDate, toCurrency } from 'filters/index';
import CustomerPaymentsFilter from './CustomerPaymentsFilter.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
const quasar = useQuasar();
const { t } = useI18n();
const arrayData = useArrayData('CustomerTransactions');
async function confirm(transaction) {
quasar
@ -36,59 +35,73 @@ async function confirmTransaction({ id }) {
});
}
const grid = ref(false);
const columns = computed(() => [
{
name: 'id',
label: t('Transaction ID'),
field: (row) => row.id,
sortable: true,
},
{
name: 'customerId',
label: t('Customer ID'),
field: (row) => row.clientFk,
align: 'right',
sortable: true,
},
{
name: 'customer',
label: t('Customer Name'),
field: (row) => row.customerName,
},
{
name: 'state',
label: t('State'),
field: (row) => row.isConfirmed,
format: (value) => (value ? t('Confirmed') : t('Unconfirmed')),
isTitle: true,
align: 'left',
sortable: true,
columnFilter: {
inWhere: true,
alias: 't',
},
columnClass: 'shrink',
},
{
name: 'dated',
align: 'left',
name: 'clientFk',
label: t('Customer'),
columnFilter: {
component: 'select',
attrs: {
url: 'Clients',
fields: ['id', 'name'],
},
},
columnClass: 'expand',
cardVisible: true,
},
{
name: 'isConfirmed',
label: t('State'),
align: 'left',
format: ({ isConfirmed }) => (isConfirmed ? t('Confirmed') : t('Unconfirmed')),
chip: {
condition: () => true,
color: ({ isConfirmed }) => (isConfirmed ? 'bg-positive' : 'bg-primary'),
},
visible: false,
},
{
name: 'created',
label: t('Dated'),
field: (row) => toDate(row.created),
sortable: true,
format: ({ created }) => toDate(created),
columnFilter: false,
cardVisible: true,
},
{
name: 'amount',
label: t('Amount'),
field: (row) => row.amount,
format: (value) => toCurrency(value),
sortable: true,
format: ({ amount }) => toCurrency(amount),
columnFilter: {
component: 'number',
},
cardVisible: true,
},
{
name: 'actions',
label: t('Actions'),
grid: false,
align: 'right',
name: 'tableActions',
actions: [
{
title: t('Confirm transaction'),
icon: 'check',
action: (row) => confirm(row),
show: ({ isConfirmed }) => !isConfirmed,
isPrimary: true,
},
],
},
]);
const isLoading = computed(() => arrayData.isLoading.value);
function stateColor(row) {
if (row.isConfirmed) return 'positive';
return 'primary';
}
</script>
<template>
@ -97,158 +110,22 @@ function stateColor(row) {
<CustomerPaymentsFilter data-key="CustomerTransactions" />
</template>
</RightMenu>
<QPage class="column items-center q-pa-md customer-payments">
<div class="vn-card-list">
<QToolbar class="q-pa-none justify-end">
<QBtn
@click="arrayData.refresh()"
:loading="isLoading"
icon="refresh"
color="primary"
class="q-mr-sm"
round
dense
/>
<QBtn @click="grid = !grid" icon="list" color="primary" round dense>
<QTooltip>{{ t('Change view') }}</QTooltip>
</QBtn>
</QToolbar>
<VnPaginate
data-key="CustomerTransactions"
url="Clients/transactions"
order="created DESC"
:limit="20"
:offset="50"
:auto-load="!!$route?.query.params"
>
<template #body="{ rows }">
<QTable
:dense="$q.screen.lt.md"
:columns="columns"
:rows="rows"
row-key="id"
:grid="grid || $q.screen.lt.sm"
class="q-mt-xs custom-table"
>
<template #body-cell-actions="{ row }">
<QTd auto-width class="text-center">
<QBtn
v-if="!row.isConfirmed"
icon="check"
@click="confirm(row)"
color="primary"
size="md"
round
flat
dense
>
<QTooltip>{{ t('Confirm transaction') }}</QTooltip>
</QBtn>
</QTd>
</template>
<template #body-cell-id="{ row }">
<QTd auto-width align="right">
<span>
{{ row.id }}
</span>
</QTd>
</template>
<template #body-cell-customerId="{ row }">
<QTd align="right">
<span class="link">
{{ row.clientFk }}
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</QTd>
</template>
<template #body-cell-customer="{ row }">
<QTd auto-width align="left" :title="row.customerName">
<span>
{{ row.customerName }}
</span>
</QTd>
</template>
<template #body-cell-state="{ row }">
<QTd auto-width class="text-center">
<QBadge text-color="black" :color="stateColor(row)">
{{
row.isConfirmed
? t('Confirmed')
: t('Unconfirmed')
}}
</QBadge>
</QTd>
</template>
<template #item="{ cols, row }">
<div class="q-mb-md col-12">
<QCard class="q-pa-none">
<QItem class="q-pa-none items-start">
<QItemSection class="q-pa-none">
<QList>
<template
v-for="col of cols"
:key="col.name"
>
<QItem
v-if="col.grid !== false"
class="q-pa-none"
>
<QItemSection>
<QItemLabel caption>
{{ col.label }}
</QItemLabel>
<QItemLabel
v-if="col.name == 'state'"
>
<QBadge
text-color="black"
:color="
stateColor(row)
"
>
{{ col.value }}
</QBadge>
</QItemLabel>
<QItemLabel
v-if="col.name != 'state'"
>
{{ col.value }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</QList>
</QItemSection>
<template v-if="!row.isConfirmed">
<QSeparator vertical />
<QCardActions
vertical
class="justify-between"
>
<QBtn
icon="check"
@click="confirm(row)"
color="primary"
size="md"
round
flat
dense
>
<QTooltip>
{{ t('Confirm transaction') }}
</QTooltip>
</QBtn>
</QCardActions>
</template>
</QItem>
</QCard>
</div>
</template>
</QTable>
</template>
</VnPaginate>
</div>
</QPage>
<VnTable
data-key="CustomerTransactions"
url="Clients/transactions"
order="created DESC"
:columns="columns"
:right-search="false"
auto-load
>
<template #column-clientFk="{ row }">
<span class="link">
{{ row.clientFk }} -
{{ row.customerName }}
<CustomerDescriptorProxy :id="row.clientFk" />
</span>
</template>
</VnTable>
</template>
<style lang="scss">
@ -269,14 +146,11 @@ es:
Web Payments: Pagos Web
Confirm transaction: Confirmar transacción
Transaction ID: ID transacción
Customer ID: ID cliente
Customer Name: Nombre cliente
Customer: cliente
State: Estado
Dated: Fecha
Amount: Importe
Actions: Acciones
Confirmed: Confirmada
Unconfirmed: Sin confirmar
Change view: Cambiar vista
Payment confirmed: Pago confirmado
</i18n>

View File

@ -21,7 +21,6 @@ const formInitialData = reactive({ isDefaultAddress: false });
const urlCreate = ref('');
const postcodesOptions = ref([]);
const agencyModes = ref([]);
const incoterms = ref([]);
const customsAgents = ref([]);
@ -85,7 +84,7 @@ function handleLocation(data, location) {
<template #form="{ data, validate }">
<QCheckbox :label="t('Default')" v-model="data.isDefaultAddress" />
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput :label="t('Consignee')" clearable v-model="data.nickname" />
<VnInput :label="t('Street address')" clearable v-model="data.street" />
@ -94,7 +93,6 @@ function handleLocation(data, location) {
<VnLocation
:rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.location"
@update:model-value="(location) => handleLocation(data, location)"
/>
@ -119,7 +117,7 @@ function handleLocation(data, location) {
/>
</div>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Incoterms')"
:options="incoterms"

View File

@ -18,7 +18,6 @@ const route = useRoute();
const router = useRouter();
const urlUpdate = ref('');
const postcodesOptions = ref([]);
const agencyModes = ref([]);
const incoterms = ref([]);
const customsAgents = ref([]);
@ -146,7 +145,7 @@ function handleLocation(data, location) {
</template>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<QCheckbox :label="t('Enabled')" v-model="data.isActive" />
</div>
@ -164,7 +163,7 @@ function handleLocation(data, location) {
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput :label="t('Consignee')" clearable v-model="data.nickname" />
</div>
@ -173,19 +172,18 @@ function handleLocation(data, location) {
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnLocation
:rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.postalCode"
@update:model-value="(location) => handleLocation(data, location)"
></VnLocation>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnSelect
:label="t('Agency')"
@ -204,7 +202,7 @@ function handleLocation(data, location) {
<VnInput :label="t('Mobile')" clearable v-model="data.mobile" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnSelect
:label="t('Incoterms')"

View File

@ -39,7 +39,7 @@ const toCustomerCreditContracts = () => {
</template>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
:label="t('Credit')"

View File

@ -1,67 +0,0 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const initialData = ref({});
const setClient = (data) => {
initialData.value.credit = data.credit;
};
const toCustomerCredits = () => {
router.push({
name: 'CustomerCredits',
params: {
id: route.params.id,
},
});
};
</script>
<template>
<FetchData
:filter="filter"
@on-fetch="setClient"
auto-load
:url="`Clients/${route.params.id}/getCard`"
/>
<FormModel
:form-initial-data="initialData"
:observe-form-changes="false"
:url-update="`/Clients/${route.params.id}`"
@on-data-saved="toCustomerCredits()"
>
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerCredits"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data }">
<QInput
:label="t('Credit')"
clearable
type="number"
v-model.number="data.credit"
/>
</template>
</FormModel>
</template>
<i18n>
es:
Credit: Crédito
</i18n>

View File

@ -143,7 +143,7 @@ const toCustomerFileManagement = () => {
<QCard class="q-pa-lg">
<QCardSection>
<QForm>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
:label="t('Reference')"
@ -163,7 +163,7 @@ const toCustomerFileManagement = () => {
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnSelect
:label="t('Warehouse')"
@ -184,7 +184,7 @@ const toCustomerFileManagement = () => {
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
:label="t('Description')"
@ -196,7 +196,7 @@ const toCustomerFileManagement = () => {
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<QFile
ref="inputFileRef"

View File

@ -119,7 +119,7 @@ const toCustomerFileManagement = () => {
<QCard class="q-pa-lg">
<QCardSection>
<QForm>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
:label="t('Reference')"
@ -139,7 +139,7 @@ const toCustomerFileManagement = () => {
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnSelect
:label="t('Warehouse')"
@ -160,7 +160,7 @@ const toCustomerFileManagement = () => {
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
:label="t('Description')"
@ -172,7 +172,7 @@ const toCustomerFileManagement = () => {
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<QFile
ref="inputFileRef"

View File

@ -1,97 +0,0 @@
<script setup>
import { onMounted, reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } 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 VnInputDate from 'components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const initialData = reactive({
shipped: '2001-01-01T11:00:00.000Z',
});
const greugeTypes = ref([]);
onMounted(() => {
initialData.clientFk = `${route.params.id}`;
});
const toCustomerGreuges = () => {
router.push({
name: 'CustomerGreuges',
params: {
id: route.params.id,
},
});
};
</script>
<template>
<fetch-data @on-fetch="(data) => (greugeTypes = data)" auto-load url="greugeTypes" />
<FormModel
:form-initial-data="initialData"
:observe-form-changes="false"
@on-data-saved="toCustomerGreuges()"
model="client"
url-create="Greuges"
>
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerGreuges"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
:label="t('Amount')"
clearable
type="number"
v-model="data.amount"
/>
<VnInputDate :label="t('Date')" v-model="data.shipped" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput :label="t('Comment')" clearable v-model="data.description" />
<VnSelect
:label="t('Type')"
:options="greugeTypes"
hide-selected
option-label="name"
option-value="id"
v-model="data.greugeTypeFk"
/>
</VnRow>
</template>
</FormModel>
</template>
<style lang="scss" scoped>
.add-icon {
cursor: pointer;
background-color: $primary;
border-radius: 50px;
}
</style>
<i18n>
es:
Amount: Importe
Date: Fecha
Comment: Comentario
Type: Tipo
</i18n>

View File

@ -22,7 +22,7 @@ const onDataSaved = (dataSaved) => {
url-create="CustomsAgents"
>
<template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('NIF')"
:required="true"
@ -36,7 +36,7 @@ const onDataSaved = (dataSaved) => {
v-model="data.fiscalName"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput :label="t('Street')" clearable v-model="data.street" />
<VnInput :label="t('Phone')" clearable v-model="data.phone" />
</VnRow>

View File

@ -38,7 +38,7 @@ const bankOptions = ref([]);
const clientFindOne = ref([]);
const deliveredAmount = ref(null);
const amountToReturn = ref(null);
const viewRecipt = ref(true);
const viewReceipt = ref();
const sendEmail = ref(false);
const isLoading = ref(false);
@ -67,12 +67,34 @@ onBeforeMount(() => {
urlCreate.value = `Clients/${route.params.id}/createReceipt`;
});
const setPaymentType = (id) => {
initialData.payed = '2001-01-01T11:00:00.000Z';
if (id === 1) initialData.description = 'Credit card';
if (id === 2) initialData.description = 'Cash';
if (id === 3 || id === 3117) initialData.description = '';
if (id === 4) initialData.description = 'Transfer';
const setPaymentType = (value) => {
// if (id === 1) initialData.description = 'Credit card';
// if (id === 2) initialData.description = 'Cash';
// if (id === 3 || id === 3117) initialData.description = '';
// if (id === 4) initialData.description = 'Transfer';
// const CASH_CODE = 2;
// // const CASH_CODE = 2
// if (!value) return;
// const accountingType = CASH_CODE;
// initialData.description = '';
// viewReceipt.value = value == CASH_CODE;
// if (accountingType.code == 'compensation') this.receipt.description = '';
// else {
// if (
// accountingType.receiptDescription != null &&
// accountingType.receiptDescription != ''
// )
// this.receipt.description.push(accountingType.receiptDescription);
// if (this.originalDescription)
// this.receipt.description.push(this.originalDescription);
// this.receipt.description = this.receipt.description.join(', ');
// }
// this.maxAmount = accountingType && accountingType.maxAmount;
// this.receipt.payed = Date.vnNew();
// if (accountingType.daysInFuture)
// this.receipt.payed.setDate(
// this.receipt.payed.getDate() + accountingType.daysInFuture
// );
};
const calculateFromAmount = (event) => {
@ -134,7 +156,7 @@ const onDataSaved = async () => {
<h5 class="q-mt-none">{{ t('New payment') }}</h5>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInputDate
:label="t('Date')"
:required="true"
@ -152,7 +174,7 @@ const onDataSaved = async () => {
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Bank')"
:options="bankOptions"
@ -187,7 +209,7 @@ const onDataSaved = async () => {
{{ t('Compensation') }}
</div>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col" v-if="data.bankFk === 3 || data.bankFk === 3117">
<VnInput
:label="t('Compensation account')"
@ -205,8 +227,7 @@ const onDataSaved = async () => {
<div class="q-mt-lg" v-if="data.bankFk === 2">
<div class="text-h6">{{ t('Cash') }}</div>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('Delivered amount')"
@update:model-value="calculateFromDeliveredAmount($event)"
@ -222,13 +243,11 @@ const onDataSaved = async () => {
v-model="amountToReturn"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<QCheckbox v-model="viewRecipt" />
<VnRow>
<QCheckbox v-model="viewReceipt" />
<QCheckbox v-model="sendEmail" />
</VnRow>
</div>
<div class="q-mt-lg row justify-end">
<QBtn
:disabled="isLoading"

View File

@ -1,57 +0,0 @@
<script setup>
import { onMounted, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const initialData = reactive({});
onMounted(() => {
initialData.clientFk = `${route.params.id}`;
});
const toCustomerNotes = () => {
router.push({
name: 'CustomerNotes',
params: {
id: route.params.id,
},
});
};
</script>
<template>
<FormModel
:form-initial-data="initialData"
:observe-form-changes="false"
@on-data-saved="toCustomerNotes()"
url-create="ClientObservations"
>
<template #moreActions>
<QBtn
:label="t('globals.cancel')"
@click="toCustomerNotes"
color="primary"
flat
icon="close"
/>
</template>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<QInput :label="t('Note')" type="textarea" v-model="data.text" />
</VnRow>
</template>
</FormModel>
</template>
<i18n>
es:
Note: Nota
</i18n>

View File

@ -49,12 +49,12 @@ const toCustomerRecoveries = () => {
</template>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInputDate :label="t('Since')" v-model="data.started" />
<VnInputDate :label="t('To')" v-model="data.finished" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('Amount')"
clearable

View File

@ -264,7 +264,7 @@ const toCustomerSamples = () => {
/>
</div>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<div class="col">
<VnInput
:label="t('Recipient')"

View File

@ -29,7 +29,7 @@ const clientsOptions = ref([]);
class="full-width"
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('department.name')"
v-model="data.name"
@ -44,7 +44,7 @@ const clientsOptions = ref([]);
clearable
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('department.chat')"
v-model="data.chatName"
@ -58,7 +58,7 @@ const clientsOptions = ref([]);
clearable
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('department.bossDepartment')"
v-model="data.workerFk"
@ -80,7 +80,7 @@ const clientsOptions = ref([]);
:rules="validate('department.clientFk')"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QCheckbox
:label="t('department.telework')"
v-model="data.isTeleworking"
@ -92,7 +92,7 @@ const clientsOptions = ref([]);
:true-value="1"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QCheckbox
:label="t('department.worksInProduction')"
v-model="data.isProduction"
@ -102,7 +102,7 @@ const clientsOptions = ref([]);
v-model="data.hasToRefill"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QCheckbox
:label="t('department.hasToSendMail')"
v-model="data.hasToSendMail"

View File

@ -67,7 +67,7 @@ const onFilterTravelSelected = (formData, id) => {
:clear-store-on-unmount="false"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('entry.basicData.supplier')"
v-model="data.supplierFk"
@ -121,13 +121,13 @@ const onFilterTravelSelected = (formData, id) => {
</template>
</VnSelectDialog>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
v-model="data.reference"
:label="t('entry.basicData.reference')"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
v-model="data.invoiceNumber"
:label="t('entry.basicData.invoiceNumber')"
@ -143,7 +143,7 @@ const onFilterTravelSelected = (formData, id) => {
:required="true"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('entry.basicData.currency')"
v-model="data.currencyFk"
@ -159,7 +159,7 @@ const onFilterTravelSelected = (formData, id) => {
min="0"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QInput
:label="t('entry.basicData.observation')"
type="textarea"
@ -169,7 +169,7 @@ const onFilterTravelSelected = (formData, id) => {
fill-input
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QCheckbox
v-model="data.isOrdered"
:label="t('entry.basicData.ordered')"

View File

@ -197,7 +197,7 @@ const redirectToBuysView = () => {
</div>
</Teleport>
<QCard class="q-pa-lg">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<QFile
ref="inputFileRef"
:label="t('entry.buys.file')"
@ -219,13 +219,13 @@ const redirectToBuysView = () => {
</QFile>
</VnRow>
<div v-if="importData.file">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('entry.buys.reference')"
v-model="importData.ref"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnInput
:label="t('entry.buys.observations')"
v-model="importData.observation"

View File

@ -78,7 +78,7 @@ const redirectToEntryBasicData = (_, { id }) => {
@on-data-saved="redirectToEntryBasicData"
>
<template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Supplier')"
class="full-width"
@ -102,7 +102,7 @@ const redirectToEntryBasicData = (_, { id }) => {
</template>
</VnSelect>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Travel')"
class="full-width"
@ -131,7 +131,7 @@ const redirectToEntryBasicData = (_, { id }) => {
</template>
</VnSelect>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnRow>
<VnSelect
:label="t('Company')"
class="full-width"

View File

@ -1,5 +1,5 @@
<script setup>
import { onMounted, onUnmounted } from 'vue';
import { onMounted, onUnmounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnTable from 'components/VnTable/VnTable.vue';
@ -15,12 +15,13 @@ const columns = [
{
align: 'center',
label: t('entry.latestBuys.tableVisibleColumns.image'),
name: 'image',
name: 'itemFk',
columnField: {
component: VnImg,
attrs: (id) => {
attrs: ({ row }) => {
return {
id,
id: row.id,
size: '50x50',
width: '50px',
};
},
@ -169,6 +170,7 @@ const columns = [
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
},
];
const tableRef = ref();
onMounted(async () => {
stateStore.rightDrawer = true;
@ -191,6 +193,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
order="id DESC"
:columns="columns"
redirect="entry"
:row-click="({ entryFk }) => tableRef.redirect(entryFk)"
auto-load
:right-search="false"
/>

View File

@ -192,7 +192,7 @@ onMounted(async () => {
:filter="entryFilter"
:create="{
urlCreate: 'Entries',
title: 'Create entry',
title: t('Create entry'),
onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {},
}"
@ -210,4 +210,5 @@ es:
Virtual entry: Es una redada
Search entries: Buscar entradas
You can search by entry reference: Puedes buscar por referencia de la entrada
Create entry: Crear entrada
</i18n>

View File

@ -1,18 +0,0 @@
<script setup>
import LeftMenu from 'src/components/LeftMenu.vue';
import { useStateStore } from 'stores/useStateStore';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -1,71 +1,89 @@
<script setup>
import { computed, onMounted } from 'vue';
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'src/filters/index';
import { useQuasar } from 'quasar';
import EntryBuysTableDialog from './EntryBuysTableDialog.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import VnInput from 'src/components/common/VnInput.vue';
const stateStore = useStateStore();
const { t } = useI18n();
const quasar = useQuasar();
onMounted(async () => {
stateStore.rightDrawer = true;
});
const columns = computed(() => [
{
align: 'left',
name: 'id',
label: t('customer.extendedList.tableVisibleColumns.id'),
chip: {
condition: () => true,
},
isId: true,
isTitle: false,
columnFilter: false,
isTitle: true,
},
{
align: 'left',
visible: false,
align: 'right',
label: t('shipped'),
name: 'shipped',
isTitle: false,
create: true,
cardVisible: true,
component: 'date',
columnField: {
component: null,
columnFilter: {
name: 'fromShipped',
label: t('fromShipped'),
component: 'date',
},
format: ({ shipped }) => toDate(shipped),
},
{
visible: false,
align: 'left',
label: t('shipped'),
name: 'shipped',
columnFilter: {
name: 'toShipped',
label: t('toShipped'),
component: 'date',
},
format: ({ shipped }) => toDate(shipped),
cardVisible: true,
},
{
align: 'right',
label: t('shipped'),
name: 'shipped',
columnFilter: false,
format: ({ shipped }) => toDate(shipped),
},
{
align: 'right',
label: t('landed'),
name: 'landed',
isTitle: false,
create: true,
cardVisible: false,
component: 'date',
columnField: {
component: null,
},
columnFilter: false,
format: ({ landed }) => toDate(landed),
},
{
align: 'right',
label: t('globals.wareHouseIn'),
name: 'warehouseInFk',
format: (row) => row.warehouseInName,
cardVisible: true,
columnFilter: {
component: 'select',
attrs: {
url: 'warehouses',
fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
},
alias: 't',
inWhere: true,
},
},
{
align: 'left',
label: t('globals.wareHouseIn'),
name: 'warehouseInName',
isTitle: false,
cardVisible: true,
create: false,
label: t('globals.daysOnward'),
name: 'days',
visible: false,
},
{
align: 'right',
name: 'tableActions',
computed,
actions: [
{
title: t('printBuys'),
@ -87,35 +105,19 @@ const printBuys = (rowId) => {
</script>
<template>
<VnSearchbar
data-key="EntryList"
data-key="myEntriesList"
url="Entries/filter"
:label="t('Search entries')"
:info="t('You can search by entry reference')"
/>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnTable
ref="myEntriesRef"
data-key="myEntriesList"
url="Entries/filter"
:columns="columns"
default-mode="card"
auto-load
:right-search="true"
>
<template #moreFilterPanel="{ params }">
<VnInput
:label="t('globals.daysOnward')"
v-model="params.days"
class="q-px-xs row"
dense
filled
outlined
></VnInput>
</template>
</VnTable>
</div>
</QPage>
<VnTable
data-key="myEntriesList"
url="Entries/filter"
:columns="columns"
default-mode="card"
order="shipped DESC"
auto-load
/>
</template>
<i18n>

View File

@ -8,4 +8,6 @@ entryFilter:
reference: Reference
landed: Landed
shipped: Shipped
fromShipped: Shipped(from)
toShipped: Shipped(to)
printBuys: Print buys

View File

@ -12,4 +12,6 @@ entryFilter:
landed: F. llegada
shipped: F. salida
fromShipped: F. salida(desde)
toShipped: F. salida(hasta)
Print buys: Imprimir etiquetas

View File

@ -2,6 +2,7 @@
import VnCard from 'components/common/VnCard.vue';
import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
import InvoiceInFilter from '../InvoiceInFilter.vue';
import InvoiceInSearchbar from '../InvoiceInSearchbar.vue';
const filter = {
include: [
@ -28,8 +29,9 @@ const filter = {
:descriptor="InvoiceInDescriptor"
:filter-panel="InvoiceInFilter"
search-data-key="InvoiceInList"
search-url="InvoiceIns/filter"
searchbar-label="Search invoice"
searchbar-info="You can search by invoice reference"
/>
>
<template #searchbar>
<InvoiceInSearchbar />
</template>
</VnCard>
</template>

View File

@ -1,6 +1,6 @@
<script setup>
import { ref, reactive, computed, onBeforeMount } from 'vue';
import { useRouter, onBeforeRouteLeave } from 'vue-router';
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import axios from 'axios';
@ -129,33 +129,23 @@ onBeforeMount(async () => {
totalAmount.value = data.totalDueDay;
});
onBeforeRouteLeave(async (to, from) => {
onBeforeRouteUpdate(async (to, from) => {
invoiceInCorrection.correcting.length = 0;
invoiceInCorrection.corrected = null;
if (to.params.id !== from.params.id) await setInvoiceCorrection(entityId.value);
if (to.params.id !== from.params.id) {
await setInvoiceCorrection(to.params.id);
const { data } = await axios.get(`InvoiceIns/${to.params.id}/getTotals`);
totalAmount.value = data.totalDueDay;
}
});
async function setInvoiceCorrection(id) {
const [{ data: correctingData }, { data: correctedData }] = await Promise.all([
axios.get('InvoiceInCorrections', {
params: {
filter: {
where: {
correctingFk: id,
},
},
},
}),
axios.get('InvoiceInCorrections', {
params: {
filter: {
where: {
correctedFk: id,
},
},
},
}),
]);
const { data: correctingData } = await axios.get('InvoiceInCorrections', {
params: { filter: { where: { correctingFk: id } } },
});
const { data: correctedData } = await axios.get('InvoiceInCorrections', {
params: { filter: { where: { correctedFk: id } } },
});
if (correctingData[0]) invoiceInCorrection.corrected = correctingData[0].correctedFk;
@ -207,8 +197,14 @@ async function cloneInvoice() {
const isAdministrative = () => hasAny(['administrative']);
const isAgricultural = () =>
invoiceIn.value?.supplier?.sageWithholdingFk === config.value[0]?.sageWithholdingFk;
const isAgricultural = () => {
console.error(config);
if (!config.value) return false;
return (
invoiceIn.value?.supplier?.sageFarmerWithholdingFk ===
config?.value[0]?.sageWithholdingFk
);
};
function showPdfInvoice() {
if (isAgricultural()) openReport(`InvoiceIns/${entityId.value}/invoice-in-pdf`);
@ -374,7 +370,7 @@ const createInvoiceInCorrection = async () => {
</template>
</VnLv>
</template>
<template #action="{ entity }">
<template #actions="{ entity }">
<QCardActions>
<QBtn
size="md"
@ -442,7 +438,7 @@ const createInvoiceInCorrection = async () => {
readonly
/>
<VnSelect
:label="`${useCapitalize(t('globals.class'))}*`"
:label="`${useCapitalize(t('globals.class'))}`"
v-model="correctionFormData.invoiceClass"
:options="siiTypeInvoiceOuts"
option-value="id"
@ -452,7 +448,7 @@ const createInvoiceInCorrection = async () => {
</QItemSection>
<QItemSection>
<VnSelect
:label="`${useCapitalize(t('globals.type'))}*`"
:label="`${useCapitalize(t('globals.type'))}`"
v-model="correctionFormData.invoiceType"
:options="cplusRectificationTypes"
option-value="id"
@ -460,7 +456,7 @@ const createInvoiceInCorrection = async () => {
:required="true"
/>
<VnSelect
:label="`${useCapitalize(t('globals.reason'))}*`"
:label="`${useCapitalize(t('globals.reason'))}`"
v-model="correctionFormData.invoiceReason"
:options="invoiceCorrectionTypes"
option-value="id"
@ -488,6 +484,9 @@ const createInvoiceInCorrection = async () => {
.q-card {
max-width: 45em;
}
.q-field:nth-child(1) {
padding-bottom: 20px;
}
}
@media (max-width: $breakpoint-xs) {

View File

@ -72,7 +72,13 @@ const columns = computed(() => [
]);
const getTotal = (data, key) =>
data.reduce((acc, cur) => acc + +String(cur[key]).replace(',', '.'), 0);
data.reduce((acc, cur) => acc + +String(cur[key] || 0).replace(',', '.'), 0);
const formatOpt = (row, { model, options }, prop) => {
const obj = row[model];
const option = options.find(({ id }) => id == obj);
return option ? `${obj}:${option[prop]}` : '';
};
</script>
<template>
<FetchData
@ -92,7 +98,7 @@ const getTotal = (data, key) =>
ref="invoiceInFormRef"
data-key="InvoiceInIntrastats"
url="InvoiceInIntrastats"
:auto-load="!currency"
auto-load
:data-required="{ invoiceInFk: invoiceInId }"
:filter="filter"
v-model:selected="rowsSelected"
@ -124,6 +130,9 @@ const getTotal = (data, key) =>
option-value="id"
option-label="description"
:filter-options="['id', 'description']"
:hide-selected="false"
:fill-input="false"
:display-value="formatOpt(row, col, 'description')"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -247,7 +256,11 @@ const getTotal = (data, key) =>
}
}
</style>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
:deep(.q-table tr .q-td:nth-child(2) input) {
display: none;
}
</style>
<i18n>
en:
amount: Amount

View File

@ -66,7 +66,7 @@ const vatColumns = ref([
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
format: (value) => toCurrency(value, currency.value),
sortable: true,
align: 'center',
align: 'left',
},
{
name: 'currency',
@ -339,6 +339,16 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
</QTh>
</QTr>
</template>
<template #body-cell-vat="{ value: vatCell }">
<QTd :title="vatCell" shrink>
{{ vatCell }}
</QTd>
</template>
<template #body-cell-transaction="{ value: transactionCell }">
<QTd :title="transactionCell" shrink>
{{ transactionCell }}
</QTd>
</template>
<template #bottom-row>
<QTr class="bg">
<QTd></QTd>
@ -347,7 +357,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
}}</QTd>
<QTd></QTd>
<QTd></QTd>
<QTd class="text-center">{{
<QTd>{{
toCurrency(getTotalTax(entity.invoiceInTax, currency))
}}</QTd>
<QTd></QTd>
@ -423,6 +433,10 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
.bg {
background-color: var(--vn-accent-color);
}
.q-chip {
color: var(--vn-text-color);
}
@media (min-width: $breakpoint-md) {
.summaryBody {
.vat {

View File

@ -162,8 +162,14 @@ async function addExpense() {
}
}
const getTotalTaxableBase = (rows) =>
rows.reduce((acc, { taxableBase }) => acc + +taxableBase, 0);
rows.reduce((acc, { taxableBase }) => acc + +(taxableBase || 0), 0);
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0);
const formatOpt = (row, { model, options }, prop) => {
const obj = row[model];
const option = options.find(({ id }) => id == obj);
return option ? `${obj}:${option[prop]}` : '';
};
</script>
<template>
<FetchData
@ -254,8 +260,9 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
:option-value="col.optionValue"
:option-label="col.optionLabel"
:filter-options="['id', 'vat']"
:autofocus="col.tabIndex == 1"
input-debounce="0"
:hide-selected="false"
:fill-input="false"
:display-value="formatOpt(row, col, 'vat')"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -280,6 +287,9 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
:filter-options="['id', 'transaction']"
:autofocus="col.tabIndex == 1"
input-debounce="0"
:hide-selected="false"
:fill-input="false"
:display-value="formatOpt(row, col, 'transaction')"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -474,11 +484,16 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
/>
</QPageSticky>
</template>
<style lang="scss" scoped>
.bg {
background-color: var(--vn-light-gray);
}
:deep(.q-table tr td:nth-child(n + 4):nth-child(-n + 5) input) {
display: none;
}
@media (max-width: $breakpoint-xs) {
.q-dialog {
.q-card {

View File

@ -7,13 +7,19 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue';
import FetchData from 'components/FetchData.vue';
const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } });
const suppliers = ref([]);
const activities = ref([]);
</script>
<template>
<FetchData
url="SupplierActivities"
auto-load
@on-fetch="(data) => (activities = data)"
/>
<VnFilterPanel :data-key="dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
@ -29,11 +35,7 @@ const suppliers = ref([]);
v-model="params.supplierRef"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="vn:client" size="sm"></QIcon>
</template>
</VnInput>
/>
</QItemSection>
</QItem>
<QItem>
@ -43,11 +45,7 @@ const suppliers = ref([]);
v-model="params.fi"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
/>
</QItemSection>
</QItem>
<QItem>
@ -59,12 +57,11 @@ const suppliers = ref([]);
:label="t('params.supplierFk')"
option-value="id"
option-label="nickname"
:options="suppliers"
dense
outlined
rounded
>
</VnSelect>
:filter-options="['id', 'name']"
/>
</QItemSection>
</QItem>
<QItem>
@ -74,11 +71,7 @@ const suppliers = ref([]);
v-model="params.account"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="person" size="sm" />
</template>
</VnInput>
/>
</QItemSection>
</QItem>
<QItem>
@ -105,7 +98,21 @@ const suppliers = ref([]);
/>
</QItemSection>
</QItem>
<QItem class="q-mb-md">
<QItem>
<QItemSection>
<VnSelect
:label="t('params.supplierActivityFk')"
v-model="params.supplierActivityFk"
dense
outlined
rounded
option-value="code"
option-label="name"
:options="activities"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<QCheckbox
:label="t('params.isBooked')"
@ -114,6 +121,14 @@ const suppliers = ref([]);
toggle-indeterminate
/>
</QItemSection>
<QItemSection>
<QCheckbox
:label="t('params.correctingFk')"
v-model="params.correctingFk"
@update:model-value="searchFn()"
toggle-indeterminate
/>
</QItemSection>
</QItem>
<QExpansionItem :label="t('More options')" expand-separator>
<QItem>
@ -123,11 +138,7 @@ const suppliers = ref([]);
v-model="params.serialNumber"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
/>
</QItemSection>
</QItem>
<QItem>
@ -137,11 +148,7 @@ const suppliers = ref([]);
v-model="params.serial"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
/>
</QItemSection>
</QItem>
<QItem>
@ -151,11 +158,7 @@ const suppliers = ref([]);
v-model="params.awbCode"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
/>
</QItemSection>
</QItem>
</QExpansionItem>
@ -166,7 +169,7 @@ const suppliers = ref([]);
<i18n>
en:
params:
search: ID
search: Id or supplier name
supplierRef: Supplier ref.
supplierFk: Supplier
fi: Supplier fiscal id
@ -177,12 +180,17 @@ en:
dued: Dued
serialNumber: Serial Number
serial: Serial
account: Account
account: Ledger account
isBooked: is booked
correctedFk: Rectificatives
correctedFk: Rectified
issued: Issued
to: To
awbCode: AWB
correctingFk: Rectificative
supplierActivityFk: Supplier activity
es:
params:
search: Contiene
search: Id o nombre proveedor
supplierRef: Ref. proveedor
supplierFk: Proveedor
clientFk: Cliente
@ -193,10 +201,12 @@ es:
amount: Importe
issued: Emitida
isBooked: Conciliada
account: Cuenta
account: Cuenta contable
created: Creada
dued: Vencida
correctedFk: Rectificativas
correctedFk: Rectificada
correctingFk: Rectificativa
supplierActivityFk: Actividad proveedor
From: Desde
To: Hasta
Amount: Importe

View File

@ -1,44 +1,29 @@
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import { onMounted, onUnmounted } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { useStateStore } from 'stores/useStateStore';
import { downloadFile } from 'src/composables/downloadFile';
import { toDate, toCurrency } from 'src/filters/index';
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 InvoiceInFilter from './InvoiceInFilter.vue';
import { getUrl } from 'src/composables/getUrl';
import InvoiceInSummary from './Card/InvoiceInSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import InvoiceInSearchbar from 'src/pages/InvoiceIn/InvoiceInSearchbar.vue';
const stateStore = useStateStore();
const router = useRouter();
const { viewSummary } = useSummaryDialog();
let url = ref();
const { t } = useI18n();
onMounted(async () => {
stateStore.rightDrawer = true;
url.value = await getUrl('');
});
onMounted(async () => (stateStore.rightDrawer = true));
onUnmounted(() => (stateStore.rightDrawer = false));
function navigate(id) {
router.push({ path: `/invoice-in/${id}` });
}
</script>
<template>
<VnSearchbar
data-key="InvoiceInList"
:label="t('Search invoice')"
:info="t('You can search by invoice reference')"
/>
<InvoiceInSearchbar />
<RightMenu>
<template #right-panel>
<InvoiceInFilter data-key="InvoiceInList" />
@ -54,10 +39,10 @@ function navigate(id) {
>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
v-for="(row, index) of rows"
:key="index"
:title="row.supplierRef"
@click="navigate(row.id)"
@click="$router.push({ path: `/invoice-in/${row.id}` })"
:id="row.id"
>
<template #list-items>
@ -102,7 +87,9 @@ function navigate(id) {
<template #actions>
<QBtn
:label="t('components.smartCard.openCard')"
@click.stop="navigate(row.id)"
@click.stop="
$router.push({ path: `/invoice-in/${row.id}` })
"
outline
type="reset"
/>
@ -115,7 +102,7 @@ function navigate(id) {
class="q-mt-sm"
/>
<QBtn
:label="t('Download')"
:label="t('globals.download')"
class="q-mt-sm"
@click.stop="downloadFile(row.dmsFk)"
type="submit"
@ -131,10 +118,3 @@ function navigate(id) {
<QBtn color="primary" icon="add" size="lg" round :href="`/#/invoice-in/create`" />
</QPageSticky>
</template>
<i18n>
es:
Search invoice: Buscar factura recibida
You can search by invoice reference: Puedes buscar por referencia de la factura
Download: Descargar
</i18n>

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

View File

@ -0,0 +1,18 @@
<script setup>
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
</script>
<template>
<VnSearchbar
data-key="InvoiceInList"
:label="t('Search invoice')"
:info="t('Search invoices in by id or supplier fiscal name')"
url="InvoiceIns/filter"
/>
</template>
<i18n>
es:
Search invoice: Buscar factura recibida
Search invoices in by id or supplier fiscal name: Buscar facturas recibidas por id o por nombre fiscal del proveedor
</i18n>

View File

@ -1,2 +0,0 @@
Search invoice: Buscar factura recibida
You can search by invoice reference: Puedes buscar por referencia de la factura

View File

@ -1,17 +0,0 @@
<script setup>
import { useStateStore } from 'stores/useStateStore';
import LeftMenu from 'src/components/LeftMenu.vue';
const stateStore = useStateStore();
</script>
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<LeftMenu />
</QScrollArea>
</QDrawer>
<QPageContainer>
<RouterView></RouterView>
</QPageContainer>
</template>

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