Compare commits
29 Commits
dev
...
6919-syncD
Author | SHA1 | Date |
---|---|---|
Jorge Penadés | 386f2e3126 | |
Jorge Penadés | 06b61a52f6 | |
Jorge Penadés | 79d6f133a1 | |
Jorge Penadés | 51b3283ff7 | |
Jorge Penadés | fc247ae413 | |
Jorge Penadés | efcf3be585 | |
Jorge Penadés | 5b9f9d38a2 | |
Jorge Penadés | 96e7bf78c5 | |
Jorge Penadés | 96e9d1a00a | |
Jorge Penadés | 617af7b7cb | |
Jorge Penadés | a44ea9384a | |
Jorge Penadés | dcd681b656 | |
Jorge Penadés | 02a1554b21 | |
Jorge Penadés | 72ce3615d0 | |
Jorge Penadés | 7962dbc26a | |
Jorge Penadés | 1c86c874e0 | |
Jorge Penadés | 4ecc8c213e | |
Jorge Penadés | 3477b24c93 | |
Jorge Penadés | c2e4380f18 | |
Jorge Penadés | 71e469542a | |
Jorge Penadés | f20660839a | |
Jorge Penadés | 8af09d46ed | |
Jorge Penadés | 00b7883aed | |
Jorge Penadés | 0f48b6fa4d | |
Jorge Penadés | 94c8f538ea | |
Jorge Penadés | fec9ef25bf | |
Jorge Penadés | 84f22cfeb8 | |
Jorge Penadés | b67489aae8 | |
Jorge Penadés | 565ec15589 |
186
CHANGELOG.md
186
CHANGELOG.md
|
@ -1,189 +1,3 @@
|
||||||
# Version 24.48 - 2024-11-25
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- chore: correct checkNotification (fix_customer_issues) by:alexm
|
|
||||||
- chore: perf (warmFix_order_equalSalix) by:alexm
|
|
||||||
- chore: refs #6818 add spaces by:jorgep
|
|
||||||
- chore: refs #6818 drop useless code & comment by:jorgep
|
|
||||||
- chore: refs #7273 sticky add btn & refactor by:jorgep
|
|
||||||
- chore: refs #7524 fix test by:jorgep
|
|
||||||
- chore: refs #8039 not required by:alexm
|
|
||||||
- chore: refs #8078 fiz tests by:jorgep
|
|
||||||
- chore: refs #8078 rollback ref by:jorgep
|
|
||||||
- chore: remove console.log (warmFix_invoiceOut_Global) by:alexm
|
|
||||||
- chore: typo (fix_itemType-redirection) by:alexm
|
|
||||||
- feat: #6943 use openURL quasar by:Javier Segarra
|
|
||||||
- feat: #7782 add cypress report by:Javier Segarra
|
|
||||||
- feat: #7782 cypress.config watchForFileChanges by:Javier Segarra
|
|
||||||
- feat: #7782 npm run resetDatabase by:Javier Segarra
|
|
||||||
- feat: #7782 waitUntil domContentLoad by:Javier Segarra
|
|
||||||
- feat: added composable to confirm orders by:Jon
|
|
||||||
- feat: add /reports in gitignore (warmFix_reports_in_gitignore) by:alexm
|
|
||||||
- feat: apply changes for customerModule by:Javier Segarra
|
|
||||||
- feat: disabled buttons by:Javier Segarra
|
|
||||||
- feat: move buttons to DescriptorMenu by:Javier Segarra
|
|
||||||
- feat: refs #6818 add icon by:jorgep
|
|
||||||
- feat: refs #6818 fetch url & default channel by:jorgep
|
|
||||||
- feat: refs #6818 saysimple integration by:jorgep
|
|
||||||
- feat: refs #6839 module searching (6839-addSearchMenu) by:jorgep
|
|
||||||
- feat: refs #6839 normalize search by:jorgep
|
|
||||||
- feat: refs #6919 sync entry data by:jorgep
|
|
||||||
- feat: refs #7006 itemType basic data new inputs by:guillermo
|
|
||||||
- feat: refs #7006 itemTypeLog added by:guillermo
|
|
||||||
- feat: refs #7193 modified parking to use the scope and corrected small errors by:Jon
|
|
||||||
- feat: refs #7206 added inactive label and corrected minor errors by:Jon
|
|
||||||
- feat: refs #7308 #7308 remove warnings related to useSession by:Javier Segarra
|
|
||||||
- feat: refs #7349 usa back con permisos by:jgallego
|
|
||||||
- feat: refs #7524 add front test by:jorgep
|
|
||||||
- feat: refs #7874 improve vn-notes ui by:jorgep
|
|
||||||
- feat: refs #7970 notify changes by:Jon
|
|
||||||
- feat(): refs #8039 canceledError not notify by:alexm
|
|
||||||
- feat: refs #8039 notify error unify by:alexm
|
|
||||||
- feat: refs #8039 show duplicate request in local by:alexm
|
|
||||||
- feat: refs #8078 add shortcut multi selection by:jorgep
|
|
||||||
- feat: refs #8078 add tests by:jorgep
|
|
||||||
- feat: refs#8087 Redadas en travel by:Carlos Andrés
|
|
||||||
- feat: refs #8087 Traspasar redadas a travels by:Carlos Andrés
|
|
||||||
- feat: remove comments by:Javier Segarra
|
|
||||||
- feat(Supplier): add companySize by:alexm
|
|
||||||
- feat: use composable to unify logic by:Javier Segarra
|
|
||||||
- feat(VnInput): empty to null by:alexm
|
|
||||||
- feat(VnSelect): order data equal salix by:alexm
|
|
||||||
- feat(VnSelect): refs #7136 add scroll (7136-vnSelect_paginate_simplify_2) by:alexm
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- chore: perf (warmFix_order_equalSalix) by:alexm
|
|
||||||
- chore: refs #7273 sticky add btn & refactor by:jorgep
|
|
||||||
- fix: better performance (warmFix_accountAcls) by:alexm
|
|
||||||
- perf: minor bugs detected by:Javier Segarra
|
|
||||||
- perf: refs #6943 #6943 merge command by:Javier Segarra
|
|
||||||
- perf: refs #7283 #7283 declare composable inst4ead code duplicated by:Javier Segarra
|
|
||||||
- perf: refs #7283 #7283 handle composable i18n by:Javier Segarra
|
|
||||||
- perf: refs #7283 #7283 handle i18n by:Javier Segarra
|
|
||||||
- perf: refs #7283 #7283 i18n params by:Javier Segarra
|
|
||||||
- perf: refs #7308 #7308 remove comments by:Javier Segarra
|
|
||||||
- perf: remove appendParams by:Javier Segarra
|
|
||||||
- perf: use const in VnLocation by:Javier Segarra
|
|
||||||
- perf: use required instead :required="true" by:Javier Segarra
|
|
||||||
- refactor: apply QPopupProxy by:wbuezas
|
|
||||||
- refactor: changed confirmOrder directory by:Jon
|
|
||||||
- refactor: change keyup.enter for update:model-value by:wbuezas
|
|
||||||
- refactor(InvoiceInBasicData): use VnDms by:alexm
|
|
||||||
- refactor: modified composable by:Jon
|
|
||||||
- refactor: refs #6818 change channel source by:jorgep
|
|
||||||
- refactor: refs #6818 channel logic by:jorgep
|
|
||||||
- refactor: refs #6919 export filter by:jorgep
|
|
||||||
- refactor: refs #7132 1st wave of changes in global translations files by:Jon
|
|
||||||
- refactor: refs #7132 account's module translations by:Jon
|
|
||||||
- refactor: refs #7132 customer's module translations by:Jon
|
|
||||||
- refactor: refs #7132 deleted pageTitles repeated by:Jon
|
|
||||||
- refactor: refs #7132 delete duplicate translations' keys by:Jon
|
|
||||||
- refactor: refs #7132 deleted useless code by:Jon
|
|
||||||
- refactor: refs #7132 global translations files changed by:Jon
|
|
||||||
- refactor: refs #7266 Changed method name by:guillermo
|
|
||||||
- refactor: refs #7950 Created cmr model by:guillermo
|
|
||||||
- refactor: refs #7970 added emit by:Jon
|
|
||||||
- refactor: refs #7970 refactored VnConfirm to emit events by:Jon
|
|
||||||
- refactor: refs #8185 modified LeftMenu to avoid duplicates by:Jon
|
|
||||||
- refactor: remove unused variable by:wbuezas
|
|
||||||
- refactor: revert catalog changes by:Jon
|
|
||||||
- refactor: small change by:wbuezas
|
|
||||||
- test: refactor e2e by:alexm
|
|
||||||
- test: refs #8039 add hasNotify and, refactor: agencyWorkCenter test by:alexm
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- chore: refs #7524 fix test by:jorgep
|
|
||||||
- fix: better performance (warmFix_accountAcls) by:alexm
|
|
||||||
- fix: catalog view category and type filter by:wbuezas
|
|
||||||
- fix: category and tags filters by:Jon
|
|
||||||
- fix: changed route.query by:Jon
|
|
||||||
- fix: change type vnput by:Javier Segarra
|
|
||||||
- fix(ClaimList): stateCode orderBy priority by:alexm
|
|
||||||
- fix: entryFilters by:carlossa
|
|
||||||
- fix: filter panel by:Jon
|
|
||||||
- fix(InvoiceOutGlobal): parallelism by:alexm
|
|
||||||
- fix: itemBotanical by:Javier Segarra
|
|
||||||
- fix: itemType redirection and fix filters by:alexm
|
|
||||||
- fix: logout spec (warmFix_logout.spec) by:alexm
|
|
||||||
- fix: merge errors by:alexm
|
|
||||||
- fix: order catalog by:wbuezas
|
|
||||||
- fix: order catalog fixes by:wbuezas
|
|
||||||
- fix: refs #6818 use right icon by:jorgep
|
|
||||||
- fix: refs #6896 fixed module problems by:Jon
|
|
||||||
- fix: refs #7193 fixed e2e test by:Jon
|
|
||||||
- fix: refs #7206 deleted duplicate code by:Jon
|
|
||||||
- fix: refs #7273 use same filter by:jorgep
|
|
||||||
- fix: refs #7283 #7283 bugs by:Javier Segarra
|
|
||||||
- fix: refs #7283 #7283 ItemDiary subToolbar by:Javier Segarra
|
|
||||||
- fix: refs #7283 #7283 ItemSummary bugs by:Javier Segarra
|
|
||||||
- fix: refs #7283 Account image resolution by:guillermo
|
|
||||||
- fix: refs #7283 css by:jorgep
|
|
||||||
- fix: refs #7283 filter by:carlossa
|
|
||||||
- fix: refs #7283 fix image by:carlossa
|
|
||||||
- fix: refs #7283 fix pr by:carlossa
|
|
||||||
- fix: refs #7283 fix preview by:carlossa
|
|
||||||
- fix: refs #7283 fix required by:carlossa
|
|
||||||
- fix: refs #7283 item filters by:carlossa
|
|
||||||
- fix: refs #7283 itemtype fix by:carlossa
|
|
||||||
- fix: refs #7283 order translation by:carlossa
|
|
||||||
- fix: refs #7283 preview by:carlossa
|
|
||||||
- fix: refs #7283 tooltips !Item by:Javier Segarra
|
|
||||||
- fix: refs #7306 clean warning by:carlossa
|
|
||||||
- fix: refs #7310 clean warning by:carlossa
|
|
||||||
- fix: refs #7323 locale #7396 by:jorgep
|
|
||||||
- fix: refs #7323 show advanced fields by:jorgep
|
|
||||||
- fix: refs #7349 dependencia no usada by:jgallego
|
|
||||||
- fix: refs #7524 e2e & worker module by:jorgep
|
|
||||||
- fix: refs #7874 add title by:jorgep
|
|
||||||
- fix: refs #7874 show name by:jorgep
|
|
||||||
- fix: refs #7943 use correct data-key by:jorgep
|
|
||||||
- fix: refs #7943 use summary by:jorgep
|
|
||||||
- fix: refs #8039 bad tests by:alexm
|
|
||||||
- fix: refs #8039 o not handle unnecessary errors by:alexm
|
|
||||||
- fix: refs #8078 e2e #7970 by:jorgep
|
|
||||||
- fix: refs #8078 handleSelection by:jorgep
|
|
||||||
- fix: refs #8078 improve cy command (8078-enableMultiSelection) by:jorgep
|
|
||||||
- fix: refs #8078 improve handleSelection by:jorgep
|
|
||||||
- fix: reset category by:wbuezas
|
|
||||||
- fix: tag chips by:Jon
|
|
||||||
- fix: vnSearchbar spec (warmFix_vnSearchBar.spec) by:alexm
|
|
||||||
- fix(VnSelect): setOptions when applyFilter by:alexm
|
|
||||||
- fix: worker test e2e by:Jon
|
|
||||||
- Merge branch 'dev' into fix_customer_issues by:Javier Segarra
|
|
||||||
- refactor: revert catalog changes by:Jon
|
|
||||||
- refs #7283 fix conflicts by:carlossa
|
|
||||||
- refs #7283 fix descriptorproxy by:carlossa
|
|
||||||
- refs #7283 fixedPrice by:carlossa
|
|
||||||
- refs #7283 fixedPrices by:carlossa
|
|
||||||
- refs #7283 fix itemFixed by:carlossa
|
|
||||||
- refs #7283 fix itemFixedPrice by:carlossa
|
|
||||||
- refs #7283 fix itemMigration by:carlossa
|
|
||||||
- refs #7283 fix itemMigration list filters by:carlossa
|
|
||||||
- refs #7283 fix items by:carlossa
|
|
||||||
- refs #7283 fix items error get images by:carlossa
|
|
||||||
- refs #7283 fix items images by:carlossa
|
|
||||||
- refs #7283 fix request by:carlossa
|
|
||||||
- refs #7283 fix searchbar by:carlossa
|
|
||||||
- refs #7283 fix viewSummary by:carlossa
|
|
||||||
- refs #7283 fix yml list basicData by:carlossa
|
|
||||||
- refs #7283 itemRequest fix by:carlossa
|
|
||||||
- refs #7283 itemRequest fix deny by:carlossa
|
|
||||||
- refs #7283 itemRequest fix reload by:carlossa
|
|
||||||
- refs #72983 fix filters by:carlossa
|
|
||||||
- revert: commit by:Javier Segarra
|
|
||||||
- revert e57a253c6f649382da187d1129449d265fb26d3b by:Javier Segarra
|
|
||||||
- test: #8162 fix clientList spec by:Javier Segarra
|
|
||||||
- test: #8162 fix vnLocation spec by:Javier Segarra
|
|
||||||
- test: fix arrayData by:Javier Segarra
|
|
||||||
- test: fix e2e by:alexm
|
|
||||||
- test: fix e2e by:Javier Segarra
|
|
||||||
- test: refs #8039 fix WorkerNotification e2e by:alexm
|
|
||||||
- test: refs #8039 fix ZoneWarehouse e2e by:alexm
|
|
||||||
- warmfix: ItemLastEntries to date (origin/warmfix_itemLastEntriesFilter) by:Javier Segarra
|
|
||||||
|
|
||||||
# Version 24.40 - 2024-10-02
|
# Version 24.40 - 2024-10-02
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
const { defineConfig } = require('cypress');
|
const { defineConfig } = require('cypress');
|
||||||
// https://docs.cypress.io/app/tooling/reporters
|
|
||||||
// https://docs.cypress.io/app/references/configuration
|
|
||||||
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
|
@ -19,7 +16,6 @@ module.exports = defineConfig({
|
||||||
reporterOptions: {
|
reporterOptions: {
|
||||||
charts: true,
|
charts: true,
|
||||||
reportPageTitle: 'Cypress Inline Reporter',
|
reportPageTitle: 'Cypress Inline Reporter',
|
||||||
reportFilename: '[status]_[datetime]-report',
|
|
||||||
embeddedScreenshots: true,
|
embeddedScreenshots: true,
|
||||||
reportDir: 'test/cypress/reports',
|
reportDir: 'test/cypress/reports',
|
||||||
inlineAssets: true,
|
inlineAssets: true,
|
||||||
|
|
|
@ -9,6 +9,8 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FormModelPopup from './FormModelPopup.vue';
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
|
defineProps({ showEntityField: { type: Boolean, default: true } });
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved']);
|
const emit = defineEmits(['onDataSaved']);
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const bicInputRef = ref(null);
|
const bicInputRef = ref(null);
|
||||||
|
@ -16,16 +18,17 @@ const state = useState();
|
||||||
|
|
||||||
const customer = computed(() => state.get('customer'));
|
const customer = computed(() => state.get('customer'));
|
||||||
|
|
||||||
const countriesFilter = {
|
|
||||||
fields: ['id', 'name', 'code'],
|
|
||||||
};
|
|
||||||
|
|
||||||
const bankEntityFormData = reactive({
|
const bankEntityFormData = reactive({
|
||||||
name: null,
|
name: null,
|
||||||
bic: null,
|
bic: null,
|
||||||
countryFk: customer.value?.countryFk,
|
countryFk: customer.value?.countryFk,
|
||||||
|
id: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const countriesFilter = {
|
||||||
|
fields: ['id', 'name', 'code'],
|
||||||
|
};
|
||||||
|
|
||||||
const countriesOptions = ref([]);
|
const countriesOptions = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (...args) => {
|
const onDataSaved = (...args) => {
|
||||||
|
@ -41,6 +44,7 @@ onMounted(async () => {
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Countries"
|
url="Countries"
|
||||||
|
:filter="countriesFilter"
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => (countriesOptions = data)"
|
@on-fetch="(data) => (countriesOptions = data)"
|
||||||
/>
|
/>
|
||||||
|
@ -50,7 +54,6 @@ onMounted(async () => {
|
||||||
:title="t('title')"
|
:title="t('title')"
|
||||||
:subtitle="t('subtitle')"
|
:subtitle="t('subtitle')"
|
||||||
:form-initial-data="bankEntityFormData"
|
:form-initial-data="bankEntityFormData"
|
||||||
:filter="countriesFilter"
|
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
|
@ -82,13 +85,7 @@ onMounted(async () => {
|
||||||
:rules="validate('bankEntity.countryFk')"
|
:rules="validate('bankEntity.countryFk')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-if="showEntityField" class="col">
|
||||||
v-if="
|
|
||||||
countriesOptions.find((c) => c.id === data.countryFk)?.code ==
|
|
||||||
'ES'
|
|
||||||
"
|
|
||||||
class="col"
|
|
||||||
>
|
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('id')"
|
:label="t('id')"
|
||||||
v-model="data.id"
|
v-model="data.id"
|
||||||
|
|
|
@ -17,6 +17,10 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
provinces: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -44,16 +48,15 @@ const onDataSaved = (...args) => {
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Name')"
|
:label="t('Names')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('city.name')"
|
:rules="validate('city.name')"
|
||||||
required
|
|
||||||
/>
|
/>
|
||||||
<VnSelectProvince
|
<VnSelectProvince
|
||||||
:province-selected="$props.provinceSelected"
|
:province-selected="$props.provinceSelected"
|
||||||
:country-fk="$props.countryFk"
|
:country-fk="$props.countryFk"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
required
|
:provinces="$props.provinces"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, ref } from 'vue';
|
import { reactive, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
@ -22,14 +22,12 @@ const postcodeFormData = reactive({
|
||||||
townFk: null,
|
townFk: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const townsFetchDataRef = ref(false);
|
const townsFetchDataRef = ref(null);
|
||||||
const countriesRef = ref(false);
|
const provincesFetchDataRef = ref(null);
|
||||||
const townsRef = ref(false);
|
const countriesOptions = ref([]);
|
||||||
const provincesFetchDataRef = ref(false);
|
|
||||||
const provincesOptions = ref([]);
|
const provincesOptions = ref([]);
|
||||||
|
const townsOptions = ref([]);
|
||||||
const town = ref({});
|
const town = ref({});
|
||||||
const townFilter = ref({});
|
|
||||||
const countryFilter = ref({});
|
|
||||||
|
|
||||||
function onDataSaved(formData) {
|
function onDataSaved(formData) {
|
||||||
const newPostcode = {
|
const newPostcode = {
|
||||||
|
@ -41,7 +39,7 @@ function onDataSaved(formData) {
|
||||||
({ id }) => id === formData.provinceFk
|
({ id }) => id === formData.provinceFk
|
||||||
);
|
);
|
||||||
newPostcode.province = provinceObject?.name;
|
newPostcode.province = provinceObject?.name;
|
||||||
const countryObject = countriesRef.value.opts.find(
|
const countryObject = countriesOptions.value.find(
|
||||||
({ id }) => id === formData.countryFk
|
({ id }) => id === formData.countryFk
|
||||||
);
|
);
|
||||||
newPostcode.country = countryObject?.name;
|
newPostcode.country = countryObject?.name;
|
||||||
|
@ -58,19 +56,10 @@ async function onCityCreated(newTown, formData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTown(newTown, data) {
|
function setTown(newTown, data) {
|
||||||
|
if (!newTown) return;
|
||||||
town.value = newTown;
|
town.value = newTown;
|
||||||
data.provinceFk = newTown?.provinceFk ?? newTown;
|
data.provinceFk = newTown.provinceFk;
|
||||||
data.countryFk = newTown?.province?.countryFk ?? newTown;
|
data.countryFk = newTown.province.countryFk;
|
||||||
}
|
|
||||||
|
|
||||||
async function setCountry(countryFk, data) {
|
|
||||||
data.townFk = null;
|
|
||||||
data.provinceFk = null;
|
|
||||||
data.countryFk = countryFk;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleProvinces(data) {
|
|
||||||
provincesOptions.value = data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setProvince(id, data) {
|
async function setProvince(id, data) {
|
||||||
|
@ -84,16 +73,61 @@ async function onProvinceCreated(data) {
|
||||||
await provincesFetchDataRef.value.fetch({
|
await provincesFetchDataRef.value.fetch({
|
||||||
where: { countryFk: postcodeFormData.countryFk },
|
where: { countryFk: postcodeFormData.countryFk },
|
||||||
});
|
});
|
||||||
postcodeFormData.provinceFk = data.id;
|
postcodeFormData.provinceFk.value = data.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const whereTowns = computed(() => {
|
watch(
|
||||||
return {
|
() => [postcodeFormData.countryFk],
|
||||||
|
async (newCountryFk, oldValueFk) => {
|
||||||
|
if (Array.isArray(newCountryFk)) {
|
||||||
|
newCountryFk = newCountryFk[0];
|
||||||
|
}
|
||||||
|
if (Array.isArray(oldValueFk)) {
|
||||||
|
oldValueFk = oldValueFk[0];
|
||||||
|
}
|
||||||
|
if (!!oldValueFk && newCountryFk !== oldValueFk) {
|
||||||
|
postcodeFormData.provinceFk = null;
|
||||||
|
postcodeFormData.townFk = null;
|
||||||
|
}
|
||||||
|
if (oldValueFk !== newCountryFk) {
|
||||||
|
await provincesFetchDataRef.value.fetch({
|
||||||
|
where: {
|
||||||
|
countryFk: newCountryFk,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await townsFetchDataRef.value.fetch({
|
||||||
|
where: {
|
||||||
provinceFk: {
|
provinceFk: {
|
||||||
inq: provincesOptions.value.map(({ id }) => id),
|
inq: provincesOptions.value.map(({ id }) => id),
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => postcodeFormData.provinceFk,
|
||||||
|
async (newProvinceFk, oldValueFk) => {
|
||||||
|
if (Array.isArray(newProvinceFk)) {
|
||||||
|
newProvinceFk = newProvinceFk[0];
|
||||||
|
}
|
||||||
|
if (newProvinceFk !== oldValueFk) {
|
||||||
|
await townsFetchDataRef.value.fetch({
|
||||||
|
where: { provinceFk: newProvinceFk },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
async function handleProvinces(data) {
|
||||||
|
provincesOptions.value = data;
|
||||||
|
}
|
||||||
|
async function handleTowns(data) {
|
||||||
|
townsOptions.value = data;
|
||||||
|
}
|
||||||
|
async function handleCountries(data) {
|
||||||
|
countriesOptions.value = data;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -105,6 +139,14 @@ const whereTowns = computed(() => {
|
||||||
auto-load
|
auto-load
|
||||||
url="Provinces/location"
|
url="Provinces/location"
|
||||||
/>
|
/>
|
||||||
|
<FetchData
|
||||||
|
ref="townsFetchDataRef"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
:limit="30"
|
||||||
|
@on-fetch="handleTowns"
|
||||||
|
auto-load
|
||||||
|
url="Towns/location"
|
||||||
|
/>
|
||||||
|
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
url-create="postcodes"
|
url-create="postcodes"
|
||||||
|
@ -122,26 +164,19 @@ const whereTowns = computed(() => {
|
||||||
v-model="data.code"
|
v-model="data.code"
|
||||||
:rules="validate('postcode.code')"
|
:rules="validate('postcode.code')"
|
||||||
clearable
|
clearable
|
||||||
required
|
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
ref="townsRef"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
:limit="30"
|
|
||||||
auto-load
|
|
||||||
url="Towns/location"
|
|
||||||
:where="whereTowns"
|
|
||||||
:label="t('City')"
|
:label="t('City')"
|
||||||
@update:model-value="(value) => setTown(value, data)"
|
@update:model-value="(value) => setTown(value, data)"
|
||||||
:tooltip="t('Create city')"
|
:tooltip="t('Create city')"
|
||||||
v-model="data.townFk"
|
v-model="data.townFk"
|
||||||
|
:options="townsOptions"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
:rules="validate('postcode.city')"
|
:rules="validate('postcode.city')"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
required
|
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -158,6 +193,7 @@ const whereTowns = computed(() => {
|
||||||
<CreateNewCityForm
|
<CreateNewCityForm
|
||||||
:country-fk="data.countryFk"
|
:country-fk="data.countryFk"
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
|
:provinces="provincesOptions"
|
||||||
@on-data-saved="
|
@on-data-saved="
|
||||||
(_, requestResponse) =>
|
(_, requestResponse) =>
|
||||||
onCityCreated(requestResponse, data)
|
onCityCreated(requestResponse, data)
|
||||||
|
@ -172,25 +208,20 @@ const whereTowns = computed(() => {
|
||||||
:province-selected="data.provinceFk"
|
:province-selected="data.provinceFk"
|
||||||
@update:model-value="(value) => setProvince(value, data)"
|
@update:model-value="(value) => setProvince(value, data)"
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
@on-province-fetched="handleProvinces"
|
:clearable="true"
|
||||||
|
:provinces="provincesOptions"
|
||||||
@on-province-created="onProvinceCreated"
|
@on-province-created="onProvinceCreated"
|
||||||
required
|
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
ref="countriesRef"
|
|
||||||
:limit="30"
|
|
||||||
:filter="countryFilter"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
auto-load
|
|
||||||
url="Countries"
|
url="Countries"
|
||||||
required
|
:sort-by="['name ASC']"
|
||||||
:label="t('Country')"
|
:label="t('Country')"
|
||||||
|
@update:options="handleCountries"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="data.countryFk"
|
v-model="data.countryFk"
|
||||||
:rules="validate('postcode.countryFk')"
|
:rules="validate('postcode.countryFk')"
|
||||||
@update:model-value="(value) => setCountry(value, data)"
|
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
@ -20,24 +21,34 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
provinces: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const autonomiesRef = ref([]);
|
const autonomiesOptions = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (dataSaved, requestResponse) => {
|
const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
requestResponse.autonomy = autonomiesRef.value.opts.find(
|
requestResponse.autonomy = autonomiesOptions.value.find(
|
||||||
(autonomy) => autonomy.id == requestResponse.autonomyFk
|
(autonomy) => autonomy.id == requestResponse.autonomyFk
|
||||||
);
|
);
|
||||||
emit('onDataSaved', dataSaved, requestResponse);
|
emit('onDataSaved', dataSaved, requestResponse);
|
||||||
};
|
};
|
||||||
const where = computed(() => {
|
|
||||||
if (!$props.countryFk) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
return { countryFk: $props.countryFk };
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
@on-fetch="(data) => (autonomiesOptions = data)"
|
||||||
|
auto-load
|
||||||
|
:filter="{
|
||||||
|
where: {
|
||||||
|
countryFk: $props.countryFk,
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
url="Autonomies/location"
|
||||||
|
:sort-by="['name ASC']"
|
||||||
|
:limit="30"
|
||||||
|
/>
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
:title="t('New province')"
|
:title="t('New province')"
|
||||||
:subtitle="t('Please, ensure you put the correct data!')"
|
:subtitle="t('Please, ensure you put the correct data!')"
|
||||||
|
@ -52,17 +63,10 @@ const where = computed(() => {
|
||||||
:label="t('Name')"
|
:label="t('Name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('province.name')"
|
:rules="validate('province.name')"
|
||||||
required
|
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
required
|
|
||||||
ref="autonomiesRef"
|
|
||||||
auto-load
|
|
||||||
:where="where"
|
|
||||||
url="Autonomies/location"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
:limit="30"
|
|
||||||
:label="t('Autonomy')"
|
:label="t('Autonomy')"
|
||||||
|
:options="autonomiesOptions"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
|
@ -10,7 +10,6 @@ import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import SkeletonTable from 'components/ui/SkeletonTable.vue';
|
import SkeletonTable from 'components/ui/SkeletonTable.vue';
|
||||||
import { tMobile } from 'src/composables/tMobile';
|
import { tMobile } from 'src/composables/tMobile';
|
||||||
import getDifferences from 'src/filters/getDifferences';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
@ -95,7 +94,6 @@ defineExpose({
|
||||||
saveChanges,
|
saveChanges,
|
||||||
getChanges,
|
getChanges,
|
||||||
formData,
|
formData,
|
||||||
originalData,
|
|
||||||
vnPaginateRef,
|
vnPaginateRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -176,13 +174,14 @@ async function saveChanges(data) {
|
||||||
const changes = data || getChanges();
|
const changes = data || getChanges();
|
||||||
try {
|
try {
|
||||||
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
||||||
} finally {
|
} catch (e) {
|
||||||
isLoading.value = false;
|
return (isLoading.value = false);
|
||||||
}
|
}
|
||||||
originalData.value = JSON.parse(JSON.stringify(formData.value));
|
originalData.value = JSON.parse(JSON.stringify(formData.value));
|
||||||
if (changes.creates?.length) await vnPaginateRef.value.fetch();
|
if (changes.creates?.length) await vnPaginateRef.value.fetch();
|
||||||
|
|
||||||
hasChanges.value = false;
|
hasChanges.value = false;
|
||||||
|
isLoading.value = false;
|
||||||
emit('saveChanges', data);
|
emit('saveChanges', data);
|
||||||
quasar.notify({
|
quasar.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
|
@ -268,6 +267,28 @@ function getChanges() {
|
||||||
return changes;
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDifferences(obj1, obj2) {
|
||||||
|
let diff = {};
|
||||||
|
delete obj1.$index;
|
||||||
|
delete obj2.$index;
|
||||||
|
|
||||||
|
for (let key in obj1) {
|
||||||
|
if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
|
||||||
|
diff[key] = obj2[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let key in obj2) {
|
||||||
|
if (
|
||||||
|
obj1[key] === undefined ||
|
||||||
|
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])
|
||||||
|
) {
|
||||||
|
diff[key] = obj2[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return diff;
|
||||||
|
}
|
||||||
|
|
||||||
function isEmpty(obj) {
|
function isEmpty(obj) {
|
||||||
if (obj == null) return true;
|
if (obj == null) return true;
|
||||||
if (obj === undefined) return true;
|
if (obj === undefined) return true;
|
||||||
|
@ -373,7 +394,6 @@ watch(formUrl, async () => {
|
||||||
@click="onSubmit"
|
@click="onSubmit"
|
||||||
:disable="!hasChanges"
|
:disable="!hasChanges"
|
||||||
:title="t('globals.save')"
|
:title="t('globals.save')"
|
||||||
data-cy="crudModelDefaultSaveBtn"
|
|
||||||
/>
|
/>
|
||||||
<slot name="moreAfterActions" />
|
<slot name="moreAfterActions" />
|
||||||
</QBtnGroup>
|
</QBtnGroup>
|
||||||
|
|
|
@ -156,6 +156,7 @@ const rotateRight = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
|
try {
|
||||||
if (!newPhoto.files && !newPhoto.url) {
|
if (!newPhoto.files && !newPhoto.url) {
|
||||||
notify(t('Select an image'), 'negative');
|
notify(t('Select an image'), 'negative');
|
||||||
return;
|
return;
|
||||||
|
@ -172,6 +173,9 @@ const onSubmit = () => {
|
||||||
newPhoto.blob = file;
|
newPhoto.blob = file;
|
||||||
})
|
})
|
||||||
.then(() => makeRequest());
|
.then(() => makeRequest());
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error uploading image');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const makeRequest = async () => {
|
const makeRequest = async () => {
|
||||||
|
|
|
@ -51,6 +51,7 @@ const onDataSaved = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
try {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
||||||
const payload = {
|
const payload = {
|
||||||
|
@ -62,6 +63,9 @@ const onSubmit = async () => {
|
||||||
await axios.post($props.editUrl, payload);
|
await axios.post($props.editUrl, payload);
|
||||||
onDataSaved();
|
onDataSaved();
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error submitting table cell edit');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -84,6 +84,7 @@ const tableColumns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
try {
|
||||||
let filter = itemFilter;
|
let filter = itemFilter;
|
||||||
const params = itemFilterParams;
|
const params = itemFilterParams;
|
||||||
const where = {};
|
const where = {};
|
||||||
|
@ -108,6 +109,9 @@ const onSubmit = async () => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
tableRows.value = data;
|
tableRows.value = data;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching entries items');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -86,6 +86,7 @@ const tableColumns = computed(() => [
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
try {
|
||||||
let filter = travelFilter;
|
let filter = travelFilter;
|
||||||
const params = travelFilterParams;
|
const params = travelFilterParams;
|
||||||
const where = {};
|
const where = {};
|
||||||
|
@ -108,6 +109,9 @@ const onSubmit = async () => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
tableRows.value = data;
|
tableRows.value = data;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching travels');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -91,10 +91,6 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
maxWidth: {
|
|
||||||
type: [String, Boolean],
|
|
||||||
default: '800px',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||||
const modelValue = computed(
|
const modelValue = computed(
|
||||||
|
@ -110,7 +106,6 @@ const originalData = ref({});
|
||||||
const formData = computed(() => state.get(modelValue));
|
const formData = computed(() => state.get(modelValue));
|
||||||
const defaultButtons = computed(() => ({
|
const defaultButtons = computed(() => ({
|
||||||
save: {
|
save: {
|
||||||
dataCy: 'saveDefaultBtn',
|
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
icon: 'save',
|
icon: 'save',
|
||||||
label: 'globals.save',
|
label: 'globals.save',
|
||||||
|
@ -118,7 +113,6 @@ const defaultButtons = computed(() => ({
|
||||||
type: 'submit',
|
type: 'submit',
|
||||||
},
|
},
|
||||||
reset: {
|
reset: {
|
||||||
dataCy: 'resetDefaultBtn',
|
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
icon: 'restart_alt',
|
icon: 'restart_alt',
|
||||||
label: 'globals.reset',
|
label: 'globals.reset',
|
||||||
|
@ -137,7 +131,13 @@ onMounted(async () => {
|
||||||
|
|
||||||
if (!$props.formInitialData) {
|
if (!$props.formInitialData) {
|
||||||
if ($props.autoLoad && $props.url) await fetch();
|
if ($props.autoLoad && $props.url) await fetch();
|
||||||
else if (arrayData.store.data) updateAndEmit('onFetch', arrayData.store.data);
|
else if (arrayData.store.data)
|
||||||
|
updateAndEmit(
|
||||||
|
'onFetch',
|
||||||
|
Array.isArray(arrayData.store.data)
|
||||||
|
? arrayData.store.data[0]
|
||||||
|
: arrayData.store.data
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($props.observeFormChanges) {
|
if ($props.observeFormChanges) {
|
||||||
watch(
|
watch(
|
||||||
|
@ -157,7 +157,10 @@ onMounted(async () => {
|
||||||
if (!$props.url)
|
if (!$props.url)
|
||||||
watch(
|
watch(
|
||||||
() => arrayData.store.data,
|
() => arrayData.store.data,
|
||||||
(val) => updateAndEmit('onFetch', val)
|
(val) => {
|
||||||
|
if (Array.isArray(val)) val = val[0] ?? {};
|
||||||
|
updateAndEmit('onFetch', val);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -209,9 +212,7 @@ async function save() {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
try {
|
try {
|
||||||
formData.value = trimData(formData.value);
|
formData.value = trimData(formData.value);
|
||||||
const body = $props.mapper
|
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
|
||||||
? $props.mapper(formData.value, originalData.value)
|
|
||||||
: formData.value;
|
|
||||||
const method = $props.urlCreate ? 'post' : 'patch';
|
const method = $props.urlCreate ? 'post' : 'patch';
|
||||||
const url =
|
const url =
|
||||||
$props.urlCreate || $props.urlUpdate || $props.url || arrayData.store.url;
|
$props.urlCreate || $props.urlUpdate || $props.url || arrayData.store.url;
|
||||||
|
@ -291,7 +292,6 @@ defineExpose({
|
||||||
@submit="save"
|
@submit="save"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
class="q-pa-md"
|
class="q-pa-md"
|
||||||
:style="maxWidth ? 'max-width: ' + maxWidth : ''"
|
|
||||||
id="formModel"
|
id="formModel"
|
||||||
>
|
>
|
||||||
<QCard>
|
<QCard>
|
||||||
|
@ -326,7 +326,6 @@ defineExpose({
|
||||||
:title="t(defaultButtons.reset.label)"
|
:title="t(defaultButtons.reset.label)"
|
||||||
/>
|
/>
|
||||||
<QBtnDropdown
|
<QBtnDropdown
|
||||||
data-cy="saveAndContinueDefaultBtn"
|
|
||||||
v-if="$props.goTo"
|
v-if="$props.goTo"
|
||||||
@click="saveAndGo"
|
@click="saveAndGo"
|
||||||
:label="tMobile('globals.saveAndContinue')"
|
:label="tMobile('globals.saveAndContinue')"
|
||||||
|
@ -381,6 +380,7 @@ defineExpose({
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
#formModel {
|
#formModel {
|
||||||
|
max-width: 800px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const emit = defineEmits(['onSubmit']);
|
const emit = defineEmits(['onSubmit']);
|
||||||
|
|
||||||
const $props = defineProps({
|
defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -25,21 +25,16 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
submitOnEnter: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
if ($props.submitOnEnter) {
|
|
||||||
emit('onSubmit');
|
emit('onSubmit');
|
||||||
closeForm();
|
closeForm();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
|
|
@ -88,6 +88,7 @@ const applyTags = (params, search) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchItemTypes = async (id) => {
|
const fetchItemTypes = async (id) => {
|
||||||
|
try {
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['id', 'name', 'categoryFk'],
|
fields: ['id', 'name', 'categoryFk'],
|
||||||
where: { categoryFk: id },
|
where: { categoryFk: id },
|
||||||
|
@ -98,6 +99,9 @@ const fetchItemTypes = async (id) => {
|
||||||
params: { filter: JSON.stringify(filter) },
|
params: { filter: JSON.stringify(filter) },
|
||||||
});
|
});
|
||||||
itemTypesOptions.value = data;
|
itemTypesOptions.value = data;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching item types', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCategoryClass = (category, params) => {
|
const getCategoryClass = (category, params) => {
|
||||||
|
@ -107,6 +111,7 @@ const getCategoryClass = (category, params) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
|
try {
|
||||||
if (!tag?.selectedTag?.id) return;
|
if (!tag?.selectedTag?.id) return;
|
||||||
tag.value = null;
|
tag.value = null;
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -120,6 +125,9 @@ const getSelectedTagValues = async (tag) => {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
tag.valueOptions = data;
|
tag.valueOptions = data;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error getting selected tag values');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeTag = (index, params, search) => {
|
const removeTag = (index, params, search) => {
|
||||||
|
|
|
@ -39,10 +39,14 @@ const refund = async () => {
|
||||||
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
|
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
|
||||||
notify(t('Refunded invoice'), 'positive');
|
notify(t('Refunded invoice'), 'positive');
|
||||||
const [id] = data?.refundId || [];
|
const [id] = data?.refundId || [];
|
||||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error refunding invoice', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
<script setup>
|
|
||||||
defineProps({ row: { type: Object, required: true } });
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<span>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.isTaxDataChecked === 0"
|
|
||||||
name="vn:no036"
|
|
||||||
color="primary"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.hasTicketRequest" name="vn:buyrequest" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.itemShortage" name="vn:unavailable" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
v-if="row.risk"
|
|
||||||
name="vn:risk"
|
|
||||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ $t('salesTicketsTable.risk') }}: {{ row.risk - row.credit }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.hasComponentLack" name="vn:components" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.isTooLittle" name="vn:isTooLittle" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</span>
|
|
||||||
</template>
|
|
|
@ -49,6 +49,7 @@ const makeInvoice = async () => {
|
||||||
makeInvoice: checked.value,
|
makeInvoice: checked.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
if (checked.value && hasToInvoiceByAddress) {
|
if (checked.value && hasToInvoiceByAddress) {
|
||||||
const response = await new Promise((resolve) => {
|
const response = await new Promise((resolve) => {
|
||||||
quasar
|
quasar
|
||||||
|
@ -75,6 +76,9 @@ const makeInvoice = async () => {
|
||||||
notify(t('Transferred invoice'), 'positive');
|
notify(t('Transferred invoice'), 'positive');
|
||||||
const id = data?.[0];
|
const id = data?.[0];
|
||||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error transfering invoice', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onProvinceCreated', 'onProvinceFetched']);
|
const emit = defineEmits(['onProvinceCreated']);
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
countryFk: {
|
countryFk: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -17,23 +17,20 @@ const $props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
provinces: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const provinceFk = defineModel({ type: Number, default: null });
|
const provinceFk = defineModel({ type: Number, default: null });
|
||||||
|
|
||||||
const { validate } = useValidator();
|
const { validate } = useValidator();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const filter = ref({
|
|
||||||
include: { relation: 'country' },
|
|
||||||
where: {
|
|
||||||
countryFk: $props.countryFk,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const provincesOptions = ref($props.provinces);
|
const provincesOptions = ref($props.provinces);
|
||||||
const provincesFetchDataRef = ref();
|
|
||||||
provinceFk.value = $props.provinceSelected;
|
provinceFk.value = $props.provinceSelected;
|
||||||
if (!$props.countryFk) {
|
const provincesFetchDataRef = ref();
|
||||||
filter.value.where = {};
|
|
||||||
}
|
|
||||||
async function onProvinceCreated(_, data) {
|
async function onProvinceCreated(_, data) {
|
||||||
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
||||||
provinceFk.value = data.id;
|
provinceFk.value = data.id;
|
||||||
|
@ -42,33 +39,25 @@ async function onProvinceCreated(_, data) {
|
||||||
async function handleProvinces(data) {
|
async function handleProvinces(data) {
|
||||||
provincesOptions.value = data;
|
provincesOptions.value = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
|
||||||
() => $props.countryFk,
|
|
||||||
async () => {
|
|
||||||
if ($props.countryFk) {
|
|
||||||
filter.value.where.countryFk = $props.countryFk;
|
|
||||||
} else filter.value.where = {};
|
|
||||||
await provincesFetchDataRef.value.fetch({});
|
|
||||||
emit('onProvinceFetched', provincesOptions.value);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="provincesFetchDataRef"
|
ref="provincesFetchDataRef"
|
||||||
:filter="filter"
|
:filter="{
|
||||||
|
include: { relation: 'country' },
|
||||||
|
where: {
|
||||||
|
countryFk: $props.countryFk,
|
||||||
|
},
|
||||||
|
}"
|
||||||
@on-fetch="handleProvinces"
|
@on-fetch="handleProvinces"
|
||||||
url="Provinces"
|
url="Provinces"
|
||||||
auto-load
|
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('Province')"
|
:label="t('Province')"
|
||||||
:options="provincesOptions"
|
:options="$props.provinces"
|
||||||
:tooltip="t('Create province')"
|
:tooltip="t('Create province')"
|
||||||
hide-selected
|
hide-selected
|
||||||
:clearable="true"
|
|
||||||
v-model="provinceFk"
|
v-model="provinceFk"
|
||||||
:rules="validate && validate('postcode.provinceFk')"
|
:rules="validate && validate('postcode.provinceFk')"
|
||||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
|
|
|
@ -143,10 +143,6 @@ function alignRow() {
|
||||||
const showFilter = computed(
|
const showFilter = computed(
|
||||||
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
|
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
|
||||||
);
|
);
|
||||||
|
|
||||||
const onTabPressed = async () => {
|
|
||||||
if (model.value) enterEvent['keyup.enter']();
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
|
@ -161,7 +157,6 @@ const onTabPressed = async () => {
|
||||||
v-model="model"
|
v-model="model"
|
||||||
:components="components"
|
:components="components"
|
||||||
component-prop="columnFilter"
|
component-prop="columnFilter"
|
||||||
@keydown.tab="onTabPressed"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -324,8 +324,6 @@ function handleOnDataSaved(_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleScroll() {
|
function handleScroll() {
|
||||||
if ($props.crudModel.disableInfiniteScroll) return;
|
|
||||||
|
|
||||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||||
|
@ -394,7 +392,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
:name="col.orderBy ?? col.name"
|
:name="col.orderBy ?? col.name"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:vertical="false"
|
:vertical="true"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<slot
|
<slot
|
||||||
|
@ -737,7 +735,6 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
fab
|
fab
|
||||||
icon="add"
|
icon="add"
|
||||||
shortcut="+"
|
shortcut="+"
|
||||||
data-cy="vnTableCreateBtn"
|
|
||||||
/>
|
/>
|
||||||
<QTooltip self="top right">
|
<QTooltip self="top right">
|
||||||
{{ createForm?.title }}
|
{{ createForm?.title }}
|
||||||
|
|
|
@ -58,6 +58,7 @@ const getConfig = async (url, filter) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchViewConfigData = async () => {
|
const fetchViewConfigData = async () => {
|
||||||
|
try {
|
||||||
const userConfigFilter = {
|
const userConfigFilter = {
|
||||||
where: { tableCode: $props.tableCode, userFk: user.value.id },
|
where: { tableCode: $props.tableCode, userFk: user.value.id },
|
||||||
};
|
};
|
||||||
|
@ -82,9 +83,13 @@ const fetchViewConfigData = async () => {
|
||||||
$props.allColumns.forEach((col) => (defaultColumns[col] = true));
|
$props.allColumns.forEach((col) => (defaultColumns[col] = true));
|
||||||
setUserConfigViewData(defaultColumns);
|
setUserConfigViewData(defaultColumns);
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching config view data', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveConfig = async () => {
|
const saveConfig = async () => {
|
||||||
|
try {
|
||||||
const params = {};
|
const params = {};
|
||||||
const configuration = {};
|
const configuration = {};
|
||||||
|
|
||||||
|
@ -123,6 +128,9 @@ const saveConfig = async () => {
|
||||||
emitSavedConfig();
|
emitSavedConfig();
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
popupProxyRef.value.hide();
|
popupProxyRef.value.hide();
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error saving user view config', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const emitSavedConfig = () => {
|
const emitSavedConfig = () => {
|
||||||
|
|
|
@ -1,24 +1,20 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { nextTick, ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { QInput } from 'quasar';
|
import { QInput } from 'quasar';
|
||||||
|
|
||||||
const $props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
insertable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
||||||
|
|
||||||
let internalValue = ref($props.modelValue);
|
let internalValue = ref(props.modelValue);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => $props.modelValue,
|
() => props.modelValue,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
internalValue.value = newVal;
|
internalValue.value = newVal;
|
||||||
}
|
}
|
||||||
|
@ -32,46 +28,8 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleKeydown = (e) => {
|
|
||||||
if (e.key === 'Backspace') return;
|
|
||||||
if (e.key === '.') {
|
|
||||||
accountShortToStandard();
|
|
||||||
// TODO: Fix this setTimeout, with nextTick doesn't work
|
|
||||||
setTimeout(() => {
|
|
||||||
setCursorPosition(0, e.target);
|
|
||||||
}, 1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($props.insertable && e.key.match(/[0-9]/)) {
|
|
||||||
handleInsertMode(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function setCursorPosition(pos, el = vnInputRef.value) {
|
|
||||||
el.focus();
|
|
||||||
el.setSelectionRange(pos, pos);
|
|
||||||
}
|
|
||||||
const vnInputRef = ref(false);
|
|
||||||
const handleInsertMode = (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
const input = e.target;
|
|
||||||
const cursorPos = input.selectionStart;
|
|
||||||
const { maxlength } = vnInputRef.value;
|
|
||||||
let currentValue = internalValue.value;
|
|
||||||
if (!currentValue) currentValue = e.key;
|
|
||||||
const newValue = e.key;
|
|
||||||
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
|
|
||||||
internalValue.value =
|
|
||||||
currentValue.substring(0, cursorPos) +
|
|
||||||
newValue +
|
|
||||||
currentValue.substring(cursorPos + 1);
|
|
||||||
}
|
|
||||||
nextTick(() => {
|
|
||||||
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
function accountShortToStandard() {
|
function accountShortToStandard() {
|
||||||
internalValue.value = internalValue.value?.replace(
|
internalValue.value = internalValue.value.replace(
|
||||||
'.',
|
'.',
|
||||||
'0'.repeat(11 - internalValue.value.length)
|
'0'.repeat(11 - internalValue.value.length)
|
||||||
);
|
);
|
||||||
|
@ -79,5 +37,5 @@ function accountShortToStandard() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" />
|
<q-input v-model="internalValue" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -10,11 +10,11 @@ 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 },
|
url: { type: String, default: undefined },
|
||||||
customUrl: { type: String, default: undefined },
|
|
||||||
filter: { type: Object, default: () => {} },
|
filter: { type: Object, default: () => {} },
|
||||||
descriptor: { type: Object, required: true },
|
descriptor: { type: Object, required: true },
|
||||||
filterPanel: { type: Object, default: undefined },
|
filterPanel: { type: Object, default: undefined },
|
||||||
|
idInWhere: { type: Boolean, default: false },
|
||||||
searchDataKey: { type: String, default: undefined },
|
searchDataKey: { type: String, default: undefined },
|
||||||
searchbarProps: { type: Object, default: undefined },
|
searchbarProps: { type: Object, default: undefined },
|
||||||
redirectOnError: { type: Boolean, default: false },
|
redirectOnError: { type: Boolean, default: false },
|
||||||
|
@ -23,24 +23,22 @@ const props = defineProps({
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const url = computed(() => {
|
const regex = /(\/\d+)/;
|
||||||
if (props.baseUrl) {
|
|
||||||
return `${props.baseUrl}/${route.params.id}`;
|
|
||||||
}
|
|
||||||
return props.customUrl;
|
|
||||||
});
|
|
||||||
const searchRightDataKey = computed(() => {
|
const searchRightDataKey = computed(() => {
|
||||||
if (!props.searchDataKey) return route.name;
|
if (!props.searchDataKey) return route.name;
|
||||||
return props.searchDataKey;
|
return props.searchDataKey;
|
||||||
});
|
});
|
||||||
const arrayData = useArrayData(props.dataKey, {
|
const arrayData = useArrayData(props.dataKey, {
|
||||||
url: url.value,
|
url: props.url,
|
||||||
filter: props.filter,
|
filter: props.filter,
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
try {
|
try {
|
||||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
if (props.idInWhere) arrayData.store.filter.where = { id: route.params.id };
|
||||||
|
else if (!regex.test(props.url))
|
||||||
|
arrayData.store.url = `${props.url}/${route.params.id}`;
|
||||||
|
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
await arrayData.fetch({ append: false, updateRouter: false });
|
||||||
} catch {
|
} catch {
|
||||||
const { matched: matches } = router.currentRoute.value;
|
const { matched: matches } = router.currentRoute.value;
|
||||||
|
@ -49,14 +47,14 @@ onBeforeMount(async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (props.baseUrl) {
|
onBeforeRouteUpdate(async (to, from) => {
|
||||||
onBeforeRouteUpdate(async (to, from) => {
|
|
||||||
if (to.params.id !== from.params.id) {
|
if (to.params.id !== from.params.id) {
|
||||||
arrayData.store.url = `${props.baseUrl}/${to.params.id}`;
|
if (props.idInWhere) arrayData.store.filter.where = { id: to.params.id };
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
else arrayData.store.url = `${props.url}/${to.params.id}`;
|
||||||
|
|
||||||
|
await arrayData.fetch({ updateRouter: false });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QDrawer
|
<QDrawer
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref, useAttrs, nextTick } from 'vue';
|
import { computed, ref, useAttrs } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRequired } from 'src/composables/useRequired';
|
import { useRequired } from 'src/composables/useRequired';
|
||||||
|
|
||||||
|
@ -34,14 +34,6 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
insertable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
maxlength: {
|
|
||||||
type: Number,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const vnInputRef = ref(null);
|
const vnInputRef = ref(null);
|
||||||
|
@ -77,9 +69,6 @@ const mixinRules = [
|
||||||
requiredFieldRule,
|
requiredFieldRule,
|
||||||
...($attrs.rules ?? []),
|
...($attrs.rules ?? []),
|
||||||
(val) => {
|
(val) => {
|
||||||
const { maxlength } = vnInputRef.value;
|
|
||||||
if (maxlength && +val.length > maxlength)
|
|
||||||
return t(`maxLength`, { value: maxlength });
|
|
||||||
const { min, max } = vnInputRef.value.$attrs;
|
const { min, max } = vnInputRef.value.$attrs;
|
||||||
if (!min) return null;
|
if (!min) return null;
|
||||||
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
||||||
|
@ -89,33 +78,6 @@ const mixinRules = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleKeydown = (e) => {
|
|
||||||
if (e.key === 'Backspace') return;
|
|
||||||
|
|
||||||
if ($props.insertable && e.key.match(/[0-9]/)) {
|
|
||||||
handleInsertMode(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleInsertMode = (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
const input = e.target;
|
|
||||||
const cursorPos = input.selectionStart;
|
|
||||||
const { maxlength } = vnInputRef.value;
|
|
||||||
let currentValue = value.value;
|
|
||||||
if (!currentValue) currentValue = e.key;
|
|
||||||
const newValue = e.key;
|
|
||||||
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
|
|
||||||
value.value =
|
|
||||||
currentValue.substring(0, cursorPos) +
|
|
||||||
newValue +
|
|
||||||
currentValue.substring(cursorPos + 1);
|
|
||||||
}
|
|
||||||
nextTick(() => {
|
|
||||||
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -127,12 +89,10 @@ const handleInsertMode = (e) => {
|
||||||
:type="$attrs.type"
|
:type="$attrs.type"
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
@keyup.enter="emit('keyup.enter')"
|
@keyup.enter="emit('keyup.enter')"
|
||||||
@keydown="handleKeydown"
|
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
:lazy-rules="true"
|
:lazy-rules="true"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
|
||||||
>
|
>
|
||||||
<template v-if="$slots.prepend" #prepend>
|
<template v-if="$slots.prepend" #prepend>
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
|
@ -141,13 +101,7 @@ const handleInsertMode = (e) => {
|
||||||
<QIcon
|
<QIcon
|
||||||
name="close"
|
name="close"
|
||||||
size="xs"
|
size="xs"
|
||||||
v-if="
|
v-if="hover && value && !$attrs.disabled && $props.clearable"
|
||||||
hover &&
|
|
||||||
value &&
|
|
||||||
!$attrs.disabled &&
|
|
||||||
!$attrs.readonly &&
|
|
||||||
$props.clearable
|
|
||||||
"
|
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
value = null;
|
value = null;
|
||||||
|
@ -169,11 +123,9 @@ const handleInsertMode = (e) => {
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
inputMin: Must be more than {value}
|
inputMin: Must be more than {value}
|
||||||
maxLength: The value exceeds {value} characters
|
|
||||||
inputMax: Must be less than {value}
|
inputMax: Must be less than {value}
|
||||||
es:
|
es:
|
||||||
inputMin: Debe ser mayor a {value}
|
inputMin: Debe ser mayor a {value}
|
||||||
maxLength: El valor excede los {value} carácteres
|
|
||||||
inputMax: Debe ser menor a {value}
|
inputMax: Debe ser menor a {value}
|
||||||
</i18n>
|
</i18n>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
|
@ -138,6 +138,8 @@ onMounted(() => {
|
||||||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
defineExpose({ opts: myOptions });
|
||||||
|
|
||||||
const arrayDataKey =
|
const arrayDataKey =
|
||||||
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
||||||
|
|
||||||
|
@ -200,10 +202,7 @@ async function fetchFilter(val) {
|
||||||
if (fields) fetchOptions.fields = fields;
|
if (fields) fetchOptions.fields = fields;
|
||||||
if (sortBy) fetchOptions.order = sortBy;
|
if (sortBy) fetchOptions.order = sortBy;
|
||||||
arrayData.reset(['skip', 'filter.skip', 'page']);
|
arrayData.reset(['skip', 'filter.skip', 'page']);
|
||||||
|
return (await arrayData.applyFilter({ filter: fetchOptions }))?.data;
|
||||||
const { data } = await arrayData.applyFilter({ filter: fetchOptions });
|
|
||||||
setOptions(data);
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function filterHandler(val, update) {
|
async function filterHandler(val, update) {
|
||||||
|
@ -257,30 +256,6 @@ async function onScroll({ to, direction, from, index }) {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ opts: myOptions });
|
|
||||||
|
|
||||||
function handleKeyDown(event) {
|
|
||||||
if (event.key === 'Tab') {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
const inputValue = vnSelectRef.value?.inputValue;
|
|
||||||
|
|
||||||
if (inputValue) {
|
|
||||||
const matchingOption = myOptions.value.find(
|
|
||||||
(option) =>
|
|
||||||
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (matchingOption) {
|
|
||||||
emit('update:modelValue', matchingOption[optionValue.value]);
|
|
||||||
} else {
|
|
||||||
emit('update:modelValue', inputValue);
|
|
||||||
}
|
|
||||||
vnSelectRef.value?.hidePopup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -291,7 +266,6 @@ function handleKeyDown(event) {
|
||||||
:option-value="optionValue"
|
:option-value="optionValue"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
@keydown="handleKeyDown"
|
|
||||||
:emit-value="nullishToTrue($attrs['emit-value'])"
|
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||||
:map-options="nullishToTrue($attrs['map-options'])"
|
:map-options="nullishToTrue($attrs['map-options'])"
|
||||||
:use-input="nullishToTrue($attrs['use-input'])"
|
:use-input="nullishToTrue($attrs['use-input'])"
|
||||||
|
@ -306,11 +280,10 @@ function handleKeyDown(event) {
|
||||||
:input-debounce="useURL ? '300' : '0'"
|
:input-debounce="useURL ? '300' : '0'"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@virtual-scroll="onScroll"
|
@virtual-scroll="onScroll"
|
||||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
|
||||||
>
|
>
|
||||||
<template #append>
|
<template v-if="isClearable" #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-show="isClearable && value"
|
v-show="value"
|
||||||
name="close"
|
name="close"
|
||||||
@click.stop="
|
@click.stop="
|
||||||
() => {
|
() => {
|
||||||
|
@ -323,22 +296,7 @@ function handleKeyDown(event) {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||||
<div v-if="slotName == 'append'">
|
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||||
<QIcon
|
|
||||||
v-show="isClearable && value"
|
|
||||||
name="close"
|
|
||||||
@click.stop="
|
|
||||||
() => {
|
|
||||||
value = null;
|
|
||||||
emit('remove');
|
|
||||||
}
|
|
||||||
"
|
|
||||||
class="cursor-pointer"
|
|
||||||
size="xs"
|
|
||||||
/>
|
|
||||||
<slot name="append" v-if="$slots.append" v-bind="slotData ?? {}" />
|
|
||||||
</div>
|
|
||||||
<slot v-else :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
|
||||||
</template>
|
</template>
|
||||||
</QSelect>
|
</QSelect>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -86,7 +86,7 @@ async function send() {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QDialog ref="dialogRef" data-cy="vnSmsDialog">
|
<QDialog ref="dialogRef">
|
||||||
<QCard class="q-pa-sm">
|
<QCard class="q-pa-sm">
|
||||||
<QCardSection class="row items-center q-pb-none">
|
<QCardSection class="row items-center q-pb-none">
|
||||||
<span class="text-h6 text-grey">
|
<span class="text-h6 text-grey">
|
||||||
|
@ -161,7 +161,6 @@ async function send() {
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
color="primary"
|
color="primary"
|
||||||
unelevated
|
unelevated
|
||||||
data-cy="sendSmsBtn"
|
|
||||||
/>
|
/>
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -74,9 +74,6 @@ const arrayData = useArrayData($props.dataKey, {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const userParams = ref({});
|
const userParams = ref({});
|
||||||
|
|
||||||
defineExpose({ search, sanitizer, params: userParams });
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
userParams.value = $props.modelValue ?? {};
|
userParams.value = $props.modelValue ?? {};
|
||||||
emit('init', { params: userParams.value });
|
emit('init', { params: userParams.value });
|
||||||
|
@ -200,7 +197,7 @@ const customTags = computed(() =>
|
||||||
|
|
||||||
async function remove(key) {
|
async function remove(key) {
|
||||||
userParams.value[key] = undefined;
|
userParams.value[key] = undefined;
|
||||||
await search();
|
search();
|
||||||
emit('remove', key);
|
emit('remove', key);
|
||||||
emit('update:modelValue', userParams.value);
|
emit('update:modelValue', userParams.value);
|
||||||
}
|
}
|
||||||
|
@ -226,6 +223,8 @@ function sanitizer(params) {
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({ search, sanitizer, userParams });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -273,7 +272,6 @@ function sanitizer(params) {
|
||||||
:key="chip.label"
|
:key="chip.label"
|
||||||
:removable="!unremovableParams?.includes(chip.label)"
|
:removable="!unremovableParams?.includes(chip.label)"
|
||||||
@remove="remove(chip.label)"
|
@remove="remove(chip.label)"
|
||||||
data-cy="vnFilterPanelChip"
|
|
||||||
>
|
>
|
||||||
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
|
import { reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { parsePhone } from 'src/filters';
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
phoneNumber: { type: [String, Number], default: null },
|
phoneNumber: { type: [String, Number], default: null },
|
||||||
channel: { type: Number, default: null },
|
channel: { type: Number, default: null },
|
||||||
|
@ -25,9 +24,9 @@ onBeforeMount(async () => {
|
||||||
.data;
|
.data;
|
||||||
if (!channel) channel = defaultChannel;
|
if (!channel) channel = defaultChannel;
|
||||||
|
|
||||||
config[type].href = `${url}?customerIdentity=%2B${parsePhone(
|
config[
|
||||||
props.phoneNumber
|
type
|
||||||
)}&channelId=${channel}`;
|
].href = `${url}?customerIdentity=%2B${props.phoneNumber}&channelId=${channel}`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -101,7 +101,6 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
@click="insert"
|
@click="insert"
|
||||||
class="q-mb-xs"
|
class="q-mb-xs"
|
||||||
dense
|
dense
|
||||||
data-cy="saveNote"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
|
|
|
@ -132,24 +132,10 @@ const addFilter = async (filter, params) => {
|
||||||
|
|
||||||
async function fetch(params) {
|
async function fetch(params) {
|
||||||
useArrayData(props.dataKey, params);
|
useArrayData(props.dataKey, params);
|
||||||
arrayData.reset(['filter.skip', 'skip', 'page']);
|
arrayData.reset(['filter.skip', 'skip']);
|
||||||
await arrayData.fetch({ append: false, updateRouter: mounted.value });
|
|
||||||
return emitStoreData();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function update(params) {
|
|
||||||
useArrayData(props.dataKey, params);
|
|
||||||
const { limit, skip } = store;
|
|
||||||
store.limit = limit + skip;
|
|
||||||
store.skip = 0;
|
|
||||||
await arrayData.fetch({ append: false });
|
await arrayData.fetch({ append: false });
|
||||||
store.limit = limit;
|
|
||||||
store.skip = skip;
|
|
||||||
return emitStoreData();
|
|
||||||
}
|
|
||||||
|
|
||||||
function emitStoreData() {
|
|
||||||
if (!store.hasMoreData) isLoading.value = false;
|
if (!store.hasMoreData) isLoading.value = false;
|
||||||
|
|
||||||
emit('onFetch', store.data);
|
emit('onFetch', store.data);
|
||||||
return store.data;
|
return store.data;
|
||||||
}
|
}
|
||||||
|
@ -195,7 +181,7 @@ async function onLoad(index, done) {
|
||||||
done(isDone);
|
done(isDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ fetch, update, addFilter, paginate });
|
defineExpose({ fetch, addFilter, paginate });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -130,7 +130,6 @@ async function search() {
|
||||||
dense
|
dense
|
||||||
standout
|
standout
|
||||||
autofocus
|
autofocus
|
||||||
data-cy="vnSearchBar"
|
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { defineProps } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
routeName: {
|
routeName: {
|
||||||
|
|
|
@ -1,24 +1,11 @@
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { getUrl } from './getUrl';
|
import { getUrl } from './getUrl';
|
||||||
import axios from 'axios';
|
|
||||||
import { exportFile } from 'quasar';
|
|
||||||
|
|
||||||
const { getTokenMultimedia } = useSession();
|
const { getTokenMultimedia } = useSession();
|
||||||
const token = getTokenMultimedia();
|
const token = getTokenMultimedia();
|
||||||
|
|
||||||
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
||||||
const appUrl = (await getUrl('', 'lilium')).replace('/#/', '');
|
let appUrl = await getUrl('', 'lilium');
|
||||||
const response = await axios.get(
|
appUrl = appUrl.replace('/#/', '');
|
||||||
url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`,
|
window.open(url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`);
|
||||||
{ responseType: 'blob' }
|
|
||||||
);
|
|
||||||
|
|
||||||
const contentDisposition = response.headers['content-disposition'];
|
|
||||||
const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
|
|
||||||
const filename =
|
|
||||||
matches != null && matches[1]
|
|
||||||
? matches[1].replace(/['"]/g, '')
|
|
||||||
: 'downloaded-file';
|
|
||||||
|
|
||||||
exportFile(filename, response.data);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
const params = { filter };
|
const params = { filter };
|
||||||
|
|
||||||
Object.assign(params, userParams);
|
Object.assign(params, userParams);
|
||||||
if (params.filter) params.filter.skip = store.skip;
|
params.filter.skip = store.skip;
|
||||||
if (store?.order && typeof store?.order == 'string') store.order = [store.order];
|
if (store?.order && typeof store?.order == 'string') store.order = [store.order];
|
||||||
if (store.order?.length) params.filter.order = [...store.order];
|
if (store.order?.length) params.filter.order = [...store.order];
|
||||||
else delete params.filter.order;
|
else delete params.filter.order;
|
||||||
|
|
|
@ -241,7 +241,7 @@ input::-webkit-inner-spin-button {
|
||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
padding: 1px 10px 1px 10px;
|
padding: 1px 10px 1px 10px;
|
||||||
max-width: 130px;
|
max-width: 100px;
|
||||||
div span {
|
div span {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
export default function getDifferences(obj1, obj2) {
|
|
||||||
let diff = {};
|
|
||||||
delete obj1.$index;
|
|
||||||
delete obj2.$index;
|
|
||||||
|
|
||||||
for (let key in obj1) {
|
|
||||||
if (obj2[key] && JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])) {
|
|
||||||
diff[key] = obj2[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let key in obj2) {
|
|
||||||
if (
|
|
||||||
obj1[key] === undefined ||
|
|
||||||
JSON.stringify(obj1[key]) !== JSON.stringify(obj2[key])
|
|
||||||
) {
|
|
||||||
diff[key] = obj2[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return diff;
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
export default function getUpdatedValues(keys, formData) {
|
|
||||||
return keys.reduce((acc, key) => {
|
|
||||||
acc[key] = formData[key];
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
}
|
|
|
@ -11,17 +11,11 @@ import dashIfEmpty from './dashIfEmpty';
|
||||||
import dateRange from './dateRange';
|
import dateRange from './dateRange';
|
||||||
import toHour from './toHour';
|
import toHour from './toHour';
|
||||||
import dashOrCurrency from './dashOrCurrency';
|
import dashOrCurrency from './dashOrCurrency';
|
||||||
import getDifferences from './getDifferences';
|
|
||||||
import getUpdatedValues from './getUpdatedValues';
|
|
||||||
import getParamWhere from './getParamWhere';
|
import getParamWhere from './getParamWhere';
|
||||||
import parsePhone from './parsePhone';
|
|
||||||
import isDialogOpened from './isDialogOpened';
|
import isDialogOpened from './isDialogOpened';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getUpdatedValues,
|
|
||||||
getDifferences,
|
|
||||||
isDialogOpened,
|
isDialogOpened,
|
||||||
parsePhone,
|
|
||||||
toLowerCase,
|
toLowerCase,
|
||||||
toLowerCamel,
|
toLowerCamel,
|
||||||
toDate,
|
toDate,
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
export default function (phone, prefix = 34) {
|
|
||||||
if (phone.startsWith('+')) {
|
|
||||||
return `${phone.slice(1)}`;
|
|
||||||
}
|
|
||||||
if (phone.startsWith('00')) {
|
|
||||||
return `${phone.slice(2)}`;
|
|
||||||
}
|
|
||||||
if (phone.startsWith(prefix) && phone.length === prefix.length + 9) {
|
|
||||||
return `${prefix}${phone.slice(prefix.length)}`;
|
|
||||||
}
|
|
||||||
return `${prefix}${phone}`;
|
|
||||||
}
|
|
|
@ -60,7 +60,7 @@ globals:
|
||||||
reference: Reference
|
reference: Reference
|
||||||
agency: Agency
|
agency: Agency
|
||||||
warehouseOut: Warehouse Out
|
warehouseOut: Warehouse Out
|
||||||
warehouseIn: Warehouse In
|
wareHouseIn: Warehouse In
|
||||||
landed: Landed
|
landed: Landed
|
||||||
shipped: Shipped
|
shipped: Shipped
|
||||||
totalEntries: Total entries
|
totalEntries: Total entries
|
||||||
|
@ -298,7 +298,6 @@ globals:
|
||||||
clientsActionsMonitor: Clients and actions
|
clientsActionsMonitor: Clients and actions
|
||||||
serial: Serial
|
serial: Serial
|
||||||
medical: Mutual
|
medical: Mutual
|
||||||
pit: IRPF
|
|
||||||
RouteExtendedList: Router
|
RouteExtendedList: Router
|
||||||
wasteRecalc: Waste recaclulate
|
wasteRecalc: Waste recaclulate
|
||||||
operator: Operator
|
operator: Operator
|
||||||
|
@ -585,15 +584,15 @@ worker:
|
||||||
role: Role
|
role: Role
|
||||||
sipExtension: Extension
|
sipExtension: Extension
|
||||||
locker: Locker
|
locker: Locker
|
||||||
fiDueDate: FI due date
|
fiDueDate: Fecha de caducidad del DNI
|
||||||
sex: Sex
|
sex: Sexo
|
||||||
seniority: Seniority
|
seniority: Antigüedad
|
||||||
fi: DNI/NIE/NIF
|
fi: DNI/NIE/NIF
|
||||||
birth: Birth
|
birth: Fecha de nacimiento
|
||||||
isFreelance: Freelance
|
isFreelance: Autónomo
|
||||||
isSsDiscounted: Bonificación SS
|
isSsDiscounted: Bonificación SS
|
||||||
hasMachineryAuthorized: Machinery authorized
|
hasMachineryAuthorized: Autorizado para llevar maquinaria
|
||||||
isDisable: Disable
|
isDisable: Trabajador desactivado
|
||||||
notificationsManager:
|
notificationsManager:
|
||||||
activeNotifications: Active notifications
|
activeNotifications: Active notifications
|
||||||
availableNotifications: Available notifications
|
availableNotifications: Available notifications
|
||||||
|
@ -709,7 +708,7 @@ supplier:
|
||||||
supplierName: Supplier name
|
supplierName: Supplier name
|
||||||
basicData:
|
basicData:
|
||||||
workerFk: Responsible
|
workerFk: Responsible
|
||||||
isReal: Verified
|
isSerious: Verified
|
||||||
isActive: Active
|
isActive: Active
|
||||||
isPayMethodChecked: PayMethod checked
|
isPayMethodChecked: PayMethod checked
|
||||||
note: Notes
|
note: Notes
|
||||||
|
@ -768,8 +767,7 @@ travel:
|
||||||
thermographs: Thermographs
|
thermographs: Thermographs
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Automatic movement (Raid)
|
daysInForward: Days in forward
|
||||||
isRaid: Raid
|
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperature
|
temperature: Temperature
|
||||||
destination: Destination
|
destination: Destination
|
||||||
|
|
|
@ -303,7 +303,6 @@ globals:
|
||||||
clientsActionsMonitor: Clientes y acciones
|
clientsActionsMonitor: Clientes y acciones
|
||||||
serial: Facturas por serie
|
serial: Facturas por serie
|
||||||
medical: Mutua
|
medical: Mutua
|
||||||
pit: IRPF
|
|
||||||
wasteRecalc: Recalcular mermas
|
wasteRecalc: Recalcular mermas
|
||||||
operator: Operario
|
operator: Operario
|
||||||
parking: Parking
|
parking: Parking
|
||||||
|
@ -581,9 +580,9 @@ worker:
|
||||||
newWorker: Nuevo trabajador
|
newWorker: Nuevo trabajador
|
||||||
summary:
|
summary:
|
||||||
boss: Jefe
|
boss: Jefe
|
||||||
phoneExtension: Ext. de teléfono
|
phoneExtension: Extensión de teléfono
|
||||||
entPhone: Tel. de empresa
|
entPhone: Teléfono de empresa
|
||||||
personalPhone: Tel. personal
|
personalPhone: Teléfono personal
|
||||||
noBoss: Sin jefe
|
noBoss: Sin jefe
|
||||||
userData: Datos de usuario
|
userData: Datos de usuario
|
||||||
userId: ID del usuario
|
userId: ID del usuario
|
||||||
|
@ -704,7 +703,7 @@ supplier:
|
||||||
supplierName: Nombre del proveedor
|
supplierName: Nombre del proveedor
|
||||||
basicData:
|
basicData:
|
||||||
workerFk: Responsable
|
workerFk: Responsable
|
||||||
isReal: Verificado
|
isSerious: Verificado
|
||||||
isActive: Activo
|
isActive: Activo
|
||||||
isPayMethodChecked: Método de pago validado
|
isPayMethodChecked: Método de pago validado
|
||||||
note: Notas
|
note: Notas
|
||||||
|
@ -762,8 +761,7 @@ travel:
|
||||||
thermographs: Termógrafos
|
thermographs: Termógrafos
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Desplazamiento automatico (redada)
|
daysInForward: Días redada
|
||||||
isRaid: Redada
|
|
||||||
thermographs:
|
thermographs:
|
||||||
temperature: Temperatura
|
temperature: Temperatura
|
||||||
destination: Destino
|
destination: Destino
|
||||||
|
|
|
@ -11,13 +11,21 @@ const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const onSynchronizeAll = async () => {
|
const onSynchronizeAll = async () => {
|
||||||
|
try {
|
||||||
notify(t('Synchronizing in the background'), 'positive');
|
notify(t('Synchronizing in the background'), 'positive');
|
||||||
await axios.patch(`Accounts/syncAll`);
|
await axios.patch(`Accounts/syncAll`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error synchronizing all accounts', error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSynchronizeRoles = async () => {
|
const onSynchronizeRoles = async () => {
|
||||||
|
try {
|
||||||
await axios.patch(`RoleInherits/sync`);
|
await axios.patch(`RoleInherits/sync`);
|
||||||
notify(t('Roles synchronized!'), 'positive');
|
notify(t('Roles synchronized!'), 'positive');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error synchronizing roles', error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const deleteAcl = async ({ id }) => {
|
const deleteAcl = async ({ id }) => {
|
||||||
|
try {
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
quasar
|
quasar
|
||||||
.dialog({
|
.dialog({
|
||||||
|
@ -130,6 +131,9 @@ const deleteAcl = async ({ id }) => {
|
||||||
await axios.delete(`ACLs/${id}`);
|
await axios.delete(`ACLs/${id}`);
|
||||||
tableRef.value.reload();
|
tableRef.value.reload();
|
||||||
notify('ACL removed', 'positive');
|
notify('ACL removed', 'positive');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error deleting Acl: ', error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,11 @@ import { ref, computed } from 'vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import exprBuilder from './Alias/AliasExprBuilder.js';
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
|
||||||
switch (param) {
|
|
||||||
case 'search':
|
|
||||||
return /^\d+$/.test(value)
|
|
||||||
? { id: value }
|
|
||||||
: { alias: { like: `%${value}%` } };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
|
@ -34,9 +34,13 @@ const refresh = () => paginateRef.value.fetch();
|
||||||
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
||||||
|
|
||||||
const killSession = async ({ userId, created }) => {
|
const killSession = async ({ userId, created }) => {
|
||||||
|
try {
|
||||||
await axios.post(`${urlPath}/killSession`, { userId, created });
|
await axios.post(`${urlPath}/killSession`, { userId, created });
|
||||||
paginateRef.value.fetch();
|
paginateRef.value.fetch();
|
||||||
notify(t('Session killed'), 'positive');
|
notify(t('Session killed'), 'positive');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error killing session', error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
export default (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return /^\d+$/.test(value)
|
||||||
|
? { id: value }
|
||||||
|
: {
|
||||||
|
or: [
|
||||||
|
{ name: { like: `%${value}%` } },
|
||||||
|
{ nickname: { like: `%${value}%` } },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
case 'name':
|
||||||
|
case 'nickname':
|
||||||
|
return { [param]: { like: `%${value}%` } };
|
||||||
|
case 'roleFk':
|
||||||
|
return { [param]: value };
|
||||||
|
}
|
||||||
|
};
|
|
@ -40,8 +40,12 @@ const formUrlCreate = ref(null);
|
||||||
const formUrlUpdate = ref(null);
|
const formUrlUpdate = ref(null);
|
||||||
const formCustomFn = ref(null);
|
const formCustomFn = ref(null);
|
||||||
const onTestConection = async () => {
|
const onTestConection = async () => {
|
||||||
|
try {
|
||||||
await axios.get(`LdapConfigs/test`);
|
await axios.get(`LdapConfigs/test`);
|
||||||
notify(t('LDAP connection established!'), 'positive');
|
notify(t('LDAP connection established!'), 'positive');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error testing connection', error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const getInitialLdapConfig = async () => {
|
const getInitialLdapConfig = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -68,10 +72,14 @@ const getInitialLdapConfig = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
|
try {
|
||||||
await axios.delete(URL_UPDATE);
|
await axios.delete(URL_UPDATE);
|
||||||
initialData.value = { ...DEFAULT_DATA };
|
initialData.value = { ...DEFAULT_DATA };
|
||||||
hasData.value = false;
|
hasData.value = false;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error deleting mail forward', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => await getInitialLdapConfig());
|
onMounted(async () => await getInitialLdapConfig());
|
||||||
|
|
|
@ -7,12 +7,13 @@ import AccountSummary from './Card/AccountSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import AccountFilter from './AccountFilter.vue';
|
import AccountFilter from './AccountFilter.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
import exprBuilder from './AccountExprBuilder.js';
|
||||||
|
import filter from './Card/AccountFilter.js';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const filter = {
|
|
||||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
|
||||||
};
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -82,24 +83,6 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const exprBuilder = (param, value) => {
|
|
||||||
switch (param) {
|
|
||||||
case 'search':
|
|
||||||
return /^\d+$/.test(value)
|
|
||||||
? { id: value }
|
|
||||||
: {
|
|
||||||
or: [
|
|
||||||
{ name: { like: `%${value}%` } },
|
|
||||||
{ nickname: { like: `%${value}%` } },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
case 'name':
|
|
||||||
case 'nickname':
|
|
||||||
return { [param]: { like: `%${value}%` } };
|
|
||||||
case 'roleFk':
|
|
||||||
return { [param]: value };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -46,8 +46,12 @@ const formUrlUpdate = ref(null);
|
||||||
const formCustomFn = ref(null);
|
const formCustomFn = ref(null);
|
||||||
|
|
||||||
const onTestConection = async () => {
|
const onTestConection = async () => {
|
||||||
|
try {
|
||||||
await axios.get(`SambaConfigs/test`);
|
await axios.get(`SambaConfigs/test`);
|
||||||
notify(t('Samba connection established!'), 'positive');
|
notify(t('Samba connection established!'), 'positive');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error testing connection', error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInitialSambaConfig = async () => {
|
const getInitialSambaConfig = async () => {
|
||||||
|
@ -75,10 +79,14 @@ const getInitialSambaConfig = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
|
try {
|
||||||
await axios.delete(URL_UPDATE);
|
await axios.delete(URL_UPDATE);
|
||||||
initialData.value = { ...DEFAULT_DATA };
|
initialData.value = { ...DEFAULT_DATA };
|
||||||
hasData.value = false;
|
hasData.value = false;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error deleting mail forward', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => await getInitialSambaConfig());
|
onMounted(async () => await getInitialSambaConfig());
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
export default (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return /^\d+$/.test(value)
|
||||||
|
? { id: value }
|
||||||
|
: { alias: { like: `%${value}%` } };
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,21 +1,21 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import AliasDescriptor from './AliasDescriptor.vue';
|
import AliasDescriptor from './AliasDescriptor.vue';
|
||||||
const { t } = useI18n();
|
import exprBuilder from '../AliasExprBuilder.js';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Alias"
|
data-key="Alias"
|
||||||
base-url="MailAliases"
|
url="MailAliases"
|
||||||
:descriptor="AliasDescriptor"
|
:descriptor="AliasDescriptor"
|
||||||
search-data-key="AccountAliasList"
|
search-data-key="AccountAliasList"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: 'MailAliases',
|
url: 'MailAliases',
|
||||||
info: t('mailAlias.searchInfo'),
|
info: $t('mailAlias.searchInfo'),
|
||||||
label: t('mailAlias.search'),
|
label: $t('mailAlias.search'),
|
||||||
searchUrl: 'table',
|
searchUrl: 'table',
|
||||||
|
exprBuilder,
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -7,7 +7,6 @@ import { useQuasar } from 'quasar';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
|
@ -29,9 +28,6 @@ const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity.alias, entity.id));
|
|
||||||
|
|
||||||
const removeAlias = () => {
|
const removeAlias = () => {
|
||||||
quasar
|
quasar
|
||||||
.dialog({
|
.dialog({
|
||||||
|
@ -44,9 +40,13 @@ const removeAlias = () => {
|
||||||
cancel: true,
|
cancel: true,
|
||||||
})
|
})
|
||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
|
try {
|
||||||
await axios.delete(`MailAliases/${entityId.value}`);
|
await axios.delete(`MailAliases/${entityId.value}`);
|
||||||
notify(t('Alias removed'), 'positive');
|
notify(t('Alias removed'), 'positive');
|
||||||
router.push({ name: 'AccountAlias' });
|
router.push({ name: 'AccountAlias' });
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error removing alias');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -56,10 +56,8 @@ const removeAlias = () => {
|
||||||
ref="descriptor"
|
ref="descriptor"
|
||||||
:url="`MailAliases/${entityId}`"
|
:url="`MailAliases/${entityId}`"
|
||||||
module="Alias"
|
module="Alias"
|
||||||
@on-fetch="setData"
|
data-key="Alias"
|
||||||
data-key="aliasData"
|
title="alias"
|
||||||
:title="data.title"
|
|
||||||
:subtitle="data.subtitle"
|
|
||||||
>
|
>
|
||||||
<template #menu>
|
<template #menu>
|
||||||
<QItem v-ripple clickable @click="removeAlias()">
|
<QItem v-ripple clickable @click="removeAlias()">
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -18,20 +16,15 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { store } = useArrayData('Alias');
|
|
||||||
const alias = ref(store.data);
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary ref="summary" :url="`MailAliases/${entityId}`" data-key="Alias">
|
||||||
ref="summary"
|
<template #header="{ entity: alias }">
|
||||||
:url="`MailAliases/${entityId}`"
|
{{ alias.id }} - {{ alias.alias }}
|
||||||
@on-fetch="(data) => (alias = data)"
|
</template>
|
||||||
data-key="MailAliasesSummary"
|
<template #body="{ entity: alias }">
|
||||||
>
|
|
||||||
<template #header> {{ alias.id }} - {{ alias.alias }} </template>
|
|
||||||
<template #body>
|
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
<router-link
|
<router-link
|
||||||
|
|
|
@ -1,46 +1,26 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
|
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import { ref, watch } from 'vue';
|
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const { t } = useI18n();
|
|
||||||
const formModelRef = ref(null);
|
|
||||||
|
|
||||||
const accountFilter = {
|
|
||||||
where: { id: route.params.id },
|
|
||||||
fields: ['id', 'email', 'nickname', 'name', 'accountStateFk', 'packages', 'pickup'],
|
|
||||||
include: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.params.id,
|
|
||||||
() => formModelRef.value.reset()
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FormModel
|
<FormModel
|
||||||
ref="formModelRef"
|
ref="formModelRef"
|
||||||
url="VnUsers/preview"
|
:url-update="`VnUsers/${$route.params.id}/update-user`"
|
||||||
:url-update="`VnUsers/${route.params.id}/update-user`"
|
model="Account"
|
||||||
:filter="accountFilter"
|
|
||||||
model="Accounts"
|
|
||||||
auto-load
|
auto-load
|
||||||
@on-data-saved="formModelRef.fetch()"
|
@on-data-saved="$refs.formModelRef.fetch()"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<div class="q-gutter-y-sm">
|
<div class="q-gutter-y-sm">
|
||||||
<VnInput v-model="data.name" :label="t('account.card.nickname')" />
|
<VnInput v-model="data.name" :label="$t('account.card.nickname')" />
|
||||||
<VnInput v-model="data.nickname" :label="t('account.card.alias')" />
|
<VnInput v-model="data.nickname" :label="$t('account.card.alias')" />
|
||||||
<VnInput v-model="data.email" :label="t('globals.params.email')" />
|
<VnInput v-model="data.email" :label="$t('globals.params.email')" />
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Languages"
|
url="Languages"
|
||||||
v-model="data.lang"
|
v-model="data.lang"
|
||||||
:label="t('account.card.lang')"
|
:label="$t('account.card.lang')"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
/>
|
/>
|
||||||
|
@ -49,7 +29,7 @@ watch(
|
||||||
table="user"
|
table="user"
|
||||||
column="twoFactor"
|
column="twoFactor"
|
||||||
v-model="data.twoFactor"
|
v-model="data.twoFactor"
|
||||||
:label="t('account.card.twoFactor')"
|
:label="$t('account.card.twoFactor')"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,20 +1,25 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import AccountDescriptor from './AccountDescriptor.vue';
|
import AccountDescriptor from './AccountDescriptor.vue';
|
||||||
|
import exprBuilder from '../AccountExprBuilder.js';
|
||||||
const { t } = useI18n();
|
import filter from './AccountFilter.js';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
|
url="VnUsers/preview"
|
||||||
|
:id-in-where="true"
|
||||||
data-key="Account"
|
data-key="Account"
|
||||||
|
:filter="filter"
|
||||||
:descriptor="AccountDescriptor"
|
:descriptor="AccountDescriptor"
|
||||||
search-data-key="AccountList"
|
search-data-key="AccountUsers"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: 'VnUsers/preview',
|
url: 'VnUsers/preview',
|
||||||
label: t('account.search'),
|
label: $t('account.search'),
|
||||||
info: t('account.searchInfo'),
|
info: $t('account.searchInfo'),
|
||||||
|
exprBuilder,
|
||||||
|
filter: {
|
||||||
|
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||||
|
},
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,11 +4,10 @@ import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
|
import filter from './AccountFilter.js';
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -22,14 +21,6 @@ const { t } = useI18n();
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
const data = ref(useCardDescription());
|
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity.nickname, entity.id));
|
|
||||||
|
|
||||||
const filter = {
|
|
||||||
where: { id: entityId },
|
|
||||||
fields: ['id', 'nickname', 'name', 'role'],
|
|
||||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
|
||||||
};
|
|
||||||
const hasAccount = ref(false);
|
const hasAccount = ref(false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -44,10 +35,8 @@ const hasAccount = ref(false);
|
||||||
:url="`VnUsers/preview`"
|
:url="`VnUsers/preview`"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
module="Account"
|
module="Account"
|
||||||
@on-fetch="setData"
|
data-key="Account"
|
||||||
data-key="AccountId"
|
title="nickname"
|
||||||
:title="data.title"
|
|
||||||
:subtitle="data.subtitle"
|
|
||||||
>
|
>
|
||||||
<template #menu>
|
<template #menu>
|
||||||
<AccountDescriptorMenu :has-account="hasAccount" />
|
<AccountDescriptorMenu :has-account="hasAccount" />
|
||||||
|
@ -73,7 +62,7 @@ const hasAccount = ref(false);
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('account.card.nickname')" :value="entity.name" />
|
<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 }">
|
||||||
<QCardActions class="q-gutter-x-md">
|
<QCardActions class="q-gutter-x-md">
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
export default {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
'email',
|
||||||
|
'nickname',
|
||||||
|
'name',
|
||||||
|
'accountStateFk',
|
||||||
|
'packages',
|
||||||
|
'pickup',
|
||||||
|
'role',
|
||||||
|
],
|
||||||
|
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||||
|
};
|
|
@ -44,23 +44,32 @@ const fetchMailForwards = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`MailForwards/${route.params.id}`);
|
const response = await axios.get(`MailForwards/${route.params.id}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch {
|
} catch (err) {
|
||||||
|
console.error('Error fetching mail forwards', err);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
|
try {
|
||||||
await axios.delete(`MailForwards/${route.params.id}`);
|
await axios.delete(`MailForwards/${route.params.id}`);
|
||||||
formData.value.forwardTo = null;
|
formData.value.forwardTo = null;
|
||||||
initialData.value.forwardTo = null;
|
initialData.value.forwardTo = null;
|
||||||
initialData.value.hasData = hasData.value;
|
initialData.value.hasData = hasData.value;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error deleting mail forward', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMailForward = async () => {
|
const updateMailForward = async () => {
|
||||||
|
try {
|
||||||
await axios.patch('MailForwards', formData.value);
|
await axios.patch('MailForwards', formData.value);
|
||||||
initialData.value = { ...formData.value };
|
initialData.value = { ...formData.value };
|
||||||
initialData.value.hasData = hasData.value;
|
initialData.value.hasData = hasData.value;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error creating mail forward', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
import filter from './AccountFilter.js';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -17,39 +14,26 @@ const $props = defineProps({
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { store } = useArrayData('Account');
|
|
||||||
const account = ref(store.data);
|
|
||||||
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const filter = {
|
|
||||||
where: { id: entityId },
|
|
||||||
fields: ['id', 'nickname', 'name', 'role'],
|
|
||||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary data-key="Account" url="VnUsers/preview" :filter="filter">
|
||||||
data-key="AccountSummary"
|
<template #header="{ entity }">{{ entity.id }} - {{ entity.nickname }}</template>
|
||||||
ref="AccountSummary"
|
<template #body="{ entity }">
|
||||||
url="VnUsers/preview"
|
|
||||||
:filter="filter"
|
|
||||||
@on-fetch="(data) => (account = data)"
|
|
||||||
>
|
|
||||||
<template #header>{{ account.id }} - {{ account.nickname }}</template>
|
|
||||||
<template #body>
|
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
<router-link
|
<router-link
|
||||||
:to="{ name: 'AccountBasicData', params: { id: entityId } }"
|
:to="{ name: 'AccountBasicData', params: { id: entityId } }"
|
||||||
class="header header-link"
|
class="header header-link"
|
||||||
>
|
>
|
||||||
{{ t('globals.pageTitles.basicData') }}
|
{{ $t('globals.pageTitles.basicData') }}
|
||||||
<QIcon name="open_in_new" />
|
<QIcon name="open_in_new" />
|
||||||
</router-link>
|
</router-link>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<VnLv :label="t('account.card.nickname')" :value="account.name" />
|
<VnLv :label="$t('account.card.nickname')" :value="entity.name" />
|
||||||
<VnLv :label="t('account.card.role')" :value="account.role.name" />
|
<VnLv :label="$t('account.card.role')" :value="entity.role?.name" />
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
export default (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return /^\d+$/.test(value)
|
||||||
|
? { id: value }
|
||||||
|
: {
|
||||||
|
or: [
|
||||||
|
{ name: { like: `%${value}%` } },
|
||||||
|
{ nickname: { like: `%${value}%` } },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
case 'name':
|
||||||
|
case 'description':
|
||||||
|
return { [param]: { like: `%${value}%` } };
|
||||||
|
}
|
||||||
|
};
|
|
@ -6,6 +6,7 @@ import { useRoute } from 'vue-router';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import RoleSummary from './Card/RoleSummary.vue';
|
import RoleSummary from './Card/RoleSummary.vue';
|
||||||
|
import exprBuilder from './AccountExprBuilder.js';
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -62,24 +63,7 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const exprBuilder = (param, value) => {
|
|
||||||
switch (param) {
|
|
||||||
case 'search':
|
|
||||||
return /^\d+$/.test(value)
|
|
||||||
? { id: value }
|
|
||||||
: {
|
|
||||||
or: [
|
|
||||||
{ name: { like: `%${value}%` } },
|
|
||||||
{ nickname: { like: `%${value}%` } },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
case 'name':
|
|
||||||
case 'description':
|
|
||||||
return { [param]: { like: `%${value}%` } };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="AccountRolesList"
|
data-key="AccountRolesList"
|
||||||
|
|
|
@ -1,24 +1,16 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
const route = useRoute();
|
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FormModel :url="`VnRoles/${route.params.id}`" model="VnRole" auto-load>
|
<FormModel model="Role" auto-load>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<VnInput v-model="data.name" :label="$t('globals.name')" />
|
||||||
<VnInput v-model="data.name" :label="t('globals.name')" />
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<VnInput v-model="data.description" :label="$t('role.description')" />
|
||||||
<VnInput v-model="data.description" :label="t('role.description')" />
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import RoleDescriptor from './RoleDescriptor.vue';
|
import RoleDescriptor from './RoleDescriptor.vue';
|
||||||
|
import exprBuilder from '../AccountExprBuilder.js';
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
|
url="VnRoles"
|
||||||
|
:id-in-where="true"
|
||||||
data-key="Role"
|
data-key="Role"
|
||||||
:descriptor="RoleDescriptor"
|
:descriptor="RoleDescriptor"
|
||||||
search-data-key="AccountRolesList"
|
search-data-key="Roles"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: 'VnRoles',
|
url: 'VnRoles',
|
||||||
label: t('role.searchRoles'),
|
label: $t('role.searchRoles'),
|
||||||
info: t('role.searchInfo'),
|
info: $t('role.searchInfo'),
|
||||||
searchUrl: 'table',
|
searchUrl: 'table',
|
||||||
|
exprBuilder,
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -26,26 +25,22 @@ const { t } = useI18n();
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
const data = ref(useCardDescription());
|
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity.name, entity.id));
|
|
||||||
const filter = {
|
|
||||||
where: { id: entityId },
|
|
||||||
};
|
|
||||||
const removeRole = async () => {
|
const removeRole = async () => {
|
||||||
|
try {
|
||||||
await axios.delete(`VnRoles/${entityId.value}`);
|
await axios.delete(`VnRoles/${entityId.value}`);
|
||||||
notify(t('Role removed'), 'positive');
|
notify(t('Role removed'), 'positive');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error deleting role', error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
:url="`VnRoles/${entityId}`"
|
url="VnRoles"
|
||||||
:filter="filter"
|
:filter="{ where: { id: entityId } }"
|
||||||
module="Role"
|
module="Role"
|
||||||
@on-fetch="setData"
|
data-key="Role"
|
||||||
data-key="accountData"
|
|
||||||
:title="data.title"
|
|
||||||
:subtitle="data.subtitle"
|
|
||||||
:summary="$props.summary"
|
:summary="$props.summary"
|
||||||
>
|
>
|
||||||
<template #menu>
|
<template #menu>
|
||||||
|
|
|
@ -19,18 +19,15 @@ const $props = defineProps({
|
||||||
const { store } = useArrayData('Role');
|
const { store } = useArrayData('Role');
|
||||||
const role = ref(store.data);
|
const role = ref(store.data);
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const filter = {
|
|
||||||
where: { id: entityId },
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
ref="summary"
|
ref="summary"
|
||||||
:url="`VnRoles`"
|
url="VnRoles"
|
||||||
:filter="filter"
|
:filter="{ where: { id: entityId } }"
|
||||||
@on-fetch="(data) => (role = data)"
|
@on-fetch="(data) => (role = data)"
|
||||||
data-key="RoleSummary"
|
data-key="Role"
|
||||||
>
|
>
|
||||||
<template #header> {{ role.id }} - {{ role.name }} </template>
|
<template #header> {{ role.id }} - {{ role.name }} </template>
|
||||||
<template #body>
|
<template #body>
|
||||||
|
|
|
@ -7,7 +7,7 @@ import filter from './ClaimFilter.js';
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Claim"
|
data-key="Claim"
|
||||||
base-url="Claims"
|
url="Claims"
|
||||||
:descriptor="ClaimDescriptor"
|
:descriptor="ClaimDescriptor"
|
||||||
:filter-panel="ClaimFilter"
|
:filter-panel="ClaimFilter"
|
||||||
search-data-key="ClaimList"
|
search-data-key="ClaimList"
|
||||||
|
|
|
@ -8,7 +8,6 @@ import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||||
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
|
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
import { getUrl } from 'src/composables/getUrl';
|
||||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||||
|
@ -39,10 +38,8 @@ const STATE_COLOR = {
|
||||||
function stateColor(code) {
|
function stateColor(code) {
|
||||||
return STATE_COLOR[code];
|
return STATE_COLOR[code];
|
||||||
}
|
}
|
||||||
const data = ref(useCardDescription());
|
|
||||||
const setData = (entity) => {
|
const setData = (entity) => {
|
||||||
if (!entity) return;
|
if (!entity) return;
|
||||||
data.value = useCardDescription(entity?.client?.name, entity.id);
|
|
||||||
state.set('ClaimDescriptor', entity);
|
state.set('ClaimDescriptor', entity);
|
||||||
};
|
};
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
|
@ -100,7 +100,7 @@ async function remove() {
|
||||||
</QMenu>
|
</QMenu>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim">
|
<QItem @click="confirmRemove()" v-ripple clickable>
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="delete" />
|
<QIcon name="delete" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -130,7 +130,7 @@ function cancel() {
|
||||||
<template #body-cell-description="{ row, value }">
|
<template #body-cell-description="{ row, value }">
|
||||||
<QTd auto-width align="right" class="link">
|
<QTd auto-width align="right" class="link">
|
||||||
{{ value }}
|
{{ value }}
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk"></ItemDescriptorProxy>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
|
|
@ -25,7 +25,7 @@ const claimFilter = computed(() => {
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'nickname', 'name'],
|
fields: ['id', 'nickname'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -95,7 +95,6 @@ const columns = computed(() => [
|
||||||
optionLabel: 'description',
|
optionLabel: 'description',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
orderBy: 'priority',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { onBeforeMount, ref, watch } from 'vue';
|
import { onBeforeMount, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
|
@ -53,6 +52,7 @@ const addressFilter = {
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
const { id } = route.params;
|
const { id } = route.params;
|
||||||
|
getAddressesData(id);
|
||||||
getClientData(id);
|
getClientData(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,10 +60,23 @@ watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (!newValue) return;
|
if (!newValue) return;
|
||||||
|
getAddressesData(newValue);
|
||||||
getClientData(newValue);
|
getClientData(newValue);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getAddressesData = async (id) => {
|
||||||
|
try {
|
||||||
|
const { data } = await axios.get(`Clients/${id}/addresses`, {
|
||||||
|
params: { filter: JSON.stringify(addressFilter) },
|
||||||
|
});
|
||||||
|
addresses.value = data;
|
||||||
|
sortAddresses();
|
||||||
|
} catch (error) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const getClientData = async (id) => {
|
const getClientData = async (id) => {
|
||||||
try {
|
try {
|
||||||
const { data } = await axios.get(`Clients/${id}`);
|
const { data } = await axios.get(`Clients/${id}`);
|
||||||
|
@ -88,9 +101,9 @@ const setDefault = (address) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const sortAddresses = (data) => {
|
const sortAddresses = () => {
|
||||||
if (!client.value || !data) return;
|
if (!client.value || !addresses.value) return;
|
||||||
addresses.value = data.sort((a, b) => {
|
addresses.value = addresses.value.sort((a, b) => {
|
||||||
return isDefaultAddress(b) - isDefaultAddress(a);
|
return isDefaultAddress(b) - isDefaultAddress(a);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -111,17 +124,8 @@ const toCustomerAddressEdit = (addressId) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
@on-fetch="sortAddresses"
|
|
||||||
auto-load
|
|
||||||
data-key="CustomerAddresses"
|
|
||||||
order="id DESC"
|
|
||||||
ref="vnPaginateRef"
|
|
||||||
:filter="addressFilter"
|
|
||||||
:url="`Clients/${route.params.id}/addresses`"
|
|
||||||
/>
|
|
||||||
<div class="full-width flex justify-center">
|
<div class="full-width flex justify-center">
|
||||||
<QCard class="card-width q-pa-lg">
|
<QCard class="card-width q-pa-lg" v-if="addresses.length">
|
||||||
<QCardSection>
|
<QCardSection>
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in addresses"
|
v-for="(item, index) in addresses"
|
||||||
|
@ -163,7 +167,7 @@ const toCustomerAddressEdit = (addressId) => {
|
||||||
<div>{{ item.street }}</div>
|
<div>{{ item.street }}</div>
|
||||||
<div>
|
<div>
|
||||||
{{ item.postalCode }} - {{ item.city }},
|
{{ item.postalCode }} - {{ item.city }},
|
||||||
{{ item.province?.name }}
|
{{ item.province.name }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ item.phone }}
|
{{ item.phone }}
|
||||||
|
|
|
@ -256,10 +256,10 @@ const showBalancePdf = ({ id }) => {
|
||||||
{{ toCurrency(balances[rowIndex]?.balance) }}
|
{{ toCurrency(balances[rowIndex]?.balance) }}
|
||||||
</template>
|
</template>
|
||||||
<template #column-description="{ row }">
|
<template #column-description="{ row }">
|
||||||
<span class="link" v-if="row.isInvoice" @click.stop>
|
<div class="link" v-if="row.isInvoice">
|
||||||
{{ t('bill', { ref: row.description }) }}
|
{{ t('bill', { ref: row.description }) }}
|
||||||
<InvoiceOutDescriptorProxy :id="row.id" />
|
<InvoiceOutDescriptorProxy :id="row.description" />
|
||||||
</span>
|
</div>
|
||||||
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
||||||
{{ row.description }}
|
{{ row.description }}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -9,7 +9,6 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
||||||
import { getDifferences, getUpdatedValues } from 'src/filters';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -31,13 +30,6 @@ const exprBuilder = (param, value) => {
|
||||||
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
|
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function onBeforeSave(formData, originalData) {
|
|
||||||
return getUpdatedValues(
|
|
||||||
Object.keys(getDifferences(formData, originalData)),
|
|
||||||
formData
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -51,12 +43,7 @@ function onBeforeSave(formData, originalData) {
|
||||||
@on-fetch="(data) => (businessTypes = data)"
|
@on-fetch="(data) => (businessTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FormModel
|
<FormModel auto-load model="Client" :url-update="`Clients/${$route.params.id}`">
|
||||||
:url="`Clients/${route.params.id}`"
|
|
||||||
auto-load
|
|
||||||
model="customer"
|
|
||||||
:mapper="onBeforeSave"
|
|
||||||
>
|
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -107,7 +94,6 @@ function onBeforeSave(formData, originalData) {
|
||||||
:rules="validate('client.phone')"
|
:rules="validate('client.phone')"
|
||||||
clearable
|
clearable
|
||||||
v-model="data.phone"
|
v-model="data.phone"
|
||||||
data-cy="customerPhone"
|
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('customer.summary.mobile')"
|
:label="t('customer.summary.mobile')"
|
||||||
|
|
|
@ -28,7 +28,12 @@ const getBankEntities = (data, formData) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FormModel :url-update="`Clients/${route.params.id}`" auto-load model="customer">
|
<FormModel
|
||||||
|
:url-update="`Clients/${route.params.id}`"
|
||||||
|
:url="`Clients/${route.params.id}/getCard`"
|
||||||
|
auto-load
|
||||||
|
model="customer"
|
||||||
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
|
|
@ -1,20 +1,14 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import CustomerDescriptor from './CustomerDescriptor.vue';
|
import CustomerDescriptor from './CustomerDescriptor.vue';
|
||||||
import CustomerFilter from '../CustomerFilter.vue';
|
import CustomerFilter from '../CustomerFilter.vue';
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const routeName = computed(() => route.name);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Client"
|
data-key="Client"
|
||||||
base-url="Clients"
|
:url="`Clients/${$route.params.id}/getCard`"
|
||||||
:descriptor="CustomerDescriptor"
|
:descriptor="CustomerDescriptor"
|
||||||
:filter-panel="routeName != 'CustomerConsumption' && CustomerFilter"
|
:filter-panel="$route.name != 'CustomerConsumption' && CustomerFilter"
|
||||||
search-data-key="CustomerList"
|
search-data-key="CustomerList"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: 'Clients/filter',
|
url: 'Clients/filter',
|
||||||
|
|
|
@ -93,6 +93,22 @@ const columns = computed(() => [
|
||||||
<WorkerDescriptorProxy :id="row.worker.id" />
|
<WorkerDescriptorProxy :id="row.worker.id" />
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
<!-- <QTable
|
||||||
|
:columns="columns"
|
||||||
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
|
:rows="rows"
|
||||||
|
hide-bottom
|
||||||
|
row-key="id"
|
||||||
|
v-model:selected="selected"
|
||||||
|
class="card-width q-px-lg"
|
||||||
|
>
|
||||||
|
<template #body-cell-employee="{ row }">
|
||||||
|
<QTd @click.stop>
|
||||||
|
<span class="link">{{ row.worker.user.nickname }}</span>
|
||||||
|
<WorkerDescriptorProxy :id="row.clientFk" />
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
|
</QTable> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||||
|
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
|
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||||
|
@ -35,11 +33,6 @@ const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
|
||||||
const setData = (entity) => {
|
|
||||||
data.value = useCardDescription(entity?.name, entity?.id);
|
|
||||||
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
|
|
||||||
};
|
|
||||||
const debtWarning = computed(() => {
|
const debtWarning = computed(() => {
|
||||||
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
||||||
});
|
});
|
||||||
|
@ -49,11 +42,9 @@ const debtWarning = computed(() => {
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
module="Customer"
|
module="Customer"
|
||||||
:url="`Clients/${entityId}/getCard`"
|
:url="`Clients/${entityId}/getCard`"
|
||||||
:title="data.title"
|
|
||||||
:subtitle="data.subtitle"
|
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
:summary="$props.summary"
|
:summary="$props.summary"
|
||||||
data-key="customer"
|
data-key="Client"
|
||||||
>
|
>
|
||||||
<template #menu="{ entity }">
|
<template #menu="{ entity }">
|
||||||
<CustomerDescriptorMenu :customer="entity" />
|
<CustomerDescriptorMenu :customer="entity" />
|
||||||
|
|
|
@ -34,6 +34,7 @@ function handleLocation(data, location) {
|
||||||
/>
|
/>
|
||||||
<FormModel
|
<FormModel
|
||||||
:url-update="`Clients/${route.params.id}/updateFiscalData`"
|
:url-update="`Clients/${route.params.id}/updateFiscalData`"
|
||||||
|
:url="`Clients/${route.params.id}/getCard`"
|
||||||
auto-load
|
auto-load
|
||||||
model="customer"
|
model="customer"
|
||||||
>
|
>
|
||||||
|
|
|
@ -320,7 +320,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
:value="entity.recommendedCredit"
|
:value="entity.recommendedCredit"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-max">
|
<QCard class="vn-one">
|
||||||
<VnTitle :text="t('Latest tickets')" />
|
<VnTitle :text="t('Latest tickets')" />
|
||||||
<CustomerSummaryTable />
|
<CustomerSummaryTable />
|
||||||
</QCard>
|
</QCard>
|
||||||
|
|
|
@ -1,82 +1,164 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { computed, onBeforeMount, ref, watch, nextTick } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
const formModelRef = ref(false);
|
import axios from 'axios';
|
||||||
|
import useNotify from 'src/composables/useNotify';
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const { notify } = useNotify();
|
||||||
|
const stateStore = useStateStore();
|
||||||
|
|
||||||
const amountInputRef = ref(null);
|
const amountInputRef = ref(null);
|
||||||
|
const initialDated = Date.vnNew();
|
||||||
|
const unpaidClient = ref(false);
|
||||||
|
const isLoading = ref(false);
|
||||||
|
const amount = ref(null);
|
||||||
|
const dated = ref(initialDated);
|
||||||
|
|
||||||
const initialData = ref({
|
const initialData = ref({
|
||||||
dated: Date.vnNew(),
|
dated: initialDated,
|
||||||
amount: null,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const filterClientFindOne = {
|
const hasChanged = computed(() => {
|
||||||
fields: ['unpaid', 'dated', 'amount'],
|
return (
|
||||||
where: {
|
initialData.value.dated !== dated.value ||
|
||||||
clientFk: route.params.id,
|
initialData.value.amount !== amount.value
|
||||||
},
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
getData(route.params.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.params.id,
|
||||||
|
(newValue) => {
|
||||||
|
if (!newValue) return;
|
||||||
|
getData(newValue);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const getData = async (id) => {
|
||||||
|
const filter = { where: { clientFk: id } };
|
||||||
|
try {
|
||||||
|
const { data } = await axios.get('ClientUnpaids', {
|
||||||
|
params: { filter: JSON.stringify(filter) },
|
||||||
|
});
|
||||||
|
if (data.length) {
|
||||||
|
setValues(data[0]);
|
||||||
|
} else {
|
||||||
|
defaultValues();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
defaultValues();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setValues = (data) => {
|
||||||
|
unpaidClient.value = true;
|
||||||
|
amount.value = data.amount;
|
||||||
|
dated.value = data.dated;
|
||||||
|
initialData.value = data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultValues = () => {
|
||||||
|
unpaidClient.value = false;
|
||||||
|
initialData.value.amount = null;
|
||||||
|
setInitialData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const setInitialData = () => {
|
||||||
|
amount.value = initialData.value.amount;
|
||||||
|
dated.value = initialData.value.dated;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSubmit = async () => {
|
||||||
|
isLoading.value = true;
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
amount: amount.value,
|
||||||
|
clientFk: route.params.id,
|
||||||
|
dated: dated.value,
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
await axios.patch('ClientUnpaids', payload);
|
||||||
|
notify('globals.dataSaved', 'positive');
|
||||||
|
unpaidClient.value = true;
|
||||||
|
} catch (error) {
|
||||||
|
notify('errors.writeRequest', 'negative');
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => unpaidClient.value,
|
||||||
|
async (val) => {
|
||||||
|
await nextTick();
|
||||||
|
if (val) amountInputRef.value.focus();
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<Teleport v-if="stateStore?.isSubToolbarShown()" to="#st-actions">
|
||||||
:filter="filterClientFindOne"
|
<QBtnGroup push class="q-gutter-x-sm">
|
||||||
auto-load
|
<QBtn
|
||||||
url="ClientUnpaids"
|
:disabled="!hasChanged"
|
||||||
@on-fetch="
|
:label="t('globals.reset')"
|
||||||
(data) => {
|
:loading="isLoading"
|
||||||
const unpaid = data.length == 1;
|
@click="setInitialData"
|
||||||
initialData = { ...data[0], unpaid };
|
color="primary"
|
||||||
}
|
flat
|
||||||
"
|
icon="restart_alt"
|
||||||
|
type="reset"
|
||||||
/>
|
/>
|
||||||
<QCard>
|
<QBtn
|
||||||
<FormModel
|
:disabled="!hasChanged"
|
||||||
v-if="'unpaid' in initialData"
|
:label="t('globals.save')"
|
||||||
:observe-form-changes="false"
|
:loading="isLoading"
|
||||||
ref="formModelRef"
|
@click="onSubmit"
|
||||||
model="unpaid"
|
color="primary"
|
||||||
url-update="ClientUnpaids"
|
icon="save"
|
||||||
:mapper="(formData) => ({ ...formData, clientFk: route.params.id })"
|
/>
|
||||||
:form-initial-data="initialData"
|
</QBtnGroup>
|
||||||
>
|
</Teleport>
|
||||||
<template #form="{ data }">
|
|
||||||
|
<div class="full-width flex justify-center">
|
||||||
|
<QCard class="card-width q-pa-lg">
|
||||||
|
<QForm>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox :label="t('Unpaid client')" v-model="data.unpaid" />
|
<div class="col">
|
||||||
|
<QCheckbox :label="t('Unpaid client')" v-model="unpaidClient" />
|
||||||
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md" v-show="data.unpaid">
|
<VnRow class="row q-gutter-md q-mb-md" v-show="unpaidClient">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInputDate
|
<VnInputDate :label="t('Date')" v-model="dated" />
|
||||||
data-cy="customerUnpaidDate"
|
|
||||||
:label="t('Date')"
|
|
||||||
v-model="data.dated"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInputNumber
|
<VnInput
|
||||||
data-cy="customerUnpaidAmount"
|
|
||||||
ref="amountInputRef"
|
ref="amountInputRef"
|
||||||
:label="t('Amount')"
|
:label="t('Amount')"
|
||||||
clearable
|
clearable
|
||||||
v-model="data.amount"
|
type="number"
|
||||||
|
v-model="amount"
|
||||||
autofocus
|
autofocus
|
||||||
>
|
>
|
||||||
<template #append>€</template></VnInputNumber
|
<template #append>€</template></VnInput
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</QForm>
|
||||||
</FormModel>
|
|
||||||
</QCard>
|
</QCard>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -25,9 +25,10 @@ async function hasCustomerRole() {
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FormModel
|
<FormModel
|
||||||
|
url="VnUsers/preview"
|
||||||
:url-update="`Clients/${route.params.id}/updateUser`"
|
:url-update="`Clients/${route.params.id}/updateUser`"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
model="customer"
|
model="webAccess"
|
||||||
:mapper="
|
:mapper="
|
||||||
({ active, name, email }) => {
|
({ active, name, email }) => {
|
||||||
return {
|
return {
|
||||||
|
@ -41,7 +42,7 @@ async function hasCustomerRole() {
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<QCheckbox :label="t('Enable web access')" v-model="data.account.active" />
|
<QCheckbox :label="t('Enable web access')" v-model="data.active" />
|
||||||
<VnInput :label="t('User')" clearable v-model="data.name" />
|
<VnInput :label="t('User')" clearable v-model="data.name" />
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Recovery email')"
|
:label="t('Recovery email')"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, onBeforeMount, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import axios from 'axios';
|
||||||
|
|
||||||
import { toCurrency, toDateHourMin } from 'src/filters';
|
import { toCurrency, toDateHourMin } from 'src/filters';
|
||||||
|
|
||||||
|
@ -20,11 +20,10 @@ const filter = {
|
||||||
{ relation: 'mandateType', scope: { fields: ['id', 'name'] } },
|
{ relation: 'mandateType', scope: { fields: ['id', 'name'] } },
|
||||||
{ relation: 'company', scope: { fields: ['id', 'code'] } },
|
{ relation: 'company', scope: { fields: ['id', 'code'] } },
|
||||||
],
|
],
|
||||||
where: { clientFk: route.params.id },
|
where: { clientFk: null },
|
||||||
order: ['created DESC'],
|
order: ['created DESC'],
|
||||||
limit: 20,
|
limit: 20,
|
||||||
};
|
};
|
||||||
const ClientDmsRef = ref(false);
|
|
||||||
|
|
||||||
const tableColumnComponents = {
|
const tableColumnComponents = {
|
||||||
state: {
|
state: {
|
||||||
|
@ -51,7 +50,7 @@ const tableColumnComponents = {
|
||||||
component: CustomerCheckIconTooltip,
|
component: CustomerCheckIconTooltip,
|
||||||
props: ({ row }) => ({
|
props: ({ row }) => ({
|
||||||
transaction: row,
|
transaction: row,
|
||||||
promise: () => ClientDmsRef.value.fetch(),
|
promise: refreshData,
|
||||||
}),
|
}),
|
||||||
event: () => {},
|
event: () => {},
|
||||||
},
|
},
|
||||||
|
@ -90,16 +89,38 @@ const columns = computed(() => [
|
||||||
name: 'validate',
|
name: 'validate',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
getData(route.params.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.params.id,
|
||||||
|
(newValue) => {
|
||||||
|
if (!newValue) return;
|
||||||
|
getData(newValue);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const getData = async (id) => {
|
||||||
|
filter.where.clientFk = id;
|
||||||
|
try {
|
||||||
|
const { data } = await axios.get('clients/transactions', {
|
||||||
|
params: { filter: JSON.stringify(filter) },
|
||||||
|
});
|
||||||
|
rows.value = data;
|
||||||
|
} catch (error) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const refreshData = () => {
|
||||||
|
getData(route.params.id);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<div class="full-width flex justify-center">
|
||||||
ref="ClientDmsRef"
|
|
||||||
:filter="filter"
|
|
||||||
@on-fetch="(data) => (rows = data)"
|
|
||||||
auto-load
|
|
||||||
url="Clients/transactions"
|
|
||||||
/>
|
|
||||||
<QPage class="card-width q-pa-lg">
|
<QPage class="card-width q-pa-lg">
|
||||||
<QTable
|
<QTable
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
@ -114,9 +135,13 @@ const columns = computed(() => [
|
||||||
<QTr :props="props">
|
<QTr :props="props">
|
||||||
<component
|
<component
|
||||||
:is="tableColumnComponents[props.col.name].component"
|
:is="tableColumnComponents[props.col.name].component"
|
||||||
@click="tableColumnComponents[props.col.name].event(props)"
|
@click="
|
||||||
|
tableColumnComponents[props.col.name].event(props)
|
||||||
|
"
|
||||||
class="rounded-borders q-pa-sm"
|
class="rounded-borders q-pa-sm"
|
||||||
v-bind="tableColumnComponents[props.col.name].props(props)"
|
v-bind="
|
||||||
|
tableColumnComponents[props.col.name].props(props)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
{{ props.value }}
|
{{ props.value }}
|
||||||
</component>
|
</component>
|
||||||
|
@ -129,6 +154,7 @@ const columns = computed(() => [
|
||||||
{{ t('globals.noResults') }}
|
{{ t('globals.noResults') }}
|
||||||
</h5>
|
</h5>
|
||||||
</QPage>
|
</QPage>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -101,8 +101,8 @@ const exprBuilder = (param, value) => {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem class="q-mb-sm">
|
||||||
<QItemSection>
|
<QItemSection
|
||||||
<VnSelect
|
><VnSelect
|
||||||
url="Provinces"
|
url="Provinces"
|
||||||
:label="t('Province')"
|
:label="t('Province')"
|
||||||
v-model="params.provinceFk"
|
v-model="params.provinceFk"
|
||||||
|
@ -120,12 +120,14 @@ const exprBuilder = (param, value) => {
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem class="q-mb-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('City')" v-model="params.city" is-outlined />
|
<VnInput :label="t('City')" v-model="params.city" is-outlined />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QSeparator />
|
||||||
|
<QExpansionItem :label="t('More options')" expand-separator>
|
||||||
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('Phone')" v-model="params.phone" is-outlined>
|
<VnInput :label="t('Phone')" v-model="params.phone" is-outlined>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
|
@ -134,7 +136,7 @@ const exprBuilder = (param, value) => {
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('Email')" v-model="params.email" is-outlined>
|
<VnInput :label="t('Email')" v-model="params.email" is-outlined>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
|
@ -143,8 +145,7 @@ const exprBuilder = (param, value) => {
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem>
|
||||||
<QItemSection>
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Zones"
|
url="Zones"
|
||||||
:label="t('Zone')"
|
:label="t('Zone')"
|
||||||
|
@ -159,9 +160,9 @@ const exprBuilder = (param, value) => {
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
auto-load
|
auto-load
|
||||||
/></QItemSection>
|
/>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Postcode')"
|
:label="t('Postcode')"
|
||||||
|
@ -170,6 +171,7 @@ const exprBuilder = (param, value) => {
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
</QExpansionItem>
|
||||||
</template>
|
</template>
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
|
@ -201,6 +203,7 @@ es:
|
||||||
Salesperson: Comercial
|
Salesperson: Comercial
|
||||||
Province: Provincia
|
Province: Provincia
|
||||||
City: Ciudad
|
City: Ciudad
|
||||||
|
More options: Más opciones
|
||||||
Phone: Teléfono
|
Phone: Teléfono
|
||||||
Email: Email
|
Email: Email
|
||||||
Zone: Zona
|
Zone: Zona
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { onBeforeMount, reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
|
@ -24,6 +25,20 @@ const agencyModes = ref([]);
|
||||||
const incoterms = ref([]);
|
const incoterms = ref([]);
|
||||||
const customsAgents = ref([]);
|
const customsAgents = ref([]);
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
urlCreate.value = `Clients/${route.params.id}/createAddress`;
|
||||||
|
getCustomsAgents();
|
||||||
|
});
|
||||||
|
|
||||||
|
const getCustomsAgents = async () => {
|
||||||
|
const { data } = await axios.get('CustomsAgents');
|
||||||
|
customsAgents.value = data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const refreshData = () => {
|
||||||
|
getCustomsAgents();
|
||||||
|
};
|
||||||
|
|
||||||
const toCustomerAddress = () => {
|
const toCustomerAddress = () => {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'CustomerAddress',
|
name: 'CustomerAddress',
|
||||||
|
@ -39,11 +54,6 @@ function handleLocation(data, location) {
|
||||||
data.provinceFk = provinceFk;
|
data.provinceFk = provinceFk;
|
||||||
data.countryFk = countryFk;
|
data.countryFk = countryFk;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAgentCreated(requestResponse, data) {
|
|
||||||
customsAgents.value.push(requestResponse);
|
|
||||||
data.customsAgentFk = requestResponse.id;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -129,7 +139,6 @@ function onAgentCreated(requestResponse, data) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
url="CustomsAgents"
|
|
||||||
:label="t('Customs agent')"
|
:label="t('Customs agent')"
|
||||||
:options="customsAgents"
|
:options="customsAgents"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
@ -139,12 +148,7 @@ function onAgentCreated(requestResponse, data) {
|
||||||
:tooltip="t('Create a new expense')"
|
:tooltip="t('Create a new expense')"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CustomerNewCustomsAgent
|
<CustomerNewCustomsAgent @on-data-saved="refreshData()" />
|
||||||
@on-data-saved="
|
|
||||||
(_, requestResponse) =>
|
|
||||||
onAgentCreated(requestResponse, data)
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</VnSelectDialog>
|
</VnSelectDialog>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
|
@ -144,7 +144,7 @@ function handleLocation(data, location) {
|
||||||
:url="`Addresses/${route.params.addressId}`"
|
:url="`Addresses/${route.params.addressId}`"
|
||||||
@on-data-saved="onDataSaved()"
|
@on-data-saved="onDataSaved()"
|
||||||
auto-load
|
auto-load
|
||||||
model="customer"
|
model="client"
|
||||||
>
|
>
|
||||||
<template #moreActions>
|
<template #moreActions>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
|
|
@ -106,6 +106,7 @@ const setParams = (params) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPreview = async () => {
|
const getPreview = async () => {
|
||||||
|
try {
|
||||||
const params = {
|
const params = {
|
||||||
recipientId: entityId,
|
recipientId: entityId,
|
||||||
};
|
};
|
||||||
|
@ -124,6 +125,9 @@ const getPreview = async () => {
|
||||||
htmlContent: data,
|
htmlContent: data,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} catch (err) {
|
||||||
|
notify('Errors getting preview', 'negative');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
|
|
@ -1,26 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FormModel
|
<FormModel model="Department" auto-load class="full-width">
|
||||||
:url="`Departments/${route.params.id}`"
|
|
||||||
model="department"
|
|
||||||
auto-load
|
|
||||||
class="full-width"
|
|
||||||
>
|
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('globals.name')"
|
:label="$t('globals.name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('globals.name')"
|
:rules="validate('globals.name')"
|
||||||
clearable
|
clearable
|
||||||
|
@ -28,28 +17,28 @@ const { t } = useI18n();
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.code"
|
v-model="data.code"
|
||||||
:label="t('globals.code')"
|
:label="$t('globals.code')"
|
||||||
:rules="validate('globals.code')"
|
:rules="validate('globals.code')"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('department.chat')"
|
:label="$t('department.chat')"
|
||||||
v-model="data.chatName"
|
v-model="data.chatName"
|
||||||
:rules="validate('department.chat')"
|
:rules="validate('department.chat')"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.notificationEmail"
|
v-model="data.notificationEmail"
|
||||||
:label="t('globals.params.email')"
|
:label="$t('globals.params.email')"
|
||||||
:rules="validate('globals.params.email')"
|
:rules="validate('globals.params.email')"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('department.bossDepartment')"
|
:label="$t('department.bossDepartment')"
|
||||||
v-model="data.workerFk"
|
v-model="data.workerFk"
|
||||||
url="Workers/search"
|
url="Workers/search"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -59,7 +48,7 @@ const { t } = useI18n();
|
||||||
:rules="validate('department.workerFk')"
|
:rules="validate('department.workerFk')"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('department.selfConsumptionCustomer')"
|
:label="$t('department.selfConsumptionCustomer')"
|
||||||
v-model="data.clientFk"
|
v-model="data.clientFk"
|
||||||
url="Clients"
|
url="Clients"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -71,11 +60,11 @@ const { t } = useI18n();
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('department.telework')"
|
:label="$t('department.telework')"
|
||||||
v-model="data.isTeleworking"
|
v-model="data.isTeleworking"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('department.notifyOnErrors')"
|
:label="$t('department.notifyOnErrors')"
|
||||||
v-model="data.hasToMistake"
|
v-model="data.hasToMistake"
|
||||||
:false-value="0"
|
:false-value="0"
|
||||||
:true-value="1"
|
:true-value="1"
|
||||||
|
@ -83,17 +72,17 @@ const { t } = useI18n();
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('department.worksInProduction')"
|
:label="$t('department.worksInProduction')"
|
||||||
v-model="data.isProduction"
|
v-model="data.isProduction"
|
||||||
/>
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('department.hasToRefill')"
|
:label="$t('department.hasToRefill')"
|
||||||
v-model="data.hasToRefill"
|
v-model="data.hasToRefill"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('department.hasToSendMail')"
|
:label="$t('department.hasToSendMail')"
|
||||||
v-model="data.hasToSendMail"
|
v-model="data.hasToSendMail"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
|
@ -7,7 +7,7 @@ import DepartmentDescriptor from 'pages/Department/Card/DepartmentDescriptor.vue
|
||||||
class="q-pa-md column items-center"
|
class="q-pa-md column items-center"
|
||||||
v-bind="{ ...$attrs }"
|
v-bind="{ ...$attrs }"
|
||||||
data-key="Department"
|
data-key="Department"
|
||||||
base-url="Departments"
|
url="Departments"
|
||||||
:descriptor="DepartmentDescriptor"
|
:descriptor="DepartmentDescriptor"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
@ -32,19 +31,14 @@ const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const department = ref();
|
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
|
||||||
|
|
||||||
const setData = (entity) => {
|
|
||||||
if (!entity) return;
|
|
||||||
data.value = useCardDescription(entity.name, entity.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
const removeDepartment = async () => {
|
const removeDepartment = async () => {
|
||||||
|
try {
|
||||||
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
|
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
|
||||||
router.push({ name: 'WorkerDepartment' });
|
router.push({ name: 'WorkerDepartment' });
|
||||||
notify('department.departmentRemoved', 'positive');
|
notify('department.departmentRemoved', 'positive');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error removing department');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
@ -54,17 +48,9 @@ const { openConfirmationModal } = useVnConfirm();
|
||||||
ref="DepartmentDescriptorRef"
|
ref="DepartmentDescriptorRef"
|
||||||
module="Department"
|
module="Department"
|
||||||
:url="`Departments/${entityId}`"
|
:url="`Departments/${entityId}`"
|
||||||
:title="data.title"
|
|
||||||
:subtitle="data.subtitle"
|
|
||||||
:summary="$props.summary"
|
:summary="$props.summary"
|
||||||
:to-module="{ name: 'WorkerDepartment' }"
|
:to-module="{ name: 'WorkerDepartment' }"
|
||||||
@on-fetch="
|
data-key="Department"
|
||||||
(data) => {
|
|
||||||
department = data;
|
|
||||||
setData(data);
|
|
||||||
}
|
|
||||||
"
|
|
||||||
data-key="department"
|
|
||||||
>
|
>
|
||||||
<template #menu="{}">
|
<template #menu="{}">
|
||||||
<QItem
|
<QItem
|
||||||
|
|
|
@ -236,9 +236,13 @@ const copyOriginalRowsData = (rows) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveChange = async (field, { rowIndex, row }) => {
|
const saveChange = async (field, { rowIndex, row }) => {
|
||||||
|
try {
|
||||||
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
|
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
|
||||||
await axios.patch(`Buys/${row.id}`, row);
|
await axios.patch(`Buys/${row.id}`, row);
|
||||||
originalRowDataCopy.value[rowIndex][field] = row[field];
|
originalRowDataCopy.value[rowIndex][field] = row[field];
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error saving changes', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const openRemoveDialog = async () => {
|
const openRemoveDialog = async () => {
|
||||||
|
@ -256,11 +260,15 @@ const openRemoveDialog = async () => {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
|
try {
|
||||||
await deleteBuys();
|
await deleteBuys();
|
||||||
const notifyMessage = t(
|
const notifyMessage = t(
|
||||||
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
|
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
|
||||||
);
|
);
|
||||||
notify(notifyMessage, 'positive');
|
notify(notifyMessage, 'positive');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error deleting buys');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -274,6 +282,7 @@ const importBuys = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleGroupingMode = async (buy, mode) => {
|
const toggleGroupingMode = async (buy, mode) => {
|
||||||
|
try {
|
||||||
const groupingMode = mode === 'grouping' ? mode : 'packing';
|
const groupingMode = mode === 'grouping' ? mode : 'packing';
|
||||||
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
|
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -281,6 +290,9 @@ const toggleGroupingMode = async (buy, mode) => {
|
||||||
};
|
};
|
||||||
await axios.patch(`Buys/${buy.id}`, params);
|
await axios.patch(`Buys/${buy.id}`, params);
|
||||||
buy.groupingMode = newGroupingMode;
|
buy.groupingMode = newGroupingMode;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error toggling grouping mode');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const lockIconType = (groupingMode, mode) => {
|
const lockIconType = (groupingMode, mode) => {
|
||||||
|
|
|
@ -123,15 +123,20 @@ const fillData = async (rawData) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchBuys = async (buys) => {
|
const fetchBuys = async (buys) => {
|
||||||
|
try {
|
||||||
const params = { buys };
|
const params = { buys };
|
||||||
const { data } = await axios.post(
|
const { data } = await axios.post(
|
||||||
`Entries/${route.params.id}/importBuysPreview`,
|
`Entries/${route.params.id}/importBuysPreview`,
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
importData.value.buys = data;
|
importData.value.buys = data;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching buys');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
|
try {
|
||||||
const params = importData.value;
|
const params = importData.value;
|
||||||
const hasAnyEmptyRow = params.buys.some((buy) => {
|
const hasAnyEmptyRow = params.buys.some((buy) => {
|
||||||
return buy.itemFk === null;
|
return buy.itemFk === null;
|
||||||
|
@ -145,6 +150,9 @@ const onSubmit = async () => {
|
||||||
await axios.post(`Entries/${route.params.id}/importBuys`, params);
|
await axios.post(`Entries/${route.params.id}/importBuys`, params);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
redirectToBuysView();
|
redirectToBuysView();
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error importing buys', err);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const redirectToBuysView = () => {
|
const redirectToBuysView = () => {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import filter from './EntryFilter.js';
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Entry"
|
data-key="Entry"
|
||||||
base-url="Entries"
|
url="Entries"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
:descriptor="EntryDescriptor"
|
:descriptor="EntryDescriptor"
|
||||||
:filter-panel="EntryFilter"
|
:filter-panel="EntryFilter"
|
||||||
|
|
|
@ -147,9 +147,12 @@ async function setEntryData(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchEntryBuys = async () => {
|
const fetchEntryBuys = async () => {
|
||||||
|
try {
|
||||||
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
||||||
if (data) entryBuys.value = data;
|
if (data) entryBuys.value = data;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error fetching entry buys');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -82,11 +82,11 @@ const entriesTableColumns = computed(() => [
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardActions align="right">
|
<QCardActions align="right">
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('myEntries.printLabels')"
|
:label="t('printLabels')"
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="print"
|
icon="print"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@click="openReport(`Entries/${entityId}/labelSupplier`)"
|
@click="openReport(`Entries/${entityId}/print`)"
|
||||||
unelevated
|
unelevated
|
||||||
autofocus
|
autofocus
|
||||||
/>
|
/>
|
||||||
|
@ -126,9 +126,7 @@ const entriesTableColumns = computed(() => [
|
||||||
"
|
"
|
||||||
unelevated
|
unelevated
|
||||||
>
|
>
|
||||||
<QTooltip>{{
|
<QTooltip>{{ t('viewLabel') }}</QTooltip>
|
||||||
t('myEntries.viewLabel')
|
|
||||||
}}</QTooltip>
|
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -12,7 +12,6 @@ import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const tableRef = ref();
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
@ -235,6 +234,7 @@ const columns = [
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
|
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const tableRef = ref();
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
|
|
|
@ -221,7 +221,7 @@ onMounted(async () => {
|
||||||
t('entry.list.tableVisibleColumns.isExcludedFromAvailable')
|
t('entry.list.tableVisibleColumns.isExcludedFromAvailable')
|
||||||
}}</QTooltip>
|
}}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="!!row.isRaid" name="vn:net" color="primary">
|
<QIcon v-if="!!row.daysInForward" name="vn:net" color="primary">
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{
|
{{
|
||||||
t('globals.raid', { daysInForward: row.daysInForward })
|
t('globals.raid', { daysInForward: row.daysInForward })
|
||||||
|
|
|
@ -30,6 +30,8 @@ const recalc = async () => {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
await axios.post('Applications/waste_addSales/execute-proc', params);
|
await axios.post('Applications/waste_addSales/execute-proc', params);
|
||||||
notify('wasteRecalc.recalcOk', 'positive');
|
notify('wasteRecalc.recalcOk', 'positive');
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ const columns = computed(() => [
|
||||||
name: 'tableActions',
|
name: 'tableActions',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
title: t('myEntries.printLabels'),
|
title: t('printLabels'),
|
||||||
icon: 'print',
|
icon: 'print',
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
action: (row) => printBuys(row.id),
|
action: (row) => printBuys(row.id),
|
||||||
|
|
|
@ -45,7 +45,7 @@ onBeforeRouteUpdate(async (to) => await setRectificative(to));
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="InvoiceIn"
|
data-key="InvoiceIn"
|
||||||
base-url="InvoiceIns"
|
url="InvoiceIns"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
:descriptor="InvoiceInDescriptor"
|
:descriptor="InvoiceInDescriptor"
|
||||||
:filter-panel="InvoiceInFilter"
|
:filter-panel="InvoiceInFilter"
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue