forked from verdnatura/salix-front
Merge branch '7500_ChangeEntryDms' of https://gitea.verdnatura.es/verdnatura/salix-front into 7500_ChangeEntryDms
This commit is contained in:
commit
b8f6bc26ad
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.36.0",
|
"version": "24.40.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
@ -62,4 +62,4 @@
|
||||||
"vite": "^5.1.4",
|
"vite": "^5.1.4",
|
||||||
"vitest": "^0.31.1"
|
"vitest": "^0.31.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,16 +9,16 @@ export default {
|
||||||
const keyBindingMap = routes
|
const keyBindingMap = routes
|
||||||
.filter((route) => route.meta.keyBinding)
|
.filter((route) => route.meta.keyBinding)
|
||||||
.reduce((map, route) => {
|
.reduce((map, route) => {
|
||||||
map[route.meta.keyBinding.toLowerCase()] = route.path;
|
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||||
return map;
|
return map;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
const { ctrlKey, altKey, key } = event;
|
const { ctrlKey, altKey, code } = event;
|
||||||
|
|
||||||
if (ctrlKey && altKey && keyBindingMap[key] && !isNotified) {
|
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
router.push(keyBindingMap[key]);
|
router.push(keyBindingMap[code]);
|
||||||
isNotified = true;
|
isNotified = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, onMounted, nextTick } from 'vue';
|
import { reactive, ref, onMounted, nextTick, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
|
@ -7,16 +7,21 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FormModelPopup from './FormModelPopup.vue';
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
defineProps({ showEntityField: { type: Boolean, default: true } });
|
defineProps({ showEntityField: { type: Boolean, default: true } });
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved']);
|
const emit = defineEmits(['onDataSaved']);
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const bicInputRef = ref(null);
|
const bicInputRef = ref(null);
|
||||||
|
const state = useState();
|
||||||
|
|
||||||
|
const customer = computed(() => state.get('customer'));
|
||||||
|
|
||||||
const bankEntityFormData = reactive({
|
const bankEntityFormData = reactive({
|
||||||
name: null,
|
name: null,
|
||||||
bic: null,
|
bic: null,
|
||||||
countryFk: null,
|
countryFk: customer.value.countryFk,
|
||||||
id: null,
|
id: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<script setup>
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['onDataSaved']);
|
||||||
|
const { t } = useI18n();
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<FormModelPopup
|
||||||
|
url-create="Expenses"
|
||||||
|
model="Expense"
|
||||||
|
:title="t('New expense')"
|
||||||
|
:form-initial-data="{ id: null, isWithheld: false, name: null }"
|
||||||
|
@on-data-saved="emit('onDataSaved', $event)"
|
||||||
|
>
|
||||||
|
<template #form-inputs="{ data, validate }">
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
:label="`${t('globals.code')}`"
|
||||||
|
v-model="data.id"
|
||||||
|
:required="true"
|
||||||
|
:rules="validate('expense.code')"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
dense
|
||||||
|
size="sm"
|
||||||
|
:label="`${t('It\'s a withholding')}`"
|
||||||
|
v-model="data.isWithheld"
|
||||||
|
:rules="validate('expense.isWithheld')"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
:label="`${t('globals.description')}`"
|
||||||
|
v-model="data.name"
|
||||||
|
:required="true"
|
||||||
|
:rules="validate('expense.description')"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormModelPopup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
New expense: Nuevo gasto
|
||||||
|
It's a withholding: Es una retención
|
||||||
|
</i18n>
|
|
@ -105,7 +105,7 @@ async function setProvince(id, data) {
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
:rules="validate('postcode.city')"
|
:rules="validate('postcode.city')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
|
|
|
@ -189,11 +189,11 @@ async function saveChanges(data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function insert() {
|
async function insert(pushData = $props.dataRequired) {
|
||||||
const $index = formData.value.length
|
const $index = formData.value.length
|
||||||
? formData.value[formData.value.length - 1].$index + 1
|
? formData.value[formData.value.length - 1].$index + 1
|
||||||
: 0;
|
: 0;
|
||||||
formData.value.push(Object.assign({ $index }, $props.dataRequired));
|
formData.value.push(Object.assign({ $index }, pushData));
|
||||||
hasChanges.value = true;
|
hasChanges.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ onMounted(async () => {
|
||||||
|
|
||||||
async function fetch(fetchFilter = {}) {
|
async function fetch(fetchFilter = {}) {
|
||||||
try {
|
try {
|
||||||
const filter = Object.assign(fetchFilter, $props.filter); // eslint-disable-line vue/no-dupe-keys
|
const filter = { ...fetchFilter, ...$props.filter }; // eslint-disable-line vue/no-dupe-keys
|
||||||
if ($props.where && !fetchFilter.where) filter.where = $props.where;
|
if ($props.where && !fetchFilter.where) filter.where = $props.where;
|
||||||
if ($props.sortBy) filter.order = $props.sortBy;
|
if ($props.sortBy) filter.order = $props.sortBy;
|
||||||
if ($props.limit) filter.limit = $props.limit;
|
if ($props.limit) filter.limit = $props.limit;
|
||||||
|
|
|
@ -159,8 +159,8 @@ const removeTag = (index, params, search) => {
|
||||||
/>
|
/>
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="props.exprBuilder"
|
||||||
:custom-tags="customTags"
|
:custom-tags="props.customTags"
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<strong v-if="tag.label === 'categoryFk'">
|
<strong v-if="tag.label === 'categoryFk'">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { onMounted, ref, reactive } from 'vue';
|
import { onMounted, watch, ref, reactive } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { QSeparator, useQuasar } from 'quasar';
|
import { QSeparator, useQuasar } from 'quasar';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
@ -29,6 +29,15 @@ onMounted(async () => {
|
||||||
getRoutes();
|
getRoutes();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.matched,
|
||||||
|
() => {
|
||||||
|
items.value = [];
|
||||||
|
getRoutes();
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
function findMatches(search, item) {
|
function findMatches(search, item) {
|
||||||
const matches = [];
|
const matches = [];
|
||||||
function findRoute(search, item) {
|
function findRoute(search, item) {
|
||||||
|
|
|
@ -33,7 +33,12 @@ const itemComputed = computed(() => {
|
||||||
<QItemSection avatar v-if="!itemComputed.icon">
|
<QItemSection avatar v-if="!itemComputed.icon">
|
||||||
<QIcon name="disabled_by_default" />
|
<QIcon name="disabled_by_default" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t(itemComputed.title) }}</QItemSection>
|
<QItemSection>
|
||||||
|
{{ t(itemComputed.title) }}
|
||||||
|
<QTooltip v-if="item.keyBinding">
|
||||||
|
{{ 'Ctrl + Alt + ' + item?.keyBinding?.toUpperCase() }}
|
||||||
|
</QTooltip>
|
||||||
|
</QItemSection>
|
||||||
<QItemSection side>
|
<QItemSection side>
|
||||||
<slot name="side" :item="itemComputed" />
|
<slot name="side" :item="itemComputed" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -33,6 +33,7 @@ const invoiceCorrectionTypesOptions = ref([]);
|
||||||
const refund = async () => {
|
const refund = async () => {
|
||||||
const params = {
|
const params = {
|
||||||
id: invoiceParams.id,
|
id: invoiceParams.id,
|
||||||
|
withWarehouse: invoiceParams.inheritWarehouse,
|
||||||
cplusRectificationTypeFk: invoiceParams.cplusRectificationTypeFk,
|
cplusRectificationTypeFk: invoiceParams.cplusRectificationTypeFk,
|
||||||
siiTypeInvoiceOutFk: invoiceParams.siiTypeInvoiceOutFk,
|
siiTypeInvoiceOutFk: invoiceParams.siiTypeInvoiceOutFk,
|
||||||
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
||||||
|
|
|
@ -38,7 +38,7 @@ async function onProvinceCreated(_, data) {
|
||||||
hide-selected
|
hide-selected
|
||||||
v-model="provinceFk"
|
v-model="provinceFk"
|
||||||
:rules="validate && validate('postcode.provinceFk')"
|
:rules="validate && validate('postcode.provinceFk')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
|
|
@ -49,6 +49,10 @@ const $props = defineProps({
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
createAsDialog: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
cardClass: {
|
cardClass: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'flex-one',
|
default: 'flex-one',
|
||||||
|
@ -65,9 +69,13 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
disableInfiniteScroll: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
hasSubToolbar: {
|
hasSubToolbar: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: null,
|
||||||
},
|
},
|
||||||
disableOption: {
|
disableOption: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -85,6 +93,10 @@ const $props = defineProps({
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
|
crudModel: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
tableHeight: {
|
tableHeight: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '90vh',
|
default: '90vh',
|
||||||
|
@ -284,10 +296,17 @@ function parseOrder(urlOrders) {
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
create: createForm,
|
||||||
reload,
|
reload,
|
||||||
redirect: redirectFn,
|
redirect: redirectFn,
|
||||||
selected,
|
selected,
|
||||||
|
CrudModelRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleOnDataSaved(_) {
|
||||||
|
if (_.onDataSaved) _.onDataSaved(this);
|
||||||
|
else $props.create.onDataSaved(_);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QDrawer
|
<QDrawer
|
||||||
|
@ -342,17 +361,18 @@ defineExpose({
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<!-- class in div to fix warn-->
|
<!-- class in div to fix warn-->
|
||||||
|
|
||||||
<CrudModel
|
<CrudModel
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
:class="$attrs['class'] ?? 'q-px-md'"
|
:class="$attrs['class'] ?? 'q-px-md'"
|
||||||
:limit="20"
|
:limit="$attrs['limit'] ?? 20"
|
||||||
ref="CrudModelRef"
|
ref="CrudModelRef"
|
||||||
@on-fetch="(...args) => emit('onFetch', ...args)"
|
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:disable-infinite-scroll="isTableMode"
|
:disable-infinite-scroll="
|
||||||
|
$attrs['disableInfiniteScroll'] ? isTableMode : !disableInfiniteScroll
|
||||||
|
"
|
||||||
@save-changes="reload"
|
@save-changes="reload"
|
||||||
:has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
|
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
|
||||||
:auto-load="hasParams || $attrs['auto-load']"
|
:auto-load="hasParams || $attrs['auto-load']"
|
||||||
>
|
>
|
||||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||||
|
@ -374,6 +394,7 @@ defineExpose({
|
||||||
@virtual-scroll="
|
@virtual-scroll="
|
||||||
(event) =>
|
(event) =>
|
||||||
event.index > rows.length - 2 &&
|
event.index > rows.length - 2 &&
|
||||||
|
($props.crudModel?.paginate ?? true) &&
|
||||||
CrudModelRef.vnPaginateRef.paginate()
|
CrudModelRef.vnPaginateRef.paginate()
|
||||||
"
|
"
|
||||||
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
||||||
|
@ -482,6 +503,7 @@ 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"
|
||||||
|
@ -616,10 +638,19 @@ defineExpose({
|
||||||
</QTable>
|
</QTable>
|
||||||
</template>
|
</template>
|
||||||
</CrudModel>
|
</CrudModel>
|
||||||
<QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky v-if="$props.create" :offset="[20, 20]" style="z-index: 2">
|
||||||
<QBtn @click="showForm = !showForm" color="primary" fab icon="add" shortcut="+" />
|
<QBtn
|
||||||
|
@click="
|
||||||
|
() =>
|
||||||
|
createAsDialog ? (showForm = !showForm) : handleOnDataSaved(create)
|
||||||
|
"
|
||||||
|
color="primary"
|
||||||
|
fab
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
/>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ createForm.title }}
|
{{ createForm?.title }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
||||||
|
@ -733,6 +764,7 @@ es:
|
||||||
}
|
}
|
||||||
.q-table__top {
|
.q-table__top {
|
||||||
top: 0;
|
top: 0;
|
||||||
|
padding: 12px 0;
|
||||||
}
|
}
|
||||||
tbody {
|
tbody {
|
||||||
.q-checkbox {
|
.q-checkbox {
|
||||||
|
|
|
@ -79,7 +79,7 @@ if (props.baseUrl) {
|
||||||
<QPage>
|
<QPage>
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
<div :class="[useCardSize(), $attrs.class]">
|
<div :class="[useCardSize(), $attrs.class]">
|
||||||
<RouterView :key="route.fullPath" />
|
<RouterView :key="route.path" />
|
||||||
</div>
|
</div>
|
||||||
</QPage>
|
</QPage>
|
||||||
</QPageContainer>
|
</QPageContainer>
|
||||||
|
|
|
@ -155,6 +155,7 @@ const columns = computed(() => [
|
||||||
field: 'hasFile',
|
field: 'hasFile',
|
||||||
label: t('globals.original'),
|
label: t('globals.original'),
|
||||||
name: 'hasFile',
|
name: 'hasFile',
|
||||||
|
toolTip: t('The documentation is available in paper form'),
|
||||||
component: QCheckbox,
|
component: QCheckbox,
|
||||||
props: (prop) => ({
|
props: (prop) => ({
|
||||||
disable: true,
|
disable: true,
|
||||||
|
@ -310,6 +311,14 @@ defineExpose({
|
||||||
row-key="clientFk"
|
row-key="clientFk"
|
||||||
:grid="$q.screen.lt.sm"
|
:grid="$q.screen.lt.sm"
|
||||||
>
|
>
|
||||||
|
<template #header="props">
|
||||||
|
<QTr :props="props" class="bg">
|
||||||
|
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
|
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip
|
||||||
|
>{{ col.label }}
|
||||||
|
</QTh>
|
||||||
|
</QTr>
|
||||||
|
</template>
|
||||||
<template #body-cell="props">
|
<template #body-cell="props">
|
||||||
<QTd :props="props">
|
<QTd :props="props">
|
||||||
<QTr :props="props">
|
<QTr :props="props">
|
||||||
|
@ -406,8 +415,10 @@ defineExpose({
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
contentTypesInfo: Allowed file types {allowedContentTypes}
|
contentTypesInfo: Allowed file types {allowedContentTypes}
|
||||||
|
The documentation is available in paper form: The documentation is available in paper form
|
||||||
es:
|
es:
|
||||||
contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes}
|
contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes}
|
||||||
Generate identifier for original file: Generar identificador para archivo original
|
Generate identifier for original file: Generar identificador para archivo original
|
||||||
Upload file: Subir fichero
|
Upload file: Subir fichero
|
||||||
|
the documentation is available in paper form: Se tiene la documentación en papel
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -92,7 +92,6 @@ const mixinRules = [
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
</template>
|
</template>
|
||||||
<template #append>
|
<template #append>
|
||||||
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
|
|
||||||
<QIcon
|
<QIcon
|
||||||
name="close"
|
name="close"
|
||||||
size="xs"
|
size="xs"
|
||||||
|
@ -104,6 +103,7 @@ const mixinRules = [
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
></QIcon>
|
></QIcon>
|
||||||
|
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
|
||||||
<QIcon v-if="info" name="info">
|
<QIcon v-if="info" name="info">
|
||||||
<QTooltip max-width="350px">
|
<QTooltip max-width="350px">
|
||||||
{{ info }}
|
{{ info }}
|
||||||
|
@ -119,3 +119,8 @@ const mixinRules = [
|
||||||
es:
|
es:
|
||||||
inputMin: Debe ser mayor a {value}
|
inputMin: Debe ser mayor a {value}
|
||||||
</i18n>
|
</i18n>
|
||||||
|
<style lang="scss">
|
||||||
|
.q-field__append {
|
||||||
|
padding-inline: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -9,6 +9,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
showEvent: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -94,6 +98,7 @@ watch(
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
|
@click="isPopupOpen = true"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -111,6 +116,7 @@ watch(
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
v-if="showEvent"
|
||||||
name="event"
|
name="event"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
@click="isPopupOpen = !isPopupOpen"
|
@click="isPopupOpen = !isPopupOpen"
|
||||||
|
@ -130,6 +136,7 @@ watch(
|
||||||
v-model="popupDate"
|
v-model="popupDate"
|
||||||
:landscape="true"
|
:landscape="true"
|
||||||
:today-btn="true"
|
:today-btn="true"
|
||||||
|
:options="$attrs.options"
|
||||||
@update:model-value="
|
@update:model-value="
|
||||||
(date) => {
|
(date) => {
|
||||||
formattedDate = date;
|
formattedDate = date;
|
||||||
|
|
|
@ -14,6 +14,7 @@ import VnJsonValue from '../common/VnJsonValue.vue';
|
||||||
import FetchData from '../FetchData.vue';
|
import FetchData from '../FetchData.vue';
|
||||||
import VnSelect from './VnSelect.vue';
|
import VnSelect from './VnSelect.vue';
|
||||||
import VnUserLink from '../ui/VnUserLink.vue';
|
import VnUserLink from '../ui/VnUserLink.vue';
|
||||||
|
import VnPaginate from '../ui/VnPaginate.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const validationsStore = useValidator();
|
const validationsStore = useValidator();
|
||||||
|
@ -66,9 +67,10 @@ const filter = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
where: { and: [{ originFk: route.params.id }] },
|
||||||
};
|
};
|
||||||
|
|
||||||
const workers = ref();
|
const paginate = ref();
|
||||||
const actions = ref();
|
const actions = ref();
|
||||||
const changeInput = ref();
|
const changeInput = ref();
|
||||||
const searchInput = ref();
|
const searchInput = ref();
|
||||||
|
@ -235,9 +237,7 @@ async function openPointRecord(id, modelLog) {
|
||||||
const locale = validations[modelLog.model]?.locale || {};
|
const locale = validations[modelLog.model]?.locale || {};
|
||||||
pointRecord.value = parseProps(propNames, locale, data);
|
pointRecord.value = parseProps(propNames, locale, data);
|
||||||
}
|
}
|
||||||
async function setLogTree() {
|
async function setLogTree(data) {
|
||||||
filter.where = { and: [{ originFk: route.params.id }] };
|
|
||||||
const { data } = await getLogs(filter);
|
|
||||||
logTree.value = getLogTree(data);
|
logTree.value = getLogTree(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,15 +266,7 @@ async function applyFilter() {
|
||||||
filter.where.and.push(selectedFilters.value);
|
filter.where.and.push(selectedFilters.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data } = await getLogs(filter);
|
paginate.value.fetch(filter);
|
||||||
|
|
||||||
logTree.value = getLogTree(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getLogs(filter) {
|
|
||||||
return axios.get(props.url ?? `${props.model}Logs`, {
|
|
||||||
params: { filter: JSON.stringify(filter) },
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDate(type) {
|
function setDate(type) {
|
||||||
|
@ -377,8 +369,6 @@ async function clearFilter() {
|
||||||
await applyFilter();
|
await applyFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
setLogTree();
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
stateStore.rightDrawer = false;
|
stateStore.rightDrawer = false;
|
||||||
});
|
});
|
||||||
|
@ -391,16 +381,6 @@ watch(
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
:url="`${props.model}Logs/${route.params.id}/editors`"
|
|
||||||
:filter="{
|
|
||||||
fields: ['id', 'nickname', 'name', 'image'],
|
|
||||||
order: 'nickname',
|
|
||||||
limit: 30,
|
|
||||||
}"
|
|
||||||
@on-fetch="(data) => (workers = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
:url="`${props.model}Logs/${route.params.id}/models`"
|
:url="`${props.model}Logs/${route.params.id}/models`"
|
||||||
:filter="{ order: ['changedModel'] }"
|
:filter="{ order: ['changedModel'] }"
|
||||||
|
@ -418,231 +398,283 @@ watch(
|
||||||
"
|
"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<div
|
<VnPaginate
|
||||||
class="column items-center logs origin-log q-mt-md"
|
ref="paginate"
|
||||||
v-for="(originLog, originLogIndex) in logTree"
|
:data-key="`${model}Log`"
|
||||||
:key="originLogIndex"
|
:url="`${model}Logs`"
|
||||||
|
:filter="filter"
|
||||||
|
:skeleton="false"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="setLogTree"
|
||||||
>
|
>
|
||||||
<QItem class="origin-info items-center q-my-md" v-if="logTree.length > 1">
|
<template #body>
|
||||||
<h6 class="origin-id text-grey">
|
<div
|
||||||
{{ useCapitalize(validations[props.model].locale.name) }}
|
class="column items-center logs origin-log q-mt-md"
|
||||||
#{{ originLog.originFk }}
|
v-for="(originLog, originLogIndex) in logTree"
|
||||||
</h6>
|
:key="originLogIndex"
|
||||||
<div class="line bg-grey"></div>
|
>
|
||||||
</QItem>
|
<QItem class="origin-info items-center q-my-md" v-if="logTree.length > 1">
|
||||||
<div
|
<h6 class="origin-id text-grey">
|
||||||
class="user-log q-mb-sm"
|
{{ useCapitalize(validations[props.model].locale.name) }}
|
||||||
v-for="(userLog, userIndex) in originLog.logs"
|
#{{ originLog.originFk }}
|
||||||
:key="userIndex"
|
</h6>
|
||||||
>
|
<div class="line bg-grey"></div>
|
||||||
<div class="timeline">
|
</QItem>
|
||||||
<div class="user-avatar">
|
<div
|
||||||
<VnUserLink :worker-id="userLog?.user?.id">
|
class="user-log q-mb-sm"
|
||||||
<template #link>
|
v-for="(userLog, userIndex) in originLog.logs"
|
||||||
<VnAvatar
|
:key="userIndex"
|
||||||
:class="{ 'cursor-pointer': userLog?.user?.id }"
|
|
||||||
:worker-id="userLog?.user?.id"
|
|
||||||
:title="userLog?.user?.nickname"
|
|
||||||
:show-letter="!userLog?.user"
|
|
||||||
size="lg"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</VnUserLink>
|
|
||||||
</div>
|
|
||||||
<div class="arrow bg-panel" v-if="byRecord"></div>
|
|
||||||
<div class="line"></div>
|
|
||||||
</div>
|
|
||||||
<QList class="user-changes" v-if="userLog">
|
|
||||||
<QItem
|
|
||||||
class="model-log column q-px-none q-py-xs"
|
|
||||||
v-for="(modelLog, modelLogIndex) in userLog.logs"
|
|
||||||
:key="modelLogIndex"
|
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<div class="timeline">
|
||||||
<QItemLabel class="model-info q-mb-xs" v-if="!byRecord">
|
<div class="user-avatar">
|
||||||
<QChip
|
<VnUserLink :worker-id="userLog?.user?.id">
|
||||||
dense
|
<template #link>
|
||||||
size="md"
|
<VnAvatar
|
||||||
class="model-name q-mr-xs text-white"
|
:class="{ 'cursor-pointer': userLog?.user?.id }"
|
||||||
v-if="
|
:worker-id="userLog?.user?.id"
|
||||||
!(modelLog.changedModel && modelLog.changedModelId) &&
|
:title="userLog?.user?.nickname"
|
||||||
modelLog.model
|
:show-letter="!userLog?.user"
|
||||||
"
|
size="lg"
|
||||||
:style="{
|
/>
|
||||||
backgroundColor: useColor(modelLog.model),
|
</template>
|
||||||
}"
|
</VnUserLink>
|
||||||
:title="`${modelLog.model} #${modelLog.id}`"
|
</div>
|
||||||
>
|
<div class="arrow bg-panel" v-if="byRecord"></div>
|
||||||
{{ t(modelLog.modelI18n) }}
|
<div class="line"></div>
|
||||||
</QChip>
|
</div>
|
||||||
|
<QList class="user-changes" v-if="userLog">
|
||||||
<span
|
<QItem
|
||||||
class="model-id q-mr-xs"
|
class="model-log column q-px-none q-py-xs"
|
||||||
v-if="modelLog.summaryId"
|
v-for="(modelLog, modelLogIndex) in userLog.logs"
|
||||||
v-text="`#${modelLog.summaryId}`"
|
:key="modelLogIndex"
|
||||||
/>
|
|
||||||
<span
|
|
||||||
class="model-value"
|
|
||||||
:title="modelLog.showValue"
|
|
||||||
v-text="modelLog.showValue"
|
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="grey"
|
|
||||||
class="q-mr-xs q-ml-auto"
|
|
||||||
size="sm"
|
|
||||||
icon="filter_alt"
|
|
||||||
:title="t('recordChanges')"
|
|
||||||
@click.stop="filterByRecord(modelLog)"
|
|
||||||
/>
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
<QItemSection>
|
|
||||||
<QCard
|
|
||||||
class="changes-log q-py-none q-mb-xs"
|
|
||||||
v-for="(log, logIndex) in modelLog.logs"
|
|
||||||
:key="logIndex"
|
|
||||||
>
|
>
|
||||||
<QCardSection class="change-info q-pa-none">
|
<QItemSection>
|
||||||
<QItem
|
<QItemLabel class="model-info q-mb-xs" v-if="!byRecord">
|
||||||
class="q-px-sm q-py-xs justify-between items-center"
|
<QChip
|
||||||
>
|
dense
|
||||||
<div
|
size="md"
|
||||||
class="date text-grey text-caption q-mr-sm"
|
class="model-name q-mr-xs text-white"
|
||||||
:title="
|
v-if="
|
||||||
date.formatDate(
|
!(
|
||||||
log.creationDate,
|
modelLog.changedModel &&
|
||||||
'DD/MM/YYYY hh:mm:ss'
|
modelLog.changedModelId
|
||||||
) ?? `date:'dd/MM/yyyy HH:mm:ss'`
|
) && modelLog.model
|
||||||
"
|
"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: useColor(modelLog.model),
|
||||||
|
}"
|
||||||
|
:title="`${modelLog.model} #${modelLog.id}`"
|
||||||
>
|
>
|
||||||
{{ toRelativeDate(log.creationDate) }}
|
{{ t(modelLog.modelI18n) }}
|
||||||
</div>
|
</QChip>
|
||||||
<div>
|
|
||||||
<QBtn
|
|
||||||
color="grey"
|
|
||||||
class="pit"
|
|
||||||
icon="preview"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
:title="t('pointRecord')"
|
|
||||||
padding="none"
|
|
||||||
v-if="log.action != 'insert'"
|
|
||||||
@click.stop="
|
|
||||||
openPointRecord(log.id, modelLog)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<QPopupProxy>
|
|
||||||
<QCard v-if="pointRecord">
|
|
||||||
<div
|
|
||||||
class="header q-px-sm q-py-xs q-ma-none text-white text-bold bg-primary"
|
|
||||||
>
|
|
||||||
{{ modelLog.modelI18n }}
|
|
||||||
<span v-if="modelLog.id"
|
|
||||||
>#{{ modelLog.id }}</span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<QCardSection
|
|
||||||
class="change-detail q-pa-sm"
|
|
||||||
>
|
|
||||||
<QItem
|
|
||||||
v-for="(
|
|
||||||
value, index
|
|
||||||
) in pointRecord"
|
|
||||||
:key="index"
|
|
||||||
class="q-pa-none"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="json-field q-mr-xs text-grey"
|
|
||||||
:title="value.name"
|
|
||||||
>
|
|
||||||
{{ value.nameI18n }}:
|
|
||||||
</span>
|
|
||||||
<VnJsonValue
|
|
||||||
:value="value.val.val"
|
|
||||||
/>
|
|
||||||
</QItem>
|
|
||||||
</QCardSection>
|
|
||||||
</QCard>
|
|
||||||
</QPopupProxy>
|
|
||||||
</QBtn>
|
|
||||||
<QIcon
|
|
||||||
class="action q-ml-xs"
|
|
||||||
:class="actionsClass[log.action]"
|
|
||||||
:name="actionsIcon[log.action]"
|
|
||||||
:title="
|
|
||||||
t(`actions.${actionsText[log.action]}`)
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</QItem>
|
|
||||||
</QCardSection>
|
|
||||||
<QCardSection
|
|
||||||
class="change-detail q-px-sm q-py-xs"
|
|
||||||
:class="{ expanded: log.expand }"
|
|
||||||
v-if="log.props.length || log.description"
|
|
||||||
>
|
|
||||||
<QIcon
|
|
||||||
class="cursor-pointer q-mr-md"
|
|
||||||
color="grey"
|
|
||||||
name="expand_more"
|
|
||||||
:title="t('globals.details')"
|
|
||||||
size="sm"
|
|
||||||
@click="log.expand = !log.expand"
|
|
||||||
/>
|
|
||||||
<span v-if="log.props.length" class="attributes">
|
|
||||||
<span v-if="!log.expand" class="q-pa-none text-grey">
|
|
||||||
<span
|
|
||||||
v-for="(prop, propIndex) in log.props"
|
|
||||||
:key="propIndex"
|
|
||||||
class="basic-json"
|
|
||||||
>
|
|
||||||
<span class="json-field" :title="prop.name">
|
|
||||||
{{ prop.nameI18n }}:
|
|
||||||
</span>
|
|
||||||
<VnJsonValue :value="prop.val.val" />
|
|
||||||
<span v-if="propIndex < log.props.length - 1"
|
|
||||||
>,
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<span
|
<span
|
||||||
v-if="log.expand"
|
class="model-id q-mr-xs"
|
||||||
class="expanded-json column q-pa-none"
|
v-if="modelLog.summaryId"
|
||||||
>
|
v-text="`#${modelLog.summaryId}`"
|
||||||
<div
|
/>
|
||||||
v-for="(prop, prop2Index) in log.props"
|
<span
|
||||||
:key="prop2Index"
|
class="model-value"
|
||||||
class="q-pa-none text-grey"
|
:title="modelLog.showValue"
|
||||||
|
v-text="modelLog.showValue"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="grey"
|
||||||
|
class="q-mr-xs q-ml-auto"
|
||||||
|
size="sm"
|
||||||
|
icon="filter_alt"
|
||||||
|
:title="t('recordChanges')"
|
||||||
|
@click.stop="filterByRecord(modelLog)"
|
||||||
|
/>
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>
|
||||||
|
<QCard
|
||||||
|
class="changes-log q-py-none q-mb-xs"
|
||||||
|
v-for="(log, logIndex) in modelLog.logs"
|
||||||
|
:key="logIndex"
|
||||||
|
>
|
||||||
|
<QCardSection class="change-info q-pa-none">
|
||||||
|
<QItem
|
||||||
|
class="q-px-sm q-py-xs justify-between items-center"
|
||||||
>
|
>
|
||||||
<span class="json-field" :title="prop.name">
|
<div
|
||||||
{{ prop.nameI18n }}:
|
class="date text-grey text-caption q-mr-sm"
|
||||||
</span>
|
:title="
|
||||||
<VnJsonValue :value="prop.val.val" />
|
date.formatDate(
|
||||||
<span v-if="prop.val.id" class="id-value">
|
log.creationDate,
|
||||||
#{{ prop.val.id }}
|
'DD/MM/YYYY hh:mm:ss'
|
||||||
</span>
|
) ?? `date:'dd/MM/yyyy HH:mm:ss'`
|
||||||
<span v-if="log.action == 'update'">
|
"
|
||||||
←
|
>
|
||||||
<VnJsonValue :value="prop.old.val" />
|
{{ toRelativeDate(log.creationDate) }}
|
||||||
<span v-if="prop.old.id" class="id-value">
|
</div>
|
||||||
#{{ prop.old.id }}
|
<div>
|
||||||
|
<QBtn
|
||||||
|
color="grey"
|
||||||
|
class="pit"
|
||||||
|
icon="preview"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
:title="t('pointRecord')"
|
||||||
|
padding="none"
|
||||||
|
v-if="log.action != 'insert'"
|
||||||
|
@click.stop="
|
||||||
|
openPointRecord(log.id, modelLog)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<QPopupProxy>
|
||||||
|
<QCard v-if="pointRecord">
|
||||||
|
<div
|
||||||
|
class="header q-px-sm q-py-xs q-ma-none text-white text-bold bg-primary"
|
||||||
|
>
|
||||||
|
{{ modelLog.modelI18n }}
|
||||||
|
<span v-if="modelLog.id"
|
||||||
|
>#{{
|
||||||
|
modelLog.id
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<QCardSection
|
||||||
|
class="change-detail q-pa-sm"
|
||||||
|
>
|
||||||
|
<QItem
|
||||||
|
v-for="(
|
||||||
|
value, index
|
||||||
|
) in pointRecord"
|
||||||
|
:key="index"
|
||||||
|
class="q-pa-none"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="json-field q-mr-xs text-grey"
|
||||||
|
:title="
|
||||||
|
value.name
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
value.nameI18n
|
||||||
|
}}:
|
||||||
|
</span>
|
||||||
|
<VnJsonValue
|
||||||
|
:value="
|
||||||
|
value.val.val
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</QItem>
|
||||||
|
</QCardSection>
|
||||||
|
</QCard>
|
||||||
|
</QPopupProxy>
|
||||||
|
</QBtn>
|
||||||
|
<QIcon
|
||||||
|
class="action q-ml-xs"
|
||||||
|
:class="actionsClass[log.action]"
|
||||||
|
:name="actionsIcon[log.action]"
|
||||||
|
:title="
|
||||||
|
t(
|
||||||
|
`actions.${
|
||||||
|
actionsText[log.action]
|
||||||
|
}`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</QItem>
|
||||||
|
</QCardSection>
|
||||||
|
<QCardSection
|
||||||
|
class="change-detail q-px-sm q-py-xs"
|
||||||
|
:class="{ expanded: log.expand }"
|
||||||
|
v-if="log.props.length || log.description"
|
||||||
|
>
|
||||||
|
<QIcon
|
||||||
|
class="cursor-pointer q-mr-md"
|
||||||
|
color="grey"
|
||||||
|
name="expand_more"
|
||||||
|
:title="t('globals.details')"
|
||||||
|
size="sm"
|
||||||
|
@click="log.expand = !log.expand"
|
||||||
|
/>
|
||||||
|
<span v-if="log.props.length" class="attributes">
|
||||||
|
<span
|
||||||
|
v-if="!log.expand"
|
||||||
|
class="q-pa-none text-grey"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
v-for="(prop, propIndex) in log.props"
|
||||||
|
:key="propIndex"
|
||||||
|
class="basic-json"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="json-field"
|
||||||
|
:title="prop.name"
|
||||||
|
>
|
||||||
|
{{ prop.nameI18n }}:
|
||||||
|
</span>
|
||||||
|
<VnJsonValue :value="prop.val.val" />
|
||||||
|
<span
|
||||||
|
v-if="
|
||||||
|
propIndex <
|
||||||
|
log.props.length - 1
|
||||||
|
"
|
||||||
|
>,
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
<span
|
||||||
</span>
|
v-if="log.expand"
|
||||||
</span>
|
class="expanded-json column q-pa-none"
|
||||||
<span v-if="!log.props.length" class="description">
|
>
|
||||||
{{ log.description }}
|
<div
|
||||||
</span>
|
v-for="(
|
||||||
</QCardSection>
|
prop, prop2Index
|
||||||
</QCard>
|
) in log.props"
|
||||||
</QItemSection>
|
:key="prop2Index"
|
||||||
</QItem>
|
class="q-pa-none text-grey"
|
||||||
</QList>
|
>
|
||||||
</div>
|
<span
|
||||||
</div>
|
class="json-field"
|
||||||
|
:title="prop.name"
|
||||||
|
>
|
||||||
|
{{ prop.nameI18n }}:
|
||||||
|
</span>
|
||||||
|
<VnJsonValue :value="prop.val.val" />
|
||||||
|
<span
|
||||||
|
v-if="prop.val.id"
|
||||||
|
class="id-value"
|
||||||
|
>
|
||||||
|
#{{ prop.val.id }}
|
||||||
|
</span>
|
||||||
|
<span v-if="log.action == 'update'">
|
||||||
|
←
|
||||||
|
<VnJsonValue
|
||||||
|
:value="prop.old.val"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
v-if="prop.old.id"
|
||||||
|
class="id-value"
|
||||||
|
>
|
||||||
|
#{{ prop.old.id }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
v-if="!log.props.length"
|
||||||
|
class="description"
|
||||||
|
>
|
||||||
|
{{ log.description }}
|
||||||
|
</span>
|
||||||
|
</QCardSection>
|
||||||
|
</QCard>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</QList>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</VnPaginate>
|
||||||
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
|
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
|
||||||
<QList dense>
|
<QList dense>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
|
@ -691,17 +723,16 @@ watch(
|
||||||
</QOptionGroup>
|
</QOptionGroup>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mt-sm">
|
<QItem class="q-mt-sm">
|
||||||
<QItemSection v-if="!workers">
|
<QItemSection v-if="userRadio !== null">
|
||||||
<QSkeleton type="QInput" class="full-width" />
|
|
||||||
</QItemSection>
|
|
||||||
<QItemSection v-if="workers && userRadio !== null">
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
class="full-width"
|
class="full-width"
|
||||||
:label="t('globals.user')"
|
:label="t('globals.user')"
|
||||||
v-model="userSelect"
|
v-model="userSelect"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
:options="workers"
|
:url="`${model}Logs/${$route.params.id}/editors`"
|
||||||
|
:fields="['id', 'nickname', 'name', 'image']"
|
||||||
|
sort-by="nickname"
|
||||||
@update:model-value="selectFilter('userSelect')"
|
@update:model-value="selectFilter('userSelect')"
|
||||||
hide-selected
|
hide-selected
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
@ -11,6 +12,10 @@ const $props = defineProps({
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ['developer'],
|
default: () => ['developer'],
|
||||||
},
|
},
|
||||||
|
acls: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
actionIcon: {
|
actionIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'add',
|
default: 'add',
|
||||||
|
@ -22,15 +27,12 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const role = useRole();
|
const role = useRole();
|
||||||
const showForm = ref(false);
|
const acl = useAcl();
|
||||||
|
|
||||||
const isAllowedToCreate = computed(() => {
|
const isAllowedToCreate = computed(() => {
|
||||||
|
if ($props.acls.length) return acl.hasAny($props.acls);
|
||||||
return role.hasAny($props.rolesAllowedToCreate);
|
return role.hasAny($props.rolesAllowedToCreate);
|
||||||
});
|
});
|
||||||
|
|
||||||
const toggleForm = () => {
|
|
||||||
showForm.value = !showForm.value;
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -41,7 +43,7 @@ const toggleForm = () => {
|
||||||
>
|
>
|
||||||
<template v-if="isAllowedToCreate" #append>
|
<template v-if="isAllowedToCreate" #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
@click.stop.prevent="toggleForm()"
|
@click.stop.prevent="$refs.dialog.show()"
|
||||||
:name="actionIcon"
|
:name="actionIcon"
|
||||||
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
||||||
:class="['default-icon', { '--add-icon': actionIcon === 'add' }]"
|
:class="['default-icon', { '--add-icon': actionIcon === 'add' }]"
|
||||||
|
@ -51,7 +53,7 @@ const toggleForm = () => {
|
||||||
>
|
>
|
||||||
<QTooltip v-if="tooltip">{{ tooltip }}</QTooltip>
|
<QTooltip v-if="tooltip">{{ tooltip }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
<QDialog ref="dialog" transition-show="scale" transition-hide="scale">
|
||||||
<slot name="form" />
|
<slot name="form" />
|
||||||
</QDialog>
|
</QDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -127,11 +127,6 @@ const dialog = ref(null);
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
|
||||||
.subName {
|
|
||||||
color: var(--vn-label-color);
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
|
||||||
|
|
||||||
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
||||||
|
|
||||||
|
@ -68,8 +69,10 @@ async function confirm() {
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
|
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="row items-center">
|
<QCardSection class="q-pb-none">
|
||||||
<span v-if="message !== false" v-html="message" />
|
<span v-if="message !== false" v-html="message" />
|
||||||
|
</QCardSection>
|
||||||
|
<QCardSection class="row items-center q-pt-none">
|
||||||
<slot name="customHTML"></slot>
|
<slot name="customHTML"></slot>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardActions align="right">
|
<QCardActions align="right">
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { onMounted, ref, computed, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { date } from 'quasar';
|
||||||
import toDate from 'filters/toDate';
|
import toDate from 'filters/toDate';
|
||||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||||
|
|
||||||
|
@ -185,6 +186,7 @@ async function remove(key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(value) {
|
function formatValue(value) {
|
||||||
|
if (value instanceof Date) return date.formatDate(value, 'DD/MM/YYYY');
|
||||||
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
||||||
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ defineExpose({
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QImg
|
<QImg
|
||||||
|
:draggable="true"
|
||||||
:class="{ zoomIn: zoom }"
|
:class="{ zoomIn: zoom }"
|
||||||
:src="getUrl()"
|
:src="getUrl()"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
|
@ -62,6 +63,7 @@ defineExpose({
|
||||||
/>
|
/>
|
||||||
<QDialog v-if="$props.zoom" v-model="show">
|
<QDialog v-if="$props.zoom" v-model="show">
|
||||||
<QImg
|
<QImg
|
||||||
|
:draggable="true"
|
||||||
:src="getUrl(true)"
|
:src="getUrl(true)"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
spinner-color="primary"
|
spinner-color="primary"
|
||||||
|
|
|
@ -119,8 +119,8 @@ watch(
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [props.url, props.filter],
|
() => [props.url, props.filter, props.userParams],
|
||||||
([url, filter]) => mounted.value && fetch({ url, filter })
|
([url, filter, userParams]) => mounted.value && fetch({ url, filter, userParams })
|
||||||
);
|
);
|
||||||
|
|
||||||
const addFilter = async (filter, params) => {
|
const addFilter = async (filter, params) => {
|
||||||
|
@ -224,20 +224,27 @@ defineExpose({ fetch, addFilter, paginate });
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
>
|
>
|
||||||
<slot name="body" :rows="store.data"></slot>
|
<slot name="body" :rows="store.data"></slot>
|
||||||
<div v-if="isLoading" class="info-row q-pa-md text-center">
|
<div v-if="isLoading" class="spinner info-row q-pa-md text-center">
|
||||||
<QSpinner color="primary" size="md" />
|
<QSpinner color="primary" size="md" />
|
||||||
</div>
|
</div>
|
||||||
</QInfiniteScroll>
|
</QInfiniteScroll>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.info-row {
|
.spinner {
|
||||||
width: 100%;
|
z-index: 1;
|
||||||
|
align-content: end;
|
||||||
h5 {
|
position: absolute;
|
||||||
margin: 0;
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.info-row {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
h5 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
<script setup>
|
||||||
|
defineProps({ wrap: { type: Boolean, default: false } });
|
||||||
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="vn-row q-gutter-md q-mb-md">
|
<div class="vn-row q-gutter-md q-mb-md">
|
||||||
<slot />
|
<slot />
|
||||||
|
@ -15,7 +18,9 @@
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
.vn-row {
|
.vn-row {
|
||||||
flex-direction: column;
|
&:not(.wrap) {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
const $props = defineProps({
|
defineProps({
|
||||||
name: { type: String, default: null },
|
name: { type: String, default: null },
|
||||||
|
tag: { type: String, default: null },
|
||||||
workerId: { type: Number, default: null },
|
workerId: { type: Number, default: null },
|
||||||
defaultName: { type: Boolean, default: false },
|
defaultName: { type: Boolean, default: false },
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<slot name="link">
|
<slot name="link">
|
||||||
<span :class="{ link: $props.workerId }">
|
<span :class="{ link: workerId }">
|
||||||
{{ $props.defaultName ? $props.name ?? t('globals.system') : $props.name }}
|
{{ defaultName ? name ?? $t('globals.system') : name }}
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
|
<WorkerDescriptorProxy v-if="workerId" :id="workerId" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { toCurrency } from 'src/filters';
|
||||||
|
|
||||||
|
export function getTotal(rows, key, opts = {}) {
|
||||||
|
const { currency, cb } = opts;
|
||||||
|
const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
|
||||||
|
|
||||||
|
return currency
|
||||||
|
? toCurrency(total, currency == 'default' ? undefined : currency)
|
||||||
|
: total;
|
||||||
|
}
|
|
@ -16,13 +16,18 @@ export function useAcl() {
|
||||||
state.setAcls(acls);
|
state.setAcls(acls);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasAny(model, prop, accessType) {
|
function hasAny(acls) {
|
||||||
const acls = state.getAcls().value[model];
|
for (const acl of acls) {
|
||||||
if (acls)
|
let { model, props, accessType } = acl;
|
||||||
return ['*', prop].some((key) => {
|
const modelAcls = state.getAcls().value[model];
|
||||||
const acl = acls[key];
|
Array.isArray(props) || (props = [props]);
|
||||||
return acl && (acl['*'] || acl[accessType]);
|
if (modelAcls)
|
||||||
});
|
return ['*', ...props].some((key) => {
|
||||||
|
const acl = modelAcls[key];
|
||||||
|
return acl && (acl['*'] || acl[accessType]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -17,6 +17,7 @@ export function usePrintService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function openReport(path, params) {
|
function openReport(path, params) {
|
||||||
|
if (typeof params === 'string') params = JSON.parse(params);
|
||||||
params = Object.assign(
|
params = Object.assign(
|
||||||
{
|
{
|
||||||
access_token: getTokenMultimedia(),
|
access_token: getTokenMultimedia(),
|
||||||
|
|
|
@ -37,6 +37,10 @@ a {
|
||||||
.link {
|
.link {
|
||||||
color: $color-link;
|
color: $color-link;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&--white {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tx-color-link {
|
.tx-color-link {
|
||||||
|
@ -271,3 +275,8 @@ input::-webkit-inner-spin-button {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subName {
|
||||||
|
color: var(--vn-label-color);
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ globals:
|
||||||
lang:
|
lang:
|
||||||
es: Spanish
|
es: Spanish
|
||||||
en: English
|
en: English
|
||||||
|
quantity: Quantity
|
||||||
language: Language
|
language: Language
|
||||||
entity: Entity
|
entity: Entity
|
||||||
user: User
|
user: User
|
||||||
|
@ -40,6 +41,8 @@ globals:
|
||||||
noChanges: No changes to save
|
noChanges: No changes to save
|
||||||
changesToSave: You have changes pending to save
|
changesToSave: You have changes pending to save
|
||||||
confirmRemove: You are about to delete this row. Are you sure?
|
confirmRemove: You are about to delete this row. Are you sure?
|
||||||
|
rowWillBeRemoved: This row will be removed
|
||||||
|
sureToContinue: Are you sure you want to continue?
|
||||||
rowAdded: Row added
|
rowAdded: Row added
|
||||||
rowRemoved: Row removed
|
rowRemoved: Row removed
|
||||||
pleaseWait: Please wait...
|
pleaseWait: Please wait...
|
||||||
|
@ -84,7 +87,7 @@ globals:
|
||||||
description: Description
|
description: Description
|
||||||
id: Id
|
id: Id
|
||||||
order: Order
|
order: Order
|
||||||
original: Original
|
original: Phys. Doc
|
||||||
file: File
|
file: File
|
||||||
selectFile: Select a file
|
selectFile: Select a file
|
||||||
copyClipboard: Copy on clipboard
|
copyClipboard: Copy on clipboard
|
||||||
|
@ -96,6 +99,10 @@ globals:
|
||||||
to: To
|
to: To
|
||||||
notes: Notes
|
notes: Notes
|
||||||
refresh: Refresh
|
refresh: Refresh
|
||||||
|
item: Item
|
||||||
|
ticket: Ticket
|
||||||
|
campaign: Campaign
|
||||||
|
weight: Weight
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Login
|
logIn: Login
|
||||||
summary: Summary
|
summary: Summary
|
||||||
|
@ -122,6 +129,7 @@ globals:
|
||||||
notifications: Notifications
|
notifications: Notifications
|
||||||
defaulter: Defaulter
|
defaulter: Defaulter
|
||||||
customerCreate: New customer
|
customerCreate: New customer
|
||||||
|
createOrder: New order
|
||||||
fiscalData: Fiscal data
|
fiscalData: Fiscal data
|
||||||
billingData: Billing data
|
billingData: Billing data
|
||||||
consignees: Consignees
|
consignees: Consignees
|
||||||
|
@ -261,6 +269,7 @@ globals:
|
||||||
clientsActionsMonitor: Clients and actions
|
clientsActionsMonitor: Clients and actions
|
||||||
serial: Serial
|
serial: Serial
|
||||||
medical: Mutual
|
medical: Mutual
|
||||||
|
supplier: Supplier
|
||||||
created: Created
|
created: Created
|
||||||
worker: Worker
|
worker: Worker
|
||||||
now: Now
|
now: Now
|
||||||
|
@ -311,135 +320,6 @@ resetPassword:
|
||||||
repeatPassword: Repeat password
|
repeatPassword: Repeat password
|
||||||
passwordNotMatch: Passwords don't match
|
passwordNotMatch: Passwords don't match
|
||||||
passwordChanged: Password changed
|
passwordChanged: Password changed
|
||||||
customer:
|
|
||||||
list:
|
|
||||||
phone: Phone
|
|
||||||
email: Email
|
|
||||||
customerOrders: Display customer orders
|
|
||||||
moreOptions: More options
|
|
||||||
card:
|
|
||||||
customerList: Customer list
|
|
||||||
customerId: Claim ID
|
|
||||||
salesPerson: Sales person
|
|
||||||
credit: Credit
|
|
||||||
risk: Risk
|
|
||||||
securedCredit: Secured credit
|
|
||||||
payMethod: Pay method
|
|
||||||
debt: Debt
|
|
||||||
isFrozen: Customer frozen
|
|
||||||
hasDebt: Customer has debt
|
|
||||||
isDisabled: Customer inactive
|
|
||||||
notChecked: Customer no checked
|
|
||||||
webAccountInactive: Web account inactive
|
|
||||||
noWebAccess: Web access is disabled
|
|
||||||
businessType: Business type
|
|
||||||
passwordRequirements: 'The password must have at least { length } length characters, {nAlpha} alphabetic characters, {nUpper} capital letters, {nDigits} digits and {nPunct} symbols (Ex: $%&.)\n'
|
|
||||||
businessTypeFk: Business type
|
|
||||||
summary:
|
|
||||||
basicData: Basic data
|
|
||||||
fiscalAddress: Fiscal address
|
|
||||||
fiscalData: Fiscal data
|
|
||||||
billingData: Billing data
|
|
||||||
consignee: Default consignee
|
|
||||||
businessData: Business data
|
|
||||||
financialData: Financial data
|
|
||||||
customerId: Customer ID
|
|
||||||
name: Name
|
|
||||||
contact: Contact
|
|
||||||
phone: Phone
|
|
||||||
mobile: Mobile
|
|
||||||
email: Email
|
|
||||||
salesPerson: Sales person
|
|
||||||
contactChannel: Contact channel
|
|
||||||
socialName: Social name
|
|
||||||
fiscalId: Fiscal ID
|
|
||||||
postcode: Postcode
|
|
||||||
province: Province
|
|
||||||
country: Country
|
|
||||||
street: Address
|
|
||||||
isEqualizated: Is equalizated
|
|
||||||
isActive: Is active
|
|
||||||
invoiceByAddress: Invoice by address
|
|
||||||
verifiedData: Verified data
|
|
||||||
hasToInvoice: Has to invoice
|
|
||||||
notifyByEmail: Notify by email
|
|
||||||
vies: VIES
|
|
||||||
payMethod: Pay method
|
|
||||||
bankAccount: Bank account
|
|
||||||
dueDay: Due day
|
|
||||||
hasLcr: Has LCR
|
|
||||||
hasCoreVnl: Has core VNL
|
|
||||||
hasB2BVnl: Has B2B VNL
|
|
||||||
addressName: Address name
|
|
||||||
addressCity: City
|
|
||||||
addressStreet: Street
|
|
||||||
username: Username
|
|
||||||
webAccess: Web access
|
|
||||||
totalGreuge: Total greuge
|
|
||||||
mana: Mana
|
|
||||||
priceIncreasingRate: Price increasing rate
|
|
||||||
averageInvoiced: Average invoiced
|
|
||||||
claimRate: Claming rate
|
|
||||||
risk: Risk
|
|
||||||
riskInfo: Invoices minus payments plus orders not yet invoiced
|
|
||||||
credit: Credit
|
|
||||||
creditInfo: Company's maximum risk
|
|
||||||
securedCredit: Secured credit
|
|
||||||
securedCreditInfo: Solunion's maximum risk
|
|
||||||
balance: Balance
|
|
||||||
balanceInfo: Invoices minus payments
|
|
||||||
balanceDue: Balance due
|
|
||||||
balanceDueInfo: Deviated invoices minus payments
|
|
||||||
recoverySince: Recovery since
|
|
||||||
businessType: Business Type
|
|
||||||
city: City
|
|
||||||
descriptorInfo: Invoices minus payments plus orders not yet
|
|
||||||
rating: Rating
|
|
||||||
recommendCredit: Recommended credit
|
|
||||||
basicData:
|
|
||||||
socialName: Fiscal name
|
|
||||||
businessType: Business type
|
|
||||||
contact: Contact
|
|
||||||
youCanSaveMultipleEmails: You can save multiple emails
|
|
||||||
email: Email
|
|
||||||
phone: Phone
|
|
||||||
mobile: Mobile
|
|
||||||
salesPerson: Sales person
|
|
||||||
contactChannel: Contact channel
|
|
||||||
previousClient: Previous client
|
|
||||||
extendedList:
|
|
||||||
tableVisibleColumns:
|
|
||||||
id: Identifier
|
|
||||||
name: Name
|
|
||||||
socialName: Social name
|
|
||||||
fi: Tax number
|
|
||||||
salesPersonFk: Salesperson
|
|
||||||
credit: Credit
|
|
||||||
creditInsurance: Credit insurance
|
|
||||||
phone: Phone
|
|
||||||
mobile: Mobile
|
|
||||||
street: Street
|
|
||||||
countryFk: Country
|
|
||||||
provinceFk: Province
|
|
||||||
city: City
|
|
||||||
postcode: Postcode
|
|
||||||
email: Email
|
|
||||||
created: Created
|
|
||||||
businessTypeFk: Business type
|
|
||||||
payMethodFk: Billing data
|
|
||||||
sageTaxTypeFk: Sage tax type
|
|
||||||
sageTransactionTypeFk: Sage tr. type
|
|
||||||
isActive: Active
|
|
||||||
isVies: Vies
|
|
||||||
isTaxDataChecked: Verified data
|
|
||||||
isEqualizated: Is equalizated
|
|
||||||
isFreezed: Freezed
|
|
||||||
hasToInvoice: Invoice
|
|
||||||
hasToInvoiceByAddress: Invoice by address
|
|
||||||
isToBeMailed: Mailing
|
|
||||||
hasLcr: Received LCR
|
|
||||||
hasCoreVnl: VNL core received
|
|
||||||
hasSepaVnl: VNL B2B received
|
|
||||||
entry:
|
entry:
|
||||||
list:
|
list:
|
||||||
newEntry: New entry
|
newEntry: New entry
|
||||||
|
@ -753,56 +633,6 @@ parking:
|
||||||
searchBar:
|
searchBar:
|
||||||
info: You can search by parking code
|
info: You can search by parking code
|
||||||
label: Search parking...
|
label: Search parking...
|
||||||
invoiceIn:
|
|
||||||
list:
|
|
||||||
ref: Reference
|
|
||||||
supplier: Supplier
|
|
||||||
supplierRef: Supplier ref.
|
|
||||||
serialNumber: Serial number
|
|
||||||
serial: Serial
|
|
||||||
file: File
|
|
||||||
issued: Issued
|
|
||||||
isBooked: Is booked
|
|
||||||
awb: AWB
|
|
||||||
amount: Amount
|
|
||||||
card:
|
|
||||||
issued: Issued
|
|
||||||
amount: Amount
|
|
||||||
client: Client
|
|
||||||
company: Company
|
|
||||||
customerCard: Customer card
|
|
||||||
ticketList: Ticket List
|
|
||||||
vat: Vat
|
|
||||||
dueDay: Due day
|
|
||||||
intrastat: Intrastat
|
|
||||||
summary:
|
|
||||||
supplier: Supplier
|
|
||||||
supplierRef: Supplier ref.
|
|
||||||
currency: Currency
|
|
||||||
docNumber: Doc number
|
|
||||||
issued: Expedition date
|
|
||||||
operated: Operation date
|
|
||||||
bookEntried: Entry date
|
|
||||||
bookedDate: Booked date
|
|
||||||
sage: Sage withholding
|
|
||||||
vat: Undeductible VAT
|
|
||||||
company: Company
|
|
||||||
booked: Booked
|
|
||||||
expense: Expense
|
|
||||||
taxableBase: Taxable base
|
|
||||||
rate: Rate
|
|
||||||
sageVat: Sage vat
|
|
||||||
sageTransaction: Sage transaction
|
|
||||||
dueDay: Date
|
|
||||||
bank: Bank
|
|
||||||
amount: Amount
|
|
||||||
foreignValue: Foreign value
|
|
||||||
dueTotal: Due day
|
|
||||||
noMatch: Do not match
|
|
||||||
code: Code
|
|
||||||
net: Net
|
|
||||||
stems: Stems
|
|
||||||
country: Country
|
|
||||||
order:
|
order:
|
||||||
field:
|
field:
|
||||||
salesPersonFk: Sales Person
|
salesPersonFk: Sales Person
|
||||||
|
@ -1298,6 +1128,7 @@ components:
|
||||||
active: Is active
|
active: Is active
|
||||||
visible: Is visible
|
visible: Is visible
|
||||||
floramondo: Is floramondo
|
floramondo: Is floramondo
|
||||||
|
showBadDates: Show future items
|
||||||
userPanel:
|
userPanel:
|
||||||
copyToken: Token copied to clipboard
|
copyToken: Token copied to clipboard
|
||||||
settings: Settings
|
settings: Settings
|
||||||
|
|
|
@ -3,6 +3,7 @@ globals:
|
||||||
es: Español
|
es: Español
|
||||||
en: Inglés
|
en: Inglés
|
||||||
language: Idioma
|
language: Idioma
|
||||||
|
quantity: Cantidad
|
||||||
entity: Entidad
|
entity: Entidad
|
||||||
user: Usuario
|
user: Usuario
|
||||||
details: Detalles
|
details: Detalles
|
||||||
|
@ -39,6 +40,8 @@ globals:
|
||||||
noChanges: Sin cambios que guardar
|
noChanges: Sin cambios que guardar
|
||||||
changesToSave: Tienes cambios pendientes de guardar
|
changesToSave: Tienes cambios pendientes de guardar
|
||||||
confirmRemove: Vas a eliminar este registro. ¿Continuar?
|
confirmRemove: Vas a eliminar este registro. ¿Continuar?
|
||||||
|
rowWillBeRemoved: Esta linea se eliminará
|
||||||
|
sureToContinue: ¿Seguro que quieres continuar?
|
||||||
rowAdded: Fila añadida
|
rowAdded: Fila añadida
|
||||||
rowRemoved: Fila eliminada
|
rowRemoved: Fila eliminada
|
||||||
pleaseWait: Por favor espera...
|
pleaseWait: Por favor espera...
|
||||||
|
@ -86,7 +89,7 @@ globals:
|
||||||
description: Descripción
|
description: Descripción
|
||||||
id: Id
|
id: Id
|
||||||
order: Orden
|
order: Orden
|
||||||
original: Original
|
original: Doc. física
|
||||||
file: Fichero
|
file: Fichero
|
||||||
selectFile: Seleccione un fichero
|
selectFile: Seleccione un fichero
|
||||||
copyClipboard: Copiar en portapapeles
|
copyClipboard: Copiar en portapapeles
|
||||||
|
@ -98,6 +101,10 @@ globals:
|
||||||
to: Hasta
|
to: Hasta
|
||||||
notes: Notas
|
notes: Notas
|
||||||
refresh: Actualizar
|
refresh: Actualizar
|
||||||
|
item: Artículo
|
||||||
|
ticket: Ticket
|
||||||
|
campaign: Campaña
|
||||||
|
weight: Peso
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Inicio de sesión
|
logIn: Inicio de sesión
|
||||||
summary: Resumen
|
summary: Resumen
|
||||||
|
@ -119,6 +126,7 @@ globals:
|
||||||
inheritedRoles: Roles heredados
|
inheritedRoles: Roles heredados
|
||||||
customers: Clientes
|
customers: Clientes
|
||||||
customerCreate: Nuevo cliente
|
customerCreate: Nuevo cliente
|
||||||
|
createOrder: Nuevo pedido
|
||||||
list: Listado
|
list: Listado
|
||||||
webPayments: Pagos Web
|
webPayments: Pagos Web
|
||||||
extendedList: Listado extendido
|
extendedList: Listado extendido
|
||||||
|
@ -265,6 +273,7 @@ globals:
|
||||||
clientsActionsMonitor: Clientes y acciones
|
clientsActionsMonitor: Clientes y acciones
|
||||||
serial: Facturas por serie
|
serial: Facturas por serie
|
||||||
medical: Mutua
|
medical: Mutua
|
||||||
|
supplier: Proveedor
|
||||||
created: Fecha creación
|
created: Fecha creación
|
||||||
worker: Trabajador
|
worker: Trabajador
|
||||||
now: Ahora
|
now: Ahora
|
||||||
|
@ -313,134 +322,6 @@ resetPassword:
|
||||||
repeatPassword: Repetir contraseña
|
repeatPassword: Repetir contraseña
|
||||||
passwordNotMatch: Las contraseñas no coinciden
|
passwordNotMatch: Las contraseñas no coinciden
|
||||||
passwordChanged: Contraseña cambiada
|
passwordChanged: Contraseña cambiada
|
||||||
customer:
|
|
||||||
list:
|
|
||||||
phone: Teléfono
|
|
||||||
email: Email
|
|
||||||
customerOrders: Mostrar órdenes del cliente
|
|
||||||
moreOptions: Más opciones
|
|
||||||
card:
|
|
||||||
customerId: ID cliente
|
|
||||||
salesPerson: Comercial
|
|
||||||
credit: Crédito
|
|
||||||
risk: Riesgo
|
|
||||||
securedCredit: Crédito asegurado
|
|
||||||
payMethod: Método de pago
|
|
||||||
debt: Riesgo
|
|
||||||
isFrozen: Cliente congelado
|
|
||||||
hasDebt: Cliente con riesgo
|
|
||||||
isDisabled: Cliente inactivo
|
|
||||||
notChecked: Cliente no comprobado
|
|
||||||
webAccountInactive: Sin acceso web
|
|
||||||
noWebAccess: El acceso web está desactivado
|
|
||||||
businessType: Tipo de negocio
|
|
||||||
passwordRequirements: 'La contraseña debe tener al menos { length } caracteres de longitud, {nAlpha} caracteres alfabéticos, {nUpper} letras mayúsculas, {nDigits} dígitos y {nPunct} símbolos (Ej: $%&.)'
|
|
||||||
businessTypeFk: Tipo de negocio
|
|
||||||
summary:
|
|
||||||
basicData: Datos básicos
|
|
||||||
fiscalAddress: Dirección fiscal
|
|
||||||
fiscalData: Datos fiscales
|
|
||||||
billingData: Datos de facturación
|
|
||||||
consignee: Consignatario pred.
|
|
||||||
businessData: Datos comerciales
|
|
||||||
financialData: Datos financieros
|
|
||||||
customerId: ID cliente
|
|
||||||
name: Nombre
|
|
||||||
contact: Contacto
|
|
||||||
phone: Teléfono
|
|
||||||
mobile: Móvil
|
|
||||||
email: Email
|
|
||||||
salesPerson: Comercial
|
|
||||||
contactChannel: Canal de contacto
|
|
||||||
socialName: Razón social
|
|
||||||
fiscalId: NIF/CIF
|
|
||||||
postcode: Código postal
|
|
||||||
province: Provincia
|
|
||||||
country: País
|
|
||||||
street: Calle
|
|
||||||
isEqualizated: Recargo de equivalencia
|
|
||||||
isActive: Activo
|
|
||||||
invoiceByAddress: Facturar por consignatario
|
|
||||||
verifiedData: Datos verificados
|
|
||||||
hasToInvoice: Facturar
|
|
||||||
notifyByEmail: Notificar por email
|
|
||||||
vies: VIES
|
|
||||||
payMethod: Método de pago
|
|
||||||
bankAccount: Cuenta bancaria
|
|
||||||
dueDay: Día de pago
|
|
||||||
hasLcr: Recibido LCR
|
|
||||||
hasCoreVnl: Recibido core VNL
|
|
||||||
hasB2BVnl: Recibido B2B VNL
|
|
||||||
addressName: Nombre de la dirección
|
|
||||||
addressCity: Ciudad
|
|
||||||
addressStreet: Calle
|
|
||||||
username: Usuario
|
|
||||||
webAccess: Acceso web
|
|
||||||
totalGreuge: Greuge total
|
|
||||||
mana: Maná
|
|
||||||
priceIncreasingRate: Ratio de incremento de precio
|
|
||||||
averageInvoiced: Facturación media
|
|
||||||
claimRate: Ratio de reclamaciones
|
|
||||||
risk: Riesgo
|
|
||||||
riskInfo: Facturas menos recibos mas pedidos sin facturar
|
|
||||||
credit: Crédito
|
|
||||||
creditInfo: Riesgo máximo asumido por la empresa
|
|
||||||
securedCredit: Crédito asegurado
|
|
||||||
securedCreditInfo: Riesgo máximo asumido por Solunion
|
|
||||||
balance: Balance
|
|
||||||
balanceInfo: Facturas menos recibos
|
|
||||||
balanceDue: Saldo vencido
|
|
||||||
balanceDueInfo: Facturas fuera de plazo menos recibos
|
|
||||||
recoverySince: Recobro desde
|
|
||||||
businessType: Tipo de negocio
|
|
||||||
city: Población
|
|
||||||
descriptorInfo: Facturas menos recibos mas pedidos sin facturar
|
|
||||||
rating: Clasificación
|
|
||||||
recommendCredit: Crédito recomendado
|
|
||||||
basicData:
|
|
||||||
socialName: Nombre fiscal
|
|
||||||
businessType: Tipo de negocio
|
|
||||||
contact: Contacto
|
|
||||||
youCanSaveMultipleEmails: Puede guardar varios correos electrónicos encadenándolos mediante comas sin espacios{','} ejemplo{':'} user{'@'}dominio{'.'}com, user2{'@'}dominio{'.'}com siendo el primer correo electrónico el principal
|
|
||||||
email: Email
|
|
||||||
phone: Teléfono
|
|
||||||
mobile: Móvil
|
|
||||||
salesPerson: Comercial
|
|
||||||
contactChannel: Canal de contacto
|
|
||||||
previousClient: Cliente anterior
|
|
||||||
extendedList:
|
|
||||||
tableVisibleColumns:
|
|
||||||
id: Identificador
|
|
||||||
name: Nombre
|
|
||||||
socialName: Razón social
|
|
||||||
fi: NIF / CIF
|
|
||||||
salesPersonFk: Comercial
|
|
||||||
credit: Crédito
|
|
||||||
creditInsurance: Crédito asegurado
|
|
||||||
phone: Teléfono
|
|
||||||
mobile: Móvil
|
|
||||||
street: Dirección fiscal
|
|
||||||
countryFk: País
|
|
||||||
provinceFk: Provincia
|
|
||||||
city: Población
|
|
||||||
postcode: Código postal
|
|
||||||
email: Email
|
|
||||||
created: Fecha creación
|
|
||||||
businessTypeFk: Tipo de negocio
|
|
||||||
payMethodFk: Forma de pago
|
|
||||||
sageTaxTypeFk: Tipo de impuesto Sage
|
|
||||||
sageTransactionTypeFk: Tipo tr. sage
|
|
||||||
isActive: Activo
|
|
||||||
isVies: Vies
|
|
||||||
isTaxDataChecked: Datos comprobados
|
|
||||||
isEqualizated: Recargo de equivalencias
|
|
||||||
isFreezed: Congelado
|
|
||||||
hasToInvoice: Factura
|
|
||||||
hasToInvoiceByAddress: Factura por consigna
|
|
||||||
isToBeMailed: Env. emails
|
|
||||||
hasLcr: Recibido LCR
|
|
||||||
hasCoreVnl: Recibido core VNL
|
|
||||||
hasSepaVnl: Recibido B2B VNL
|
|
||||||
entry:
|
entry:
|
||||||
list:
|
list:
|
||||||
newEntry: Nueva entrada
|
newEntry: Nueva entrada
|
||||||
|
@ -799,54 +680,6 @@ parking:
|
||||||
searchBar:
|
searchBar:
|
||||||
info: Puedes buscar por código de parking
|
info: Puedes buscar por código de parking
|
||||||
label: Buscar parking...
|
label: Buscar parking...
|
||||||
invoiceIn:
|
|
||||||
list:
|
|
||||||
ref: Referencia
|
|
||||||
supplier: Proveedor
|
|
||||||
supplierRef: Ref. proveedor
|
|
||||||
serialNumber: Num. serie
|
|
||||||
shortIssued: F. emisión
|
|
||||||
serial: Serie
|
|
||||||
file: Fichero
|
|
||||||
issued: Fecha emisión
|
|
||||||
isBooked: Conciliada
|
|
||||||
awb: AWB
|
|
||||||
amount: Importe
|
|
||||||
card:
|
|
||||||
issued: Fecha emisión
|
|
||||||
amount: Importe
|
|
||||||
client: Cliente
|
|
||||||
company: Empresa
|
|
||||||
customerCard: Ficha del cliente
|
|
||||||
ticketList: Listado de tickets
|
|
||||||
vat: Iva
|
|
||||||
dueDay: Fecha de vencimiento
|
|
||||||
summary:
|
|
||||||
supplier: Proveedor
|
|
||||||
supplierRef: Ref. proveedor
|
|
||||||
currency: Divisa
|
|
||||||
docNumber: Número documento
|
|
||||||
issued: Fecha de expedición
|
|
||||||
operated: Fecha operación
|
|
||||||
bookEntried: Fecha asiento
|
|
||||||
bookedDate: Fecha contable
|
|
||||||
sage: Retención sage
|
|
||||||
vat: Iva no deducible
|
|
||||||
company: Empresa
|
|
||||||
booked: Contabilizada
|
|
||||||
expense: Gasto
|
|
||||||
taxableBase: Base imp.
|
|
||||||
rate: Tasa
|
|
||||||
sageTransaction: Sage transación
|
|
||||||
dueDay: Fecha
|
|
||||||
bank: Caja
|
|
||||||
amount: Importe
|
|
||||||
foreignValue: Divisa
|
|
||||||
dueTotal: Vencimiento
|
|
||||||
code: Código
|
|
||||||
net: Neto
|
|
||||||
stems: Tallos
|
|
||||||
country: País
|
|
||||||
department:
|
department:
|
||||||
pageTitles:
|
pageTitles:
|
||||||
basicData: Basic data
|
basicData: Basic data
|
||||||
|
@ -1278,6 +1111,7 @@ components:
|
||||||
active: Activo
|
active: Activo
|
||||||
visible: Visible
|
visible: Visible
|
||||||
floramondo: Floramondo
|
floramondo: Floramondo
|
||||||
|
showBadDates: Ver items a futuro
|
||||||
userPanel:
|
userPanel:
|
||||||
copyToken: Token copiado al portapapeles
|
copyToken: Token copiado al portapapeles
|
||||||
settings: Configuración
|
settings: Configuración
|
||||||
|
|
|
@ -27,15 +27,15 @@ const filter = {
|
||||||
order: 'created DESC',
|
order: 'created DESC',
|
||||||
};
|
};
|
||||||
|
|
||||||
const urlPath = 'AccessTokens';
|
const urlPath = 'VnTokens';
|
||||||
|
|
||||||
const refresh = () => paginateRef.value.fetch();
|
const refresh = () => paginateRef.value.fetch();
|
||||||
|
|
||||||
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
||||||
|
|
||||||
const killSession = async (id) => {
|
const killSession = async ({ userId, created }) => {
|
||||||
try {
|
try {
|
||||||
await axios.delete(`${urlPath}/${id}`);
|
await axios.post(`${urlPath}/killSession`, { userId, created });
|
||||||
paginateRef.value.fetch();
|
paginateRef.value.fetch();
|
||||||
notify(t('Session killed'), 'positive');
|
notify(t('Session killed'), 'positive');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -84,7 +84,7 @@ const killSession = async (id) => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('Session will be killed'),
|
t('Session will be killed'),
|
||||||
t('Are you sure you want to continue?'),
|
t('Are you sure you want to continue?'),
|
||||||
() => killSession(row.id)
|
() => killSession(row)
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
outline
|
outline
|
||||||
|
|
|
@ -19,7 +19,15 @@ watch(
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" />
|
<FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" />
|
||||||
<FormModel ref="formModelRef" model="AccountPrivileges" url="VnUsers" auto-load>
|
<FormModel
|
||||||
|
ref="formModelRef"
|
||||||
|
model="AccountPrivileges"
|
||||||
|
url="VnUsers/preview"
|
||||||
|
:filter="{ where: { id: route.params.id } }"
|
||||||
|
:url-create="`VnUsers/${route.params.id}/privileges`"
|
||||||
|
:id="route.params.id"
|
||||||
|
auto-load
|
||||||
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<div class="q-gutter-y-sm">
|
<div class="q-gutter-y-sm">
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
|
|
|
@ -45,7 +45,7 @@ async function onFetchClaim(data) {
|
||||||
|
|
||||||
const amount = ref();
|
const amount = ref();
|
||||||
const amountClaimed = ref();
|
const amountClaimed = ref();
|
||||||
async function onFetch(rows, newRows) {
|
function onFetch(rows, newRows) {
|
||||||
if (newRows) rows = newRows;
|
if (newRows) rows = newRows;
|
||||||
amount.value = 0;
|
amount.value = 0;
|
||||||
amountClaimed.value = 0;
|
amountClaimed.value = 0;
|
||||||
|
@ -155,7 +155,7 @@ function showImportDialog() {
|
||||||
async function saveWhenHasChanges() {
|
async function saveWhenHasChanges() {
|
||||||
if (claimLinesForm.value.getChanges().updates) {
|
if (claimLinesForm.value.getChanges().updates) {
|
||||||
await claimLinesForm.value.onSubmit();
|
await claimLinesForm.value.onSubmit();
|
||||||
await claimLinesForm.value.reload();
|
onFetch(claimLinesForm.value.formData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -211,7 +211,7 @@ async function saveWhenHasChanges() {
|
||||||
<template #body-cell-claimed="{ row }">
|
<template #body-cell-claimed="{ row }">
|
||||||
<QTd auto-width align="right" class="text-primary">
|
<QTd auto-width align="right" class="text-primary">
|
||||||
<QInput
|
<QInput
|
||||||
v-model="row.quantity"
|
v-model.number="row.quantity"
|
||||||
type="number"
|
type="number"
|
||||||
dense
|
dense
|
||||||
@keyup.enter="saveWhenHasChanges()"
|
@keyup.enter="saveWhenHasChanges()"
|
||||||
|
@ -266,7 +266,9 @@ async function saveWhenHasChanges() {
|
||||||
<template v-if="column.name === 'claimed'">
|
<template v-if="column.name === 'claimed'">
|
||||||
<QItemLabel class="text-primary">
|
<QItemLabel class="text-primary">
|
||||||
<QInput
|
<QInput
|
||||||
v-model="props.row.quantity"
|
v-model.number="
|
||||||
|
props.row.quantity
|
||||||
|
"
|
||||||
type="number"
|
type="number"
|
||||||
dense
|
dense
|
||||||
autofocus
|
autofocus
|
||||||
|
|
|
@ -94,8 +94,8 @@ const detailsColumns = ref([
|
||||||
{
|
{
|
||||||
name: 'total',
|
name: 'total',
|
||||||
label: 'claim.total',
|
label: 'claim.total',
|
||||||
field: ({ sale }) =>
|
field: (row) =>
|
||||||
toCurrency(sale.quantity * sale.price * ((100 - sale.discount) / 100)),
|
toCurrency(row.quantity * row.sale.price * ((100 - row.sale.discount) / 100)),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { computed, onBeforeMount, ref } 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 { useAcl } from 'src/composables/useAcl';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescr
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const { sendEmail } = usePrintService();
|
const { sendEmail } = usePrintService();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { hasAny } = useRole();
|
const { hasAny } = useAcl();
|
||||||
|
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const tokenMultimedia = session.getTokenMultimedia();
|
const tokenMultimedia = session.getTokenMultimedia();
|
||||||
|
@ -95,12 +95,7 @@ const columns = computed(() => [
|
||||||
label: t('Employee'),
|
label: t('Employee'),
|
||||||
columnField: {
|
columnField: {
|
||||||
component: 'userLink',
|
component: 'userLink',
|
||||||
attrs: ({ row }) => {
|
attrs: ({ row }) => ({ workerId: row.workerFk, tag: row.userName }),
|
||||||
return {
|
|
||||||
workerId: row.workerFk,
|
|
||||||
name: row.userName,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
|
@ -259,6 +254,7 @@ const showBalancePdf = ({ id }) => {
|
||||||
:is-editable="false"
|
:is-editable="false"
|
||||||
:column-search="false"
|
:column-search="false"
|
||||||
@on-fetch="onFetch"
|
@on-fetch="onFetch"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #column-balance="{ rowIndex }">
|
<template #column-balance="{ rowIndex }">
|
||||||
|
@ -284,7 +280,9 @@ const showBalancePdf = ({ id }) => {
|
||||||
>
|
>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="scope.value"
|
v-model="scope.value"
|
||||||
:disable="!hasAny(['administrative'])"
|
:disable="
|
||||||
|
!hasAny([{ model: 'Receipt', props: '*', accessType: 'WRITE' }])
|
||||||
|
"
|
||||||
@keypress.enter="scope.set"
|
@keypress.enter="scope.set"
|
||||||
autofocus
|
autofocus
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -25,6 +25,7 @@ const title = ref();
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="BusinessTypes"
|
url="BusinessTypes"
|
||||||
|
:filter="{ fields: ['code', 'description'], order: 'description ASC ' }"
|
||||||
@on-fetch="(data) => (businessTypes = data)"
|
@on-fetch="(data) => (businessTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
@ -38,7 +39,7 @@ const title = ref();
|
||||||
clearable
|
clearable
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
/>
|
/>
|
||||||
<QSelect
|
<VnSelect
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
:label="t('customer.basicData.businessType')"
|
:label="t('customer.basicData.businessType')"
|
||||||
:options="businessTypes"
|
:options="businessTypes"
|
||||||
|
@ -89,20 +90,18 @@ const title = ref();
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Workers/activeWithInheritedRole"
|
url="Workers/search"
|
||||||
:filter="{ where: { role: 'salesPerson' } }"
|
|
||||||
option-filter="firstName"
|
|
||||||
v-model="data.salesPersonFk"
|
v-model="data.salesPersonFk"
|
||||||
:label="t('customer.basicData.salesPerson')"
|
:label="t('customer.basicData.salesPerson')"
|
||||||
|
:params="{
|
||||||
|
departmentCodes: ['VT', 'shopping'],
|
||||||
|
}"
|
||||||
|
:fields="['id', 'nickname']"
|
||||||
|
sort-by="nickname ASC"
|
||||||
:rules="validate('client.salesPersonFk')"
|
:rules="validate('client.salesPersonFk')"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
:emit-value="false"
|
emit-value
|
||||||
@update:model-value="
|
auto-load
|
||||||
(val) => {
|
|
||||||
title = val?.nickname;
|
|
||||||
data.salesPersonFk = val?.id;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VnAvatar
|
<VnAvatar
|
||||||
|
@ -111,8 +110,19 @@ const title = ref();
|
||||||
:title="title"
|
:title="title"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||||
|
<QItemLabel caption
|
||||||
|
>{{ scope.opt?.nickname }},
|
||||||
|
{{ scope.opt?.code }}</QItemLabel
|
||||||
|
>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<QSelect
|
<VnSelect
|
||||||
v-model="data.contactChannelFk"
|
v-model="data.contactChannelFk"
|
||||||
:options="contactChannels"
|
:options="contactChannels"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -125,7 +135,9 @@ const title = ref();
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QSelect
|
<VnSelect
|
||||||
|
url="Clients"
|
||||||
|
:where="{ id: { neq: $route.params.id } }"
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
:label="t('customer.basicData.previousClient')"
|
:label="t('customer.basicData.previousClient')"
|
||||||
:options="clients"
|
:options="clients"
|
||||||
|
@ -134,7 +146,9 @@ const title = ref();
|
||||||
map-options
|
map-options
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
sort-by="name ASC"
|
||||||
v-model="data.transferorFk"
|
v-model="data.transferorFk"
|
||||||
|
:fields="['id', 'name']"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon name="info" class="cursor-pointer">
|
<QIcon name="info" class="cursor-pointer">
|
||||||
|
@ -145,7 +159,7 @@ const title = ref();
|
||||||
}}</QTooltip>
|
}}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</template>
|
</template>
|
||||||
</QSelect>
|
</VnSelect>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
|
|
|
@ -31,8 +31,8 @@ const getBankEntities = (data, formData) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<fetch-data @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
|
<FetchData @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
|
||||||
<fetch-data
|
<FetchData
|
||||||
ref="bankEntitiesRef"
|
ref="bankEntitiesRef"
|
||||||
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
|
@ -70,7 +70,7 @@ const getBankEntities = (data, formData) => {
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('Swift / BIC')"
|
:label="t('Swift / BIC')"
|
||||||
:options="bankEntitiesOptions"
|
:options="bankEntitiesOptions"
|
||||||
:roles-allowed-to-create="['salesAssistant', 'hr']"
|
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
|
||||||
:rules="validate('Worker.bankEntity')"
|
:rules="validate('Worker.bankEntity')"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
@ -85,9 +85,8 @@ const getBankEntities = (data, formData) => {
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection v-if="scope.opt">
|
<QItemSection v-if="scope.opt">
|
||||||
<QItemLabel
|
<QItemLabel>{{ scope.opt.bic }} </QItemLabel>
|
||||||
>{{ scope.opt.bic }} {{ scope.opt.name }}</QItemLabel
|
<QItemLabel caption> {{ scope.opt.name }}</QItemLabel>
|
||||||
>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,17 +1,23 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import CustomerDescriptor from './CustomerDescriptor.vue';
|
import CustomerDescriptor from './CustomerDescriptor.vue';
|
||||||
import CustomerFilter from '../CustomerFilter.vue';
|
import CustomerFilter from '../CustomerFilter.vue';
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
const routeName = computed(() => route.name);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Client"
|
data-key="Client"
|
||||||
base-url="Clients"
|
base-url="Clients"
|
||||||
:descriptor="CustomerDescriptor"
|
:descriptor="CustomerDescriptor"
|
||||||
:filter-panel="CustomerFilter"
|
:filter-panel="routeName != 'CustomerConsumption' && CustomerFilter"
|
||||||
search-data-key="CustomerList"
|
search-data-key="CustomerList"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: 'Clients/extendedListFilter',
|
url: 'Clients/filter',
|
||||||
label: 'Search customer',
|
label: 'Search customer',
|
||||||
info: 'You can search by customer id or name',
|
info: 'You can search by customer id or name',
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -1,15 +1,241 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import CustomerConsumptionFilter from './CustomerConsumptionFilter.vue';
|
import { ref, computed, onBeforeMount } from 'vue';
|
||||||
import { useStateStore } from 'src/stores/useStateStore';
|
import axios from 'axios';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { toDate } from 'src/filters/index';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { usePrintService } from 'src/composables/usePrintService';
|
||||||
|
import { useVnConfirm } from 'src/composables/useVnConfirm';
|
||||||
|
|
||||||
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
const { openReport, sendEmail } = usePrintService();
|
||||||
|
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||||
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
|
|
||||||
|
const arrayData = useArrayData('Client');
|
||||||
|
const { t } = useI18n();
|
||||||
|
const route = useRoute();
|
||||||
|
const campaignList = ref();
|
||||||
|
const showActionBtns = computed(() => handleQueryParams());
|
||||||
|
function handleQueryParams() {
|
||||||
|
const query = getQueryParams();
|
||||||
|
return query.from && query.to;
|
||||||
|
}
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
name: 'search',
|
||||||
|
align: 'left',
|
||||||
|
label: t('globals.search'),
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'itemFk',
|
||||||
|
align: 'left',
|
||||||
|
label: t('globals.item'),
|
||||||
|
columnClass: 'shrink',
|
||||||
|
cardVisible: true,
|
||||||
|
columnFilter: {
|
||||||
|
name: 'itemId',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ticketFk',
|
||||||
|
align: 'left',
|
||||||
|
label: t('globals.ticket'),
|
||||||
|
cardVisible: true,
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'shipped',
|
||||||
|
align: 'left',
|
||||||
|
label: t('globals.shipped'),
|
||||||
|
format: ({ shipped }) => toDate(shipped),
|
||||||
|
columnFilter: false,
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
align: 'left',
|
||||||
|
label: t('globals.description'),
|
||||||
|
columnClass: 'expand',
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'quantity',
|
||||||
|
label: t('globals.quantity'),
|
||||||
|
cardVisible: true,
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'grouped',
|
||||||
|
label: t('Group by items'),
|
||||||
|
component: 'checkbox',
|
||||||
|
visible: false,
|
||||||
|
orderBy: false,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
campaignList.value = (await axios('Campaigns/latest')).data;
|
||||||
|
});
|
||||||
|
|
||||||
|
function getQueryParams() {
|
||||||
|
return JSON.parse(route.query.consumption ?? '{}');
|
||||||
|
}
|
||||||
|
function getParams() {
|
||||||
|
const query = getQueryParams();
|
||||||
|
return {
|
||||||
|
from: query.from,
|
||||||
|
to: query.to,
|
||||||
|
recipient: arrayData.store.data.email,
|
||||||
|
recipientId: arrayData.store.data.id,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const userParams = computed(() => {
|
||||||
|
const minDate = Date.vnNew();
|
||||||
|
minDate.setHours(0, 0, 0, 0);
|
||||||
|
minDate.setMonth(minDate.getMonth() - 2);
|
||||||
|
|
||||||
|
const maxDate = Date.vnNew();
|
||||||
|
maxDate.setHours(23, 59, 59, 59);
|
||||||
|
|
||||||
|
return {
|
||||||
|
campaign: campaignList.value[0]?.id,
|
||||||
|
from: minDate,
|
||||||
|
to: maxDate,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const openReportPdf = () => {
|
||||||
|
openReport(`Clients/${route.params.id}/campaign-metrics-pdf`, getParams());
|
||||||
|
};
|
||||||
|
|
||||||
|
const openSendEmailDialog = async () => {
|
||||||
|
openConfirmationModal(
|
||||||
|
t('The consumption report will be sent'),
|
||||||
|
t('Please, confirm'),
|
||||||
|
() => sendCampaignMetricsEmail({ address: arrayData.store.data.email })
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
|
sendEmail(`Clients/${route.params.id}/campaign-metrics-email`, {
|
||||||
|
recipient: address,
|
||||||
|
...getParams(),
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Teleport to="#right-panel" v-if="useStateStore().isHeaderMounted()">
|
<VnTable
|
||||||
<CustomerConsumptionFilter data-key="CustomerConsumption" />
|
v-if="campaignList"
|
||||||
</Teleport>
|
data-key="CustomerConsumption"
|
||||||
|
url="Clients/consumption"
|
||||||
|
:order="['itemTypeFk', 'itemName', 'itemSize', 'description']"
|
||||||
|
:columns="columns"
|
||||||
|
search-url="consumption"
|
||||||
|
:filter="filter"
|
||||||
|
:user-params="userParams"
|
||||||
|
:default-remove="false"
|
||||||
|
:default-reset="false"
|
||||||
|
:default-save="false"
|
||||||
|
:has-sub-toolbar="true"
|
||||||
|
auto-load
|
||||||
|
>
|
||||||
|
<template #moreBeforeActions>
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
icon-right="picture_as_pdf"
|
||||||
|
@click="openReportPdf()"
|
||||||
|
:disabled="!showActionBtns"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('globals.downloadPdf') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
icon-right="email"
|
||||||
|
@click="openSendEmailDialog()"
|
||||||
|
:disabled="!showActionBtns"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('Send to email') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</template>
|
||||||
|
<template #column-itemFk="{ row }">
|
||||||
|
<span class="link">
|
||||||
|
{{ row.itemFk }}
|
||||||
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template #column-ticketFk="{ row }">
|
||||||
|
<span class="link">
|
||||||
|
{{ row.ticketFk }}
|
||||||
|
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template #column-description="{ row }">
|
||||||
|
<div>{{ row.concept }}</div>
|
||||||
|
<div v-if="row.subName" class="subName">
|
||||||
|
{{ row.subName }}
|
||||||
|
</div>
|
||||||
|
<FetchedTags :item="row" :max-length="3" />
|
||||||
|
</template>
|
||||||
|
<template #moreFilterPanel="{ params }">
|
||||||
|
<div class="column no-wrap flex-center q-gutter-y-md q-mt-xs q-pr-xl">
|
||||||
|
<VnSelect
|
||||||
|
v-model="params.campaign"
|
||||||
|
:options="campaignList"
|
||||||
|
:label="t('globals.campaign')"
|
||||||
|
:filled="true"
|
||||||
|
class="q-px-sm q-pt-none fit"
|
||||||
|
dense
|
||||||
|
option-label="code"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt?.code }}
|
||||||
|
{{
|
||||||
|
new Date(scope.opt?.dated).getFullYear()
|
||||||
|
}}</QItemLabel
|
||||||
|
>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
<VnInputDate
|
||||||
|
v-model="params.from"
|
||||||
|
:label="t('globals.from')"
|
||||||
|
:filled="true"
|
||||||
|
class="q-px-xs q-pt-none fit"
|
||||||
|
dense
|
||||||
|
/>
|
||||||
|
<VnInputDate
|
||||||
|
v-model="params.to"
|
||||||
|
:label="t('globals.to')"
|
||||||
|
:filled="true"
|
||||||
|
class="q-px-xs q-pt-none fit"
|
||||||
|
dense
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Enter a new search: Introduce una nueva búsqueda
|
Enter a new search: Introduce una nueva búsqueda
|
||||||
|
Group by items: Agrupar por artículos
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,91 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
import { QItem } from 'quasar';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import { QItemSection } from 'quasar';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
defineProps({ dataKey: { type: String, required: true } });
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
|
||||||
<template #tags="{ tag, formatFn }">
|
|
||||||
<div class="q-gutter-x-xs">
|
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #body="{ params }">
|
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
|
||||||
<VnInput
|
|
||||||
:label="t('params.item')"
|
|
||||||
v-model="params.itemId"
|
|
||||||
is-outlined
|
|
||||||
lazy-rules
|
|
||||||
/>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
|
||||||
<VnSelect
|
|
||||||
v-model="params.buyerId"
|
|
||||||
url="TicketRequests/getItemTypeWorker"
|
|
||||||
:label="t('params.buyer')"
|
|
||||||
option-value="id"
|
|
||||||
option-label="nickname"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
rounded
|
|
||||||
/>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
<!--It's required to include the relation category !! There's 413 records in production-->
|
|
||||||
<QItemSection>
|
|
||||||
<VnSelect
|
|
||||||
v-model="params.typeId"
|
|
||||||
url="ItemTypes"
|
|
||||||
:label="t('params.type')"
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
rounded
|
|
||||||
>
|
|
||||||
</VnSelect>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
|
||||||
<VnSelect
|
|
||||||
url="ItemCategories"
|
|
||||||
:label="t('params.category')"
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="params.categoryId"
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
rounded
|
|
||||||
/>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnFilterPanel>
|
|
||||||
</template>
|
|
||||||
<i18n>
|
|
||||||
en:
|
|
||||||
params:
|
|
||||||
item: Item id
|
|
||||||
buyer: Buyer
|
|
||||||
type: Type
|
|
||||||
category: Category
|
|
||||||
es:
|
|
||||||
params:
|
|
||||||
item: Id artículo
|
|
||||||
buyer: Comprador
|
|
||||||
type: Tipo
|
|
||||||
category: Categoría
|
|
||||||
</i18n>
|
|
|
@ -53,6 +53,8 @@ const openDialog = (item) => {
|
||||||
promise: updateData,
|
promise: updateData,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
updateData();
|
||||||
|
showQPageSticky.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const openViewCredit = (credit) => {
|
const openViewCredit = (credit) => {
|
||||||
|
|
|
@ -1,23 +1,17 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, watch } 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 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
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 WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const clientInformasRef = ref(null);
|
const tableRef = ref();
|
||||||
const rows = ref([]);
|
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -37,10 +31,9 @@ const filter = {
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'created',
|
format: ({ created }) => toDateHourMin(created),
|
||||||
format: (value) => toDateHourMin(value),
|
|
||||||
label: t('Since'),
|
label: t('Since'),
|
||||||
name: 'since',
|
name: 'created',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -53,64 +46,54 @@ const columns = computed(() => [
|
||||||
field: 'rating',
|
field: 'rating',
|
||||||
label: t('Rating'),
|
label: t('Rating'),
|
||||||
name: 'rating',
|
name: 'rating',
|
||||||
|
create: true,
|
||||||
|
columnCreate: {
|
||||||
|
component: 'number',
|
||||||
|
autofocus: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'recommendedCredit',
|
field: 'recommendedCredit',
|
||||||
format: (value) => toCurrency(value),
|
format: ({ recommendedCredit }) => toCurrency(recommendedCredit),
|
||||||
label: t('Recommended credit'),
|
label: t('Recommended credit'),
|
||||||
name: 'recommendedCredit',
|
name: 'recommendedCredit',
|
||||||
|
create: true,
|
||||||
|
columnCreate: {
|
||||||
|
component: 'number',
|
||||||
|
autofocus: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.params.id,
|
|
||||||
(newValue) => {
|
|
||||||
if (!newValue) return;
|
|
||||||
filter.where.clientFk = newValue;
|
|
||||||
clientInformasRef.value?.fetch();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<VnTable
|
||||||
:filter="filter"
|
ref="tableRef"
|
||||||
@on-fetch="(data) => (rows = data)"
|
data-key="ClientInformas"
|
||||||
auto-load
|
|
||||||
ref="clientInformasRef"
|
|
||||||
url="ClientInformas"
|
url="ClientInformas"
|
||||||
/>
|
:filter="filter"
|
||||||
|
:order="['created DESC']"
|
||||||
<FormModel
|
:columns="columns"
|
||||||
:form-initial-data="{}"
|
:right-search="false"
|
||||||
:observe-form-changes="false"
|
:is-editable="false"
|
||||||
:url-create="`Clients/${route.params.id}/setRating`"
|
:use-model="true"
|
||||||
|
:column-search="false"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
|
auto-load
|
||||||
|
:create="{
|
||||||
|
urlCreate: `Clients/${route.params.id}/setRating`,
|
||||||
|
title: 'Create rating',
|
||||||
|
onDataSaved: () => tableRef.reload(),
|
||||||
|
formInitialData: {},
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #column-employee="{ row }">
|
||||||
<VnRow>
|
<span class="link" @click.stop>{{ row.worker.user.nickname }}</span>
|
||||||
<div class="col">
|
<WorkerDescriptorProxy :id="row.clientFk" />
|
||||||
<VnInput
|
|
||||||
:label="t('Rating')"
|
|
||||||
clearable
|
|
||||||
type="number"
|
|
||||||
v-model.number="data.rating"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<VnInput
|
|
||||||
:label="t('Recommended credit')"
|
|
||||||
clearable
|
|
||||||
type="number"
|
|
||||||
v-model.number="data.recommendedCredit"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</VnTable>
|
||||||
|
<!-- <QTable
|
||||||
<div class="full-width flex justify-center" v-if="rows.length">
|
|
||||||
<QTable
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
|
@ -120,17 +103,12 @@ watch(
|
||||||
class="card-width q-px-lg"
|
class="card-width q-px-lg"
|
||||||
>
|
>
|
||||||
<template #body-cell-employee="{ row }">
|
<template #body-cell-employee="{ row }">
|
||||||
<QTd auto-width @click.stop>
|
<QTd @click.stop>
|
||||||
<QBtn color="blue" flat no-caps>{{ row.worker.user.nickname }}</QBtn>
|
<span class="link">{{ row.worker.user.nickname }}</span>
|
||||||
<WorkerDescriptorProxy :id="row.clientFk" />
|
<WorkerDescriptorProxy :id="row.clientFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable> -->
|
||||||
</div>
|
|
||||||
|
|
||||||
<h5 class="flex justify-center color-vn-label" v-else>
|
|
||||||
{{ t('globals.noResults') }}
|
|
||||||
</h5>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { ref, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import { toCurrency, toDate } from 'src/filters';
|
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||||
|
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
|
|
||||||
|
@ -11,6 +11,10 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue';
|
import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue';
|
||||||
|
import { useState } from 'src/composables/useState';
|
||||||
|
const state = useState();
|
||||||
|
|
||||||
|
const customer = computed(() => state.get('customer'));
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -43,7 +47,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
:subtitle="data.subtitle"
|
:subtitle="data.subtitle"
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
:summary="$props.summary"
|
:summary="$props.summary"
|
||||||
data-key="customerData"
|
data-key="customer"
|
||||||
>
|
>
|
||||||
<template #menu="{ entity }">
|
<template #menu="{ entity }">
|
||||||
<CustomerDescriptorMenu :customer="entity" />
|
<CustomerDescriptorMenu :customer="entity" />
|
||||||
|
@ -57,35 +61,46 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
:value="toCurrency(entity.creditInsurance)"
|
:value="toCurrency(entity.creditInsurance)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnLv :label="t('customer.card.debt')" :value="toCurrency(entity.debt)" />
|
<VnLv
|
||||||
<VnLv v-if="entity.salesPersonUser" :label="t('customer.card.salesPerson')">
|
:label="t('customer.card.debt')"
|
||||||
|
:value="toCurrency(entity.debt)"
|
||||||
|
:info="t('customer.summary.riskInfo')"
|
||||||
|
/>
|
||||||
|
<VnLv :label="t('customer.card.salesPerson')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<VnUserLink
|
<VnUserLink
|
||||||
:name="entity.salesPersonUser?.name"
|
v-if="entity.salesPersonUser"
|
||||||
|
:name="entity.salesPersonUser.name"
|
||||||
:worker-id="entity.salesPersonFk"
|
:worker-id="entity.salesPersonFk"
|
||||||
/>
|
/>
|
||||||
|
<span v-else>{{ dashIfEmpty(entity.salesPersonUser) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.card.businessTypeFk')"
|
:label="t('customer.card.businessTypeFk')"
|
||||||
:value="entity.businessTypeFk"
|
:value="entity.businessType.description"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #icons="{ entity }">
|
<template #icons>
|
||||||
<QCardActions class="q-gutter-x-md">
|
<QCardActions v-if="customer" class="q-gutter-x-md">
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="!entity.isActive"
|
v-if="!customer.isActive"
|
||||||
name="vn:disabled"
|
name="vn:disabled"
|
||||||
size="xs"
|
size="xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip>
|
<QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="entity.isFreezed" name="vn:frozen" size="xs" color="primary">
|
<QIcon
|
||||||
|
v-if="customer.isFreezed"
|
||||||
|
name="vn:frozen"
|
||||||
|
size="xs"
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
|
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="!entity.account.active"
|
v-if="!customer.account?.active"
|
||||||
color="primary"
|
color="primary"
|
||||||
name="vn:noweb"
|
name="vn:noweb"
|
||||||
size="xs"
|
size="xs"
|
||||||
|
@ -93,7 +108,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
<QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip>
|
<QTooltip>{{ t('customer.card.webAccountInactive') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="entity.debt > entity.credit"
|
v-if="customer.debt > customer.credit"
|
||||||
name="vn:risk"
|
name="vn:risk"
|
||||||
size="xs"
|
size="xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -101,7 +116,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
|
<QTooltip>{{ t('customer.card.hasDebt') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="!entity.isTaxDataChecked"
|
v-if="!customer.isTaxDataChecked"
|
||||||
name="vn:no036"
|
name="vn:no036"
|
||||||
size="xs"
|
size="xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -109,7 +124,7 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
|
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="entity.unpaid"
|
v-if="customer.unpaid"
|
||||||
flat
|
flat
|
||||||
size="sm"
|
size="sm"
|
||||||
icon="vn:Client_unpaid"
|
icon="vn:Client_unpaid"
|
||||||
|
@ -121,13 +136,13 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
<br />
|
<br />
|
||||||
{{
|
{{
|
||||||
t('unpaidDated', {
|
t('unpaidDated', {
|
||||||
dated: toDate(entity.unpaid.dated),
|
dated: toDate(customer.unpaid.dated),
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
<br />
|
<br />
|
||||||
{{
|
{{
|
||||||
t('unpaidAmount', {
|
t('unpaidAmount', {
|
||||||
amount: toCurrency(entity.unpaid.amount),
|
amount: toCurrency(customer.unpaid.amount),
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
@ -139,7 +154,13 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
<QBtn
|
<QBtn
|
||||||
:to="{
|
:to="{
|
||||||
name: 'TicketList',
|
name: 'TicketList',
|
||||||
query: { table: JSON.stringify({ clientFk: entity.id }) },
|
query: {
|
||||||
|
from: undefined,
|
||||||
|
to: undefined,
|
||||||
|
table: JSON.stringify({
|
||||||
|
clientFk: entity.id,
|
||||||
|
}),
|
||||||
|
},
|
||||||
}"
|
}"
|
||||||
size="md"
|
size="md"
|
||||||
icon="vn:ticket"
|
icon="vn:ticket"
|
||||||
|
@ -160,23 +181,8 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<QBtn
|
<QBtn
|
||||||
:to="{
|
:to="{
|
||||||
name: 'OrderCreate',
|
name: 'AccountSummary',
|
||||||
query: { clientId: entity.id },
|
params: { id: entity.id },
|
||||||
}"
|
|
||||||
size="md"
|
|
||||||
icon="vn:basketadd"
|
|
||||||
color="primary"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ t('New order') }}</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
<QBtn
|
|
||||||
:to="{
|
|
||||||
name: 'AccountList',
|
|
||||||
query: {
|
|
||||||
table: JSON.stringify({
|
|
||||||
filter: { where: { id: entity.id } },
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
}"
|
}"
|
||||||
size="md"
|
size="md"
|
||||||
icon="face"
|
icon="face"
|
||||||
|
@ -197,7 +203,6 @@ es:
|
||||||
Go to module index: Ir al índice del módulo
|
Go to module index: Ir al índice del módulo
|
||||||
Customer ticket list: Listado de tickets del cliente
|
Customer ticket list: Listado de tickets del cliente
|
||||||
Customer invoice out list: Listado de facturas del cliente
|
Customer invoice out list: Listado de facturas del cliente
|
||||||
New order: Nuevo pedido
|
|
||||||
Go to user: Ir al usuario
|
Go to user: Ir al usuario
|
||||||
Customer unpaid: Cliente impago
|
Customer unpaid: Cliente impago
|
||||||
Unpaid: Impagado
|
Unpaid: Impagado
|
||||||
|
|
|
@ -8,6 +8,9 @@ import { useQuasar } from 'quasar';
|
||||||
import useNotify from 'src/composables/useNotify';
|
import useNotify from 'src/composables/useNotify';
|
||||||
|
|
||||||
import VnSmsDialog from 'src/components/common/VnSmsDialog.vue';
|
import VnSmsDialog from 'src/components/common/VnSmsDialog.vue';
|
||||||
|
import TicketCreateDialog from 'src/pages/Ticket/TicketCreateDialog.vue';
|
||||||
|
import OrderCreateDialog from 'src/pages/Order/Card/OrderCreateDialog.vue';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
customer: {
|
customer: {
|
||||||
|
@ -40,20 +43,32 @@ const sendSms = async (payload) => {
|
||||||
notify(error.message, 'positive');
|
notify(error.message, 'positive');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ticketCreateFormDialog = ref(null);
|
||||||
|
const openTicketCreateForm = () => {
|
||||||
|
ticketCreateFormDialog.value.show();
|
||||||
|
};
|
||||||
|
const orderCreateFormDialog = ref(null);
|
||||||
|
const openOrderCreateForm = () => {
|
||||||
|
orderCreateFormDialog.value.show();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QItem v-ripple clickable>
|
<QItem v-ripple clickable @click="openTicketCreateForm()">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<RouterLink
|
{{ t('globals.pageTitles.createTicket') }}
|
||||||
:to="{
|
<QDialog ref="ticketCreateFormDialog">
|
||||||
name: 'TicketCreate',
|
<TicketCreateDialog />
|
||||||
query: { clientFk: customer.id },
|
</QDialog>
|
||||||
}"
|
</QItemSection>
|
||||||
class="color-vn-text"
|
</QItem>
|
||||||
>
|
<QItem v-ripple clickable @click="openOrderCreateForm()">
|
||||||
{{ t('Simple ticket') }}
|
<QItemSection>
|
||||||
</RouterLink>
|
{{ t('globals.pageTitles.createOrder') }}
|
||||||
|
<QDialog ref="orderCreateFormDialog">
|
||||||
|
<OrderCreateDialog :client-fk="customer.id" />
|
||||||
|
</QDialog>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-ripple clickable>
|
<QItem v-ripple clickable>
|
||||||
|
|
|
@ -93,7 +93,7 @@ function handleLocation(data, location) {
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.postcode"
|
v-model="data.postcode"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -47,7 +47,6 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'userFk',
|
|
||||||
label: t('Created by'),
|
label: t('Created by'),
|
||||||
component: 'userLink',
|
component: 'userLink',
|
||||||
attrs: ({ row }) => {
|
attrs: ({ row }) => {
|
||||||
|
@ -73,6 +72,7 @@ const columns = computed(() => [
|
||||||
columnCreate: {
|
columnCreate: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
url: 'greugeTypes',
|
url: 'greugeTypes',
|
||||||
|
sortBy: 'name ASC ',
|
||||||
limit: 0,
|
limit: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -105,9 +105,10 @@ const setRows = (data) => {
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
:column-search="false"
|
:column-search="false"
|
||||||
@on-fetch="(data) => setRows(data)"
|
@on-fetch="(data) => setRows(data)"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: `Greuges`,
|
urlCreate: `Greuges`,
|
||||||
title: t('New credit'),
|
title: t('New greuge'),
|
||||||
onDataSaved: () => tableRef.reload(),
|
onDataSaved: () => tableRef.reload(),
|
||||||
formInitialData: { shipped: new Date(), clientFk: route.params.id },
|
formInitialData: { shipped: new Date(), clientFk: route.params.id },
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -89,6 +89,7 @@ function setFinished(id) {
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Recoveries',
|
urlCreate: 'Recoveries',
|
||||||
title: 'New recovery',
|
title: 'New recovery',
|
||||||
|
|
|
@ -3,18 +3,18 @@ import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { QBtn } from 'quasar';
|
import { QBtn, useQuasar } from 'quasar';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import { toDateTimeFormat } from 'src/filters/date';
|
import { toDateTimeFormat } from 'src/filters/date';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import { dashIfEmpty } from 'src/filters';
|
||||||
|
import CustomerSamplesCreate from '../components/CustomerSamplesCreate.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const rows = ref([]);
|
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
{ relation: 'type', scope: { fields: ['code', 'description'] } },
|
{ relation: 'type', scope: { fields: ['code', 'description'] } },
|
||||||
|
@ -26,105 +26,67 @@ const filter = {
|
||||||
limit: 20,
|
limit: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
const tableColumnComponents = {
|
|
||||||
sent: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
worker: {
|
|
||||||
component: QBtn,
|
|
||||||
props: () => ({ flat: true, color: 'blue', noCaps: true }),
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
company: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'created',
|
name: 'created',
|
||||||
label: t('Sent'),
|
label: t('Sent'),
|
||||||
name: 'sent',
|
format: ({ created }) => toDateTimeFormat(created),
|
||||||
format: (value) => toDateTimeFormat(value),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: (value) => value.type.description,
|
format: (row) => row.type.description,
|
||||||
label: t('Description'),
|
label: t('Description'),
|
||||||
name: 'description',
|
name: 'description',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: (value) => value.user.name,
|
|
||||||
label: t('Worker'),
|
label: t('Worker'),
|
||||||
name: 'worker',
|
name: 'worker',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: (value) => value.company?.code,
|
format: ({ company }) => company?.code ?? dashIfEmpty(company),
|
||||||
label: t('Company'),
|
label: t('Company'),
|
||||||
name: 'company',
|
name: 'company',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const toCustomerSamplesCreate = () => {
|
const toCustomerSamplesCreate = () => {
|
||||||
router.push({ name: 'CustomerSamplesCreate' });
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: CustomerSamplesCreate,
|
||||||
|
})
|
||||||
|
.onOk(() => tableRef.value.reload());
|
||||||
};
|
};
|
||||||
|
const tableRef = ref();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<VnTable
|
||||||
:filter="filter"
|
ref="tableRef"
|
||||||
@on-fetch="(data) => (rows = data)"
|
data-key="ClientSamples"
|
||||||
auto-load
|
auto-load
|
||||||
|
:filter="filter"
|
||||||
url="ClientSamples"
|
url="ClientSamples"
|
||||||
/>
|
:columns="columns"
|
||||||
|
:pagination="{ rowsPerPage: 12 }"
|
||||||
<div class="full-width flex justify-center">
|
:disable-option="{ card: true }"
|
||||||
<QPage class="card-width q-pa-lg">
|
:rows="rows"
|
||||||
<QTable
|
class="full-width q-mt-md"
|
||||||
:columns="columns"
|
row-key="id"
|
||||||
:pagination="{ rowsPerPage: 12 }"
|
:create="false"
|
||||||
:rows="rows"
|
:no-data-label="t('globals.noResults')"
|
||||||
class="full-width q-mt-md"
|
>
|
||||||
row-key="id"
|
<template #column-worker="{ row }">
|
||||||
:no-data-label="t('globals.noResults')"
|
<div v-if="row.user">
|
||||||
>
|
<span class="link">{{ row.user?.name }}</span
|
||||||
<template #body-cell="props">
|
><WorkerDescriptorProxy :id="row.userFk" />
|
||||||
<QTd :props="props">
|
</div>
|
||||||
<QTr :props="props" class="cursor-pointer">
|
<span v-else>{{ dashIfEmpty(row.user) }}</span>
|
||||||
<component
|
</template>
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
</VnTable>
|
||||||
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 === 'worker'"
|
|
||||||
/>
|
|
||||||
</component>
|
|
||||||
</QTr>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
</QTable>
|
|
||||||
</QPage>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<QPageSticky :offset="[18, 18]">
|
<QPageSticky :offset="[18, 18]">
|
||||||
<QBtn @click.stop="toCustomerSamplesCreate()" color="primary" fab icon="add" />
|
<QBtn @click.stop="toCustomerSamplesCreate()" color="primary" fab icon="add" />
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
|
|
||||||
import { toCurrency, toPercentage, toDate } from 'src/filters';
|
import { toCurrency, toPercentage, toDate } from 'src/filters';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import CustomerSummaryTable from 'src/pages/Customer/components/CustomerSummaryTable.vue';
|
import CustomerSummaryTable from 'src/pages/Customer/components/CustomerSummaryTable.vue';
|
||||||
|
@ -23,11 +24,6 @@ const $props = defineProps({
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const customer = computed(() => summary.value.entity);
|
const customer = computed(() => summary.value.entity);
|
||||||
const summary = ref();
|
const summary = ref();
|
||||||
const clientUrl = ref();
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
clientUrl.value = (await getUrl('client/')) + entityId.value + '/';
|
|
||||||
});
|
|
||||||
|
|
||||||
const balanceDue = computed(() => {
|
const balanceDue = computed(() => {
|
||||||
return (
|
return (
|
||||||
|
@ -40,11 +36,11 @@ const balanceDue = computed(() => {
|
||||||
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
||||||
|
|
||||||
const claimRate = computed(() => {
|
const claimRate = computed(() => {
|
||||||
return customer.value.claimsRatio.claimingRate;
|
return customer.value.claimsRatio?.claimingRate ?? 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
const priceIncreasingRate = computed(() => {
|
const priceIncreasingRate = computed(() => {
|
||||||
return customer.value.claimsRatio.priceIncreasing / 100;
|
return customer.value.claimsRatio?.priceIncreasing ?? 0 / 100;
|
||||||
});
|
});
|
||||||
|
|
||||||
const debtWarning = computed(() => {
|
const debtWarning = computed(() => {
|
||||||
|
@ -58,6 +54,11 @@ const creditWarning = computed(() => {
|
||||||
|
|
||||||
return tooMuchInsurance || noCreditInsurance ? 'negative' : '';
|
return tooMuchInsurance || noCreditInsurance ? 'negative' : '';
|
||||||
});
|
});
|
||||||
|
const sumRisk = ({ clientRisks }) => {
|
||||||
|
let total = clientRisks.reduce((acc, { amount }) => acc + amount, 0);
|
||||||
|
|
||||||
|
return total;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -91,7 +92,13 @@ const creditWarning = computed(() => {
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
:value="entity?.salesPersonUser?.name"
|
:value="entity?.salesPersonUser?.name"
|
||||||
/>
|
>
|
||||||
|
<template #value>
|
||||||
|
<VnUserLink
|
||||||
|
:name="entity.salesPersonUser?.name"
|
||||||
|
:worker-id="entity.salesPersonFk"
|
||||||
|
/> </template
|
||||||
|
></VnLv>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.contactChannel')"
|
:label="t('customer.summary.contactChannel')"
|
||||||
:value="entity?.contactChannel?.name"
|
:value="entity?.contactChannel?.name"
|
||||||
|
@ -131,7 +138,7 @@ const creditWarning = computed(() => {
|
||||||
:url="`#/customer/${entityId}/fiscal-data`"
|
:url="`#/customer/${entityId}/fiscal-data`"
|
||||||
:text="t('customer.summary.fiscalData')"
|
:text="t('customer.summary.fiscalData')"
|
||||||
/>
|
/>
|
||||||
<VnRow>
|
<VnRow class="block">
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.isEqualizated')"
|
:label="t('customer.summary.isEqualizated')"
|
||||||
:value="entity.isEqualizated"
|
:value="entity.isEqualizated"
|
||||||
|
@ -140,8 +147,6 @@ const creditWarning = computed(() => {
|
||||||
:label="t('customer.summary.isActive')"
|
:label="t('customer.summary.isActive')"
|
||||||
:value="entity.isActive"
|
:value="entity.isActive"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
|
||||||
<VnRow>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.verifiedData')"
|
:label="t('customer.summary.verifiedData')"
|
||||||
:value="entity.isTaxDataChecked"
|
:value="entity.isTaxDataChecked"
|
||||||
|
@ -150,8 +155,6 @@ const creditWarning = computed(() => {
|
||||||
:label="t('customer.summary.hasToInvoice')"
|
:label="t('customer.summary.hasToInvoice')"
|
||||||
:value="entity.hasToInvoice"
|
:value="entity.hasToInvoice"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
|
||||||
<VnRow>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.notifyByEmail')"
|
:label="t('customer.summary.notifyByEmail')"
|
||||||
:value="entity.isToBeMailed"
|
:value="entity.isToBeMailed"
|
||||||
|
@ -162,7 +165,7 @@ const creditWarning = computed(() => {
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="`#/customer/${entityId}/billing-data`"
|
:url="`#/customer/${entityId}/billing-data`"
|
||||||
:text="t('customer.summary.billingData')"
|
:text="t('customer.summary.payMethodFk')"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.payMethod')"
|
:label="t('customer.summary.payMethod')"
|
||||||
|
@ -170,7 +173,7 @@ const creditWarning = computed(() => {
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('customer.summary.bankAccount')" :value="entity.iban" />
|
<VnLv :label="t('customer.summary.bankAccount')" :value="entity.iban" />
|
||||||
<VnLv :label="t('customer.summary.dueDay')" :value="entity.dueDay" />
|
<VnLv :label="t('customer.summary.dueDay')" :value="entity.dueDay" />
|
||||||
<VnRow class="q-mt-sm" wrap>
|
<VnRow class="q-mt-sm block">
|
||||||
<VnLv :label="t('customer.summary.hasLcr')" :value="entity.hasLcr" />
|
<VnLv :label="t('customer.summary.hasLcr')" :value="entity.hasLcr" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.hasCoreVnl')"
|
:label="t('customer.summary.hasCoreVnl')"
|
||||||
|
@ -185,7 +188,7 @@ const creditWarning = computed(() => {
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one" v-if="entity.defaultAddress">
|
<QCard class="vn-one" v-if="entity.defaultAddress">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="`#/customer/${entityId}/consignees`"
|
:url="`#/customer/${entityId}/address`"
|
||||||
:text="t('customer.summary.consignee')"
|
:text="t('customer.summary.consignee')"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
|
@ -218,7 +221,7 @@ const creditWarning = computed(() => {
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one" v-if="entity.account">
|
<QCard class="vn-one" v-if="entity.account">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="`https://grafana.verdnatura.es/d/adjlxzv5yjt34d/analisis-de-clientes-7c-crm?orgId=1&var-clientFk=${entityId}`"
|
:url="`${grafanaUrl}/d/adjlxzv5yjt34d/analisis-de-clientes-7c-crm?orgId=1&var-clientFk=${entityId}`"
|
||||||
:text="t('customer.summary.businessData')"
|
:text="t('customer.summary.businessData')"
|
||||||
icon="vn:grafana"
|
icon="vn:grafana"
|
||||||
/>
|
/>
|
||||||
|
@ -231,7 +234,6 @@ const creditWarning = computed(() => {
|
||||||
:value="toCurrency(entity?.mana?.mana)"
|
:value="toCurrency(entity?.mana?.mana)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
v-if="entity.claimsRatio"
|
|
||||||
:label="t('customer.summary.priceIncreasingRate')"
|
:label="t('customer.summary.priceIncreasingRate')"
|
||||||
:value="toPercentage(priceIncreasingRate)"
|
:value="toPercentage(priceIncreasingRate)"
|
||||||
/>
|
/>
|
||||||
|
@ -240,15 +242,14 @@ const creditWarning = computed(() => {
|
||||||
:value="toCurrency(entity?.averageInvoiced?.invoiced)"
|
:value="toCurrency(entity?.averageInvoiced?.invoiced)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
v-if="entity.claimsRatio"
|
|
||||||
:label="t('customer.summary.claimRate')"
|
:label="t('customer.summary.claimRate')"
|
||||||
:value="toPercentage(claimRate)"
|
:value="toPercentage(claimRate)"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one" v-if="entity.account">
|
<QCard class="vn-one" v-if="entity.account">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="`https://grafana.verdnatura.es/d/40buzE4Vk/comportamiento-pagos-clientes?orgId=1&var-clientFk=${entityId}`"
|
:url="`${grafanaUrl}/d/40buzE4Vk/comportamiento-pagos-clientes?orgId=1&var-clientFk=${entityId}`"
|
||||||
:text="t('customer.summary.financialData')"
|
:text="t('customer.summary.payMethodFk')"
|
||||||
icon="vn:grafana"
|
icon="vn:grafana"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
|
@ -266,15 +267,13 @@ const creditWarning = computed(() => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnLv
|
<VnLv
|
||||||
v-if="entity.creditInsurance"
|
|
||||||
:label="t('customer.summary.securedCredit')"
|
:label="t('customer.summary.securedCredit')"
|
||||||
:value="toCurrency(entity.creditInsurance)"
|
:value="toCurrency(entity.creditInsurance)"
|
||||||
:info="t('customer.summary.securedCreditInfo')"
|
:info="t('customer.summary.securedCreditInfo')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.balance')"
|
:label="t('customer.summary.balance')"
|
||||||
:value="toCurrency(entity.sumRisk) || toCurrency(0)"
|
:value="toCurrency(sumRisk(entity)) || toCurrency(0)"
|
||||||
:info="t('customer.summary.balanceInfo')"
|
:info="t('customer.summary.balanceInfo')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -301,7 +300,7 @@ const creditWarning = computed(() => {
|
||||||
:value="entity.recommendedCredit"
|
:value="entity.recommendedCredit"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard>
|
||||||
<VnTitle :text="t('Latest tickets')" />
|
<VnTitle :text="t('Latest tickets')" />
|
||||||
<CustomerSummaryTable />
|
<CustomerSummaryTable />
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -151,7 +151,10 @@ watch(
|
||||||
clearable
|
clearable
|
||||||
type="number"
|
type="number"
|
||||||
v-model="amount"
|
v-model="amount"
|
||||||
/>
|
autofocus
|
||||||
|
>
|
||||||
|
<template #append>€</template></VnInput
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</QForm>
|
</QForm>
|
||||||
|
|
|
@ -86,7 +86,7 @@ function handleLocation(data, location) {
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.location"
|
v-model="data.location"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { ref, computed, markRaw } from 'vue';
|
import { ref, computed, markRaw } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
|
@ -69,7 +70,7 @@ const columns = computed(() => [
|
||||||
optionFilter: 'firstName',
|
optionFilter: 'firstName',
|
||||||
useLike: false,
|
useLike: false,
|
||||||
},
|
},
|
||||||
create: true,
|
create: false,
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
|
@ -195,6 +196,8 @@ const columns = computed(() => [
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'BusinessTypes',
|
url: 'BusinessTypes',
|
||||||
|
fields: ['code', 'description'],
|
||||||
|
sortBy: 'description ASC ',
|
||||||
optionLabel: 'description',
|
optionLabel: 'description',
|
||||||
optionValue: 'code',
|
optionValue: 'code',
|
||||||
},
|
},
|
||||||
|
@ -353,12 +356,13 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
title: t('Client ticket list'),
|
title: t('Client ticket list'),
|
||||||
icon: 'vn:ticket',
|
icon: 'vn:ticket',
|
||||||
action: redirectToCreateView,
|
action: redirectToTicketsList,
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('components.smartCard.viewSummary'),
|
title: t('components.smartCard.viewSummary'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
|
isPrimary: true,
|
||||||
action: (row) => viewSummary(row.id, CustomerSummary),
|
action: (row) => viewSummary(row.id, CustomerSummary),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -366,11 +370,12 @@ const columns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const redirectToCreateView = (row) => {
|
const redirectToTicketsList = (row) => {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'TicketList',
|
name: 'TicketList',
|
||||||
|
|
||||||
query: {
|
query: {
|
||||||
params: JSON.stringify({
|
table: JSON.stringify({
|
||||||
clientFk: row.id,
|
clientFk: row.id,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
@ -395,10 +400,10 @@ function handleLocation(data, location) {
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="Customer"
|
data-key="Customer"
|
||||||
url="Clients/extendedListFilter"
|
url="Clients/filter"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Clients/createWithUser',
|
urlCreate: 'Clients/createWithUser',
|
||||||
title: 'Create client',
|
title: t('globals.pageTitles.customerCreate'),
|
||||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
formInitialData: {
|
formInitialData: {
|
||||||
active: true,
|
active: true,
|
||||||
|
@ -411,8 +416,41 @@ function handleLocation(data, location) {
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
|
<VnSelect
|
||||||
|
url="Workers/search"
|
||||||
|
v-model="data.salesPersonFk"
|
||||||
|
:label="t('customer.basicData.salesPerson')"
|
||||||
|
:params="{
|
||||||
|
departmentCodes: ['VT', 'shopping'],
|
||||||
|
}"
|
||||||
|
:fields="['id', 'nickname']"
|
||||||
|
sort-by="nickname ASC"
|
||||||
|
:use-like="false"
|
||||||
|
emit-value
|
||||||
|
auto-load
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<VnAvatar
|
||||||
|
:worker-id="data.salesPersonFk"
|
||||||
|
color="primary"
|
||||||
|
:title="title"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||||
|
<QItemLabel caption
|
||||||
|
>{{ scope.opt?.nickname }},
|
||||||
|
{{ scope.opt?.code }}</QItemLabel
|
||||||
|
>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.location"
|
v-model="data.location"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -57,12 +57,12 @@ function handleLocation(data, location) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<fetch-data
|
<FetchData
|
||||||
@on-fetch="(data) => (agencyModes = data)"
|
@on-fetch="(data) => (agencyModes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="AgencyModes/isActive"
|
url="AgencyModes/isActive"
|
||||||
/>
|
/>
|
||||||
<fetch-data @on-fetch="(data) => (incoterms = data)" auto-load url="Incoterms" />
|
<FetchData @on-fetch="(data) => (incoterms = data)" auto-load url="Incoterms" />
|
||||||
|
|
||||||
<FormModel
|
<FormModel
|
||||||
:form-initial-data="formInitialData"
|
:form-initial-data="formInitialData"
|
||||||
|
@ -92,7 +92,7 @@ function handleLocation(data, location) {
|
||||||
|
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.location"
|
v-model="data.location"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -113,18 +113,18 @@ function handleLocation(data, location) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<fetch-data
|
<FetchData
|
||||||
@on-fetch="(data) => (agencyModes = data)"
|
@on-fetch="(data) => (agencyModes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="AgencyModes/isActive"
|
url="AgencyModes/isActive"
|
||||||
/>
|
/>
|
||||||
<fetch-data @on-fetch="(data) => (incoterms = data)" auto-load url="Incoterms" />
|
<FetchData @on-fetch="(data) => (incoterms = data)" auto-load url="Incoterms" />
|
||||||
<fetch-data
|
<FetchData
|
||||||
@on-fetch="(data) => (customsAgents = data)"
|
@on-fetch="(data) => (customsAgents = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="CustomsAgents"
|
url="CustomsAgents"
|
||||||
/>
|
/>
|
||||||
<fetch-data @on-fetch="getData" auto-load url="ObservationTypes" />
|
<FetchData @on-fetch="getData" auto-load url="ObservationTypes" />
|
||||||
|
|
||||||
<FormModel
|
<FormModel
|
||||||
:observe-form-changes="false"
|
:observe-form-changes="false"
|
||||||
|
@ -176,7 +176,7 @@ function handleLocation(data, location) {
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.postalCode"
|
v-model="data.postalCode"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
></VnLocation>
|
></VnLocation>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue';
|
import { reactive, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
@ -10,10 +10,12 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const routeId = computed(() => route.params.id);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const initialData = reactive({
|
const initialData = reactive({
|
||||||
clientFK: Number(route.params.id),
|
started: Date.vnNew(),
|
||||||
|
clientFk: routeId.value,
|
||||||
});
|
});
|
||||||
|
|
||||||
const toCustomerCreditContracts = () => {
|
const toCustomerCreditContracts = () => {
|
||||||
|
|
|
@ -1,47 +1,26 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import { toCurrency, toDateHourMinSec } from 'src/filters';
|
import { toCurrency, toDate } from 'src/filters';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const rows = ref([]);
|
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {
|
where: {
|
||||||
creditClassificationFk: `${route.params.creditId}`,
|
creditClassificationFk: `${route.params.creditId}`,
|
||||||
},
|
},
|
||||||
limit: 20,
|
limit: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
const tableColumnComponents = {
|
|
||||||
created: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
grade: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
credit: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'created',
|
field: 'created',
|
||||||
format: (value) => toDateHourMinSec(value),
|
format: ({ created }) => toDate(created),
|
||||||
label: t('Created'),
|
label: t('Created'),
|
||||||
name: 'created',
|
name: 'created',
|
||||||
},
|
},
|
||||||
|
@ -53,8 +32,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'credit',
|
format: ({ credit }) => toCurrency(credit),
|
||||||
format: (value) => toCurrency(value),
|
|
||||||
label: t('Credit'),
|
label: t('Credit'),
|
||||||
name: 'credit',
|
name: 'credit',
|
||||||
},
|
},
|
||||||
|
@ -62,41 +40,19 @@ const columns = computed(() => [
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<VnTable
|
||||||
:filter="filter"
|
|
||||||
@on-fetch="(data) => (rows = data)"
|
|
||||||
auto-load
|
|
||||||
url="CreditInsurances"
|
url="CreditInsurances"
|
||||||
/>
|
ref="tableRef"
|
||||||
|
data-key="creditInsurances"
|
||||||
<QPage class="column items-center q-pa-md" v-if="rows.length">
|
:filter="filter"
|
||||||
<QTable
|
:columns="columns"
|
||||||
:columns="columns"
|
:right-search="false"
|
||||||
:pagination="{ rowsPerPage: 12 }"
|
:is-editable="false"
|
||||||
:rows="rows"
|
:use-model="true"
|
||||||
class="full-width q-mt-md"
|
:column-search="false"
|
||||||
row-key="id"
|
:disable-option="{ card: true }"
|
||||||
>
|
auto-load
|
||||||
<template #body-cell="props">
|
></VnTable>
|
||||||
<QTd :props="props">
|
|
||||||
<QTr :props="props" class="cursor-pointer">
|
|
||||||
<component
|
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
|
||||||
class="col-content"
|
|
||||||
v-bind="tableColumnComponents[props.col.name].props(props)"
|
|
||||||
@click="tableColumnComponents[props.col.name].event(props)"
|
|
||||||
>
|
|
||||||
{{ props.value }}
|
|
||||||
</component>
|
|
||||||
</QTr>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
</QTable>
|
|
||||||
</QPage>
|
|
||||||
|
|
||||||
<h5 class="flex justify-center color-vn-label" v-else>
|
|
||||||
{{ t('globals.noResults') }}
|
|
||||||
</h5>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -83,35 +83,35 @@ const toCustomerFileManagement = () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<fetch-data
|
<FetchData
|
||||||
@on-fetch="(data) => (client = data)"
|
@on-fetch="(data) => (client = data)"
|
||||||
auto-load
|
auto-load
|
||||||
:url="`Clients/${route.params.id}/getCard`"
|
:url="`Clients/${route.params.id}/getCard`"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterFindOne"
|
:filter="filterFindOne"
|
||||||
@on-fetch="(data) => (findOne = data)"
|
@on-fetch="(data) => (findOne = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="DmsTypes/findOne"
|
url="DmsTypes/findOne"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
@on-fetch="(data) => (allowedContentTypes = data)"
|
@on-fetch="(data) => (allowedContentTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="DmsContainers/allowedContentTypes"
|
url="DmsContainers/allowedContentTypes"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterCompanies"
|
:filter="filterCompanies"
|
||||||
@on-fetch="(data) => (optionsCompanies = data)"
|
@on-fetch="(data) => (optionsCompanies = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Companies"
|
url="Companies"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterWarehouses"
|
:filter="filterWarehouses"
|
||||||
@on-fetch="(data) => (optionsWarehouses = data)"
|
@on-fetch="(data) => (optionsWarehouses = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Warehouses"
|
url="Warehouses"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterWarehouses"
|
:filter="filterWarehouses"
|
||||||
@on-fetch="(data) => (optionsDmsTypes = data)"
|
@on-fetch="(data) => (optionsDmsTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
|
|
|
@ -69,25 +69,25 @@ const toCustomerFileManagement = () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<fetch-data :url="`Dms/${route.params.dmsId}`" @on-fetch="setCurrentDms" auto-load />
|
<FetchData :url="`Dms/${route.params.dmsId}`" @on-fetch="setCurrentDms" auto-load />
|
||||||
<fetch-data
|
<FetchData
|
||||||
@on-fetch="(data) => (allowedContentTypes = data)"
|
@on-fetch="(data) => (allowedContentTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="DmsContainers/allowedContentTypes"
|
url="DmsContainers/allowedContentTypes"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterCompanies"
|
:filter="filterCompanies"
|
||||||
@on-fetch="(data) => (optionsCompanies = data)"
|
@on-fetch="(data) => (optionsCompanies = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Companies"
|
url="Companies"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterWarehouses"
|
:filter="filterWarehouses"
|
||||||
@on-fetch="(data) => (optionsWarehouses = data)"
|
@on-fetch="(data) => (optionsWarehouses = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Warehouses"
|
url="Warehouses"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterWarehouses"
|
:filter="filterWarehouses"
|
||||||
@on-fetch="(data) => (optionsDmsTypes = data)"
|
@on-fetch="(data) => (optionsDmsTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount, reactive, ref } from 'vue';
|
import { computed, onBeforeMount, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
|
import { useDialogPluginComponent, useQuasar } from 'quasar';
|
||||||
|
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
|
@ -16,7 +17,9 @@ 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 VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue';
|
import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import FormPopup from 'src/components/FormPopup.vue';
|
||||||
|
|
||||||
|
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
||||||
|
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -26,17 +29,17 @@ const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const stateStore = useStateStore();
|
const { sendEmail } = usePrintService();
|
||||||
|
|
||||||
const client = ref({});
|
|
||||||
const hasChanged = ref(false);
|
const hasChanged = ref(false);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const optionsClientsAddressess = ref([]);
|
const addressess = ref([]);
|
||||||
const optionsCompanies = ref([]);
|
const companies = ref([]);
|
||||||
const optionsEmailUsers = ref([]);
|
const optionsEmailUsers = ref([]);
|
||||||
const optionsSamplesVisible = ref([]);
|
const optionsSamplesVisible = ref([]);
|
||||||
const sampleType = ref({ hasPreview: false });
|
const sampleType = ref({ hasPreview: false });
|
||||||
|
const initialData = reactive({});
|
||||||
|
const entityId = computed(() => route.params.id);
|
||||||
|
const customer = computed(() => state.get('customer'));
|
||||||
const filterEmailUsers = { where: { userFk: user.value.id } };
|
const filterEmailUsers = { where: { userFk: user.value.id } };
|
||||||
const filterClientsAddresses = {
|
const filterClientsAddresses = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -58,14 +61,13 @@ const filterSamplesVisible = {
|
||||||
],
|
],
|
||||||
order: ['description'],
|
order: ['description'],
|
||||||
};
|
};
|
||||||
const initialData = reactive({});
|
|
||||||
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
const { data } = await axios.get(`Clients/1/getCard`);
|
initialData.clientFk = customer.value.id;
|
||||||
client.value = data;
|
initialData.recipient = customer.value.email;
|
||||||
initialData.clientFk = route.params?.id;
|
initialData.recipientId = customer.value.id;
|
||||||
initialData.recipient = data.email;
|
|
||||||
initialData.recipientId = data.id;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const setEmailUser = (data) => {
|
const setEmailUser = (data) => {
|
||||||
|
@ -75,7 +77,7 @@ const setEmailUser = (data) => {
|
||||||
|
|
||||||
const setClientsAddresses = (data) => {
|
const setClientsAddresses = (data) => {
|
||||||
initialData.addressId = data[0].id;
|
initialData.addressId = data[0].id;
|
||||||
optionsClientsAddressess.value = data;
|
addressess.value = data;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setSampleType = (sampleId) => {
|
const setSampleType = (sampleId) => {
|
||||||
|
@ -88,20 +90,6 @@ const setSampleType = (sampleId) => {
|
||||||
initialData.companyId = companyFk;
|
initialData.companyId = companyFk;
|
||||||
};
|
};
|
||||||
|
|
||||||
const setInitialData = () => {
|
|
||||||
hasChanged.value = false;
|
|
||||||
|
|
||||||
initialData.addressId = optionsClientsAddressess.value[0].id;
|
|
||||||
initialData.companyFk = null;
|
|
||||||
initialData.from = null;
|
|
||||||
initialData.recipient = client.value.email;
|
|
||||||
initialData.recipientId = client.value.id;
|
|
||||||
initialData.replyTo = optionsEmailUsers.value[0]?.email;
|
|
||||||
initialData.typeFk = '';
|
|
||||||
|
|
||||||
sampleType.value = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
const validateMessage = () => {
|
const validateMessage = () => {
|
||||||
if (!initialData.recipient) return 'Email cannot be blank';
|
if (!initialData.recipient) return 'Email cannot be blank';
|
||||||
if (!sampleType.value) return 'Choose a sample';
|
if (!sampleType.value) return 'Choose a sample';
|
||||||
|
@ -120,14 +108,14 @@ const setParams = (params) => {
|
||||||
const getPreview = async () => {
|
const getPreview = async () => {
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
recipientId: route.params.id,
|
recipientId: entityId,
|
||||||
};
|
};
|
||||||
const validationMessage = validateMessage();
|
const validationMessage = validateMessage();
|
||||||
if (validationMessage) return notify(t(validationMessage), 'negative');
|
if (validationMessage) return notify(t(validationMessage), 'negative');
|
||||||
|
|
||||||
setParams(params);
|
setParams(params);
|
||||||
|
|
||||||
const path = `${sampleType.value.model}/${route.params.id}/${sampleType.value.code}-html`;
|
const path = `${sampleType.value.model}/${entityId.value}/${sampleType.value.code}-html`;
|
||||||
const { data } = await axios.get(path, { params });
|
const { data } = await axios.get(path, { params });
|
||||||
|
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
@ -156,22 +144,33 @@ const onSubmit = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDataSaved = async ({
|
const getSamples = async () => {
|
||||||
addressId,
|
try {
|
||||||
companyFk,
|
const filter = { where: { id: initialData.typeFk } };
|
||||||
companyId,
|
let { data } = await axios.get('Samples', {
|
||||||
from,
|
params: { filter: JSON.stringify(filter) },
|
||||||
recipient,
|
});
|
||||||
replyTo,
|
return data[0];
|
||||||
}) => {
|
} catch (error) {
|
||||||
await axios.post(`Clients/${route.params.id}/incoterms-authorization-email`, {
|
notify('errors.create', 'negative');
|
||||||
addressId,
|
}
|
||||||
companyFk,
|
};
|
||||||
companyId,
|
|
||||||
from,
|
const onDataSaved = async () => {
|
||||||
recipient,
|
try {
|
||||||
replyTo,
|
const params = {
|
||||||
});
|
recipientId: initialData.recipientId,
|
||||||
|
recipient: initialData.recipient,
|
||||||
|
replyTo: initialData.replyTo,
|
||||||
|
};
|
||||||
|
setParams(params);
|
||||||
|
const samplesData = await getSamples();
|
||||||
|
const path = `${samplesData.model}/${entityId.value}/${samplesData.code}-email`;
|
||||||
|
await sendEmail(path, params);
|
||||||
|
onDialogOK(params);
|
||||||
|
} catch (error) {
|
||||||
|
notify('errors.create', 'negative');
|
||||||
|
}
|
||||||
toCustomerSamples();
|
toCustomerSamples();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,73 +184,54 @@ const toCustomerSamples = () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterEmailUsers"
|
:filter="filterEmailUsers"
|
||||||
@on-fetch="setEmailUser"
|
@on-fetch="setEmailUser"
|
||||||
auto-load
|
auto-load
|
||||||
url="EmailUsers"
|
url="EmailUsers"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterClientsAddresses"
|
:filter="filterClientsAddresses"
|
||||||
:url="`Clients/${route.params.id}/addresses`"
|
:url="`Clients/${entityId}/addresses`"
|
||||||
@on-fetch="setClientsAddresses"
|
@on-fetch="setClientsAddresses"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterCompanies"
|
:filter="filterCompanies"
|
||||||
@on-fetch="(data) => (optionsCompanies = data)"
|
@on-fetch="(data) => (companies = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Companies"
|
url="Companies"
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
:filter="filterSamplesVisible"
|
:filter="filterSamplesVisible"
|
||||||
@on-fetch="(data) => (optionsSamplesVisible = data)"
|
@on-fetch="(data) => (optionsSamplesVisible = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Samples/visible"
|
url="Samples/visible"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Teleport v-if="stateStore?.isSubToolbarShown()" to="#st-actions">
|
<QDialog ref="dialogRef">
|
||||||
<QBtnGroup push class="q-gutter-x-sm">
|
<FormPopup
|
||||||
<QBtn
|
:default-cancel-button="false"
|
||||||
:label="t('globals.cancel')"
|
:default-submit-button="false"
|
||||||
@click="toCustomerSamples"
|
@on-submit="onSubmit()"
|
||||||
color="primary"
|
>
|
||||||
flat
|
<template #custom-buttons>
|
||||||
icon="close"
|
<QBtn
|
||||||
/>
|
:disabled="isLoading || !sampleType?.hasPreview"
|
||||||
<QBtn
|
:label="t('Preview')"
|
||||||
:disabled="isLoading || !sampleType?.hasPreview"
|
:loading="isLoading"
|
||||||
:label="t('Preview')"
|
@click.stop="getPreview()"
|
||||||
:loading="isLoading"
|
color="primary"
|
||||||
@click.stop="getPreview()"
|
flat
|
||||||
color="primary"
|
icon="preview" /><QBtn
|
||||||
flat
|
:disabled="!hasChanged"
|
||||||
icon="preview"
|
:label="t('globals.save')"
|
||||||
/>
|
:loading="isLoading"
|
||||||
<QBtn
|
@click="onSubmit"
|
||||||
:disabled="!hasChanged"
|
color="primary"
|
||||||
:label="t('globals.reset')"
|
icon="save"
|
||||||
:loading="isLoading"
|
/></template>
|
||||||
@click="setInitialData"
|
<template #form-inputs>
|
||||||
color="primary"
|
|
||||||
flat
|
|
||||||
icon="restart_alt"
|
|
||||||
type="reset"
|
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
:disabled="!hasChanged"
|
|
||||||
:label="t('globals.save')"
|
|
||||||
:loading="isLoading"
|
|
||||||
@click="onSubmit"
|
|
||||||
color="primary"
|
|
||||||
icon="save"
|
|
||||||
/>
|
|
||||||
</QBtnGroup>
|
|
||||||
</Teleport>
|
|
||||||
|
|
||||||
<div class="full-width flex justify-center">
|
|
||||||
<QCard class="card-width q-pa-lg">
|
|
||||||
<QForm>
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Sample')"
|
:label="t('Sample')"
|
||||||
|
@ -308,7 +288,7 @@ const toCustomerSamples = () => {
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Company')"
|
:label="t('Company')"
|
||||||
:options="optionsCompanies"
|
:options="companies"
|
||||||
:rules="validate('entry.companyFk')"
|
:rules="validate('entry.companyFk')"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="code"
|
option-label="code"
|
||||||
|
@ -321,7 +301,7 @@ const toCustomerSamples = () => {
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Address')"
|
:label="t('Address')"
|
||||||
:options="optionsClientsAddressess"
|
:options="addressess"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -359,15 +339,15 @@ const toCustomerSamples = () => {
|
||||||
required="true"
|
required="true"
|
||||||
v-model="initialData.from"
|
v-model="initialData.from"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div> </VnRow
|
||||||
</VnRow>
|
></template>
|
||||||
</QForm>
|
</FormPopup>
|
||||||
</QCard>
|
</QDialog>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
|
New sample: Crear plantilla
|
||||||
Sample: Plantilla
|
Sample: Plantilla
|
||||||
Recipient: Destinatario
|
Recipient: Destinatario
|
||||||
Reply to: Responder a
|
Reply to: Responder a
|
||||||
|
|
|
@ -1,22 +1,25 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { QBtn, date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
|
|
||||||
import { toCurrency } from 'src/filters';
|
import { toCurrency } from 'src/filters';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import CustomerSummaryTableActions from './CustomerSummaryTableActions.vue';
|
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
|
||||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
|
||||||
|
import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||||
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
|
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { viewSummary } = useSummaryDialog();
|
||||||
const rows = ref([]);
|
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -32,57 +35,6 @@ const filter = {
|
||||||
],
|
],
|
||||||
where: { clientFk: route.params.id },
|
where: { clientFk: route.params.id },
|
||||||
order: ['shipped DESC', 'id'],
|
order: ['shipped DESC', 'id'],
|
||||||
limit: 10,
|
|
||||||
};
|
|
||||||
|
|
||||||
const tableColumnComponents = {
|
|
||||||
id: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
nickname: {
|
|
||||||
component: QBtn,
|
|
||||||
props: () => ({ flat: true, color: 'blue', noCaps: true }),
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
agency: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
route: {
|
|
||||||
component: QBtn,
|
|
||||||
props: () => ({ flat: true, color: 'blue' }),
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
packages: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
date: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
state: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
total: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
component: CustomerSummaryTableActions,
|
|
||||||
props: (prop) => ({
|
|
||||||
id: prop.row.id,
|
|
||||||
}),
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
@ -94,37 +46,37 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'nickname',
|
|
||||||
label: t('Nickname'),
|
label: t('Nickname'),
|
||||||
name: 'nickname',
|
name: 'nickname',
|
||||||
|
columnClass: 'expand',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: (row) => row?.agencyMode?.name,
|
format: (row) => row.agencyMode.name,
|
||||||
|
columnClass: 'expand',
|
||||||
label: t('Agency'),
|
label: t('Agency'),
|
||||||
name: 'agency',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'routeFk',
|
name: 'routeFk',
|
||||||
|
columnClass: 'shrink',
|
||||||
label: t('Route'),
|
label: t('Route'),
|
||||||
name: 'route',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'packages',
|
field: 'packages',
|
||||||
label: t('Packages'),
|
label: t('Packages'),
|
||||||
name: 'packages',
|
name: 'packages',
|
||||||
|
columnClass: 'shrink',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: (row) => date.formatDate(row?.shipped, 'DD/MM/YYYY'),
|
format: ({ shipped }) => date.formatDate(shipped, 'DD/MM/YYYY'),
|
||||||
label: t('Date'),
|
label: t('Date'),
|
||||||
name: 'date',
|
name: 'shipped',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: (row) => row?.ticketState?.state?.name,
|
|
||||||
label: t('State'),
|
label: t('State'),
|
||||||
name: 'state',
|
name: 'state',
|
||||||
},
|
},
|
||||||
|
@ -134,11 +86,25 @@ const columns = computed(() => [
|
||||||
label: t('Total'),
|
label: t('Total'),
|
||||||
name: 'total',
|
name: 'total',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
field: 'totalWithVat',
|
|
||||||
label: '',
|
label: '',
|
||||||
name: 'actions',
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('customer.summary.goToLines'),
|
||||||
|
icon: 'vn:lines',
|
||||||
|
action: ({ id }) => router.push({ params: { id }, name: 'TicketSale' }),
|
||||||
|
isPrimary: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('components.smartCard.viewSummary'),
|
||||||
|
icon: 'preview',
|
||||||
|
isPrimary: true,
|
||||||
|
action: (row) => viewSummary(row.id, TicketSummary),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -156,84 +122,90 @@ const setTotalPriceColor = (ticket) => {
|
||||||
if (total > 0 && total < 50) return 'warning';
|
if (total > 0 && total < 50) return 'warning';
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateToticketSummary = (id) => {
|
const setShippedColor = (date) => {
|
||||||
router.push({
|
const today = Date.vnNew();
|
||||||
name: 'TicketSummary',
|
today.setHours(0, 0, 0, 0);
|
||||||
params: { id },
|
|
||||||
});
|
const ticketShipped = new Date(date);
|
||||||
|
ticketShipped.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
|
const difference = today - ticketShipped;
|
||||||
|
|
||||||
|
if (difference == 0) return 'warning';
|
||||||
|
if (difference < 0) return 'success';
|
||||||
};
|
};
|
||||||
const commonColumns = (col) => ['date', 'state', 'total'].includes(col);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<VnTable
|
||||||
|
data-key="CustomerTickets"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@on-fetch="(data) => (rows = data)"
|
:right-search="false"
|
||||||
auto-load
|
:column-search="false"
|
||||||
url="Tickets"
|
url="Tickets"
|
||||||
/>
|
:columns="columns"
|
||||||
<QCard class="vn-one q-py-sm flex justify-between">
|
search-url="tickets"
|
||||||
<QTable
|
:without-header="true"
|
||||||
:columns="columns"
|
auto-load
|
||||||
:pagination="{ rowsPerPage: 12 }"
|
order="shipped DESC, id"
|
||||||
:rows="rows"
|
:disable-option="{ card: true, table: true }"
|
||||||
class="full-width"
|
limit="5"
|
||||||
row-key="id"
|
class="full-width"
|
||||||
>
|
:disable-infinite-scroll="true"
|
||||||
<template #body-cell="props">
|
>
|
||||||
<QTd :props="props" @click="navigateToticketSummary(props.row.id)">
|
<template #column-nickname="{ row }">
|
||||||
<QTr :props="props" class="cursor-pointer">
|
<span class="link">
|
||||||
<component
|
{{ row.nickname }}
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||||
@click="tableColumnComponents[props.col.name].event(props)"
|
</span>
|
||||||
class="rounded-borders"
|
</template>
|
||||||
v-bind="tableColumnComponents[props.col.name].props(props)"
|
|
||||||
>
|
<template #column-routeFk="{ row }">
|
||||||
<template v-if="!commonColumns(props.col.name)">
|
<span class="link">
|
||||||
<span
|
{{ row.routeFk }}
|
||||||
:class="{
|
<RouteDescriptorProxy :id="row.routeFk" />
|
||||||
link:
|
</span>
|
||||||
props.col.name === 'route' ||
|
</template>
|
||||||
props.col.name === 'nickname',
|
<template #column-total="{ row }">
|
||||||
}"
|
<QBadge
|
||||||
>
|
class="q-pa-sm"
|
||||||
{{ props.value }}
|
v-if="setTotalPriceColor(row)"
|
||||||
</span>
|
:color="setTotalPriceColor(row)"
|
||||||
</template>
|
text-color="black"
|
||||||
<template v-if="props.col.name === 'date'">
|
>
|
||||||
<QBadge class="q-pa-sm" color="warning">
|
{{ toCurrency(row.totalWithVat) }}
|
||||||
{{ props.value }}
|
</QBadge>
|
||||||
</QBadge>
|
<span v-else> {{ toCurrency(row.totalWithVat) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="props.col.name === 'state'">
|
<template #column-state="{ row }">
|
||||||
<QBadge :color="setStateColor(props.row)" class="q-pa-sm">
|
<span v-if="row.invoiceOut">
|
||||||
{{ props.value }}
|
<span :class="{ link: row.invoiceOut.ref }">
|
||||||
</QBadge>
|
{{ row.invoiceOut.ref }}
|
||||||
</template>
|
<InvoiceOutDescriptorProxy :id="row.invoiceOut.id" />
|
||||||
<template v-if="props.col.name === 'total'">
|
</span>
|
||||||
<QBadge
|
</span>
|
||||||
:color="setTotalPriceColor(props.row)"
|
<QBadge
|
||||||
class="q-pa-sm"
|
class="q-pa-sm"
|
||||||
v-if="setTotalPriceColor(props.row)"
|
:color="setStateColor(row)"
|
||||||
>
|
text-color="black"
|
||||||
{{ toCurrency(props.value) }}
|
v-else-if="setStateColor(row)"
|
||||||
</QBadge>
|
>
|
||||||
<div v-else>{{ toCurrency(props.value) }}</div>
|
{{ row?.ticketState?.state.name }}
|
||||||
</template>
|
</QBadge>
|
||||||
<CustomerDescriptorProxy
|
<span v-else> {{ row?.ticketState?.state.name }}</span>
|
||||||
:id="props.row.clientFk"
|
</template>
|
||||||
v-if="props.col.name === 'nickname'"
|
<template #column-shipped="{ row }">
|
||||||
/>
|
<QBadge
|
||||||
<RouteDescriptorProxy
|
class="q-pa-sm"
|
||||||
:id="props.row.routeFk"
|
:color="setShippedColor(row.shipped)"
|
||||||
v-if="props.col.name === 'route'"
|
text-color="black"
|
||||||
/>
|
v-if="setShippedColor(row.shipped)"
|
||||||
</component>
|
>
|
||||||
</QTr>
|
{{ toDateFormat(row.shipped) }}
|
||||||
</QTd>
|
</QBadge>
|
||||||
</template>
|
<span v-else> {{ toDateFormat(row.shipped) }}</span>
|
||||||
</QTable>
|
</template>
|
||||||
</QCard>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
|
||||||
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
defineProps({
|
|
||||||
id: {
|
|
||||||
type: Number,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { viewSummary } = useSummaryDialog();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<QIcon color="primary" name="vn:lines" size="sm">
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Go to lines') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
@click.stop="viewSummary(id, TicketSummary)"
|
|
||||||
class="q-ml-md"
|
|
||||||
color="primary"
|
|
||||||
name="preview"
|
|
||||||
size="sm"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Preview') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<i18n>
|
|
||||||
es:
|
|
||||||
Go to lines: Ir a lineas
|
|
||||||
Preview: Vista previa
|
|
||||||
</i18n>
|
|
|
@ -2,3 +2,135 @@ customerFilter:
|
||||||
filter:
|
filter:
|
||||||
name: Name
|
name: Name
|
||||||
socialName: Social name
|
socialName: Social name
|
||||||
|
customer:
|
||||||
|
list:
|
||||||
|
phone: Phone
|
||||||
|
email: Email
|
||||||
|
customerOrders: Display customer orders
|
||||||
|
moreOptions: More options
|
||||||
|
card:
|
||||||
|
customerList: Customer list
|
||||||
|
customerId: Claim ID
|
||||||
|
salesPerson: Sales person
|
||||||
|
credit: Credit
|
||||||
|
risk: Risk
|
||||||
|
securedCredit: Secured credit
|
||||||
|
payMethod: Pay method
|
||||||
|
debt: Debt
|
||||||
|
isFrozen: Customer frozen
|
||||||
|
hasDebt: Customer has debt
|
||||||
|
isDisabled: Customer inactive
|
||||||
|
notChecked: Customer no checked
|
||||||
|
webAccountInactive: Web account inactive
|
||||||
|
noWebAccess: Web access is disabled
|
||||||
|
businessType: Business type
|
||||||
|
passwordRequirements: 'The password must have at least { length } length characters, {nAlpha} alphabetic characters, {nUpper} capital letters, {nDigits} digits and {nPunct} symbols (Ex: $%&.)\n'
|
||||||
|
businessTypeFk: Business type
|
||||||
|
summary:
|
||||||
|
basicData: Basic data
|
||||||
|
fiscalAddress: Fiscal address
|
||||||
|
fiscalData: Fiscal data
|
||||||
|
billingData: Billing data
|
||||||
|
consignee: Default consignee
|
||||||
|
businessData: Business data
|
||||||
|
financialData: Financial data
|
||||||
|
customerId: Customer ID
|
||||||
|
name: Name
|
||||||
|
contact: Contact
|
||||||
|
phone: Phone
|
||||||
|
mobile: Mobile
|
||||||
|
email: Email
|
||||||
|
salesPerson: Sales person
|
||||||
|
contactChannel: Contact channel
|
||||||
|
socialName: Social name
|
||||||
|
fiscalId: Fiscal ID
|
||||||
|
postcode: Postcode
|
||||||
|
province: Province
|
||||||
|
country: Country
|
||||||
|
street: Address
|
||||||
|
isEqualizated: Is equalizated
|
||||||
|
isActive: Is active
|
||||||
|
invoiceByAddress: Invoice by address
|
||||||
|
verifiedData: Verified data
|
||||||
|
hasToInvoice: Has to invoice
|
||||||
|
notifyByEmail: Notify by email
|
||||||
|
vies: VIES
|
||||||
|
payMethod: Pay method
|
||||||
|
bankAccount: Bank account
|
||||||
|
dueDay: Due day
|
||||||
|
hasLcr: Has LCR
|
||||||
|
hasCoreVnl: Has core VNL
|
||||||
|
hasB2BVnl: Has B2B VNL
|
||||||
|
addressName: Address name
|
||||||
|
addressCity: City
|
||||||
|
addressStreet: Street
|
||||||
|
username: Username
|
||||||
|
webAccess: Web access
|
||||||
|
totalGreuge: Total greuge
|
||||||
|
mana: Mana
|
||||||
|
priceIncreasingRate: Price increasing rate
|
||||||
|
averageInvoiced: Average invoiced
|
||||||
|
claimRate: Claming rate
|
||||||
|
payMethodFk: Billing data
|
||||||
|
risk: Risk
|
||||||
|
maximumRisk: Solunion's maximum risk
|
||||||
|
riskInfo: Invoices minus payments plus orders not yet invoiced
|
||||||
|
credit: Credit
|
||||||
|
creditInfo: Company's maximum risk
|
||||||
|
securedCredit: Secured credit
|
||||||
|
securedCreditInfo: Solunion's maximum risk
|
||||||
|
balance: Balance
|
||||||
|
balanceInfo: Invoices minus payments
|
||||||
|
balanceDue: Balance due
|
||||||
|
balanceDueInfo: Deviated invoices minus payments
|
||||||
|
recoverySince: Recovery since
|
||||||
|
businessType: Business Type
|
||||||
|
city: City
|
||||||
|
descriptorInfo: Invoices minus payments plus orders not yet
|
||||||
|
rating: Rating
|
||||||
|
recommendCredit: Recommended credit
|
||||||
|
goToLines: Go to lines
|
||||||
|
basicData:
|
||||||
|
socialName: Fiscal name
|
||||||
|
businessType: Business type
|
||||||
|
contact: Contact
|
||||||
|
youCanSaveMultipleEmails: You can save multiple emails
|
||||||
|
email: Email
|
||||||
|
phone: Phone
|
||||||
|
mobile: Mobile
|
||||||
|
salesPerson: Sales person
|
||||||
|
contactChannel: Contact channel
|
||||||
|
previousClient: Previous client
|
||||||
|
extendedList:
|
||||||
|
tableVisibleColumns:
|
||||||
|
id: Identifier
|
||||||
|
name: Name
|
||||||
|
socialName: Social name
|
||||||
|
fi: Tax number
|
||||||
|
salesPersonFk: Salesperson
|
||||||
|
credit: Credit
|
||||||
|
creditInsurance: Credit insurance
|
||||||
|
phone: Phone
|
||||||
|
mobile: Mobile
|
||||||
|
street: Street
|
||||||
|
countryFk: Country
|
||||||
|
provinceFk: Province
|
||||||
|
city: City
|
||||||
|
postcode: Postcode
|
||||||
|
email: Email
|
||||||
|
created: Created
|
||||||
|
businessTypeFk: Business type
|
||||||
|
payMethodFk: Billing data
|
||||||
|
sageTaxTypeFk: Sage tax type
|
||||||
|
sageTransactionTypeFk: Sage tr. type
|
||||||
|
isActive: Active
|
||||||
|
isVies: Vies
|
||||||
|
isTaxDataChecked: Verified data
|
||||||
|
isEqualizated: Is equalizated
|
||||||
|
isFreezed: Freezed
|
||||||
|
hasToInvoice: Invoice
|
||||||
|
hasToInvoiceByAddress: Invoice by address
|
||||||
|
isToBeMailed: Mailing
|
||||||
|
hasLcr: Received LCR
|
||||||
|
hasCoreVnl: VNL core received
|
||||||
|
hasSepaVnl: VNL B2B received
|
||||||
|
|
|
@ -4,3 +4,134 @@ customerFilter:
|
||||||
filter:
|
filter:
|
||||||
name: Nombre
|
name: Nombre
|
||||||
socialName: Razón Social
|
socialName: Razón Social
|
||||||
|
customer:
|
||||||
|
list:
|
||||||
|
phone: Teléfono
|
||||||
|
email: Email
|
||||||
|
customerOrders: Mostrar órdenes del cliente
|
||||||
|
moreOptions: Más opciones
|
||||||
|
card:
|
||||||
|
customerId: ID cliente
|
||||||
|
salesPerson: Comercial
|
||||||
|
credit: Crédito
|
||||||
|
risk: Riesgo
|
||||||
|
securedCredit: Crédito asegurado
|
||||||
|
payMethod: Método de pago
|
||||||
|
debt: Riesgo
|
||||||
|
isFrozen: Cliente congelado
|
||||||
|
hasDebt: Cliente con riesgo
|
||||||
|
isDisabled: Cliente inactivo
|
||||||
|
notChecked: Cliente no comprobado
|
||||||
|
webAccountInactive: Sin acceso web
|
||||||
|
noWebAccess: El acceso web está desactivado
|
||||||
|
businessType: Tipo de negocio
|
||||||
|
passwordRequirements: 'La contraseña debe tener al menos { length } caracteres de longitud, {nAlpha} caracteres alfabéticos, {nUpper} letras mayúsculas, {nDigits} dígitos y {nPunct} símbolos (Ej: $%&.)'
|
||||||
|
businessTypeFk: Tipo de negocio
|
||||||
|
summary:
|
||||||
|
basicData: Datos básicos
|
||||||
|
fiscalAddress: Dirección fiscal
|
||||||
|
fiscalData: Datos fiscales
|
||||||
|
billingData: Datos de facturación
|
||||||
|
consignee: Consignatario pred.
|
||||||
|
businessData: Datos comerciales
|
||||||
|
financialData: Datos financieros
|
||||||
|
customerId: ID cliente
|
||||||
|
name: Nombre
|
||||||
|
contact: Contacto
|
||||||
|
phone: Teléfono
|
||||||
|
mobile: Móvil
|
||||||
|
email: Email
|
||||||
|
salesPerson: Comercial
|
||||||
|
contactChannel: Canal de contacto
|
||||||
|
socialName: Razón social
|
||||||
|
fiscalId: NIF/CIF
|
||||||
|
postcode: Código postal
|
||||||
|
province: Provincia
|
||||||
|
country: País
|
||||||
|
street: Calle
|
||||||
|
isEqualizated: Recargo de equivalencia
|
||||||
|
isActive: Activo
|
||||||
|
invoiceByAddress: Facturar por consignatario
|
||||||
|
verifiedData: Datos verificados
|
||||||
|
hasToInvoice: Facturar
|
||||||
|
notifyByEmail: Notificar por email
|
||||||
|
vies: VIES
|
||||||
|
payMethod: Método de pago
|
||||||
|
bankAccount: Cuenta bancaria
|
||||||
|
dueDay: Día de pago
|
||||||
|
hasLcr: Recibido LCR
|
||||||
|
hasCoreVnl: Recibido core VNL
|
||||||
|
hasB2BVnl: Recibido B2B VNL
|
||||||
|
addressName: Nombre de la dirección
|
||||||
|
addressCity: Ciudad
|
||||||
|
addressStreet: Calle
|
||||||
|
username: Usuario
|
||||||
|
webAccess: Acceso web
|
||||||
|
totalGreuge: Greuge total
|
||||||
|
mana: Maná
|
||||||
|
priceIncreasingRate: Ratio de incremento de precio
|
||||||
|
averageInvoiced: Facturación media
|
||||||
|
claimRate: Ratio de reclamaciones
|
||||||
|
maximumRisk: Riesgo máximo asumido por Solunion
|
||||||
|
payMethodFk: Forma de pago
|
||||||
|
risk: Riesgo
|
||||||
|
riskInfo: Facturas menos recibos mas pedidos sin facturar
|
||||||
|
credit: Crédito
|
||||||
|
creditInfo: Riesgo máximo asumido por la empresa
|
||||||
|
securedCredit: Crédito asegurado
|
||||||
|
securedCreditInfo: Riesgo máximo asumido por Solunion
|
||||||
|
balance: Balance
|
||||||
|
balanceInfo: Facturas menos recibos
|
||||||
|
balanceDue: Saldo vencido
|
||||||
|
balanceDueInfo: Facturas fuera de plazo menos recibos
|
||||||
|
recoverySince: Recobro desde
|
||||||
|
businessType: Tipo de negocio
|
||||||
|
city: Población
|
||||||
|
descriptorInfo: Facturas menos recibos mas pedidos sin facturar
|
||||||
|
rating: Clasificación
|
||||||
|
recommendCredit: Crédito recomendado
|
||||||
|
goToLines: Ir a líneas
|
||||||
|
basicData:
|
||||||
|
socialName: Nombre fiscal
|
||||||
|
businessType: Tipo de negocio
|
||||||
|
contact: Contacto
|
||||||
|
youCanSaveMultipleEmails: Puede guardar varios correos electrónicos encadenándolos mediante comas sin espacios{','} ejemplo{':'} user{'@'}dominio{'.'}com, user2{'@'}dominio{'.'}com siendo el primer correo electrónico el principal
|
||||||
|
email: Email
|
||||||
|
phone: Teléfono
|
||||||
|
mobile: Móvil
|
||||||
|
salesPerson: Comercial
|
||||||
|
contactChannel: Canal de contacto
|
||||||
|
previousClient: Cliente anterior
|
||||||
|
extendedList:
|
||||||
|
tableVisibleColumns:
|
||||||
|
id: Identificador
|
||||||
|
name: Nombre
|
||||||
|
socialName: Razón social
|
||||||
|
fi: NIF / CIF
|
||||||
|
salesPersonFk: Comercial
|
||||||
|
credit: Crédito
|
||||||
|
creditInsurance: Crédito asegurado
|
||||||
|
phone: Teléfono
|
||||||
|
mobile: Móvil
|
||||||
|
street: Dirección fiscal
|
||||||
|
countryFk: País
|
||||||
|
provinceFk: Provincia
|
||||||
|
city: Población
|
||||||
|
postcode: Código postal
|
||||||
|
email: Email
|
||||||
|
created: Fecha creación
|
||||||
|
businessTypeFk: Tipo de negocio
|
||||||
|
payMethodFk: Forma de pago
|
||||||
|
sageTaxTypeFk: Tipo de impuesto Sage
|
||||||
|
sageTransactionTypeFk: Tipo tr. sage
|
||||||
|
isActive: Activo
|
||||||
|
isVies: Vies
|
||||||
|
isTaxDataChecked: Datos comprobados
|
||||||
|
isEqualizated: Recargo de equivalencias
|
||||||
|
isFreezed: Congelado
|
||||||
|
hasToInvoice: Factura
|
||||||
|
hasToInvoiceByAddress: Factura por consigna
|
||||||
|
isToBeMailed: Env. emails
|
||||||
|
hasLcr: Recibido LCR
|
||||||
|
hasCoreVnl: Recibido core VNL
|
||||||
|
hasSepaVnl: Recibido B2B VNL
|
||||||
|
|
|
@ -55,6 +55,15 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
|
||||||
>
|
>
|
||||||
<div class="text-center text-primary button-text">
|
<div class="text-center text-primary button-text">
|
||||||
{{ t(item.title) }}
|
{{ t(item.title) }}
|
||||||
|
<div v-if="item.keyBinding">
|
||||||
|
{{ '(' + item.keyBinding + ')' }}
|
||||||
|
<QTooltip>
|
||||||
|
{{
|
||||||
|
'Ctrl + Alt + ' +
|
||||||
|
item?.keyBinding?.toUpperCase()
|
||||||
|
}}
|
||||||
|
</QTooltip>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,12 +16,12 @@ const workersOptions = ref([]);
|
||||||
const clientsOptions = ref([]);
|
const clientsOptions = ref([]);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<fetch-data
|
<FetchData
|
||||||
url="Workers/search"
|
url="Workers/search"
|
||||||
@on-fetch="(data) => (workersOptions = data)"
|
@on-fetch="(data) => (workersOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<fetch-data url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load />
|
<FetchData url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load />
|
||||||
<FormModel
|
<FormModel
|
||||||
:url="`Departments/${route.params.id}`"
|
:url="`Departments/${route.params.id}`"
|
||||||
model="department"
|
model="department"
|
||||||
|
|
|
@ -26,7 +26,6 @@ const { notify } = useNotify();
|
||||||
|
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
const entryBuysPaginateRef = ref(null);
|
const entryBuysPaginateRef = ref(null);
|
||||||
const packagingsOptions = ref(null);
|
|
||||||
const originalRowDataCopy = ref(null);
|
const originalRowDataCopy = ref(null);
|
||||||
|
|
||||||
const getInputEvents = (colField, props) => {
|
const getInputEvents = (colField, props) => {
|
||||||
|
@ -66,7 +65,10 @@ const tableColumnComponents = computed(() => ({
|
||||||
'map-options': true,
|
'map-options': true,
|
||||||
'use-input': true,
|
'use-input': true,
|
||||||
'hide-selected': true,
|
'hide-selected': true,
|
||||||
options: packagingsOptions.value,
|
url: 'Packagings',
|
||||||
|
fields: ['id'],
|
||||||
|
where: { freightItemFk: true },
|
||||||
|
'sort-by': 'id ASC',
|
||||||
dense: true,
|
dense: true,
|
||||||
},
|
},
|
||||||
event: getInputEvents,
|
event: getInputEvents,
|
||||||
|
@ -304,13 +306,6 @@ const lockIconType = (groupingMode, mode) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
ref="expensesRef"
|
|
||||||
url="Packagings"
|
|
||||||
:filter="{ fields: ['id'], where: { freightItemFk: true }, order: 'id ASC' }"
|
|
||||||
auto-load
|
|
||||||
@on-fetch="(data) => (packagingsOptions = data)"
|
|
||||||
/>
|
|
||||||
<VnSubToolbar>
|
<VnSubToolbar>
|
||||||
<template #st-actions>
|
<template #st-actions>
|
||||||
<QBtnGroup push style="column-gap: 10px">
|
<QBtnGroup push style="column-gap: 10px">
|
||||||
|
|
|
@ -223,6 +223,10 @@ async function onSubmit() {
|
||||||
autofocus
|
autofocus
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInputDate :label="t('Entry date')" v-model="data.bookEntried" />
|
||||||
|
<VnInputDate :label="t('Accounted date')" v-model="data.booked" />
|
||||||
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Undeductible VAT')"
|
:label="t('Undeductible VAT')"
|
||||||
|
@ -285,10 +289,6 @@ async function onSubmit() {
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
|
||||||
<VnInputDate :label="t('Entry date')" v-model="data.bookEntried" />
|
|
||||||
<VnInputDate :label="t('Accounted date')" v-model="data.booked" />
|
|
||||||
</VnRow>
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Currency')"
|
:label="t('Currency')"
|
||||||
|
|
|
@ -3,6 +3,8 @@ 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';
|
import InvoiceInSearchbar from '../InvoiceInSearchbar.vue';
|
||||||
|
import { onBeforeRouteUpdate } from 'vue-router';
|
||||||
|
import { setRectificative } from '../composables/setRectificative';
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -20,6 +22,8 @@ const filter = {
|
||||||
{ relation: 'currency' },
|
{ relation: 'currency' },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onBeforeRouteUpdate(async (to) => await setRectificative(to));
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { toCurrency, toDate } from 'src/filters';
|
import { toCurrency, toDate } from 'src/filters';
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
import { downloadFile } from 'src/composables/downloadFile';
|
import { downloadFile } from 'src/composables/downloadFile';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
|
@ -24,7 +24,7 @@ const $props = defineProps({ id: { type: Number, default: null } });
|
||||||
const { push, currentRoute } = useRouter();
|
const { push, currentRoute } = useRouter();
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const { hasAny } = useRole();
|
const { hasAny } = useAcl();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openReport, sendEmail } = usePrintService();
|
const { openReport, sendEmail } = usePrintService();
|
||||||
const arrayData = useArrayData();
|
const arrayData = useArrayData();
|
||||||
|
@ -195,7 +195,8 @@ async function cloneInvoice() {
|
||||||
push({ path: `/invoice-in/${data.id}/summary` });
|
push({ path: `/invoice-in/${data.id}/summary` });
|
||||||
}
|
}
|
||||||
|
|
||||||
const isAdministrative = () => hasAny(['administrative']);
|
const canEditProp = (props) =>
|
||||||
|
hasAny([{ model: 'InvoiceIn', props, accessType: 'WRITE' }]);
|
||||||
|
|
||||||
const isAgricultural = () => {
|
const isAgricultural = () => {
|
||||||
if (!config.value) return false;
|
if (!config.value) return false;
|
||||||
|
@ -283,7 +284,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
<InvoiceInToBook>
|
<InvoiceInToBook>
|
||||||
<template #content="{ book }">
|
<template #content="{ book }">
|
||||||
<QItem
|
<QItem
|
||||||
v-if="!entity?.isBooked && isAdministrative()"
|
v-if="!entity?.isBooked && canEditProp('toBook')"
|
||||||
v-ripple
|
v-ripple
|
||||||
clickable
|
clickable
|
||||||
@click="book(entityId)"
|
@click="book(entityId)"
|
||||||
|
@ -293,7 +294,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
</template>
|
</template>
|
||||||
</InvoiceInToBook>
|
</InvoiceInToBook>
|
||||||
<QItem
|
<QItem
|
||||||
v-if="entity?.isBooked && isAdministrative()"
|
v-if="entity?.isBooked && canEditProp('toUnbook')"
|
||||||
v-ripple
|
v-ripple
|
||||||
clickable
|
clickable
|
||||||
@click="triggerMenu('unbook')"
|
@click="triggerMenu('unbook')"
|
||||||
|
@ -303,7 +304,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem
|
<QItem
|
||||||
v-if="isAdministrative()"
|
v-if="canEditProp('deleteById')"
|
||||||
v-ripple
|
v-ripple
|
||||||
clickable
|
clickable
|
||||||
@click="triggerMenu('delete')"
|
@click="triggerMenu('delete')"
|
||||||
|
@ -311,7 +312,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
<QItemSection>{{ t('Delete invoice') }}</QItemSection>
|
<QItemSection>{{ t('Delete invoice') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem
|
<QItem
|
||||||
v-if="isAdministrative()"
|
v-if="canEditProp('clone')"
|
||||||
v-ripple
|
v-ripple
|
||||||
clickable
|
clickable
|
||||||
@click="triggerMenu('clone')"
|
@click="triggerMenu('clone')"
|
||||||
|
@ -356,10 +357,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" />
|
<VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" />
|
||||||
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
|
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
|
||||||
<VnLv
|
<VnLv :label="t('invoiceIn.card.amount')" :value="toCurrency(totalAmount)" />
|
||||||
:label="t('invoiceIn.card.amount')"
|
|
||||||
:value="toCurrency(totalAmount, entity.currency?.code)"
|
|
||||||
/>
|
|
||||||
<VnLv :label="t('invoiceIn.summary.supplier')">
|
<VnLv :label="t('invoiceIn.summary.supplier')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<span class="link">
|
<span class="link">
|
||||||
|
|
|
@ -5,10 +5,10 @@ import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { getTotal } from 'src/composables/getTotal';
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import { toCurrency } from 'src/filters';
|
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
@ -72,7 +72,6 @@ async function insert() {
|
||||||
await invoiceInFormRef.value.reload();
|
await invoiceInFormRef.value.reload();
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
}
|
}
|
||||||
const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount, 0);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -155,9 +154,17 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd>
|
<QTd>
|
||||||
{{ toCurrency(getTotalAmount(rows), currency) }}
|
{{ getTotal(rows, 'amount', { currency: 'default' }) }}
|
||||||
|
</QTd>
|
||||||
|
<QTd>
|
||||||
|
<template v-if="isNotEuro(invoiceIn.currency.code)">
|
||||||
|
{{
|
||||||
|
getTotal(rows, 'foreignValue', {
|
||||||
|
currency: invoiceIn.currency.code,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
</template>
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd />
|
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
<template #item="props">
|
<template #item="props">
|
||||||
|
|
|
@ -2,18 +2,15 @@
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { toCurrency } from 'src/filters';
|
import { getTotal } from 'src/composables/getTotal';
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const arrayData = useArrayData();
|
|
||||||
const currency = computed(() => arrayData.store.data?.currency?.code);
|
|
||||||
const invoceInIntrastat = ref([]);
|
const invoceInIntrastat = ref([]);
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
const countries = ref([]);
|
const countries = ref([]);
|
||||||
|
@ -72,9 +69,6 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const getTotal = (data, key) =>
|
|
||||||
data.reduce((acc, cur) => acc + +String(cur[key] || 0).replace(',', '.'), 0);
|
|
||||||
|
|
||||||
const formatOpt = (row, { model, options }, prop) => {
|
const formatOpt = (row, { model, options }, prop) => {
|
||||||
const obj = row[model];
|
const obj = row[model];
|
||||||
const option = options.find(({ id }) => id == obj);
|
const option = options.find(({ id }) => id == obj);
|
||||||
|
@ -154,7 +148,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd>
|
<QTd>
|
||||||
{{ toCurrency(getTotal(rows, 'amount'), currency) }}
|
{{ getTotal(rows, 'amount', { currency: 'default' }) }}
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd>
|
<QTd>
|
||||||
{{ getTotal(rows, 'net') }}
|
{{ getTotal(rows, 'net') }}
|
||||||
|
|
|
@ -35,7 +35,7 @@ const vatColumns = ref([
|
||||||
name: 'landed',
|
name: 'landed',
|
||||||
label: 'invoiceIn.summary.taxableBase',
|
label: 'invoiceIn.summary.taxableBase',
|
||||||
field: (row) => row.taxableBase,
|
field: (row) => row.taxableBase,
|
||||||
format: (value) => toCurrency(value, currency.value),
|
format: (value) => toCurrency(value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
|
@ -64,7 +64,7 @@ const vatColumns = ref([
|
||||||
name: 'rate',
|
name: 'rate',
|
||||||
label: 'invoiceIn.summary.rate',
|
label: 'invoiceIn.summary.rate',
|
||||||
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),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
|
@ -72,7 +72,7 @@ const vatColumns = ref([
|
||||||
name: 'currency',
|
name: 'currency',
|
||||||
label: 'invoiceIn.summary.currency',
|
label: 'invoiceIn.summary.currency',
|
||||||
field: (row) => row.foreignValue,
|
field: (row) => row.foreignValue,
|
||||||
format: (value) => value,
|
format: (val) => val && toCurrency(val, currency.value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
|
@ -97,7 +97,7 @@ const dueDayColumns = ref([
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
label: 'invoiceIn.summary.amount',
|
label: 'invoiceIn.summary.amount',
|
||||||
field: (row) => row.amount,
|
field: (row) => row.amount,
|
||||||
format: (value) => toCurrency(value, currency.value),
|
format: (value) => toCurrency(value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
|
@ -105,7 +105,7 @@ const dueDayColumns = ref([
|
||||||
name: 'landed',
|
name: 'landed',
|
||||||
label: 'invoiceIn.summary.foreignValue',
|
label: 'invoiceIn.summary.foreignValue',
|
||||||
field: (row) => row.foreignValue,
|
field: (row) => row.foreignValue,
|
||||||
format: (value) => value,
|
format: (val) => val && toCurrency(val, currency.value),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
|
@ -124,7 +124,7 @@ const intrastatColumns = ref([
|
||||||
{
|
{
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
label: 'invoiceIn.summary.amount',
|
label: 'invoiceIn.summary.amount',
|
||||||
field: (row) => toCurrency(row.amount, currency.value),
|
field: (row) => toCurrency(row.amount),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
|
@ -179,7 +179,6 @@ const getTotalTax = (tax) =>
|
||||||
|
|
||||||
const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
data-key="InvoiceInSummary"
|
data-key="InvoiceInSummary"
|
||||||
|
@ -229,10 +228,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
:label="t('invoiceIn.summary.currency')"
|
:label="t('invoiceIn.summary.currency')"
|
||||||
:value="entity.currency?.code"
|
:value="entity.currency?.code"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv :label="t('invoiceIn.serial')" :value="`${entity.serial}`" />
|
||||||
:label="t('invoiceIn.summary.docNumber')"
|
|
||||||
:value="`${entity.serial}/${entity.serialNumber}`"
|
|
||||||
/>
|
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
|
@ -293,12 +289,9 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.summary.taxableBase')"
|
:label="t('invoiceIn.summary.taxableBase')"
|
||||||
:value="toCurrency(entity.totals.totalTaxableBase, currency)"
|
:value="toCurrency(entity.totals.totalTaxableBase)"
|
||||||
/>
|
|
||||||
<VnLv
|
|
||||||
label="Total"
|
|
||||||
:value="toCurrency(entity.totals.totalVat, currency)"
|
|
||||||
/>
|
/>
|
||||||
|
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
|
||||||
<VnLv :label="t('invoiceIn.summary.dueTotal')">
|
<VnLv :label="t('invoiceIn.summary.dueTotal')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<QChip
|
<QChip
|
||||||
|
@ -311,7 +304,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
: t('invoiceIn.summary.dueTotal')
|
: t('invoiceIn.summary.dueTotal')
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ toCurrency(entity.totals.totalDueDay, currency) }}
|
{{ toCurrency(entity.totals.totalDueDay) }}
|
||||||
</QChip>
|
</QChip>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
|
@ -350,15 +343,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
<template #bottom-row>
|
<template #bottom-row>
|
||||||
<QTr class="bg">
|
<QTr class="bg">
|
||||||
<QTd></QTd>
|
<QTd></QTd>
|
||||||
|
<QTd>{{ toCurrency(entity.totals.totalTaxableBase) }}</QTd>
|
||||||
|
<QTd></QTd>
|
||||||
|
<QTd></QTd>
|
||||||
|
<QTd>{{ toCurrency(getTotalTax(entity.invoiceInTax)) }}</QTd>
|
||||||
<QTd>{{
|
<QTd>{{
|
||||||
toCurrency(entity.totals.totalTaxableBase, currency)
|
entity.totals.totalTaxableBaseForeignValue &&
|
||||||
|
toCurrency(
|
||||||
|
entity.totals.totalTaxableBaseForeignValue,
|
||||||
|
currency
|
||||||
|
)
|
||||||
}}</QTd>
|
}}</QTd>
|
||||||
<QTd></QTd>
|
|
||||||
<QTd></QTd>
|
|
||||||
<QTd>{{
|
|
||||||
toCurrency(getTotalTax(entity.invoiceInTax, currency))
|
|
||||||
}}</QTd>
|
|
||||||
<QTd></QTd>
|
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
@ -384,9 +379,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
<QTd></QTd>
|
<QTd></QTd>
|
||||||
<QTd></QTd>
|
<QTd></QTd>
|
||||||
<QTd>
|
<QTd>
|
||||||
{{ toCurrency(entity.totals.totalDueDay, currency) }}
|
{{ toCurrency(entity.totals.totalDueDay) }}
|
||||||
|
</QTd>
|
||||||
|
<QTd>
|
||||||
|
{{
|
||||||
|
entity.totals.totalDueDayForeignValue &&
|
||||||
|
toCurrency(
|
||||||
|
entity.totals.totalDueDayForeignValue,
|
||||||
|
currency
|
||||||
|
)
|
||||||
|
}}
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd></QTd>
|
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
@ -421,7 +424,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
<template #bottom-row>
|
<template #bottom-row>
|
||||||
<QTr class="bg">
|
<QTr class="bg">
|
||||||
<QTd></QTd>
|
<QTd></QTd>
|
||||||
<QTd>{{ toCurrency(intrastatTotals.amount, currency) }}</QTd>
|
<QTd>{{ toCurrency(intrastatTotals.amount) }}</QTd>
|
||||||
<QTd>{{ intrastatTotals.net }}</QTd>
|
<QTd>{{ intrastatTotals.net }}</QTd>
|
||||||
<QTd>{{ intrastatTotals.stems }}</QTd>
|
<QTd>{{ intrastatTotals.stems }}</QTd>
|
||||||
<QTd></QTd>
|
<QTd></QTd>
|
||||||
|
|
|
@ -2,18 +2,17 @@
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
import axios from 'axios';
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { getTotal } from 'src/composables/getTotal';
|
||||||
import { toCurrency } from 'src/filters';
|
import { toCurrency } from 'src/filters';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||||
|
import CreateNewExpenseForm from 'src/components/CreateNewExpenseForm.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const quasar = useQuasar();
|
|
||||||
|
|
||||||
const arrayData = useArrayData();
|
const arrayData = useArrayData();
|
||||||
const invoiceIn = computed(() => arrayData.store.data);
|
const invoiceIn = computed(() => arrayData.store.data);
|
||||||
|
@ -23,15 +22,7 @@ const expenses = ref([]);
|
||||||
const sageTaxTypes = ref([]);
|
const sageTaxTypes = ref([]);
|
||||||
const sageTransactionTypes = ref([]);
|
const sageTransactionTypes = ref([]);
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
const newExpense = ref({
|
|
||||||
code: undefined,
|
|
||||||
isWithheld: false,
|
|
||||||
description: undefined,
|
|
||||||
});
|
|
||||||
|
|
||||||
const invoiceInFormRef = ref();
|
const invoiceInFormRef = ref();
|
||||||
const expensesRef = ref();
|
|
||||||
const newExpenseRef = ref();
|
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
actionIcon: {
|
actionIcon: {
|
||||||
|
@ -56,7 +47,7 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
name: 'taxablebase',
|
name: 'taxablebase',
|
||||||
label: t('Taxable base'),
|
label: t('Taxable base'),
|
||||||
field: (row) => toCurrency(row.taxableBase, currency.value),
|
field: (row) => row.taxableBase,
|
||||||
model: 'taxableBase',
|
model: 'taxableBase',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
tabIndex: 2,
|
tabIndex: 2,
|
||||||
|
@ -91,7 +82,7 @@ const columns = computed(() => [
|
||||||
label: t('Rate'),
|
label: t('Rate'),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
tabIndex: 5,
|
tabIndex: 5,
|
||||||
field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk), currency.value),
|
field: (row) => taxRate(row, row.taxTypeSageFk),
|
||||||
align: 'left',
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -132,40 +123,6 @@ function taxRate(invoiceInTax) {
|
||||||
return (taxTypeSage / 100) * taxableBase;
|
return (taxTypeSage / 100) * taxableBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addExpense() {
|
|
||||||
try {
|
|
||||||
if (!newExpense.value.code) throw new Error(t(`The code can't be empty`));
|
|
||||||
if (isNaN(newExpense.value.code))
|
|
||||||
throw new Error(t(`The code have to be a number`));
|
|
||||||
if (!newExpense.value.description)
|
|
||||||
throw new Error(t(`The description can't be empty`));
|
|
||||||
|
|
||||||
const data = [
|
|
||||||
{
|
|
||||||
id: newExpense.value.code,
|
|
||||||
isWithheld: newExpense.value.isWithheld,
|
|
||||||
name: newExpense.value.description,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
await axios.post(`Expenses`, data);
|
|
||||||
await expensesRef.value.fetch();
|
|
||||||
quasar.notify({
|
|
||||||
type: 'positive',
|
|
||||||
message: t('globals.dataSaved'),
|
|
||||||
});
|
|
||||||
newExpenseRef.value.hide();
|
|
||||||
} catch (error) {
|
|
||||||
quasar.notify({
|
|
||||||
type: 'negative',
|
|
||||||
message: t(`${error.message}`),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const getTotalTaxableBase = (rows) =>
|
|
||||||
rows.reduce((acc, { taxableBase }) => acc + +(taxableBase || 0), 0);
|
|
||||||
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0);
|
|
||||||
|
|
||||||
const formatOpt = (row, { model, options }, prop) => {
|
const formatOpt = (row, { model, options }, prop) => {
|
||||||
const obj = row[model];
|
const obj = row[model];
|
||||||
const option = options.find(({ id }) => id == obj);
|
const option = options.find(({ id }) => id == obj);
|
||||||
|
@ -207,37 +164,25 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
>
|
>
|
||||||
<template #body-cell-expense="{ row, col }">
|
<template #body-cell-expense="{ row, col }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<VnSelect
|
<VnSelectDialog
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'name']"
|
:filter-options="['id', 'name']"
|
||||||
|
:tooltip="t('Create a new expense')"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
<template #append>
|
<template #form>
|
||||||
<QIcon
|
<CreateNewExpenseForm
|
||||||
name="close"
|
@on-data-saved="$refs.expensesRef.fetch()"
|
||||||
@click.stop="value = null"
|
|
||||||
class="cursor-pointer"
|
|
||||||
size="xs"
|
|
||||||
/>
|
/>
|
||||||
<QIcon
|
|
||||||
@click.stop.prevent="newExpenseRef.show()"
|
|
||||||
:name="actionIcon"
|
|
||||||
size="xs"
|
|
||||||
class="default-icon"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Create expense') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelectDialog>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-taxablebase="{ row }">
|
<template #body-cell-taxablebase="{ row }">
|
||||||
|
@ -325,12 +270,24 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd>
|
<QTd>
|
||||||
{{ toCurrency(getTotalTaxableBase(rows), currency) }}
|
{{ getTotal(rows, 'taxableBase', { currency: 'default' }) }}
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd> {{ toCurrency(getTotalRate(rows), currency) }}</QTd>
|
<QTd>
|
||||||
<QTd />
|
{{
|
||||||
|
getTotal(rows, null, { cb: taxRate, currency: 'default' })
|
||||||
|
}}</QTd
|
||||||
|
>
|
||||||
|
<QTd>
|
||||||
|
<template v-if="isNotEuro(invoiceIn.currency.code)">
|
||||||
|
{{
|
||||||
|
getTotal(rows, 'foreignValue', {
|
||||||
|
currency: invoiceIn.currency.code,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
</template>
|
||||||
|
</QTd>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
<template #item="props">
|
<template #item="props">
|
||||||
|
@ -342,7 +299,7 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QList>
|
<QList>
|
||||||
<QItem>
|
<QItem>
|
||||||
<VnSelect
|
<VnSelectDialog
|
||||||
:label="t('Expense')"
|
:label="t('Expense')"
|
||||||
class="full-width"
|
class="full-width"
|
||||||
v-model="props.row['expenseFk']"
|
v-model="props.row['expenseFk']"
|
||||||
|
@ -350,13 +307,17 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
:filter-options="['id', 'name']"
|
:filter-options="['id', 'name']"
|
||||||
|
:tooltip="t('Create a new expense')"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
<template #form>
|
||||||
|
<CreateNewExpenseForm />
|
||||||
|
</template>
|
||||||
|
</VnSelectDialog>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<VnInputNumber
|
<VnInputNumber
|
||||||
|
@ -439,44 +400,6 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
</QTable>
|
</QTable>
|
||||||
</template>
|
</template>
|
||||||
</CrudModel>
|
</CrudModel>
|
||||||
<QDialog ref="newExpenseRef">
|
|
||||||
<QCard>
|
|
||||||
<QCardSection class="q-pb-none">
|
|
||||||
<QItem class="q-pa-none">
|
|
||||||
<span class="text-primary text-h6 full-width">
|
|
||||||
<QIcon name="edit" class="q-mr-xs" />
|
|
||||||
{{ t('New expense') }}
|
|
||||||
</span>
|
|
||||||
<QBtn icon="close" flat round dense v-close-popup />
|
|
||||||
</QItem>
|
|
||||||
</QCardSection>
|
|
||||||
<QCardSection class="q-pt-none">
|
|
||||||
<QItem>
|
|
||||||
<VnInput
|
|
||||||
:label="`${t('Code')}*`"
|
|
||||||
v-model="newExpense.code"
|
|
||||||
:required="true"
|
|
||||||
/>
|
|
||||||
<QCheckbox
|
|
||||||
dense
|
|
||||||
size="sm"
|
|
||||||
:label="`${t('It\'s a withholding')}`"
|
|
||||||
v-model="newExpense.isWithheld"
|
|
||||||
/>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
<VnInput
|
|
||||||
:label="`${t('Descripction')}*`"
|
|
||||||
v-model="newExpense.description"
|
|
||||||
/>
|
|
||||||
</QItem>
|
|
||||||
</QCardSection>
|
|
||||||
<QCardActions class="justify-end">
|
|
||||||
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
|
|
||||||
<QBtn :label="t('globals.save')" color="primary" @click="addExpense" />
|
|
||||||
</QCardActions>
|
|
||||||
</QCard>
|
|
||||||
</QDialog>
|
|
||||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||||
<QBtn
|
<QBtn
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -484,7 +407,9 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
size="lg"
|
size="lg"
|
||||||
round
|
round
|
||||||
@click="invoiceInFormRef.insert()"
|
@click="invoiceInFormRef.insert()"
|
||||||
/>
|
>
|
||||||
|
<QTooltip>{{ t('Add tax') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -524,18 +449,11 @@ const formatOpt = (row, { model, options }, prop) => {
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Expense: Gasto
|
Expense: Gasto
|
||||||
Create expense: Crear gasto
|
Create a new expense: Crear nuevo gasto
|
||||||
Add tax: Crear gasto
|
Add tax: Crear gasto
|
||||||
Taxable base: Base imp.
|
Taxable base: Base imp.
|
||||||
Sage tax: Sage iva
|
Sage tax: Sage iva
|
||||||
Sage transaction: Sage transacción
|
Sage transaction: Sage transacción
|
||||||
Rate: Tasa
|
Rate: Tasa
|
||||||
Foreign value: Divisa
|
Foreign value: Divisa
|
||||||
New expense: Nuevo gasto
|
|
||||||
Code: Código
|
|
||||||
It's a withholding: Es una retención
|
|
||||||
Descripction: Descripción
|
|
||||||
The code can't be empty: El código no puede estar vacío
|
|
||||||
The description can't be empty: La descripción no puede estar vacía
|
|
||||||
The code have to be a number: El código debe ser un número.
|
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -28,6 +28,16 @@ const activities = ref([]);
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ params, searchFn }">
|
<template #body="{ params, searchFn }">
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInputDate :label="t('From')" v-model="params.from" is-outlined />
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
@ -64,16 +74,6 @@ const activities = ref([]);
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
|
||||||
<VnInput
|
|
||||||
:label="t('params.serialNumber')"
|
|
||||||
v-model="params.serialNumber"
|
|
||||||
is-outlined
|
|
||||||
lazy-rules
|
|
||||||
/>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -84,15 +84,6 @@ const activities = ref([]);
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
|
||||||
<VnInputDate
|
|
||||||
:label="t('Issued')"
|
|
||||||
v-model="params.issued"
|
|
||||||
is-outlined
|
|
||||||
/>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -140,22 +131,6 @@ const activities = ref([]);
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QExpansionItem :label="t('More options')" expand-separator>
|
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
|
||||||
<VnInputDate
|
|
||||||
:label="t('From')"
|
|
||||||
v-model="params.from"
|
|
||||||
is-outlined
|
|
||||||
/>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
|
||||||
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</QExpansionItem>
|
|
||||||
</template>
|
</template>
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
|
@ -179,6 +154,7 @@ en:
|
||||||
correctedFk: Rectified
|
correctedFk: Rectified
|
||||||
issued: Issued
|
issued: Issued
|
||||||
to: To
|
to: To
|
||||||
|
from: From
|
||||||
awbCode: AWB
|
awbCode: AWB
|
||||||
correctingFk: Rectificative
|
correctingFk: Rectificative
|
||||||
supplierActivityFk: Supplier activity
|
supplierActivityFk: Supplier activity
|
||||||
|
@ -201,6 +177,8 @@ es:
|
||||||
correctedFk: Rectificada
|
correctedFk: Rectificada
|
||||||
correctingFk: Rectificativa
|
correctingFk: Rectificativa
|
||||||
supplierActivityFk: Actividad proveedor
|
supplierActivityFk: Actividad proveedor
|
||||||
|
from: Desde
|
||||||
|
to: Hasta
|
||||||
From: Desde
|
From: Desde
|
||||||
To: Hasta
|
To: Hasta
|
||||||
Amount: Importe
|
Amount: Importe
|
||||||
|
|
|
@ -47,12 +47,6 @@ const cols = computed(() => [
|
||||||
name: 'supplierRef',
|
name: 'supplierRef',
|
||||||
label: t('invoiceIn.list.supplierRef'),
|
label: t('invoiceIn.list.supplierRef'),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'serialNumber',
|
|
||||||
label: t('invoiceIn.list.serialNumber'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'serial',
|
name: 'serial',
|
||||||
|
@ -141,7 +135,7 @@ const cols = computed(() => [
|
||||||
v-model="data.supplierFk"
|
v-model="data.supplierFk"
|
||||||
url="Suppliers"
|
url="Suppliers"
|
||||||
:fields="['id', 'nickname']"
|
:fields="['id', 'nickname']"
|
||||||
:label="t('Supplier')"
|
:label="t('globals.supplier')"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
:filter-options="['id', 'name']"
|
:filter-options="['id', 'name']"
|
||||||
|
@ -162,7 +156,7 @@ const cols = computed(() => [
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Companies"
|
url="Companies"
|
||||||
:label="t('Company')"
|
:label="t('globals.company')"
|
||||||
:fields="['id', 'code']"
|
:fields="['id', 'code']"
|
||||||
v-model="data.companyFk"
|
v-model="data.companyFk"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export async function setRectificative(route) {
|
||||||
|
const card = route.matched.find((route) => route.name === 'InvoiceInCard');
|
||||||
|
const corrective = card.children.find(
|
||||||
|
(route) => route.name === 'InvoiceInCorrective'
|
||||||
|
);
|
||||||
|
|
||||||
|
corrective.meta.hidden = !(
|
||||||
|
await axios.get('InvoiceInCorrections', {
|
||||||
|
params: { filter: { where: { correctingFk: route.params.id } } },
|
||||||
|
})
|
||||||
|
).data.length;
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
invoiceIn:
|
||||||
|
serial: Serial
|
||||||
|
list:
|
||||||
|
ref: Reference
|
||||||
|
supplier: Supplier
|
||||||
|
supplierRef: Supplier ref.
|
||||||
|
serial: Serial
|
||||||
|
file: File
|
||||||
|
issued: Issued
|
||||||
|
isBooked: Is booked
|
||||||
|
awb: AWB
|
||||||
|
amount: Amount
|
||||||
|
card:
|
||||||
|
issued: Issued
|
||||||
|
amount: Amount
|
||||||
|
client: Client
|
||||||
|
company: Company
|
||||||
|
customerCard: Customer card
|
||||||
|
ticketList: Ticket List
|
||||||
|
vat: Vat
|
||||||
|
dueDay: Due day
|
||||||
|
intrastat: Intrastat
|
||||||
|
summary:
|
||||||
|
supplier: Supplier
|
||||||
|
supplierRef: Supplier ref.
|
||||||
|
currency: Currency
|
||||||
|
issued: Expedition date
|
||||||
|
operated: Operation date
|
||||||
|
bookEntried: Entry date
|
||||||
|
bookedDate: Booked date
|
||||||
|
sage: Sage withholding
|
||||||
|
vat: Undeductible VAT
|
||||||
|
company: Company
|
||||||
|
booked: Booked
|
||||||
|
expense: Expense
|
||||||
|
taxableBase: Taxable base
|
||||||
|
rate: Rate
|
||||||
|
sageVat: Sage vat
|
||||||
|
sageTransaction: Sage transaction
|
||||||
|
dueDay: Date
|
||||||
|
bank: Bank
|
||||||
|
amount: Amount
|
||||||
|
foreignValue: Foreign value
|
||||||
|
dueTotal: Due day
|
||||||
|
noMatch: Do not match
|
||||||
|
code: Code
|
||||||
|
net: Net
|
||||||
|
stems: Stems
|
||||||
|
country: Country
|
|
@ -0,0 +1,47 @@
|
||||||
|
invoiceIn:
|
||||||
|
serial: Serie
|
||||||
|
list:
|
||||||
|
ref: Referencia
|
||||||
|
supplier: Proveedor
|
||||||
|
supplierRef: Ref. proveedor
|
||||||
|
shortIssued: F. emisión
|
||||||
|
file: Fichero
|
||||||
|
issued: Fecha emisión
|
||||||
|
isBooked: Conciliada
|
||||||
|
awb: AWB
|
||||||
|
amount: Importe
|
||||||
|
card:
|
||||||
|
issued: Fecha emisión
|
||||||
|
amount: Importe
|
||||||
|
client: Cliente
|
||||||
|
company: Empresa
|
||||||
|
customerCard: Ficha del cliente
|
||||||
|
ticketList: Listado de tickets
|
||||||
|
vat: Iva
|
||||||
|
dueDay: Fecha de vencimiento
|
||||||
|
summary:
|
||||||
|
supplier: Proveedor
|
||||||
|
supplierRef: Ref. proveedor
|
||||||
|
currency: Divisa
|
||||||
|
docNumber: Número documento
|
||||||
|
issued: Fecha de expedición
|
||||||
|
operated: Fecha operación
|
||||||
|
bookEntried: Fecha asiento
|
||||||
|
bookedDate: Fecha contable
|
||||||
|
sage: Retención sage
|
||||||
|
vat: Iva no deducible
|
||||||
|
company: Empresa
|
||||||
|
booked: Contabilizada
|
||||||
|
expense: Gasto
|
||||||
|
taxableBase: Base imp.
|
||||||
|
rate: Tasa
|
||||||
|
sageTransaction: Sage transación
|
||||||
|
dueDay: Fecha
|
||||||
|
bank: Caja
|
||||||
|
amount: Importe
|
||||||
|
foreignValue: Divisa
|
||||||
|
dueTotal: Vencimiento
|
||||||
|
code: Código
|
||||||
|
net: Neto
|
||||||
|
stems: Tallos
|
||||||
|
country: País
|
|
@ -10,8 +10,6 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import RegularizeStockForm from 'components/RegularizeStockForm.vue';
|
import RegularizeStockForm from 'components/RegularizeStockForm.vue';
|
||||||
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
||||||
|
|
||||||
import { useState } from 'src/composables/useState';
|
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
import { getUrl } from 'src/composables/getUrl';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -35,58 +33,69 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
warehouseFk: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const state = useState();
|
const warehouseConfig = ref(null);
|
||||||
const user = state.getUser();
|
|
||||||
|
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const regularizeStockFormDialog = ref(null);
|
const regularizeStockFormDialog = ref(null);
|
||||||
const available = ref(null);
|
const available = ref(null);
|
||||||
const visible = ref(null);
|
const visible = ref(null);
|
||||||
const _warehouseFk = ref(null);
|
|
||||||
const salixUrl = ref();
|
const salixUrl = ref();
|
||||||
const warehouseFk = computed({
|
|
||||||
get() {
|
|
||||||
return _warehouseFk.value;
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
_warehouseFk.value = val;
|
|
||||||
if (val) updateStock();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
warehouseFk.value = user.value.warehouseFk;
|
|
||||||
salixUrl.value = await getUrl('');
|
salixUrl.value = await getUrl('');
|
||||||
|
await getItemConfigs();
|
||||||
|
await updateStock();
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
const data = ref(useCardDescription());
|
||||||
const setData = (entity) => {
|
const setData = async (entity) => {
|
||||||
if (!entity) return;
|
try {
|
||||||
data.value = useCardDescription(entity.name, entity.id);
|
if (!entity) return;
|
||||||
|
data.value = useCardDescription(entity.name, entity.id);
|
||||||
|
await updateStock();
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error item');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getItemConfigs = async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await axios.get('ItemConfigs/findOne');
|
||||||
|
if (!data) return;
|
||||||
|
return (warehouseConfig.value = data.warehouseFk);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error item');
|
||||||
|
}
|
||||||
|
};
|
||||||
const updateStock = async () => {
|
const updateStock = async () => {
|
||||||
try {
|
try {
|
||||||
available.value = null;
|
available.value = null;
|
||||||
visible.value = null;
|
visible.value = null;
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
warehouseFk: warehouseFk.value,
|
warehouseFk: $props.warehouseFk,
|
||||||
dated: $props.dated,
|
dated: $props.dated,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
await getItemConfigs();
|
||||||
|
if (!params.warehouseFk) {
|
||||||
|
params.warehouseFk = warehouseConfig.value;
|
||||||
|
}
|
||||||
const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, {
|
const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
|
|
||||||
available.value = data.available;
|
available.value = data.available;
|
||||||
visible.value = data.visible;
|
visible.value = data.visible;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -47,8 +47,11 @@ const getWarehouseName = async (warehouseFk) => {
|
||||||
const filter = {
|
const filter = {
|
||||||
where: { id: warehouseFk },
|
where: { id: warehouseFk },
|
||||||
};
|
};
|
||||||
|
const { data } = await axios.get('Warehouses/findOne', {
|
||||||
const { data } = await axios.get('Warehouses/findOne', { filter });
|
params: {
|
||||||
|
filter: JSON.stringify(filter),
|
||||||
|
},
|
||||||
|
});
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
warehouseName.value = data.name;
|
warehouseName.value = data.name;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,10 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
warehouseFk: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -26,6 +30,7 @@ const $props = defineProps({
|
||||||
:summary="ItemSummary"
|
:summary="ItemSummary"
|
||||||
:dated="dated"
|
:dated="dated"
|
||||||
:sale-fk="saleFk"
|
:sale-fk="saleFk"
|
||||||
|
:warehouse-fk="warehouseFk"
|
||||||
/>
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -7,8 +7,7 @@ import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
import { useRole } from 'src/composables/useRole';
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -19,23 +18,10 @@ const $props = defineProps({
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const roleState = useRole();
|
|
||||||
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
|
const getUrl = (id, param) => `#/Item/${id}/${param}`;
|
||||||
const isBuyer = computed(() => {
|
|
||||||
return roleState.hasAny(['buyer']);
|
|
||||||
});
|
|
||||||
|
|
||||||
const isReplenisher = computed(() => {
|
|
||||||
return roleState.hasAny(['replenisher']);
|
|
||||||
});
|
|
||||||
|
|
||||||
const isAdministrative = computed(() => {
|
|
||||||
return roleState.hasAny(['administrative']);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
ref="summary"
|
ref="summary"
|
||||||
|
@ -44,13 +30,15 @@ const isAdministrative = computed(() => {
|
||||||
data-key="ItemSummary"
|
data-key="ItemSummary"
|
||||||
>
|
>
|
||||||
<template #header-left>
|
<template #header-left>
|
||||||
<router-link
|
<QBtn
|
||||||
v-if="route.name !== 'ItemSummary'"
|
v-if="$route.name !== 'ItemSummary'"
|
||||||
:to="{ name: 'ItemSummary', params: { id: entityId } }"
|
:to="{ name: 'ItemSummary', params: { id: entityId } }"
|
||||||
class="header link"
|
class="header link--white"
|
||||||
>
|
icon="open_in_new"
|
||||||
<QIcon name="open_in_new" color="white" size="sm" />
|
flat
|
||||||
</router-link>
|
dense
|
||||||
|
round
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #header="{ entity: { item } }">
|
<template #header="{ entity: { item } }">
|
||||||
{{ item.id }} - {{ item.name }}
|
{{ item.id }} - {{ item.name }}
|
||||||
|
@ -65,15 +53,10 @@ const isAdministrative = computed(() => {
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<component
|
<VnTitle
|
||||||
:is="isBuyer ? 'router-link' : 'span'"
|
:url="getUrl(entityId, 'basic-data')"
|
||||||
:to="{ name: 'ItemBasicData', params: { id: entityId } }"
|
:text="t('item.summary.basicData')"
|
||||||
class="header"
|
/>
|
||||||
:class="{ 'header-link': isBuyer }"
|
|
||||||
>
|
|
||||||
{{ t('item.summary.basicData') }}
|
|
||||||
<QIcon v-if="isBuyer" name="open_in_new" />
|
|
||||||
</component>
|
|
||||||
<VnLv :label="t('item.summary.name')" :value="item.name" />
|
<VnLv :label="t('item.summary.name')" :value="item.name" />
|
||||||
<VnLv :label="t('item.summary.completeName')" :value="item.longName" />
|
<VnLv :label="t('item.summary.completeName')" :value="item.longName" />
|
||||||
<VnLv :label="t('item.summary.family')" :value="item.itemType.name" />
|
<VnLv :label="t('item.summary.family')" :value="item.itemType.name" />
|
||||||
|
@ -104,15 +87,10 @@ const isAdministrative = computed(() => {
|
||||||
</VnLv>
|
</VnLv>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<component
|
<VnTitle
|
||||||
:is="isBuyer ? 'router-link' : 'span'"
|
:url="getUrl(entityId, 'basic-data')"
|
||||||
:to="{ name: 'ItemBasicData', params: { id: entityId } }"
|
:text="t('item.summary.otherData')"
|
||||||
class="header"
|
/>
|
||||||
:class="{ 'header-link': isBuyer }"
|
|
||||||
>
|
|
||||||
{{ t('item.summary.otherData') }}
|
|
||||||
<QIcon v-if="isBuyer" name="open_in_new" />
|
|
||||||
</component>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('item.summary.intrastatCode')"
|
:label="t('item.summary.intrastatCode')"
|
||||||
:value="item.intrastat.id"
|
:value="item.intrastat.id"
|
||||||
|
@ -137,15 +115,7 @@ const isAdministrative = computed(() => {
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<component
|
<VnTitle :url="getUrl(entityId, 'tags')" :text="t('item.summary.tags')" />
|
||||||
:is="isBuyer || isReplenisher ? 'router-link' : 'span'"
|
|
||||||
:to="{ name: 'ItemTags', params: { id: entityId } }"
|
|
||||||
class="header"
|
|
||||||
:class="{ 'header-link': isBuyer || isReplenisher }"
|
|
||||||
>
|
|
||||||
{{ t('item.summary.tags') }}
|
|
||||||
<QIcon v-if="isBuyer || isReplenisher" name="open_in_new" />
|
|
||||||
</component>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
v-for="(tag, index) in tags"
|
v-for="(tag, index) in tags"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@ -154,29 +124,14 @@ const isAdministrative = computed(() => {
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one" v-if="item.description">
|
<QCard class="vn-one" v-if="item.description">
|
||||||
<component
|
<VnTitle
|
||||||
:is="isBuyer ? 'router-link' : 'span'"
|
:url="getUrl(entityId, 'basic-data')"
|
||||||
:to="{ name: 'ItemBasicData', params: { id: entityId } }"
|
:text="t('item.summary.description')"
|
||||||
class="header"
|
/>
|
||||||
:class="{ 'header-link': isBuyer }"
|
<p v-text="item.description" />
|
||||||
>
|
|
||||||
{{ t('item.summary.description') }}
|
|
||||||
<QIcon v-if="isBuyer" name="open_in_new" />
|
|
||||||
</component>
|
|
||||||
<p>
|
|
||||||
{{ item.description }}
|
|
||||||
</p>
|
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<component
|
<VnTitle :url="getUrl(entityId, 'tax')" :text="t('item.summary.tax')" />
|
||||||
:is="isBuyer || isAdministrative ? 'router-link' : 'span'"
|
|
||||||
:to="{ name: 'ItemTax', params: { id: entityId } }"
|
|
||||||
class="header"
|
|
||||||
:class="{ 'header-link': isBuyer || isAdministrative }"
|
|
||||||
>
|
|
||||||
{{ t('item.summary.tax') }}
|
|
||||||
<QIcon v-if="isBuyer || isAdministrative" name="open_in_new" />
|
|
||||||
</component>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
v-for="(tax, index) in item.taxes"
|
v-for="(tax, index) in item.taxes"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@ -185,15 +140,10 @@ const isAdministrative = computed(() => {
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<component
|
<VnTitle
|
||||||
:is="isBuyer ? 'router-link' : 'span'"
|
:url="getUrl(entityId, 'botanical')"
|
||||||
:to="{ name: 'ItemBotanical', params: { id: entityId } }"
|
:text="t('item.summary.botanical')"
|
||||||
class="header"
|
/>
|
||||||
:class="{ 'header-link': isBuyer }"
|
|
||||||
>
|
|
||||||
{{ t('item.summary.botanical') }}
|
|
||||||
<QIcon v-if="isBuyer" name="open_in_new" />
|
|
||||||
</component>
|
|
||||||
<VnLv :label="t('item.summary.genus')" :value="botanical?.genus?.name" />
|
<VnLv :label="t('item.summary.genus')" :value="botanical?.genus?.name" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('item.summary.specie')"
|
:label="t('item.summary.specie')"
|
||||||
|
@ -201,23 +151,19 @@ const isAdministrative = computed(() => {
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<component
|
<VnTitle
|
||||||
:is="isBuyer || isReplenisher ? 'router-link' : 'span'"
|
:url="getUrl(entityId, 'barcode')"
|
||||||
:to="{ name: 'ItemBarcode', params: { id: entityId } }"
|
:text="t('item.summary.barcode')"
|
||||||
class="header"
|
/>
|
||||||
:class="{ 'header-link': isBuyer || isReplenisher }"
|
<p
|
||||||
>
|
v-for="(barcode, index) in item.itemBarcode"
|
||||||
{{ t('item.summary.barcode') }}
|
:key="index"
|
||||||
<QIcon v-if="isBuyer || isReplenisher" name="open_in_new" />
|
v-text="barcode.code"
|
||||||
</component>
|
/>
|
||||||
<p v-for="(barcode, index) in item.itemBarcode" :key="index">
|
|
||||||
{{ barcode.code }}
|
|
||||||
</p>
|
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
Este artículo necesita una foto: Este artículo necesita una foto
|
Este artículo necesita una foto: Este artículo necesita una foto
|
||||||
|
|
|
@ -1,196 +1,190 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, reactive, computed, onUnmounted, watch } from 'vue';
|
import { onMounted, ref, reactive, onUnmounted, nextTick, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import EditTableCellValueForm from 'src/components/EditTableCellValueForm.vue';
|
import EditTableCellValueForm from 'src/components/EditTableCellValueForm.vue';
|
||||||
import ItemFixedPriceFilter from './ItemFixedPriceFilter.vue';
|
import ItemFixedPriceFilter from './ItemFixedPriceFilter.vue';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
|
||||||
|
import { tMobile } from 'src/composables/tMobile';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { toCurrency } from 'filters/index';
|
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
|
||||||
import { isLower, isBigger } from 'src/filters/date.js';
|
import { isLower, isBigger } from 'src/filters/date.js';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import { QCheckbox } from 'quasar';
|
||||||
|
|
||||||
|
const quasar = useQuasar();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
const tableRef = ref();
|
||||||
const editTableCellDialogRef = ref(null);
|
const editTableCellDialogRef = ref(null);
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const fixedPrices = ref([]);
|
const fixedPrices = ref([]);
|
||||||
const fixedPricesOriginalData = ref([]);
|
|
||||||
const warehousesOptions = ref([]);
|
const warehousesOptions = ref([]);
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const itemFixedPriceFilterRef = ref();
|
||||||
switch (param) {
|
|
||||||
case 'name':
|
|
||||||
return { 'i.name': { like: `%${value}%` } };
|
|
||||||
case 'itemFk':
|
|
||||||
case 'warehouseFk':
|
|
||||||
case 'rate2':
|
|
||||||
case 'rate3':
|
|
||||||
param = `fp.${param}`;
|
|
||||||
return { [param]: value };
|
|
||||||
case 'minPrice':
|
|
||||||
param = `i.${param}`;
|
|
||||||
return { [param]: value };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const params = reactive({});
|
const params = reactive({});
|
||||||
const arrayData = useArrayData('ItemFixedPrices', {
|
|
||||||
url: 'FixedPrices/filter',
|
|
||||||
userParams: params,
|
|
||||||
order: ['name ASC', 'itemFk'],
|
|
||||||
exprBuilder: exprBuilder,
|
|
||||||
});
|
|
||||||
const store = arrayData.store;
|
|
||||||
|
|
||||||
const fetchFixedPrices = async () => {
|
|
||||||
await arrayData.fetch({ append: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
const onFixedPricesFetched = (data) => {
|
|
||||||
fixedPrices.value = data;
|
|
||||||
// el objetivo de guardar una copia de las rows es evitar guardar cambios si la data no cambió al disparar los eventos
|
|
||||||
fixedPricesOriginalData.value = JSON.parse(JSON.stringify(data));
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => store.data,
|
|
||||||
(data) => onFixedPricesFetched(data)
|
|
||||||
);
|
|
||||||
|
|
||||||
const applyColumnFilter = async (col) => {
|
|
||||||
try {
|
|
||||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
|
||||||
params[paramKey] = col.columnFilter.filterValue;
|
|
||||||
await arrayData.addFilter({ params });
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error applying column filter', err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getColumnInputEvents = (col) => {
|
|
||||||
return col.columnFilter.type === 'select'
|
|
||||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
|
||||||
: {
|
|
||||||
'keyup.enter': () => applyColumnFilter(col),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const defaultColumnFilter = {
|
|
||||||
component: VnInput,
|
|
||||||
type: 'text',
|
|
||||||
filterValue: null,
|
|
||||||
event: getColumnInputEvents,
|
|
||||||
attrs: {
|
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const defaultColumnAttrs = {
|
const defaultColumnAttrs = {
|
||||||
align: 'left',
|
align: 'left',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
};
|
};
|
||||||
|
onMounted(async () => {
|
||||||
|
stateStore.rightDrawer = true;
|
||||||
|
params.warehouseFk = user.value.warehouseFk;
|
||||||
|
});
|
||||||
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.itemId'),
|
label: t('item.fixedPrice.itemId'),
|
||||||
name: 'itemId',
|
name: 'itemId',
|
||||||
field: 'itemFk',
|
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnFilter: {
|
isId: true,
|
||||||
...defaultColumnFilter,
|
cardVisible: true,
|
||||||
|
columnField: {
|
||||||
|
component: 'input',
|
||||||
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
columnClass: 'shrink',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('globals.description'),
|
label: t('globals.name'),
|
||||||
field: 'name',
|
field: 'name',
|
||||||
name: 'description',
|
name: 'description',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnFilter: {
|
create: true,
|
||||||
...defaultColumnFilter,
|
cardVisible: true,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.groupingPrice'),
|
label: t('item.fixedPrice.groupingPrice'),
|
||||||
field: 'rate2',
|
field: 'rate2',
|
||||||
name: 'groupingPrice',
|
name: 'rate2',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnFilter: {
|
cardVisible: true,
|
||||||
...defaultColumnFilter,
|
columnField: {
|
||||||
|
class: 'expand',
|
||||||
|
component: 'input',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
columnFilter: {
|
||||||
|
class: 'expand',
|
||||||
|
component: 'input',
|
||||||
|
type: 'number',
|
||||||
},
|
},
|
||||||
format: (val) => toCurrency(val),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.packingPrice'),
|
label: t('item.fixedPrice.packingPrice'),
|
||||||
field: 'rate3',
|
field: 'rate3',
|
||||||
name: 'packingPrice',
|
name: 'rate3',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnFilter: {
|
cardVisible: true,
|
||||||
...defaultColumnFilter,
|
columnField: {
|
||||||
|
class: 'expand',
|
||||||
|
component: 'input',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
|
columnFilter: {
|
||||||
|
class: 'expand',
|
||||||
|
component: 'input',
|
||||||
|
type: 'number',
|
||||||
},
|
},
|
||||||
format: (val) => dashIfEmpty(val),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.minPrice'),
|
label: t('item.fixedPrice.minPrice'),
|
||||||
field: 'minPrice',
|
field: 'minPrice',
|
||||||
|
columnClass: 'shrink',
|
||||||
name: 'minPrice',
|
name: 'minPrice',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
|
cardVisible: true,
|
||||||
|
columnField: {
|
||||||
|
class: 'expand',
|
||||||
|
component: 'input',
|
||||||
|
type: 'number',
|
||||||
|
},
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
...defaultColumnFilter,
|
class: 'expand',
|
||||||
|
component: 'input',
|
||||||
|
type: 'number',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.started'),
|
label: t('item.fixedPrice.started'),
|
||||||
field: 'started',
|
field: 'started',
|
||||||
name: 'started',
|
name: 'started',
|
||||||
|
format: ({ started }) => toDate(started),
|
||||||
|
cardVisible: true,
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnFilter: null,
|
columnField: {
|
||||||
|
component: 'date',
|
||||||
|
class: 'shrink',
|
||||||
|
},
|
||||||
|
columnFilter: {
|
||||||
|
component: 'date',
|
||||||
|
},
|
||||||
|
columnClass: 'expand',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.ended'),
|
label: t('item.fixedPrice.ended'),
|
||||||
field: 'ended',
|
field: 'ended',
|
||||||
name: 'ended',
|
name: 'ended',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnFilter: null,
|
cardVisible: true,
|
||||||
|
columnField: {
|
||||||
|
component: 'date',
|
||||||
|
class: 'shrink',
|
||||||
|
},
|
||||||
|
columnFilter: {
|
||||||
|
component: 'date',
|
||||||
|
},
|
||||||
|
columnClass: 'expand',
|
||||||
|
format: (row) => toDate(row.ended),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.warehouse'),
|
label: t('item.fixedPrice.warehouse'),
|
||||||
field: 'warehouseFk',
|
field: 'warehouseFk',
|
||||||
name: 'warehouse',
|
name: 'warehouseFk',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
|
columnClass: 'shrink',
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: VnSelect,
|
component: 'select',
|
||||||
type: 'select',
|
},
|
||||||
filterValue: null,
|
columnField: {
|
||||||
event: getColumnInputEvents,
|
component: 'select',
|
||||||
attrs: {
|
class: 'expand',
|
||||||
options: warehousesOptions.value,
|
},
|
||||||
'option-value': 'id',
|
attrs: {
|
||||||
'option-label': 'name',
|
options: warehousesOptions,
|
||||||
dense: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ name: 'deleteAction', align: 'center' },
|
{
|
||||||
|
align: 'right',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('delete'),
|
||||||
|
icon: 'delete',
|
||||||
|
action: (row) => confirmRemove(row),
|
||||||
|
isPrimary: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const editTableFieldsOptions = [
|
const editTableFieldsOptions = [
|
||||||
|
@ -218,15 +212,6 @@ const editTableFieldsOptions = [
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
field: 'hasMinPrice',
|
|
||||||
label: t('item.fixedPrice.hasMinPrice'),
|
|
||||||
component: 'checkbox',
|
|
||||||
attrs: {
|
|
||||||
'false-value': 0,
|
|
||||||
'true-value': 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'started',
|
field: 'started',
|
||||||
label: t('item.fixedPrice.started'),
|
label: t('item.fixedPrice.started'),
|
||||||
|
@ -248,7 +233,6 @@ const editTableFieldsOptions = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
||||||
return inputType === 'text'
|
return inputType === 'text'
|
||||||
? {
|
? {
|
||||||
|
@ -258,91 +242,6 @@ const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
||||||
: { 'update:modelValue': () => upsertPrice(props, resetMinPrice) };
|
: { 'update:modelValue': () => upsertPrice(props, resetMinPrice) };
|
||||||
};
|
};
|
||||||
|
|
||||||
const validations = (row, rowIndex, col) => {
|
|
||||||
const isNew = !row.id;
|
|
||||||
// Si la row no tiene id significa que fue agregada con addRow y no se ha guardado en la base de datos
|
|
||||||
// Si isNew es falso no se checkea si el valor es igual a la original
|
|
||||||
if (!isNew)
|
|
||||||
if (fixedPricesOriginalData.value[rowIndex][col.field] == row[col.field])
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const requiredFields = ['itemFk', 'started', 'ended', 'rate2', 'rate3'];
|
|
||||||
return requiredFields.every(
|
|
||||||
(field) => row[field] !== null && row[field] !== undefined
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const upsertPrice = async ({ row, col, rowIndex }, resetMinPrice = false) => {
|
|
||||||
if (!validations(row, rowIndex, col)) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (resetMinPrice) row.hasMinPrice = 0;
|
|
||||||
|
|
||||||
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
|
||||||
row = data;
|
|
||||||
fixedPricesOriginalData.value[rowIndex][col.field] = row[col.field];
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error editing price', err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const addRow = () => {
|
|
||||||
if (!fixedPrices.value || fixedPrices.value.length === 0) {
|
|
||||||
fixedPrices.value = [];
|
|
||||||
|
|
||||||
const today = Date.vnNew();
|
|
||||||
const millisecsInDay = 86400000;
|
|
||||||
const daysInWeek = 7;
|
|
||||||
const nextWeek = new Date(today.getTime() + daysInWeek * millisecsInDay);
|
|
||||||
|
|
||||||
const newPrice = {
|
|
||||||
started: today,
|
|
||||||
ended: nextWeek,
|
|
||||||
hasMinPrice: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
fixedPricesOriginalData.value.push({ ...newPrice });
|
|
||||||
fixedPrices.value.push({ ...newPrice });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lastItemCopy = JSON.parse(
|
|
||||||
JSON.stringify(fixedPrices.value[fixedPrices.value.length - 1])
|
|
||||||
);
|
|
||||||
delete lastItemCopy.id;
|
|
||||||
fixedPricesOriginalData.value.push(lastItemCopy);
|
|
||||||
fixedPrices.value.push(lastItemCopy);
|
|
||||||
};
|
|
||||||
|
|
||||||
const openEditTableCellDialog = () => {
|
|
||||||
editTableCellDialogRef.value.show();
|
|
||||||
};
|
|
||||||
|
|
||||||
const onEditCellDataSaved = async () => {
|
|
||||||
rowsSelected.value = [];
|
|
||||||
await fetchFixedPrices();
|
|
||||||
};
|
|
||||||
|
|
||||||
const onWarehousesFetched = (data) => {
|
|
||||||
warehousesOptions.value = data;
|
|
||||||
// Actualiza las 'options' del elemento con field 'warehouseFk' en 'editTableFieldsOptions'.
|
|
||||||
const warehouseField = editTableFieldsOptions.find(
|
|
||||||
(field) => field.field === 'warehouseFk'
|
|
||||||
);
|
|
||||||
warehouseField.attrs.options = data;
|
|
||||||
};
|
|
||||||
|
|
||||||
const removePrice = async (id, rowIndex) => {
|
|
||||||
try {
|
|
||||||
await axios.delete(`FixedPrices/${id}`);
|
|
||||||
fixedPrices.value.splice(rowIndex, 1);
|
|
||||||
fixedPricesOriginalData.value.splice(rowIndex, 1);
|
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing price', err);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateMinPrice = async (value, props) => {
|
const updateMinPrice = async (value, props) => {
|
||||||
// El checkbox hasMinPrice se encuentra en la misma columna que el input hasMinPrice
|
// El checkbox hasMinPrice se encuentra en la misma columna que el input hasMinPrice
|
||||||
// Por lo tanto le mandamos otro objeto con las mismas propiedades pero con el campo 'field' cambiado
|
// Por lo tanto le mandamos otro objeto con las mismas propiedades pero con el campo 'field' cambiado
|
||||||
|
@ -354,213 +253,361 @@ const updateMinPrice = async (value, props) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
const upsertPrice = async (props, resetMinPrice = false) => {
|
||||||
stateStore.rightDrawer = true;
|
try {
|
||||||
params.warehouseFk = user.value.warehouseFk;
|
const { row } = props;
|
||||||
await fetchFixedPrices();
|
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
||||||
});
|
if (resetMinPrice) row.hasMinPrice = 0;
|
||||||
|
await upsertFixedPrice(row);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error editing price', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
async function upsertFixedPrice(row) {
|
||||||
|
try {
|
||||||
|
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
||||||
|
return data;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error editing price', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveOnRowChange(row) {
|
||||||
|
if (rowsSelected.value.length > 1) return;
|
||||||
|
if (rowsSelected.value[0]?.id === row.id) return;
|
||||||
|
else if (rowsSelected.value.length === 1) await upsertPrice(rowsSelected.value[0]);
|
||||||
|
rowsSelected.value = [row];
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkLastVisibleRow() {
|
||||||
|
let lastVisibleRow = null;
|
||||||
|
|
||||||
|
getTableRows().forEach((row, index) => {
|
||||||
|
const rect = row.getBoundingClientRect();
|
||||||
|
if (rect.top >= 0 && rect.bottom <= window.innerHeight) {
|
||||||
|
lastVisibleRow = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return lastVisibleRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
const addRow = (original = null) => {
|
||||||
|
let copy = null;
|
||||||
|
if (!original) {
|
||||||
|
const today = Date.vnNew();
|
||||||
|
const millisecsInDay = 86400000;
|
||||||
|
const daysInWeek = 7;
|
||||||
|
const nextWeek = new Date(today.getTime() + daysInWeek * millisecsInDay);
|
||||||
|
|
||||||
|
copy = {
|
||||||
|
id: 0,
|
||||||
|
started: today,
|
||||||
|
ended: nextWeek,
|
||||||
|
hasMinPrice: 0,
|
||||||
|
$index: 0,
|
||||||
|
};
|
||||||
|
} else
|
||||||
|
copy = {
|
||||||
|
$index: original.$index - 1,
|
||||||
|
itemFk: original.itemFk,
|
||||||
|
name: original.name,
|
||||||
|
subName: original.subName,
|
||||||
|
value5: original.value5,
|
||||||
|
value6: original.value6,
|
||||||
|
value7: original.value7,
|
||||||
|
value8: original.value8,
|
||||||
|
value9: original.value9,
|
||||||
|
value10: original.value10,
|
||||||
|
warehouseFk: original.warehouseFk,
|
||||||
|
rate2: original.rate2,
|
||||||
|
rate3: original.rate3,
|
||||||
|
hasMinPrice: original.hasMinPrice,
|
||||||
|
minPrice: original.minPrice,
|
||||||
|
started: Date.vnNew(),
|
||||||
|
ended: Date.vnNew(),
|
||||||
|
};
|
||||||
|
return { original, copy };
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTableRows = () =>
|
||||||
|
document.getElementsByClassName('q-table')[0].querySelectorAll('tr.cursor-pointer');
|
||||||
|
|
||||||
|
function highlightNewRow({ $index: index }) {
|
||||||
|
const row = getTableRows()[index];
|
||||||
|
if (row) {
|
||||||
|
row.classList.add('highlight');
|
||||||
|
setTimeout(() => {
|
||||||
|
row.classList.remove('highlight');
|
||||||
|
}, 3000); // Duración de la animación en milisegundos
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const openEditTableCellDialog = () => {
|
||||||
|
editTableCellDialogRef.value.show();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onEditCellDataSaved = async () => {
|
||||||
|
rowsSelected.value = [];
|
||||||
|
tableRef.value.reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeFuturePrice = async () => {
|
||||||
|
try {
|
||||||
|
rowsSelected.value.forEach(({ id }) => {
|
||||||
|
const rowIndex = fixedPrices.value.findIndex(({ id }) => id === id);
|
||||||
|
removePrice(id, rowIndex);
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error removing price', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function confirmRemove(item, isFuture) {
|
||||||
|
const promise = async () =>
|
||||||
|
isFuture ? removeFuturePrice(item.id) : removePrice(item.id);
|
||||||
|
quasar.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('globals.rowWillBeRemoved'),
|
||||||
|
message: t('globals.confirmDeletion'),
|
||||||
|
promise,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const removePrice = async (id) => {
|
||||||
|
try {
|
||||||
|
await axios.delete(`FixedPrices/${id}`);
|
||||||
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
tableRef.value.reload({});
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error removing price', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const dateStyle = (date) =>
|
||||||
|
date
|
||||||
|
? {
|
||||||
|
'bg-color': 'warning',
|
||||||
|
'is-outlined': true,
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
|
||||||
|
function handleOnDataSave({ CrudModelRef }) {
|
||||||
|
const { original, copy } = addRow(CrudModelRef.formData[checkLastVisibleRow()]);
|
||||||
|
if (original) {
|
||||||
|
CrudModelRef.formData.splice(original?.$index ?? 0, 0, copy);
|
||||||
|
} else {
|
||||||
|
CrudModelRef.insert(copy);
|
||||||
|
}
|
||||||
|
nextTick(() => {
|
||||||
|
highlightNewRow(original ?? { $index: 0 });
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Warehouses"
|
@on-fetch="(data) => (warehousesOptions = data)"
|
||||||
:filter="{ order: ['name'] }"
|
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => onWarehousesFetched(data)"
|
url="Warehouses"
|
||||||
|
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<ItemFixedPriceFilter
|
<ItemFixedPriceFilter
|
||||||
data-key="ItemFixedPrices"
|
data-key="ItemFixedPrices"
|
||||||
:warehouses-options="warehousesOptions"
|
ref="itemFixedPriceFilterRef"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<QPage class="column items-center q-pa-md">
|
<VnSubToolbar>
|
||||||
<QTable
|
<template #st-data>
|
||||||
:rows="fixedPrices"
|
<QBtn
|
||||||
|
v-if="rowsSelected.length"
|
||||||
|
@click="openEditTableCellDialog()"
|
||||||
|
color="primary"
|
||||||
|
icon="edit"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('Edit fixed price(s)') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
:label="tMobile('globals.remove')"
|
||||||
|
color="primary"
|
||||||
|
icon="delete"
|
||||||
|
flat
|
||||||
|
@click="(row) => confirmRemove(row, true)"
|
||||||
|
:title="t('globals.remove')"
|
||||||
|
v-if="rowsSelected.length"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnSubToolbar>
|
||||||
|
<QPage>
|
||||||
|
<VnTable
|
||||||
|
@on-fetch="
|
||||||
|
(data) =>
|
||||||
|
data.forEach((item) => {
|
||||||
|
item.hasMinPrice = `${item.hasMinPrice !== 0}`;
|
||||||
|
})
|
||||||
|
"
|
||||||
|
:default-remove="false"
|
||||||
|
:default-reset="false"
|
||||||
|
:default-save="false"
|
||||||
|
data-key="ItemFixedPrices"
|
||||||
|
url="FixedPrices/filter"
|
||||||
|
:order="['itemFk ASC']"
|
||||||
|
save-url="FixedPrices/crud"
|
||||||
|
:user-params="{ warehouseFk: user.warehouseFk }"
|
||||||
|
ref="tableRef"
|
||||||
|
dense
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
row-key="id"
|
default-mode="table"
|
||||||
selection="multiple"
|
auto-load
|
||||||
|
:is-editable="true"
|
||||||
|
:right-search="false"
|
||||||
|
:table="{
|
||||||
|
'row-key': 'id',
|
||||||
|
selection: 'multiple',
|
||||||
|
}"
|
||||||
|
:crud-model="{
|
||||||
|
paginate: false,
|
||||||
|
}"
|
||||||
v-model:selected="rowsSelected"
|
v-model:selected="rowsSelected"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:row-click="saveOnRowChange"
|
||||||
class="full-width q-mt-md"
|
:create-as-dialog="false"
|
||||||
:no-data-label="t('globals.noResults')"
|
:create="{
|
||||||
|
onDataSaved: handleOnDataSave,
|
||||||
|
}"
|
||||||
|
:use-model="true"
|
||||||
|
:disable-option="{ card: true }"
|
||||||
>
|
>
|
||||||
<template #top-row="{ cols }">
|
<template #header-selection="scope">
|
||||||
<QTr>
|
<QCheckbox v-model="scope.selected" />
|
||||||
<QTd />
|
</template>
|
||||||
<QTd
|
<template #body-selection="scope">
|
||||||
v-for="(col, index) in cols"
|
{{ scope }}
|
||||||
:key="index"
|
<QCheckbox flat v-model="scope.selected" />
|
||||||
style="max-width: 100px"
|
|
||||||
>
|
|
||||||
<component
|
|
||||||
:is="col.columnFilter.component"
|
|
||||||
v-if="col.columnFilter"
|
|
||||||
v-model="col.columnFilter.filterValue"
|
|
||||||
v-bind="col.columnFilter.attrs"
|
|
||||||
v-on="col.columnFilter.event(col)"
|
|
||||||
dense
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</QTr>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #body-cell-itemId="props">
|
<template #column-itemId="props">
|
||||||
<QTd>
|
<VnSelect
|
||||||
<VnSelect
|
style="max-width: 100px"
|
||||||
url="Items/withName"
|
url="Items/withName"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="id"
|
option-label="id"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="props.row.itemFk"
|
v-model="props.row.itemFk"
|
||||||
v-on="getRowUpdateInputEvents(props, true, 'select')"
|
v-on="getRowUpdateInputEvents(props, true, 'select')"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
||||||
<QItemLabel caption>{{ scope.opt?.name }}</QItemLabel>
|
<QItemLabel caption>{{ scope.opt?.name }}</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-description="{ row }">
|
<template #column-description="{ row }">
|
||||||
<QTd class="col">
|
<span class="link">
|
||||||
<span class="link">
|
{{ row.name }}
|
||||||
{{ row.name }}
|
</span>
|
||||||
</span>
|
<span class="subName">{{ row.subName }}</span>
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
<FetchedTags :item="row" />
|
<FetchedTags style="width: max-content; max-width: 220px" :item="row" />
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-groupingPrice="props">
|
<template #column-rate2="props">
|
||||||
<QTd class="col">
|
<VnInput
|
||||||
<VnInput
|
mask="###.##"
|
||||||
v-model.number="props.row.rate2"
|
v-model.number="props.row.rate2"
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
v-on="getRowUpdateInputEvents(props)"
|
||||||
>
|
>
|
||||||
<template #append>€</template>
|
<template #append>€</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-packingPrice="props">
|
<template #column-rate3="props">
|
||||||
<QTd class="col">
|
<VnInput
|
||||||
<VnInput
|
mask="###.##"
|
||||||
v-model.number="props.row.rate3"
|
v-model.number="props.row.rate3"
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
v-on="getRowUpdateInputEvents(props)"
|
||||||
>
|
>
|
||||||
<template #append>€</template>
|
<template #append>€</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-minPrice="props">
|
<template #column-minPrice="props">
|
||||||
<QTd class="col">
|
<QTd class="col">
|
||||||
<div class="row">
|
<div class="row" style="width: 115px">
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
class="col"
|
|
||||||
:model-value="props.row.hasMinPrice"
|
:model-value="props.row.hasMinPrice"
|
||||||
@update:model-value="updateMinPrice($event, props)"
|
@update:model-value="updateMinPrice($event, props)"
|
||||||
:false-value="0"
|
:false-value="'false'"
|
||||||
:true-value="1"
|
:true-value="'true'"
|
||||||
:toggle-indeterminate="false"
|
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
class="col"
|
class="col"
|
||||||
:disable="!props.row.hasMinPrice"
|
:disable="props.row.hasMinPrice === 1"
|
||||||
v-model.number="props.row.minPrice"
|
v-model.number="props.row.minPrice"
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
v-on="getRowUpdateInputEvents(props)"
|
||||||
type="number"
|
>
|
||||||
/>
|
<template #append>€</template>
|
||||||
|
</VnInput>
|
||||||
</div>
|
</div>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-started="props">
|
<template #column-started="props">
|
||||||
<QTd class="col" style="min-width: 160px">
|
<VnInputDate
|
||||||
<VnInputDate
|
class="vnInputDate"
|
||||||
v-model="props.row.started"
|
:show-event="true"
|
||||||
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
v-model="props.row.started"
|
||||||
v-bind="
|
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
||||||
isBigger(props.row.started)
|
v-bind="dateStyle(isBigger(props.row.started))"
|
||||||
? { 'bg-color': 'warning', 'is-outlined': true }
|
/>
|
||||||
: {}
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-ended="props">
|
<template #column-ended="props">
|
||||||
<QTd class="col" style="min-width: 150px">
|
<VnInputDate
|
||||||
<VnInputDate
|
class="vnInputDate"
|
||||||
v-model="props.row.ended"
|
:show-event="true"
|
||||||
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
v-model="props.row.ended"
|
||||||
v-bind="
|
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
||||||
isLower(props.row.ended)
|
v-bind="dateStyle(isLower(props.row.ended))"
|
||||||
? { 'bg-color': 'warning', 'is-outlined': true }
|
/>
|
||||||
: {}
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-warehouse="props">
|
<template #column-warehouseFk="props">
|
||||||
<QTd class="col">
|
<VnSelect
|
||||||
<VnSelect
|
style="max-width: 150px"
|
||||||
:options="warehousesOptions"
|
:options="warehousesOptions"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="props.row.warehouseFk"
|
v-model="props.row.warehouseFk"
|
||||||
v-on="getRowUpdateInputEvents(props, false, 'select')"
|
v-on="getRowUpdateInputEvents(props, false, 'select')"
|
||||||
/>
|
/>
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-deleteAction="{ row, rowIndex }">
|
<template #column-deleteAction="{ row, rowIndex }">
|
||||||
<QTd class="col">
|
<QIcon
|
||||||
<QIcon
|
name="delete"
|
||||||
name="delete"
|
size="sm"
|
||||||
size="sm"
|
class="cursor-pointer fill-icon-on-hover"
|
||||||
class="cursor-pointer fill-icon-on-hover"
|
color="primary"
|
||||||
color="primary"
|
@click.stop="
|
||||||
@click.stop="
|
openConfirmationModal(
|
||||||
openConfirmationModal(
|
t('globals.rowWillBeRemoved'),
|
||||||
t('This row will be removed'),
|
t('Do you want to clone this item?'),
|
||||||
t('Do you want to clone this item?'),
|
() => removePrice(row.id, rowIndex)
|
||||||
() => removePrice(row.id, rowIndex)
|
)
|
||||||
)
|
"
|
||||||
"
|
>
|
||||||
>
|
<QTooltip class="text-no-wrap">
|
||||||
<QTooltip class="text-no-wrap">
|
{{ t('globals.delete') }}
|
||||||
{{ t('Delete') }}
|
</QTooltip>
|
||||||
</QTooltip>
|
</QIcon>
|
||||||
</QIcon>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
<template #bottom-row>
|
</VnTable>
|
||||||
<QTd align="center">
|
|
||||||
<QIcon
|
|
||||||
@click.stop="addRow()"
|
|
||||||
class="fill-icon-on-hover"
|
|
||||||
color="primary"
|
|
||||||
name="add_circle"
|
|
||||||
size="sm"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Add fixed price') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
</QTable>
|
|
||||||
<QPageSticky v-if="rowsSelected.length" :offset="[20, 20]">
|
|
||||||
<QBtn @click="openEditTableCellDialog()" color="primary" fab icon="edit" />
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Edit fixed price(s)') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QPageSticky>
|
|
||||||
<QDialog ref="editTableCellDialogRef">
|
<QDialog ref="editTableCellDialogRef">
|
||||||
<EditTableCellValueForm
|
<EditTableCellValueForm
|
||||||
edit-url="FixedPrices/editFixedPrice"
|
edit-url="FixedPrices/editFixedPrice"
|
||||||
|
@ -571,12 +618,56 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
</QDialog>
|
</QDialog>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="scss">
|
||||||
|
.q-table th,
|
||||||
|
.q-table td {
|
||||||
|
padding-inline: 5px !important;
|
||||||
|
// text-align: -webkit-right;
|
||||||
|
}
|
||||||
|
.q-table tbody td {
|
||||||
|
max-width: none;
|
||||||
|
|
||||||
|
.q-td.col {
|
||||||
|
& .vnInputDate {
|
||||||
|
min-width: 90px;
|
||||||
|
}
|
||||||
|
& div.row {
|
||||||
|
& .q-checkbox {
|
||||||
|
& .q-checkbox__inner {
|
||||||
|
position: relative !important;
|
||||||
|
&.q-checkbox__inner--truthy {
|
||||||
|
color: var(--q-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.q-field__after,
|
||||||
|
.q-field__append {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr.highlight .q-td {
|
||||||
|
animation: highlight-animation 4s ease-in-out;
|
||||||
|
}
|
||||||
|
@keyframes highlight-animation {
|
||||||
|
0% {
|
||||||
|
background-color: $primary-light;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.subName {
|
||||||
|
margin-left: 5%;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--vn-label-color);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Add fixed price: Añadir precio fijado
|
Add fixed price: Añadir precio fijado
|
||||||
Edit fixed price(s): Editar precio(s) fijado(s)
|
Edit fixed price(s): Editar precio(s) fijado(s)
|
||||||
This row will be removed: Esta linea se eliminará
|
|
||||||
Are you sure you want to continue?: ¿Seguro que quieres continuar?
|
|
||||||
Delete: Eliminar
|
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -9,18 +9,29 @@ import ItemsFilterPanel from 'src/components/ItemsFilterPanel.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
defineProps({
|
const props = defineProps({
|
||||||
dataKey: {
|
dataKey: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
warehousesOptions: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const itemTypeWorkersOptions = ref([]);
|
const itemTypeWorkersOptions = ref([]);
|
||||||
|
const exprBuilder = (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'name':
|
||||||
|
return { 'i.name': { like: `%${value}%` } };
|
||||||
|
case 'itemFk':
|
||||||
|
case 'warehouseFk':
|
||||||
|
case 'rate2':
|
||||||
|
case 'rate3':
|
||||||
|
param = `fp.${param}`;
|
||||||
|
return { [param]: value };
|
||||||
|
case 'minPrice':
|
||||||
|
param = `i.${param}`;
|
||||||
|
return { [param]: value };
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -31,7 +42,7 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC', limit: 30 }"
|
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC', limit: 30 }"
|
||||||
@on-fetch="(data) => (itemTypeWorkersOptions = data)"
|
@on-fetch="(data) => (itemTypeWorkersOptions = data)"
|
||||||
/>
|
/>
|
||||||
<ItemsFilterPanel :data-key="dataKey" :custom-tags="['tags']">
|
<ItemsFilterPanel :data-key="props.dataKey" :custom-tags="['tags']">
|
||||||
<template #body="{ params, searchFn }">
|
<template #body="{ params, searchFn }">
|
||||||
<QItem class="q-my-md">
|
<QItem class="q-my-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
|
@ -52,9 +63,11 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
<QItem class="q-my-md">
|
<QItem class="q-my-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
url="Warehouses"
|
||||||
|
auto-load
|
||||||
|
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||||
:label="t('components.itemsFilterPanel.warehouseFk')"
|
:label="t('components.itemsFilterPanel.warehouseFk')"
|
||||||
v-model="params.warehouseFk"
|
v-model="params.warehouseFk"
|
||||||
:options="warehousesOptions"
|
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
dense
|
dense
|
||||||
|
@ -93,8 +106,15 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
|
||||||
<QItemSection>
|
<QCheckbox
|
||||||
|
v-model="params.showBadDates"
|
||||||
|
:label="t(`components.itemsFilterPanel.showBadDates`)"
|
||||||
|
toggle-indeterminate
|
||||||
|
@update:model-value="searchFn()"
|
||||||
|
>
|
||||||
|
</QCheckbox>
|
||||||
|
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('components.itemsFilterPanel.hasMinPrice')"
|
:label="t('components.itemsFilterPanel.hasMinPrice')"
|
||||||
v-model="params.hasMinPrice"
|
v-model="params.hasMinPrice"
|
||||||
|
|
|
@ -33,7 +33,6 @@ async function onSubmit() {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('newPassword: ', newPassword);
|
|
||||||
await axios.post(
|
await axios.post(
|
||||||
'VnUsers/reset-password',
|
'VnUsers/reset-password',
|
||||||
{ newPassword: newPassword.value },
|
{ newPassword: newPassword.value },
|
||||||
|
|
|
@ -0,0 +1,220 @@
|
||||||
|
<script setup>
|
||||||
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import axios from 'axios';
|
||||||
|
import { useState } from 'composables/useState';
|
||||||
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
|
import { reactive } from 'vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const route = useRoute();
|
||||||
|
const state = useState();
|
||||||
|
const ORDER_MODEL = 'order';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const clientList = ref([]);
|
||||||
|
const agencyList = ref([]);
|
||||||
|
const addressList = ref([]);
|
||||||
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
|
||||||
|
const fetchAddressList = async (addressId) => {
|
||||||
|
try {
|
||||||
|
const { data } = await axios.get('addresses', {
|
||||||
|
params: {
|
||||||
|
filter: JSON.stringify({
|
||||||
|
fields: ['id', 'nickname', 'street', 'city'],
|
||||||
|
where: { id: addressId },
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
addressList.value = data;
|
||||||
|
if (addressList.value?.length === 1) {
|
||||||
|
state.get(ORDER_MODEL).addressId = addressList.value[0].id;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error fetching addresses`, err);
|
||||||
|
return err.response;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchAgencyList = async (landed, addressFk) => {
|
||||||
|
if (!landed || !addressFk) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const { data } = await axios.get('Agencies/landsThatDay', {
|
||||||
|
params: {
|
||||||
|
addressFk,
|
||||||
|
landed: new Date(landed).toISOString(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
agencyList.value = data;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error fetching agencies`, err);
|
||||||
|
return err.response;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// const fetchOrderDetails = (order) => {
|
||||||
|
// fetchAddressList(order?.addressFk);
|
||||||
|
// fetchAgencyList(order?.landed, order?.addressFk);
|
||||||
|
// };
|
||||||
|
const $props = defineProps({
|
||||||
|
clientFk: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const initialFormState = reactive({
|
||||||
|
active: true,
|
||||||
|
addressId: null,
|
||||||
|
clientFk: $props.clientFk,
|
||||||
|
});
|
||||||
|
// const orderMapper = (order) => {
|
||||||
|
// return {
|
||||||
|
// addressId: order.addressFk,
|
||||||
|
// agencyModeId: order.agencyModeFk,
|
||||||
|
// landed: new Date(order.landed).toISOString(),
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
// const orderFilter = {
|
||||||
|
// include: [
|
||||||
|
// { relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||||
|
// {
|
||||||
|
// relation: 'address',
|
||||||
|
// scope: { fields: ['nickname'] },
|
||||||
|
// },
|
||||||
|
// { relation: 'rows', scope: { fields: ['id'] } },
|
||||||
|
// {
|
||||||
|
// relation: 'client',
|
||||||
|
// scope: {
|
||||||
|
// fields: [
|
||||||
|
// 'salesPersonFk',
|
||||||
|
// 'name',
|
||||||
|
// 'isActive',
|
||||||
|
// 'isFreezed',
|
||||||
|
// 'isTaxDataChecked',
|
||||||
|
// ],
|
||||||
|
// include: {
|
||||||
|
// relation: 'salesPersonUser',
|
||||||
|
// scope: { fields: ['id', 'name'] },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// };
|
||||||
|
|
||||||
|
const onClientChange = async (clientId = $props.clientFk) => {
|
||||||
|
try {
|
||||||
|
const { data } = await axios.get(`Clients/${clientId}`);
|
||||||
|
await fetchAddressList(data.defaultAddressFk);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error al cambiar el cliente:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async function onDataSaved(_, id) {
|
||||||
|
await router.push({ path: `/order/${id}/catalog` });
|
||||||
|
}
|
||||||
|
onMounted(async () => {
|
||||||
|
await onClientChange();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="addresses"
|
||||||
|
@on-fetch="(data) => (clientOptions = data)"
|
||||||
|
:filter="{ fields: ['id', 'name', 'defaultAddressFk'], order: 'id' }"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FormModelPopup
|
||||||
|
url-create="Orders/new"
|
||||||
|
:title="t('Create Order')"
|
||||||
|
@on-data-saved="onDataSaved"
|
||||||
|
:model="ORDER_MODEL"
|
||||||
|
:filter="orderFilter"
|
||||||
|
:form-initial-data="initialFormState"
|
||||||
|
>
|
||||||
|
<template #form-inputs="{ data }">
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<VnSelect
|
||||||
|
url="Clients"
|
||||||
|
:label="t('order.form.clientFk')"
|
||||||
|
v-model="data.clientFk"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
:filter="{
|
||||||
|
fields: ['id', 'name', 'defaultAddressFk'],
|
||||||
|
}"
|
||||||
|
hide-selected
|
||||||
|
@update:model-value="onClientChange"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('order.form.addressFk')"
|
||||||
|
v-model="data.addressId"
|
||||||
|
:options="addressList"
|
||||||
|
option-value="id"
|
||||||
|
option-label="street"
|
||||||
|
hide-selected
|
||||||
|
:disable="!addressList?.length"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{
|
||||||
|
`${scope.opt.nickname}: ${scope.opt.street},${scope.opt.city}`
|
||||||
|
}}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<VnInputDate
|
||||||
|
placeholder="dd-mm-aaa"
|
||||||
|
:label="t('order.form.landed')"
|
||||||
|
v-model="data.landed"
|
||||||
|
@update:model-value="
|
||||||
|
() => fetchAgencyList(data.landed, data.addressId)
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<VnSelect
|
||||||
|
:label="t('order.form.agencyModeFk')"
|
||||||
|
v-model="data.agencyModeId"
|
||||||
|
:options="agencyList"
|
||||||
|
option-value="agencyModeFk"
|
||||||
|
option-label="agencyMode"
|
||||||
|
hide-selected
|
||||||
|
:disable="!agencyList?.length"
|
||||||
|
>
|
||||||
|
</VnSelect>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormModelPopup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
No default address found for the client: No hay ninguna dirección asociada a este cliente.
|
||||||
|
</i18n>
|
|
@ -23,7 +23,7 @@ function confirmRemove() {
|
||||||
.dialog({
|
.dialog({
|
||||||
component: VnConfirm,
|
component: VnConfirm,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
title: t('confirmDeletion'),
|
title: t('globals.confirmDeletion'),
|
||||||
message: t('confirmDeletionMessage'),
|
message: t('confirmDeletionMessage'),
|
||||||
promise: remove,
|
promise: remove,
|
||||||
},
|
},
|
||||||
|
@ -52,12 +52,10 @@ async function remove() {
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
deleteOrder: Delete order
|
deleteOrder: Delete order
|
||||||
confirmDeletion: Confirm deletion
|
|
||||||
confirmDeletionMessage: Are you sure you want to delete this order?
|
confirmDeletionMessage: Are you sure you want to delete this order?
|
||||||
|
|
||||||
es:
|
es:
|
||||||
deleteOrder: Eliminar pedido
|
deleteOrder: Eliminar pedido
|
||||||
confirmDeletion: Confirmar eliminación
|
|
||||||
confirmDeletionMessage: Seguro que quieres eliminar este pedido?
|
confirmDeletionMessage: Seguro que quieres eliminar este pedido?
|
||||||
|
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -83,7 +83,7 @@ function handleLocation(data, location) {
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.location"
|
v-model="data.location"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,56 +1,21 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.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 FetchData from 'components/FetchData.vue';
|
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
defineProps({
|
||||||
dataKey: {
|
dataKey: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const buyersOptions = ref([]);
|
|
||||||
const itemTypesOptions = ref([]);
|
|
||||||
const itemCategoriesOptions = ref([]);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<VnFilterPanel :data-key="dataKey" :search-button="true" :redirect="false">
|
||||||
url="TicketRequests/getItemTypeWorker"
|
|
||||||
:filter="{
|
|
||||||
fields: ['id', 'nickname'],
|
|
||||||
order: 'nickname ASC',
|
|
||||||
}"
|
|
||||||
@on-fetch="(data) => (buyersOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
url="ItemTypes"
|
|
||||||
:filter="{
|
|
||||||
fields: ['id', 'name', 'categoryFk'],
|
|
||||||
include: 'category',
|
|
||||||
order: 'name ASC',
|
|
||||||
}"
|
|
||||||
@on-fetch="(data) => (itemTypesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
url="ItemCategories"
|
|
||||||
:filter="{
|
|
||||||
fields: ['id', 'name'],
|
|
||||||
order: 'name ASC',
|
|
||||||
}"
|
|
||||||
@on-fetch="(data) => (itemCategoriesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" :redirect="false">
|
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
@ -82,7 +47,9 @@ const itemCategoriesOptions = ref([]);
|
||||||
:label="t('params.buyerId')"
|
:label="t('params.buyerId')"
|
||||||
v-model="params.buyerId"
|
v-model="params.buyerId"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
:options="buyersOptions"
|
url="TicketRequests/getItemTypeWorker"
|
||||||
|
:fields="['id', 'nickname']"
|
||||||
|
sort-by="nickname ASC"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
@ -98,7 +65,10 @@ const itemCategoriesOptions = ref([]);
|
||||||
:label="t('params.typeId')"
|
:label="t('params.typeId')"
|
||||||
v-model="params.typeId"
|
v-model="params.typeId"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
:options="itemTypesOptions"
|
url="ItemTypes"
|
||||||
|
:include="['category']"
|
||||||
|
:fields="['id', 'name', 'categoryFk']"
|
||||||
|
sort-by="name ASC"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
@ -125,7 +95,9 @@ const itemCategoriesOptions = ref([]);
|
||||||
:label="t('params.categoryId')"
|
:label="t('params.categoryId')"
|
||||||
v-model="params.categoryId"
|
v-model="params.categoryId"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
:options="itemCategoriesOptions"
|
url="ItemCategories"
|
||||||
|
:fields="['id', 'name']"
|
||||||
|
sort-by="name ASC"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
|
|
@ -129,7 +129,7 @@ function handleLocation(data, location) {
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.postCode"
|
v-model="data.postCode"
|
||||||
@update:model-value="(location) => handleLocation(data, location)"
|
@update:model-value="(location) => handleLocation(data, location)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -4,13 +4,11 @@ import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import { useRole } from 'src/composables/useRole';
|
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const roleState = useRole();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -32,13 +30,7 @@ async function setData(data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const isAdministrative = computed(() => {
|
const getUrl = (section) => `#/supplier/${entityId.value}/${section}`;
|
||||||
return roleState.hasAny(['administrative']);
|
|
||||||
});
|
|
||||||
|
|
||||||
function getUrl(section) {
|
|
||||||
return isAdministrative.value && `#/supplier/${entityId.value}/${section}`;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { computed } from 'vue';
|
|
||||||
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import TicketDescriptor from './TicketDescriptor.vue';
|
import TicketDescriptor from './TicketDescriptor.vue';
|
||||||
import TicketFilter from '../TicketFilter.vue';
|
import TicketFilter from '../TicketFilter.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const routeName = computed(() => route.name);
|
|
||||||
const customRouteRedirectName = computed(() => routeName.value);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
|
@ -21,7 +15,7 @@ const customRouteRedirectName = computed(() => routeName.value);
|
||||||
:descriptor="TicketDescriptor"
|
:descriptor="TicketDescriptor"
|
||||||
search-data-key="TicketList"
|
search-data-key="TicketList"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
customRouteRedirectName,
|
url: 'Tickets/filter',
|
||||||
label: t('card.search'),
|
label: t('card.search'),
|
||||||
info: t('card.searchInfo'),
|
info: t('card.searchInfo'),
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -9,6 +9,8 @@ import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import VnSmsDialog from 'components/common/VnSmsDialog.vue';
|
import VnSmsDialog from 'components/common/VnSmsDialog.vue';
|
||||||
import toDate from 'filters/toDate';
|
import toDate from 'filters/toDate';
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
ticket: {
|
ticket: {
|
||||||
|
@ -21,9 +23,10 @@ const { push, currentRoute } = useRouter();
|
||||||
const { dialog, notify } = useQuasar();
|
const { dialog, notify } = useQuasar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openReport, sendEmail } = usePrintService();
|
const { openReport, sendEmail } = usePrintService();
|
||||||
|
const ticketSummary = useArrayData('TicketSummary');
|
||||||
const ticket = ref(props.ticket);
|
const ticket = ref(props.ticket);
|
||||||
const ticketId = currentRoute.value.params.id;
|
const ticketId = currentRoute.value.params.id;
|
||||||
|
const weight = ref();
|
||||||
const actions = {
|
const actions = {
|
||||||
clone: async () => {
|
clone: async () => {
|
||||||
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
||||||
|
@ -46,6 +49,25 @@ const actions = {
|
||||||
push({ name: 'TicketSummary', params: { id: clonedTicketId } });
|
push({ name: 'TicketSummary', params: { id: clonedTicketId } });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setWeight: async () => {
|
||||||
|
try {
|
||||||
|
const invoiceIds = (
|
||||||
|
await axios.post(`Tickets/${ticketId}/setWeight`, {
|
||||||
|
weight: weight.value,
|
||||||
|
})
|
||||||
|
).data;
|
||||||
|
|
||||||
|
notify({ message: t('Weight set'), type: 'positive' });
|
||||||
|
if (invoiceIds.length)
|
||||||
|
notify({
|
||||||
|
message: t('invoiceIds', { invoiceIds: invoiceIds.join() }),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
|
await ticketSummary.fetch({ updateRouter: false });
|
||||||
|
} catch (e) {
|
||||||
|
notify({ message: e.message, type: 'negative' });
|
||||||
|
}
|
||||||
|
},
|
||||||
remove: async () => {
|
remove: async () => {
|
||||||
try {
|
try {
|
||||||
await axios.post(`Tickets/${ticketId}/setDeleted`);
|
await axios.post(`Tickets/${ticketId}/setDeleted`);
|
||||||
|
@ -255,6 +277,12 @@ function openConfirmDialog(callback) {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t('To clone ticket') }}</QItemSection>
|
<QItemSection>{{ t('To clone ticket') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem @click="$refs.weightDialog.show()" v-ripple clickable>
|
||||||
|
<QItemSection avatar>
|
||||||
|
<QIcon name="weight" />
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>{{ t('Set weight') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
<template v-if="!ticket.isDeleted">
|
<template v-if="!ticket.isDeleted">
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QItem @click="openConfirmDialog('remove')" v-ripple clickable>
|
<QItem @click="openConfirmDialog('remove')" v-ripple clickable>
|
||||||
|
@ -264,9 +292,25 @@ function openConfirmDialog(callback) {
|
||||||
<QItemSection>{{ t('Delete ticket') }}</QItemSection>
|
<QItemSection>{{ t('Delete ticket') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
|
<VnConfirm
|
||||||
|
ref="weightDialog"
|
||||||
|
:title="t('Set weight')"
|
||||||
|
:message="t('This ticket may be invoiced, do you want to continue?')"
|
||||||
|
:promise="actions.setWeight"
|
||||||
|
>
|
||||||
|
<template #customHTML>
|
||||||
|
<VnInputNumber
|
||||||
|
:label="t('globals.weight')"
|
||||||
|
v-model="weight"
|
||||||
|
class="full-width"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnConfirm>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
en:
|
||||||
|
invoiceIds: "Invoices have been generated with the following ids: {invoiceIds}"
|
||||||
|
|
||||||
es:
|
es:
|
||||||
Open Delivery Note...: Abrir albarán...
|
Open Delivery Note...: Abrir albarán...
|
||||||
Send Delivery Note...: Enviar albarán...
|
Send Delivery Note...: Enviar albarán...
|
||||||
|
@ -284,4 +328,8 @@ es:
|
||||||
To clone ticket: Clonar ticket
|
To clone ticket: Clonar ticket
|
||||||
Ticket cloned: Ticked clonado
|
Ticket cloned: Ticked clonado
|
||||||
It was not able to clone the ticket: No se pudo clonar el ticket
|
It was not able to clone the ticket: No se pudo clonar el ticket
|
||||||
|
Set weight: Establecer peso
|
||||||
|
Weight set: Peso establecido
|
||||||
|
This ticket may be invoiced, do you want to continue?: Es posible que se facture este ticket, desea continuar?
|
||||||
|
invoiceIds: "Se han generado las facturas con los siguientes ids: {invoiceIds}"
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -31,8 +31,7 @@ const $props = defineProps({
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
|
|
||||||
const summaryRef = ref();
|
const summaryRef = ref();
|
||||||
const ticket = ref();
|
const ticket = computed(() => summaryRef.value?.entity);
|
||||||
const salesLines = ref(null);
|
|
||||||
const editableStates = ref([]);
|
const editableStates = ref([]);
|
||||||
const ticketUrl = ref();
|
const ticketUrl = ref();
|
||||||
const grafanaUrl = 'https://grafana.verdnatura.es';
|
const grafanaUrl = 'https://grafana.verdnatura.es';
|
||||||
|
@ -40,12 +39,6 @@ const grafanaUrl = 'https://grafana.verdnatura.es';
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/';
|
ticketUrl.value = (await getUrl('ticket/')) + entityId.value + '/';
|
||||||
});
|
});
|
||||||
async function setData(data) {
|
|
||||||
if (data) {
|
|
||||||
ticket.value = data;
|
|
||||||
salesLines.value = data.sales;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function formattedAddress() {
|
function formattedAddress() {
|
||||||
if (!ticket.value) return '';
|
if (!ticket.value) return '';
|
||||||
|
@ -89,7 +82,6 @@ async function changeState(value) {
|
||||||
<CardSummary
|
<CardSummary
|
||||||
ref="summaryRef"
|
ref="summaryRef"
|
||||||
:url="`Tickets/${entityId}/summary`"
|
:url="`Tickets/${entityId}/summary`"
|
||||||
@on-fetch="(data) => setData(data)"
|
|
||||||
data-key="TicketSummary"
|
data-key="TicketSummary"
|
||||||
>
|
>
|
||||||
<template #header="{ entity }">
|
<template #header="{ entity }">
|
||||||
|
@ -131,7 +123,7 @@ async function changeState(value) {
|
||||||
</QList>
|
</QList>
|
||||||
</QBtnDropdown>
|
</QBtnDropdown>
|
||||||
</template>
|
</template>
|
||||||
<template #body>
|
<template #body="{ entity }">
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="ticketUrl + 'basic-data/step-one'"
|
:url="ticketUrl + 'basic-data/step-one'"
|
||||||
|
@ -139,57 +131,58 @@ async function changeState(value) {
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('ticket.summary.state')">
|
<VnLv :label="t('ticket.summary.state')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<QChip :color="ticket.ticketState?.state?.classColor ?? 'dark'">
|
<QChip :color="entity.ticketState?.state?.classColor ?? 'dark'">
|
||||||
{{ ticket.ticketState?.state?.name }}
|
{{ entity.ticketState?.state?.name }}
|
||||||
</QChip>
|
</QChip>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :label="t('ticket.summary.salesPerson')">
|
<VnLv :label="t('ticket.summary.salesPerson')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<VnUserLink
|
<VnUserLink
|
||||||
:name="ticket.client?.salesPersonUser?.name"
|
:name="entity.client?.salesPersonUser?.name"
|
||||||
:worker-id="ticket.client?.salesPersonFk"
|
:worker-id="entity.client?.salesPersonFk"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('ticket.summary.agency')"
|
:label="t('ticket.summary.agency')"
|
||||||
:value="ticket.agencyMode?.name"
|
:value="entity.agencyMode?.name"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('ticket.summary.zone')" :value="ticket?.zone?.name" />
|
<VnLv :label="t('ticket.summary.zone')" :value="entity?.zone?.name" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('ticket.summary.warehouse')"
|
:label="t('ticket.summary.warehouse')"
|
||||||
:value="ticket.warehouse?.name"
|
:value="entity.warehouse?.name"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
|
v-if="ticket?.ticketCollections?.length > 0"
|
||||||
:label="t('ticket.summary.collection')"
|
:label="t('ticket.summary.collection')"
|
||||||
:value="ticket.ticketCollections[0]?.collectionFk"
|
:value="ticket?.ticketCollections[0]?.collectionFk"
|
||||||
>
|
>
|
||||||
<template #value>
|
<template #value>
|
||||||
<a
|
<a
|
||||||
:href="`${grafanaUrl}/d/d552ab74-85b4-4e7f-a279-fab7cd9c6124/control-de-expediciones?orgId=1&var-collectionFk=${ticket.ticketCollections[0]?.collectionFk}`"
|
:href="`${grafanaUrl}/d/d552ab74-85b4-4e7f-a279-fab7cd9c6124/control-de-expediciones?orgId=1&var-collectionFk=${entity.ticketCollections[0]?.collectionFk}`"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="grafana"
|
class="grafana"
|
||||||
>
|
>
|
||||||
{{ ticket.ticketCollections[0]?.collectionFk }}
|
{{ entity.ticketCollections[0]?.collectionFk }}
|
||||||
</a>
|
</a>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :label="t('ticket.summary.route')" :value="ticket.routeFk" />
|
<VnLv :label="t('ticket.summary.route')" :value="entity.routeFk" />
|
||||||
<VnLv :label="t('ticket.summary.invoice')">
|
<VnLv :label="t('ticket.summary.invoice')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<span :class="{ link: ticket.refFk }">
|
<span :class="{ link: entity.refFk }">
|
||||||
{{ dashIfEmpty(ticket.refFk) }}
|
{{ dashIfEmpty(entity.refFk) }}
|
||||||
<InvoiceOutDescriptorProxy
|
<InvoiceOutDescriptorProxy
|
||||||
:id="ticket.invoiceOut.id"
|
:id="entity.invoiceOut.id"
|
||||||
v-if="ticket.refFk"
|
v-if="entity.refFk"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('ticket.summary.weight')"
|
:label="t('ticket.summary.weight')"
|
||||||
:value="dashIfEmpty(ticket.weight)"
|
:value="dashIfEmpty(entity.weight)"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
|
@ -199,35 +192,35 @@ async function changeState(value) {
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('ticket.summary.shipped')"
|
:label="t('ticket.summary.shipped')"
|
||||||
:value="toDate(ticket.shipped)"
|
:value="toDate(entity.shipped)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('ticket.summary.landed')"
|
:label="t('ticket.summary.landed')"
|
||||||
:value="toDate(ticket.landed)"
|
:value="toDate(entity.landed)"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('globals.packages')" :value="ticket.packages" />
|
<VnLv :label="t('globals.packages')" :value="entity.packages" />
|
||||||
<VnLv :value="ticket.address.phone">
|
<VnLv :value="entity.address.phone">
|
||||||
<template #label>
|
<template #label>
|
||||||
{{ t('ticket.summary.consigneePhone') }}
|
{{ t('ticket.summary.consigneePhone') }}
|
||||||
<VnLinkPhone :phone-number="ticket.address.phone" />
|
<VnLinkPhone :phone-number="entity.address.phone" />
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :value="ticket.address.mobile">
|
<VnLv :value="entity.address.mobile">
|
||||||
<template #label>
|
<template #label>
|
||||||
{{ t('ticket.summary.consigneeMobile') }}
|
{{ t('ticket.summary.consigneeMobile') }}
|
||||||
<VnLinkPhone :phone-number="ticket.address.mobile" />
|
<VnLinkPhone :phone-number="entity.address.mobile" />
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :value="ticket.client.phone">
|
<VnLv :value="entity.client.phone">
|
||||||
<template #label>
|
<template #label>
|
||||||
{{ t('ticket.summary.clientPhone') }}
|
{{ t('ticket.summary.clientPhone') }}
|
||||||
<VnLinkPhone :phone-number="ticket.client.phone" />
|
<VnLinkPhone :phone-number="entity.client.phone" />
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :value="ticket.client.mobile">
|
<VnLv :value="entity.client.mobile">
|
||||||
<template #label>
|
<template #label>
|
||||||
{{ t('ticket.summary.clientMobile') }}
|
{{ t('ticket.summary.clientMobile') }}
|
||||||
<VnLinkPhone :phone-number="ticket.client.mobile" />
|
<VnLinkPhone :phone-number="entity.client.mobile" />
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv
|
<VnLv
|
||||||
|
@ -235,13 +228,13 @@ async function changeState(value) {
|
||||||
:value="formattedAddress()"
|
:value="formattedAddress()"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-one" v-if="ticket.notes.length">
|
<QCard class="vn-one" v-if="entity.notes.length">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="ticketUrl + 'observation'"
|
:url="ticketUrl + 'observation'"
|
||||||
:text="t('ticket.pageTitles.notes')"
|
:text="t('ticket.pageTitles.notes')"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
v-for="note in ticket.notes"
|
v-for="note in entity.notes"
|
||||||
:key="note.id"
|
:key="note.id"
|
||||||
:label="note.observationType.description"
|
:label="note.observationType.description"
|
||||||
:value="note.description"
|
:value="note.description"
|
||||||
|
@ -262,15 +255,15 @@ async function changeState(value) {
|
||||||
<div class="bodyCard">
|
<div class="bodyCard">
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('ticket.summary.subtotal')"
|
:label="t('ticket.summary.subtotal')"
|
||||||
:value="toCurrency(ticket.totalWithoutVat)"
|
:value="toCurrency(entity.totalWithoutVat)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('ticket.summary.vat')"
|
:label="t('ticket.summary.vat')"
|
||||||
:value="toCurrency(ticket.totalWithVat - ticket.totalWithoutVat)"
|
:value="toCurrency(entity.totalWithVat - entity.totalWithoutVat)"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('ticket.summary.total')"
|
:label="t('ticket.summary.total')"
|
||||||
:value="toCurrency(ticket.totalWithVat)"
|
:value="toCurrency(entity.totalWithVat)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
@ -279,7 +272,7 @@ async function changeState(value) {
|
||||||
:url="ticketUrl + 'sale'"
|
:url="ticketUrl + 'sale'"
|
||||||
:text="t('ticket.summary.saleLines')"
|
:text="t('ticket.summary.saleLines')"
|
||||||
/>
|
/>
|
||||||
<QTable :rows="ticket.sales" style="text-align: center">
|
<QTable :rows="entity.sales" style="text-align: center">
|
||||||
<template #body-cell="{ value }">
|
<template #body-cell="{ value }">
|
||||||
<QTd>{{ value }}</QTd>
|
<QTd>{{ value }}</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -383,7 +376,11 @@ async function changeState(value) {
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn class="link" flat>
|
<QBtn class="link" flat>
|
||||||
{{ props.row.itemFk }}
|
{{ props.row.itemFk }}
|
||||||
<ItemDescriptorProxy :id="props.row.itemFk" />
|
<ItemDescriptorProxy
|
||||||
|
:id="props.row.itemFk"
|
||||||
|
:sale-fk="props.row.id"
|
||||||
|
:warehouse-fk="ticket.warehouseFk"
|
||||||
|
/>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd>{{ props.row.visible }}</QTd>
|
<QTd>{{ props.row.visible }}</QTd>
|
||||||
|
@ -419,10 +416,10 @@ async function changeState(value) {
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard
|
<QCard
|
||||||
class="vn-max"
|
class="vn-max"
|
||||||
v-if="ticket.packagings.length > 0 || ticket.services.length > 0"
|
v-if="entity.packagings.length || entity.services.length"
|
||||||
>
|
>
|
||||||
<VnTitle :url="ticketUrl + 'package'" :text="t('globals.packages')" />
|
<VnTitle :url="ticketUrl + 'package'" :text="t('globals.packages')" />
|
||||||
<QTable :rows="ticket.packagings" flat>
|
<QTable :rows="entity.packagings" flat>
|
||||||
<template #header="props">
|
<template #header="props">
|
||||||
<QTr :props="props">
|
<QTr :props="props">
|
||||||
<QTh auto-width>{{ t('ticket.summary.created') }}</QTh>
|
<QTh auto-width>{{ t('ticket.summary.created') }}</QTh>
|
||||||
|
@ -442,7 +439,7 @@ async function changeState(value) {
|
||||||
:url="ticketUrl + 'service'"
|
:url="ticketUrl + 'service'"
|
||||||
:text="t('ticket.summary.service')"
|
:text="t('ticket.summary.service')"
|
||||||
/>
|
/>
|
||||||
<QTable :rows="ticket.services" flat>
|
<QTable :rows="entity.services" flat>
|
||||||
<template #header="props">
|
<template #header="props">
|
||||||
<QTr :props="props">
|
<QTr :props="props">
|
||||||
<QTh auto-width>{{ t('ticket.summary.quantity') }}</QTh>
|
<QTh auto-width>{{ t('ticket.summary.quantity') }}</QTh>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import TicketTransferForm from './TicketTransferForm.vue';
|
||||||
|
|
||||||
import { toDateFormat } from 'src/filters/date.js';
|
import { toDateFormat } from 'src/filters/date.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -135,9 +136,7 @@ onMounted(() => (_transfer.value = $props.transfer));
|
||||||
:columns="destinationTicketColumns"
|
:columns="destinationTicketColumns"
|
||||||
:title="t('Destination ticket')"
|
:title="t('Destination ticket')"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
|
||||||
class="full-width q-mt-md"
|
class="full-width q-mt-md"
|
||||||
:no-data-label="t('globals.noResults')"
|
|
||||||
>
|
>
|
||||||
<template #body-cell-address="{ row }">
|
<template #body-cell-address="{ row }">
|
||||||
<QTd @click.stop>
|
<QTd @click.stop>
|
||||||
|
@ -158,29 +157,11 @@ onMounted(() => (_transfer.value = $props.transfer));
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template #no-data>
|
||||||
|
<TicketTransferForm v-bind="$props" />
|
||||||
|
</template>
|
||||||
<template #bottom>
|
<template #bottom>
|
||||||
<QForm class="q-mt-lg full-width">
|
<TicketTransferForm v-bind="$props" />
|
||||||
<VnInput
|
|
||||||
v-model.number="_transfer.ticketId"
|
|
||||||
:label="t('Transfer to ticket')"
|
|
||||||
:clearable="false"
|
|
||||||
>
|
|
||||||
<template #append>
|
|
||||||
<QBtn
|
|
||||||
icon="keyboard_arrow_right"
|
|
||||||
color="primary"
|
|
||||||
@click="transferSales(_transfer.ticketId)"
|
|
||||||
style="width: 30px"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</VnInput>
|
|
||||||
<QBtn
|
|
||||||
:label="t('New ticket')"
|
|
||||||
color="primary"
|
|
||||||
class="full-width q-my-lg"
|
|
||||||
@click="transferSales()"
|
|
||||||
/>
|
|
||||||
</QForm>
|
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
mana: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
newPrice: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
transfer: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
|
ticket: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['refreshData']);
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const _transfer = ref(null);
|
||||||
|
|
||||||
|
const transferSales = async (ticketId) => {
|
||||||
|
const params = {
|
||||||
|
ticketId: ticketId,
|
||||||
|
sales: $props.transfer.sales,
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await axios.post(
|
||||||
|
`tickets/${$props.ticket.id}/transferSales`,
|
||||||
|
params
|
||||||
|
);
|
||||||
|
|
||||||
|
if (data && data.id === $props.ticket.id) emit('refreshData');
|
||||||
|
else router.push({ name: 'TicketSale', params: { id: data.id } });
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => (_transfer.value = $props.transfer));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
{{ _transfer }}
|
||||||
|
<QForm class="q-mt-lg full-width">
|
||||||
|
<VnInput
|
||||||
|
v-model.number="_transfer.ticketId"
|
||||||
|
:label="t('Transfer to ticket')"
|
||||||
|
:clearable="false"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<QBtn
|
||||||
|
icon="keyboard_arrow_right"
|
||||||
|
color="primary"
|
||||||
|
@click="transferSales(_transfer.ticketId)"
|
||||||
|
style="width: 30px"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
|
<QBtn
|
||||||
|
:label="t('New ticket')"
|
||||||
|
color="primary"
|
||||||
|
class="full-width q-my-lg"
|
||||||
|
@click="transferSales()"
|
||||||
|
/>
|
||||||
|
</QForm>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Sales to transfer: Líneas a transferir
|
||||||
|
Destination ticket: Ticket destinatario
|
||||||
|
Transfer to ticket: Transferir a ticket
|
||||||
|
New ticket: Nuevo ticket
|
||||||
|
</i18n>
|
|
@ -133,6 +133,14 @@ const ticketColumns = computed(() => [
|
||||||
sortable: true,
|
sortable: true,
|
||||||
columnFilter: null,
|
columnFilter: null,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: t('advanceTickets.preparation'),
|
||||||
|
name: 'preparation',
|
||||||
|
field: 'preparation',
|
||||||
|
align: 'left',
|
||||||
|
sortable: true,
|
||||||
|
columnFilter: null,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t('advanceTickets.liters'),
|
label: t('advanceTickets.liters'),
|
||||||
name: 'liters',
|
name: 'liters',
|
||||||
|
@ -624,6 +632,7 @@ onMounted(async () => {
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #body-cell-ticketId="{ row }">
|
<template #body-cell-ticketId="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBtn flat class="link">
|
<QBtn flat class="link">
|
||||||
|
@ -635,6 +644,7 @@ onMounted(async () => {
|
||||||
<template #body-cell-state="{ row }">
|
<template #body-cell-state="{ row }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<QBadge
|
<QBadge
|
||||||
|
v-if="row.state"
|
||||||
text-color="black"
|
text-color="black"
|
||||||
:color="row.classColor"
|
:color="row.classColor"
|
||||||
class="q-ma-none"
|
class="q-ma-none"
|
||||||
|
@ -642,6 +652,7 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
{{ row.state }}
|
{{ row.state }}
|
||||||
</QBadge>
|
</QBadge>
|
||||||
|
<span v-else> {{ dashIfEmpty(row.state) }}</span>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-import="{ row }">
|
<template #body-cell-import="{ row }">
|
||||||
|
|
|
@ -55,7 +55,7 @@ onMounted(async () => await getItemPackingTypes());
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
:hidden-tags="['search']"
|
:hidden-tags="['search']"
|
||||||
:un-removable-params="['warehouseFk', 'dateFuture', 'dateToAdvance']"
|
:unremovable-params="['warehouseFk', 'dateFuture', 'dateToAdvance']"
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
|
@ -119,10 +119,9 @@ onMounted(async () => await getItemPackingTypes());
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('params.itemPackingTypes')"
|
:label="t('params.isFullMovable')"
|
||||||
v-model="params.itemPackingTypes"
|
v-model="params.isFullMovable"
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
:false-value="null"
|
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -155,7 +154,7 @@ en:
|
||||||
dateToAdvance: Destination date
|
dateToAdvance: Destination date
|
||||||
futureIpt: Origin IPT
|
futureIpt: Origin IPT
|
||||||
ipt: Destination IPT
|
ipt: Destination IPT
|
||||||
itemPackingTypes: 100% movable
|
isFullMovable: 100% movable
|
||||||
warehouseFk: Warehouse
|
warehouseFk: Warehouse
|
||||||
es:
|
es:
|
||||||
Horizontal: Horizontal
|
Horizontal: Horizontal
|
||||||
|
@ -166,6 +165,6 @@ es:
|
||||||
dateToAdvance: Fecha destino
|
dateToAdvance: Fecha destino
|
||||||
futureIpt: IPT Origen
|
futureIpt: IPT Origen
|
||||||
ipt: IPT destino
|
ipt: IPT destino
|
||||||
itemPackingTypes: 100% movible
|
isFullMovable: 100% movible
|
||||||
warehouseFk: Almacén
|
warehouseFk: Almacén
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue