Merge branch 'dev' of https: refs #7702//gitea.verdnatura.es/verdnatura/salix-front into 7702_fix_setPassword
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
6983245d7d
|
@ -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
|
||||||
|
|
|
@ -14,5 +14,5 @@
|
||||||
"[vue]": {
|
"[vue]": {
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
},
|
},
|
||||||
"cSpell.words": ["axios"]
|
"cSpell.words": ["axios", "composables"]
|
||||||
}
|
}
|
||||||
|
|
392
CHANGELOG.md
392
CHANGELOG.md
|
@ -1,3 +1,395 @@
|
||||||
|
# Version 24.36 - 2024-08-27
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- feat(FormModel): trim data by default by:alexm
|
||||||
|
- feat(orderBasicData): add notes by:alexm
|
||||||
|
- feat(orderList): correct create order by:alexm
|
||||||
|
- feat(orderList): use orderFilter and fixed this by:alexm
|
||||||
|
- feat: #7323 handle workerPhoto (origin/7323_workerPhoto, 7323_workerPhoto) by:Javier Segarra
|
||||||
|
- feat: add recover password and reset password by:alexm
|
||||||
|
- feat: refs #7346 add seriaType option by:jgallego
|
||||||
|
- feat: refs #7346 elimino === by:jgallego
|
||||||
|
- feat: refs #7346 formdata uses serialType by:jgallego
|
||||||
|
- feat: refs #7346 refactor by:jgallego
|
||||||
|
- feat: refs #7346 sonarLint warnings (origin/7346-invoiceOutMultilple, 7346-invoiceOutMultilple) by:jgallego
|
||||||
|
- feat: refs #7710 uses cloneAll by:jgallego
|
||||||
|
- fix: refs #7717 fix OrderList table filters' and summary table style by:Jon
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- feat: refs #7346 refactor by:jgallego
|
||||||
|
- perf: date fields (mindshore/feature/TicketFutureFilter, feature/TicketFutureFilter) by:Javier Segarra
|
||||||
|
- perf: refs #7717 right menu filter by:Jon
|
||||||
|
- perf: use ref at component start by:Javier Segarra
|
||||||
|
- refactor: refs #7717 delete useless function and import by:Jon
|
||||||
|
- refactor: refs #7717 deleted useless code by:Jon
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- feat(orderList): use orderFilter and fixed this by:alexm
|
||||||
|
- fix(VnTable): orderBy v-model by:alexm
|
||||||
|
- fix(account_card): redirection by:carlossa
|
||||||
|
- fix(orderLines): reload when delete and redirect when confirm by:alexm
|
||||||
|
- fix: #6336 ClaimListStates by:Javier Segarra
|
||||||
|
- fix: account subsections cards by:carlossa
|
||||||
|
- fix: duplicate key by:Jon
|
||||||
|
- fix: order description to vnTable by:alexm
|
||||||
|
- fix: orderCatalogFilter order by:alexm
|
||||||
|
- fix: quasar build warnings (6336_claim_fix_states) by:Javier Segarra
|
||||||
|
- fix: refs #7717 fix OrderList table filters' and summary table style by:Jon
|
||||||
|
- fix: refs #7717 fix basic data form & minor errors by:Jon
|
||||||
|
- fix: refs #7717 fix catalog filter, searchbar redirect and search by:Jon
|
||||||
|
- fix: refs #7717 fix catalog searchbar and worker tests(refs #7323) by:Jon
|
||||||
|
- fix: refs #7717 fix order sections by:Jon
|
||||||
|
- fix: refs #7717 fix volume and lines redirect by:Jon
|
||||||
|
- fix: refs #7717 fixed searchbar filter with rightmenu filters' applied by:Jon
|
||||||
|
- fix: test by:alexm
|
||||||
|
- fix: ticketDescriptorMenu by:Javier Segarra
|
||||||
|
- refs #7355 account fixes by:carlossa
|
||||||
|
|
||||||
|
# Version 24.34 - 2024-08-20
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- chore: #6900 order params by:jorgep
|
||||||
|
- chore: refs #6900 drop console log by:jorgep
|
||||||
|
- chore: refs #6900 drop vnCurrency by:jorgep
|
||||||
|
- chore: refs #6900 fix e2e tests by:jorgep
|
||||||
|
- chore: refs #6900 mv rectificative logic by:jorgep
|
||||||
|
- chore: refs #6900 responsive code by:jorgep
|
||||||
|
- chore: refs #7283 drop array types by:jorgep
|
||||||
|
- chore: refs #7283 drop import by:jorgep
|
||||||
|
- chore: refs #7283 fix e2e logout by:jorgep
|
||||||
|
- chore: refs #7283 update VnAvatar title handling by:jorgep
|
||||||
|
- chore: refs #7323 fix test by:jorgep
|
||||||
|
- chore: refs #7323 remove unused import by:jorgep
|
||||||
|
- chore: refs #7323drop commented code by:jorgep
|
||||||
|
- feat(VnCard): use props searchbar by:alexm
|
||||||
|
- feat(customer): improve basicData to balance by:alexm
|
||||||
|
- feat(customer_balance): refs #6943 add functionality from salix by:alexm
|
||||||
|
- feat(customer_balance): refs #6943 translations by:alexm
|
||||||
|
- feat: refs #6130 husky commitLint config by:pablone
|
||||||
|
- feat: refs #6130 husky hooks by:pablone
|
||||||
|
- feat: refs #6900 add InvoiceInSerial by:jorgep
|
||||||
|
- feat: refs #6900 add locale by:jorgep
|
||||||
|
- feat: refs #6900 use VnTable & sort filter fields by:jorgep
|
||||||
|
- feat: refs #7323 add flex-wrap by:jorgep
|
||||||
|
- feat: refs #7323 add my account" btn & fix models log selectable by:jorgep
|
||||||
|
- feat: refs #7323 improve test by:jorgep
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- refactor(customer_log: use VnLog by:alexm
|
||||||
|
- refactor(customer_recovery): to vnTable by:alexm
|
||||||
|
- refactor(customer_webAccess): FormModel by:alexm
|
||||||
|
- refactor: refs #7283 update avatar size and color by:jorgep
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- chore: refs #6900 fix e2e tests by:jorgep
|
||||||
|
- chore: refs #7283 fix e2e logout by:jorgep
|
||||||
|
- chore: refs #7323 fix test by:jorgep
|
||||||
|
- feat: refs #7323 add my account" btn & fix models log selectable by:jorgep
|
||||||
|
- fix #7355 fix acls list by:carlossa
|
||||||
|
- fix(VnFilterPanel): emit userParams better by:alexm
|
||||||
|
- fix(claim_summary): url links (HEAD -> 7864_testToMaster_2434, origin/test, origin/7864_testToMaster_2434, test) by:alexm
|
||||||
|
- fix(customer_sms: fix reload by:alexm
|
||||||
|
- fix(twoFactor): unify code login and twoFactor by:alexm
|
||||||
|
- fix: VnCard VnSearchbar props by:alexm
|
||||||
|
- fix: accountMailAlias by:alexm
|
||||||
|
- fix: refs #6130 add commit lint modules by:pablone
|
||||||
|
- fix: refs #6130 pnpm-lock.yml by:pablone
|
||||||
|
- fix: refs #6900 improve loading by:jorgep
|
||||||
|
- fix: refs #6900 improve logic (origin/6900-addSerial) by:jorgep
|
||||||
|
- fix: refs #6900 improve logic by:jorgep
|
||||||
|
- fix: refs #6900 rectificative btn reactivity by:jorgep
|
||||||
|
- fix: refs #6900 use type number by:jorgep
|
||||||
|
- fix: refs #6900 vat & dueday by:jorgep
|
||||||
|
- fix: refs #6900 vat, dueday & intrastat by:jorgep
|
||||||
|
- fix: refs #6989 show entity name & default time from config table by:jorgep
|
||||||
|
- fix: refs #7283 basicData locale by:jorgep
|
||||||
|
- fix: refs #7283 itemLastEntries filter by:jorgep
|
||||||
|
- fix: refs #7283 itemTags & VnImg by:jorgep
|
||||||
|
- fix: refs #7283 locale by:jorgep
|
||||||
|
- fix: refs #7283 min-width vnImg by:jorgep
|
||||||
|
- fix: refs #7283 use vnAvatar & add optional zoom by:jorgep
|
||||||
|
- fix: refs #7283 userPanel pic by:jorgep
|
||||||
|
- fix: refs #7323 add department popup by:jorgep
|
||||||
|
- fix: refs #7323 add locale by:jorgep
|
||||||
|
- fix: refs #7323 css righ menu by:jorgep
|
||||||
|
- fix: refs #7323 data-key & add select by:jorgep
|
||||||
|
- fix: refs #7323 load all opts by:jorgep
|
||||||
|
- fix: refs #7323 righ menu bug by:jorgep
|
||||||
|
- fix: refs #7323 use global locale by:jorgep
|
||||||
|
- fix: refs #7323 use workerFilter (origin/7323-warmfix-fixErrors) by:jorgep
|
||||||
|
- fix: refs #7323 vnsubtoolbar css by:jorgep
|
||||||
|
- fix: refs #7323 wrong css by:jorgep
|
||||||
|
- refs #7355 fix Rol, alias by:carlossa
|
||||||
|
- refs #7355 fix accountAlias by:carlossa
|
||||||
|
- refs #7355 fix alias summary by:carlossa
|
||||||
|
- refs #7355 fix conflicts by:carlossa
|
||||||
|
- refs #7355 fix create Rol by:carlossa
|
||||||
|
- refs #7355 fix list by:carlossa
|
||||||
|
- refs #7355 fix lists redirects summary by:carlossa
|
||||||
|
- refs #7355 fix roles by:carlossa
|
||||||
|
- refs #7355 fix search exprBuilder by:carlossa
|
||||||
|
- refs #7355 fix vnTable by:carlossa
|
||||||
|
|
||||||
|
# Version 24.32 - 2024-08-06
|
||||||
|
|
||||||
|
### 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
|
||||||
|
|
||||||
|
### Added 🆕
|
||||||
|
|
||||||
|
- Change header titles style by:wbuezas
|
||||||
|
- chore: refs #7436 fix e2e (origin/7436-showQCheckbox) by:jorgep
|
||||||
|
- feat: #7196 eslint (origin/7196-cjsToEsm) by:jgallego
|
||||||
|
- feat: adapt tu VnTable → CrudModel by:alexm
|
||||||
|
- feat(CustomerFIlter): use correct table by:alexm
|
||||||
|
- feat(customerList): add searchbar by:alexm
|
||||||
|
- feat: customerList is customerExtendedList by:alexm
|
||||||
|
- feat: fixes #7196 by:jgallego
|
||||||
|
- feat: refs #6739 transferInvoice new checkbox and functionality by:Jon
|
||||||
|
- feat: refs #6825 create vnTable and add in CustomerExtendedList by:alexm
|
||||||
|
- feat: refs #6825 create vnTableColumn, cardActions by:alexm
|
||||||
|
- feat: refs #6825 fix modes by:alexm
|
||||||
|
- feat: refs #6825 qchip color by:alexm
|
||||||
|
- feat: refs #6825 right filter panel (6825-vnTable) by:alexm
|
||||||
|
- feat: refs #6825 scroll for table mode by:alexm
|
||||||
|
- feat: refs #6825 share filters, create popup by:alexm
|
||||||
|
- feat: refs #6825 VnComponent mix component and attrs Form to create new row by:alexm
|
||||||
|
- feat: refs #6825 VnTableFilter and VnPanelFilter init by:alexm
|
||||||
|
- feat: refs #6826 added rol summary link by:Jon
|
||||||
|
- feat: refs #6896 created VnImg and added to order module by:Jon
|
||||||
|
- feat: refs #6896 new filters by:Jon
|
||||||
|
- feat: refs #7129 fix some code and add order by:pablone
|
||||||
|
- feat: refs #7436 show checkbox by:jorgep
|
||||||
|
- feat: refs #7545 Deleted hasIncoterms client column (origin/7545-hasIncoterms) by:guillermo
|
||||||
|
- feat(TicketService): use correct format by:alexm
|
||||||
|
- feat(url): sepate filters by:alexm
|
||||||
|
- feat(VnFilter): merge objects by:alexm
|
||||||
|
- feat(VnTable): is-editable and use-model. fix: checkbox by:alexm
|
||||||
|
- feat(VnTable): refs #6825 actions sticky by:alexm
|
||||||
|
- feat(VnTable): refs #6825 addInWhere by:alexm
|
||||||
|
- feat(VnTable): refs #6825 dinamic columns by:alexm
|
||||||
|
- feat(VnTable): refs #6825 execute function when create by:alexm
|
||||||
|
- feat(VnTable): refs #6825 fix ellipsis and add titles by:alexm
|
||||||
|
- feat(VnTable): refs #6825 merge where's by:alexm
|
||||||
|
- feat(VnTable): refs #6825 move to folder. fix checkboxs by:alexm
|
||||||
|
- feat(VnTable): refs #6825 remove field prop. Add actions in table by:alexm
|
||||||
|
- feat(VnTable): refs #6825 use checkbox if startsWith 'is' or 'has' by:alexm
|
||||||
|
- feat(VnTable): refs #6825 VnTableChip component by:alexm
|
||||||
|
- feat(vnTable): reload data when change url by:alexm
|
||||||
|
- feat(WorkerFormation): add columnFilter by:alexm
|
||||||
|
- feat(WorkerFormation): is-editable and use-model by:alexm
|
||||||
|
- fix: notify icon style by:Javier Segarra
|
||||||
|
- refactor: refs #6896 fixed styles by:Jon
|
||||||
|
- Revert "feat: fixes #7196" by:alexm
|
||||||
|
- style: refs #6464 changed checkbox and qbtn styles by:Jon
|
||||||
|
|
||||||
|
### Changed 📦
|
||||||
|
|
||||||
|
- perf: Remove div.col by:Javier Segarra
|
||||||
|
- perf: remove ItemPicture by:Javier Segarra
|
||||||
|
- perf: replace ItemPicture in favour of VnImg by:Javier Segarra
|
||||||
|
- refactor by:wbuezas
|
||||||
|
- refactor: refs #5447 changed warehouse filter by:Jon
|
||||||
|
- refactor: refs #5447 changed warehouse out filter behavior by:Jon
|
||||||
|
- refactor: refs #5447 fixed filter if continent not selected by:Jon
|
||||||
|
- refactor: refs #5447 fix request by:Jon
|
||||||
|
- refactor: refs #5447 refactor filters by:Jon
|
||||||
|
- refactor: refs #6739 changed invoice functions' name by:Jon
|
||||||
|
- refactor: refs #6739 changed router.push by:Jon
|
||||||
|
- refactor: refs #6739 deleted useless const by:Jon
|
||||||
|
- refactor: refs #6739 fix redirect transferInvoice by:Jon
|
||||||
|
- refactor: refs #6739 new confirmation window by:Jon
|
||||||
|
- refactor: refs #6739 requested changes by:Jon
|
||||||
|
- refactor: refs #6739 updated transferInvoice function by:Jon
|
||||||
|
- refactor: refs #6896 changes requested in PR by:Jon
|
||||||
|
- refactor: refs #6896 end migration orders by:Jon
|
||||||
|
- refactor: refs #6896 fixed styles by:Jon
|
||||||
|
- refactor: refs #6896 fix qdrawer by:Jon
|
||||||
|
- refactor: refs #6896 refactor VnImg by:Jon
|
||||||
|
- refactor: refs #6896 requested changes by:Jon
|
||||||
|
- refactor: refs #6977 fix VnImg props (origin/6977-ClonedURL) by:Jon
|
||||||
|
- refactor: refs #6977 refactor VnImg by:Jon
|
||||||
|
- refactor: refs #6977 use VnImg by:Jon
|
||||||
|
- refactors by:alexm
|
||||||
|
|
||||||
|
### Fixed 🛠️
|
||||||
|
|
||||||
|
- chore: refs #7436 fix e2e (origin/7436-showQCheckbox) by:jorgep
|
||||||
|
- feat: fixes #7196 by:jgallego
|
||||||
|
- feat: refs #6825 fix modes by:alexm
|
||||||
|
- feat: refs #7129 fix some code and add order by:pablone
|
||||||
|
- feat(VnTable): is-editable and use-model. fix: checkbox by:alexm
|
||||||
|
- feat(VnTable): refs #6825 fix ellipsis and add titles by:alexm
|
||||||
|
- feat(VnTable): refs #6825 move to folder. fix checkboxs by:alexm
|
||||||
|
- fix(ArrayData): refs #6825 router.replace and use filter.where by:alexm
|
||||||
|
- fix: bug replace by:alexm
|
||||||
|
- fix: column hidden v-if by:Javier Segarra
|
||||||
|
- fix: comment 4 by:Javier Segarra
|
||||||
|
- fix: comments by:Javier Segarra
|
||||||
|
- fix: cypress.config to mjs by:alexm
|
||||||
|
- fix(EntryBuys): fix VnSubtoolbar by:alexm
|
||||||
|
- fixes: fix vnFilter params and redirect by:alexm
|
||||||
|
- fix: fix warnings by:alexm
|
||||||
|
- fix: invoiceDueDay test by:alexm
|
||||||
|
- fix log view not refreshing when changing id param by:wbuezas
|
||||||
|
- fix: map selected by:Javier Segarra
|
||||||
|
- fix: merge dev by:Javier Segarra
|
||||||
|
- fix: notify icon style by:Javier Segarra
|
||||||
|
- fix: point 1 by:Javier Segarra
|
||||||
|
- fix: point 3 by:Javier Segarra
|
||||||
|
- fix: refs #5447 deleted console.log by:Jon
|
||||||
|
- fix: refs 6464 deleted useless class in checkbox by:Jon
|
||||||
|
- fix: refs #6464 fix error isLoading by:Jon
|
||||||
|
- fix: refs #6739 changed checkbox field by:Jon
|
||||||
|
- fix: refs #6825 css by:carlossa
|
||||||
|
- fix: refs #6826 fix redirect by:Jon
|
||||||
|
- fix: refs #6826 fix roleDescriptor by:Jon
|
||||||
|
- fix: refs #7129 fix e2e by:pablone
|
||||||
|
- fix: refs #7129 fix module routes by:pablone
|
||||||
|
- fix: refs #7129 fix some issues on load and tools by:pablone
|
||||||
|
- fix: refs #7129 remove consoleLog by:pablone
|
||||||
|
- fix: refs #7129 remove fix from claim lines by:pablone
|
||||||
|
- fix: refs #7274 fix duplicate rows by:jorgep
|
||||||
|
- fix: refs #7433 skeleton by:jorgep
|
||||||
|
- fix: refs #7623 bugs & tests by:jorgep
|
||||||
|
- fix: refs #7623 disable router update by:jorgep
|
||||||
|
- fix: refs #7623 redirect by:jorgep
|
||||||
|
- fix: refs #7623 test by:jorgep
|
||||||
|
- fix: refs #7623 update add updateRoute prop in VnPaginate by:jorgep
|
||||||
|
- fix: refs #7623 updating skip param by:jorgep
|
||||||
|
- fix: revert cypress mjs by:alexm
|
||||||
|
- fix: SkeletonTable by:alexm
|
||||||
|
- fix: state translations by:Javier Segarra
|
||||||
|
- fix: ticket order by:Javier Segarra
|
||||||
|
- fix(ticket router): typo by:alexm
|
||||||
|
- fix(TicketService): pay use selected by:alexm
|
||||||
|
- fix: TravelLog by:Javier Segarra
|
||||||
|
- fix(url): filter by:alexm
|
||||||
|
- fix(url): redirect by:alexm
|
||||||
|
- fix(VnFilter): filter with params by:alexm
|
||||||
|
- fix(VnFilterPanel): remove key by:alexm
|
||||||
|
- fix(VnTable): create scss by:alexm
|
||||||
|
- fix(VnTable): duplicate fetch by:alexm
|
||||||
|
- fix(VnTable): Qtable v-bind by:alexm
|
||||||
|
- fix(VnTable): refs #6825 checkbox align and color by:alexm
|
||||||
|
- fix(VnTable): refs #6825 fix click sticky column by:alexm
|
||||||
|
- fix(VnTable): refs #6825 fix events and css by:alexm
|
||||||
|
- fix(VnTable): refs #6825 VnInputDate by:alexm
|
||||||
|
- fix(VnTable): showLabel by:alexm
|
||||||
|
- fix(VnTable): warns by:alexm
|
||||||
|
- fix: WorkerNotificationsManager test by:alexm
|
||||||
|
- fix: WorkerSelect option format by:Javier Segarra
|
||||||
|
- refactor: refs #5447 fixed filter if continent not selected by:Jon
|
||||||
|
- refactor: refs #5447 fix request by:Jon
|
||||||
|
- refactor: refs #6739 fix redirect transferInvoice by:Jon
|
||||||
|
- refactor: refs #6896 fixed styles by:Jon
|
||||||
|
- refactor: refs #6896 fix qdrawer by:Jon
|
||||||
|
- refactor: refs #6977 fix VnImg props (origin/6977-ClonedURL) by:Jon
|
||||||
|
- refs #6504 fix formModel claimFilter claimCard (origin/6504-fixCardClaim) by:carlossa
|
||||||
|
- refs #7406 fix components by:carlossa
|
||||||
|
- refs #7406 fix pr by:carlossa
|
||||||
|
- refs #7406 fix props by:carlossa
|
||||||
|
- refs #7406 fix Tb components create by:carlossa
|
||||||
|
- refs #7406 fix trad by:carlossa
|
||||||
|
- refs #7406 fix url by:carlossa
|
||||||
|
- refs #7406 fix VnTable columns by:carlossa
|
||||||
|
- refs #7409 fix balance and formation by:carlossa
|
||||||
|
- refs #7409 fix trad by:carlossa
|
||||||
|
- Revert "feat: fixes #7196" by:alexm
|
||||||
|
- test: fix intermitent e2e by:alexm
|
||||||
|
- test: fix vnSearchbar adapt to vnTable (origin/7648_dev_customerEntries) by:alexm
|
||||||
|
|
||||||
# Version 24.24 - 2024-06-11
|
# Version 24.24 - 2024-06-11
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = { extends: ['@commitlint/config-conventional'] };
|
12
package.json
12
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.30.1",
|
"version": "24.40.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"
|
||||||
|
@ -56,4 +62,4 @@
|
||||||
"vite": "^5.1.4",
|
"vite": "^5.1.4",
|
||||||
"vitest": "^0.31.1"
|
"vitest": "^0.31.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
15114
pnpm-lock.yaml
15114
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;
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
export default {
|
||||||
|
mounted: function (el, binding) {
|
||||||
|
const shortcut = binding.value ?? '+';
|
||||||
|
|
||||||
|
const { key, ctrl, alt, callback } =
|
||||||
|
typeof shortcut === 'string'
|
||||||
|
? {
|
||||||
|
key: shortcut,
|
||||||
|
ctrl: true,
|
||||||
|
alt: true,
|
||||||
|
callback: () =>
|
||||||
|
document
|
||||||
|
.querySelector(`button[shortcut="${shortcut}"]`)
|
||||||
|
?.click(),
|
||||||
|
}
|
||||||
|
: binding.value;
|
||||||
|
|
||||||
|
const handleKeydown = (event) => {
|
||||||
|
if (event.key === key && (!ctrl || event.ctrlKey) && (!alt || event.altKey)) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Attach the event listener to the window
|
||||||
|
window.addEventListener('keydown', handleKeydown);
|
||||||
|
|
||||||
|
el._handleKeydown = handleKeydown;
|
||||||
|
},
|
||||||
|
unmounted: function (el) {
|
||||||
|
if (el._handleKeydown) {
|
||||||
|
window.removeEventListener('keydown', el._handleKeydown);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
|
@ -0,0 +1,38 @@
|
||||||
|
import routes from 'src/router/modules';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
|
let isNotified = false;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
created: function () {
|
||||||
|
const router = useRouter();
|
||||||
|
const keyBindingMap = routes
|
||||||
|
.filter((route) => route.meta.keyBinding)
|
||||||
|
.reduce((map, route) => {
|
||||||
|
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||||
|
return map;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
const handleKeyDown = (event) => {
|
||||||
|
const { ctrlKey, altKey, code } = event;
|
||||||
|
|
||||||
|
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
||||||
|
event.preventDefault();
|
||||||
|
router.push(keyBindingMap[code]);
|
||||||
|
isNotified = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleKeyUp = (event) => {
|
||||||
|
const { ctrlKey, altKey } = event;
|
||||||
|
|
||||||
|
// Resetea la bandera cuando se sueltan las teclas ctrl o alt
|
||||||
|
if (!ctrlKey || !altKey) {
|
||||||
|
isNotified = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('keydown', handleKeyDown);
|
||||||
|
window.addEventListener('keyup', handleKeyUp);
|
||||||
|
},
|
||||||
|
};
|
|
@ -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') {
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import { boot } from 'quasar/wrappers';
|
import { boot } from 'quasar/wrappers';
|
||||||
import qFormMixin from './qformMixin';
|
import qFormMixin from './qformMixin';
|
||||||
|
import mainShortcutMixin from './mainShortcutMixin';
|
||||||
|
import keyShortcut from './keyShortcut';
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
app.mixin(qFormMixin);
|
app.mixin(qFormMixin);
|
||||||
|
app.mixin(mainShortcutMixin);
|
||||||
|
app.directive('shortcut', keyShortcut);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, onMounted, nextTick } from 'vue';
|
import { reactive, ref, onMounted, nextTick, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
|
@ -7,16 +7,21 @@ 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 FormModelPopup from './FormModelPopup.vue';
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
defineProps({ showEntityField: { type: Boolean, default: true } });
|
defineProps({ showEntityField: { type: Boolean, default: true } });
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved']);
|
const emit = defineEmits(['onDataSaved']);
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const bicInputRef = ref(null);
|
const bicInputRef = ref(null);
|
||||||
|
const state = useState();
|
||||||
|
|
||||||
|
const customer = computed(() => state.get('customer'));
|
||||||
|
|
||||||
const bankEntityFormData = reactive({
|
const bankEntityFormData = reactive({
|
||||||
name: null,
|
name: null,
|
||||||
bic: null,
|
bic: null,
|
||||||
countryFk: null,
|
countryFk: customer.value.countryFk,
|
||||||
id: null,
|
id: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,7 +57,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 +72,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>
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<script setup>
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['onDataSaved']);
|
||||||
|
const { t } = useI18n();
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<FormModelPopup
|
||||||
|
url-create="Expenses"
|
||||||
|
model="Expense"
|
||||||
|
:title="t('New expense')"
|
||||||
|
:form-initial-data="{ id: null, isWithheld: false, name: null }"
|
||||||
|
@on-data-saved="emit('onDataSaved', $event)"
|
||||||
|
>
|
||||||
|
<template #form-inputs="{ data, validate }">
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
:label="`${t('globals.code')}`"
|
||||||
|
v-model="data.id"
|
||||||
|
:required="true"
|
||||||
|
:rules="validate('expense.code')"
|
||||||
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
dense
|
||||||
|
size="sm"
|
||||||
|
:label="`${t('It\'s a withholding')}`"
|
||||||
|
v-model="data.isWithheld"
|
||||||
|
:rules="validate('expense.isWithheld')"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInput
|
||||||
|
:label="`${t('globals.description')}`"
|
||||||
|
v-model="data.name"
|
||||||
|
:required="true"
|
||||||
|
:rules="validate('expense.description')"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormModelPopup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
New expense: Nuevo gasto
|
||||||
|
It's a withholding: Es una retención
|
||||||
|
</i18n>
|
|
@ -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']"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
|
: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']"
|
<VnSelect
|
||||||
>
|
|
||||||
<template #form>
|
|
||||||
<CreateNewProvinceForm
|
|
||||||
@on-data-saved="onProvinceCreated($event, data)"
|
|
||||||
/>
|
|
||||||
</template> </VnSelectDialog
|
|
||||||
></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,20 +97,31 @@ 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) {
|
||||||
if (data && Array.isArray(data)) {
|
|
||||||
let $index = 0;
|
|
||||||
data.map((d) => (d.$index = $index++));
|
|
||||||
}
|
|
||||||
|
|
||||||
resetData(data);
|
resetData(data);
|
||||||
|
|
||||||
emit('onFetch', data);
|
emit('onFetch', data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetData(data) {
|
function resetData(data) {
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
|
if (data && Array.isArray(data)) {
|
||||||
|
let $index = 0;
|
||||||
|
data.map((d) => (d.$index = $index++));
|
||||||
|
}
|
||||||
originalData.value = JSON.parse(JSON.stringify(data));
|
originalData.value = JSON.parse(JSON.stringify(data));
|
||||||
formData.value = JSON.parse(JSON.stringify(data));
|
formData.value = JSON.parse(JSON.stringify(data));
|
||||||
|
|
||||||
|
@ -178,11 +189,11 @@ async function saveChanges(data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function insert() {
|
async function insert(pushData = $props.dataRequired) {
|
||||||
const $index = formData.value.length
|
const $index = formData.value.length
|
||||||
? formData.value[formData.value.length - 1].$index + 1
|
? formData.value[formData.value.length - 1].$index + 1
|
||||||
: 0;
|
: 0;
|
||||||
formData.value.push(Object.assign({ $index }, $props.dataRequired));
|
formData.value.push(Object.assign({ $index }, pushData));
|
||||||
hasChanges.value = true;
|
hasChanges.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +310,7 @@ watch(formUrl, async () => {
|
||||||
:url="url"
|
:url="url"
|
||||||
:limit="limit"
|
:limit="limit"
|
||||||
@on-fetch="fetch"
|
@on-fetch="fetch"
|
||||||
@on-change="resetData"
|
@on-change="fetch"
|
||||||
:skeleton="false"
|
:skeleton="false"
|
||||||
ref="vnPaginateRef"
|
ref="vnPaginateRef"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -44,7 +44,7 @@ onMounted(async () => {
|
||||||
|
|
||||||
async function fetch(fetchFilter = {}) {
|
async function fetch(fetchFilter = {}) {
|
||||||
try {
|
try {
|
||||||
const filter = Object.assign(fetchFilter, $props.filter); // eslint-disable-line vue/no-dupe-keys
|
const filter = { ...fetchFilter, ...$props.filter }; // eslint-disable-line vue/no-dupe-keys
|
||||||
if ($props.where && !fetchFilter.where) filter.where = $props.where;
|
if ($props.where && !fetchFilter.where) filter.where = $props.where;
|
||||||
if ($props.sortBy) filter.order = $props.sortBy;
|
if ($props.sortBy) filter.order = $props.sortBy;
|
||||||
if ($props.limit) filter.limit = $props.limit;
|
if ($props.limit) filter.limit = $props.limit;
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -22,7 +22,7 @@ const { t } = useI18n();
|
||||||
const { validate } = useValidator();
|
const { validate } = useValidator();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const myForm = ref(null);
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
url: {
|
url: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -87,10 +87,14 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
defaultTrim: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||||
const modelValue = computed(
|
const modelValue = computed(
|
||||||
() => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`,
|
() => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`
|
||||||
).value;
|
).value;
|
||||||
const componentIsRendered = ref(false);
|
const componentIsRendered = ref(false);
|
||||||
const arrayData = useArrayData(modelValue);
|
const arrayData = useArrayData(modelValue);
|
||||||
|
@ -100,17 +104,19 @@ 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',
|
||||||
icon: 'save',
|
icon: 'save',
|
||||||
label: 'globals.save',
|
label: 'globals.save',
|
||||||
|
click: () => myForm.value.submit(),
|
||||||
|
type: 'submit',
|
||||||
},
|
},
|
||||||
reset: {
|
reset: {
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
icon: 'restart_alt',
|
icon: 'restart_alt',
|
||||||
label: 'globals.reset',
|
label: 'globals.reset',
|
||||||
|
click: () => reset(),
|
||||||
},
|
},
|
||||||
...$props.defaultButtons,
|
...$props.defaultButtons,
|
||||||
}));
|
}));
|
||||||
|
@ -137,7 +143,7 @@ onMounted(async () => {
|
||||||
JSON.stringify(newVal) !== JSON.stringify(originalData.value);
|
JSON.stringify(newVal) !== JSON.stringify(originalData.value);
|
||||||
isResetting.value = false;
|
isResetting.value = false;
|
||||||
},
|
},
|
||||||
{ deep: true },
|
{ deep: true }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -145,22 +151,25 @@ onMounted(async () => {
|
||||||
if (!$props.url)
|
if (!$props.url)
|
||||||
watch(
|
watch(
|
||||||
() => arrayData.store.data,
|
() => arrayData.store.data,
|
||||||
(val) => updateAndEmit('onFetch', val),
|
(val) => updateAndEmit('onFetch', val)
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(formUrl, async () => {
|
watch(
|
||||||
originalData.value = null;
|
() => [$props.url, $props.filter],
|
||||||
reset();
|
async () => {
|
||||||
await fetch();
|
originalData.value = null;
|
||||||
});
|
reset();
|
||||||
|
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(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -193,6 +202,7 @@ async function save() {
|
||||||
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
try {
|
try {
|
||||||
|
formData.value = trimData(formData.value);
|
||||||
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
|
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
|
||||||
const method = $props.urlCreate ? 'post' : 'patch';
|
const method = $props.urlCreate ? 'post' : 'patch';
|
||||||
const url =
|
const url =
|
||||||
|
@ -239,7 +249,7 @@ function filter(value, update, filterOptions) {
|
||||||
(ref) => {
|
(ref) => {
|
||||||
ref.setOptionIndex(-1);
|
ref.setOptionIndex(-1);
|
||||||
ref.moveOptionSelection(1, true);
|
ref.moveOptionSelection(1, true);
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +261,14 @@ function updateAndEmit(evt, val, res) {
|
||||||
emit(evt, state.get(modelValue), res);
|
emit(evt, state.get(modelValue), res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trimData(data) {
|
||||||
|
if (!$props.defaultTrim) return data;
|
||||||
|
for (const key in data) {
|
||||||
|
if (typeof data[key] == 'string') data[key] = data[key].trim();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
save,
|
save,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
@ -262,7 +280,8 @@ defineExpose({
|
||||||
<template>
|
<template>
|
||||||
<div class="column items-center full-width">
|
<div class="column items-center full-width">
|
||||||
<QForm
|
<QForm
|
||||||
|
ref="myForm"
|
||||||
|
v-if="formData"
|
||||||
@submit="save"
|
@submit="save"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
class="q-pa-md"
|
class="q-pa-md"
|
||||||
|
@ -276,70 +295,72 @@ defineExpose({
|
||||||
:validate="validate"
|
:validate="validate"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
/>
|
/>
|
||||||
<SkeletonForm v-else/>
|
<SkeletonForm v-else />
|
||||||
</QCard>
|
</QCard>
|
||||||
</QForm>
|
</QForm>
|
||||||
</div>
|
</div>
|
||||||
<Teleport
|
<Teleport
|
||||||
to="#st-actions"
|
to="#st-actions"
|
||||||
v-if="stateStore?.isSubToolbarShown() && componentIsRendered"
|
v-if="
|
||||||
|
$props.defaultActions &&
|
||||||
|
stateStore?.isSubToolbarShown() &&
|
||||||
|
componentIsRendered
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<div v-if="$props.defaultActions">
|
<QBtnGroup push class="q-gutter-x-sm">
|
||||||
<QBtnGroup push class="q-gutter-x-sm">
|
<slot name="moreActions" />
|
||||||
<slot name="moreActions" />
|
<QBtn
|
||||||
<QBtn
|
:label="tMobile(defaultButtons.reset.label)"
|
||||||
:label="tMobile(defaultButtons.reset.label)"
|
:color="defaultButtons.reset.color"
|
||||||
:color="defaultButtons.reset.color"
|
:icon="defaultButtons.reset.icon"
|
||||||
:icon="defaultButtons.reset.icon"
|
flat
|
||||||
flat
|
@click="defaultButtons.reset.click"
|
||||||
@click="reset"
|
:disable="!hasChanges"
|
||||||
:disable="!hasChanges"
|
:title="t(defaultButtons.reset.label)"
|
||||||
:title="t(defaultButtons.reset.label)"
|
/>
|
||||||
/>
|
<QBtnDropdown
|
||||||
<QBtnDropdown
|
v-if="$props.goTo"
|
||||||
v-if="$props.goTo"
|
@click="saveAndGo"
|
||||||
@click="saveAndGo"
|
:label="tMobile('globals.saveAndContinue')"
|
||||||
:label="tMobile('globals.saveAndContinue')"
|
:title="t('globals.saveAndContinue')"
|
||||||
:title="t('globals.saveAndContinue')"
|
:disable="!hasChanges"
|
||||||
:disable="!hasChanges"
|
color="primary"
|
||||||
color="primary"
|
icon="save"
|
||||||
icon="save"
|
split
|
||||||
split
|
>
|
||||||
>
|
<QList>
|
||||||
<QList>
|
<QItem
|
||||||
<QItem
|
clickable
|
||||||
clickable
|
v-close-popup
|
||||||
v-close-popup
|
@click="save"
|
||||||
@click="save"
|
:title="t('globals.save')"
|
||||||
:title="t('globals.save')"
|
>
|
||||||
>
|
<QItemSection>
|
||||||
<QItemSection>
|
<QItemLabel>
|
||||||
<QItemLabel>
|
<QIcon
|
||||||
<QIcon
|
name="save"
|
||||||
name="save"
|
color="white"
|
||||||
color="white"
|
class="q-mr-sm"
|
||||||
class="q-mr-sm"
|
size="sm"
|
||||||
size="sm"
|
/>
|
||||||
/>
|
{{ t('globals.save').toUpperCase() }}
|
||||||
{{ t('globals.save').toUpperCase() }}
|
</QItemLabel>
|
||||||
</QItemLabel>
|
</QItemSection>
|
||||||
</QItemSection>
|
</QItem>
|
||||||
</QItem>
|
</QList>
|
||||||
</QList>
|
</QBtnDropdown>
|
||||||
</QBtnDropdown>
|
<QBtn
|
||||||
<QBtn
|
v-else
|
||||||
v-else
|
:label="tMobile('globals.save')"
|
||||||
:label="tMobile('globals.save')"
|
color="primary"
|
||||||
color="primary"
|
icon="save"
|
||||||
icon="save"
|
@click="defaultButtons.save.click"
|
||||||
@click="save"
|
:disable="!hasChanges"
|
||||||
:disable="!hasChanges"
|
:title="t(defaultButtons.save.label)"
|
||||||
:title="t(defaultButtons.save.label)"
|
/>
|
||||||
/>
|
</QBtnGroup>
|
||||||
</QBtnGroup>
|
|
||||||
</div>
|
|
||||||
</Teleport>
|
</Teleport>
|
||||||
|
|
||||||
<QInnerLoading
|
<QInnerLoading
|
||||||
:showing="isLoading"
|
:showing="isLoading"
|
||||||
:label="t('globals.pleaseWait')"
|
:label="t('globals.pleaseWait')"
|
||||||
|
@ -360,8 +381,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>
|
|
||||||
|
|
|
@ -23,18 +23,15 @@ const formModelRef = ref(null);
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
|
|
||||||
const onDataSaved = (formData, requestResponse) => {
|
const onDataSaved = (formData, requestResponse) => {
|
||||||
closeForm();
|
if (closeButton.value) closeButton.value.click();
|
||||||
emit('onDataSaved', formData, requestResponse);
|
emit('onDataSaved', formData, requestResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isLoading = computed(() => formModelRef.value?.isLoading);
|
const isLoading = computed(() => formModelRef.value?.isLoading);
|
||||||
|
|
||||||
const closeForm = async () => {
|
|
||||||
if (closeButton.value) closeButton.value.click();
|
|
||||||
};
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
isLoading,
|
isLoading,
|
||||||
|
onDataSaved,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -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'],
|
||||||
|
@ -158,8 +159,8 @@ const removeTag = (index, params, search) => {
|
||||||
/>
|
/>
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
:data-key="props.dataKey"
|
:data-key="props.dataKey"
|
||||||
:expr-builder="exprBuilder"
|
:expr-builder="props.exprBuilder"
|
||||||
:custom-tags="customTags"
|
:custom-tags="props.customTags"
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<strong v-if="tag.label === 'categoryFk'">
|
<strong v-if="tag.label === 'categoryFk'">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { onMounted, ref, reactive } from 'vue';
|
import { onMounted, watch, ref, reactive } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { QSeparator, useQuasar } from 'quasar';
|
import { QSeparator, useQuasar } from 'quasar';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
@ -29,6 +29,15 @@ onMounted(async () => {
|
||||||
getRoutes();
|
getRoutes();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.matched,
|
||||||
|
() => {
|
||||||
|
items.value = [];
|
||||||
|
getRoutes();
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
function findMatches(search, item) {
|
function findMatches(search, item) {
|
||||||
const matches = [];
|
const matches = [];
|
||||||
function findRoute(search, item) {
|
function findRoute(search, item) {
|
||||||
|
|
|
@ -33,7 +33,12 @@ const itemComputed = computed(() => {
|
||||||
<QItemSection avatar v-if="!itemComputed.icon">
|
<QItemSection avatar v-if="!itemComputed.icon">
|
||||||
<QIcon name="disabled_by_default" />
|
<QIcon name="disabled_by_default" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t(itemComputed.title) }}</QItemSection>
|
<QItemSection>
|
||||||
|
{{ t(itemComputed.title) }}
|
||||||
|
<QTooltip v-if="item.keyBinding">
|
||||||
|
{{ 'Ctrl + Alt + ' + item?.keyBinding?.toUpperCase() }}
|
||||||
|
</QTooltip>
|
||||||
|
</QItemSection>
|
||||||
<QItemSection side>
|
<QItemSection side>
|
||||||
<slot name="side" :item="itemComputed" />
|
<slot name="side" :item="itemComputed" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -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();
|
||||||
|
@ -24,7 +24,13 @@ const pinnedModulesRef = ref();
|
||||||
<template>
|
<template>
|
||||||
<QHeader color="white" elevated>
|
<QHeader color="white" elevated>
|
||||||
<QToolbar class="q-py-sm q-px-md">
|
<QToolbar class="q-py-sm q-px-md">
|
||||||
<QBtn @click="stateStore.toggleLeftDrawer()" icon="menu" round dense flat>
|
<QBtn
|
||||||
|
@click="stateStore.toggleLeftDrawer()"
|
||||||
|
icon="dock_to_right"
|
||||||
|
round
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
>
|
||||||
<QTooltip bottom anchor="bottom right">
|
<QTooltip bottom anchor="bottom right">
|
||||||
{{ t('globals.collapseMenu') }}
|
{{ t('globals.collapseMenu') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
|
@ -72,22 +78,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>
|
||||||
|
|
|
@ -0,0 +1,174 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useDialogPluginComponent } from 'quasar';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
import FormPopup from './FormPopup.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
invoiceOutData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { dialogRef } = useDialogPluginComponent();
|
||||||
|
const { t } = useI18n();
|
||||||
|
const router = useRouter();
|
||||||
|
const { notify } = useNotify();
|
||||||
|
|
||||||
|
const rectificativeTypeOptions = ref([]);
|
||||||
|
const siiTypeInvoiceOutsOptions = ref([]);
|
||||||
|
const inheritWarehouse = ref(true);
|
||||||
|
const invoiceParams = reactive({
|
||||||
|
id: $props.invoiceOutData?.id,
|
||||||
|
});
|
||||||
|
const invoiceCorrectionTypesOptions = ref([]);
|
||||||
|
|
||||||
|
const refund = async () => {
|
||||||
|
const params = {
|
||||||
|
id: invoiceParams.id,
|
||||||
|
withWarehouse: invoiceParams.inheritWarehouse,
|
||||||
|
cplusRectificationTypeFk: invoiceParams.cplusRectificationTypeFk,
|
||||||
|
siiTypeInvoiceOutFk: invoiceParams.siiTypeInvoiceOutFk,
|
||||||
|
invoiceCorrectionTypeFk: invoiceParams.invoiceCorrectionTypeFk,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { data } = await axios.post('InvoiceOuts/refundAndInvoice', params);
|
||||||
|
notify(t('Refunded invoice'), 'positive');
|
||||||
|
const [id] = data?.refundId || [];
|
||||||
|
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error refunding invoice', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="CplusRectificationTypes"
|
||||||
|
:filter="{ order: 'description' }"
|
||||||
|
@on-fetch="
|
||||||
|
(data) => (
|
||||||
|
(rectificativeTypeOptions = data),
|
||||||
|
(invoiceParams.cplusRectificationTypeFk = data.filter(
|
||||||
|
(type) => type.description == 'I – Por diferencias'
|
||||||
|
)[0].id)
|
||||||
|
)
|
||||||
|
"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="SiiTypeInvoiceOuts"
|
||||||
|
:filter="{ where: { code: { like: 'R%' } } }"
|
||||||
|
@on-fetch="
|
||||||
|
(data) => (
|
||||||
|
(siiTypeInvoiceOutsOptions = data),
|
||||||
|
(invoiceParams.siiTypeInvoiceOutFk = data.filter(
|
||||||
|
(type) => type.code == 'R4'
|
||||||
|
)[0].id)
|
||||||
|
)
|
||||||
|
"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="InvoiceCorrectionTypes"
|
||||||
|
@on-fetch="(data) => (invoiceCorrectionTypesOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
|
||||||
|
<QDialog ref="dialogRef">
|
||||||
|
<FormPopup
|
||||||
|
@on-submit="refund()"
|
||||||
|
:custom-submit-button-label="t('Accept')"
|
||||||
|
:default-cancel-button="false"
|
||||||
|
>
|
||||||
|
<template #form-inputs>
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('Rectificative type')"
|
||||||
|
:options="rectificativeTypeOptions"
|
||||||
|
hide-selected
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
|
v-model="invoiceParams.cplusRectificationTypeFk"
|
||||||
|
:required="true"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('Class')"
|
||||||
|
:options="siiTypeInvoiceOutsOptions"
|
||||||
|
hide-selected
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
|
v-model="invoiceParams.siiTypeInvoiceOutFk"
|
||||||
|
:required="true"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt?.code }} -
|
||||||
|
{{ scope.opt?.description }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
|
</VnRow>
|
||||||
|
|
||||||
|
<VnRow>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('Type')"
|
||||||
|
:options="invoiceCorrectionTypesOptions"
|
||||||
|
hide-selected
|
||||||
|
option-label="description"
|
||||||
|
option-value="id"
|
||||||
|
v-model="invoiceParams.invoiceCorrectionTypeFk"
|
||||||
|
:required="true"
|
||||||
|
/> </VnRow
|
||||||
|
><VnRow>
|
||||||
|
<div>
|
||||||
|
<QCheckbox
|
||||||
|
:label="t('Inherit warehouse')"
|
||||||
|
v-model="inheritWarehouse"
|
||||||
|
/>
|
||||||
|
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
||||||
|
<QTooltip>{{ t('Inherit warehouse tooltip') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormPopup>
|
||||||
|
</QDialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
Refund invoice: Refund invoice
|
||||||
|
Rectificative type: Rectificative type
|
||||||
|
Class: Class
|
||||||
|
Type: Type
|
||||||
|
Refunded invoice: Refunded invoice
|
||||||
|
Inherit warehouse: Inherit the warehouse
|
||||||
|
Inherit warehouse tooltip: Select this option to inherit the warehouse when refunding the invoice
|
||||||
|
Accept: Accept
|
||||||
|
Error refunding invoice: Error refunding invoice
|
||||||
|
es:
|
||||||
|
Refund invoice: Abonar factura
|
||||||
|
Rectificative type: Tipo rectificativa
|
||||||
|
Class: Clase
|
||||||
|
Type: Tipo
|
||||||
|
Refunded invoice: Factura abonada
|
||||||
|
Inherit warehouse: Heredar el almacén
|
||||||
|
Inherit warehouse tooltip: Seleccione esta opción para heredar el almacén al abonar la factura.
|
||||||
|
Accept: Aceptar
|
||||||
|
Error refunding invoice: Error abonando factura
|
||||||
|
</i18n>
|
|
@ -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"
|
||||||
|
|
|
@ -2,13 +2,12 @@
|
||||||
import { ref, reactive } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar, useDialogPluginComponent } from 'quasar';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.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 VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import FormPopup from './FormPopup.vue';
|
import FormPopup from './FormPopup.vue';
|
||||||
import { useDialogPluginComponent } from 'quasar';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
|
@ -18,19 +17,19 @@ const $props = defineProps({
|
||||||
default: () => {},
|
default: () => {},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { dialogRef } = useDialogPluginComponent();
|
const { dialogRef } = useDialogPluginComponent();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const checked = ref(true);
|
|
||||||
const transferInvoiceParams = reactive({
|
|
||||||
id: $props.invoiceOutData?.id,
|
|
||||||
refFk: $props.invoiceOutData?.ref,
|
|
||||||
});
|
|
||||||
|
|
||||||
const rectificativeTypeOptions = ref([]);
|
const rectificativeTypeOptions = ref([]);
|
||||||
const siiTypeInvoiceOutsOptions = ref([]);
|
const siiTypeInvoiceOutsOptions = ref([]);
|
||||||
|
const checked = ref(true);
|
||||||
|
const transferInvoiceParams = reactive({
|
||||||
|
id: $props.invoiceOutData?.id,
|
||||||
|
});
|
||||||
const invoiceCorrectionTypesOptions = ref([]);
|
const invoiceCorrectionTypesOptions = ref([]);
|
||||||
|
|
||||||
const selectedClient = (client) => {
|
const selectedClient = (client) => {
|
||||||
|
@ -44,10 +43,9 @@ const makeInvoice = async () => {
|
||||||
const params = {
|
const params = {
|
||||||
id: transferInvoiceParams.id,
|
id: transferInvoiceParams.id,
|
||||||
cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk,
|
cplusRectificationTypeFk: transferInvoiceParams.cplusRectificationTypeFk,
|
||||||
|
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
|
||||||
invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk,
|
invoiceCorrectionTypeFk: transferInvoiceParams.invoiceCorrectionTypeFk,
|
||||||
newClientFk: transferInvoiceParams.newClientFk,
|
newClientFk: transferInvoiceParams.newClientFk,
|
||||||
refFk: transferInvoiceParams.refFk,
|
|
||||||
siiTypeInvoiceOutFk: transferInvoiceParams.siiTypeInvoiceOutFk,
|
|
||||||
makeInvoice: checked.value,
|
makeInvoice: checked.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,7 +72,7 @@ const makeInvoice = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data } = await axios.post('InvoiceOuts/transferInvoice', params);
|
const { data } = await axios.post('InvoiceOuts/transfer', params);
|
||||||
notify(t('Transferred invoice'), 'positive');
|
notify(t('Transferred invoice'), 'positive');
|
||||||
const id = data?.[0];
|
const id = data?.[0];
|
||||||
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
if (id) router.push({ name: 'InvoiceOutSummary', params: { id } });
|
||||||
|
@ -118,13 +116,13 @@ const makeInvoice = async () => {
|
||||||
/>
|
/>
|
||||||
<QDialog ref="dialogRef">
|
<QDialog ref="dialogRef">
|
||||||
<FormPopup
|
<FormPopup
|
||||||
@on-submit="makeInvoice()"
|
@on-submit="makeInvoice()"
|
||||||
:title="t('Transfer invoice')"
|
:title="t('Transfer invoice')"
|
||||||
:custom-submit-button-label="t('Transfer client')"
|
:custom-submit-button-label="t('Transfer client')"
|
||||||
: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 +158,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 +189,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('globals.myAccount')"
|
||||||
|
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"
|
||||||
|
|
|
@ -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')"
|
||||||
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
|
>
|
||||||
|
<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>
|
|
@ -35,7 +35,9 @@ function stopEventPropagation(event) {
|
||||||
dense
|
dense
|
||||||
square
|
square
|
||||||
>
|
>
|
||||||
<span v-if="!col.chip.icon">{{ row[col.name] }}</span>
|
<span v-if="!col.chip.icon">
|
||||||
|
{{ col.format ? col.format(row) : row[col.name] }}
|
||||||
|
</span>
|
||||||
<QIcon v-else :name="col.chip.icon" color="primary-light" />
|
<QIcon v-else :name="col.chip.icon" color="primary-light" />
|
||||||
</QChip>
|
</QChip>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -5,9 +5,13 @@ import { dashIfEmpty } from 'src/filters';
|
||||||
|
|
||||||
/* basic input */
|
/* basic input */
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.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 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({
|
||||||
|
@ -41,6 +45,17 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const defaultSelect = {
|
||||||
|
attrs: {
|
||||||
|
row: $props.row,
|
||||||
|
disable: !$props.isEditable,
|
||||||
|
class: 'fit',
|
||||||
|
},
|
||||||
|
forceAttrs: {
|
||||||
|
label: $props.showLabel && $props.column.label,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const defaultComponents = {
|
const defaultComponents = {
|
||||||
input: {
|
input: {
|
||||||
component: markRaw(VnInput),
|
component: markRaw(VnInput),
|
||||||
|
@ -53,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',
|
||||||
|
@ -65,7 +80,7 @@ const defaultComponents = {
|
||||||
date: {
|
date: {
|
||||||
component: markRaw(VnInputDate),
|
component: markRaw(VnInputDate),
|
||||||
attrs: {
|
attrs: {
|
||||||
readonly: true,
|
readonly: !$props.isEditable,
|
||||||
disable: !$props.isEditable,
|
disable: !$props.isEditable,
|
||||||
style: 'min-width: 125px',
|
style: 'min-width: 125px',
|
||||||
class: 'fit',
|
class: 'fit',
|
||||||
|
@ -74,16 +89,25 @@ const defaultComponents = {
|
||||||
label: $props.showLabel && $props.column.label,
|
label: $props.showLabel && $props.column.label,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
time: {
|
||||||
|
component: markRaw(VnInputTime),
|
||||||
|
attrs: {
|
||||||
|
disable: !$props.isEditable,
|
||||||
|
},
|
||||||
|
forceAttrs: {
|
||||||
|
label: $props.showLabel && $props.column.label,
|
||||||
|
},
|
||||||
|
},
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -94,18 +118,19 @@ const defaultComponents = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
|
component: markRaw(VnSelectCache),
|
||||||
|
...defaultSelect,
|
||||||
|
},
|
||||||
|
rawSelect: {
|
||||||
component: markRaw(VnSelect),
|
component: markRaw(VnSelect),
|
||||||
attrs: {
|
...defaultSelect,
|
||||||
disable: !$props.isEditable,
|
|
||||||
class: 'fit',
|
|
||||||
},
|
|
||||||
forceAttrs: {
|
|
||||||
label: $props.showLabel && $props.column.label,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
component: markRaw(QIcon),
|
component: markRaw(QIcon),
|
||||||
},
|
},
|
||||||
|
userLink: {
|
||||||
|
component: markRaw(VnUserLink),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const value = computed(() => {
|
const value = computed(() => {
|
||||||
|
@ -126,8 +151,8 @@ 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
|
newColumn.component == null
|
||||||
)
|
)
|
||||||
newColumn.component = 'checkbox';
|
newColumn.component = 'checkbox';
|
||||||
if ($props.default && !newColumn.component) newColumn.component = $props.default;
|
if ($props.default && !newColumn.component) newColumn.component = $props.default;
|
||||||
|
@ -143,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>
|
||||||
|
@ -158,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,
|
||||||
|
@ -45,7 +47,18 @@ const defaultAttrs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const forceAttrs = {
|
const forceAttrs = {
|
||||||
label: $props.showTitle ? '' : $props.column.label,
|
label: $props.showTitle ? '' : columnFilter.value?.label ?? $props.column.label,
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectComponent = {
|
||||||
|
component: markRaw(VnSelect),
|
||||||
|
event: updateEvent,
|
||||||
|
attrs: {
|
||||||
|
class: 'q-px-sm q-pb-xs q-pt-none fit',
|
||||||
|
dense: true,
|
||||||
|
filled: !$props.showTitle,
|
||||||
|
},
|
||||||
|
forceAttrs,
|
||||||
};
|
};
|
||||||
|
|
||||||
const components = {
|
const components = {
|
||||||
|
@ -64,6 +77,7 @@ const components = {
|
||||||
attrs: {
|
attrs: {
|
||||||
...defaultAttrs,
|
...defaultAttrs,
|
||||||
clearable: true,
|
clearable: true,
|
||||||
|
type: 'number',
|
||||||
},
|
},
|
||||||
forceAttrs,
|
forceAttrs,
|
||||||
},
|
},
|
||||||
|
@ -97,16 +111,8 @@ const components = {
|
||||||
},
|
},
|
||||||
forceAttrs,
|
forceAttrs,
|
||||||
},
|
},
|
||||||
select: {
|
select: selectComponent,
|
||||||
component: markRaw(VnSelect),
|
rawSelect: selectComponent,
|
||||||
event: updateEvent,
|
|
||||||
attrs: {
|
|
||||||
class: 'q-px-sm q-pb-xs q-pt-none fit',
|
|
||||||
dense: true,
|
|
||||||
filled: !$props.showTitle,
|
|
||||||
},
|
|
||||||
forceAttrs,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function addFilter(value) {
|
async function addFilter(value) {
|
||||||
|
@ -138,7 +144,12 @@ const showFilter = computed(
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-if="showFilter" class="full-width" :class="alignRow()">
|
<div
|
||||||
|
v-if="showFilter"
|
||||||
|
class="full-width"
|
||||||
|
:class="alignRow()"
|
||||||
|
style="max-height: 45px; overflow: hidden"
|
||||||
|
>
|
||||||
<VnTableColumn
|
<VnTableColumn
|
||||||
:column="$props.column"
|
:column="$props.column"
|
||||||
default="input"
|
default="input"
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
const model = defineModel({ type: Object });
|
||||||
|
const $props = defineProps({
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
type: String,
|
||||||
|
default: undefined,
|
||||||
|
},
|
||||||
|
dataKey: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
searchUrl: {
|
||||||
|
type: String,
|
||||||
|
default: 'params',
|
||||||
|
},
|
||||||
|
vertical: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const hover = ref();
|
||||||
|
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
||||||
|
|
||||||
|
async function orderBy(name, direction) {
|
||||||
|
if (!name) return;
|
||||||
|
switch (direction) {
|
||||||
|
case 'DESC':
|
||||||
|
direction = undefined;
|
||||||
|
break;
|
||||||
|
case undefined:
|
||||||
|
direction = 'ASC';
|
||||||
|
break;
|
||||||
|
case 'ASC':
|
||||||
|
direction = 'DESC';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!direction) return await arrayData.deleteOrder(name);
|
||||||
|
await arrayData.addOrder(name, direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ orderBy });
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
@mouseenter="hover = true"
|
||||||
|
@mouseleave="hover = false"
|
||||||
|
@click="orderBy(name, model?.direction)"
|
||||||
|
class="row items-center no-wrap cursor-pointer"
|
||||||
|
>
|
||||||
|
<span :title="label">{{ label }}</span>
|
||||||
|
<QChip
|
||||||
|
v-if="name"
|
||||||
|
:label="!vertical ? model?.index : ''"
|
||||||
|
:icon="
|
||||||
|
(model?.index || hover) && !vertical
|
||||||
|
? model?.direction == 'DESC'
|
||||||
|
? 'arrow_downward'
|
||||||
|
: 'arrow_upward'
|
||||||
|
: undefined
|
||||||
|
"
|
||||||
|
:size="vertical ? '' : 'sm'"
|
||||||
|
:class="[
|
||||||
|
model?.index ? 'color-vn-text' : 'bg-transparent',
|
||||||
|
vertical ? 'q-px-none' : '',
|
||||||
|
]"
|
||||||
|
class="no-box-shadow"
|
||||||
|
:clickable="true"
|
||||||
|
style="min-width: 40px"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="column flex-center"
|
||||||
|
v-if="vertical"
|
||||||
|
:style="!model?.index && 'color: #5d5d5d'"
|
||||||
|
>
|
||||||
|
{{ model?.index }}
|
||||||
|
<QIcon
|
||||||
|
:name="
|
||||||
|
model?.index
|
||||||
|
? model?.direction == 'DESC'
|
||||||
|
? 'arrow_downward'
|
||||||
|
: 'arrow_upward'
|
||||||
|
: 'swap_vert'
|
||||||
|
"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</QChip>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,19 +1,20 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, computed, watch } from 'vue';
|
import { ref, onBeforeMount, onMounted, computed, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
|
||||||
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
|
||||||
|
|
||||||
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
|
|
||||||
|
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
||||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
||||||
import VnTableFilter from 'components/VnTable/VnFilter.vue';
|
import VnTableFilter from 'components/VnTable/VnFilter.vue';
|
||||||
import VnTableChip from 'components/VnTable/VnChip.vue';
|
import VnTableChip from 'components/VnTable/VnChip.vue';
|
||||||
import TableVisibleColumns from 'src/components/VnTable/VnVisibleColumn.vue';
|
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
||||||
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
|
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
columns: {
|
columns: {
|
||||||
|
@ -22,7 +23,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
defaultMode: {
|
defaultMode: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'card', // 'table', 'card'
|
default: 'table', // 'table', 'card'
|
||||||
},
|
},
|
||||||
columnSearch: {
|
columnSearch: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -33,7 +34,11 @@ const $props = defineProps({
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
rowClick: {
|
rowClick: {
|
||||||
type: Function,
|
type: [Function, Boolean],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
rowCtrlClick: {
|
||||||
|
type: [Function, Boolean],
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
redirect: {
|
redirect: {
|
||||||
|
@ -44,6 +49,10 @@ const $props = defineProps({
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
createAsDialog: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
cardClass: {
|
cardClass: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'flex-one',
|
default: 'flex-one',
|
||||||
|
@ -60,9 +69,13 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
disableInfiniteScroll: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
hasSubToolbar: {
|
hasSubToolbar: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: null,
|
||||||
},
|
},
|
||||||
disableOption: {
|
disableOption: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -80,6 +93,14 @@ const $props = defineProps({
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
|
crudModel: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
tableHeight: {
|
||||||
|
type: String,
|
||||||
|
default: '90vh',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -87,15 +108,20 @@ const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
|
||||||
const DEFAULT_MODE = 'card';
|
const CARD_MODE = 'card';
|
||||||
const TABLE_MODE = 'table';
|
const TABLE_MODE = 'table';
|
||||||
const mode = ref(DEFAULT_MODE);
|
const mode = ref(CARD_MODE);
|
||||||
const selected = ref([]);
|
const selected = ref([]);
|
||||||
|
const hasParams = ref(false);
|
||||||
const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}');
|
const routeQuery = JSON.parse(route?.query[$props.searchUrl] ?? '{}');
|
||||||
const params = ref({ ...routeQuery, ...routeQuery.filter?.where });
|
const params = ref({ ...routeQuery, ...routeQuery.filter?.where });
|
||||||
|
const orders = ref(parseOrder(routeQuery.filter?.order));
|
||||||
const CrudModelRef = ref({});
|
const CrudModelRef = ref({});
|
||||||
const showForm = ref(false);
|
const showForm = ref(false);
|
||||||
const splittedColumns = ref({ columns: [] });
|
const splittedColumns = ref({ columns: [] });
|
||||||
|
const columnsVisibilitySkipped = ref();
|
||||||
|
const createForm = ref();
|
||||||
|
|
||||||
const tableModes = [
|
const tableModes = [
|
||||||
{
|
{
|
||||||
icon: 'view_column',
|
icon: 'view_column',
|
||||||
|
@ -106,15 +132,35 @@ const tableModes = [
|
||||||
{
|
{
|
||||||
icon: 'grid_view',
|
icon: 'grid_view',
|
||||||
title: t('grid view'),
|
title: t('grid view'),
|
||||||
value: DEFAULT_MODE,
|
value: CARD_MODE,
|
||||||
disable: $props.disableOption?.card,
|
disable: $props.disableOption?.card,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
onBeforeMount(() => {
|
||||||
|
setUserParams(route.query[$props.searchUrl]);
|
||||||
|
hasParams.value = params.value && Object.keys(params.value).length !== 0;
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
mode.value = quasar.platform.is.mobile ? DEFAULT_MODE : $props.defaultMode;
|
mode.value =
|
||||||
|
quasar.platform.is.mobile && !$props.disableOption?.card
|
||||||
|
? CARD_MODE
|
||||||
|
: $props.defaultMode;
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
setUserParams(route.query[$props.searchUrl]);
|
columnsVisibilitySkipped.value = [
|
||||||
|
...splittedColumns.value.columns
|
||||||
|
.filter((c) => c.visible == false)
|
||||||
|
.map((c) => c.name),
|
||||||
|
...['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(
|
||||||
|
@ -128,23 +174,34 @@ watch(
|
||||||
(val) => setUserParams(val)
|
(val) => setUserParams(val)
|
||||||
);
|
);
|
||||||
|
|
||||||
const rowClickFunction = computed(() => {
|
|
||||||
if ($props.rowClick) return $props.rowClick;
|
|
||||||
if ($props.redirect) return ({ id }) => redirectFn(id);
|
|
||||||
return () => {};
|
|
||||||
});
|
|
||||||
|
|
||||||
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 where = JSON.parse(watchedParams?.filter)?.where;
|
const filter =
|
||||||
|
typeof watchedParams?.filter == 'string'
|
||||||
|
? JSON.parse(watchedParams?.filter ?? '{}')
|
||||||
|
: watchedParams?.filter;
|
||||||
|
const where = filter?.where;
|
||||||
|
const order = watchedOrder ?? filter?.order;
|
||||||
|
|
||||||
watchedParams = { ...watchedParams, ...where };
|
watchedParams = { ...watchedParams, ...where };
|
||||||
delete watchedParams.filter;
|
delete watchedParams.filter;
|
||||||
delete params.value?.filter;
|
delete params.value?.filter;
|
||||||
params.value = { ...params.value, ...watchedParams };
|
params.value = { ...params.value, ...sanitizer(watchedParams) };
|
||||||
|
orders.value = parseOrder(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
function splitColumns(columns) {
|
function splitColumns(columns) {
|
||||||
|
@ -156,13 +213,17 @@ function splitColumns(columns) {
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const col of columns) {
|
for (const col of columns) {
|
||||||
if (col.name == 'tableActions') splittedColumns.value.actions = col;
|
if (col.name == 'tableActions') {
|
||||||
|
col.orderBy = false;
|
||||||
|
splittedColumns.value.actions = col;
|
||||||
|
}
|
||||||
if (col.chip) splittedColumns.value.chips.push(col);
|
if (col.chip) splittedColumns.value.chips.push(col);
|
||||||
if (col.isTitle) splittedColumns.value.title = col;
|
if (col.isTitle) splittedColumns.value.title = col;
|
||||||
if (col.create) splittedColumns.value.create.push(col);
|
if (col.create) splittedColumns.value.create.push(col);
|
||||||
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
|
if (col.cardVisible) splittedColumns.value.cardVisible.push(col);
|
||||||
if ($props.isEditable && col.disable == null) col.disable = false;
|
if ($props.isEditable && col.disable == null) col.disable = false;
|
||||||
if ($props.useModel) col.columnFilter = { ...col.columnFilter, inWhere: true };
|
if ($props.useModel && col.columnFilter != false)
|
||||||
|
col.columnFilter = { ...col.columnFilter, inWhere: true };
|
||||||
splittedColumns.value.columns.push(col);
|
splittedColumns.value.columns.push(col);
|
||||||
}
|
}
|
||||||
// Status column
|
// Status column
|
||||||
|
@ -176,10 +237,27 @@ function splitColumns(columns) {
|
||||||
label: t('status'),
|
label: t('status'),
|
||||||
name: 'tableStatus',
|
name: 'tableStatus',
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
|
orderBy: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const rowClickFunction = computed(() => {
|
||||||
|
if ($props.rowClick != undefined) return $props.rowClick;
|
||||||
|
if ($props.redirect) return ({ id }) => redirectFn(id);
|
||||||
|
return () => {};
|
||||||
|
});
|
||||||
|
|
||||||
|
const rowCtrlClickFunction = computed(() => {
|
||||||
|
if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick;
|
||||||
|
if ($props.redirect)
|
||||||
|
return (evt, { id }) => {
|
||||||
|
stopEventPropagation(evt);
|
||||||
|
window.open(`/#/${$props.redirect}/${id}`, '_blank');
|
||||||
|
};
|
||||||
|
return () => {};
|
||||||
|
});
|
||||||
|
|
||||||
function redirectFn(id) {
|
function redirectFn(id) {
|
||||||
router.push({ path: `/${$props.redirect}/${id}` });
|
router.push({ path: `/${$props.redirect}/${id}` });
|
||||||
}
|
}
|
||||||
|
@ -190,6 +268,7 @@ function stopEventPropagation(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload(params) {
|
function reload(params) {
|
||||||
|
selected.value = [];
|
||||||
CrudModelRef.value.reload(params);
|
CrudModelRef.value.reload(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,12 +283,30 @@ function getColAlign(col) {
|
||||||
return 'text-' + (col.align ?? 'left');
|
return 'text-' + (col.align ?? 'left');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseOrder(urlOrders) {
|
||||||
|
const orderObject = {};
|
||||||
|
if (!urlOrders) return orderObject;
|
||||||
|
if (typeof urlOrders == 'string') urlOrders = [urlOrders];
|
||||||
|
for (const [index, orders] of urlOrders.entries()) {
|
||||||
|
const [name, direction] = orders.split(' ');
|
||||||
|
orderObject[name] = { direction, index: index + 1 };
|
||||||
|
}
|
||||||
|
return orderObject;
|
||||||
|
}
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
create: createForm,
|
||||||
reload,
|
reload,
|
||||||
redirect: redirectFn,
|
redirect: redirectFn,
|
||||||
selected,
|
selected,
|
||||||
|
CrudModelRef,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function handleOnDataSaved(_) {
|
||||||
|
if (_.onDataSaved) _.onDataSaved(this);
|
||||||
|
else $props.create.onDataSaved(_);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QDrawer
|
<QDrawer
|
||||||
|
@ -224,108 +321,126 @@ defineExpose({
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
:search-button="true"
|
:search-button="true"
|
||||||
v-model="params"
|
v-model="params"
|
||||||
:disable-submit-event="true"
|
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
:redirect="!!redirect"
|
:redirect="!!redirect"
|
||||||
|
@set-user-params="setUserParams"
|
||||||
>
|
>
|
||||||
<template #body>
|
<template #body>
|
||||||
<VnTableFilter
|
<div
|
||||||
:column="col"
|
class="row no-wrap flex-center"
|
||||||
:data-key="$attrs['data-key']"
|
v-for="col of splittedColumns.columns.filter(
|
||||||
v-for="col of splittedColumns.columns"
|
(c) => c.columnFilter ?? true
|
||||||
|
)"
|
||||||
:key="col.id"
|
:key="col.id"
|
||||||
v-model="params[columnName(col)]"
|
>
|
||||||
:search-url="searchUrl"
|
<VnTableFilter
|
||||||
|
:column="col"
|
||||||
|
:data-key="$attrs['data-key']"
|
||||||
|
v-model="params[columnName(col)]"
|
||||||
|
:search-url="searchUrl"
|
||||||
|
/>
|
||||||
|
<VnTableOrder
|
||||||
|
v-if="
|
||||||
|
col?.columnFilter !== false &&
|
||||||
|
col?.name !== 'tableActions'
|
||||||
|
"
|
||||||
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
|
:name="col.orderBy ?? col.name"
|
||||||
|
:data-key="$attrs['data-key']"
|
||||||
|
:search-url="searchUrl"
|
||||||
|
:vertical="true"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<slot
|
||||||
|
name="moreFilterPanel"
|
||||||
|
:params="params"
|
||||||
|
:columns="splittedColumns.columns"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<slot
|
|
||||||
name="moreFilterPanel"
|
|
||||||
:params="params"
|
|
||||||
:columns="splittedColumns.columns"
|
|
||||||
/>
|
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<!-- class in div to fix warn-->
|
<!-- class in div to fix warn-->
|
||||||
<div class="q-px-md">
|
<CrudModel
|
||||||
<CrudModel
|
v-bind="$attrs"
|
||||||
v-bind="$attrs"
|
:class="$attrs['class'] ?? 'q-px-md'"
|
||||||
:limit="20"
|
:limit="$attrs['limit'] ?? 20"
|
||||||
ref="CrudModelRef"
|
ref="CrudModelRef"
|
||||||
:search-url="searchUrl"
|
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||||
:disable-infinite-scroll="isTableMode"
|
:search-url="searchUrl"
|
||||||
@save-changes="reload"
|
:disable-infinite-scroll="
|
||||||
:has-sub-toolbar="$attrs['hasSubToolbar'] ?? isEditable"
|
$attrs['disableInfiniteScroll'] ? isTableMode : !disableInfiniteScroll
|
||||||
>
|
"
|
||||||
<template
|
@save-changes="reload"
|
||||||
v-for="(_, slotName) in $slots"
|
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
|
||||||
#[slotName]="slotData"
|
:auto-load="hasParams || $attrs['auto-load']"
|
||||||
:key="slotName"
|
>
|
||||||
|
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
|
||||||
|
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
||||||
|
</template>
|
||||||
|
<template #body="{ rows }">
|
||||||
|
<QTable
|
||||||
|
v-bind="table"
|
||||||
|
class="vnTable"
|
||||||
|
:columns="splittedColumns.columns"
|
||||||
|
:rows="rows"
|
||||||
|
v-model:selected="selected"
|
||||||
|
:grid="!isTableMode"
|
||||||
|
table-header-class="bg-header"
|
||||||
|
card-container-class="grid-three"
|
||||||
|
flat
|
||||||
|
:style="isTableMode && `max-height: ${tableHeight}`"
|
||||||
|
virtual-scroll
|
||||||
|
@virtual-scroll="
|
||||||
|
(event) =>
|
||||||
|
event.index > rows.length - 2 &&
|
||||||
|
($props.crudModel?.paginate ?? true) &&
|
||||||
|
CrudModelRef.vnPaginateRef.paginate()
|
||||||
|
"
|
||||||
|
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
||||||
|
@update:selected="emit('update:selected', $event)"
|
||||||
>
|
>
|
||||||
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
|
<template #top-left v-if="!$props.withoutHeader">
|
||||||
</template>
|
<slot name="top-left"></slot>
|
||||||
<template #body="{ rows }">
|
</template>
|
||||||
<QTable
|
<template #top-right v-if="!$props.withoutHeader">
|
||||||
v-bind="table"
|
<VnVisibleColumn
|
||||||
class="vnTable"
|
v-if="isTableMode"
|
||||||
:columns="splittedColumns.columns"
|
v-model="splittedColumns.columns"
|
||||||
:rows="rows"
|
:table-code="tableCode ?? route.name"
|
||||||
v-model:selected="selected"
|
:skip="columnsVisibilitySkipped"
|
||||||
:grid="!isTableMode"
|
/>
|
||||||
table-header-class="bg-header"
|
<QBtnToggle
|
||||||
card-container-class="grid-three"
|
v-model="mode"
|
||||||
flat
|
toggle-color="primary"
|
||||||
:style="isTableMode && 'max-height: 90vh'"
|
class="bg-vn-section-color"
|
||||||
virtual-scroll
|
dense
|
||||||
@virtual-scroll="
|
:options="tableModes.filter((mode) => !mode.disable)"
|
||||||
(event) =>
|
/>
|
||||||
event.index > rows.length - 2 &&
|
<QBtn
|
||||||
CrudModelRef.vnPaginateRef.paginate()
|
v-if="$props.rightSearch"
|
||||||
"
|
icon="filter_alt"
|
||||||
@row-click="(_, row) => rowClickFunction(row)"
|
class="bg-vn-section-color q-ml-md"
|
||||||
@update:selected="emit('update:selected', $event)"
|
dense
|
||||||
>
|
@click="stateStore.toggleRightDrawer()"
|
||||||
<template #top-left v-if="!$props.withoutHeader">
|
/>
|
||||||
<slot name="top-left"></slot>
|
</template>
|
||||||
</template>
|
<template #header-cell="{ col }">
|
||||||
<template #top-right>
|
<QTh v-if="col.visible ?? true">
|
||||||
<TableVisibleColumns
|
<div
|
||||||
v-if="isTableMode"
|
class="column self-start q-ml-xs ellipsis"
|
||||||
v-model="splittedColumns.columns"
|
:class="`text-${col?.align ?? 'left'}`"
|
||||||
:table-code="tableCode ?? route.name"
|
:style="$props.columnSearch ? 'height: 75px' : ''"
|
||||||
/>
|
|
||||||
<QBtnToggle
|
|
||||||
v-model="mode"
|
|
||||||
toggle-color="primary"
|
|
||||||
class="bg-vn-section-color"
|
|
||||||
dense
|
|
||||||
:options="tableModes"
|
|
||||||
/>
|
|
||||||
<QBtn
|
|
||||||
v-if="$props.rightSearch"
|
|
||||||
icon="filter_alt"
|
|
||||||
title="asd"
|
|
||||||
class="bg-vn-section-color q-ml-md"
|
|
||||||
dense
|
|
||||||
@click="stateStore.toggleRightDrawer()"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #header-cell="{ col }">
|
|
||||||
<QTh
|
|
||||||
v-if="col.visible ?? true"
|
|
||||||
auto-width
|
|
||||||
style="min-width: 100px"
|
|
||||||
>
|
>
|
||||||
<div
|
<div class="row items-center no-wrap" style="height: 30px">
|
||||||
class="q-pt-sm q-px-sm ellipsis"
|
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip>
|
||||||
:class="`text-${col?.align ?? 'left'}`"
|
<VnTableOrder
|
||||||
:style="
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
$props.columnSearch && col.columnFilter == false
|
:name="col.orderBy ?? col.name"
|
||||||
? { 'min-height': 72 + 'px' }
|
:label="col?.label"
|
||||||
: ''
|
:data-key="$attrs['data-key']"
|
||||||
"
|
:search-url="searchUrl"
|
||||||
>
|
/>
|
||||||
{{ col?.label }}
|
|
||||||
</div>
|
</div>
|
||||||
<VnTableFilter
|
<VnTableFilter
|
||||||
v-if="$props.columnSearch"
|
v-if="$props.columnSearch"
|
||||||
|
@ -334,209 +449,232 @@ defineExpose({
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
v-model="params[columnName(col)]"
|
v-model="params[columnName(col)]"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
|
class="full-width"
|
||||||
/>
|
/>
|
||||||
</QTh>
|
</div>
|
||||||
</template>
|
</QTh>
|
||||||
<template #header-cell-tableActions>
|
</template>
|
||||||
<QTh auto-width class="sticky" />
|
<template #header-cell-tableActions>
|
||||||
</template>
|
<QTh auto-width class="sticky" />
|
||||||
<template #body-cell-tableStatus="{ col, row }">
|
</template>
|
||||||
<QTd auto-width :class="getColAlign(col)">
|
<template #body-cell-tableStatus="{ col, row }">
|
||||||
<VnTableChip
|
<QTd auto-width :class="getColAlign(col)">
|
||||||
:columns="splittedColumns.columnChips"
|
<VnTableChip :columns="splittedColumns.columnChips" :row="row">
|
||||||
|
<template #afterChip>
|
||||||
|
<slot name="afterChip" :row="row"></slot>
|
||||||
|
</template>
|
||||||
|
</VnTableChip>
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
|
<template #body-cell="{ col, row, rowIndex }">
|
||||||
|
<!-- Columns -->
|
||||||
|
<QTd
|
||||||
|
auto-width
|
||||||
|
class="no-margin q-px-xs"
|
||||||
|
:class="[getColAlign(col), col.columnClass]"
|
||||||
|
v-if="col.visible ?? true"
|
||||||
|
@click.ctrl="
|
||||||
|
($event) =>
|
||||||
|
rowCtrlClickFunction && rowCtrlClickFunction($event, row)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<slot
|
||||||
|
:name="`column-${col.name}`"
|
||||||
|
:col="col"
|
||||||
|
:row="row"
|
||||||
|
:row-index="rowIndex"
|
||||||
|
>
|
||||||
|
<VnTableColumn
|
||||||
|
:column="col"
|
||||||
:row="row"
|
:row="row"
|
||||||
>
|
:is-editable="col.isEditable ?? isEditable"
|
||||||
<template #afterChip>
|
v-model="row[col.name]"
|
||||||
<slot name="afterChip" :row="row"></slot>
|
component-prop="columnField"
|
||||||
</template>
|
|
||||||
</VnTableChip>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #body-cell="{ col, row }">
|
|
||||||
<!-- Columns -->
|
|
||||||
<QTd
|
|
||||||
auto-width
|
|
||||||
class="no-margin q-px-xs"
|
|
||||||
:class="getColAlign(col)"
|
|
||||||
v-if="col.visible ?? true"
|
|
||||||
>
|
|
||||||
<slot :name="`column-${col.name}`" :col="col" :row="row">
|
|
||||||
<VnTableColumn
|
|
||||||
:column="col"
|
|
||||||
:row="row"
|
|
||||||
:is-editable="false"
|
|
||||||
v-model="row[col.name]"
|
|
||||||
component-prop="columnField"
|
|
||||||
/>
|
|
||||||
</slot>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #body-cell-tableActions="{ col, row }">
|
|
||||||
<QTd
|
|
||||||
auto-width
|
|
||||||
:class="getColAlign(col)"
|
|
||||||
class="sticky no-padding"
|
|
||||||
@click="stopEventPropagation($event)"
|
|
||||||
>
|
|
||||||
<QBtn
|
|
||||||
v-for="(btn, index) of col.actions"
|
|
||||||
:key="index"
|
|
||||||
:title="btn.title"
|
|
||||||
:icon="btn.icon"
|
|
||||||
class="q-px-sm"
|
|
||||||
flat
|
|
||||||
:class="
|
|
||||||
btn.isPrimary
|
|
||||||
? 'text-primary-light'
|
|
||||||
: 'color-vn-text '
|
|
||||||
"
|
|
||||||
@click="btn.action(row)"
|
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</slot>
|
||||||
</template>
|
</QTd>
|
||||||
<template #item="{ row, colsMap }">
|
</template>
|
||||||
<component
|
<template #body-cell-tableActions="{ col, row }">
|
||||||
:is="$props.redirect ? 'router-link' : 'span'"
|
<QTd
|
||||||
:to="`/${$props.redirect}/` + row.id"
|
auto-width
|
||||||
|
:class="getColAlign(col)"
|
||||||
|
class="sticky no-padding"
|
||||||
|
@click="stopEventPropagation($event)"
|
||||||
|
>
|
||||||
|
<QBtn
|
||||||
|
v-for="(btn, index) of col.actions"
|
||||||
|
v-show="btn.show ? btn.show(row) : true"
|
||||||
|
:key="index"
|
||||||
|
:title="btn.title"
|
||||||
|
:icon="btn.icon"
|
||||||
|
class="q-px-sm text-primary-light"
|
||||||
|
flat
|
||||||
|
:style="`visibility: ${
|
||||||
|
(btn.show && btn.show(row)) ?? true ? 'visible' : 'hidden'
|
||||||
|
}`"
|
||||||
|
@click="btn.action(row)"
|
||||||
|
/>
|
||||||
|
</QTd>
|
||||||
|
</template>
|
||||||
|
<template #item="{ row, colsMap }">
|
||||||
|
<component
|
||||||
|
:is="$props.redirect ? 'router-link' : 'span'"
|
||||||
|
:to="`/${$props.redirect}/` + row.id"
|
||||||
|
>
|
||||||
|
<QCard
|
||||||
|
bordered
|
||||||
|
flat
|
||||||
|
class="row no-wrap justify-between cursor-pointer"
|
||||||
|
@click="
|
||||||
|
(_, row) => {
|
||||||
|
$props.rowClick && $props.rowClick(row);
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<QCard
|
<QCardSection
|
||||||
bordered
|
vertical
|
||||||
flat
|
class="no-margin no-padding"
|
||||||
class="row no-wrap justify-between cursor-pointer"
|
:class="colsMap.tableActions ? 'w-80' : 'fit'"
|
||||||
@click="
|
|
||||||
(_, row) => {
|
|
||||||
$props.rowClick && $props.rowClick(row);
|
|
||||||
}
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
|
<!-- Chips -->
|
||||||
<QCardSection
|
<QCardSection
|
||||||
vertical
|
v-if="splittedColumns.chips.length"
|
||||||
class="no-margin no-padding"
|
class="no-margin q-px-xs q-py-none"
|
||||||
:class="colsMap.tableActions ? 'w-80' : 'fit'"
|
|
||||||
>
|
>
|
||||||
<!-- Chips -->
|
<VnTableChip
|
||||||
<QCardSection
|
:columns="splittedColumns.chips"
|
||||||
v-if="splittedColumns.chips.length"
|
:row="row"
|
||||||
class="no-margin q-px-xs q-py-none"
|
|
||||||
>
|
>
|
||||||
<VnTableChip
|
<template #afterChip>
|
||||||
:columns="splittedColumns.chips"
|
<slot name="afterChip" :row="row"></slot>
|
||||||
:row="row"
|
</template>
|
||||||
>
|
</VnTableChip>
|
||||||
<template #afterChip>
|
</QCardSection>
|
||||||
<slot name="afterChip" :row="row"></slot>
|
<!-- Title -->
|
||||||
</template>
|
<QCardSection
|
||||||
</VnTableChip>
|
v-if="splittedColumns.title"
|
||||||
</QCardSection>
|
class="q-pl-sm q-py-none text-primary-light text-bold text-h6 cardEllipsis"
|
||||||
<!-- Title -->
|
>
|
||||||
<QCardSection
|
<span
|
||||||
v-if="splittedColumns.title"
|
:title="row[splittedColumns.title.name]"
|
||||||
class="q-pl-sm q-py-none text-primary-light text-bold text-h6 cardEllipsis"
|
@click="stopEventPropagation($event)"
|
||||||
|
class="cursor-text"
|
||||||
>
|
>
|
||||||
<span
|
{{ row[splittedColumns.title.name] }}
|
||||||
:title="row[splittedColumns.title.name]"
|
</span>
|
||||||
@click="stopEventPropagation($event)"
|
</QCardSection>
|
||||||
class="cursor-text"
|
<!-- Fields -->
|
||||||
>
|
<QCardSection
|
||||||
{{ row[splittedColumns.title.name] }}
|
class="q-pl-sm q-pr-lg q-py-xs"
|
||||||
</span>
|
:class="$props.cardClass"
|
||||||
</QCardSection>
|
>
|
||||||
<!-- Fields -->
|
<div
|
||||||
<QCardSection
|
v-for="(
|
||||||
class="q-pl-sm q-pr-lg q-py-xs"
|
col, index
|
||||||
:class="$props.cardClass"
|
) of splittedColumns.cardVisible"
|
||||||
|
:key="col.name"
|
||||||
|
class="fields"
|
||||||
>
|
>
|
||||||
<div
|
<VnLv
|
||||||
v-for="col of splittedColumns.cardVisible"
|
:label="
|
||||||
:key="col.name"
|
!col.component && col.label
|
||||||
class="fields"
|
? `${col.label}:`
|
||||||
|
: ''
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<VnLv
|
<template #value>
|
||||||
:label="
|
<span
|
||||||
!col.component && col.label
|
@click="stopEventPropagation($event)"
|
||||||
? `${col.label}:`
|
>
|
||||||
: ''
|
<slot
|
||||||
"
|
:name="`column-${col.name}`"
|
||||||
>
|
:col="col"
|
||||||
<template #value>
|
:row="row"
|
||||||
<span
|
:row-index="index"
|
||||||
@click="
|
|
||||||
stopEventPropagation($event)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<slot
|
<VnTableColumn
|
||||||
:name="`column-${col.name}`"
|
:column="col"
|
||||||
:col="col"
|
|
||||||
:row="row"
|
:row="row"
|
||||||
>
|
:is-editable="false"
|
||||||
<VnTableColumn
|
v-model="row[col.name]"
|
||||||
:column="col"
|
component-prop="columnField"
|
||||||
:row="row"
|
:show-label="true"
|
||||||
:is-editable="false"
|
/>
|
||||||
v-model="row[col.name]"
|
</slot>
|
||||||
component-prop="columnField"
|
</span>
|
||||||
:show-label="true"
|
</template>
|
||||||
/>
|
</VnLv>
|
||||||
</slot>
|
</div>
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</VnLv>
|
|
||||||
</div>
|
|
||||||
</QCardSection>
|
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<!-- Actions -->
|
</QCardSection>
|
||||||
<QCardSection
|
<!-- Actions -->
|
||||||
v-if="colsMap.tableActions"
|
<QCardSection
|
||||||
class="column flex-center w-10 no-margin q-pa-xs q-gutter-y-xs"
|
v-if="colsMap.tableActions"
|
||||||
@click="stopEventPropagation($event)"
|
class="column flex-center w-10 no-margin q-pa-xs q-gutter-y-xs"
|
||||||
>
|
@click="stopEventPropagation($event)"
|
||||||
<QBtn
|
>
|
||||||
v-for="(btn, index) of splittedColumns.actions
|
<QBtn
|
||||||
.actions"
|
v-for="(btn, index) of splittedColumns.actions
|
||||||
:key="index"
|
.actions"
|
||||||
:title="btn.title"
|
:key="index"
|
||||||
:icon="btn.icon"
|
:title="btn.title"
|
||||||
class="q-pa-xs"
|
:icon="btn.icon"
|
||||||
flat
|
class="q-pa-xs"
|
||||||
:class="
|
flat
|
||||||
btn.isPrimary
|
:class="
|
||||||
? 'text-primary-light'
|
btn.isPrimary
|
||||||
: 'color-vn-text '
|
? 'text-primary-light'
|
||||||
"
|
: 'color-vn-text '
|
||||||
@click="btn.action(row)"
|
"
|
||||||
/>
|
@click="btn.action(row)"
|
||||||
</QCardSection>
|
/>
|
||||||
</QCard>
|
</QCardSection>
|
||||||
</component>
|
</QCard>
|
||||||
</template>
|
</component>
|
||||||
</QTable>
|
</template>
|
||||||
</template>
|
</QTable>
|
||||||
</CrudModel>
|
</template>
|
||||||
</div>
|
</CrudModel>
|
||||||
<QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky v-if="$props.create" :offset="[20, 20]" style="z-index: 2">
|
||||||
<QBtn @click="showForm = !showForm" color="primary" fab icon="add" />
|
<QBtn
|
||||||
|
@click="
|
||||||
|
() =>
|
||||||
|
createAsDialog ? (showForm = !showForm) : handleOnDataSaved(create)
|
||||||
|
"
|
||||||
|
color="primary"
|
||||||
|
fab
|
||||||
|
icon="add"
|
||||||
|
shortcut="+"
|
||||||
|
/>
|
||||||
<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"
|
||||||
:column="column"
|
:name="`column-create-${column.name}`"
|
||||||
:row="{}"
|
:data="data"
|
||||||
default="input"
|
:column-name="column.name"
|
||||||
v-model="data[column.name]"
|
:label="column.label"
|
||||||
:show-label="true"
|
>
|
||||||
component-prop="columnCreate"
|
<VnTableColumn
|
||||||
/>
|
:column="column"
|
||||||
|
:row="{}"
|
||||||
|
default="input"
|
||||||
|
v-model="data[column.name]"
|
||||||
|
:show-label="true"
|
||||||
|
component-prop="columnCreate"
|
||||||
|
/>
|
||||||
|
</slot>
|
||||||
<slot name="more-create-dialog" :data="data" />
|
<slot name="more-create-dialog" :data="data" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -546,8 +684,12 @@ defineExpose({
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
status: Status
|
status: Status
|
||||||
|
table view: Table view
|
||||||
|
grid view: Grid view
|
||||||
es:
|
es:
|
||||||
status: Estados
|
status: Estados
|
||||||
|
table view: Vista en tabla
|
||||||
|
grid view: Vista en cuadrícula
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -557,7 +699,11 @@ es:
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-header {
|
.bg-header {
|
||||||
background-color: #5d5d5d;
|
background-color: var(--vn-header-color);
|
||||||
|
color: var(--vn-text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-vn-text {
|
||||||
color: var(--vn-text-color);
|
color: var(--vn-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,7 +712,7 @@ es:
|
||||||
.q-table--dark tr,
|
.q-table--dark tr,
|
||||||
.q-table--dark th,
|
.q-table--dark th,
|
||||||
.q-table--dark td {
|
.q-table--dark td {
|
||||||
border-color: #222222;
|
border-color: var(--vn-section-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.q-table__container > div:first-child {
|
.q-table__container > div:first-child {
|
||||||
|
@ -615,6 +761,7 @@ es:
|
||||||
}
|
}
|
||||||
.q-table__top {
|
.q-table__top {
|
||||||
top: 0;
|
top: 0;
|
||||||
|
padding: 12px 0;
|
||||||
}
|
}
|
||||||
tbody {
|
tbody {
|
||||||
.q-checkbox {
|
.q-checkbox {
|
||||||
|
@ -636,7 +783,7 @@ es:
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
td.sticky {
|
td.sticky {
|
||||||
background-color: var(--q-dark);
|
background-color: var(--vn-section-color);
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,10 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
skip: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
@ -30,8 +34,12 @@ function setUserConfigViewData(data, isLocal) {
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
// Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config
|
// Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config
|
||||||
if (!isLocal) localColumns.value = [];
|
if (!isLocal) localColumns.value = [];
|
||||||
|
// Array to Object
|
||||||
|
const skippeds = $props.skip.reduce((a, v) => ({ ...a, [v]: v }), {});
|
||||||
|
|
||||||
for (let column of columns.value) {
|
for (let column of columns.value) {
|
||||||
const { label, name } = column;
|
const { label, name } = column;
|
||||||
|
if (skippeds[name]) continue;
|
||||||
column.visible = data[name] ?? true;
|
column.visible = data[name] ?? true;
|
||||||
if (!isLocal) localColumns.value.push({ name, label, visible: column.visible });
|
if (!isLocal) localColumns.value.push({ name, label, visible: column.visible });
|
||||||
}
|
}
|
||||||
|
@ -57,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 },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -73,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +135,7 @@ onMounted(async () => {
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QBtn icon="vn:visible_columns" class="bg-vn-section-color q-mr-md" dense>
|
<QBtn icon="vn:visible_columns" class="bg-vn-section-color q-mr-md q-px-sm" dense>
|
||||||
<QPopupProxy ref="popupProxyRef">
|
<QPopupProxy ref="popupProxyRef">
|
||||||
<QCard class="column q-pa-md">
|
<QCard class="column q-pa-md">
|
||||||
<QIcon name="info" size="sm" class="info-icon">
|
<QIcon name="info" size="sm" class="info-icon">
|
||||||
|
|
|
@ -37,7 +37,7 @@ const stateStore = useStateStore();
|
||||||
@click="stateStore.toggleRightDrawer()"
|
@click="stateStore.toggleRightDrawer()"
|
||||||
round
|
round
|
||||||
dense
|
dense
|
||||||
icon="menu"
|
icon="dock_to_left"
|
||||||
>
|
>
|
||||||
<QTooltip bottom anchor="bottom right">
|
<QTooltip bottom anchor="bottom right">
|
||||||
{{ t('globals.collapseMenu') }}
|
{{ t('globals.collapseMenu') }}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ watchEffect(() => {
|
||||||
(matched) => Object.keys(matched.meta).length
|
(matched) => Object.keys(matched.meta).length
|
||||||
);
|
);
|
||||||
breadcrumbs.value.length = 0;
|
breadcrumbs.value.length = 0;
|
||||||
|
if (!matched.value[0]) return;
|
||||||
if (matched.value[0].name != 'Dashboard') {
|
if (matched.value[0].name != 'Dashboard') {
|
||||||
root.value = useCamelCase(matched.value[0].path.substring(1).toLowerCase());
|
root.value = useCamelCase(matched.value[0].path.substring(1).toLowerCase());
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount, computed } from 'vue';
|
import { onBeforeMount, computed } from 'vue';
|
||||||
import { useRoute, onBeforeRouteUpdate } from 'vue-router';
|
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import useCardSize from 'src/composables/useCardSize';
|
import useCardSize from 'src/composables/useCardSize';
|
||||||
|
@ -8,7 +8,6 @@ import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import LeftMenu from 'components/LeftMenu.vue';
|
import LeftMenu from 'components/LeftMenu.vue';
|
||||||
import RightMenu from 'components/common/RightMenu.vue';
|
import RightMenu from 'components/common/RightMenu.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
dataKey: { type: String, required: true },
|
dataKey: { type: String, required: true },
|
||||||
baseUrl: { type: String, default: undefined },
|
baseUrl: { type: String, default: undefined },
|
||||||
|
@ -17,29 +16,33 @@ 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: '' },
|
redirectOnError: { type: Boolean, default: false },
|
||||||
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();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
const url = computed(() => {
|
const url = computed(() => {
|
||||||
if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`;
|
if (props.baseUrl) return `${props.baseUrl}/${route.params.id}`;
|
||||||
return props.customUrl;
|
return props.customUrl;
|
||||||
});
|
});
|
||||||
|
const searchRightDataKey = computed(() => {
|
||||||
|
if (!props.searchDataKey) return route.name;
|
||||||
|
return props.searchDataKey;
|
||||||
|
});
|
||||||
const arrayData = useArrayData(props.dataKey, {
|
const arrayData = useArrayData(props.dataKey, {
|
||||||
url: url.value,
|
url: url.value,
|
||||||
filter: props.filter,
|
filter: props.filter,
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
try {
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
||||||
|
await arrayData.fetch({ append: false, updateRouter: false });
|
||||||
|
} catch (e) {
|
||||||
|
router.push({ name: 'WorkerList' });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (props.baseUrl) {
|
if (props.baseUrl) {
|
||||||
|
@ -65,26 +68,18 @@ 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" />
|
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel v-if="props.filterPanel">
|
<template #right-panel v-if="props.filterPanel">
|
||||||
<component :is="props.filterPanel" :data-key="props.searchDataKey" />
|
<component :is="props.filterPanel" :data-key="searchRightDataKey" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<QPageContainer>
|
<QPageContainer>
|
||||||
<QPage>
|
<QPage>
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
<div :class="[useCardSize(), $attrs.class]">
|
<div :class="[useCardSize(), $attrs.class]">
|
||||||
<RouterView />
|
<RouterView :key="route.path" />
|
||||||
</div>
|
</div>
|
||||||
</QPage>
|
</QPage>
|
||||||
</QPageContainer>
|
</QPageContainer>
|
||||||
|
|
|
@ -17,15 +17,17 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let mixed;
|
||||||
const componentArray = computed(() => {
|
const componentArray = computed(() => {
|
||||||
if (typeof $props.prop === 'object') return [$props.prop];
|
if (typeof $props.prop === 'object') return [$props.prop];
|
||||||
return $props.prop;
|
return $props.prop;
|
||||||
});
|
});
|
||||||
|
|
||||||
function mix(toComponent) {
|
function mix(toComponent) {
|
||||||
|
if (mixed) return mixed;
|
||||||
const { component, attrs, event } = toComponent;
|
const { component, attrs, event } = toComponent;
|
||||||
const customComponent = $props.components[component];
|
const customComponent = $props.components[component];
|
||||||
return {
|
mixed = {
|
||||||
component: customComponent?.component ?? component,
|
component: customComponent?.component ?? component,
|
||||||
attrs: {
|
attrs: {
|
||||||
...toValueAttrs(attrs),
|
...toValueAttrs(attrs),
|
||||||
|
@ -33,8 +35,9 @@ function mix(toComponent) {
|
||||||
...toComponent,
|
...toComponent,
|
||||||
...toValueAttrs(customComponent?.forceAttrs),
|
...toValueAttrs(customComponent?.forceAttrs),
|
||||||
},
|
},
|
||||||
event: event ?? customComponent?.event,
|
event: { ...customComponent?.event, ...event },
|
||||||
};
|
};
|
||||||
|
return mixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toValueAttrs(attrs) {
|
function toValueAttrs(attrs) {
|
||||||
|
|
|
@ -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>
|
|
|
@ -5,12 +5,14 @@ import { useRoute } from 'vue-router';
|
||||||
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
|
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
|
import VnUserLink from '../ui/VnUserLink.vue';
|
||||||
|
import { downloadFile } from 'src/composables/downloadFile';
|
||||||
|
import VnImg from 'components/ui/VnImg.vue';
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import VnDms from 'src/components/common/VnDms.vue';
|
import VnDms from 'src/components/common/VnDms.vue';
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnUserLink from '../ui/VnUserLink.vue';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { downloadFile } from 'src/composables/downloadFile';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
@ -18,6 +20,7 @@ const { t } = useI18n();
|
||||||
const rows = ref();
|
const rows = ref();
|
||||||
const dmsRef = ref();
|
const dmsRef = ref();
|
||||||
const formDialog = ref({});
|
const formDialog = ref({});
|
||||||
|
const token = useSession().getTokenMultimedia();
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
model: {
|
model: {
|
||||||
|
@ -89,6 +92,23 @@ const dmsFilter = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
{
|
||||||
|
label: '',
|
||||||
|
name: 'file',
|
||||||
|
align: 'left',
|
||||||
|
component: VnImg,
|
||||||
|
props: (prop) => {
|
||||||
|
return {
|
||||||
|
storage: 'dms',
|
||||||
|
collection: null,
|
||||||
|
resolution: null,
|
||||||
|
id: prop.row.file.split('.')[0],
|
||||||
|
token: token,
|
||||||
|
class: 'rounded',
|
||||||
|
ratio: 1,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'id',
|
field: 'id',
|
||||||
|
@ -135,19 +155,13 @@ const columns = computed(() => [
|
||||||
field: 'hasFile',
|
field: 'hasFile',
|
||||||
label: t('globals.original'),
|
label: t('globals.original'),
|
||||||
name: 'hasFile',
|
name: 'hasFile',
|
||||||
|
toolTip: t('The documentation is available in paper form'),
|
||||||
component: QCheckbox,
|
component: QCheckbox,
|
||||||
props: (prop) => ({
|
props: (prop) => ({
|
||||||
disable: true,
|
disable: true,
|
||||||
'model-value': Boolean(prop.value),
|
'model-value': Boolean(prop.value),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
field: 'file',
|
|
||||||
label: t('globals.file'),
|
|
||||||
name: 'file',
|
|
||||||
component: 'span',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
field: 'worker',
|
field: 'worker',
|
||||||
|
@ -273,6 +287,10 @@ function shouldRenderButton(button, isExternal = false) {
|
||||||
if (button.name == 'download') return true;
|
if (button.name == 'download') return true;
|
||||||
return button.external === isExternal;
|
return button.external === isExternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
dmsRef,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
|
@ -293,6 +311,14 @@ function shouldRenderButton(button, isExternal = false) {
|
||||||
row-key="clientFk"
|
row-key="clientFk"
|
||||||
:grid="$q.screen.lt.sm"
|
:grid="$q.screen.lt.sm"
|
||||||
>
|
>
|
||||||
|
<template #header="props">
|
||||||
|
<QTr :props="props" class="bg">
|
||||||
|
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
|
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip
|
||||||
|
>{{ col.label }}
|
||||||
|
</QTh>
|
||||||
|
</QTr>
|
||||||
|
</template>
|
||||||
<template #body-cell="props">
|
<template #body-cell="props">
|
||||||
<QTd :props="props">
|
<QTd :props="props">
|
||||||
<QTr :props="props">
|
<QTr :props="props">
|
||||||
|
@ -374,14 +400,14 @@ function shouldRenderButton(button, isExternal = false) {
|
||||||
/>
|
/>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||||
<QBtn fab color="primary" icon="add" @click="showFormDialog()" />
|
<QBtn fab color="primary" icon="add" @click="showFormDialog()" class="fill-icon">
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('Upload file') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.q-gutter-y-ms {
|
|
||||||
display: grid;
|
|
||||||
row-gap: 20px;
|
|
||||||
}
|
|
||||||
.labelColor {
|
.labelColor {
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
}
|
}
|
||||||
|
@ -389,7 +415,10 @@ function shouldRenderButton(button, isExternal = false) {
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
contentTypesInfo: Allowed file types {allowedContentTypes}
|
contentTypesInfo: Allowed file types {allowedContentTypes}
|
||||||
|
The documentation is available in paper form: The documentation is available in paper form
|
||||||
es:
|
es:
|
||||||
contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes}
|
contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes}
|
||||||
Generate identifier for original file: Generar identificador para archivo original
|
Generate identifier for original file: Generar identificador para archivo original
|
||||||
|
Upload file: Subir fichero
|
||||||
|
the documentation is available in paper form: Se tiene la documentación en papel
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useValidator } from 'src/composables/useValidator';
|
||||||
|
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
'update:modelValue',
|
'update:modelValue',
|
||||||
|
@ -27,9 +28,11 @@ const $props = defineProps({
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const { validations } = useValidator();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||||
|
|
||||||
const vnInputRef = ref(null);
|
const vnInputRef = ref(null);
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
|
@ -57,21 +60,22 @@ const focus = () => {
|
||||||
defineExpose({
|
defineExpose({
|
||||||
focus,
|
focus,
|
||||||
});
|
});
|
||||||
|
import { useAttrs } from 'vue';
|
||||||
|
const $attrs = useAttrs();
|
||||||
|
|
||||||
const inputRules = [
|
const mixinRules = [
|
||||||
|
requiredFieldRule,
|
||||||
|
...($attrs.rules ?? []),
|
||||||
(val) => {
|
(val) => {
|
||||||
const { min } = vnInputRef.value.$attrs;
|
const { min } = vnInputRef.value.$attrs;
|
||||||
|
if (!min) return null;
|
||||||
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
if (min >= 0) if (Math.floor(val) < min) return t('inputMin', { value: min });
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||||
@mouseover="hover = true"
|
|
||||||
@mouseleave="hover = false"
|
|
||||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
|
||||||
>
|
|
||||||
<QInput
|
<QInput
|
||||||
ref="vnInputRef"
|
ref="vnInputRef"
|
||||||
v-model="value"
|
v-model="value"
|
||||||
|
@ -80,7 +84,7 @@ const inputRules = [
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
@keyup.enter="emit('keyup.enter')"
|
@keyup.enter="emit('keyup.enter')"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
:rules="inputRules"
|
:rules="mixinRules"
|
||||||
:lazy-rules="true"
|
:lazy-rules="true"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
>
|
>
|
||||||
|
@ -88,7 +92,6 @@ const inputRules = [
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
</template>
|
</template>
|
||||||
<template #append>
|
<template #append>
|
||||||
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
|
|
||||||
<QIcon
|
<QIcon
|
||||||
name="close"
|
name="close"
|
||||||
size="xs"
|
size="xs"
|
||||||
|
@ -100,6 +103,7 @@ const inputRules = [
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
></QIcon>
|
></QIcon>
|
||||||
|
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
|
||||||
<QIcon v-if="info" name="info">
|
<QIcon v-if="info" name="info">
|
||||||
<QTooltip max-width="350px">
|
<QTooltip max-width="350px">
|
||||||
{{ info }}
|
{{ info }}
|
||||||
|
@ -115,3 +119,8 @@ const inputRules = [
|
||||||
es:
|
es:
|
||||||
inputMin: Debe ser mayor a {value}
|
inputMin: Debe ser mayor a {value}
|
||||||
</i18n>
|
</i18n>
|
||||||
|
<style lang="scss">
|
||||||
|
.q-field__append {
|
||||||
|
padding-inline: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -3,12 +3,16 @@ import { onMounted, watch, computed, ref } from 'vue';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const model = defineModel({ type: String });
|
const model = defineModel({ type: [String, Date] });
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
isOutlined: {
|
isOutlined: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
showEvent: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -44,15 +48,18 @@ const formattedDate = computed({
|
||||||
let newDate;
|
let newDate;
|
||||||
if (value) {
|
if (value) {
|
||||||
// parse input
|
// parse input
|
||||||
if (value.includes('/') && value.length >= 10) {
|
if (value.includes('/')) {
|
||||||
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
|
if (value.length == 6) value = value + new Date().getFullYear();
|
||||||
value = date.formatDate(
|
if (value.length >= 10) {
|
||||||
new Date(value).toISOString(),
|
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
|
||||||
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
value = date.formatDate(
|
||||||
);
|
new Date(value).toISOString(),
|
||||||
|
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let ymd = value.split('-').map((e) => parseInt(e));
|
const [year, month, day] = value.split('-').map((e) => parseInt(e));
|
||||||
newDate = new Date(ymd[0], ymd[1] - 1, ymd[2]);
|
newDate = new Date(year, month - 1, day);
|
||||||
if (model.value) {
|
if (model.value) {
|
||||||
const orgDate =
|
const orgDate =
|
||||||
model.value instanceof Date ? model.value : new Date(model.value);
|
model.value instanceof Date ? model.value : new Date(model.value);
|
||||||
|
@ -91,6 +98,7 @@ watch(
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
|
@click="isPopupOpen = true"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -107,7 +115,13 @@ watch(
|
||||||
isPopupOpen = false;
|
isPopupOpen = false;
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<QIcon name="event" class="cursor-pointer" />
|
<QIcon
|
||||||
|
v-if="showEvent"
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="isPopupOpen = !isPopupOpen"
|
||||||
|
:title="t('Open date')"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<QMenu
|
<QMenu
|
||||||
transition-show="scale"
|
transition-show="scale"
|
||||||
|
@ -116,10 +130,13 @@ watch(
|
||||||
anchor="bottom left"
|
anchor="bottom left"
|
||||||
self="top start"
|
self="top start"
|
||||||
:no-focus="true"
|
:no-focus="true"
|
||||||
|
:no-parent-event="true"
|
||||||
>
|
>
|
||||||
<QDate
|
<QDate
|
||||||
v-model="popupDate"
|
v-model="popupDate"
|
||||||
|
:landscape="true"
|
||||||
:today-btn="true"
|
:today-btn="true"
|
||||||
|
:options="$attrs.options"
|
||||||
@update:model-value="
|
@update:model-value="
|
||||||
(date) => {
|
(date) => {
|
||||||
formattedDate = date;
|
formattedDate = date;
|
||||||
|
@ -131,7 +148,6 @@ watch(
|
||||||
</QInput>
|
</QInput>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.vn-input-date.q-field--standard.q-field--readonly .q-field__control:before {
|
.vn-input-date.q-field--standard.q-field--readonly .q-field__control:before {
|
||||||
border-bottom-style: solid;
|
border-bottom-style: solid;
|
||||||
|
@ -141,3 +157,7 @@ watch(
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Open date: Abrir fecha
|
||||||
|
</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>
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { watch, computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { date } from 'quasar';
|
import { date } from 'quasar';
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ const props = defineProps({
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const initialDate = ref(model.value ?? Date.vnNew());
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
const requiredFieldRule = (val) => !!val || t('globals.fieldRequired');
|
||||||
|
|
||||||
|
@ -41,11 +42,18 @@ const formattedTime = computed({
|
||||||
let time = value;
|
let time = value;
|
||||||
if (time) {
|
if (time) {
|
||||||
if (time?.length > 5) time = dateToTime(time);
|
if (time?.length > 5) time = dateToTime(time);
|
||||||
|
else {
|
||||||
|
if (time.length == 1 && parseInt(time) > 2) time = time.padStart(2, '0');
|
||||||
|
time = time.padEnd(5, '0');
|
||||||
|
if (!time.includes(':'))
|
||||||
|
time = time.substring(0, 2) + ':' + time.substring(3, 5);
|
||||||
|
}
|
||||||
if (!props.timeOnly) {
|
if (!props.timeOnly) {
|
||||||
const hours = time.split(':');
|
const [hh, mm] = time.split(':');
|
||||||
const date = new Date();
|
|
||||||
date.setHours(hours[0], hours[1], 0);
|
const date = new Date(model.value ? model.value : initialDate.value);
|
||||||
time = date.toISOString();
|
date.setHours(hh, mm, 0);
|
||||||
|
time = date?.toISOString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.value = time;
|
model.value = time;
|
||||||
|
@ -55,14 +63,7 @@ const formattedTime = computed({
|
||||||
function dateToTime(newDate) {
|
function dateToTime(newDate) {
|
||||||
return date.formatDate(new Date(newDate), dateFormat);
|
return date.formatDate(new Date(newDate), dateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
|
||||||
() => model.value,
|
|
||||||
(val) => (formattedTime.value = val),
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div @mouseover="hover = true" @mouseleave="hover = false">
|
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||||
<QInput
|
<QInput
|
||||||
|
@ -74,6 +75,8 @@ watch(
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
style="min-width: 100px"
|
style="min-width: 100px"
|
||||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||||
|
@click="isPopupOpen = false"
|
||||||
|
type="time"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -90,7 +93,12 @@ watch(
|
||||||
isPopupOpen = false;
|
isPopupOpen = false;
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<QIcon name="Schedule" class="cursor-pointer" />
|
<QIcon
|
||||||
|
name="Schedule"
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="isPopupOpen = !isPopupOpen"
|
||||||
|
:title="t('Open time')"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<QMenu
|
<QMenu
|
||||||
transition-show="scale"
|
transition-show="scale"
|
||||||
|
@ -99,14 +107,9 @@ watch(
|
||||||
anchor="bottom left"
|
anchor="bottom left"
|
||||||
self="top start"
|
self="top start"
|
||||||
:no-focus="true"
|
:no-focus="true"
|
||||||
|
:no-parent-event="true"
|
||||||
>
|
>
|
||||||
<QTime
|
<QTime v-model="formattedTime" mask="HH:mm" landscape now-btn />
|
||||||
:format24h="false"
|
|
||||||
v-model="formattedTime"
|
|
||||||
mask="HH:mm"
|
|
||||||
landscape
|
|
||||||
now-btn
|
|
||||||
/>
|
|
||||||
</QMenu>
|
</QMenu>
|
||||||
</QInput>
|
</QInput>
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,3 +123,12 @@ watch(
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(input[type='time']::-webkit-calendar-picker-indicator) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Open time: Abrir tiempo
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -1,123 +1,33 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
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';
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
const emit = defineEmits(['update:modelValue', 'update:options']);
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const postcodesOptions = ref([]);
|
const value = defineModel({ type: [String, Number, Object] });
|
||||||
const postcodesRef = ref(null);
|
|
||||||
|
|
||||||
const $props = defineProps({
|
|
||||||
modelValue: {
|
|
||||||
type: [String, Number, Object],
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
optionLabel: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
optionValue: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
filterOptions: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
isClearable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
defaultFilter: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { options } = toRefs($props);
|
|
||||||
const myOptions = ref([]);
|
|
||||||
const myOptionsOriginal = ref([]);
|
|
||||||
|
|
||||||
const value = computed({
|
|
||||||
get() {
|
|
||||||
return $props.modelValue;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
emit(
|
|
||||||
'update:modelValue',
|
|
||||||
postcodesOptions.value.find((p) => p.code === value)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
locationFilter($props.modelValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
function setOptions(data) {
|
|
||||||
myOptions.value = JSON.parse(JSON.stringify(data));
|
|
||||||
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
|
||||||
}
|
|
||||||
setOptions(options.value);
|
|
||||||
|
|
||||||
watch(options, (newValue) => {
|
|
||||||
setOptions(newValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
function showLabel(data) {
|
function showLabel(data) {
|
||||||
return `${data.code} - ${data.town}(${data.province}), ${data.country}`;
|
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) {
|
|
||||||
postcodesOptions.value.push(newPostcode);
|
|
||||||
value.value = newPostcode.code;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
ref="postcodesRef"
|
|
||||||
url="Postcodes/filter"
|
|
||||||
@on-fetch="(data) => handleFetch(data)"
|
|
||||||
/>
|
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
v-if="postcodesRef"
|
|
||||||
:option-label="(opt) => showLabel(opt) ?? 'code'"
|
|
||||||
:option-value="(opt) => opt.code"
|
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:options="postcodesOptions"
|
option-value="code"
|
||||||
|
option-filter-value="search"
|
||||||
|
:option-label="(opt) => showLabel(opt)"
|
||||||
|
url="Postcodes/filter"
|
||||||
|
:use-like="false"
|
||||||
:label="t('Location')"
|
:label="t('Location')"
|
||||||
:placeholder="t('search_by_postalcode')"
|
:placeholder="t('search_by_postalcode')"
|
||||||
@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="false"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateNewPostcode
|
<CreateNewPostcode @on-data-saved="(newValue) => (value = newValue)" />
|
||||||
@on-data-saved="onDataSaved"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
|
|
@ -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';
|
||||||
|
@ -14,11 +14,13 @@ import VnJsonValue from '../common/VnJsonValue.vue';
|
||||||
import FetchData from '../FetchData.vue';
|
import FetchData from '../FetchData.vue';
|
||||||
import VnSelect from './VnSelect.vue';
|
import VnSelect from './VnSelect.vue';
|
||||||
import VnUserLink from '../ui/VnUserLink.vue';
|
import VnUserLink from '../ui/VnUserLink.vue';
|
||||||
|
import VnPaginate from '../ui/VnPaginate.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
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: {
|
||||||
|
@ -65,9 +67,10 @@ const filter = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
where: { and: [{ originFk: route.params.id }] },
|
||||||
};
|
};
|
||||||
|
|
||||||
const workers = ref();
|
const paginate = ref();
|
||||||
const actions = ref();
|
const actions = ref();
|
||||||
const changeInput = ref();
|
const changeInput = ref();
|
||||||
const searchInput = ref();
|
const searchInput = ref();
|
||||||
|
@ -213,7 +216,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) || {};
|
||||||
|
@ -234,9 +237,7 @@ async function openPointRecord(id, modelLog) {
|
||||||
const locale = validations[modelLog.model]?.locale || {};
|
const locale = validations[modelLog.model]?.locale || {};
|
||||||
pointRecord.value = parseProps(propNames, locale, data);
|
pointRecord.value = parseProps(propNames, locale, data);
|
||||||
}
|
}
|
||||||
async function setLogTree() {
|
async function setLogTree(data) {
|
||||||
filter.where = { and: [{ originFk: route.params.id }] };
|
|
||||||
const { data } = await getLogs(filter);
|
|
||||||
logTree.value = getLogTree(data);
|
logTree.value = getLogTree(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,15 +266,7 @@ async function applyFilter() {
|
||||||
filter.where.and.push(selectedFilters.value);
|
filter.where.and.push(selectedFilters.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data } = await getLogs(filter);
|
paginate.value.fetch(filter);
|
||||||
|
|
||||||
logTree.value = getLogTree(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getLogs(filter) {
|
|
||||||
return axios.get(props.url ?? `${props.model}Logs`, {
|
|
||||||
params: { filter: JSON.stringify(filter) },
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDate(type) {
|
function setDate(type) {
|
||||||
|
@ -376,257 +369,312 @@ async function clearFilter() {
|
||||||
await applyFilter();
|
await applyFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
setLogTree();
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
stateStore.rightDrawer = false;
|
stateStore.rightDrawer = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => router.currentRoute.value.params.id,
|
||||||
|
() => {
|
||||||
|
applyFilter();
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
:url="`${props.model}Logs/${route.params.id}/editors`"
|
|
||||||
:filter="{
|
|
||||||
fields: ['id', 'nickname', 'name', 'image'],
|
|
||||||
order: 'nickname',
|
|
||||||
limit: 30,
|
|
||||||
}"
|
|
||||||
@on-fetch="(data) => (workers = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
:url="`${props.model}Logs/${route.params.id}/models`"
|
:url="`${props.model}Logs/${route.params.id}/models`"
|
||||||
:filter="{ order: ['changedModel'] }"
|
:filter="{ order: ['changedModel'] }"
|
||||||
@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,
|
||||||
};
|
};
|
||||||
}))
|
}))
|
||||||
"
|
"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<div
|
<VnPaginate
|
||||||
class="column items-center logs origin-log q-mt-md"
|
ref="paginate"
|
||||||
v-for="(originLog, originLogIndex) in logTree"
|
:data-key="`${model}Log`"
|
||||||
:key="originLogIndex"
|
:url="`${model}Logs`"
|
||||||
|
:filter="filter"
|
||||||
|
:skeleton="false"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="setLogTree"
|
||||||
>
|
>
|
||||||
<QItem class="origin-info items-center q-my-md" v-if="logTree.length > 1">
|
<template #body>
|
||||||
<h6 class="origin-id text-grey">
|
<div
|
||||||
{{ useCapitalize(validations[props.model].locale.name) }}
|
class="column items-center logs origin-log q-mt-md"
|
||||||
#{{ originLog.originFk }}
|
v-for="(originLog, originLogIndex) in logTree"
|
||||||
</h6>
|
:key="originLogIndex"
|
||||||
<div class="line bg-grey"></div>
|
>
|
||||||
</QItem>
|
<QItem class="origin-info items-center q-my-md" v-if="logTree.length > 1">
|
||||||
<div
|
<h6 class="origin-id text-grey">
|
||||||
class="user-log q-mb-sm"
|
{{ useCapitalize(validations[props.model].locale.name) }}
|
||||||
v-for="(userLog, userIndex) in originLog.logs"
|
#{{ originLog.originFk }}
|
||||||
:key="userIndex"
|
</h6>
|
||||||
>
|
<div class="line bg-grey"></div>
|
||||||
<div class="timeline">
|
</QItem>
|
||||||
<div class="user-avatar">
|
<div
|
||||||
<VnUserLink :worker-id="userLog?.user?.id">
|
class="user-log q-mb-sm"
|
||||||
<template #link>
|
v-for="(userLog, userIndex) in originLog.logs"
|
||||||
<VnAvatar
|
:key="userIndex"
|
||||||
:class="{ 'cursor-pointer': userLog?.user?.id }"
|
|
||||||
:worker-id="userLog?.user?.id"
|
|
||||||
:title="userLog?.user?.nickname"
|
|
||||||
:show-letter="!userLog?.user"
|
|
||||||
size="lg"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</VnUserLink>
|
|
||||||
</div>
|
|
||||||
<div class="arrow bg-panel" v-if="byRecord"></div>
|
|
||||||
<div class="line"></div>
|
|
||||||
</div>
|
|
||||||
<QList class="user-changes" v-if="userLog">
|
|
||||||
<QItem
|
|
||||||
class="model-log column q-px-none q-py-xs"
|
|
||||||
v-for="(modelLog, modelLogIndex) in userLog.logs"
|
|
||||||
:key="modelLogIndex"
|
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<div class="timeline">
|
||||||
<QItemLabel class="model-info q-mb-xs" v-if="!byRecord">
|
<div class="user-avatar">
|
||||||
<QChip
|
<VnUserLink :worker-id="userLog?.user?.id">
|
||||||
dense
|
<template #link>
|
||||||
size="md"
|
<VnAvatar
|
||||||
class="model-name q-mr-xs text-white"
|
:class="{ 'cursor-pointer': userLog?.user?.id }"
|
||||||
v-if="
|
:worker-id="userLog?.user?.id"
|
||||||
!(modelLog.changedModel && modelLog.changedModelId) &&
|
:title="userLog?.user?.nickname"
|
||||||
modelLog.model
|
:show-letter="!userLog?.user"
|
||||||
"
|
size="lg"
|
||||||
:style="{
|
/>
|
||||||
backgroundColor: useColor(modelLog.model),
|
</template>
|
||||||
}"
|
</VnUserLink>
|
||||||
:title="`${modelLog.model} #${modelLog.id}`"
|
</div>
|
||||||
>
|
<div class="arrow bg-panel" v-if="byRecord"></div>
|
||||||
{{ t(modelLog.modelI18n) }}
|
<div class="line"></div>
|
||||||
</QChip>
|
</div>
|
||||||
<span class="model-id" v-if="modelLog.summaryId"
|
<QList class="user-changes" v-if="userLog">
|
||||||
>#{{ modelLog.summaryId }}</span
|
<QItem
|
||||||
>
|
class="model-log column q-px-none q-py-xs"
|
||||||
<span class="model-value" :title="modelLog.showValue">
|
v-for="(modelLog, modelLogIndex) in userLog.logs"
|
||||||
{{ modelLog.showValue }}
|
:key="modelLogIndex"
|
||||||
</span>
|
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
color="grey"
|
|
||||||
class="q-mr-xs q-ml-auto"
|
|
||||||
size="sm"
|
|
||||||
icon="filter_alt"
|
|
||||||
:title="t('recordChanges')"
|
|
||||||
@click.stop="filterByRecord(modelLog)"
|
|
||||||
/>
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
<QItemSection>
|
|
||||||
<QCard
|
|
||||||
class="changes-log q-py-none q-mb-xs"
|
|
||||||
v-for="(log, logIndex) in modelLog.logs"
|
|
||||||
:key="logIndex"
|
|
||||||
>
|
>
|
||||||
<QCardSection class="change-info q-pa-none">
|
<QItemSection>
|
||||||
<QItem
|
<QItemLabel class="model-info q-mb-xs" v-if="!byRecord">
|
||||||
class="q-px-sm q-py-xs justify-between items-center"
|
<QChip
|
||||||
>
|
dense
|
||||||
<div
|
size="md"
|
||||||
class="date text-grey text-caption q-mr-sm"
|
class="model-name q-mr-xs text-white"
|
||||||
:title="
|
v-if="
|
||||||
date.formatDate(
|
!(
|
||||||
log.creationDate,
|
modelLog.changedModel &&
|
||||||
'DD/MM/YYYY hh:mm:ss'
|
modelLog.changedModelId
|
||||||
) ?? `date:'dd/MM/yyyy HH:mm:ss'`
|
) && modelLog.model
|
||||||
"
|
"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: useColor(modelLog.model),
|
||||||
|
}"
|
||||||
|
:title="`${modelLog.model} #${modelLog.id}`"
|
||||||
>
|
>
|
||||||
{{ toRelativeDate(log.creationDate) }}
|
{{ t(modelLog.modelI18n) }}
|
||||||
</div>
|
</QChip>
|
||||||
<div>
|
|
||||||
<QBtn
|
|
||||||
color="grey"
|
|
||||||
class="pit"
|
|
||||||
icon="preview"
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
:title="t('pointRecord')"
|
|
||||||
padding="none"
|
|
||||||
v-if="log.action != 'insert'"
|
|
||||||
@click.stop="
|
|
||||||
openPointRecord(log.id, modelLog)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<QPopupProxy>
|
|
||||||
<QCard v-if="pointRecord">
|
|
||||||
<div
|
|
||||||
class="header q-px-sm q-py-xs q-ma-none text-white text-bold bg-primary"
|
|
||||||
>
|
|
||||||
{{ modelLog.modelI18n }}
|
|
||||||
<span v-if="modelLog.id"
|
|
||||||
>#{{ modelLog.id }}</span
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<QCardSection
|
|
||||||
class="change-detail q-pa-sm"
|
|
||||||
>
|
|
||||||
<QItem
|
|
||||||
v-for="(
|
|
||||||
value, index
|
|
||||||
) in pointRecord"
|
|
||||||
:key="index"
|
|
||||||
class="q-pa-none"
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
class="json-field q-mr-xs text-grey"
|
|
||||||
:title="value.name"
|
|
||||||
>
|
|
||||||
{{ value.nameI18n }}:
|
|
||||||
</span>
|
|
||||||
<VnJsonValue
|
|
||||||
:value="value.val.val"
|
|
||||||
/>
|
|
||||||
</QItem>
|
|
||||||
</QCardSection>
|
|
||||||
</QCard>
|
|
||||||
</QPopupProxy>
|
|
||||||
</QBtn>
|
|
||||||
<QIcon
|
|
||||||
class="action q-ml-xs"
|
|
||||||
:class="actionsClass[log.action]"
|
|
||||||
:name="actionsIcon[log.action]"
|
|
||||||
:title="
|
|
||||||
t(`actions.${actionsText[log.action]}`)
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</QItem>
|
|
||||||
</QCardSection>
|
|
||||||
<QCardSection
|
|
||||||
class="change-detail q-px-sm q-py-xs"
|
|
||||||
:class="{ expanded: log.expand }"
|
|
||||||
v-if="log.props.length || log.description"
|
|
||||||
>
|
|
||||||
<QIcon
|
|
||||||
class="cursor-pointer q-mr-md"
|
|
||||||
color="grey"
|
|
||||||
name="expand_more"
|
|
||||||
:title="t('globals.details')"
|
|
||||||
size="sm"
|
|
||||||
@click="log.expand = !log.expand"
|
|
||||||
/>
|
|
||||||
<span v-if="log.props.length" class="attributes">
|
|
||||||
<span v-if="!log.expand" class="q-pa-none text-grey">
|
|
||||||
<span
|
|
||||||
v-for="(prop, propIndex) in log.props"
|
|
||||||
:key="propIndex"
|
|
||||||
class="basic-json"
|
|
||||||
>
|
|
||||||
<span class="json-field" :title="prop.name">
|
|
||||||
{{ prop.nameI18n }}:
|
|
||||||
</span>
|
|
||||||
<VnJsonValue :value="prop.val.val" />
|
|
||||||
<span v-if="propIndex < log.props.length - 1"
|
|
||||||
>,
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<span
|
<span
|
||||||
v-if="log.expand"
|
class="model-id q-mr-xs"
|
||||||
class="expanded-json column q-pa-none"
|
v-if="modelLog.summaryId"
|
||||||
>
|
v-text="`#${modelLog.summaryId}`"
|
||||||
<div
|
/>
|
||||||
v-for="(prop, prop2Index) in log.props"
|
<span
|
||||||
:key="prop2Index"
|
class="model-value"
|
||||||
class="q-pa-none text-grey"
|
:title="modelLog.showValue"
|
||||||
|
v-text="modelLog.showValue"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="grey"
|
||||||
|
class="q-mr-xs q-ml-auto"
|
||||||
|
size="sm"
|
||||||
|
icon="filter_alt"
|
||||||
|
:title="t('recordChanges')"
|
||||||
|
@click.stop="filterByRecord(modelLog)"
|
||||||
|
/>
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>
|
||||||
|
<QCard
|
||||||
|
class="changes-log q-py-none q-mb-xs"
|
||||||
|
v-for="(log, logIndex) in modelLog.logs"
|
||||||
|
:key="logIndex"
|
||||||
|
>
|
||||||
|
<QCardSection class="change-info q-pa-none">
|
||||||
|
<QItem
|
||||||
|
class="q-px-sm q-py-xs justify-between items-center"
|
||||||
>
|
>
|
||||||
<span class="json-field" :title="prop.name">
|
<div
|
||||||
{{ prop.nameI18n }}:
|
class="date text-grey text-caption q-mr-sm"
|
||||||
</span>
|
:title="
|
||||||
<VnJsonValue :value="prop.val.val" />
|
date.formatDate(
|
||||||
<span v-if="prop.val.id" class="id-value">
|
log.creationDate,
|
||||||
#{{ prop.val.id }}
|
'DD/MM/YYYY hh:mm:ss'
|
||||||
</span>
|
) ?? `date:'dd/MM/yyyy HH:mm:ss'`
|
||||||
<span v-if="log.action == 'update'">
|
"
|
||||||
←
|
>
|
||||||
<VnJsonValue :value="prop.old.val" />
|
{{ toRelativeDate(log.creationDate) }}
|
||||||
<span v-if="prop.old.id" class="id-value">
|
</div>
|
||||||
#{{ prop.old.id }}
|
<div>
|
||||||
|
<QBtn
|
||||||
|
color="grey"
|
||||||
|
class="pit"
|
||||||
|
icon="preview"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
:title="t('pointRecord')"
|
||||||
|
padding="none"
|
||||||
|
v-if="log.action != 'insert'"
|
||||||
|
@click.stop="
|
||||||
|
openPointRecord(log.id, modelLog)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<QPopupProxy>
|
||||||
|
<QCard v-if="pointRecord">
|
||||||
|
<div
|
||||||
|
class="header q-px-sm q-py-xs q-ma-none text-white text-bold bg-primary"
|
||||||
|
>
|
||||||
|
{{ modelLog.modelI18n }}
|
||||||
|
<span v-if="modelLog.id"
|
||||||
|
>#{{
|
||||||
|
modelLog.id
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<QCardSection
|
||||||
|
class="change-detail q-pa-sm"
|
||||||
|
>
|
||||||
|
<QItem
|
||||||
|
v-for="(
|
||||||
|
value, index
|
||||||
|
) in pointRecord"
|
||||||
|
:key="index"
|
||||||
|
class="q-pa-none"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="json-field q-mr-xs text-grey"
|
||||||
|
:title="
|
||||||
|
value.name
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
value.nameI18n
|
||||||
|
}}:
|
||||||
|
</span>
|
||||||
|
<VnJsonValue
|
||||||
|
:value="
|
||||||
|
value.val.val
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</QItem>
|
||||||
|
</QCardSection>
|
||||||
|
</QCard>
|
||||||
|
</QPopupProxy>
|
||||||
|
</QBtn>
|
||||||
|
<QIcon
|
||||||
|
class="action q-ml-xs"
|
||||||
|
:class="actionsClass[log.action]"
|
||||||
|
:name="actionsIcon[log.action]"
|
||||||
|
:title="
|
||||||
|
t(
|
||||||
|
`actions.${
|
||||||
|
actionsText[log.action]
|
||||||
|
}`
|
||||||
|
)
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</QItem>
|
||||||
|
</QCardSection>
|
||||||
|
<QCardSection
|
||||||
|
class="change-detail q-px-sm q-py-xs"
|
||||||
|
:class="{ expanded: log.expand }"
|
||||||
|
v-if="log.props.length || log.description"
|
||||||
|
>
|
||||||
|
<QIcon
|
||||||
|
class="cursor-pointer q-mr-md"
|
||||||
|
color="grey"
|
||||||
|
name="expand_more"
|
||||||
|
:title="t('globals.details')"
|
||||||
|
size="sm"
|
||||||
|
@click="log.expand = !log.expand"
|
||||||
|
/>
|
||||||
|
<span v-if="log.props.length" class="attributes">
|
||||||
|
<span
|
||||||
|
v-if="!log.expand"
|
||||||
|
class="q-pa-none text-grey"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
v-for="(prop, propIndex) in log.props"
|
||||||
|
:key="propIndex"
|
||||||
|
class="basic-json"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="json-field"
|
||||||
|
:title="prop.name"
|
||||||
|
>
|
||||||
|
{{ prop.nameI18n }}:
|
||||||
|
</span>
|
||||||
|
<VnJsonValue :value="prop.val.val" />
|
||||||
|
<span
|
||||||
|
v-if="
|
||||||
|
propIndex <
|
||||||
|
log.props.length - 1
|
||||||
|
"
|
||||||
|
>,
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
<span
|
||||||
</span>
|
v-if="log.expand"
|
||||||
</span>
|
class="expanded-json column q-pa-none"
|
||||||
<span v-if="!log.props.length" class="description">
|
>
|
||||||
{{ log.description }}
|
<div
|
||||||
</span>
|
v-for="(
|
||||||
</QCardSection>
|
prop, prop2Index
|
||||||
</QCard>
|
) in log.props"
|
||||||
</QItemSection>
|
:key="prop2Index"
|
||||||
</QItem>
|
class="q-pa-none text-grey"
|
||||||
</QList>
|
>
|
||||||
</div>
|
<span
|
||||||
</div>
|
class="json-field"
|
||||||
|
:title="prop.name"
|
||||||
|
>
|
||||||
|
{{ prop.nameI18n }}:
|
||||||
|
</span>
|
||||||
|
<VnJsonValue :value="prop.val.val" />
|
||||||
|
<span
|
||||||
|
v-if="prop.val.id"
|
||||||
|
class="id-value"
|
||||||
|
>
|
||||||
|
#{{ prop.val.id }}
|
||||||
|
</span>
|
||||||
|
<span v-if="log.action == 'update'">
|
||||||
|
←
|
||||||
|
<VnJsonValue
|
||||||
|
:value="prop.old.val"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
v-if="prop.old.id"
|
||||||
|
class="id-value"
|
||||||
|
>
|
||||||
|
#{{ prop.old.id }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
v-if="!log.props.length"
|
||||||
|
class="description"
|
||||||
|
>
|
||||||
|
{{ log.description }}
|
||||||
|
</span>
|
||||||
|
</QCardSection>
|
||||||
|
</QCard>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</QList>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</VnPaginate>
|
||||||
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
|
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
|
||||||
<QList dense>
|
<QList dense>
|
||||||
<QSeparator />
|
<QSeparator />
|
||||||
|
@ -675,17 +723,16 @@ onUnmounted(() => {
|
||||||
</QOptionGroup>
|
</QOptionGroup>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mt-sm">
|
<QItem class="q-mt-sm">
|
||||||
<QItemSection v-if="!workers">
|
<QItemSection v-if="userRadio !== null">
|
||||||
<QSkeleton type="QInput" class="full-width" />
|
|
||||||
</QItemSection>
|
|
||||||
<QItemSection v-if="workers && userRadio !== null">
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
class="full-width"
|
class="full-width"
|
||||||
:label="t('globals.user')"
|
:label="t('globals.user')"
|
||||||
v-model="userSelect"
|
v-model="userSelect"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
:options="workers"
|
:url="`${model}Logs/${$route.params.id}/editors`"
|
||||||
|
:fields="['id', 'nickname', 'name', 'image']"
|
||||||
|
sort-by="nickname"
|
||||||
@update:model-value="selectFilter('userSelect')"
|
@update:model-value="selectFilter('userSelect')"
|
||||||
hide-selected
|
hide-selected
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import LeftMenu from 'components/LeftMenu.vue';
|
import LeftMenu from 'components/LeftMenu.vue';
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
const $props = defineProps({
|
||||||
|
leftDrawer: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
onMounted(() => (stateStore.leftDrawer = $props.leftDrawer));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
|
@ -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,9 +25,13 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
optionFilterValue: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
url: {
|
url: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: null,
|
||||||
},
|
},
|
||||||
filterOptions: {
|
filterOptions: {
|
||||||
type: [Array],
|
type: [Array],
|
||||||
|
@ -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,
|
||||||
|
@ -65,37 +73,72 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
params: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
noOne: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
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();
|
||||||
const dataRef = ref();
|
const dataRef = ref();
|
||||||
|
const lastVal = ref();
|
||||||
|
const noOneText = t('globals.noOne');
|
||||||
|
const noOneOpt = ref({
|
||||||
|
[optionValue.value]: false,
|
||||||
|
[optionLabel.value]: noOneText,
|
||||||
|
});
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
return $props.modelValue;
|
return $props.modelValue;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
|
setOptions(myOptionsOriginal.value);
|
||||||
emit('update:modelValue', value);
|
emit('update:modelValue', value);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(options, (newValue) => {
|
||||||
|
setOptions(newValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(modelValue, async (newValue) => {
|
||||||
|
if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
|
||||||
|
await fetchFilter(newValue);
|
||||||
|
|
||||||
|
if ($props.noOne) myOptions.value.unshift(noOneOpt.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setOptions(options.value);
|
||||||
|
if ($props.url && $props.modelValue && !findKeyInOptions())
|
||||||
|
fetchFilter($props.modelValue);
|
||||||
|
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
||||||
|
});
|
||||||
|
|
||||||
|
function findKeyInOptions() {
|
||||||
|
if (!$props.options) return;
|
||||||
|
return filter($props.modelValue, $props.options)?.length;
|
||||||
|
}
|
||||||
|
|
||||||
function setOptions(data) {
|
function setOptions(data) {
|
||||||
myOptions.value = JSON.parse(JSON.stringify(data));
|
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||||
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
|
||||||
setOptions(options.value);
|
|
||||||
if ($props.url && $props.modelValue) fetchFilter($props.modelValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
function filter(val, options) {
|
function filter(val, options) {
|
||||||
const search = val.toString().toLowerCase();
|
const search = val?.toString()?.toLowerCase();
|
||||||
|
|
||||||
if (!search) return options;
|
if (!search) return options;
|
||||||
|
|
||||||
|
@ -107,7 +150,8 @@ function filter(val, options) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const id = row.id;
|
if (!row) return;
|
||||||
|
const id = row[$props.optionValue];
|
||||||
const optionLabel = String(row[$props.optionLabel]).toLowerCase();
|
const optionLabel = String(row[$props.optionLabel]).toLowerCase();
|
||||||
|
|
||||||
return id == search || optionLabel.includes(search);
|
return id == search || optionLabel.includes(search);
|
||||||
|
@ -117,28 +161,49 @@ 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 ??
|
||||||
|
(new RegExp(/\d/g).test(val)
|
||||||
|
? optionValue.value
|
||||||
|
: optionFilter.value ?? optionLabel.value);
|
||||||
|
|
||||||
if (new RegExp(/\d/g).test(val)) key = optionValue.value;
|
let defaultWhere = {};
|
||||||
|
if ($props.filterOptions.length) {
|
||||||
const defaultWhere = $props.useLike
|
defaultWhere = $props.filterOptions.reduce((obj, prop) => {
|
||||||
? { [key]: { like: `%${val}%` } }
|
if (!obj.or) obj.or = [];
|
||||||
: { [key]: val };
|
obj.or.push({ [prop]: getVal(val) });
|
||||||
const where = { ...defaultWhere, ...$props.where };
|
return obj;
|
||||||
const fetchOptions = { where, order: sortBy, limit };
|
}, {});
|
||||||
|
} else defaultWhere = { [key]: getVal(val) };
|
||||||
|
const where = { ...(val ? defaultWhere : {}), ...$props.where };
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function filterHandler(val, update) {
|
async function filterHandler(val, update) {
|
||||||
if (!$props.defaultFilter) return update();
|
if (!val && lastVal.value === val) {
|
||||||
|
lastVal.value = val;
|
||||||
|
return update();
|
||||||
|
}
|
||||||
|
lastVal.value = val;
|
||||||
let newOptions;
|
let newOptions;
|
||||||
if ($props.url) {
|
|
||||||
|
if (!$props.defaultFilter) return update();
|
||||||
|
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(
|
||||||
() => {
|
() => {
|
||||||
|
if ($props.noOne && noOneText.toLowerCase().includes(val.toLowerCase()))
|
||||||
|
newOptions.unshift(noOneOpt.value);
|
||||||
|
|
||||||
myOptions.value = newOptions;
|
myOptions.value = newOptions;
|
||||||
},
|
},
|
||||||
(ref) => {
|
(ref) => {
|
||||||
|
@ -150,18 +215,11 @@ async function filterHandler(val, update) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(options, (newValue) => {
|
function nullishToTrue(value) {
|
||||||
setOptions(newValue);
|
return value ?? true;
|
||||||
});
|
}
|
||||||
|
|
||||||
watch(modelValue, (newValue) => {
|
const getVal = (val) => ($props.useLike ? { like: `%${val}%` } : val);
|
||||||
if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
|
|
||||||
fetchFilter(newValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -173,6 +231,7 @@ onMounted(async () => {
|
||||||
:limit="limit"
|
:limit="limit"
|
||||||
:sort-by="sortBy"
|
:sort-by="sortBy"
|
||||||
:fields="fields"
|
:fields="fields"
|
||||||
|
:params="params"
|
||||||
/>
|
/>
|
||||||
<QSelect
|
<QSelect
|
||||||
v-model="value"
|
v-model="value"
|
||||||
|
@ -180,12 +239,12 @@ onMounted(async () => {
|
||||||
: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 }"
|
||||||
|
@ -196,7 +255,12 @@ onMounted(async () => {
|
||||||
<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"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref, onBeforeMount, useAttrs } from 'vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
row: {
|
||||||
|
type: [Object],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
find: {
|
||||||
|
type: [String, Object],
|
||||||
|
default: null,
|
||||||
|
description: 'search in row to add default options',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const options = ref([]);
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
const { url, optionValue, optionLabel } = useAttrs();
|
||||||
|
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
||||||
|
if (!findBy || !$props.row) return;
|
||||||
|
// is object
|
||||||
|
if (typeof findBy == 'object') {
|
||||||
|
const { value, label } = findBy;
|
||||||
|
if (!$props.row[value] || !$props.row[label]) return;
|
||||||
|
return (options.value = [
|
||||||
|
{
|
||||||
|
[optionValue ?? 'id']: $props.row[value],
|
||||||
|
[optionLabel ?? 'name']: $props.row[label],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// is string
|
||||||
|
if ($props.row[findBy]) options.value = [$props.row[findBy]];
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" />
|
||||||
|
</template>
|
|
@ -1,25 +1,21 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
import { useAcl } from 'src/composables/useAcl';
|
||||||
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
|
||||||
import { useRole } from 'src/composables/useRole';
|
|
||||||
|
|
||||||
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'],
|
||||||
},
|
},
|
||||||
|
acls: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
actionIcon: {
|
actionIcon: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'add',
|
default: 'add',
|
||||||
|
@ -31,31 +27,23 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const role = useRole();
|
const role = useRole();
|
||||||
const showForm = ref(false);
|
const acl = useAcl();
|
||||||
|
|
||||||
const value = computed({
|
|
||||||
get() {
|
|
||||||
return $props.modelValue;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
emit('update:modelValue', value);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const isAllowedToCreate = computed(() => {
|
const isAllowedToCreate = computed(() => {
|
||||||
|
if ($props.acls.length) return acl.hasAny($props.acls);
|
||||||
return role.hasAny($props.rolesAllowedToCreate);
|
return role.hasAny($props.rolesAllowedToCreate);
|
||||||
});
|
});
|
||||||
|
|
||||||
const toggleForm = () => {
|
|
||||||
showForm.value = !showForm.value;
|
|
||||||
};
|
|
||||||
</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="$refs.dialog.show()"
|
||||||
:name="actionIcon"
|
:name="actionIcon"
|
||||||
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
||||||
:class="['default-icon', { '--add-icon': actionIcon === 'add' }]"
|
:class="['default-icon', { '--add-icon': actionIcon === 'add' }]"
|
||||||
|
@ -65,7 +53,7 @@ const toggleForm = () => {
|
||||||
>
|
>
|
||||||
<QTooltip v-if="tooltip">{{ tooltip }}</QTooltip>
|
<QTooltip v-if="tooltip">{{ tooltip }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
<QDialog ref="dialog" transition-show="scale" transition-hide="scale">
|
||||||
<slot name="form" />
|
<slot name="form" />
|
||||||
</QDialog>
|
</QDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -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" />
|
||||||
|
|
|
@ -120,7 +120,7 @@ const toModule = computed(() =>
|
||||||
:icon="iconModule"
|
:icon="iconModule"
|
||||||
color="white"
|
color="white"
|
||||||
class="link"
|
class="link"
|
||||||
:to="toModule"
|
:to="$attrs['to-module'] ?? toModule"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('globals.goToModuleIndex') }}
|
{{ t('globals.goToModuleIndex') }}
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -52,6 +52,10 @@ const dialog = ref(null);
|
||||||
:value="item?.[`value${index + 4}`]"
|
:value="item?.[`value${index + 4}`]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<div v-if="item.minQuantity" class="min-quantity">
|
||||||
|
<QIcon name="production_quantity_limits" size="xs" />
|
||||||
|
{{ item.minQuantity }}
|
||||||
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="price">
|
<div class="price">
|
||||||
<p v-if="isCatalog">
|
<p v-if="isCatalog">
|
||||||
|
@ -123,16 +127,16 @@ const dialog = ref(null);
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
|
||||||
.subName {
|
|
||||||
color: var(--vn-label-color);
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.min-quantity {
|
||||||
|
text-align: right;
|
||||||
|
color: $negative !important;
|
||||||
|
}
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
.price {
|
.price {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
maxLength: {
|
|
||||||
type: Number,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
item: {
|
item: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
|
|
|
@ -52,8 +52,8 @@ const containerClasses = computed(() => {
|
||||||
--calendar-border-current: #84d0e2 2px solid;
|
--calendar-border-current: #84d0e2 2px solid;
|
||||||
--calendar-current-color-dark: #84d0e2;
|
--calendar-current-color-dark: #84d0e2;
|
||||||
// Colores de fondo del calendario en dark mode
|
// Colores de fondo del calendario en dark mode
|
||||||
--calendar-outside-background-dark: #222;
|
--calendar-outside-background-dark: var(--vn-section-color);
|
||||||
--calendar-background-dark: #222;
|
--calendar-background-dark: var(--vn-section-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
|
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
|
||||||
|
@ -70,8 +70,26 @@ const containerClasses = computed(() => {
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-calendar-month__head--workweek,
|
||||||
|
.q-calendar-month__head--weekday,
|
||||||
|
// .q-calendar-month__workweek.q-past-day,
|
||||||
|
.q-calendar-month__week :nth-child(n+6):nth-child(-n+7) {
|
||||||
|
color: var(--vn-label-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-calendar-month__head--weekdays > div[aria-label='miércoles'] > span {
|
||||||
|
/* color: transparent; */
|
||||||
|
visibility: hidden;
|
||||||
|
// position: absolute;
|
||||||
|
}
|
||||||
|
.q-calendar-month__head--weekdays > div[aria-label='miércoles'] > span:after {
|
||||||
|
content: 'X';
|
||||||
|
visibility: visible;
|
||||||
|
left: 33%;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
.transparent-background {
|
.transparent-background {
|
||||||
--calendar-background-dark: transparent;
|
// --calendar-background-dark: transparent;
|
||||||
--calendar-background: transparent;
|
--calendar-background: transparent;
|
||||||
--calendar-outside-background-dark: transparent;
|
--calendar-outside-background-dark: transparent;
|
||||||
}
|
}
|
||||||
|
@ -110,11 +128,6 @@ const containerClasses = computed(() => {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.q-calendar-month__week--days > div:nth-child(6),
|
|
||||||
.q-calendar-month__week--days > div:nth-child(7) {
|
|
||||||
// Cambia el color de los días sábado y domingo
|
|
||||||
color: #777777;
|
|
||||||
}
|
|
||||||
|
|
||||||
.q-calendar-month__week--wrapper {
|
.q-calendar-month__week--wrapper {
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
|
@ -124,6 +137,7 @@ const containerClasses = computed(() => {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
color: var(--vn-label-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.q-calendar__button--bordered {
|
.q-calendar__button--bordered {
|
||||||
|
@ -147,7 +161,7 @@ const containerClasses = computed(() => {
|
||||||
.q-calendar-month__head--workweek,
|
.q-calendar-month__head--workweek,
|
||||||
.q-calendar-month__head--weekday.q-calendar__center.q-calendar__ellipsis {
|
.q-calendar-month__head--weekday.q-calendar__center.q-calendar__ellipsis {
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
color: $color-font-secondary;
|
color: var(--vn-label-color);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -15,7 +15,7 @@ const props = defineProps({
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
type: String,
|
type: [String, Boolean],
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
|
@ -31,11 +31,15 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
|
||||||
|
|
||||||
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
||||||
|
|
||||||
const title = props.title || t('Confirm');
|
const title = props.title || t('Confirm');
|
||||||
const message = props.message || t('Are you sure you want to continue?');
|
const message =
|
||||||
|
props.message ||
|
||||||
|
(props.message !== false ? t('Are you sure you want to continue?') : false);
|
||||||
|
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
async function confirm() {
|
async function confirm() {
|
||||||
|
@ -61,12 +65,14 @@ async function confirm() {
|
||||||
size="xl"
|
size="xl"
|
||||||
v-if="icon"
|
v-if="icon"
|
||||||
/>
|
/>
|
||||||
<span class="text-h6 text-grey">{{ title }}</span>
|
<span class="text-h6">{{ title }}</span>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
|
<QBtn icon="close" :disable="isLoading" flat round dense v-close-popup />
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="row items-center">
|
<QCardSection class="q-pb-none">
|
||||||
<span v-html="message"></span>
|
<span v-if="message !== false" v-html="message" />
|
||||||
|
</QCardSection>
|
||||||
|
<QCardSection class="row items-center q-pt-none">
|
||||||
<slot name="customHTML"></slot>
|
<slot name="customHTML"></slot>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardActions align="right">
|
<QCardActions align="right">
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { onMounted, ref, computed, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { date } from 'quasar';
|
||||||
import toDate from 'filters/toDate';
|
import toDate from 'filters/toDate';
|
||||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||||
|
|
||||||
|
@ -18,7 +19,6 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
searchButton: {
|
searchButton: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
showAll: {
|
showAll: {
|
||||||
|
@ -29,8 +29,8 @@ const $props = defineProps({
|
||||||
type: Array,
|
type: Array,
|
||||||
required: false,
|
required: false,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
description:
|
description: `Some filters come with default search parameters and require a value.
|
||||||
'Algunos filtros vienen con parametros de búsqueda por default y necesitan tener si o si un valor, por eso de ser necesario, esta prop nos sirve para saber que filtros podemos remover y cuales no',
|
This prop helps us determine which filters can be removed and which cannot.`,
|
||||||
},
|
},
|
||||||
exprBuilder: {
|
exprBuilder: {
|
||||||
type: Function,
|
type: Function,
|
||||||
|
@ -38,7 +38,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
hiddenTags: {
|
hiddenTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => ['filter'],
|
default: () => ['filter', 'search', 'or', 'and'],
|
||||||
},
|
},
|
||||||
customTags: {
|
customTags: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -58,7 +58,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ search });
|
defineExpose({ search, sanitizer });
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
'update:modelValue',
|
'update:modelValue',
|
||||||
'refresh',
|
'refresh',
|
||||||
|
@ -66,6 +66,7 @@ const emit = defineEmits([
|
||||||
'search',
|
'search',
|
||||||
'init',
|
'init',
|
||||||
'remove',
|
'remove',
|
||||||
|
'setUserParams',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const arrayData = useArrayData($props.dataKey, {
|
const arrayData = useArrayData($props.dataKey, {
|
||||||
|
@ -82,22 +83,28 @@ 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 = sanitizer(watchedParams);
|
||||||
|
emit('setUserParams', userParams.value, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.query[$props.searchUrl],
|
() => route.query[$props.searchUrl],
|
||||||
(val) => setUserParams(val)
|
(val, oldValue) => (val || oldValue) && setUserParams(val)
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => arrayData.store.userParams,
|
() => arrayData.store.userParams,
|
||||||
(val) => setUserParams(val)
|
(val, oldValue) => (val || oldValue) && setUserParams(val)
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -107,57 +114,51 @@ watch(
|
||||||
|
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
async function search(evt) {
|
async function search(evt) {
|
||||||
if (evt && $props.disableSubmitEvent) return;
|
try {
|
||||||
|
if (evt && $props.disableSubmitEvent) return;
|
||||||
|
|
||||||
store.filter.where = {};
|
store.filter.where = {};
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const filter = { ...userParams.value };
|
const filter = { ...userParams.value, ...$props.modelValue };
|
||||||
store.userParamsChanged = true;
|
store.userParamsChanged = true;
|
||||||
arrayData.reset(['skip', 'filter.skip', 'page']);
|
const { params: newParams } = await arrayData.addFilter({
|
||||||
const { params: newParams } = await arrayData.addFilter({ params: userParams.value });
|
params: filter,
|
||||||
userParams.value = newParams;
|
});
|
||||||
|
userParams.value = newParams;
|
||||||
|
|
||||||
if (!$props.showAll && !Object.values(filter).length) store.data = [];
|
if (!$props.showAll && !Object.values(filter).length) store.data = [];
|
||||||
|
emit('search');
|
||||||
isLoading.value = false;
|
} finally {
|
||||||
emit('search');
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reload() {
|
|
||||||
isLoading.value = true;
|
|
||||||
const params = Object.values(userParams.value).filter((param) => param);
|
|
||||||
store.skip = 0;
|
|
||||||
store.page = 1;
|
|
||||||
await arrayData.fetch({ append: false });
|
|
||||||
if (!$props.showAll && !params.length) store.data = [];
|
|
||||||
isLoading.value = false;
|
|
||||||
emit('refresh');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clearFilters() {
|
async function clearFilters() {
|
||||||
isLoading.value = true;
|
try {
|
||||||
store.userParamsChanged = true;
|
isLoading.value = true;
|
||||||
arrayData.reset(['skip', 'filter.skip', 'page']);
|
store.userParamsChanged = true;
|
||||||
// Filtrar los params no removibles
|
arrayData.reset(['skip', 'filter.skip', 'page']);
|
||||||
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
// Filtrar los params no removibles
|
||||||
$props.unremovableParams.includes(param)
|
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
||||||
);
|
$props.unremovableParams.includes(param)
|
||||||
const newParams = {};
|
);
|
||||||
// Conservar solo los params que no son removibles
|
const newParams = {};
|
||||||
for (const key of removableFilters) {
|
// Conservar solo los params que no son removibles
|
||||||
newParams[key] = userParams.value[key];
|
for (const key of removableFilters) {
|
||||||
}
|
newParams[key] = userParams.value[key];
|
||||||
userParams.value = {};
|
}
|
||||||
userParams.value = { ...newParams }; // Actualizar los params con los removibles
|
userParams.value = {};
|
||||||
await arrayData.applyFilter({ params: userParams.value });
|
userParams.value = { ...newParams }; // Actualizar los params con los removibles
|
||||||
|
await arrayData.applyFilter({ params: userParams.value });
|
||||||
|
|
||||||
if (!$props.showAll) {
|
if (!$props.showAll) {
|
||||||
store.data = [];
|
store.data = [];
|
||||||
|
}
|
||||||
|
emit('clear');
|
||||||
|
emit('update:modelValue', userParams.value);
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoading.value = false;
|
|
||||||
emit('clear');
|
|
||||||
emit('update:modelValue', userParams.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const tagsList = computed(() => {
|
const tagsList = computed(() => {
|
||||||
|
@ -171,10 +172,10 @@ const tagsList = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const tags = computed(() => {
|
const tags = computed(() => {
|
||||||
return tagsList.value.filter((tag) => !($props.customTags || []).includes(tag.key));
|
return tagsList.value.filter((tag) => !($props.customTags || []).includes(tag.label));
|
||||||
});
|
});
|
||||||
const customTags = computed(() =>
|
const customTags = computed(() =>
|
||||||
tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.key))
|
tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.label))
|
||||||
);
|
);
|
||||||
|
|
||||||
async function remove(key) {
|
async function remove(key) {
|
||||||
|
@ -185,11 +186,22 @@ async function remove(key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(value) {
|
function formatValue(value) {
|
||||||
|
if (value instanceof Date) return date.formatDate(value, 'DD/MM/YYYY');
|
||||||
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
||||||
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
||||||
|
|
||||||
return `"${value}"`;
|
return `"${value}"`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sanitizer(params) {
|
||||||
|
for (const [key, value] of Object.entries(params)) {
|
||||||
|
if (value && typeof value === 'object') {
|
||||||
|
const param = Object.values(value)[0];
|
||||||
|
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -210,32 +222,18 @@ function formatValue(value) {
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection top side>
|
<QItemSection top side>
|
||||||
<div class="q-gutter-xs">
|
<QBtn
|
||||||
<QBtn
|
@click="clearFilters"
|
||||||
@click="clearFilters"
|
color="primary"
|
||||||
color="primary"
|
dense
|
||||||
dense
|
flat
|
||||||
flat
|
icon="filter_list_off"
|
||||||
icon="filter_list_off"
|
padding="none"
|
||||||
padding="none"
|
round
|
||||||
round
|
size="sm"
|
||||||
size="sm"
|
>
|
||||||
>
|
<QTooltip>{{ t('Remove filters') }}</QTooltip>
|
||||||
<QTooltip>{{ t('Remove filters') }}</QTooltip>
|
</QBtn>
|
||||||
</QBtn>
|
|
||||||
<QBtn
|
|
||||||
@click="reload"
|
|
||||||
color="primary"
|
|
||||||
dense
|
|
||||||
flat
|
|
||||||
icon="refresh"
|
|
||||||
padding="none"
|
|
||||||
round
|
|
||||||
size="sm"
|
|
||||||
>
|
|
||||||
<QTooltip>{{ t('Refresh') }}</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
</div>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-mb-sm">
|
<QItem class="q-mb-sm">
|
||||||
|
@ -249,7 +247,7 @@ function formatValue(value) {
|
||||||
<VnFilterPanelChip
|
<VnFilterPanelChip
|
||||||
v-for="chip of tags"
|
v-for="chip of tags"
|
||||||
:key="chip.label"
|
:key="chip.label"
|
||||||
:removable="!unremovableParams.includes(chip.label)"
|
:removable="!unremovableParams?.includes(chip.label)"
|
||||||
@remove="remove(chip.label)"
|
@remove="remove(chip.label)"
|
||||||
>
|
>
|
||||||
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
||||||
|
@ -272,7 +270,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,18 @@ 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';
|
const isEmployee = useRole().isEmployee();
|
||||||
import { useRole } from 'src/composables/useRole';
|
|
||||||
const url = computed(() => {
|
const getUrl = (zoom = false) => {
|
||||||
const isEmployee = useRole().isEmployee();
|
const curResolution = zoom
|
||||||
|
? $props.zoomResolution || $props.resolution
|
||||||
|
: $props.resolution;
|
||||||
|
if ($props.storage === 'dms')
|
||||||
|
return `/api/${$props.storage}/${$props.id}/downloadFile?access_token=${token}`;
|
||||||
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 +54,24 @@ defineExpose({
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QImg
|
<QImg
|
||||||
:class="{ zoomIn: $props.zoomSize }"
|
:draggable="true"
|
||||||
:src="url"
|
:class="{ zoomIn: zoom }"
|
||||||
|
: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"
|
:draggable="true"
|
||||||
size="full"
|
:src="getUrl(true)"
|
||||||
class="img_zoom"
|
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
spinner-color="primary"
|
spinner-color="primary"
|
||||||
|
class="img_zoom"
|
||||||
|
:ratio="0"
|
||||||
/>
|
/>
|
||||||
</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>
|
|
@ -10,6 +10,10 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
class: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
autoLoad: {
|
autoLoad: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
@ -115,8 +119,8 @@ watch(
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.url,
|
() => [props.url, props.filter, props.userParams],
|
||||||
(url) => fetch({ url })
|
([url, filter, userParams]) => mounted.value && fetch({ url, filter, userParams })
|
||||||
);
|
);
|
||||||
|
|
||||||
const addFilter = async (filter, params) => {
|
const addFilter = async (filter, params) => {
|
||||||
|
@ -215,18 +219,25 @@ defineExpose({ fetch, addFilter, paginate });
|
||||||
v-if="store.data"
|
v-if="store.data"
|
||||||
@load="onLoad"
|
@load="onLoad"
|
||||||
:offset="offset"
|
:offset="offset"
|
||||||
class="full-width"
|
:class="['full-width', props.class]"
|
||||||
:disable="disableInfiniteScroll || !store.hasMoreData"
|
:disable="disableInfiniteScroll || !store.hasMoreData"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
>
|
>
|
||||||
<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="spinner info-row q-pa-md text-center">
|
||||||
<QSpinner color="orange" size="md" />
|
<QSpinner color="primary" size="md" />
|
||||||
</div>
|
</div>
|
||||||
</QInfiniteScroll>
|
</QInfiniteScroll>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.spinner {
|
||||||
|
z-index: 1;
|
||||||
|
align-content: end;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
.info-row {
|
.info-row {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
|
<script setup>
|
||||||
|
defineProps({ wrap: { type: Boolean, default: false } });
|
||||||
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="vn-row q-gutter-md q-mb-md">
|
<div class="vn-row q-gutter-md q-mb-md">
|
||||||
<slot></slot>
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scopped>
|
<style lang="scss" scoped>
|
||||||
.vn-row {
|
.vn-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
> * {
|
> :deep(*) {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
&[wrap] {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
.vn-row {
|
.vn-row {
|
||||||
flex-direction: column;
|
&:not(.wrap) {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -63,13 +63,13 @@ const props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
makeFetch: {
|
whereFilter: {
|
||||||
type: Boolean,
|
type: Function,
|
||||||
default: true,
|
default: undefined,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const searchText = ref('');
|
const searchText = ref();
|
||||||
let arrayDataProps = { ...props };
|
let arrayDataProps = { ...props };
|
||||||
if (props.redirect)
|
if (props.redirect)
|
||||||
arrayDataProps = {
|
arrayDataProps = {
|
||||||
|
@ -100,18 +100,23 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
async function search() {
|
async function search() {
|
||||||
const staticParams = Object.entries(store.userParams).filter(
|
const staticParams = Object.entries(store.userParams);
|
||||||
([key, value]) => value && (props.staticParams || []).includes(key)
|
|
||||||
);
|
|
||||||
arrayData.reset(['skip', 'page']);
|
arrayData.reset(['skip', 'page']);
|
||||||
|
|
||||||
if (props.makeFetch)
|
const filter = {
|
||||||
await arrayData.applyFilter({
|
params: {
|
||||||
params: {
|
...Object.fromEntries(staticParams),
|
||||||
...Object.fromEntries(staticParams),
|
search: searchText.value,
|
||||||
search: searchText.value,
|
},
|
||||||
},
|
};
|
||||||
});
|
|
||||||
|
if (props.whereFilter) {
|
||||||
|
filter.filter = {
|
||||||
|
where: props.whereFilter(searchText.value),
|
||||||
|
};
|
||||||
|
delete filter.params.search;
|
||||||
|
}
|
||||||
|
await arrayData.applyFilter(filter);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
@ -119,7 +124,7 @@ async function search() {
|
||||||
<QForm @submit="search" id="searchbarForm">
|
<QForm @submit="search" id="searchbarForm">
|
||||||
<VnInput
|
<VnInput
|
||||||
id="searchbar"
|
id="searchbar"
|
||||||
v-model="searchText"
|
v-model.trim="searchText"
|
||||||
:placeholder="t(props.label)"
|
:placeholder="t(props.label)"
|
||||||
dense
|
dense
|
||||||
standout
|
standout
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount } from 'vue';
|
import { 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,31 +10,32 @@ const $props = defineProps({
|
||||||
where: { type: Object, default: () => {} },
|
where: { type: Object, default: () => {} },
|
||||||
});
|
});
|
||||||
|
|
||||||
const filter = {
|
const filter = computed(() => {
|
||||||
fields: ['smsFk'],
|
return {
|
||||||
include: {
|
fields: ['smsFk'],
|
||||||
relation: 'sms',
|
include: {
|
||||||
scope: {
|
relation: 'sms',
|
||||||
fields: [
|
scope: {
|
||||||
'senderFk',
|
fields: [
|
||||||
'sender',
|
'senderFk',
|
||||||
'destination',
|
'sender',
|
||||||
'message',
|
'destination',
|
||||||
'statusCode',
|
'message',
|
||||||
'status',
|
'statusCode',
|
||||||
'created',
|
'status',
|
||||||
],
|
'created',
|
||||||
include: {
|
],
|
||||||
relation: 'sender',
|
include: {
|
||||||
scope: {
|
relation: 'sender',
|
||||||
fields: ['name'],
|
scope: {
|
||||||
|
fields: ['name'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
...{ 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;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, onBeforeUnmount, ref, nextTick } from 'vue';
|
import { onMounted, onBeforeUnmount, ref } from 'vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -30,6 +30,7 @@ onBeforeUnmount(() => stateStore.toggleSubToolbar());
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QToolbar
|
<QToolbar
|
||||||
|
id="subToolbar"
|
||||||
class="justify-end sticky"
|
class="justify-end sticky"
|
||||||
v-show="hasContent || $slots['st-actions'] || $slots['st-data']"
|
v-show="hasContent || $slots['st-actions'] || $slots['st-data']"
|
||||||
>
|
>
|
||||||
|
@ -42,20 +43,9 @@ onBeforeUnmount(() => stateStore.toggleSubToolbar());
|
||||||
</slot>
|
</slot>
|
||||||
</QToolbar>
|
</QToolbar>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss">
|
|
||||||
.q-toolbar {
|
|
||||||
background: var(--vn-section-color);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.sticky {
|
.sticky {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 61px;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
@media (max-width: $breakpoint-sm) {
|
|
||||||
.sticky {
|
|
||||||
top: 90px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
const $props = defineProps({
|
defineProps({
|
||||||
name: { type: String, default: null },
|
name: { type: String, default: null },
|
||||||
|
tag: { type: String, default: null },
|
||||||
workerId: { type: Number, default: null },
|
workerId: { type: Number, default: null },
|
||||||
defaultName: { type: Boolean, default: false },
|
defaultName: { type: Boolean, default: false },
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<slot name="link">
|
<slot name="link">
|
||||||
<span :class="{ link: $props.workerId }">
|
<span :class="{ link: workerId }">
|
||||||
{{ $props.defaultName ? $props.name ?? t('globals.system') : $props.name }}
|
{{ defaultName ? name ?? $t('globals.system') : name }}
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
<WorkerDescriptorProxy v-if="$props.workerId" :id="$props.workerId" />
|
<WorkerDescriptorProxy v-if="workerId" :id="workerId" />
|
||||||
</template>
|
</template>
|
||||||
<style scoped></style>
|
|
||||||
|
|
|
@ -7,5 +7,5 @@ export function getDateQBadgeColor(date) {
|
||||||
let comparation = today - timeTicket;
|
let comparation = today - timeTicket;
|
||||||
|
|
||||||
if (comparation == 0) return 'warning';
|
if (comparation == 0) return 'warning';
|
||||||
if (comparation < 0) return 'negative';
|
if (comparation < 0) return 'success';
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { toCurrency } from 'src/filters';
|
||||||
|
|
||||||
|
export function getTotal(rows, key, opts = {}) {
|
||||||
|
const { currency, cb } = opts;
|
||||||
|
const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
|
||||||
|
|
||||||
|
return currency
|
||||||
|
? toCurrency(total, currency == 'default' ? undefined : currency)
|
||||||
|
: total;
|
||||||
|
}
|
|
@ -16,13 +16,18 @@ export function useAcl() {
|
||||||
state.setAcls(acls);
|
state.setAcls(acls);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasAny(model, prop, accessType) {
|
function hasAny(acls) {
|
||||||
const acls = state.getAcls().value[model];
|
for (const acl of acls) {
|
||||||
if (acls)
|
let { model, props, accessType } = acl;
|
||||||
return ['*', prop].some((key) => {
|
const modelAcls = state.getAcls().value[model];
|
||||||
const acl = acls[key];
|
Array.isArray(props) || (props = [props]);
|
||||||
return acl && (acl['*'] || acl[accessType]);
|
if (modelAcls)
|
||||||
});
|
return ['*', ...props].some((key) => {
|
||||||
|
const acl = modelAcls[key];
|
||||||
|
return acl && (acl['*'] || acl[accessType]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -18,16 +18,17 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setOptions();
|
setOptions();
|
||||||
arrayDataStore.reset(['skip']);
|
reset(['skip']);
|
||||||
|
|
||||||
const query = route.query;
|
const query = route.query;
|
||||||
const searchUrl = store.searchUrl;
|
const searchUrl = store.searchUrl;
|
||||||
if (query[searchUrl]) {
|
if (query[searchUrl]) {
|
||||||
const params = JSON.parse(query[searchUrl]);
|
const params = JSON.parse(query[searchUrl]);
|
||||||
const filter = params?.filter;
|
const filter = params?.filter && JSON.parse(params?.filter ?? '{}');
|
||||||
delete params.filter;
|
delete params.filter;
|
||||||
store.userParams = { ...params, ...store.userParams };
|
store.userParams = { ...params, ...store.userParams };
|
||||||
store.userFilter = { ...JSON.parse(filter ?? '{}'), ...store.userFilter };
|
store.userFilter = { ...filter, ...store.userFilter };
|
||||||
|
if (filter?.order) store.order = filter.order;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -69,7 +70,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
canceller = new AbortController();
|
canceller = new AbortController();
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
order: store.order,
|
|
||||||
limit: store.limit,
|
limit: store.limit,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -94,6 +94,8 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
|
|
||||||
Object.assign(params, userParams);
|
Object.assign(params, userParams);
|
||||||
params.filter.skip = store.skip;
|
params.filter.skip = store.skip;
|
||||||
|
if (store.order && store.order.length) params.filter.order = store.order;
|
||||||
|
else delete params.filter.order;
|
||||||
|
|
||||||
params.filter = JSON.stringify(params.filter);
|
params.filter = JSON.stringify(params.filter);
|
||||||
store.currentFilter = params;
|
store.currentFilter = params;
|
||||||
|
@ -147,7 +149,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
store.filter = {};
|
store.filter = {};
|
||||||
if (params) store.userParams = { ...params };
|
if (params) store.userParams = { ...params };
|
||||||
|
|
||||||
const response = await fetch({ append: false });
|
const response = await fetch({});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,9 +160,9 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
userParams = sanitizerParams(userParams, store?.exprBuilder);
|
userParams = sanitizerParams(userParams, store?.exprBuilder);
|
||||||
|
|
||||||
store.userParams = userParams;
|
store.userParams = userParams;
|
||||||
arrayDataStore.reset(['skip', 'filter.skip', 'page']);
|
reset(['skip', 'filter.skip', 'page']);
|
||||||
|
|
||||||
await fetch({ append: false });
|
await fetch({});
|
||||||
return { filter, params };
|
return { filter, params };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,16 +173,58 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
await addFilter({ filter: { where } });
|
await addFilter({ filter: { where } });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function addOrder(field, direction = 'ASC') {
|
||||||
|
const newOrder = field + ' ' + direction;
|
||||||
|
let order = store.order || [];
|
||||||
|
if (typeof order == 'string') order = [order];
|
||||||
|
|
||||||
|
let index = order.findIndex((o) => o.split(' ')[0] === field);
|
||||||
|
if (index > -1) {
|
||||||
|
order[index] = newOrder;
|
||||||
|
} else {
|
||||||
|
index = order.length;
|
||||||
|
order.push(newOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
store.order = order;
|
||||||
|
reset(['skip', 'filter.skip', 'page']);
|
||||||
|
fetch({});
|
||||||
|
index++;
|
||||||
|
|
||||||
|
return { index, order };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteOrder(field) {
|
||||||
|
let order = store.order ?? [];
|
||||||
|
if (typeof order == 'string') order = [order];
|
||||||
|
|
||||||
|
const index = order.findIndex((o) => o.split(' ')[0] === field);
|
||||||
|
if (index > -1) order.splice(index, 1);
|
||||||
|
|
||||||
|
store.order = order;
|
||||||
|
fetch({});
|
||||||
|
}
|
||||||
|
|
||||||
function sanitizerParams(params, exprBuilder) {
|
function sanitizerParams(params, exprBuilder) {
|
||||||
for (const param in params) {
|
for (const param in params) {
|
||||||
if (params[param] === '' || params[param] === null) {
|
if (params[param] === '' || params[param] === null) {
|
||||||
delete store.userParams[param];
|
delete store.userParams[param];
|
||||||
delete params[param];
|
delete params[param];
|
||||||
if (store.filter?.where) {
|
if (store.filter?.where) {
|
||||||
const key = Object.keys(exprBuilder ? exprBuilder(param) : param);
|
let key;
|
||||||
if (key[0]) delete store.filter.where[key[0]];
|
if (exprBuilder) {
|
||||||
if (Object.keys(store.filter.where).length === 0) {
|
const result = exprBuilder(param);
|
||||||
delete store.filter.where;
|
if (result !== undefined && result !== null)
|
||||||
|
key = Object.keys(result);
|
||||||
|
} else {
|
||||||
|
if (typeof param === 'object' && param !== null)
|
||||||
|
key = Object.keys(param);
|
||||||
|
}
|
||||||
|
if (key && key[0]) {
|
||||||
|
delete store.filter.where[key[0]];
|
||||||
|
if (Object.keys(store.filter.where).length === 0) {
|
||||||
|
delete store.filter.where;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +242,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refresh() {
|
async function refresh() {
|
||||||
if (Object.values(store.userParams).length) await fetch({ append: false });
|
if (Object.values(store.userParams).length) await fetch({});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateStateParams() {
|
function updateStateParams() {
|
||||||
|
@ -240,6 +284,8 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
||||||
applyFilter,
|
applyFilter,
|
||||||
addFilter,
|
addFilter,
|
||||||
addFilterWhere,
|
addFilterWhere,
|
||||||
|
addOrder,
|
||||||
|
deleteOrder,
|
||||||
refresh,
|
refresh,
|
||||||
destroy,
|
destroy,
|
||||||
loadMore,
|
loadMore,
|
||||||
|
|
|
@ -16,7 +16,8 @@ export function usePrintService() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openReport(path, params) {
|
function openReport(path, params, isNewTab = '_self') {
|
||||||
|
if (typeof params === 'string') params = JSON.parse(params);
|
||||||
params = Object.assign(
|
params = Object.assign(
|
||||||
{
|
{
|
||||||
access_token: getTokenMultimedia(),
|
access_token: getTokenMultimedia(),
|
||||||
|
@ -25,8 +26,7 @@ export function usePrintService() {
|
||||||
);
|
);
|
||||||
|
|
||||||
const query = new URLSearchParams(params).toString();
|
const query = new URLSearchParams(params).toString();
|
||||||
|
window.open(`api/${path}?${query}`, isNewTab);
|
||||||
window.open(`api/${path}?${query}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -28,7 +28,7 @@ export function useValidator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const validations = function (validation) {
|
const validations = function (validation = {}) {
|
||||||
return {
|
return {
|
||||||
format: (value) => {
|
format: (value) => {
|
||||||
const { allowNull, with: format, allowBlank } = validation;
|
const { allowNull, with: format, allowBlank } = validation;
|
||||||
|
@ -40,12 +40,15 @@ export function useValidator() {
|
||||||
if (!isValid) return message;
|
if (!isValid) return message;
|
||||||
},
|
},
|
||||||
presence: (value) => {
|
presence: (value) => {
|
||||||
let message = `Value can't be empty`;
|
let message = t(`globals.valueCantBeEmpty`);
|
||||||
if (validation.message)
|
if (validation.message)
|
||||||
message = t(validation.message) || validation.message;
|
message = t(validation.message) || validation.message;
|
||||||
|
|
||||||
return !validator.isEmpty(value ? String(value) : '') || message;
|
return !validator.isEmpty(value ? String(value) : '') || message;
|
||||||
},
|
},
|
||||||
|
required: (required, value) => {
|
||||||
|
return required ? !!value || t('globals.fieldRequired') : null;
|
||||||
|
},
|
||||||
length: (value) => {
|
length: (value) => {
|
||||||
const options = {
|
const options = {
|
||||||
min: validation.min || validation.is,
|
min: validation.min || validation.is,
|
||||||
|
@ -71,12 +74,17 @@ export function useValidator() {
|
||||||
return validator.isInt(value) || 'Value should be integer';
|
return validator.isInt(value) || 'Value should be integer';
|
||||||
return validator.isNumeric(value) || 'Value should be a number';
|
return validator.isNumeric(value) || 'Value should be a number';
|
||||||
},
|
},
|
||||||
|
min: (value, min) => {
|
||||||
|
if (min >= 0)
|
||||||
|
if (Math.floor(value) < min) return t('inputMin', { value: min });
|
||||||
|
},
|
||||||
custom: (value) => validation.bindedFunction(value) || 'Invalid value',
|
custom: (value) => validation.bindedFunction(value) || 'Invalid value',
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
validate,
|
validate,
|
||||||
|
validations,
|
||||||
models,
|
models,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
107
src/css/app.scss
107
src/css/app.scss
|
@ -4,9 +4,10 @@
|
||||||
|
|
||||||
body.body--light {
|
body.body--light {
|
||||||
--font-color: black;
|
--font-color: black;
|
||||||
|
--vn-header-color: #cecece;
|
||||||
|
--vn-page-color: #ffffff;
|
||||||
--vn-section-color: #e0e0e0;
|
--vn-section-color: #e0e0e0;
|
||||||
--vn-section-hover-color: #b9b9b9;
|
--vn-section-hover-color: #b9b9b9;
|
||||||
--vn-page-color: #ffffff;
|
|
||||||
--vn-text-color: var(--font-color);
|
--vn-text-color: var(--font-color);
|
||||||
--vn-label-color: #5f5f5f;
|
--vn-label-color: #5f5f5f;
|
||||||
--vn-accent-color: #e7e3e3;
|
--vn-accent-color: #e7e3e3;
|
||||||
|
@ -18,6 +19,7 @@ body.body--light {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body.body--dark {
|
body.body--dark {
|
||||||
|
--vn-header-color: #5d5d5d;
|
||||||
--vn-page-color: #222;
|
--vn-page-color: #222;
|
||||||
--vn-section-color: #3d3d3d;
|
--vn-section-color: #3d3d3d;
|
||||||
--vn-section-hover-color: #747474;
|
--vn-section-hover-color: #747474;
|
||||||
|
@ -35,6 +37,10 @@ a {
|
||||||
.link {
|
.link {
|
||||||
color: $color-link;
|
color: $color-link;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&--white {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tx-color-link {
|
.tx-color-link {
|
||||||
|
@ -101,10 +107,6 @@ select:-webkit-autofill {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-width {
|
|
||||||
width: 770px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vn-card-list {
|
.vn-card-list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 60em;
|
max-width: 60em;
|
||||||
|
@ -151,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);
|
||||||
}
|
}
|
||||||
|
@ -182,15 +190,12 @@ select:-webkit-autofill {
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
}
|
}
|
||||||
|
|
||||||
.q-card__actions {
|
.q-toolbar {
|
||||||
justify-content: center;
|
background: var(--vn-section-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.q-card,
|
.q-card__actions {
|
||||||
.q-table,
|
justify-content: center;
|
||||||
.q-table__bottom,
|
|
||||||
.q-drawer {
|
|
||||||
background-color: var(--vn-section-color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type='number'] {
|
input[type='number'] {
|
||||||
|
@ -207,25 +212,71 @@ input::-webkit-inner-spin-button {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== Scrollbar CSS ===== /
|
.q-table__container {
|
||||||
/ Firefox */
|
/* ===== Scrollbar CSS ===== /
|
||||||
|
/ Firefox */
|
||||||
|
|
||||||
* {
|
* {
|
||||||
scrollbar-width: auto;
|
scrollbar-width: auto;
|
||||||
scrollbar-color: var(--vn-label-color) transparent;
|
scrollbar-color: var(--vn-label-color) transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Chrome, Edge, and Safari */
|
||||||
|
*::-webkit-scrollbar {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-thumb {
|
||||||
|
background-color: var(--vn-label-color);
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Chrome, Edge, and Safari */
|
.q-table {
|
||||||
*::-webkit-scrollbar {
|
th,
|
||||||
width: 10px;
|
td {
|
||||||
height: 10px;
|
padding: 1px 10px 1px 10px;
|
||||||
|
max-width: 100px;
|
||||||
|
div span {
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
th {
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
font-size: 11pt;
|
||||||
|
border-top: 1px solid var(--vn-page-color);
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.shrink {
|
||||||
|
max-width: 75px;
|
||||||
|
}
|
||||||
|
.expand {
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.edit-photo-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 12px;
|
||||||
|
bottom: 12px;
|
||||||
|
z-index: 1;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
*::-webkit-scrollbar-thumb {
|
.subName {
|
||||||
background-color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
border-radius: 10px;
|
text-transform: uppercase;
|
||||||
}
|
|
||||||
|
|
||||||
*::-webkit-scrollbar-track {
|
|
||||||
background: transparent;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,21 +20,21 @@ export function isValidDate(date) {
|
||||||
* Converts a given date to a specific format.
|
* Converts a given date to a specific format.
|
||||||
*
|
*
|
||||||
* @param {number|string|Date} date - The date to be formatted.
|
* @param {number|string|Date} date - The date to be formatted.
|
||||||
|
* @param {Object} opts - Optional parameters to customize the output format.
|
||||||
* @returns {string} The formatted date as a string in 'dd/mm/yyyy' format. If the provided date is not valid, an empty string is returned.
|
* @returns {string} The formatted date as a string in 'dd/mm/yyyy' format. If the provided date is not valid, an empty string is returned.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* // returns "02/12/2022"
|
* // returns "02/12/2022"
|
||||||
* toDateFormat(new Date(2022, 11, 2));
|
* toDateFormat(new Date(2022, 11, 2));
|
||||||
*/
|
*/
|
||||||
export function toDateFormat(date, locale = 'es-ES') {
|
export function toDateFormat(date, locale = 'es-ES', opts = {}) {
|
||||||
if (!isValidDate(date)) {
|
if (!isValidDate(date)) return '';
|
||||||
return '';
|
|
||||||
}
|
const format = Object.assign(
|
||||||
return new Date(date).toLocaleDateString(locale, {
|
{ year: 'numeric', month: '2-digit', day: '2-digit' },
|
||||||
year: 'numeric',
|
opts
|
||||||
month: '2-digit',
|
);
|
||||||
day: '2-digit',
|
return new Date(date).toLocaleDateString(locale, format);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export default function dateRange(value) {
|
export default function dateRange(value) {
|
||||||
const minHour = new Date(value);
|
const minHour = new Date(value);
|
||||||
minHour.setHours(0, 0, 0, 0);
|
minHour.setHours(0, 0, 0, 0);
|
||||||
const maxHour = new Date();
|
const maxHour = new Date(value);
|
||||||
maxHour.setHours(23, 59, 59, 59);
|
maxHour.setHours(23, 59, 59, 59);
|
||||||
|
|
||||||
return [minHour, maxHour];
|
return [minHour, maxHour];
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
// parsing JSON safely
|
||||||
|
function parseJSON(str, fallback) {
|
||||||
|
try {
|
||||||
|
return JSON.parse(str ?? '{}');
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error parsing JSON:', e);
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default function (route, param) {
|
||||||
|
// catch route query params
|
||||||
|
const params = parseJSON(route?.query?.params, {});
|
||||||
|
|
||||||
|
// extract and parse filter from params
|
||||||
|
const { filter: filterStr = '{}' } = params;
|
||||||
|
const where = parseJSON(filterStr, {})?.where;
|
||||||
|
if (where && where[param] !== undefined) {
|
||||||
|
return where[param];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
|
@ -11,6 +11,7 @@ import dashIfEmpty from './dashIfEmpty';
|
||||||
import dateRange from './dateRange';
|
import dateRange from './dateRange';
|
||||||
import toHour from './toHour';
|
import toHour from './toHour';
|
||||||
import dashOrCurrency from './dashOrCurrency';
|
import dashOrCurrency from './dashOrCurrency';
|
||||||
|
import getParamWhere from './getParamWhere';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
toLowerCase,
|
toLowerCase,
|
||||||
|
@ -26,4 +27,5 @@ export {
|
||||||
toPercentage,
|
toPercentage,
|
||||||
dashIfEmpty,
|
dashIfEmpty,
|
||||||
dateRange,
|
dateRange,
|
||||||
|
getParamWhere,
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@ globals:
|
||||||
lang:
|
lang:
|
||||||
es: Spanish
|
es: Spanish
|
||||||
en: English
|
en: English
|
||||||
|
quantity: Quantity
|
||||||
language: Language
|
language: Language
|
||||||
entity: Entity
|
entity: Entity
|
||||||
user: User
|
user: User
|
||||||
|
@ -40,12 +41,15 @@ globals:
|
||||||
noChanges: No changes to save
|
noChanges: No changes to save
|
||||||
changesToSave: You have changes pending to save
|
changesToSave: You have changes pending to save
|
||||||
confirmRemove: You are about to delete this row. Are you sure?
|
confirmRemove: You are about to delete this row. Are you sure?
|
||||||
|
rowWillBeRemoved: This row will be removed
|
||||||
|
sureToContinue: Are you sure you want to continue?
|
||||||
rowAdded: Row added
|
rowAdded: Row added
|
||||||
rowRemoved: Row removed
|
rowRemoved: Row removed
|
||||||
pleaseWait: Please wait...
|
pleaseWait: Please wait...
|
||||||
noPinnedModules: You don't have any pinned modules
|
noPinnedModules: You don't have any pinned modules
|
||||||
summary:
|
summary:
|
||||||
basicData: Basic data
|
basicData: Basic data
|
||||||
|
daysOnward: Days onward
|
||||||
today: Today
|
today: Today
|
||||||
yesterday: Yesterday
|
yesterday: Yesterday
|
||||||
dateFormat: en-GB
|
dateFormat: en-GB
|
||||||
|
@ -66,6 +70,7 @@ globals:
|
||||||
allRows: 'All { numberRows } row(s)'
|
allRows: 'All { numberRows } row(s)'
|
||||||
markAll: Mark all
|
markAll: Mark all
|
||||||
requiredField: Required field
|
requiredField: Required field
|
||||||
|
valueCantBeEmpty: Value cannot be empty
|
||||||
class: clase
|
class: clase
|
||||||
type: Type
|
type: Type
|
||||||
reason: reason
|
reason: reason
|
||||||
|
@ -82,13 +87,22 @@ globals:
|
||||||
description: Description
|
description: Description
|
||||||
id: Id
|
id: Id
|
||||||
order: Order
|
order: Order
|
||||||
original: Original
|
original: Phys. Doc
|
||||||
file: File
|
file: File
|
||||||
selectFile: Select a file
|
selectFile: Select a file
|
||||||
copyClipboard: Copy on clipboard
|
copyClipboard: Copy on clipboard
|
||||||
salesPerson: SalesPerson
|
salesPerson: SalesPerson
|
||||||
send: Send
|
send: Send
|
||||||
code: Code
|
code: Code
|
||||||
|
since: Since
|
||||||
|
from: From
|
||||||
|
to: To
|
||||||
|
notes: Notes
|
||||||
|
refresh: Refresh
|
||||||
|
item: Item
|
||||||
|
ticket: Ticket
|
||||||
|
campaign: Campaign
|
||||||
|
weight: Weight
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Login
|
logIn: Login
|
||||||
summary: Summary
|
summary: Summary
|
||||||
|
@ -115,9 +129,11 @@ globals:
|
||||||
notifications: Notifications
|
notifications: Notifications
|
||||||
defaulter: Defaulter
|
defaulter: Defaulter
|
||||||
customerCreate: New customer
|
customerCreate: New customer
|
||||||
|
createOrder: New order
|
||||||
fiscalData: Fiscal data
|
fiscalData: Fiscal data
|
||||||
billingData: Billing data
|
billingData: Billing data
|
||||||
consignees: Consignees
|
consignees: Consignees
|
||||||
|
'address-create': New address
|
||||||
notes: Notes
|
notes: Notes
|
||||||
credits: Credits
|
credits: Credits
|
||||||
greuges: Greuges
|
greuges: Greuges
|
||||||
|
@ -196,6 +212,12 @@ globals:
|
||||||
autonomous: Autonomous
|
autonomous: Autonomous
|
||||||
suppliers: Suppliers
|
suppliers: Suppliers
|
||||||
supplier: Supplier
|
supplier: Supplier
|
||||||
|
expedition: Expedition
|
||||||
|
services: Service
|
||||||
|
components: Components
|
||||||
|
pictures: Pictures
|
||||||
|
packages: Packages
|
||||||
|
tracking: Tracking
|
||||||
labeler: Labeler
|
labeler: Labeler
|
||||||
supplierCreate: New supplier
|
supplierCreate: New supplier
|
||||||
accounts: Accounts
|
accounts: Accounts
|
||||||
|
@ -232,12 +254,23 @@ globals:
|
||||||
formation: Formation
|
formation: Formation
|
||||||
locations: Locations
|
locations: Locations
|
||||||
warehouses: Warehouses
|
warehouses: Warehouses
|
||||||
|
saleTracking: Sale tracking
|
||||||
roles: Roles
|
roles: Roles
|
||||||
connections: Connections
|
connections: Connections
|
||||||
acls: ACLs
|
acls: ACLs
|
||||||
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
|
||||||
|
ticketsMonitor: Tickets monitor
|
||||||
|
clientsActionsMonitor: Clients and actions
|
||||||
|
serial: Serial
|
||||||
|
medical: Mutual
|
||||||
|
supplier: Supplier
|
||||||
created: Created
|
created: Created
|
||||||
worker: Worker
|
worker: Worker
|
||||||
now: Now
|
now: Now
|
||||||
|
@ -246,6 +279,12 @@ 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
|
||||||
|
myAccount: My account
|
||||||
|
noOne: No one
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Access denied
|
statusUnauthorized: Access denied
|
||||||
statusInternalServerError: An internal server error has ocurred
|
statusInternalServerError: An internal server error has ocurred
|
||||||
|
@ -271,143 +310,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: >-
|
||||||
customer:
|
We will sent you an email to recover your password
|
||||||
list:
|
resetPassword:
|
||||||
phone: Phone
|
repeatPassword: Repeat password
|
||||||
email: Email
|
passwordNotMatch: Passwords don't match
|
||||||
customerOrders: Display customer orders
|
passwordChanged: Password changed
|
||||||
moreOptions: More options
|
|
||||||
card:
|
|
||||||
customerList: Customer list
|
|
||||||
customerId: Claim ID
|
|
||||||
salesPerson: Sales person
|
|
||||||
credit: Credit
|
|
||||||
risk: Risk
|
|
||||||
securedCredit: Secured credit
|
|
||||||
payMethod: Pay method
|
|
||||||
debt: Debt
|
|
||||||
isFrozen: Customer frozen
|
|
||||||
hasDebt: Customer has debt
|
|
||||||
isDisabled: Customer inactive
|
|
||||||
notChecked: Customer no checked
|
|
||||||
webAccountInactive: Web account inactive
|
|
||||||
noWebAccess: Web access is disabled
|
|
||||||
businessType: Business type
|
|
||||||
passwordRequirements: 'The password must have at least { length } length characters, {nAlpha} alphabetic characters, {nUpper} capital letters, {nDigits} digits and {nPunct} symbols (Ex: $%&.)\n'
|
|
||||||
businessTypeFk: Business type
|
|
||||||
summary:
|
|
||||||
basicData: Basic data
|
|
||||||
fiscalAddress: Fiscal address
|
|
||||||
fiscalData: Fiscal data
|
|
||||||
billingData: Billing data
|
|
||||||
consignee: Default consignee
|
|
||||||
businessData: Business data
|
|
||||||
financialData: Financial data
|
|
||||||
customerId: Customer ID
|
|
||||||
name: Name
|
|
||||||
contact: Contact
|
|
||||||
phone: Phone
|
|
||||||
mobile: Mobile
|
|
||||||
email: Email
|
|
||||||
salesPerson: Sales person
|
|
||||||
contactChannel: Contact channel
|
|
||||||
socialName: Social name
|
|
||||||
fiscalId: Fiscal ID
|
|
||||||
postcode: Postcode
|
|
||||||
province: Province
|
|
||||||
country: Country
|
|
||||||
street: Address
|
|
||||||
isEqualizated: Is equalizated
|
|
||||||
isActive: Is active
|
|
||||||
invoiceByAddress: Invoice by address
|
|
||||||
verifiedData: Verified data
|
|
||||||
hasToInvoice: Has to invoice
|
|
||||||
notifyByEmail: Notify by email
|
|
||||||
vies: VIES
|
|
||||||
payMethod: Pay method
|
|
||||||
bankAccount: Bank account
|
|
||||||
dueDay: Due day
|
|
||||||
hasLcr: Has LCR
|
|
||||||
hasCoreVnl: Has core VNL
|
|
||||||
hasB2BVnl: Has B2B VNL
|
|
||||||
addressName: Address name
|
|
||||||
addressCity: City
|
|
||||||
addressStreet: Street
|
|
||||||
username: Username
|
|
||||||
webAccess: Web access
|
|
||||||
totalGreuge: Total greuge
|
|
||||||
mana: Mana
|
|
||||||
priceIncreasingRate: Price increasing rate
|
|
||||||
averageInvoiced: Average invoiced
|
|
||||||
claimRate: Claming rate
|
|
||||||
risk: Risk
|
|
||||||
riskInfo: Invoices minus payments plus orders not yet invoiced
|
|
||||||
credit: Credit
|
|
||||||
creditInfo: Company's maximum risk
|
|
||||||
securedCredit: Secured credit
|
|
||||||
securedCreditInfo: Solunion's maximum risk
|
|
||||||
balance: Balance
|
|
||||||
balanceInfo: Invoices minus payments
|
|
||||||
balanceDue: Balance due
|
|
||||||
balanceDueInfo: Deviated invoices minus payments
|
|
||||||
recoverySince: Recovery since
|
|
||||||
businessType: Business Type
|
|
||||||
city: City
|
|
||||||
descriptorInfo: Invoices minus payments plus orders not yet
|
|
||||||
rating: Rating
|
|
||||||
recommendCredit: Recommended credit
|
|
||||||
basicData:
|
|
||||||
socialName: Fiscal name
|
|
||||||
businessType: Business type
|
|
||||||
contact: Contact
|
|
||||||
youCanSaveMultipleEmails: You can save multiple emails
|
|
||||||
email: Email
|
|
||||||
phone: Phone
|
|
||||||
mobile: Mobile
|
|
||||||
salesPerson: Sales person
|
|
||||||
contactChannel: Contact channel
|
|
||||||
previousClient: Previous client
|
|
||||||
extendedList:
|
|
||||||
tableVisibleColumns:
|
|
||||||
id: Identifier
|
|
||||||
name: Comercial name
|
|
||||||
socialName: Business name
|
|
||||||
fi: Tax number
|
|
||||||
salesPersonFk: Salesperson
|
|
||||||
credit: Credit
|
|
||||||
creditInsurance: Credit insurance
|
|
||||||
phone: Phone
|
|
||||||
mobile: Mobile
|
|
||||||
street: Street
|
|
||||||
countryFk: Country
|
|
||||||
provinceFk: Province
|
|
||||||
city: City
|
|
||||||
postcode: Postcode
|
|
||||||
email: Email
|
|
||||||
created: Created
|
|
||||||
businessTypeFk: Business type
|
|
||||||
payMethodFk: Billing data
|
|
||||||
sageTaxTypeFk: Sage tax type
|
|
||||||
sageTransactionTypeFk: Sage tr. type
|
|
||||||
isActive: Active
|
|
||||||
isVies: Vies
|
|
||||||
isTaxDataChecked: Verified data
|
|
||||||
isEqualizated: Is equalizated
|
|
||||||
isFreezed: Freezed
|
|
||||||
hasToInvoice: Invoice
|
|
||||||
hasToInvoiceByAddress: Invoice by address
|
|
||||||
isToBeMailed: Mailing
|
|
||||||
hasLcr: Received LCR
|
|
||||||
hasCoreVnl: VNL core received
|
|
||||||
hasSepaVnl: VNL B2B received
|
|
||||||
entry:
|
entry:
|
||||||
list:
|
list:
|
||||||
newEntry: New entry
|
newEntry: New entry
|
||||||
|
@ -429,6 +342,7 @@ entry:
|
||||||
travelFk: Travel
|
travelFk: Travel
|
||||||
isExcludedFromAvailable: Inventory
|
isExcludedFromAvailable: Inventory
|
||||||
isRaid: Raid
|
isRaid: Raid
|
||||||
|
invoiceAmount: Import
|
||||||
summary:
|
summary:
|
||||||
commission: Commission
|
commission: Commission
|
||||||
currency: Currency
|
currency: Currency
|
||||||
|
@ -546,18 +460,13 @@ ticket:
|
||||||
sms: Sms
|
sms: Sms
|
||||||
notes: Notes
|
notes: Notes
|
||||||
sale: Sale
|
sale: Sale
|
||||||
|
dms: File management
|
||||||
volume: Volume
|
volume: Volume
|
||||||
observation: Notes
|
observation: Notes
|
||||||
ticketAdvance: Advance tickets
|
ticketAdvance: Advance tickets
|
||||||
futureTickets: Future tickets
|
futureTickets: Future tickets
|
||||||
expedition: Expedition
|
|
||||||
purchaseRequest: Purchase request
|
purchaseRequest: Purchase request
|
||||||
weeklyTickets: Weekly tickets
|
weeklyTickets: Weekly tickets
|
||||||
services: Service
|
|
||||||
tracking: Tracking
|
|
||||||
components: Components
|
|
||||||
pictures: Pictures
|
|
||||||
packages: Packages
|
|
||||||
list:
|
list:
|
||||||
nickname: Nickname
|
nickname: Nickname
|
||||||
state: State
|
state: State
|
||||||
|
@ -670,6 +579,7 @@ invoiceOut:
|
||||||
chooseValidClient: Choose a valid client
|
chooseValidClient: Choose a valid client
|
||||||
chooseValidCompany: Choose a valid company
|
chooseValidCompany: Choose a valid company
|
||||||
chooseValidPrinter: Choose a valid printer
|
chooseValidPrinter: Choose a valid printer
|
||||||
|
chooseValidSerialType: Choose a serial type
|
||||||
fillDates: Invoice date and the max date should be filled
|
fillDates: Invoice date and the max date should be filled
|
||||||
invoiceDateLessThanMaxDate: Invoice date can not be less than max date
|
invoiceDateLessThanMaxDate: Invoice date can not be less than max date
|
||||||
invoiceWithFutureDate: Exists an invoice with a future date
|
invoiceWithFutureDate: Exists an invoice with a future date
|
||||||
|
@ -724,56 +634,6 @@ parking:
|
||||||
searchBar:
|
searchBar:
|
||||||
info: You can search by parking code
|
info: You can search by parking code
|
||||||
label: Search parking...
|
label: Search parking...
|
||||||
invoiceIn:
|
|
||||||
list:
|
|
||||||
ref: Reference
|
|
||||||
supplier: Supplier
|
|
||||||
supplierRef: Supplier ref.
|
|
||||||
serialNumber: Serial number
|
|
||||||
serial: Serial
|
|
||||||
file: File
|
|
||||||
issued: Issued
|
|
||||||
isBooked: Is booked
|
|
||||||
awb: AWB
|
|
||||||
amount: Amount
|
|
||||||
card:
|
|
||||||
issued: Issued
|
|
||||||
amount: Amount
|
|
||||||
client: Client
|
|
||||||
company: Company
|
|
||||||
customerCard: Customer card
|
|
||||||
ticketList: Ticket List
|
|
||||||
vat: Vat
|
|
||||||
dueDay: Due day
|
|
||||||
intrastat: Intrastat
|
|
||||||
summary:
|
|
||||||
supplier: Supplier
|
|
||||||
supplierRef: Supplier ref.
|
|
||||||
currency: Currency
|
|
||||||
docNumber: Doc number
|
|
||||||
issued: Expedition date
|
|
||||||
operated: Operation date
|
|
||||||
bookEntried: Entry date
|
|
||||||
bookedDate: Booked date
|
|
||||||
sage: Sage withholding
|
|
||||||
vat: Undeductible VAT
|
|
||||||
company: Company
|
|
||||||
booked: Booked
|
|
||||||
expense: Expense
|
|
||||||
taxableBase: Taxable base
|
|
||||||
rate: Rate
|
|
||||||
sageVat: Sage vat
|
|
||||||
sageTransaction: Sage transaction
|
|
||||||
dueDay: Date
|
|
||||||
bank: Bank
|
|
||||||
amount: Amount
|
|
||||||
foreignValue: Foreign value
|
|
||||||
dueTotal: Due day
|
|
||||||
noMatch: Do not match
|
|
||||||
code: Code
|
|
||||||
net: Net
|
|
||||||
stems: Stems
|
|
||||||
country: Country
|
|
||||||
order:
|
order:
|
||||||
field:
|
field:
|
||||||
salesPersonFk: Sales Person
|
salesPersonFk: Sales Person
|
||||||
|
@ -850,6 +710,7 @@ worker:
|
||||||
timeControl: Time control
|
timeControl: Time control
|
||||||
locker: Locker
|
locker: Locker
|
||||||
balance: Balance
|
balance: Balance
|
||||||
|
medical: Medical
|
||||||
list:
|
list:
|
||||||
name: Name
|
name: Name
|
||||||
email: Email
|
email: Email
|
||||||
|
@ -861,6 +722,7 @@ worker:
|
||||||
newWorker: New worker
|
newWorker: New worker
|
||||||
card:
|
card:
|
||||||
workerId: Worker ID
|
workerId: Worker ID
|
||||||
|
user: User
|
||||||
name: Name
|
name: Name
|
||||||
email: Email
|
email: Email
|
||||||
phone: Phone
|
phone: Phone
|
||||||
|
@ -929,6 +791,15 @@ worker:
|
||||||
amount: Importe
|
amount: Importe
|
||||||
remark: Bonficado
|
remark: Bonficado
|
||||||
hasDiploma: Diploma
|
hasDiploma: Diploma
|
||||||
|
medical:
|
||||||
|
tableVisibleColumns:
|
||||||
|
date: Date
|
||||||
|
time: Hour
|
||||||
|
center: Formation Center
|
||||||
|
invoice: Invoice
|
||||||
|
amount: Amount
|
||||||
|
isFit: Fit
|
||||||
|
remark: Observations
|
||||||
imageNotFound: Image not found
|
imageNotFound: Image not found
|
||||||
balance:
|
balance:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
|
@ -938,6 +809,16 @@ worker:
|
||||||
credit: Have
|
credit: Have
|
||||||
concept: Concept
|
concept: Concept
|
||||||
wagon:
|
wagon:
|
||||||
|
pageTitles:
|
||||||
|
wagons: Wagons
|
||||||
|
wagonsList: Wagons List
|
||||||
|
wagonCreate: Create wagon
|
||||||
|
wagonEdit: Edit wagon
|
||||||
|
typesList: Types List
|
||||||
|
typeCreate: Create type
|
||||||
|
typeEdit: Edit type
|
||||||
|
wagonCounter: Trolley counter
|
||||||
|
wagonTray: Tray List
|
||||||
type:
|
type:
|
||||||
name: Name
|
name: Name
|
||||||
submit: Submit
|
submit: Submit
|
||||||
|
@ -994,18 +875,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
|
||||||
|
@ -1113,9 +982,12 @@ travel:
|
||||||
agency: Agency
|
agency: Agency
|
||||||
shipped: Shipped
|
shipped: Shipped
|
||||||
landed: Landed
|
landed: Landed
|
||||||
|
shipHour: Shipment Hour
|
||||||
|
landHour: Landing Hour
|
||||||
warehouseIn: Warehouse in
|
warehouseIn: Warehouse in
|
||||||
warehouseOut: Warehouse out
|
warehouseOut: Warehouse out
|
||||||
totalEntries: Total entries
|
totalEntries: Total entries
|
||||||
|
totalEntriesTooltip: Total entries
|
||||||
summary:
|
summary:
|
||||||
confirmed: Confirmed
|
confirmed: Confirmed
|
||||||
entryId: Entry Id
|
entryId: Entry Id
|
||||||
|
@ -1268,6 +1140,7 @@ components:
|
||||||
active: Is active
|
active: Is active
|
||||||
visible: Is visible
|
visible: Is visible
|
||||||
floramondo: Is floramondo
|
floramondo: Is floramondo
|
||||||
|
showBadDates: Show future items
|
||||||
userPanel:
|
userPanel:
|
||||||
copyToken: Token copied to clipboard
|
copyToken: Token copied to clipboard
|
||||||
settings: Settings
|
settings: Settings
|
||||||
|
|
|
@ -3,6 +3,7 @@ globals:
|
||||||
es: Español
|
es: Español
|
||||||
en: Inglés
|
en: Inglés
|
||||||
language: Idioma
|
language: Idioma
|
||||||
|
quantity: Cantidad
|
||||||
entity: Entidad
|
entity: Entidad
|
||||||
user: Usuario
|
user: Usuario
|
||||||
details: Detalles
|
details: Detalles
|
||||||
|
@ -39,12 +40,15 @@ globals:
|
||||||
noChanges: Sin cambios que guardar
|
noChanges: Sin cambios que guardar
|
||||||
changesToSave: Tienes cambios pendientes de guardar
|
changesToSave: Tienes cambios pendientes de guardar
|
||||||
confirmRemove: Vas a eliminar este registro. ¿Continuar?
|
confirmRemove: Vas a eliminar este registro. ¿Continuar?
|
||||||
|
rowWillBeRemoved: Esta linea se eliminará
|
||||||
|
sureToContinue: ¿Seguro que quieres continuar?
|
||||||
rowAdded: Fila añadida
|
rowAdded: Fila añadida
|
||||||
rowRemoved: Fila eliminada
|
rowRemoved: Fila eliminada
|
||||||
pleaseWait: Por favor espera...
|
pleaseWait: Por favor espera...
|
||||||
noPinnedModules: No has fijado ningún módulo
|
noPinnedModules: No has fijado ningún módulo
|
||||||
summary:
|
summary:
|
||||||
basicData: Datos básicos
|
basicData: Datos básicos
|
||||||
|
daysOnward: Días adelante
|
||||||
today: Hoy
|
today: Hoy
|
||||||
yesterday: Ayer
|
yesterday: Ayer
|
||||||
dateFormat: es-ES
|
dateFormat: es-ES
|
||||||
|
@ -75,6 +79,9 @@ globals:
|
||||||
warehouse: Almacén
|
warehouse: Almacén
|
||||||
company: Empresa
|
company: Empresa
|
||||||
fieldRequired: Campo requerido
|
fieldRequired: Campo requerido
|
||||||
|
valueCantBeEmpty: El valor no puede estar vacío
|
||||||
|
Value can't be blank: El valor no puede estar en blanco
|
||||||
|
Value can't be null: El valor no puede ser nulo
|
||||||
allowedFilesText: 'Tipos de archivo permitidos: { allowedContentTypes }'
|
allowedFilesText: 'Tipos de archivo permitidos: { allowedContentTypes }'
|
||||||
smsSent: SMS enviado
|
smsSent: SMS enviado
|
||||||
confirmDeletion: Confirmar eliminación
|
confirmDeletion: Confirmar eliminación
|
||||||
|
@ -82,13 +89,22 @@ globals:
|
||||||
description: Descripción
|
description: Descripción
|
||||||
id: Id
|
id: Id
|
||||||
order: Orden
|
order: Orden
|
||||||
original: Original
|
original: Doc. física
|
||||||
file: Fichero
|
file: Fichero
|
||||||
selectFile: Seleccione un fichero
|
selectFile: Seleccione un fichero
|
||||||
copyClipboard: Copiar en portapapeles
|
copyClipboard: Copiar en portapapeles
|
||||||
salesPerson: Comercial
|
salesPerson: Comercial
|
||||||
send: Enviar
|
send: Enviar
|
||||||
code: Código
|
code: Código
|
||||||
|
since: Desde
|
||||||
|
from: Desde
|
||||||
|
to: Hasta
|
||||||
|
notes: Notas
|
||||||
|
refresh: Actualizar
|
||||||
|
item: Artículo
|
||||||
|
ticket: Ticket
|
||||||
|
campaign: Campaña
|
||||||
|
weight: Peso
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Inicio de sesión
|
logIn: Inicio de sesión
|
||||||
summary: Resumen
|
summary: Resumen
|
||||||
|
@ -110,6 +126,7 @@ globals:
|
||||||
inheritedRoles: Roles heredados
|
inheritedRoles: Roles heredados
|
||||||
customers: Clientes
|
customers: Clientes
|
||||||
customerCreate: Nuevo cliente
|
customerCreate: Nuevo cliente
|
||||||
|
createOrder: Nuevo pedido
|
||||||
list: Listado
|
list: Listado
|
||||||
webPayments: Pagos Web
|
webPayments: Pagos Web
|
||||||
extendedList: Listado extendido
|
extendedList: Listado extendido
|
||||||
|
@ -119,6 +136,7 @@ globals:
|
||||||
fiscalData: Datos fiscales
|
fiscalData: Datos fiscales
|
||||||
billingData: Forma de pago
|
billingData: Forma de pago
|
||||||
consignees: Consignatarios
|
consignees: Consignatarios
|
||||||
|
'address-create': Nuevo consignatario
|
||||||
notes: Notas
|
notes: Notas
|
||||||
credits: Créditos
|
credits: Créditos
|
||||||
greuges: Greuges
|
greuges: Greuges
|
||||||
|
@ -231,7 +249,7 @@ globals:
|
||||||
purchaseRequest: Petición de compra
|
purchaseRequest: Petición de compra
|
||||||
weeklyTickets: Tickets programados
|
weeklyTickets: Tickets programados
|
||||||
formation: Formación
|
formation: Formación
|
||||||
locations: Ubicaciones
|
locations: Localizaciones
|
||||||
warehouses: Almacenes
|
warehouses: Almacenes
|
||||||
roles: Roles
|
roles: Roles
|
||||||
connections: Conexiones
|
connections: Conexiones
|
||||||
|
@ -241,11 +259,22 @@ globals:
|
||||||
privileges: Privilegios
|
privileges: Privilegios
|
||||||
observation: Notas
|
observation: Notas
|
||||||
expedition: Expedición
|
expedition: Expedición
|
||||||
|
saleTracking: Líneas preparadas
|
||||||
services: Servicios
|
services: Servicios
|
||||||
tracking: Estados
|
tracking: Estados
|
||||||
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
|
||||||
|
ticketsMonitor: Monitor de tickets
|
||||||
|
clientsActionsMonitor: Clientes y acciones
|
||||||
|
serial: Facturas por serie
|
||||||
|
medical: Mutua
|
||||||
|
supplier: Proveedor
|
||||||
created: Fecha creación
|
created: Fecha creación
|
||||||
worker: Trabajador
|
worker: Trabajador
|
||||||
now: Ahora
|
now: Ahora
|
||||||
|
@ -254,6 +283,12 @@ 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
|
||||||
|
myAccount: Mi cuenta
|
||||||
|
noOne: Nadie
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Acceso denegado
|
statusUnauthorized: Acceso denegado
|
||||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||||
|
@ -277,142 +312,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: >-
|
||||||
customer:
|
Te enviaremos un correo para restablecer tu contraseña
|
||||||
list:
|
resetPassword:
|
||||||
phone: Teléfono
|
repeatPassword: Repetir contraseña
|
||||||
email: Email
|
passwordNotMatch: Las contraseñas no coinciden
|
||||||
customerOrders: Mostrar órdenes del cliente
|
passwordChanged: Contraseña cambiada
|
||||||
moreOptions: Más opciones
|
|
||||||
card:
|
|
||||||
customerId: ID cliente
|
|
||||||
salesPerson: Comercial
|
|
||||||
credit: Crédito
|
|
||||||
risk: Riesgo
|
|
||||||
securedCredit: Crédito asegurado
|
|
||||||
payMethod: Método de pago
|
|
||||||
debt: Riesgo
|
|
||||||
isFrozen: Cliente congelado
|
|
||||||
hasDebt: Cliente con riesgo
|
|
||||||
isDisabled: Cliente inactivo
|
|
||||||
notChecked: Cliente no comprobado
|
|
||||||
webAccountInactive: Sin acceso web
|
|
||||||
noWebAccess: El acceso web está desactivado
|
|
||||||
businessType: Tipo de negocio
|
|
||||||
passwordRequirements: 'La contraseña debe tener al menos { length } caracteres de longitud, {nAlpha} caracteres alfabéticos, {nUpper} letras mayúsculas, {nDigits} dígitos y {nPunct} símbolos (Ej: $%&.)'
|
|
||||||
businessTypeFk: Tipo de negocio
|
|
||||||
summary:
|
|
||||||
basicData: Datos básicos
|
|
||||||
fiscalAddress: Dirección fiscal
|
|
||||||
fiscalData: Datos fiscales
|
|
||||||
billingData: Datos de facturación
|
|
||||||
consignee: Consignatario pred.
|
|
||||||
businessData: Datos comerciales
|
|
||||||
financialData: Datos financieros
|
|
||||||
customerId: ID cliente
|
|
||||||
name: Nombre
|
|
||||||
contact: Contacto
|
|
||||||
phone: Teléfono
|
|
||||||
mobile: Móvil
|
|
||||||
email: Email
|
|
||||||
salesPerson: Comercial
|
|
||||||
contactChannel: Canal de contacto
|
|
||||||
socialName: Razón social
|
|
||||||
fiscalId: NIF/CIF
|
|
||||||
postcode: Código postal
|
|
||||||
province: Provincia
|
|
||||||
country: País
|
|
||||||
street: Calle
|
|
||||||
isEqualizated: Recargo de equivalencia
|
|
||||||
isActive: Activo
|
|
||||||
invoiceByAddress: Facturar por consignatario
|
|
||||||
verifiedData: Datos verificados
|
|
||||||
hasToInvoice: Facturar
|
|
||||||
notifyByEmail: Notificar por email
|
|
||||||
vies: VIES
|
|
||||||
payMethod: Método de pago
|
|
||||||
bankAccount: Cuenta bancaria
|
|
||||||
dueDay: Día de pago
|
|
||||||
hasLcr: Recibido LCR
|
|
||||||
hasCoreVnl: Recibido core VNL
|
|
||||||
hasB2BVnl: Recibido B2B VNL
|
|
||||||
addressName: Nombre de la dirección
|
|
||||||
addressCity: Ciudad
|
|
||||||
addressStreet: Calle
|
|
||||||
username: Usuario
|
|
||||||
webAccess: Acceso web
|
|
||||||
totalGreuge: Greuge total
|
|
||||||
mana: Maná
|
|
||||||
priceIncreasingRate: Ratio de incremento de precio
|
|
||||||
averageInvoiced: Facturación media
|
|
||||||
claimRate: Ratio de reclamaciones
|
|
||||||
risk: Riesgo
|
|
||||||
riskInfo: Facturas menos recibos mas pedidos sin facturar
|
|
||||||
credit: Crédito
|
|
||||||
creditInfo: Riesgo máximo asumido por la empresa
|
|
||||||
securedCredit: Crédito asegurado
|
|
||||||
securedCreditInfo: Riesgo máximo asumido por Solunion
|
|
||||||
balance: Balance
|
|
||||||
balanceInfo: Facturas menos recibos
|
|
||||||
balanceDue: Saldo vencido
|
|
||||||
balanceDueInfo: Facturas fuera de plazo menos recibos
|
|
||||||
recoverySince: Recobro desde
|
|
||||||
businessType: Tipo de negocio
|
|
||||||
city: Población
|
|
||||||
descriptorInfo: Facturas menos recibos mas pedidos sin facturar
|
|
||||||
rating: Clasificación
|
|
||||||
recommendCredit: Crédito recomendado
|
|
||||||
basicData:
|
|
||||||
socialName: Nombre fiscal
|
|
||||||
businessType: Tipo de negocio
|
|
||||||
contact: Contacto
|
|
||||||
youCanSaveMultipleEmails: Puede guardar varios correos electrónicos encadenándolos mediante comas sin espacios{','} ejemplo{':'} user{'@'}dominio{'.'}com, user2{'@'}dominio{'.'}com siendo el primer correo electrónico el principal
|
|
||||||
email: Email
|
|
||||||
phone: Teléfono
|
|
||||||
mobile: Móvil
|
|
||||||
salesPerson: Comercial
|
|
||||||
contactChannel: Canal de contacto
|
|
||||||
previousClient: Cliente anterior
|
|
||||||
extendedList:
|
|
||||||
tableVisibleColumns:
|
|
||||||
id: Identificador
|
|
||||||
name: Nombre Comercial
|
|
||||||
socialName: Razón social
|
|
||||||
fi: NIF / CIF
|
|
||||||
salesPersonFk: Comercial
|
|
||||||
credit: Crédito
|
|
||||||
creditInsurance: Crédito asegurado
|
|
||||||
phone: Teléfono
|
|
||||||
mobile: Móvil
|
|
||||||
street: Dirección fiscal
|
|
||||||
countryFk: País
|
|
||||||
provinceFk: Provincia
|
|
||||||
city: Población
|
|
||||||
postcode: Código postal
|
|
||||||
email: Email
|
|
||||||
created: Fecha creación
|
|
||||||
businessTypeFk: Tipo de negocio
|
|
||||||
payMethodFk: Forma de pago
|
|
||||||
sageTaxTypeFk: Tipo de impuesto Sage
|
|
||||||
sageTransactionTypeFk: Tipo tr. sage
|
|
||||||
isActive: Activo
|
|
||||||
isVies: Vies
|
|
||||||
isTaxDataChecked: Datos comprobados
|
|
||||||
isEqualizated: Recargo de equivalencias
|
|
||||||
isFreezed: Congelado
|
|
||||||
hasToInvoice: Factura
|
|
||||||
hasToInvoiceByAddress: Factura por consigna
|
|
||||||
isToBeMailed: Env. emails
|
|
||||||
hasLcr: Recibido LCR
|
|
||||||
hasCoreVnl: Recibido core VNL
|
|
||||||
hasSepaVnl: Recibido B2B VNL
|
|
||||||
entry:
|
entry:
|
||||||
list:
|
list:
|
||||||
newEntry: Nueva entrada
|
newEntry: Nueva entrada
|
||||||
|
@ -434,6 +344,7 @@ entry:
|
||||||
travelFk: Envio
|
travelFk: Envio
|
||||||
isExcludedFromAvailable: Inventario
|
isExcludedFromAvailable: Inventario
|
||||||
isRaid: Redada
|
isRaid: Redada
|
||||||
|
invoiceAmount: Importe
|
||||||
summary:
|
summary:
|
||||||
commission: Comisión
|
commission: Comisión
|
||||||
currency: Moneda
|
currency: Moneda
|
||||||
|
@ -551,6 +462,7 @@ ticket:
|
||||||
sms: Sms
|
sms: Sms
|
||||||
notes: Notas
|
notes: Notas
|
||||||
sale: Lineas del pedido
|
sale: Lineas del pedido
|
||||||
|
dms: Gestión documental
|
||||||
volume: Volumen
|
volume: Volumen
|
||||||
observation: Notas
|
observation: Notas
|
||||||
ticketAdvance: Adelantar tickets
|
ticketAdvance: Adelantar tickets
|
||||||
|
@ -558,6 +470,7 @@ ticket:
|
||||||
expedition: Expedición
|
expedition: Expedición
|
||||||
purchaseRequest: Petición de compra
|
purchaseRequest: Petición de compra
|
||||||
weeklyTickets: Tickets programados
|
weeklyTickets: Tickets programados
|
||||||
|
saleTracking: Líneas preparadas
|
||||||
services: Servicios
|
services: Servicios
|
||||||
tracking: Estados
|
tracking: Estados
|
||||||
components: Componentes
|
components: Componentes
|
||||||
|
@ -675,6 +588,7 @@ invoiceOut:
|
||||||
chooseValidClient: Selecciona un cliente válido
|
chooseValidClient: Selecciona un cliente válido
|
||||||
chooseValidCompany: Selecciona una empresa válida
|
chooseValidCompany: Selecciona una empresa válida
|
||||||
chooseValidPrinter: Selecciona una impresora válida
|
chooseValidPrinter: Selecciona una impresora válida
|
||||||
|
chooseValidSerialType: Selecciona una tipo de serie válida
|
||||||
fillDates: La fecha de la factura y la fecha máxima deben estar completas
|
fillDates: La fecha de la factura y la fecha máxima deben estar completas
|
||||||
invoiceDateLessThanMaxDate: La fecha de la factura no puede ser menor que la fecha máxima
|
invoiceDateLessThanMaxDate: La fecha de la factura no puede ser menor que la fecha máxima
|
||||||
invoiceWithFutureDate: Existe una factura con una fecha futura
|
invoiceWithFutureDate: Existe una factura con una fecha futura
|
||||||
|
@ -688,8 +602,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
|
||||||
|
@ -769,54 +681,6 @@ parking:
|
||||||
searchBar:
|
searchBar:
|
||||||
info: Puedes buscar por código de parking
|
info: Puedes buscar por código de parking
|
||||||
label: Buscar parking...
|
label: Buscar parking...
|
||||||
invoiceIn:
|
|
||||||
list:
|
|
||||||
ref: Referencia
|
|
||||||
supplier: Proveedor
|
|
||||||
supplierRef: Ref. proveedor
|
|
||||||
serialNumber: Num. serie
|
|
||||||
shortIssued: F. emisión
|
|
||||||
serial: Serie
|
|
||||||
file: Fichero
|
|
||||||
issued: Fecha emisión
|
|
||||||
isBooked: Conciliada
|
|
||||||
awb: AWB
|
|
||||||
amount: Importe
|
|
||||||
card:
|
|
||||||
issued: Fecha emisión
|
|
||||||
amount: Importe
|
|
||||||
client: Cliente
|
|
||||||
company: Empresa
|
|
||||||
customerCard: Ficha del cliente
|
|
||||||
ticketList: Listado de tickets
|
|
||||||
vat: Iva
|
|
||||||
dueDay: Fecha de vencimiento
|
|
||||||
summary:
|
|
||||||
supplier: Proveedor
|
|
||||||
supplierRef: Ref. proveedor
|
|
||||||
currency: Divisa
|
|
||||||
docNumber: Número documento
|
|
||||||
issued: Fecha de expedición
|
|
||||||
operated: Fecha operación
|
|
||||||
bookEntried: Fecha asiento
|
|
||||||
bookedDate: Fecha contable
|
|
||||||
sage: Retención sage
|
|
||||||
vat: Iva no deducible
|
|
||||||
company: Empresa
|
|
||||||
booked: Contabilizada
|
|
||||||
expense: Gasto
|
|
||||||
taxableBase: Base imp.
|
|
||||||
rate: Tasa
|
|
||||||
sageTransaction: Sage transación
|
|
||||||
dueDay: Fecha
|
|
||||||
bank: Caja
|
|
||||||
amount: Importe
|
|
||||||
foreignValue: Divisa
|
|
||||||
dueTotal: Vencimiento
|
|
||||||
code: Código
|
|
||||||
net: Neto
|
|
||||||
stems: Tallos
|
|
||||||
country: País
|
|
||||||
department:
|
department:
|
||||||
pageTitles:
|
pageTitles:
|
||||||
basicData: Basic data
|
basicData: Basic data
|
||||||
|
@ -852,6 +716,8 @@ worker:
|
||||||
timeControl: Control de horario
|
timeControl: Control de horario
|
||||||
locker: Taquilla
|
locker: Taquilla
|
||||||
balance: Balance
|
balance: Balance
|
||||||
|
formation: Formación
|
||||||
|
medical: Mutua
|
||||||
list:
|
list:
|
||||||
name: Nombre
|
name: Nombre
|
||||||
email: Email
|
email: Email
|
||||||
|
@ -863,8 +729,9 @@ worker:
|
||||||
newWorker: Nuevo trabajador
|
newWorker: Nuevo trabajador
|
||||||
card:
|
card:
|
||||||
workerId: ID Trabajador
|
workerId: ID Trabajador
|
||||||
|
user: Usuario
|
||||||
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
|
||||||
|
@ -922,6 +789,15 @@ worker:
|
||||||
amount: Importe
|
amount: Importe
|
||||||
remark: Bonficado
|
remark: Bonficado
|
||||||
hasDiploma: Diploma
|
hasDiploma: Diploma
|
||||||
|
medical:
|
||||||
|
tableVisibleColumns:
|
||||||
|
date: Fecha
|
||||||
|
time: Hora
|
||||||
|
center: Centro de Formación
|
||||||
|
invoice: Factura
|
||||||
|
amount: Importe
|
||||||
|
isFit: Apto
|
||||||
|
remark: Observaciones
|
||||||
imageNotFound: No se ha encontrado la imagen
|
imageNotFound: No se ha encontrado la imagen
|
||||||
balance:
|
balance:
|
||||||
tableVisibleColumns:
|
tableVisibleColumns:
|
||||||
|
@ -931,6 +807,16 @@ worker:
|
||||||
credit: Haber
|
credit: Haber
|
||||||
concept: Concepto
|
concept: Concepto
|
||||||
wagon:
|
wagon:
|
||||||
|
pageTitles:
|
||||||
|
wagons: Vagones
|
||||||
|
wagonsList: Listado vagones
|
||||||
|
wagonCreate: Crear tipo
|
||||||
|
wagonEdit: Editar tipo
|
||||||
|
typesList: Listado tipos
|
||||||
|
typeCreate: Crear tipo
|
||||||
|
typeEdit: Editar tipo
|
||||||
|
wagonCounter: Contador de carros
|
||||||
|
wagonTray: Listado bandejas
|
||||||
type:
|
type:
|
||||||
name: Nombre
|
name: Nombre
|
||||||
submit: Guardar
|
submit: Guardar
|
||||||
|
@ -974,18 +860,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
|
||||||
|
@ -1091,11 +965,14 @@ travel:
|
||||||
id: Id
|
id: Id
|
||||||
ref: Referencia
|
ref: Referencia
|
||||||
agency: Agencia
|
agency: Agencia
|
||||||
shipped: Enviado
|
shipped: F.envío
|
||||||
landed: Llegada
|
shipHour: Hora de envío
|
||||||
warehouseIn: Almacén de salida
|
landHour: Hora de llegada
|
||||||
warehouseOut: Almacén de entrada
|
landed: F.entrega
|
||||||
totalEntries: Total de entradas
|
warehouseIn: Alm.salida
|
||||||
|
warehouseOut: Alm.entrada
|
||||||
|
totalEntries: ∑
|
||||||
|
totalEntriesTooltip: Entradas totales
|
||||||
summary:
|
summary:
|
||||||
confirmed: Confirmado
|
confirmed: Confirmado
|
||||||
entryId: Id entrada
|
entryId: Id entrada
|
||||||
|
@ -1243,11 +1120,10 @@ 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
|
||||||
|
showBadDates: Ver items a futuro
|
||||||
userPanel:
|
userPanel:
|
||||||
copyToken: Token copiado al portapapeles
|
copyToken: Token copiado al portapapeles
|
||||||
settings: Configuración
|
settings: Configuración
|
||||||
|
@ -1262,6 +1138,7 @@ components:
|
||||||
clone: Clonar
|
clone: Clonar
|
||||||
openCard: Ficha
|
openCard: Ficha
|
||||||
openSummary: Detalles
|
openSummary: Detalles
|
||||||
|
viewSummary: Vista previa
|
||||||
cardDescriptor:
|
cardDescriptor:
|
||||||
mainList: Listado principal
|
mainList: Listado principal
|
||||||
summary: Resumen
|
summary: Resumen
|
||||||
|
|
|
@ -5,7 +5,7 @@ const quasar = useQuasar();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QLayout view="hHh LpR fFf">
|
<QLayout view="hHh LpR fFf" v-shortcut>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<RouterView></RouterView>
|
<RouterView></RouterView>
|
||||||
<QFooter v-if="quasar.platform.is.mobile"></QFooter>
|
<QFooter v-if="quasar.platform.is.mobile"></QFooter>
|
||||||
|
|
|
@ -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,14 @@
|
||||||
<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 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,11 +20,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 exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -40,106 +33,121 @@ 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
|
<VnSearchbar
|
||||||
url="VnRoles"
|
data-key="AccountAcls"
|
||||||
:filter="{ fields: ['name'], order: 'name ASC' }"
|
url="ACLs"
|
||||||
@on-fetch="(data) => (rolesOptions = data)"
|
:expr-builder="exprBuilder"
|
||||||
auto-load
|
:label="t('acls.search')"
|
||||||
|
:info="t('acls.searchInfo')"
|
||||||
/>
|
/>
|
||||||
<template v-if="stateStore.isHeaderMounted()">
|
|
||||||
<Teleport to="#searchbar">
|
|
||||||
<VnSearchbar
|
|
||||||
data-key="AccountAcls"
|
|
||||||
url="ACLs"
|
|
||||||
:expr-builder="exprBuilder"
|
|
||||||
:label="t('acls.search')"
|
|
||||||
: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">
|
data-key="AccountAcls"
|
||||||
<VnPaginate
|
:url="`ACLs`"
|
||||||
ref="paginateRef"
|
:create="{
|
||||||
data-key="AccountAcls"
|
urlCreate: 'ACLs',
|
||||||
url="ACLs"
|
title: 'Create ACL',
|
||||||
:expr-builder="exprBuilder"
|
onDataSaved: () => tableRef.reload(),
|
||||||
>
|
formInitialData: {},
|
||||||
<template #body="{ rows }">
|
}"
|
||||||
<CardList
|
order="id DESC"
|
||||||
v-for="row of rows"
|
:disable-option="{ card: true }"
|
||||||
:id="row.id"
|
:columns="columns"
|
||||||
:key="row.id"
|
default-mode="table"
|
||||||
:title="`${row.model}.${row.property}`"
|
:right-search="true"
|
||||||
@click="showFormDialog(row)"
|
:is-editable="true"
|
||||||
>
|
:use-model="true"
|
||||||
<template #list-items>
|
/>
|
||||||
<VnLv :label="t('acls.role')" :value="row.principalId" />
|
|
||||||
<VnLv :label="t('acls.accessType')" :value="row.accessType" />
|
|
||||||
<VnLv
|
|
||||||
:label="t('acls.permissions')"
|
|
||||||
:value="row.permission"
|
|
||||||
/>
|
|
||||||
</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>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
@ -148,4 +156,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,29 @@ 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,
|
||||||
|
cardVisible: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'alias',
|
||||||
|
label: t('Alias'),
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'description',
|
||||||
|
label: t('Description'),
|
||||||
|
cardVisible: true,
|
||||||
|
create: true,
|
||||||
|
},
|
||||||
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -52,54 +54,29 @@ 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
|
data-key="AccountAliasList"
|
||||||
ref="paginateRef"
|
url="MailAliases"
|
||||||
data-key="AccountAliasList"
|
:create="{
|
||||||
url="MailAliases"
|
urlCreate: 'MailAliases',
|
||||||
:expr-builder="exprBuilder"
|
title: 'Create MailAlias',
|
||||||
>
|
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||||
<template #body="{ rows }">
|
formInitialData: {},
|
||||||
<CardList
|
}"
|
||||||
v-for="row of rows"
|
order="id DESC"
|
||||||
:id="row.id"
|
:columns="columns"
|
||||||
:key="row.id"
|
:disable-option="{ card: true }"
|
||||||
:title="row.alias"
|
default-mode="table"
|
||||||
@click="navigate(row.id)"
|
redirect="account/alias"
|
||||||
>
|
:is-editable="true"
|
||||||
<template #list-items>
|
:use-model="true"
|
||||||
<VnLv :label="t('mailAlias.alias')" :value="row.alias">
|
/>
|
||||||
</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>
|
|
||||||
</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>
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Id: Id
|
||||||
|
Alias: Alias
|
||||||
|
Description: Descripción
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -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';
|
||||||
|
@ -29,15 +27,15 @@ const filter = {
|
||||||
order: 'created DESC',
|
order: 'created DESC',
|
||||||
};
|
};
|
||||||
|
|
||||||
const urlPath = 'AccessTokens';
|
const urlPath = 'VnTokens';
|
||||||
|
|
||||||
const refresh = () => paginateRef.value.fetch();
|
const refresh = () => paginateRef.value.fetch();
|
||||||
|
|
||||||
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
||||||
|
|
||||||
const killSession = async (id) => {
|
const killSession = async ({ userId, created }) => {
|
||||||
try {
|
try {
|
||||||
await axios.delete(`${urlPath}/${id}`);
|
await axios.post(`${urlPath}/killSession`, { userId, created });
|
||||||
paginateRef.value.fetch();
|
paginateRef.value.fetch();
|
||||||
notify(t('Session killed'), 'positive');
|
notify(t('Session killed'), 'positive');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -86,7 +84,7 @@ const killSession = async (id) => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('Session will be killed'),
|
t('Session will be killed'),
|
||||||
t('Are you sure you want to continue?'),
|
t('Are you sure you want to continue?'),
|
||||||
() => killSession(row.id)
|
() => killSession(row)
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
outline
|
outline
|
||||||
|
|
|
@ -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,83 @@
|
||||||
<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,
|
||||||
|
columnFilter: {
|
||||||
|
component: 'select',
|
||||||
|
name: 'search',
|
||||||
|
attrs: {
|
||||||
|
url: 'VnUsers/preview',
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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),
|
||||||
|
isPrimary: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
|
@ -46,99 +96,31 @@ 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()">
|
<VnSearchbar
|
||||||
<Teleport to="#searchbar">
|
data-key="AccountUsers"
|
||||||
<VnSearchbar
|
:expr-builder="exprBuilder"
|
||||||
data-key="AccountList"
|
:label="t('account.search')"
|
||||||
url="VnUsers/preview"
|
:info="t('account.searchInfo')"
|
||||||
:expr-builder="exprBuilder"
|
/>
|
||||||
:label="t('account.search')"
|
|
||||||
:info="t('account.searchInfo')"
|
<VnTable
|
||||||
/>
|
ref="tableRef"
|
||||||
</Teleport>
|
data-key="AccountUsers"
|
||||||
<Teleport to="#actions-append">
|
url="VnUsers/preview"
|
||||||
<div class="row q-gutter-x-sm">
|
order="id DESC"
|
||||||
<QBtn
|
:columns="columns"
|
||||||
flat
|
default-mode="table"
|
||||||
@click="stateStore.toggleRightDrawer()"
|
redirect="account"
|
||||||
round
|
:use-model="true"
|
||||||
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"
|
|
||||||
auto-load
|
|
||||||
>
|
|
||||||
<template #body="{ rows }">
|
|
||||||
<CardList
|
|
||||||
v-for="row of rows"
|
|
||||||
: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>
|
|
||||||
</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>
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Id: Id
|
||||||
|
Nickname: Nickname
|
||||||
|
Name: Nombre
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import LeftMenu from 'components/LeftMenu.vue';
|
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
|
||||||
<QScrollArea class="fit text-grey-8">
|
|
||||||
<LeftMenu />
|
|
||||||
</QScrollArea>
|
|
||||||
</QDrawer>
|
|
||||||
<QPageContainer>
|
|
||||||
<RouterView></RouterView>
|
|
||||||
</QPageContainer>
|
|
||||||
</template>
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue