Compare commits
No commits in common. "dev" and "8277-createEntryControl" have entirely different histories.
dev
...
8277-creat
|
@ -125,7 +125,7 @@ pipeline {
|
|||
sh "docker-compose ${env.COMPOSE_PARAMS} pull db"
|
||||
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
|
||||
|
||||
def modules = sh(script: "node test/cypress/docker/find/find.js ${env.COMPOSE_TAG}", returnStdout: true).trim()
|
||||
def modules = sh(script: 'node test/cypress/docker/find/find.js', returnStdout: true).trim()
|
||||
echo "E2E MODULES: ${modules}"
|
||||
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
|
||||
sh "sh test/cypress/docker/cypressParallel.sh 1 '${modules}'"
|
||||
|
|
|
@ -347,8 +347,8 @@ watch(formUrl, async () => {
|
|||
<QBtnDropdown
|
||||
v-if="$props.goTo && $props.defaultSave"
|
||||
@click="onSubmitAndGo"
|
||||
:label="tMobile('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:title="t('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:label="tMobile('globals.saveAndContinue')"
|
||||
:title="t('globals.saveAndContinue')"
|
||||
:disable="!hasChanges"
|
||||
color="primary"
|
||||
icon="save"
|
||||
|
@ -397,4 +397,4 @@ watch(formUrl, async () => {
|
|||
:label="t && t('globals.pleaseWait')"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { date } from 'quasar';
|
||||
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
|
||||
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
|
||||
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
|
||||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||
import useWeekdaysOrder from 'src/composables/getWeekdays';
|
||||
|
||||
const formatDate = (dateToFormat, format = 'YYYY-MM-DD') => (
|
||||
date.formatDate(dateToFormat, format)
|
||||
);
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
year: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
month: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
monthDate: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
daysMap: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['onDateSelected']);
|
||||
|
||||
const { locale } = useI18n();
|
||||
const weekdayStore = useWeekdayStore();
|
||||
const weekDays = useWeekdaysOrder();
|
||||
const calendarRef = ref(null);
|
||||
const today = ref(formatDate(Date.vnNew()));
|
||||
const todayTimestamp = computed(() => {
|
||||
const date = Date.vnNew();
|
||||
date.setHours(0, 0, 0, 0);
|
||||
return date.getTime();
|
||||
});
|
||||
const _monthDate = computed(() => formatDate(props.monthDate));
|
||||
|
||||
const calendarHeaderTitle = computed(() => {
|
||||
return `${weekdayStore.getLocaleMonths[props.month - 1].locale} ${props.year}`;
|
||||
});
|
||||
|
||||
const isToday = (timestamp) => {
|
||||
const { year, month, day } = timestamp;
|
||||
return todayTimestamp.value === new Date(year, month - 1, day).getTime();
|
||||
};
|
||||
|
||||
const getEventByTimestamp = ({ year, month, day }) => {
|
||||
const stamp = new Date(year, month - 1, day).getTime();
|
||||
return props.daysMap?.[stamp] || null;
|
||||
};
|
||||
|
||||
const handleDateClick = (timestamp) => {
|
||||
const event = getEventByTimestamp(timestamp);
|
||||
const { year, month, day } = timestamp;
|
||||
const date = new Date(year, month - 1, day);
|
||||
emit('onDateSelected', {
|
||||
date,
|
||||
isNewMode: !event,
|
||||
event: event?.[0] || null
|
||||
});
|
||||
};
|
||||
|
||||
const getEventAttrs = (timestamp) => {
|
||||
return {
|
||||
class: '--event',
|
||||
label: timestamp.day,
|
||||
};
|
||||
};
|
||||
|
||||
defineExpose({ getEventByTimestamp, handleDateClick });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QCalendarMonthWrapper
|
||||
style="height: 290px; width: 290px"
|
||||
transparent-background
|
||||
view-customization="workerCalendar"
|
||||
>
|
||||
<template #header>
|
||||
<span class="full-width text-center text-body1 q-py-sm">{{
|
||||
calendarHeaderTitle
|
||||
}}</span>
|
||||
</template>
|
||||
<template #calendar>
|
||||
<QCalendarMonth
|
||||
ref="calendarRef"
|
||||
:model-value="_monthDate"
|
||||
show-work-weeks
|
||||
no-outside-days
|
||||
no-active-date
|
||||
:weekdays="weekDays"
|
||||
short-weekday-label
|
||||
:locale="locale"
|
||||
:now="today"
|
||||
@click-date="handleDateClick($event.scope.timestamp)"
|
||||
mini-mode
|
||||
>
|
||||
<template #day="{ scope: { timestamp } }">
|
||||
<slot name="day" :timestamp="timestamp" :getEventAttrs="getEventAttrs">
|
||||
<QBtn
|
||||
v-if="getEventByTimestamp(timestamp)"
|
||||
v-bind="{ ...getEventAttrs(timestamp) }"
|
||||
@click="handleDateClick(timestamp)"
|
||||
rounded
|
||||
dense
|
||||
flat
|
||||
class="calendar-event"
|
||||
:class="{ '--today': isToday(timestamp) }"
|
||||
/>
|
||||
</slot>
|
||||
</template>
|
||||
</QCalendarMonth>
|
||||
</template>
|
||||
</QCalendarMonthWrapper>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.calendar-event {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
font-size: 13px;
|
||||
line-height: 1.715em;
|
||||
cursor: pointer;
|
||||
color: white;
|
||||
|
||||
&.--today {
|
||||
border: 2px solid $info;
|
||||
}
|
||||
|
||||
&.--event {
|
||||
background-color: $positive;
|
||||
color: black;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,126 +0,0 @@
|
|||
<script setup>
|
||||
import { computed, onMounted, ref, onUnmounted, nextTick } from 'vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
calendarComponent: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
additionalProps: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
}
|
||||
});
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const weekdayStore = useWeekdayStore();
|
||||
const nMonths = ref(4);
|
||||
const _date = ref(Date.vnNew());
|
||||
const firstDay = ref(Date.vnNew());
|
||||
const lastDay = ref(Date.vnNew());
|
||||
const months = ref([]);
|
||||
const arrayData = useArrayData(props.dataKey);
|
||||
onMounted(async () => {
|
||||
const initialDate = Date.vnNew();
|
||||
initialDate.setDate(1);
|
||||
initialDate.setHours(0, 0, 0, 0);
|
||||
date.value = initialDate;
|
||||
await nextTick();
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
|
||||
onUnmounted(() => arrayData.destroy());
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:firstDay',
|
||||
'update:lastDay',
|
||||
'update:events',
|
||||
'onDateSelected',
|
||||
]);
|
||||
|
||||
const date = computed({
|
||||
get: () => _date.value,
|
||||
set: (value) => {
|
||||
if (!(value instanceof Date)) return;
|
||||
_date.value = value;
|
||||
const stamp = value.getTime();
|
||||
|
||||
firstDay.value = new Date(stamp);
|
||||
firstDay.value.setDate(1);
|
||||
|
||||
lastDay.value = new Date(stamp);
|
||||
lastDay.value.setMonth(lastDay.value.getMonth() + nMonths.value);
|
||||
lastDay.value.setDate(0);
|
||||
|
||||
months.value = [];
|
||||
for (let i = 0; i < nMonths.value; i++) {
|
||||
const monthDate = new Date(stamp);
|
||||
monthDate.setMonth(value.getMonth() + i);
|
||||
months.value.push(monthDate);
|
||||
}
|
||||
|
||||
emit('update:firstDay', firstDay.value);
|
||||
emit('update:lastDay', lastDay.value);
|
||||
emit('refresh-events');
|
||||
},
|
||||
});
|
||||
|
||||
const headerTitle = computed(() => {
|
||||
if (!months.value?.length) return '';
|
||||
const getMonthName = date =>
|
||||
`${weekdayStore.getLocaleMonths[date.getMonth()].locale} ${date.getFullYear()}`;
|
||||
return `${getMonthName(months.value[0])} - ${getMonthName(months.value[months.value.length - 1])}`;
|
||||
});
|
||||
|
||||
const step = (direction) => {
|
||||
const newDate = new Date(date.value);
|
||||
newDate.setMonth(newDate.getMonth() + nMonths.value * direction);
|
||||
date.value = newDate;
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
firstDay,
|
||||
lastDay
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QCard style="height: max-content">
|
||||
<div class="calendars-header">
|
||||
<QBtn
|
||||
icon="arrow_left"
|
||||
size="sm"
|
||||
flat
|
||||
class="full-height"
|
||||
@click="step(-1)"
|
||||
/>
|
||||
<span>{{ headerTitle }}</span>
|
||||
<QBtn
|
||||
icon="arrow_right"
|
||||
size="sm"
|
||||
flat
|
||||
class="full-height"
|
||||
@click="step(1)"
|
||||
/>
|
||||
</div>
|
||||
<div class="calendars-container">
|
||||
<component
|
||||
:is="calendarComponent"
|
||||
v-for="(month, index) in months"
|
||||
:key="index"
|
||||
:month="month.getMonth() + 1"
|
||||
:year="month.getFullYear()"
|
||||
:month-date="month"
|
||||
v-bind="additionalProps"
|
||||
@on-date-selected="data => emit('onDateSelected', data)"
|
||||
/>
|
||||
</div>
|
||||
</QCard>
|
||||
</template>
|
|
@ -156,9 +156,6 @@ const selectTravel = ({ id }) => {
|
|||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.warehouseOutFk"
|
||||
:where="{
|
||||
isOrigin: true,
|
||||
}"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('globals.warehouseIn')"
|
||||
|
@ -167,9 +164,6 @@ const selectTravel = ({ id }) => {
|
|||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.warehouseInFk"
|
||||
:where="{
|
||||
isDestiny: true,
|
||||
}"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('globals.shipped')"
|
||||
|
|
|
@ -100,7 +100,7 @@ const $props = defineProps({
|
|||
},
|
||||
preventSubmit: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(['onFetch', 'onDataSaved', 'submit']);
|
||||
|
@ -287,7 +287,7 @@ function updateAndEmit(evt, { val, res, old } = { val: null, res: null, old: nul
|
|||
state.set(modelValue, val);
|
||||
if (!$props.url) arrayData.store.data = val;
|
||||
|
||||
emit(evt, state.get(modelValue), res, old, formData);
|
||||
emit(evt, state.get(modelValue), res, old);
|
||||
}
|
||||
|
||||
function trimData(data) {
|
||||
|
@ -380,8 +380,8 @@ defineExpose({
|
|||
data-cy="saveAndContinueDefaultBtn"
|
||||
v-if="$props.goTo"
|
||||
@click="saveAndGo"
|
||||
:label="tMobile('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:title="t('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:label="tMobile('globals.saveAndContinue')"
|
||||
:title="t('globals.saveAndContinue')"
|
||||
:disable="!hasChanges"
|
||||
color="primary"
|
||||
icon="save"
|
||||
|
|
|
@ -40,9 +40,6 @@ const onDataSaved = (data) => {
|
|||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
auto-load
|
||||
:where="{
|
||||
isInventory: true,
|
||||
}"
|
||||
/>
|
||||
<FormModelPopup
|
||||
url-create="Items/regularize"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { markRaw, computed, onBeforeMount } from 'vue';
|
||||
import { QToggle } from 'quasar';
|
||||
import { markRaw, computed } from 'vue';
|
||||
import { QCheckbox, QToggle } from 'quasar';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
|
@ -150,16 +150,6 @@ const showFilter = computed(
|
|||
const onTabPressed = async () => {
|
||||
if (model.value) enterEvent['keyup.enter']();
|
||||
};
|
||||
|
||||
onBeforeMount(() => {
|
||||
const columnFilter = $props.column?.columnFilter;
|
||||
const component = columnFilter?.component;
|
||||
const defaultComponent = components[component];
|
||||
const events = { update: updateEvent, enter: enterEvent };
|
||||
|
||||
if (!columnFilter || defaultComponent) return;
|
||||
$props.column.columnFilter.event = events[columnFilter.event];
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div v-if="showFilter" class="full-width" style="overflow: hidden">
|
||||
|
|
|
@ -33,9 +33,7 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
|||
import VnTableFilter from './VnTableFilter.vue';
|
||||
import { getColAlign } from 'src/composables/getColAlign';
|
||||
import RightMenu from '../common/RightMenu.vue';
|
||||
import VnScroll from '../common/VnScroll.vue';
|
||||
import VnCheckboxMenu from '../common/VnCheckboxMenu.vue';
|
||||
import VnCheckbox from '../common/VnCheckbox.vue';
|
||||
import VnScroll from '../common/VnScroll.vue'
|
||||
|
||||
const arrayData = useArrayData(useAttrs()['data-key']);
|
||||
const $props = defineProps({
|
||||
|
@ -115,10 +113,6 @@ const $props = defineProps({
|
|||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
multiCheck: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
crudModel: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
|
@ -163,7 +157,6 @@ const CARD_MODE = 'card';
|
|||
const TABLE_MODE = 'table';
|
||||
const mode = ref(CARD_MODE);
|
||||
const selected = ref([]);
|
||||
const selectAll = ref(false);
|
||||
const hasParams = ref(false);
|
||||
const CrudModelRef = ref({});
|
||||
const showForm = ref(false);
|
||||
|
@ -202,10 +195,10 @@ const onVirtualScroll = ({ to }) => {
|
|||
handleScroll();
|
||||
const virtualScrollContainer = tableRef.value?.$el?.querySelector('.q-table__middle');
|
||||
if (virtualScrollContainer) {
|
||||
virtualScrollContainer.dispatchEvent(new CustomEvent('scroll'));
|
||||
if (vnScrollRef.value) {
|
||||
vnScrollRef.value.updateScrollContainer(virtualScrollContainer);
|
||||
}
|
||||
virtualScrollContainer.dispatchEvent(new CustomEvent('scroll'));
|
||||
if (vnScrollRef.value) {
|
||||
vnScrollRef.value.updateScrollContainer(virtualScrollContainer);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -333,7 +326,6 @@ function stopEventPropagation(event) {
|
|||
|
||||
function reload(params) {
|
||||
selected.value = [];
|
||||
selectAll.value = false;
|
||||
CrudModelRef.value.reload(params);
|
||||
}
|
||||
|
||||
|
@ -349,11 +341,11 @@ function handleOnDataSaved(_) {
|
|||
else $props.create.onDataSaved(_);
|
||||
}
|
||||
function handleScroll() {
|
||||
if ($props.crudModel.disableInfiniteScroll) return;
|
||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
|
||||
if ($props.crudModel.disableInfiniteScroll) return;
|
||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
|
||||
}
|
||||
function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||
if (evt?.shiftKey && added) {
|
||||
|
@ -646,17 +638,6 @@ const rowCtrlClickFunction = computed(() => {
|
|||
};
|
||||
return () => {};
|
||||
});
|
||||
const handleHeaderSelection = (evt, data) => {
|
||||
if (evt === 'updateSelected' && selectAll.value) {
|
||||
selected.value = tableRef.value.rows;
|
||||
} else if (evt === 'selectAll') {
|
||||
selected.value = data;
|
||||
} else {
|
||||
selected.value = [];
|
||||
}
|
||||
|
||||
emit('update:selected', selected.value);
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<RightMenu v-if="$props.rightSearch" :overlay="overlay">
|
||||
|
@ -682,13 +663,7 @@ const handleHeaderSelection = (evt, data) => {
|
|||
:class="$attrs['class'] ?? 'q-px-md'"
|
||||
:limit="$attrs['limit'] ?? 100"
|
||||
ref="CrudModelRef"
|
||||
@on-fetch="
|
||||
(...args) => {
|
||||
selectAll = false;
|
||||
selected = [];
|
||||
emit('onFetch', ...args);
|
||||
}
|
||||
"
|
||||
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||
:search-url="searchUrl"
|
||||
:disable-infinite-scroll="isTableMode"
|
||||
:before-save-fn="removeTextValue"
|
||||
|
@ -704,9 +679,9 @@ const handleHeaderSelection = (evt, data) => {
|
|||
ref="tableRef"
|
||||
v-bind="table"
|
||||
:class="[
|
||||
'vnTable',
|
||||
table ? 'selection-cell' : '',
|
||||
$props.footer ? 'last-row-sticky' : '',
|
||||
'vnTable',
|
||||
table ? 'selection-cell' : '',
|
||||
$props.footer ? 'last-row-sticky' : '',
|
||||
]"
|
||||
wrap-cells
|
||||
:columns="splittedColumns.columns"
|
||||
|
@ -725,26 +700,6 @@ const handleHeaderSelection = (evt, data) => {
|
|||
:hide-selected-banner="true"
|
||||
:data-cy
|
||||
>
|
||||
<template #header-selection>
|
||||
<div class="flex items-center no-wrap" style="display: flex">
|
||||
<VnCheckbox
|
||||
v-model="selectAll"
|
||||
@click="handleHeaderSelection('updateSelected', $event)"
|
||||
/>
|
||||
|
||||
<VnCheckboxMenu
|
||||
v-if="selectAll && $props.multiCheck.expand"
|
||||
:searchUrl="searchUrl"
|
||||
v-model="selectAll"
|
||||
:url="$attrs['url']"
|
||||
@update:selected="
|
||||
handleHeaderSelection('updateSelected', $event)
|
||||
"
|
||||
@select:all="handleHeaderSelection('selectAll', $event)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #top-left v-if="!$props.withoutHeader">
|
||||
<slot name="top-left"> </slot>
|
||||
</template>
|
||||
|
@ -1143,10 +1098,10 @@ const handleHeaderSelection = (evt, data) => {
|
|||
</template>
|
||||
</FormModelPopup>
|
||||
</QDialog>
|
||||
<VnScroll
|
||||
ref="vnScrollRef"
|
||||
v-if="isTableMode"
|
||||
:scroll-target="tableRef?.$el?.querySelector('.q-table__middle')"
|
||||
<VnScroll
|
||||
ref="vnScrollRef"
|
||||
v-if="isTableMode"
|
||||
:scroll-target="tableRef?.$el?.querySelector('.q-table__middle')"
|
||||
/>
|
||||
</template>
|
||||
<i18n>
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FetchData from '../FetchData.vue';
|
||||
import VnSelectDialog from './VnSelectDialog.vue';
|
||||
|
||||
import CreateBankEntityForm from '../CreateBankEntityForm.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
iban: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
bankEntityFk: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
disableElement: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
const filter = {
|
||||
fields: ['id', 'bic', 'name'],
|
||||
order: 'bic ASC',
|
||||
};
|
||||
const { t } = useI18n();
|
||||
const emit = defineEmits(['updateBic']);
|
||||
const iban = ref($props.iban);
|
||||
const bankEntityFk = ref($props.bankEntityFk);
|
||||
const bankEntities = ref([]);
|
||||
|
||||
const autofillBic = async (bic) => {
|
||||
if (!bic) return;
|
||||
const bankEntityId = parseInt(bic.substr(4, 4));
|
||||
const ibanCountry = bic.substr(0, 2);
|
||||
if (ibanCountry != 'ES') return;
|
||||
|
||||
const existBank = bankEntities.value.find((b) => b.id === bankEntityId);
|
||||
bankEntityFk.value = existBank ? bankEntityId : null;
|
||||
emit('updateBic', { iban: iban.value, bankEntityFk: bankEntityFk.value });
|
||||
};
|
||||
|
||||
const getBankEntities = (data) => {
|
||||
bankEntityFk.value = data.id;
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="BankEntities"
|
||||
:filter="filter"
|
||||
auto-load
|
||||
@on-fetch="(data) => (bankEntities = data)"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('IBAN')"
|
||||
clearable
|
||||
v-model="iban"
|
||||
@update:model-value="autofillBic($event)"
|
||||
:disable="disableElement"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-info">
|
||||
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
<VnSelectDialog
|
||||
:label="t('Swift / BIC')"
|
||||
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
|
||||
:options="bankEntities"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="bankEntityFk"
|
||||
@update:model-value="$emit('updateBic', { iban, bankEntityFk })"
|
||||
:disable="disableElement"
|
||||
>
|
||||
<template #form>
|
||||
<CreateBankEntityForm @on-data-saved="getBankEntities($event)" />
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection v-if="scope.opt">
|
||||
<QItemLabel>{{ scope.opt.bic }} </QItemLabel>
|
||||
<QItemLabel caption> {{ scope.opt.name }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</template>
|
|
@ -33,7 +33,7 @@ onBeforeRouteLeave(() => {
|
|||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
if (props.visual) stateStore.cardDescriptorChangeValue(markRaw(props.descriptor));
|
||||
stateStore.cardDescriptorChangeValue(markRaw(props.descriptor));
|
||||
|
||||
const route = router.currentRoute.value;
|
||||
try {
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import VnCheckbox from './VnCheckbox.vue';
|
||||
import axios from 'axios';
|
||||
import { toRaw } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const model = defineModel({ type: [Boolean] });
|
||||
const props = defineProps({
|
||||
url: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
searchUrl: {
|
||||
type: [String, Boolean],
|
||||
default: 'table',
|
||||
},
|
||||
});
|
||||
const menuRef = ref(null);
|
||||
const errorMessage = ref(null);
|
||||
const rows = ref(0);
|
||||
const onClick = async () => {
|
||||
errorMessage.value = null;
|
||||
|
||||
const { filter } = JSON.parse(route.query[props.searchUrl]);
|
||||
filter.limit = 0;
|
||||
const params = {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
};
|
||||
try {
|
||||
const { data } = axios.get(props.url, params);
|
||||
rows.value = data;
|
||||
} catch (error) {
|
||||
const response = error.response;
|
||||
if (response.data.error.name === 'UserError') {
|
||||
errorMessage.value = t('tooManyResults');
|
||||
} else {
|
||||
errorMessage.value = response.data.error.message;
|
||||
}
|
||||
}
|
||||
};
|
||||
defineEmits(['update:selected', 'select:all']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QIcon
|
||||
style="margin-left: -10px"
|
||||
data-cy="btnMultiCheck"
|
||||
name="expand_more"
|
||||
@click="onClick"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QMenu
|
||||
fit
|
||||
anchor="bottom start"
|
||||
self="top left"
|
||||
ref="menuRef"
|
||||
data-cy="menuMultiCheck"
|
||||
>
|
||||
<QList separator>
|
||||
<QItem
|
||||
data-cy="selectAll"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="
|
||||
$refs.menuRef.hide();
|
||||
$emit('select:all', toRaw(rows));
|
||||
"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
<span v-text="t('Select all')" />
|
||||
</QItemLabel>
|
||||
<QItemLabel overline caption>
|
||||
<span
|
||||
v-if="errorMessage"
|
||||
class="text-negative"
|
||||
v-text="errorMessage"
|
||||
/>
|
||||
<span
|
||||
v-else
|
||||
v-text="t('records', { rows: rows.length ?? 0 })"
|
||||
/>
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<slot name="more-options"></slot>
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QIcon>
|
||||
</template>
|
||||
<i18n lang="yml">
|
||||
en:
|
||||
tooManyResults: Too many results. Please narrow down your search.
|
||||
records: '{rows} records'
|
||||
es:
|
||||
Select all: Seleccionar todo
|
||||
tooManyResults: Demasiados registros. Restringe la búsqueda.
|
||||
records: '{rows} registros'
|
||||
</i18n>
|
|
@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
|
||||
import VnUserLink from '../ui/VnUserLink.vue';
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
|
@ -24,7 +23,6 @@ const rows = ref([]);
|
|||
const dmsRef = ref();
|
||||
const formDialog = ref({});
|
||||
const token = useSession().getTokenMultimedia();
|
||||
const { openReport } = usePrintService();
|
||||
|
||||
const $props = defineProps({
|
||||
model: {
|
||||
|
@ -201,7 +199,12 @@ const columns = computed(() => [
|
|||
color: 'primary',
|
||||
}),
|
||||
click: (prop) =>
|
||||
openReport(`dms/${prop.row.id}/downloadFile`, {}, '_blank'),
|
||||
downloadFile(
|
||||
prop.row.id,
|
||||
$props.downloadModel,
|
||||
undefined,
|
||||
prop.row.download,
|
||||
),
|
||||
},
|
||||
{
|
||||
component: QBtn,
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const model = defineModel({ type: [Number, String] });
|
||||
const emit = defineEmits(['updateBic']);
|
||||
|
||||
const getIbanCountry = (bank) => {
|
||||
return bank.substr(0, 2);
|
||||
};
|
||||
|
||||
const autofillBic = async (iban) => {
|
||||
if (!iban) return;
|
||||
|
||||
const bankEntityId = parseInt(iban.substr(4, 4));
|
||||
const ibanCountry = getIbanCountry(iban);
|
||||
|
||||
if (ibanCountry != 'ES') return;
|
||||
|
||||
const filter = { where: { id: bankEntityId } };
|
||||
const params = { filter: JSON.stringify(filter) };
|
||||
|
||||
const { data } = await axios.get(`BankEntities`, { params });
|
||||
|
||||
emit('updateBic', data[0]?.id);
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<VnInput
|
||||
:label="t('IBAN')"
|
||||
clearable
|
||||
v-model="model"
|
||||
@update:model-value="autofillBic($event)"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-info">
|
||||
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
</template>
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, computed } from 'vue';
|
||||
import { ref, onMounted, onUnmounted, watch, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
|
|
|
@ -161,7 +161,7 @@ const arrayData = useArrayData(arrayDataKey, {
|
|||
searchUrl: false,
|
||||
mapKey: $attrs['map-key'],
|
||||
});
|
||||
const isMenuOpened = ref(false);
|
||||
|
||||
const computedSortBy = computed(() => {
|
||||
return $props.sortBy || $props.optionLabel + ' ASC';
|
||||
});
|
||||
|
@ -186,9 +186,7 @@ onMounted(() => {
|
|||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||
});
|
||||
|
||||
const someIsLoading = computed(
|
||||
() => (isLoading.value || !!arrayData?.isLoading?.value) && !isMenuOpened.value,
|
||||
);
|
||||
const someIsLoading = computed(() => isLoading.value || !!arrayData?.isLoading?.value);
|
||||
function findKeyInOptions() {
|
||||
if (!$props.options) return;
|
||||
return filter($props.modelValue, $props.options)?.length;
|
||||
|
@ -370,9 +368,8 @@ function getCaption(opt) {
|
|||
hide-bottom-space
|
||||
:input-debounce="useURL ? '300' : '0'"
|
||||
:loading="someIsLoading"
|
||||
:disable="someIsLoading"
|
||||
@virtual-scroll="onScroll"
|
||||
@popup-hide="isMenuOpened = false"
|
||||
@popup-show="isMenuOpened = true"
|
||||
@keydown="handleKeyDown"
|
||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||
:data-url="url"
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import VnBankDetailsForm from 'components/common/VnBankDetailsForm.vue';
|
||||
import { vi, afterEach, expect, it, beforeEach, describe } from 'vitest';
|
||||
|
||||
describe('VnBankDetail Component', () => {
|
||||
let vm;
|
||||
let wrapper;
|
||||
const bankEntities = [
|
||||
{ id: 2100, bic: 'CAIXESBBXXX', name: 'CaixaBank' },
|
||||
{ id: 1234, bic: 'TESTBIC', name: 'Test Bank' },
|
||||
];
|
||||
const correctIban = 'ES6621000418401234567891';
|
||||
|
||||
beforeAll(() => {
|
||||
wrapper = createWrapper(VnBankDetailsForm, {
|
||||
$props: {
|
||||
iban: null,
|
||||
bankEntityFk: null,
|
||||
disableElement: false,
|
||||
},
|
||||
});
|
||||
vm = wrapper.vm;
|
||||
wrapper = wrapper.wrapper;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should update bankEntityFk when IBAN exists in bankEntities', async () => {
|
||||
vm.bankEntities = bankEntities;
|
||||
|
||||
await vm.autofillBic(correctIban);
|
||||
expect(vm.bankEntityFk).toBe(2100);
|
||||
});
|
||||
|
||||
it('should set bankEntityFk to null when IBAN bank code is not found', async () => {
|
||||
vm.bankEntities = bankEntities;
|
||||
|
||||
await vm.autofillBic('ES1234567891324567891234');
|
||||
expect(vm.bankEntityFk).toBe(null);
|
||||
});
|
||||
});
|
|
@ -132,7 +132,8 @@ const card = toRef(props, 'item');
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
|
||||
white-space: nowrap;
|
||||
width: 192px;
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<script setup>
|
||||
import { watch, ref, onMounted } from 'vue';
|
||||
import { onBeforeMount, watch, computed, ref } from 'vue';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnDescriptor from './VnDescriptor.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
|
@ -18,50 +20,39 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const state = useState();
|
||||
const route = useRoute();
|
||||
let arrayData;
|
||||
let store;
|
||||
const entity = ref();
|
||||
let entity;
|
||||
const isLoading = ref(false);
|
||||
const containerRef = ref(null);
|
||||
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
|
||||
defineExpose({ getData });
|
||||
|
||||
onMounted(async () => {
|
||||
let isPopup;
|
||||
let el = containerRef.value.$el;
|
||||
while (el) {
|
||||
if (el.classList?.contains('q-menu')) {
|
||||
isPopup = true;
|
||||
break;
|
||||
}
|
||||
el = el.parentElement;
|
||||
}
|
||||
|
||||
arrayData = useArrayData($props.dataKey + (isPopup ? 'Proxy' : ''), {
|
||||
onBeforeMount(async () => {
|
||||
arrayData = useArrayData($props.dataKey, {
|
||||
url: $props.url,
|
||||
userFilter: $props.filter,
|
||||
skip: 0,
|
||||
oneRecord: true,
|
||||
});
|
||||
store = arrayData.store;
|
||||
entity = computed(() => {
|
||||
const data = store.data ?? {};
|
||||
if (data) emit('onFetch', data);
|
||||
return data;
|
||||
});
|
||||
|
||||
// It enables to load data only once if the module is the same as the dataKey
|
||||
if (!isSameDataKey.value || !route.params.id) await getData();
|
||||
watch(
|
||||
() => [$props.url, $props.filter],
|
||||
async () => {
|
||||
await getData();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
watch(
|
||||
() => arrayData.store.data,
|
||||
(newValue) => {
|
||||
entity.value = newValue;
|
||||
if (!isSameDataKey.value) await getData();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
defineExpose({ getData });
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
||||
async function getData() {
|
||||
store.url = $props.url;
|
||||
store.filter = $props.filter ?? {};
|
||||
|
@ -69,15 +60,18 @@ async function getData() {
|
|||
try {
|
||||
await arrayData.fetch({ append: false, updateRouter: false });
|
||||
const { data } = store;
|
||||
state.set($props.dataKey, data);
|
||||
emit('onFetch', data);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnDescriptor v-model="entity" v-bind="$attrs" :module="dataKey" ref="containerRef">
|
||||
<VnDescriptor v-model="entity" v-bind="$attrs" :module="dataKey">
|
||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||
</template>
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref, reactive, useAttrs, computed, onMounted, nextTick, } from 'vue';
|
||||
import { onBeforeRouteLeave , useRouter, useRoute} from 'vue-router';
|
||||
import { ref, reactive, useAttrs, computed } from 'vue';
|
||||
import { onBeforeRouteLeave } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { tMobile } from 'src/composables/tMobile';
|
||||
|
||||
import { toDateHourMin } from 'src/filters';
|
||||
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
|
@ -34,15 +33,10 @@ const $props = defineProps({
|
|||
addNote: { type: Boolean, default: false },
|
||||
selectType: { type: Boolean, default: false },
|
||||
justInput: { type: Boolean, default: false },
|
||||
goTo: { type: String, default: '', },
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const componentIsRendered = ref(false);
|
||||
const newNote = reactive({ text: null, observationTypeFk: null });
|
||||
const observationTypes = ref([]);
|
||||
const vnPaginateRef = ref();
|
||||
|
@ -51,7 +45,6 @@ const defaultObservationType = computed(() =>
|
|||
observationTypes.value.find(ot => ot.code === 'salesPerson')?.id
|
||||
);
|
||||
|
||||
let savedNote = false;
|
||||
let originalText;
|
||||
|
||||
function handleClick(e) {
|
||||
|
@ -75,7 +68,6 @@ async function insert() {
|
|||
};
|
||||
await axios.post($props.url, newBody);
|
||||
await vnPaginateRef.value.fetch();
|
||||
savedNote = true;
|
||||
}
|
||||
|
||||
function confirmAndUpdate() {
|
||||
|
@ -137,29 +129,8 @@ const handleObservationTypes = (data) => {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => (componentIsRendered.value = true));
|
||||
});
|
||||
|
||||
async function saveAndGo() {
|
||||
savedNote = false;
|
||||
await insert();
|
||||
await savedNote;
|
||||
router.push({ path: $props.goTo });
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown() && componentIsRendered && $props.goTo && !route.path.includes('summary')">
|
||||
<QBtn
|
||||
:label="tMobile('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
:title="t('globals.saveAndContinue') + ' ' + t('globals.' + $props.goTo.split('/').pop())"
|
||||
color="primary"
|
||||
icon="save"
|
||||
@click="saveAndGo"
|
||||
data-cy="saveContinueNoteButton"
|
||||
/>
|
||||
</Teleport>
|
||||
<FetchData
|
||||
v-if="selectType"
|
||||
url="ObservationTypes"
|
||||
|
@ -205,7 +176,7 @@ async function saveAndGo() {
|
|||
:required="'required' in originalAttrs"
|
||||
clearable
|
||||
>
|
||||
<template #append v-if="!$props.goTo">
|
||||
<template #append>
|
||||
<QBtn
|
||||
:title="t('Save (Enter)')"
|
||||
icon="save"
|
||||
|
|
|
@ -146,14 +146,14 @@ const addFilter = async (filter, params) => {
|
|||
};
|
||||
|
||||
async function fetch(params) {
|
||||
arrayData.setOptions(params);
|
||||
useArrayData(props.dataKey, params);
|
||||
arrayData.resetPagination();
|
||||
await arrayData.fetch({ append: false });
|
||||
return emitStoreData();
|
||||
}
|
||||
|
||||
async function update(params) {
|
||||
arrayData.setOptions(params);
|
||||
useArrayData(props.dataKey, params);
|
||||
const { limit, skip } = store;
|
||||
store.limit = limit + skip;
|
||||
store.skip = 0;
|
||||
|
@ -222,7 +222,7 @@ defineExpose({
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="full-width">
|
||||
<div class="full-width" v-bind="attrs">
|
||||
<div
|
||||
v-if="!store.data && !store.data?.length && !isLoading"
|
||||
class="info-row q-pa-md text-center"
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
import { ref } from 'vue';
|
||||
import moment from 'moment';
|
||||
|
||||
export default function useWeekdaysOrder() {
|
||||
|
||||
const firstDay = moment().weekday(1).day();
|
||||
const weekdays = [...Array(7).keys()].map(i => (i + firstDay) % 7);
|
||||
|
||||
return ref(weekdays);
|
||||
}
|
|
@ -19,7 +19,7 @@ export function useArrayData(key, userOptions) {
|
|||
let canceller = null;
|
||||
|
||||
onMounted(() => {
|
||||
setOptions(userOptions ?? {});
|
||||
setOptions();
|
||||
reset(['skip']);
|
||||
|
||||
const query = route.query;
|
||||
|
@ -39,10 +39,9 @@ export function useArrayData(key, userOptions) {
|
|||
setCurrentFilter();
|
||||
});
|
||||
|
||||
if (userOptions) setOptions(userOptions);
|
||||
if (key && userOptions) setOptions();
|
||||
|
||||
function setOptions(params) {
|
||||
if (!params) return;
|
||||
function setOptions() {
|
||||
const allowedOptions = [
|
||||
'url',
|
||||
'filter',
|
||||
|
@ -58,14 +57,14 @@ export function useArrayData(key, userOptions) {
|
|||
'mapKey',
|
||||
'oneRecord',
|
||||
];
|
||||
if (typeof params === 'object') {
|
||||
for (const option in params) {
|
||||
const isEmpty = params[option] == null || params[option] === '';
|
||||
if (typeof userOptions === 'object') {
|
||||
for (const option in userOptions) {
|
||||
const isEmpty = userOptions[option] == null || userOptions[option] === '';
|
||||
if (isEmpty || !allowedOptions.includes(option)) continue;
|
||||
|
||||
if (Object.hasOwn(store, option)) {
|
||||
const defaultOpts = params[option];
|
||||
store[option] = params.keepOpts?.includes(option)
|
||||
const defaultOpts = userOptions[option];
|
||||
store[option] = userOptions.keepOpts?.includes(option)
|
||||
? Object.assign(defaultOpts, store[option])
|
||||
: defaultOpts;
|
||||
if (option === 'userParams') store.defaultParams = store[option];
|
||||
|
@ -368,6 +367,5 @@ export function useArrayData(key, userOptions) {
|
|||
deleteOption,
|
||||
reset,
|
||||
resetPagination,
|
||||
setOptions,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -343,20 +343,3 @@ input::-webkit-inner-spin-button {
|
|||
.q-item__section--main ~ .q-item__section--side {
|
||||
padding-inline: 0;
|
||||
}
|
||||
|
||||
.calendars-header {
|
||||
height: 45px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: $primary;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.calendars-container {
|
||||
max-width: 800px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-evenly;
|
||||
}
|
|
@ -6,7 +6,6 @@ import toDateHourMinSec from './toDateHourMinSec';
|
|||
import toRelativeDate from './toRelativeDate';
|
||||
import toCurrency from './toCurrency';
|
||||
import toPercentage from './toPercentage';
|
||||
import toNumber from './toNumber';
|
||||
import toLowerCamel from './toLowerCamel';
|
||||
import dashIfEmpty from './dashIfEmpty';
|
||||
import dateRange from './dateRange';
|
||||
|
@ -35,7 +34,6 @@ export {
|
|||
toRelativeDate,
|
||||
toCurrency,
|
||||
toPercentage,
|
||||
toNumber,
|
||||
dashIfEmpty,
|
||||
dateRange,
|
||||
getParamWhere,
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
export default function (value, fractionSize = 2) {
|
||||
if (isNaN(value)) return value;
|
||||
return new Intl.NumberFormat('es-ES', {
|
||||
style: 'decimal',
|
||||
minimumFractionDigits: 0,
|
||||
maximumFractionDigits: fractionSize,
|
||||
}).format(value);
|
||||
}
|
|
@ -24,14 +24,13 @@ globals:
|
|||
dataDeleted: Data deleted
|
||||
delete: Delete
|
||||
search: Search
|
||||
lines: Lines
|
||||
changes: Changes
|
||||
dataCreated: Data created
|
||||
add: Add
|
||||
create: Create
|
||||
edit: Edit
|
||||
save: Save
|
||||
saveAndContinue: Save and go to
|
||||
saveAndContinue: Save and continue
|
||||
remove: Remove
|
||||
reset: Reset
|
||||
close: Close
|
||||
|
@ -108,8 +107,6 @@ globals:
|
|||
from: From
|
||||
to: To
|
||||
notes: Notes
|
||||
photos: Photos
|
||||
due-day: Due day
|
||||
refresh: Refresh
|
||||
item: Item
|
||||
ticket: Ticket
|
||||
|
@ -125,7 +122,6 @@ globals:
|
|||
producer: Producer
|
||||
origin: Origin
|
||||
state: State
|
||||
total: Total
|
||||
subtotal: Subtotal
|
||||
visible: Visible
|
||||
price: Price
|
||||
|
@ -351,7 +347,6 @@ globals:
|
|||
vehicleList: Vehicles
|
||||
vehicle: Vehicle
|
||||
entryPreAccount: Pre-account
|
||||
management: Worker management
|
||||
unsavedPopup:
|
||||
title: Unsaved changes will be lost
|
||||
subtitle: Are you sure exit without saving?
|
||||
|
@ -400,7 +395,6 @@ errors:
|
|||
updateUserConfig: Error updating user config
|
||||
tokenConfig: Error fetching token config
|
||||
writeRequest: The requested operation could not be completed
|
||||
claimBeginningQuantity: Cannot import a line with a claimed quantity of 0
|
||||
login:
|
||||
title: Login
|
||||
username: Username
|
||||
|
|
|
@ -25,13 +25,12 @@ globals:
|
|||
openDetail: Ver detalle
|
||||
delete: Eliminar
|
||||
search: Buscar
|
||||
lines: Lineas
|
||||
changes: Cambios
|
||||
add: Añadir
|
||||
create: Crear
|
||||
edit: Modificar
|
||||
save: Guardar
|
||||
saveAndContinue: Guardar e ir a
|
||||
saveAndContinue: Guardar y continuar
|
||||
remove: Eliminar
|
||||
reset: Restaurar
|
||||
close: Cerrar
|
||||
|
@ -112,8 +111,6 @@ globals:
|
|||
from: Desde
|
||||
to: Hasta
|
||||
notes: Notas
|
||||
photos: Fotos
|
||||
due-day: Vencimiento
|
||||
refresh: Actualizar
|
||||
item: Artículo
|
||||
ticket: Ticket
|
||||
|
@ -129,7 +126,6 @@ globals:
|
|||
producer: Productor
|
||||
origin: Origen
|
||||
state: Estado
|
||||
total: Total
|
||||
subtotal: Subtotal
|
||||
visible: Visible
|
||||
price: Precio
|
||||
|
@ -354,7 +350,6 @@ globals:
|
|||
vehicleList: Vehículos
|
||||
vehicle: Vehículo
|
||||
entryPreAccount: Precontabilizar
|
||||
management: Gestión de trabajadores
|
||||
unsavedPopup:
|
||||
title: Los cambios que no haya guardado se perderán
|
||||
subtitle: ¿Seguro que quiere salir sin guardar?
|
||||
|
@ -396,7 +391,6 @@ errors:
|
|||
updateUserConfig: Error al actualizar la configuración de usuario
|
||||
tokenConfig: Error al obtener configuración de token
|
||||
writeRequest: No se pudo completar la operación solicitada
|
||||
claimBeginningQuantity: No se puede importar una linea sin una cantidad reclamada
|
||||
login:
|
||||
title: Inicio de sesión
|
||||
username: Nombre de usuario
|
||||
|
|
|
@ -4,6 +4,11 @@ import AccountSummary from './AccountSummary.vue';
|
|||
</script>
|
||||
<template>
|
||||
<QPopupProxy style="max-width: 10px">
|
||||
<AccountDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="AccountSummary" />
|
||||
<AccountDescriptor
|
||||
v-if="$attrs.id"
|
||||
v-bind="$attrs"
|
||||
:summary="AccountSummary"
|
||||
:proxy-render="true"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -13,10 +13,8 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
|||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const quasar = useQuasar();
|
||||
const route = useRoute();
|
||||
const claim = ref(null);
|
||||
|
@ -178,17 +176,12 @@ async function save(data) {
|
|||
}
|
||||
|
||||
async function importToNewRefundTicket() {
|
||||
try{
|
||||
await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`);
|
||||
await claimActionsForm.value.reload();
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
});
|
||||
} catch (error) {
|
||||
const errorMessage = error.response?.data?.error?.message;
|
||||
notify( t(errorMessage), 'negative' );
|
||||
}
|
||||
await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`);
|
||||
await claimActionsForm.value.reload();
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
|
||||
async function post(query, params) {
|
||||
|
|
|
@ -33,7 +33,6 @@ function onBeforeSave(formData, originalData) {
|
|||
<FetchData url="ClaimStates" @on-fetch="setClaimStates" auto-load />
|
||||
<FormModel
|
||||
model="Claim"
|
||||
:go-to="`/claim/${route.params.id}/notes`"
|
||||
:url-update="`Claims/updateClaim/${route.params.id}`"
|
||||
:mapper="onBeforeSave"
|
||||
auto-load
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDateHourMinSec, toPercentage } from 'src/filters';
|
||||
|
@ -9,6 +9,7 @@ import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/Departme
|
|||
import EntityDescriptor from 'components/ui/EntityDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import filter from './ClaimFilter.js';
|
||||
|
||||
|
@ -22,6 +23,7 @@ const $props = defineProps({
|
|||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const salixUrl = ref();
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
|
@ -29,6 +31,10 @@ const entityId = computed(() => {
|
|||
function stateColor(entity) {
|
||||
return entity?.claimState?.classColor;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
salixUrl.value = await getUrl('');
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -120,7 +126,7 @@ function stateColor(entity) {
|
|||
size="md"
|
||||
icon="assignment"
|
||||
color="primary"
|
||||
:to="{ name: 'TicketSaleTracking', params: { id: entity.ticketFk } }"
|
||||
:href="salixUrl + 'ticket/' + entity.ticketFk + '/sale-tracking'"
|
||||
>
|
||||
<QTooltip>{{ t('claim.saleTracking') }}</QTooltip>
|
||||
</QBtn>
|
||||
|
@ -128,7 +134,7 @@ function stateColor(entity) {
|
|||
size="md"
|
||||
icon="visibility"
|
||||
color="primary"
|
||||
:to="{ name: 'TicketTracking', params: { id: entity.ticketFk } }"
|
||||
:href="salixUrl + 'ticket/' + entity.ticketFk + '/tracking/index'"
|
||||
>
|
||||
<QTooltip>{{ t('claim.ticketTracking') }}</QTooltip>
|
||||
</QBtn>
|
||||
|
|
|
@ -4,6 +4,11 @@ import ClaimSummary from './ClaimSummary.vue';
|
|||
</script>
|
||||
<template>
|
||||
<QPopupProxy style="max-width: 10px">
|
||||
<ClaimDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="ClaimSummary" />
|
||||
<ClaimDescriptor
|
||||
v-if="$attrs.id"
|
||||
v-bind="$attrs.id"
|
||||
:summary="ClaimSummary"
|
||||
:proxy-render="true"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -78,8 +78,6 @@ const columns = computed(() => [
|
|||
label: t('Quantity'),
|
||||
field: ({ sale }) => sale.quantity,
|
||||
sortable: true,
|
||||
style: 'padding-right: 2%;',
|
||||
headerStyle: 'padding-right: 2%;'
|
||||
},
|
||||
{
|
||||
name: 'claimed',
|
||||
|
@ -112,8 +110,6 @@ const columns = computed(() => [
|
|||
field: ({ sale }) => totalRow(sale),
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
style: 'padding-right: 2%;',
|
||||
headerStyle: 'padding-right: 2%;'
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -156,33 +152,12 @@ function showImportDialog() {
|
|||
.onOk(() => claimLinesForm.value.reload());
|
||||
}
|
||||
|
||||
function fillClaimedQuantities() {
|
||||
const formData = claimLinesForm.value.formData;
|
||||
let hasChanges = false;
|
||||
|
||||
const selectedRows = formData.filter(row => selected.value.includes(row));
|
||||
|
||||
for (const row of selectedRows) {
|
||||
if (row.quantity === 0 || row.quantity === null) {
|
||||
row.quantity = row.sale.quantity;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasChanges) {
|
||||
quasar.notify({
|
||||
message: t('Quantities filled automatically'),
|
||||
type: 'positive',
|
||||
});
|
||||
} else {
|
||||
quasar.notify({
|
||||
message: t('No quantities to fill'),
|
||||
type: 'info',
|
||||
});
|
||||
async function saveWhenHasChanges() {
|
||||
if (claimLinesForm.value.getChanges().updates) {
|
||||
await claimLinesForm.value.onSubmit();
|
||||
onFetch(claimLinesForm.value.formData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
|
||||
|
@ -210,16 +185,15 @@ function fillClaimedQuantities() {
|
|||
auto-load
|
||||
/>
|
||||
<div class="q-pa-md">
|
||||
|
||||
<CrudModel
|
||||
data-key="claimLines"
|
||||
data-key="ClaimLines"
|
||||
ref="claimLinesForm"
|
||||
:go-to="`photos`"
|
||||
:url="`Claims/${route.params.id}/lines`"
|
||||
save-url="ClaimBeginnings/crud"
|
||||
:user-filter="linesFilter"
|
||||
@on-fetch="onFetch"
|
||||
v-model:selected="selected"
|
||||
:default-save="false"
|
||||
:default-reset="false"
|
||||
auto-load
|
||||
:limit="0"
|
||||
|
@ -240,7 +214,8 @@ function fillClaimedQuantities() {
|
|||
v-model.number="row.quantity"
|
||||
type="number"
|
||||
dense
|
||||
|
||||
@keyup.enter="saveWhenHasChanges()"
|
||||
@blur="saveWhenHasChanges()"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
|
@ -297,7 +272,10 @@ function fillClaimedQuantities() {
|
|||
type="number"
|
||||
dense
|
||||
autofocus
|
||||
|
||||
@keyup.enter="
|
||||
saveWhenHasChanges()
|
||||
"
|
||||
@blur="saveWhenHasChanges()"
|
||||
/>
|
||||
</QItemLabel>
|
||||
</template>
|
||||
|
@ -335,18 +313,6 @@ function fillClaimedQuantities() {
|
|||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
color="primary"
|
||||
text-color="white"
|
||||
:unelevated="true"
|
||||
:label="t('Rellenar cantidades')"
|
||||
:title="t('Rellenar cantidades')"
|
||||
icon="auto_fix_high"
|
||||
:disabled="!selected.length"
|
||||
@click="fillClaimedQuantities"
|
||||
/>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</div>
|
||||
|
||||
|
@ -392,8 +358,6 @@ es:
|
|||
Delete claimed sales: Eliminar ventas reclamadas
|
||||
Discount updated: Descuento actualizado
|
||||
Claimed quantity: Cantidad reclamada
|
||||
Quantities filled automatically: Cantidades rellenadas automáticamente
|
||||
No quantities to fill: No hay cantidades para rellenar
|
||||
You are about to remove {count} rows: '
|
||||
Vas a eliminar <strong>{count}</strong> línea |
|
||||
Vas a eliminar <strong>{count}</strong> líneas'
|
||||
|
|
|
@ -35,11 +35,9 @@ const body = {
|
|||
workerFk: user.value.id,
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnNotes
|
||||
url="claimObservations"
|
||||
:go-to="`/claim/${route.params.id}/lines`"
|
||||
:add-note="$props.addNote"
|
||||
:user-filter="claimFilter"
|
||||
:filter="{ where: { claimFk: claimId } }"
|
||||
|
|
|
@ -54,7 +54,7 @@ const detailsColumns = ref([
|
|||
{
|
||||
name: 'item',
|
||||
label: 'claim.item',
|
||||
field: (row) => dashIfEmpty(row.sale.itemFk),
|
||||
field: (row) => row.sale.itemFk,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
|
@ -67,13 +67,13 @@ const detailsColumns = ref([
|
|||
{
|
||||
name: 'quantity',
|
||||
label: 'claim.quantity',
|
||||
field: (row) => dashIfEmpty(row.sale.quantity),
|
||||
field: (row) => row.sale.quantity,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'claimed',
|
||||
label: 'claim.claimed',
|
||||
field: (row) => dashIfEmpty(row.quantity),
|
||||
field: (row) => row.quantity,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ const detailsColumns = ref([
|
|||
{
|
||||
name: 'price',
|
||||
label: 'claim.price',
|
||||
field: (row) => dashIfEmpty(row.sale.price),
|
||||
field: (row) => row.sale.price,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
|
@ -337,16 +337,23 @@ function claimUrl(section) {
|
|||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body-cell-description="props">
|
||||
<QTd :props="props">
|
||||
<span class="link">
|
||||
{{ props.value }}
|
||||
</span>
|
||||
<ItemDescriptorProxy
|
||||
:id="props.row.sale.itemFk"
|
||||
:sale-fk="props.row.saleFk"
|
||||
/>
|
||||
</QTd>
|
||||
<template #body="props">
|
||||
<QTr :props="props">
|
||||
<QTd v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<template v-if="col.name === 'description'">
|
||||
<span class="link">{{
|
||||
dashIfEmpty(col.field(props.row))
|
||||
}}</span>
|
||||
<ItemDescriptorProxy
|
||||
:id="props.row.sale.itemFk"
|
||||
:sale-fk="props.row.saleFk"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ dashIfEmpty(col.field(props.row)) }}
|
||||
</template>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
|
|
|
@ -77,10 +77,10 @@ const isDefaultAddress = (address) => {
|
|||
return client?.value?.defaultAddressFk === address.id ? 1 : 0;
|
||||
};
|
||||
|
||||
const setDefault = async (address) => {
|
||||
const setDefault = (address) => {
|
||||
const url = `Clients/${route.params.id}`;
|
||||
const payload = { defaultAddressFk: address.id };
|
||||
await axios.patch(url, payload).then((res) => {
|
||||
axios.patch(url, payload).then((res) => {
|
||||
if (res.data) {
|
||||
client.value.defaultAddressFk = res.data.defaultAddressFk;
|
||||
sortAddresses();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
|
@ -6,15 +7,29 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnBankDetailsForm from 'src/components/common/VnBankDetailsForm.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
import VnInputBic from 'src/components/common/VnInputBic.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const bankEntitiesRef = ref(null);
|
||||
|
||||
const filter = {
|
||||
fields: ['id', 'bic', 'name'],
|
||||
order: 'bic ASC',
|
||||
};
|
||||
|
||||
const getBankEntities = (data, formData) => {
|
||||
bankEntitiesRef.value.fetch();
|
||||
formData.bankEntityFk = Number(data.id);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormModel :url-update="`Clients/${route.params.id}`" auto-load model="Customer">
|
||||
<template #form="{ data }">
|
||||
<template #form="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
auto-load
|
||||
|
@ -27,19 +42,42 @@ const route = useRoute();
|
|||
/>
|
||||
<VnInput :label="t('Due day')" clearable v-model="data.dueDay" />
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<VnBankDetailsForm
|
||||
v-model:iban="data.iban"
|
||||
v-model:bankEntityFk="data.bankEntityFk"
|
||||
@update-bic="
|
||||
({ iban, bankEntityFk }) => {
|
||||
if (!iban || !bankEntityFk) return;
|
||||
data.iban = iban;
|
||||
data.bankEntityFk = bankEntityFk;
|
||||
}
|
||||
"
|
||||
<VnInputBic
|
||||
:label="t('IBAN')"
|
||||
v-model="data.iban"
|
||||
@update-bic="(bankEntityFk) => (data.bankEntityFk = bankEntityFk)"
|
||||
/>
|
||||
<VnSelectDialog
|
||||
:label="t('Swift / BIC')"
|
||||
ref="bankEntitiesRef"
|
||||
:filter="filter"
|
||||
auto-load
|
||||
url="BankEntities"
|
||||
:acls="[{ model: 'BankEntity', props: '*', accessType: 'WRITE' }]"
|
||||
:rules="validate('Worker.bankEntity')"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="data.bankEntityFk"
|
||||
>
|
||||
<template #form>
|
||||
<CreateBankEntityForm
|
||||
@on-data-saved="getBankEntities($event, data)"
|
||||
/>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection v-if="scope.opt">
|
||||
<QItemLabel>{{ scope.opt.bic }} </QItemLabel>
|
||||
<QItemLabel caption> {{ scope.opt.name }}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<QCheckbox :label="t('Received LCR')" v-model="data.hasLcr" />
|
||||
<QCheckbox :label="t('VNL core received')" v-model="data.hasCoreVnl" />
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import ModalCloseContract from 'src/pages/Customer/components/ModalCloseContract.vue';
|
||||
import CustomerCreditContractsCreate from '../components/CustomerCreditContractsCreate.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
@ -17,7 +16,6 @@ const quasar = useQuasar();
|
|||
|
||||
const vnPaginateRef = ref(null);
|
||||
const showQPageSticky = ref(true);
|
||||
const showForm = ref();
|
||||
|
||||
const filter = {
|
||||
order: 'finished ASC, started DESC',
|
||||
|
@ -38,21 +36,25 @@ const fetch = (data) => {
|
|||
data.forEach((element) => {
|
||||
if (!element.finished) {
|
||||
showQPageSticky.value = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const toCustomerCreditContractsCreate = () => {
|
||||
router.push({ name: 'CustomerCreditContractsCreate' });
|
||||
};
|
||||
|
||||
const openDialog = (item) => {
|
||||
quasar.dialog({
|
||||
component: ModalCloseContract,
|
||||
componentProps: {
|
||||
id: item.id,
|
||||
promise: async () => {
|
||||
await updateData();
|
||||
showQPageSticky.value = true;
|
||||
},
|
||||
promise: updateData,
|
||||
},
|
||||
});
|
||||
updateData();
|
||||
showQPageSticky.value = true;
|
||||
};
|
||||
|
||||
const openViewCredit = (credit) => {
|
||||
|
@ -64,14 +66,14 @@ const openViewCredit = (credit) => {
|
|||
});
|
||||
};
|
||||
|
||||
const updateData = async () => {
|
||||
await vnPaginateRef.value?.fetch();
|
||||
const updateData = () => {
|
||||
vnPaginateRef.value?.fetch();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="row justify-center">
|
||||
<QCard class="q-pa-lg" style="width: 70%">
|
||||
<div class="full-width flex justify-center">
|
||||
<QCard class="card-width q-pa-lg">
|
||||
<VnPaginate
|
||||
:user-filter="filter"
|
||||
@on-fetch="fetch"
|
||||
|
@ -82,84 +84,100 @@ const updateData = async () => {
|
|||
url="CreditClassifications"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<div v-if="rows.length" class="q-gutter-y-md">
|
||||
<div v-if="rows.length">
|
||||
<QCard
|
||||
v-for="(item, index) in rows"
|
||||
:key="index"
|
||||
:class="{ disabled: item.finished }"
|
||||
:class="{
|
||||
'customer-card': true,
|
||||
'q-mb-md': index < rows.length - 1,
|
||||
'is-active': !item.finished,
|
||||
}"
|
||||
>
|
||||
<QCardSection
|
||||
class="full-width"
|
||||
:class="{ 'row justify-between': $q.screen.gt.md }"
|
||||
class="full-width flex justify-between q-py-none"
|
||||
>
|
||||
<div class="width-state row no-wrap">
|
||||
<QIcon
|
||||
:style="{
|
||||
visibility: item.finished
|
||||
? 'hidden'
|
||||
: 'visible',
|
||||
}"
|
||||
@click.stop="openDialog(item)"
|
||||
color="primary"
|
||||
name="lock"
|
||||
data-cy="closeBtn"
|
||||
size="md"
|
||||
class="fill-icon q-px-md"
|
||||
<div class="width-state flex">
|
||||
<div
|
||||
class="flex items-center cursor-pointer q-mr-md"
|
||||
v-if="!item.finished"
|
||||
>
|
||||
<QTooltip>{{ t('Close contract') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
@click.stop="openDialog(item)"
|
||||
color="primary"
|
||||
name="lock"
|
||||
size="md"
|
||||
class="fill-icon"
|
||||
>
|
||||
<QTooltip>{{ t('Close contract') }}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<VnLv
|
||||
:label="t('Since')"
|
||||
:value="toDate(item.started)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('To')"
|
||||
:value="toDate(item.finished)"
|
||||
/>
|
||||
<div>
|
||||
<div class="flex q-mb-xs">
|
||||
<div class="q-mr-sm color-vn-label">
|
||||
{{ t('Since') }}:
|
||||
</div>
|
||||
<div class="text-weight-bold">
|
||||
{{ toDate(item.started) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="q-mr-sm color-vn-label">
|
||||
{{ t('To') }}:
|
||||
</div>
|
||||
<div class="text-weight-bold">
|
||||
{{ toDate(item.finished) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<QSeparator vertical />
|
||||
|
||||
<div class="column width-data">
|
||||
<div class="width-data flex">
|
||||
<div
|
||||
class="column"
|
||||
class="full-width flex justify-between items-center"
|
||||
v-if="item?.insurances.length"
|
||||
v-for="insurance in item.insurances"
|
||||
:key="insurance.id"
|
||||
>
|
||||
<div
|
||||
:class="{
|
||||
'row q-gutter-x-md': $q.screen.gt.sm,
|
||||
}"
|
||||
class="q-mb-sm"
|
||||
>
|
||||
<VnLv
|
||||
:label="t('Credit')"
|
||||
:value="toCurrency(insurance.credit)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('Grade')"
|
||||
:value="dashIfEmpty(insurance.grade)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('Date')"
|
||||
:value="toDate(insurance.created)"
|
||||
/>
|
||||
<div class="flex">
|
||||
<div class="color-vn-label q-mr-xs">
|
||||
{{ t('Credit') }}:
|
||||
</div>
|
||||
<div class="text-weight-bold">
|
||||
{{ item.insurances[0].credit }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="color-vn-label q-mr-xs">
|
||||
{{ t('Grade') }}:
|
||||
</div>
|
||||
<div class="text-weight-bold">
|
||||
{{ item.insurances[0].grade || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="color-vn-label q-mr-xs">
|
||||
{{ t('Date') }}:
|
||||
</div>
|
||||
<div class="text-weight-bold">
|
||||
{{ toDate(item.insurances[0].created) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center cursor-pointer">
|
||||
<QIcon
|
||||
@click.stop="openViewCredit(item)"
|
||||
color="primary"
|
||||
name="preview"
|
||||
size="md"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('View credits')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<QBtn
|
||||
@click.stop="openViewCredit(item)"
|
||||
icon="preview"
|
||||
size="md"
|
||||
:title="t('View credits')"
|
||||
data-cy="viewBtn"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</div>
|
||||
|
@ -169,12 +187,11 @@ const updateData = async () => {
|
|||
</template>
|
||||
</VnPaginate>
|
||||
</QCard>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<QPageSticky :offset="[18, 18]" v-if="showQPageSticky">
|
||||
<QBtn
|
||||
data-cy="createBtn"
|
||||
@click.stop="showForm = !showForm"
|
||||
@click.stop="toCustomerCreditContractsCreate()"
|
||||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
|
@ -184,25 +201,24 @@ const updateData = async () => {
|
|||
{{ t('New contract') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
|
||||
<QDialog v-model="showForm">
|
||||
<CustomerCreditContractsCreate @on-data-saved="updateData()" />
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.customer-card {
|
||||
border: 2px solid var(--vn-light-gray);
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.is-active {
|
||||
background-color: var(--vn-light-gray);
|
||||
}
|
||||
.width-state {
|
||||
width: 30%;
|
||||
}
|
||||
.width-data {
|
||||
width: 50%;
|
||||
}
|
||||
::v-deep(.label) {
|
||||
margin-right: 5px;
|
||||
}
|
||||
::v-deep(.label)::after {
|
||||
content: ':';
|
||||
color: var(--vn-label-color);
|
||||
width: 65%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
<script setup>
|
||||
import { computed, onBeforeMount, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const create = ref(null);
|
||||
const tableRef = ref();
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
field: 'created',
|
||||
format: ({ created }) => toDate(created),
|
||||
label: t('Created'),
|
||||
name: 'created',
|
||||
create: true,
|
||||
columnCreate: {
|
||||
component: 'date',
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: 'grade',
|
||||
label: t('Grade'),
|
||||
name: 'grade',
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
format: ({ credit }) => toCurrency(credit),
|
||||
label: t('Credit'),
|
||||
name: 'credit',
|
||||
create: true,
|
||||
},
|
||||
]);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const query = `CreditClassifications/findOne?filter=${encodeURIComponent(
|
||||
JSON.stringify({
|
||||
fields: ['finished'],
|
||||
where: { id: route.params.creditId },
|
||||
}),
|
||||
)}`;
|
||||
const { data } = await axios(query);
|
||||
create.value = data.finished
|
||||
? false
|
||||
: {
|
||||
urlCreate: 'CreditInsurances',
|
||||
title: t('Create Insurance'),
|
||||
onDataSaved: () => tableRef.value.reload(),
|
||||
formInitialData: {
|
||||
created: Date.vnNew(),
|
||||
creditClassificationFk: route.params.creditId,
|
||||
},
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnTable
|
||||
v-if="create != null"
|
||||
url="CreditInsurances"
|
||||
ref="tableRef"
|
||||
data-key="creditInsurances"
|
||||
:filter="{
|
||||
where: {
|
||||
creditClassificationFk: `${route.params.creditId}`,
|
||||
},
|
||||
order: 'created DESC',
|
||||
}"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="false"
|
||||
:use-model="true"
|
||||
:column-search="false"
|
||||
:disable-option="{ card: true }"
|
||||
:create
|
||||
auto-load
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Created: Fecha creación
|
||||
Grade: Grade
|
||||
Credit: Crédito
|
||||
</i18n>
|
|
@ -99,13 +99,7 @@ async function acceptPropagate({ isEqualizated }) {
|
|||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('Street')"
|
||||
clearable
|
||||
v-model="data.street"
|
||||
:uppercase="true"
|
||||
required
|
||||
/>
|
||||
<VnInput :label="t('Street')" clearable v-model="data.street" required />
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
|
|
|
@ -26,7 +26,6 @@ const columns = computed(() => [
|
|||
url: 'Clients',
|
||||
fields: ['id', 'socialName'],
|
||||
optionLabel: 'socialName',
|
||||
optionValue: 'socialName',
|
||||
},
|
||||
},
|
||||
columnClass: 'expand',
|
||||
|
@ -38,11 +37,8 @@ const columns = computed(() => [
|
|||
name: 'city',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
inWhere: true,
|
||||
attrs: {
|
||||
url: 'Towns',
|
||||
optionValue: 'name',
|
||||
optionLabel: 'name',
|
||||
},
|
||||
},
|
||||
cardVisible: true,
|
||||
|
@ -93,19 +89,17 @@ const columns = computed(() => [
|
|||
<CustomerNotificationsCampaignConsumption
|
||||
:selected-rows="selected.length > 0"
|
||||
:clients="selected"
|
||||
:promise="refreshData"
|
||||
/>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<VnTable
|
||||
:data-key="dataKey"
|
||||
url="Clients/extendedListFilter"
|
||||
url="Clients/filter"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
:multi-check="{
|
||||
expand: true,
|
||||
}"
|
||||
v-model:selected="selected"
|
||||
:right-search="true"
|
||||
:columns="columns"
|
||||
|
|
|
@ -98,9 +98,7 @@ onMounted(async () => {
|
|||
<QBtn color="primary" icon="show_chart" :disable="!selectedRows">
|
||||
<QPopupProxy ref="popupProxyRef">
|
||||
<QCard class="column q-pa-md">
|
||||
<span class="text-body1 q-mb-sm">{{
|
||||
t('Campaign consumption', { rows: $props.clients.length })
|
||||
}}</span>
|
||||
<span class="text-body1 q-mb-sm">{{ t('Campaign consumption') }}</span>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:options="moreFields"
|
||||
|
@ -142,13 +140,12 @@ onMounted(async () => {
|
|||
valentinesDay: Valentine's Day
|
||||
mothersDay: Mother's Day
|
||||
allSaints: All Saints' Day
|
||||
Campaign consumption: Campaign consumption - {rows} records
|
||||
es:
|
||||
params:
|
||||
valentinesDay: Día de San Valentín
|
||||
mothersDay: Día de la Madre
|
||||
allSaints: Día de Todos los Santos
|
||||
Campaign consumption: Consumo campaña - {rows} registros
|
||||
Campaign consumption: Consumo campaña
|
||||
Campaign: Campaña
|
||||
From: Desde
|
||||
To: Hasta
|
||||
|
|
|
@ -3,29 +3,44 @@ import { reactive, computed } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const routeId = computed(() => route.params.id);
|
||||
const router = useRouter();
|
||||
|
||||
const initialData = reactive({
|
||||
started: Date.vnNew(),
|
||||
clientFk: routeId.value,
|
||||
});
|
||||
|
||||
const toCustomerCreditContracts = () => {
|
||||
router.push({ name: 'CustomerCreditContracts' });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormModelPopup
|
||||
v-on="$attrs"
|
||||
<FormModel
|
||||
:form-initial-data="initialData"
|
||||
:observe-form-changes="false"
|
||||
url-create="creditClassifications/createWithInsurance"
|
||||
@on-data-saved="toCustomerCreditContracts()"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<template #moreActions>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
@click="toCustomerCreditContracts"
|
||||
color="primary"
|
||||
flat
|
||||
icon="close"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
|
@ -48,7 +63,7 @@ const initialData = reactive({
|
|||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
</FormModel>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const filter = {
|
||||
where: {
|
||||
creditClassificationFk: `${route.params.creditId}`,
|
||||
},
|
||||
limit: 20,
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
field: 'created',
|
||||
format: ({ created }) => toDate(created),
|
||||
label: t('Created'),
|
||||
name: 'created',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
field: 'grade',
|
||||
label: t('Grade'),
|
||||
name: 'grade',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
format: ({ credit }) => toCurrency(credit),
|
||||
label: t('Credit'),
|
||||
name: 'credit',
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnTable
|
||||
url="CreditInsurances"
|
||||
ref="tableRef"
|
||||
data-key="creditInsurances"
|
||||
:filter="filter"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="false"
|
||||
:use-model="true"
|
||||
:column-search="false"
|
||||
:disable-option="{ card: true }"
|
||||
auto-load
|
||||
></VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Created: Fecha creación
|
||||
Grade: Grade
|
||||
Credit: Crédito
|
||||
</i18n>
|
|
@ -1,9 +1,9 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
|
||||
import CustomerFileManagementDelete from 'src/pages/Customer/components/CustomerFileManagementDelete.vue';
|
||||
|
@ -12,7 +12,7 @@ const { t } = useI18n();
|
|||
const quasar = useQuasar();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { openReport } = usePrintService();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
|
@ -24,7 +24,7 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const setDownloadFile = () => openReport(`dms/${$props.id}/downloadFile`, {}, '_blank');
|
||||
const setDownloadFile = () => downloadFile($props.id);
|
||||
|
||||
const toCustomerFileManagementEdit = () => {
|
||||
router.push({
|
||||
|
|
|
@ -15,7 +15,7 @@ import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescripto
|
|||
import RouteDescriptorProxy from 'src/pages/Route/Card/RouteDescriptorProxy.vue';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import CustomerDescriptorProxy from '../Card/CustomerDescriptorProxy.vue';
|
||||
import { getItemPackagingType } from '../composables/getItemPackagingType.js';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
@ -161,6 +161,23 @@ const setShippedColor = (date) => {
|
|||
};
|
||||
const rowClick = ({ id }) =>
|
||||
window.open(router.resolve({ params: { id }, name: 'TicketSummary' }).href, '_blank');
|
||||
|
||||
const getItemPackagingType = (ticketSales) => {
|
||||
if (!ticketSales?.length) return '-';
|
||||
|
||||
const packagingTypes = ticketSales.reduce((types, sale) => {
|
||||
const { itemPackingTypeFk } = sale.item;
|
||||
if (
|
||||
!types.includes(itemPackingTypeFk) &&
|
||||
(itemPackingTypeFk === 'H' || itemPackingTypeFk === 'V')
|
||||
) {
|
||||
types.push(itemPackingTypeFk);
|
||||
}
|
||||
return types;
|
||||
}, []);
|
||||
|
||||
return dashIfEmpty(packagingTypes.join(', ') || '-');
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
import { describe, it, expect } from 'vitest';
|
||||
import { getItemPackagingType } from '../getItemPackagingType';
|
||||
|
||||
describe('getItemPackagingType', () => {
|
||||
it('should return "-" if ticketSales is null or undefined', () => {
|
||||
expect(getItemPackagingType(null)).toBe('-');
|
||||
expect(getItemPackagingType(undefined)).toBe('-');
|
||||
});
|
||||
|
||||
it('should return "-" if ticketSales does not have a length property', () => {
|
||||
const ticketSales = { someKey: 'someValue' }; // No tiene propiedad length
|
||||
expect(getItemPackagingType(ticketSales)).toBe('-');
|
||||
});
|
||||
|
||||
it('should return unique packaging types as a comma-separated string', () => {
|
||||
const ticketSales = [
|
||||
{ item: { itemPackingTypeFk: 'H' } },
|
||||
{ item: { itemPackingTypeFk: 'V' } },
|
||||
{ item: { itemPackingTypeFk: 'H' } },
|
||||
];
|
||||
expect(getItemPackagingType(ticketSales)).toBe('H, V');
|
||||
});
|
||||
it('should return unique packaging types as a comma-separated string', () => {
|
||||
const ticketSales = [
|
||||
{ item: { itemPackingTypeFk: 'H' } },
|
||||
{ item: { itemPackingTypeFk: 'V' } },
|
||||
{ item: { itemPackingTypeFk: 'H' } },
|
||||
{ item: { itemPackingTypeFk: 'A' } },
|
||||
];
|
||||
expect(getItemPackagingType(ticketSales)).toBe('H, V, A');
|
||||
});
|
||||
|
||||
it('should return "-" if ticketSales is an empty array', () => {
|
||||
expect(getItemPackagingType([])).toBe('-');
|
||||
});
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
export function getItemPackagingType(ticketSales) {
|
||||
if (!ticketSales?.length) return '-';
|
||||
|
||||
const packagingTypes = Array.from(
|
||||
new Set(ticketSales.map(({ item: { itemPackingTypeFk } }) => itemPackingTypeFk)),
|
||||
);
|
||||
|
||||
return dashIfEmpty(packagingTypes.join(', '));
|
||||
}
|
|
@ -162,9 +162,6 @@ const entryFilterPanel = ref();
|
|||
v-model="params.warehouseOutFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="Warehouses"
|
||||
:where="{
|
||||
isOrigin: true,
|
||||
}"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="name ASC"
|
||||
hide-selected
|
||||
|
@ -180,9 +177,6 @@ const entryFilterPanel = ref();
|
|||
v-model="params.warehouseInFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="Warehouses"
|
||||
:where="{
|
||||
isDestiny: true,
|
||||
}"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="name ASC"
|
||||
hide-selected
|
||||
|
|
|
@ -133,7 +133,6 @@ const columns = computed(() => [
|
|||
label: null,
|
||||
name: 'supplierFk',
|
||||
class: 'fit',
|
||||
event: 'update',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -473,6 +472,6 @@ en:
|
|||
es:
|
||||
IntraCommunity: Intracomunitaria
|
||||
NonCommunity: Extracomunitaria
|
||||
CanaryIslands: Islas Canarias
|
||||
CanaryIsland: Islas Canarias
|
||||
National: Nacional
|
||||
</i18n>
|
||||
|
|
|
@ -6,18 +6,13 @@ import { useRoute } from 'vue-router';
|
|||
import { useSession } from 'src/composables/useSession';
|
||||
import { toDateHourMin } from 'filters/index';
|
||||
import { useStateStore } from 'src/stores/useStateStore';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
import AgencyDescriptorProxy from '../Agency/Card/AgencyDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import RouteDescriptorProxy from '../Card/RouteDescriptorProxy.vue';
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -35,117 +30,39 @@ const userParams = {
|
|||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
name: 'cmrFk',
|
||||
label: t('cmr.params.cmrFk'),
|
||||
label: t('route.cmr.params.cmrFk'),
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: t('cmr.params.ticketFk'),
|
||||
align: 'center',
|
||||
name: 'hasCmrDms',
|
||||
label: t('route.cmr.params.hasCmrDms'),
|
||||
component: 'checkbox',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('route.cmr.params.ticketFk'),
|
||||
name: 'ticketFk',
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: t('cmr.params.routeFk'),
|
||||
align: 'left',
|
||||
label: t('route.cmr.params.routeFk'),
|
||||
name: 'routeFk',
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.client'),
|
||||
align: 'left',
|
||||
label: t('route.cmr.params.clientFk'),
|
||||
name: 'clientFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Clients',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'clientFk',
|
||||
attrs: {
|
||||
url: 'Clients',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.agency'),
|
||||
name: 'agencyModeFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Agencies',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'agencyModeFk',
|
||||
attrs: {
|
||||
url: 'Agencies',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
format: ({ agencyName }) => agencyName,
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.supplier'),
|
||||
name: 'supplierFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'suppliers',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'supplierFk',
|
||||
attrs: {
|
||||
url: 'suppliers',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.sender'),
|
||||
name: 'addressFromFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Addresses',
|
||||
fields: ['id', 'nickname'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'addressFromFk',
|
||||
attrs: {
|
||||
url: 'Addresses',
|
||||
fields: ['id', 'nickname'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
},
|
||||
},
|
||||
format: ({ origin }) => origin,
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.destination'),
|
||||
name: 'addressToFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'addresses',
|
||||
fields: ['id', 'nickname'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'addressToFk',
|
||||
attrs: {
|
||||
url: 'addresses',
|
||||
fields: ['id', 'nickname'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
},
|
||||
},
|
||||
format: ({ destination }) => destination,
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.country'),
|
||||
align: 'right',
|
||||
label: t('route.cmr.params.countryFk'),
|
||||
name: 'countryFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
|
@ -162,61 +79,16 @@ const columns = computed(() => [
|
|||
format: ({ countryName }) => countryName,
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.created'),
|
||||
name: 'created',
|
||||
component: 'date',
|
||||
format: ({ created }) => dashIfEmpty(toDateHourMin(created)),
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.shipped'),
|
||||
align: 'right',
|
||||
label: t('route.cmr.params.shipped'),
|
||||
name: 'shipped',
|
||||
cardVisible: true,
|
||||
component: 'date',
|
||||
format: ({ shipped }) => dashIfEmpty(toDateHourMin(shipped)),
|
||||
format: ({ shipped }) => toDateHourMin(shipped),
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.etd'),
|
||||
name: 'ead',
|
||||
component: 'date',
|
||||
format: ({ ead }) => dashIfEmpty(toDateHourMin(ead)),
|
||||
toolTip: t('cmr.params.etdTooltip'),
|
||||
},
|
||||
{
|
||||
label: t('globals.landed'),
|
||||
name: 'landed',
|
||||
component: 'date',
|
||||
format: ({ landed }) => dashIfEmpty(toDateHourMin(landed)),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.packageList'),
|
||||
name: 'packagesList',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.observation'),
|
||||
name: 'observation',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.senderInstructions'),
|
||||
name: 'senderInstruccions',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.paymentInstructions'),
|
||||
name: 'paymentInstruccions',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.vehiclePlate'),
|
||||
name: 'truckPlate',
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.warehouse'),
|
||||
align: 'right',
|
||||
label: t('route.cmr.params.warehouseFk'),
|
||||
name: 'warehouseFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
|
@ -224,6 +96,7 @@ const columns = computed(() => [
|
|||
fields: ['id', 'name'],
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
name: 'warehouseFk',
|
||||
attrs: {
|
||||
url: 'warehouses',
|
||||
|
@ -232,23 +105,12 @@ const columns = computed(() => [
|
|||
},
|
||||
format: ({ warehouseName }) => warehouseName,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'specialAgreements',
|
||||
label: t('cmr.params.specialAgreements'),
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
name: 'hasCmrDms',
|
||||
label: t('cmr.params.hasCmrDms'),
|
||||
component: 'checkbox',
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('cmr.params.viewCmr'),
|
||||
title: t('route.cmr.params.viewCmr'),
|
||||
icon: 'visibility',
|
||||
isPrimary: true,
|
||||
action: (row) => window.open(getCmrUrl(row?.cmrFk), '_blank'),
|
||||
|
@ -289,7 +151,11 @@ function downloadPdfs() {
|
|||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnSearchbar :data-key :label="t('cmr.search')" :info="t('cmr.searchInfo')" />
|
||||
<VnSearchbar
|
||||
:data-key
|
||||
:label="t('route.cmr.search')"
|
||||
:info="t('route.cmr.searchInfo')"
|
||||
/>
|
||||
<VnSubToolbar>
|
||||
<template #st-actions>
|
||||
<QBtn
|
||||
|
@ -299,7 +165,7 @@ function downloadPdfs() {
|
|||
:disable="!selectedRows?.length"
|
||||
@click="downloadPdfs"
|
||||
>
|
||||
<QTooltip>{{ t('cmr.params.downloadCmrs') }}</QTooltip>
|
||||
<QTooltip>{{ t('route.cmr.params.downloadCmrs') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
|
@ -325,72 +191,11 @@ function downloadPdfs() {
|
|||
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-routeFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.routeFk }}
|
||||
<RouteDescriptorProxy :id="row.routeFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-clientFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.clientName }}
|
||||
{{ row.clientFk }}
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-agencyModeFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.agencyName }}
|
||||
<AgencyDescriptorProxy :id="row.agencyModeFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-supplierFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.carrierName }}
|
||||
<SupplierDescriptorProxy :id="row.supplierFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-observation="{ row }">
|
||||
<VnInput
|
||||
v-if="row.observation"
|
||||
type="textarea"
|
||||
v-model="row.observation"
|
||||
readonly
|
||||
dense
|
||||
rows="2"
|
||||
style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap"
|
||||
/>
|
||||
</template>
|
||||
<template #column-packagesList="{ row }">
|
||||
<span>
|
||||
{{ row.packagesList }}
|
||||
<QTooltip v-if="row.packagesList" :label="row.packagesList">
|
||||
{{ row.packagesList }}
|
||||
</QTooltip>
|
||||
</span>
|
||||
</template>
|
||||
<template #column-senderInstruccions="{ row }">
|
||||
<span>
|
||||
{{ row.senderInstruccions }}
|
||||
<QTooltip v-if="row.packagesList" :label="row.packagesList">
|
||||
{{ row.senderInstruccions }}
|
||||
</QTooltip>
|
||||
</span>
|
||||
</template>
|
||||
<template #column-paymentInstruccions="{ row }">
|
||||
<span>
|
||||
{{ row.paymentInstruccions }}
|
||||
<QTooltip v-if="row.packagesList" :label="row.packagesList">
|
||||
{{ row.paymentInstruccions }}
|
||||
</QTooltip>
|
||||
</span>
|
||||
</template>
|
||||
<template #column-specialAgreements="{ row }">
|
||||
<span>
|
||||
{{ row.specialAgreements }}
|
||||
<QTooltip v-if="row.packagesList" :label="row.packagesList">
|
||||
{{ row.specialAgreements }}
|
||||
</QTooltip>
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
cmr:
|
||||
search: Search Cmr
|
||||
searchInfo: You can search Cmr by Id
|
||||
params:
|
||||
agency: Agency
|
||||
client: Client
|
||||
cmrFk: CMR id
|
||||
country: Country
|
||||
created: Created
|
||||
destination: Destination
|
||||
downloadCmrs: Download CMRs
|
||||
etd: ETD
|
||||
etdTooltip: Estimated Time Delivery
|
||||
hasCmrDms: Attached in gestdoc
|
||||
observation: Observation
|
||||
packageList: Package List
|
||||
paymentInstructions: Payment instructions
|
||||
routeFk: Route id
|
||||
results: results
|
||||
search: General search
|
||||
sender: Sender
|
||||
senderInstructions: Sender instructions
|
||||
shipped: Shipped
|
||||
specialAgreements: Special agreements
|
||||
supplier: Carrier
|
||||
ticketFk: Ticket id
|
||||
vehiclePlate: Vehicle plate
|
||||
viewCmr: View CMR
|
||||
warehouse: Warehouse
|
||||
'true': 'Yes'
|
||||
'false': 'No'
|
|
@ -1,31 +0,0 @@
|
|||
cmr:
|
||||
search: Buscar Cmr
|
||||
searchInfo: Puedes buscar cmr por id
|
||||
params:
|
||||
agency: Agencia
|
||||
client: Cliente
|
||||
cmrFk: Id cmr
|
||||
country: País
|
||||
created: Creado
|
||||
destination: Destinatario
|
||||
downloadCmrs: Descargar CMRs
|
||||
etd: ETD
|
||||
etdTooltip: Fecha estimada de entrega
|
||||
hasCmrDms: Adjunto en gestdoc
|
||||
observation: Observaciones
|
||||
packageList: Listado embalajes
|
||||
paymentInstructions: Instrucciones de pago
|
||||
routeFk: Id ruta
|
||||
results: Resultados
|
||||
search: Busqueda general
|
||||
sender: Remitente
|
||||
senderInstructions: Instrucciones de envío
|
||||
shipped: F. envío
|
||||
specialAgreements: Acuerdos especiales
|
||||
supplier: Transportista
|
||||
ticketFk: Id ticket
|
||||
vehiclePlate: Matrícula
|
||||
viewCmr: Ver CMR
|
||||
warehouse: Almacén
|
||||
'true': 'Si'
|
||||
'false': 'No'
|
|
@ -1,183 +0,0 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FormPopup from 'components/FormPopup.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import axios from 'axios';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const props = defineProps({
|
||||
event: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
isNewMode: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
eventType: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
firstDay: {
|
||||
type: Date,
|
||||
default: null,
|
||||
},
|
||||
lastDay: {
|
||||
type: Date,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['onSubmit', 'closeForm', 'refresh-events']);
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
|
||||
const isNew = computed(() => props.isNewMode);
|
||||
const vehicleFormData = ref({
|
||||
started: null,
|
||||
finished: null,
|
||||
vehicleStateFk: null,
|
||||
description: '',
|
||||
vehicleFk: null,
|
||||
userFk: null,
|
||||
});
|
||||
|
||||
const arrayData = useArrayData('VehicleEvents');
|
||||
|
||||
onMounted(() => {
|
||||
if (props.event) {
|
||||
vehicleFormData.value = props.event;
|
||||
}
|
||||
});
|
||||
|
||||
const createVehicleEvent = async () => {
|
||||
vehicleFormData.value.vehicleFk = route.params.id;
|
||||
vehicleFormData.value.userFk = user.value.id;
|
||||
|
||||
if (isNew.value) {
|
||||
await axios.post(`VehicleEvents`, vehicleFormData.value);
|
||||
} else {
|
||||
await axios.patch(
|
||||
`VehicleEvents/${props.event?.id}`,
|
||||
vehicleFormData.value,
|
||||
);
|
||||
}
|
||||
await refetchEvents();
|
||||
|
||||
};
|
||||
|
||||
const deleteVehicleEvent = async () => {
|
||||
if (!props.event) return;
|
||||
await axios.delete(`VehicleEvents/${props.event?.id}`);
|
||||
await refetchEvents();
|
||||
};
|
||||
|
||||
const refetchEvents = async () => {
|
||||
await arrayData.refresh({
|
||||
append: false,
|
||||
params: {
|
||||
filter: {
|
||||
where: {
|
||||
vehicleFk: route.params.id,
|
||||
and: [
|
||||
{
|
||||
or: [
|
||||
{ started: { lte: props.lastDay?.toISOString() } },
|
||||
{ started: null }
|
||||
]
|
||||
},
|
||||
{
|
||||
or: [
|
||||
{ finished: { gte: props.firstDay?.toISOString() } },
|
||||
{ finished: null }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
emit('refresh-events');
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
emit('closeForm');
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormPopup
|
||||
:title="isNew ? t('Add vehicle event') : t('Edit vehicle event')"
|
||||
:default-cancel-button="false"
|
||||
:default-submit-button="false"
|
||||
>
|
||||
<template #form-inputs>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<VnInputDate :label="t('Started')" v-model="vehicleFormData.started" />
|
||||
<VnInputDate :label="t('Finished')" v-model="vehicleFormData.finished" />
|
||||
<VnSelect
|
||||
url="VehicleStates"
|
||||
v-model="vehicleFormData.vehicleStateFk"
|
||||
:label="t('globals.state')"
|
||||
option-label="state"
|
||||
data-cy="State_input"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnInput
|
||||
v-model="vehicleFormData.description"
|
||||
:label="t('globals.description')"
|
||||
/>
|
||||
</template>
|
||||
<template #custom-buttons>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
class="q-mr-sm"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
v-if="!isNew"
|
||||
:label="t('globals.delete')"
|
||||
color="primary"
|
||||
flat
|
||||
class="q-mr-sm"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('vehicle.deleteTitle'),
|
||||
t('vehicle.deleteSubtitle'),
|
||||
() => deleteVehicleEvent(),
|
||||
)
|
||||
"
|
||||
/>
|
||||
<QBtn
|
||||
:label="isNew ? t('globals.save') : t('globals.add')"
|
||||
@click="createVehicleEvent"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
</FormPopup>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Started: Inicio
|
||||
Finished: Fin
|
||||
Add vehicle event: Agregar evento
|
||||
Edit vehicle event: Editar evento
|
||||
</i18n>
|
|
@ -1,86 +0,0 @@
|
|||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VehicleEventsPanel from './VehicleEventsPanel.vue';
|
||||
import VehicleCalendarGrid from '../VehicleCalendarGrid.vue';
|
||||
import VehicleEventInclusionForm from './VehicleEventInclusionForm.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
|
||||
const firstDay = ref();
|
||||
const lastDay = ref();
|
||||
const events = ref([]);
|
||||
const vehicleEventsPanelRef = ref(null);
|
||||
const showVehicleEventForm = ref(false);
|
||||
const vehicleEventsFormProps = reactive({
|
||||
isNewMode: true,
|
||||
date: null,
|
||||
event: null,
|
||||
});
|
||||
|
||||
const refreshEvents = async () => {
|
||||
await vehicleEventsPanelRef.value.fetchData();
|
||||
};
|
||||
|
||||
const openForm = (data) => {
|
||||
const { date = null, isNewMode, event } = data;
|
||||
Object.assign(vehicleEventsFormProps, { date, isNewMode, event });
|
||||
|
||||
showVehicleEventForm.value = true;
|
||||
};
|
||||
|
||||
const onVehicleEventFormClose = () => {
|
||||
showVehicleEventForm.value = false;
|
||||
vehicleEventsFormProps.value = {};
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RightMenu>
|
||||
<template #right-panel v-if="stateStore.isHeaderMounted()">
|
||||
<VehicleEventsPanel
|
||||
ref="vehicleEventsPanelRef"
|
||||
:first-day="firstDay"
|
||||
:last-day="lastDay"
|
||||
:events="events"
|
||||
@update:events="events = $event"
|
||||
/>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QPage class="q-pa-md flex justify-center">
|
||||
<VehicleCalendarGrid
|
||||
v-model:events="events"
|
||||
v-model:firstDay="firstDay"
|
||||
v-model:lastDay="lastDay"
|
||||
data-key="VehicleEvents"
|
||||
@on-date-selected="openForm"
|
||||
/>
|
||||
<QDialog v-model="showVehicleEventForm" @hide="onVehicleEventFormClose()">
|
||||
<VehicleEventInclusionForm
|
||||
v-bind="vehicleEventsFormProps"
|
||||
:first-day="firstDay"
|
||||
:last-day="lastDay"
|
||||
@close-form="onVehicleEventFormClose()"
|
||||
@refresh-events="refreshEvents()"
|
||||
/>
|
||||
</QDialog>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn
|
||||
@click="openForm({ isNewMode: true }, true)"
|
||||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
v-shortcut="'+'"
|
||||
/>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('eventsInclusionForm.addEvent') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
|
@ -1,196 +0,0 @@
|
|||
<script setup>
|
||||
import { onMounted, watch, computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import axios from 'axios';
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const props = defineProps({
|
||||
firstDay: {
|
||||
type: Date,
|
||||
default: null,
|
||||
},
|
||||
lastDay: {
|
||||
type: Date,
|
||||
default: null,
|
||||
},
|
||||
events: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['openVehicleForm']);
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const { notify } = useNotify();
|
||||
const weekdayStore = useWeekdayStore();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const vehicleStates = ref({});
|
||||
const fetchVehicleState = async () => {
|
||||
const vehicles = await axios.get('VehicleStates');
|
||||
vehicleStates.value = vehicles.data;
|
||||
};
|
||||
|
||||
const getVehicleStateName = (id) => {
|
||||
return vehicleStates.value[id - 1] ?? dashIfEmpty(id - 1);
|
||||
};
|
||||
|
||||
const params = computed(() => ({
|
||||
vehicleFk: route.params.id,
|
||||
started: props.firstDay,
|
||||
finished: props.lastDay,
|
||||
}));
|
||||
|
||||
const arrayData = useArrayData('VehicleEvents', {
|
||||
params: params,
|
||||
url: `VehicleEvents`,
|
||||
});
|
||||
|
||||
const fetchData = async () => {
|
||||
if (!params.value.vehicleFk || !props.firstDay || !props.lastDay) return;
|
||||
|
||||
try {
|
||||
await arrayData.applyFilter({
|
||||
params: {
|
||||
filter: {
|
||||
where: {
|
||||
vehicleFk: route.params.id,
|
||||
and: [
|
||||
{ or: [
|
||||
{ started: { lte: props.lastDay } },
|
||||
{ started: null }
|
||||
]},
|
||||
{ or: [
|
||||
{ finished: { gte: props.firstDay } },
|
||||
{ finished: null }
|
||||
]}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
emit('update:events', arrayData.store.data || []);
|
||||
} catch (error) {
|
||||
console.error('Error fetching events:', error);
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
params,
|
||||
async () => {
|
||||
await fetchData();
|
||||
},
|
||||
{ immediate: true, deep: true },
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.events,
|
||||
(newEvents) => {
|
||||
emit('update:events', newEvents);
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const deleteEvent = async (id) => {
|
||||
if (!id) return;
|
||||
await axios.delete(`VehicleEvents/${id}`);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
await fetchData();
|
||||
};
|
||||
|
||||
const openInclusionForm = (event) => {
|
||||
emit('openVehicleForm', {
|
||||
date: event.dated,
|
||||
event,
|
||||
isNewMode: false,
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
weekdayStore.initStore();
|
||||
await fetchVehicleState();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
fetchData
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QForm @submit="onSubmit()">
|
||||
<div class="column q-pa-md q-gutter-y-sm"></div>
|
||||
<span class="color-vn-label text-subtitle1 q-px-md">{{
|
||||
t('eventsPanel.events')
|
||||
}}</span>
|
||||
<QList>
|
||||
<QItem v-for="(event, index) in events" :key="index" class="event-card">
|
||||
<QItemSection left @click="openInclusionForm(event)">
|
||||
<div class="q-mb-xs">
|
||||
<span
|
||||
>({{ toDateFormat(event.started) }} -
|
||||
{{ toDateFormat(event.finished) }})</span
|
||||
>
|
||||
</div>
|
||||
<span class="color-vn-label"
|
||||
>{{ t('globals.description') }}:
|
||||
<span class="color-vn-text q-ml-xs">{{
|
||||
dashIfEmpty(event.description)
|
||||
}}</span>
|
||||
</span>
|
||||
<span class="color-vn-label"
|
||||
>{{ t('globals.state') }}:
|
||||
<span class="color-vn-text">{{
|
||||
getVehicleStateName(event.vehicleStateFk).state
|
||||
}}</span>
|
||||
</span>
|
||||
</QItemSection>
|
||||
<QItemSection side @click="openInclusionForm(event)">
|
||||
<QBtn
|
||||
icon="delete"
|
||||
data-cy="delete_event"
|
||||
flat
|
||||
dense
|
||||
size="md"
|
||||
color="primary"
|
||||
@click.stop="
|
||||
openConfirmationModal(
|
||||
t('vehicle.deleteTitle'),
|
||||
t('vehicle.deleteSubtitle'),
|
||||
() => deleteEvent(event.id),
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip>{{ t('eventsPanel.delete') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<span
|
||||
v-if="!events.length"
|
||||
class="flex justify-center text-h5 color-vn-label"
|
||||
>
|
||||
{{ t('globals.noResults') }}
|
||||
</span>
|
||||
</QList>
|
||||
</QForm>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.event-card {
|
||||
display: flex;
|
||||
border-bottom: $border-thin-light;
|
||||
margin: 0;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--vn-accent-color);
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,13 +0,0 @@
|
|||
<script setup>
|
||||
import EntityCalendar from 'src/components/EntityCalendar.vue';
|
||||
|
||||
const emit = defineEmits(['onDateSelected']);
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<EntityCalendar
|
||||
v-bind="$props"
|
||||
@onDateSelected="(e) => emit('onDateSelected', e)"
|
||||
/>
|
||||
</template>
|
|
@ -1,97 +0,0 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import EntityCalendarGrid from 'src/components/EntityCalendarGrid.vue';
|
||||
import VehicleCalendar from './VehicleCalendar.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const firstDay = ref(new Date());
|
||||
const lastDay = ref(new Date());
|
||||
const entityCalendarRef = ref(null);
|
||||
|
||||
const arrayData = useArrayData(props.dataKey);
|
||||
const { store } = arrayData;
|
||||
const _data = ref(null);
|
||||
const days = ref({});
|
||||
const events = ref([]);
|
||||
|
||||
const refreshEvents = () => {
|
||||
days.value = {};
|
||||
if (!events.value?.length || !firstDay.value || !lastDay.value) return;
|
||||
|
||||
let day = new Date(firstDay.value.getTime());
|
||||
let endDate = new Date(lastDay.value.getTime());
|
||||
|
||||
while (day <= endDate) {
|
||||
let stamp = day.getTime();
|
||||
let dayEvents = [];
|
||||
|
||||
for (let event of events.value) {
|
||||
const eventStart = event.started ? new Date(event.started).getTime() : null;
|
||||
const eventEnd = event.finished ? new Date(event.finished).getTime() : null;
|
||||
|
||||
let match = (!eventStart || stamp >= eventStart) &&
|
||||
(!eventEnd || stamp <= eventEnd);
|
||||
|
||||
if (match) {
|
||||
dayEvents.push(event);
|
||||
}
|
||||
}
|
||||
|
||||
if (dayEvents.length) {
|
||||
days.value[stamp] = dayEvents;
|
||||
}
|
||||
|
||||
day.setDate(day.getDate() + 1);
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => store.data,
|
||||
(value) => {
|
||||
_data.value = value;
|
||||
events.value = Array.isArray(value) ? value : [];
|
||||
|
||||
function toStamp(date) {
|
||||
return date && new Date(date).setHours(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (events.value) {
|
||||
for (let event of events.value) {
|
||||
event.dated = toStamp(event.dated);
|
||||
event.finished = toStamp(event.finished);
|
||||
event.started = toStamp(event.started);
|
||||
}
|
||||
}
|
||||
|
||||
refreshEvents();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
watch(() => entityCalendarRef.value?.firstDay, (newVal) => {
|
||||
if (newVal) firstDay.value = new Date(newVal);
|
||||
});
|
||||
|
||||
watch(() => entityCalendarRef.value?.lastDay, (newVal) => {
|
||||
if (newVal) lastDay.value = new Date(newVal);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<EntityCalendarGrid
|
||||
ref="entityCalendarRef"
|
||||
:data-key="dataKey"
|
||||
:calendar-component="VehicleCalendar"
|
||||
:additional-props="{ daysMap: days }"
|
||||
@refresh-events="refreshEvents"
|
||||
v-bind="$attrs"
|
||||
/>
|
||||
</template>
|
|
@ -15,8 +15,6 @@ vehicle:
|
|||
remove: Vehicle removed
|
||||
search: Search Vehicle
|
||||
searchInfo: Search by id or number plate
|
||||
deleteTitle: This item will be deleted
|
||||
deleteSubtitle: Are you sure you want to continue?
|
||||
params:
|
||||
vehicleTypeFk: Type
|
||||
vehicleStateFk: State
|
||||
|
|
|
@ -15,8 +15,6 @@ vehicle:
|
|||
remove: Vehículo eliminado
|
||||
search: Buscar Vehículo
|
||||
searchInfo: Buscar por id o matrícula
|
||||
deleteTitle: Este elemento será eliminado
|
||||
deleteSubtitle: ¿Seguro que quieres continuar?
|
||||
params:
|
||||
vehicleTypeFk: Tipo
|
||||
vehicleStateFk: Estado
|
||||
|
|
|
@ -51,11 +51,6 @@ route:
|
|||
agencyModeName: Agency route
|
||||
isOwn: Own
|
||||
isAnyVolumeAllowed: Any volume allowed
|
||||
created: Created
|
||||
addressFromFk: Sender
|
||||
addressToFk: Destination
|
||||
landed: Landed
|
||||
ead: EAD
|
||||
Worker: Worker
|
||||
Agency: Agency
|
||||
Vehicle: Vehicle
|
||||
|
@ -75,3 +70,21 @@ route:
|
|||
searchInfo: You can search by route reference
|
||||
dated: Dated
|
||||
preview: Preview
|
||||
cmr:
|
||||
search: Search Cmr
|
||||
searchInfo: You can search Cmr by Id
|
||||
params:
|
||||
results: results
|
||||
cmrFk: CMR id
|
||||
hasCmrDms: Attached in gestdoc
|
||||
'true': 'Yes'
|
||||
'false': 'No'
|
||||
ticketFk: Ticketd id
|
||||
routeFk: Route id
|
||||
countryFk: Country
|
||||
clientFk: Client id
|
||||
warehouseFk: Warehouse
|
||||
shipped: Preparation date
|
||||
viewCmr: View CMR
|
||||
downloadCmrs: Download CMRs
|
||||
search: General search
|
||||
|
|
|
@ -47,16 +47,11 @@ route:
|
|||
routeFk: Id ruta
|
||||
clientFk: Id cliente
|
||||
countryFk: Pais
|
||||
shipped: F. envío
|
||||
shipped: Fecha preparación
|
||||
agencyModeName: Agencia Ruta
|
||||
agencyAgreement: Agencia Acuerdo
|
||||
isOwn: Propio
|
||||
isAnyVolumeAllowed: Cualquier volumen
|
||||
created: Creado
|
||||
addressFromFk: Remitente
|
||||
addressToFk: Destinatario
|
||||
landed: F. entrega
|
||||
ead: ETD
|
||||
Worker: Trabajador
|
||||
Agency: Agencia
|
||||
Vehicle: Vehículo
|
||||
|
|
|
@ -4,6 +4,11 @@ import ParkingSummary from './ParkingSummary.vue';
|
|||
</script>
|
||||
<template>
|
||||
<QPopupProxy style="max-width: 10px">
|
||||
<ParkingDescriptor v-if="$attrs.id" v-bind="$attrs" :summary="ParkingSummary" />
|
||||
<ParkingDescriptor
|
||||
v-if="$attrs.id"
|
||||
v-bind="$attrs.id"
|
||||
:summary="ParkingSummary"
|
||||
:proxy-render="true"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -7,11 +7,12 @@ import FetchData from 'components/FetchData.vue';
|
|||
import CrudModel from 'components/CrudModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useQuasar } from 'quasar';
|
||||
import VnBankDetailsForm from 'src/components/common/VnBankDetailsForm.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
|
@ -25,6 +26,11 @@ const wireTransferFk = ref(null);
|
|||
const bankEntitiesOptions = ref([]);
|
||||
const filteredBankEntitiesOptions = ref([]);
|
||||
|
||||
const onBankEntityCreated = async (dataSaved, rowData) => {
|
||||
await bankEntitiesRef.value.fetch();
|
||||
rowData.bankEntityFk = dataSaved.id;
|
||||
};
|
||||
|
||||
const onChangesSaved = async () => {
|
||||
if (supplier.value.payMethodFk !== wireTransferFk.value)
|
||||
quasar
|
||||
|
@ -50,6 +56,23 @@ const setWireTransfer = async () => {
|
|||
await axios.patch(`Suppliers/${route.params.id}`, params);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
};
|
||||
|
||||
function findBankFk(value, row) {
|
||||
row.bankEntityFk = null;
|
||||
if (!value) return;
|
||||
|
||||
const bankEntityFk = bankEntitiesOptions.value.find((b) => b.id == value.slice(4, 8));
|
||||
if (bankEntityFk) row.bankEntityFk = bankEntityFk.id;
|
||||
}
|
||||
|
||||
function bankEntityFilter(val) {
|
||||
const needle = val.toLowerCase();
|
||||
filteredBankEntitiesOptions.value = bankEntitiesOptions.value.filter(
|
||||
(bank) =>
|
||||
bank.bic.toLowerCase().startsWith(needle) ||
|
||||
bank.name.toLowerCase().includes(needle),
|
||||
);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -95,16 +118,47 @@ const setWireTransfer = async () => {
|
|||
:key="index"
|
||||
class="row q-gutter-md q-mb-md"
|
||||
>
|
||||
<VnBankDetailsForm
|
||||
v-model:iban="row.iban"
|
||||
v-model:bankEntityFk="row.bankEntityFk"
|
||||
@update-bic="
|
||||
({ iban, bankEntityFk }) => {
|
||||
row.iban = iban;
|
||||
row.bankEntityFk = bankEntityFk;
|
||||
}
|
||||
"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('supplier.accounts.iban')"
|
||||
v-model="row.iban"
|
||||
@update:model-value="(value) => findBankFk(value, row)"
|
||||
:required="true"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-info">
|
||||
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
<VnSelectDialog
|
||||
:label="t('worker.create.bankEntity')"
|
||||
v-model="row.bankEntityFk"
|
||||
:options="filteredBankEntitiesOptions"
|
||||
:filter-fn="bankEntityFilter"
|
||||
option-label="bic"
|
||||
hide-selected
|
||||
:required="true"
|
||||
:roles-allowed-to-create="['financial']"
|
||||
>
|
||||
<template #form>
|
||||
<CreateBankEntityForm
|
||||
@on-data-saved="
|
||||
(_, requestResponse) =>
|
||||
onBankEntityCreated(requestResponse, row)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection v-if="scope.opt">
|
||||
<QItemLabel
|
||||
>{{ scope.opt.bic }}
|
||||
{{ scope.opt.name }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
<VnInput
|
||||
:label="t('supplier.accounts.beneficiary')"
|
||||
v-model="row.beneficiary"
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import { dateRange, toCurrency, toNumber, toDateHourMin } from 'src/filters';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||
import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
|
||||
import { dateRange, toDate } from 'src/filters';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||
import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
|
||||
const state = useState();
|
||||
const stateStore = useStateStore();
|
||||
|
@ -29,86 +31,7 @@ const arrayData = useArrayData('SupplierConsumption', {
|
|||
order: ['itemTypeFk', 'itemName', 'itemSize'],
|
||||
userFilter: { where: { supplierFk: route.params.id } },
|
||||
});
|
||||
const headerColumns = computed(() => [
|
||||
{
|
||||
name: 'id',
|
||||
label: t('globals.entry'),
|
||||
align: 'left',
|
||||
field: 'id',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'invoiceNumber',
|
||||
label: t('globals.params.supplierRef'),
|
||||
align: 'left',
|
||||
field: 'invoiceNumber',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'shipped',
|
||||
label: t('globals.shipped'),
|
||||
align: 'center',
|
||||
field: 'shipped',
|
||||
format: toDateHourMin,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'quantity',
|
||||
label: t('item.list.stems'),
|
||||
align: 'center',
|
||||
field: 'quantity',
|
||||
format: (value) => toNumber(value),
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'total',
|
||||
label: t('globals.total'),
|
||||
align: 'center',
|
||||
field: 'total',
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
},
|
||||
]);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'itemName',
|
||||
label: t('globals.item'),
|
||||
align: 'left',
|
||||
field: 'itemName',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'subName',
|
||||
align: 'left',
|
||||
field: 'subName',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'quantity',
|
||||
label: t('globals.quantity'),
|
||||
align: 'right',
|
||||
field: 'quantity',
|
||||
format: (value) => toNumber(value),
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'price',
|
||||
label: t('globals.price'),
|
||||
align: 'right',
|
||||
field: 'price',
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'total',
|
||||
label: t('globals.total'),
|
||||
align: 'right',
|
||||
field: 'total',
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
},
|
||||
]);
|
||||
const store = arrayData.store;
|
||||
|
||||
onUnmounted(() => state.unset('SupplierConsumption'));
|
||||
|
@ -117,11 +40,13 @@ const dateRanges = computed(() => {
|
|||
return { from, to };
|
||||
});
|
||||
|
||||
const reportParams = computed(() => ({
|
||||
recipientId: Number(route.params.id),
|
||||
from: dateRange(dateRanges.value.from)[0].toISOString(),
|
||||
to: dateRange(dateRanges.value.to)[1].toISOString(),
|
||||
}));
|
||||
const reportParams = computed(() => {
|
||||
return {
|
||||
recipientId: Number(route.params.id),
|
||||
to: dateRange(dateRanges.value.to)[1],
|
||||
from: dateRange(dateRanges.value.from)[1],
|
||||
};
|
||||
});
|
||||
|
||||
async function getSupplierConsumptionData() {
|
||||
await arrayData.fetch({ append: false });
|
||||
|
@ -177,34 +102,33 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
|||
};
|
||||
|
||||
const totalEntryPrice = (rows) => {
|
||||
if (!rows) return [];
|
||||
totalRows.value = rows.reduce(
|
||||
(acc, row) => {
|
||||
if (Array.isArray(row.buys)) {
|
||||
const { total, quantity } = row.buys.reduce(
|
||||
(buyAcc, buy) => {
|
||||
buyAcc.total += buy.total || 0;
|
||||
buyAcc.quantity += buy.quantity || 0;
|
||||
return buyAcc;
|
||||
},
|
||||
{ total: 0, quantity: 0 },
|
||||
);
|
||||
row.total = total;
|
||||
row.quantity = quantity;
|
||||
acc.totalPrice += total;
|
||||
acc.totalQuantity += quantity;
|
||||
let totalPrice = 0;
|
||||
let totalQuantity = 0;
|
||||
if (!rows) return totalPrice;
|
||||
for (const row of rows) {
|
||||
let total = 0;
|
||||
let quantity = 0;
|
||||
|
||||
if (row.buys) {
|
||||
for (const buy of row.buys) {
|
||||
total = total + buy.total;
|
||||
quantity = quantity + buy.quantity;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{ totalPrice: 0, totalQuantity: 0 },
|
||||
);
|
||||
}
|
||||
|
||||
row.total = total;
|
||||
row.quantity = quantity;
|
||||
totalPrice = totalPrice + total;
|
||||
totalQuantity = totalQuantity + quantity;
|
||||
}
|
||||
totalRows.value = { totalPrice, totalQuantity };
|
||||
return rows;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
await getSupplierConsumptionData();
|
||||
});
|
||||
const expanded = ref([]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -238,14 +162,14 @@ const expanded = ref([]);
|
|||
<div>
|
||||
{{ t('Total entries') }}:
|
||||
<QChip :dense="$q.screen.lt.sm" text-color="white">
|
||||
{{ toCurrency(totalRows.totalPrice) }}
|
||||
{{ totalRows.totalPrice }} €
|
||||
</QChip>
|
||||
</div>
|
||||
<QSeparator dark vertical />
|
||||
<div>
|
||||
{{ t('Total stems entries') }}:
|
||||
<QChip :dense="$q.screen.lt.sm" text-color="white">
|
||||
{{ toNumber(totalRows.totalQuantity) }}
|
||||
{{ totalRows.totalQuantity }}
|
||||
</QChip>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -255,111 +179,59 @@ const expanded = ref([]);
|
|||
<SupplierConsumptionFilter data-key="SupplierConsumption" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QCard class="full-width q-pa-md">
|
||||
<QTable
|
||||
flat
|
||||
bordered
|
||||
:rows="rows"
|
||||
:columns="headerColumns"
|
||||
row-key="id"
|
||||
v-model:expanded="expanded"
|
||||
:grid="$q.screen.lt.md"
|
||||
>
|
||||
<template #header="props">
|
||||
<QTr :props="props">
|
||||
<QTh auto-width />
|
||||
|
||||
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span v-text="col.label" class="tr-header" />
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
|
||||
<template #body="props">
|
||||
<QTr
|
||||
:props="props"
|
||||
:key="`movement_${props.row.id}`"
|
||||
class="bg-vn-page cursor-pointer"
|
||||
@click="props.expand = !props.expand"
|
||||
<QTable
|
||||
:rows="rows"
|
||||
row-key="id"
|
||||
hide-header
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('No results')"
|
||||
>
|
||||
<template #body="{ row }">
|
||||
<QTr>
|
||||
<QTd no-hover>
|
||||
<span class="label">{{ t('supplier.consumption.entry') }}: </span>
|
||||
<span>{{ row.id }}</span>
|
||||
</QTd>
|
||||
<QTd no-hover>
|
||||
<span class="label">{{ t('globals.date') }}: </span>
|
||||
<span>{{ toDate(row.shipped) }}</span></QTd
|
||||
>
|
||||
<QTd auto-width>
|
||||
<QIcon
|
||||
:class="props.expand ? '' : 'rotate-270'"
|
||||
name="expand_circle_down"
|
||||
size="md"
|
||||
:color="props.expand ? 'primary' : 'white'"
|
||||
/>
|
||||
</QTd>
|
||||
<QTd colspan="6" no-hover>
|
||||
<span class="label">{{ t('globals.reference') }}: </span>
|
||||
<span>{{ row.invoiceNumber }}</span>
|
||||
</QTd>
|
||||
</QTr>
|
||||
<QTr v-for="(buy, index) in row.buys" :key="index">
|
||||
<QTd no-hover>
|
||||
<QBtn flat class="link" dense no-caps>{{ buy.itemName }}</QBtn>
|
||||
<ItemDescriptorProxy :id="buy.itemFk" />
|
||||
</QTd>
|
||||
|
||||
<QTd v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span @click.stop class="link" v-if="col.name === 'id'">
|
||||
{{ col.value }}
|
||||
<EntryDescriptorProxy :id="col.value" />
|
||||
</span>
|
||||
|
||||
<span v-else v-text="col.value" />
|
||||
</QTd>
|
||||
</QTr>
|
||||
|
||||
<QTr
|
||||
v-show="props.expand"
|
||||
:props="props"
|
||||
:key="`expedition_${props.row.id}`"
|
||||
>
|
||||
<QTd colspan="12" style="padding: 1px 0">
|
||||
<QTable
|
||||
color="secondary"
|
||||
card-class="bg-vn-page text-white "
|
||||
style-class="height: 30px"
|
||||
table-header-class="text-white"
|
||||
:rows="props.row.buys"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
virtual-scroll
|
||||
v-model:expanded="expanded"
|
||||
>
|
||||
<template #header="props">
|
||||
<QTr :props="props">
|
||||
<QTh
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
<span v-text="col.label" class="tr-header" />
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body="props">
|
||||
<QTr :props="props" :key="`m_${props.row.id}`">
|
||||
<QTd
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:title="col.label"
|
||||
:props="props"
|
||||
>
|
||||
<span
|
||||
@click.stop
|
||||
class="link"
|
||||
v-if="col.name === 'itemName'"
|
||||
>
|
||||
{{ col.value }}
|
||||
<ItemDescriptorProxy :id="props.row.itemFk" />
|
||||
</span>
|
||||
<span v-else v-text="col.value" />
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
<QTd no-hover>
|
||||
<span>{{ buy.subName }}</span>
|
||||
<FetchedTags :item="buy" />
|
||||
</QTd>
|
||||
<QTd no-hover> {{ dashIfEmpty(buy.quantity) }}</QTd>
|
||||
<QTd no-hover> {{ dashIfEmpty(buy.price) }}</QTd>
|
||||
<QTd colspan="2" no-hover> {{ dashIfEmpty(buy.total) }}</QTd>
|
||||
</QTr>
|
||||
<QTr>
|
||||
<QTd colspan="5" no-hover>
|
||||
<span class="label">{{ t('Total entry') }}: </span>
|
||||
<span>{{ row.total }} €</span>
|
||||
</QTd>
|
||||
<QTd no-hover>
|
||||
<span class="label">{{ t('Total stems') }}: </span>
|
||||
<span>{{ row.quantity }}</span>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.q-table thead tr,
|
||||
.q-table tbody td {
|
||||
height: 30px;
|
||||
.label {
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
@ -24,9 +25,7 @@ const { validate } = useValidator();
|
|||
const { notify } = useNotify();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const canEditZone = useAcl().hasAny([
|
||||
{ model: 'Ticket', props: 'editZone', accessType: 'WRITE' },
|
||||
]);
|
||||
const canEditZone = useAcl().hasAcl('Ticket', 'editZone', 'WRITE');
|
||||
|
||||
const agencyFetchRef = ref();
|
||||
const warehousesOptions = ref([]);
|
||||
|
@ -58,38 +57,26 @@ const zoneWhere = computed(() => {
|
|||
});
|
||||
|
||||
async function getLanded(params) {
|
||||
const data = await getDate(`Agencies/getLanded`, params);
|
||||
formData.value.landed = data.landed;
|
||||
const shippedDate = new Date(params.shipped);
|
||||
const landedDate = new Date(data.hour);
|
||||
shippedDate.setHours(
|
||||
landedDate.getHours(),
|
||||
landedDate.getMinutes(),
|
||||
landedDate.getSeconds(),
|
||||
);
|
||||
formData.value.shipped = shippedDate.toISOString();
|
||||
getDate(`Agencies/getLanded`, params);
|
||||
}
|
||||
|
||||
async function getShipped(params) {
|
||||
const data = await getDate(`Agencies/getShipped`, params);
|
||||
formData.value.landed = params.landed;
|
||||
const [hours, minutes, seconds] = data.hour.split(':').map(Number);
|
||||
let shippedDate = new Date(data.shipped);
|
||||
shippedDate.setHours(hours, minutes, seconds);
|
||||
formData.value.shipped = shippedDate.toISOString();
|
||||
getDate(`Agencies/getShipped`, params);
|
||||
}
|
||||
|
||||
async function getDate(query, params) {
|
||||
for (const param in params) {
|
||||
if (!params[param]) return;
|
||||
}
|
||||
|
||||
formData.value.zoneFk = null;
|
||||
zonesOptions.value = [];
|
||||
const { data } = await axios.get(query, { params });
|
||||
if (!data) return notify(t('basicData.noDeliveryZoneAvailable'), 'negative');
|
||||
|
||||
formData.value.zoneFk = data.zoneFk;
|
||||
|
||||
return data;
|
||||
if (data.landed) formData.value.landed = data.landed;
|
||||
if (data.shipped) formData.value.shipped = data.shipped;
|
||||
}
|
||||
|
||||
const onChangeZone = async (zoneId) => {
|
||||
|
@ -138,7 +125,6 @@ const addressId = computed({
|
|||
formData.value.addressFk = val;
|
||||
onChangeAddress(val);
|
||||
getShipped({
|
||||
shipped: formData.value?.shipped,
|
||||
landed: formData.value?.landed,
|
||||
addressFk: val,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
|
@ -253,9 +239,6 @@ async function getZone(options) {
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: true,
|
||||
}"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
|
@ -279,6 +262,8 @@ async function getZone(options) {
|
|||
<VnSelect
|
||||
:label="t('ticketList.client')"
|
||||
v-model="clientId"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
url="Clients"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="id"
|
||||
|
@ -298,7 +283,7 @@ async function getZone(options) {
|
|||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
:label="t('basicData.warehouse')"
|
||||
:label="t('ticketList.warehouse')"
|
||||
v-model="warehouseId"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
@ -306,38 +291,23 @@ async function getZone(options) {
|
|||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:rules="validate('basicData.warehouse')"
|
||||
:rules="validate('ticketList.warehouse')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md no-wrap">
|
||||
<VnSelect
|
||||
:label="t('basicData.address')"
|
||||
v-model="addressId"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:options="addresses"
|
||||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:sort-by="['isActive DESC']"
|
||||
:rules="validate('basicData.address')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem
|
||||
v-bind="scope.itemProps"
|
||||
:class="{ disabled: !scope.opt.isActive }"
|
||||
>
|
||||
<QItemSection style="min-width: min-content" avatar>
|
||||
<QIcon
|
||||
v-if="
|
||||
scope.opt.isActive &&
|
||||
formData.client.defaultAddressFk === scope.opt.id
|
||||
"
|
||||
size="sm"
|
||||
color="grey"
|
||||
name="star"
|
||||
class="fill-icon"
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel
|
||||
:class="{
|
||||
|
@ -363,9 +333,6 @@ async function getZone(options) {
|
|||
{{ scope.opt?.agencyMode?.name }}</span
|
||||
>
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `#${scope.opt?.id}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
@ -447,6 +414,13 @@ async function getZone(options) {
|
|||
:rules="validate('ticketList.shipped')"
|
||||
@update:model-value="setShipped"
|
||||
/>
|
||||
<VnInputTime
|
||||
:label="t('basicData.shippedHour')"
|
||||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
:rules="validate('basicData.shippedHour')"
|
||||
@update:model-value="setShipped"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('basicData.landed')"
|
||||
v-model="formData.landed"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
|
@ -29,29 +30,31 @@ const { t } = useI18n();
|
|||
const router = useRouter();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const newTicketFormData = reactive({});
|
||||
const date = new Date();
|
||||
|
||||
async function createTicket(formData) {
|
||||
const createTicket = async () => {
|
||||
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
|
||||
const params = {
|
||||
clientId: $props.ticket.clientFk,
|
||||
landed: formData.landed,
|
||||
landed: newTicketFormData.landed,
|
||||
warehouseId: $props.ticket.warehouseFk,
|
||||
addressId: $props.ticket.addressFk,
|
||||
agencyModeId: $props.ticket.agencyModeFk,
|
||||
routeId: formData.routeFk,
|
||||
routeId: newTicketFormData.routeFk,
|
||||
expeditionIds: expeditionIds,
|
||||
};
|
||||
|
||||
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormModelPopup
|
||||
model="expeditionNewTicket"
|
||||
:form-initial-data="{}"
|
||||
:form-initial-data="newTicketFormData"
|
||||
:save-fn="createTicket"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
|
|
|
@ -20,7 +20,6 @@ export default {
|
|||
'isFreezed',
|
||||
'isTaxDataChecked',
|
||||
'hasElectronicInvoice',
|
||||
'defaultAddressFk',
|
||||
'credit',
|
||||
],
|
||||
include: [
|
||||
|
|
|
@ -55,75 +55,73 @@ async function handleSave(e) {
|
|||
auto-load
|
||||
url="ObservationTypes"
|
||||
/>
|
||||
<div class="full-width flex justify-center">
|
||||
<QPage class="card-width q-pa-lg">
|
||||
<CrudModel
|
||||
class="fit"
|
||||
ref="ticketNotesCrudRef"
|
||||
data-key="TicketNotes"
|
||||
url="TicketObservations"
|
||||
model="TicketNotes"
|
||||
:filter="crudModelFilter"
|
||||
:data-required="crudModelRequiredData"
|
||||
:default-remove="false"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QCard class="q-px-lg q-py-md">
|
||||
<div
|
||||
v-for="(row, index) in rows"
|
||||
:key="index"
|
||||
class="q-mb-md row items-center q-gutter-x-md"
|
||||
<div class="flex justify-center">
|
||||
<CrudModel
|
||||
ref="ticketNotesCrudRef"
|
||||
data-key="TicketNotes"
|
||||
url="TicketObservations"
|
||||
model="TicketNotes"
|
||||
:filter="crudModelFilter"
|
||||
:data-required="crudModelRequiredData"
|
||||
:default-remove="false"
|
||||
auto-load
|
||||
style="max-width: 800px"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QCard class="q-px-lg q-py-md">
|
||||
<div
|
||||
v-for="(row, index) in rows"
|
||||
:key="index"
|
||||
class="q-mb-md row q-gutter-x-md"
|
||||
>
|
||||
<VnSelect
|
||||
:label="t('ticketNotes.observationType')"
|
||||
:options="observationTypes"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
v-model="row.observationTypeFk"
|
||||
:disable="!!row.id"
|
||||
data-cy="ticketNotesObservationType"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('basicData.description')"
|
||||
v-model="row.description"
|
||||
class="col"
|
||||
@keydown.enter.stop="handleSave"
|
||||
autogrow
|
||||
data-cy="ticketNotesDescription"
|
||||
/>
|
||||
<QIcon
|
||||
name="delete"
|
||||
size="sm"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="handleDelete(row)"
|
||||
data-cy="ticketNotesRemoveNoteBtn"
|
||||
>
|
||||
<VnSelect
|
||||
:label="t('ticketNotes.observationType')"
|
||||
:options="observationTypes"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
v-model="row.observationTypeFk"
|
||||
:disable="!!row.id"
|
||||
data-cy="ticketNotesObservationType"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('basicData.description')"
|
||||
v-model="row.description"
|
||||
class="col"
|
||||
@keydown.enter.stop="handleSave"
|
||||
autogrow
|
||||
data-cy="ticketNotesDescription"
|
||||
/>
|
||||
<QIcon
|
||||
name="delete"
|
||||
size="sm"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="handleDelete(row)"
|
||||
data-cy="ticketNotesRemoveNoteBtn"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticketNotes.removeNote') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnRow v-if="observationTypes.length > rows.length">
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
class="fill-icon-on-hover q-ml-md"
|
||||
color="primary"
|
||||
@click="ticketNotesCrudRef.insert()"
|
||||
data-cy="ticketNotesAddNoteBtn"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticketNotes.addNote') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</VnRow>
|
||||
</QCard>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</QPage>
|
||||
<QTooltip>
|
||||
{{ t('ticketNotes.removeNote') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnRow v-if="observationTypes.length > rows.length">
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
class="fill-icon-on-hover q-ml-md"
|
||||
color="primary"
|
||||
@click="ticketNotesCrudRef.insert()"
|
||||
data-cy="ticketNotesAddNoteBtn"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticketNotes.addNote') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</VnRow>
|
||||
</QCard>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -49,95 +49,88 @@ watch(
|
|||
<FetchData
|
||||
@on-fetch="(data) => (listPackagingsOptions = data)"
|
||||
auto-load
|
||||
:filter="{ fields: ['packagingFk', 'name'], order: 'name ASC' }"
|
||||
url="Packagings/listPackaging"
|
||||
:filter="{
|
||||
fields: ['packagingFk', 'name'],
|
||||
order: ['name ASC'],
|
||||
}"
|
||||
/>
|
||||
<div class="full-width flex justify-center">
|
||||
<QPage class="card-width q-pa-lg">
|
||||
<CrudModel
|
||||
ref="ticketPackagingsCrudRef"
|
||||
data-key="TicketPackagings"
|
||||
url="TicketPackagings"
|
||||
model="TicketPackagings"
|
||||
:filter="crudModelFilter"
|
||||
:data-required="crudModelRequiredData"
|
||||
:default-remove="false"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows, validate }">
|
||||
<QCard class="q-px-lg q-py-md">
|
||||
<div
|
||||
v-for="(row, index) in rows"
|
||||
:key="index"
|
||||
class="q-mb-md row items-center q-gutter-x-md"
|
||||
<div class="flex justify-center">
|
||||
<CrudModel
|
||||
ref="ticketPackagingsCrudRef"
|
||||
data-key="TicketPackagings"
|
||||
url="TicketPackagings"
|
||||
model="TicketPackagings"
|
||||
:filter="crudModelFilter"
|
||||
:data-required="crudModelRequiredData"
|
||||
:default-remove="false"
|
||||
auto-load
|
||||
style="max-width: 800px"
|
||||
>
|
||||
<template #body="{ rows, validate }">
|
||||
<QCard class="q-px-lg q-py-md">
|
||||
<div
|
||||
v-for="(row, index) in rows"
|
||||
:key="index"
|
||||
class="q-mb-md row items-center q-gutter-x-md"
|
||||
>
|
||||
<VnSelect
|
||||
:label="t('package.package')"
|
||||
:options="listPackagingsOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="packagingFk"
|
||||
v-model="row.packagingFk"
|
||||
>
|
||||
<VnSelect
|
||||
:label="t('package.package')"
|
||||
:options="listPackagingsOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="packagingFk"
|
||||
v-model="row.packagingFk"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.name }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
#{{ scope.opt?.itemFk }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnInput
|
||||
:label="t('basicData.quantity')"
|
||||
v-model.number="row.quantity"
|
||||
class="col"
|
||||
type="number"
|
||||
min="1"
|
||||
:required="true"
|
||||
@update:model-value="handleInputQuantityClear(row)"
|
||||
:rules="validate('TicketPackaging.quantity')"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('package.added')"
|
||||
v-model="row.created"
|
||||
/>
|
||||
<QIcon
|
||||
name="delete"
|
||||
size="sm"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="ticketPackagingsCrudRef.remove([row])"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('package.removePackage') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnRow>
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
class="fill-icon-on-hover q-ml-md"
|
||||
color="primary"
|
||||
@click="ticketPackagingsCrudRef.insert()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('package.addPackage') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</VnRow>
|
||||
</QCard>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</QPage>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.name }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
#{{ scope.opt?.itemFk }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnInput
|
||||
:label="t('basicData.quantity')"
|
||||
v-model.number="row.quantity"
|
||||
class="col"
|
||||
type="number"
|
||||
min="1"
|
||||
:required="true"
|
||||
@update:model-value="handleInputQuantityClear(row)"
|
||||
:rules="validate('TicketPackaging.quantity')"
|
||||
/>
|
||||
<VnInputDate :label="t('package.added')" v-model="row.created" />
|
||||
<QIcon
|
||||
name="delete"
|
||||
size="sm"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="ticketPackagingsCrudRef.remove([row])"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('package.removePackage') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnRow>
|
||||
<QBtn
|
||||
icon="add_circle"
|
||||
v-shortcut="'+'"
|
||||
flat
|
||||
class="fill-icon-on-hover q-ml-md"
|
||||
color="primary"
|
||||
@click="ticketPackagingsCrudRef.insert()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('package.addPackage') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</VnRow>
|
||||
</QCard>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -47,14 +47,7 @@ const setUserParams = (params) => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehouses = data)"
|
||||
:where="{
|
||||
isForTicket: true,
|
||||
}"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
||||
<FetchData
|
||||
url="ItemCategories"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||
|
@ -137,6 +130,8 @@ const setUserParams = (params) => {
|
|||
($event) => onCategoryChange($event, searchFn)
|
||||
"
|
||||
:options="categoriesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
filled
|
||||
|
@ -150,7 +145,10 @@ const setUserParams = (params) => {
|
|||
<VnSelect
|
||||
:label="t('negative.type')"
|
||||
v-model="params.typeFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="itemTypesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
filled
|
||||
|
|
|
@ -121,7 +121,7 @@ const ticketColumns = computed(() => [
|
|||
format: (row, dashIfEmpty) => dashIfEmpty(row.lines),
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
label: t('advanceTickets.import'),
|
||||
name: 'totalWithVat',
|
||||
hidden: true,
|
||||
|
@ -172,15 +172,6 @@ const ticketColumns = computed(() => [
|
|||
headerClass: 'horizontal-separator',
|
||||
name: 'futureLiters',
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.preparation'),
|
||||
name: 'futurePreparation',
|
||||
field: 'futurePreparation',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
headerClass: 'horizontal-separator',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('advanceTickets.futureZone'),
|
||||
|
@ -205,17 +196,15 @@ const ticketColumns = computed(() => [
|
|||
label: t('advanceTickets.notMovableLines'),
|
||||
headerClass: 'horizontal-separator',
|
||||
name: 'notMovableLines',
|
||||
class: 'shrink',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('advanceTickets.futureLines'),
|
||||
headerClass: 'horizontal-separator',
|
||||
name: 'futureLines',
|
||||
class: 'shrink',
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
align: 'left',
|
||||
label: t('advanceTickets.futureImport'),
|
||||
name: 'futureTotalWithVat',
|
||||
hidden: true,
|
||||
|
@ -396,12 +385,7 @@ watch(
|
|||
if (!$el) return;
|
||||
const head = $el.querySelector('thead');
|
||||
const firstRow = $el.querySelector('thead > tr');
|
||||
const headSelectionCol = $el.querySelector(
|
||||
'thead tr.bg-header th.q-table--col-auto-width',
|
||||
);
|
||||
if (headSelectionCol) {
|
||||
headSelectionCol.classList.add('horizontal-separator');
|
||||
}
|
||||
|
||||
const newRow = document.createElement('tr');
|
||||
destinationElRef.value = document.createElement('th');
|
||||
originElRef.value = document.createElement('th');
|
||||
|
@ -410,10 +394,8 @@ watch(
|
|||
destinationElRef.value.classList.add('text-uppercase', 'color-vn-label');
|
||||
originElRef.value.classList.add('text-uppercase', 'color-vn-label');
|
||||
|
||||
originElRef.value.classList.add('advance-icon');
|
||||
|
||||
destinationElRef.value.setAttribute('colspan', '9');
|
||||
originElRef.value.setAttribute('colspan', '11');
|
||||
destinationElRef.value.setAttribute('colspan', '7');
|
||||
originElRef.value.setAttribute('colspan', '9');
|
||||
|
||||
destinationElRef.value.textContent = `${t(
|
||||
'advanceTickets.destination',
|
||||
|
@ -508,6 +490,8 @@ watch(
|
|||
selection: 'multiple',
|
||||
}"
|
||||
v-model:selected="selectedTickets"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
:no-data-label="$t('globals.noResults')"
|
||||
:right-search="false"
|
||||
:order="['futureTotalWithVat ASC']"
|
||||
auto-load
|
||||
|
|
|
@ -51,9 +51,6 @@ onMounted(async () => await getItemPackingTypes());
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: true,
|
||||
}"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel
|
||||
|
@ -68,7 +65,7 @@ onMounted(async () => await getItemPackingTypes());
|
|||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
|
@ -96,10 +93,12 @@ onMounted(async () => await getItemPackingTypes());
|
|||
option-value="code"
|
||||
option-label="description"
|
||||
:info="t('iptInfo')"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
filled
|
||||
:use-like="false"
|
||||
/>
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -111,10 +110,12 @@ onMounted(async () => await getItemPackingTypes());
|
|||
option-value="code"
|
||||
option-label="description"
|
||||
:info="t('iptInfo')"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
filled
|
||||
:use-like="false"
|
||||
/>
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -133,6 +134,7 @@ onMounted(async () => await getItemPackingTypes());
|
|||
:label="t('params.isFullMovable')"
|
||||
v-model="params.isFullMovable"
|
||||
toggle-indeterminate
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
/>
|
||||
</QItemSection>
|
||||
|
@ -155,9 +157,13 @@ onMounted(async () => await getItemPackingTypes());
|
|||
:label="t('params.warehouseFk')"
|
||||
v-model="params.warehouseFk"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
filled
|
||||
/>
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -166,6 +172,7 @@ onMounted(async () => await getItemPackingTypes());
|
|||
toggle-indeterminate
|
||||
:label="t('params.onlyWithDestination')"
|
||||
v-model="params.onlyWithDestination"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
/>
|
||||
</QItemSection>
|
||||
|
|
|
@ -67,12 +67,14 @@ const onClientSelected = async (formData) => {
|
|||
|
||||
const fetchAvailableAgencies = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
const response = await getAgencies(formData, selectedClient.value);
|
||||
const response= await getAgencies(formData, selectedClient.value);
|
||||
if (!response) return;
|
||||
|
||||
const { options, agency } = response;
|
||||
if (options) agenciesOptions.value = options;
|
||||
if (agency) formData.agencyModeId = agency;
|
||||
|
||||
const { options, agency } = response
|
||||
if(options)
|
||||
agenciesOptions.value = options;
|
||||
if(agency)
|
||||
formData.agencyModeId = agency;
|
||||
};
|
||||
|
||||
const redirectToTicketList = (_, { id }) => {
|
||||
|
@ -90,9 +92,6 @@ const redirectToTicketList = (_, { id }) => {
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: true,
|
||||
}"
|
||||
order="name"
|
||||
auto-load
|
||||
/>
|
||||
|
|
|
@ -40,7 +40,7 @@ onBeforeMount(async () => {
|
|||
|
||||
function resetAgenciesSelector(formData) {
|
||||
agenciesOptions.value = [];
|
||||
if (formData) formData.agencyModeId = null;
|
||||
if(formData) formData.agencyModeId = null;
|
||||
}
|
||||
|
||||
const fetchClient = async (formData) => {
|
||||
|
@ -67,12 +67,14 @@ const onClientSelected = async (formData) => {
|
|||
|
||||
const fetchAvailableAgencies = async (formData) => {
|
||||
resetAgenciesSelector(formData);
|
||||
const response = await getAgencies(formData, selectedClient.value);
|
||||
const response= await getAgencies(formData, selectedClient.value);
|
||||
if (!response) return;
|
||||
|
||||
const { options, agency } = response;
|
||||
if (options) agenciesOptions.value = options;
|
||||
if (agency) formData.agencyModeId = agency;
|
||||
|
||||
const { options, agency } = response
|
||||
if(options)
|
||||
agenciesOptions.value = options;
|
||||
if(agency)
|
||||
formData.agencyModeId = agency;
|
||||
};
|
||||
|
||||
const redirectToTicketList = (_, { id }) => {
|
||||
|
@ -84,9 +86,6 @@ const redirectToTicketList = (_, { id }) => {
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: true,
|
||||
}"
|
||||
order="name"
|
||||
auto-load
|
||||
/>
|
||||
|
|
|
@ -41,26 +41,15 @@ const groupedStates = ref([]);
|
|||
@on-fetch="(data) => (agencies = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehouses = data)"
|
||||
auto-load
|
||||
:where="{
|
||||
isForTicket: true,
|
||||
}"
|
||||
/>
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
:unremovableParams="['from', 'to']"
|
||||
>
|
||||
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput v-model="params.clientFk" :label="t('Customer ID')" filled />
|
||||
|
@ -108,7 +97,10 @@ const groupedStates = ref([]);
|
|||
<VnSelect
|
||||
:label="t('State')"
|
||||
v-model="params.stateFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="states"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
|
@ -125,6 +117,7 @@ const groupedStates = ref([]);
|
|||
<VnSelect
|
||||
:label="t('params.groupedStates')"
|
||||
v-model="params.groupedStates"
|
||||
@update:model-value="searchFn()"
|
||||
:options="groupedStates"
|
||||
option-label="code"
|
||||
emit-value
|
||||
|
@ -159,6 +152,7 @@ const groupedStates = ref([]);
|
|||
<QItemSection>
|
||||
<QCheckbox
|
||||
v-model="params.myTeam"
|
||||
@update:model-value="searchFn()"
|
||||
:label="t('My team')"
|
||||
toggle-indeterminate
|
||||
/>
|
||||
|
@ -166,6 +160,7 @@ const groupedStates = ref([]);
|
|||
<QItemSection>
|
||||
<QCheckbox
|
||||
v-model="params.pending"
|
||||
@update:model-value="searchFn()"
|
||||
:label="t('Pending')"
|
||||
toggle-indeterminate
|
||||
/>
|
||||
|
@ -175,6 +170,7 @@ const groupedStates = ref([]);
|
|||
<QItemSection>
|
||||
<QCheckbox
|
||||
v-model="params.hasInvoice"
|
||||
@update:model-value="searchFn()"
|
||||
:label="t('Invoiced')"
|
||||
toggle-indeterminate
|
||||
/>
|
||||
|
@ -182,6 +178,7 @@ const groupedStates = ref([]);
|
|||
<QItemSection>
|
||||
<QCheckbox
|
||||
v-model="params.hasRoute"
|
||||
@update:model-value="searchFn()"
|
||||
:label="t('Routed')"
|
||||
toggle-indeterminate
|
||||
/>
|
||||
|
@ -195,7 +192,10 @@ const groupedStates = ref([]);
|
|||
<VnSelect
|
||||
:label="t('Province')"
|
||||
v-model="params.provinceFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="provinces"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
|
@ -212,6 +212,7 @@ const groupedStates = ref([]);
|
|||
<VnSelect
|
||||
:label="t('Agency')"
|
||||
v-model="params.agencyModeFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="agencies"
|
||||
emit-value
|
||||
map-options
|
||||
|
@ -229,7 +230,10 @@ const groupedStates = ref([]);
|
|||
<VnSelect
|
||||
:label="t('Warehouse')"
|
||||
v-model="params.warehouseFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="warehouses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
|
|
|
@ -85,12 +85,11 @@ const ticketColumns = computed(() => [
|
|||
label: t('advanceTickets.liters'),
|
||||
name: 'liters',
|
||||
align: 'left',
|
||||
class: 'shrink',
|
||||
headerClass: 'horizontal-separator',
|
||||
},
|
||||
{
|
||||
label: t('advanceTickets.import'),
|
||||
name: 'totalWithVat',
|
||||
name: 'import',
|
||||
align: 'left',
|
||||
headerClass: 'horizontal-separator',
|
||||
columnFilter: false,
|
||||
|
@ -178,12 +177,7 @@ watch(
|
|||
if (!$el) return;
|
||||
const head = $el.querySelector('thead');
|
||||
const firstRow = $el.querySelector('thead > tr');
|
||||
const headSelectionCol = $el.querySelector(
|
||||
'thead tr.bg-header th.q-table--col-auto-width',
|
||||
);
|
||||
if (headSelectionCol) {
|
||||
headSelectionCol.classList.add('horizontal-separator');
|
||||
}
|
||||
|
||||
const newRow = document.createElement('tr');
|
||||
destinationElRef.value = document.createElement('th');
|
||||
originElRef.value = document.createElement('th');
|
||||
|
@ -191,10 +185,9 @@ watch(
|
|||
newRow.classList.add('bg-header');
|
||||
destinationElRef.value.classList.add('text-uppercase', 'color-vn-label');
|
||||
originElRef.value.classList.add('text-uppercase', 'color-vn-label');
|
||||
originElRef.value.classList.add('advance-icon');
|
||||
|
||||
destinationElRef.value.setAttribute('colspan', '9');
|
||||
originElRef.value.setAttribute('colspan', '7');
|
||||
destinationElRef.value.setAttribute('colspan', '7');
|
||||
originElRef.value.setAttribute('colspan', '9');
|
||||
|
||||
originElRef.value.textContent = `${t('advanceTickets.origin')}`;
|
||||
destinationElRef.value.textContent = `${t('advanceTickets.destination')}`;
|
||||
|
@ -324,7 +317,7 @@ watch(
|
|||
</QBadge>
|
||||
<span v-else> {{ dashIfEmpty(row.state) }}</span>
|
||||
</template>
|
||||
<template #column-totalWithVat="{ row }">
|
||||
<template #column-import="{ row }">
|
||||
<QBadge
|
||||
:text-color="
|
||||
totalPriceColor(row.totalWithVat) === 'warning'
|
||||
|
@ -378,12 +371,4 @@ watch(
|
|||
:deep(.horizontal-bottom-separator) {
|
||||
border-bottom: 4px solid white !important;
|
||||
}
|
||||
:deep(th.advance-icon::after) {
|
||||
content: '>>';
|
||||
font-size: larger;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
float: 0;
|
||||
left: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -55,9 +55,6 @@ onMounted(async () => {
|
|||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
:where="{
|
||||
isForTicket: true,
|
||||
}"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel
|
||||
|
@ -70,7 +67,7 @@ onMounted(async () => {
|
|||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
|
@ -116,9 +113,11 @@ onMounted(async () => {
|
|||
option-value="code"
|
||||
option-label="description"
|
||||
:info="t('iptInfo')"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
filled
|
||||
/>
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -130,9 +129,11 @@ onMounted(async () => {
|
|||
option-value="code"
|
||||
option-label="description"
|
||||
:info="t('iptInfo')"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
filled
|
||||
/>
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -141,9 +142,13 @@ onMounted(async () => {
|
|||
:label="t('params.state')"
|
||||
v-model="params.state"
|
||||
:options="stateOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
filled
|
||||
/>
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -152,9 +157,13 @@ onMounted(async () => {
|
|||
:label="t('params.futureState')"
|
||||
v-model="params.futureState"
|
||||
:options="stateOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
filled
|
||||
/>
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
||||
|
@ -164,6 +173,7 @@ onMounted(async () => {
|
|||
:label="t('params.problems')"
|
||||
v-model="params.problems"
|
||||
:toggle-indeterminate="false"
|
||||
@update:model-value="searchFn()"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -173,9 +183,13 @@ onMounted(async () => {
|
|||
:label="t('params.warehouseFk')"
|
||||
v-model="params.warehouseFk"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
filled
|
||||
/>
|
||||
>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
|
|
@ -204,9 +204,6 @@ const columns = computed(() => [
|
|||
attrs: {
|
||||
url: 'warehouses',
|
||||
fields: ['id', 'name'],
|
||||
where: {
|
||||
isForTicket: true,
|
||||
},
|
||||
},
|
||||
format: (row) => row.warehouse,
|
||||
columnField: {
|
||||
|
@ -582,7 +579,7 @@ function setReference(data) {
|
|||
hide-selected
|
||||
required
|
||||
@update:model-value="() => onClientSelected(data)"
|
||||
:sort-by="['id ASC']"
|
||||
:sort-by="'id ASC'"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -608,7 +605,7 @@ function setReference(data) {
|
|||
map-options
|
||||
required
|
||||
:disable="!data.clientId"
|
||||
:sort-by="['isActive DESC']"
|
||||
:sort-by="'isActive DESC'"
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
>
|
||||
<template #option="scope">
|
||||
|
@ -673,11 +670,9 @@ function setReference(data) {
|
|||
:sort-by="['name']"
|
||||
:label="t('globals.warehouse')"
|
||||
v-model="data.warehouseId"
|
||||
:options="warehousesOptions"
|
||||
hide-selected
|
||||
required
|
||||
:where="{
|
||||
isForTicket: true,
|
||||
}"
|
||||
@update:model-value="() => fetchAvailableAgencies(data)"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -102,9 +102,6 @@ const columns = computed(() => [
|
|||
attrs: {
|
||||
url: 'Warehouses',
|
||||
fields: ['id', 'name'],
|
||||
where: {
|
||||
isForTicket: true,
|
||||
},
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
|
|
|
@ -120,7 +120,6 @@ basicData:
|
|||
difference: Difference
|
||||
total: Total
|
||||
price: Price
|
||||
warehouse: Warehouse
|
||||
newPrice: New price
|
||||
chargeDifference: Charge difference to
|
||||
withoutNegatives: Create without negatives
|
||||
|
@ -209,7 +208,6 @@ ticketList:
|
|||
hour: Hour
|
||||
rounding: Rounding
|
||||
noVerifiedData: No verified data
|
||||
warehouse: Warehouse
|
||||
purchaseRequest: Purchase request
|
||||
notVisible: Not visible
|
||||
clientFrozen: Client frozen
|
||||
|
|
|
@ -47,7 +47,6 @@ basicData:
|
|||
difference: Diferencia
|
||||
total: Total
|
||||
price: Precio
|
||||
warehouse: Almacén
|
||||
newPrice: Nuevo precio
|
||||
chargeDifference: Cargar diferencia a
|
||||
withoutNegatives: Crear sin negativos
|
||||
|
|
|
@ -28,17 +28,13 @@ const warehousesOptionsIn = ref([]);
|
|||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptionsOut = data)"
|
||||
auto-load
|
||||
:where="{
|
||||
isOrigin: true,
|
||||
}"
|
||||
:filter="{ where: { isOrigin: TRUE } }"
|
||||
/>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptionsIn = data)"
|
||||
auto-load
|
||||
:where="{
|
||||
isDestiny: true,
|
||||
}"
|
||||
:filter="{ where: { isDestiny: TRUE } }"
|
||||
/>
|
||||
<FormModel :url-update="`Travels/${route.params.id}`" model="Travel">
|
||||
<template #form="{ data }">
|
||||
|
|
|
@ -13,8 +13,6 @@ export default {
|
|||
'daysInForward',
|
||||
'availabled',
|
||||
'awbFk',
|
||||
'isDelivered',
|
||||
'isReceived',
|
||||
],
|
||||
include: [
|
||||
{
|
||||
|
|
|
@ -182,7 +182,6 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
showValue: false,
|
||||
sortable: true,
|
||||
style: 'max-width: 200px;',
|
||||
},
|
||||
{
|
||||
label: t('globals.packages'),
|
||||
|
@ -207,7 +206,6 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
showValue: false,
|
||||
sortable: true,
|
||||
style: 'max-width: 75px;',
|
||||
},
|
||||
{
|
||||
label: t('extraCommunity.physicKg'),
|
||||
|
|
|
@ -183,9 +183,7 @@ warehouses();
|
|||
<VnSelect
|
||||
:label="t('extraCommunity.filter.warehouseOutFk')"
|
||||
v-model="params.warehouseOutFk"
|
||||
:options="
|
||||
warehousesOptions.filter((option) => option.isOrigin === true)
|
||||
"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
@ -199,11 +197,7 @@ warehouses();
|
|||
<VnSelect
|
||||
:label="t('extraCommunity.filter.warehouseInFk')"
|
||||
v-model="params.warehouseInFk"
|
||||
:options="
|
||||
warehousesOptions.filter(
|
||||
(option) => option.isDestiny === true,
|
||||
)
|
||||
"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
|
|
@ -81,9 +81,6 @@ const redirectToTravelBasicData = (_, { id }) => {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
:where="{
|
||||
isOrigin: true,
|
||||
}"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('globals.warehouseIn')"
|
||||
|
@ -92,9 +89,6 @@ const redirectToTravelBasicData = (_, { id }) => {
|
|||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
:where="{
|
||||
isDestiny: true,
|
||||
}"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
|
|
|
@ -64,9 +64,6 @@ defineExpose({ states });
|
|||
option-filter="name"
|
||||
dense
|
||||
filled
|
||||
:where="{
|
||||
isDestiny: true,
|
||||
}"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('travel.shipped')"
|
||||
|
@ -92,9 +89,6 @@ defineExpose({ states });
|
|||
option-filter="name"
|
||||
dense
|
||||
filled
|
||||
:where="{
|
||||
isOrigin: true,
|
||||
}"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('travel.landed')"
|
||||
|
|
|
@ -99,7 +99,6 @@ const columns = computed(() => [
|
|||
fields: ['id', 'name'],
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
where: { isDestiny: true },
|
||||
},
|
||||
format: (row) => row.warehouseInName,
|
||||
columnField: {
|
||||
|
@ -134,7 +133,6 @@ const columns = computed(() => [
|
|||
attrs: {
|
||||
url: 'warehouses',
|
||||
fields: ['id', 'name'],
|
||||
where: { isOrigin: true },
|
||||
},
|
||||
format: (row) => row.warehouseOutName,
|
||||
columnField: {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import { ref, nextTick } from 'vue';
|
||||
import { ref, nextTick, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -8,23 +9,21 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { useAdvancedSummary } from 'src/composables/useAdvancedSummary';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const { t } = useI18n();
|
||||
const form = ref();
|
||||
const educationLevels = ref([]);
|
||||
const countries = ref([]);
|
||||
const model = 'Worker';
|
||||
const maritalStatus = [
|
||||
{ code: 'M', name: t('Married') },
|
||||
{ code: 'S', name: t('Single') },
|
||||
];
|
||||
const route = useRoute();
|
||||
async function addAdvancedData(data) {
|
||||
const advanced = await useAdvancedSummary('Workers', route.params.id);
|
||||
data.value = { ...data.value, ...advanced };
|
||||
|
||||
onMounted(async () => {
|
||||
const advanced = await useAdvancedSummary('Workers', useRoute().params.id);
|
||||
Object.assign(form.value.formData, advanced);
|
||||
nextTick(() => (form.value.hasChanges = false));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -43,8 +42,7 @@ async function addAdvancedData(data) {
|
|||
ref="form"
|
||||
:url-update="`Workers/${$route.params.id}`"
|
||||
auto-load
|
||||
:model
|
||||
@on-fetch="(data, res, old, formData) => addAdvancedData(formData)"
|
||||
model="Worker"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
|
|
|
@ -11,7 +11,6 @@ import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
|
|||
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import useWeekdaysOrder from 'src/composables/getWeekdays';
|
||||
|
||||
const props = defineProps({
|
||||
year: {
|
||||
|
@ -45,7 +44,6 @@ const { locale } = useI18n();
|
|||
|
||||
const calendarRef = ref(null);
|
||||
const weekdayStore = useWeekdayStore();
|
||||
const weekDays = useWeekdaysOrder();
|
||||
const selectedDate = ref();
|
||||
const calendarEventDates = [];
|
||||
const today = ref(date.formatDate(Date.vnNew(), 'YYYY-MM-DD'));
|
||||
|
@ -184,7 +182,7 @@ watch(_year, (newValue) => {
|
|||
no-outside-days
|
||||
:selected-dates="calendarEventDates"
|
||||
no-active-date
|
||||
:weekdays="weekDays"
|
||||
:weekdays="[1, 2, 3, 4, 5, 6, 0]"
|
||||
short-weekday-label
|
||||
:locale="locale"
|
||||
:now="today"
|
||||
|
|
|
@ -4,11 +4,9 @@ import VnCard from 'src/components/common/VnCard.vue';
|
|||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
:data-key="$attrs['data-key'] ?? 'Worker'"
|
||||
data-key="Worker"
|
||||
url="Workers/summary"
|
||||
:id-in-where="true"
|
||||
:descriptor="WorkerDescriptor"
|
||||
v-bind="$attrs"
|
||||
v-on="$attrs"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { computed, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import EntityDescriptor from 'src/components/ui/EntityDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||
|
@ -10,8 +11,6 @@ import VnImg from 'src/components/ui/VnImg.vue';
|
|||
import EditPictureForm from 'components/EditPictureForm.vue';
|
||||
import WorkerDescriptorMenu from './WorkerDescriptorMenu.vue';
|
||||
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
||||
import WorkerCard from './WorkerCard.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -53,17 +52,14 @@ const handlePhotoUpdated = (evt = false) => {
|
|||
};
|
||||
</script>
|
||||
<template>
|
||||
<CardDescriptor
|
||||
v-bind="$attrs"
|
||||
<EntityDescriptor
|
||||
ref="cardDescriptorRef"
|
||||
:data-key="dataKey"
|
||||
:summary="$props.summary"
|
||||
:card="WorkerCard"
|
||||
:id="entityId"
|
||||
url="Workers/summary"
|
||||
:filter="{ where: { id: entityId } }"
|
||||
title="user.nickname"
|
||||
@on-fetch="getIsExcluded"
|
||||
module="Worker"
|
||||
>
|
||||
<template #menu="{ entity }">
|
||||
<WorkerDescriptorMenu
|
||||
|
@ -169,7 +165,7 @@ const handlePhotoUpdated = (evt = false) => {
|
|||
</QBtn>
|
||||
</QCardActions>
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
</EntityDescriptor>
|
||||
<VnChangePassword
|
||||
ref="changePassRef"
|
||||
:submit-fn="
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { onMounted, ref, computed, onBeforeMount, nextTick, reactive } from 'vue';
|
||||
import { axiosNoError } from 'src/boot/axios';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import WorkerTimeHourChip from 'pages/Worker/Card/WorkerTimeHourChip.vue';
|
||||
|
@ -281,10 +282,10 @@ const fetchWeekData = async () => {
|
|||
};
|
||||
try {
|
||||
const [{ data: mailData }, { data: countData }] = await Promise.all([
|
||||
axios.get(`Workers/${route.params.id}/mail`, {
|
||||
axiosNoError.get(`Workers/${route.params.id}/mail`, {
|
||||
params: { filter: { where } },
|
||||
}),
|
||||
axios.get('WorkerTimeControlMails/count', { params: { where } }),
|
||||
axiosNoError.get('WorkerTimeControlMails/count', { params: { where } }),
|
||||
]);
|
||||
|
||||
const mail = mailData[0];
|
||||
|
@ -292,9 +293,8 @@ const fetchWeekData = async () => {
|
|||
state.value = mail?.state;
|
||||
reason.value = mail?.reason;
|
||||
canResend.value = !!countData.count;
|
||||
} catch (error) {
|
||||
} catch {
|
||||
state.value = null;
|
||||
if (error?.status != 403) throw error;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -408,7 +408,7 @@ const isUnsatisfied = async (reason) => {
|
|||
|
||||
const resendEmail = async () => {
|
||||
const params = {
|
||||
recipient: worker.value?.user?.emailUser?.email,
|
||||
recipient: worker.value[0]?.user?.emailUser?.email,
|
||||
week: selectedWeekNumber.value,
|
||||
year: selectedDateYear.value,
|
||||
workerId: Number(route.params.id),
|
||||
|
|
|
@ -4,8 +4,6 @@ import { useI18n } from 'vue-i18n';
|
|||
|
||||
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
|
||||
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
|
||||
import useWeekdaysOrder from 'src/composables/getWeekdays';
|
||||
|
||||
const $props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
|
@ -34,7 +32,6 @@ const emit = defineEmits(['update:modelValue', 'clickDate', 'onMoved']);
|
|||
const { locale } = useI18n();
|
||||
|
||||
const calendarRef = ref(null);
|
||||
const weekDays = useWeekdaysOrder();
|
||||
|
||||
const stateClasses = {
|
||||
CONFIRMED: {
|
||||
|
@ -138,7 +135,7 @@ const paintWorkWeeks = async () => {
|
|||
ref="calendarRef"
|
||||
v-model="value"
|
||||
show-work-weeks
|
||||
:weekdays="weekDays"
|
||||
:weekdays="[1, 2, 3, 4, 5, 6, 0]"
|
||||
:selected-dates="selectedDates"
|
||||
:min-weekday-label="1"
|
||||
:locale="locale"
|
||||
|
|
|
@ -33,6 +33,14 @@ const getLocale = (label) => {
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput :label="t('FI')" v-model="params.fi" filled
|
||||
><template #prepend>
|
||||
<QIcon name="badge" size="xs"></QIcon> </template
|
||||
></VnInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput :label="t('First Name')" v-model="params.firstName" filled />
|
||||
|
@ -104,6 +112,7 @@ es:
|
|||
lastName: Apellidos
|
||||
userName: Usuario
|
||||
extension: Extensión
|
||||
FI: NIF
|
||||
First Name: Nombre
|
||||
Last Name: Apellidos
|
||||
User Name: Usuario
|
||||
|
|
|
@ -10,13 +10,15 @@ import VnRadio from 'src/components/common/VnRadio.vue';
|
|||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import WorkerFilter from './WorkerFilter.vue';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import axios from 'axios';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import VnBankDetailsForm from 'src/components/common/VnBankDetailsForm.vue';
|
||||
import VnInputBic from 'src/components/common/VnInputBic.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
|
@ -120,6 +122,12 @@ onBeforeMount(async () => {
|
|||
).data?.payMethodFk;
|
||||
});
|
||||
|
||||
async function handleNewBankEntity(data, resp) {
|
||||
await bankEntitiesRef.value.fetch();
|
||||
data.bankEntityFk = resp.id;
|
||||
bankEntitiesOptions.value.push(resp);
|
||||
}
|
||||
|
||||
function handleLocation(data, location) {
|
||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||
data.postcode = code;
|
||||
|
@ -315,20 +323,52 @@ function generateCodeUser(worker) {
|
|||
(val) => !val && delete data.payMethodFk
|
||||
"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnBankDetailsForm
|
||||
v-model:iban="data.iban"
|
||||
v-model:bankEntityFk="data.bankEntityFk"
|
||||
:disable-element="data.isFreelance"
|
||||
<VnInputBic
|
||||
:label="t('IBAN')"
|
||||
v-model="data.iban"
|
||||
:disable="data.isFreelance"
|
||||
@update-bic="
|
||||
({ iban, bankEntityFk }) => {
|
||||
data.iban = iban;
|
||||
data.bankEntityFk = bankEntityFk;
|
||||
}
|
||||
(bankEntityFk) => (data.bankEntityFk = bankEntityFk)
|
||||
"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelectDialog
|
||||
:label="t('worker.create.bankEntity')"
|
||||
v-model="data.bankEntityFk"
|
||||
:options="bankEntitiesOptions"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
hide-selected
|
||||
:acls="[
|
||||
{
|
||||
model: 'BankEntity',
|
||||
props: '*',
|
||||
accessType: 'WRITE',
|
||||
},
|
||||
]"
|
||||
:disable="data.isFreelance"
|
||||
:filter-options="['bic', 'name']"
|
||||
>
|
||||
<template #form>
|
||||
<CreateBankEntityForm
|
||||
@on-data-saved="
|
||||
(_, resp) => handleNewBankEntity(data, resp)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection v-if="scope.opt">
|
||||
<QItemLabel
|
||||
>{{ scope.opt.bic }}
|
||||
{{ scope.opt.name }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</VnRow>
|
||||
</div>
|
||||
</template>
|
||||
</VnTable>
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
<script setup>
|
||||
import { computed, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import WorkerSummary from './Card/WorkerSummary.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import WorkerManagementFilter from './WorkerManagementFilter.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const dataKey = 'ManagementList';
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
label: t('tableColumns.firstName'),
|
||||
name: 'firstName',
|
||||
isTitle: true,
|
||||
columnFilter: {
|
||||
name: 'firstName',
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('tableColumns.lastName'),
|
||||
name: 'lastName',
|
||||
columnFilter: {
|
||||
name: 'lastName',
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('management.NIF'),
|
||||
name: 'fi',
|
||||
columnFilter: {
|
||||
name: 'fi',
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('tableColumns.email'),
|
||||
name: 'email',
|
||||
columnFilter: {
|
||||
name: 'email',
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('management.ssn'),
|
||||
labelAbbreviation: t('management.ssn'),
|
||||
toolTip: t('management.completeSsn'),
|
||||
name: 'SSN',
|
||||
columnFilter: {
|
||||
name: 'SSN',
|
||||
},
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'departmentFk',
|
||||
label: t('tableColumns.department'),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
name: 'departmentFk',
|
||||
attrs: {
|
||||
url: 'Departments',
|
||||
},
|
||||
},
|
||||
cardVisible: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.department),
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('globals.pageTitles.summary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row?.id, WorkerSummary),
|
||||
isPrimary: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
onMounted(() => {
|
||||
const canAccess = useAcl().hasAcl('Worker', 'management', 'WRITE');
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<VnSearchbar
|
||||
:data-key
|
||||
url="Workers/filter"
|
||||
:label="t('management.search')"
|
||||
:info="t('management.searchInfo')"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<WorkerManagementFilter :data-key />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
url="Workers/filter"
|
||||
:columns="columns"
|
||||
:data-key
|
||||
:right-search="false"
|
||||
order="id DESC"
|
||||
/>
|
||||
</template>
|
|
@ -1,99 +0,0 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const departments = ref();
|
||||
|
||||
const getLocale = (label) => {
|
||||
const globalLocale = `globals.params.${label}`;
|
||||
return te(globalLocale) ? t(globalLocale) : t(`management.${label}`);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="Departments" @on-fetch="(data) => (departments = data)" auto-load />
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ getLocale(tag.label) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('tableColumns.firstName')"
|
||||
v-model="params.firstName"
|
||||
filled
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('tableColumns.lastName')"
|
||||
v-model="params.lastName"
|
||||
filled
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('management.NIF')"
|
||||
v-model="params.fi"
|
||||
filled
|
||||
data-cy="worker-filter-fi"
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="xs" />
|
||||
</template>
|
||||
</VnInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('tableColumns.email')"
|
||||
v-model="params.email"
|
||||
filled
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput :label="t('management.ssn')" v-model="params.SSN" filled />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('tableColumns.department')"
|
||||
v-model="params.departmentFk"
|
||||
:options="departments"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
dense
|
||||
filled
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue