forked from verdnatura/salix-front
Merge branch 'dev' into 7677_vnLocation_perf
This commit is contained in:
commit
3e44c6e404
|
@ -0,0 +1,33 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
function getCurrentBranchName(p = process.cwd()) {
|
||||||
|
if (!fs.existsSync(p)) return false;
|
||||||
|
|
||||||
|
const gitHeadPath = path.join(p, '.git', 'HEAD');
|
||||||
|
|
||||||
|
if (!fs.existsSync(gitHeadPath))
|
||||||
|
return getCurrentBranchName(path.resolve(p, '..'));
|
||||||
|
|
||||||
|
const headContent = fs.readFileSync(gitHeadPath, 'utf-8');
|
||||||
|
return headContent.trim().split('/')[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
const branchName = getCurrentBranchName();
|
||||||
|
|
||||||
|
if (branchName) {
|
||||||
|
const msgPath = `.git/COMMIT_EDITMSG`;
|
||||||
|
const msg = fs.readFileSync(msgPath, 'utf-8');
|
||||||
|
const reference = branchName.match(/^\d+/);
|
||||||
|
|
||||||
|
const referenceTag = `refs #${reference}`;
|
||||||
|
if (!msg.includes(referenceTag) && reference) {
|
||||||
|
const splitedMsg = msg.split(':');
|
||||||
|
|
||||||
|
if (splitedMsg.length > 1) {
|
||||||
|
const finalMsg = splitedMsg[0] + ': ' + referenceTag + splitedMsg.slice(1).join(':');
|
||||||
|
fs.writeFileSync(msgPath, finalMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
echo "Running husky commit-msg hook"
|
||||||
|
npx --no-install commitlint --edit
|
||||||
|
echo "Adding reference tag to commit message"
|
||||||
|
node .husky/addReferenceTag.js
|
||||||
|
|
88
CHANGELOG.md
88
CHANGELOG.md
|
@ -1,3 +1,91 @@
|
||||||
|
# Version 24.32 - 2024-08-06
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- chore: refs #7197 drop space by:jorgep
|
||||||
|
- chore: refs #7197 drop useless attr by:jorgep
|
||||||
|
- chore: refs #7197 fix test by:jorgep
|
||||||
|
- chore: refs #7197 fix tests by:jorgep
|
||||||
|
- chore: refs #7197 fix unit tests by:jorgep
|
||||||
|
- chore: refs #7197 idrop useless class by:jorgep
|
||||||
|
- chore: refs #7197 improve form filling in Cypress tests by:jorgep
|
||||||
|
- chore: refs #7197 remove unused import by:jorgep
|
||||||
|
- feat: customerPayments card view by:alexm
|
||||||
|
- feat: refs #6943 lock grid mode by:jorgep
|
||||||
|
- feat: refs #6943 wip consumption filter by:jorgep
|
||||||
|
- feat: refs #7197 add correcting filter by:jorgep
|
||||||
|
- feat: refs #7197 add supplier activities filter option by:jorgep
|
||||||
|
- feat: refs #7197 summary responsive by:jorgep
|
||||||
|
- feat: refs #7323 fix descriptors, added VnTable and minor changes by:Jon
|
||||||
|
- feat: refs #7323 fixed tests, changed calendar styles and fix workerCreate by:Jon
|
||||||
|
- feat: refs #7356 list & weekly to VnTable and style fixes by:Jon
|
||||||
|
- feat: refs #7401 add menu options by:pablone
|
||||||
|
- feat: SalesClientTable by:Javier Segarra
|
||||||
|
- feat: salesOrderTable by:Javier Segarra
|
||||||
|
- feat: salesTicketTable by:Javier Segarra
|
||||||
|
- feat: VnTable SalesTicketTable by:Javier Segarra
|
||||||
|
- fix: columns style by:alexm
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- perf: LeftMenu show/hide by:Javier Segarra
|
||||||
|
- perf: refs #7356 TicketList state column by:Jon
|
||||||
|
- perf: VnFilterPanel (origin/7323_WorkerMigration_End) by:Javier Segarra
|
||||||
|
- perf: width SalesTicketsTable by:Javier Segarra
|
||||||
|
- refactor: #6943 wip use vnTable CustomerCredits by:jorgep
|
||||||
|
- refactor: CustomerNotifications use VnTable by:alexm
|
||||||
|
- refactor: CustomerPayments use VnTable by:alexm
|
||||||
|
- refactor: refs #7014 deleted main files and changed route files by:Jon
|
||||||
|
- refactor: refs #7014 improved route.js & deleted RouteMain by:Jon
|
||||||
|
- refactor: refs #7014 refactor <module>Main.vue by:Jon
|
||||||
|
- refactor: refs #7014 refactor ZoneCard, deleted ZoneMain & created basic tests for functionality by:Jon
|
||||||
|
- refactor: refs #7197 use invoiceInSearchbar & queryParams by:jorgep
|
||||||
|
- refactor: refs #7323 hidden column filter proposal by:Jon
|
||||||
|
- refactor: refs #7356 fixed VnTable filters by:Jon
|
||||||
|
- refactor: refs #7356 requested changes by:Jon
|
||||||
|
- refactor: wip use vnTable CustomerCredits by:jorgep
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- chore: refs #7197 fix test by:jorgep
|
||||||
|
- chore: refs #7197 fix tests by:jorgep
|
||||||
|
- chore: refs #7197 fix unit tests by:jorgep
|
||||||
|
- feat: refs #7323 fix descriptors, added VnTable and minor changes by:Jon
|
||||||
|
- feat: refs #7323 fixed tests, changed calendar styles and fix workerCreate by:Jon
|
||||||
|
- feat: refs #7356 list & weekly to VnTable and style fixes by:Jon
|
||||||
|
- fix(claim): small details (6336-claim-v6) by:alexm
|
||||||
|
- fix: columns style by:alexm
|
||||||
|
- fix: customer defaulter add amount order (6943-fixCustomer) by:alexm
|
||||||
|
- fix: customerDefaulter correct functionality by:alexm
|
||||||
|
- fix: customerNotifications filter by:alexm
|
||||||
|
- fix: fix conflicts by:Jon
|
||||||
|
- fix: refs #6101 fix TicketList by:Jon
|
||||||
|
- fix: refs #6891 worker tests by:jorgep
|
||||||
|
- fix: refs #6943 drop padding-left checkbox & create wrap mode vnRow by:jorgep
|
||||||
|
- fix: refs #6943 prevent undefined by:jorgep
|
||||||
|
- fix: refs #7014 fix tests by:Jon
|
||||||
|
- fix: refs #7014 fix wagon module by:Jon
|
||||||
|
- fix: refs #7197 add url InvoiceInSearchbar by:jorgep
|
||||||
|
- fix: refs #7197 amount reactivity by:jorgep
|
||||||
|
- fix: refs #7197 drop character by:jorgep
|
||||||
|
- fix: refs #7197 reactivity invoiceCorrection by:jorgep
|
||||||
|
- fix: refs #7197 responsive summary layout by:jorgep
|
||||||
|
- fix: refs #7197 rollback by:jorgep
|
||||||
|
- fix: refs #7197 rollback crudModel by:jorgep
|
||||||
|
- fix: refs #7197 setInvoiceInCorrecition by:jorgep
|
||||||
|
- fix: refs #7197 vat, intrastat, filter and list sections by:jorgep
|
||||||
|
- fix: refs #7323 fix department & email table filter by:Jon
|
||||||
|
- fix: refs #7323 fixed left filter by:Jon
|
||||||
|
- fix: refs #7323 fix workerTimeControl form by:Jon
|
||||||
|
- fix: refs #7401 fix routeForm by:pablone
|
||||||
|
- fix: refs #7401 remove console.log by:pablone
|
||||||
|
- fix: refs CAU 207504 fix itemDiary and logs by:Jon
|
||||||
|
- fix: workerCreate form street field to be always upperCase by:Jon
|
||||||
|
- hotfix: refs CAU #207614 fix sale.concept field by:Jon
|
||||||
|
- refactor: refs #7356 fixed VnTable filters by:Jon
|
||||||
|
- refs #6898 fix by:carlossa
|
||||||
|
- Ticket expedition initial load fix by:wbuezas
|
||||||
|
|
||||||
# Version 24.28 - 2024-07-09
|
# Version 24.28 - 2024-07-09
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = { extends: ['@commitlint/config-conventional'] };
|
10
package.json
10
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.32.0",
|
"version": "24.34.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
@ -13,7 +13,10 @@
|
||||||
"test:e2e:ci": "cd ../salix && gulp docker && cd ../salix-front && cypress run",
|
"test:e2e:ci": "cd ../salix && gulp docker && cd ../salix-front && cypress run",
|
||||||
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
||||||
"test:unit": "vitest",
|
"test:unit": "vitest",
|
||||||
"test:unit:ci": "vitest run"
|
"test:unit:ci": "vitest run",
|
||||||
|
"commitlint": "commitlint --edit",
|
||||||
|
"prepare": "npx husky install",
|
||||||
|
"addReferenceTag": "node .husky/addReferenceTag.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@quasar/cli": "^2.3.0",
|
"@quasar/cli": "^2.3.0",
|
||||||
|
@ -29,6 +32,8 @@
|
||||||
"vue-router": "^4.2.1"
|
"vue-router": "^4.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@commitlint/cli": "^19.2.1",
|
||||||
|
"@commitlint/config-conventional": "^19.1.0",
|
||||||
"@intlify/unplugin-vue-i18n": "^0.8.1",
|
"@intlify/unplugin-vue-i18n": "^0.8.1",
|
||||||
"@pinia/testing": "^0.1.2",
|
"@pinia/testing": "^0.1.2",
|
||||||
"@quasar/app-vite": "^1.7.3",
|
"@quasar/app-vite": "^1.7.3",
|
||||||
|
@ -41,6 +46,7 @@
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-cypress": "^2.13.3",
|
"eslint-plugin-cypress": "^2.13.3",
|
||||||
"eslint-plugin-vue": "^9.14.1",
|
"eslint-plugin-vue": "^9.14.1",
|
||||||
|
"husky": "^8.0.0",
|
||||||
"postcss": "^8.4.23",
|
"postcss": "^8.4.23",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"vitest": "^0.31.1"
|
"vitest": "^0.31.1"
|
||||||
|
|
4762
pnpm-lock.yaml
4762
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -43,6 +43,15 @@ const onResponseError = (error) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (response?.status) {
|
switch (response?.status) {
|
||||||
|
case 422:
|
||||||
|
if (error.name == 'ValidationError')
|
||||||
|
message +=
|
||||||
|
' "' +
|
||||||
|
responseError.details.context +
|
||||||
|
'.' +
|
||||||
|
Object.keys(responseError.details.codes).join(',') +
|
||||||
|
'"';
|
||||||
|
break;
|
||||||
case 500:
|
case 500:
|
||||||
message = 'errors.statusInternalServerError';
|
message = 'errors.statusInternalServerError';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,28 +1,11 @@
|
||||||
import { getCurrentInstance } from 'vue';
|
import { getCurrentInstance } from 'vue';
|
||||||
|
|
||||||
const filterAvailableInput = (element) => {
|
|
||||||
return element.classList.contains('q-field__native') && !element.disabled;
|
|
||||||
};
|
|
||||||
const filterAvailableText = (element) => {
|
|
||||||
return (
|
|
||||||
element.__vueParentComponent.type.name === 'QInput' &&
|
|
||||||
element.__vueParentComponent?.attrs?.class !== 'vn-input-date'
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
const vm = getCurrentInstance();
|
const vm = getCurrentInstance();
|
||||||
if (vm.type.name === 'QForm') {
|
if (vm.type.name === 'QForm') {
|
||||||
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
|
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
|
||||||
// AUTOFOCUS
|
// TODO: AUTOFOCUS IS NOT FOCUSING
|
||||||
const elementsArray = Array.from(this.$el.elements);
|
|
||||||
const availableInputs = elementsArray.filter(filterAvailableInput);
|
|
||||||
const firstInputElement = availableInputs.find(filterAvailableText);
|
|
||||||
|
|
||||||
if (firstInputElement) {
|
|
||||||
firstInputElement.focus();
|
|
||||||
}
|
|
||||||
const that = this;
|
const that = this;
|
||||||
this.$el.addEventListener('keyup', function (evt) {
|
this.$el.addEventListener('keyup', function (evt) {
|
||||||
if (evt.key === 'Enter') {
|
if (evt.key === 'Enter') {
|
||||||
|
|
|
@ -52,7 +52,7 @@ onMounted(async () => {
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('name')"
|
:label="t('name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
|
@ -67,7 +67,7 @@ onMounted(async () => {
|
||||||
:rules="validate('bankEntity.bic')"
|
:rules="validate('bankEntity.bic')"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('country')"
|
:label="t('country')"
|
||||||
|
|
|
@ -59,7 +59,7 @@ const onDataSaved = async (formData, requestResponse) => {
|
||||||
<QIcon name="warning" class="fill-icon q-mr-sm" size="md" />
|
<QIcon name="warning" class="fill-icon q-mr-sm" size="md" />
|
||||||
{{ t('Invoicing in progress...') }}
|
{{ t('Invoicing in progress...') }}
|
||||||
</span>
|
</span>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Ticket')"
|
:label="t('Ticket')"
|
||||||
:options="ticketsOptions"
|
:options="ticketsOptions"
|
||||||
|
@ -99,7 +99,7 @@ const onDataSaved = async (formData, requestResponse) => {
|
||||||
/>
|
/>
|
||||||
<VnInputDate :label="t('Max date')" v-model="data.maxShipped" />
|
<VnInputDate :label="t('Max date')" v-model="data.maxShipped" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Serial')"
|
:label="t('Serial')"
|
||||||
:options="invoiceOutSerialsOptions"
|
:options="invoiceOutSerialsOptions"
|
||||||
|
@ -117,7 +117,7 @@ const onDataSaved = async (formData, requestResponse) => {
|
||||||
v-model="data.taxArea"
|
v-model="data.taxArea"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Reference')"
|
:label="t('Reference')"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
|
|
|
@ -4,8 +4,8 @@ import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelectProvince from 'components/VnSelectProvince.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
import FormModelPopup from './FormModelPopup.vue';
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved']);
|
const emit = defineEmits(['onDataSaved']);
|
||||||
|
@ -19,8 +19,8 @@ const cityFormData = reactive({
|
||||||
|
|
||||||
const provincesOptions = ref([]);
|
const provincesOptions = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (dataSaved) => {
|
const onDataSaved = (...args) => {
|
||||||
emit('onDataSaved', dataSaved);
|
emit('onDataSaved', ...args);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -36,24 +36,16 @@ const onDataSaved = (dataSaved) => {
|
||||||
:form-initial-data="cityFormData"
|
:form-initial-data="cityFormData"
|
||||||
url-create="towns"
|
url-create="towns"
|
||||||
model="city"
|
model="city"
|
||||||
@on-data-saved="onDataSaved($event)"
|
@on-data-saved="onDataSaved"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Name')"
|
:label="t('Name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
:rules="validate('city.name')"
|
:rules="validate('city.name')"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelectProvince v-model="data.provinceFk" />
|
||||||
:label="t('Province')"
|
|
||||||
:options="provincesOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="data.provinceFk"
|
|
||||||
:rules="validate('city.provinceFk')"
|
|
||||||
/>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModelPopup>
|
</FormModelPopup>
|
||||||
|
|
|
@ -5,9 +5,9 @@ import { useI18n } from 'vue-i18n';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import VnSelectProvince from 'src/components/VnSelectProvince.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import CreateNewCityForm from './CreateNewCityForm.vue';
|
import CreateNewCityForm from './CreateNewCityForm.vue';
|
||||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
|
||||||
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
import FormModelPopup from './FormModelPopup.vue';
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
|
|
||||||
|
@ -22,20 +22,17 @@ const postcodeFormData = reactive({
|
||||||
townFk: null,
|
townFk: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const townsFetchDataRef = ref(null);
|
|
||||||
const provincesFetchDataRef = ref(null);
|
const provincesFetchDataRef = ref(null);
|
||||||
const countriesOptions = ref([]);
|
const countriesOptions = ref([]);
|
||||||
const provincesOptions = ref([]);
|
const provincesOptions = ref([]);
|
||||||
const townsLocationOptions = ref([]);
|
const town = ref({});
|
||||||
|
|
||||||
const onDataSaved = (formData) => {
|
function onDataSaved(formData) {
|
||||||
const newPostcode = {
|
const newPostcode = {
|
||||||
...formData,
|
...formData,
|
||||||
};
|
};
|
||||||
const townObject = townsLocationOptions.value.find(
|
newPostcode.town = town.value.name;
|
||||||
({ id }) => id === formData.townFk
|
newPostcode.townFk = town.value.id;
|
||||||
);
|
|
||||||
newPostcode.town = townObject?.name;
|
|
||||||
const provinceObject = provincesOptions.value.find(
|
const provinceObject = provincesOptions.value.find(
|
||||||
({ id }) => id === formData.provinceFk
|
({ id }) => id === formData.provinceFk
|
||||||
);
|
);
|
||||||
|
@ -43,39 +40,41 @@ const onDataSaved = (formData) => {
|
||||||
const countryObject = countriesOptions.value.find(
|
const countryObject = countriesOptions.value.find(
|
||||||
({ id }) => id === formData.countryFk
|
({ id }) => id === formData.countryFk
|
||||||
);
|
);
|
||||||
newPostcode.country = countryObject?.country;
|
newPostcode.country = countryObject?.name;
|
||||||
emit('onDataSaved', newPostcode);
|
emit('onDataSaved', newPostcode);
|
||||||
};
|
}
|
||||||
|
|
||||||
const onCityCreated = async ({ name, provinceFk }, formData) => {
|
async function onCityCreated(newTown, formData) {
|
||||||
await townsFetchDataRef.value.fetch();
|
|
||||||
formData.townFk = townsLocationOptions.value.find((town) => town.name === name).id;
|
|
||||||
formData.provinceFk = provinceFk;
|
|
||||||
formData.countryFk = provincesOptions.value.find(
|
|
||||||
(province) => province.id === provinceFk
|
|
||||||
).countryFk;
|
|
||||||
};
|
|
||||||
|
|
||||||
const onProvinceCreated = async ({ name }, formData) => {
|
|
||||||
await provincesFetchDataRef.value.fetch();
|
await provincesFetchDataRef.value.fetch();
|
||||||
formData.provinceFk = provincesOptions.value.find(
|
newTown.province = provincesOptions.value.find(
|
||||||
(province) => province.name === name
|
(province) => province.id === newTown.provinceFk
|
||||||
).id;
|
);
|
||||||
};
|
formData.townFk = newTown;
|
||||||
|
setTown(newTown, formData);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTown(newTown, data) {
|
||||||
|
if (!newTown) return;
|
||||||
|
town.value = newTown;
|
||||||
|
data.provinceFk = newTown.provinceFk;
|
||||||
|
data.countryFk = newTown.province.countryFk;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setProvince(id, data) {
|
||||||
|
await provincesFetchDataRef.value.fetch();
|
||||||
|
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
||||||
|
if (!newProvince) return;
|
||||||
|
|
||||||
|
data.countryFk = newProvince.countryFk;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
ref="townsFetchDataRef"
|
|
||||||
@on-fetch="(data) => (townsLocationOptions = data)"
|
|
||||||
auto-load
|
|
||||||
url="Towns/location"
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="provincesFetchDataRef"
|
ref="provincesFetchDataRef"
|
||||||
@on-fetch="(data) => (provincesOptions = data)"
|
@on-fetch="(data) => (provincesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Provinces"
|
url="Provinces/location"
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
@on-fetch="(data) => (countriesOptions = data)"
|
@on-fetch="(data) => (countriesOptions = data)"
|
||||||
|
@ -88,10 +87,11 @@ const onProvinceCreated = async ({ name }, formData) => {
|
||||||
:title="t('New postcode')"
|
:title="t('New postcode')"
|
||||||
:subtitle="t('Please, ensure you put the correct data!')"
|
:subtitle="t('Please, ensure you put the correct data!')"
|
||||||
:form-initial-data="postcodeFormData"
|
:form-initial-data="postcodeFormData"
|
||||||
|
:mapper="(data) => (data.townFk = data.townFk.id) && data"
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Postcode')"
|
:label="t('Postcode')"
|
||||||
v-model="data.code"
|
v-model="data.code"
|
||||||
|
@ -99,38 +99,43 @@ const onProvinceCreated = async ({ name }, formData) => {
|
||||||
/>
|
/>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('City')"
|
:label="t('City')"
|
||||||
:options="townsLocationOptions"
|
url="Towns/location"
|
||||||
|
@update:model-value="(value) => setTown(value, data)"
|
||||||
v-model="data.townFk"
|
v-model="data.townFk"
|
||||||
hide-selected
|
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
:rules="validate('postcode.city')"
|
:rules="validate('postcode.city')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:roles-allowed-to-create="['deliveryAssistant']"
|
||||||
|
:emit-value="false"
|
||||||
|
clearable
|
||||||
>
|
>
|
||||||
|
<template #option="{ itemProps, opt }">
|
||||||
|
<QItem v-bind="itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ opt.province.name }},
|
||||||
|
{{ opt.province.country.name }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateNewCityForm @on-data-saved="onCityCreated($event, data)" />
|
<CreateNewCityForm
|
||||||
|
@on-data-saved="
|
||||||
|
(_, requestResponse) =>
|
||||||
|
onCityCreated(requestResponse, data)
|
||||||
|
"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnSelectDialog>
|
</VnSelectDialog>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-xl">
|
<VnRow>
|
||||||
<VnSelectDialog
|
<VnSelectProvince
|
||||||
:label="t('Province')"
|
@update:model-value="(value) => setProvince(value, data)"
|
||||||
:options="provincesOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
:rules="validate('postcode.provinceFk')"
|
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
|
||||||
>
|
|
||||||
<template #form>
|
|
||||||
<CreateNewProvinceForm
|
|
||||||
@on-data-saved="onProvinceCreated($event, data)"
|
|
||||||
/>
|
/>
|
||||||
</template> </VnSelectDialog
|
<VnSelect
|
||||||
></VnRow>
|
|
||||||
<VnRow class="row q-gutter-md q-mb-xl"
|
|
||||||
><VnSelect
|
|
||||||
:label="t('Country')"
|
:label="t('Country')"
|
||||||
:options="countriesOptions"
|
:options="countriesOptions"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
|
|
@ -19,8 +19,11 @@ const provinceFormData = reactive({
|
||||||
|
|
||||||
const autonomiesOptions = ref([]);
|
const autonomiesOptions = ref([]);
|
||||||
|
|
||||||
const onDataSaved = (dataSaved) => {
|
const onDataSaved = (dataSaved, requestResponse) => {
|
||||||
emit('onDataSaved', dataSaved);
|
requestResponse.autonomy = autonomiesOptions.value.find(
|
||||||
|
(autonomy) => autonomy.id == requestResponse.autonomyFk
|
||||||
|
);
|
||||||
|
emit('onDataSaved', dataSaved, requestResponse);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -28,7 +31,7 @@ const onDataSaved = (dataSaved) => {
|
||||||
<FetchData
|
<FetchData
|
||||||
@on-fetch="(data) => (autonomiesOptions = data)"
|
@on-fetch="(data) => (autonomiesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="Autonomies"
|
url="Autonomies/location"
|
||||||
/>
|
/>
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
:title="t('New province')"
|
:title="t('New province')"
|
||||||
|
@ -36,10 +39,10 @@ const onDataSaved = (dataSaved) => {
|
||||||
url-create="provinces"
|
url-create="provinces"
|
||||||
model="province"
|
model="province"
|
||||||
:form-initial-data="provinceFormData"
|
:form-initial-data="provinceFormData"
|
||||||
@on-data-saved="onDataSaved($event)"
|
@on-data-saved="onDataSaved"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Name')"
|
:label="t('Name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
|
@ -53,7 +56,16 @@ const onDataSaved = (dataSaved) => {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="data.autonomyFk"
|
v-model="data.autonomyFk"
|
||||||
:rules="validate('province.autonomyFk')"
|
:rules="validate('province.autonomyFk')"
|
||||||
/>
|
>
|
||||||
|
<template #option="{ itemProps, opt }">
|
||||||
|
<QItem v-bind="itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||||
|
<QItemLabel caption> {{ opt.country.name }} </QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModelPopup>
|
</FormModelPopup>
|
||||||
|
|
|
@ -53,7 +53,7 @@ const onDataSaved = (dataSaved) => {
|
||||||
@on-data-saved="onDataSaved($event)"
|
@on-data-saved="onDataSaved($event)"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Identifier')"
|
:label="t('Identifier')"
|
||||||
v-model="data.thermographId"
|
v-model="data.thermographId"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { computed, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter, onBeforeRouteLeave } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
|
@ -97,6 +97,19 @@ defineExpose({
|
||||||
vnPaginateRef,
|
vnPaginateRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeRouteLeave((to, from, next) => {
|
||||||
|
if (hasChanges.value)
|
||||||
|
quasar.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('globals.unsavedPopup.title'),
|
||||||
|
message: t('globals.unsavedPopup.subtitle'),
|
||||||
|
promise: () => next(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
else next();
|
||||||
|
});
|
||||||
|
|
||||||
async function fetch(data) {
|
async function fetch(data) {
|
||||||
resetData(data);
|
resetData(data);
|
||||||
emit('onFetch', data);
|
emit('onFetch', data);
|
||||||
|
|
|
@ -245,14 +245,14 @@ const makeRequest = async () => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<QOptionGroup
|
<QOptionGroup
|
||||||
:options="uploadMethodsOptions"
|
:options="uploadMethodsOptions"
|
||||||
type="radio"
|
type="radio"
|
||||||
v-model="uploadMethodSelected"
|
v-model="uploadMethodSelected"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<QFile
|
<QFile
|
||||||
v-if="uploadMethodSelected === 'computer'"
|
v-if="uploadMethodSelected === 'computer'"
|
||||||
ref="inputFileRef"
|
ref="inputFileRef"
|
||||||
|
@ -287,7 +287,7 @@ const makeRequest = async () => {
|
||||||
placeholder="https://"
|
placeholder="https://"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Orientation')"
|
:label="t('Orientation')"
|
||||||
:options="viewportTypes"
|
:options="viewportTypes"
|
||||||
|
|
|
@ -82,7 +82,7 @@ const closeForm = () => {
|
||||||
<span class="title">{{ t('Edit') }}</span>
|
<span class="title">{{ t('Edit') }}</span>
|
||||||
<span class="countLines">{{ ` ${rows.length} ` }}</span>
|
<span class="countLines">{{ ` ${rows.length} ` }}</span>
|
||||||
<span class="title">{{ t('buy(s)') }}</span>
|
<span class="title">{{ t('buy(s)') }}</span>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Field to edit')"
|
:label="t('Field to edit')"
|
||||||
:options="fieldsOptions"
|
:options="fieldsOptions"
|
||||||
|
|
|
@ -151,7 +151,7 @@ const selectItem = ({ id }) => {
|
||||||
<QIcon name="close" size="sm" />
|
<QIcon name="close" size="sm" />
|
||||||
</span>
|
</span>
|
||||||
<h1 class="title">{{ t('Filter item') }}</h1>
|
<h1 class="title">{{ t('Filter item') }}</h1>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput :label="t('entry.buys.name')" v-model="itemFilterParams.name" />
|
<VnInput :label="t('entry.buys.name')" v-model="itemFilterParams.name" />
|
||||||
<VnInput :label="t('entry.buys.size')" v-model="itemFilterParams.size" />
|
<VnInput :label="t('entry.buys.size')" v-model="itemFilterParams.size" />
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
|
|
@ -144,7 +144,7 @@ const selectTravel = ({ id }) => {
|
||||||
<QIcon name="close" size="sm" />
|
<QIcon name="close" size="sm" />
|
||||||
</span>
|
</span>
|
||||||
<h1 class="title">{{ t('Filter travels') }}</h1>
|
<h1 class="title">{{ t('Filter travels') }}</h1>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('entry.basicData.agency')"
|
:label="t('entry.basicData.agency')"
|
||||||
:options="agenciesOptions"
|
:options="agenciesOptions"
|
||||||
|
|
|
@ -100,7 +100,6 @@ const isResetting = ref(false);
|
||||||
const hasChanges = ref(!$props.observeFormChanges);
|
const hasChanges = ref(!$props.observeFormChanges);
|
||||||
const originalData = ref({});
|
const originalData = ref({});
|
||||||
const formData = computed(() => state.get(modelValue));
|
const formData = computed(() => state.get(modelValue));
|
||||||
const formUrl = computed(() => $props.url);
|
|
||||||
const defaultButtons = computed(() => ({
|
const defaultButtons = computed(() => ({
|
||||||
save: {
|
save: {
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
|
@ -148,19 +147,22 @@ if (!$props.url)
|
||||||
(val) => updateAndEmit('onFetch', val)
|
(val) => updateAndEmit('onFetch', val)
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(formUrl, async () => {
|
watch(
|
||||||
|
() => [$props.url, $props.filter],
|
||||||
|
async () => {
|
||||||
originalData.value = null;
|
originalData.value = null;
|
||||||
reset();
|
reset();
|
||||||
await fetch();
|
await fetch();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
onBeforeRouteLeave((to, from, next) => {
|
onBeforeRouteLeave((to, from, next) => {
|
||||||
if (hasChanges.value && $props.observeFormChanges)
|
if (hasChanges.value && $props.observeFormChanges)
|
||||||
quasar.dialog({
|
quasar.dialog({
|
||||||
component: VnConfirm,
|
component: VnConfirm,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
title: t('Unsaved changes will be lost'),
|
title: t('globals.unsavedPopup.title'),
|
||||||
message: t('Are you sure exit without saving?'),
|
message: t('globals.unsavedPopup.subtitle'),
|
||||||
promise: () => next(),
|
promise: () => next(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -356,8 +358,3 @@ defineExpose({
|
||||||
padding: 32px;
|
padding: 32px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
|
||||||
es:
|
|
||||||
Unsaved changes will be lost: Los cambios que no haya guardado se perderán
|
|
||||||
Are you sure exit without saving?: ¿Seguro que quiere salir sin guardar?
|
|
||||||
</i18n>
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ const getCategoryClass = (category, params) => {
|
||||||
|
|
||||||
const getSelectedTagValues = async (tag) => {
|
const getSelectedTagValues = async (tag) => {
|
||||||
try {
|
try {
|
||||||
|
if (!tag?.selectedTag?.id) return;
|
||||||
tag.value = null;
|
tag.value = null;
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['value'],
|
fields: ['value'],
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { useQuasar } from 'quasar';
|
||||||
import PinnedModules from './PinnedModules.vue';
|
import PinnedModules from './PinnedModules.vue';
|
||||||
import UserPanel from 'components/UserPanel.vue';
|
import UserPanel from 'components/UserPanel.vue';
|
||||||
import VnBreadcrumbs from './common/VnBreadcrumbs.vue';
|
import VnBreadcrumbs from './common/VnBreadcrumbs.vue';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnAvatar from './ui/VnAvatar.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -72,22 +72,13 @@ const pinnedModulesRef = ref();
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
<PinnedModules ref="pinnedModulesRef" />
|
<PinnedModules ref="pinnedModulesRef" />
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<QBtn
|
<QBtn class="q-pa-none" rounded dense flat no-wrap id="user">
|
||||||
:class="{ 'q-pa-none': quasar.platform.is.mobile }"
|
<VnAvatar
|
||||||
rounded
|
:worker-id="user.id"
|
||||||
dense
|
:title="user.name"
|
||||||
flat
|
size="lg"
|
||||||
no-wrap
|
color="transparent"
|
||||||
id="user"
|
|
||||||
>
|
|
||||||
<QAvatar size="lg">
|
|
||||||
<VnImg
|
|
||||||
:id="user.id"
|
|
||||||
collection="user"
|
|
||||||
size="160x160"
|
|
||||||
:zoom-size="null"
|
|
||||||
/>
|
/>
|
||||||
</QAvatar>
|
|
||||||
<QTooltip bottom>
|
<QTooltip bottom>
|
||||||
{{ t('globals.userPanel') }}
|
{{ t('globals.userPanel') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
|
|
@ -15,7 +15,7 @@ const props = defineProps({
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
warehouseFk: {
|
warehouseFk: {
|
||||||
type: Boolean,
|
type: Number,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,7 @@ const props = defineProps({
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const regularizeFormData = reactive({
|
const regularizeFormData = reactive({
|
||||||
itemFk: props.itemFk,
|
itemFk: Number(props.itemFk),
|
||||||
warehouseFk: props.warehouseFk,
|
warehouseFk: props.warehouseFk,
|
||||||
quantity: null,
|
quantity: null,
|
||||||
});
|
});
|
||||||
|
@ -49,18 +49,19 @@ const onDataSaved = (data) => {
|
||||||
@on-data-saved="onDataSaved($event)"
|
@on-data-saved="onDataSaved($event)"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<QInput
|
<QInput
|
||||||
:label="t('Type the visible quantity')"
|
:label="t('Type the visible quantity')"
|
||||||
v-model.number="data.quantity"
|
v-model.number="data.quantity"
|
||||||
|
type="number"
|
||||||
autofocus
|
autofocus
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Warehouse')"
|
:label="t('Warehouse')"
|
||||||
v-model="data.warehouseFk"
|
v-model.number="data.warehouseFk"
|
||||||
:options="warehousesOptions"
|
:options="warehousesOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
|
|
@ -124,7 +124,7 @@ const makeInvoice = async () => {
|
||||||
:default-cancel-button="false"
|
:default-cancel-button="false"
|
||||||
>
|
>
|
||||||
<template #form-inputs>
|
<template #form-inputs>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Client')"
|
:label="t('Client')"
|
||||||
:options="clientsOptions"
|
:options="clientsOptions"
|
||||||
|
@ -160,7 +160,7 @@ const makeInvoice = async () => {
|
||||||
:required="true"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Class')"
|
:label="t('Class')"
|
||||||
:options="siiTypeInvoiceOutsOptions"
|
:options="siiTypeInvoiceOutsOptions"
|
||||||
|
@ -191,9 +191,12 @@ const makeInvoice = async () => {
|
||||||
:required="true"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div>
|
<div>
|
||||||
<QCheckbox :label="t('Bill destination client')" v-model="checked" />
|
<QCheckbox
|
||||||
|
:label="t('Bill destination client')"
|
||||||
|
v-model="checked"
|
||||||
|
/>
|
||||||
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
||||||
<QTooltip>{{ t('transferInvoiceInfo') }}</QTooltip>
|
<QTooltip>{{ t('transferInvoiceInfo') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
|
|
|
@ -11,8 +11,8 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import { useClipboard } from 'src/composables/useClipboard';
|
import { useClipboard } from 'src/composables/useClipboard';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
import VnAvatar from './ui/VnAvatar.vue';
|
||||||
|
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
|
@ -136,7 +136,7 @@ const isEmployee = computed(() => useRole().isEmployee());
|
||||||
@update:model-value="saveLanguage"
|
@update:model-value="saveLanguage"
|
||||||
:label="t(`globals.lang['${userLocale}']`)"
|
:label="t(`globals.lang['${userLocale}']`)"
|
||||||
icon="public"
|
icon="public"
|
||||||
color="orange"
|
color="primary"
|
||||||
false-value="es"
|
false-value="es"
|
||||||
true-value="en"
|
true-value="en"
|
||||||
/>
|
/>
|
||||||
|
@ -145,7 +145,7 @@ const isEmployee = computed(() => useRole().isEmployee());
|
||||||
@update:model-value="saveDarkMode"
|
@update:model-value="saveDarkMode"
|
||||||
:label="t(`globals.darkMode`)"
|
:label="t(`globals.darkMode`)"
|
||||||
checked-icon="dark_mode"
|
checked-icon="dark_mode"
|
||||||
color="orange"
|
color="primary"
|
||||||
unchecked-icon="light_mode"
|
unchecked-icon="light_mode"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -153,10 +153,20 @@ const isEmployee = computed(() => useRole().isEmployee());
|
||||||
<QSeparator vertical inset class="q-mx-lg" />
|
<QSeparator vertical inset class="q-mx-lg" />
|
||||||
|
|
||||||
<div class="col column items-center q-mb-sm">
|
<div class="col column items-center q-mb-sm">
|
||||||
<QAvatar size="80px">
|
<VnAvatar
|
||||||
<VnImg :id="user.id" collection="user" size="160x160" />
|
:worker-id="user.id"
|
||||||
</QAvatar>
|
:title="user.name"
|
||||||
|
size="xxl"
|
||||||
|
color="transparent"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
v-if="isEmployee"
|
||||||
|
class="q-mt-sm q-px-md"
|
||||||
|
:to="`/worker/${user.id}`"
|
||||||
|
color="primary"
|
||||||
|
:label="t('My account')"
|
||||||
|
dense
|
||||||
|
/>
|
||||||
<div class="text-subtitle1 q-mt-md">
|
<div class="text-subtitle1 q-mt-md">
|
||||||
<strong>{{ user.nickname }}</strong>
|
<strong>{{ user.nickname }}</strong>
|
||||||
</div>
|
</div>
|
||||||
|
@ -168,7 +178,7 @@ const isEmployee = computed(() => useRole().isEmployee());
|
||||||
</div>
|
</div>
|
||||||
<QBtn
|
<QBtn
|
||||||
id="logout"
|
id="logout"
|
||||||
color="orange"
|
color="primary"
|
||||||
flat
|
flat
|
||||||
:label="t('globals.logOut')"
|
:label="t('globals.logOut')"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
@ -260,3 +270,7 @@ const isEmployee = computed(() => useRole().isEmployee());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
My account: Mi cuenta
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['onProvinceCreated']);
|
||||||
|
const provinceFk = defineModel({ type: Number });
|
||||||
|
watch(provinceFk, async () => await provincesFetchDataRef.value.fetch());
|
||||||
|
|
||||||
|
const { validate } = useValidator();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const provincesOptions = ref();
|
||||||
|
const provincesFetchDataRef = ref();
|
||||||
|
|
||||||
|
async function onProvinceCreated(_, data) {
|
||||||
|
await provincesFetchDataRef.value.fetch();
|
||||||
|
provinceFk.value = data.id;
|
||||||
|
emit('onProvinceCreated', data);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
ref="provincesFetchDataRef"
|
||||||
|
:filter="{ include: { relation: 'country' } }"
|
||||||
|
@on-fetch="(data) => (provincesOptions = data)"
|
||||||
|
auto-load
|
||||||
|
url="Provinces"
|
||||||
|
/>
|
||||||
|
<VnSelectDialog
|
||||||
|
:label="t('Province')"
|
||||||
|
:options="provincesOptions"
|
||||||
|
hide-selected
|
||||||
|
v-model="provinceFk"
|
||||||
|
:rules="validate && validate('postcode.provinceFk')"
|
||||||
|
:roles-allowed-to-create="['deliveryAssistant']"
|
||||||
|
>
|
||||||
|
<template #option="{ itemProps, opt }">
|
||||||
|
<QItem v-bind="itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||||
|
<QItemLabel caption> {{ opt.country.name }} </QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
<template #form>
|
||||||
|
<CreateNewProvinceForm @on-data-saved="onProvinceCreated" />
|
||||||
|
</template>
|
||||||
|
</VnSelectDialog>
|
||||||
|
</template>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Province: Provincia
|
||||||
|
</i18n>
|
|
@ -7,9 +7,11 @@ import { dashIfEmpty } from 'src/filters';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnSelectCache from 'components/common/VnSelectCache.vue';
|
import VnSelectCache from 'components/common/VnSelectCache.vue';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
|
import VnInputNumber from 'components/common/VnInputNumber.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||||
import VnComponent from 'components/common/VnComponent.vue';
|
import VnComponent from 'components/common/VnComponent.vue';
|
||||||
|
import VnUserLink from 'components/ui/VnUserLink.vue';
|
||||||
|
|
||||||
const model = defineModel(undefined, { required: true });
|
const model = defineModel(undefined, { required: true });
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -66,7 +68,7 @@ const defaultComponents = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
number: {
|
number: {
|
||||||
component: markRaw(VnInput),
|
component: markRaw(VnInputNumber),
|
||||||
attrs: {
|
attrs: {
|
||||||
disable: !$props.isEditable,
|
disable: !$props.isEditable,
|
||||||
class: 'fit',
|
class: 'fit',
|
||||||
|
@ -98,14 +100,14 @@ const defaultComponents = {
|
||||||
},
|
},
|
||||||
checkbox: {
|
checkbox: {
|
||||||
component: markRaw(QCheckbox),
|
component: markRaw(QCheckbox),
|
||||||
attrs: (prop) => {
|
attrs: ({ model }) => {
|
||||||
const defaultAttrs = {
|
const defaultAttrs = {
|
||||||
disable: !$props.isEditable,
|
disable: !$props.isEditable,
|
||||||
'model-value': Boolean(prop),
|
'model-value': Boolean(model),
|
||||||
class: 'no-padding fit',
|
class: 'no-padding fit',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof prop == 'number') {
|
if (typeof model == 'number') {
|
||||||
defaultAttrs['true-value'] = 1;
|
defaultAttrs['true-value'] = 1;
|
||||||
defaultAttrs['false-value'] = 0;
|
defaultAttrs['false-value'] = 0;
|
||||||
}
|
}
|
||||||
|
@ -126,6 +128,9 @@ const defaultComponents = {
|
||||||
icon: {
|
icon: {
|
||||||
component: markRaw(QIcon),
|
component: markRaw(QIcon),
|
||||||
},
|
},
|
||||||
|
userLink: {
|
||||||
|
component: markRaw(VnUserLink),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const value = computed(() => {
|
const value = computed(() => {
|
||||||
|
@ -146,7 +151,7 @@ const col = computed(() => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
(newColumn.name.startsWith('is') || newColumn.name.startsWith('has')) &&
|
(/^is[A-Z]/.test(newColumn.name) || /^has[A-Z]/.test(newColumn.name)) &&
|
||||||
newColumn.component == null
|
newColumn.component == null
|
||||||
)
|
)
|
||||||
newColumn.component = 'checkbox';
|
newColumn.component = 'checkbox';
|
||||||
|
@ -163,14 +168,14 @@ const components = computed(() => $props.components ?? defaultComponents);
|
||||||
v-if="col.before"
|
v-if="col.before"
|
||||||
:prop="col.before"
|
:prop="col.before"
|
||||||
:components="components"
|
:components="components"
|
||||||
:value="model"
|
:value="{ row, model }"
|
||||||
v-model="model"
|
v-model="model"
|
||||||
/>
|
/>
|
||||||
<VnComponent
|
<VnComponent
|
||||||
v-if="col.component"
|
v-if="col.component"
|
||||||
:prop="col"
|
:prop="col"
|
||||||
:components="components"
|
:components="components"
|
||||||
:value="model"
|
:value="{ row, model }"
|
||||||
v-model="model"
|
v-model="model"
|
||||||
/>
|
/>
|
||||||
<span :title="value" v-else>{{ value }}</span>
|
<span :title="value" v-else>{{ value }}</span>
|
||||||
|
@ -178,7 +183,7 @@ const components = computed(() => $props.components ?? defaultComponents);
|
||||||
v-if="col.after"
|
v-if="col.after"
|
||||||
:prop="col.after"
|
:prop="col.after"
|
||||||
:components="components"
|
:components="components"
|
||||||
:value="model"
|
:value="{ row, model }"
|
||||||
v-model="model"
|
v-model="model"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,6 +10,8 @@ import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
||||||
|
|
||||||
|
defineExpose({ addFilter });
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
column: {
|
column: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -32,7 +34,7 @@ const model = defineModel(undefined, { required: true });
|
||||||
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
||||||
const columnFilter = computed(() => $props.column?.columnFilter);
|
const columnFilter = computed(() => $props.column?.columnFilter);
|
||||||
|
|
||||||
const updateEvent = { 'update:modelValue': addFilter };
|
const updateEvent = { 'update:modelValue': addFilter, remove: () => addFilter(null) };
|
||||||
const enterEvent = {
|
const enterEvent = {
|
||||||
'keyup.enter': () => addFilter(model.value),
|
'keyup.enter': () => addFilter(model.value),
|
||||||
remove: () => addFilter(null),
|
remove: () => addFilter(null),
|
||||||
|
@ -45,7 +47,7 @@ const defaultAttrs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const forceAttrs = {
|
const forceAttrs = {
|
||||||
label: $props.showTitle ? '' : $props.column.label,
|
label: $props.showTitle ? '' : columnFilter.value?.label ?? $props.column.label,
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectComponent = {
|
const selectComponent = {
|
||||||
|
|
|
@ -108,6 +108,8 @@ const CrudModelRef = ref({});
|
||||||
const showForm = ref(false);
|
const showForm = ref(false);
|
||||||
const splittedColumns = ref({ columns: [] });
|
const splittedColumns = ref({ columns: [] });
|
||||||
const columnsVisibilitySkiped = ref();
|
const columnsVisibilitySkiped = ref();
|
||||||
|
const createForm = ref();
|
||||||
|
|
||||||
const tableModes = [
|
const tableModes = [
|
||||||
{
|
{
|
||||||
icon: 'view_column',
|
icon: 'view_column',
|
||||||
|
@ -124,7 +126,7 @@ const tableModes = [
|
||||||
];
|
];
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
setUserParams(route.query[$props.searchUrl]);
|
setUserParams(route.query[$props.searchUrl]);
|
||||||
hasParams.value = Object.keys(params.value).length !== 0;
|
hasParams.value = params.value && Object.keys(params.value).length !== 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -139,6 +141,14 @@ onMounted(() => {
|
||||||
.map((c) => c.name),
|
.map((c) => c.name),
|
||||||
...['tableActions'],
|
...['tableActions'],
|
||||||
];
|
];
|
||||||
|
createForm.value = $props.create;
|
||||||
|
if ($props.create && route?.query?.createForm) {
|
||||||
|
showForm.value = true;
|
||||||
|
createForm.value = {
|
||||||
|
...createForm.value,
|
||||||
|
...{ formInitialData: JSON.parse(route?.query?.createForm) },
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -154,13 +164,16 @@ watch(
|
||||||
|
|
||||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||||
|
|
||||||
function setUserParams(watchedParams) {
|
function setUserParams(watchedParams, watchedOrder) {
|
||||||
if (!watchedParams) return;
|
if (!watchedParams) return;
|
||||||
|
|
||||||
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
||||||
const filter = JSON.parse(watchedParams?.filter);
|
const filter =
|
||||||
|
typeof watchedParams?.filter == 'string'
|
||||||
|
? JSON.parse(watchedParams?.filter ?? '{}')
|
||||||
|
: watchedParams?.filter;
|
||||||
const where = filter?.where;
|
const where = filter?.where;
|
||||||
const order = filter?.order;
|
const order = watchedOrder ?? filter?.order;
|
||||||
|
|
||||||
watchedParams = { ...watchedParams, ...where };
|
watchedParams = { ...watchedParams, ...where };
|
||||||
delete watchedParams.filter;
|
delete watchedParams.filter;
|
||||||
|
@ -281,6 +294,7 @@ defineExpose({
|
||||||
v-model="params"
|
v-model="params"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:redirect="!!redirect"
|
:redirect="!!redirect"
|
||||||
|
@set-user-params="setUserParams"
|
||||||
>
|
>
|
||||||
<template #body>
|
<template #body>
|
||||||
<div
|
<div
|
||||||
|
@ -313,11 +327,6 @@ defineExpose({
|
||||||
:params="params"
|
:params="params"
|
||||||
:columns="splittedColumns.columns"
|
:columns="splittedColumns.columns"
|
||||||
/>
|
/>
|
||||||
<slot
|
|
||||||
name="moreFilterPanel"
|
|
||||||
:params="params"
|
|
||||||
:columns="splittedColumns.columns"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
|
@ -328,6 +337,7 @@ defineExpose({
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
:limit="20"
|
:limit="20"
|
||||||
ref="CrudModelRef"
|
ref="CrudModelRef"
|
||||||
|
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:disable-infinite-scroll="isTableMode"
|
:disable-infinite-scroll="isTableMode"
|
||||||
@save-changes="reload"
|
@save-changes="reload"
|
||||||
|
@ -365,7 +375,7 @@ defineExpose({
|
||||||
<template #top-left v-if="!$props.withoutHeader">
|
<template #top-left v-if="!$props.withoutHeader">
|
||||||
<slot name="top-left"></slot>
|
<slot name="top-left"></slot>
|
||||||
</template>
|
</template>
|
||||||
<template #top-right>
|
<template #top-right v-if="!$props.withoutHeader">
|
||||||
<VnVisibleColumn
|
<VnVisibleColumn
|
||||||
v-if="isTableMode"
|
v-if="isTableMode"
|
||||||
v-model="splittedColumns.columns"
|
v-model="splittedColumns.columns"
|
||||||
|
@ -382,7 +392,6 @@ defineExpose({
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="$props.rightSearch"
|
v-if="$props.rightSearch"
|
||||||
icon="filter_alt"
|
icon="filter_alt"
|
||||||
title="asd"
|
|
||||||
class="bg-vn-section-color q-ml-md"
|
class="bg-vn-section-color q-ml-md"
|
||||||
dense
|
dense
|
||||||
@click="stateStore.toggleRightDrawer()"
|
@click="stateStore.toggleRightDrawer()"
|
||||||
|
@ -393,7 +402,7 @@ defineExpose({
|
||||||
<div
|
<div
|
||||||
class="column self-start q-ml-xs ellipsis"
|
class="column self-start q-ml-xs ellipsis"
|
||||||
:class="`text-${col?.align ?? 'left'}`"
|
:class="`text-${col?.align ?? 'left'}`"
|
||||||
style="height: 75px"
|
:style="$props.columnSearch ? 'height: 75px' : ''"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="row items-center no-wrap"
|
class="row items-center no-wrap"
|
||||||
|
@ -434,7 +443,7 @@ defineExpose({
|
||||||
</VnTableChip>
|
</VnTableChip>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell="{ col, row }">
|
<template #body-cell="{ col, row, rowIndex }">
|
||||||
<!-- Columns -->
|
<!-- Columns -->
|
||||||
<QTd
|
<QTd
|
||||||
auto-width
|
auto-width
|
||||||
|
@ -447,7 +456,12 @@ defineExpose({
|
||||||
rowCtrlClickFunction($event, row)
|
rowCtrlClickFunction($event, row)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<slot :name="`column-${col.name}`" :col="col" :row="row">
|
<slot
|
||||||
|
:name="`column-${col.name}`"
|
||||||
|
:col="col"
|
||||||
|
:row="row"
|
||||||
|
:row-index="rowIndex"
|
||||||
|
>
|
||||||
<VnTableColumn
|
<VnTableColumn
|
||||||
:column="col"
|
:column="col"
|
||||||
:row="row"
|
:row="row"
|
||||||
|
@ -467,7 +481,6 @@ defineExpose({
|
||||||
>
|
>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-for="(btn, index) of col.actions"
|
v-for="(btn, index) of col.actions"
|
||||||
v-show="btn.show ? btn.show(row) : true"
|
|
||||||
:key="index"
|
:key="index"
|
||||||
:title="btn.title"
|
:title="btn.title"
|
||||||
:icon="btn.icon"
|
:icon="btn.icon"
|
||||||
|
@ -478,6 +491,11 @@ defineExpose({
|
||||||
? 'text-primary-light'
|
? 'text-primary-light'
|
||||||
: 'color-vn-text '
|
: 'color-vn-text '
|
||||||
"
|
"
|
||||||
|
:style="`visibility: ${
|
||||||
|
(btn.show && btn.show(row)) ?? true
|
||||||
|
? 'visible'
|
||||||
|
: 'hidden'
|
||||||
|
}`"
|
||||||
@click="btn.action(row)"
|
@click="btn.action(row)"
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
|
@ -535,7 +553,9 @@ defineExpose({
|
||||||
:class="$props.cardClass"
|
:class="$props.cardClass"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-for="col of splittedColumns.cardVisible"
|
v-for="(
|
||||||
|
col, index
|
||||||
|
) of splittedColumns.cardVisible"
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
class="fields"
|
class="fields"
|
||||||
>
|
>
|
||||||
|
@ -556,6 +576,7 @@ defineExpose({
|
||||||
:name="`column-${col.name}`"
|
:name="`column-${col.name}`"
|
||||||
:col="col"
|
:col="col"
|
||||||
:row="row"
|
:row="row"
|
||||||
|
:row-index="index"
|
||||||
>
|
>
|
||||||
<VnTableColumn
|
<VnTableColumn
|
||||||
:column="col"
|
:column="col"
|
||||||
|
@ -604,20 +625,26 @@ defineExpose({
|
||||||
<QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2">
|
||||||
<QBtn @click="showForm = !showForm" color="primary" fab icon="add" />
|
<QBtn @click="showForm = !showForm" color="primary" fab icon="add" />
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ create.title }}
|
{{ createForm.title }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
v-bind="create"
|
v-bind="createForm"
|
||||||
:model="$attrs['data-key'] + 'Create'"
|
:model="$attrs['data-key'] + 'Create'"
|
||||||
@on-data-saved="(_, res) => create.onDataSaved(res)"
|
@on-data-saved="(_, res) => createForm.onDataSaved(res)"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
<div class="grid-create">
|
<div class="grid-create">
|
||||||
<VnTableColumn
|
<slot
|
||||||
v-for="column of splittedColumns.create"
|
v-for="column of splittedColumns.create"
|
||||||
:key="column.name"
|
:key="column.name"
|
||||||
|
:name="`column-create-${column.name}`"
|
||||||
|
:data="data"
|
||||||
|
:column-name="column.name"
|
||||||
|
:label="column.label"
|
||||||
|
>
|
||||||
|
<VnTableColumn
|
||||||
:column="column"
|
:column="column"
|
||||||
:row="{}"
|
:row="{}"
|
||||||
default="input"
|
default="input"
|
||||||
|
@ -625,6 +652,7 @@ defineExpose({
|
||||||
:show-label="true"
|
:show-label="true"
|
||||||
component-prop="columnCreate"
|
component-prop="columnCreate"
|
||||||
/>
|
/>
|
||||||
|
</slot>
|
||||||
<slot name="more-create-dialog" :data="data" />
|
<slot name="more-create-dialog" :data="data" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -65,7 +65,7 @@ async function fetchViewConfigData() {
|
||||||
const userConfig = await getConfig('UserConfigViews', {
|
const userConfig = await getConfig('UserConfigViews', {
|
||||||
where: {
|
where: {
|
||||||
...defaultFilter.where,
|
...defaultFilter.where,
|
||||||
...{ userFk: user.id },
|
...{ userFk: user.value.id },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ async function fetchViewConfigData() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.err('Error fetching config view data', err);
|
console.error('Error fetching config view data', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ const stateStore = useStateStore();
|
||||||
</div>
|
</div>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea class="fit text-grey-8">
|
<QScrollArea class="fit">
|
||||||
<div id="right-panel"></div>
|
<div id="right-panel"></div>
|
||||||
<slot v-if="!hasContent" name="right-panel" />
|
<slot v-if="!hasContent" name="right-panel" />
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
|
|
|
@ -84,7 +84,7 @@ const fetchViewConfigData = async () => {
|
||||||
setUserConfigViewData(defaultColumns);
|
setUserConfigViewData(defaultColumns);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.err('Error fetching config view data', err);
|
console.error('Error fetching config view data', err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,7 @@ const props = defineProps({
|
||||||
descriptor: { type: Object, required: true },
|
descriptor: { type: Object, required: true },
|
||||||
filterPanel: { type: Object, default: undefined },
|
filterPanel: { type: Object, default: undefined },
|
||||||
searchDataKey: { type: String, default: undefined },
|
searchDataKey: { type: String, default: undefined },
|
||||||
searchUrl: { type: String, default: undefined },
|
searchbarProps: { type: Object, default: undefined },
|
||||||
searchbarLabel: { type: String, default: '' },
|
|
||||||
searchbarInfo: { type: String, default: '' },
|
|
||||||
searchCustomRouteRedirect: { type: String, default: undefined },
|
|
||||||
searchRedirect: { type: Boolean, default: true },
|
|
||||||
searchMakeFetch: { type: Boolean, default: true },
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -65,14 +60,7 @@ if (props.baseUrl) {
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<slot name="searchbar" v-if="props.searchDataKey">
|
<slot name="searchbar" v-if="props.searchDataKey">
|
||||||
<VnSearchbar
|
<VnSearchbar :data-key="props.searchDataKey" v-bind="props.searchbarProps" />
|
||||||
:data-key="props.searchDataKey"
|
|
||||||
:url="props.searchUrl"
|
|
||||||
:label="props.searchbarLabel"
|
|
||||||
:info="props.searchbarInfo"
|
|
||||||
:custom-route-redirect-name="searchCustomRouteRedirect"
|
|
||||||
:redirect="searchRedirect"
|
|
||||||
/>
|
|
||||||
</slot>
|
</slot>
|
||||||
<slot v-else name="searchbar" />
|
<slot v-else name="searchbar" />
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
|
|
|
@ -35,7 +35,7 @@ function mix(toComponent) {
|
||||||
...toComponent,
|
...toComponent,
|
||||||
...toValueAttrs(customComponent?.forceAttrs),
|
...toValueAttrs(customComponent?.forceAttrs),
|
||||||
},
|
},
|
||||||
event: event ?? customComponent?.event,
|
event: { ...customComponent?.event, ...event },
|
||||||
};
|
};
|
||||||
return mixed;
|
return mixed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { useCapitalize } from 'src/composables/useCapitalize';
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
modelValue: { type: [String, Number], default: '' },
|
|
||||||
});
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
|
||||||
|
|
||||||
const amount = computed({
|
|
||||||
get() {
|
|
||||||
return props.modelValue;
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
emit('update:modelValue', val);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<VnInput
|
|
||||||
v-model="amount"
|
|
||||||
type="number"
|
|
||||||
step="any"
|
|
||||||
:label="useCapitalize(t('amount'))"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<i18n>
|
|
||||||
es:
|
|
||||||
amount: importe
|
|
||||||
</i18n>
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<script setup>
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
const model = defineModel({ type: [Number, String] });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VnInput v-bind="$attrs" v-model.number="model" type="number" />
|
||||||
|
</template>
|
|
@ -50,7 +50,7 @@ const formattedTime = computed({
|
||||||
}
|
}
|
||||||
if (!props.timeOnly) {
|
if (!props.timeOnly) {
|
||||||
const [hh, mm] = time.split(':');
|
const [hh, mm] = time.split(':');
|
||||||
const date = model.value ?? Date.vnNew();
|
const date = new Date(model.value ? model.value : null);
|
||||||
date.setHours(hh, mm, 0);
|
date.setHours(hh, mm, 0);
|
||||||
time = date?.toISOString();
|
time = date?.toISOString();
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ const formattedTime = computed({
|
||||||
function dateToTime(newDate) {
|
function dateToTime(newDate) {
|
||||||
return date.formatDate(new Date(newDate), dateFormat);
|
return date.formatDate(new Date(newDate), dateFormat);
|
||||||
}
|
}
|
||||||
const timeField = ref();
|
|
||||||
watch(
|
watch(
|
||||||
() => model.value,
|
() => model.value,
|
||||||
(val) => (formattedTime.value = val),
|
(val) => (formattedTime.value = val),
|
||||||
|
@ -153,4 +153,3 @@ watch(
|
||||||
es:
|
es:
|
||||||
Open time: Abrir tiempo
|
Open time: Abrir tiempo
|
||||||
</i18n>
|
</i18n>
|
||||||
, nextTick
|
|
||||||
|
|
|
@ -1,23 +1,19 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, toRefs, onMounted, nextTick } from 'vue';
|
import { ref, toRefs, computed, watch, onMounted } from 'vue';
|
||||||
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||||
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||||
const emit = defineEmits(['update:selected', 'update:options']);
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
const emit = defineEmits(['update:modelValue', 'update:options']);
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const postcodesOptions = ref([]);
|
const postcodesOptions = ref([]);
|
||||||
const postcodesOptionsOriginal = ref([]);
|
const postcodesRef = ref(null);
|
||||||
// const postcodesRef = ref(null);
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
postalCodeKey: {
|
modelValue: {
|
||||||
type: String,
|
type: [String, Number, Object],
|
||||||
default: 'postalCode',
|
|
||||||
},
|
|
||||||
location: {
|
|
||||||
type: Object,
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
@ -46,106 +42,74 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const selectedId = ref(null);
|
const { options } = toRefs($props);
|
||||||
const mySelect = ref();
|
const myOptions = ref([]);
|
||||||
const modelValue = ref($props.location[$props.postalCodeKey]);
|
const myOptionsOriginal = ref([]);
|
||||||
const arrayData = useArrayData('postcodes', {
|
|
||||||
url: 'Postcodes/filter',
|
const value = computed({
|
||||||
limit: 1,
|
get() {
|
||||||
|
return $props.modelValue;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
emit(
|
||||||
|
'update:modelValue',
|
||||||
|
postcodesOptions.value.find((p) => p.code === value)
|
||||||
|
);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function sanitizePostcode(data) {
|
onMounted(() => {
|
||||||
return data.map((postcode) => ({
|
locationFilter($props.modelValue);
|
||||||
...postcode,
|
|
||||||
original: postcode,
|
|
||||||
id: sanitizeId(postcode),
|
|
||||||
label: sanitizeLabel(postcode),
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
function sanitizeId(postcode) {
|
|
||||||
return `${postcode.code ?? postcode[$props.postalCodeKey]}_${postcode.provinceFk}_${
|
|
||||||
postcode.countryFk
|
|
||||||
}`;
|
|
||||||
}
|
|
||||||
onMounted(async () => {
|
|
||||||
await retriveOptions();
|
|
||||||
nextTick(() => mySelect.value.showPopup());
|
|
||||||
});
|
});
|
||||||
async function retriveOptions() {
|
|
||||||
let options = [];
|
|
||||||
if (modelValue.value) {
|
|
||||||
await locationFilter(modelValue.value, () => {});
|
|
||||||
options = arrayData.store.data;
|
|
||||||
} else {
|
|
||||||
const { data } = await arrayData.fetch({ updateRouter: false, append: true });
|
|
||||||
options = data;
|
|
||||||
}
|
|
||||||
setOptions(options);
|
|
||||||
}
|
|
||||||
function findOptionById(postcode) {
|
|
||||||
return postcodesOptions.value.find((p) => p.id === postcode);
|
|
||||||
}
|
|
||||||
function setOptions(data) {
|
function setOptions(data) {
|
||||||
postcodesOptions.value = sanitizePostcode(data);
|
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||||
if (modelValue.value) {
|
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||||
const { [$props.postalCodeKey]: code } = $props.location;
|
|
||||||
selectedId.value =
|
|
||||||
findOptionById(sanitizeId({ ...$props.location, code })) ??
|
|
||||||
sanitizePostcode([$props.location])[0];
|
|
||||||
}
|
|
||||||
postcodesOptionsOriginal.value = JSON.parse(JSON.stringify(postcodesOptions.value));
|
|
||||||
}
|
}
|
||||||
|
setOptions(options.value);
|
||||||
|
|
||||||
async function handleInput(value) {
|
watch(options, (newValue) => {
|
||||||
if (value) emit('update:selected', findOptionById(value));
|
setOptions(newValue);
|
||||||
if (modelValue.value) {
|
|
||||||
modelValue.value = value;
|
|
||||||
arrayData.store.userFilter = {};
|
|
||||||
await retriveOptions();
|
|
||||||
mySelect.value.showPopup();
|
|
||||||
} else postcodesOptions.value = postcodesOptionsOriginal.value;
|
|
||||||
}
|
|
||||||
function sanitizeLabel(postcode) {
|
|
||||||
return `${postcode.code ?? postcode[$props.postalCodeKey]} - ${postcode.town}(${
|
|
||||||
postcode.province
|
|
||||||
}), ${postcode.country}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function locationFilter(search, update) {
|
|
||||||
if (search.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let where = { search };
|
|
||||||
arrayData.store.userFilter = { filter: { where } };
|
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
|
||||||
|
|
||||||
update(() => {
|
|
||||||
postcodesOptions.value = sanitizePostcode(arrayData.store.data);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function showLabel(data) {
|
||||||
|
return `${data.code} - ${data.town}(${data.province}), ${data.country}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function locationFilter(search = '') {
|
||||||
|
if (
|
||||||
|
search &&
|
||||||
|
(search.includes('undefined') || search.startsWith(`${$props.modelValue} - `))
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
let where = { search };
|
||||||
|
postcodesRef.value.fetch({ filter: { where }, limit: 30 });
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFetch(data) {
|
||||||
|
postcodesOptions.value = data;
|
||||||
|
}
|
||||||
function onDataSaved(newPostcode) {
|
function onDataSaved(newPostcode) {
|
||||||
postcodesOptions.value.push(newPostcode);
|
postcodesOptions.value.push(newPostcode);
|
||||||
selectedId.value = newPostcode.code ?? newPostcode[$props.postalCodeKey];
|
value.value = newPostcode.code;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
ref="mySelect"
|
v-if="postcodesRef"
|
||||||
option-label="label"
|
:option-label="(opt) => showLabel(opt) ?? 'code'"
|
||||||
option-value="id"
|
:option-value="(opt) => opt.code"
|
||||||
v-model="selectedId"
|
v-model="value"
|
||||||
:options="postcodesOptions"
|
:options="postcodesOptions"
|
||||||
:label="t('Location')"
|
:label="t('Location')"
|
||||||
@update:model-value="handleInput"
|
@update:model-value="handleInput"
|
||||||
:placeholder="t('search_by_postalcode')"
|
:placeholder="t('search_by_postalcode')"
|
||||||
@filter="locationFilter"
|
@input-value="locationFilter"
|
||||||
|
:default-filter="false"
|
||||||
:input-debounce="300"
|
:input-debounce="300"
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
clearable
|
clearable
|
||||||
emit-value
|
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateNewPostcode @on-data-saved="onDataSaved" />
|
<CreateNewPostcode @on-data-saved="onDataSaved" />
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onUnmounted } from 'vue';
|
import { ref, onUnmounted, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
@ -19,6 +19,7 @@ const stateStore = useStateStore();
|
||||||
const validationsStore = useValidator();
|
const validationsStore = useValidator();
|
||||||
const { models } = validationsStore;
|
const { models } = validationsStore;
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
model: {
|
model: {
|
||||||
|
@ -213,7 +214,7 @@ function getLogTree(data) {
|
||||||
}
|
}
|
||||||
nLogs++;
|
nLogs++;
|
||||||
modelLog.logs.push(log);
|
modelLog.logs.push(log);
|
||||||
|
modelLog.summaryId = modelLog.logs[0].summaryId;
|
||||||
// Changes
|
// Changes
|
||||||
const notDelete = log.action != 'delete';
|
const notDelete = log.action != 'delete';
|
||||||
const olds = (notDelete ? log.oldInstance : null) || {};
|
const olds = (notDelete ? log.oldInstance : null) || {};
|
||||||
|
@ -381,6 +382,13 @@ setLogTree();
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
stateStore.rightDrawer = false;
|
stateStore.rightDrawer = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => router.currentRoute.value.params.id,
|
||||||
|
() => {
|
||||||
|
applyFilter();
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -399,9 +407,12 @@ onUnmounted(() => {
|
||||||
@on-fetch="
|
@on-fetch="
|
||||||
(data) =>
|
(data) =>
|
||||||
(actions = data.map((item) => {
|
(actions = data.map((item) => {
|
||||||
|
const changedModel = item.changedModel;
|
||||||
return {
|
return {
|
||||||
locale: useCapitalize(validations[item.changedModel].locale.name),
|
locale: useCapitalize(
|
||||||
value: item.changedModel,
|
validations[changedModel]?.locale?.name ?? changedModel
|
||||||
|
),
|
||||||
|
value: changedModel,
|
||||||
};
|
};
|
||||||
}))
|
}))
|
||||||
"
|
"
|
||||||
|
@ -464,12 +475,17 @@ onUnmounted(() => {
|
||||||
>
|
>
|
||||||
{{ t(modelLog.modelI18n) }}
|
{{ t(modelLog.modelI18n) }}
|
||||||
</QChip>
|
</QChip>
|
||||||
<span class="model-id" v-if="modelLog.summaryId"
|
|
||||||
>#{{ modelLog.summaryId }}</span
|
<span
|
||||||
>
|
class="model-id q-mr-xs"
|
||||||
<span class="model-value" :title="modelLog.showValue">
|
v-if="modelLog.summaryId"
|
||||||
{{ modelLog.showValue }}
|
v-text="`#${modelLog.summaryId}`"
|
||||||
</span>
|
/>
|
||||||
|
<span
|
||||||
|
class="model-value"
|
||||||
|
:title="modelLog.showValue"
|
||||||
|
v-text="modelLog.showValue"
|
||||||
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref, toRefs, computed, watch, onMounted } from 'vue';
|
import { ref, toRefs, computed, watch, onMounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
const emit = defineEmits(['update:modelValue', 'update:options']);
|
const emit = defineEmits(['update:modelValue', 'update:options', 'remove']);
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
|
@ -25,6 +25,10 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
optionFilterValue: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
url: {
|
url: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -45,6 +49,10 @@ const $props = defineProps({
|
||||||
type: Array,
|
type: Array,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
include: {
|
||||||
|
type: [Object, Array],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
where: {
|
where: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -70,7 +78,8 @@ const $props = defineProps({
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const requiredFieldRule = (val) => val ?? t('globals.fieldRequired');
|
const requiredFieldRule = (val) => val ?? t('globals.fieldRequired');
|
||||||
|
|
||||||
const { optionLabel, optionValue, optionFilter, options, modelValue } = toRefs($props);
|
const { optionLabel, optionValue, optionFilter, optionFilterValue, options, modelValue } =
|
||||||
|
toRefs($props);
|
||||||
const myOptions = ref([]);
|
const myOptions = ref([]);
|
||||||
const myOptionsOriginal = ref([]);
|
const myOptionsOriginal = ref([]);
|
||||||
const vnSelectRef = ref();
|
const vnSelectRef = ref();
|
||||||
|
@ -82,6 +91,7 @@ const value = computed({
|
||||||
return $props.modelValue;
|
return $props.modelValue;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
|
setOptions(myOptionsOriginal.value);
|
||||||
emit('update:modelValue', value);
|
emit('update:modelValue', value);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -136,17 +146,20 @@ function filter(val, options) {
|
||||||
async function fetchFilter(val) {
|
async function fetchFilter(val) {
|
||||||
if (!$props.url || !dataRef.value) return;
|
if (!$props.url || !dataRef.value) return;
|
||||||
|
|
||||||
const { fields, sortBy, limit } = $props;
|
const { fields, include, sortBy, limit } = $props;
|
||||||
let key = optionFilter.value ?? optionLabel.value;
|
const key =
|
||||||
|
optionFilterValue.value ??
|
||||||
if (new RegExp(/\d/g).test(val)) key = optionValue.value;
|
(new RegExp(/\d/g).test(val)
|
||||||
|
? optionValue.value
|
||||||
|
: optionFilter.value ?? optionLabel.value);
|
||||||
|
|
||||||
const defaultWhere = $props.useLike
|
const defaultWhere = $props.useLike
|
||||||
? { [key]: { like: `%${val}%` } }
|
? { [key]: { like: `%${val}%` } }
|
||||||
: { [key]: val };
|
: { [key]: val };
|
||||||
const where = { ...(val ? defaultWhere : {}), ...$props.where };
|
const where = { ...(val ? defaultWhere : {}), ...$props.where };
|
||||||
const fetchOptions = { where, order: sortBy, limit };
|
const fetchOptions = { where, include, limit };
|
||||||
if (fields) fetchOptions.fields = fields;
|
if (fields) fetchOptions.fields = fields;
|
||||||
|
if (sortBy) fetchOptions.order = sortBy;
|
||||||
return dataRef.value.fetch(fetchOptions);
|
return dataRef.value.fetch(fetchOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +172,10 @@ async function filterHandler(val, update) {
|
||||||
let newOptions;
|
let newOptions;
|
||||||
|
|
||||||
if (!$props.defaultFilter) return update();
|
if (!$props.defaultFilter) return update();
|
||||||
if ($props.url) {
|
if (
|
||||||
|
$props.url &&
|
||||||
|
($props.limit || (!$props.limit && Object.keys(myOptions.value).length === 0))
|
||||||
|
) {
|
||||||
newOptions = await fetchFilter(val);
|
newOptions = await fetchFilter(val);
|
||||||
} else newOptions = filter(val, myOptionsOriginal.value);
|
} else newOptions = filter(val, myOptionsOriginal.value);
|
||||||
update(
|
update(
|
||||||
|
@ -174,6 +190,10 @@ async function filterHandler(val, update) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nullishToTrue(value) {
|
||||||
|
return value ?? true;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -192,12 +212,12 @@ async function filterHandler(val, update) {
|
||||||
:option-label="optionLabel"
|
:option-label="optionLabel"
|
||||||
:option-value="optionValue"
|
:option-value="optionValue"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
use-input
|
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
hide-selected
|
:emit-value="nullishToTrue($attrs['emit-value'])"
|
||||||
fill-input
|
:map-options="nullishToTrue($attrs['map-options'])"
|
||||||
|
:use-input="nullishToTrue($attrs['use-input'])"
|
||||||
|
:hide-selected="nullishToTrue($attrs['hide-selected'])"
|
||||||
|
:fill-input="nullishToTrue($attrs['fill-input'])"
|
||||||
ref="vnSelectRef"
|
ref="vnSelectRef"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
|
@ -208,7 +228,12 @@ async function filterHandler(val, update) {
|
||||||
<QIcon
|
<QIcon
|
||||||
v-show="value"
|
v-show="value"
|
||||||
name="close"
|
name="close"
|
||||||
@click.stop="value = null"
|
@click.stop="
|
||||||
|
() => {
|
||||||
|
value = null;
|
||||||
|
emit('remove');
|
||||||
|
}
|
||||||
|
"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
size="xs"
|
size="xs"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,21 +1,12 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
|
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
const value = defineModel({ type: [String, Number, Object] });
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
modelValue: {
|
|
||||||
type: [String, Number, Object],
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
rolesAllowedToCreate: {
|
rolesAllowedToCreate: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ['developer'],
|
default: () => ['developer'],
|
||||||
|
@ -33,15 +24,6 @@ const $props = defineProps({
|
||||||
const role = useRole();
|
const role = useRole();
|
||||||
const showForm = ref(false);
|
const showForm = ref(false);
|
||||||
|
|
||||||
const value = computed({
|
|
||||||
get() {
|
|
||||||
return $props.modelValue;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
emit('update:modelValue', value);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const isAllowedToCreate = computed(() => {
|
const isAllowedToCreate = computed(() => {
|
||||||
return role.hasAny($props.rolesAllowedToCreate);
|
return role.hasAny($props.rolesAllowedToCreate);
|
||||||
});
|
});
|
||||||
|
@ -52,7 +34,11 @@ const toggleForm = () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSelect v-model="value" :options="options" v-bind="$attrs">
|
<VnSelect
|
||||||
|
v-model="value"
|
||||||
|
v-bind="$attrs"
|
||||||
|
@update:model-value="(...args) => emit('update:modelValue', ...args)"
|
||||||
|
>
|
||||||
<template v-if="isAllowedToCreate" #append>
|
<template v-if="isAllowedToCreate" #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
@click.stop.prevent="toggleForm()"
|
@click.stop.prevent="toggleForm()"
|
||||||
|
|
|
@ -7,7 +7,7 @@ defineProps({
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div :class="$q.screen.gt.md ? 'q-pb-lg' : 'q-pb-md'">
|
<div :class="$q.screen.gt.md ? 'q-pb-lg' : 'q-pb-md'">
|
||||||
<div class="header-link">
|
<div class="header-link" :style="{ cursor: url ? 'pointer' : 'default' }">
|
||||||
<a :href="url" :class="url ? 'link' : 'color-vn-text'">
|
<a :href="url" :class="url ? 'link' : 'color-vn-text'">
|
||||||
{{ text }}
|
{{ text }}
|
||||||
<QIcon v-if="url" :name="icon" />
|
<QIcon v-if="url" :name="icon" />
|
||||||
|
|
|
@ -31,7 +31,7 @@ const dialog = ref(null);
|
||||||
<div class="container order-catalog-item overflow-hidden">
|
<div class="container order-catalog-item overflow-hidden">
|
||||||
<QCard class="card shadow-6">
|
<QCard class="card shadow-6">
|
||||||
<div class="img-wrapper">
|
<div class="img-wrapper">
|
||||||
<VnImg :id="item.id" zoom-size="lg" class="image" />
|
<VnImg :id="item.id" class="image" />
|
||||||
<div v-if="item.hex && isCatalog" class="item-color-container">
|
<div v-if="item.hex && isCatalog" class="item-color-container">
|
||||||
<div
|
<div
|
||||||
class="item-color"
|
class="item-color"
|
||||||
|
|
|
@ -73,8 +73,7 @@ const containerClasses = computed(() => {
|
||||||
.q-calendar-month__head--workweek,
|
.q-calendar-month__head--workweek,
|
||||||
.q-calendar-month__head--weekday,
|
.q-calendar-month__head--weekday,
|
||||||
// .q-calendar-month__workweek.q-past-day,
|
// .q-calendar-month__workweek.q-past-day,
|
||||||
.q-calendar-month__week :nth-child(6),
|
.q-calendar-month__week :nth-child(n+6):nth-child(-n+7) {
|
||||||
:nth-child(7) {
|
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,45 +1,62 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { useColor } from 'src/composables/useColor';
|
import { useColor } from 'src/composables/useColor';
|
||||||
|
import { getCssVar } from 'quasar';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
workerId: { type: Number, required: true },
|
workerId: { type: Number, required: true },
|
||||||
description: { type: String, default: null },
|
description: { type: String, default: null },
|
||||||
size: { type: String, default: null },
|
|
||||||
title: { type: String, default: null },
|
title: { type: String, default: null },
|
||||||
|
color: { type: String, default: null },
|
||||||
});
|
});
|
||||||
|
|
||||||
const { getTokenMultimedia } = useSession();
|
const { getTokenMultimedia } = useSession();
|
||||||
const token = getTokenMultimedia();
|
const token = getTokenMultimedia();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const title = computed(() => $props.title ?? t('globals.system'));
|
const src = computed(
|
||||||
|
() => `/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`
|
||||||
|
);
|
||||||
|
const title = computed(() => $props.title?.toUpperCase() || t('globals.system'));
|
||||||
const showLetter = ref(false);
|
const showLetter = ref(false);
|
||||||
|
const backgroundColor = computed(() => {
|
||||||
|
const color = $props.color || useColor(title.value);
|
||||||
|
return getCssVar(color) || color;
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(src, () => (showLetter.value = false));
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="avatar-picture column items-center">
|
<div class="column items-center">
|
||||||
<QAvatar
|
<QAvatar
|
||||||
:style="{
|
:style="{ backgroundColor }"
|
||||||
backgroundColor: useColor(title),
|
v-bind="$attrs"
|
||||||
}"
|
:title="title || t('globals.system')"
|
||||||
:size="$props.size"
|
|
||||||
:title="title"
|
|
||||||
>
|
>
|
||||||
<template v-if="showLetter">{{ title.charAt(0) }}</template>
|
<template v-if="showLetter">
|
||||||
<QImg
|
{{ title.charAt(0) }}
|
||||||
v-else
|
</template>
|
||||||
:src="`/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`"
|
<QImg v-else :src="src" spinner-color="white" @error="showLetter = true" />
|
||||||
spinner-color="white"
|
|
||||||
@error="showLetter = true"
|
|
||||||
/>
|
|
||||||
</QAvatar>
|
</QAvatar>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<slot name="description" v-if="$props.description">
|
<slot name="description" v-if="description">
|
||||||
<p>
|
<p v-text="description" />
|
||||||
{{ $props.description }}
|
|
||||||
</p>
|
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
[size='xxl'] {
|
||||||
|
.q-avatar,
|
||||||
|
.q-img {
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-img {
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -37,7 +37,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
hiddenTags: {
|
hiddenTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ['filter'],
|
default: () => ['filter', 'search', 'or', 'and'],
|
||||||
},
|
},
|
||||||
customTags: {
|
customTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -57,7 +57,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ search });
|
defineExpose({ search, sanitizer });
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
'update:modelValue',
|
'update:modelValue',
|
||||||
'refresh',
|
'refresh',
|
||||||
|
@ -65,6 +65,7 @@ const emit = defineEmits([
|
||||||
'search',
|
'search',
|
||||||
'init',
|
'init',
|
||||||
'remove',
|
'remove',
|
||||||
|
'setUserParams',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const arrayData = useArrayData($props.dataKey, {
|
const arrayData = useArrayData($props.dataKey, {
|
||||||
|
@ -81,22 +82,26 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function setUserParams(watchedParams) {
|
function setUserParams(watchedParams) {
|
||||||
if (!watchedParams) return;
|
if (!watchedParams || Object.keys(watchedParams).length == 0) return;
|
||||||
|
|
||||||
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
if (typeof watchedParams == 'string') watchedParams = JSON.parse(watchedParams);
|
||||||
|
if (typeof watchedParams?.filter == 'string')
|
||||||
|
watchedParams.filter = JSON.parse(watchedParams.filter);
|
||||||
|
|
||||||
watchedParams = { ...watchedParams, ...watchedParams.filter?.where };
|
watchedParams = { ...watchedParams, ...watchedParams.filter?.where };
|
||||||
|
const order = watchedParams.filter?.order;
|
||||||
|
|
||||||
delete watchedParams.filter;
|
delete watchedParams.filter;
|
||||||
userParams.value = { ...userParams.value, ...watchedParams };
|
userParams.value = { ...userParams.value, ...sanitizer(watchedParams) };
|
||||||
|
emit('setUserParams', userParams.value, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.query[$props.searchUrl],
|
() => [route.query[$props.searchUrl], arrayData.store.userParams],
|
||||||
(val) => setUserParams(val)
|
([newSearchUrl, newUserParams], [oldSearchUrl, oldUserParams]) => {
|
||||||
);
|
if (newSearchUrl || oldSearchUrl) setUserParams(newSearchUrl);
|
||||||
|
if (newUserParams || oldUserParams) setUserParams(newUserParams);
|
||||||
watch(
|
}
|
||||||
() => arrayData.store.userParams,
|
|
||||||
(val) => setUserParams(val)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -190,6 +195,16 @@ function formatValue(value) {
|
||||||
|
|
||||||
return `"${value}"`;
|
return `"${value}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sanitizer(params) {
|
||||||
|
for (const [key, value] of Object.entries(params)) {
|
||||||
|
if (typeof value == 'object') {
|
||||||
|
const param = Object.values(value)[0];
|
||||||
|
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -272,7 +287,7 @@ function formatValue(value) {
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
</QList>
|
</QList>
|
||||||
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
||||||
<slot name="body" :params="userParams" :search-fn="search"></slot>
|
<slot name="body" :params="sanitizer(userParams)" :search-fn="search"></slot>
|
||||||
</QList>
|
</QList>
|
||||||
</QForm>
|
</QForm>
|
||||||
<QInnerLoading
|
<QInnerLoading
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
|
import noImage from '/no-user.png';
|
||||||
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
storage: {
|
storage: {
|
||||||
|
@ -11,14 +13,17 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: 'catalog',
|
default: 'catalog',
|
||||||
},
|
},
|
||||||
size: {
|
resolution: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '200x200',
|
default: '200x200',
|
||||||
},
|
},
|
||||||
zoomSize: {
|
zoomResolution: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
default: null,
|
||||||
default: 'lg',
|
},
|
||||||
|
zoom: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
},
|
},
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
@ -28,14 +33,16 @@ const $props = defineProps({
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const token = useSession().getTokenMultimedia();
|
const token = useSession().getTokenMultimedia();
|
||||||
const timeStamp = ref(`timestamp=${Date.now()}`);
|
const timeStamp = ref(`timestamp=${Date.now()}`);
|
||||||
import noImage from '/no-user.png';
|
|
||||||
import { useRole } from 'src/composables/useRole';
|
|
||||||
const url = computed(() => {
|
|
||||||
const isEmployee = useRole().isEmployee();
|
const isEmployee = useRole().isEmployee();
|
||||||
|
|
||||||
|
const getUrl = (zoom = false) => {
|
||||||
|
const curResolution = zoom
|
||||||
|
? $props.zoomResolution || $props.resolution
|
||||||
|
: $props.resolution;
|
||||||
return isEmployee
|
return isEmployee
|
||||||
? `/api/${$props.storage}/${$props.collection}/${$props.size}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
|
? `/api/${$props.storage}/${$props.collection}/${curResolution}/${$props.id}/download?access_token=${token}&${timeStamp.value}`
|
||||||
: noImage;
|
: noImage;
|
||||||
});
|
};
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
timeStamp.value = `timestamp=${Date.now()}`;
|
timeStamp.value = `timestamp=${Date.now()}`;
|
||||||
};
|
};
|
||||||
|
@ -45,23 +52,21 @@ defineExpose({
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QImg
|
<QImg
|
||||||
:class="{ zoomIn: $props.zoomSize }"
|
:class="{ zoomIn: zoom }"
|
||||||
:src="url"
|
:src="getUrl()"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@click="show = !show"
|
@click.stop="show = $props.zoom ? true : false"
|
||||||
spinner-color="primary"
|
spinner-color="primary"
|
||||||
/>
|
/>
|
||||||
<QDialog v-model="show" v-if="$props.zoomSize">
|
<QDialog v-if="$props.zoom" v-model="show">
|
||||||
<QImg
|
<QImg
|
||||||
:src="url"
|
:src="getUrl(true)"
|
||||||
size="full"
|
|
||||||
class="img_zoom"
|
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
spinner-color="primary"
|
spinner-color="primary"
|
||||||
|
class="img_zoom"
|
||||||
/>
|
/>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.q-img {
|
.q-img {
|
||||||
&.zoomIn {
|
&.zoomIn {
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
|
||||||
import { toDateHourMin } from 'src/filters';
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { onBeforeRouteLeave } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnPaginate from './VnPaginate.vue';
|
import { useQuasar } from 'quasar';
|
||||||
import VnUserLink from '../ui/VnUserLink.vue';
|
|
||||||
|
import { toDateHourMin } from 'src/filters';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
|
import VnUserLink from 'components/ui/VnUserLink.vue';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import VnAvatar from 'components/ui/VnAvatar.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
url: { type: String, default: null },
|
url: { type: String, default: null },
|
||||||
filter: { type: Object, default: () => {} },
|
filter: { type: Object, default: () => {} },
|
||||||
|
@ -17,6 +22,7 @@ const $props = defineProps({
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
const quasar = useQuasar();
|
||||||
const currentUser = ref(state.getUser());
|
const currentUser = ref(state.getUser());
|
||||||
const newNote = ref('');
|
const newNote = ref('');
|
||||||
const vnPaginateRef = ref();
|
const vnPaginateRef = ref();
|
||||||
|
@ -28,11 +34,24 @@ function handleKeyUp(event) {
|
||||||
}
|
}
|
||||||
async function insert() {
|
async function insert() {
|
||||||
const body = $props.body;
|
const body = $props.body;
|
||||||
Object.assign(body, { text: newNote.value });
|
const newBody = { ...body, ...{ text: newNote.value } };
|
||||||
await axios.post($props.url, body);
|
await axios.post($props.url, newBody);
|
||||||
await vnPaginateRef.value.fetch();
|
await vnPaginateRef.value.fetch();
|
||||||
newNote.value = '';
|
newNote.value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBeforeRouteLeave((to, from, next) => {
|
||||||
|
if (newNote.value)
|
||||||
|
quasar.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('globals.unsavedPopup.title'),
|
||||||
|
message: t('globals.unsavedPopup.subtitle'),
|
||||||
|
promise: () => next(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
else next();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote">
|
<QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote">
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<script setup>
|
||||||
|
const emit = defineEmits(['submit']);
|
||||||
|
defineProps({
|
||||||
|
icon: { type: String, required: false, default: 'phonelink_lock' },
|
||||||
|
title: { type: String, required: true },
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<QForm @submit="emit('submit')" class="q-gutter-y-md q-pa-lg formCard">
|
||||||
|
<div class="column items-center">
|
||||||
|
<QIcon v-if="icon != false" :name="icon" size="xl" color="primary" />
|
||||||
|
<h5 class="text-center q-my-md">
|
||||||
|
{{ title }}
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<slot></slot>
|
||||||
|
<div class="q-mt-lg">
|
||||||
|
<slot name="buttons"></slot>
|
||||||
|
</div>
|
||||||
|
</QForm>
|
||||||
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.formCard {
|
||||||
|
max-width: 350px;
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
|
@media (max-width: $breakpoint-xs-max) {
|
||||||
|
.formCard {
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -115,8 +115,8 @@ watch(
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.url,
|
() => [props.url, props.filter],
|
||||||
(url) => fetch({ url })
|
([url, filter]) => mounted.value && fetch({ url, filter })
|
||||||
);
|
);
|
||||||
|
|
||||||
const addFilter = async (filter, params) => {
|
const addFilter = async (filter, params) => {
|
||||||
|
@ -221,7 +221,7 @@ defineExpose({ fetch, addFilter, paginate });
|
||||||
>
|
>
|
||||||
<slot name="body" :rows="store.data"></slot>
|
<slot name="body" :rows="store.data"></slot>
|
||||||
<div v-if="isLoading" class="info-row q-pa-md text-center">
|
<div v-if="isLoading" class="info-row q-pa-md text-center">
|
||||||
<QSpinner color="orange" size="md" />
|
<QSpinner color="primary" size="md" />
|
||||||
</div>
|
</div>
|
||||||
</QInfiniteScroll>
|
</QInfiniteScroll>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,28 +1,18 @@
|
||||||
<script setup>
|
|
||||||
defineProps({ wrap: { type: Boolean, default: false } });
|
|
||||||
</script>
|
|
||||||
<template>
|
<template>
|
||||||
<div class="vn-row q-gutter-md q-mb-md" :class="{ wrap }">
|
<div class="vn-row q-gutter-md q-mb-md">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.vn-row {
|
.vn-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
&.wrap {
|
> :deep(*) {
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
&:not(.wrap) {
|
|
||||||
> :slotted(*) {
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
.vn-row {
|
.vn-row {
|
||||||
&:not(.wrap) {
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -67,6 +67,10 @@ const props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
searchUrl: {
|
||||||
|
type: String,
|
||||||
|
default: 'params',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const searchText = ref('');
|
const searchText = ref('');
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount } from 'vue';
|
import { watch, computed } from 'vue';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import VnAvatar from '../ui/VnAvatar.vue';
|
import VnAvatar from '../ui/VnAvatar.vue';
|
||||||
|
@ -10,7 +10,8 @@ const $props = defineProps({
|
||||||
where: { type: Object, default: () => {} },
|
where: { type: Object, default: () => {} },
|
||||||
});
|
});
|
||||||
|
|
||||||
const filter = {
|
const filter = computed(() => {
|
||||||
|
return {
|
||||||
fields: ['smsFk'],
|
fields: ['smsFk'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'sms',
|
relation: 'sms',
|
||||||
|
@ -32,9 +33,9 @@ const filter = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
...{ where: $props.where },
|
||||||
};
|
};
|
||||||
|
});
|
||||||
onBeforeMount(() => (filter.where = $props.where));
|
|
||||||
|
|
||||||
function formatNumber(number) {
|
function formatNumber(number) {
|
||||||
if (number.length <= 10) return number;
|
if (number.length <= 10) return number;
|
||||||
|
|
|
@ -18,4 +18,3 @@ const { t } = useI18n();
|
||||||
</slot>
|
</slot>
|
||||||
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
|
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
|
||||||
</template>
|
</template>
|
||||||
<style scoped></style>
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
delete params.filter;
|
delete params.filter;
|
||||||
store.userParams = { ...params, ...store.userParams };
|
store.userParams = { ...params, ...store.userParams };
|
||||||
store.userFilter = { ...filter, ...store.userFilter };
|
store.userFilter = { ...filter, ...store.userFilter };
|
||||||
if (filter.order) store.order = filter.order;
|
if (filter?.order) store.order = filter.order;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,14 @@ import { useRole } from './useRole';
|
||||||
import { useAcl } from './useAcl';
|
import { useAcl } from './useAcl';
|
||||||
import { useUserConfig } from './useUserConfig';
|
import { useUserConfig } from './useUserConfig';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import useNotify from './useNotify';
|
import useNotify from './useNotify';
|
||||||
import { useTokenConfig } from './useTokenConfig';
|
import { useTokenConfig } from './useTokenConfig';
|
||||||
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
|
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
|
||||||
const TOKEN = 'token';
|
const TOKEN = 'token';
|
||||||
|
|
||||||
export function useSession() {
|
export function useSession() {
|
||||||
|
const router = useRouter();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
let isCheckingToken = false;
|
let isCheckingToken = false;
|
||||||
let intervalId = null;
|
let intervalId = null;
|
||||||
|
@ -102,6 +104,31 @@ export function useSession() {
|
||||||
startInterval();
|
startInterval();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setLogin(data) {
|
||||||
|
const {
|
||||||
|
data: { multimediaToken },
|
||||||
|
} = await axios.get('VnUsers/ShareToken', {
|
||||||
|
headers: { Authorization: data.token },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!multimediaToken) return;
|
||||||
|
|
||||||
|
await login({
|
||||||
|
...data,
|
||||||
|
created: Date.now(),
|
||||||
|
tokenMultimedia: multimediaToken.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
notify('login.loginSuccess', 'positive');
|
||||||
|
|
||||||
|
const currentRoute = router.currentRoute.value;
|
||||||
|
if (currentRoute.query?.redirect) {
|
||||||
|
router.push(currentRoute.query.redirect);
|
||||||
|
} else {
|
||||||
|
router.push({ name: 'Dashboard' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function isLoggedIn() {
|
function isLoggedIn() {
|
||||||
const localToken = localStorage.getItem(TOKEN);
|
const localToken = localStorage.getItem(TOKEN);
|
||||||
const sessionToken = sessionStorage.getItem(TOKEN);
|
const sessionToken = sessionStorage.getItem(TOKEN);
|
||||||
|
@ -163,6 +190,7 @@ export function useSession() {
|
||||||
setToken,
|
setToken,
|
||||||
destroy,
|
destroy,
|
||||||
login,
|
login,
|
||||||
|
setLogin,
|
||||||
isLoggedIn,
|
isLoggedIn,
|
||||||
checkValidity,
|
checkValidity,
|
||||||
setSession,
|
setSession,
|
||||||
|
|
|
@ -153,6 +153,12 @@ select:-webkit-autofill {
|
||||||
background-color: var(--vn-section-color);
|
background-color: var(--vn-section-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-table td[shrink] {
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
max-width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
.tr-header {
|
.tr-header {
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
}
|
}
|
||||||
|
@ -188,13 +194,6 @@ select:-webkit-autofill {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.q-card,
|
|
||||||
.q-table,
|
|
||||||
.q-table__bottom,
|
|
||||||
.q-drawer {
|
|
||||||
background-color: var(--vn-section-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type='number'] {
|
input[type='number'] {
|
||||||
-moz-appearance: textfield;
|
-moz-appearance: textfield;
|
||||||
}
|
}
|
||||||
|
@ -209,6 +208,7 @@ input::-webkit-inner-spin-button {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-table__container {
|
||||||
/* ===== Scrollbar CSS ===== /
|
/* ===== Scrollbar CSS ===== /
|
||||||
/ Firefox */
|
/ Firefox */
|
||||||
|
|
||||||
|
@ -231,6 +231,7 @@ input::-webkit-inner-spin-button {
|
||||||
*::-webkit-scrollbar-track {
|
*::-webkit-scrollbar-track {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.q-table {
|
.q-table {
|
||||||
th,
|
th,
|
||||||
|
@ -246,6 +247,16 @@ input::-webkit-inner-spin-button {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
tr {
|
||||||
|
th {
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
font-size: 11pt;
|
||||||
|
border-top: 1px solid var(--vn-page-color);
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
}
|
||||||
.shrink {
|
.shrink {
|
||||||
max-width: 75px;
|
max-width: 75px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,9 @@ globals:
|
||||||
salesPerson: SalesPerson
|
salesPerson: SalesPerson
|
||||||
send: Send
|
send: Send
|
||||||
code: Code
|
code: Code
|
||||||
|
since: Since
|
||||||
|
from: From
|
||||||
|
to: To
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Login
|
logIn: Login
|
||||||
summary: Summary
|
summary: Summary
|
||||||
|
@ -246,6 +249,11 @@ globals:
|
||||||
mailForwarding: Mail forwarding
|
mailForwarding: Mail forwarding
|
||||||
mailAlias: Mail alias
|
mailAlias: Mail alias
|
||||||
privileges: Privileges
|
privileges: Privileges
|
||||||
|
ldap: LDAP
|
||||||
|
samba: Samba
|
||||||
|
twoFactor: Two factor
|
||||||
|
recoverPassword: Recover password
|
||||||
|
resetPassword: Reset password
|
||||||
created: Created
|
created: Created
|
||||||
worker: Worker
|
worker: Worker
|
||||||
now: Now
|
now: Now
|
||||||
|
@ -254,6 +262,10 @@ globals:
|
||||||
comment: Comment
|
comment: Comment
|
||||||
observations: Observations
|
observations: Observations
|
||||||
goToModuleIndex: Go to module index
|
goToModuleIndex: Go to module index
|
||||||
|
unsavedPopup:
|
||||||
|
title: Unsaved changes will be lost
|
||||||
|
subtitle: Are you sure exit without saving?
|
||||||
|
createInvoiceIn: Create invoice in
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Access denied
|
statusUnauthorized: Access denied
|
||||||
statusInternalServerError: An internal server error has ocurred
|
statusInternalServerError: An internal server error has ocurred
|
||||||
|
@ -279,14 +291,17 @@ twoFactor:
|
||||||
explanation: >-
|
explanation: >-
|
||||||
Please, enter the verification code that we have sent to your email in the
|
Please, enter the verification code that we have sent to your email in the
|
||||||
next 5 minutes
|
next 5 minutes
|
||||||
pageTitles:
|
|
||||||
twoFactor: Two-Factor
|
|
||||||
verifyEmail:
|
verifyEmail:
|
||||||
pageTitles:
|
pageTitles:
|
||||||
verifyEmail: Email verification
|
verifyEmail: Email verification
|
||||||
dashboard:
|
recoverPassword:
|
||||||
pageTitles:
|
userOrEmail: User or recovery email
|
||||||
|
explanation: >-
|
||||||
|
We will sent you an email to recover your password
|
||||||
|
resetPassword:
|
||||||
|
repeatPassword: Repeat password
|
||||||
|
passwordNotMatch: Passwords don't match
|
||||||
|
passwordChanged: Password changed
|
||||||
customer:
|
customer:
|
||||||
list:
|
list:
|
||||||
phone: Phone
|
phone: Phone
|
||||||
|
@ -386,8 +401,8 @@ customer:
|
||||||
extendedList:
|
extendedList:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
id: Identifier
|
id: Identifier
|
||||||
name: Comercial name
|
name: Name
|
||||||
socialName: Business name
|
socialName: Social name
|
||||||
fi: Tax number
|
fi: Tax number
|
||||||
salesPersonFk: Salesperson
|
salesPersonFk: Salesperson
|
||||||
credit: Credit
|
credit: Credit
|
||||||
|
@ -997,18 +1012,6 @@ route:
|
||||||
shipped: Preparation date
|
shipped: Preparation date
|
||||||
viewCmr: View CMR
|
viewCmr: View CMR
|
||||||
downloadCmrs: Download CMRs
|
downloadCmrs: Download CMRs
|
||||||
columnLabels:
|
|
||||||
Id: Id
|
|
||||||
vehicle: Vehicle
|
|
||||||
description: Description
|
|
||||||
isServed: Served
|
|
||||||
worker: Worker
|
|
||||||
date: Date
|
|
||||||
started: Started
|
|
||||||
actions: Actions
|
|
||||||
agency: Agency
|
|
||||||
volume: Volume
|
|
||||||
finished: Finished
|
|
||||||
supplier:
|
supplier:
|
||||||
list:
|
list:
|
||||||
payMethod: Pay method
|
payMethod: Pay method
|
||||||
|
|
|
@ -90,6 +90,9 @@ globals:
|
||||||
salesPerson: Comercial
|
salesPerson: Comercial
|
||||||
send: Enviar
|
send: Enviar
|
||||||
code: Código
|
code: Código
|
||||||
|
since: Desde
|
||||||
|
from: Desde
|
||||||
|
to: Hasta
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Inicio de sesión
|
logIn: Inicio de sesión
|
||||||
summary: Resumen
|
summary: Resumen
|
||||||
|
@ -248,6 +251,11 @@ globals:
|
||||||
components: Componentes
|
components: Componentes
|
||||||
pictures: Fotos
|
pictures: Fotos
|
||||||
packages: Bultos
|
packages: Bultos
|
||||||
|
ldap: LDAP
|
||||||
|
samba: Samba
|
||||||
|
twoFactor: Doble factor
|
||||||
|
recoverPassword: Recuperar contraseña
|
||||||
|
resetPassword: Restablecer contraseña
|
||||||
created: Fecha creación
|
created: Fecha creación
|
||||||
worker: Trabajador
|
worker: Trabajador
|
||||||
now: Ahora
|
now: Ahora
|
||||||
|
@ -256,6 +264,11 @@ globals:
|
||||||
comment: Comentario
|
comment: Comentario
|
||||||
observations: Observaciones
|
observations: Observaciones
|
||||||
goToModuleIndex: Ir al índice del módulo
|
goToModuleIndex: Ir al índice del módulo
|
||||||
|
unsavedPopup:
|
||||||
|
title: Los cambios que no haya guardado se perderán
|
||||||
|
subtitle: ¿Seguro que quiere salir sin guardar?
|
||||||
|
createInvoiceIn: Crear factura recibida
|
||||||
|
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Acceso denegado
|
statusUnauthorized: Acceso denegado
|
||||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||||
|
@ -279,14 +292,17 @@ twoFactor:
|
||||||
validate: Validar
|
validate: Validar
|
||||||
insert: Introduce el código de verificación
|
insert: Introduce el código de verificación
|
||||||
explanation: Por favor introduce el código de verificación que te hemos enviado a tu email en los próximos 5 minutos
|
explanation: Por favor introduce el código de verificación que te hemos enviado a tu email en los próximos 5 minutos
|
||||||
pageTitles:
|
|
||||||
twoFactor: Doble factor
|
|
||||||
verifyEmail:
|
verifyEmail:
|
||||||
pageTitles:
|
pageTitles:
|
||||||
verifyEmail: Verificación de correo
|
verifyEmail: Verificación de correo
|
||||||
dashboard:
|
recoverPassword:
|
||||||
pageTitles:
|
userOrEmail: Usuario o correo de recuperación
|
||||||
|
explanation: >-
|
||||||
|
Te enviaremos un correo para restablecer tu contraseña
|
||||||
|
resetPassword:
|
||||||
|
repeatPassword: Repetir contraseña
|
||||||
|
passwordNotMatch: Las contraseñas no coinciden
|
||||||
|
passwordChanged: Contraseña cambiada
|
||||||
customer:
|
customer:
|
||||||
list:
|
list:
|
||||||
phone: Teléfono
|
phone: Teléfono
|
||||||
|
@ -385,7 +401,7 @@ customer:
|
||||||
extendedList:
|
extendedList:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
id: Identificador
|
id: Identificador
|
||||||
name: Nombre Comercial
|
name: Nombre
|
||||||
socialName: Razón social
|
socialName: Razón social
|
||||||
fi: NIF / CIF
|
fi: NIF / CIF
|
||||||
salesPersonFk: Comercial
|
salesPersonFk: Comercial
|
||||||
|
@ -692,8 +708,6 @@ invoiceOut:
|
||||||
percentageText: '{getPercentage}% {getAddressNumber} de {getNAddresses}'
|
percentageText: '{getPercentage}% {getAddressNumber} de {getNAddresses}'
|
||||||
pdfsNumberText: '{nPdfs} de {totalPdfs} PDFs'
|
pdfsNumberText: '{nPdfs} de {totalPdfs} PDFs'
|
||||||
negativeBases:
|
negativeBases:
|
||||||
from: Desde
|
|
||||||
to: Hasta
|
|
||||||
company: Empresa
|
company: Empresa
|
||||||
country: País
|
country: País
|
||||||
clientId: Id cliente
|
clientId: Id cliente
|
||||||
|
@ -868,7 +882,7 @@ worker:
|
||||||
card:
|
card:
|
||||||
workerId: ID Trabajador
|
workerId: ID Trabajador
|
||||||
name: Nombre
|
name: Nombre
|
||||||
email: Email
|
email: Correo personal
|
||||||
phone: Teléfono
|
phone: Teléfono
|
||||||
mobile: Móvil
|
mobile: Móvil
|
||||||
active: Activo
|
active: Activo
|
||||||
|
@ -978,18 +992,6 @@ route:
|
||||||
shipped: Fecha preparación
|
shipped: Fecha preparación
|
||||||
viewCmr: Ver CMR
|
viewCmr: Ver CMR
|
||||||
downloadCmrs: Descargar CMRs
|
downloadCmrs: Descargar CMRs
|
||||||
columnLabels:
|
|
||||||
Id: Id
|
|
||||||
vehicle: Vehículo
|
|
||||||
description: Descripción
|
|
||||||
isServed: Servida
|
|
||||||
worker: Trabajador
|
|
||||||
date: Fecha
|
|
||||||
started: Iniciada
|
|
||||||
actions: Acciones
|
|
||||||
agency: Agencia
|
|
||||||
volume: Volumen
|
|
||||||
finished: Finalizada
|
|
||||||
supplier:
|
supplier:
|
||||||
list:
|
list:
|
||||||
payMethod: Método de pago
|
payMethod: Método de pago
|
||||||
|
@ -1247,8 +1249,6 @@ components:
|
||||||
# LatestBuysFilter
|
# LatestBuysFilter
|
||||||
salesPersonFk: Comprador
|
salesPersonFk: Comprador
|
||||||
supplierFk: Proveedor
|
supplierFk: Proveedor
|
||||||
from: Desde
|
|
||||||
to: Hasta
|
|
||||||
active: Activo
|
active: Activo
|
||||||
visible: Visible
|
visible: Visible
|
||||||
floramondo: Floramondo
|
floramondo: Floramondo
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { ref } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
|
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
|
||||||
import AclFilter from './Acls/AclFilter.vue';
|
|
||||||
import AclFormView from './Acls/AclFormView.vue';
|
|
||||||
|
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -25,10 +21,9 @@ defineProps({
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const paginateRef = ref();
|
const tableRef = ref();
|
||||||
const formDialog = ref(false);
|
|
||||||
const rolesOptions = ref([]);
|
const rolesOptions = ref([]);
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
|
@ -40,32 +35,94 @@ const exprBuilder = (param, value) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteAcl = async (id) => {
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'id',
|
||||||
|
label: t('id'),
|
||||||
|
isId: true,
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'model',
|
||||||
|
label: t('model'),
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'principalId',
|
||||||
|
label: t('principalId'),
|
||||||
|
cardVisible: true,
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'VnRoles',
|
||||||
|
optionLabel: 'name',
|
||||||
|
optionValue: 'name',
|
||||||
|
},
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'property',
|
||||||
|
label: t('property'),
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'accessType',
|
||||||
|
label: t('accessType'),
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
options: ['READ', 'WRITE', '*'],
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
label: '',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('Delete'),
|
||||||
|
icon: 'delete',
|
||||||
|
action: deleteAcl,
|
||||||
|
isPrimary: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const deleteAcl = async ({ id }) => {
|
||||||
try {
|
try {
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('Remove ACL'),
|
||||||
|
message: t('Do you want to remove this ACL?'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(() => {
|
||||||
|
resolve(true);
|
||||||
|
})
|
||||||
|
.onCancel(() => {
|
||||||
|
resolve(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
await axios.delete(`ACLs/${id}`);
|
await axios.delete(`ACLs/${id}`);
|
||||||
paginateRef.value.fetch();
|
tableRef.value.reload();
|
||||||
notify('ACL removed', 'positive');
|
notify('ACL removed', 'positive');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error deleting Acl: ', error);
|
console.error('Error deleting Acl: ', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function showFormDialog(data) {
|
|
||||||
formDialog.value = {
|
|
||||||
show: true,
|
|
||||||
formInitialData: { ...data },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
url="VnRoles"
|
|
||||||
:filter="{ fields: ['name'], order: 'name ASC' }"
|
|
||||||
@on-fetch="(data) => (rolesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
|
||||||
<Teleport to="#searchbar">
|
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="AccountAcls"
|
data-key="AccountAcls"
|
||||||
url="ACLs"
|
url="ACLs"
|
||||||
|
@ -73,74 +130,26 @@ function showFormDialog(data) {
|
||||||
:label="t('acls.search')"
|
:label="t('acls.search')"
|
||||||
:info="t('acls.searchInfo')"
|
:info="t('acls.searchInfo')"
|
||||||
/>
|
/>
|
||||||
</Teleport>
|
|
||||||
</template>
|
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea class="fit text-grey-8">
|
|
||||||
<AclFilter data-key="AccountAcls" />
|
|
||||||
</QScrollArea>
|
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
|
<VnTable
|
||||||
<QPage class="flex justify-center q-pa-md">
|
ref="tableRef"
|
||||||
<div class="vn-card-list">
|
|
||||||
<VnPaginate
|
|
||||||
ref="paginateRef"
|
|
||||||
data-key="AccountAcls"
|
data-key="AccountAcls"
|
||||||
url="ACLs"
|
:url="`ACLs`"
|
||||||
:expr-builder="exprBuilder"
|
:create="{
|
||||||
>
|
urlCreate: 'ACLs',
|
||||||
<template #body="{ rows }">
|
title: 'Create ACL',
|
||||||
<CardList
|
onDataSaved: () => tableRef.reload(),
|
||||||
v-for="row of rows"
|
formInitialData: {},
|
||||||
:id="row.id"
|
}"
|
||||||
:key="row.id"
|
order="id DESC"
|
||||||
:title="`${row.model}.${row.property}`"
|
:columns="columns"
|
||||||
@click="showFormDialog(row)"
|
default-mode="table"
|
||||||
>
|
:right-search="true"
|
||||||
<template #list-items>
|
:is-editable="true"
|
||||||
<VnLv :label="t('acls.role')" :value="row.principalId" />
|
:use-model="true"
|
||||||
<VnLv :label="t('acls.accessType')" :value="row.accessType" />
|
|
||||||
<VnLv
|
|
||||||
:label="t('acls.permissions')"
|
|
||||||
:value="row.permission"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
|
||||||
<QBtn
|
|
||||||
:label="t('globals.delete')"
|
|
||||||
@click.stop="
|
|
||||||
openConfirmationModal(
|
|
||||||
t('ACL will be removed'),
|
|
||||||
t('Are you sure you want to continue?'),
|
|
||||||
() => deleteAcl(row.id)
|
|
||||||
)
|
|
||||||
"
|
|
||||||
color="primary"
|
|
||||||
style="margin-top: 15px"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</CardList>
|
|
||||||
</template>
|
|
||||||
</VnPaginate>
|
|
||||||
</div>
|
|
||||||
<QDialog
|
|
||||||
v-model="formDialog.show"
|
|
||||||
transition-show="scale"
|
|
||||||
transition-hide="scale"
|
|
||||||
>
|
|
||||||
<AclFormView
|
|
||||||
:form-initial-data="formDialog.formInitialData"
|
|
||||||
@on-data-change="paginateRef.fetch()"
|
|
||||||
:roles-options="rolesOptions"
|
|
||||||
/>
|
|
||||||
</QDialog>
|
|
||||||
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
|
||||||
<QBtn fab icon="add" color="primary" @click="showFormDialog()">
|
|
||||||
<QTooltip class="text-no-wrap">{{ t('New ACL') }}</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
</QPageSticky>
|
|
||||||
</QPage>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
|
@ -148,4 +157,17 @@ es:
|
||||||
ACL removed: ACL eliminado
|
ACL removed: ACL eliminado
|
||||||
ACL will be removed: El ACL será eliminado
|
ACL will be removed: El ACL será eliminado
|
||||||
Are you sure you want to continue?: ¿Seguro que quieres continuar?
|
Are you sure you want to continue?: ¿Seguro que quieres continuar?
|
||||||
|
Remove ACL: Eliminar Acl
|
||||||
|
Do you want to remove this ACL?: ¿Quieres eliminar este ACL?
|
||||||
|
principalId: Rol
|
||||||
|
model: Modelo
|
||||||
|
en:
|
||||||
|
New ACL: New ACL
|
||||||
|
ACL removed: ACL removed
|
||||||
|
ACL will be removed: ACL will be removed
|
||||||
|
Are you sure you want to continue?: Are you sure you want to continue?
|
||||||
|
Remove ACL: Remove ACL
|
||||||
|
Do you want to remove this ACL?: Do you want to remove this ACL?
|
||||||
|
principalId: Rol
|
||||||
|
model: Models
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,30 +1,13 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { ref } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
|
||||||
import AliasSummary from './Alias/Card/AliasSummary.vue';
|
|
||||||
import AliasCreateForm from './Alias/AliasCreateForm.vue';
|
|
||||||
|
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
defineProps({
|
const tableRef = ref();
|
||||||
id: {
|
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
|
||||||
const router = useRouter();
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const aliasCreateDialogRef = ref(null);
|
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -34,10 +17,32 @@ const exprBuilder = (param, value) => {
|
||||||
: { alias: { like: `%${value}%` } };
|
: { alias: { like: `%${value}%` } };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const columns = computed(() => [
|
||||||
const navigate = (id) => router.push({ name: 'AliasSummary', params: { id } });
|
{
|
||||||
|
align: 'left',
|
||||||
const openCreateModal = () => aliasCreateDialogRef.value.show();
|
name: 'id',
|
||||||
|
label: t('id'),
|
||||||
|
isId: true,
|
||||||
|
field: 'id',
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'alias',
|
||||||
|
label: t('alias'),
|
||||||
|
field: 'alias',
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'description',
|
||||||
|
label: t('description'),
|
||||||
|
field: 'description',
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -52,54 +57,21 @@ const openCreateModal = () => aliasCreateDialogRef.value.show();
|
||||||
/>
|
/>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
</template>
|
</template>
|
||||||
<QPage class="flex justify-center q-pa-md">
|
<VnTable
|
||||||
<div class="vn-card-list">
|
ref="tableRef"
|
||||||
<VnPaginate
|
|
||||||
ref="paginateRef"
|
|
||||||
data-key="AccountAliasList"
|
data-key="AccountAliasList"
|
||||||
url="MailAliases"
|
url="MailAliases"
|
||||||
:expr-builder="exprBuilder"
|
:create="{
|
||||||
>
|
urlCreate: 'MailAliases',
|
||||||
<template #body="{ rows }">
|
title: 'Create MailAlias',
|
||||||
<CardList
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
v-for="row of rows"
|
formInitialData: {},
|
||||||
:id="row.id"
|
}"
|
||||||
:key="row.id"
|
order="id DESC"
|
||||||
:title="row.alias"
|
:columns="columns"
|
||||||
@click="navigate(row.id)"
|
default-mode="table"
|
||||||
>
|
redirect="account/alias"
|
||||||
<template #list-items>
|
:is-editable="true"
|
||||||
<VnLv :label="t('mailAlias.alias')" :value="row.alias">
|
:use-model="true"
|
||||||
</VnLv>
|
|
||||||
<VnLv
|
|
||||||
:label="t('mailAlias.description')"
|
|
||||||
:value="row.description"
|
|
||||||
>
|
|
||||||
</VnLv>
|
|
||||||
</template>
|
|
||||||
<template #actions>
|
|
||||||
<QBtn
|
|
||||||
:label="t('components.smartCard.openSummary')"
|
|
||||||
@click.stop="viewSummary(row.id, AliasSummary)"
|
|
||||||
color="primary"
|
|
||||||
style="margin-top: 15px"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</CardList>
|
|
||||||
</template>
|
|
||||||
</VnPaginate>
|
|
||||||
</div>
|
|
||||||
<QDialog
|
|
||||||
ref="aliasCreateDialogRef"
|
|
||||||
transition-show="scale"
|
|
||||||
transition-hide="scale"
|
|
||||||
>
|
|
||||||
<AliasCreateForm />
|
|
||||||
</QDialog>
|
|
||||||
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
|
||||||
<QBtn fab icon="add" color="primary" @click="openCreateModal()">
|
|
||||||
<QTooltip class="text-no-wrap">{{ t('mailAlias.newAlias') }}</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
</QPageSticky>
|
|
||||||
</QPage>
|
|
||||||
</template>
|
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
import CardList from 'src/components/ui/CardList.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
|
||||||
import { toDateTimeFormat } from 'src/filters/date.js';
|
import { toDateTimeFormat } from 'src/filters/date.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
@ -15,7 +14,6 @@ const newAccountForm = reactive({
|
||||||
active: true,
|
active: true,
|
||||||
});
|
});
|
||||||
const rolesOptions = ref([]);
|
const rolesOptions = ref([]);
|
||||||
|
|
||||||
const redirectToAccountBasicData = (_, { id }) => {
|
const redirectToAccountBasicData = (_, { id }) => {
|
||||||
router.push({ name: 'AccountBasicData', params: { id } });
|
router.push({ name: 'AccountBasicData', params: { id } });
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, computed } from 'vue';
|
import { ref, onMounted, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -15,7 +13,6 @@ const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const arrayData = useArrayData('AccountLdap');
|
const arrayData = useArrayData('AccountLdap');
|
||||||
|
|
||||||
const URL_UPDATE = `LdapConfigs/${1}`;
|
const URL_UPDATE = `LdapConfigs/${1}`;
|
||||||
const URL_CREATE = `LdapConfigs`;
|
const URL_CREATE = `LdapConfigs`;
|
||||||
const DEFAULT_DATA = {
|
const DEFAULT_DATA = {
|
||||||
|
@ -27,11 +24,9 @@ const DEFAULT_DATA = {
|
||||||
server: null,
|
server: null,
|
||||||
userDn: null,
|
userDn: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialData = ref({
|
const initialData = ref({
|
||||||
...DEFAULT_DATA,
|
...DEFAULT_DATA,
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasData = computed({
|
const hasData = computed({
|
||||||
get: () => initialData.value.hasData,
|
get: () => initialData.value.hasData,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
|
@ -40,12 +35,10 @@ const hasData = computed({
|
||||||
else formCustomFn.value = null;
|
else formCustomFn.value = null;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const initialDataLoaded = ref(false);
|
const initialDataLoaded = ref(false);
|
||||||
const formUrlCreate = ref(null);
|
const formUrlCreate = ref(null);
|
||||||
const formUrlUpdate = ref(null);
|
const formUrlUpdate = ref(null);
|
||||||
const formCustomFn = ref(null);
|
const formCustomFn = ref(null);
|
||||||
|
|
||||||
const onTestConection = async () => {
|
const onTestConection = async () => {
|
||||||
try {
|
try {
|
||||||
await axios.get(`LdapConfigs/test`);
|
await axios.get(`LdapConfigs/test`);
|
||||||
|
@ -54,7 +47,6 @@ const onTestConection = async () => {
|
||||||
console.error('Error testing connection', error);
|
console.error('Error testing connection', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInitialLdapConfig = async () => {
|
const getInitialLdapConfig = async () => {
|
||||||
try {
|
try {
|
||||||
initialDataLoaded.value = false;
|
initialDataLoaded.value = false;
|
||||||
|
@ -79,7 +71,6 @@ const getInitialLdapConfig = async () => {
|
||||||
initialDataLoaded.value = true;
|
initialDataLoaded.value = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
try {
|
try {
|
||||||
await axios.delete(URL_UPDATE);
|
await axios.delete(URL_UPDATE);
|
||||||
|
|
|
@ -1,33 +1,74 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { ref, computed } from 'vue';
|
||||||
import { computed, ref } from 'vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
|
||||||
import AccountSummary from './Card/AccountSummary.vue';
|
import AccountSummary from './Card/AccountSummary.vue';
|
||||||
import AccountFilter from './AccountFilter.vue';
|
|
||||||
import AccountCreate from './AccountCreate.vue';
|
|
||||||
|
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import { useRole } from 'src/composables/useRole';
|
|
||||||
import { QDialog } from 'quasar';
|
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
|
||||||
const router = useRouter();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const accountCreateDialogRef = ref(null);
|
const tableRef = ref();
|
||||||
const showNewUserBtn = computed(() => useRole().hasAny(['itManagement']));
|
|
||||||
|
|
||||||
const filter = {
|
|
||||||
fields: ['id', 'nickname', 'name', 'role'],
|
|
||||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
|
||||||
};
|
|
||||||
|
|
||||||
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'id',
|
||||||
|
label: t('id'),
|
||||||
|
isId: true,
|
||||||
|
field: 'id',
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'username',
|
||||||
|
label: t('nickname'),
|
||||||
|
isTitle: true,
|
||||||
|
component: 'input',
|
||||||
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'name',
|
||||||
|
label: t('name'),
|
||||||
|
component: 'input',
|
||||||
|
columnField: {
|
||||||
|
component: null,
|
||||||
|
},
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'email',
|
||||||
|
label: t('email'),
|
||||||
|
component: 'input',
|
||||||
|
create: true,
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
label: '',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('View Summary'),
|
||||||
|
icon: 'preview',
|
||||||
|
action: (row) => viewSummary(row.id, AccountSummary),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
|
@ -46,99 +87,24 @@ const exprBuilder = (param, value) => {
|
||||||
return { [param]: value };
|
return { [param]: value };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getApiUrl = () => new URL(window.location).origin;
|
|
||||||
|
|
||||||
const navigate = (event, id) => {
|
|
||||||
if (event.ctrlKey || event.metaKey)
|
|
||||||
return window.open(`${getApiUrl()}/#/account/${id}/summary`);
|
|
||||||
router.push({ path: `/account/${id}` });
|
|
||||||
};
|
|
||||||
|
|
||||||
const openCreateModal = () => accountCreateDialogRef.value.show();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
|
||||||
<Teleport to="#searchbar">
|
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="AccountList"
|
data-key="AccountUsers"
|
||||||
url="VnUsers/preview"
|
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="exprBuilder"
|
||||||
:label="t('account.search')"
|
:label="t('account.search')"
|
||||||
:info="t('account.searchInfo')"
|
:info="t('account.searchInfo')"
|
||||||
/>
|
/>
|
||||||
</Teleport>
|
|
||||||
<Teleport to="#actions-append">
|
<VnTable
|
||||||
<div class="row q-gutter-x-sm">
|
ref="tableRef"
|
||||||
<QBtn
|
data-key="AccountUsers"
|
||||||
flat
|
|
||||||
@click="stateStore.toggleRightDrawer()"
|
|
||||||
round
|
|
||||||
dense
|
|
||||||
icon="menu"
|
|
||||||
>
|
|
||||||
<QTooltip bottom anchor="bottom right">
|
|
||||||
{{ t('globals.collapseMenu') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
</div>
|
|
||||||
</Teleport>
|
|
||||||
</template>
|
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
|
||||||
<QScrollArea class="fit text-grey-8">
|
|
||||||
<AccountFilter data-key="AccountList" :expr-builder="exprBuilder" />
|
|
||||||
</QScrollArea>
|
|
||||||
</QDrawer>
|
|
||||||
<QPage class="column items-center q-pa-md">
|
|
||||||
<div class="vn-card-list">
|
|
||||||
<VnPaginate
|
|
||||||
:filter="filter"
|
|
||||||
data-key="AccountList"
|
|
||||||
url="VnUsers/preview"
|
url="VnUsers/preview"
|
||||||
auto-load
|
order="id DESC"
|
||||||
>
|
:columns="columns"
|
||||||
<template #body="{ rows }">
|
default-mode="table"
|
||||||
<CardList
|
redirect="account"
|
||||||
v-for="row of rows"
|
:use-model="true"
|
||||||
:id="row.id"
|
|
||||||
:key="row.id"
|
|
||||||
:title="row.nickname"
|
|
||||||
@click="navigate($event, row.id)"
|
|
||||||
>
|
|
||||||
<template #list-items>
|
|
||||||
<VnLv :label="t('account.card.name')" :value="row.nickname">
|
|
||||||
</VnLv>
|
|
||||||
<VnLv
|
|
||||||
:label="t('account.card.nickname')"
|
|
||||||
:value="row.username"
|
|
||||||
>
|
|
||||||
</VnLv>
|
|
||||||
</template>
|
|
||||||
<template #actions>
|
|
||||||
<QBtn
|
|
||||||
:label="t('components.smartCard.openSummary')"
|
|
||||||
@click.stop="viewSummary(row.id, AccountSummary)"
|
|
||||||
color="primary"
|
|
||||||
style="margin-top: 15px"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</CardList>
|
|
||||||
</template>
|
|
||||||
</VnPaginate>
|
|
||||||
</div>
|
|
||||||
<QDialog
|
|
||||||
ref="accountCreateDialogRef"
|
|
||||||
transition-hide="scale"
|
|
||||||
transition-show="scale"
|
|
||||||
>
|
|
||||||
<AccountCreate />
|
|
||||||
</QDialog>
|
|
||||||
<QPageSticky :offset="[20, 20]" v-if="showNewUserBtn">
|
|
||||||
<QBtn @click="openCreateModal" color="primary" fab icon="add" />
|
|
||||||
<QTooltip class="text-no-wrap">
|
|
||||||
{{ t('account.card.newUser') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QPageSticky>
|
|
||||||
</QPage>
|
|
||||||
</template>
|
|
||||||
|
|
|
@ -1,23 +1,18 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, computed } from 'vue';
|
import { ref, onMounted, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const arrayData = useArrayData('AccountSamba');
|
const arrayData = useArrayData('AccountSamba');
|
||||||
|
|
||||||
const formModel = ref(null);
|
const formModel = ref(null);
|
||||||
|
|
||||||
const URL_UPDATE = `SambaConfigs/${1}`;
|
const URL_UPDATE = `SambaConfigs/${1}`;
|
||||||
const URL_CREATE = `SambaConfigs`;
|
const URL_CREATE = `SambaConfigs`;
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,12 @@ const onDataSaved = ({ id }) => {
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput v-model="data.alias" :label="t('mailAlias.name')" />
|
<VnInput v-model="data.alias" :label="t('mailAlias.name')" />
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.description"
|
v-model="data.description"
|
||||||
|
|
|
@ -1,22 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { computed } from 'vue';
|
|
||||||
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import AliasDescriptor from './AliasDescriptor.vue';
|
import AliasDescriptor from './AliasDescriptor.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const routeName = computed(() => route.name);
|
|
||||||
const customRouteRedirectName = computed(() => {
|
|
||||||
return routeName.value;
|
|
||||||
});
|
|
||||||
const searchBarDataKeys = {
|
|
||||||
AliasBasicData: 'AliasBasicData',
|
|
||||||
AliasUsers: 'AliasUsers',
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -24,10 +10,12 @@ const searchBarDataKeys = {
|
||||||
data-key="Alias"
|
data-key="Alias"
|
||||||
base-url="MailAliases"
|
base-url="MailAliases"
|
||||||
:descriptor="AliasDescriptor"
|
:descriptor="AliasDescriptor"
|
||||||
:search-data-key="searchBarDataKeys[routeName]"
|
search-data-key="AccountAliasList"
|
||||||
:search-custom-route-redirect="customRouteRedirectName"
|
:searchbar-props="{
|
||||||
:search-redirect="!!customRouteRedirectName"
|
url: 'MailAliases',
|
||||||
:searchbar-label="t('mailAlias.search')"
|
info: t('mailAlias.searchInfo'),
|
||||||
:searchbar-info="t('mailAlias.searchInfo')"
|
label: t('mailAlias.search'),
|
||||||
|
searchUrl: 'table',
|
||||||
|
}"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -28,6 +28,7 @@ const entityId = computed(() => $props.id || route.params.id);
|
||||||
ref="summary"
|
ref="summary"
|
||||||
:url="`MailAliases/${entityId}`"
|
:url="`MailAliases/${entityId}`"
|
||||||
@on-fetch="(data) => (alias = data)"
|
@on-fetch="(data) => (alias = data)"
|
||||||
|
data-key="MailAliasesSummary"
|
||||||
>
|
>
|
||||||
<template #header> {{ alias.id }} - {{ alias.alias }} </template>
|
<template #header> {{ alias.id }} - {{ alias.alias }} </template>
|
||||||
<template #body>
|
<template #body>
|
||||||
|
|
|
@ -37,9 +37,11 @@ watch(
|
||||||
<VnInput v-model="data.nickname" :label="t('account.card.alias')" />
|
<VnInput v-model="data.nickname" :label="t('account.card.alias')" />
|
||||||
<VnInput v-model="data.email" :label="t('account.card.email')" />
|
<VnInput v-model="data.email" :label="t('account.card.email')" />
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
url="Languages"
|
||||||
v-model="data.lang"
|
v-model="data.lang"
|
||||||
:options="['es', 'en']"
|
|
||||||
:label="t('account.card.lang')"
|
:label="t('account.card.lang')"
|
||||||
|
option-value="code"
|
||||||
|
option-label="code"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,34 +1,21 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import AccountDescriptor from './AccountDescriptor.vue';
|
import AccountDescriptor from './AccountDescriptor.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const routeName = computed(() => route.name);
|
|
||||||
const customRouteRedirectName = computed(() => routeName.value);
|
|
||||||
const searchBarDataKeys = {
|
|
||||||
AccountSummary: 'AccountSummary',
|
|
||||||
AccountInheritedRoles: 'AccountInheritedRoles',
|
|
||||||
AccountMailForwarding: 'AccountMailForwarding',
|
|
||||||
AccountMailAlias: 'AccountMailAlias',
|
|
||||||
AccountPrivileges: 'AccountPrivileges',
|
|
||||||
AccountLog: 'AccountLog',
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Account"
|
data-key="Account"
|
||||||
:descriptor="AccountDescriptor"
|
:descriptor="AccountDescriptor"
|
||||||
:search-data-key="searchBarDataKeys[routeName]"
|
search-data-key="AccountUsers"
|
||||||
:search-custom-route-redirect="customRouteRedirectName"
|
:searchbar-props="{
|
||||||
:search-redirect="!!customRouteRedirectName"
|
url: 'VnUsers/preview',
|
||||||
:searchbar-label="t('account.search')"
|
label: t('account.search'),
|
||||||
:searchbar-info="t('account.searchInfo')"
|
info: t('account.searchInfo'),
|
||||||
|
searchUrl: 'table',
|
||||||
|
}"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -54,7 +54,7 @@ const hasAccount = ref(false);
|
||||||
</template>
|
</template>
|
||||||
<template #before>
|
<template #before>
|
||||||
<!-- falla id :id="entityId.value" collection="user" size="160x160" -->
|
<!-- falla id :id="entityId.value" collection="user" size="160x160" -->
|
||||||
<VnImg :id="entityId" collection="user" size="160x160" class="photo">
|
<VnImg :id="entityId" collection="user" resolution="160x160" class="photo">
|
||||||
<template #error>
|
<template #error>
|
||||||
<div
|
<div
|
||||||
class="absolute-full picture text-center q-pa-md flex flex-center"
|
class="absolute-full picture text-center q-pa-md flex flex-center"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { useRoute } from 'vue-router';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
|
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
hasAccount: {
|
hasAccount: {
|
||||||
|
@ -21,7 +21,7 @@ const { t } = useI18n();
|
||||||
const { hasAccount } = toRefs($props);
|
const { hasAccount } = toRefs($props);
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const { notify } = useNotify();
|
||||||
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
||||||
account.value.hasAccount = hasAccount.value;
|
account.value.hasAccount = hasAccount.value;
|
||||||
const entityId = computed(() => +route.params.id);
|
const entityId = computed(() => +route.params.id);
|
||||||
|
@ -71,6 +71,15 @@ async function sync() {
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const removeAccount = async () => {
|
||||||
|
try {
|
||||||
|
await axios.delete(`VnUsers/${account.value.id}`);
|
||||||
|
notify(t('Account removed'), 'positive');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error deleting user', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnConfirm
|
<VnConfirm
|
||||||
|
@ -103,7 +112,7 @@ async function sync() {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnConfirm>
|
</VnConfirm>
|
||||||
<QItem v-ripple clickable @click="setPassword">
|
<!-- <QItem v-ripple clickable @click="setPassword">
|
||||||
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
|
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem
|
<QItem
|
||||||
|
@ -119,7 +128,8 @@ async function sync() {
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
|
<QItemSection>{{ t('account.card.actions.enableAccount.name') }}</QItemSection>
|
||||||
</QItem>
|
</QItem> -->
|
||||||
|
|
||||||
<QItem
|
<QItem
|
||||||
v-if="account.hasAccount"
|
v-if="account.hasAccount"
|
||||||
v-ripple
|
v-ripple
|
||||||
|
@ -168,20 +178,10 @@ async function sync() {
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
<QItem
|
<!-- <QItem @click="removeAccount(id)" v-ripple clickable>
|
||||||
@click="
|
|
||||||
openConfirmationModal(
|
|
||||||
t('account.card.actions.delete.title'),
|
|
||||||
t('account.card.actions.delete.subTitle'),
|
|
||||||
removeAccount
|
|
||||||
)
|
|
||||||
"
|
|
||||||
v-ripple
|
|
||||||
clickable
|
|
||||||
>
|
|
||||||
<QItemSection avatar>
|
<QItemSection avatar>
|
||||||
<QIcon name="delete" />
|
<QIcon name="delete" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t('account.card.actions.delete.name') }}</QItemSection>
|
<QItemSection>{{ t('account.card.actions.delete.name') }}</QItemSection>
|
||||||
</QItem>
|
</QItem> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -85,7 +85,7 @@ const fetchMailAliases = async () => {
|
||||||
paginateRef.value.fetch();
|
paginateRef.value.fetch();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAccountData = async () => {
|
const getAccountData = async (reload = true) => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
hasAccount.value = await fetchAccountExistence();
|
hasAccount.value = await fetchAccountExistence();
|
||||||
if (!hasAccount.value) {
|
if (!hasAccount.value) {
|
||||||
|
@ -93,7 +93,7 @@ const getAccountData = async () => {
|
||||||
store.data = [];
|
store.data = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await fetchMailAliases();
|
reload && (await fetchMailAliases());
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,13 +102,11 @@ const openCreateMailAliasForm = () => createMailAliasDialogRef.value.show();
|
||||||
watch(
|
watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
() => {
|
() => {
|
||||||
store.url = urlPath;
|
|
||||||
store.filter = filter.value;
|
|
||||||
getAccountData();
|
getAccountData();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
onMounted(async () => await getAccountData());
|
onMounted(async () => await getAccountData(false));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -33,7 +33,7 @@ const aliasOptions = ref([]);
|
||||||
@on-submit="emit('onSubmitCreateAlias', aliasFormData)"
|
@on-submit="emit('onSubmitCreateAlias', aliasFormData)"
|
||||||
>
|
>
|
||||||
<template #form-inputs>
|
<template #form-inputs>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('account.card.alias')"
|
:label="t('account.card.alias')"
|
||||||
|
|
|
@ -14,16 +14,11 @@ const rolesOptions = ref([]);
|
||||||
const formModelRef = ref();
|
const formModelRef = ref();
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData url="VnRoles" auto-load @on-fetch="(data) => (rolesOptions = data)" />
|
||||||
url="VnRoles"
|
|
||||||
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
|
||||||
auto-load
|
|
||||||
@on-fetch="(data) => (rolesOptions = data)"
|
|
||||||
/>
|
|
||||||
<FormModel
|
<FormModel
|
||||||
ref="formModelRef"
|
ref="formModelRef"
|
||||||
model="AccountPrivileges"
|
model="AccountPrivileges"
|
||||||
:url="`VnUsers/${route.params.id}`"
|
:url="`VnUsers/${route.params.id}/privileges`"
|
||||||
:url-create="`VnUsers/${route.params.id}/privileges`"
|
:url-create="`VnUsers/${route.params.id}/privileges`"
|
||||||
auto-load
|
auto-load
|
||||||
@on-data-saved="formModelRef.fetch()"
|
@on-data-saved="formModelRef.fetch()"
|
||||||
|
|
|
@ -1,23 +1,17 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { computed, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
|
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
|
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
dataKey: { type: String, required: true },
|
dataKey: { type: String, required: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const paginateRef = ref(null);
|
const paginateRef = ref(null);
|
||||||
|
|
||||||
const arrayData = useArrayData(props.dataKey);
|
const arrayData = useArrayData(props.dataKey);
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
|
|
||||||
const data = computed(() => {
|
const data = computed(() => {
|
||||||
const dataCopy = store.data;
|
const dataCopy = store.data;
|
||||||
return dataCopy.sort((a, b) => a.role?.name.localeCompare(b.role?.name));
|
return dataCopy.sort((a, b) => a.role?.name.localeCompare(b.role?.name));
|
||||||
|
@ -37,7 +31,6 @@ const filter = computed(() => ({
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const urlPath = 'RoleMappings';
|
const urlPath = 'RoleMappings';
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
name: 'name',
|
name: 'name',
|
||||||
|
|
|
@ -1,26 +1,62 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { computed, ref } from 'vue';
|
||||||
import { ref } from 'vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
|
||||||
import RoleSummary from './Card/RoleSummary.vue';
|
|
||||||
import RoleForm from './Card/RoleForm.vue';
|
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import AccountRolesFilter from './AccountRolesFilter.vue';
|
|
||||||
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
import RoleSummary from './Card/RoleSummary.vue';
|
||||||
|
const route = useRoute();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const router = useRouter();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const $props = defineProps({
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const tableRef = ref();
|
||||||
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
const columns = computed(() => [
|
||||||
const roleCreateDialogRef = ref(null);
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'id',
|
||||||
|
label: t('id'),
|
||||||
|
isId: true,
|
||||||
|
columnFilter: {
|
||||||
|
inWhere: true,
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'name',
|
||||||
|
label: t('name'),
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'description',
|
||||||
|
label: t('description'),
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
label: '',
|
||||||
|
name: 'tableActions',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
title: t('View Summary'),
|
||||||
|
icon: 'preview',
|
||||||
|
action: (row) => viewSummary(row.id, RoleSummary),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
|
@ -37,95 +73,30 @@ const exprBuilder = (param, value) => {
|
||||||
return { [param]: { like: `%${value}%` } };
|
return { [param]: { like: `%${value}%` } };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const openCreateModal = () => roleCreateDialogRef.value.show();
|
|
||||||
|
|
||||||
const getApiUrl = () => new URL(window.location).origin;
|
|
||||||
|
|
||||||
const navigate = (event, id) => {
|
|
||||||
if (event.ctrlKey || event.metaKey)
|
|
||||||
return window.open(`${getApiUrl()}/#/account/role/${id}/summary`);
|
|
||||||
router.push({ name: 'RoleSummary', params: { id } });
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
|
||||||
<Teleport to="#searchbar">
|
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="RolesList"
|
data-key="Roles"
|
||||||
url="VnRoles"
|
:expr-builder="exprBuilder"
|
||||||
:label="t('role.searchRoles')"
|
:label="t('role.searchRoles')"
|
||||||
:info="t('role.searchInfo')"
|
:info="t('role.searchInfo')"
|
||||||
/>
|
/>
|
||||||
</Teleport>
|
<VnTable
|
||||||
<Teleport to="#actions-append">
|
ref="tableRef"
|
||||||
<div class="row q-gutter-x-sm">
|
data-key="Roles"
|
||||||
<QBtn
|
:url="`VnRoles`"
|
||||||
flat
|
:create="{
|
||||||
@click="stateStore.toggleRightDrawer()"
|
urlCreate: 'VnRoles',
|
||||||
round
|
title: t('Create rol'),
|
||||||
dense
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
icon="menu"
|
formInitialData: {
|
||||||
>
|
editorFk: entityId,
|
||||||
<QTooltip bottom anchor="bottom right">
|
},
|
||||||
{{ t('globals.collapseMenu') }}
|
}"
|
||||||
</QTooltip>
|
order="id ASC"
|
||||||
</QBtn>
|
:columns="columns"
|
||||||
</div>
|
default-mode="table"
|
||||||
</Teleport>
|
redirect="account/role"
|
||||||
</template>
|
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
|
||||||
<QScrollArea class="fit text-grey-8">
|
|
||||||
<AccountRolesFilter data-key="RolesList" :expr-builder="exprBuilder" />
|
|
||||||
</QScrollArea>
|
|
||||||
</QDrawer>
|
|
||||||
<QPage class="column items-center q-pa-md">
|
|
||||||
<div class="vn-card-list">
|
|
||||||
<VnPaginate data-key="RolesList" url="VnRoles">
|
|
||||||
<template #body="{ rows }">
|
|
||||||
<CardList
|
|
||||||
:id="row.id"
|
|
||||||
:key="row.id"
|
|
||||||
:title="row.name"
|
|
||||||
@click="navigate($event, row.id)"
|
|
||||||
v-for="row of rows"
|
|
||||||
>
|
|
||||||
<template #list-items>
|
|
||||||
<div style="flex-direction: column; width: 100%">
|
|
||||||
<VnLv :label="t('role.card.name')" :value="row.name">
|
|
||||||
</VnLv>
|
|
||||||
<VnLv
|
|
||||||
:label="t('role.card.description')"
|
|
||||||
:value="row.description"
|
|
||||||
>
|
|
||||||
</VnLv>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #actions>
|
|
||||||
<QBtn
|
|
||||||
:label="t('components.smartCard.openSummary')"
|
|
||||||
@click.stop="viewSummary(row.id, RoleSummary)"
|
|
||||||
color="primary"
|
|
||||||
style="margin-top: 15px"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</CardList>
|
|
||||||
</template>
|
|
||||||
</VnPaginate>
|
|
||||||
</div>
|
|
||||||
<QDialog
|
|
||||||
ref="roleCreateDialogRef"
|
|
||||||
transition-show="scale"
|
|
||||||
transition-hide="scale"
|
|
||||||
>
|
|
||||||
<RoleForm />
|
|
||||||
</QDialog>
|
|
||||||
<QPageSticky :offset="[20, 20]">
|
|
||||||
<QBtn fab icon="add" color="primary" @click="openCreateModal()" />
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('role.newRole') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QPageSticky>
|
|
||||||
</QPage>
|
|
||||||
</template>
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@ const { t } = useI18n();
|
||||||
<template>
|
<template>
|
||||||
<FormModel :url="`VnRoles/${route.params.id}`" model="VnRole" auto-load>
|
<FormModel :url="`VnRoles/${route.params.id}`" model="VnRole" auto-load>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput v-model="data.name" :label="t('role.card.name')" />
|
<VnInput v-model="data.name" :label="t('role.card.name')" />
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.description"
|
v-model="data.description"
|
||||||
|
@ -23,11 +23,6 @@ const { t } = useI18n();
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
|
||||||
<div class="col">
|
|
||||||
<QCheckbox :label="t('mailAlias.isPublic')" v-model="data.isPublic" />
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,32 +1,20 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import RoleDescriptor from './RoleDescriptor.vue';
|
import RoleDescriptor from './RoleDescriptor.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const routeName = computed(() => route.name);
|
|
||||||
const customRouteRedirectName = computed(() => routeName.value);
|
|
||||||
const searchBarDataKeys = {
|
|
||||||
RoleSummary: 'RoleSummary',
|
|
||||||
RoleBasicData: 'RoleBasicData',
|
|
||||||
SubRoles: 'SubRoles',
|
|
||||||
InheritedRoles: 'InheritedRoles',
|
|
||||||
RoleLog: 'RoleLog',
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Role"
|
data-key="Role"
|
||||||
:descriptor="RoleDescriptor"
|
:descriptor="RoleDescriptor"
|
||||||
:search-data-key="searchBarDataKeys[routeName]"
|
search-data-key="AccountRoles"
|
||||||
:search-custom-route-redirect="customRouteRedirectName"
|
:searchbar-props="{
|
||||||
:search-redirect="!!customRouteRedirectName"
|
url: 'VnRoles',
|
||||||
:searchbar-label="t('role.searchRoles')"
|
label: t('role.searchRoles'),
|
||||||
:searchbar-info="t('role.searchInfo')"
|
info: t('role.searchInfo'),
|
||||||
|
searchUrl: 'table',
|
||||||
|
}"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -23,9 +21,6 @@ const $props = defineProps({
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const quasar = useQuasar();
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
|
@ -36,29 +31,13 @@ const setData = (entity) => (data.value = useCardDescription(entity.name, entity
|
||||||
const filter = {
|
const filter = {
|
||||||
where: { id: entityId },
|
where: { id: entityId },
|
||||||
};
|
};
|
||||||
const removeRole = () => {
|
const removeRole = async () => {
|
||||||
quasar
|
|
||||||
.dialog({
|
|
||||||
title: 'Are you sure you want to delete it?',
|
|
||||||
message: 'Delete department',
|
|
||||||
ok: {
|
|
||||||
push: true,
|
|
||||||
color: 'primary',
|
|
||||||
},
|
|
||||||
cancel: true,
|
|
||||||
})
|
|
||||||
.onOk(async () => {
|
|
||||||
try {
|
try {
|
||||||
await axios.post(
|
await axios.delete(`VnRoles/${entityId.value}`);
|
||||||
`/Departments/${entityId.value}/removeChild`,
|
notify(t('Role removed'), 'positive');
|
||||||
entityId.value
|
} catch (error) {
|
||||||
);
|
console.error('Error deleting role', error);
|
||||||
router.push({ name: 'WorkerDepartment' });
|
|
||||||
notify('department.departmentRemoved', 'positive');
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Error removing department');
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
@ -21,12 +20,12 @@ const { t } = useI18n();
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput v-model="data.name" :label="t('role.card.name')" />
|
<VnInput v-model="data.name" :label="t('role.card.name')" />
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.description"
|
v-model="data.description"
|
||||||
|
|
|
@ -2,17 +2,14 @@
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import FormPopup from 'components/FormPopup.vue';
|
import FormPopup from 'components/FormPopup.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onSubmitCreateSubrole']);
|
const emit = defineEmits(['onSubmitCreateSubrole']);
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
const subRoleFormData = reactive({
|
const subRoleFormData = reactive({
|
||||||
inheritsFrom: null,
|
inheritsFrom: null,
|
||||||
role: route.params.id,
|
role: route.params.id,
|
||||||
|
@ -33,7 +30,7 @@ const rolesOptions = ref([]);
|
||||||
@on-submit="emit('onSubmitCreateSubrole', subRoleFormData)"
|
@on-submit="emit('onSubmitCreateSubrole', subRoleFormData)"
|
||||||
>
|
>
|
||||||
<template #form-inputs>
|
<template #form-inputs>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('account.card.role')"
|
:label="t('account.card.role')"
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { computed, ref, watch } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import SubRoleCreateForm from './SubRoleCreateForm.vue';
|
import SubRoleCreateForm from './SubRoleCreateForm.vue';
|
||||||
|
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
@ -16,10 +14,8 @@ const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const paginateRef = ref(null);
|
const paginateRef = ref(null);
|
||||||
const createSubRoleDialogRef = ref(null);
|
const createSubRoleDialogRef = ref(null);
|
||||||
|
|
||||||
const arrayData = useArrayData('SubRoles');
|
const arrayData = useArrayData('SubRoles');
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ account:
|
||||||
delete:
|
delete:
|
||||||
name: Delete
|
name: Delete
|
||||||
title: The account will be deleted
|
title: The account will be deleted
|
||||||
subtitle: Are you sure you want to continue?
|
subTitle: Are you sure you want to continue?
|
||||||
success: ''
|
success: ''
|
||||||
search: Search user
|
search: Search user
|
||||||
searchInfo: You can search by id, name or nickname
|
searchInfo: You can search by id, name or nickname
|
||||||
|
|
|
@ -67,7 +67,7 @@ account:
|
||||||
delete:
|
delete:
|
||||||
name: Eliminar
|
name: Eliminar
|
||||||
title: El usuario será eliminado
|
title: El usuario será eliminado
|
||||||
subtitle: ¿Seguro que quieres continuar?
|
subTitle: ¿Seguro que quieres continuar?
|
||||||
success: ''
|
success: ''
|
||||||
search: Buscar usuario
|
search: Buscar usuario
|
||||||
searchInfo: Puedes buscar por id, nombre o usuario
|
searchInfo: Puedes buscar por id, nombre o usuario
|
||||||
|
|
|
@ -31,7 +31,7 @@ const destinationTypes = ref([]);
|
||||||
const totalClaimed = ref(null);
|
const totalClaimed = ref(null);
|
||||||
const DEFAULT_MAX_RESPONSABILITY = 5;
|
const DEFAULT_MAX_RESPONSABILITY = 5;
|
||||||
const DEFAULT_MIN_RESPONSABILITY = 1;
|
const DEFAULT_MIN_RESPONSABILITY = 1;
|
||||||
const arrayData = useArrayData('claimData');
|
const arrayData = useArrayData('Claim');
|
||||||
const marker_labels = [
|
const marker_labels = [
|
||||||
{ value: DEFAULT_MIN_RESPONSABILITY, label: t('claim.company') },
|
{ value: DEFAULT_MIN_RESPONSABILITY, label: t('claim.company') },
|
||||||
{ value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.person') },
|
{ value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.person') },
|
||||||
|
|
|
@ -10,13 +10,10 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
// import { useSession } from 'src/composables/useSession';
|
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
// const { getTokenMultimedia } = useSession();
|
|
||||||
// const token = getTokenMultimedia();
|
|
||||||
|
|
||||||
const claimStates = ref([]);
|
const claimStates = ref([]);
|
||||||
const claimStatesCopy = ref([]);
|
const claimStatesCopy = ref([]);
|
||||||
|
@ -74,7 +71,7 @@ const statesFilter = {
|
||||||
:reload="true"
|
:reload="true"
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate, filter }">
|
<template #form="{ data, validate, filter }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.client.name"
|
v-model="data.client.name"
|
||||||
:label="t('claim.customer')"
|
:label="t('claim.customer')"
|
||||||
|
@ -82,7 +79,7 @@ const statesFilter = {
|
||||||
/>
|
/>
|
||||||
<VnInputDate v-model="data.created" :label="t('claim.created')" />
|
<VnInputDate v-model="data.created" :label="t('claim.created')" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('claim.assignedTo')"
|
:label="t('claim.assignedTo')"
|
||||||
v-model="data.workerFk"
|
v-model="data.workerFk"
|
||||||
|
@ -94,15 +91,14 @@ const statesFilter = {
|
||||||
:rules="validate('claim.claimStateFk')"
|
:rules="validate('claim.claimStateFk')"
|
||||||
>
|
>
|
||||||
<template #before>
|
<template #before>
|
||||||
<QAvatar color="orange">
|
<VnAvatar
|
||||||
<VnImg
|
:worker-id="data.workerFk"
|
||||||
v-if="data.workerFk"
|
size="md"
|
||||||
:size="'160x160'"
|
:title="
|
||||||
:id="data.workerFk"
|
workersOptions.find(({ id }) => id == data.workerFk)?.name
|
||||||
collection="user"
|
"
|
||||||
spinner-color="white"
|
color="primary"
|
||||||
/>
|
/>
|
||||||
</QAvatar>
|
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
<QSelect
|
<QSelect
|
||||||
|
@ -120,7 +116,7 @@ const statesFilter = {
|
||||||
>
|
>
|
||||||
</QSelect>
|
</QSelect>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<QInput
|
<QInput
|
||||||
v-model.number="data.packages"
|
v-model.number="data.packages"
|
||||||
:label="t('globals.packages')"
|
:label="t('globals.packages')"
|
||||||
|
|
|
@ -11,9 +11,11 @@ import filter from './ClaimFilter.js';
|
||||||
:descriptor="ClaimDescriptor"
|
:descriptor="ClaimDescriptor"
|
||||||
:filter-panel="ClaimFilter"
|
:filter-panel="ClaimFilter"
|
||||||
search-data-key="ClaimList"
|
search-data-key="ClaimList"
|
||||||
search-url="Claims/filter"
|
|
||||||
searchbar-label="Search claim"
|
|
||||||
searchbar-info="You can search by claim id or customer name"
|
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
|
:searchbar-props="{
|
||||||
|
url: 'Claims/filter',
|
||||||
|
label: 'Search claim',
|
||||||
|
info: 'You can search by claim id or customer name',
|
||||||
|
}"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -20,7 +20,8 @@ const workers = ref([]);
|
||||||
const selected = ref([]);
|
const selected = ref([]);
|
||||||
const saveButtonRef = ref();
|
const saveButtonRef = ref();
|
||||||
|
|
||||||
const developmentsFilter = {
|
const developmentsFilter = computed(() => {
|
||||||
|
return {
|
||||||
fields: [
|
fields: [
|
||||||
'id',
|
'id',
|
||||||
'claimFk',
|
'claimFk',
|
||||||
|
@ -34,6 +35,7 @@ const developmentsFilter = {
|
||||||
claimFk: route.params.id,
|
claimFk: route.params.id,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -142,9 +144,9 @@ const columns = computed(() => [
|
||||||
ref="claimDevelopmentForm"
|
ref="claimDevelopmentForm"
|
||||||
:data-required="{ claimFk: route.params.id }"
|
:data-required="{ claimFk: route.params.id }"
|
||||||
v-model:selected="selected"
|
v-model:selected="selected"
|
||||||
auto-load
|
|
||||||
@save-changes="$router.push(`/claim/${route.params.id}/action`)"
|
@save-changes="$router.push(`/claim/${route.params.id}/action`)"
|
||||||
:default-save="false"
|
:default-save="false"
|
||||||
|
auto-load
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QTable
|
<QTable
|
||||||
|
|
|
@ -14,7 +14,8 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
const claimId = computed(() => $props.id || route.params.id);
|
const claimId = computed(() => $props.id || route.params.id);
|
||||||
|
|
||||||
const claimFilter = {
|
const claimFilter = computed(() => {
|
||||||
|
return {
|
||||||
where: { claimFk: claimId.value },
|
where: { claimFk: claimId.value },
|
||||||
fields: ['id', 'created', 'workerFk', 'text'],
|
fields: ['id', 'created', 'workerFk', 'text'],
|
||||||
include: {
|
include: {
|
||||||
|
@ -30,6 +31,7 @@ const claimFilter = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
claimFk: claimId.value,
|
claimFk: claimId.value,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, watch } from 'vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
@ -22,10 +22,8 @@ const claimDms = ref([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const client = ref({});
|
const client = ref({});
|
||||||
|
|
||||||
const inputFile = ref();
|
const inputFile = ref();
|
||||||
const files = ref({});
|
const files = ref({});
|
||||||
|
|
||||||
const spinnerRef = ref();
|
const spinnerRef = ref();
|
||||||
const claimDmsRef = ref();
|
const claimDmsRef = ref();
|
||||||
const dmsType = ref({});
|
const dmsType = ref({});
|
||||||
|
@ -58,6 +56,14 @@ const claimDmsFilter = ref({
|
||||||
const multimediaDialog = ref();
|
const multimediaDialog = ref();
|
||||||
const multimediaSlide = ref();
|
const multimediaSlide = ref();
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => router.currentRoute.value.params.id,
|
||||||
|
() => {
|
||||||
|
claimDmsFilter.value.where.id = router.currentRoute.value.params.id;
|
||||||
|
claimDmsRef.value.fetch();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
function openDialog(dmsId) {
|
function openDialog(dmsId) {
|
||||||
multimediaSlide.value = dmsId;
|
multimediaSlide.value = dmsId;
|
||||||
multimediaDialog.value = true;
|
multimediaDialog.value = true;
|
||||||
|
|
|
@ -279,7 +279,7 @@ async function changeState(value) {
|
||||||
<ClaimNotes
|
<ClaimNotes
|
||||||
:id="entityId"
|
:id="entityId"
|
||||||
:add-note="false"
|
:add-note="false"
|
||||||
class="max-container-height"
|
style="max-height: 300px"
|
||||||
order="created ASC"
|
order="created ASC"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
@ -330,7 +330,7 @@ async function changeState(value) {
|
||||||
<QTable
|
<QTable
|
||||||
:columns="detailsColumns"
|
:columns="detailsColumns"
|
||||||
:rows="salesClaimed"
|
:rows="salesClaimed"
|
||||||
flat
|
separator="horizontal"
|
||||||
dense
|
dense
|
||||||
:rows-per-page-options="[0]"
|
:rows-per-page-options="[0]"
|
||||||
hide-bottom
|
hide-bottom
|
||||||
|
@ -344,7 +344,7 @@ async function changeState(value) {
|
||||||
</template>
|
</template>
|
||||||
<template #body="props">
|
<template #body="props">
|
||||||
<QTr :props="props">
|
<QTr :props="props">
|
||||||
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
<QTd v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
<span v-if="col.name != 'description'">{{
|
<span v-if="col.name != 'description'">{{
|
||||||
t(col.value)
|
t(col.value)
|
||||||
}}</span>
|
}}</span>
|
||||||
|
@ -359,7 +359,7 @@ async function changeState(value) {
|
||||||
:id="props.row.sale.itemFk"
|
:id="props.row.sale.itemFk"
|
||||||
:sale-fk="props.row.saleFk"
|
:sale-fk="props.row.saleFk"
|
||||||
></ItemDescriptorProxy>
|
></ItemDescriptorProxy>
|
||||||
</QTh>
|
</QTd>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
@ -384,7 +384,7 @@ async function changeState(value) {
|
||||||
<template #body-cell-worker="props">
|
<template #body-cell-worker="props">
|
||||||
<QTd :props="props" class="link">
|
<QTd :props="props" class="link">
|
||||||
{{ props.value }}
|
{{ props.value }}
|
||||||
<WorkerDescriptorProxy :id="props.row.worker.id" />
|
<WorkerDescriptorProxy :id="props.row.worker?.id" />
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
|
|
@ -100,6 +100,7 @@ defineExpose({ states });
|
||||||
url="Items/withName"
|
url="Items/withName"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
:use-like="false"
|
||||||
sort-by="id DESC"
|
sort-by="id DESC"
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
|
|
|
@ -125,7 +125,7 @@ const STATE_COLOR = {
|
||||||
<VnTable
|
<VnTable
|
||||||
data-key="ClaimList"
|
data-key="ClaimList"
|
||||||
url="Claims/filter"
|
url="Claims/filter"
|
||||||
:order="['priority ASC', 'created DESC']"
|
:order="['priority ASC', 'created ASC']"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="claim"
|
redirect="claim"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
|
|
@ -1,120 +1,171 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onBeforeMount, ref, watch } from 'vue';
|
import { computed, onBeforeMount, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useRole } from 'src/composables/useRole';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { QCheckbox, QBtn, useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import { toCurrency, toDate, toDateHourMin } from 'src/filters';
|
import { toCurrency, toDate, toDateHourMin } from 'src/filters';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'composables/useState';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useValidator } from 'src/composables/useValidator';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import { usePrintService } from 'src/composables/usePrintService';
|
import { useSession } from 'composables/useSession';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
|
||||||
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
|
import VnSubToolbar from 'components/ui/VnSubToolbar.vue';
|
||||||
|
import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||||
|
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue';
|
import CustomerNewPayment from 'src/pages/Customer/components/CustomerNewPayment.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
|
||||||
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||||
const session = useSession();
|
|
||||||
|
|
||||||
const tokenMultimedia = session.getTokenMultimedia();
|
|
||||||
|
|
||||||
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const { sendEmail } = usePrintService();
|
const { sendEmail } = usePrintService();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { validate } = useValidator();
|
const { hasAny } = useRole();
|
||||||
|
|
||||||
|
const session = useSession();
|
||||||
|
const tokenMultimedia = session.getTokenMultimedia();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
|
|
||||||
const clientRisks = ref(null);
|
const clientRisk = ref([]);
|
||||||
const clientRisksRef = ref(null);
|
const tableRef = ref();
|
||||||
const companiesOptions = ref([]);
|
const companyId = ref();
|
||||||
const companyId = ref(null);
|
const companyLastId = ref(user.value.companyFk);
|
||||||
const receiptsRef = ref(null);
|
const balances = ref([]);
|
||||||
const receiptsData = ref([]);
|
const vnFilterRef = ref({});
|
||||||
|
const filter = computed(() => {
|
||||||
const filterCompanies = { order: ['code'] };
|
return {
|
||||||
const userParams = {
|
|
||||||
clientId: route.params.id,
|
clientId: route.params.id,
|
||||||
companyId: user.value.companyFk,
|
companyId: companyId.value ?? user.value.companyFk,
|
||||||
};
|
};
|
||||||
const filter = {
|
});
|
||||||
include: { relation: 'company', scope: { fields: ['code'] } },
|
|
||||||
where: { clientFk: route.params.id, companyFk: user.value.companyFk },
|
const companyFilterColumn = {
|
||||||
|
align: 'left',
|
||||||
|
name: 'companyId',
|
||||||
|
label: t('Company'),
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'Companies',
|
||||||
|
optionLabel: 'code',
|
||||||
|
sortBy: 'code',
|
||||||
|
limit: 0,
|
||||||
|
},
|
||||||
|
columnFilter: {
|
||||||
|
event: {
|
||||||
|
remove: () => (companyId.value = null),
|
||||||
|
'update:modelValue': (newCompanyFk) => {
|
||||||
|
if (!newCompanyFk) return;
|
||||||
|
vnFilterRef.value.addFilter(newCompanyFk);
|
||||||
|
companyLastId.value = newCompanyFk;
|
||||||
|
},
|
||||||
|
blur: () =>
|
||||||
|
!companyId.value &&
|
||||||
|
(companyId.value = companyLastId.value ?? user.value.companyFk),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
visible: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'payed',
|
name: 'payed',
|
||||||
format: (value) => toDate(value),
|
|
||||||
label: t('Date'),
|
label: t('Date'),
|
||||||
name: 'date',
|
format: ({ payed }) => toDate(payed),
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'created',
|
name: 'created',
|
||||||
format: (value) => toDateHourMin(value),
|
|
||||||
label: t('Creation date'),
|
label: t('Creation date'),
|
||||||
name: 'creationDate',
|
format: ({ created }) => toDateHourMin(created),
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'userName',
|
name: 'workerFk',
|
||||||
label: t('Employee'),
|
label: t('Employee'),
|
||||||
name: 'employee',
|
columnField: {
|
||||||
|
component: 'userLink',
|
||||||
|
attrs: ({ row }) => {
|
||||||
|
return {
|
||||||
|
workerId: row.workerFk,
|
||||||
|
name: row.userName,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'description',
|
name: 'description',
|
||||||
label: t('Reference'),
|
label: t('Reference'),
|
||||||
name: 'reference',
|
isTitle: true,
|
||||||
|
class: 'extend',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
field: 'bankFk',
|
name: 'bankFk',
|
||||||
label: t('Bank'),
|
label: t('Bank'),
|
||||||
name: 'bank',
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'debit',
|
|
||||||
format: (value) => value && toCurrency(value),
|
|
||||||
label: t('Debit'),
|
|
||||||
name: 'debit',
|
name: 'debit',
|
||||||
|
label: t('Debit'),
|
||||||
|
format: ({ debit }) => debit && toCurrency(debit),
|
||||||
|
isId: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'credit',
|
name: 'credit',
|
||||||
format: (value) => value && toCurrency(value),
|
|
||||||
label: t('Havings'),
|
label: t('Havings'),
|
||||||
name: 'havings',
|
format: ({ credit }) => credit && toCurrency(credit),
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
field: 'balance',
|
|
||||||
format: (value) => value && toCurrency(value),
|
|
||||||
label: t('Balance'),
|
|
||||||
name: 'balance',
|
name: 'balance',
|
||||||
|
label: t('Balance'),
|
||||||
|
format: ({ balance }) => toCurrency(balance),
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'isConciliate',
|
name: 'isConciliate',
|
||||||
label: t('Conciliated'),
|
label: t('Conciliated'),
|
||||||
name: 'conciliated',
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'totalWithVat',
|
name: 'tableActions',
|
||||||
label: '',
|
actions: [
|
||||||
name: 'actions',
|
{
|
||||||
|
title: t('globals.downloadPdf'),
|
||||||
|
icon: 'cloud_download',
|
||||||
|
show: (row) => row.isInvoice,
|
||||||
|
action: (row) => showBalancePdf(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('Send compensation'),
|
||||||
|
icon: 'outgoing_mail',
|
||||||
|
show: (row) => !!row.isCompensation,
|
||||||
|
action: ({ id }) =>
|
||||||
|
openConfirmationModal(
|
||||||
|
t('Send compensation'),
|
||||||
|
t('Do you want to report compensation to the client by mail?'),
|
||||||
|
() => sendEmail(`Receipts/${id}/balance-compensation-email`)
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -123,249 +174,124 @@ onBeforeMount(() => {
|
||||||
companyId.value = user.value.companyFk;
|
companyId.value = user.value.companyFk;
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
async function getClientRisk() {
|
||||||
() => route.params.id,
|
const { data } = await axios.get(`clientRisks`, {
|
||||||
(newValue) => {
|
params: {
|
||||||
if (!newValue) return;
|
filter: JSON.stringify({
|
||||||
userParams.clientId = newValue;
|
include: { relation: 'company', scope: { fields: ['code'] } },
|
||||||
filter.where.clientFk = newValue;
|
where: { clientFk: route.params.id, companyFk: user.value.companyFk },
|
||||||
getData();
|
}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
clientRisk.value = data;
|
||||||
|
return clientRisk.value;
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
const getData = () => {
|
async function getCurrentBalance() {
|
||||||
receiptsRef.value?.fetch();
|
const currentBalance = (await getClientRisk()).find((balance) => {
|
||||||
clientRisksRef.value?.fetch();
|
|
||||||
};
|
|
||||||
|
|
||||||
const getCurrentBalance = () => {
|
|
||||||
const currentBalance = clientRisks.value.find((balance) => {
|
|
||||||
return balance.companyFk === companyId.value;
|
return balance.companyFk === companyId.value;
|
||||||
});
|
});
|
||||||
return currentBalance && currentBalance.amount;
|
return currentBalance && currentBalance.amount;
|
||||||
};
|
|
||||||
|
|
||||||
const onFetch = (balances) => {
|
|
||||||
balances.forEach((balance, index) => {
|
|
||||||
if (index === 0) {
|
|
||||||
balance.balance = getCurrentBalance();
|
|
||||||
} else {
|
|
||||||
let previousBalance = balances[index - 1];
|
|
||||||
balance.balance =
|
|
||||||
previousBalance.balance -
|
|
||||||
(previousBalance.debit - previousBalance.credit);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
receiptsData.value = balances;
|
async function onFetch(data) {
|
||||||
};
|
balances.value = [];
|
||||||
|
for (const [index, balance] of data.entries()) {
|
||||||
|
if (index === 0) {
|
||||||
|
balance.balance = await getCurrentBalance();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const previousBalance = data[index - 1];
|
||||||
|
balance.balance =
|
||||||
|
previousBalance?.balance - (previousBalance?.debit - previousBalance?.credit);
|
||||||
|
}
|
||||||
|
balances.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
const showNewPaymentDialog = () => {
|
const showNewPaymentDialog = () => {
|
||||||
quasar.dialog({
|
quasar.dialog({
|
||||||
component: CustomerNewPayment,
|
component: CustomerNewPayment,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
companyId: companyId.value,
|
companyId: companyId.value,
|
||||||
totalCredit: clientRisks.value[0]?.amount,
|
totalCredit: clientRisk.value[0]?.amount,
|
||||||
promise: getData,
|
promise: () => tableRef.value.reload(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateCompanyId = (id) => {
|
const showBalancePdf = ({ id }) => {
|
||||||
if (id) {
|
const url = `api/InvoiceOuts/${id}/download?access_token=${tokenMultimedia}`;
|
||||||
companyId.value = id;
|
|
||||||
userParams.companyId = id;
|
|
||||||
filter.where.companyFk = id;
|
|
||||||
}
|
|
||||||
getData();
|
|
||||||
};
|
|
||||||
|
|
||||||
const saveFieldValue = async (row) => {
|
|
||||||
try {
|
|
||||||
const payload = { description: row.description };
|
|
||||||
await axios.patch(`Receipts/${row.id}`, payload);
|
|
||||||
} catch (err) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const sendEmailAction = () => {
|
|
||||||
sendEmail(`Suppliers/${route.params.id}/campaign-metrics-email`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const showBalancePdf = (balance) => {
|
|
||||||
const url = `api/InvoiceOuts/${balance.id}/download?access_token=${tokenMultimedia}`;
|
|
||||||
window.open(url, '_blank');
|
window.open(url, '_blank');
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<VnSubToolbar class="q-mb-md">
|
||||||
:filter="filter"
|
<template #st-data>
|
||||||
@on-fetch="(data) => (clientRisks = data)"
|
<div class="column justify-center q-px-md q-py-sm">
|
||||||
auto-load
|
<span class="text-bold">{{ t('Total by company') }}</span>
|
||||||
ref="clientRisksRef"
|
<div class="row justify-center" v-if="clientRisk?.length">
|
||||||
url="ClientRisks"
|
{{ clientRisk[0].company.code }}:
|
||||||
|
{{ toCurrency(clientRisk[0].amount) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #st-actions>
|
||||||
|
<div>
|
||||||
|
<VnFilter
|
||||||
|
ref="vnFilterRef"
|
||||||
|
v-model="companyId"
|
||||||
|
data-key="CustomerBalance"
|
||||||
|
:column="companyFilterColumn"
|
||||||
|
search-url="balance"
|
||||||
/>
|
/>
|
||||||
<FetchData
|
</div>
|
||||||
:filter="filterCompanies"
|
</template>
|
||||||
@on-fetch="(data) => (companiesOptions = data)"
|
</VnSubToolbar>
|
||||||
auto-load
|
<VnTable
|
||||||
url="Companies"
|
ref="tableRef"
|
||||||
/>
|
|
||||||
|
|
||||||
<VnPaginate
|
|
||||||
auto-load
|
|
||||||
data-key="CustomerBalance"
|
data-key="CustomerBalance"
|
||||||
url="Receipts/filter"
|
url="Receipts/filter"
|
||||||
:user-params="userParams"
|
search-url="balance"
|
||||||
ref="receiptsRef"
|
:user-params="filter"
|
||||||
@on-fetch="onFetch"
|
|
||||||
>
|
|
||||||
<template #body="{ rows }">
|
|
||||||
<QTable
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:no-data-label="t('globals.noResults')"
|
:right-search="false"
|
||||||
:rows-per-page-options="[0]"
|
:is-editable="false"
|
||||||
:rows="rows"
|
:column-search="false"
|
||||||
class="full-width q-mt-md"
|
@on-fetch="onFetch"
|
||||||
row-key="id"
|
auto-load
|
||||||
>
|
>
|
||||||
<template #body-cell-employee="{ row }">
|
<template #column-balance="{ rowIndex }">
|
||||||
<QTd auto-width @click.stop>
|
{{ toCurrency(balances[rowIndex]?.balance) }}
|
||||||
<QBtn color="blue" flat no-caps>{{ row.userName }}</QBtn>
|
|
||||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-description="{ row }">
|
||||||
<template #body-cell-reference="{ row }">
|
<div class="link" v-if="row.isInvoice">
|
||||||
<QTd auto-width @click.stop v-if="row.isInvoice">
|
{{ row.description }}
|
||||||
<QBtn color="blue" dense flat>
|
<InvoiceOutDescriptorProxy :id="row.description" />
|
||||||
{{ t('bill', { ref: row.description }) }}
|
</div>
|
||||||
</QBtn>
|
<span v-else class="q-pa-xs dotted rounded-borders" :title="row.description">
|
||||||
<InvoiceOutDescriptorProxy :id="row.id" />
|
{{ row.description }}
|
||||||
</QTd>
|
|
||||||
<QTd v-else>
|
|
||||||
<VnInput
|
|
||||||
@keyup.enter="saveFieldValue(row)"
|
|
||||||
autofocus
|
|
||||||
clearable
|
|
||||||
dense
|
|
||||||
v-model="row.description"
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #body-cell-conciliated="{ row }">
|
|
||||||
<QTd align="center">
|
|
||||||
<QCheckbox :model-value="row.isConciliate === 1" disable />
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #body-cell-actions="{ row }">
|
|
||||||
<QTd align="center">
|
|
||||||
<QIcon
|
|
||||||
@click.stop="showDialog = true"
|
|
||||||
class="q-ml-md fill-icon"
|
|
||||||
color="primary"
|
|
||||||
name="outgoing_mail"
|
|
||||||
size="sm"
|
|
||||||
v-if="row.isCompensation"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Send compensation') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon
|
|
||||||
@click="showBalancePdf(row)"
|
|
||||||
class="q-ml-md fill-icon"
|
|
||||||
color="primary"
|
|
||||||
name="cloud_download"
|
|
||||||
size="sm"
|
|
||||||
v-if="row.hasPdf"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('globals.downloadPdf') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
|
|
||||||
<QDialog v-model="showDialog">
|
|
||||||
<QCard class="q-pa-sm">
|
|
||||||
<QCardSection>
|
|
||||||
<span
|
|
||||||
ref="closeButton"
|
|
||||||
class="flex justify-end color-vn-label"
|
|
||||||
v-close-popup
|
|
||||||
>
|
|
||||||
<QIcon name="close" size="sm" />
|
|
||||||
</span>
|
</span>
|
||||||
<div class="text-h6">
|
<QPopupEdit
|
||||||
{{ t('Send compensation') }}
|
v-model="row.description"
|
||||||
</div>
|
v-slot="scope"
|
||||||
</QCardSection>
|
@save="
|
||||||
<QCardSection>
|
(value) =>
|
||||||
<div>
|
value != row.description &&
|
||||||
{{
|
axios.patch(`Receipts/${row.id}`, { description: value })
|
||||||
t(
|
"
|
||||||
'Do you want to report compensation to the client by mail?'
|
auto-save
|
||||||
)
|
>
|
||||||
}}
|
<VnInput
|
||||||
</div>
|
v-model="scope.value"
|
||||||
</QCardSection>
|
:disable="!hasAny(['administrative'])"
|
||||||
<QCardActions class="flex justify-end q-mb-sm">
|
@keypress.enter="scope.set"
|
||||||
<QBtn
|
autofocus
|
||||||
:label="t('globals.cancel')"
|
|
||||||
color="primary"
|
|
||||||
flat
|
|
||||||
v-close-popup
|
|
||||||
/>
|
/>
|
||||||
<QBtn
|
</QPopupEdit>
|
||||||
:label="t('globals.save')"
|
|
||||||
@click="sendEmailAction"
|
|
||||||
class="q-ml-sm"
|
|
||||||
color="primary"
|
|
||||||
/>
|
|
||||||
</QCardActions>
|
|
||||||
</QCard>
|
|
||||||
</QDialog>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</VnTable>
|
||||||
</template>
|
<QPageSticky :offset="[18, 18]" style="z-index: 2">
|
||||||
</VnPaginate>
|
|
||||||
|
|
||||||
<QDrawer :width="256" show-if-above side="right" v-model="stateStore.rightDrawer">
|
|
||||||
<div class="q-mt-xl q-px-md">
|
|
||||||
<VnSelect
|
|
||||||
:label="t('Company')"
|
|
||||||
:options="companiesOptions"
|
|
||||||
@update:model-value="updateCompanyId($event)"
|
|
||||||
hide-selected
|
|
||||||
option-label="code"
|
|
||||||
option-value="id"
|
|
||||||
v-model="companyId"
|
|
||||||
:rules="validate('entry.companyFk')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<QCard class="q-ma-md q-pa-md q-mt-lg" v-if="receiptsData?.length">
|
|
||||||
<QCardSection>
|
|
||||||
<div class="flex justify-center text-subtitle1 text-bold">
|
|
||||||
{{ t('Total by company') }}
|
|
||||||
</div>
|
|
||||||
<div class="flex justify-center">
|
|
||||||
<div class="q-mr-sm" v-if="clientRisks?.length">
|
|
||||||
{{ clientRisks[0].company.code }}:
|
|
||||||
</div>
|
|
||||||
<div v-if="clientRisks?.length">
|
|
||||||
{{ toCurrency(clientRisks[0].amount) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</QCardSection>
|
|
||||||
</QCard>
|
|
||||||
</QDrawer>
|
|
||||||
|
|
||||||
<QPageSticky :offset="[18, 18]">
|
|
||||||
<QBtn @click.stop="showNewPaymentDialog()" color="primary" fab icon="add" />
|
<QBtn @click.stop="showNewPaymentDialog()" color="primary" fab icon="add" />
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('New payment') }}
|
{{ t('New payment') }}
|
||||||
|
@ -393,3 +319,12 @@ es:
|
||||||
Send compensation: Enviar compensación
|
Send compensation: Enviar compensación
|
||||||
Do you want to report compensation to the client by mail?: ¿Desea informar de la compensación al cliente por correo?
|
Do you want to report compensation to the client by mail?: ¿Desea informar de la compensación al cliente por correo?
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.dotted {
|
||||||
|
border: 1px dotted var(--vn-header-color);
|
||||||
|
}
|
||||||
|
.dotted:hover {
|
||||||
|
border: 1px dotted $primary;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -7,67 +7,30 @@ import FetchData from 'components/FetchData.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const workers = ref([]);
|
|
||||||
const workersCopy = ref([]);
|
|
||||||
const businessTypes = ref([]);
|
const businessTypes = ref([]);
|
||||||
const contactChannels = ref([]);
|
const contactChannels = ref([]);
|
||||||
|
const title = ref();
|
||||||
function setWorkers(data) {
|
|
||||||
workers.value = data;
|
|
||||||
workersCopy.value = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
const filterOptions = {
|
|
||||||
options: workers,
|
|
||||||
filterFn: (options, value) => {
|
|
||||||
const search = value.toLowerCase();
|
|
||||||
|
|
||||||
if (value === '') return workersCopy.value;
|
|
||||||
|
|
||||||
return options.value.filter((row) => {
|
|
||||||
const id = row.id;
|
|
||||||
const name = row.name.toLowerCase();
|
|
||||||
|
|
||||||
const idMatches = id === search;
|
|
||||||
const nameMatches = name.indexOf(search) > -1;
|
|
||||||
|
|
||||||
return idMatches || nameMatches;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<fetch-data
|
<FetchData
|
||||||
url="Workers/activeWithInheritedRole"
|
|
||||||
:filter="{ where: { role: 'salesPerson' } }"
|
|
||||||
@on-fetch="setWorkers"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<fetch-data
|
|
||||||
url="ContactChannels"
|
url="ContactChannels"
|
||||||
@on-fetch="(data) => (contactChannels = data)"
|
@on-fetch="(data) => (contactChannels = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
<FetchData
|
||||||
url="BusinessTypes"
|
url="BusinessTypes"
|
||||||
@on-fetch="(data) => (businessTypes = data)"
|
@on-fetch="(data) => (businessTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<fetch-data
|
|
||||||
:filter="filter"
|
|
||||||
@on-fetch="(data) => (clients = data)"
|
|
||||||
auto-load
|
|
||||||
url="Clients"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<FormModel :url="`Clients/${route.params.id}`" auto-load model="customer">
|
<FormModel :url="`Clients/${route.params.id}`" auto-load model="customer">
|
||||||
<template #form="{ data, validate, filter }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('globals.name')"
|
:label="t('globals.name')"
|
||||||
:rules="validate('client.socialName')"
|
:rules="validate('client.socialName')"
|
||||||
|
@ -75,7 +38,6 @@ const filterOptions = {
|
||||||
clearable
|
clearable
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<QSelect
|
<QSelect
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
:label="t('customer.basicData.businessType')"
|
:label="t('customer.basicData.businessType')"
|
||||||
|
@ -88,7 +50,7 @@ const filterOptions = {
|
||||||
v-model="data.businessTypeFk"
|
v-model="data.businessTypeFk"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('customer.basicData.contact')"
|
:label="t('customer.basicData.contact')"
|
||||||
:rules="validate('client.contact')"
|
:rules="validate('client.contact')"
|
||||||
|
@ -111,7 +73,7 @@ const filterOptions = {
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</VnInput>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('customer.basicData.phone')"
|
:label="t('customer.basicData.phone')"
|
||||||
:rules="validate('client.phone')"
|
:rules="validate('client.phone')"
|
||||||
|
@ -125,31 +87,26 @@ const filterOptions = {
|
||||||
v-model="data.mobile"
|
v-model="data.mobile"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<QSelect
|
<VnSelect
|
||||||
:input-debounce="0"
|
url="Workers/activeWithInheritedRole"
|
||||||
:label="t('customer.basicData.salesPerson')"
|
:filter="{ where: { role: 'salesPerson' } }"
|
||||||
:options="workers"
|
option-filter="firstName"
|
||||||
:rules="validate('client.salesPersonFk')"
|
|
||||||
@filter="(value, update) => filter(value, update, filterOptions)"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
use-input
|
|
||||||
v-model="data.salesPersonFk"
|
v-model="data.salesPersonFk"
|
||||||
|
:label="t('customer.basicData.salesPerson')"
|
||||||
|
:rules="validate('client.salesPersonFk')"
|
||||||
|
:use-like="false"
|
||||||
|
:emit-value="false"
|
||||||
|
@update:model-value="(val) => (title = val?.nickname)"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<QAvatar color="orange">
|
<VnAvatar
|
||||||
<VnImg
|
:worker-id="data.salesPersonFk"
|
||||||
v-if="data.salesPersonFk"
|
color="primary"
|
||||||
:id="user.id"
|
:title="title"
|
||||||
collection="user"
|
|
||||||
spinner-color="white"
|
|
||||||
/>
|
/>
|
||||||
</QAvatar>
|
|
||||||
</template>
|
</template>
|
||||||
</QSelect>
|
</VnSelect>
|
||||||
<QSelect
|
<QSelect
|
||||||
v-model="data.contactChannelFk"
|
v-model="data.contactChannelFk"
|
||||||
:options="contactChannels"
|
:options="contactChannels"
|
||||||
|
@ -162,7 +119,7 @@ const filterOptions = {
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow>
|
||||||
<QSelect
|
<QSelect
|
||||||
:input-debounce="0"
|
:input-debounce="0"
|
||||||
:label="t('customer.basicData.previousClient')"
|
:label="t('customer.basicData.previousClient')"
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue