Compare commits
No commits in common. "dev" and "8277-createEntryControl" have entirely different histories.
dev
...
8277-creat
|
@ -26,7 +26,7 @@ if (branchName) {
|
|||
const splitedMsg = msg.split(':');
|
||||
|
||||
if (splitedMsg.length > 1) {
|
||||
const finalMsg = `${splitedMsg[0]}: ${referenceTag}${splitedMsg.slice(1).join(':')}`;
|
||||
const finalMsg = splitedMsg[0] + ': ' + referenceTag + splitedMsg.slice(1).join(':');
|
||||
writeFileSync(msgPath, finalMsg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}'"
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import { defineConfig } from 'cypress';
|
||||
|
||||
let urlHost;
|
||||
let reporter;
|
||||
let reporterOptions;
|
||||
let timeouts;
|
||||
let urlHost, reporter, reporterOptions, timeouts;
|
||||
|
||||
if (process.env.CI) {
|
||||
urlHost = 'front';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= productName %></title>
|
||||
|
@ -12,12 +12,7 @@
|
|||
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>"
|
||||
/>
|
||||
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="128x128"
|
||||
href="icons/favicon-128x128.png"
|
||||
/>
|
||||
<link rel="icon" type="image/png" sizes="128x128" href="icons/favicon-128x128.png" />
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png" />
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable */
|
||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||
|
||||
import autoprefixer from 'autoprefixer';
|
||||
|
|
|
@ -13,7 +13,7 @@ import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
|||
import path from 'path';
|
||||
const target = `http://${process.env.CI ? 'back' : 'localhost'}:3000`;
|
||||
|
||||
export default configure((/* ctx */) => {
|
||||
export default configure(function (/* ctx */) {
|
||||
return {
|
||||
eslint: {
|
||||
// fix: true,
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{
|
||||
"@quasar/testing-unit-vitest": {
|
||||
"options": ["scripts"]
|
||||
"options": [
|
||||
"scripts"
|
||||
]
|
||||
},
|
||||
"@quasar/qcalendar": {}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ export default function (component, key, value) {
|
|||
};
|
||||
break;
|
||||
case 'undefined':
|
||||
throw new Error(`unknown prop: ${key}`);
|
||||
throw new Error('unknown prop: ' + key);
|
||||
default:
|
||||
throw new Error(`unhandled type: ${typeof prop}`);
|
||||
throw new Error('unhandled type: ' + typeof prop);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ export default {
|
|||
const keyBindingMap = routes
|
||||
.filter((route) => route.meta.keyBinding)
|
||||
.reduce((map, route) => {
|
||||
map[`Key${route.meta.keyBinding.toUpperCase()}`] = route.path;
|
||||
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||
return map;
|
||||
}, {});
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable eslint/export */
|
||||
export * from './defaults/qTable';
|
||||
export * from './defaults/qInput';
|
||||
export * from './defaults/qSelect';
|
||||
|
|
|
@ -24,9 +24,12 @@ export default boot(({ app }) => {
|
|||
switch (response?.status) {
|
||||
case 422:
|
||||
if (error.name == 'ValidationError')
|
||||
message += ` "${responseError.details.context}.${Object.keys(
|
||||
responseError.details.codes,
|
||||
).join(',')}"`;
|
||||
message +=
|
||||
' "' +
|
||||
responseError.details.context +
|
||||
'.' +
|
||||
Object.keys(responseError.details.codes).join(',') +
|
||||
'"';
|
||||
break;
|
||||
case 500:
|
||||
message = 'errors.statusInternalServerError';
|
||||
|
|
|
@ -25,7 +25,7 @@ const autonomiesRef = ref([]);
|
|||
|
||||
const onDataSaved = (dataSaved, requestResponse) => {
|
||||
requestResponse.autonomy = autonomiesRef.value.opts.find(
|
||||
(autonomy) => autonomy.id == requestResponse.autonomyFk,
|
||||
(autonomy) => autonomy.id == requestResponse.autonomyFk
|
||||
);
|
||||
emit('onDataSaved', dataSaved, requestResponse);
|
||||
};
|
||||
|
|
|
@ -347,16 +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"
|
||||
|
|
|
@ -1,154 +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,16 +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"
|
||||
|
|
|
@ -26,7 +26,7 @@ async function redirect() {
|
|||
|
||||
if (route?.params?.id)
|
||||
return (window.location.href = await getUrl(
|
||||
`${section}/${route.params.id}/summary`,
|
||||
`${section}/${route.params.id}/summary`
|
||||
));
|
||||
return (window.location.href = await getUrl(section + '/index'));
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ const refund = async () => {
|
|||
(data) => (
|
||||
(rectificativeTypeOptions = data),
|
||||
(invoiceParams.cplusRectificationTypeFk = data.filter(
|
||||
(type) => type.description == 'I – Por diferencias',
|
||||
(type) => type.description == 'I – Por diferencias'
|
||||
)[0].id)
|
||||
)
|
||||
"
|
||||
|
@ -68,7 +68,7 @@ const refund = async () => {
|
|||
(data) => (
|
||||
(siiTypeInvoiceOutsOptions = data),
|
||||
(invoiceParams.siiTypeInvoiceOutFk = data.filter(
|
||||
(type) => type.code == 'R4',
|
||||
(type) => type.code == 'R4'
|
||||
)[0].id)
|
||||
)
|
||||
"
|
||||
|
|
|
@ -40,9 +40,6 @@ const onDataSaved = (data) => {
|
|||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
auto-load
|
||||
:where="{
|
||||
isInventory: true,
|
||||
}"
|
||||
/>
|
||||
<FormModelPopup
|
||||
url-create="Items/regularize"
|
||||
|
|
|
@ -52,7 +52,7 @@ watch(
|
|||
} else filter.value.where = {};
|
||||
await provincesFetchDataRef.value.fetch({});
|
||||
emit('onProvinceFetched', provincesOptions.value);
|
||||
},
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
@ -333,7 +326,6 @@ function stopEventPropagation(event) {
|
|||
|
||||
function reload(params) {
|
||||
selected.value = [];
|
||||
selectAll.value = false;
|
||||
CrudModelRef.value.reload(params);
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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>
|
||||
|
|
|
@ -6,7 +6,7 @@ export default function (initialFooter, data) {
|
|||
});
|
||||
return acc;
|
||||
},
|
||||
{ ...initialFooter },
|
||||
{ ...initialFooter }
|
||||
);
|
||||
return footer;
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ describe('CrudModel', () => {
|
|||
|
||||
await vm.saveChanges(data);
|
||||
|
||||
expect(postMock).toHaveBeenCalledWith(`${vm.url}/crud`, data);
|
||||
expect(postMock).toHaveBeenCalledWith(vm.url + '/crud', data);
|
||||
expect(vm.isLoading).toBe(false);
|
||||
expect(vm.hasChanges).toBe(false);
|
||||
expect(vm.originalData).toEqual(JSON.parse(JSON.stringify(vm.formData)));
|
||||
|
|
|
@ -142,14 +142,14 @@ describe('getRoutes', () => {
|
|||
const fn = (props) => getRoutes(props, getMethodA, getMethodB);
|
||||
|
||||
it('should call getMethodB when source is card', () => {
|
||||
const props = { source: 'methodB' };
|
||||
let props = { source: 'methodB' };
|
||||
fn(props);
|
||||
|
||||
expect(getMethodB).toHaveBeenCalled();
|
||||
expect(getMethodA).not.toHaveBeenCalled();
|
||||
});
|
||||
it('should call getMethodA when source is main', () => {
|
||||
const props = { source: 'methodA' };
|
||||
let props = { source: 'methodA' };
|
||||
fn(props);
|
||||
|
||||
expect(getMethodA).toHaveBeenCalled();
|
||||
|
@ -157,7 +157,7 @@ describe('getRoutes', () => {
|
|||
});
|
||||
|
||||
it('should call getMethodA when source is not exists or undefined', () => {
|
||||
const props = { source: 'methodC' };
|
||||
let props = { source: 'methodC' };
|
||||
expect(() => fn(props)).toThrowError('Method not defined');
|
||||
|
||||
expect(getMethodA).not.toHaveBeenCalled();
|
||||
|
|
|
@ -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>
|
|
@ -15,7 +15,7 @@ let root = ref(null);
|
|||
|
||||
watchEffect(() => {
|
||||
matched.value = currentRoute.value.matched.filter(
|
||||
(matched) => !!matched?.meta?.title || !!matched?.meta?.icon,
|
||||
(matched) => !!matched?.meta?.title || !!matched?.meta?.icon
|
||||
);
|
||||
breadcrumbs.value.length = 0;
|
||||
if (!matched.value[0]) return;
|
||||
|
|
|
@ -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>
|
|
@ -21,7 +21,7 @@ watch(
|
|||
(newValue) => {
|
||||
if (!modelValue.value) return;
|
||||
modelValue.value = formatLocation(newValue) ?? null;
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const mixinRules = [requiredFieldRule];
|
||||
|
@ -45,7 +45,7 @@ const formatLocation = (obj, properties = locationProperties) => {
|
|||
});
|
||||
|
||||
const filteredParts = parts.filter(
|
||||
(part) => part !== null && part !== undefined && part !== '',
|
||||
(part) => part !== null && part !== undefined && part !== ''
|
||||
);
|
||||
|
||||
return filteredParts.join(', ');
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
scrollTarget: { type: [String, Object], default: 'window' },
|
||||
scrollTarget: { type: [String, Object], default: 'window' }
|
||||
});
|
||||
|
||||
const scrollPosition = ref(0);
|
||||
|
@ -39,7 +39,7 @@ const updateScrollContainer = (container) => {
|
|||
};
|
||||
|
||||
defineExpose({
|
||||
updateScrollContainer,
|
||||
updateScrollContainer
|
||||
});
|
||||
|
||||
const initScrollContainer = async () => {
|
||||
|
@ -51,10 +51,11 @@ const initScrollContainer = async () => {
|
|||
scrollContainer = window;
|
||||
}
|
||||
|
||||
if (!scrollContainer) return;
|
||||
if (!scrollContainer) return
|
||||
scrollContainer.addEventListener('scroll', onScroll);
|
||||
};
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
initScrollContainer();
|
||||
});
|
||||
|
@ -96,3 +97,4 @@ onUnmounted(() => {
|
|||
filter: brightness(0.8);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
|
@ -35,7 +35,7 @@ describe('VnSmsDialog', () => {
|
|||
expect.objectContaining({
|
||||
message: 'You must enter a new password',
|
||||
type: 'negative',
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -47,7 +47,7 @@ describe('VnSmsDialog', () => {
|
|||
expect.objectContaining({
|
||||
message: `Passwords don't match`,
|
||||
type: 'negative',
|
||||
}),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -25,9 +25,6 @@ describe('VnDmsList', () => {
|
|||
deleteModel: 'WorkerDms',
|
||||
downloadModel: 'WorkerDms',
|
||||
},
|
||||
global: {
|
||||
stubs: ['VnUserLink'],
|
||||
},
|
||||
}).vm;
|
||||
});
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ function buildComponent(data) {
|
|||
return createWrapper(VnLocation, {
|
||||
global: {
|
||||
props: {
|
||||
location: data,
|
||||
},
|
||||
location: data
|
||||
}
|
||||
},
|
||||
}).vm;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ describe('formatLocation', () => {
|
|||
postcode: '46680',
|
||||
city: 'Algemesi',
|
||||
province: { name: 'Valencia' },
|
||||
country: { name: 'Spain' },
|
||||
country: { name: 'Spain' }
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -47,12 +47,7 @@ describe('formatLocation', () => {
|
|||
});
|
||||
|
||||
it('should return the country', () => {
|
||||
const location = {
|
||||
...locationBase,
|
||||
postcode: undefined,
|
||||
city: undefined,
|
||||
province: undefined,
|
||||
};
|
||||
const location = { ...locationBase, postcode: undefined, city: undefined, province: undefined };
|
||||
const vm = buildComponent(location);
|
||||
expect(vm.formatLocation(location)).toEqual('Spain');
|
||||
});
|
||||
|
@ -66,7 +61,7 @@ describe('showLabel', () => {
|
|||
code: '46680',
|
||||
town: 'Algemesi',
|
||||
province: 'Valencia',
|
||||
country: 'Spain',
|
||||
country: 'Spain'
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -89,12 +84,7 @@ describe('showLabel', () => {
|
|||
});
|
||||
|
||||
it('should show the label with country', () => {
|
||||
const location = {
|
||||
...locationBase,
|
||||
code: undefined,
|
||||
town: undefined,
|
||||
province: undefined,
|
||||
};
|
||||
const location = { ...locationBase, code: undefined, town: undefined, province: undefined };
|
||||
const vm = buildComponent(location);
|
||||
expect(vm.showLabel(location)).toEqual('Spain');
|
||||
});
|
||||
|
|
|
@ -90,7 +90,7 @@ describe('VnLog', () => {
|
|||
|
||||
vm = createWrapper(VnLog, {
|
||||
global: {
|
||||
stubs: ['FetchData', 'vue-i18n', 'VnUserLink'],
|
||||
stubs: ['FetchData', 'vue-i18n'],
|
||||
mocks: {
|
||||
fetch: vi.fn(),
|
||||
},
|
||||
|
|
|
@ -2,14 +2,13 @@ import { createWrapper } from 'app/test/vitest/helper';
|
|||
import VnSmsDialog from 'components/common/VnSmsDialog.vue';
|
||||
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||
|
||||
|
||||
describe('VnSmsDialog', () => {
|
||||
let vm;
|
||||
const orderId = 1;
|
||||
const shipped = new Date();
|
||||
const phone = '012345678';
|
||||
const promise = (response) => {
|
||||
return response;
|
||||
};
|
||||
const promise = (response) => {return response;};
|
||||
const template = 'minAmount';
|
||||
const locale = 'en';
|
||||
|
||||
|
@ -18,13 +17,13 @@ describe('VnSmsDialog', () => {
|
|||
propsData: {
|
||||
data: {
|
||||
orderId,
|
||||
shipped,
|
||||
shipped
|
||||
},
|
||||
template,
|
||||
locale,
|
||||
phone,
|
||||
promise,
|
||||
},
|
||||
promise
|
||||
}
|
||||
}).vm;
|
||||
});
|
||||
|
||||
|
@ -36,9 +35,7 @@ describe('VnSmsDialog', () => {
|
|||
it('should update the message value with the correct template and parameters', () => {
|
||||
vm.updateMessage();
|
||||
|
||||
expect(vm.message).toEqual(
|
||||
`A minimum amount of 50€ (VAT excluded) is required for your order ${orderId} of ${shipped} to receive it without additional shipping costs.`,
|
||||
);
|
||||
expect(vm.message).toEqual(`A minimum amount of 50€ (VAT excluded) is required for your order ${orderId} of ${shipped} to receive it without additional shipping costs.`);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -50,7 +47,7 @@ describe('VnSmsDialog', () => {
|
|||
orderId,
|
||||
shipped,
|
||||
destination: phone,
|
||||
message: vm.message,
|
||||
message: vm.message
|
||||
};
|
||||
await vm.send();
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -17,7 +17,7 @@ const token = getTokenMultimedia();
|
|||
const { t } = useI18n();
|
||||
|
||||
const src = computed(
|
||||
() => `/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`,
|
||||
() => `/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`
|
||||
);
|
||||
const title = computed(() => $props.title?.toUpperCase() || t('globals.system'));
|
||||
const showLetter = ref(false);
|
||||
|
|
|
@ -13,7 +13,7 @@ const src = computed({
|
|||
get() {
|
||||
return new URL(
|
||||
`../../assets/${$props.logo}${Dark.isActive ? '_dark' : ''}.svg`,
|
||||
import.meta.url,
|
||||
import.meta.url
|
||||
).href;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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,24 +33,18 @@ 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();
|
||||
|
||||
const defaultObservationType = computed(
|
||||
() => observationTypes.value.find((ot) => ot.code === 'salesPerson')?.id,
|
||||
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,44 +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"
|
||||
|
@ -220,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"
|
||||
|
@ -249,7 +205,9 @@ async function saveAndGo() {
|
|||
class="show"
|
||||
v-bind="$attrs"
|
||||
:search-url="false"
|
||||
@on-fetch="newNote.text = ''"
|
||||
@on-fetch="
|
||||
newNote.text = '';
|
||||
"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<TransitionGroup name="list" tag="div" class="column items-center full-width">
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -87,7 +87,7 @@ function formatNumber(number) {
|
|||
<QItemLabel caption>{{
|
||||
date.formatDate(
|
||||
row.sms.created,
|
||||
'YYYY-MM-DD HH:mm:ss',
|
||||
'YYYY-MM-DD HH:mm:ss'
|
||||
)
|
||||
}}</QItemLabel>
|
||||
<QItemLabel class="row center">
|
||||
|
|
|
@ -37,7 +37,8 @@ onBeforeUnmount(() => stateStore.toggleSubToolbar() && hasSubToolbar);
|
|||
class="justify-end sticky"
|
||||
>
|
||||
<slot name="st-data">
|
||||
<div id="st-data" :class="{ 'full-width': !actionsChildCount() }"></div>
|
||||
<div id="st-data" :class="{ 'full-width': !actionsChildCount() }">
|
||||
</div>
|
||||
</slot>
|
||||
<QSpace />
|
||||
<slot name="st-actions">
|
||||
|
|
|
@ -1,38 +1,18 @@
|
|||
<script setup>
|
||||
import AccountDescriptorProxy from 'src/pages/Account/Card/AccountDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import { ref, onMounted } from 'vue';
|
||||
import axios from 'axios';
|
||||
const $props = defineProps({
|
||||
|
||||
defineProps({
|
||||
name: { type: String, default: null },
|
||||
tag: { type: String, default: null },
|
||||
workerId: { type: Number, default: null },
|
||||
defaultName: { type: Boolean, default: false },
|
||||
});
|
||||
const isWorker = ref(false);
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const {
|
||||
data: { exists },
|
||||
} = await axios(`/Workers/${$props.workerId}/exists`);
|
||||
isWorker.value = exists;
|
||||
} catch (error) {
|
||||
if (error.status === 403) return;
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<slot name="link">
|
||||
<span :class="{ link: workerId }">
|
||||
{{ defaultName ? (name ?? $t('globals.system')) : name }}
|
||||
{{ defaultName ? name ?? $t('globals.system') : name }}
|
||||
</span>
|
||||
</slot>
|
||||
<WorkerDescriptorProxy
|
||||
v-if="isWorker"
|
||||
:id="workerId"
|
||||
@on-fetch="(data) => (isWorker = data?.workerId !== undefined)"
|
||||
/>
|
||||
<AccountDescriptorProxy v-else :id="workerId" />
|
||||
<WorkerDescriptorProxy v-if="workerId" :id="workerId" />
|
||||
</template>
|
||||
|
|
|
@ -12,12 +12,12 @@ function generateWrapper(storage = 'images') {
|
|||
id: 123,
|
||||
zoomResolution: '400x400',
|
||||
storage,
|
||||
},
|
||||
}
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
vm.timeStamp = 'timestamp';
|
||||
}
|
||||
};
|
||||
|
||||
vi.mock('src/composables/useSession', () => ({
|
||||
useSession: () => ({
|
||||
|
@ -31,6 +31,7 @@ vi.mock('src/composables/useRole', () => ({
|
|||
}),
|
||||
}));
|
||||
|
||||
|
||||
describe('VnImg', () => {
|
||||
beforeEach(() => {
|
||||
isEmployeeMock.mockReset();
|
||||
|
@ -62,9 +63,7 @@ describe('VnImg', () => {
|
|||
generateWrapper();
|
||||
await vm.$nextTick();
|
||||
const url = vm.getUrl();
|
||||
expect(url).toBe(
|
||||
'/api/images/catalog/200x200/123/download?access_token=token×tamp',
|
||||
);
|
||||
expect(url).toBe('/api/images/catalog/200x200/123/download?access_token=token×tamp');
|
||||
});
|
||||
|
||||
it('should return /api/{storage}/{collection}/{curResolution}/{id}/download?access_token={token}&{timeStamp} when zoom is true and role is employee and storage is not dms', async () => {
|
||||
|
@ -72,9 +71,7 @@ describe('VnImg', () => {
|
|||
generateWrapper();
|
||||
await vm.$nextTick();
|
||||
const url = vm.getUrl(true);
|
||||
expect(url).toBe(
|
||||
'/api/images/catalog/400x400/123/download?access_token=token×tamp',
|
||||
);
|
||||
expect(url).toBe('/api/images/catalog/400x400/123/download?access_token=token×tamp');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -53,26 +53,26 @@ describe('useAcl', () => {
|
|||
expect(
|
||||
acl.hasAny([
|
||||
{ model: 'Worker', props: 'updateAttributes', accessType: 'WRITE' },
|
||||
]),
|
||||
])
|
||||
).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return false if no roles matched', async () => {
|
||||
expect(
|
||||
acl.hasAny([{ model: 'Worker', props: 'holidays', accessType: 'READ' }]),
|
||||
acl.hasAny([{ model: 'Worker', props: 'holidays', accessType: 'READ' }])
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
describe('*', () => {
|
||||
it('should return true if an acl matched', async () => {
|
||||
expect(
|
||||
acl.hasAny([{ model: 'Address', props: '*', accessType: 'WRITE' }]),
|
||||
acl.hasAny([{ model: 'Address', props: '*', accessType: 'WRITE' }])
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return false if no acls matched', async () => {
|
||||
expect(
|
||||
acl.hasAny([{ model: 'Worker', props: '*', accessType: 'READ' }]),
|
||||
acl.hasAny([{ model: 'Worker', props: '*', accessType: 'READ' }])
|
||||
).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
@ -80,15 +80,13 @@ describe('useAcl', () => {
|
|||
describe('$authenticated', () => {
|
||||
it('should return false if no acls matched', async () => {
|
||||
expect(
|
||||
acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: '*' }]),
|
||||
acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: '*' }])
|
||||
).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return true if an acl matched', async () => {
|
||||
expect(
|
||||
acl.hasAny([
|
||||
{ model: 'Url', props: 'getByUser', accessType: 'READ' },
|
||||
]),
|
||||
acl.hasAny([{ model: 'Url', props: 'getByUser', accessType: 'READ' }])
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@ -98,7 +96,7 @@ describe('useAcl', () => {
|
|||
expect(
|
||||
acl.hasAny([
|
||||
{ model: 'TpvTransaction', props: 'start', accessType: 'READ' },
|
||||
]),
|
||||
])
|
||||
).toBeFalsy();
|
||||
});
|
||||
|
||||
|
@ -106,7 +104,7 @@ describe('useAcl', () => {
|
|||
expect(
|
||||
acl.hasAny([
|
||||
{ model: 'TpvTransaction', props: 'start', accessType: 'WRITE' },
|
||||
]),
|
||||
])
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,7 +18,7 @@ export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile',
|
|||
|
||||
export async function downloadDocuware(url, params) {
|
||||
const appUrl = await getAppUrl();
|
||||
const response = await axios.get(`${appUrl}/api/${url}`, {
|
||||
const response = await axios.get(`${appUrl}/api/` + url, {
|
||||
responseType: 'blob',
|
||||
params,
|
||||
});
|
||||
|
|
|
@ -20,5 +20,5 @@ export function getColAlign(col) {
|
|||
|
||||
if (/^is[A-Z]/.test(col.name) || /^has[A-Z]/.test(col.name)) align = 'center';
|
||||
|
||||
return `text-${align ?? 'center'}`;
|
||||
return 'text-' + (align ?? 'center');
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
export function getDateQBadgeColor(date) {
|
||||
const today = Date.vnNew();
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const timeTicket = new Date(date);
|
||||
let timeTicket = new Date(date);
|
||||
timeTicket.setHours(0, 0, 0, 0);
|
||||
|
||||
const comparation = today - timeTicket;
|
||||
let comparation = today - timeTicket;
|
||||
|
||||
if (comparation == 0) return 'warning';
|
||||
if (comparation < 0) return 'success';
|
||||
|
|
|
@ -1,9 +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);
|
||||
}
|
|
@ -7,7 +7,7 @@ export async function beforeSave(data, getChanges, modelOrigin) {
|
|||
const patchPromises = [];
|
||||
|
||||
for (const change of changes) {
|
||||
const patchData = {};
|
||||
let patchData = {};
|
||||
|
||||
if ('hasMinPrice' in change.data) {
|
||||
patchData.hasMinPrice = change.data?.hasMinPrice;
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,4 +3,5 @@ import { useQuasar } from 'quasar';
|
|||
export default function() {
|
||||
const quasar = useQuasar();
|
||||
return quasar.screen.gt.xs ? 'q-pa-md': 'q-pa-xs';
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ export function djb2a(string) {
|
|||
}
|
||||
|
||||
export function useColor(value) {
|
||||
return `#${colors[djb2a(value || '') % colors.length]}`;
|
||||
return '#' + colors[djb2a(value || '') % colors.length];
|
||||
}
|
||||
|
||||
const colors = [
|
||||
|
|
|
@ -15,16 +15,18 @@ export function usePrintService() {
|
|||
message: t('globals.notificationSent'),
|
||||
type: 'positive',
|
||||
icon: 'check',
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
function openReport(path, params, isNewTab = '_self') {
|
||||
if (typeof params === 'string') params = JSON.parse(params);
|
||||
params = {
|
||||
params = Object.assign(
|
||||
{
|
||||
access_token: getTokenMultimedia(),
|
||||
...params,
|
||||
};
|
||||
},
|
||||
params
|
||||
);
|
||||
|
||||
const query = new URLSearchParams(params).toString();
|
||||
window.open(`api/${path}?${query}`, isNewTab);
|
||||
|
|
|
@ -17,7 +17,7 @@ export function useSession() {
|
|||
let intervalId = null;
|
||||
|
||||
function setSession(data) {
|
||||
const keepLogin = data.keepLogin;
|
||||
let keepLogin = data.keepLogin;
|
||||
const storage = keepLogin ? localStorage : sessionStorage;
|
||||
storage.setItem(TOKEN, data.token);
|
||||
storage.setItem(TOKEN_MULTIMEDIA, data.tokenMultimedia);
|
||||
|
|
|
@ -8,7 +8,7 @@ export function useVnConfirm() {
|
|||
message,
|
||||
promise,
|
||||
successFn,
|
||||
customHTML = {},
|
||||
customHTML = {}
|
||||
) => {
|
||||
const { component, props } = customHTML;
|
||||
Dialog.create({
|
||||
|
@ -19,7 +19,7 @@ export function useVnConfirm() {
|
|||
message: message,
|
||||
promise: promise,
|
||||
},
|
||||
{ customHTML: () => h(component, props) },
|
||||
{ customHTML: () => h(component, props) }
|
||||
),
|
||||
}).onOk(async () => {
|
||||
if (successFn) successFn();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,8 +1,7 @@
|
|||
@font-face {
|
||||
font-family: 'icon';
|
||||
src: url('fonts/icon.eot?uocffs');
|
||||
src:
|
||||
url('fonts/icon.eot?uocffs#iefix') format('embedded-opentype'),
|
||||
src: url('fonts/icon.eot?uocffs#iefix') format('embedded-opentype'),
|
||||
url('fonts/icon.ttf?uocffs') format('truetype'),
|
||||
url('fonts/icon.woff?uocffs') format('woff'),
|
||||
url('fonts/icon.svg?uocffs#icon') format('svg');
|
||||
|
@ -11,8 +10,7 @@
|
|||
font-display: block;
|
||||
}
|
||||
|
||||
[class^='icon-'],
|
||||
[class*=' icon-'] {
|
||||
[class^="icon-"], [class*=" icon-"] {
|
||||
/* use !important to prevent issues with browser extensions that change fonts */
|
||||
font-family: 'icon' !important;
|
||||
speak: never;
|
||||
|
@ -28,428 +26,428 @@
|
|||
}
|
||||
|
||||
.icon-inactive-car:before {
|
||||
content: '\e978';
|
||||
content: "\e978";
|
||||
}
|
||||
.icon-hasItemLost:before {
|
||||
content: '\e957';
|
||||
content: "\e957";
|
||||
}
|
||||
.icon-hasItemDelay:before {
|
||||
content: '\e96d';
|
||||
content: "\e96d";
|
||||
}
|
||||
.icon-add_entries:before {
|
||||
content: '\e953';
|
||||
content: "\e953";
|
||||
}
|
||||
.icon-100:before {
|
||||
content: '\e901';
|
||||
content: "\e901";
|
||||
}
|
||||
.icon-Client_unpaid:before {
|
||||
content: '\e98c';
|
||||
content: "\e98c";
|
||||
}
|
||||
.icon-History:before {
|
||||
content: '\e902';
|
||||
content: "\e902";
|
||||
}
|
||||
.icon-Person:before {
|
||||
content: '\e903';
|
||||
content: "\e903";
|
||||
}
|
||||
.icon-accessory:before {
|
||||
content: '\e904';
|
||||
content: "\e904";
|
||||
}
|
||||
.icon-account:before {
|
||||
content: '\e905';
|
||||
content: "\e905";
|
||||
}
|
||||
.icon-actions:before {
|
||||
content: '\e907';
|
||||
content: "\e907";
|
||||
}
|
||||
.icon-addperson:before {
|
||||
content: '\e908';
|
||||
content: "\e908";
|
||||
}
|
||||
.icon-agencia_tributaria:before {
|
||||
content: '\e948';
|
||||
content: "\e948";
|
||||
}
|
||||
.icon-agency:before {
|
||||
content: '\e92a';
|
||||
content: "\e92a";
|
||||
}
|
||||
.icon-agency-term:before {
|
||||
content: '\e909';
|
||||
content: "\e909";
|
||||
}
|
||||
.icon-albaran:before {
|
||||
content: '\e92c';
|
||||
content: "\e92c";
|
||||
}
|
||||
.icon-anonymous:before {
|
||||
content: '\e90b';
|
||||
content: "\e90b";
|
||||
}
|
||||
.icon-apps:before {
|
||||
content: '\e90c';
|
||||
content: "\e90c";
|
||||
}
|
||||
.icon-artificial:before {
|
||||
content: '\e90d';
|
||||
content: "\e90d";
|
||||
}
|
||||
.icon-attach:before {
|
||||
content: '\e90e';
|
||||
content: "\e90e";
|
||||
}
|
||||
.icon-barcode:before {
|
||||
content: '\e90f';
|
||||
content: "\e90f";
|
||||
}
|
||||
.icon-basket:before {
|
||||
content: '\e910';
|
||||
content: "\e910";
|
||||
}
|
||||
.icon-basketadd:before {
|
||||
content: '\e911';
|
||||
content: "\e911";
|
||||
}
|
||||
.icon-bin:before {
|
||||
content: '\e913';
|
||||
content: "\e913";
|
||||
}
|
||||
.icon-botanical:before {
|
||||
content: '\e914';
|
||||
content: "\e914";
|
||||
}
|
||||
.icon-bucket:before {
|
||||
content: '\e915';
|
||||
content: "\e915";
|
||||
}
|
||||
.icon-buscaman:before {
|
||||
content: '\e916';
|
||||
content: "\e916";
|
||||
}
|
||||
.icon-buyrequest:before {
|
||||
content: '\e917';
|
||||
content: "\e917";
|
||||
}
|
||||
.icon-calc_volum .path1:before {
|
||||
content: '\e918';
|
||||
content: "\e918";
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path2:before {
|
||||
content: '\e919';
|
||||
content: "\e919";
|
||||
margin-left: -1em;
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path3:before {
|
||||
content: '\e91c';
|
||||
content: "\e91c";
|
||||
margin-left: -1em;
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path4:before {
|
||||
content: '\e91d';
|
||||
content: "\e91d";
|
||||
margin-left: -1em;
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path5:before {
|
||||
content: '\e91e';
|
||||
content: "\e91e";
|
||||
margin-left: -1em;
|
||||
color: rgb(0, 0, 0);
|
||||
}
|
||||
.icon-calc_volum .path6:before {
|
||||
content: '\e91f';
|
||||
content: "\e91f";
|
||||
margin-left: -1em;
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
.icon-calendar:before {
|
||||
content: '\e920';
|
||||
content: "\e920";
|
||||
}
|
||||
.icon-catalog:before {
|
||||
content: '\e921';
|
||||
content: "\e921";
|
||||
}
|
||||
.icon-claims:before {
|
||||
content: '\e922';
|
||||
content: "\e922";
|
||||
}
|
||||
.icon-client:before {
|
||||
content: '\e923';
|
||||
content: "\e923";
|
||||
}
|
||||
.icon-clone:before {
|
||||
content: '\e924';
|
||||
content: "\e924";
|
||||
}
|
||||
.icon-columnadd:before {
|
||||
content: '\e925';
|
||||
content: "\e925";
|
||||
}
|
||||
.icon-columndelete:before {
|
||||
content: '\e926';
|
||||
content: "\e926";
|
||||
}
|
||||
.icon-components:before {
|
||||
content: '\e927';
|
||||
content: "\e927";
|
||||
}
|
||||
.icon-consignatarios:before {
|
||||
content: '\e928';
|
||||
content: "\e928";
|
||||
}
|
||||
.icon-control:before {
|
||||
content: '\e929';
|
||||
content: "\e929";
|
||||
}
|
||||
.icon-credit:before {
|
||||
content: '\e92b';
|
||||
content: "\e92b";
|
||||
}
|
||||
.icon-defaulter:before {
|
||||
content: '\e92d';
|
||||
content: "\e92d";
|
||||
}
|
||||
.icon-deletedTicket:before {
|
||||
content: '\e92e';
|
||||
content: "\e92e";
|
||||
}
|
||||
.icon-deleteline:before {
|
||||
content: '\e92f';
|
||||
content: "\e92f";
|
||||
}
|
||||
.icon-delivery:before {
|
||||
content: '\e930';
|
||||
content: "\e930";
|
||||
}
|
||||
.icon-deliveryprices:before {
|
||||
content: '\e932';
|
||||
content: "\e932";
|
||||
}
|
||||
.icon-details:before {
|
||||
content: '\e933';
|
||||
content: "\e933";
|
||||
}
|
||||
.icon-dfiscales:before {
|
||||
content: '\e934';
|
||||
content: "\e934";
|
||||
}
|
||||
.icon-disabled:before {
|
||||
content: '\e935';
|
||||
content: "\e935";
|
||||
}
|
||||
.icon-doc:before {
|
||||
content: '\e936';
|
||||
content: "\e936";
|
||||
}
|
||||
.icon-entry:before {
|
||||
content: '\e937';
|
||||
content: "\e937";
|
||||
}
|
||||
.icon-entry_lastbuys:before {
|
||||
content: '\e91a';
|
||||
content: "\e91a";
|
||||
}
|
||||
.icon-exit:before {
|
||||
content: '\e938';
|
||||
content: "\e938";
|
||||
}
|
||||
.icon-eye:before {
|
||||
content: '\e939';
|
||||
content: "\e939";
|
||||
}
|
||||
.icon-fixedPrice:before {
|
||||
content: '\e93a';
|
||||
content: "\e93a";
|
||||
}
|
||||
.icon-flower:before {
|
||||
content: '\e93b';
|
||||
content: "\e93b";
|
||||
}
|
||||
.icon-frozen:before {
|
||||
content: '\e93c';
|
||||
content: "\e93c";
|
||||
}
|
||||
.icon-fruit:before {
|
||||
content: '\e93d';
|
||||
content: "\e93d";
|
||||
}
|
||||
.icon-funeral:before {
|
||||
content: '\e93e';
|
||||
content: "\e93e";
|
||||
}
|
||||
.icon-grafana:before {
|
||||
content: '\e906';
|
||||
content: "\e906";
|
||||
}
|
||||
.icon-greenery:before {
|
||||
content: '\e93f';
|
||||
content: "\e93f";
|
||||
}
|
||||
.icon-greuge:before {
|
||||
content: '\e940';
|
||||
content: "\e940";
|
||||
}
|
||||
.icon-grid:before {
|
||||
content: '\e941';
|
||||
content: "\e941";
|
||||
}
|
||||
.icon-handmade:before {
|
||||
content: '\e942';
|
||||
content: "\e942";
|
||||
}
|
||||
.icon-handmadeArtificial:before {
|
||||
content: '\e943';
|
||||
content: "\e943";
|
||||
}
|
||||
.icon-headercol:before {
|
||||
content: '\e945';
|
||||
content: "\e945";
|
||||
}
|
||||
.icon-info:before {
|
||||
content: '\e946';
|
||||
content: "\e946";
|
||||
}
|
||||
.icon-inventory:before {
|
||||
content: '\e947';
|
||||
content: "\e947";
|
||||
}
|
||||
.icon-invoice:before {
|
||||
content: '\e968';
|
||||
content: "\e968";
|
||||
color: #5f5f5f;
|
||||
}
|
||||
.icon-invoice-in:before {
|
||||
content: '\e949';
|
||||
content: "\e949";
|
||||
}
|
||||
.icon-invoice-in-create:before {
|
||||
content: '\e94a';
|
||||
content: "\e94a";
|
||||
}
|
||||
.icon-invoice-out:before {
|
||||
content: '\e94b';
|
||||
content: "\e94b";
|
||||
}
|
||||
.icon-isTooLittle:before {
|
||||
content: '\e94c';
|
||||
content: "\e94c";
|
||||
}
|
||||
.icon-item:before {
|
||||
content: '\e94d';
|
||||
content: "\e94d";
|
||||
}
|
||||
.icon-languaje:before {
|
||||
content: '\e970';
|
||||
content: "\e970";
|
||||
}
|
||||
.icon-lines:before {
|
||||
content: '\e94e';
|
||||
content: "\e94e";
|
||||
}
|
||||
.icon-linesprepaired:before {
|
||||
content: '\e94f';
|
||||
content: "\e94f";
|
||||
}
|
||||
.icon-link-to-corrected:before {
|
||||
content: '\e931';
|
||||
content: "\e931";
|
||||
}
|
||||
.icon-link-to-correcting:before {
|
||||
content: '\e944';
|
||||
content: "\e944";
|
||||
}
|
||||
.icon-logout:before {
|
||||
content: '\e973';
|
||||
content: "\e973";
|
||||
}
|
||||
.icon-mana:before {
|
||||
content: '\e950';
|
||||
content: "\e950";
|
||||
}
|
||||
.icon-mandatory:before {
|
||||
content: '\e951';
|
||||
content: "\e951";
|
||||
}
|
||||
.icon-net:before {
|
||||
content: '\e952';
|
||||
content: "\e952";
|
||||
}
|
||||
.icon-newalbaran:before {
|
||||
content: '\e954';
|
||||
content: "\e954";
|
||||
}
|
||||
.icon-niche:before {
|
||||
content: '\e955';
|
||||
content: "\e955";
|
||||
}
|
||||
.icon-no036:before {
|
||||
content: '\e956';
|
||||
content: "\e956";
|
||||
}
|
||||
.icon-noPayMethod:before {
|
||||
content: '\e958';
|
||||
content: "\e958";
|
||||
}
|
||||
.icon-notes:before {
|
||||
content: '\e959';
|
||||
content: "\e959";
|
||||
}
|
||||
.icon-noweb:before {
|
||||
content: '\e95a';
|
||||
content: "\e95a";
|
||||
}
|
||||
.icon-onlinepayment:before {
|
||||
content: '\e95b';
|
||||
content: "\e95b";
|
||||
}
|
||||
.icon-package:before {
|
||||
content: '\e95c';
|
||||
content: "\e95c";
|
||||
}
|
||||
.icon-payment:before {
|
||||
content: '\e95d';
|
||||
content: "\e95d";
|
||||
}
|
||||
.icon-pbx:before {
|
||||
content: '\e95e';
|
||||
content: "\e95e";
|
||||
}
|
||||
.icon-pets:before {
|
||||
content: '\e95f';
|
||||
content: "\e95f";
|
||||
}
|
||||
.icon-photo:before {
|
||||
content: '\e960';
|
||||
content: "\e960";
|
||||
}
|
||||
.icon-plant:before {
|
||||
content: '\e961';
|
||||
content: "\e961";
|
||||
}
|
||||
.icon-polizon:before {
|
||||
content: '\e962';
|
||||
content: "\e962";
|
||||
}
|
||||
.icon-preserved:before {
|
||||
content: '\e963';
|
||||
content: "\e963";
|
||||
}
|
||||
.icon-recovery:before {
|
||||
content: '\e964';
|
||||
content: "\e964";
|
||||
}
|
||||
.icon-regentry:before {
|
||||
content: '\e965';
|
||||
content: "\e965";
|
||||
}
|
||||
.icon-reserva:before {
|
||||
content: '\e966';
|
||||
content: "\e966";
|
||||
}
|
||||
.icon-revision:before {
|
||||
content: '\e967';
|
||||
content: "\e967";
|
||||
}
|
||||
.icon-risk:before {
|
||||
content: '\e969';
|
||||
content: "\e969";
|
||||
}
|
||||
.icon-saysimple:before {
|
||||
content: '\e912';
|
||||
content: "\e912";
|
||||
}
|
||||
.icon-services:before {
|
||||
content: '\e96a';
|
||||
content: "\e96a";
|
||||
}
|
||||
.icon-settings:before {
|
||||
content: '\e96b';
|
||||
content: "\e96b";
|
||||
}
|
||||
.icon-shipment:before {
|
||||
content: '\e96c';
|
||||
content: "\e96c";
|
||||
}
|
||||
.icon-sign:before {
|
||||
content: '\e90a';
|
||||
content: "\e90a";
|
||||
}
|
||||
.icon-sms:before {
|
||||
content: '\e96e';
|
||||
content: "\e96e";
|
||||
}
|
||||
.icon-solclaim:before {
|
||||
content: '\e96f';
|
||||
content: "\e96f";
|
||||
}
|
||||
.icon-solunion:before {
|
||||
content: '\e971';
|
||||
content: "\e971";
|
||||
}
|
||||
.icon-splitline:before {
|
||||
content: '\e972';
|
||||
content: "\e972";
|
||||
}
|
||||
.icon-splur:before {
|
||||
content: '\e974';
|
||||
content: "\e974";
|
||||
}
|
||||
.icon-stowaway:before {
|
||||
content: '\e975';
|
||||
content: "\e975";
|
||||
}
|
||||
.icon-supplier:before {
|
||||
content: '\e976';
|
||||
content: "\e976";
|
||||
}
|
||||
.icon-supplierfalse:before {
|
||||
content: '\e977';
|
||||
content: "\e977";
|
||||
}
|
||||
.icon-tags:before {
|
||||
content: '\e979';
|
||||
content: "\e979";
|
||||
}
|
||||
.icon-tax:before {
|
||||
content: '\e97a';
|
||||
content: "\e97a";
|
||||
}
|
||||
.icon-thermometer:before {
|
||||
content: '\e97b';
|
||||
content: "\e97b";
|
||||
}
|
||||
.icon-ticket:before {
|
||||
content: '\e97c';
|
||||
content: "\e97c";
|
||||
}
|
||||
.icon-ticketAdd:before {
|
||||
content: '\e97e';
|
||||
content: "\e97e";
|
||||
}
|
||||
.icon-traceability:before {
|
||||
content: '\e97f';
|
||||
content: "\e97f";
|
||||
}
|
||||
.icon-transaction:before {
|
||||
content: '\e91b';
|
||||
content: "\e91b";
|
||||
}
|
||||
.icon-treatments:before {
|
||||
content: '\e980';
|
||||
content: "\e980";
|
||||
}
|
||||
.icon-trolley:before {
|
||||
content: '\e900';
|
||||
content: "\e900";
|
||||
}
|
||||
.icon-troncales:before {
|
||||
content: '\e982';
|
||||
content: "\e982";
|
||||
}
|
||||
.icon-unavailable:before {
|
||||
content: '\e983';
|
||||
content: "\e983";
|
||||
}
|
||||
.icon-visible_columns:before {
|
||||
content: '\e984';
|
||||
content: "\e984";
|
||||
}
|
||||
.icon-volume:before {
|
||||
content: '\e985';
|
||||
content: "\e985";
|
||||
}
|
||||
.icon-wand:before {
|
||||
content: '\e986';
|
||||
content: "\e986";
|
||||
}
|
||||
.icon-web:before {
|
||||
content: '\e987';
|
||||
content: "\e987";
|
||||
}
|
||||
.icon-wiki:before {
|
||||
content: '\e989';
|
||||
content: "\e989";
|
||||
}
|
||||
.icon-worker:before {
|
||||
content: '\e98a';
|
||||
content: "\e98a";
|
||||
}
|
||||
.icon-zone:before {
|
||||
content: '\e98b';
|
||||
content: "\e98b";
|
||||
}
|
||||
|
|
|
@ -30,12 +30,10 @@ export function isValidDate(date) {
|
|||
export function toDateFormat(date, locale = 'es-ES', opts = {}) {
|
||||
if (!isValidDate(date)) return '';
|
||||
|
||||
const format = {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
...opts,
|
||||
};
|
||||
const format = Object.assign(
|
||||
{ year: 'numeric', month: '2-digit', day: '2-digit' },
|
||||
opts
|
||||
);
|
||||
return new Date(date).toLocaleDateString(locale, format);
|
||||
}
|
||||
|
||||
|
@ -106,17 +104,17 @@ export function secondsToHoursMinutes(seconds, includeHSuffix = true) {
|
|||
const hours = Math.floor(seconds / 3600);
|
||||
const remainingMinutes = seconds % 3600;
|
||||
const minutes = Math.floor(remainingMinutes / 60);
|
||||
const formattedHours = hours < 10 ? `0${hours}` : hours;
|
||||
const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes;
|
||||
const formattedHours = hours < 10 ? '0' + hours : hours;
|
||||
const formattedMinutes = minutes < 10 ? '0' + minutes : minutes;
|
||||
|
||||
// Append "h." if includeHSuffix is true
|
||||
const suffix = includeHSuffix ? ' h.' : '';
|
||||
// Return formatted string
|
||||
return `${formattedHours}:${formattedMinutes}${suffix}`;
|
||||
return formattedHours + ':' + formattedMinutes + suffix;
|
||||
}
|
||||
|
||||
export function getTimeDifferenceWithToday(date) {
|
||||
const today = Date.vnNew();
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
date = new Date(date);
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* @return {Object} The fields as object
|
||||
*/
|
||||
function fieldsToObject(fields) {
|
||||
const fieldsObj = {};
|
||||
let fieldsObj = {};
|
||||
|
||||
if (Array.isArray(fields)) {
|
||||
for (const field of fields) fieldsObj[field] = true;
|
||||
for (let field of fields) fieldsObj[field] = true;
|
||||
} else if (typeof fields == 'object') {
|
||||
for (const field in fields) {
|
||||
for (let field in fields) {
|
||||
if (fields[field]) fieldsObj[field] = true;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ function fieldsToObject(fields) {
|
|||
* @return {Array} The merged fields as an array
|
||||
*/
|
||||
function mergeFields(src, dst) {
|
||||
const fields = {};
|
||||
let fields = {};
|
||||
Object.assign(fields, fieldsToObject(src), fieldsToObject(dst));
|
||||
return Object.keys(fields);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ function mergeFields(src, dst) {
|
|||
* @return {Array} The merged wheres
|
||||
*/
|
||||
function mergeWhere(src, dst) {
|
||||
const and = [];
|
||||
let and = [];
|
||||
if (src) and.push(src);
|
||||
if (dst) and.push(dst);
|
||||
return simplifyOperation(and, 'and');
|
||||
|
@ -53,7 +53,7 @@ function mergeWhere(src, dst) {
|
|||
* @return {Object} The result filter
|
||||
*/
|
||||
function mergeFilters(src, dst) {
|
||||
const res = { ...dst };
|
||||
let res = Object.assign({}, dst);
|
||||
|
||||
if (!src) return res;
|
||||
|
||||
|
@ -80,12 +80,12 @@ function simplifyOperation(operation, operator) {
|
|||
}
|
||||
|
||||
function buildFilter(params, builderFunc) {
|
||||
const and = [];
|
||||
let and = [];
|
||||
|
||||
for (const param in params) {
|
||||
const value = params[param];
|
||||
for (let param in params) {
|
||||
let value = params[param];
|
||||
if (value == null) continue;
|
||||
const expr = builderFunc(param, value);
|
||||
let expr = builderFunc(param, value);
|
||||
if (expr) and.push(expr);
|
||||
}
|
||||
return simplifyOperation(and, 'and');
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
export default function getDifferences(obj1, obj2) {
|
||||
const diff = {};
|
||||
let diff = {};
|
||||
delete obj1.$index;
|
||||
delete obj2.$index;
|
||||
|
||||
for (const key in obj1) {
|
||||
for (let key in obj1) {
|
||||
if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
|
||||
diff[key] = obj2[key];
|
||||
}
|
||||
}
|
||||
for (const key in obj2) {
|
||||
for (let key in obj2) {
|
||||
if (
|
||||
obj1[key] === undefined ||
|
||||
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])
|
||||
|
|
|
@ -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,10 +1,10 @@
|
|||
export default function toDateString(date) {
|
||||
let day = date.getDate();
|
||||
let month = date.getMonth() + 1;
|
||||
const year = date.getFullYear();
|
||||
let year = date.getFullYear();
|
||||
|
||||
if (day < 10) day = `0${day}`;
|
||||
if (month < 10) month = `0${month}`;
|
||||
|
||||
return `${year}-${month}-${day}`;
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
export default function toLowerCamel(value) {
|
||||
if (!value) return;
|
||||
if (typeof value !== 'string') return value;
|
||||
if (typeof (value) !== 'string') return value;
|
||||
return value.charAt(0).toLowerCase() + value.slice(1);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -9,7 +9,7 @@ export default function formatDate(dateVal) {
|
|||
const dateZeroTime = new Date(dateVal);
|
||||
dateZeroTime.setHours(0, 0, 0, 0);
|
||||
const diff = Math.trunc(
|
||||
(today.getTime() - dateZeroTime.getTime()) / (1000 * 3600 * 24),
|
||||
(today.getTime() - dateZeroTime.getTime()) / (1000 * 3600 * 24)
|
||||
);
|
||||
let format;
|
||||
if (diff === 0) format = t('globals.today');
|
||||
|
|
|
@ -11,12 +11,12 @@ for (const file in files) {
|
|||
translations[lang] = g.default;
|
||||
})
|
||||
.finally(() => {
|
||||
const actualLang = `${lang}.yml`;
|
||||
const actualLang = lang + '.yml';
|
||||
for (const module in modules) {
|
||||
if (!module.endsWith(actualLang)) continue;
|
||||
modules[module]().then((t) => {
|
||||
Object.assign(translations[lang], t.default);
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -80,7 +80,7 @@ const killSession = async ({ userId, created }) => {
|
|||
openConfirmationModal(
|
||||
t('Session will be killed'),
|
||||
t('Are you sure you want to continue?'),
|
||||
() => killSession(row),
|
||||
() => killSession(row)
|
||||
)
|
||||
"
|
||||
outline
|
||||
|
|
|
@ -57,7 +57,7 @@ watch(
|
|||
store.url = urlPath.value;
|
||||
store.filter = filter;
|
||||
fetchAliases();
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const fetchAliases = () => paginateRef.value.fetch();
|
||||
|
@ -91,7 +91,7 @@ const fetchAliases = () => paginateRef.value.fetch();
|
|||
openConfirmationModal(
|
||||
t('User will be removed from alias'),
|
||||
t('Are you sure you want to continue?'),
|
||||
() => deleteAlias(row),
|
||||
() => deleteAlias(row)
|
||||
)
|
||||
"
|
||||
>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -28,7 +28,7 @@ const loading = ref(false);
|
|||
const hasDataChanged = computed(
|
||||
() =>
|
||||
formData.value.forwardTo !== initialData.value.forwardTo ||
|
||||
initialData.value.hasData !== hasData.value,
|
||||
initialData.value.hasData !== hasData.value
|
||||
);
|
||||
|
||||
const fetchMailForwards = async () => {
|
||||
|
@ -77,7 +77,7 @@ const setInitialData = async () => {
|
|||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
() => setInitialData(),
|
||||
() => setInitialData()
|
||||
);
|
||||
|
||||
onMounted(async () => await setInitialData());
|
||||
|
|
|
@ -14,7 +14,7 @@ const rolesOptions = ref([]);
|
|||
const formModelRef = ref();
|
||||
watch(
|
||||
() => route.params.id,
|
||||
() => formModelRef.value.reset(),
|
||||
() => formModelRef.value.reset()
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
@ -44,7 +44,7 @@ watch(
|
|||
store.filter = filter.value;
|
||||
store.limit = 0;
|
||||
fetchSubRoles();
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const fetchSubRoles = () => paginateRef.value.fetch();
|
||||
|
|
|
@ -43,7 +43,7 @@ watch(
|
|||
store.url = urlPath.value;
|
||||
store.filter = filter.value;
|
||||
fetchSubRoles();
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const fetchSubRoles = () => paginateRef.value.fetch();
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
||||
|
|
|
@ -238,9 +238,7 @@ const columns = computed(() => [
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.grid-style-transition {
|
||||
transition:
|
||||
transform 0.28s,
|
||||
background-color 0.28s;
|
||||
transition: transform 0.28s, background-color 0.28s;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -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,29 +152,10 @@ 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>
|
||||
|
@ -209,14 +186,14 @@ function fillClaimedQuantities() {
|
|||
/>
|
||||
<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"
|
||||
|
@ -233,7 +210,13 @@ function fillClaimedQuantities() {
|
|||
>
|
||||
<template #body-cell-claimed="{ row }">
|
||||
<QTd auto-width align="right" class="text-primary shrink">
|
||||
<QInput v-model.number="row.quantity" type="number" dense />
|
||||
<QInput
|
||||
v-model.number="row.quantity"
|
||||
type="number"
|
||||
dense
|
||||
@keyup.enter="saveWhenHasChanges()"
|
||||
@blur="saveWhenHasChanges()"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-description="{ row, value }">
|
||||
|
@ -289,6 +272,10 @@ function fillClaimedQuantities() {
|
|||
type="number"
|
||||
dense
|
||||
autofocus
|
||||
@keyup.enter="
|
||||
saveWhenHasChanges()
|
||||
"
|
||||
@blur="saveWhenHasChanges()"
|
||||
/>
|
||||
</QItemLabel>
|
||||
</template>
|
||||
|
@ -326,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>
|
||||
|
||||
|
@ -383,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>
|
||||
<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>
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('ClaimDescriptorMenu', () => {
|
|||
await vm.remove();
|
||||
|
||||
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ type: 'positive' }),
|
||||
expect.objectContaining({ type: 'positive' })
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -17,7 +17,6 @@ import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.v
|
|||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
const arrayData = useArrayData('Customer');
|
||||
const { t } = useI18n();
|
||||
|
@ -51,7 +50,7 @@ const columns = computed(() => [
|
|||
label: t('globals.ticket'),
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
name: 'ticketId',
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -85,8 +84,7 @@ const columns = computed(() => [
|
|||
label: t('globals.description'),
|
||||
columnClass: 'expand',
|
||||
columnFilter: {
|
||||
name: 'description',
|
||||
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -94,10 +92,17 @@ const columns = computed(() => [
|
|||
label: t('globals.quantity'),
|
||||
cardVisible: true,
|
||||
visible: true,
|
||||
columnFilter: false
|
||||
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'grouped',
|
||||
label: t('Group by items'),
|
||||
component: 'checkbox',
|
||||
visible: false,
|
||||
orderBy: false,
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
onBeforeMount(async () => {
|
||||
|
@ -213,9 +218,9 @@ const updateDateParams = (value, params) => {
|
|||
<div v-if="row.subName" class="subName">
|
||||
{{ row.subName }}
|
||||
</div>
|
||||
<FetchedTags :item="row" :columns="6"/>
|
||||
<FetchedTags :item="row" />
|
||||
</template>
|
||||
<template #moreFilterPanel="{ params, searchFn}">
|
||||
<template #moreFilterPanel="{ params }">
|
||||
<div class="column no-wrap flex-center q-gutter-y-md q-mt-xs q-pr-xl">
|
||||
<VnSelect
|
||||
:filled="true"
|
||||
|
@ -285,13 +290,6 @@ const updateDateParams = (value, params) => {
|
|||
class="q-px-xs q-pt-none fit"
|
||||
dense
|
||||
/>
|
||||
<VnCheckbox
|
||||
v-model="params.grouped"
|
||||
:label="t('Group by items')"
|
||||
class="q-px-xs q-pt-none fit"
|
||||
dense
|
||||
@update:modelValue="() => searchFn()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</VnTable>
|
||||
|
|
|
@ -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 flex">
|
||||
<div
|
||||
class="flex items-center cursor-pointer q-mr-md"
|
||||
v-if="!item.finished"
|
||||
>
|
||||
<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"
|
||||
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>
|
||||
<QBtn
|
||||
<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)"
|
||||
icon="preview"
|
||||
size="md"
|
||||
:title="t('View credits')"
|
||||
data-cy="viewBtn"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
name="preview"
|
||||
size="md"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('View credits')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
|
@ -117,6 +111,8 @@ async function acceptPropagate({ isEqualizated }) {
|
|||
option-value="id"
|
||||
v-model="data.sageTaxTypeFk"
|
||||
data-cy="sageTaxTypeFk"
|
||||
:required="data.isTaxDataChecked"
|
||||
:rules="[(val) => validations.required(data.isTaxDataChecked, val)]"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('Sage transaction type')"
|
||||
|
@ -126,6 +122,10 @@ async function acceptPropagate({ isEqualizated }) {
|
|||
option-value="id"
|
||||
data-cy="sageTransactionTypeFk"
|
||||
v-model="data.sageTransactionTypeFk"
|
||||
:required="data.isTaxDataChecked"
|
||||
:rules="[
|
||||
(val) => validations.required(data.sageTransactionTypeFk, val),
|
||||
]"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue