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
|
||||
|
||||
### Added 🆕
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
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({
|
||||
e2e: {
|
||||
|
@ -19,7 +16,6 @@ module.exports = defineConfig({
|
|||
reporterOptions: {
|
||||
charts: true,
|
||||
reportPageTitle: 'Cypress Inline Reporter',
|
||||
reportFilename: '[status]_[datetime]-report',
|
||||
embeddedScreenshots: true,
|
||||
reportDir: 'test/cypress/reports',
|
||||
inlineAssets: true,
|
||||
|
|
|
@ -9,6 +9,8 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import FormModelPopup from './FormModelPopup.vue';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
defineProps({ showEntityField: { type: Boolean, default: true } });
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
const { t } = useI18n();
|
||||
const bicInputRef = ref(null);
|
||||
|
@ -16,16 +18,17 @@ const state = useState();
|
|||
|
||||
const customer = computed(() => state.get('customer'));
|
||||
|
||||
const countriesFilter = {
|
||||
fields: ['id', 'name', 'code'],
|
||||
};
|
||||
|
||||
const bankEntityFormData = reactive({
|
||||
name: null,
|
||||
bic: null,
|
||||
countryFk: customer.value?.countryFk,
|
||||
id: null,
|
||||
});
|
||||
|
||||
const countriesFilter = {
|
||||
fields: ['id', 'name', 'code'],
|
||||
};
|
||||
|
||||
const countriesOptions = ref([]);
|
||||
|
||||
const onDataSaved = (...args) => {
|
||||
|
@ -41,6 +44,7 @@ onMounted(async () => {
|
|||
<template>
|
||||
<FetchData
|
||||
url="Countries"
|
||||
:filter="countriesFilter"
|
||||
auto-load
|
||||
@on-fetch="(data) => (countriesOptions = data)"
|
||||
/>
|
||||
|
@ -50,7 +54,6 @@ onMounted(async () => {
|
|||
:title="t('title')"
|
||||
:subtitle="t('subtitle')"
|
||||
:form-initial-data="bankEntityFormData"
|
||||
:filter="countriesFilter"
|
||||
@on-data-saved="onDataSaved"
|
||||
>
|
||||
<template #form-inputs="{ data, validate }">
|
||||
|
@ -82,13 +85,7 @@ onMounted(async () => {
|
|||
:rules="validate('bankEntity.countryFk')"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="
|
||||
countriesOptions.find((c) => c.id === data.countryFk)?.code ==
|
||||
'ES'
|
||||
"
|
||||
class="col"
|
||||
>
|
||||
<div v-if="showEntityField" class="col">
|
||||
<VnInput
|
||||
:label="t('id')"
|
||||
v-model="data.id"
|
||||
|
|
|
@ -17,6 +17,10 @@ const $props = defineProps({
|
|||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinces: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -44,7 +48,7 @@ const onDataSaved = (...args) => {
|
|||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('Name')"
|
||||
:label="t('Names')"
|
||||
v-model="data.name"
|
||||
:rules="validate('city.name')"
|
||||
/>
|
||||
|
@ -52,6 +56,7 @@ const onDataSaved = (...args) => {
|
|||
:province-selected="$props.provinceSelected"
|
||||
:country-fk="$props.countryFk"
|
||||
v-model="data.provinceFk"
|
||||
:provinces="$props.provinces"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -22,15 +22,12 @@ const postcodeFormData = reactive({
|
|||
townFk: null,
|
||||
});
|
||||
|
||||
const townsFetchDataRef = ref(false);
|
||||
const countriesFetchDataRef = ref(false);
|
||||
const provincesFetchDataRef = ref(false);
|
||||
const townsFetchDataRef = ref(null);
|
||||
const provincesFetchDataRef = ref(null);
|
||||
const countriesOptions = ref([]);
|
||||
const provincesOptions = ref([]);
|
||||
const townsOptions = ref([]);
|
||||
const town = ref({});
|
||||
const townFilter = ref({});
|
||||
const countryFilter = ref({});
|
||||
|
||||
function onDataSaved(formData) {
|
||||
const newPostcode = {
|
||||
|
@ -59,60 +56,10 @@ async function onCityCreated(newTown, formData) {
|
|||
}
|
||||
|
||||
function setTown(newTown, data) {
|
||||
if (!newTown) return;
|
||||
town.value = newTown;
|
||||
data.provinceFk = newTown?.provinceFk ?? newTown;
|
||||
data.countryFk = newTown?.province?.countryFk ?? newTown;
|
||||
}
|
||||
|
||||
async function setCountry(countryFk, data) {
|
||||
data.townFk = null;
|
||||
data.provinceFk = null;
|
||||
data.countryFk = countryFk;
|
||||
}
|
||||
|
||||
async function filterTowns(name) {
|
||||
if (name !== '') {
|
||||
townFilter.value.where = {
|
||||
name: {
|
||||
like: `%${name}%`,
|
||||
},
|
||||
};
|
||||
await townsFetchDataRef.value?.fetch();
|
||||
}
|
||||
}
|
||||
async function filterCountries(name) {
|
||||
if (name !== '') {
|
||||
countryFilter.value.where = {
|
||||
name: {
|
||||
like: `%${name}%`,
|
||||
},
|
||||
};
|
||||
await countriesFetchDataRef.value?.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchTowns(countryFk) {
|
||||
if (!countryFk) return;
|
||||
townFilter.value.where = {
|
||||
provinceFk: {
|
||||
inq: provincesOptions.value.map(({ id }) => id),
|
||||
},
|
||||
};
|
||||
await townsFetchDataRef.value?.fetch();
|
||||
}
|
||||
|
||||
async function handleProvinces(data) {
|
||||
provincesOptions.value = data;
|
||||
if (postcodeFormData.countryFk) {
|
||||
await fetchTowns(postcodeFormData.countryFk);
|
||||
}
|
||||
}
|
||||
async function handleTowns(data) {
|
||||
townsOptions.value = data;
|
||||
}
|
||||
|
||||
async function handleCountries(data) {
|
||||
countriesOptions.value = data;
|
||||
data.provinceFk = newTown.provinceFk;
|
||||
data.countryFk = newTown.province.countryFk;
|
||||
}
|
||||
|
||||
async function setProvince(id, data) {
|
||||
|
@ -126,7 +73,60 @@ async function onProvinceCreated(data) {
|
|||
await provincesFetchDataRef.value.fetch({
|
||||
where: { countryFk: postcodeFormData.countryFk },
|
||||
});
|
||||
postcodeFormData.provinceFk = data.id;
|
||||
postcodeFormData.provinceFk.value = data.id;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [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: {
|
||||
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>
|
||||
|
||||
|
@ -143,20 +143,10 @@ async function onProvinceCreated(data) {
|
|||
ref="townsFetchDataRef"
|
||||
:sort-by="['name ASC']"
|
||||
:limit="30"
|
||||
:filter="townFilter"
|
||||
@on-fetch="handleTowns"
|
||||
auto-load
|
||||
url="Towns/location"
|
||||
/>
|
||||
<FetchData
|
||||
ref="countriesFetchDataRef"
|
||||
:limit="30"
|
||||
:filter="countryFilter"
|
||||
:sort-by="['name ASC']"
|
||||
@on-fetch="handleCountries"
|
||||
auto-load
|
||||
url="Countries"
|
||||
/>
|
||||
|
||||
<FormModelPopup
|
||||
url-create="postcodes"
|
||||
|
@ -178,7 +168,6 @@ async function onProvinceCreated(data) {
|
|||
<VnSelectDialog
|
||||
:label="t('City')"
|
||||
@update:model-value="(value) => setTown(value, data)"
|
||||
@filter="filterTowns"
|
||||
:tooltip="t('Create city')"
|
||||
v-model="data.townFk"
|
||||
:options="townsOptions"
|
||||
|
@ -204,6 +193,7 @@ async function onProvinceCreated(data) {
|
|||
<CreateNewCityForm
|
||||
:country-fk="data.countryFk"
|
||||
:province-selected="data.provinceFk"
|
||||
:provinces="provincesOptions"
|
||||
@on-data-saved="
|
||||
(_, requestResponse) =>
|
||||
onCityCreated(requestResponse, data)
|
||||
|
@ -218,20 +208,20 @@ async function onProvinceCreated(data) {
|
|||
:province-selected="data.provinceFk"
|
||||
@update:model-value="(value) => setProvince(value, data)"
|
||||
v-model="data.provinceFk"
|
||||
@on-province-fetched="handleProvinces"
|
||||
:clearable="true"
|
||||
:provinces="provincesOptions"
|
||||
@on-province-created="onProvinceCreated"
|
||||
/>
|
||||
<VnSelect
|
||||
url="Countries"
|
||||
:sort-by="['name ASC']"
|
||||
:label="t('Country')"
|
||||
@update:options="handleCountries"
|
||||
:options="countriesOptions"
|
||||
hide-selected
|
||||
@filter="filterCountries"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="data.countryFk"
|
||||
:rules="validate('postcode.countryFk')"
|
||||
@update:model-value="(value) => setCountry(value, data)"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -34,12 +34,6 @@ const onDataSaved = (dataSaved, requestResponse) => {
|
|||
);
|
||||
emit('onDataSaved', dataSaved, requestResponse);
|
||||
};
|
||||
const where = computed(() => {
|
||||
if (!$props.countryFk) {
|
||||
return {};
|
||||
}
|
||||
return { countryFk: $props.countryFk };
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -47,7 +41,9 @@ const where = computed(() => {
|
|||
@on-fetch="(data) => (autonomiesOptions = data)"
|
||||
auto-load
|
||||
:filter="{
|
||||
where,
|
||||
where: {
|
||||
countryFk: $props.countryFk,
|
||||
},
|
||||
}"
|
||||
url="Autonomies/location"
|
||||
:sort-by="['name ASC']"
|
||||
|
|
|
@ -94,7 +94,6 @@ defineExpose({
|
|||
saveChanges,
|
||||
getChanges,
|
||||
formData,
|
||||
originalData,
|
||||
vnPaginateRef,
|
||||
});
|
||||
|
||||
|
@ -395,7 +394,6 @@ watch(formUrl, async () => {
|
|||
@click="onSubmit"
|
||||
:disable="!hasChanges"
|
||||
:title="t('globals.save')"
|
||||
data-cy="crudModelDefaultSaveBtn"
|
||||
/>
|
||||
<slot name="moreAfterActions" />
|
||||
</QBtnGroup>
|
||||
|
|
|
@ -156,6 +156,7 @@ const rotateRight = () => {
|
|||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
try {
|
||||
if (!newPhoto.files && !newPhoto.url) {
|
||||
notify(t('Select an image'), 'negative');
|
||||
return;
|
||||
|
@ -172,6 +173,9 @@ const onSubmit = () => {
|
|||
newPhoto.blob = file;
|
||||
})
|
||||
.then(() => makeRequest());
|
||||
} catch (err) {
|
||||
console.error('Error uploading image');
|
||||
}
|
||||
};
|
||||
|
||||
const makeRequest = async () => {
|
||||
|
|
|
@ -51,6 +51,7 @@ const onDataSaved = () => {
|
|||
};
|
||||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
||||
const payload = {
|
||||
|
@ -62,6 +63,9 @@ const onSubmit = async () => {
|
|||
await axios.post($props.editUrl, payload);
|
||||
onDataSaved();
|
||||
isLoading.value = false;
|
||||
} catch (err) {
|
||||
console.error('Error submitting table cell edit');
|
||||
}
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
|
|
|
@ -84,6 +84,7 @@ const tableColumns = computed(() => [
|
|||
]);
|
||||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
let filter = itemFilter;
|
||||
const params = itemFilterParams;
|
||||
const where = {};
|
||||
|
@ -108,6 +109,9 @@ const onSubmit = async () => {
|
|||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
tableRows.value = data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching entries items');
|
||||
}
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
|
|
|
@ -86,6 +86,7 @@ const tableColumns = computed(() => [
|
|||
]);
|
||||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
let filter = travelFilter;
|
||||
const params = travelFilterParams;
|
||||
const where = {};
|
||||
|
@ -108,6 +109,9 @@ const onSubmit = async () => {
|
|||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
tableRows.value = data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching travels');
|
||||
}
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
|
|
|
@ -91,10 +91,6 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
maxWidth: {
|
||||
type: [String, Boolean],
|
||||
default: '800px',
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||
const modelValue = computed(
|
||||
|
@ -135,7 +131,13 @@ onMounted(async () => {
|
|||
|
||||
if (!$props.formInitialData) {
|
||||
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) {
|
||||
watch(
|
||||
|
@ -155,7 +157,10 @@ onMounted(async () => {
|
|||
if (!$props.url)
|
||||
watch(
|
||||
() => arrayData.store.data,
|
||||
(val) => updateAndEmit('onFetch', val)
|
||||
(val) => {
|
||||
if (Array.isArray(val)) val = val[0] ?? {};
|
||||
updateAndEmit('onFetch', val);
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
|
@ -287,7 +292,6 @@ defineExpose({
|
|||
@submit="save"
|
||||
@reset="reset"
|
||||
class="q-pa-md"
|
||||
:style="maxWidth ? 'max-width: ' + maxWidth : ''"
|
||||
id="formModel"
|
||||
>
|
||||
<QCard>
|
||||
|
@ -376,6 +380,7 @@ defineExpose({
|
|||
color: black;
|
||||
}
|
||||
#formModel {
|
||||
max-width: 800px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||
|
||||
const emit = defineEmits(['onSubmit']);
|
||||
|
||||
const $props = defineProps({
|
||||
defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: '',
|
||||
|
@ -25,21 +25,16 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
submitOnEnter: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const closeButton = ref(null);
|
||||
const isLoading = ref(false);
|
||||
|
||||
const onSubmit = () => {
|
||||
if ($props.submitOnEnter) {
|
||||
emit('onSubmit');
|
||||
closeForm();
|
||||
}
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
|
|
|
@ -88,6 +88,7 @@ const applyTags = (params, search) => {
|
|||
};
|
||||
|
||||
const fetchItemTypes = async (id) => {
|
||||
try {
|
||||
const filter = {
|
||||
fields: ['id', 'name', 'categoryFk'],
|
||||
where: { categoryFk: id },
|
||||
|
@ -98,6 +99,9 @@ const fetchItemTypes = async (id) => {
|
|||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
itemTypesOptions.value = data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching item types', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getCategoryClass = (category, params) => {
|
||||
|
@ -107,6 +111,7 @@ const getCategoryClass = (category, params) => {
|
|||
};
|
||||
|
||||
const getSelectedTagValues = async (tag) => {
|
||||
try {
|
||||
if (!tag?.selectedTag?.id) return;
|
||||
tag.value = null;
|
||||
const filter = {
|
||||
|
@ -120,6 +125,9 @@ const getSelectedTagValues = async (tag) => {
|
|||
params,
|
||||
});
|
||||
tag.valueOptions = data;
|
||||
} catch (err) {
|
||||
console.error('Error getting selected tag values');
|
||||
}
|
||||
};
|
||||
|
||||
const removeTag = (index, params, search) => {
|
||||
|
|
|
@ -39,10 +39,14 @@ const refund = async () => {
|
|||
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
||||
};
|
||||
|
||||
try {
|
||||
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
|
||||
notify(t('Refunded invoice'), 'positive');
|
||||
const [id] = data?.refundId || [];
|
||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||
} catch (err) {
|
||||
console.error('Error refunding invoice', err);
|
||||
}
|
||||
};
|
||||
</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,
|
||||
};
|
||||
|
||||
try {
|
||||
if (checked.value && hasToInvoiceByAddress) {
|
||||
const response = await new Promise((resolve) => {
|
||||
quasar
|
||||
|
@ -75,6 +76,9 @@ const makeInvoice = async () => {
|
|||
notify(t('Transferred invoice'), 'positive');
|
||||
const id = data?.[0];
|
||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||
} catch (err) {
|
||||
console.error('Error transfering invoice', err);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
|
@ -7,7 +7,7 @@ import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||
|
||||
const emit = defineEmits(['onProvinceCreated', 'onProvinceFetched']);
|
||||
const emit = defineEmits(['onProvinceCreated']);
|
||||
const $props = defineProps({
|
||||
countryFk: {
|
||||
type: Number,
|
||||
|
@ -17,23 +17,20 @@ const $props = defineProps({
|
|||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinces: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const provinceFk = defineModel({ type: Number, default: null });
|
||||
|
||||
const { validate } = useValidator();
|
||||
const { t } = useI18n();
|
||||
const filter = ref({
|
||||
include: { relation: 'country' },
|
||||
where: {
|
||||
countryFk: $props.countryFk,
|
||||
},
|
||||
});
|
||||
|
||||
const provincesOptions = ref($props.provinces);
|
||||
const provincesFetchDataRef = ref();
|
||||
provinceFk.value = $props.provinceSelected;
|
||||
if (!$props.countryFk) {
|
||||
filter.value.where = {};
|
||||
}
|
||||
const provincesFetchDataRef = ref();
|
||||
|
||||
async function onProvinceCreated(_, data) {
|
||||
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
||||
provinceFk.value = data.id;
|
||||
|
@ -42,33 +39,25 @@ async function onProvinceCreated(_, data) {
|
|||
async function handleProvinces(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>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="provincesFetchDataRef"
|
||||
:filter="filter"
|
||||
:filter="{
|
||||
include: { relation: 'country' },
|
||||
where: {
|
||||
countryFk: $props.countryFk,
|
||||
},
|
||||
}"
|
||||
@on-fetch="handleProvinces"
|
||||
url="Provinces"
|
||||
auto-load
|
||||
/>
|
||||
<VnSelectDialog
|
||||
:label="t('Province')"
|
||||
:options="provincesOptions"
|
||||
:options="$props.provinces"
|
||||
:tooltip="t('Create province')"
|
||||
hide-selected
|
||||
:clearable="true"
|
||||
v-model="provinceFk"
|
||||
:rules="validate && validate('postcode.provinceFk')"
|
||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||
|
|
|
@ -143,10 +143,6 @@ function alignRow() {
|
|||
const showFilter = computed(
|
||||
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
|
||||
);
|
||||
|
||||
const onTabPressed = async () => {
|
||||
if (model.value) enterEvent['keyup.enter']();
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
|
@ -161,7 +157,6 @@ const onTabPressed = async () => {
|
|||
v-model="model"
|
||||
:components="components"
|
||||
component-prop="columnFilter"
|
||||
@keydown.tab="onTabPressed"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -324,8 +324,6 @@ function handleOnDataSaved(_) {
|
|||
}
|
||||
|
||||
function handleScroll() {
|
||||
if ($props.crudModel.disableInfiniteScroll) return;
|
||||
|
||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||
|
@ -394,7 +392,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
:name="col.orderBy ?? col.name"
|
||||
:data-key="$attrs['data-key']"
|
||||
:search-url="searchUrl"
|
||||
:vertical="false"
|
||||
:vertical="true"
|
||||
/>
|
||||
</div>
|
||||
<slot
|
||||
|
@ -737,7 +735,6 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
data-cy="vnTableCreateBtn"
|
||||
/>
|
||||
<QTooltip self="top right">
|
||||
{{ createForm?.title }}
|
||||
|
|
|
@ -58,6 +58,7 @@ const getConfig = async (url, filter) => {
|
|||
};
|
||||
|
||||
const fetchViewConfigData = async () => {
|
||||
try {
|
||||
const userConfigFilter = {
|
||||
where: { tableCode: $props.tableCode, userFk: user.value.id },
|
||||
};
|
||||
|
@ -82,9 +83,13 @@ const fetchViewConfigData = async () => {
|
|||
$props.allColumns.forEach((col) => (defaultColumns[col] = true));
|
||||
setUserConfigViewData(defaultColumns);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error fetching config view data', err);
|
||||
}
|
||||
};
|
||||
|
||||
const saveConfig = async () => {
|
||||
try {
|
||||
const params = {};
|
||||
const configuration = {};
|
||||
|
||||
|
@ -123,6 +128,9 @@ const saveConfig = async () => {
|
|||
emitSavedConfig();
|
||||
notify('globals.dataSaved', 'positive');
|
||||
popupProxyRef.value.hide();
|
||||
} catch (err) {
|
||||
console.error('Error saving user view config', err);
|
||||
}
|
||||
};
|
||||
|
||||
const emitSavedConfig = () => {
|
||||
|
|
|
@ -1,24 +1,20 @@
|
|||
<script setup>
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { QInput } from 'quasar';
|
||||
|
||||
const $props = defineProps({
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
insertable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
||||
|
||||
let internalValue = ref($props.modelValue);
|
||||
let internalValue = ref(props.modelValue);
|
||||
|
||||
watch(
|
||||
() => $props.modelValue,
|
||||
() => props.modelValue,
|
||||
(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() {
|
||||
internalValue.value = internalValue.value?.replace(
|
||||
internalValue.value = internalValue.value.replace(
|
||||
'.',
|
||||
'0'.repeat(11 - internalValue.value.length)
|
||||
);
|
||||
|
@ -79,5 +37,5 @@ function accountShortToStandard() {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" />
|
||||
<q-input v-model="internalValue" />
|
||||
</template>
|
||||
|
|
|
@ -10,11 +10,11 @@ import LeftMenu from 'components/LeftMenu.vue';
|
|||
import RightMenu from 'components/common/RightMenu.vue';
|
||||
const props = defineProps({
|
||||
dataKey: { type: String, required: true },
|
||||
baseUrl: { type: String, default: undefined },
|
||||
customUrl: { type: String, default: undefined },
|
||||
url: { type: String, default: undefined },
|
||||
filter: { type: Object, default: () => {} },
|
||||
descriptor: { type: Object, required: true },
|
||||
filterPanel: { type: Object, default: undefined },
|
||||
idInWhere: { type: Boolean, default: false },
|
||||
searchDataKey: { type: String, default: undefined },
|
||||
searchbarProps: { type: Object, default: undefined },
|
||||
redirectOnError: { type: Boolean, default: false },
|
||||
|
@ -23,24 +23,22 @@ const props = defineProps({
|
|||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const url = computed(() => {
|
||||
if (props.baseUrl) {
|
||||
return `${props.baseUrl}/${route.params.id}`;
|
||||
}
|
||||
return props.customUrl;
|
||||
});
|
||||
const regex = /(\/\d+)/;
|
||||
const searchRightDataKey = computed(() => {
|
||||
if (!props.searchDataKey) return route.name;
|
||||
return props.searchDataKey;
|
||||
});
|
||||
const arrayData = useArrayData(props.dataKey, {
|
||||
url: url.value,
|
||||
url: props.url,
|
||||
filter: props.filter,
|
||||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
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 });
|
||||
} catch {
|
||||
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) {
|
||||
arrayData.store.url = `${props.baseUrl}/${to.params.id}`;
|
||||
await arrayData.fetch({ append: false, updateRouter: false });
|
||||
if (props.idInWhere) arrayData.store.filter.where = { id: to.params.id };
|
||||
else arrayData.store.url = `${props.url}/${to.params.id}`;
|
||||
|
||||
await arrayData.fetch({ updateRouter: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { computed, ref, useAttrs, nextTick } from 'vue';
|
||||
import { computed, ref, useAttrs } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRequired } from 'src/composables/useRequired';
|
||||
|
||||
|
@ -34,14 +34,6 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
insertable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
maxlength: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const vnInputRef = ref(null);
|
||||
|
@ -77,9 +69,6 @@ const mixinRules = [
|
|||
requiredFieldRule,
|
||||
...($attrs.rules ?? []),
|
||||
(val) => {
|
||||
const { maxlength } = vnInputRef.value;
|
||||
if (maxlength && +val.length > maxlength)
|
||||
return t(`maxLength`, { value: maxlength });
|
||||
const { min, max } = vnInputRef.value.$attrs;
|
||||
if (!min) return null;
|
||||
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>
|
||||
|
||||
<template>
|
||||
|
@ -127,12 +89,10 @@ const handleInsertMode = (e) => {
|
|||
:type="$attrs.type"
|
||||
:class="{ required: isRequired }"
|
||||
@keyup.enter="emit('keyup.enter')"
|
||||
@keydown="handleKeydown"
|
||||
:clearable="false"
|
||||
:rules="mixinRules"
|
||||
:lazy-rules="true"
|
||||
hide-bottom-space
|
||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
||||
>
|
||||
<template v-if="$slots.prepend" #prepend>
|
||||
<slot name="prepend" />
|
||||
|
@ -141,13 +101,7 @@ const handleInsertMode = (e) => {
|
|||
<QIcon
|
||||
name="close"
|
||||
size="xs"
|
||||
v-if="
|
||||
hover &&
|
||||
value &&
|
||||
!$attrs.disabled &&
|
||||
!$attrs.readonly &&
|
||||
$props.clearable
|
||||
"
|
||||
v-if="hover && value && !$attrs.disabled && $props.clearable"
|
||||
@click="
|
||||
() => {
|
||||
value = null;
|
||||
|
@ -169,11 +123,9 @@ const handleInsertMode = (e) => {
|
|||
<i18n>
|
||||
en:
|
||||
inputMin: Must be more than {value}
|
||||
maxLength: The value exceeds {value} characters
|
||||
inputMax: Must be less than {value}
|
||||
es:
|
||||
inputMin: Debe ser mayor a {value}
|
||||
maxLength: El valor excede los {value} carácteres
|
||||
inputMax: Debe ser menor a {value}
|
||||
</i18n>
|
||||
<style lang="scss">
|
||||
|
|
|
@ -138,6 +138,8 @@ onMounted(() => {
|
|||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||
});
|
||||
|
||||
defineExpose({ opts: myOptions });
|
||||
|
||||
const arrayDataKey =
|
||||
$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 (sortBy) fetchOptions.order = sortBy;
|
||||
arrayData.reset(['skip', 'filter.skip', 'page']);
|
||||
|
||||
const { data } = await arrayData.applyFilter({ filter: fetchOptions });
|
||||
setOptions(data);
|
||||
return data;
|
||||
return (await arrayData.applyFilter({ filter: fetchOptions }))?.data;
|
||||
}
|
||||
|
||||
async function filterHandler(val, update) {
|
||||
|
@ -257,30 +256,6 @@ async function onScroll({ to, direction, from, index }) {
|
|||
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>
|
||||
|
||||
<template>
|
||||
|
@ -291,7 +266,6 @@ function handleKeyDown(event) {
|
|||
:option-value="optionValue"
|
||||
v-bind="$attrs"
|
||||
@filter="filterHandler"
|
||||
@keydown="handleKeyDown"
|
||||
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||
:map-options="nullishToTrue($attrs['map-options'])"
|
||||
:use-input="nullishToTrue($attrs['use-input'])"
|
||||
|
@ -306,7 +280,6 @@ function handleKeyDown(event) {
|
|||
:input-debounce="useURL ? '300' : '0'"
|
||||
:loading="isLoading"
|
||||
@virtual-scroll="onScroll"
|
||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_select'"
|
||||
>
|
||||
<template v-if="isClearable" #append>
|
||||
<QIcon
|
||||
|
|
|
@ -86,7 +86,7 @@ async function send() {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef" data-cy="vnSmsDialog">
|
||||
<QDialog ref="dialogRef">
|
||||
<QCard class="q-pa-sm">
|
||||
<QCardSection class="row items-center q-pb-none">
|
||||
<span class="text-h6 text-grey">
|
||||
|
@ -161,7 +161,6 @@ async function send() {
|
|||
:loading="isLoading"
|
||||
color="primary"
|
||||
unelevated
|
||||
data-cy="sendSmsBtn"
|
||||
/>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
|
|
|
@ -74,9 +74,6 @@ const arrayData = useArrayData($props.dataKey, {
|
|||
const route = useRoute();
|
||||
const store = arrayData.store;
|
||||
const userParams = ref({});
|
||||
|
||||
defineExpose({ search, sanitizer, params: userParams });
|
||||
|
||||
onMounted(() => {
|
||||
userParams.value = $props.modelValue ?? {};
|
||||
emit('init', { params: userParams.value });
|
||||
|
@ -200,7 +197,7 @@ const customTags = computed(() =>
|
|||
|
||||
async function remove(key) {
|
||||
userParams.value[key] = undefined;
|
||||
await search();
|
||||
search();
|
||||
emit('remove', key);
|
||||
emit('update:modelValue', userParams.value);
|
||||
}
|
||||
|
@ -226,6 +223,8 @@ function sanitizer(params) {
|
|||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
defineExpose({ search, sanitizer, userParams });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -132,24 +132,10 @@ const addFilter = async (filter, params) => {
|
|||
|
||||
async function fetch(params) {
|
||||
useArrayData(props.dataKey, params);
|
||||
arrayData.reset(['filter.skip', 'skip', 'page']);
|
||||
arrayData.reset(['filter.skip', 'skip']);
|
||||
await arrayData.fetch({ append: false });
|
||||
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 });
|
||||
store.limit = limit;
|
||||
store.skip = skip;
|
||||
return emitStoreData();
|
||||
}
|
||||
|
||||
function emitStoreData() {
|
||||
if (!store.hasMoreData) isLoading.value = false;
|
||||
|
||||
emit('onFetch', store.data);
|
||||
return store.data;
|
||||
}
|
||||
|
@ -195,7 +181,7 @@ async function onLoad(index, done) {
|
|||
done(isDone);
|
||||
}
|
||||
|
||||
defineExpose({ fetch, update, addFilter, paginate });
|
||||
defineExpose({ fetch, addFilter, paginate });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -130,7 +130,6 @@ async function search() {
|
|||
dense
|
||||
standout
|
||||
autofocus
|
||||
data-cy="vnSearchBar"
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { defineProps } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
routeName: {
|
||||
|
|
|
@ -1,24 +1,11 @@
|
|||
import { useSession } from 'src/composables/useSession';
|
||||
import { getUrl } from './getUrl';
|
||||
import axios from 'axios';
|
||||
import { exportFile } from 'quasar';
|
||||
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const token = getTokenMultimedia();
|
||||
|
||||
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
|
||||
const appUrl = (await getUrl('', 'lilium')).replace('/#/', '');
|
||||
const response = await axios.get(
|
||||
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);
|
||||
let appUrl = await getUrl('', 'lilium');
|
||||
appUrl = appUrl.replace('/#/', '');
|
||||
window.open(url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
const params = { filter };
|
||||
|
||||
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?.length) params.filter.order = [...store.order];
|
||||
else delete params.filter.order;
|
||||
|
|
|
@ -241,7 +241,7 @@ input::-webkit-inner-spin-button {
|
|||
th,
|
||||
td {
|
||||
padding: 1px 10px 1px 10px;
|
||||
max-width: 130px;
|
||||
max-width: 100px;
|
||||
div span {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
|
|
@ -60,7 +60,7 @@ globals:
|
|||
reference: Reference
|
||||
agency: Agency
|
||||
warehouseOut: Warehouse Out
|
||||
warehouseIn: Warehouse In
|
||||
wareHouseIn: Warehouse In
|
||||
landed: Landed
|
||||
shipped: Shipped
|
||||
totalEntries: Total entries
|
||||
|
@ -298,7 +298,6 @@ globals:
|
|||
clientsActionsMonitor: Clients and actions
|
||||
serial: Serial
|
||||
medical: Mutual
|
||||
pit: IRPF
|
||||
RouteExtendedList: Router
|
||||
wasteRecalc: Waste recaclulate
|
||||
operator: Operator
|
||||
|
@ -585,15 +584,15 @@ worker:
|
|||
role: Role
|
||||
sipExtension: Extension
|
||||
locker: Locker
|
||||
fiDueDate: FI due date
|
||||
sex: Sex
|
||||
seniority: Seniority
|
||||
fiDueDate: Fecha de caducidad del DNI
|
||||
sex: Sexo
|
||||
seniority: Antigüedad
|
||||
fi: DNI/NIE/NIF
|
||||
birth: Birth
|
||||
isFreelance: Freelance
|
||||
birth: Fecha de nacimiento
|
||||
isFreelance: Autónomo
|
||||
isSsDiscounted: Bonificación SS
|
||||
hasMachineryAuthorized: Machinery authorized
|
||||
isDisable: Disable
|
||||
hasMachineryAuthorized: Autorizado para llevar maquinaria
|
||||
isDisable: Trabajador desactivado
|
||||
notificationsManager:
|
||||
activeNotifications: Active notifications
|
||||
availableNotifications: Available notifications
|
||||
|
@ -709,7 +708,7 @@ supplier:
|
|||
supplierName: Supplier name
|
||||
basicData:
|
||||
workerFk: Responsible
|
||||
isReal: Verified
|
||||
isSerious: Verified
|
||||
isActive: Active
|
||||
isPayMethodChecked: PayMethod checked
|
||||
note: Notes
|
||||
|
@ -769,7 +768,6 @@ travel:
|
|||
hb: HB
|
||||
basicData:
|
||||
daysInForward: Days in forward
|
||||
isRaid: Raid
|
||||
thermographs:
|
||||
temperature: Temperature
|
||||
destination: Destination
|
||||
|
|
|
@ -303,7 +303,6 @@ globals:
|
|||
clientsActionsMonitor: Clientes y acciones
|
||||
serial: Facturas por serie
|
||||
medical: Mutua
|
||||
pit: IRPF
|
||||
wasteRecalc: Recalcular mermas
|
||||
operator: Operario
|
||||
parking: Parking
|
||||
|
@ -581,9 +580,9 @@ worker:
|
|||
newWorker: Nuevo trabajador
|
||||
summary:
|
||||
boss: Jefe
|
||||
phoneExtension: Ext. de teléfono
|
||||
entPhone: Tel. de empresa
|
||||
personalPhone: Tel. personal
|
||||
phoneExtension: Extensión de teléfono
|
||||
entPhone: Teléfono de empresa
|
||||
personalPhone: Teléfono personal
|
||||
noBoss: Sin jefe
|
||||
userData: Datos de usuario
|
||||
userId: ID del usuario
|
||||
|
@ -704,7 +703,7 @@ supplier:
|
|||
supplierName: Nombre del proveedor
|
||||
basicData:
|
||||
workerFk: Responsable
|
||||
isReal: Verificado
|
||||
isSerious: Verificado
|
||||
isActive: Activo
|
||||
isPayMethodChecked: Método de pago validado
|
||||
note: Notas
|
||||
|
@ -763,7 +762,6 @@ travel:
|
|||
hb: HB
|
||||
basicData:
|
||||
daysInForward: Días redada
|
||||
isRaid: Redada
|
||||
thermographs:
|
||||
temperature: Temperatura
|
||||
destination: Destino
|
||||
|
|
|
@ -11,13 +11,21 @@ const { t } = useI18n();
|
|||
const { notify } = useNotify();
|
||||
|
||||
const onSynchronizeAll = async () => {
|
||||
try {
|
||||
notify(t('Synchronizing in the background'), 'positive');
|
||||
await axios.patch(`Accounts/syncAll`);
|
||||
} catch (error) {
|
||||
console.error('Error synchronizing all accounts', error);
|
||||
}
|
||||
};
|
||||
|
||||
const onSynchronizeRoles = async () => {
|
||||
try {
|
||||
await axios.patch(`RoleInherits/sync`);
|
||||
notify(t('Roles synchronized!'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error synchronizing roles', error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ const columns = computed(() => [
|
|||
},
|
||||
]);
|
||||
const deleteAcl = async ({ id }) => {
|
||||
try {
|
||||
await new Promise((resolve) => {
|
||||
quasar
|
||||
.dialog({
|
||||
|
@ -130,6 +131,9 @@ const deleteAcl = async ({ id }) => {
|
|||
await axios.delete(`ACLs/${id}`);
|
||||
tableRef.value.reload();
|
||||
notify('ACL removed', 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error deleting Acl: ', error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -4,19 +4,11 @@ import { ref, computed } from 'vue';
|
|||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
||||
import exprBuilder from './Alias/AliasExprBuilder.js';
|
||||
const tableRef = ref();
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return /^\d+$/.test(value)
|
||||
? { id: value }
|
||||
: { alias: { like: `%${value}%` } };
|
||||
}
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
|
|
@ -34,9 +34,13 @@ const refresh = () => paginateRef.value.fetch();
|
|||
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
||||
|
||||
const killSession = async ({ userId, created }) => {
|
||||
try {
|
||||
await axios.post(`${urlPath}/killSession`, { userId, created });
|
||||
paginateRef.value.fetch();
|
||||
notify(t('Session killed'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error killing session', error);
|
||||
}
|
||||
};
|
||||
</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 formCustomFn = ref(null);
|
||||
const onTestConection = async () => {
|
||||
try {
|
||||
await axios.get(`LdapConfigs/test`);
|
||||
notify(t('LDAP connection established!'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error testing connection', error);
|
||||
}
|
||||
};
|
||||
const getInitialLdapConfig = async () => {
|
||||
try {
|
||||
|
@ -68,10 +72,14 @@ const getInitialLdapConfig = async () => {
|
|||
}
|
||||
};
|
||||
const deleteMailForward = async () => {
|
||||
try {
|
||||
await axios.delete(URL_UPDATE);
|
||||
initialData.value = { ...DEFAULT_DATA };
|
||||
hasData.value = false;
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error deleting mail forward', err);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => await getInitialLdapConfig());
|
||||
|
|
|
@ -7,12 +7,13 @@ import AccountSummary from './Card/AccountSummary.vue';
|
|||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import AccountFilter from './AccountFilter.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import exprBuilder from './AccountExprBuilder.js';
|
||||
import filter from './Card/AccountFilter.js';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
const filter = {
|
||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
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>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -46,8 +46,12 @@ const formUrlUpdate = ref(null);
|
|||
const formCustomFn = ref(null);
|
||||
|
||||
const onTestConection = async () => {
|
||||
try {
|
||||
await axios.get(`SambaConfigs/test`);
|
||||
notify(t('Samba connection established!'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error testing connection', error);
|
||||
}
|
||||
};
|
||||
|
||||
const getInitialSambaConfig = async () => {
|
||||
|
@ -75,10 +79,14 @@ const getInitialSambaConfig = async () => {
|
|||
};
|
||||
|
||||
const deleteMailForward = async () => {
|
||||
try {
|
||||
await axios.delete(URL_UPDATE);
|
||||
initialData.value = { ...DEFAULT_DATA };
|
||||
hasData.value = false;
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error deleting mail forward', err);
|
||||
}
|
||||
};
|
||||
|
||||
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>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import AliasDescriptor from './AliasDescriptor.vue';
|
||||
const { t } = useI18n();
|
||||
import exprBuilder from '../AliasExprBuilder.js';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnCard
|
||||
data-key="Alias"
|
||||
base-url="MailAliases"
|
||||
url="MailAliases"
|
||||
:descriptor="AliasDescriptor"
|
||||
search-data-key="AccountAliasList"
|
||||
:searchbar-props="{
|
||||
url: 'MailAliases',
|
||||
info: t('mailAlias.searchInfo'),
|
||||
label: t('mailAlias.search'),
|
||||
info: $t('mailAlias.searchInfo'),
|
||||
label: $t('mailAlias.search'),
|
||||
searchUrl: 'table',
|
||||
exprBuilder,
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -7,7 +7,6 @@ import { useQuasar } from 'quasar';
|
|||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
|
@ -29,9 +28,6 @@ const entityId = computed(() => {
|
|||
return $props.id || route.params.id;
|
||||
});
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => (data.value = useCardDescription(entity.alias, entity.id));
|
||||
|
||||
const removeAlias = () => {
|
||||
quasar
|
||||
.dialog({
|
||||
|
@ -44,9 +40,13 @@ const removeAlias = () => {
|
|||
cancel: true,
|
||||
})
|
||||
.onOk(async () => {
|
||||
try {
|
||||
await axios.delete(`MailAliases/${entityId.value}`);
|
||||
notify(t('Alias removed'), 'positive');
|
||||
router.push({ name: 'AccountAlias' });
|
||||
} catch (err) {
|
||||
console.error('Error removing alias');
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
@ -56,10 +56,8 @@ const removeAlias = () => {
|
|||
ref="descriptor"
|
||||
:url="`MailAliases/${entityId}`"
|
||||
module="Alias"
|
||||
@on-fetch="setData"
|
||||
data-key="aliasData"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
data-key="Alias"
|
||||
title="alias"
|
||||
>
|
||||
<template #menu>
|
||||
<QItem v-ripple clickable @click="removeAlias()">
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const route = useRoute();
|
||||
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);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`MailAliases/${entityId}`"
|
||||
@on-fetch="(data) => (alias = data)"
|
||||
data-key="MailAliasesSummary"
|
||||
>
|
||||
<template #header> {{ alias.id }} - {{ alias.alias }} </template>
|
||||
<template #body>
|
||||
<CardSummary ref="summary" :url="`MailAliases/${entityId}`" data-key="Alias">
|
||||
<template #header="{ entity: alias }">
|
||||
{{ alias.id }} - {{ alias.alias }}
|
||||
</template>
|
||||
<template #body="{ entity: alias }">
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
<router-link
|
||||
|
|
|
@ -1,46 +1,26 @@
|
|||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
|
||||
import FormModel from 'components/FormModel.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>
|
||||
<template>
|
||||
<FormModel
|
||||
ref="formModelRef"
|
||||
url="VnUsers/preview"
|
||||
:url-update="`VnUsers/${route.params.id}/update-user`"
|
||||
:filter="accountFilter"
|
||||
model="Accounts"
|
||||
:url-update="`VnUsers/${$route.params.id}/update-user`"
|
||||
model="Account"
|
||||
auto-load
|
||||
@on-data-saved="formModelRef.fetch()"
|
||||
@on-data-saved="$refs.formModelRef.fetch()"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<div class="q-gutter-y-sm">
|
||||
<VnInput v-model="data.name" :label="t('account.card.nickname')" />
|
||||
<VnInput v-model="data.nickname" :label="t('account.card.alias')" />
|
||||
<VnInput v-model="data.email" :label="t('globals.params.email')" />
|
||||
<VnInput v-model="data.name" :label="$t('account.card.nickname')" />
|
||||
<VnInput v-model="data.nickname" :label="$t('account.card.alias')" />
|
||||
<VnInput v-model="data.email" :label="$t('globals.params.email')" />
|
||||
<VnSelect
|
||||
url="Languages"
|
||||
v-model="data.lang"
|
||||
:label="t('account.card.lang')"
|
||||
:label="$t('account.card.lang')"
|
||||
option-value="code"
|
||||
option-label="code"
|
||||
/>
|
||||
|
@ -49,7 +29,7 @@ watch(
|
|||
table="user"
|
||||
column="twoFactor"
|
||||
v-model="data.twoFactor"
|
||||
:label="t('account.card.twoFactor')"
|
||||
:label="$t('account.card.twoFactor')"
|
||||
option-value="code"
|
||||
option-label="code"
|
||||
/>
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import AccountDescriptor from './AccountDescriptor.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
import exprBuilder from '../AccountExprBuilder.js';
|
||||
import filter from './AccountFilter.js';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnCard
|
||||
url="VnUsers/preview"
|
||||
:id-in-where="true"
|
||||
data-key="Account"
|
||||
:filter="filter"
|
||||
:descriptor="AccountDescriptor"
|
||||
search-data-key="AccountList"
|
||||
search-data-key="AccountUsers"
|
||||
:searchbar-props="{
|
||||
url: 'VnUsers/preview',
|
||||
label: t('account.search'),
|
||||
info: t('account.searchInfo'),
|
||||
label: $t('account.search'),
|
||||
info: $t('account.searchInfo'),
|
||||
exprBuilder,
|
||||
filter: {
|
||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||
},
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -4,11 +4,10 @@ import { useRoute } from 'vue-router';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
import filter from './AccountFilter.js';
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
|
@ -22,14 +21,6 @@ const { t } = useI18n();
|
|||
const entityId = computed(() => {
|
||||
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);
|
||||
</script>
|
||||
|
||||
|
@ -44,10 +35,8 @@ const hasAccount = ref(false);
|
|||
:url="`VnUsers/preview`"
|
||||
:filter="filter"
|
||||
module="Account"
|
||||
@on-fetch="setData"
|
||||
data-key="AccountId"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
data-key="Account"
|
||||
title="nickname"
|
||||
>
|
||||
<template #menu>
|
||||
<AccountDescriptorMenu :has-account="hasAccount" />
|
||||
|
@ -73,7 +62,7 @@ const hasAccount = ref(false);
|
|||
</template>
|
||||
<template #body="{ entity }">
|
||||
<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 #actions="{ entity }">
|
||||
<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'] } },
|
||||
};
|
|
@ -41,22 +41,35 @@ const fetchAccountExistence = async () => {
|
|||
};
|
||||
|
||||
const fetchMailForwards = async () => {
|
||||
try {
|
||||
const response = await axios.get(`MailForwards/${route.params.id}`);
|
||||
return response.data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching mail forwards', err);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const deleteMailForward = async () => {
|
||||
try {
|
||||
await axios.delete(`MailForwards/${route.params.id}`);
|
||||
formData.value.forwardTo = null;
|
||||
initialData.value.forwardTo = null;
|
||||
initialData.value.hasData = hasData.value;
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error deleting mail forward', err);
|
||||
}
|
||||
};
|
||||
|
||||
const updateMailForward = async () => {
|
||||
try {
|
||||
await axios.patch('MailForwards', formData.value);
|
||||
initialData.value = { ...formData.value };
|
||||
initialData.value.hasData = hasData.value;
|
||||
} catch (err) {
|
||||
console.error('Error creating mail forward', err);
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = async () => {
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import filter from './AccountFilter.js';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -17,39 +14,26 @@ const $props = defineProps({
|
|||
default: 0,
|
||||
},
|
||||
});
|
||||
const { store } = useArrayData('Account');
|
||||
const account = ref(store.data);
|
||||
|
||||
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>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
data-key="AccountSummary"
|
||||
ref="AccountSummary"
|
||||
url="VnUsers/preview"
|
||||
:filter="filter"
|
||||
@on-fetch="(data) => (account = data)"
|
||||
>
|
||||
<template #header>{{ account.id }} - {{ account.nickname }}</template>
|
||||
<template #body>
|
||||
<CardSummary data-key="Account" url="VnUsers/preview" :filter="filter">
|
||||
<template #header="{ entity }">{{ entity.id }} - {{ entity.nickname }}</template>
|
||||
<template #body="{ entity }">
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
<router-link
|
||||
:to="{ name: 'AccountBasicData', params: { id: entityId } }"
|
||||
class="header header-link"
|
||||
>
|
||||
{{ t('globals.pageTitles.basicData') }}
|
||||
{{ $t('globals.pageTitles.basicData') }}
|
||||
<QIcon name="open_in_new" />
|
||||
</router-link>
|
||||
</QCardSection>
|
||||
<VnLv :label="t('account.card.nickname')" :value="account.name" />
|
||||
<VnLv :label="t('account.card.role')" :value="account.role.name" />
|
||||
<VnLv :label="$t('account.card.nickname')" :value="entity.name" />
|
||||
<VnLv :label="$t('account.card.role')" :value="entity.role?.name" />
|
||||
</QCard>
|
||||
</template>
|
||||
</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 { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import RoleSummary from './Card/RoleSummary.vue';
|
||||
import exprBuilder from './AccountExprBuilder.js';
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
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>
|
||||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="AccountRolesList"
|
||||
|
|
|
@ -1,24 +1,16 @@
|
|||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<FormModel :url="`VnRoles/${route.params.id}`" model="VnRole" auto-load>
|
||||
<FormModel model="Role" auto-load>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnInput v-model="data.name" :label="t('globals.name')" />
|
||||
</div>
|
||||
<VnInput v-model="data.name" :label="$t('globals.name')" />
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnInput v-model="data.description" :label="t('role.description')" />
|
||||
</div>
|
||||
<VnInput v-model="data.description" :label="$t('role.description')" />
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import RoleDescriptor from './RoleDescriptor.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
import exprBuilder from '../AccountExprBuilder.js';
|
||||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
url="VnRoles"
|
||||
:id-in-where="true"
|
||||
data-key="Role"
|
||||
:descriptor="RoleDescriptor"
|
||||
search-data-key="AccountRolesList"
|
||||
search-data-key="Roles"
|
||||
:searchbar-props="{
|
||||
url: 'VnRoles',
|
||||
label: t('role.searchRoles'),
|
||||
info: t('role.searchInfo'),
|
||||
label: $t('role.searchRoles'),
|
||||
info: $t('role.searchInfo'),
|
||||
searchUrl: 'table',
|
||||
exprBuilder,
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
const $props = defineProps({
|
||||
|
@ -26,26 +25,22 @@ const { t } = useI18n();
|
|||
const entityId = computed(() => {
|
||||
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 () => {
|
||||
try {
|
||||
await axios.delete(`VnRoles/${entityId.value}`);
|
||||
notify(t('Role removed'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error deleting role', error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardDescriptor
|
||||
:url="`VnRoles/${entityId}`"
|
||||
:filter="filter"
|
||||
url="VnRoles"
|
||||
:filter="{ where: { id: entityId } }"
|
||||
module="Role"
|
||||
@on-fetch="setData"
|
||||
data-key="accountData"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
data-key="Role"
|
||||
:summary="$props.summary"
|
||||
>
|
||||
<template #menu>
|
||||
|
|
|
@ -19,18 +19,15 @@ const $props = defineProps({
|
|||
const { store } = useArrayData('Role');
|
||||
const role = ref(store.data);
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const filter = {
|
||||
where: { id: entityId },
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`VnRoles`"
|
||||
:filter="filter"
|
||||
url="VnRoles"
|
||||
:filter="{ where: { id: entityId } }"
|
||||
@on-fetch="(data) => (role = data)"
|
||||
data-key="RoleSummary"
|
||||
data-key="Role"
|
||||
>
|
||||
<template #header> {{ role.id }} - {{ role.name }} </template>
|
||||
<template #body>
|
||||
|
|
|
@ -7,7 +7,7 @@ import filter from './ClaimFilter.js';
|
|||
<template>
|
||||
<VnCard
|
||||
data-key="Claim"
|
||||
base-url="Claims"
|
||||
url="Claims"
|
||||
:descriptor="ClaimDescriptor"
|
||||
:filter-panel="ClaimFilter"
|
||||
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 CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
|
@ -39,10 +38,8 @@ const STATE_COLOR = {
|
|||
function stateColor(code) {
|
||||
return STATE_COLOR[code];
|
||||
}
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => {
|
||||
if (!entity) return;
|
||||
data.value = useCardDescription(entity?.client?.name, entity.id);
|
||||
state.set('ClaimDescriptor', entity);
|
||||
};
|
||||
onMounted(async () => {
|
||||
|
|
|
@ -100,7 +100,7 @@ async function remove() {
|
|||
</QMenu>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
<QItem @click="confirmRemove()" v-ripple clickable data-cy="deleteClaim">
|
||||
<QItem @click="confirmRemove()" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="delete" />
|
||||
</QItemSection>
|
||||
|
|
|
@ -130,7 +130,7 @@ function cancel() {
|
|||
<template #body-cell-description="{ row, value }">
|
||||
<QTd auto-width align="right" class="link">
|
||||
{{ value }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
<ItemDescriptorProxy :id="row.itemFk"></ItemDescriptorProxy>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
|
|
|
@ -25,7 +25,7 @@ const claimFilter = computed(() => {
|
|||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['id', 'nickname', 'name'],
|
||||
fields: ['id', 'nickname'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -95,7 +95,6 @@ const columns = computed(() => [
|
|||
optionLabel: 'description',
|
||||
},
|
||||
},
|
||||
orderBy: 'priority',
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
|
|
|
@ -167,7 +167,7 @@ const toCustomerAddressEdit = (addressId) => {
|
|||
<div>{{ item.street }}</div>
|
||||
<div>
|
||||
{{ item.postalCode }} - {{ item.city }},
|
||||
{{ item.province?.name }}
|
||||
{{ item.province.name }}
|
||||
</div>
|
||||
<div>
|
||||
{{ item.phone }}
|
||||
|
|
|
@ -256,10 +256,10 @@ const showBalancePdf = ({ id }) => {
|
|||
{{ toCurrency(balances[rowIndex]?.balance) }}
|
||||
</template>
|
||||
<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 }) }}
|
||||
<InvoiceOutDescriptorProxy :id="row.id" />
|
||||
</span>
|
||||
<InvoiceOutDescriptorProxy :id="row.description" />
|
||||
</div>
|
||||
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
||||
{{ row.description }}
|
||||
</span>
|
||||
|
|
|
@ -43,7 +43,7 @@ const exprBuilder = (param, value) => {
|
|||
@on-fetch="(data) => (businessTypes = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FormModel :url="`Clients/${route.params.id}`" auto-load model="customer">
|
||||
<FormModel auto-load model="Client" :url-update="`Clients/${$route.params.id}`">
|
||||
<template #form="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnInput
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import CustomerDescriptor from './CustomerDescriptor.vue';
|
||||
import CustomerFilter from '../CustomerFilter.vue';
|
||||
const route = useRoute();
|
||||
|
||||
const routeName = computed(() => route.name);
|
||||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
data-key="Client"
|
||||
base-url="Clients"
|
||||
:url="`Clients/${$route.params.id}/getCard`"
|
||||
:descriptor="CustomerDescriptor"
|
||||
:filter-panel="routeName != 'CustomerConsumption' && CustomerFilter"
|
||||
:filter-panel="$route.name != 'CustomerConsumption' && CustomerFilter"
|
||||
search-data-key="CustomerList"
|
||||
:searchbar-props="{
|
||||
url: 'Clients/filter',
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
|
@ -35,8 +33,6 @@ const entityId = computed(() => {
|
|||
return $props.id || route.params.id;
|
||||
});
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => (data.value = useCardDescription(entity?.name, entity?.id));
|
||||
const debtWarning = computed(() => {
|
||||
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
||||
});
|
||||
|
@ -46,11 +42,9 @@ const debtWarning = computed(() => {
|
|||
<CardDescriptor
|
||||
module="Customer"
|
||||
:url="`Clients/${entityId}/getCard`"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
@on-fetch="setData"
|
||||
:summary="$props.summary"
|
||||
data-key="customer"
|
||||
data-key="Client"
|
||||
>
|
||||
<template #menu="{ entity }">
|
||||
<CustomerDescriptorMenu :customer="entity" />
|
||||
|
|
|
@ -320,7 +320,7 @@ const sumRisk = ({ clientRisks }) => {
|
|||
:value="entity.recommendedCredit"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-max">
|
||||
<QCard class="vn-one">
|
||||
<VnTitle :text="t('Latest tickets')" />
|
||||
<CustomerSummaryTable />
|
||||
</QCard>
|
||||
|
|
|
@ -106,6 +106,7 @@ const setParams = (params) => {
|
|||
};
|
||||
|
||||
const getPreview = async () => {
|
||||
try {
|
||||
const params = {
|
||||
recipientId: entityId,
|
||||
};
|
||||
|
@ -124,6 +125,9 @@ const getPreview = async () => {
|
|||
htmlContent: data,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
notify('Errors getting preview', 'negative');
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = async () => {
|
||||
|
|
|
@ -1,26 +1,15 @@
|
|||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<FormModel
|
||||
:url="`Departments/${route.params.id}`"
|
||||
model="department"
|
||||
auto-load
|
||||
class="full-width"
|
||||
>
|
||||
<FormModel model="Department" auto-load class="full-width">
|
||||
<template #form="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('globals.name')"
|
||||
:label="$t('globals.name')"
|
||||
v-model="data.name"
|
||||
:rules="validate('globals.name')"
|
||||
clearable
|
||||
|
@ -28,28 +17,28 @@ const { t } = useI18n();
|
|||
/>
|
||||
<VnInput
|
||||
v-model="data.code"
|
||||
:label="t('globals.code')"
|
||||
:label="$t('globals.code')"
|
||||
:rules="validate('globals.code')"
|
||||
clearable
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('department.chat')"
|
||||
:label="$t('department.chat')"
|
||||
v-model="data.chatName"
|
||||
:rules="validate('department.chat')"
|
||||
clearable
|
||||
/>
|
||||
<VnInput
|
||||
v-model="data.notificationEmail"
|
||||
:label="t('globals.params.email')"
|
||||
:label="$t('globals.params.email')"
|
||||
:rules="validate('globals.params.email')"
|
||||
clearable
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('department.bossDepartment')"
|
||||
:label="$t('department.bossDepartment')"
|
||||
v-model="data.workerFk"
|
||||
url="Workers/search"
|
||||
option-value="id"
|
||||
|
@ -59,7 +48,7 @@ const { t } = useI18n();
|
|||
:rules="validate('department.workerFk')"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('department.selfConsumptionCustomer')"
|
||||
:label="$t('department.selfConsumptionCustomer')"
|
||||
v-model="data.clientFk"
|
||||
url="Clients"
|
||||
option-value="id"
|
||||
|
@ -71,11 +60,11 @@ const { t } = useI18n();
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<QCheckbox
|
||||
:label="t('department.telework')"
|
||||
:label="$t('department.telework')"
|
||||
v-model="data.isTeleworking"
|
||||
/>
|
||||
<QCheckbox
|
||||
:label="t('department.notifyOnErrors')"
|
||||
:label="$t('department.notifyOnErrors')"
|
||||
v-model="data.hasToMistake"
|
||||
:false-value="0"
|
||||
:true-value="1"
|
||||
|
@ -83,17 +72,17 @@ const { t } = useI18n();
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<QCheckbox
|
||||
:label="t('department.worksInProduction')"
|
||||
:label="$t('department.worksInProduction')"
|
||||
v-model="data.isProduction"
|
||||
/>
|
||||
<QCheckbox
|
||||
:label="t('department.hasToRefill')"
|
||||
:label="$t('department.hasToRefill')"
|
||||
v-model="data.hasToRefill"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<QCheckbox
|
||||
:label="t('department.hasToSendMail')"
|
||||
:label="$t('department.hasToSendMail')"
|
||||
v-model="data.hasToSendMail"
|
||||
/>
|
||||
</VnRow>
|
||||
|
|
|
@ -7,7 +7,7 @@ import DepartmentDescriptor from 'pages/Department/Card/DepartmentDescriptor.vue
|
|||
class="q-pa-md column items-center"
|
||||
v-bind="{ ...$attrs }"
|
||||
data-key="Department"
|
||||
base-url="Departments"
|
||||
url="Departments"
|
||||
:descriptor="DepartmentDescriptor"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -5,7 +5,6 @@ import { useI18n } from 'vue-i18n';
|
|||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
@ -32,19 +31,14 @@ const entityId = computed(() => {
|
|||
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 () => {
|
||||
try {
|
||||
await axios.post(`/Departments/${entityId.value}/removeChild`, entityId.value);
|
||||
router.push({ name: 'WorkerDepartment' });
|
||||
notify('department.departmentRemoved', 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error removing department');
|
||||
}
|
||||
};
|
||||
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
@ -54,17 +48,9 @@ const { openConfirmationModal } = useVnConfirm();
|
|||
ref="DepartmentDescriptorRef"
|
||||
module="Department"
|
||||
:url="`Departments/${entityId}`"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
:summary="$props.summary"
|
||||
:to-module="{ name: 'WorkerDepartment' }"
|
||||
@on-fetch="
|
||||
(data) => {
|
||||
department = data;
|
||||
setData(data);
|
||||
}
|
||||
"
|
||||
data-key="department"
|
||||
data-key="Department"
|
||||
>
|
||||
<template #menu="{}">
|
||||
<QItem
|
||||
|
|
|
@ -236,9 +236,13 @@ const copyOriginalRowsData = (rows) => {
|
|||
};
|
||||
|
||||
const saveChange = async (field, { rowIndex, row }) => {
|
||||
try {
|
||||
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
|
||||
await axios.patch(`Buys/${row.id}`, row);
|
||||
originalRowDataCopy.value[rowIndex][field] = row[field];
|
||||
} catch (err) {
|
||||
console.error('Error saving changes', err);
|
||||
}
|
||||
};
|
||||
|
||||
const openRemoveDialog = async () => {
|
||||
|
@ -256,11 +260,15 @@ const openRemoveDialog = async () => {
|
|||
},
|
||||
})
|
||||
.onOk(async () => {
|
||||
try {
|
||||
await deleteBuys();
|
||||
const notifyMessage = t(
|
||||
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
|
||||
);
|
||||
notify(notifyMessage, 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error deleting buys');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -274,6 +282,7 @@ const importBuys = () => {
|
|||
};
|
||||
|
||||
const toggleGroupingMode = async (buy, mode) => {
|
||||
try {
|
||||
const groupingMode = mode === 'grouping' ? mode : 'packing';
|
||||
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
|
||||
const params = {
|
||||
|
@ -281,6 +290,9 @@ const toggleGroupingMode = async (buy, mode) => {
|
|||
};
|
||||
await axios.patch(`Buys/${buy.id}`, params);
|
||||
buy.groupingMode = newGroupingMode;
|
||||
} catch (err) {
|
||||
console.error('Error toggling grouping mode');
|
||||
}
|
||||
};
|
||||
|
||||
const lockIconType = (groupingMode, mode) => {
|
||||
|
|
|
@ -123,15 +123,20 @@ const fillData = async (rawData) => {
|
|||
};
|
||||
|
||||
const fetchBuys = async (buys) => {
|
||||
try {
|
||||
const params = { buys };
|
||||
const { data } = await axios.post(
|
||||
`Entries/${route.params.id}/importBuysPreview`,
|
||||
params
|
||||
);
|
||||
importData.value.buys = data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching buys');
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
const params = importData.value;
|
||||
const hasAnyEmptyRow = params.buys.some((buy) => {
|
||||
return buy.itemFk === null;
|
||||
|
@ -145,6 +150,9 @@ const onSubmit = async () => {
|
|||
await axios.post(`Entries/${route.params.id}/importBuys`, params);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
redirectToBuysView();
|
||||
} catch (err) {
|
||||
console.error('Error importing buys', err);
|
||||
}
|
||||
};
|
||||
|
||||
const redirectToBuysView = () => {
|
||||
|
|
|
@ -7,7 +7,7 @@ import filter from './EntryFilter.js';
|
|||
<template>
|
||||
<VnCard
|
||||
data-key="Entry"
|
||||
base-url="Entries"
|
||||
url="Entries"
|
||||
:filter="filter"
|
||||
:descriptor="EntryDescriptor"
|
||||
:filter-panel="EntryFilter"
|
||||
|
|
|
@ -147,9 +147,12 @@ async function setEntryData(data) {
|
|||
}
|
||||
|
||||
const fetchEntryBuys = async () => {
|
||||
try {
|
||||
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
||||
if (data) entryBuys.value = data;
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error fetching entry buys');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import VnImg from 'src/components/ui/VnImg.vue';
|
|||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const columns = [
|
||||
{
|
||||
align: 'center',
|
||||
|
@ -235,6 +234,7 @@ const columns = [
|
|||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landing)),
|
||||
},
|
||||
];
|
||||
const tableRef = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
|
|
|
@ -221,7 +221,7 @@ onMounted(async () => {
|
|||
t('entry.list.tableVisibleColumns.isExcludedFromAvailable')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="!!row.isRaid" name="vn:net" color="primary">
|
||||
<QIcon v-if="!!row.daysInForward" name="vn:net" color="primary">
|
||||
<QTooltip>
|
||||
{{
|
||||
t('globals.raid', { daysInForward: row.daysInForward })
|
||||
|
|
|
@ -30,6 +30,8 @@ const recalc = async () => {
|
|||
isLoading.value = true;
|
||||
await axios.post('Applications/waste_addSales/execute-proc', params);
|
||||
notify('wasteRecalc.recalcOk', 'positive');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ onBeforeRouteUpdate(async (to) => await setRectificative(to));
|
|||
<template>
|
||||
<VnCard
|
||||
data-key="InvoiceIn"
|
||||
base-url="InvoiceIns"
|
||||
url="InvoiceIns"
|
||||
:filter="filter"
|
||||
:descriptor="InvoiceInDescriptor"
|
||||
:filter-panel="InvoiceInFilter"
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue';
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import InvoiceOutFilter from '../InvoiceOutFilter.vue';
|
||||
import filter from './InvoiceOutFilter.js';
|
||||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
data-key="InvoiceOut"
|
||||
base-url="InvoiceOuts"
|
||||
url="InvoiceOuts"
|
||||
:filter="filter"
|
||||
:descriptor="InvoiceOutDescriptor"
|
||||
:filter-panel="InvoiceOutFilter"
|
||||
search-data-key="InvoiceOutList"
|
||||
|
|
|
@ -8,8 +8,8 @@ import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy
|
|||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import InvoiceOutDescriptorMenu from './InvoiceOutDescriptorMenu.vue';
|
||||
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
import filter from './InvoiceOutFilter.js';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -26,30 +26,11 @@ const entityId = computed(() => {
|
|||
return $props.id || route.params.id;
|
||||
});
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'company',
|
||||
scope: {
|
||||
fields: ['id', 'code'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['id', 'name', 'email'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const descriptor = ref();
|
||||
|
||||
function ticketFilter(invoice) {
|
||||
return JSON.stringify({ refFk: invoice.ref });
|
||||
}
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.id));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -58,10 +39,8 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
|
|||
module="InvoiceOut"
|
||||
:url="`InvoiceOuts/${entityId}`"
|
||||
:filter="filter"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
@on-fetch="setData"
|
||||
data-key="invoiceOutData"
|
||||
title="ref"
|
||||
data-key="InvoiceOut"
|
||||
>
|
||||
<template #menu="{ entity, menuRef }">
|
||||
<InvoiceOutDescriptorMenu :invoice-out-data="entity" :menu-ref="menuRef" />
|
||||
|
|
|
@ -61,6 +61,7 @@ const showSendInvoiceDialog = (type) => {
|
|||
};
|
||||
|
||||
const sendEmailInvoice = async ({ address }) => {
|
||||
try {
|
||||
if (!address) notify(`The email can't be empty`, 'negative');
|
||||
|
||||
if (invoiceFormType.value === 'pdf') {
|
||||
|
@ -69,10 +70,16 @@ const sendEmailInvoice = async ({ address }) => {
|
|||
recipient: address,
|
||||
});
|
||||
} else {
|
||||
return sendEmail(`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`, {
|
||||
return sendEmail(
|
||||
`InvoiceOuts/${$props.invoiceOutData.ref}/invoice-csv-email`,
|
||||
{
|
||||
recipientId: $props.invoiceOutData.client.id,
|
||||
recipient: address,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error sending email', err);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -81,21 +88,34 @@ const redirectToInvoiceOutList = () => {
|
|||
};
|
||||
|
||||
const deleteInvoice = async () => {
|
||||
try {
|
||||
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/delete`);
|
||||
notify(t('InvoiceOut deleted'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error deleting invoice out', err);
|
||||
}
|
||||
};
|
||||
|
||||
const bookInvoice = async () => {
|
||||
try {
|
||||
await axios.post(`InvoiceOuts/${$props.invoiceOutData.ref}/book`);
|
||||
notify(t('InvoiceOut booked'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error booking invoice out', err);
|
||||
}
|
||||
};
|
||||
|
||||
const generateInvoicePdf = async () => {
|
||||
try {
|
||||
await axios.post(`InvoiceOuts/${$props.invoiceOutData.id}/createPdf`);
|
||||
notify(t('The invoice PDF document has been regenerated'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error generating invoice out pdf', err);
|
||||
}
|
||||
};
|
||||
|
||||
const refundInvoice = async (withWarehouse) => {
|
||||
try {
|
||||
const params = { ref: $props.invoiceOutData.ref, withWarehouse: withWarehouse };
|
||||
const { data } = await axios.post('InvoiceOuts/refund', params);
|
||||
location.href = window.origin + `/#/ticket/${data[0].id}/sale`;
|
||||
|
@ -105,6 +125,9 @@ const refundInvoice = async (withWarehouse) => {
|
|||
}),
|
||||
'positive'
|
||||
);
|
||||
} catch (err) {
|
||||
console.error('Error generating invoice out pdf', err);
|
||||
}
|
||||
};
|
||||
|
||||
const showTransferInvoiceForm = async () => {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
export default {
|
||||
include: [
|
||||
{
|
||||
relation: 'company',
|
||||
scope: {
|
||||
fields: ['id', 'code'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['id', 'name', 'email'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
|
@ -135,10 +135,15 @@ onMounted(() => (stateStore.rightDrawer = true));
|
|||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
||||
function openPdf(id) {
|
||||
try {
|
||||
openReport(`${MODEL}/${id}/download`);
|
||||
} catch (err) {
|
||||
console.error('Error opening PDF', err);
|
||||
}
|
||||
}
|
||||
|
||||
function downloadPdf() {
|
||||
try {
|
||||
if (selectedRows.value.size === 0) return;
|
||||
const selectedCardsArray = Array.from(selectedRows.value.values());
|
||||
|
||||
|
@ -157,7 +162,9 @@ function downloadPdf() {
|
|||
|
||||
openReport(`${MODEL}/downloadZip`, params);
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error opening PDF');
|
||||
}
|
||||
}
|
||||
|
||||
watchEffect(selectedRows);
|
||||
|
@ -247,7 +254,10 @@ watchEffect(selectedRows);
|
|||
@update:model-value="fetchClientAddress"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItem
|
||||
v-bind="scope.itemProps"
|
||||
@click="selectedClient(scope.opt)"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
#{{ scope.opt?.id }} -
|
||||
|
@ -286,17 +296,18 @@ watchEffect(selectedRows);
|
|||
: ''
|
||||
} `
|
||||
}}
|
||||
<span>{{
|
||||
<span>
|
||||
{{
|
||||
scope.opt?.nickname
|
||||
}}</span>
|
||||
}}</span
|
||||
>
|
||||
<span
|
||||
v-if="
|
||||
scope.opt?.province ||
|
||||
scope.opt?.city ||
|
||||
scope.opt?.street
|
||||
"
|
||||
>
|
||||
, {{ scope.opt?.street }},
|
||||
>, {{ scope.opt?.street }},
|
||||
{{ scope.opt?.city }},
|
||||
{{
|
||||
scope.opt?.province?.name
|
||||
|
@ -305,8 +316,8 @@ watchEffect(selectedRows);
|
|||
{{
|
||||
scope.opt?.agencyMode
|
||||
?.name
|
||||
}}
|
||||
</span>
|
||||
}}</span
|
||||
>
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -54,9 +54,8 @@ const onIntrastatCreated = (response, formData) => {
|
|||
auto-load
|
||||
/>
|
||||
<FormModel
|
||||
:url="`Items/${route.params.id}`"
|
||||
:url-update="`Items/${route.params.id}`"
|
||||
model="item"
|
||||
model="Item"
|
||||
auto-load
|
||||
:clear-store-on-unmount="false"
|
||||
>
|
||||
|
|
|
@ -6,7 +6,7 @@ import ItemListFilter from '../ItemListFilter.vue';
|
|||
<template>
|
||||
<VnCard
|
||||
data-key="Item"
|
||||
base-url="Items"
|
||||
:url="`Items/${$route.params.id}/getCard`"
|
||||
:descriptor="ItemDescriptor"
|
||||
:filter-panel="ItemListFilter"
|
||||
search-data-key="ItemList"
|
||||
|
|
|
@ -8,7 +8,6 @@ import VnLv from 'src/components/ui/VnLv.vue';
|
|||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import RegularizeStockForm from 'components/RegularizeStockForm.vue';
|
||||
import ItemDescriptorImage from 'src/pages/Item/Card/ItemDescriptorImage.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import axios from 'axios';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
@ -58,10 +57,8 @@ onMounted(async () => {
|
|||
mounted.value = true;
|
||||
});
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = async (entity) => {
|
||||
if (!entity) return;
|
||||
data.value = useCardDescription(entity.name, entity.id);
|
||||
await updateStock();
|
||||
};
|
||||
|
||||
|
@ -97,10 +94,8 @@ const openRegularizeStockForm = () => {
|
|||
|
||||
<template>
|
||||
<CardDescriptor
|
||||
data-key="ItemData"
|
||||
data-key="Item"
|
||||
module="Item"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
:summary="$props.summary"
|
||||
:url="`Items/${entityId}/getCard`"
|
||||
@on-fetch="setData"
|
||||
|
|
|
@ -170,7 +170,7 @@ onMounted(async () => {
|
|||
from.value = getDate(_from, 'from');
|
||||
const _to = Date.vnNew();
|
||||
_to.setDate(_to.getDate() + 10);
|
||||
to.value = getDate(_to, 'to');
|
||||
to.value = getDate(Date.vnNew(), 'to');
|
||||
|
||||
updateFilter();
|
||||
|
||||
|
|
|
@ -45,9 +45,13 @@ const arrayData = useArrayData('ItemShelvings', {
|
|||
const rows = computed(() => arrayData.store.data || []);
|
||||
|
||||
const applyColumnFilter = async (col) => {
|
||||
try {
|
||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||
params[paramKey] = col.columnFilter.filterValue;
|
||||
await arrayData.addFilter({ filter: null, params });
|
||||
} catch (err) {
|
||||
console.error('Error applying column filter', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getInputEvents = (col) => {
|
||||
|
@ -169,11 +173,15 @@ const totalLabels = computed(() =>
|
|||
);
|
||||
|
||||
const removeLines = async () => {
|
||||
try {
|
||||
const itemShelvingIds = rowsSelected.value.map((row) => row.itemShelvingFk);
|
||||
await axios.post('ItemShelvings/deleteItemShelvings', { itemShelvingIds });
|
||||
rowsSelected.value = [];
|
||||
notify('shelvings.shelvingsRemoved', 'positive');
|
||||
await arrayData.fetch({ append: false });
|
||||
} catch (err) {
|
||||
console.error('Error removing lines', err);
|
||||
}
|
||||
};
|
||||
onMounted(async () => {
|
||||
await arrayData.fetch({ append: false });
|
||||
|
|
|
@ -19,6 +19,7 @@ const tagOptions = ref([]);
|
|||
const valueOptionsMap = ref(new Map());
|
||||
|
||||
const getSelectedTagValues = async (tag) => {
|
||||
try {
|
||||
if (!tag.tagFk && tag.tag.isFree) return;
|
||||
const filter = {
|
||||
fields: ['value'],
|
||||
|
@ -31,6 +32,9 @@ const getSelectedTagValues = async (tag) => {
|
|||
params,
|
||||
});
|
||||
valueOptionsMap.value.set(tag.tagFk, data);
|
||||
} catch (err) {
|
||||
console.error('Error getting selected tag values');
|
||||
}
|
||||
};
|
||||
|
||||
const onItemTagsFetched = async (itemTags) => {
|
||||
|
|
|
@ -32,6 +32,7 @@ const ItemTaxRef = ref(null);
|
|||
const taxesOptions = ref([]);
|
||||
|
||||
const submitTaxes = async (data) => {
|
||||
try {
|
||||
let payload = data.map((tax) => ({
|
||||
id: tax.id,
|
||||
taxClassFk: tax.taxClassFk,
|
||||
|
@ -39,6 +40,9 @@ const submitTaxes = async (data) => {
|
|||
|
||||
await axios.post(`Items/updateTaxes`, payload);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error saving taxes', err);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
|
|
|
@ -221,16 +221,24 @@ const updateMinPrice = async (value, props) => {
|
|||
};
|
||||
|
||||
const upsertPrice = async (props, resetMinPrice = false) => {
|
||||
try {
|
||||
const { row } = props;
|
||||
if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) {
|
||||
if (resetMinPrice) row.hasMinPrice = 0;
|
||||
await upsertFixedPrice(row);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error editing price', err);
|
||||
}
|
||||
};
|
||||
|
||||
async function upsertFixedPrice(row) {
|
||||
try {
|
||||
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
||||
return data;
|
||||
} catch (err) {
|
||||
console.error('Error editing price', err);
|
||||
}
|
||||
}
|
||||
|
||||
async function saveOnRowChange(row) {
|
||||
|
@ -313,10 +321,14 @@ const onEditCellDataSaved = async () => {
|
|||
};
|
||||
|
||||
const removeFuturePrice = async () => {
|
||||
try {
|
||||
rowsSelected.value.forEach(({ id }) => {
|
||||
const rowIndex = fixedPrices.value.findIndex(({ id }) => id === id);
|
||||
removePrice(id, rowIndex);
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error removing price', err);
|
||||
}
|
||||
};
|
||||
|
||||
function confirmRemove(item, isFuture) {
|
||||
|
@ -333,9 +345,13 @@ function confirmRemove(item, isFuture) {
|
|||
}
|
||||
|
||||
const removePrice = async (id) => {
|
||||
try {
|
||||
await axios.delete(`FixedPrices/${id}`);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
tableRef.value.reload({});
|
||||
} catch (err) {
|
||||
console.error('Error removing price', err);
|
||||
}
|
||||
};
|
||||
const dateStyle = (date) =>
|
||||
date
|
||||
|
@ -424,7 +440,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
selection: 'multiple',
|
||||
}"
|
||||
:crud-model="{
|
||||
disableInfiniteScroll: true,
|
||||
paginate: false,
|
||||
}"
|
||||
v-model:selected="rowsSelected"
|
||||
:row-click="saveOnRowChange"
|
||||
|
|
|
@ -55,6 +55,7 @@ const onCategoryChange = async (categoryFk, search) => {
|
|||
};
|
||||
|
||||
const getSelectedTagValues = async (tag) => {
|
||||
try {
|
||||
if (!tag?.selectedTag?.id) return;
|
||||
tag.value = null;
|
||||
const filter = {
|
||||
|
@ -67,6 +68,9 @@ const getSelectedTagValues = async (tag) => {
|
|||
params,
|
||||
});
|
||||
tag.valueOptions = data;
|
||||
} catch (err) {
|
||||
console.error('Error getting selected tag values');
|
||||
}
|
||||
};
|
||||
|
||||
const applyTags = (params, search) => {
|
||||
|
|
|
@ -173,6 +173,7 @@ const getBadgeColor = (date) => {
|
|||
};
|
||||
|
||||
const changeQuantity = async (request) => {
|
||||
try {
|
||||
if (request.saleFk) {
|
||||
const params = {
|
||||
quantity: request.saleQuantity,
|
||||
|
@ -182,9 +183,13 @@ const changeQuantity = async (request) => {
|
|||
notify(t('globals.dataSaved'), 'positive');
|
||||
confirmRequest(request);
|
||||
} else confirmRequest(request);
|
||||
} catch (error) {
|
||||
console.error('Error changing quantity:: ', error);
|
||||
}
|
||||
};
|
||||
|
||||
const confirmRequest = async (request) => {
|
||||
try {
|
||||
if (request.itemFk && request.saleQuantity) {
|
||||
const params = {
|
||||
itemFk: request.itemFk,
|
||||
|
@ -192,11 +197,17 @@ const confirmRequest = async (request) => {
|
|||
attenderFk: request.attenderFk,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(`TicketRequests/${request.id}/confirm`, params);
|
||||
const { data } = await axios.post(
|
||||
`TicketRequests/${request.id}/confirm`,
|
||||
params
|
||||
);
|
||||
request.itemDescription = data.concept;
|
||||
request.isOk = true;
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error confirming request:: ', error);
|
||||
}
|
||||
};
|
||||
|
||||
const getState = (isOk) => {
|
||||
|
|
|
@ -40,12 +40,7 @@ const itemPackingTypesOptions = ref([]);
|
|||
}"
|
||||
auto-load
|
||||
/>
|
||||
<FormModel
|
||||
:url="`ItemTypes/${route.params.id}`"
|
||||
:url-update="`ItemTypes/${route.params.id}`"
|
||||
model="itemTypeBasicData"
|
||||
auto-load
|
||||
>
|
||||
<FormModel :url-update="`ItemTypes/${route.params.id}`" model="ItemType" auto-load>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
<VnInput v-model="data.code" :label="t('shared.code')" />
|
||||
|
|
|
@ -3,11 +3,13 @@ import VnCard from 'components/common/VnCard.vue';
|
|||
import ItemTypeDescriptor from 'src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue';
|
||||
import ItemTypeFilter from 'src/pages/Item/ItemType/ItemTypeFilter.vue';
|
||||
import ItemTypeSearchbar from '../ItemTypeSearchbar.vue';
|
||||
import filter from './ItemTypeFilter.js';
|
||||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
data-key="ItemTypeSummary"
|
||||
base-url="ItemTypes"
|
||||
data-key="ItemType"
|
||||
url="ItemTypes"
|
||||
:filter="filter"
|
||||
:descriptor="ItemTypeDescriptor"
|
||||
:filter-panel="ItemTypeFilter"
|
||||
search-data-key="ItemTypeList"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue