0
0
Fork 0
This commit is contained in:
Javi Gallego 2024-08-28 17:25:58 +02:00
commit 28fa876806
32 changed files with 519 additions and 170 deletions

View File

@ -1,3 +1,141 @@
# Version 24.36 - 2024-08-27
### Added 🆕
- feat(FormModel): trim data by default by:alexm
- feat(orderBasicData): add notes by:alexm
- feat(orderList): correct create order by:alexm
- feat(orderList): use orderFilter and fixed this by:alexm
- feat: #7323 handle workerPhoto (origin/7323_workerPhoto, 7323_workerPhoto) by:Javier Segarra
- feat: add recover password and reset password by:alexm
- feat: refs #7346 add seriaType option by:jgallego
- feat: refs #7346 elimino === by:jgallego
- feat: refs #7346 formdata uses serialType by:jgallego
- feat: refs #7346 refactor by:jgallego
- feat: refs #7346 sonarLint warnings (origin/7346-invoiceOutMultilple, 7346-invoiceOutMultilple) by:jgallego
- feat: refs #7710 uses cloneAll by:jgallego
- fix: refs #7717 fix OrderList table filters' and summary table style by:Jon
### Changed 📦
- feat: refs #7346 refactor by:jgallego
- perf: date fields (mindshore/feature/TicketFutureFilter, feature/TicketFutureFilter) by:Javier Segarra
- perf: refs #7717 right menu filter by:Jon
- perf: use ref at component start by:Javier Segarra
- refactor: refs #7717 delete useless function and import by:Jon
- refactor: refs #7717 deleted useless code by:Jon
### Fixed 🛠️
- feat(orderList): use orderFilter and fixed this by:alexm
- fix(VnTable): orderBy v-model by:alexm
- fix(account_card): redirection by:carlossa
- fix(orderLines): reload when delete and redirect when confirm by:alexm
- fix: #6336 ClaimListStates by:Javier Segarra
- fix: account subsections cards by:carlossa
- fix: duplicate key by:Jon
- fix: order description to vnTable by:alexm
- fix: orderCatalogFilter order by:alexm
- fix: quasar build warnings (6336_claim_fix_states) by:Javier Segarra
- fix: refs #7717 fix OrderList table filters' and summary table style by:Jon
- fix: refs #7717 fix basic data form & minor errors by:Jon
- fix: refs #7717 fix catalog filter, searchbar redirect and search by:Jon
- fix: refs #7717 fix catalog searchbar and worker tests(refs #7323) by:Jon
- fix: refs #7717 fix order sections by:Jon
- fix: refs #7717 fix volume and lines redirect by:Jon
- fix: refs #7717 fixed searchbar filter with rightmenu filters' applied by:Jon
- fix: test by:alexm
- fix: ticketDescriptorMenu by:Javier Segarra
- refs #7355 account fixes by:carlossa
# Version 24.34 - 2024-08-20
### Added 🆕
- chore: #6900 order params by:jorgep
- chore: refs #6900 drop console log by:jorgep
- chore: refs #6900 drop vnCurrency by:jorgep
- chore: refs #6900 fix e2e tests by:jorgep
- chore: refs #6900 mv rectificative logic by:jorgep
- chore: refs #6900 responsive code by:jorgep
- chore: refs #7283 drop array types by:jorgep
- chore: refs #7283 drop import by:jorgep
- chore: refs #7283 fix e2e logout by:jorgep
- chore: refs #7283 update VnAvatar title handling by:jorgep
- chore: refs #7323 fix test by:jorgep
- chore: refs #7323 remove unused import by:jorgep
- chore: refs #7323drop commented code by:jorgep
- feat(VnCard): use props searchbar by:alexm
- feat(customer): improve basicData to balance by:alexm
- feat(customer_balance): refs #6943 add functionality from salix by:alexm
- feat(customer_balance): refs #6943 translations by:alexm
- feat: refs #6130 husky commitLint config by:pablone
- feat: refs #6130 husky hooks by:pablone
- feat: refs #6900 add InvoiceInSerial by:jorgep
- feat: refs #6900 add locale by:jorgep
- feat: refs #6900 use VnTable & sort filter fields by:jorgep
- feat: refs #7323 add flex-wrap by:jorgep
- feat: refs #7323 add my account" btn & fix models log selectable by:jorgep
- feat: refs #7323 improve test by:jorgep
### Changed 📦
- refactor(customer_log: use VnLog by:alexm
- refactor(customer_recovery): to vnTable by:alexm
- refactor(customer_webAccess): FormModel by:alexm
- refactor: refs #7283 update avatar size and color by:jorgep
### Fixed 🛠️
- chore: refs #6900 fix e2e tests by:jorgep
- chore: refs #7283 fix e2e logout by:jorgep
- chore: refs #7323 fix test by:jorgep
- feat: refs #7323 add my account" btn & fix models log selectable by:jorgep
- fix #7355 fix acls list by:carlossa
- fix(VnFilterPanel): emit userParams better by:alexm
- fix(claim_summary): url links (HEAD -> 7864_testToMaster_2434, origin/test, origin/7864_testToMaster_2434, test) by:alexm
- fix(customer_sms: fix reload by:alexm
- fix(twoFactor): unify code login and twoFactor by:alexm
- fix: VnCard VnSearchbar props by:alexm
- fix: accountMailAlias by:alexm
- fix: refs #6130 add commit lint modules by:pablone
- fix: refs #6130 pnpm-lock.yml by:pablone
- fix: refs #6900 improve loading by:jorgep
- fix: refs #6900 improve logic (origin/6900-addSerial) by:jorgep
- fix: refs #6900 improve logic by:jorgep
- fix: refs #6900 rectificative btn reactivity by:jorgep
- fix: refs #6900 use type number by:jorgep
- fix: refs #6900 vat & dueday by:jorgep
- fix: refs #6900 vat, dueday & intrastat by:jorgep
- fix: refs #6989 show entity name & default time from config table by:jorgep
- fix: refs #7283 basicData locale by:jorgep
- fix: refs #7283 itemLastEntries filter by:jorgep
- fix: refs #7283 itemTags & VnImg by:jorgep
- fix: refs #7283 locale by:jorgep
- fix: refs #7283 min-width vnImg by:jorgep
- fix: refs #7283 use vnAvatar & add optional zoom by:jorgep
- fix: refs #7283 userPanel pic by:jorgep
- fix: refs #7323 add department popup by:jorgep
- fix: refs #7323 add locale by:jorgep
- fix: refs #7323 css righ menu by:jorgep
- fix: refs #7323 data-key & add select by:jorgep
- fix: refs #7323 load all opts by:jorgep
- fix: refs #7323 righ menu bug by:jorgep
- fix: refs #7323 use global locale by:jorgep
- fix: refs #7323 use workerFilter (origin/7323-warmfix-fixErrors) by:jorgep
- fix: refs #7323 vnsubtoolbar css by:jorgep
- fix: refs #7323 wrong css by:jorgep
- refs #7355 fix Rol, alias by:carlossa
- refs #7355 fix accountAlias by:carlossa
- refs #7355 fix alias summary by:carlossa
- refs #7355 fix conflicts by:carlossa
- refs #7355 fix create Rol by:carlossa
- refs #7355 fix list by:carlossa
- refs #7355 fix lists redirects summary by:carlossa
- refs #7355 fix roles by:carlossa
- refs #7355 fix search exprBuilder by:carlossa
- refs #7355 fix vnTable by:carlossa
# Version 24.32 - 2024-08-06 # Version 24.32 - 2024-08-06
### Added 🆕 ### Added 🆕

View File

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

View File

@ -8,7 +8,6 @@ import VnSubToolbar from '../ui/VnSubToolbar.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import RightMenu from 'components/common/RightMenu.vue'; import RightMenu from 'components/common/RightMenu.vue';
const props = defineProps({ const props = defineProps({
dataKey: { type: String, required: true }, dataKey: { type: String, required: true },
baseUrl: { type: String, default: undefined }, baseUrl: { type: String, default: undefined },
@ -74,7 +73,7 @@ if (props.baseUrl) {
<QPage> <QPage>
<VnSubToolbar /> <VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]"> <div :class="[useCardSize(), $attrs.class]">
<RouterView /> <RouterView :key="route.fullPath" />
</div> </div>
</QPage> </QPage>
</QPageContainer> </QPageContainer>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { watch, computed, ref, nextTick } from 'vue'; import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { date } from 'quasar'; import { date } from 'quasar';
@ -14,13 +14,13 @@ const props = defineProps({
default: false, default: false,
}, },
}); });
const initialDate = ref(model.value);
const { t } = useI18n(); const { t } = useI18n();
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired'); const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
const dateFormat = 'HH:mm'; const dateFormat = 'HH:mm';
const isPopupOpen = ref(); const isPopupOpen = ref();
const hover = ref(); const hover = ref();
const inputRef = ref();
const styleAttrs = computed(() => { const styleAttrs = computed(() => {
return props.isOutlined return props.isOutlined
@ -50,7 +50,8 @@ const formattedTime = computed({
} }
if (!props.timeOnly) { if (!props.timeOnly) {
const [hh, mm] = time.split(':'); const [hh, mm] = time.split(':');
const date = new Date(model.value ? model.value : null);
const date = new Date(model.value ? model.value : initialDate.value);
date.setHours(hh, mm, 0); date.setHours(hh, mm, 0);
time = date?.toISOString(); time = date?.toISOString();
} }
@ -62,37 +63,10 @@ const formattedTime = computed({
function dateToTime(newDate) { function dateToTime(newDate) {
return date.formatDate(new Date(newDate), dateFormat); return date.formatDate(new Date(newDate), dateFormat);
} }
watch(
() => model.value,
(val) => (formattedTime.value = val),
{ immediate: true }
);
watch(
() => formattedTime.value,
async (val) => {
let position = 3;
const input = inputRef.value?.getNativeElement();
if (!val || !input) return;
let [hh, mm] = val.split(':');
hh = parseInt(hh);
if (hh >= 10 || mm != '00') return;
await nextTick();
await nextTick();
if (!hh) position = 0;
input.setSelectionRange(position, position);
},
{ immediate: true }
);
</script> </script>
<template> <template>
<div @mouseover="hover = true" @mouseleave="hover = false"> <div @mouseover="hover = true" @mouseleave="hover = false">
<QInput <QInput
ref="inputRef"
class="vn-input-time" class="vn-input-time"
mask="##:##" mask="##:##"
placeholder="--:--" placeholder="--:--"
@ -102,7 +76,7 @@ watch(
style="min-width: 100px" style="min-width: 100px"
:rules="$attrs.required ? [requiredFieldRule] : null" :rules="$attrs.required ? [requiredFieldRule] : null"
@click="isPopupOpen = false" @click="isPopupOpen = false"
@focus="inputRef.getNativeElement().setSelectionRange(0, 0)" type="time"
> >
<template #append> <template #append>
<QIcon <QIcon
@ -149,6 +123,11 @@ watch(
border-style: solid; border-style: solid;
} }
</style> </style>
<style lang="scss" scoped>
:deep(input[type='time']::-webkit-calendar-picker-indicator) {
display: none;
}
</style>
<i18n> <i18n>
es: es:
Open time: Abrir tiempo Open time: Abrir tiempo

View File

@ -73,6 +73,10 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
params: {
type: Object,
default: null,
},
}); });
const { t } = useI18n(); const { t } = useI18n();
@ -153,9 +157,14 @@ async function fetchFilter(val) {
? optionValue.value ? optionValue.value
: optionFilter.value ?? optionLabel.value); : optionFilter.value ?? optionLabel.value);
const defaultWhere = $props.useLike let defaultWhere = {};
? { [key]: { like: `%${val}%` } } if ($props.filterOptions.length) {
: { [key]: val }; defaultWhere = $props.filterOptions.reduce((obj, prop) => {
if (!obj.or) obj.or = [];
obj.or.push({ [prop]: getVal(val) });
return obj;
}, {});
} else defaultWhere = { [key]: getVal(val) };
const where = { ...(val ? defaultWhere : {}), ...$props.where }; const where = { ...(val ? defaultWhere : {}), ...$props.where };
const fetchOptions = { where, include, limit }; const fetchOptions = { where, include, limit };
if (fields) fetchOptions.fields = fields; if (fields) fetchOptions.fields = fields;
@ -194,6 +203,8 @@ async function filterHandler(val, update) {
function nullishToTrue(value) { function nullishToTrue(value) {
return value ?? true; return value ?? true;
} }
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
</script> </script>
<template> <template>
@ -205,6 +216,7 @@ function nullishToTrue(value) {
:limit="limit" :limit="limit"
:sort-by="sortBy" :sort-by="sortBy"
:fields="fields" :fields="fields"
:params="params"
/> />
<QSelect <QSelect
v-model="value" v-model="value"

View File

@ -121,7 +121,7 @@ async function search() {
<QForm @submit="search" id="searchbarForm"> <QForm @submit="search" id="searchbarForm">
<VnInput <VnInput
id="searchbar" id="searchbar"
v-model="searchText" v-model.trim="searchText"
:placeholder="t(props.label)" :placeholder="t(props.label)"
dense dense
standout standout

View File

@ -255,6 +255,7 @@ globals:
twoFactor: Two factor twoFactor: Two factor
recoverPassword: Recover password recoverPassword: Recover password
resetPassword: Reset password resetPassword: Reset password
serial: Serial
created: Created created: Created
worker: Worker worker: Worker
now: Now now: Now

View File

@ -257,6 +257,7 @@ globals:
twoFactor: Doble factor twoFactor: Doble factor
recoverPassword: Recuperar contraseña recoverPassword: Recuperar contraseña
resetPassword: Restablecer contraseña resetPassword: Restablecer contraseña
serial: Facturas por serie
created: Fecha creación created: Fecha creación
worker: Trabajador worker: Trabajador
now: Ahora now: Ahora

View File

@ -72,7 +72,7 @@ const hasAccount = ref(false);
</VnImg> </VnImg>
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('account.card.nickname')" :value="entity.nickname" /> <VnLv :label="t('account.card.nickname')" :value="entity.name" />
<VnLv :label="t('account.card.role')" :value="entity.role.name" /> <VnLv :label="t('account.card.role')" :value="entity.role.name" />
</template> </template>
<template #actions="{ entity }"> <template #actions="{ entity }">

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -12,17 +12,14 @@ const route = useRoute();
const rolesOptions = ref([]); const rolesOptions = ref([]);
const formModelRef = ref(); const formModelRef = ref();
watch(
() => route.params.id,
() => formModelRef.value.reset()
);
</script> </script>
<template> <template>
<FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" /> <FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" />
<FormModel <FormModel ref="formModelRef" model="AccountPrivileges" url="VnUsers" auto-load>
ref="formModelRef"
model="AccountPrivileges"
:url="`VnUsers/${route.params.id}/privileges`"
:url-create="`VnUsers/${route.params.id}/privileges`"
auto-load
@on-data-saved="formModelRef.fetch()"
>
<template #form="{ data }"> <template #form="{ data }">
<div class="q-gutter-y-sm"> <div class="q-gutter-y-sm">
<QCheckbox <QCheckbox

View File

@ -48,7 +48,7 @@ const filter = {
<QIcon name="open_in_new" /> <QIcon name="open_in_new" />
</router-link> </router-link>
</QCardSection> </QCardSection>
<VnLv :label="t('account.card.nickname')" :value="account.nickname" /> <VnLv :label="t('account.card.nickname')" :value="account.name" />
<VnLv :label="t('account.card.role')" :value="account.role.name" /> <VnLv :label="t('account.card.role')" :value="account.role.name" />
</QCard> </QCard>
</template> </template>

View File

@ -36,8 +36,6 @@ const $props = defineProps({
const entityId = computed(() => $props.id || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const ClaimStates = ref([]); const ClaimStates = ref([]);
const claimUrl = ref();
const salixUrl = ref();
const claimDmsRef = ref(); const claimDmsRef = ref();
const claimDms = ref([]); const claimDms = ref([]);
const multimediaDialog = ref(); const multimediaDialog = ref();
@ -152,11 +150,6 @@ const developmentColumns = ref([
}, },
]); ]);
onMounted(async () => {
salixUrl.value = await getUrl('');
claimUrl.value = salixUrl.value + `claim/${entityId.value}/`;
});
async function getClaimDms() { async function getClaimDms() {
claimDmsFilter.value.where = { claimFk: entityId.value }; claimDmsFilter.value.where = { claimFk: entityId.value };
await claimDmsRef.value.fetch(); await claimDmsRef.value.fetch();
@ -177,10 +170,15 @@ function openDialog(dmsId) {
multimediaSlide.value = dmsId; multimediaSlide.value = dmsId;
multimediaDialog.value = true; multimediaDialog.value = true;
} }
async function changeState(value) { async function changeState(value) {
await axios.patch(`Claims/updateClaim/${entityId.value}`, { claimStateFk: value }); await axios.patch(`Claims/updateClaim/${entityId.value}`, { claimStateFk: value });
router.go(route.fullPath); router.go(route.fullPath);
} }
function claimUrl(section) {
return '#/claim/' + entityId.value + '/' + section;
}
</script> </script>
<template> <template>
@ -234,7 +232,7 @@ async function changeState(value) {
<template #body="{ entity: { claim, salesClaimed, developments } }"> <template #body="{ entity: { claim, salesClaimed, developments } }">
<QCard class="vn-one" v-if="$route.name != 'ClaimSummary'"> <QCard class="vn-one" v-if="$route.name != 'ClaimSummary'">
<VnTitle <VnTitle
:url="`#/claim/${entityId}/basic-data`" :url="claimUrl('basic-data')"
:text="t('globals.pageTitles.basicData')" :text="t('globals.pageTitles.basicData')"
/> />
<VnLv :label="t('claim.created')" :value="toDate(claim.created)" /> <VnLv :label="t('claim.created')" :value="toDate(claim.created)" />
@ -275,7 +273,7 @@ async function changeState(value) {
/> />
</QCard> </QCard>
<QCard class="vn-two"> <QCard class="vn-two">
<VnTitle :url="`#/claim/${entityId}/notes`" :text="t('claim.notes')" /> <VnTitle :url="claimUrl('notes')" :text="t('claim.notes')" />
<ClaimNotes <ClaimNotes
:id="entityId" :id="entityId"
:add-note="false" :add-note="false"
@ -284,7 +282,7 @@ async function changeState(value) {
/> />
</QCard> </QCard>
<QCard class="vn-two" v-if="claimDms?.length"> <QCard class="vn-two" v-if="claimDms?.length">
<VnTitle :url="`#/claim/${entityId}/photos`" :text="t('claim.photos')" /> <VnTitle :url="claimUrl('photos')" :text="t('claim.photos')" />
<div class="container max-container-height" style="overflow: auto"> <div class="container max-container-height" style="overflow: auto">
<div <div
class="multimedia-container" class="multimedia-container"
@ -326,7 +324,7 @@ async function changeState(value) {
</div> </div>
</QCard> </QCard>
<QCard class="vn-max" v-if="salesClaimed.length > 0"> <QCard class="vn-max" v-if="salesClaimed.length > 0">
<VnTitle :url="`#/claim/${entityId}/lines`" :text="t('claim.details')" /> <VnTitle :url="claimUrl('lines')" :text="t('claim.details')" />
<QTable <QTable
:columns="detailsColumns" :columns="detailsColumns"
:rows="salesClaimed" :rows="salesClaimed"
@ -365,7 +363,7 @@ async function changeState(value) {
</QTable> </QTable>
</QCard> </QCard>
<QCard class="vn-max" v-if="developments.length > 0"> <QCard class="vn-max" v-if="developments.length > 0">
<VnTitle :url="claimUrl + 'development'" :text="t('claim.development')" /> <VnTitle :url="claimUrl('development')" :text="t('claim.development')" />
<QTable <QTable
:columns="developmentColumns" :columns="developmentColumns"
:rows="developments" :rows="developments"
@ -390,7 +388,7 @@ async function changeState(value) {
</QTable> </QTable>
</QCard> </QCard>
<QCard class="vn-max"> <QCard class="vn-max">
<VnTitle :url="claimUrl + 'action'" :text="t('claim.actions')" /> <VnTitle :url="claimUrl('action')" :text="t('claim.actions')" />
<div id="slider-container" class="q-px-xl q-py-md"> <div id="slider-container" class="q-px-xl q-py-md">
<QSlider <QSlider
v-model="claim.responsibility" v-model="claim.responsibility"

View File

@ -18,6 +18,7 @@ const { notify } = useNotify();
const { t } = useI18n(); const { t } = useI18n();
const arrayData = useArrayData(); const arrayData = useArrayData();
const invoiceIn = computed(() => arrayData.store.data); const invoiceIn = computed(() => arrayData.store.data);
const currency = computed(() => invoiceIn.value?.currency?.code);
const rowsSelected = ref([]); const rowsSelected = ref([]);
const banks = ref([]); const banks = ref([]);
@ -139,9 +140,9 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd> <QTd>
<VnInputNumber <VnInputNumber
:class="{ :class="{
'no-pointer-events': !isNotEuro(invoiceIn.currency.code), 'no-pointer-events': !isNotEuro(currency),
}" }"
:disable="!isNotEuro(invoiceIn.currency.code)" :disable="!isNotEuro(currency)"
v-model="row.foreignValue" v-model="row.foreignValue"
clearable clearable
clear-icon="close" clear-icon="close"
@ -154,9 +155,7 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd /> <QTd />
<QTd /> <QTd />
<QTd> <QTd>
{{ {{ toCurrency(getTotalAmount(rows), currency) }}
toCurrency(getTotalAmount(rows), invoiceIn.currency.code)
}}
</QTd> </QTd>
<QTd /> <QTd />
</QTr> </QTr>
@ -208,11 +207,9 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
:label="t('Foreign value')" :label="t('Foreign value')"
class="full-width" class="full-width"
:class="{ :class="{
'no-pointer-events': !isNotEuro( 'no-pointer-events': !isNotEuro(currency),
invoiceIn.currency.code
),
}" }"
:disable="!isNotEuro(invoiceIn.currency.code)" :disable="!isNotEuro(currency)"
v-model="props.row.foreignValue" v-model="props.row.foreignValue"
clearable clearable
clear-icon="close" clear-icon="close"

View File

@ -242,11 +242,12 @@ const formatOpt = (row, { model, options }, prop) => {
</template> </template>
<template #body-cell-taxablebase="{ row }"> <template #body-cell-taxablebase="{ row }">
<QTd> <QTd>
{{ currency }}
<VnInputNumber <VnInputNumber
:class="{ :class="{
'no-pointer-events': isNotEuro(invoiceIn.currency.code), 'no-pointer-events': isNotEuro(currency),
}" }"
:disable="isNotEuro(invoiceIn.currency.code)" :disable="isNotEuro(currency)"
label="" label=""
clear-icon="close" clear-icon="close"
v-model="row.taxableBase" v-model="row.taxableBase"
@ -312,9 +313,9 @@ const formatOpt = (row, { model, options }, prop) => {
<QTd> <QTd>
<VnInputNumber <VnInputNumber
:class="{ :class="{
'no-pointer-events': !isNotEuro(invoiceIn.currency.code), 'no-pointer-events': !isNotEuro(currency),
}" }"
:disable="!isNotEuro(invoiceIn.currency.code)" :disable="!isNotEuro(currency)"
v-model="row.foreignValue" v-model="row.foreignValue"
/> />
</QTd> </QTd>
@ -361,12 +362,10 @@ const formatOpt = (row, { model, options }, prop) => {
<VnInputNumber <VnInputNumber
:label="t('Taxable base')" :label="t('Taxable base')"
:class="{ :class="{
'no-pointer-events': isNotEuro( 'no-pointer-events': isNotEuro(currency),
invoiceIn.currency.code
),
}" }"
class="full-width" class="full-width"
:disable="isNotEuro(invoiceIn.currency.code)" :disable="isNotEuro(currency)"
clear-icon="close" clear-icon="close"
v-model="props.row.taxableBase" v-model="props.row.taxableBase"
clearable clearable
@ -427,11 +426,9 @@ const formatOpt = (row, { model, options }, prop) => {
:label="t('Foreign value')" :label="t('Foreign value')"
class="full-width" class="full-width"
:class="{ :class="{
'no-pointer-events': !isNotEuro( 'no-pointer-events': !isNotEuro(currency),
invoiceIn.currency.code
),
}" }"
:disable="!isNotEuro(invoiceIn.currency.code)" :disable="!isNotEuro(currency)"
v-model="props.row.foreignValue" v-model="props.row.foreignValue"
/> />
</QItem> </QItem>

View File

@ -0,0 +1,68 @@
<script setup>
import { ref, computed, onBeforeMount } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import VnTable from 'src/components/VnTable/VnTable.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import InvoiceInSerialFilter from './InvoiceInSerialFilter.vue';
const { t } = useI18n();
const cols = computed(() => [
{
align: 'left',
name: 'serial',
label: t('Serial'),
columnFilter: false,
},
{
align: 'left',
name: 'pending',
label: t('Pending'),
columnFilter: false,
},
{
align: 'left',
name: 'total',
label: 'Total',
columnFilter: false,
},
]);
const daysAgo = ref();
onBeforeMount(async () => {
const tableParam = useRoute().query.table;
if (tableParam) daysAgo.value = JSON.parse(tableParam).daysAgo;
else
daysAgo.value = (
await axios.get('InvoiceInConfigs/findOne', {
params: { filter: { fields: ['daysAgo'] } },
})
).data?.daysAgo;
});
</script>
<template>
<RightMenu>
<template #right-panel>
<InvoiceInSerialFilter data-key="InvoiceInSerial" />
</template>
</RightMenu>
<VnTable
v-if="!isNaN(daysAgo)"
data-key="InvoiceInSerial"
url="InvoiceIns/getSerial"
:columns="cols"
:right-search="false"
:user-params="{ daysAgo }"
:disable-option="{ card: true }"
auto-load
/>
</template>
<i18n>
es:
Serial: Serie
Pending: Pendiente
</i18n>

View File

@ -0,0 +1,53 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
defineProps({ dataKey: { type: String, required: true } });
const { t } = useI18n();
</script>
<template>
<VnFilterPanel :data-key="dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params }">
<QItem>
<QItemSection>
<VnInputNumber
v-model="params.daysAgo"
:label="t('params.daysAgo')"
outlined
rounded
dense
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
v-model="params.serial"
:label="t('params.serial')"
outlined
rounded
dense
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
daysAgo: Last days
serial: serial
es:
params:
daysAgo: Últimos días
serial: serie
</i18n>

View File

@ -52,7 +52,7 @@ const getStatus = computed({
onMounted(async () => { onMounted(async () => {
await invoiceOutGlobalStore.init(); await invoiceOutGlobalStore.init();
formData.value = formInitialData.value.invoiceDate; formData.value = { invoiceDate: formInitialData.value.invoiceDate };
}); });
</script> </script>
@ -101,7 +101,17 @@ onMounted(async () => {
dense dense
outlined outlined
rounded rounded
/> >
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
#{{ scope.opt?.id }} {{ scope.opt?.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<VnSelect <VnSelect
:label="t('invoiceOutSerialType')" :label="t('invoiceOutSerialType')"
v-model="formData.serialType" v-model="formData.serialType"
@ -127,9 +137,7 @@ onMounted(async () => {
:label="t('company')" :label="t('company')"
v-model="formData.companyFk" v-model="formData.companyFk"
:options="companiesOptions" :options="companiesOptions"
option-value="id"
option-label="code" option-label="code"
hide-selected
dense dense
outlined outlined
rounded rounded
@ -138,9 +146,6 @@ onMounted(async () => {
:label="t('printer')" :label="t('printer')"
v-model="formData.printer" v-model="formData.printer"
:options="printersOptions" :options="printersOptions"
option-value="id"
option-label="name"
hide-selected
dense dense
outlined outlined
rounded rounded

View File

@ -226,10 +226,18 @@ watchEffect(selectedRows);
url="Tickets" url="Tickets"
v-model="data.ticketFk" v-model="data.ticketFk"
:label="t('invoiceOutList.tableVisibleColumns.ticket')" :label="t('invoiceOutList.tableVisibleColumns.ticket')"
:options="ticketsOptions" option-label="id"
option-label="nickname"
option-value="id" option-value="id"
/> >
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
<QItemLabel caption>{{ scope.opt?.nickname }}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
<span class="q-ml-md">O</span> <span class="q-ml-md">O</span>
</div> </div>
<VnSelect <VnSelect

View File

@ -1,6 +1,6 @@
<script setup> <script setup>
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { ref } from 'vue'; import { computed, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
@ -11,8 +11,8 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const shelvingId = route.params?.id || null; const entityId = computed(() => route.params.id ?? null);
const isNew = Boolean(!shelvingId); const isNew = Boolean(!entityId.value);
const defaultInitialData = { const defaultInitialData = {
parkingFk: null, parkingFk: null,
priority: null, priority: null,
@ -67,7 +67,7 @@ const onSave = (shelving, newShelving) => {
}; };
</script> </script>
<template> <template>
<VnSubToolbar /> <VnSubToolbar v-if="isNew" />
<FetchData <FetchData
url="Parkings" url="Parkings"
:filter="parkingFilter" :filter="parkingFilter"
@ -75,13 +75,13 @@ const onSave = (shelving, newShelving) => {
auto-load auto-load
/> />
<FormModel <FormModel
:url="isNew ? null : `Shelvings/${shelvingId}`" :url="isNew ? null : `Shelvings/${entityId}`"
:url-create="isNew ? 'Shelvings' : null" :url-create="isNew ? 'Shelvings' : null"
:observe-form-changes="!isNew" :observe-form-changes="!isNew"
:filter="shelvingFilter" :filter="shelvingFilter"
model="shelving" model="shelving"
:auto-load="!isNew" :auto-load="!isNew"
:form-initial-data="defaultInitialData" :form-initial-data="isNew ? defaultInitialData : null"
@on-data-saved="onSave" @on-data-saved="onSave"
> >
<template #form="{ data, validate, filter }"> <template #form="{ data, validate, filter }">

View File

@ -30,10 +30,12 @@ const actions = {
let clonedTicketId; let clonedTicketId;
try { try {
const { data } = await axios.post(`Tickets/${ticketId}/clone`, { const { data } = await axios.post(`Tickets/cloneAll`, {
shipped: ticket.value.shipped, ticketsIds: [ticket.value.id],
withWarehouse: true,
negative: false,
}); });
clonedTicketId = data; clonedTicketId = data[0].id;
} catch (e) { } catch (e) {
opts.message = t('It was not able to clone the ticket'); opts.message = t('It was not able to clone the ticket');
opts.type = 'negative'; opts.type = 'negative';

View File

@ -268,7 +268,6 @@ onMounted(async () => {
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
const filteredColumns = columns.value.filter((col) => col.name !== 'history'); const filteredColumns = columns.value.filter((col) => col.name !== 'history');
allColumnNames.value = filteredColumns.map((col) => col.name); allColumnNames.value = filteredColumns.map((col) => col.name);
// await expeditionsArrayData.fetch({ append: false });
}); });
onUnmounted(() => (stateStore.rightDrawer = false)); onUnmounted(() => (stateStore.rightDrawer = false));

View File

@ -153,14 +153,22 @@ const setReserved = async (reserved) => {
}; };
const createRefund = async (withWarehouse) => { const createRefund = async (withWarehouse) => {
if (!props.sales) return; if (!props.ticket) return;
const salesIds = props.sales.map((sale) => sale.id); const params = {
const params = { salesIds: salesIds, withWarehouse: withWarehouse, negative: true }; ticketsIds: [props.ticket.id],
const { data } = await axios.post('Sales/clone', params); withWarehouse: withWarehouse,
const [refundTicket] = data; negative: true,
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive'); };
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
try {
const { data } = await axios.post('Tickets/cloneAll', params);
const [refundTicket] = data;
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
} catch (error) {
console.error(error);
}
}; };
</script> </script>

View File

@ -82,7 +82,9 @@ const openCreateModal = () => createTrackingDialogRef.value.show();
data-key="TicketTracking" data-key="TicketTracking"
:filter="paginateFilter" :filter="paginateFilter"
url="TicketTrackings" url="TicketTrackings"
auto-load auto-load
order="created DESC"
:limit="0"
> >
<template #body="{ rows }"> <template #body="{ rows }">
<QTable <QTable

View File

@ -152,7 +152,7 @@ const getEventAttrs = (timestamp) => {
if (isFestive) { if (isFestive) {
attrs.class = '--festive'; attrs.class = '--festive';
attrs.label = event.absenceId ?? timestamp.day; attrs.label = timestamp.day;
} else attrs.class = `--${type}`; } else attrs.class = `--${type}`;
return attrs; return attrs;

View File

@ -93,7 +93,6 @@ const filter = {
/> />
</template> </template>
</VnLv> </VnLv>
<VnLv :label="t('worker.list.email')" :value="worker.user.email" copy />
<VnLv :label="t('worker.summary.boss')" link> <VnLv :label="t('worker.summary.boss')" link>
<template #value> <template #value>
<VnUserLink <VnUserLink
@ -139,29 +138,25 @@ const filter = {
/> />
<VnLv :label="t('worker.summary.fi')" :value="worker.fi" /> <VnLv :label="t('worker.summary.fi')" :value="worker.fi" />
<VnLv :label="t('worker.summary.birth')" :value="toDate(worker.birth)" /> <VnLv :label="t('worker.summary.birth')" :value="toDate(worker.birth)" />
<VnRow class="q-mt-sm" wrap> <VnLv
<VnLv :label="t('worker.summary.isFreelance')"
:label="t('worker.summary.isFreelance')" :value="worker.isFreelance"
:value="worker.isFreelance" />
/> <VnLv
<VnLv :label="t('worker.summary.isSsDiscounted')"
:label="t('worker.summary.isSsDiscounted')" :value="worker.isSsDiscounted"
:value="worker.isSsDiscounted" />
/> <VnLv
<VnLv :label="t('worker.summary.hasMachineryAuthorized')"
:label="t('worker.summary.hasMachineryAuthorized')" :value="worker.hasMachineryAuthorized"
:value="worker.hasMachineryAuthorized" />
/> <VnLv :label="t('worker.summary.isDisable')" :value="worker.isDisable" />
<VnLv
:label="t('worker.summary.isDisable')"
:value="worker.isDisable"
/>
</VnRow>
</QCard> </QCard>
<QCard class="vn-one"> <QCard class="vn-one">
<VnTitle :text="t('worker.summary.userData')" /> <VnTitle :text="t('worker.summary.userData')" />
<VnLv :label="t('worker.summary.userId')" :value="worker.user.id" /> <VnLv :label="t('worker.summary.userId')" :value="worker.user.id" />
<VnLv :label="t('worker.card.name')" :value="worker.user.nickname" /> <VnLv :label="t('worker.card.name')" :value="worker.user.nickname" />
<VnLv :label="t('worker.list.email')" :value="worker.user.email" copy />
<VnLv :label="t('worker.summary.role')"> <VnLv :label="t('worker.summary.role')">
<template #value> <template #value>
<span class="link"> <span class="link">

View File

@ -34,6 +34,10 @@ const weekdayStore = useWeekdayStore();
const weekDays = ref([]); const weekDays = ref([]);
const { openConfirmationModal } = useVnConfirm(); const { openConfirmationModal } = useVnConfirm();
const { getWeekOfYear } = date; const { getWeekOfYear } = date;
const defaultDate = computed(() => {
const timestamp = route.query.timestamp;
return timestamp ? new Date(timestamp * 1000) : Date.vnNew();
});
const workerTimeFormDialogRef = ref(null); const workerTimeFormDialogRef = ref(null);
const workerTimeReasonFormDialogRef = ref(null); const workerTimeReasonFormDialogRef = ref(null);
@ -56,7 +60,7 @@ const workerTimeFormProps = reactive({
// Array utilizado por QCalendar para seleccionar un rango de fechas // Array utilizado por QCalendar para seleccionar un rango de fechas
const selectedCalendarDates = ref([]); const selectedCalendarDates = ref([]);
// Date formateada para bindear al componente QDate // Date formateada para bindear al componente QDate
const selectedDateFormatted = ref(toDateString(Date.vnNew())); const selectedDateFormatted = ref(toDateString(defaultDate.value));
const arrayData = useArrayData('workerData'); const arrayData = useArrayData('workerData');
@ -423,7 +427,7 @@ onBeforeMount(() => {
}); });
onMounted(async () => { onMounted(async () => {
await setDate(Date.vnNew()); await setDate(defaultDate.value);
await getMailStates(selectedDate.value); await getMailStates(selectedDate.value);
stateStore.rightDrawer = true; stateStore.rightDrawer = true;
}); });
@ -547,9 +551,12 @@ onMounted(async () => {
<QTd <QTd
v-for="(day, index) in props.cols" v-for="(day, index) in props.cols"
:key="index" :key="index"
style="padding: 20px 16px !important" :style="{
padding: '20px 16px !important',
'vertical-align': 'baseline',
}"
> >
<div class="full-height full-width column items-center"> <div class="full-width column items-center">
<WorkerTimeHourChip <WorkerTimeHourChip
v-for="(hour, ind) in day.dayData?.hours" v-for="(hour, ind) in day.dayData?.hours"
:key="ind" :key="ind"

View File

@ -2,7 +2,6 @@
import { onBeforeMount, ref } from 'vue'; import { onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import axios from 'axios'; import axios from 'axios';
import { useUserConfig } from 'src/composables/useUserConfig';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
@ -14,15 +13,25 @@ import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue'; import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import VnRadio from 'src/components/common/VnRadio.vue'; import VnRadio from 'src/components/common/VnRadio.vue';
import { useState } from 'src/composables/useState';
const { t } = useI18n(); const { t } = useI18n();
const user = useState().getUser();
const companiesOptions = ref([]); const companiesOptions = ref([]);
const workersOptions = ref([]);
const payMethodsOptions = ref([]); const payMethodsOptions = ref([]);
const bankEntitiesOptions = ref([]); const bankEntitiesOptions = ref([]);
const formData = ref({ isFreelance: false }); const formData = ref({ companyFk: user.value.companyFk, isFreelance: false });
const defaultPayMethod = ref(0); const defaultPayMethod = ref();
onBeforeMount(async () => {
defaultPayMethod.value = (
await axios.get('WorkerConfigs/findOne', {
params: { field: ['payMethodFk'] },
})
).data.payMethodFk;
formData.value.payMethodFk = defaultPayMethod.value;
});
function handleLocation(data, location) { function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {}; const { town, code, provinceFk, countryFk } = location ?? {};
@ -32,16 +41,32 @@ function handleLocation(data, location) {
data.countryFk = countryFk; data.countryFk = countryFk;
} }
onBeforeMount(async () => { function generateCodeUser(worker) {
const userInfo = await useUserConfig().fetch(); if (!worker.firstName || !worker.lastNames) return;
formData.value.companyFk = userInfo.companyFk;
const { data } = await axios.get('WorkerConfigs/findOne', { const totalName = worker.firstName.concat(' ' + worker.lastNames).toLowerCase();
params: { field: ['payMethodFk'] }, const totalNameArray = totalName.split(' ');
}); let newCode = '';
defaultPayMethod.value = data.payMethodFk;
formData.value.payMethodFk = defaultPayMethod.value; for (let part of totalNameArray) newCode += part.charAt(0);
});
worker.code = newCode.toUpperCase().slice(0, 3);
worker.name = totalNameArray[0] + newCode.slice(1);
if (!worker.companyFk) worker.companyFk = user.companyFk;
}
async function autofillBic(worker) {
if (!worker || !worker.iban) return;
let bankEntityId = parseInt(worker.iban.substr(4, 4));
let filter = { where: { id: bankEntityId } };
const { data } = await axios.get(`BankEntities`, { params: { filter } });
const hasData = data && data[0];
if (hasData) worker.bankEntityFk = data[0].id;
else if (!hasData) worker.bankEntityFk = undefined;
}
</script> </script>
<template> <template>
<FetchData <FetchData
@ -49,11 +74,6 @@ onBeforeMount(async () => {
@on-fetch="(data) => (companiesOptions = data)" @on-fetch="(data) => (companiesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Workers/search"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<FetchData <FetchData
url="Paymethods" url="Paymethods"
@on-fetch="(data) => (payMethodsOptions = data)" @on-fetch="(data) => (payMethodsOptions = data)"
@ -93,11 +113,13 @@ onBeforeMount(async () => {
v-model="data.firstName" v-model="data.firstName"
:label="t('worker.create.name')" :label="t('worker.create.name')"
:rules="validate('Worker.firstName')" :rules="validate('Worker.firstName')"
@update:model-value="generateCodeUser(data)"
/> />
<VnInput <VnInput
v-model="data.lastNames" v-model="data.lastNames"
:label="t('worker.create.lastName')" :label="t('worker.create.lastName')"
:rules="validate('Worker.lastNames')" :rules="validate('Worker.lastNames')"
@update:model-value="generateCodeUser(data)"
/> />
<VnInput <VnInput
v-model="data.code" v-model="data.code"
@ -130,7 +152,7 @@ onBeforeMount(async () => {
<VnSelect <VnSelect
:label="t('worker.create.boss')" :label="t('worker.create.boss')"
v-model="data.bossFk" v-model="data.bossFk"
:options="workersOptions" url="Workers/search"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected
@ -204,6 +226,7 @@ onBeforeMount(async () => {
:label="t('worker.create.iban')" :label="t('worker.create.iban')"
:rules="validate('Worker.iban')" :rules="validate('Worker.iban')"
:disable="formData.isFreelance" :disable="formData.isFreelance"
@update:model-value="autofillBic(data)"
> >
<template #append> <template #append>
<QIcon name="info" class="cursor-info"> <QIcon name="info" class="cursor-info">
@ -221,6 +244,8 @@ onBeforeMount(async () => {
:roles-allowed-to-create="['salesAssistant', 'hr']" :roles-allowed-to-create="['salesAssistant', 'hr']"
:rules="validate('Worker.bankEntity')" :rules="validate('Worker.bankEntity')"
:disable="formData.isFreelance" :disable="formData.isFreelance"
@update:model-value="autofillBic(data)"
:filter-options="['bic', 'name']"
> >
<template #form> <template #form>
<CreateBankEntityForm <CreateBankEntityForm

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { onBeforeMount, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
@ -16,16 +16,19 @@ import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import RightMenu from 'src/components/common/RightMenu.vue'; import RightMenu from 'src/components/common/RightMenu.vue';
import WorkerFilter from './WorkerFilter.vue'; import WorkerFilter from './WorkerFilter.vue';
import { useState } from 'src/composables/useState';
import axios from 'axios';
const { t } = useI18n(); const { t } = useI18n();
const tableRef = ref(); const tableRef = ref();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const companiesOptions = ref([]); const companiesOptions = ref([]);
const workersOptions = ref([]);
const payMethodsOptions = ref([]); const payMethodsOptions = ref([]);
const bankEntitiesOptions = ref([]); const bankEntitiesOptions = ref([]);
const postcodesOptions = ref([]); const postcodesOptions = ref([]);
const user = useState().getUser();
const defaultPayMethod = ref();
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
@ -82,6 +85,14 @@ const columns = computed(() => [
}, },
]); ]);
onBeforeMount(async () => {
defaultPayMethod.value = (
await axios.get('WorkerConfigs/findOne', {
params: { field: ['payMethodFk'] },
})
).data?.payMethodFk;
});
function handleLocation(data, location) { function handleLocation(data, location) {
const { town, code, provinceFk, countryFk } = location ?? {}; const { town, code, provinceFk, countryFk } = location ?? {};
data.postcode = code; data.postcode = code;
@ -98,6 +109,31 @@ function uppercaseStreetModel(data) {
}, },
}; };
} }
function generateCodeUser(worker) {
if (!worker.firstName || !worker.lastNames) return;
const totalName = worker.firstName.concat(' ' + worker.lastNames).toLowerCase();
const totalNameArray = totalName.split(' ');
let newCode = '';
for (let part of totalNameArray) newCode += part.charAt(0);
worker.code = newCode.toUpperCase().slice(0, 3);
worker.name = totalNameArray[0] + newCode.slice(1);
if (!worker.companyFk) worker.companyFk = user.companyFk;
}
async function autofillBic(worker) {
if (!worker || !worker.iban) return;
let bankEntityId = parseInt(worker.iban.substr(4, 4));
let filter = { where: { id: bankEntityId } };
const { data } = await axios.get(`BankEntities`, { params: { filter } });
worker.bankEntityFk = data?.[0]?.id ?? undefined;
}
</script> </script>
<template> <template>
<VnSearchbar <VnSearchbar
@ -110,11 +146,6 @@ function uppercaseStreetModel(data) {
@on-fetch="(data) => (companiesOptions = data)" @on-fetch="(data) => (companiesOptions = data)"
auto-load auto-load
/> />
<FetchData
url="Workers/search"
@on-fetch="(data) => (workersOptions = data)"
auto-load
/>
<FetchData <FetchData
url="Paymethods" url="Paymethods"
@on-fetch="(data) => (payMethodsOptions = data)" @on-fetch="(data) => (payMethodsOptions = data)"
@ -131,6 +162,7 @@ function uppercaseStreetModel(data) {
</template> </template>
</RightMenu> </RightMenu>
<VnTable <VnTable
v-if="defaultPayMethod"
ref="tableRef" ref="tableRef"
data-key="Worker" data-key="Worker"
url="Workers/filter" url="Workers/filter"
@ -139,6 +171,8 @@ function uppercaseStreetModel(data) {
title: t('Create worker'), title: t('Create worker'),
onDataSaved: ({ id }) => tableRef.redirect(id), onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: { formInitialData: {
payMethodFk: defaultPayMethod,
companyFk: user.companyFk,
isFreelance: false, isFreelance: false,
}, },
}" }"
@ -149,7 +183,7 @@ function uppercaseStreetModel(data) {
auto-load auto-load
> >
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<div class="q-pa-lg full-width" style="max-width: 1200px"> <div class="q-pa-lg full-width">
<VnRadio <VnRadio
v-model="data.isFreelance" v-model="data.isFreelance"
:val="false" :val="false"
@ -163,10 +197,16 @@ function uppercaseStreetModel(data) {
@update:model-value="delete data.payMethodFk" @update:model-value="delete data.payMethodFk"
/> />
<VnRow> <VnRow>
<VnInput v-model="data.firstName" :label="t('worker.create.name')" /> <VnInput
next
v-model="data.firstName"
:label="t('worker.create.name')"
@update:model-value="generateCodeUser(data)"
/>
<VnInput <VnInput
v-model="data.lastNames" v-model="data.lastNames"
:label="t('worker.create.lastName')" :label="t('worker.create.lastName')"
@update:model-value="generateCodeUser(data)"
/> />
<VnInput v-model="data.code" :label="t('worker.create.code')" /> <VnInput v-model="data.code" :label="t('worker.create.code')" />
</VnRow> </VnRow>
@ -189,7 +229,7 @@ function uppercaseStreetModel(data) {
<VnSelect <VnSelect
:label="t('worker.create.boss')" :label="t('worker.create.boss')"
v-model="data.bossFk" v-model="data.bossFk"
:options="workersOptions" url="Workers/search"
option-value="id" option-value="id"
option-label="name" option-label="name"
hide-selected hide-selected
@ -254,6 +294,7 @@ function uppercaseStreetModel(data) {
v-model="data.iban" v-model="data.iban"
:label="t('worker.create.iban')" :label="t('worker.create.iban')"
:disable="data.isFreelance" :disable="data.isFreelance"
@update:model-value="autofillBic(data)"
> >
<template #append> <template #append>
<QIcon name="info" class="cursor-info"> <QIcon name="info" class="cursor-info">
@ -272,6 +313,8 @@ function uppercaseStreetModel(data) {
hide-selected hide-selected
:roles-allowed-to-create="['salesAssistant', 'hr']" :roles-allowed-to-create="['salesAssistant', 'hr']"
:disable="data.isFreelance" :disable="data.isFreelance"
@update:model-value="autofillBic(data)"
:filter-options="['bic', 'name']"
> >
<template #form> <template #form>
<CreateBankEntityForm <CreateBankEntityForm

View File

@ -11,7 +11,7 @@ export default {
component: RouterView, component: RouterView,
redirect: { name: 'InvoiceInMain' }, redirect: { name: 'InvoiceInMain' },
menus: { menus: {
main: ['InvoiceInList'], main: ['InvoiceInList', 'InvoiceInSerial'],
card: [ card: [
'InvoiceInBasicData', 'InvoiceInBasicData',
'InvoiceInVat', 'InvoiceInVat',
@ -37,6 +37,16 @@ export default {
}, },
component: () => import('src/pages/InvoiceIn/InvoiceInList.vue'), component: () => import('src/pages/InvoiceIn/InvoiceInList.vue'),
}, },
{
path: 'serial',
name: 'InvoiceInSerial',
meta: {
title: 'serial',
icon: 'view_list',
},
component: () =>
import('src/pages/InvoiceIn/Serial/InvoiceInSerial.vue'),
},
{ {
path: 'create', path: 'create',
name: 'InvoiceInCreare', name: 'InvoiceInCreare',

View File

@ -10,12 +10,13 @@ describe('Route', () => {
it('Route list create route', () => { it('Route list create route', () => {
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click(); cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
cy.get('input[name="description"]').eq(1).type('routeTestOne{enter}'); cy.get('input[name="description"]').type('routeTestOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created'); cy.get('.q-notification__message').should('have.text', 'Data created');
cy.url().should('include', '/summary'); cy.url().should('include', '/summary');
}); });
it('Route list search and edit', () => { it('Route list search and edit', () => {
cy.get('#searchbar input').type('{enter}');
cy.get('input[name="description"]').type('routeTestOne{enter}'); cy.get('input[name="description"]').type('routeTestOne{enter}');
cy.get('.q-table tr') cy.get('.q-table tr')
.its('length') .its('length')

View File

@ -16,7 +16,7 @@ describe('Ticket descriptor', () => {
cy.openActionsDescriptor(); cy.openActionsDescriptor();
cy.get(toCloneOpt).click(); cy.get(toCloneOpt).click();
cy.clickConfirm(); cy.clickConfirm();
cy.get(warehouseValue).contains('-'); cy.get(warehouseValue).contains('Warehouse One');
cy.get(summaryHeader) cy.get(summaryHeader)
.invoke('text') .invoke('text')
.then((text) => { .then((text) => {

View File

@ -2,6 +2,9 @@ describe('WorkerCreate', () => {
const externalRadio = '.q-radio:nth-child(2)'; const externalRadio = '.q-radio:nth-child(2)';
const notification = '.q-notification__message'; const notification = '.q-notification__message';
const developerBossId = 120; const developerBossId = 120;
const payMethodCross =
'.grid-create .full-width > :nth-child(9) .q-select .q-field__append:not(.q-anchor--skip)';
const saveBtn = '.q-mt-lg > .q-btn--standard';
const internal = { const internal = {
Fi: { val: '78457139E' }, Fi: { val: '78457139E' },
@ -36,7 +39,8 @@ describe('WorkerCreate', () => {
it('should throw an error if a pay method has not been selected', () => { it('should throw an error if a pay method has not been selected', () => {
cy.fillInForm(internal); cy.fillInForm(internal);
cy.get('.q-mt-lg > .q-btn--standard').click(); cy.get(payMethodCross).click();
cy.get(saveBtn).click();
cy.get(notification).should('contains.text', 'Payment method is required'); cy.get(notification).should('contains.text', 'Payment method is required');
}); });
@ -45,14 +49,14 @@ describe('WorkerCreate', () => {
...internal, ...internal,
'Pay method': { val: 'PayMethod one', type: 'select' }, 'Pay method': { val: 'PayMethod one', type: 'select' },
}); });
cy.get('.q-mt-lg > .q-btn--standard').click(); cy.get(saveBtn).click();
cy.get(notification).should('contains.text', 'Data created'); cy.get(notification).should('contains.text', 'Data created');
}); });
it('should create an external', () => { it('should create an external', () => {
cy.get(externalRadio).click(); cy.get(externalRadio).click();
cy.fillInForm(external); cy.fillInForm(external);
cy.get('.q-mt-lg > .q-btn--standard').click(); cy.get(saveBtn).click();
cy.get(notification).should('contains.text', 'Data created'); cy.get(notification).should('contains.text', 'Data created');
}); });
}); });