0
0
Fork 0

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

This commit is contained in:
Carlos Satorres 2024-07-31 07:22:43 +02:00
commit 5b214b58ab
137 changed files with 1165 additions and 1442 deletions

View File

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

View File

@ -1,28 +1,11 @@
import { getCurrentInstance } from 'vue'; 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 { export default {
mounted: function () { mounted: function () {
const vm = getCurrentInstance(); const vm = getCurrentInstance();
if (vm.type.name === 'QForm') { if (vm.type.name === 'QForm') {
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) { if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
// AUTOFOCUS // TODO: AUTOFOCUS IS NOT FOCUSING
const elementsArray = Array.from(this.$el.elements);
const availableInputs = elementsArray.filter(filterAvailableInput);
const firstInputElement = availableInputs.find(filterAvailableText);
if (firstInputElement) {
firstInputElement.focus();
}
const that = this; const that = this;
this.$el.addEventListener('keyup', function (evt) { this.$el.addEventListener('keyup', function (evt) {
if (evt.key === 'Enter') { if (evt.key === 'Enter') {

View File

@ -52,7 +52,7 @@ onMounted(async () => {
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
> >
<template #form-inputs="{ data, validate }"> <template #form-inputs="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
:label="t('name')" :label="t('name')"
v-model="data.name" v-model="data.name"
@ -67,7 +67,7 @@ onMounted(async () => {
:rules="validate('bankEntity.bic')" :rules="validate('bankEntity.bic')"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnSelect <VnSelect
:label="t('country')" :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" /> <QIcon name="warning" class="fill-icon q-mr-sm" size="md" />
{{ t('Invoicing in progress...') }} {{ t('Invoicing in progress...') }}
</span> </span>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('Ticket')" :label="t('Ticket')"
:options="ticketsOptions" :options="ticketsOptions"
@ -99,7 +99,7 @@ const onDataSaved = async (formData, requestResponse) => {
/> />
<VnInputDate :label="t('Max date')" v-model="data.maxShipped" /> <VnInputDate :label="t('Max date')" v-model="data.maxShipped" />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('Serial')" :label="t('Serial')"
:options="invoiceOutSerialsOptions" :options="invoiceOutSerialsOptions"
@ -117,7 +117,7 @@ const onDataSaved = async (formData, requestResponse) => {
v-model="data.taxArea" v-model="data.taxArea"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
:label="t('Reference')" :label="t('Reference')"
type="textarea" type="textarea"

View File

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

View File

@ -91,7 +91,7 @@ const onProvinceCreated = async ({ name }, formData) => {
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
> >
<template #form-inputs="{ data, validate }"> <template #form-inputs="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
:label="t('Postcode')" :label="t('Postcode')"
v-model="data.code" v-model="data.code"

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import axios from 'axios'; import axios from 'axios';
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter, onBeforeRouteLeave } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useValidator } from 'src/composables/useValidator'; import { useValidator } from 'src/composables/useValidator';
@ -97,6 +97,19 @@ defineExpose({
vnPaginateRef, 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) { async function fetch(data) {
resetData(data); resetData(data);
emit('onFetch', data); emit('onFetch', data);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -313,11 +313,6 @@ defineExpose({
:params="params" :params="params"
:columns="splittedColumns.columns" :columns="splittedColumns.columns"
/> />
<slot
name="moreFilterPanel"
:params="params"
:columns="splittedColumns.columns"
/>
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</QScrollArea> </QScrollArea>
@ -328,6 +323,7 @@ defineExpose({
v-bind="$attrs" v-bind="$attrs"
:limit="20" :limit="20"
ref="CrudModelRef" ref="CrudModelRef"
@on-fetch="(...args) => emit('onFetch', ...args)"
:search-url="searchUrl" :search-url="searchUrl"
:disable-infinite-scroll="isTableMode" :disable-infinite-scroll="isTableMode"
@save-changes="reload" @save-changes="reload"
@ -365,7 +361,7 @@ defineExpose({
<template #top-left v-if="!$props.withoutHeader"> <template #top-left v-if="!$props.withoutHeader">
<slot name="top-left"></slot> <slot name="top-left"></slot>
</template> </template>
<template #top-right> <template #top-right v-if="!$props.withoutHeader">
<VnVisibleColumn <VnVisibleColumn
v-if="isTableMode" v-if="isTableMode"
v-model="splittedColumns.columns" v-model="splittedColumns.columns"
@ -393,7 +389,7 @@ defineExpose({
<div <div
class="column self-start q-ml-xs ellipsis" class="column self-start q-ml-xs ellipsis"
:class="`text-${col?.align ?? 'left'}`" :class="`text-${col?.align ?? 'left'}`"
style="height: 75px" :style="$props.columnSearch ? 'height: 75px' : ''"
> >
<div <div
class="row items-center no-wrap" class="row items-center no-wrap"
@ -434,7 +430,7 @@ defineExpose({
</VnTableChip> </VnTableChip>
</QTd> </QTd>
</template> </template>
<template #body-cell="{ col, row }"> <template #body-cell="{ col, row, rowIndex }">
<!-- Columns --> <!-- Columns -->
<QTd <QTd
auto-width auto-width
@ -447,7 +443,12 @@ defineExpose({
rowCtrlClickFunction($event, row) 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 <VnTableColumn
:column="col" :column="col"
:row="row" :row="row"
@ -467,7 +468,6 @@ defineExpose({
> >
<QBtn <QBtn
v-for="(btn, index) of col.actions" v-for="(btn, index) of col.actions"
v-show="btn.show ? btn.show(row) : true"
:key="index" :key="index"
:title="btn.title" :title="btn.title"
:icon="btn.icon" :icon="btn.icon"
@ -478,6 +478,11 @@ defineExpose({
? 'text-primary-light' ? 'text-primary-light'
: 'color-vn-text ' : 'color-vn-text '
" "
:style="`visibility: ${
(btn.show && btn.show(row)) ?? true
? 'visible'
: 'hidden'
}`"
@click="btn.action(row)" @click="btn.action(row)"
/> />
</QTd> </QTd>
@ -535,7 +540,9 @@ defineExpose({
:class="$props.cardClass" :class="$props.cardClass"
> >
<div <div
v-for="col of splittedColumns.cardVisible" v-for="(
col, index
) of splittedColumns.cardVisible"
:key="col.name" :key="col.name"
class="fields" class="fields"
> >
@ -556,6 +563,7 @@ defineExpose({
:name="`column-${col.name}`" :name="`column-${col.name}`"
:col="col" :col="col"
:row="row" :row="row"
:row-index="index"
> >
<VnTableColumn <VnTableColumn
:column="col" :column="col"
@ -615,16 +623,23 @@ defineExpose({
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<div class="grid-create"> <div class="grid-create">
<VnTableColumn <slot
v-for="column of splittedColumns.create" v-for="column of splittedColumns.create"
:key="column.name" :key="column.name"
:column="column" :name="`column-create-${column.name}`"
:row="{}" :data="data"
default="input" :column-name="column.name"
v-model="data[column.name]" :label="column.label"
:show-label="true" >
component-prop="columnCreate" <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" /> <slot name="more-create-dialog" :data="data" />
</div> </div>
</template> </template>

View File

@ -81,7 +81,7 @@ async function fetchViewConfigData() {
return; return;
} }
} catch (err) { } 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); setUserConfigViewData(defaultColumns);
} }
} catch (err) { } catch (err) {
console.err('Error fetching config view data', err); console.error('Error fetching config view data', err);
} }
}; };

View File

@ -30,12 +30,12 @@ function mix(toComponent) {
mixed = { mixed = {
component: customComponent?.component ?? component, component: customComponent?.component ?? component,
attrs: { attrs: {
...toValueAttrs(attrs),
...toValueAttrs(customComponent?.attrs), ...toValueAttrs(customComponent?.attrs),
...toComponent,
...toValueAttrs(customComponent?.forceAttrs), ...toValueAttrs(customComponent?.forceAttrs),
...toComponent,
...toValueAttrs(attrs),
}, },
event: event ?? customComponent?.event, event: { ...customComponent?.event, ...event },
}; };
return mixed; return mixed;
} }

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

@ -2,7 +2,7 @@
import { ref, toRefs, computed, watch, onMounted } from 'vue'; import { ref, toRefs, computed, watch, onMounted } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
const emit = defineEmits(['update:modelValue', 'update:options']); const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
const $props = defineProps({ const $props = defineProps({
modelValue: { modelValue: {
@ -159,7 +159,10 @@ async function filterHandler(val, update) {
let newOptions; let newOptions;
if (!$props.defaultFilter) return update(); 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); newOptions = await fetchFilter(val);
} else newOptions = filter(val, myOptionsOriginal.value); } else newOptions = filter(val, myOptionsOriginal.value);
update( update(
@ -196,8 +199,8 @@ async function filterHandler(val, update) {
map-options map-options
use-input use-input
@filter="filterHandler" @filter="filterHandler"
hide-selected :hide-selected="$attrs['hide-selected'] ?? true"
fill-input :fill-input="$attrs['fill-input'] ?? true"
ref="vnSelectRef" ref="vnSelectRef"
lazy-rules lazy-rules
:class="{ required: $attrs.required }" :class="{ required: $attrs.required }"
@ -208,7 +211,12 @@ async function filterHandler(val, update) {
<QIcon <QIcon
v-show="value" v-show="value"
name="close" name="close"
@click.stop="value = null" @click.stop="
() => {
value = null;
emit('remove');
}
"
class="cursor-pointer" class="cursor-pointer"
size="xs" size="xs"
/> />

View File

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

View File

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

View File

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

View File

@ -3,26 +3,19 @@ defineProps({ wrap: { type: Boolean, default: false } });
</script> </script>
<template> <template>
<div class="vn-row q-gutter-md q-mb-md" :class="{ wrap }"> <div class="vn-row q-gutter-md q-mb-md" :class="{ wrap }">
<slot /> <slot></slot>
</div> </div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scopped>
.vn-row { .vn-row {
display: flex; display: flex;
&.wrap { > * {
flex-wrap: wrap; flex: 1;
}
&:not(.wrap) {
> :slotted(*) {
flex: 1;
}
} }
} }
@media screen and (max-width: 800px) { @media screen and (max-width: 800px) {
.vn-row { .vn-row {
&:not(.wrap) { flex-direction: column;
flex-direction: column;
}
} }
} }
</style> </style>

View File

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

View File

@ -153,6 +153,12 @@ select:-webkit-autofill {
background-color: var(--vn-section-color); background-color: var(--vn-section-color);
} }
.q-table td[shrink] {
text-overflow: ellipsis;
overflow: hidden;
max-width: 80px;
}
.tr-header { .tr-header {
color: var(--vn-label-color); color: var(--vn-label-color);
} }
@ -209,27 +215,29 @@ input::-webkit-inner-spin-button {
max-width: 100%; max-width: 100%;
} }
/* ===== Scrollbar CSS ===== / .q-table__container {
/ Firefox */ /* ===== Scrollbar CSS ===== /
/ Firefox */
* { * {
scrollbar-width: auto; scrollbar-width: auto;
scrollbar-color: var(--vn-label-color) transparent; scrollbar-color: var(--vn-label-color) transparent;
} }
/* Chrome, Edge, and Safari */ /* Chrome, Edge, and Safari */
*::-webkit-scrollbar { *::-webkit-scrollbar {
width: 10px; width: 10px;
height: 10px; height: 10px;
} }
*::-webkit-scrollbar-thumb { *::-webkit-scrollbar-thumb {
background-color: var(--vn-label-color); background-color: var(--vn-label-color);
border-radius: 10px; border-radius: 10px;
} }
*::-webkit-scrollbar-track { *::-webkit-scrollbar-track {
background: transparent; background: transparent;
}
} }
.q-table { .q-table {

View File

@ -254,6 +254,9 @@ globals:
comment: Comment comment: Comment
observations: Observations observations: Observations
goToModuleIndex: Go to module index goToModuleIndex: Go to module index
unsavedPopup:
title: Unsaved changes will be lost
subtitle: Are you sure exit without saving?
errors: errors:
statusUnauthorized: Access denied statusUnauthorized: Access denied
statusInternalServerError: An internal server error has ocurred statusInternalServerError: An internal server error has ocurred
@ -386,8 +389,8 @@ customer:
extendedList: extendedList:
tableVisibleColumns: tableVisibleColumns:
id: Identifier id: Identifier
name: Comercial name name: Name
socialName: Business name socialName: Social name
fi: Tax number fi: Tax number
salesPersonFk: Salesperson salesPersonFk: Salesperson
credit: Credit credit: Credit
@ -997,18 +1000,6 @@ route:
shipped: Preparation date shipped: Preparation date
viewCmr: View CMR viewCmr: View CMR
downloadCmrs: Download CMRs 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: supplier:
list: list:
payMethod: Pay method payMethod: Pay method

View File

@ -256,6 +256,9 @@ globals:
comment: Comentario comment: Comentario
observations: Observaciones observations: Observaciones
goToModuleIndex: Ir al índice del módulo 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: errors:
statusUnauthorized: Acceso denegado statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor statusInternalServerError: Ha ocurrido un error interno del servidor
@ -385,7 +388,7 @@ customer:
extendedList: extendedList:
tableVisibleColumns: tableVisibleColumns:
id: Identificador id: Identificador
name: Nombre Comercial name: Nombre
socialName: Razón social socialName: Razón social
fi: NIF / CIF fi: NIF / CIF
salesPersonFk: Comercial salesPersonFk: Comercial
@ -978,18 +981,6 @@ route:
shipped: Fecha preparación shipped: Fecha preparación
viewCmr: Ver CMR viewCmr: Ver CMR
downloadCmrs: Descargar CMRs 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: supplier:
list: list:
payMethod: Método de pago payMethod: Método de pago

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,120 +1,191 @@
<script setup> <script setup>
import { computed, onBeforeMount, ref, watch } from 'vue'; import { computed, onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useRole } from 'src/composables/useRole';
import axios from 'axios'; import axios from 'axios';
import { QCheckbox, QBtn, useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { toCurrency, toDate, toDateHourMin } from 'src/filters'; import { toCurrency, toDate, toDateHourMin } from 'src/filters';
import { useState } from 'src/composables/useState'; import { useState } from 'composables/useState';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { useValidator } from 'src/composables/useValidator'; import { usePrintService } from 'composables/usePrintService';
import { usePrintService } from 'src/composables/usePrintService'; import { useSession } from 'composables/useSession';
import { useSession } from 'src/composables/useSession'; import { useVnConfirm } from 'composables/useVnConfirm';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import FetchData from 'components/FetchData.vue'; import VnInput from 'components/common/VnInput.vue';
import VnInput from 'src/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 VnSelect from 'src/components/common/VnSelect.vue';
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.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'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
const session = useSession();
const tokenMultimedia = session.getTokenMultimedia();
const { openConfirmationModal } = useVnConfirm();
const { sendEmail } = usePrintService(); const { sendEmail } = usePrintService();
const { t } = useI18n(); const { t } = useI18n();
const { validate } = useValidator(); const { hasAny } = useRole();
const session = useSession();
const tokenMultimedia = session.getTokenMultimedia();
const quasar = useQuasar(); const quasar = useQuasar();
const route = useRoute(); const route = useRoute();
const state = useState(); const state = useState();
const stateStore = useStateStore(); const stateStore = useStateStore();
const user = state.getUser(); const user = state.getUser();
const clientRisks = ref(null); const clientRisk = ref([]);
const clientRisksRef = ref(null); const tableRef = ref();
const companiesOptions = ref([]); const companyId = ref();
const companyId = ref(null); const companyLastId = ref(user.value.companyFk);
const receiptsRef = ref(null); const balances = ref([]);
const receiptsData = ref([]); const vnFilterRef = ref({});
const filter = computed(() => {
return {
clientId: route.params.id,
companyId: companyId.value ?? user.value.companyFk,
};
});
const filterCompanies = { order: ['code'] }; const companyFilterColumn = {
const userParams = { align: 'left',
clientId: route.params.id, name: 'companyId',
companyId: user.value.companyFk, 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 = { const referenceColumn = {
include: { relation: 'company', scope: { fields: ['code'] } }, align: 'left',
where: { clientFk: route.params.id, companyFk: user.value.companyFk }, name: 'description',
label: t('Reference'),
};
const onlyCreate = {
visible: false,
columnFilter: false,
create: true,
}; };
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
field: 'payed', name: 'payed',
format: (value) => toDate(value),
label: t('Date'), label: t('Date'),
name: 'date', format: ({ payed }) => toDate(payed),
cardVisible: true,
create: true,
columnCreate: {
component: 'date',
},
}, },
{ {
align: 'left', align: 'left',
field: 'created', name: 'created',
format: (value) => toDateHourMin(value),
label: t('Creation date'), label: t('Creation date'),
name: 'creationDate', format: ({ created }) => toDateHourMin(created),
cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
field: 'userName', name: 'workerFk',
label: t('Employee'), 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', align: 'right',
field: 'description', name: 'bankFk',
label: t('Reference'),
name: 'reference',
},
{
align: 'left',
field: 'bankFk',
label: t('Bank'), label: t('Bank'),
name: 'bank', cardVisible: true,
create: true,
},
{
align: 'right',
name: 'amountPaid',
label: t('Amount'),
component: 'number',
...onlyCreate,
}, },
{ {
align: 'right', align: 'right',
field: 'debit',
format: (value) => value && toCurrency(value),
label: t('Debit'),
name: 'debit', name: 'debit',
label: t('Debit'),
format: ({ debit }) => debit && toCurrency(debit),
isId: true,
}, },
{ {
align: 'right', align: 'right',
field: 'credit', name: 'credit',
format: (value) => value && toCurrency(value),
label: t('Havings'), label: t('Havings'),
name: 'havings', format: ({ credit }) => credit && toCurrency(credit),
cardVisible: true,
}, },
{ {
align: 'right', align: 'right',
field: 'balance',
format: (value) => value && toCurrency(value),
label: t('Balance'),
name: 'balance', name: 'balance',
label: t('Balance'),
format: ({ balance }) => toCurrency(balance),
cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
field: 'isConciliate', name: 'isConciliate',
label: t('Conciliated'), label: t('Conciliated'),
name: 'conciliated', cardVisible: true,
}, },
{ ...referenceColumn, ...onlyCreate },
{ {
align: 'left', align: 'left',
field: 'totalWithVat', name: 'tableActions',
label: '', actions: [
name: '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; companyId.value = user.value.companyFk;
}); });
watch( async function getClientRisk(reload = false) {
() => route.params.id, if (reload || !clientRisk.value?.length) {
(newValue) => { const { data } = await axios.get(`clientRisks`, {
if (!newValue) return; params: {
userParams.clientId = newValue; filter: JSON.stringify({
filter.where.clientFk = newValue; include: { relation: 'company', scope: { fields: ['code'] } },
getData(); where: { clientFk: route.params.id, companyFk: user.value.companyFk },
}),
},
});
clientRisk.value = data;
} }
); return clientRisk.value;
}
const getData = () => { async function getCurrentBalance() {
receiptsRef.value?.fetch(); const currentBalance = (await getClientRisk()).find((balance) => {
clientRisksRef.value?.fetch();
};
const getCurrentBalance = () => {
const currentBalance = clientRisks.value.find((balance) => {
return balance.companyFk === companyId.value; return balance.companyFk === companyId.value;
}); });
return currentBalance && currentBalance.amount; return currentBalance && currentBalance.amount;
}; }
const onFetch = (balances) => { async function onFetch(data) {
balances.forEach((balance, index) => { balances.value = [];
for (const [index, balance] of data.entries()) {
if (index === 0) { if (index === 0) {
balance.balance = getCurrentBalance(); balance.balance = await getCurrentBalance();
} else { continue;
let previousBalance = balances[index - 1];
balance.balance =
previousBalance.balance -
(previousBalance.debit - previousBalance.credit);
} }
}); const previousBalance = data[index - 1];
balance.balance =
receiptsData.value = balances; previousBalance?.balance - (previousBalance?.debit - previousBalance?.credit);
}; }
balances.value = data;
}
// BORRAR COMPONENTE Y HACER CON VNTABLE
const showNewPaymentDialog = () => { const showNewPaymentDialog = () => {
quasar.dialog({ quasar.dialog({
component: CustomerNewPayment, component: CustomerNewPayment,
componentProps: { componentProps: {
companyId: companyId.value, companyId: companyId.value,
totalCredit: clientRisks.value[0]?.amount, totalCredit: clientRisk.value[0]?.amount,
promise: getData, promise: getClientRisk(true),
}, },
}); });
}; };
const updateCompanyId = (id) => { const showBalancePdf = ({ id }) => {
if (id) { const url = `api/InvoiceOuts/${id}/download?access_token=${tokenMultimedia}`;
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}`;
window.open(url, '_blank'); window.open(url, '_blank');
}; };
</script> </script>
<template> <template>
<FetchData <VnSubToolbar class="q-mb-md">
:filter="filter" <template #st-data>
@on-fetch="(data) => (clientRisks = data)" <div class="column justify-center q-px-md q-py-sm">
auto-load <span class="text-bold">{{ t('Total by company') }}</span>
ref="clientRisksRef" <div class="row justify-center" v-if="clientRisk?.length">
url="ClientRisks" {{ clientRisk[0].company.code }}:
/> {{ toCurrency(clientRisk[0].amount) }}
<FetchData </div>
:filter="filterCompanies" </div>
@on-fetch="(data) => (companiesOptions = data)" </template>
auto-load <template #st-actions>
url="Companies" <div>
/> <VnFilter
ref="vnFilterRef"
<VnPaginate v-model="companyId"
auto-load data-key="CustomerBalance"
:column="companyFilterColumn"
search-url="balance"
/>
</div>
</template>
</VnSubToolbar>
<VnTable
ref="tableRef"
data-key="CustomerBalance" data-key="CustomerBalance"
url="Receipts/filter" url="Receipts/filter"
:user-params="userParams" search-url="balance"
ref="receiptsRef" :user-params="filter"
:columns="columns"
:right-search="false"
:is-editable="false"
:column-search="false"
@on-fetch="onFetch" @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 }"> <template #column-balance="{ rowIndex }">
<QTable {{ toCurrency(balances[rowIndex]?.balance) }}
: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> </template>
</VnPaginate> <template #column-description="{ row }">
<div class="link" v-if="row.isInvoice">
<QDrawer :width="256" show-if-above side="right" v-model="stateStore.rightDrawer"> {{ row.description }}
<div class="q-mt-xl q-px-md"> <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 <VnSelect
:label="t('Company')" url="Accountings"
:options="companiesOptions" :label="label"
@update:model-value="updateCompanyId($event)" :limit="0"
hide-selected option-label="bank"
option-label="code" sort-by="id"
option-value="id" v-model="data[columnName]"
v-model="companyId" >
:rules="validate('entry.companyFk')" <template #option="scope">
/> <QItem v-bind="scope.itemProps">
</div> <QItemLabel>
#{{ scope.opt?.id }}: {{ scope.opt?.bank }}
<QCard class="q-ma-md q-pa-md q-mt-lg" v-if="receiptsData?.length"> </QItemLabel>
<QCardSection> </QItem>
<div class="flex justify-center text-subtitle1 text-bold"> </template>
{{ t('Total by company') }} </VnSelect>
</div> </template>
<div class="flex justify-center"> </VnTable>
<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>
</template> </template>
<i18n> <i18n>
@ -393,3 +364,12 @@ es:
Send compensation: Enviar compensación 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? Do you want to report compensation to the client by mail?: ¿Desea informar de la compensación al cliente por correo?
</i18n> </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 VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnImg from 'src/components/ui/VnImg.vue'; import VnImg from 'src/components/ui/VnImg.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const workers = ref([]);
const workersCopy = ref([]);
const businessTypes = ref([]); const businessTypes = ref([]);
const contactChannels = 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> </script>
<template> <template>
<fetch-data <FetchData
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
@on-fetch="setWorkers"
auto-load
/>
<fetch-data
url="ContactChannels" url="ContactChannels"
@on-fetch="(data) => (contactChannels = data)" @on-fetch="(data) => (contactChannels = data)"
auto-load auto-load
/> />
<fetch-data <FetchData
url="BusinessTypes" url="BusinessTypes"
@on-fetch="(data) => (businessTypes = data)" @on-fetch="(data) => (businessTypes = data)"
auto-load 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"> <FormModel :url="`Clients/${route.params.id}`" auto-load model="customer">
<template #form="{ data, validate, filter }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
:label="t('globals.name')" :label="t('globals.name')"
:rules="validate('client.socialName')" :rules="validate('client.socialName')"
@ -75,7 +37,6 @@ const filterOptions = {
clearable clearable
v-model="data.name" v-model="data.name"
/> />
<QSelect <QSelect
:input-debounce="0" :input-debounce="0"
:label="t('customer.basicData.businessType')" :label="t('customer.basicData.businessType')"
@ -88,7 +49,7 @@ const filterOptions = {
v-model="data.businessTypeFk" v-model="data.businessTypeFk"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
:label="t('customer.basicData.contact')" :label="t('customer.basicData.contact')"
:rules="validate('client.contact')" :rules="validate('client.contact')"
@ -111,7 +72,7 @@ const filterOptions = {
</template> </template>
</VnInput> </VnInput>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
:label="t('customer.basicData.phone')" :label="t('customer.basicData.phone')"
:rules="validate('client.phone')" :rules="validate('client.phone')"
@ -125,31 +86,27 @@ const filterOptions = {
v-model="data.mobile" v-model="data.mobile"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<QSelect <VnSelect
:input-debounce="0" url="Workers/activeWithInheritedRole"
:label="t('customer.basicData.salesPerson')" :filter="{ where: { role: 'salesPerson' } }"
:options="workers" option-filter="firstName"
:rules="validate('client.salesPersonFk')"
@filter="(value, update) => filter(value, update, filterOptions)"
emit-value
map-options
option-label="name"
option-value="id"
use-input
v-model="data.salesPersonFk" v-model="data.salesPersonFk"
:label="t('customer.basicData.salesPerson')"
:rules="validate('client.salesPersonFk')"
:use-like="false"
> >
<template #prepend> <template #prepend>
<QAvatar color="orange"> <QAvatar color="orange">
<VnImg <VnImg
v-if="data.salesPersonFk" v-if="data.salesPersonFk"
:id="user.id" :id="data.salesPersonFk"
collection="user" collection="user"
spinner-color="white" spinner-color="white"
/> />
</QAvatar> </QAvatar>
</template> </template>
</QSelect> </VnSelect>
<QSelect <QSelect
v-model="data.contactChannelFk" v-model="data.contactChannelFk"
:options="contactChannels" :options="contactChannels"
@ -162,7 +119,7 @@ const filterOptions = {
:input-debounce="0" :input-debounce="0"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<QSelect <QSelect
:input-debounce="0" :input-debounce="0"
:label="t('customer.basicData.previousClient')" :label="t('customer.basicData.previousClient')"

View File

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

View File

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

View File

@ -1,8 +1,7 @@
<script setup> <script setup>
import { computed } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { QBtn } from 'quasar';
import { toCurrency, toDateHourMin } from 'src/filters'; import { toCurrency, toDateHourMin } from 'src/filters';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
@ -10,21 +9,23 @@ import VnUserLink from 'src/components/ui/VnUserLink.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const filter = { const filter = computed(() => {
include: [ return {
{ include: [
relation: 'worker', {
scope: { relation: 'worker',
fields: ['id'], scope: {
include: { relation: 'user', scope: { fields: ['name'] } }, fields: ['id'],
include: { relation: 'user', scope: { fields: ['name'] } },
},
}, },
}, ],
], where: { clientFk: +route.params.id },
where: { clientFk: +route.params.id }, };
order: ['created DESC'], });
limit: 20,
};
const tableRef = ref();
const tableData = ref([]);
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
@ -43,39 +44,44 @@ const columns = computed(() => [
name: 'amount', name: 'amount',
format: ({ amount }) => toCurrency(amount), format: ({ amount }) => toCurrency(amount),
}, },
{
label: t('Credit'),
name: 'credit',
create: true,
visible: false,
attrs: {
autofocus: true,
},
},
]); ]);
</script> </script>
<template> <template>
<!-- Column titles are missing -->
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="ClientCredit" data-key="ClientCredit"
url="ClientCredits" url="ClientCredits"
search-url="credits"
:filter="filter" :filter="filter"
:order="['created DESC']"
:columns="columns" :columns="columns"
default-mode="table"
auto-load auto-load
:right-search="false" :right-search="false"
:is-editable="false" :is-editable="false"
:use-model="true" :use-model="true"
:column-search="false" :column-search="false"
:disable-option="{ card: true }" :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 }"> <template #column-employee="{ row }">
<VnUserLink :name="row?.worker?.user?.name" :worker-id="row.worker?.id" /> <VnUserLink :name="row?.worker?.user?.name" :worker-id="row.worker?.id" />
</template> </template>
</VnTable> </VnTable>
<QPageSticky :offset="[18, 18]">
<QBtn
@click.stop="$router.push({ name: 'CustomerCreditCreate' })"
color="primary"
fab
icon="add"
/>
<QTooltip>
{{ t('New credit') }}
</QTooltip>
</QPageSticky>
</template> </template>
<i18n> <i18n>
es: es:

View File

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

View File

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

View File

@ -1,14 +1,8 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router';
import { useRoute, useRouter } 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 route = useRoute();
const router = useRouter();
const noteFilter = { const noteFilter = {
order: 'created DESC', order: 'created DESC',
@ -16,68 +10,14 @@ const noteFilter = {
clientFk: `${route.params.id}`, clientFk: `${route.params.id}`,
}, },
}; };
const toCustomerNoteCreate = () => {
router.push({ name: 'CustomerNoteCreate' });
};
</script> </script>
<template> <template>
<div class="full-width flex justify-center"> <VnNotes
<QCard class="card-width q-pa-lg"> url="clientObservations"
<VnPaginate :add-note="true"
data-key="CustomerNotes" :filter="noteFilter"
url="clientObservations" :body="{ clientFk: route.params.id }"
auto-load style="overflow-y: auto"
: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>
</template> </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

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

View File

@ -48,7 +48,7 @@ function handleLocation(data, location) {
url-create="Clients/createWithUser" url-create="Clients/createWithUser"
> >
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<QInput :label="t('Comercial name')" v-model="data.name" /> <QInput :label="t('Comercial name')" v-model="data.name" />
<VnSelect <VnSelect
:label="t('Salesperson')" :label="t('Salesperson')"
@ -59,7 +59,7 @@ function handleLocation(data, location) {
v-model="data.salesPersonFk" v-model="data.salesPersonFk"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('Business type')" :label="t('Business type')"
:options="businessTypesOptions" :options="businessTypesOptions"
@ -70,21 +70,21 @@ function handleLocation(data, location) {
/> />
<QInput v-model="data.fi" :label="t('Tax number')" /> <QInput v-model="data.fi" :label="t('Tax number')" />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<QInput <QInput
:label="t('Business name')" :label="t('Business name')"
:rules="validate('client.socialName')" :rules="validate('client.socialName')"
v-model="data.socialName" v-model="data.socialName"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<QInput <QInput
:label="t('Street')" :label="t('Street')"
:rules="validate('client.street')" :rules="validate('client.street')"
v-model="data.street" v-model="data.street"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnLocation <VnLocation
:rules="validate('Worker.postcode')" :rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']" :roles-allowed-to-create="['deliveryAssistant']"
@ -95,7 +95,7 @@ function handleLocation(data, location) {
</VnLocation> </VnLocation>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<QInput v-model="data.userName" :label="t('Web user')" /> <QInput v-model="data.userName" :label="t('Web user')" />
<QInput <QInput
:label="t('Email')" :label="t('Email')"

View File

@ -106,9 +106,9 @@ const columns = computed(() => [
component: null, component: null,
after: { after: {
component: markRaw(VnLinkPhone), component: markRaw(VnLinkPhone),
attrs: (prop) => { attrs: ({ model }) => {
return { return {
'phone-number': prop, 'phone-number': model,
}; };
}, },
}, },

View File

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

View File

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

View File

@ -85,7 +85,7 @@ function handleLocation(data, location) {
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<QCheckbox :label="t('Default')" v-model="data.isDefaultAddress" /> <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('Consignee')" clearable v-model="data.nickname" />
<VnInput :label="t('Street address')" clearable v-model="data.street" /> <VnInput :label="t('Street address')" clearable v-model="data.street" />
@ -119,7 +119,7 @@ function handleLocation(data, location) {
/> />
</div> </div>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('Incoterms')" :label="t('Incoterms')"
:options="incoterms" :options="incoterms"

View File

@ -146,7 +146,7 @@ function handleLocation(data, location) {
</template> </template>
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<QCheckbox :label="t('Enabled')" v-model="data.isActive" /> <QCheckbox :label="t('Enabled')" v-model="data.isActive" />
</div> </div>
@ -164,7 +164,7 @@ function handleLocation(data, location) {
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnInput :label="t('Consignee')" clearable v-model="data.nickname" /> <VnInput :label="t('Consignee')" clearable v-model="data.nickname" />
</div> </div>
@ -173,7 +173,7 @@ function handleLocation(data, location) {
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnLocation <VnLocation
:rules="validate('Worker.postcode')" :rules="validate('Worker.postcode')"
@ -185,7 +185,7 @@ function handleLocation(data, location) {
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnSelect <VnSelect
:label="t('Agency')" :label="t('Agency')"
@ -204,7 +204,7 @@ function handleLocation(data, location) {
<VnInput :label="t('Mobile')" clearable v-model="data.mobile" /> <VnInput :label="t('Mobile')" clearable v-model="data.mobile" />
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnSelect <VnSelect
:label="t('Incoterms')" :label="t('Incoterms')"

View File

@ -39,7 +39,7 @@ const toCustomerCreditContracts = () => {
</template> </template>
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnInput <VnInput
:label="t('Credit')" :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"> <QCard class="q-pa-lg">
<QCardSection> <QCardSection>
<QForm> <QForm>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnInput <VnInput
:label="t('Reference')" :label="t('Reference')"
@ -163,7 +163,7 @@ const toCustomerFileManagement = () => {
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnSelect <VnSelect
:label="t('Warehouse')" :label="t('Warehouse')"
@ -184,7 +184,7 @@ const toCustomerFileManagement = () => {
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnInput <VnInput
:label="t('Description')" :label="t('Description')"
@ -196,7 +196,7 @@ const toCustomerFileManagement = () => {
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<QFile <QFile
ref="inputFileRef" ref="inputFileRef"

View File

@ -119,7 +119,7 @@ const toCustomerFileManagement = () => {
<QCard class="q-pa-lg"> <QCard class="q-pa-lg">
<QCardSection> <QCardSection>
<QForm> <QForm>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnInput <VnInput
:label="t('Reference')" :label="t('Reference')"
@ -139,7 +139,7 @@ const toCustomerFileManagement = () => {
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnSelect <VnSelect
:label="t('Warehouse')" :label="t('Warehouse')"
@ -160,7 +160,7 @@ const toCustomerFileManagement = () => {
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnInput <VnInput
:label="t('Description')" :label="t('Description')"
@ -172,7 +172,7 @@ const toCustomerFileManagement = () => {
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<QFile <QFile
ref="inputFileRef" 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" url-create="CustomsAgents"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
:label="t('NIF')" :label="t('NIF')"
:required="true" :required="true"
@ -36,7 +36,7 @@ const onDataSaved = (dataSaved) => {
v-model="data.fiscalName" v-model="data.fiscalName"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput :label="t('Street')" clearable v-model="data.street" /> <VnInput :label="t('Street')" clearable v-model="data.street" />
<VnInput :label="t('Phone')" clearable v-model="data.phone" /> <VnInput :label="t('Phone')" clearable v-model="data.phone" />
</VnRow> </VnRow>

View File

@ -11,12 +11,10 @@ import VnRow from 'components/ui/VnRow.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import { useState } from 'src/composables/useState';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const { dialogRef } = useDialogPluginComponent(); const { dialogRef } = useDialogPluginComponent();
const state = useState();
const user = state.getUser();
const $props = defineProps({ const $props = defineProps({
companyId: { companyId: {
@ -40,7 +38,7 @@ const bankOptions = ref([]);
const clientFindOne = ref([]); const clientFindOne = ref([]);
const deliveredAmount = ref(null); const deliveredAmount = ref(null);
const amountToReturn = ref(null); const amountToReturn = ref(null);
const viewRecipt = ref(true); const viewReceipt = ref();
const sendEmail = ref(false); const sendEmail = ref(false);
const isLoading = ref(false); const isLoading = ref(false);
@ -57,24 +55,46 @@ const filterClientFindOne = {
id: route.params.id, id: route.params.id,
}, },
}; };
const initialData = reactive({ const initialData = reactive({
amountPaid: $props.totalCredit, amountPaid: $props.totalCredit,
clientFk: route.params.id, clientFk: route.params.id,
companyFk: $props.companyId, companyFk: $props.companyId,
email: clientFindOne.value.email, email: clientFindOne.value.email,
bankFk: user.value.localBankFk,
}); });
onBeforeMount(() => { onBeforeMount(() => {
urlCreate.value = `Clients/${route.params.id}/createReceipt`; urlCreate.value = `Clients/${route.params.id}/createReceipt`;
}); });
const setPaymentType = (id) => { const setPaymentType = (value) => {
initialData.payed = '2001-01-01T11:00:00.000Z'; // if (id === 1) initialData.description = 'Credit card';
if (id === 1) initialData.description = 'Credit card'; // if (id === 2) initialData.description = 'Cash';
if (id === 2) initialData.description = 'Cash'; // if (id === 3 || id === 3117) initialData.description = '';
if (id === 3 || id === 3117) initialData.description = ''; // if (id === 4) initialData.description = 'Transfer';
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) => { const calculateFromAmount = (event) => {
@ -136,7 +156,7 @@ const onDataSaved = async () => {
<h5 class="q-mt-none">{{ t('New payment') }}</h5> <h5 class="q-mt-none">{{ t('New payment') }}</h5>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInputDate <VnInputDate
:label="t('Date')" :label="t('Date')"
:required="true" :required="true"
@ -154,7 +174,7 @@ const onDataSaved = async () => {
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('Bank')" :label="t('Bank')"
:options="bankOptions" :options="bankOptions"
@ -189,7 +209,7 @@ const onDataSaved = async () => {
{{ t('Compensation') }} {{ t('Compensation') }}
</div> </div>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col" v-if="data.bankFk === 3 || data.bankFk === 3117"> <div class="col" v-if="data.bankFk === 3 || data.bankFk === 3117">
<VnInput <VnInput
:label="t('Compensation account')" :label="t('Compensation account')"
@ -207,8 +227,7 @@ const onDataSaved = async () => {
<div class="q-mt-lg" v-if="data.bankFk === 2"> <div class="q-mt-lg" v-if="data.bankFk === 2">
<div class="text-h6">{{ t('Cash') }}</div> <div class="text-h6">{{ t('Cash') }}</div>
<VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput <VnInput
:label="t('Delivered amount')" :label="t('Delivered amount')"
@update:model-value="calculateFromDeliveredAmount($event)" @update:model-value="calculateFromDeliveredAmount($event)"
@ -224,13 +243,11 @@ const onDataSaved = async () => {
v-model="amountToReturn" v-model="amountToReturn"
/> />
</VnRow> </VnRow>
<VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <QCheckbox v-model="viewReceipt" />
<QCheckbox v-model="viewRecipt" />
<QCheckbox v-model="sendEmail" /> <QCheckbox v-model="sendEmail" />
</VnRow> </VnRow>
</div> </div>
<div class="q-mt-lg row justify-end"> <div class="q-mt-lg row justify-end">
<QBtn <QBtn
:disabled="isLoading" :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>
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInputDate :label="t('Since')" v-model="data.started" /> <VnInputDate :label="t('Since')" v-model="data.started" />
<VnInputDate :label="t('To')" v-model="data.finished" /> <VnInputDate :label="t('To')" v-model="data.finished" />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
:label="t('Amount')" :label="t('Amount')"
clearable clearable

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,9 +18,9 @@ const columns = [
name: 'itemFk', name: 'itemFk',
columnField: { columnField: {
component: VnImg, component: VnImg,
attrs: (id) => { attrs: ({ row }) => {
return { return {
id, id: row.id,
size: '50x50', size: '50x50',
width: '50px', width: '50px',
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -162,8 +162,14 @@ async function addExpense() {
} }
} }
const getTotalTaxableBase = (rows) => 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 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> </script>
<template> <template>
<FetchData <FetchData
@ -254,8 +260,9 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
:option-value="col.optionValue" :option-value="col.optionValue"
:option-label="col.optionLabel" :option-label="col.optionLabel"
:filter-options="['id', 'vat']" :filter-options="['id', 'vat']"
:autofocus="col.tabIndex == 1" :hide-selected="false"
input-debounce="0" :fill-input="false"
:display-value="formatOpt(row, col, 'vat')"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -280,6 +287,9 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
:filter-options="['id', 'transaction']" :filter-options="['id', 'transaction']"
:autofocus="col.tabIndex == 1" :autofocus="col.tabIndex == 1"
input-debounce="0" input-debounce="0"
:hide-selected="false"
:fill-input="false"
:display-value="formatOpt(row, col, 'transaction')"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -474,11 +484,16 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0)
/> />
</QPageSticky> </QPageSticky>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.bg { .bg {
background-color: var(--vn-light-gray); 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) { @media (max-width: $breakpoint-xs) {
.q-dialog { .q-dialog {
.q-card { .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 VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnCurrency from 'src/components/common/VnCurrency.vue'; import VnCurrency from 'src/components/common/VnCurrency.vue';
import FetchData from 'components/FetchData.vue';
const { t } = useI18n(); const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } }); defineProps({ dataKey: { type: String, required: true } });
const suppliers = ref([]); const activities = ref([]);
</script> </script>
<template> <template>
<FetchData
url="SupplierActivities"
auto-load
@on-fetch="(data) => (activities = data)"
/>
<VnFilterPanel :data-key="dataKey" :search-button="true"> <VnFilterPanel :data-key="dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
@ -29,11 +35,7 @@ const suppliers = ref([]);
v-model="params.supplierRef" v-model="params.supplierRef"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="vn:client" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -43,11 +45,7 @@ const suppliers = ref([]);
v-model="params.fi" v-model="params.fi"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -59,12 +57,11 @@ const suppliers = ref([]);
:label="t('params.supplierFk')" :label="t('params.supplierFk')"
option-value="id" option-value="id"
option-label="nickname" option-label="nickname"
:options="suppliers"
dense dense
outlined outlined
rounded rounded
> :filter-options="['id', 'name']"
</VnSelect> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -74,11 +71,7 @@ const suppliers = ref([]);
v-model="params.account" v-model="params.account"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="person" size="sm" />
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -105,7 +98,21 @@ const suppliers = ref([]);
/> />
</QItemSection> </QItemSection>
</QItem> </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> <QItemSection>
<QCheckbox <QCheckbox
:label="t('params.isBooked')" :label="t('params.isBooked')"
@ -114,6 +121,14 @@ const suppliers = ref([]);
toggle-indeterminate toggle-indeterminate
/> />
</QItemSection> </QItemSection>
<QItemSection>
<QCheckbox
:label="t('params.correctingFk')"
v-model="params.correctingFk"
@update:model-value="searchFn()"
toggle-indeterminate
/>
</QItemSection>
</QItem> </QItem>
<QExpansionItem :label="t('More options')" expand-separator> <QExpansionItem :label="t('More options')" expand-separator>
<QItem> <QItem>
@ -123,11 +138,7 @@ const suppliers = ref([]);
v-model="params.serialNumber" v-model="params.serialNumber"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -137,11 +148,7 @@ const suppliers = ref([]);
v-model="params.serial" v-model="params.serial"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
@ -151,11 +158,7 @@ const suppliers = ref([]);
v-model="params.awbCode" v-model="params.awbCode"
is-outlined is-outlined
lazy-rules lazy-rules
> />
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
</QExpansionItem> </QExpansionItem>
@ -166,7 +169,7 @@ const suppliers = ref([]);
<i18n> <i18n>
en: en:
params: params:
search: ID search: Id or supplier name
supplierRef: Supplier ref. supplierRef: Supplier ref.
supplierFk: Supplier supplierFk: Supplier
fi: Supplier fiscal id fi: Supplier fiscal id
@ -177,12 +180,17 @@ en:
dued: Dued dued: Dued
serialNumber: Serial Number serialNumber: Serial Number
serial: Serial serial: Serial
account: Account account: Ledger account
isBooked: is booked isBooked: is booked
correctedFk: Rectificatives correctedFk: Rectified
issued: Issued
to: To
awbCode: AWB
correctingFk: Rectificative
supplierActivityFk: Supplier activity
es: es:
params: params:
search: Contiene search: Id o nombre proveedor
supplierRef: Ref. proveedor supplierRef: Ref. proveedor
supplierFk: Proveedor supplierFk: Proveedor
clientFk: Cliente clientFk: Cliente
@ -193,10 +201,12 @@ es:
amount: Importe amount: Importe
issued: Emitida issued: Emitida
isBooked: Conciliada isBooked: Conciliada
account: Cuenta account: Cuenta contable
created: Creada created: Creada
dued: Vencida dued: Vencida
correctedFk: Rectificativas correctedFk: Rectificada
correctingFk: Rectificativa
supplierActivityFk: Actividad proveedor
From: Desde From: Desde
To: Hasta To: Hasta
Amount: Importe Amount: Importe

View File

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

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

@ -31,7 +31,7 @@ onMounted(async () => {
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
ref="genusInputRef" ref="genusInputRef"
:label="t('Latin genus name')" :label="t('Latin genus name')"

View File

@ -33,7 +33,7 @@ onMounted(async () => {
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
ref="identifierInputRef" ref="identifierInputRef"
:label="t('createIntrastatForm.identifier')" :label="t('createIntrastatForm.identifier')"

View File

@ -31,7 +31,7 @@ onMounted(async () => {
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
ref="specieInputRef" ref="specieInputRef"
:label="t('Latin species name')" :label="t('Latin species name')"

View File

@ -71,7 +71,7 @@ const onIntrastatCreated = (response, formData) => {
:clear-store-on-unmount="false" :clear-store-on-unmount="false"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('basicData.type')" :label="t('basicData.type')"
v-model="data.typeFk" v-model="data.typeFk"
@ -95,7 +95,7 @@ const onIntrastatCreated = (response, formData) => {
<VnInput :label="t('basicData.reference')" v-model="data.comment" /> <VnInput :label="t('basicData.reference')" v-model="data.comment" />
<VnInput :label="t('basicData.relevancy')" v-model="data.relevancy" /> <VnInput :label="t('basicData.relevancy')" v-model="data.relevancy" />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput :label="t('basicData.stems')" v-model="data.stems" /> <VnInput :label="t('basicData.stems')" v-model="data.stems" />
<VnInput <VnInput
:label="t('basicData.multiplier')" :label="t('basicData.multiplier')"
@ -127,7 +127,7 @@ const onIntrastatCreated = (response, formData) => {
</template> </template>
</VnSelectDialog> </VnSelectDialog>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelectDialog <VnSelectDialog
:label="t('basicData.intrastat')" :label="t('basicData.intrastat')"
v-model="data.intrastatFk" v-model="data.intrastatFk"
@ -166,7 +166,7 @@ const onIntrastatCreated = (response, formData) => {
/> />
</div> </div>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
:label="t('basicData.weightByPiece')" :label="t('basicData.weightByPiece')"
v-model.number="data.weightByPiece" v-model.number="data.weightByPiece"
@ -192,7 +192,7 @@ const onIntrastatCreated = (response, formData) => {
type="number" type="number"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<QCheckbox v-model="data.isActive" :label="t('basicData.isActive')" /> <QCheckbox v-model="data.isActive" :label="t('basicData.isActive')" />
<QCheckbox v-model="data.hasKgPrice" :label="t('basicData.hasKgPrice')" /> <QCheckbox v-model="data.hasKgPrice" :label="t('basicData.hasKgPrice')" />
<div> <div>

View File

@ -67,7 +67,7 @@ onMounted(async () => {
:clear-store-on-unmount="false" :clear-store-on-unmount="false"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelectDialog <VnSelectDialog
:label="t('Genus')" :label="t('Genus')"
v-model="data.genusFk" v-model="data.genusFk"

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onMounted, computed, onUnmounted, reactive, ref } from 'vue'; import { onMounted, computed, onUnmounted, reactive, ref, nextTick } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -17,6 +17,7 @@ import { toDateFormat } from 'src/filters/date.js';
import { dashIfEmpty } from 'src/filters'; import { dashIfEmpty } from 'src/filters';
import { date } from 'quasar'; import { date } from 'quasar';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import axios from 'axios';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -33,6 +34,7 @@ const itemsBalanceFilter = reactive({
const itemBalances = ref([]); const itemBalances = ref([]);
const warehouseFk = ref(null); const warehouseFk = ref(null);
const _showWhatsBeforeInventory = ref(false); const _showWhatsBeforeInventory = ref(false);
const inventoriedDate = ref(null);
const columns = computed(() => [ const columns = computed(() => [
{ {
@ -98,7 +100,7 @@ const showWhatsBeforeInventory = computed({
set: (val) => { set: (val) => {
_showWhatsBeforeInventory.value = val; _showWhatsBeforeInventory.value = val;
if (!val) itemsBalanceFilter.where.date = null; if (!val) itemsBalanceFilter.where.date = null;
else itemsBalanceFilter.where.date = new Date(); else itemsBalanceFilter.where.date = inventoriedDate.value ?? new Date();
}, },
}); });
@ -113,18 +115,36 @@ const getBadgeAttrs = (_date) => {
return attrs; return attrs;
}; };
const scrollToToday = async () => {
await nextTick();
const today = Date.vnNew();
today.setHours(0, 0, 0, 0);
const todayCell = document.querySelector(`td[data-date="${today.toISOString()}"]`);
if (todayCell) {
todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
};
const formatDateForAttribute = (dateValue) => {
if (dateValue instanceof Date) return date.formatDate(dateValue, 'YYYY-MM-DD');
return dateValue;
};
const originTypeMap = { const originTypeMap = {
entry: { entry: {
descriptor: EntryDescriptorProxy, descriptor: EntryDescriptorProxy,
icon: 'vn:entry', icon: 'vn:entry',
color: 'green',
}, },
ticket: { ticket: {
descriptor: TicketDescriptorProxy, descriptor: TicketDescriptorProxy,
icon: 'vn:ticket', icon: 'vn:ticket',
color: 'red',
}, },
order: { order: {
descriptor: OrderDescriptorProxy, descriptor: OrderDescriptorProxy,
icon: 'vn:basket', icon: 'vn:basket',
color: 'yellow',
}, },
}; };
@ -142,7 +162,10 @@ onMounted(async () => {
if (route.query.warehouseFk) warehouseFk.value = route.query.warehouseFk; if (route.query.warehouseFk) warehouseFk.value = route.query.warehouseFk;
else if (user.value) warehouseFk.value = user.value.warehouseFk; else if (user.value) warehouseFk.value = user.value.warehouseFk;
itemsBalanceFilter.where.warehouseFk = warehouseFk.value; itemsBalanceFilter.where.warehouseFk = warehouseFk.value;
const { data } = await axios.get('Configs/findOne');
inventoriedDate.value = data.inventoried;
await fetchItemBalances(); await fetchItemBalances();
await scrollToToday();
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));
@ -215,7 +238,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
</QTd> </QTd>
</template> </template>
<template #body-cell-date="{ row }"> <template #body-cell-date="{ row }">
<QTd @click.stop> <QTd @click.stop :data-date="formatDateForAttribute(row.shipped)">
<QBadge <QBadge
v-bind="getBadgeAttrs(row.shipped)" v-bind="getBadgeAttrs(row.shipped)"
class="q-ma-none" class="q-ma-none"
@ -237,12 +260,13 @@ onUnmounted(() => (stateStore.rightDrawer = false));
> >
{{ row.originId }} {{ row.originId }}
</component> </component>
<QIcon
:name="originTypeMap[row.originType]?.icon"
class="fill-icon q-mr-sm"
size="sm"
:color="originTypeMap[row.originType]?.color"
/>
<span class="link"> <span class="link">
<QIcon
:name="originTypeMap[row.originType]?.icon"
class="fill-icon q-mr-sm"
size="xs"
/>
{{ row.originId }} {{ row.originId }}
</span> </span>
</QTd> </QTd>
@ -264,7 +288,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
> >
{{ row.entityId }} {{ row.entityId }}
</component> </component>
<span class="link"> <span :class="{ link: row.entityId }">
{{ dashIfEmpty(row.entityName) }} {{ dashIfEmpty(row.entityName) }}
</span> </span>
</QBadge> </QBadge>

View File

@ -85,7 +85,7 @@ onBeforeMount(async () => {
@on-data-saved="redirectToItemBasicData" @on-data-saved="redirectToItemBasicData"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
v-model="data.provisionalName" v-model="data.provisionalName"
:label="t('item.create.name')" :label="t('item.create.name')"
@ -107,7 +107,7 @@ onBeforeMount(async () => {
hide-selected hide-selected
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('item.create.type')" :label="t('item.create.type')"
v-model="data.typeFk" v-model="data.typeFk"
@ -154,7 +154,7 @@ onBeforeMount(async () => {
</template> </template>
</VnSelect> </VnSelect>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('item.create.origin')" :label="t('item.create.origin')"
v-model="data.originFk" v-model="data.originFk"

View File

@ -36,7 +36,7 @@ onMounted(async () => {
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<div class="col"> <div class="col">
<VnInput <VnInput
ref="textAreaRef" ref="textAreaRef"

View File

@ -53,11 +53,11 @@ const redirectToItemTypeBasicData = (_, { id }) => {
@on-data-saved="redirectToItemTypeBasicData" @on-data-saved="redirectToItemTypeBasicData"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput v-model="data.code" :label="t('itemType.shared.code')" /> <VnInput v-model="data.code" :label="t('itemType.shared.code')" />
<VnInput v-model="data.name" :label="t('itemType.shared.name')" /> <VnInput v-model="data.name" :label="t('itemType.shared.name')" />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
v-model="data.workerFk" v-model="data.workerFk"
:label="t('itemType.shared.worker')" :label="t('itemType.shared.worker')"
@ -75,7 +75,7 @@ const redirectToItemTypeBasicData = (_, { id }) => {
hide-selected hide-selected
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
v-model="data.temperatureFk" v-model="data.temperatureFk"
:label="t('itemType.shared.temperature')" :label="t('itemType.shared.temperature')"

View File

@ -42,11 +42,11 @@ const temperaturesOptions = ref([]);
auto-load auto-load
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput v-model="data.code" :label="t('shared.code')" /> <VnInput v-model="data.code" :label="t('shared.code')" />
<VnInput v-model="data.name" :label="t('shared.name')" /> <VnInput v-model="data.name" :label="t('shared.name')" />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
v-model="data.workerFk" v-model="data.workerFk"
:label="t('shared.worker')" :label="t('shared.worker')"
@ -64,7 +64,7 @@ const temperaturesOptions = ref([]);
hide-selected hide-selected
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
v-model="data.temperatureFk" v-model="data.temperatureFk"
:label="t('shared.temperature')" :label="t('shared.temperature')"

View File

@ -7,6 +7,7 @@ import axios from 'axios';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { useLogin } from 'src/composables/useLogin'; import { useLogin } from 'src/composables/useLogin';
import VnInput from 'src/components/common/VnInput.vue';
const quasar = useQuasar(); const quasar = useQuasar();
const session = useSession(); const session = useSession();

View File

@ -125,7 +125,7 @@ async function onDataSaved({ id }) {
auto-load auto-load
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
url="Clients" url="Clients"
:label="t('order.form.clientFk')" :label="t('order.form.clientFk')"
@ -171,7 +171,7 @@ async function onDataSaved({ id }) {
</template> </template>
</VnSelect> </VnSelect>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInputDate <VnInputDate
placeholder="dd-mm-aaa" placeholder="dd-mm-aaa"
:label="t('order.form.landed')" :label="t('order.form.landed')"
@ -181,7 +181,7 @@ async function onDataSaved({ id }) {
" "
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('order.form.agencyModeFk')" :label="t('order.form.agencyModeFk')"
v-model="data.agencyModeFk" v-model="data.agencyModeFk"

View File

@ -70,9 +70,9 @@ const columns = computed(() => [
name: 'image', name: 'image',
columnField: { columnField: {
component: VnImg, component: VnImg,
attrs: (id) => { attrs: ({ row }) => {
return { return {
id, id: row.id,
width: '50px', width: '50px',
}; };
}, },

View File

@ -98,7 +98,7 @@ async function deleteWorCenter(id) {
@on-data-saved="paginate.fetch()" @on-data-saved="paginate.fetch()"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
v-model="data.workCenterFk" v-model="data.workCenterFk"
option-value="id" option-value="id"

View File

@ -3,6 +3,7 @@ import axios from 'axios';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useSession } from 'src/composables/useSession';
import VnConfirm from 'components/ui/VnConfirm.vue'; import VnConfirm from 'components/ui/VnConfirm.vue';
const props = defineProps({ const props = defineProps({
@ -11,10 +12,20 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
const router = useRouter(); const router = useRouter();
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const routeId = props.route.id;
async function openRouteReport() {
const url = new URL(window.location).origin;
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
window.open(
`${url}/api/Routes/${routeId}/driver-route-pdf?access_token=${token}`,
'_blank'
);
}
function confirmRemove() { function confirmRemove() {
quasar quasar
@ -29,20 +40,50 @@ function confirmRemove() {
.onOk(async () => await router.push({ name: 'RouteList' })); .onOk(async () => await router.push({ name: 'RouteList' }));
} }
async function sendMail() {
const params = {
id: routeId,
recipient: props?.route?.worker?.user?.emailUser?.email,
};
await axios.post(`Routes/${routeId}/driver-route-email`, params);
}
async function actualizeVolume() {
const params = { isOk: true };
await axios.post(`Routes/${routeId}/updateVolume`, params);
quasar.notify({
message: t('globals.dataUpdated'),
type: 'positive',
});
}
async function remove() { async function remove() {
if (!props.route.id) { await axios.delete(`Routes/${routeId}`);
return;
}
await axios.delete(`Routes/${props.route.id}`);
quasar.notify({ quasar.notify({
message: t('globals.dataDeleted'), message: t('globals.dataDeleted'),
type: 'positive', type: 'positive',
}); });
} }
// TODO: Add reports
</script> </script>
<template> <template>
<QItem @click="openRouteReport" v-ripple clickable>
<QItemSection avatar>
<QIcon name="description" />
</QItemSection>
<QItemSection>{{ t('seeReport') }}</QItemSection>
</QItem>
<QItem @click="sendMail" v-ripple clickable>
<QItemSection avatar>
<QIcon name="outgoing_mail" />
</QItemSection>
<QItemSection>{{ t('sendMail') }}</QItemSection>
</QItem>
<QItem @click="actualizeVolume" v-ripple clickable>
<QItemSection avatar>
<QIcon name="package_2" />
</QItemSection>
<QItemSection>{{ t('actualizeVolume') }}</QItemSection>
</QItem>
<QItem @click="confirmRemove" v-ripple clickable> <QItem @click="confirmRemove" v-ripple clickable>
<QItemSection avatar> <QItemSection avatar>
<QIcon name="delete" /> <QIcon name="delete" />
@ -56,8 +97,14 @@ en:
confirmDeletion: Confirm deletion confirmDeletion: Confirm deletion
confirmDeletionMessage: Are you sure you want to delete this route? confirmDeletionMessage: Are you sure you want to delete this route?
deleteRoute: Delete route deleteRoute: Delete route
seeReport: See route report
sendMail: Send route report
actualizeVolume: Actualize volume
es: es:
confirmDeletion: Confirmar eliminación, confirmDeletion: Confirmar eliminación,
confirmDeletionMessage: Seguro que quieres eliminar esta ruta? confirmDeletionMessage: Seguro que quieres eliminar esta ruta?
deleteRoute: Eliminar ruta deleteRoute: Eliminar ruta
seeReport: Ver informe de ruta
sendMail: Enviar informe de ruta
actualizeVolume: Actualizar volumen
</i18n> </i18n>

View File

@ -120,7 +120,7 @@ const onSave = (data, response) => {
@on-data-saved="onSave" @on-data-saved="onSave"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('Worker')" :label="t('Worker')"
v-model="data.workerFk" v-model="data.workerFk"
@ -155,7 +155,7 @@ const onSave = (data, response) => {
:input-debounce="0" :input-debounce="0"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('Agency')" :label="t('Agency')"
v-model="data.agencyModeFk" v-model="data.agencyModeFk"
@ -170,7 +170,7 @@ const onSave = (data, response) => {
<VnInputDate v-model="data.created" :label="t('Created')" /> <VnInputDate v-model="data.created" :label="t('Created')" />
</VnRow> </VnRow>
<template v-if="!isNew"> <template v-if="!isNew">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput v-model="data.kmStart" :label="t('Km Start')" clearable /> <VnInput v-model="data.kmStart" :label="t('Km Start')" clearable />
<QInput <QInput
v-model.number="data.kmEnd" v-model.number="data.kmEnd"
@ -184,7 +184,7 @@ const onSave = (data, response) => {
type="number" type="number"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInputTime <VnInputTime
v-model="data.started" v-model="data.started"
:label="t('Hour started')" :label="t('Hour started')"
@ -205,15 +205,13 @@ const onSave = (data, response) => {
</div> </div>
</VnRow> </VnRow>
</template> </template>
<VnRow class="row q-gutter-md q-mb-md"> <VnInput
<VnInput v-model="data.description"
v-model="data.description" :label="t('Description')"
:label="t('Description')" type="textarea"
type="textarea" :rows="3"
:rows="3" clearable
clearable />
/>
</VnRow>
</template> </template>
</FormModel> </FormModel>
</template> </template>

View File

@ -3,7 +3,7 @@ import { onBeforeMount, onMounted, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { Notify } from 'quasar'; import { Notify } from 'quasar';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { toDate, toDateHourMin } from 'filters/index'; import { toDateHourMin } from 'filters/index';
import { useStateStore } from 'src/stores/useStateStore'; import { useStateStore } from 'src/stores/useStateStore';
import axios from 'axios'; import axios from 'axios';

View File

@ -38,12 +38,12 @@ const onSave = (data, response) => {
@on-data-saved="onSave" @on-data-saved="onSave"
> >
<template #form="{ data }"> <template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput v-model="data.name" :label="t('Roadmap')" clearable /> <VnInput v-model="data.name" :label="t('Roadmap')" clearable />
<VnInputDate v-model="data.etd" :label="t('ETD date')" /> <VnInputDate v-model="data.etd" :label="t('ETD date')" />
<VnInputTime v-model="data.etd" :label="t('ETD hour')" /> <VnInputTime v-model="data.etd" :label="t('ETD hour')" />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
v-model="data.tractorPlate" v-model="data.tractorPlate"
:label="t('Tractor plate')" :label="t('Tractor plate')"
@ -55,7 +55,7 @@ const onSave = (data, response) => {
clearable clearable
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnSelect <VnSelect
:label="t('Carrier')" :label="t('Carrier')"
v-model="data.supplierFk" v-model="data.supplierFk"
@ -84,11 +84,11 @@ const onSave = (data, response) => {
clearable clearable
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput v-model="data.driverName" :label="t('Driver name')" clearable /> <VnInput v-model="data.driverName" :label="t('Driver name')" clearable />
<VnInput v-model="data.phone" :label="t('Phone')" clearable /> <VnInput v-model="data.phone" :label="t('Phone')" clearable />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
v-model="data.observations" v-model="data.observations"
:label="t('Observations')" :label="t('Observations')"

View File

@ -85,7 +85,7 @@ const onSave = (shelving, newShelving) => {
@on-data-saved="onSave" @on-data-saved="onSave"
> >
<template #form="{ data, validate, filter }"> <template #form="{ data, validate, filter }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
v-model="data.code" v-model="data.code"
:label="t('shelving.basicData.code')" :label="t('shelving.basicData.code')"
@ -107,7 +107,7 @@ const onSave = (shelving, newShelving) => {
:input-debounce="0" :input-debounce="0"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
v-model="data.priority" v-model="data.priority"
type="number" type="number"

View File

@ -71,7 +71,7 @@ function handleLocation(data, location) {
@on-data-saved="onDataSaved()" @on-data-saved="onDataSaved()"
> >
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
v-model="data.nickname" v-model="data.nickname"
:label="t('supplier.addresses.name')" :label="t('supplier.addresses.name')"
@ -81,7 +81,7 @@ function handleLocation(data, location) {
:label="t('supplier.addresses.street')" :label="t('supplier.addresses.street')"
/> />
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnLocation <VnLocation
:rules="validate('Worker.postcode')" :rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']" :roles-allowed-to-create="['deliveryAssistant']"
@ -91,7 +91,7 @@ function handleLocation(data, location) {
> >
</VnLocation> </VnLocation>
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow>
<VnInput <VnInput
v-model="data.phone" v-model="data.phone"
:label="t('supplier.addresses.phone')" :label="t('supplier.addresses.phone')"

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