Merge branch 'dev' into 6321_negative_tickets
This commit is contained in:
commit
8be1a42c53
|
@ -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,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -35,7 +35,7 @@ const itemComputed = computed(() => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t(itemComputed.title) }}
|
{{ t(itemComputed.title) }}
|
||||||
<QTooltip>
|
<QTooltip v-if="item.keyBinding">
|
||||||
{{ 'Ctrl + Alt + ' + item?.keyBinding?.toUpperCase() }}
|
{{ 'Ctrl + Alt + ' + item?.keyBinding?.toUpperCase() }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -34,7 +34,7 @@ const model = defineModel(undefined, { required: true });
|
||||||
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
||||||
const columnFilter = computed(() => $props.column?.columnFilter);
|
const columnFilter = computed(() => $props.column?.columnFilter);
|
||||||
|
|
||||||
const updateEvent = { 'update:modelValue': addFilter, remove: () => addFilter(null) };
|
const updateEvent = { 'update:modelValue': addFilter };
|
||||||
const enterEvent = {
|
const enterEvent = {
|
||||||
'keyup.enter': () => addFilter(model.value),
|
'keyup.enter': () => addFilter(model.value),
|
||||||
remove: () => addFilter(null),
|
remove: () => addFilter(null),
|
||||||
|
|
|
@ -69,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,
|
||||||
|
@ -299,7 +303,7 @@ defineExpose({
|
||||||
CrudModelRef,
|
CrudModelRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleOnDataSaved(_, res) {
|
function handleOnDataSaved(_) {
|
||||||
if (_.onDataSaved) _.onDataSaved(this);
|
if (_.onDataSaved) _.onDataSaved(this);
|
||||||
else $props.create.onDataSaved(_);
|
else $props.create.onDataSaved(_);
|
||||||
}
|
}
|
||||||
|
@ -357,17 +361,18 @@ function handleOnDataSaved(_, res) {
|
||||||
</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">
|
||||||
|
@ -502,11 +507,8 @@ function handleOnDataSaved(_, res) {
|
||||||
:key="index"
|
:key="index"
|
||||||
:title="btn.title"
|
:title="btn.title"
|
||||||
:icon="btn.icon"
|
:icon="btn.icon"
|
||||||
class="q-px-sm"
|
class="q-px-sm text-primary-light"
|
||||||
flat
|
flat
|
||||||
:class="
|
|
||||||
btn.isPrimary ? 'text-primary-light' : 'color-vn-text '
|
|
||||||
"
|
|
||||||
:style="`visibility: ${
|
:style="`visibility: ${
|
||||||
(btn.show && btn.show(row)) ?? true ? 'visible' : 'hidden'
|
(btn.show && btn.show(row)) ?? true ? 'visible' : 'hidden'
|
||||||
}`"
|
}`"
|
||||||
|
@ -633,7 +635,7 @@ function handleOnDataSaved(_, res) {
|
||||||
</QTable>
|
</QTable>
|
||||||
</template>
|
</template>
|
||||||
</CrudModel>
|
</CrudModel>
|
||||||
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky v-if="$props.create" :offset="[20, 20]" style="z-index: 2">
|
||||||
<QBtn
|
<QBtn
|
||||||
@click="
|
@click="
|
||||||
() =>
|
() =>
|
||||||
|
@ -645,7 +647,7 @@ function handleOnDataSaved(_, res) {
|
||||||
shortcut="+"
|
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">
|
||||||
|
@ -759,6 +761,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>
|
||||||
|
|
|
@ -5,12 +5,14 @@ import { useRoute } from 'vue-router';
|
||||||
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
|
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
|
import VnUserLink from '../ui/VnUserLink.vue';
|
||||||
|
import { downloadFile } from 'src/composables/downloadFile';
|
||||||
|
import VnImg from 'components/ui/VnImg.vue';
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import VnDms from 'src/components/common/VnDms.vue';
|
import VnDms from 'src/components/common/VnDms.vue';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnUserLink from '../ui/VnUserLink.vue';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { downloadFile } from 'src/composables/downloadFile';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
@ -18,6 +20,7 @@ const { t } = useI18n();
|
||||||
const rows = ref();
|
const rows = ref();
|
||||||
const dmsRef = ref();
|
const dmsRef = ref();
|
||||||
const formDialog = ref({});
|
const formDialog = ref({});
|
||||||
|
const token = useSession().getTokenMultimedia();
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
model: {
|
model: {
|
||||||
|
@ -89,6 +92,23 @@ const dmsFilter = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
label: '',
|
||||||
|
name: 'file',
|
||||||
|
align: 'left',
|
||||||
|
component: VnImg,
|
||||||
|
props: (prop) => {
|
||||||
|
return {
|
||||||
|
storage: 'dms',
|
||||||
|
collection: null,
|
||||||
|
resolution: null,
|
||||||
|
id: prop.row.file.split('.')[0],
|
||||||
|
token: token,
|
||||||
|
class: 'rounded',
|
||||||
|
ratio: 1,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'id',
|
field: 'id',
|
||||||
|
@ -142,13 +162,6 @@ const columns = computed(() => [
|
||||||
'model-value': Boolean(prop.value),
|
'model-value': Boolean(prop.value),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
field: 'file',
|
|
||||||
label: t('globals.file'),
|
|
||||||
name: 'file',
|
|
||||||
component: 'span',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'worker',
|
field: 'worker',
|
||||||
|
@ -395,10 +408,6 @@ defineExpose({
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.q-gutter-y-ms {
|
|
||||||
display: grid;
|
|
||||||
row-gap: 20px;
|
|
||||||
}
|
|
||||||
.labelColor {
|
.labelColor {
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ const $props = defineProps({
|
||||||
|
|
||||||
const role = useRole();
|
const role = useRole();
|
||||||
const acl = useAcl();
|
const acl = useAcl();
|
||||||
const showForm = ref(false);
|
|
||||||
|
|
||||||
const isAllowedToCreate = computed(() => {
|
const isAllowedToCreate = computed(() => {
|
||||||
if ($props.acls.length) return acl.hasAny($props.acls);
|
if ($props.acls.length) return acl.hasAny($props.acls);
|
||||||
|
|
|
@ -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 id="spanHTML" v-if="message !== false" v-html="message" />
|
<span id="spanHTML" 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);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@ const getUrl = (zoom = false) => {
|
||||||
const curResolution = zoom
|
const curResolution = zoom
|
||||||
? $props.zoomResolution || $props.resolution
|
? $props.zoomResolution || $props.resolution
|
||||||
: $props.resolution;
|
: $props.resolution;
|
||||||
|
if ($props.storage === 'dms')
|
||||||
|
return `/api/${$props.storage}/${$props.id}/downloadFile?access_token=${token}`;
|
||||||
return isEmployee
|
return isEmployee
|
||||||
? `/api/${$props.storage}/${$props.collection}/${curResolution}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
|
? `/api/${$props.storage}/${$props.collection}/${curResolution}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
|
||||||
: noImage;
|
: noImage;
|
||||||
|
@ -52,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"
|
||||||
|
@ -60,10 +63,12 @@ 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"
|
||||||
class="img_zoom"
|
class="img_zoom"
|
||||||
|
:ratio="0"
|
||||||
/>
|
/>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -228,13 +228,20 @@ 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>
|
||||||
|
.spinner {
|
||||||
|
z-index: 1;
|
||||||
|
align-content: end;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
.info-row {
|
.info-row {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -16,7 +16,8 @@ export function usePrintService() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openReport(path, params) {
|
function openReport(path, params, isNewTab = '_self') {
|
||||||
|
if (typeof params === 'string') params = JSON.parse(params);
|
||||||
params = Object.assign(
|
params = Object.assign(
|
||||||
{
|
{
|
||||||
access_token: getTokenMultimedia(),
|
access_token: getTokenMultimedia(),
|
||||||
|
@ -25,8 +26,7 @@ export function usePrintService() {
|
||||||
);
|
);
|
||||||
|
|
||||||
const query = new URLSearchParams(params).toString();
|
const query = new URLSearchParams(params).toString();
|
||||||
|
window.open(`api/${path}?${query}`, isNewTab);
|
||||||
window.open(`api/${path}?${query}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -285,3 +285,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
|
||||||
|
@ -103,6 +104,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
|
||||||
|
@ -130,9 +135,11 @@ 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
|
||||||
|
'address-create': New address
|
||||||
notes: Notes
|
notes: Notes
|
||||||
credits: Credits
|
credits: Credits
|
||||||
greuges: Greuges
|
greuges: Greuges
|
||||||
|
@ -283,6 +290,14 @@ globals:
|
||||||
createInvoiceIn: Create invoice in
|
createInvoiceIn: Create invoice in
|
||||||
myAccount: My account
|
myAccount: My account
|
||||||
noOne: No one
|
noOne: No one
|
||||||
|
params:
|
||||||
|
clientFk: Client id
|
||||||
|
salesPersonFk: Sales person
|
||||||
|
warehouseFk: Warehouse
|
||||||
|
provinceFk: Province
|
||||||
|
from: From
|
||||||
|
To: To
|
||||||
|
stateFk: State
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Access denied
|
statusUnauthorized: Access denied
|
||||||
statusInternalServerError: An internal server error has ocurred
|
statusInternalServerError: An internal server error has ocurred
|
||||||
|
@ -319,135 +334,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
|
||||||
|
@ -850,6 +736,7 @@ worker:
|
||||||
newWorker: New worker
|
newWorker: New worker
|
||||||
card:
|
card:
|
||||||
workerId: Worker ID
|
workerId: Worker ID
|
||||||
|
user: User
|
||||||
name: Name
|
name: Name
|
||||||
email: Email
|
email: Email
|
||||||
phone: Phone
|
phone: Phone
|
||||||
|
@ -936,6 +823,16 @@ worker:
|
||||||
credit: Have
|
credit: Have
|
||||||
concept: Concept
|
concept: Concept
|
||||||
wagon:
|
wagon:
|
||||||
|
pageTitles:
|
||||||
|
wagons: Wagons
|
||||||
|
wagonsList: Wagons List
|
||||||
|
wagonCreate: Create wagon
|
||||||
|
wagonEdit: Edit wagon
|
||||||
|
typesList: Types List
|
||||||
|
typeCreate: Create type
|
||||||
|
typeEdit: Edit type
|
||||||
|
wagonCounter: Trolley counter
|
||||||
|
wagonTray: Tray List
|
||||||
type:
|
type:
|
||||||
name: Name
|
name: Name
|
||||||
submit: Submit
|
submit: Submit
|
||||||
|
|
|
@ -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
|
||||||
|
@ -105,6 +106,10 @@ globals:
|
||||||
from: Desde
|
from: Desde
|
||||||
to: Hasta
|
to: Hasta
|
||||||
notes: Notas
|
notes: Notas
|
||||||
|
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
|
||||||
|
@ -127,6 +132,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
|
||||||
|
@ -136,6 +142,7 @@ globals:
|
||||||
fiscalData: Datos fiscales
|
fiscalData: Datos fiscales
|
||||||
billingData: Forma de pago
|
billingData: Forma de pago
|
||||||
consignees: Consignatarios
|
consignees: Consignatarios
|
||||||
|
'address-create': Nuevo consignatario
|
||||||
notes: Notas
|
notes: Notas
|
||||||
credits: Créditos
|
credits: Créditos
|
||||||
greuges: Greuges
|
greuges: Greuges
|
||||||
|
@ -287,6 +294,14 @@ globals:
|
||||||
createInvoiceIn: Crear factura recibida
|
createInvoiceIn: Crear factura recibida
|
||||||
myAccount: Mi cuenta
|
myAccount: Mi cuenta
|
||||||
noOne: Nadie
|
noOne: Nadie
|
||||||
|
params:
|
||||||
|
clientFk: Id cliente
|
||||||
|
salesPersonFk: Comercial
|
||||||
|
warehouseFk: Almacén
|
||||||
|
provinceFk: Provincia
|
||||||
|
from: Desde
|
||||||
|
To: Hasta
|
||||||
|
stateFk: Estado
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Acceso denegado
|
statusUnauthorized: Acceso denegado
|
||||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||||
|
@ -321,134 +336,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
|
||||||
|
@ -856,6 +743,7 @@ worker:
|
||||||
newWorker: Nuevo trabajador
|
newWorker: Nuevo trabajador
|
||||||
card:
|
card:
|
||||||
workerId: ID Trabajador
|
workerId: ID Trabajador
|
||||||
|
user: Usuario
|
||||||
name: Nombre
|
name: Nombre
|
||||||
email: Correo personal
|
email: Correo personal
|
||||||
phone: Teléfono
|
phone: Teléfono
|
||||||
|
@ -933,6 +821,16 @@ worker:
|
||||||
credit: Haber
|
credit: Haber
|
||||||
concept: Concepto
|
concept: Concepto
|
||||||
wagon:
|
wagon:
|
||||||
|
pageTitles:
|
||||||
|
wagons: Vagones
|
||||||
|
wagonsList: Listado vagones
|
||||||
|
wagonCreate: Crear tipo
|
||||||
|
wagonEdit: Editar tipo
|
||||||
|
typesList: Listado tipos
|
||||||
|
typeCreate: Crear tipo
|
||||||
|
typeEdit: Editar tipo
|
||||||
|
wagonCounter: Contador de carros
|
||||||
|
wagonTray: Listado bandejas
|
||||||
type:
|
type:
|
||||||
name: Nombre
|
name: Nombre
|
||||||
submit: Guardar
|
submit: Guardar
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -16,7 +16,6 @@ const claimReasons = ref([]);
|
||||||
const claimResults = ref([]);
|
const claimResults = ref([]);
|
||||||
const claimResponsibles = ref([]);
|
const claimResponsibles = ref([]);
|
||||||
const claimRedeliveries = ref([]);
|
const claimRedeliveries = ref([]);
|
||||||
const workers = ref([]);
|
|
||||||
const selected = ref([]);
|
const selected = ref([]);
|
||||||
const saveButtonRef = ref();
|
const saveButtonRef = ref();
|
||||||
|
|
||||||
|
@ -82,7 +81,9 @@ const columns = computed(() => [
|
||||||
label: t('Worker'),
|
label: t('Worker'),
|
||||||
field: (row) => row.workerFk,
|
field: (row) => row.workerFk,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
options: workers.value,
|
url: 'Workers/search',
|
||||||
|
where: { active: 1 },
|
||||||
|
sortBy: 'name ASC',
|
||||||
model: 'workerFk',
|
model: 'workerFk',
|
||||||
optionValue: 'id',
|
optionValue: 'id',
|
||||||
optionLabel: 'nickname',
|
optionLabel: 'nickname',
|
||||||
|
@ -129,13 +130,6 @@ const columns = computed(() => [
|
||||||
@on-fetch="(data) => (claimRedeliveries = data)"
|
@on-fetch="(data) => (claimRedeliveries = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
|
||||||
url="Workers/search"
|
|
||||||
:where="{ active: 1 }"
|
|
||||||
order="name ASC"
|
|
||||||
@on-fetch="(data) => (workers = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<CrudModel
|
<CrudModel
|
||||||
data-key="ClaimDevelopments"
|
data-key="ClaimDevelopments"
|
||||||
url="ClaimDevelopments"
|
url="ClaimDevelopments"
|
||||||
|
@ -165,6 +159,9 @@ const columns = computed(() => [
|
||||||
>
|
>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
|
:url="col.url"
|
||||||
|
:where="col.where"
|
||||||
|
:sort-by="col.sortBy"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
|
|
|
@ -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,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -52,6 +52,7 @@ const columns = computed(() => [
|
||||||
name: 'attendedBy',
|
name: 'attendedBy',
|
||||||
orderBy: 'workerFk',
|
orderBy: 'workerFk',
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
|
name: 'attenderFk',
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'Workers/activeWithInheritedRole',
|
url: 'Workers/activeWithInheritedRole',
|
||||||
|
|
|
@ -179,6 +179,13 @@ const toCustomerAddressEdit = (addressId) => {
|
||||||
{{ item.postalCode }} - {{ item.city }},
|
{{ item.postalCode }} - {{ item.city }},
|
||||||
{{ setProvince(item.provinceFk) }}
|
{{ setProvince(item.provinceFk) }}
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
{{ item.phone }}
|
||||||
|
<span v-if="item.mobile"
|
||||||
|
>,
|
||||||
|
{{ item.mobile }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('Is equalizated')"
|
:label="t('Is equalizated')"
|
||||||
|
|
|
@ -5,12 +5,12 @@ import { useRoute } from 'vue-router';
|
||||||
import { useAcl } from 'src/composables/useAcl';
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
||||||
import { toCurrency, toDate, toDateHourMin } from 'src/filters';
|
import { toCurrency, toDate, toDateHourMin } from 'src/filters';
|
||||||
import { useState } from 'composables/useState';
|
import { useState } from 'composables/useState';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import { useSession } from 'composables/useSession';
|
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
@ -22,12 +22,10 @@ import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment
|
||||||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||||
|
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const { sendEmail } = usePrintService();
|
const { sendEmail, openReport } = usePrintService();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { hasAny } = useAcl();
|
const { hasAny } = useAcl();
|
||||||
|
const currentBalance = ref({});
|
||||||
const session = useSession();
|
|
||||||
const tokenMultimedia = session.getTokenMultimedia();
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
@ -36,7 +34,7 @@ const user = state.getUser();
|
||||||
|
|
||||||
const clientRisk = ref([]);
|
const clientRisk = ref([]);
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const companyId = ref();
|
const companyId = ref(user.value.companyFk);
|
||||||
const companyLastId = ref(user.value.companyFk);
|
const companyLastId = ref(user.value.companyFk);
|
||||||
const balances = ref([]);
|
const balances = ref([]);
|
||||||
const vnFilterRef = ref({});
|
const vnFilterRef = ref({});
|
||||||
|
@ -76,14 +74,14 @@ const companyFilterColumn = {
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
name: 'payed',
|
name: 'payed',
|
||||||
label: t('Date'),
|
label: t('Date'),
|
||||||
format: ({ payed }) => toDate(payed),
|
format: ({ payed }) => toDate(payed),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
name: 'created',
|
name: 'created',
|
||||||
label: t('Creation date'),
|
label: t('Creation date'),
|
||||||
format: ({ created }) => toDateHourMin(created),
|
format: ({ created }) => toDateHourMin(created),
|
||||||
|
@ -91,16 +89,10 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'workerFk',
|
|
||||||
label: t('Employee'),
|
label: t('Employee'),
|
||||||
columnField: {
|
columnField: {
|
||||||
component: 'userLink',
|
component: 'userLink',
|
||||||
attrs: ({ row }) => {
|
attrs: ({ row }) => ({ workerId: row.workerFk, name: row.userName }),
|
||||||
return {
|
|
||||||
workerId: row.workerFk,
|
|
||||||
name: row.userName,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
|
@ -125,14 +117,14 @@ const columns = computed(() => [
|
||||||
isId: true,
|
isId: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'left',
|
||||||
name: 'credit',
|
name: 'credit',
|
||||||
label: t('Havings'),
|
label: t('Havings'),
|
||||||
format: ({ credit }) => credit && toCurrency(credit),
|
format: ({ credit }) => credit && toCurrency(credit),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'left',
|
||||||
name: 'balance',
|
name: 'balance',
|
||||||
label: t('Balance'),
|
label: t('Balance'),
|
||||||
format: ({ balance }) => toCurrency(balance),
|
format: ({ balance }) => toCurrency(balance),
|
||||||
|
@ -171,41 +163,15 @@ const columns = computed(() => [
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
companyId.value = user.value.companyFk;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getClientRisk() {
|
async function getCurrentBalance(data) {
|
||||||
const { data } = await axios.get(`clientRisks`, {
|
for (const balance of data) {
|
||||||
params: {
|
currentBalance.value[balance.companyFk] = {
|
||||||
filter: JSON.stringify({
|
code: balance.company.code,
|
||||||
include: { relation: 'company', scope: { fields: ['code'] } },
|
amount: balance.amount,
|
||||||
where: { clientFk: route.params.id, companyFk: user.value.companyFk },
|
};
|
||||||
}),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
clientRisk.value = data;
|
|
||||||
return clientRisk.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getCurrentBalance() {
|
|
||||||
const currentBalance = (await getClientRisk()).find((balance) => {
|
|
||||||
return balance.companyFk === companyId.value;
|
|
||||||
});
|
|
||||||
return currentBalance && currentBalance.amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function onFetch(data) {
|
|
||||||
balances.value = [];
|
|
||||||
for (const [index, balance] of data.entries()) {
|
|
||||||
if (index === 0) {
|
|
||||||
balance.balance = await getCurrentBalance();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const previousBalance = data[index - 1];
|
|
||||||
balance.balance =
|
|
||||||
previousBalance?.balance - (previousBalance?.debit - previousBalance?.credit);
|
|
||||||
}
|
}
|
||||||
balances.value = data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const showNewPaymentDialog = () => {
|
const showNewPaymentDialog = () => {
|
||||||
|
@ -220,19 +186,27 @@ const showNewPaymentDialog = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const showBalancePdf = ({ id }) => {
|
const showBalancePdf = ({ id }) => {
|
||||||
const url = `api/InvoiceOuts/${id}/download?access_token=${tokenMultimedia}`;
|
openReport(`InvoiceOuts/${id}/download`, {}, '_blank');
|
||||||
window.open(url, '_blank');
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="clientRisks"
|
||||||
|
:filter="{
|
||||||
|
include: { relation: 'company', scope: { fields: ['code'] } },
|
||||||
|
where: { clientFk: route.params.id, companyFk: companyId },
|
||||||
|
}"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="getCurrentBalance"
|
||||||
|
></FetchData>
|
||||||
<VnSubToolbar class="q-mb-md">
|
<VnSubToolbar class="q-mb-md">
|
||||||
<template #st-data>
|
<template #st-data>
|
||||||
<div class="column justify-center q-px-md q-py-sm">
|
<div class="column justify-center q-px-md q-py-sm">
|
||||||
<span class="text-bold">{{ t('Total by company') }}</span>
|
<span class="text-bold">{{ t('Total by company') }}</span>
|
||||||
<div class="row justify-center" v-if="clientRisk?.length">
|
<div class="row justify-center">
|
||||||
{{ clientRisk[0].company.code }}:
|
{{ currentBalance[companyId]?.code }}:
|
||||||
{{ toCurrency(clientRisk[0].amount) }}
|
{{ toCurrency(currentBalance[companyId]?.amount) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -258,7 +232,7 @@ const showBalancePdf = ({ id }) => {
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:is-editable="false"
|
:is-editable="false"
|
||||||
:column-search="false"
|
:column-search="false"
|
||||||
@on-fetch="onFetch"
|
:disable-option="{ card: true }"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #column-balance="{ rowIndex }">
|
<template #column-balance="{ rowIndex }">
|
||||||
|
@ -266,7 +240,7 @@ const showBalancePdf = ({ id }) => {
|
||||||
</template>
|
</template>
|
||||||
<template #column-description="{ row }">
|
<template #column-description="{ row }">
|
||||||
<div class="link" v-if="row.isInvoice">
|
<div class="link" v-if="row.isInvoice">
|
||||||
{{ row.description }}
|
{{ t('bill', { ref: row.description }) }}
|
||||||
<InvoiceOutDescriptorProxy :id="row.description" />
|
<InvoiceOutDescriptorProxy :id="row.description" />
|
||||||
</div>
|
</div>
|
||||||
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
||||||
|
|
|
@ -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,8 @@ const title = ref();
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QSelect
|
<VnSelect
|
||||||
|
url="Clients"
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
:label="t('customer.basicData.previousClient')"
|
:label="t('customer.basicData.previousClient')"
|
||||||
:options="clients"
|
:options="clients"
|
||||||
|
@ -134,7 +145,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 +158,7 @@ const title = ref();
|
||||||
}}</QTooltip>
|
}}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</template>
|
</template>
|
||||||
</QSelect>
|
</VnSelect>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
@ -14,8 +13,6 @@ import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const payMethods = ref([]);
|
|
||||||
const bankEntitiesOptions = ref([]);
|
|
||||||
const bankEntitiesRef = ref(null);
|
const bankEntitiesRef = ref(null);
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -31,15 +28,6 @@ const getBankEntities = (data, formData) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<fetch-data @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
|
|
||||||
<fetch-data
|
|
||||||
ref="bankEntitiesRef"
|
|
||||||
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
|
||||||
:filter="filter"
|
|
||||||
auto-load
|
|
||||||
url="BankEntities"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<FormModel
|
<FormModel
|
||||||
:url-update="`Clients/${route.params.id}`"
|
:url-update="`Clients/${route.params.id}`"
|
||||||
:url="`Clients/${route.params.id}/getCard`"
|
:url="`Clients/${route.params.id}/getCard`"
|
||||||
|
@ -49,8 +37,9 @@ const getBankEntities = (data, formData) => {
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
auto-load
|
||||||
|
url="PayMethods"
|
||||||
:label="t('Billing data')"
|
:label="t('Billing data')"
|
||||||
:options="payMethods"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -69,7 +58,10 @@ const getBankEntities = (data, formData) => {
|
||||||
</VnInput>
|
</VnInput>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('Swift / BIC')"
|
:label="t('Swift / BIC')"
|
||||||
:options="bankEntitiesOptions"
|
ref="bankEntitiesRef"
|
||||||
|
:filter="filter"
|
||||||
|
auto-load
|
||||||
|
url="BankEntities"
|
||||||
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
|
||||||
:rules="validate('Worker.bankEntity')"
|
:rules="validate('Worker.bankEntity')"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
@ -85,9 +77,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',
|
||||||
|
@ -51,66 +44,56 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'rating',
|
field: 'rating',
|
||||||
label: t('Rating'),
|
label: t('customer.summary.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('customer.summary.recommendCredit'),
|
||||||
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">{{ row.worker.user.nickname }}</span>
|
||||||
<div class="col">
|
<WorkerDescriptorProxy :id="row.worker.id" />
|
||||||
<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,22 +103,16 @@ 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>
|
||||||
es:
|
es:
|
||||||
Rating: Clasificación
|
|
||||||
Recommended credit: Crédito recomendado
|
Recommended credit: Crédito recomendado
|
||||||
Since: Desde
|
Since: Desde
|
||||||
Employee: Empleado
|
Employee: Empleado
|
||||||
|
|
|
@ -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,24 +61,30 @@ 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"
|
||||||
|
@ -97,11 +107,16 @@ const setData = (entity) => (data.value = useCardDescription(entity?.name, entit
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('Allowed substitution') }}</QTooltip>
|
<QTooltip>{{ t('Allowed substitution') }}</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"
|
||||||
|
@ -109,7 +124,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"
|
||||||
|
@ -117,7 +132,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"
|
||||||
|
@ -125,7 +140,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"
|
||||||
|
@ -137,13 +152,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>
|
||||||
|
@ -155,7 +170,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"
|
||||||
|
@ -176,23 +197,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"
|
||||||
|
@ -213,7 +219,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,6 +43,15 @@ 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();
|
||||||
|
};
|
||||||
const updateSubstitutionAllowed = async () => {
|
const updateSubstitutionAllowed = async () => {
|
||||||
try {
|
try {
|
||||||
await axios.patch(`Clients/${route.params.id}`, {
|
await axios.patch(`Clients/${route.params.id}`, {
|
||||||
|
@ -53,17 +65,20 @@ const updateSubstitutionAllowed = async () => {
|
||||||
</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>
|
||||||
|
|
|
@ -5,10 +5,10 @@ import { useRoute } from 'vue-router';
|
||||||
import { toCurrency } from 'src/filters';
|
import { toCurrency } from 'src/filters';
|
||||||
import { toDateTimeFormat } from 'src/filters/date';
|
import { toDateTimeFormat } from 'src/filters/date';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
const entityId = computed(() => route.params.id);
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const rows = ref([]);
|
|
||||||
const totalAmount = ref();
|
const totalAmount = ref();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const filter = computed(() => {
|
const filter = computed(() => {
|
||||||
|
@ -28,7 +28,7 @@ const filter = computed(() => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
where: {
|
where: {
|
||||||
clientFk: route.params.id,
|
clientFk: entityId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -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,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -84,14 +84,14 @@ const columns = computed(() => [
|
||||||
create: true,
|
create: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const setRows = (data) => {
|
|
||||||
rows.value = data;
|
|
||||||
totalAmount.value = data.reduce((acc, { amount = 0 }) => acc + amount, 0);
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
:url="`Greuges/${entityId}/sumAmount`"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="({ sumAmount }) => (totalAmount = sumAmount)"
|
||||||
|
></FetchData>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="Greuges"
|
data-key="Greuges"
|
||||||
|
@ -104,10 +104,10 @@ const setRows = (data) => {
|
||||||
:is-editable="false"
|
:is-editable="false"
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
:column-search="false"
|
:column-search="false"
|
||||||
@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 },
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
<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 { toDateTimeFormat } from 'src/filters/date';
|
import { toDateTimeFormat } from 'src/filters/date';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import { dashIfEmpty } from 'src/filters';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const rows = ref([]);
|
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
{ relation: 'mandateType', scope: { fields: ['id', 'name'] } },
|
{ relation: 'mandateType', scope: { fields: ['id', 'code'] } },
|
||||||
{ relation: 'company', scope: { fields: ['id', 'code'] } },
|
{ relation: 'company', scope: { fields: ['id', 'code'] } },
|
||||||
],
|
],
|
||||||
where: { clientFk: route.params.id },
|
where: { clientFk: route.params.id },
|
||||||
|
@ -22,114 +21,61 @@ const filter = {
|
||||||
limit: 20,
|
limit: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
const tableColumnComponents = {
|
|
||||||
id: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
company: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
type: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
registerDate: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
endDate: {
|
|
||||||
component: 'span',
|
|
||||||
props: () => {},
|
|
||||||
event: () => {},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'id',
|
|
||||||
label: t('Id'),
|
|
||||||
name: 'id',
|
name: 'id',
|
||||||
|
label: t('globals.id'),
|
||||||
|
field: 'id',
|
||||||
|
isId: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: (row) => row.company.code,
|
cardVisible: true,
|
||||||
label: t('Company'),
|
format: ({ company }) => company.code,
|
||||||
|
label: t('globals.company'),
|
||||||
name: 'company',
|
name: 'company',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: (row) => row.mandateType.name,
|
cardVisible: true,
|
||||||
label: t('Type'),
|
format: ({ mandateType }) => mandateType.code,
|
||||||
|
label: t('globals.type'),
|
||||||
name: 'type',
|
name: 'type',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'created',
|
cardVisible: true,
|
||||||
label: t('Register date'),
|
label: t('Register date'),
|
||||||
name: 'registerDate',
|
name: 'created',
|
||||||
format: (value) => toDateTimeFormat(value),
|
format: ({ created }) => toDateTimeFormat(created),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
field: 'finished',
|
cardVisible: true,
|
||||||
|
name: 'finished',
|
||||||
label: t('End date'),
|
label: t('End date'),
|
||||||
name: 'endDate',
|
format: ({ finished }) => dashIfEmpty(toDateTimeFormat(finished)),
|
||||||
format: (value) => (value ? toDateTimeFormat(value) : '-'),
|
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
:filter="filter"
|
|
||||||
@on-fetch="(data) => (rows = data)"
|
|
||||||
auto-load
|
|
||||||
url="Mandates"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QTable
|
<VnTable
|
||||||
|
:filter="filter"
|
||||||
|
auto-load
|
||||||
|
url="Mandates"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:pagination="{ rowsPerPage: 12 }"
|
|
||||||
:rows="rows"
|
|
||||||
class="full-width q-mt-md"
|
class="full-width q-mt-md"
|
||||||
row-key="id"
|
:right-search="false"
|
||||||
v-if="rows?.length"
|
:row-click="false"
|
||||||
>
|
/>
|
||||||
<template #body-cell="props">
|
|
||||||
<QTd :props="props">
|
|
||||||
<QTr :props="props" class="cursor-pointer">
|
|
||||||
<component
|
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
|
||||||
@click="tableColumnComponents[props.col.name].event(props)"
|
|
||||||
class="rounded-borders q-pa-sm"
|
|
||||||
v-bind="tableColumnComponents[props.col.name].props(props)"
|
|
||||||
>
|
|
||||||
{{ props.value }}
|
|
||||||
</component>
|
|
||||||
</QTr>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
</QTable>
|
|
||||||
|
|
||||||
<h5 class="flex justify-center color-vn-label" v-else>
|
|
||||||
{{ t('globals.noResults') }}
|
|
||||||
</h5>
|
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Id: Id
|
|
||||||
Company: Empresa
|
|
||||||
Type: Tipo
|
|
||||||
Register date: Fecha alta
|
Register date: Fecha alta
|
||||||
End date: Fecha baja
|
End date: Fecha baja
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -89,9 +89,10 @@ 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: t('New recovery'),
|
||||||
onDataSaved: () => tableRef.reload(),
|
onDataSaved: () => tableRef.reload(),
|
||||||
formInitialData: { clientFk: route.params.id, started: Date.vnNew() },
|
formInitialData: { clientFk: route.params.id, started: Date.vnNew() },
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute } 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 rows = ref([]);
|
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -26,105 +25,78 @@ 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',
|
columnField: {
|
||||||
|
component: 'userLink',
|
||||||
|
attrs: ({ row }) => {
|
||||||
|
return {
|
||||||
|
defaultName: true,
|
||||||
|
workerId: row?.user?.id,
|
||||||
|
name: row?.user?.name,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
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">
|
:right-search="false"
|
||||||
<QTable
|
:rows="rows"
|
||||||
:columns="columns"
|
:order="['created DESC']"
|
||||||
:pagination="{ rowsPerPage: 12 }"
|
class="full-width q-mt-md"
|
||||||
:rows="rows"
|
row-key="id"
|
||||||
class="full-width q-mt-md"
|
:create="false"
|
||||||
row-key="id"
|
:no-data-label="t('globals.noResults')"
|
||||||
:no-data-label="t('globals.noResults')"
|
>
|
||||||
>
|
<template #column-worker="{ row }">
|
||||||
<template #body-cell="props">
|
<div v-if="row.user">
|
||||||
<QTd :props="props">
|
<span class="link">{{ row.user?.name }}</span
|
||||||
<QTr :props="props" class="cursor-pointer">
|
><WorkerDescriptorProxy :id="row.userFk" />
|
||||||
<component
|
</div>
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
<span v-else>{{ dashIfEmpty(row.user) }}</span>
|
||||||
class="col-content"
|
</template>
|
||||||
v-bind="
|
</VnTable>
|
||||||
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>
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import { toCurrency, toDateHourMinSec } from 'src/filters';
|
import { toCurrency, toDateHourMin } from 'src/filters';
|
||||||
|
|
||||||
import CustomerCloseIconTooltip from '../components/CustomerCloseIconTooltip.vue';
|
import CustomerCloseIconTooltip from '../components/CustomerCloseIconTooltip.vue';
|
||||||
import CustomerCheckIconTooltip from '../components/CustomerCheckIconTooltip.vue';
|
import CustomerCheckIconTooltip from '../components/CustomerCheckIconTooltip.vue';
|
||||||
|
@ -74,7 +74,7 @@ const columns = computed(() => [
|
||||||
field: 'created',
|
field: 'created',
|
||||||
label: t('Date'),
|
label: t('Date'),
|
||||||
name: 'date',
|
name: 'date',
|
||||||
format: (value) => toDateHourMinSec(value),
|
format: (value) => toDateHourMin(value),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
|
@ -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,6 +416,39 @@ 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
|
||||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.location"
|
v-model="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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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,11 +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 { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import { useQuasar } from 'quasar';
|
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';
|
||||||
|
@ -17,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();
|
||||||
|
@ -27,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 { 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: [
|
||||||
|
@ -59,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) => {
|
||||||
|
@ -76,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) => {
|
||||||
|
@ -89,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';
|
||||||
|
@ -121,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;
|
||||||
|
@ -169,7 +156,6 @@ const getSamples = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getSamples();
|
|
||||||
const onDataSaved = async () => {
|
const onDataSaved = async () => {
|
||||||
try {
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -179,8 +165,9 @@ const onDataSaved = async () => {
|
||||||
};
|
};
|
||||||
setParams(params);
|
setParams(params);
|
||||||
const samplesData = await getSamples();
|
const samplesData = await getSamples();
|
||||||
const path = `${samplesData.model}/${route.params.id}/${samplesData.code}-email`;
|
const path = `${samplesData.model}/${entityId.value}/${samplesData.code}-email`;
|
||||||
await sendEmail(path, params);
|
await sendEmail(path, params);
|
||||||
|
onDialogOK(params);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notify('errors.create', 'negative');
|
notify('errors.create', 'negative');
|
||||||
}
|
}
|
||||||
|
@ -197,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')"
|
||||||
|
@ -320,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"
|
||||||
|
@ -333,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"
|
||||||
|
@ -371,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
|
||||||
|
|
|
@ -60,7 +60,7 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{
|
{{
|
||||||
'Ctrl + Alt + ' +
|
'Ctrl + Alt + ' +
|
||||||
item.keyBinding.toUpperCase()
|
item?.keyBinding?.toUpperCase()
|
||||||
}}
|
}}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</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"
|
||||||
|
|
|
@ -116,7 +116,7 @@ const entriesTableColumns = computed(() => [
|
||||||
{{ col.value }}
|
{{ col.value }}
|
||||||
</QTd>
|
</QTd>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="print"
|
icon="visibility"
|
||||||
v-if="props.row.stickers > 0"
|
v-if="props.row.stickers > 0"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@click="
|
@click="
|
||||||
|
@ -126,7 +126,7 @@ const entriesTableColumns = computed(() => [
|
||||||
"
|
"
|
||||||
unelevated
|
unelevated
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('printLabel') }}</QTooltip>
|
<QTooltip>{{ t('viewLabel') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -11,4 +11,4 @@ shipped: Shipped
|
||||||
fromShipped: Shipped(from)
|
fromShipped: Shipped(from)
|
||||||
toShipped: Shipped(to)
|
toShipped: Shipped(to)
|
||||||
printLabels: Print stickers
|
printLabels: Print stickers
|
||||||
printLabel: Print sticker
|
viewLabel: View sticker
|
||||||
|
|
|
@ -15,4 +15,4 @@ shipped: F. salida
|
||||||
fromShipped: F. salida(desde)
|
fromShipped: F. salida(desde)
|
||||||
toShipped: F. salida(hasta)
|
toShipped: F. salida(hasta)
|
||||||
printLabels: Imprimir etiquetas
|
printLabels: Imprimir etiquetas
|
||||||
printLabel: Imprimir etiqueta
|
viewLabel: Ver etiqueta
|
||||||
|
|
|
@ -41,8 +41,7 @@ const invoiceFormType = ref('pdf');
|
||||||
const defaultEmailAddress = ref($props.invoiceOutData.client?.email);
|
const defaultEmailAddress = ref($props.invoiceOutData.client?.email);
|
||||||
|
|
||||||
const showInvoicePdf = () => {
|
const showInvoicePdf = () => {
|
||||||
const url = `api/InvoiceOuts/${$props.invoiceOutData.id}/download?access_token=${token}`;
|
openReport(`InvoiceOuts/${$props.invoiceOutData.id}/download`, {}, '_blank');
|
||||||
window.open(url, '_blank');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const showInvoiceCsv = () => {
|
const showInvoiceCsv = () => {
|
||||||
|
|
|
@ -76,16 +76,8 @@ const columns = computed(() => [
|
||||||
name: 'rate2',
|
name: 'rate2',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
columnField: {
|
component: 'input',
|
||||||
class: 'expand',
|
type: 'number',
|
||||||
component: 'input',
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
columnFilter: {
|
|
||||||
class: 'expand',
|
|
||||||
component: 'input',
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.packingPrice'),
|
label: t('item.fixedPrice.packingPrice'),
|
||||||
|
@ -93,35 +85,18 @@ const columns = computed(() => [
|
||||||
name: 'rate3',
|
name: 'rate3',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
columnField: {
|
component: 'input',
|
||||||
class: 'expand',
|
type: 'number',
|
||||||
component: 'input',
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
columnFilter: {
|
|
||||||
class: 'expand',
|
|
||||||
component: 'input',
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.minPrice'),
|
label: t('item.fixedPrice.minPrice'),
|
||||||
field: 'minPrice',
|
field: 'minPrice',
|
||||||
columnClass: 'shrink',
|
|
||||||
name: 'minPrice',
|
name: 'minPrice',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
columnField: {
|
component: 'input',
|
||||||
class: 'expand',
|
type: 'number',
|
||||||
component: 'input',
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
columnFilter: {
|
|
||||||
class: 'expand',
|
|
||||||
component: 'input',
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.started'),
|
label: t('item.fixedPrice.started'),
|
||||||
|
@ -162,16 +137,9 @@ const columns = computed(() => [
|
||||||
name: 'warehouseFk',
|
name: 'warehouseFk',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnClass: 'shrink',
|
columnClass: 'shrink',
|
||||||
columnFilter: {
|
component: 'select',
|
||||||
component: 'select',
|
|
||||||
},
|
options: warehousesOptions,
|
||||||
columnField: {
|
|
||||||
component: 'select',
|
|
||||||
class: 'expand',
|
|
||||||
},
|
|
||||||
attrs: {
|
|
||||||
options: warehousesOptions,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -518,29 +486,35 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
</span>
|
</span>
|
||||||
<span class="subName">{{ row.subName }}</span>
|
<span class="subName">{{ row.subName }}</span>
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
<FetchedTags style="width: max-content; max-width: 220px" :item="row" />
|
<FetchedTags :item="row" />
|
||||||
</template>
|
</template>
|
||||||
<template #column-rate2="props">
|
<template #column-rate2="props">
|
||||||
<VnInput
|
<QTd class="col">
|
||||||
mask="###.##"
|
<VnInput
|
||||||
v-model.number="props.row.rate2"
|
type="currency"
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
style="width: 75px"
|
||||||
>
|
v-model.number="props.row.rate2"
|
||||||
<template #append>€</template>
|
v-on="getRowUpdateInputEvents(props)"
|
||||||
</VnInput>
|
>
|
||||||
|
<template #append>€</template>
|
||||||
|
</VnInput>
|
||||||
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #column-rate3="props">
|
<template #column-rate3="props">
|
||||||
<VnInput
|
<QTd class="col">
|
||||||
mask="###.##"
|
<VnInput
|
||||||
v-model.number="props.row.rate3"
|
style="width: 75px"
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
type="currency"
|
||||||
>
|
v-model.number="props.row.rate3"
|
||||||
<template #append>€</template>
|
v-on="getRowUpdateInputEvents(props)"
|
||||||
</VnInput>
|
>
|
||||||
|
<template #append>€</template>
|
||||||
|
</VnInput>
|
||||||
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #column-minPrice="props">
|
<template #column-minPrice="props">
|
||||||
<QTd class="col">
|
<QTd class="col">
|
||||||
<div class="row" style="width: 115px">
|
<div class="row">
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:model-value="props.row.hasMinPrice"
|
:model-value="props.row.hasMinPrice"
|
||||||
@update:model-value="updateMinPrice($event, props)"
|
@update:model-value="updateMinPrice($event, props)"
|
||||||
|
@ -549,6 +523,8 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
class="col"
|
class="col"
|
||||||
|
type="currency"
|
||||||
|
mask="###.##"
|
||||||
:disable="props.row.hasMinPrice === 1"
|
: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)"
|
||||||
|
@ -577,15 +553,17 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #column-warehouseFk="props">
|
<template #column-warehouseFk="props">
|
||||||
<VnSelect
|
<QTd class="col">
|
||||||
style="max-width: 150px"
|
<VnSelect
|
||||||
:options="warehousesOptions"
|
style="max-width: 150px"
|
||||||
hide-selected
|
:options="warehousesOptions"
|
||||||
option-label="name"
|
hide-selected
|
||||||
option-value="id"
|
option-label="name"
|
||||||
v-model="props.row.warehouseFk"
|
option-value="id"
|
||||||
v-on="getRowUpdateInputEvents(props, false, 'select')"
|
v-model="props.row.warehouseFk"
|
||||||
/>
|
v-on="getRowUpdateInputEvents(props, false, 'select')"
|
||||||
|
/>
|
||||||
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #column-deleteAction="{ row, rowIndex }">
|
<template #column-deleteAction="{ row, rowIndex }">
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -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 },
|
||||||
|
|
|
@ -40,7 +40,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
:hidden-tags="['from', 'to']"
|
:hidden-tags="['from', 'to', 'search']"
|
||||||
:custom-tags="['scopeDays']"
|
:custom-tags="['scopeDays']"
|
||||||
:unremovable-params="['from', 'to', 'scopeDays']"
|
:unremovable-params="['from', 'to', 'scopeDays']"
|
||||||
>
|
>
|
||||||
|
@ -64,7 +64,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('params.clientFk')"
|
:label="t('globals.params.clientFk')"
|
||||||
v-model="params.clientFk"
|
v-model="params.clientFk"
|
||||||
is-outlined
|
is-outlined
|
||||||
/>
|
/>
|
||||||
|
@ -105,7 +105,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
:label="t('params.salesPersonFk')"
|
:label="t('globals.params.salesPersonFk')"
|
||||||
v-model="params.salesPersonFk"
|
v-model="params.salesPersonFk"
|
||||||
url="Workers/search"
|
url="Workers/search"
|
||||||
:params="{ departmentCodes: ['VT'] }"
|
:params="{ departmentCodes: ['VT'] }"
|
||||||
|
@ -158,7 +158,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
:label="t('params.stateFk')"
|
:label="t('globals.params.stateFk')"
|
||||||
v-model="params.stateFk"
|
v-model="params.stateFk"
|
||||||
url="States"
|
url="States"
|
||||||
is-outlined
|
is-outlined
|
||||||
|
@ -184,7 +184,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
:label="t('params.warehouseFk')"
|
:label="t('globals.params.warehouseFk')"
|
||||||
v-model="params.warehouseFk"
|
v-model="params.warehouseFk"
|
||||||
:options="warehouses"
|
:options="warehouses"
|
||||||
/>
|
/>
|
||||||
|
@ -196,7 +196,7 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
rounded
|
rounded
|
||||||
:label="t('params.provinceFk')"
|
:label="t('globals.params.provinceFk')"
|
||||||
v-model="params.provinceFk"
|
v-model="params.provinceFk"
|
||||||
url="Provinces"
|
url="Provinces"
|
||||||
/>
|
/>
|
||||||
|
@ -235,22 +235,15 @@ const handleScopeDays = (params, days, callback) => {
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
params:
|
params:
|
||||||
clientFk: Client id
|
|
||||||
orderFk: Order id
|
orderFk: Order id
|
||||||
scopeDays: Days onward
|
scopeDays: Days onward
|
||||||
nickname: Nickname
|
nickname: Nickname
|
||||||
salesPersonFk: Sales person
|
|
||||||
refFk: Invoice
|
refFk: Invoice
|
||||||
agencyModeFk: Agency
|
agencyModeFk: Agency
|
||||||
stateFk: State
|
|
||||||
groupedStates: Grouped State
|
groupedStates: Grouped State
|
||||||
warehouseFk: Warehouse
|
|
||||||
provinceFk: Province
|
|
||||||
myTeam: My team
|
myTeam: My team
|
||||||
problems: With problems
|
problems: With problems
|
||||||
pending: Pending
|
pending: Pending
|
||||||
from: From
|
|
||||||
to: To
|
|
||||||
alertLevel: Grouped State
|
alertLevel: Grouped State
|
||||||
FREE: Free
|
FREE: Free
|
||||||
DELIVERED: Delivered
|
DELIVERED: Delivered
|
||||||
|
@ -261,22 +254,15 @@ en:
|
||||||
|
|
||||||
es:
|
es:
|
||||||
params:
|
params:
|
||||||
clientFk: Id cliente
|
|
||||||
orderFk: Id cesta
|
orderFk: Id cesta
|
||||||
scopeDays: Días en adelante
|
scopeDays: Días en adelante
|
||||||
nickname: Nombre mostrado
|
nickname: Nombre mostrado
|
||||||
salesPersonFk: Comercial
|
|
||||||
refFk: Factura
|
refFk: Factura
|
||||||
agencyModeFk: Agencia
|
agencyModeFk: Agencia
|
||||||
stateFk: Estado
|
|
||||||
groupedStates: Estado agrupado
|
groupedStates: Estado agrupado
|
||||||
warehouseFk: Almacén
|
|
||||||
provinceFk: Provincia
|
|
||||||
myTeam: Mi equipo
|
myTeam: Mi equipo
|
||||||
problems: Con problemas
|
problems: Con problemas
|
||||||
pending: Pendiente
|
pending: Pendiente
|
||||||
from: Desde
|
|
||||||
To: Hasta
|
|
||||||
alertLevel: Estado agrupado
|
alertLevel: Estado agrupado
|
||||||
FREE: Libre
|
FREE: Libre
|
||||||
DELIVERED: Servido
|
DELIVERED: Servido
|
||||||
|
|
|
@ -3,7 +3,7 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="SalesMonitorTickets"
|
data-key="saleMonitorTickets"
|
||||||
url="SalesMonitors/salesFilter"
|
url="SalesMonitors/salesFilter"
|
||||||
:redirect="false"
|
:redirect="false"
|
||||||
:label="$t('searchBar.label')"
|
:label="$t('searchBar.label')"
|
||||||
|
|
|
@ -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>
|
|
@ -17,13 +17,15 @@ import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import { usePrintService } from 'src/composables/usePrintService';
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
filter: {
|
filter: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
watch($props.filter, (v) => (filterLack.value.where = v));
|
|
||||||
|
const { openReport } = usePrintService();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
@ -224,7 +226,7 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
watch($props.filter, (v) => (filterLack.value.where = v));
|
||||||
function navigate(id) {
|
function navigate(id) {
|
||||||
router.push({ path: `/route/${id}` });
|
router.push({ path: `/route/${id}` });
|
||||||
}
|
}
|
||||||
|
@ -242,18 +244,15 @@ const cloneRoutes = () => {
|
||||||
const showRouteReport = () => {
|
const showRouteReport = () => {
|
||||||
const ids = selectedRows.value.map((row) => row?.id);
|
const ids = selectedRows.value.map((row) => row?.id);
|
||||||
const idString = ids.join(',');
|
const idString = ids.join(',');
|
||||||
let url;
|
let url = `Routes/${idString}/driver-route-pdf`;
|
||||||
|
let params = {};
|
||||||
if (selectedRows.value.length <= 1) {
|
if (selectedRows.value.length >= 1) {
|
||||||
url = `api/Routes/${idString}/driver-route-pdf?access_token=${session.getTokenMultimedia()}`;
|
params = {
|
||||||
} else {
|
|
||||||
const params = new URLSearchParams({
|
|
||||||
access_token: session.getTokenMultimedia(),
|
|
||||||
id: idString,
|
id: idString,
|
||||||
});
|
};
|
||||||
url = `api/Routes/downloadZip?${params.toString()}`;
|
url = `Routes/downloadZip`;
|
||||||
}
|
}
|
||||||
window.open(url, '_blank');
|
openReport(url, params, '_blank');
|
||||||
};
|
};
|
||||||
|
|
||||||
function markAsServed() {
|
function markAsServed() {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
|
@ -423,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>
|
||||||
|
@ -446,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>
|
||||||
|
|
|
@ -159,10 +159,10 @@ const transferSales = async (ticketId) => {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #no-data>
|
<template #no-data>
|
||||||
<TicketTransferForm @refresh-data="transferSales" />
|
<TicketTransferForm v-bind="$props" />
|
||||||
</template>
|
</template>
|
||||||
<template #bottom>
|
<template #bottom>
|
||||||
<TicketTransferForm @refresh-data="transferSales" />
|
<TicketTransferForm v-bind="$props" />
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -1,19 +1,61 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
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 emit = defineEmits(['refreshData']);
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const newTicket = ref(null);
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
{{ _transfer }}
|
||||||
<QForm class="q-mt-lg full-width">
|
<QForm class="q-mt-lg full-width">
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model.number="newTicket"
|
v-model.number="_transfer.ticketId"
|
||||||
:label="t('Transfer to ticket')"
|
:label="t('Transfer to ticket')"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
>
|
>
|
||||||
|
@ -21,7 +63,7 @@ const newTicket = ref(null);
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="keyboard_arrow_right"
|
icon="keyboard_arrow_right"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="emit('refreshData', newTicket)"
|
@click="transferSales(_transfer.ticketId)"
|
||||||
style="width: 30px"
|
style="width: 30px"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -30,7 +72,7 @@ const newTicket = ref(null);
|
||||||
:label="t('New ticket')"
|
:label="t('New ticket')"
|
||||||
color="primary"
|
color="primary"
|
||||||
class="full-width q-my-lg"
|
class="full-width q-my-lg"
|
||||||
@click="emit('refreshData')"
|
@click="transferSales()"
|
||||||
/>
|
/>
|
||||||
</QForm>
|
</QForm>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -0,0 +1,226 @@
|
||||||
|
<script setup>
|
||||||
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import { onBeforeMount, reactive, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
|
|
||||||
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
|
|
||||||
|
import { useState } from 'composables/useState';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
const state = useState();
|
||||||
|
const user = state.getUser();
|
||||||
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
|
||||||
|
const initialFormState = reactive({
|
||||||
|
clientId: Number(route.query?.clientFk) || null,
|
||||||
|
addressId: null,
|
||||||
|
agencyModeId: null,
|
||||||
|
warehouseId: user.value.warehouseFk,
|
||||||
|
landed: null,
|
||||||
|
});
|
||||||
|
const clientOptions = ref([]);
|
||||||
|
const agenciesOptions = ref([]);
|
||||||
|
const addressesOptions = ref([]);
|
||||||
|
const warehousesOptions = ref([]);
|
||||||
|
const selectedClient = ref(null);
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
await onClientSelected(initialFormState);
|
||||||
|
});
|
||||||
|
|
||||||
|
const fetchClient = async (formData) => {
|
||||||
|
try {
|
||||||
|
const filter = {
|
||||||
|
include: {
|
||||||
|
relation: 'defaultAddress',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'agencyModeFk'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
where: { id: formData.clientId },
|
||||||
|
};
|
||||||
|
const params = { filter: JSON.stringify(filter) };
|
||||||
|
const { data } = await axios.get('Clients', { params });
|
||||||
|
const [client] = data;
|
||||||
|
selectedClient.value = client;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching client');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchAddresses = async (formData) => {
|
||||||
|
try {
|
||||||
|
if (!formData.clientId) return;
|
||||||
|
|
||||||
|
const filter = {
|
||||||
|
fields: ['nickname', 'street', 'city', 'id'],
|
||||||
|
where: { isActive: true },
|
||||||
|
order: 'nickname ASC',
|
||||||
|
};
|
||||||
|
const params = { filter: JSON.stringify(filter) };
|
||||||
|
const { data } = await axios.get(`Clients/${formData.clientId}/addresses`, {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
addressesOptions.value = data;
|
||||||
|
|
||||||
|
const { defaultAddress } = selectedClient.value;
|
||||||
|
formData.addressId = defaultAddress.id;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error fetching addresses`, err);
|
||||||
|
return err.response;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onClientSelected = async (formData) => {
|
||||||
|
await fetchClient(formData);
|
||||||
|
await fetchAddresses(formData);
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchAvailableAgencies = async (formData) => {
|
||||||
|
if (!formData.warehouseId || !formData.addressId || !formData.landed) return;
|
||||||
|
let params = {
|
||||||
|
warehouseFk: formData.warehouseId,
|
||||||
|
addressFk: formData.addressId,
|
||||||
|
landed: formData.landed,
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await axios.get('Agencies/getAgenciesWithWarehouse', { params });
|
||||||
|
|
||||||
|
agenciesOptions.value = data;
|
||||||
|
|
||||||
|
const defaultAgency = agenciesOptions.value.find(
|
||||||
|
(agency) =>
|
||||||
|
agency.agencyModeFk === selectedClient.value.defaultAddress.agencyModeFk
|
||||||
|
);
|
||||||
|
|
||||||
|
if (defaultAgency) formData.agencyModeId = defaultAgency.agencyModeFk;
|
||||||
|
};
|
||||||
|
|
||||||
|
const redirectToTicketList = (_, { id }) => {
|
||||||
|
router.push({ name: 'TicketSummary', params: { id } });
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="Clients"
|
||||||
|
@on-fetch="(data) => (clientOptions = data)"
|
||||||
|
:filter="{ fields: ['id', 'name', 'defaultAddressFk'], order: 'id' }"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="Warehouses"
|
||||||
|
@on-fetch="(data) => (warehousesOptions = data)"
|
||||||
|
order="name"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
|
||||||
|
<FormModelPopup
|
||||||
|
:title="t('globals.pageTitles.createTicket')"
|
||||||
|
url-create="Tickets/new"
|
||||||
|
model="ticket"
|
||||||
|
:form-initial-data="initialFormState"
|
||||||
|
@on-data-saved="redirectToTicketList"
|
||||||
|
>
|
||||||
|
<template #form-inputs="{ data }">
|
||||||
|
<VnRow>
|
||||||
|
<div class="col">
|
||||||
|
<VnSelect
|
||||||
|
:label="t('ticket.create.client')"
|
||||||
|
v-model="data.clientId"
|
||||||
|
:options="clientOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
hide-selected
|
||||||
|
@update:model-value="(client) => onClientSelected(data)"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt.name }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ `#${scope.opt.id}` }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<div class="col">
|
||||||
|
<VnSelect
|
||||||
|
:label="t('ticket.create.address')"
|
||||||
|
v-model="data.addressId"
|
||||||
|
:options="addressesOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="nickname"
|
||||||
|
hide-selected
|
||||||
|
:disable="!data.clientId"
|
||||||
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt.nickname }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ `${scope.opt.street}, ${scope.opt.city}` }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<div class="col">
|
||||||
|
<VnInputDate
|
||||||
|
placeholder="dd-mm-aaa"
|
||||||
|
:label="t('ticket.create.landed')"
|
||||||
|
v-model="data.landed"
|
||||||
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<div class="col">
|
||||||
|
<VnSelect
|
||||||
|
:label="t('ticket.create.warehouse')"
|
||||||
|
v-model="data.warehouseId"
|
||||||
|
:options="warehousesOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
hide-selected
|
||||||
|
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<div class="col">
|
||||||
|
<VnSelect
|
||||||
|
:label="t('ticket.create.agency')"
|
||||||
|
v-model="data.agencyModeId"
|
||||||
|
:options="agenciesOptions"
|
||||||
|
option-value="agencyModeFk"
|
||||||
|
option-label="agencyMode"
|
||||||
|
hide-selected
|
||||||
|
:disable="!data.clientId || !data.landed || !data.warehouseId"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormModelPopup>
|
||||||
|
</template>
|
|
@ -153,7 +153,7 @@ onMounted(async () => {
|
||||||
:label="t('params.state')"
|
:label="t('params.state')"
|
||||||
v-model="params.state"
|
v-model="params.state"
|
||||||
:options="stateOptions"
|
:options="stateOptions"
|
||||||
option-value="code"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
dense
|
dense
|
||||||
|
@ -169,7 +169,7 @@ onMounted(async () => {
|
||||||
:label="t('params.futureState')"
|
:label="t('params.futureState')"
|
||||||
v-model="params.futureState"
|
v-model="params.futureState"
|
||||||
:options="stateOptions"
|
:options="stateOptions"
|
||||||
option-value="code"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
dense
|
dense
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { computed, ref, onMounted } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { toDate, toCurrency } from 'src/filters/index';
|
import { toDate, toCurrency } from 'src/filters/index';
|
||||||
|
@ -14,6 +15,7 @@ import VnRow from 'src/components/ui/VnRow.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import TicketFilter from './TicketFilter.vue';
|
import TicketFilter from './TicketFilter.vue';
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
@ -23,12 +25,23 @@ const agenciesOptions = ref([]);
|
||||||
const selectedClient = ref();
|
const selectedClient = ref();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const from = Date.vnNew();
|
const from = Date.vnNew();
|
||||||
|
from.setHours(0, 0, 0, 0);
|
||||||
const to = Date.vnNew();
|
const to = Date.vnNew();
|
||||||
|
to.setHours(23, 59, 0, 0);
|
||||||
to.setDate(to.getDate() + 1);
|
to.setDate(to.getDate() + 1);
|
||||||
|
|
||||||
const userParams = {
|
const userParams = {
|
||||||
from: from.toISOString(),
|
from: null,
|
||||||
to: to.toISOString(),
|
to: null,
|
||||||
|
};
|
||||||
|
// Método para inicializar las variables desde la query string
|
||||||
|
const initializeFromQuery = () => {
|
||||||
|
const query = route.query.table ? JSON.parse(route.query.table) : {};
|
||||||
|
|
||||||
|
// Asigna los valores a las variables correspondientes
|
||||||
|
from.value = query.from || from.toISOString();
|
||||||
|
to.value = query.to || to.toISOString();
|
||||||
|
Object.assign(userParams, { from, to });
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
@ -200,23 +213,26 @@ const getColor = (row) => {
|
||||||
return row?.classColor ? `bg-${row.classColor}` : 'bg-orange';
|
return row?.classColor ? `bg-${row.classColor}` : 'bg-orange';
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => (stateStore.rightDrawer = true));
|
onMounted(() => {
|
||||||
|
initializeFromQuery();
|
||||||
|
stateStore.rightDrawer = true;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="Tickets"
|
data-key="Ticket"
|
||||||
:label="t('Search ticket')"
|
:label="t('Search ticket')"
|
||||||
:info="t('You can search by ticket id or alias')"
|
:info="t('You can search by ticket id or alias')"
|
||||||
/>
|
/>
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<TicketFilter data-key="Tickets" />
|
<TicketFilter data-key="Ticket" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="Tickets"
|
data-key="Ticket"
|
||||||
url="Tickets/filter"
|
url="Tickets/filter"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Tickets/new',
|
urlCreate: 'Tickets/new',
|
||||||
|
@ -225,7 +241,7 @@ onMounted(() => (stateStore.rightDrawer = true));
|
||||||
formInitialData: {},
|
formInitialData: {},
|
||||||
}"
|
}"
|
||||||
default-mode="table"
|
default-mode="table"
|
||||||
order="id DESC"
|
:order="['shippedDate DESC', 'shippedHour ASC', 'zoneLanding ASC', 'id']"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:user-params="userParams"
|
:user-params="userParams"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import FormPopup from 'src/components/FormPopup.vue';
|
||||||
|
import VnRow from 'src/components/ui/VnRow.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
entityId: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const entityId = ref($props.entityId);
|
||||||
|
const selectedTrayColor = ref();
|
||||||
|
const trayHeight = ref();
|
||||||
|
const wagonColors = ref([]);
|
||||||
|
const wagonColorTranslated = ref();
|
||||||
|
const heights = ref();
|
||||||
|
const existingTrayHeight = ref($props.height);
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
watch(wagonColors, () => {
|
||||||
|
wagonColorTranslated.value = wagonColors.value.map((color) => {
|
||||||
|
return { ...color, name: t(`colors.${color.name}`) };
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const emit = defineEmits(['onSubmit']);
|
||||||
|
|
||||||
|
async function getTrays() {
|
||||||
|
const { data } = await axios.get('WagonTypeTrays', undefined, {
|
||||||
|
filter: { wagonTypeFk: entityId.value },
|
||||||
|
});
|
||||||
|
existingTrayHeight.value = data.filter((item) => item.wagonTypeFk == entityId.value);
|
||||||
|
heights.value = existingTrayHeight.value.map((item) => item.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSubmit() {
|
||||||
|
emit('onSubmit', {
|
||||||
|
wagonTypeFk: entityId.value,
|
||||||
|
wagonTypeColorFk: selectedTrayColor.value,
|
||||||
|
height: trayHeight.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getTrays();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="WagonTypeColors"
|
||||||
|
@on-fetch="(data) => (wagonColors = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FormPopup
|
||||||
|
ref="createTrayFormDialogRef"
|
||||||
|
@on-submit="onSubmit()"
|
||||||
|
:title="t('Add new tray')"
|
||||||
|
:entity-id="selectedEntityId"
|
||||||
|
>
|
||||||
|
<template #form-inputs>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<VnSelect
|
||||||
|
v-model="selectedTrayColor"
|
||||||
|
:options="wagonColorTranslated"
|
||||||
|
option-label="name"
|
||||||
|
option-value="id"
|
||||||
|
id="id"
|
||||||
|
:label="t('Select a tray color')"
|
||||||
|
:required="true"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps" clickable>
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ scope.opt.name }}</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
<VnInput v-model="trayHeight" :label="t('Height')" type="number" />
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormPopup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
Select a tray: Select a tray
|
||||||
|
colors:
|
||||||
|
white: White
|
||||||
|
red: Red
|
||||||
|
green: Green
|
||||||
|
blue: Blue
|
||||||
|
es:
|
||||||
|
Select a tray color: Seleccione un color
|
||||||
|
Add new tray: Añadir nueva bandeja
|
||||||
|
Height: Altura
|
||||||
|
The minimum height between trays is 50cm: La altura mínima entre bandejas es de 50cm
|
||||||
|
The maximum height of the wagon is 200cm: La altura máxima del vagón es de 200cm
|
||||||
|
A tray with the same height already exists, try with a different height: Ya existe una bandeja con la misma altura, prueba con una diferente
|
||||||
|
colors:
|
||||||
|
white: Blanco
|
||||||
|
red: Rojo
|
||||||
|
green: Verde
|
||||||
|
blue: Azul
|
||||||
|
</i18n>
|
|
@ -1,433 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { computed, ref, onMounted, onUpdated } from 'vue';
|
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
onMounted(() => fetch());
|
|
||||||
onUpdated(() => fetch());
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const route = useRoute();
|
|
||||||
const quasar = useQuasar();
|
|
||||||
const router = useRouter();
|
|
||||||
const $props = defineProps({
|
|
||||||
id: {
|
|
||||||
type: Number,
|
|
||||||
required: false,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
|
||||||
|
|
||||||
const wagon = ref([]);
|
|
||||||
const divisible = ref(false);
|
|
||||||
const name = ref('');
|
|
||||||
const colorPickerActive = ref(false);
|
|
||||||
let originalData = { trays: [] };
|
|
||||||
let wagonConfig;
|
|
||||||
let wagonTypeColors;
|
|
||||||
let currentTrayColorPicked;
|
|
||||||
|
|
||||||
async function fetch() {
|
|
||||||
try {
|
|
||||||
await axios.get('WagonConfigs').then(async (res) => {
|
|
||||||
if (res.data) {
|
|
||||||
wagonConfig = res.data[0];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await axios.get(`WagonTypeColors`).then(async (res) => {
|
|
||||||
if (res.data) {
|
|
||||||
wagonTypeColors = res.data;
|
|
||||||
if (!entityId.value)
|
|
||||||
wagon.value.push({
|
|
||||||
id: 0,
|
|
||||||
position: 0,
|
|
||||||
color: { ...wagonTypeColors[0] },
|
|
||||||
action: 'add',
|
|
||||||
});
|
|
||||||
else {
|
|
||||||
await axios
|
|
||||||
.get(`WagonTypeTrays`, {
|
|
||||||
params: { filter: { where: { typeFk: entityId.value } } },
|
|
||||||
})
|
|
||||||
.then(async (res) => {
|
|
||||||
if (res.data) {
|
|
||||||
for (let i = 0; i < res.data.length; i++) {
|
|
||||||
const tray = res.data[i];
|
|
||||||
wagon.value.push({
|
|
||||||
id: res.data.length - i - 1,
|
|
||||||
position: tray.height,
|
|
||||||
color: {
|
|
||||||
...wagonTypeColors.find((color) => {
|
|
||||||
return color.id === tray.colorFk;
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
action: tray.height == 0 ? 'add' : 'delete',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
wagon.value.forEach((value) => {
|
|
||||||
originalData.trays.push({ ...value });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (entityId.value) {
|
|
||||||
await axios.get(`WagonTypes/${entityId.value}`).then((res) => {
|
|
||||||
if (res.data) {
|
|
||||||
originalData.name = name.value = res.data.name;
|
|
||||||
originalData.divisible = divisible.value = res.data.divisible;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function addTray() {
|
|
||||||
if (
|
|
||||||
wagon.value.find((tray) => {
|
|
||||||
return tray.position == null;
|
|
||||||
})
|
|
||||||
) {
|
|
||||||
quasar.notify({
|
|
||||||
message: t('wagon.warnings.uncompleteTrays'),
|
|
||||||
type: 'warning',
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wagon.value.length < wagonConfig.maxTrays) {
|
|
||||||
wagon.value.unshift({
|
|
||||||
id: wagon.value.length,
|
|
||||||
position: null,
|
|
||||||
color: { ...wagonTypeColors[0] },
|
|
||||||
action: 'delete',
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
quasar.notify({
|
|
||||||
message: t('wagon.warnings.maxTrays'),
|
|
||||||
type: 'warning',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteTray(trayToDelete) {
|
|
||||||
wagon.value = wagon.value.filter((tray) => tray.id !== trayToDelete.id);
|
|
||||||
reorderIds();
|
|
||||||
}
|
|
||||||
|
|
||||||
function reorderIds() {
|
|
||||||
for (let index = wagon.value.length - 1; index >= 0; index--) {
|
|
||||||
wagon.value[index].id = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function onSubmit() {
|
|
||||||
try {
|
|
||||||
const path = entityId.value
|
|
||||||
? 'WagonTypes/editWagonType'
|
|
||||||
: 'WagonTypes/createWagonType';
|
|
||||||
|
|
||||||
const params = {
|
|
||||||
id: entityId.value,
|
|
||||||
name: name.value,
|
|
||||||
divisible: divisible.value,
|
|
||||||
trays: wagon.value,
|
|
||||||
};
|
|
||||||
|
|
||||||
await axios.patch(path, params).then((res) => {
|
|
||||||
if (res.status == 204) router.push({ path: `/wagon/type/list` });
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onReset() {
|
|
||||||
name.value = entityId.value ? originalData.name : null;
|
|
||||||
divisible.value = entityId.value ? originalData.divisible : false;
|
|
||||||
wagon.value = entityId.value
|
|
||||||
? [...originalData.trays]
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
position: 0,
|
|
||||||
color: { ...wagonTypeColors[0] },
|
|
||||||
action: 'add',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
function doAction(tray) {
|
|
||||||
if (tray.action == 'add') {
|
|
||||||
addTray();
|
|
||||||
} else {
|
|
||||||
deleteTray(tray);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showColorPicker(tray) {
|
|
||||||
colorPickerActive.value = true;
|
|
||||||
currentTrayColorPicked = wagon.value.findIndex((val) => {
|
|
||||||
return val.id === tray.id;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateColor(newColor) {
|
|
||||||
wagon.value[currentTrayColorPicked].color = {
|
|
||||||
...wagonTypeColors.find((color) => {
|
|
||||||
return color.rgb === newColor;
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function onPositionBlur(tray) {
|
|
||||||
if (tray.position) {
|
|
||||||
if (tray.position == '' || tray.position < 0) {
|
|
||||||
tray.position = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tray.position = parseInt(tray.position);
|
|
||||||
wagon.value.sort((a, b) => b.position - a.position);
|
|
||||||
reorderIds();
|
|
||||||
for (let index = wagon.value.length - 1; index > 0; index--) {
|
|
||||||
if (exceedMaxHeight(index - 1)) continue;
|
|
||||||
if (
|
|
||||||
wagon.value[index - 1].position - wagon.value[index].position >=
|
|
||||||
wagonConfig.minHeightBetweenTrays
|
|
||||||
) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
wagon.value[index - 1].position +=
|
|
||||||
wagonConfig.minHeightBetweenTrays -
|
|
||||||
(wagon.value[index - 1].position - wagon.value[index].position);
|
|
||||||
|
|
||||||
quasar.notify({
|
|
||||||
message:
|
|
||||||
t('wagon.warnings.minHeightBetweenTrays') +
|
|
||||||
wagonConfig.minHeightBetweenTrays +
|
|
||||||
' cm',
|
|
||||||
type: 'warning',
|
|
||||||
});
|
|
||||||
|
|
||||||
exceedMaxHeight(index - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function exceedMaxHeight(pos) {
|
|
||||||
if (wagon.value[pos].position > wagonConfig.maxWagonHeight) {
|
|
||||||
wagon.value.splice(pos, 1);
|
|
||||||
quasar.notify({
|
|
||||||
message:
|
|
||||||
t('wagon.warnings.maxWagonHeight') + wagonConfig.maxWagonHeight + ' cm',
|
|
||||||
type: 'warning',
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<QPage class="q-pa-sm q-mx-xl">
|
|
||||||
<QForm @submit="onSubmit()" @reset="onReset()" class="q-pa-sm">
|
|
||||||
<QCard class="q-pa-md">
|
|
||||||
<VnInput
|
|
||||||
filled
|
|
||||||
v-model="name"
|
|
||||||
:label="t('wagon.type.name')"
|
|
||||||
:rules="[(val) => !!val || t('wagon.warnings.nameNotEmpty')]"
|
|
||||||
/>
|
|
||||||
<QCheckbox class="q-mb-sm" v-model="divisible" label="Divisible" />
|
|
||||||
<div class="wagon-tray q-mx-lg" v-for="tray in wagon" :key="tray.id">
|
|
||||||
<div class="position">
|
|
||||||
<QInput
|
|
||||||
autofocus
|
|
||||||
filled
|
|
||||||
type="number"
|
|
||||||
:class="{ isVisible: tray.action == 'add' }"
|
|
||||||
v-model="tray.position"
|
|
||||||
@blur="onPositionBlur(tray)"
|
|
||||||
>
|
|
||||||
<QTooltip :delay="2000">
|
|
||||||
{{
|
|
||||||
t('wagon.warnings.minHeightBetweenTrays') +
|
|
||||||
wagonConfig.minHeightBetweenTrays +
|
|
||||||
' cm'
|
|
||||||
}}
|
|
||||||
<QSpace />
|
|
||||||
{{
|
|
||||||
t('wagon.warnings.maxWagonHeight') +
|
|
||||||
wagonConfig.maxWagonHeight +
|
|
||||||
' cm'
|
|
||||||
}}
|
|
||||||
</QTooltip>
|
|
||||||
</QInput>
|
|
||||||
</div>
|
|
||||||
<div class="shelving">
|
|
||||||
<div class="shelving-half">
|
|
||||||
<div class="shelving-up"></div>
|
|
||||||
<div
|
|
||||||
class="shelving-down"
|
|
||||||
:style="{ backgroundColor: tray.color.rgb }"
|
|
||||||
@click="showColorPicker(tray)"
|
|
||||||
></div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="shelving-divisible"
|
|
||||||
:class="{ isVisible: !divisible }"
|
|
||||||
></div>
|
|
||||||
<div class="shelving-half">
|
|
||||||
<div class="shelving-up"></div>
|
|
||||||
<div
|
|
||||||
class="shelving-down"
|
|
||||||
:style="{ backgroundColor: tray.color.rgb }"
|
|
||||||
@click="showColorPicker(tray)"
|
|
||||||
></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="action-button">
|
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="primary"
|
|
||||||
:icon="tray.action"
|
|
||||||
@click="doAction(tray)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="q-mb-sm wheels">
|
|
||||||
<QIcon color="grey-6" name="trip_origin" size="xl" />
|
|
||||||
<QIcon color="grey-6" name="trip_origin" size="xl" />
|
|
||||||
</div>
|
|
||||||
<QDialog
|
|
||||||
v-model="colorPickerActive"
|
|
||||||
position="right"
|
|
||||||
:no-backdrop-dismiss="false"
|
|
||||||
>
|
|
||||||
<QCard>
|
|
||||||
<QCardSection>
|
|
||||||
<div class="text-h6">{{ t('wagon.type.trayColor') }}</div>
|
|
||||||
</QCardSection>
|
|
||||||
<QCardSection class="row items-center no-wrap">
|
|
||||||
<QColor
|
|
||||||
flat
|
|
||||||
v-model="wagon[currentTrayColorPicked].color.rgb"
|
|
||||||
no-header
|
|
||||||
no-footer
|
|
||||||
default-view="palette"
|
|
||||||
:palette="
|
|
||||||
wagonTypeColors.map((color) => {
|
|
||||||
return color.rgb;
|
|
||||||
})
|
|
||||||
"
|
|
||||||
@change="updateColor($event)"
|
|
||||||
/>
|
|
||||||
<QBtn flat round icon="close" v-close-popup />
|
|
||||||
</QCardSection>
|
|
||||||
</QCard>
|
|
||||||
</QDialog>
|
|
||||||
</QCard>
|
|
||||||
<div class="q-mt-md">
|
|
||||||
<QBtn :label="t('wagon.type.submit')" type="submit" color="primary" />
|
|
||||||
<QBtn
|
|
||||||
:label="t('wagon.type.reset')"
|
|
||||||
type="reset"
|
|
||||||
color="primary"
|
|
||||||
flat
|
|
||||||
class="q-ml-sm"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</QForm>
|
|
||||||
</QPage>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.q-page {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.q-form {
|
|
||||||
width: 70%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.q-dialog {
|
|
||||||
.q-card {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.wheels {
|
|
||||||
margin-left: 5%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-around;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wagon-tray {
|
|
||||||
display: flex;
|
|
||||||
height: 6rem;
|
|
||||||
|
|
||||||
.position {
|
|
||||||
width: 20%;
|
|
||||||
border-right: 1rem solid gray;
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-end;
|
|
||||||
justify-content: flex-end;
|
|
||||||
padding-right: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shelving {
|
|
||||||
display: flex;
|
|
||||||
width: 75%;
|
|
||||||
|
|
||||||
.shelving-half {
|
|
||||||
width: 50%;
|
|
||||||
height: 100%;
|
|
||||||
|
|
||||||
.shelving-up {
|
|
||||||
height: 80%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.shelving-down {
|
|
||||||
height: 20%;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.shelving-divisible {
|
|
||||||
width: 1%;
|
|
||||||
height: 100%;
|
|
||||||
border-left: 0.5rem dashed grey;
|
|
||||||
border-right: 0.5rem dashed grey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-button {
|
|
||||||
width: 10%;
|
|
||||||
border-left: 1rem solid gray;
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-end;
|
|
||||||
justify-content: flex-start;
|
|
||||||
padding-left: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.isVisible {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -0,0 +1,293 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed, ref, watch } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
import FormModel from 'src/components/FormModel.vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import axios from 'axios';
|
||||||
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
|
import WagonCreateTray from './WagonCreateTray.vue';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { notify } = useQuasar();
|
||||||
|
const route = useRoute();
|
||||||
|
const entityId = computed(() => route.params.id);
|
||||||
|
const wagonTrays = ref([]);
|
||||||
|
const createTrayFormDialogRef = ref();
|
||||||
|
const selectedEntityId = ref();
|
||||||
|
|
||||||
|
async function loadTrays() {
|
||||||
|
try {
|
||||||
|
const res = await axios.get('WagonTypeTrays');
|
||||||
|
const filteredTrays = res.data.filter(
|
||||||
|
(tray) => tray.wagonTypeFk === entityId.value
|
||||||
|
);
|
||||||
|
wagonTrays.value = filteredTrays;
|
||||||
|
return;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error loading trays:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addTray(newTray) {
|
||||||
|
const res = await axios.post(`WagonTypeTrays`, newTray);
|
||||||
|
wagonTrays.value.push(res.data);
|
||||||
|
notify({
|
||||||
|
message: t(`Tray added successfully`),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteTray(trayToDelete) {
|
||||||
|
await axios.delete(`WagonTypeTrays/${trayToDelete.id}`);
|
||||||
|
const index = wagonTrays.value.findIndex((tray) => tray.id === trayToDelete.id);
|
||||||
|
if (index !== -1) {
|
||||||
|
wagonTrays.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
notify({
|
||||||
|
message: t('Tray deleted successfully'),
|
||||||
|
type: 'positive',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const filter = {
|
||||||
|
where: { wagonTypeFk: entityId.value },
|
||||||
|
include: {
|
||||||
|
relation: 'color',
|
||||||
|
scope: {
|
||||||
|
fields: ['rgb'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const formFilter = { where: { wagonTypeFk: entityId.value } };
|
||||||
|
|
||||||
|
const showCreateTrayForm = (id) => {
|
||||||
|
selectedEntityId.value = id;
|
||||||
|
createTrayFormDialogRef.value.show();
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => wagonTrays.value,
|
||||||
|
async (newVal, oldVal) => {
|
||||||
|
if (newVal.length !== oldVal.length) {
|
||||||
|
await loadTrays();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VnSubToolbar />
|
||||||
|
<QPage class="q-pa-sm q-mx-xl">
|
||||||
|
<FormModel
|
||||||
|
:url="`WagonTypes/ ${entityId}`"
|
||||||
|
:url-update="`WagonTypes/ ${entityId}`"
|
||||||
|
:filter="formFilter"
|
||||||
|
model="WagonType"
|
||||||
|
auto-load
|
||||||
|
>
|
||||||
|
<template #form="{ data }">
|
||||||
|
<QCard class="q-pa-md">
|
||||||
|
<VnInput
|
||||||
|
filled
|
||||||
|
v-model="data.name"
|
||||||
|
:label="t('wagon.type.name')"
|
||||||
|
:rules="[(val) => !!val || t('wagon.warnings.nameNotEmpty')]"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
class="q-mb-sm"
|
||||||
|
v-model="data.divisible"
|
||||||
|
label="Divisible"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VnPaginate
|
||||||
|
data-key="wagonTypeTray"
|
||||||
|
url="WagonTypeTrays"
|
||||||
|
order="id DESC"
|
||||||
|
:filter="filter"
|
||||||
|
auto-load
|
||||||
|
ref="vnPaginateRef"
|
||||||
|
v-bind="$attrs"
|
||||||
|
:key="wagonTrays.length"
|
||||||
|
>
|
||||||
|
<template #body="{ rows }">
|
||||||
|
<div v-for="row in rows" :key="row.id">
|
||||||
|
<div class="shelving"></div>
|
||||||
|
<div class="action-button">
|
||||||
|
<div class="wagon-tray q-mx-lg">
|
||||||
|
<div class="position">
|
||||||
|
<VnInput
|
||||||
|
borderless
|
||||||
|
type="number"
|
||||||
|
disable
|
||||||
|
class="input-tray q-mb-sm"
|
||||||
|
:label="t('Height') + ': '"
|
||||||
|
v-model="row.height"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="shelving">
|
||||||
|
<div class="shelving-half">
|
||||||
|
<div class="shelving-up"></div>
|
||||||
|
<div
|
||||||
|
class="shelving-down"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: row.color.rgb,
|
||||||
|
}"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="shelving-divisible"
|
||||||
|
:class="{ isVisible: !data.divisible }"
|
||||||
|
></div>
|
||||||
|
<div class="shelving-half">
|
||||||
|
<div class="shelving-up"></div>
|
||||||
|
<div
|
||||||
|
class="shelving-down"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: row.color.rgb,
|
||||||
|
}"
|
||||||
|
></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="action-button">
|
||||||
|
<QBtn
|
||||||
|
v-if="row.height === 0"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="primary"
|
||||||
|
:icon="'add'"
|
||||||
|
class="btn-tray"
|
||||||
|
@click="showCreateTrayForm(entityId)"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
v-else
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="primary"
|
||||||
|
:icon="'delete'"
|
||||||
|
class="btn-tray"
|
||||||
|
@click="deleteTray(row)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</VnPaginate>
|
||||||
|
<div class="q-mb-sm wheels">
|
||||||
|
<QIcon color="grey-6" name="trip_origin" size="xl" />
|
||||||
|
<QIcon color="grey-6" name="trip_origin" size="xl" />
|
||||||
|
</div>
|
||||||
|
</QCard>
|
||||||
|
<QDialog ref="createTrayFormDialogRef">
|
||||||
|
<WagonCreateTray :entity-id="entityId" @on-submit="addTray($event)" />
|
||||||
|
</QDialog>
|
||||||
|
</template>
|
||||||
|
</FormModel>
|
||||||
|
</QPage>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.q-page {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-form {
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-dialog {
|
||||||
|
.q-card {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.wheels {
|
||||||
|
margin-left: 5%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wagon-tray {
|
||||||
|
display: flex;
|
||||||
|
height: 6rem;
|
||||||
|
|
||||||
|
.position {
|
||||||
|
width: 26%;
|
||||||
|
border-right: 1rem solid gray;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding-right: 2rem;
|
||||||
|
padding-left: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shelving {
|
||||||
|
display: flex;
|
||||||
|
width: 54%;
|
||||||
|
|
||||||
|
.shelving-half {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
.shelving-up {
|
||||||
|
height: 80%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shelving-down {
|
||||||
|
height: 20%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.shelving-divisible {
|
||||||
|
width: 1%;
|
||||||
|
height: 100%;
|
||||||
|
border-left: 0.5rem dashed grey;
|
||||||
|
border-right: 0.5rem dashed grey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button {
|
||||||
|
width: 20%;
|
||||||
|
border-left: 1rem solid gray;
|
||||||
|
align-items: baseline;
|
||||||
|
padding-left: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.isVisible {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn-tray {
|
||||||
|
margin-right: 100%;
|
||||||
|
margin-top: 100%;
|
||||||
|
}
|
||||||
|
.input-tray {
|
||||||
|
margin-top: 100%;
|
||||||
|
margin-left: 40%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
tray: Tray
|
||||||
|
wagonColor: Wagon color
|
||||||
|
Select a tray: Select a tray
|
||||||
|
es:
|
||||||
|
tray: Bandeja
|
||||||
|
wagonColor: Color de la bandeja
|
||||||
|
Select a tray: Seleccione una bandeja
|
||||||
|
Create new Wagon type: Crear nuevo tipo de vagón
|
||||||
|
Add new tray: Añadir nueva bandeja
|
||||||
|
Height: Altura
|
||||||
|
Tray added successfully: Bandeja añadida correctamente
|
||||||
|
Tray deleted successfully: Bandeja eliminada correctamente
|
||||||
|
</i18n>
|
|
@ -1,4 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
|
@ -6,36 +7,40 @@ import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import CardList from 'components/ui/CardList.vue';
|
import CardList from 'components/ui/CardList.vue';
|
||||||
|
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import VnRow from 'src/components/ui/VnRow.vue';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const arrayData = useArrayData('WagonTypeList');
|
const arrayData = useArrayData('WagonTypeList');
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const router = useRouter();
|
const dialog = ref();
|
||||||
|
const { push } = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const paginate = ref();
|
||||||
|
|
||||||
function navigate(id) {
|
const initialData = computed(() => {
|
||||||
router.push({ path: `/wagon/type/${id}/edit` });
|
return {
|
||||||
|
name: null,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
function reloadData() {
|
||||||
|
initialData.value.name = null;
|
||||||
|
paginate.value.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
function create() {
|
function navigate(id, name) {
|
||||||
router.push({ path: `/wagon/type/create` });
|
push({ path: `/wagon/type/${id}/edit`, query: { name } });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function remove(row) {
|
async function remove(row) {
|
||||||
try {
|
await axios.delete(`WagonTypes/${row.id}`);
|
||||||
const id = row.id;
|
quasar.notify({
|
||||||
await axios
|
message: t('wagon.type.removeItem'),
|
||||||
.delete(`WagonTypes/deleteWagonType`, { params: { id } })
|
type: 'positive',
|
||||||
.then(async () => {
|
});
|
||||||
quasar.notify({
|
store.data.splice(store.data.indexOf(row), 1);
|
||||||
message: t('wagon.type.removeItem'),
|
|
||||||
type: 'positive',
|
|
||||||
});
|
|
||||||
store.data.splice(store.data.indexOf(row), 1);
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -43,8 +48,9 @@ async function remove(row) {
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<div class="vn-card-list">
|
<div class="vn-card-list">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
|
ref="paginate"
|
||||||
data-key="WagonTypeList"
|
data-key="WagonTypeList"
|
||||||
url="/WagonTypes"
|
url="WagonTypes"
|
||||||
order="id DESC"
|
order="id DESC"
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
|
@ -54,12 +60,19 @@ async function remove(row) {
|
||||||
:key="row.id"
|
:key="row.id"
|
||||||
:title="(row.name || '').toString()"
|
:title="(row.name || '').toString()"
|
||||||
:id="row.id"
|
:id="row.id"
|
||||||
@click="navigate(row.id)"
|
@click="navigate(row.id, row.name)"
|
||||||
>
|
>
|
||||||
|
<template #list-items>
|
||||||
|
<QCheckbox
|
||||||
|
:label="t('Divisble')"
|
||||||
|
:model-value="row.divisible"
|
||||||
|
disable
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('components.smartCard.openCard')"
|
:label="t('components.smartCard.openCard')"
|
||||||
@click.stop="navigate(row.id)"
|
@click.stop="navigate(row.id, row.name)"
|
||||||
outline
|
outline
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -73,8 +86,42 @@ async function remove(row) {
|
||||||
</template>
|
</template>
|
||||||
</VnPaginate>
|
</VnPaginate>
|
||||||
</div>
|
</div>
|
||||||
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
<QPageSticky :offset="[18, 18]">
|
||||||
<QBtn @click="create" fab icon="add" color="primary" shortcut="+" />
|
<QBtn @click.stop="dialog.show()" color="primary" fab icon="add" shortcut="+">
|
||||||
|
<QDialog ref="dialog">
|
||||||
|
<FormModelPopup
|
||||||
|
:title="t('Create new Wagon type')"
|
||||||
|
url-create="WagonTypes"
|
||||||
|
model="WagonType"
|
||||||
|
:form-initial-data="initialData"
|
||||||
|
@on-data-saved="reloadData()"
|
||||||
|
auto-load
|
||||||
|
>
|
||||||
|
<template #form-inputs="{ data }">
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<VnInput
|
||||||
|
filled
|
||||||
|
v-model="data.name"
|
||||||
|
:label="t('Name')"
|
||||||
|
:rules="[(val) => !!val || t('nameNotEmpty')]"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormModelPopup>
|
||||||
|
</QDialog>
|
||||||
|
</QBtn>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('globals.new') }}
|
||||||
|
</QTooltip>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</QPage>
|
</QPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
nameNotEmpty: The name cannot be empty
|
||||||
|
es:
|
||||||
|
Create new Wagon type: Crear nuevo tipo de vagón
|
||||||
|
Name: Nombre
|
||||||
|
nameNotEmpty: El nombre no puede estar vacío
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -151,7 +151,7 @@ const refetch = async () => await cardDescriptorRef.value.getData();
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" />
|
<VnLv :label="t('worker.card.user')" :value="entity.user?.name" />
|
||||||
<VnLv :label="t('worker.card.email')" :value="entity.user?.email" copy />
|
<VnLv :label="t('worker.card.email')" :value="entity.user?.email" copy />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('worker.list.department')"
|
:label="t('worker.list.department')"
|
||||||
|
|
|
@ -10,6 +10,6 @@ const route = useRoute();
|
||||||
delete-model="WorkerDms"
|
delete-model="WorkerDms"
|
||||||
download-model="WorkerDms"
|
download-model="WorkerDms"
|
||||||
default-dms-code="hhrrData"
|
default-dms-code="hhrrData"
|
||||||
filter="worker"
|
filter="wd.workerFk"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -11,7 +11,7 @@ export default {
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'WagonMain' },
|
redirect: { name: 'WagonMain' },
|
||||||
menus: {
|
menus: {
|
||||||
main: ['WagonList', 'WagonTypeList', 'WagonCounter'],
|
main: ['WagonList', 'WagonTypeList', 'WagonCounter', 'WagonTray'],
|
||||||
card: [],
|
card: [],
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
@ -81,7 +81,7 @@ export default {
|
||||||
title: 'typeCreate',
|
title: 'typeCreate',
|
||||||
icon: 'create',
|
icon: 'create',
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Wagon/Type/WagonTypeCreate.vue'),
|
component: () => import('src/pages/Wagon/Type/WagonTypeList.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':id/edit',
|
path: ':id/edit',
|
||||||
|
@ -90,7 +90,7 @@ export default {
|
||||||
title: 'typeEdit',
|
title: 'typeEdit',
|
||||||
icon: 'edit',
|
icon: 'edit',
|
||||||
},
|
},
|
||||||
component: () => import('src/pages/Wagon/Type/WagonTypeCreate.vue'),
|
component: () => import('src/pages/Wagon/Type/WagonTypeEdit.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,6 +8,8 @@ describe('ClaimDevelopment', () => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/claim/${claimId}/development`);
|
cy.visit(`/#/claim/${claimId}/development`);
|
||||||
|
cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
|
||||||
|
cy.intercept('GET', /\/api\/Workers\/search/).as('workers');
|
||||||
cy.waitForElement('tbody');
|
cy.waitForElement('tbody');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,10 +34,19 @@ describe('ClaimDevelopment', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add and remove new line', () => {
|
it('should add and remove new line', () => {
|
||||||
|
cy.wait(['@workers', '@workers']);
|
||||||
cy.addCard();
|
cy.addCard();
|
||||||
|
|
||||||
cy.get(thirdRow).should('exist');
|
cy.get(thirdRow).should('exist');
|
||||||
|
|
||||||
const rowData = [false, 'Novato', 'Roces', 'Compradores', 'employeeNick', 'Tour'];
|
const rowData = [
|
||||||
|
false,
|
||||||
|
'Novato',
|
||||||
|
'Roces',
|
||||||
|
'Compradores',
|
||||||
|
'administrativeNick',
|
||||||
|
'Tour',
|
||||||
|
];
|
||||||
cy.fillRow(thirdRow, rowData);
|
cy.fillRow(thirdRow, rowData);
|
||||||
|
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('Ticket descriptor', () => {
|
describe('Ticket descriptor', () => {
|
||||||
const toCloneOpt = '[role="menu"] .q-list > :nth-child(5)';
|
const toCloneOpt = '[role="menu"] .q-list > :nth-child(5)';
|
||||||
|
const setWeightOpt = '[role="menu"] .q-list > :nth-child(6)';
|
||||||
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
|
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
|
||||||
const summaryHeader = '.summaryHeader > div';
|
const summaryHeader = '.summaryHeader > div';
|
||||||
|
const weight = 25;
|
||||||
|
const weightValue = ':nth-child(10) > .value > span';
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const ticketId = 1;
|
|
||||||
|
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/ticket/${ticketId}/summary`);
|
cy.viewport(1920, 1080);
|
||||||
cy.waitForElement('.q-page', 7000);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should clone the ticket without warehouse', () => {
|
it('should clone the ticket without warehouse', () => {
|
||||||
cy.openLeftMenu();
|
cy.visit('/#/ticket/1/summary');
|
||||||
cy.openActionsDescriptor();
|
cy.openActionsDescriptor();
|
||||||
cy.get(toCloneOpt).click();
|
cy.get(toCloneOpt).click();
|
||||||
cy.clickConfirm();
|
cy.clickConfirm();
|
||||||
|
@ -25,4 +24,15 @@ describe('Ticket descriptor', () => {
|
||||||
cy.wrap(owner.trim()).should('eq', 'Bruce Wayne (1101)');
|
cy.wrap(owner.trim()).should('eq', 'Bruce Wayne (1101)');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set the weight of the ticket', () => {
|
||||||
|
cy.visit('/#/ticket/10/summary');
|
||||||
|
cy.openActionsDescriptor();
|
||||||
|
cy.get(setWeightOpt).click();
|
||||||
|
cy.intercept('POST', /\/api\/Tickets\/\d+\/setWeight/).as('weight');
|
||||||
|
cy.get('.q-dialog input').type(weight);
|
||||||
|
cy.clickConfirm();
|
||||||
|
cy.wait('@weight');
|
||||||
|
cy.get(weightValue).contains(weight);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,50 +6,12 @@ describe('WagonTypeCreate', () => {
|
||||||
cy.waitForElement('.q-page', 6000);
|
cy.waitForElement('.q-page', 6000);
|
||||||
});
|
});
|
||||||
|
|
||||||
function chooseColor(color) {
|
it('should create a new wagon type', () => {
|
||||||
cy.get('div.shelving-down').eq(1).click();
|
cy.get('.q-page-sticky > div > .q-btn').click();
|
||||||
cy.get('div.q-color-picker__cube').eq(color).click();
|
|
||||||
cy.get('div.q-card__section').find('button').click();
|
|
||||||
}
|
|
||||||
|
|
||||||
function addTray(position) {
|
|
||||||
cy.get('div.action-button').last().find('button').click();
|
|
||||||
cy.focused().type(position);
|
|
||||||
cy.focused().blur();
|
|
||||||
}
|
|
||||||
|
|
||||||
it('should create and delete a new wagon type', () => {
|
|
||||||
cy.get('input').first().type('Example for testing');
|
cy.get('input').first().type('Example for testing');
|
||||||
cy.get('div.q-checkbox__bg').click();
|
|
||||||
chooseColor(1);
|
|
||||||
|
|
||||||
// Insert invalid position (not minimal height)
|
|
||||||
addTray(20);
|
|
||||||
cy.get('div[role="alert"]').should('exist');
|
|
||||||
chooseColor(2);
|
|
||||||
addTray(150);
|
|
||||||
chooseColor(3);
|
|
||||||
addTray(100);
|
|
||||||
|
|
||||||
// Insert invalid position (max height reached)
|
|
||||||
addTray(210);
|
|
||||||
cy.get('div[role="alert"]').should('exist');
|
|
||||||
|
|
||||||
// Save
|
|
||||||
cy.get('button[type="submit"]').click();
|
cy.get('button[type="submit"]').click();
|
||||||
|
});
|
||||||
// Check data has been saved successfully
|
it('delete a wagon type', () => {
|
||||||
cy.get(':nth-child(1) > :nth-child(1) > .justify-between > .flex > .title')
|
|
||||||
.contains('Example for testing')
|
|
||||||
.click();
|
|
||||||
cy.get('input').first().should('have.value', 'Example for testing');
|
|
||||||
cy.get('div.wagon-tray').should('have.length', 4);
|
|
||||||
cy.get('div.position').eq(0).find('input').should('have.value', '150');
|
|
||||||
cy.get('div.position').eq(1).find('input').should('have.value', '100');
|
|
||||||
cy.get('div.position').eq(2).find('input').should('have.value', '50');
|
|
||||||
|
|
||||||
// Delete wagon type created
|
|
||||||
cy.go('back');
|
|
||||||
cy.get(
|
cy.get(
|
||||||
':nth-child(2) > :nth-child(1) > .card-list-body > .actions > .q-btn--standard'
|
':nth-child(2) > :nth-child(1) > .card-list-body > .actions > .q-btn--standard'
|
||||||
).click();
|
).click();
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
describe('WagonTypeEdit', () => {
|
||||||
|
const trayColorRow =
|
||||||
|
'.q-select > .q-field__inner > .q-field__control > .q-field__control-container';
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/#/wagon/type/2/edit');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should edit the name and the divisible field of the wagon type', () => {
|
||||||
|
cy.get('.q-card');
|
||||||
|
cy.get('input').first().type(' changed');
|
||||||
|
cy.get('div.q-checkbox__bg').first().click();
|
||||||
|
cy.get('.q-btn--standard').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create a tray', () => {
|
||||||
|
cy.get('.action-button > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
|
cy.get('input').last().type('150');
|
||||||
|
cy.get(trayColorRow).type('{downArrow}{downArrow}{enter}');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete a tray', () => {
|
||||||
|
cy.get('.action-button > .q-btn > .q-btn__content > .q-icon').first().click();
|
||||||
|
cy.reload();
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,271 +0,0 @@
|
||||||
import { axios, createWrapper } from 'app/test/vitest/helper';
|
|
||||||
import WagonTypeCreate from 'pages/Wagon/Type/WagonTypeCreate.vue';
|
|
||||||
import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest';
|
|
||||||
|
|
||||||
describe('WagonTypeCreate', () => {
|
|
||||||
let vmCreate, vmEdit;
|
|
||||||
const entityId = 1;
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
vmEdit = createWrapper(WagonTypeCreate, {propsData: {
|
|
||||||
id: entityId,
|
|
||||||
}}).vm;
|
|
||||||
vmCreate = createWrapper(WagonTypeCreate).vm;
|
|
||||||
vmEdit.wagonConfig = vmCreate.wagonConfig = {maxTrays: 2 ,minHeightBetweenTrays: 50, maxWagonHeight: 200 };
|
|
||||||
vmEdit.wagonTypeColors = vmCreate.wagonTypeColors = [{id: 1, color:'white', rgb:'#000000'}];
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
vi.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('addTray()', () => {
|
|
||||||
it('should throw message if there are uncomplete trays', async () => {
|
|
||||||
vi.spyOn(vmEdit.quasar, 'notify');
|
|
||||||
vmEdit.wagon = [{
|
|
||||||
id: 1,
|
|
||||||
position: null,
|
|
||||||
color: vmEdit.wagonTypeColors[0]
|
|
||||||
}];
|
|
||||||
|
|
||||||
await vmEdit.addTray();
|
|
||||||
|
|
||||||
expect(vmEdit.quasar.notify).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create a new tray if the limit has not been reached', async () => {
|
|
||||||
vmEdit.wagon = [{
|
|
||||||
id: 1,
|
|
||||||
position: 0,
|
|
||||||
color: vmEdit.wagonTypeColors[0]
|
|
||||||
}];
|
|
||||||
|
|
||||||
await vmEdit.addTray();
|
|
||||||
expect(vmEdit.wagon.length).toEqual(2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw message if there are uncomplete trays', async () => {
|
|
||||||
vi.spyOn(vmEdit.quasar, 'notify');
|
|
||||||
vmEdit.wagon = [{
|
|
||||||
id: 1,
|
|
||||||
position: 0,
|
|
||||||
color: vmEdit.wagonTypeColors[0]
|
|
||||||
},{
|
|
||||||
id: 2,
|
|
||||||
position: 50,
|
|
||||||
color: vmEdit.wagonTypeColors[0]
|
|
||||||
}];
|
|
||||||
|
|
||||||
await vmEdit.addTray();
|
|
||||||
|
|
||||||
expect(vmEdit.quasar.notify).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('deleteTray() reorderIds()', () => {
|
|
||||||
it('should delete a tray and reorder the ids', async () => {
|
|
||||||
const trayToDelete = {
|
|
||||||
id: 1,
|
|
||||||
position: 0,
|
|
||||||
color: vmEdit.wagonTypeColors[0]
|
|
||||||
};
|
|
||||||
const trayMaintained = {
|
|
||||||
id: 2,
|
|
||||||
position: 50,
|
|
||||||
color: vmEdit.wagonTypeColors[0]
|
|
||||||
};
|
|
||||||
vmEdit.wagon = [trayToDelete,trayMaintained];
|
|
||||||
|
|
||||||
await vmEdit.deleteTray(trayToDelete);
|
|
||||||
|
|
||||||
expect(vmEdit.wagon.length).toEqual(1);
|
|
||||||
expect(vmEdit.wagon[0].id).toEqual(0);
|
|
||||||
expect(vmEdit.wagon[0].position).toEqual(50);
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('onSubmit()', () => {
|
|
||||||
it('should make a patch to editWagonType if have id', async () => {
|
|
||||||
vi.spyOn(axios, 'patch').mockResolvedValue({ data: true });
|
|
||||||
const wagon = {
|
|
||||||
id: entityId,
|
|
||||||
name: "Mock name",
|
|
||||||
divisible: true,
|
|
||||||
trays: [{
|
|
||||||
id: 1,
|
|
||||||
position: 0,
|
|
||||||
color: vmEdit.wagonTypeColors[0]
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
vmEdit.name = wagon.name;
|
|
||||||
vmEdit.divisible = wagon.divisible;
|
|
||||||
vmEdit.wagon = wagon.trays;
|
|
||||||
|
|
||||||
await vmEdit.onSubmit();
|
|
||||||
|
|
||||||
expect(axios.patch).toHaveBeenCalledWith(
|
|
||||||
`WagonTypes/editWagonType`, wagon
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should make a patch to createtWagonType if not have id', async () => {
|
|
||||||
vi.spyOn(axios, 'patch').mockResolvedValue({ data: true });
|
|
||||||
const wagon = {
|
|
||||||
name: "Mock name",
|
|
||||||
divisible: true,
|
|
||||||
trays: [{
|
|
||||||
id: 1,
|
|
||||||
position: 0,
|
|
||||||
color: vmCreate.wagonTypeColors[0]
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
vmCreate.name = wagon.name;
|
|
||||||
vmCreate.divisible = wagon.divisible;
|
|
||||||
vmCreate.wagon = wagon.trays;
|
|
||||||
|
|
||||||
await vmCreate.onSubmit();
|
|
||||||
|
|
||||||
expect(axios.patch).toHaveBeenCalledWith(
|
|
||||||
`WagonTypes/createWagonType`, wagon
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('onReset()', () => {
|
|
||||||
it('should reset if have id', async () => {
|
|
||||||
vmEdit.name = 'Changed name';
|
|
||||||
vmEdit.divisible = false;
|
|
||||||
vmEdit.wagon = [];
|
|
||||||
vmEdit.originalData = {
|
|
||||||
name: 'Original name',
|
|
||||||
divisible: true,
|
|
||||||
trays: [{
|
|
||||||
id: 1,
|
|
||||||
position: 0,
|
|
||||||
color: vmEdit.wagonTypeColors[0]
|
|
||||||
},{
|
|
||||||
id: 2,
|
|
||||||
position: 50,
|
|
||||||
color: vmEdit.wagonTypeColors[0]
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
|
|
||||||
vmEdit.onReset();
|
|
||||||
|
|
||||||
expect(vmEdit.name).toEqual(vmEdit.originalData.name);
|
|
||||||
expect(vmEdit.divisible).toEqual(vmEdit.originalData.divisible);
|
|
||||||
expect(vmEdit.wagon).toEqual(vmEdit.originalData.trays);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should reset if not have id', async () => {
|
|
||||||
vmCreate.name = 'Changed name';
|
|
||||||
vmCreate.divisible = false;
|
|
||||||
vmCreate.wagon = [];
|
|
||||||
|
|
||||||
vmCreate.onReset();
|
|
||||||
|
|
||||||
expect(vmCreate.name).toEqual(null);
|
|
||||||
expect(vmCreate.divisible).toEqual(false);
|
|
||||||
expect(vmCreate.wagon.length).toEqual(1);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('onPositionBlur()', () => {
|
|
||||||
it('should set position null if position is negative', async () => {
|
|
||||||
const negativeTray = {
|
|
||||||
id: 1,
|
|
||||||
position: -1,
|
|
||||||
color: vmCreate.wagonTypeColors[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
vmCreate.onPositionBlur(negativeTray);
|
|
||||||
|
|
||||||
expect(negativeTray.position).toEqual(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should set position and reorder array', async () => {
|
|
||||||
const trays = [{
|
|
||||||
id: 0,
|
|
||||||
position: 100,
|
|
||||||
color: vmCreate.wagonTypeColors[0]
|
|
||||||
},{
|
|
||||||
id: 1,
|
|
||||||
position: 0,
|
|
||||||
color: vmCreate.wagonTypeColors[0]
|
|
||||||
}];
|
|
||||||
const newTray = {
|
|
||||||
id: 2,
|
|
||||||
position: 50,
|
|
||||||
color: vmCreate.wagonTypeColors[0]
|
|
||||||
};
|
|
||||||
trays.push(newTray);
|
|
||||||
vmCreate.wagon = trays;
|
|
||||||
|
|
||||||
vmCreate.onPositionBlur(newTray);
|
|
||||||
|
|
||||||
expect(vmCreate.wagon[0].position).toEqual(100);
|
|
||||||
expect(vmCreate.wagon[1].position).toEqual(50);
|
|
||||||
expect(vmCreate.wagon[2].position).toEqual(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw message if not have min height between trays and should set new adequate positions', async () => {
|
|
||||||
vi.spyOn(vmCreate.quasar, 'notify');
|
|
||||||
const trays = [{
|
|
||||||
id: 0,
|
|
||||||
position: 0,
|
|
||||||
color: vmCreate.wagonTypeColors[0]
|
|
||||||
}];
|
|
||||||
const newTray = {
|
|
||||||
id: 1,
|
|
||||||
position: 20,
|
|
||||||
color: vmCreate.wagonTypeColors[0]
|
|
||||||
};
|
|
||||||
trays.push(newTray);
|
|
||||||
vmCreate.wagon = trays;
|
|
||||||
|
|
||||||
vmCreate.onPositionBlur(newTray);
|
|
||||||
|
|
||||||
expect(vmCreate.wagon[0].position).toEqual(50);
|
|
||||||
expect(vmCreate.wagon[1].position).toEqual(0);
|
|
||||||
expect(vmCreate.quasar.notify).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw message if max height has been exceed', async () => {
|
|
||||||
vi.spyOn(vmCreate.quasar, 'notify');
|
|
||||||
const trays = [{
|
|
||||||
id: 0,
|
|
||||||
position: 0,
|
|
||||||
color: vmCreate.wagonTypeColors[0]
|
|
||||||
}];
|
|
||||||
const newTray = {
|
|
||||||
id: 1,
|
|
||||||
position: 210,
|
|
||||||
color: vmCreate.wagonTypeColors[0]
|
|
||||||
};
|
|
||||||
trays.push(newTray);
|
|
||||||
vmCreate.wagon = trays;
|
|
||||||
|
|
||||||
vmCreate.onPositionBlur(newTray);
|
|
||||||
|
|
||||||
expect(vmCreate.wagon.length).toEqual(1);
|
|
||||||
expect(vmCreate.quasar.notify).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({
|
|
||||||
type: 'warning',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue