Compare commits

..

25 Commits

Author SHA1 Message Date
Javier Segarra 99e0dbb2f1 Merge branch 'dev' into fix_ticketNegatives
gitea/salix-front/pipeline/pr-dev This commit is unstable Details
2025-03-01 02:10:21 +01:00
Javier Segarra 9907fdf2fe test: clean test 2025-03-01 02:09:09 +01:00
Javier Segarra 6ea9ffa739 feat: updates
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-02-24 15:14:59 +01:00
Javier Segarra 66d327a552 test: improve test
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-02-24 02:10:19 +01:00
Javier Segarra e1173c2ab1 Merge branch '6321_improve_handleResults' into fix_ticketNegatives 2025-02-24 00:25:34 +01:00
Javier Segarra bd7f30e779 perf: minor changes 2025-02-23 22:45:38 +01:00
Javier Segarra 34b636319b Merge branch 'dev' into fix_ticketNegatives
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-21 11:57:36 +01:00
Javier Segarra 6a31a29d1d Merge branch 'dev' into fix_ticketNegatives
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-21 07:55:35 +00:00
Javier Segarra 4108246e70 Merge branch 'dev' into fix_ticketNegatives
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-19 21:14:42 +00:00
Javier Segarra f1a57ceba1 feat: refs #6321 init 2025-02-19 14:09:00 +01:00
Javier Segarra 1c3718a3dd fix: vnLocation error
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-18 12:39:10 +01:00
Javier Segarra cf9b08ba9b fix: style
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-18 12:13:38 +01:00
Javier Segarra 209814e477 fix: trycatch
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-18 12:12:37 +01:00
Javier Segarra c86601d548 Merge branch 'dev' into fix_ticketNegatives
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-18 10:42:51 +00:00
Jon Elias c4f480688e Merge branch 'dev' into fix_ticketNegatives
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-18 08:17:28 +00:00
Javier Segarra 315dddbdb9 Merge branch 'dev' into fix_ticketNegatives
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-17 17:42:44 +00:00
Jon Elias c50a5c9d0c Merge branch 'dev' into fix_ticketNegatives
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-17 14:37:31 +00:00
Javier Segarra 5519fcd066 fix: replace colour by inkFk
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-17 13:36:26 +01:00
Javier Segarra 0e68b75083 style: change align some columns
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-17 11:36:43 +01:00
Javier Segarra cec625b269 fix: filters
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-17 11:32:34 +01:00
Javier Segarra 1243e05266 Merge branch 'dev' into fix_ticketNegatives 2025-02-17 09:22:11 +01:00
Javier Segarra 7d5522de95 test: remove watch property
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-16 03:03:09 +01:00
Javier Segarra 6877a629c7 fix: bugs
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-16 03:02:34 +01:00
Javier Segarra 4af8361f90 Merge branch 'dev' into fix_ticketNegatives 2025-02-16 00:58:48 +01:00
Javier Segarra b78ab598b7 fix: icons
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-02-13 12:06:53 +01:00
463 changed files with 8517 additions and 11298 deletions

1
.gitignore vendored
View File

@ -31,7 +31,6 @@ yarn-error.log*
# Cypress directories and files
/test/cypress/videos
/test/cypress/screenshots
/junit
# VitePress directories and files
/docs/.vitepress/cache

View File

@ -1,436 +1,3 @@
# Version 25.12 - 2025-03-25
### Added 🆕
- chore: add junit-merge dependency to package.json by:alexm
- chore: downgrade version from 25.14.0 to 25.12.0 in package.json by:alexm
- chore: reduce page load timeout in Cypress configuration by:alexm
- chore: refs #6695 update Cypress to version 14.1.0 and simplify test execution in Jenkinsfile by:alexm
- chore: refs #8602 add comments for clarity in Cypress commands file by:pablone
- chore: refs #8602 enhance Cypress support files with detailed comments and organization by:pablone
- ci: refs #6695 feat jenkins parallel e2e by:alexm
- feat: integrate vue-router to enhance routing capabilities in ZoneCard component by:alexm
- feat: refs #6695 implement parallel Cypress testing and enhance timeout configurations by:alexm
- feat: refs #6695 update Cypress parallel test execution to use 3 instances by:alexm
- feat: refs #6802 add dash placeholder for empty department names in InvoiceOut list by:jgallego
- feat: refs #6802 add DepartmentDescriptorProxy to InvoiceOutList and update translations by:jgallego
- feat: refs #6802 add DepartmentDescriptorProxy to various components and update department handling by:jgallego
- feat: refs #7587 add 'ticketClaimed' translation and implement claims retrieval in TicketDescriptor by:jtubau
- feat: refs #7949 show new field in ticket sales by:Jon
- feat: refs #8045 added new logic to show the correct icon and the correct path to redirect by:Jon
- feat: refs #8045 modified icon and route to redirect from CardDescriptor by:Jon
- feat: refs #8074 modified spinner size by:Jon
- feat: refs #8600 added calendar e2e and modified basic data by:Jon
- feat: refs #8600 added deliveryDays and modified warehouse E2Es by:Jon
- feat: refs #8600 added new tests for zoneSummary & zoneLocations by:provira
- feat: refs #8602 add custom Cypress commands for improved element interaction and request handling by:pablone
- feat: refs #8602 add new Cypress command for clicking buttons with icons by:pablone
- feat: refs #8602 add remove functionality for tag filters in EntryBuys component by:pablone
- feat: refs #8602 add sorting options for select fields and update locale files with supplier name by:pablone
- feat: refs #8602 refactor EntryBuys component and enhance observation tests by:pablone
- feat: refs #8602 remove unused state property from useArrayDataStore by:pablone
- feat: refs #8602 remove unused URL property from VnTable in ClaimList component by:pablone
- feat: refs #8602 skip warehouse creation and removal test in ZoneWarehouse spec by:pablone
- feat: refs #8602 streamline beforeSaveFn execution in CrudModel component by:pablone
- feat: refs #8602 streamline beforeSaveFn execution in VnTable component by:pablone
- feat: refs #8602 streamline filter logic in EntryBuys component by:pablone
- feat: refs #8602 update entry components and tests, add data-cy attributes for Cypress integration by:pablone
- feat: refs #8602 update localization for purchased spaces and enhance Entry components with new labels by:pablone
- feat: refs #8606 adapt module to VnCatdBeta by:Jon
- feat: refs #8612 added summary button & changed e2e tests by:provira
- feat: refs #8612 changed shelving to VnTable & created e2e tests by:provira
- feat: refs #8616 add summary prop to CardDescriptor in RoadmapDescriptor and WorkerDescriptor by:jtubau
- feat: refs #8616 add VnCheckbox component to VnFilter and update prop types in VnFilterPanel and VnSearchbar by:jtubau
- feat: refs #8630 add Agency and Vehicle descriptor components with summary props by:jtubau
- feat: refs #8638 add AWB field to travel and entry forms, update translations and styles by:pablone
- feat: refs #8638 add data attributes for transfer buys functionality in EntryBuys.vue and corresponding tests by:pablone
- feat: refs #8648 enhance roadmapList tests with improved selectors and additional scenarios by:jtubau
- feat: refs #8664 add CmrFilter component and integrate it into CmrList for enhanced filtering options by:jtubau
- feat: refs #8721 add ticket navigation and update route columns by:jtubau
- feat: run.sh build neccessary images by:alexm
- feat: update Jenkinsfile to pull Docker images for back and db services by:alexm
- feat: update labels and add department selection in InvoiceOut filter and list by:jgallego
- refactor: refs #8626 update button styles and improve route redirection logic by:jtubau
- style: refs #8041 new variable by:benjaminedc
### Changed 📦
- feat: refs #8602 refactor EntryBuys component and enhance observation tests by:pablone
- refactor(cypress): refs #6695 simplify parallel test execution script by:alexm
- refactor: deleted useless (origin/Warmfix-DepartmentIcon) by:Jon
- refactor: refs #6695 enable ClaimNotes test suite by:alexm
- refactor: refs #6695 fix invoiceOutSummary by:alexm
- refactor: refs #6695 improve notification check and extend waitForElement timeout by:alexm
- refactor: refs #6695 remove mocha dependency and optimize Cypress command execution by:alexm
- refactor: refs #6695 skips by:alexm
- refactor: refs #6695 skip zoneWarehouse by:alexm
- refactor: refs #6695 streamline Cypress test execution and remove deprecated configurations by:alexm
- refactor: refs #6802 replace salesPerson references with department in claims and tickets by:jgallego
- refactor: refs #6802 replace 'salesPerson' terminology with 'team' across multiple locales and components by:jgallego
- refactor: refs #6802 update import paths for DepartmentDescriptorProxy to use Worker directory by:jgallego
- refactor: refs #6802 update InvoiceOutNegativeBases to use Department instead of Worker by:jgallego
- refactor: refs #6802 update TicketFilter and TicketSale components to use departmentFk and adjust API endpoints by:jgallego
- refactor: refs #8041 unify class link and unify titles to VnTitles by:benjaminedc
- refactor: refs #8045 modified icon and module const by:Jon
- refactor: refs #8197 rename VnCardBeta to VnCard by:alexm
- refactor: refs #8197 simplify menu retrieval logic in LeftMenu component by:alexm
- refactor: refs #8322 changed Wagon component to use VnSection/VnCardBeta by:provira
- refactor: refs #8322 remove keyBinding from Wagon router module by:alexm
- refactor: refs #8322 update WagonCard component and routing structure by:alexm
- refactor: refs #8370 modified function to get the correct date by:Jon
- refactor: refs #8472 remove added div and add class to VnInput by:jtubau
- refactor: refs #8472 unified styling for the more-create-dialog slot to ensure consistency across all scenarios by:jtubau
- refactor: refs #8472 update class names from q-span-2 to col-span-2 for consistency in layout by:jtubau
- refactor: refs #8600 changed test case description by:provira
- refactor: refs #8600 modified make invoice and send dialog e2es by:Jon
- refactor: refs #8600 modified upcomingDeliveries e2e and created deliveryDays by:Jon
- refactor: refs #8600 modified zoneSummary e2e by:Jon
- refactor: refs #8602 remove redundant date input test from entryList.spec.js by:pablone
- refactor: refs #8606 clear some warnings by:Jon
- refactor: refs #8606 deleted code and fixed translation by:Jon
- refactor: refs #8606 merged previous and e2e changes and corrected minor errors by:Jon
- refactor: refs #8606 requested changes by:Jon
- refactor: refs #8616 integrate summary dialog and update navigation in Agency and Vehicle components by:jtubau
- refactor: refs #8616 integrate VnSelectWorker component in RouteList and optimize format functions by:jtubau
- refactor: refs #8616 simplify template bindings and improve link generation in VehicleSummary by:jtubau
- refactor: refs #8616 update routing components for AgencyList and RouteRoadmap in route.js by:jtubau
- refactor: refs #8619 simplify empty data check in RouteDescriptor component by:jtubau
- refactor: refs #8626 add cardVisible property to RouteList columns by:jtubau
- refactor: refs #8626 add formatting for agency and vehicle columns in RouteList by:jtubau
- refactor: refs #8626 enhance Worker and Agency components with data attributes and improved routing by:jtubau
- refactor: refs #8626 improve test messages and selectors in route tests by:jtubau
- refactor: refs #8626 update button styles and improve route redirection logic by:jtubau
- refactor: refs #8626 update RouteList columns and enable AgencyWorkCenter tests by:jtubau
- refactor: refs #8630 add vehicle translations and enhance route list columns by:jtubau
- refactor: refs #8648 update roadmap deletion test to use current element text by:jtubau
- refactor: refs #8664 enhance CmrList component with query initialization and user parameters by:jtubau
- refactor: refs #8664 localization files by:jtubau
- refactor: refs #8664 remove CmrFilter and replace with VnSearchbar in CmrList by:jtubau
- refactor: remove unnecessary login and reload calls in ClaimDevelopment tests by:alexm
- refactor: simplify client selection in order creation test by:alexm
- refactor: update client ID input selector and remove viewport setting by:alexm
- test: refs #8197 comment out ticket list tests for refactoring by:alexm
- test: refs #8626 refactor notification check in routeList.spec.js by:jtubau
- test: refs #8626 refactor routeList.spec.js to use a constant for summary URL by:jtubau
- test: refs #8626 refactor routeList.spec.js to use selectors and improve readability by:jtubau
### Fixed 🛠️
- fix: add --init flag to Docker container for Cypress tests by:alexm
- fix: agency list filters by:jtubau
- fix: align Article label to the left in EntryBuys component by:alexm
- fix: card descriptor imports by:Jon
- fix: card descriptor merge by:Jon
- fix(ClaimAction): update shelving options to use URL instead of static data by:jgallego
- fix(ClaimSummary): clean url by:alexm
- fix(cypress.config.js): refs #6695 update reporter to junit and remove unused dependencies by:alexm
- fix(cypressParallel.sh): refs #6695 improve script readability by:alexm
- fix(cypressParallel.sh): refs #6695 improve test execution output for clarity by:alexm
- fix(cypressParallel.sh): refs #6695 simplify test execution output format by:alexm
- fix(cypress scripts): refs #6695 improve cleanup process and adjust output redirection by:alexm
- fix: fixed department descriptor icon by:Jon
- fix: fixed submodule descriptors icons by:Jon
- fix(invoiceOutSummary.spec.js): refs #6695 remove unnecessary visibility check for descriptor by:alexm
- fix(Jenkinsfile): reduce parallel Cypress test execution from 3 to 2 by:alexm
- fix(Jenkinsfile): refs #6695 add credentials for Docker login in E2E stage by:alexm
- fix(Jenkinsfile): refs #6695 change parallel test execution from 4 to 2 by:alexm
- fix(Jenkinsfile): refs #6695 increase parallel test execution from 2 to 4 by:alexm
- fix(Jenkinsfile): refs #6695 update parallel test execution to 4 by:alexm
- fix(LeftMenu): refs #8197 handle missing children in findRoute and update menu structure by:alexm
- fix: refs #6695 update Cypress configuration and test result paths by:alexm
- fix: refs #6695 update Jenkinsfile to build Docker image correctly and modify logout test visit method by:alexm
- fix: refs #6695 update Jenkinsfile to remove specific e2e XML files and adjust Cypress parallel execution by:alexm
- fix: refs #6695 update Jenkinsfile to source cypressParallel.sh correctly by:alexm
- fix: refs #6695 update visit method in TicketLackDetail.spec.js to prevent page reload by:alexm
- fix: refs #6802 update import path for DepartmentDescriptorProxy in OrderList.vue by:jgallego
- fix: refs #6802 update OrderFilter to use department relation instead of salesPerson by:jgallego
- fix: refs #8041 update redirection from preview to summary in ShelvingList tests by:benjaminedc
- fix: refs #8041 update selector for summary header in ParkingList tests by:benjaminedc
- fix: refs #8041 update summaryHeader selector in ParkingList test by:benjaminedc
- fix: refs #8322 update order property for WagonList component by:alexm
- fix: refs #8370 change param rely on month by:Jon
- fix: refs #8417 added data-cy to all files and fixed test by:provira
- fix: refs #8417 added data-cy to delete button by:provira
- fix: refs #8417 fixed claimPhoto e2e by:provira
- fix: refs #8417 fixed claimPhoto e2e test by:provira
- fix: refs #8417 fixed e2e test by:provira
- fix: refs #8417 fixed e2e test case by:provira
- fix: refs #8417 fixed failing test case by:provira
- fix: refs #8417 fixed invoiceOutSummary e2e test by:provira
- fix: refs #8417 removed .only by:provira
- fix: refs #8583 basicData, business, summary by:carlossa
- fix: refs #8583 basicData e2e by:carlossa
- fix: refs #8583 basicData timeControl by:carlossa
- fix: refs #8583 cypressconf by:carlossa
- fix: refs #8583 dataCy operator by:carlossa
- fix: refs #8583 fix AddCard by:carlossa
- fix: refs #8583 mutual create by:carlossa
- fix: refs #8583 operator by:carlossa
- fix: refs #8583 remove workerTimeControl by:carlossa
- fix: refs #8583 tMutual, tNotes, TOperator by:carlossa
- fix: refs #8583 wBusiness by:carlossa
- fix: refs #8583 wBusiness e2e by:carlossa
- fix: refs #8583 workerBasicData & workerTimeControl by:carlossa
- fix: refs #8583 workerBusiness by:carlossa
- fix: refs #8583 workerBusiness e2e by:carlossa
- fix: refs #8583 workerBusiness test by:carlossa
- fix: refs #8583 workerE2E by:carlossa
- fix: refs #8583 worker mutual e2e by:carlossa
- fix: refs #8583 workerSummary test by:carlossa
- fix: refs #8583 workerTimeControl by:carlossa
- fix: refs #8583 workerTimeControl e2e by:carlossa
- fix: refs #8600 e2e by:Jon
- fix: refs #8600 fixed calendar e2e by:Jon
- fix: refs #8600 fixed e2e and skip client ones by:Jon
- fix: refs #8600 fixed e2e by:Jon
- fix: refs #8600 fixed invoiceOut summary e2e by:Jon
- fix: refs #8600 fixed zoneList & added test case to zoneSummary by:provira
- fix: refs #8600 zone basic data e2e and skip intermitent invoice out summary it by:Jon
- fix: refs #8602 delete unused entryDms and stockBought test files (origin/8581-e2eInvoiceIn) by:pablone
- fix: refs #8606 deleted code by:Jon
- fix: refs #8612 changed QCheckbox for VnCheckbox by:provira
- fix: refs #8612 fixed shelving e2e tests by:provira
- fix: refs #8616 add conditional for SupplierDescriptorProxy and bind attributes in CardDescriptor by:jtubau
- fix: refs #8616 remove redundant v-on binding from QCheckbox in VnCheckbox.vue by:jtubau
- fix: refs #8616 update binding syntax for is-editable prop in AgencyList.vue by:jtubau
- fix: refs #8616 update FormModel prop from 'update-url' to 'url-update' in Agency and RoadMap BasicData by:jtubau
- fix: refs #8619 handle empty ticket records in RouteDescriptor component by:jtubau
- fix: refs #8619 update route descriptor to handle empty ticket records and adjust test cases by:jtubau
- fix: refs #8626 remove duplicate ref attribute from RouteList.vue by:jtubau
- fix: refs #8630 remove duplicated locations by:jtubau
- fix: refs #8638 restore invoiceInBasicData by:pablone
- fix: refs #8638 update comment formatting in VnTable.vue by:pablone
- fix: refs #8638 update null check for maxlength validation in VnInput.vue by:pablone
- fix: simplify menu structure in monitor router module (origin/fix_monitor_leftMenu) by:Javier Segarra
- refactor: refs #6695 fix invoiceOutSummary by:alexm
- refactor: refs #8606 deleted code and fixed translation by:Jon
- test: fix intermitent e2e by:alexm
- test: fix orderList e2e, unestables by:alexm
- test(OrderList): fix inconsistency by:alexm
- test(TicketList): fix inconsistency by:alexm
# Version 25.10 - 2025-03-11
### Added 🆕
- chore: refs #6695 empty commit by:alexm
- chore: refs #6695 get docker compose version by:alexm
- chore: refs #6695 try use docker compose by:alexm
- feat: add --browser chromium by:Javier Segarra
- feat: docker pull back image by:alexm
- feat(jenkinsE2E): refs #6695 new image by:alexm
- feat(jenkinsE2E): refs #6695 try fix db by:alexm
- feat(jenkinsE2E): refs #6695 try new sintax by:alexm
- feat(Jenkinsfile): refs #8714 add CHANGE_TARGET environment variable logging (origin/8714-devToTest, 8714-devToTest) by:alexm
- feat: refs #6695 add additional test directories for Cypress integration tests in Jenkinsfile by:alexm
- feat: refs #6695 add cypress-cache volume to docker-compose.e2e.yml by:alexm
- feat: refs #6695 add Dockerfile for Cypress setup and update Jenkinsfile for installation steps by:alexm
- feat: refs #6695 add setup and e2e testing by:alexm
- feat: refs #6695 better stages for e2e by:alexm
- feat: refs #6695 better stages for e2e rollback by:alexm
- feat: refs #6695 install Cypress during Jenkins pipeline setup by:alexm
- feat: refs #6695 jenkins run e2e by:alexm
- feat: refs #6695 jenkins run e2e front deteach by:alexm
- feat: refs #6695 jenkins run e2e rebuild by:alexm
- feat: refs #6695 jenkins run e2e remove ports by:alexm
- feat: refs #6695 jenkins run e2e try down and rm by:alexm
- feat: refs #6695 jenkins run e2e try fix db by:alexm
- feat: refs #6695 jenkins run e2e whitout rebuild by:alexm
- feat: refs #6695 pull salix-back image and use by:alexm
- feat: refs #6695 run e2e in docker by:alexm
- feat: refs #6695 run front by:alexm
- feat: refs #6695 run front quasar build by:alexm
- feat: refs #6695 run parallel e2e in local by:alexm
- feat: refs #6695 update cypress cache path command in Jenkinsfile by:alexm
- feat: refs #6695 update cypress-cache volume path in docker-compose.e2e.yml by:alexm
- feat: refs #6695 update cypress command in Jenkinsfile and docker-compose.e2e.yml by:alexm
- feat: refs #6695 update Docker configurations and Cypress settings for improved local development (origin/6695-docker_push_2, 6695-docker_push_2) by:alexm
- feat: refs #6695 when failure, clean by:alexm
- feat: refs #7937 add import claim button to ClaimAction component by:jgallego
- feat: refs #7937 add shelving selection to claim actions with data fetching by:jgallego
- feat: refs #8348 Added grouping by:guillermo
- feat: refs #8402 added lost filters from Salix by:Jon
- feat: refs #8484 add addressId to createForm in CustomerDescriptor by:jorgep
- feat: refs #8484 overwrite Cypress visit command to ensure main element exists by:jorgep
- feat: refs #8555 added new filter field and translations by:Jon
- feat: refs #8593 added summary button & modified e2e tests by:provira
- feat: refs #8593 changed parking to VnTable and modified e2e tests by:provira
- feat: refs #8599 added new test and translations by:Jon
- feat: refs #8599 modified tests to be more complete and added new ones by:Jon
- feat: refs #8697 enable data-cy attribute for VnTable, update test cases to remove skips and adjust selectors by:pablone
- feat: rename test:unit by test:front by:Javier Segarra
- feat: try run salix back by:alexm
- fix: style w-80 by:Javier Segarra
- Merge pull request 'fix: style' (!1425) from warmfix_vntable_card_style into test by:Javier Segarra
### Changed 📦
- ci: refs #6695 Docker & Jenkinsfile fixes/refactor by:Juan Ferrer Toribio
- ci: refs #6695 refactor Cypress setup in Jenkinsfile and replace local docker-compose with new configuration by:alexm
- perf: refs #6695 only necessary by:alexm
- refactor: adjust translation to standardize it by:Jon
- refactor: refs #6695 comment out vnComponent tests in Jenkinsfile by:alexm
- refactor: refs #6695 improve group size calculation for parallel test execution in Jenkinsfile by:alexm
- refactor: refs #6695 improve parallel test execution logic in Jenkinsfile by:alexm
- refactor: refs #6695 simplify Docker cleanup commands in Jenkinsfile by:alexm
- refactor: refs #6695 update Docker setup for Cypress and remove obsolete files by:alexm
- refactor: refs #6695 update E2E test execution to support parallel groups and improve by:alexm
- refactor: refs #6695 update Jenkinsfile and Dockerfile to use 'developer' by:alexm
- refactor: refs #6695 update Jenkinsfile to run E2E tests in parallel and simplify docker-compose command by:alexm
- refactor: refs #6897 clean up Cypress configuration and improve entry list filtering (origin/6897-fixEntryE2e) by:pablone
- refactor: refs #7414 update VnLog component to change display order value changes on update action by:jtubau
- refactor: refs #7937 align columns to the right and add shelvingCode to ClaimSummaryAction by:jgallego
- refactor: refs #8484 add data-cy attribute for claim photo image and update test to use it by:jorgep
- refactor: refs #8484 clean up test files by removing commented issue references and updating test cases by:jorgep
- refactor: refs #8484 enhance login command with session management and clean up unused commands by:jtubau
- refactor: refs #8484 improve search input behavior and enhance visit command with DOM content load by:jtubau
- refactor: refs #8484 improve selectOption command with retry logic for visibility checks by:jtubau
- refactor: refs #8484 remove comment in wagonCreate.spec.js by:jtubau
- refactor: refs #8484 remove redundant visit command overwrite by:jorgep
- refactor: refs #8484 remove unnecessary domContentLoad calls from client tests by:jorgep
- refactor: refs #8484 remove unnecessary intercepts and waits in ticket and zone tests by:jorgep
- refactor: refs #8484 simplify image dialog test by using aliases for elements by:jorgep
- refactor: refs #8484 streamline assertions in ClaimNotes test by:jorgep
- refactor: refs #8484 streamline login command and remove commented code by:jorgep
- refactor: refs #8484 update specPattern to include all spec files and remove data-cy attribute by:jorgep
- refactor: refs #8594 update vehicle summary tests to use expected variable for consistency by:jtubau
- refactor: refs #8599 corrected it name by:Jon
- refactor: refs #8599 invoice out list e2e by:Jon
- refactor: refs #8599 requested changes by:Jon
- refactor: refs #8606 modified table height and deleted void file by:Jon
- refactor: refs #8606 modified table width and order by:Jon
- refactor: refs #8606 modified upcoming deliveries view by:Jon
- refactor: refs #8606 translations by:Jon
- refactor: refs #8618 simplify selectors and improve test readability in routeExtendedList.spec.js by:jtubau
- refactor: refs #8620 update RouteAutonomous to notify on data save and change invoice reference display by:jtubau
- refactor: remove default browser setting from Cypress configuration by:alexm
- refactor: remove unused variables by:alexm
- refactor: skip claimNotes by:alexm
- refactor: update labels and conditions in Claim components by:jgallego
- refactor: use constant for account input selector in VnAccountNumber tests by:alexm
### Fixed 🛠️
- build: refs #6695 cypress-setup fix volume by:alexm
- build: refs #6695 cypress-setup fix volume (origin/6695-docker_push, 6695-docker_push) by:alexm
- ci: refs #6695 cypress reporter fix by:Juan Ferrer Toribio
- ci: refs #6695 Docker & Jenkinsfile fixes/refactor by:Juan Ferrer Toribio
- ci: refs #6695 JUnit report fixes by:Juan Ferrer Toribio
- ci: refs #6695 vitest junit file fix by:Juan Ferrer Toribio
- feat(jenkinsE2E): refs #6695 try fix db by:alexm
- feat: refs #6695 jenkins run e2e try fix db by:alexm
- fix: add data-cy attribute to card button for improved testing by:jtubau
- fix: added lost code by:Jon
- fix: add --init flag to Cypress Docker container for improved stability by:alexm
- fix: add mapper before Save by:Javier Segarra
- fix: cy.domContentLoad(); not exist by:alexm
- fix: elements position by:Javier Segarra
- fix: fixed select not filtering when typing by:Jon
- fix: fixed wagonTypeCreate test (origin/wagonTypeTestFix) by:PAU ROVIRA ROSALENY
- fix: fix sctions by:carlossa
- fix(Jenkinsfile): enhance Docker registry credentials handling with dynamic URL (origin/warmFix_use_withDockerRegistry, warmFix_use_withDockerRegistry) by:alexm
- fix(Jenkinsfile): update Docker registry credentials handling in E2E stage by:alexm
- fix: junit report by:alexm
- fix: merge revert by:alexm
- fix: merge test to dev by:alexm
- fix: prevent 'cypress run' error to show junit by:alexm
- fix: refs #6695 add --volumes flag to docker-compose down command by:alexm
- fix: refs #6695 checkErrors(folderName) by:alexm
- fix: refs #6695 clientBasicData by:alexm
- fix: refs #6695 dockerFile by:alexm
- fix: refs #6695 e2e.sh by:alexm
- fix: refs #6695 e2e stockBought by:alexm
- fix: refs #6695 fix e2e's by:alexm
- fix: refs #6695 storage by:alexm
- fix: refs #6695 try by:alexm
- fix: refs #6695 try parallel by:alexm
- fix: refs #6695 update Cypress cache handling and increase wait timeout for elements by:alexm
- fix: refs #6695 update Cypress configuration and Docker setup for improved testing by:alexm
- fix: refs #6695 update E2E stages to run tests in parallel for specific folders by:alexm
- fix: refs #6695 update remove Cypress installation by:alexm
- fix: refs #6695 zoneWarehouse est by:alexm
- fix: refs #6943 e2e clientList, formModel by:carlossa
- fix: refs #6943 formModel workerDepartment by:carlossa
- fix: refs #7323 e2e (origin/7323-fixe2e) by:carlossa
- fix: refs #7323 notification manager by:carlossa
- fix: refs #7414 updated default value rendering for non-update scenarios by:jtubau
- fix: refs #7414 update VnLog.vue to correctly display log actions and values by:jtubau
- fix: refs #7937 update claimId in ClaimAction test to reflect correct value (origin/7937-claimAgile) by:jgallego
- fix: refs #8484 ensure document is fully loaded before visiting pages in tests by:jorgep
- fix: refs #8484 fixed some tests to enable previously skipped cases and enhance functionality by:jtubau
- fix: refs #8484 remove unused addressId from createForm in CustomerDescriptor.vue by:jtubau
- fix: refs #8484 rollback by:jorgep
- fix: refs #8484 update Boss field type to 'selectWorker' and add selectWorkerOption command by:jtubau
- fix: refs #8484 update Boss type from 'selectWorker' to 'select' by:jorgep
- fix: refs #8484 update parking list URL to correct shelving path in integration test by:jtubau
- fix: refs #8484 update selector for buyLabel button in myEntry test by:jtubau
- fix: refs #8484 update selector for removing wagon type in wagonCreate.spec.js by:jtubau
- fix: refs #8484 update wagon type deletion selector and clean up unused code in commands.js by:jtubau
- fix: refs #8593 fixed parking e2e tests by:provira
- fix: refs #8606 fixed list e2e test by:Jon
- fix: refs #8620 add module name to InvoiceInSummary by:jtubau
- fix: refs #8623 fixed different errors by:Jon
- fix: remove info by:carlossa
- fix: remove old end-to-end test files before building Docker image by:alexm
- fix: revert cypress.config by:alexm
- fix: style w-80 by:Javier Segarra
- fix: unnecessary function by:alexm
- fix: update docker-compose command to remove volumes on teardown by:alexm
- fix: update Jenkinsfile to remove specific end-to-end test files by:alexm
- fix: update Jenkinsfile to use environment variable for Docker registry credentials by:alexm
- fix: warmFix vnInput dataCy by:alexm
- Merge pull request 'fix: style' (!1425) from warmfix_vntable_card_style into test by:Javier Segarra
- revert: browser chromium package.json by:Javier Segarra
- Revert "revert 1015acefb7e400be2d8b5958dba69b4d98276b34" by:alexm
- test: refs #6695 e2e fix allowedHosts by:alexm
- test: refs #6695 e2e fix back image by:alexm
- test: refs #6695 e2e fix base urls by:alexm
- test: refs #6695 e2e fix command by:alexm
- test: refs #6695 e2e fix connection db by:alexm
- test: refs #6695 e2e fix network by:alexm
- test: refs #6695 e2e fix sequential by:alexm
- test: refs #6695 fix e2e by:alexm
- test: refs #6695 fix e2e command by:alexm
- test: refs #6695 fix selectOption command by:alexm
# Version 25.08 - 2025-03-04
### Added 🆕
- feat: add order for table (origin/8681_ticketAdvance_updates) by:Javier Segarra
- feat: detect when is descriptor proxy by:Javier Segarra
- feat: refs #7356 update CrudModel by:Javier Segarra
- feat: refs #8242 remove teleport by:Javier Segarra
- feat: refs #8242 use stateStore by:Javier Segarra
- fix: fixed negative bases style by:Jon
- fix: fixed style when clicking on icons by:Jon
- refactor: refs #6897 remove debug logs and unused style (origin/6897-fixSomeCaus) by:pablone
- style: refs #7356 eslint format by:Javier Segarra
### Changed 📦
- perf: refs #7356 minor changes (origin/7356_ticketService) by:Javier Segarra
- refactor: refs #6897 remove debug logs and unused style (origin/6897-fixSomeCaus) by:pablone
- refactor: refs #6897 update component props and attributes for consistency and improved functionality (origin/6897-fixMinorIssues) by:pablone
- refactor: refs #6897 update component props and improve UI handling in Entry pages by:pablone
- refactor: refs #6897 update VnTable components for improved value handling and UI adjustments (origin/6897-minorFixes) by:pablone
- refactor: refs #8697 simplify date handling in ItemDiary component by:pablone
### Fixed 🛠️
- fix: add datakey by:Javier Segarra
- fix: fixed account descriptor menu and created e2e by:Jon
- fix: fixed negative bases style by:Jon
- fix: fixed style when clicking on icons by:Jon
- fix: refs #6553 workerBusiness (origin/6553-fixWorkerBusinessV2) by:carlossa
- fix: refs #6553 workerBusiness v3 by:carlossa
- fix: refs #6897 prevent default event behavior in autocompleteExpense function by:pablone
- fix: refs #7356 chaining params by:Javier Segarra
- fix: refs #7356 ticketService by:Javier Segarra
- fix: refs #8242 workerDepartmentTree bug (origin/8242_leftMenu_responsive) by:Javier Segarra
- fix: workerBasicData by:carlossa
- Revert "revert 1015acefb7e400be2d8b5958dba69b4d98276b34" (origin/fix_revert_revert, fix_revert_revert) by:alexm
# Version 25.06 - 2025-02-18
### Added 🆕

19
Jenkinsfile vendored
View File

@ -26,7 +26,6 @@ node {
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"
echo "CHANGE_TARGET: ${env.CHANGE_TARGET}"
configFileProvider([
configFile(fileId: 'salix-front.properties',
@ -95,7 +94,7 @@ pipeline {
parallel {
stage('Unit') {
steps {
sh 'pnpm run test:front:ci'
sh 'pnpm run test:unit:ci'
}
post {
always {
@ -108,32 +107,24 @@ pipeline {
}
stage('E2E') {
environment {
CREDS = credentials('docker-registry')
CREDENTIALS = credentials('docker-registry')
COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}"
COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ."
}
steps {
script {
sh 'rm -f junit/e2e-*.xml'
sh 'rm -rf test/cypress/screenshots'
sh 'rm junit/e2e-*.xml || true'
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev'
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh "docker-compose ${env.COMPOSE_PARAMS} pull back"
sh "docker-compose ${env.COMPOSE_PARAMS} pull db"
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
sh 'sh test/cypress/cypressParallel.sh 2'
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
sh 'cypress run --browser chromium || true'
}
}
}
post {
always {
sh "docker-compose ${env.COMPOSE_PARAMS} down -v"
archiveArtifacts artifacts: 'test/cypress/screenshots/**/*', allowEmptyArchive: true
junit(
testResults: 'junit/e2e-*.xml',
allowEmptyResults: true

View File

@ -23,7 +23,7 @@ quasar dev
### Run unit tests
```bash
pnpm run test:front
pnpm run test:unit
```
### Run e2e tests
@ -32,26 +32,8 @@ pnpm run test:front
pnpm run test:e2e
```
### Run e2e parallel
```bash
pnpm run test:e2e:parallel
```
### View e2e parallel report
```bash
pnpm run test:e2e:summary
```
### Build the app for production
```bash
quasar build
```
### Serve the app for production
```bash
quasar build quasar serve dist/spa --host 0.0.0.0 --proxy=./proxy-serve.js
```

View File

@ -1,18 +1,13 @@
import { defineConfig } from 'cypress';
let urlHost, reporter, reporterOptions, timeouts;
let urlHost, reporter, reporterOptions;
if (process.env.CI) {
urlHost = 'front';
reporter = 'junit';
reporterOptions = {
mochaFile: 'junit/e2e-[hash].xml',
};
timeouts = {
defaultCommandTimeout: 30000,
requestTimeout: 30000,
responseTimeout: 60000,
pageLoadTimeout: 60000,
toConsole: false,
};
} else {
urlHost = 'localhost';
@ -25,19 +20,17 @@ if (process.env.CI) {
reportDir: 'test/cypress/reports',
inlineAssets: true,
};
timeouts = {
defaultCommandTimeout: 10000,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
};
}
export default defineConfig({
e2e: {
baseUrl: `http://${urlHost}:9000`,
experimentalStudio: false,
defaultCommandTimeout: 10000,
trashAssetsBeforeRuns: false,
requestTimeout: 10000,
responseTimeout: 30000,
pageLoadTimeout: 60000,
defaultBrowser: 'chromium',
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
@ -57,8 +50,8 @@ export default defineConfig({
},
viewportWidth: 1280,
viewportHeight: 720,
...timeouts,
includeShadowDom: true,
waitForAnimations: true,
},
experimentalMemoryManagement: true,
defaultCommandTimeout: 10000,
numTestsKeptInMemory: 2,
});

View File

@ -25,8 +25,6 @@ RUN apt-get update \
libnss3 \
libxss1 \
libxtst6 \
mesa-vulkan-drivers \
vulkan-tools \
xauth \
xvfb \
&& apt-get clean \
@ -41,7 +39,7 @@ ENV PNPM_HOME="/home/app/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN pnpm setup \
&& pnpm install --global cypress@14.1.0 \
&& pnpm install --global cypress@13.6.6 \
&& cypress install
WORKDIR /app

View File

@ -1,6 +1,6 @@
{
"name": "salix-front",
"version": "25.16.0",
"version": "25.10.0",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",
@ -13,11 +13,9 @@
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
"test:e2e": "cypress open",
"test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run",
"test:e2e:parallel": "bash ./test/cypress/run.sh",
"test:e2e:summary": "bash ./test/cypress/summary.sh",
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
"test:front": "vitest",
"test:front:ci": "vitest run",
"test:unit": "vitest",
"test:unit:ci": "vitest run",
"commitlint": "commitlint --edit",
"prepare": "npx husky install",
"addReferenceTag": "node .husky/addReferenceTag.js",
@ -49,21 +47,18 @@
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
"@vue/test-utils": "^2.4.4",
"autoprefixer": "^10.4.14",
"cypress": "^14.1.0",
"cypress": "^13.6.6",
"cypress-mochawesome-reporter": "^3.8.2",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-vue": "^9.32.0",
"husky": "^8.0.0",
"junit-merge": "^2.0.0",
"mocha": "^11.1.0",
"postcss": "^8.4.23",
"prettier": "^3.4.2",
"sass": "^1.83.4",
"vitepress": "^1.6.3",
"vitest": "^0.34.0",
"xunit-viewer": "^10.6.1"
"vitest": "^0.34.0"
},
"engines": {
"node": "^20 || ^18 || ^16",

File diff suppressed because it is too large Load Diff

View File

@ -181,19 +181,17 @@ async function saveChanges(data) {
return;
}
let changes = data || getChanges();
if ($props.beforeSaveFn) changes = await $props.beforeSaveFn(changes, getChanges);
if ($props.beforeSaveFn) {
changes = await $props.beforeSaveFn(changes, getChanges);
}
try {
if (changes?.creates?.length === 0 && changes?.updates?.length === 0) {
return;
}
await axios.post($props.saveUrl || $props.url + '/crud', changes);
} finally {
isLoading.value = false;
}
originalData.value = JSON.parse(JSON.stringify(formData.value));
if (changes?.creates?.length) await vnPaginateRef.value.fetch();
if (changes.creates?.length) await vnPaginateRef.value.fetch();
hasChanges.value = false;
emit('saveChanges', data);

View File

@ -188,7 +188,7 @@ const selectItem = ({ id }) => {
>
<template #body-cell-id="{ row }">
<QTd auto-width @click.stop>
<QBtn flat class="link">{{ row.id }}</QBtn>
<QBtn flat color="blue">{{ row.id }}</QBtn>
<ItemDescriptorProxy :id="row.id" />
</QTd>
</template>

View File

@ -124,7 +124,7 @@ const selectTravel = ({ id }) => {
<FetchData
url="AgencyModes"
@on-fetch="(data) => (agenciesOptions = data)"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
auto-load
/>
<FetchData
@ -196,7 +196,7 @@ const selectTravel = ({ id }) => {
>
<template #body-cell-id="{ row }">
<QTd auto-width @click.stop data-cy="travelFk-travel-form">
<QBtn flat class="link">{{ row.id }}</QBtn>
<QBtn flat color="blue">{{ row.id }}</QBtn>
<TravelDescriptorProxy :id="row.id" />
</QTd>
</template>

View File

@ -198,7 +198,8 @@ const setCategoryList = (data) => {
v-model="params.typeFk"
:options="itemTypesOptions"
dense
filled
outlined
rounded
use-input
:disable="!selectedCategoryFk"
@update:model-value="
@ -234,7 +235,8 @@ const setCategoryList = (data) => {
v-model="value.selectedTag"
:options="tagOptions"
dense
filled
outlined
rounded
:emit-value="false"
use-input
:is-clearable="false"
@ -250,7 +252,8 @@ const setCategoryList = (data) => {
option-value="value"
option-label="value"
dense
filled
outlined
rounded
emit-value
use-input
:disable="!value"
@ -262,6 +265,7 @@ const setCategoryList = (data) => {
v-model="value.value"
:label="t('components.itemsFilterPanel.value')"
:disable="!value"
is-outlined
:is-clearable="false"
@keyup.enter="applyTags(params, searchFn)"
/>

View File

@ -77,7 +77,6 @@ watch(
function findMatches(search, item) {
const matches = [];
function findRoute(search, item) {
if (!item?.children) return;
for (const child of item.children) {
if (search?.indexOf(child.name) > -1) {
matches.push(child);
@ -93,7 +92,7 @@ function findMatches(search, item) {
}
function addChildren(module, route, parent) {
const menus = route?.meta?.menu;
const menus = route?.meta?.menu ?? route?.menus?.[props.source]; //backwards compatible
if (!menus) return;
const matches = findMatches(menus, route);
@ -108,7 +107,11 @@ function getRoutes() {
main: getMainRoutes,
card: getCardRoutes,
};
handleRoutes[props.source]();
try {
handleRoutes[props.source]();
} catch (error) {
throw new Error(`Method is not defined`);
}
}
function getMainRoutes() {
const modules = Object.assign([], navigation.getModules().value);
@ -119,6 +122,7 @@ function getMainRoutes() {
);
if (!moduleDef) continue;
item.children = [];
addChildren(item.module, moduleDef, item.children);
}
@ -128,18 +132,23 @@ function getMainRoutes() {
function getCardRoutes() {
const currentRoute = route.matched[1];
const currentModule = toLowerCamel(currentRoute.name);
let moduleDef;
let index = route.matched.length - 1;
while (!moduleDef && index > 0) {
if (route.matched[index]?.meta?.menu) moduleDef = route.matched[index];
index--;
}
let moduleDef = routes.find((route) => toLowerCamel(route.name) === currentModule);
if (!moduleDef) return;
if (!moduleDef?.menus) moduleDef = betaGetRoutes();
addChildren(currentModule, moduleDef, items.value);
}
function betaGetRoutes() {
let menuRoute;
let index = route.matched.length - 1;
while (!menuRoute && index > 0) {
if (route.matched[index]?.meta?.menu) menuRoute = route.matched[index];
index--;
}
return menuRoute;
}
async function togglePinned(item, event) {
if (event.defaultPrevented) return;
event.preventDefault();

View File

@ -1,5 +1,5 @@
<script setup>
import { onMounted, ref, computed } from 'vue';
import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore';
@ -18,14 +18,6 @@ const state = useState();
const user = state.getUser();
const appName = 'Lilium';
const pinnedModulesRef = ref();
const hostname = window.location.hostname;
const env = ref();
const getEnvironment = computed(() => {
env.value = hostname.split('-');
if (env.value.length <= 1) return;
return env.value[0];
});
onMounted(() => stateStore.setMounted());
const refresh = () => window.location.reload();
@ -57,9 +49,6 @@ const refresh = () => window.location.reload();
{{ t('globals.backToDashboard') }}
</QTooltip>
</QBtn>
<QBadge v-if="getEnvironment" color="primary" align="top">
{{ getEnvironment }}
</QBadge>
</RouterLink>
<VnBreadcrumbs v-if="$q.screen.gt.sm" />
<QSpinner
@ -68,7 +57,7 @@ const refresh = () => window.location.reload();
:class="{
'no-visible': !stateQuery.isLoading().value,
}"
size="sm"
size="xs"
data-cy="loading-spinner"
/>
<QSpace />

View File

@ -12,31 +12,20 @@ defineProps({ row: { type: Object, required: true } });
>
<QIcon name="vn:claims" size="xs">
<QTooltip>
{{ $t('ticketSale.claim') }}:
{{ t('ticketSale.claim') }}:
{{ row.claim?.claimFk }}
</QTooltip>
</QIcon>
</router-link>
<QIcon
v-if="row?.isDeleted"
color="primary"
name="vn:deletedTicket"
size="xs"
data-cy="ticketDeletedIcon"
>
<QTooltip>
{{ t('Ticket deleted') }}
</QTooltip>
</QIcon>
<QIcon
v-if="row?.hasRisk"
v-if="row?.risk"
name="vn:risk"
:color="row.hasHighRisk ? 'negative' : 'primary'"
size="xs"
>
<QTooltip>
{{ $t('salesTicketsTable.risk') }}:
{{ toCurrency(row.risk - (row.credit ?? 0)) }}
{{ toCurrency(row.risk - row.credit) }}
</QTooltip>
</QIcon>
<QIcon
@ -78,7 +67,12 @@ defineProps({ row: { type: Object, required: true } });
>
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
</QIcon>
<QIcon v-if="row?.isTaxDataChecked" name="vn:no036" color="primary" size="xs">
<QIcon
v-if="row?.isTaxDataChecked !== 0"
name="vn:no036"
color="primary"
size="xs"
>
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
</QIcon>
<QIcon v-if="row?.isFreezed" name="vn:frozen" color="primary" size="xs">

View File

@ -87,7 +87,7 @@ const makeInvoice = async () => {
(data) => (
(rectificativeTypeOptions = data),
(transferInvoiceParams.cplusRectificationTypeFk = data.filter(
(type) => type.description == 'I Por diferencias',
(type) => type.description == 'I Por diferencias'
)[0].id)
)
"
@ -100,7 +100,7 @@ const makeInvoice = async () => {
(data) => (
(siiTypeInvoiceOutsOptions = data),
(transferInvoiceParams.siiTypeInvoiceOutFk = data.filter(
(type) => type.code == 'R4',
(type) => type.code == 'R4'
)[0].id)
)
"
@ -122,6 +122,7 @@ const makeInvoice = async () => {
<VnRow>
<VnSelect
:label="t('Client')"
:options="clientsOptions"
hide-selected
option-label="name"
option-value="id"

View File

@ -55,8 +55,6 @@ const $props = defineProps({
},
});
const label = $props.showLabel && $props.column.label ? $props.column.label : '';
const defaultSelect = {
attrs: {
row: $props.row,
@ -64,7 +62,7 @@ const defaultSelect = {
class: 'fit',
},
forceAttrs: {
label,
label: $props.showLabel && $props.column.label,
},
};
@ -76,7 +74,7 @@ const defaultComponents = {
class: 'fit',
},
forceAttrs: {
label,
label: $props.showLabel && $props.column.label,
},
},
number: {
@ -86,7 +84,7 @@ const defaultComponents = {
class: 'fit',
},
forceAttrs: {
label,
label: $props.showLabel && $props.column.label,
},
},
date: {
@ -98,7 +96,7 @@ const defaultComponents = {
class: 'fit',
},
forceAttrs: {
label,
label: $props.showLabel && $props.column.label,
},
},
time: {
@ -107,7 +105,7 @@ const defaultComponents = {
disable: !$props.isEditable,
},
forceAttrs: {
label,
label: $props.showLabel && $props.column.label,
},
},
checkbox: {
@ -127,7 +125,7 @@ const defaultComponents = {
return defaultAttrs;
},
forceAttrs: {
label,
label: $props.showLabel && $props.column.label,
autofocus: true,
},
events: {

View File

@ -6,7 +6,6 @@ import VnSelect from 'components/common/VnSelect.vue';
import VnInput from 'components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnInputTime from 'components/common/VnInputTime.vue';
import VnCheckbox from 'components/common/VnCheckbox.vue';
import VnColumn from 'components/VnTable/VnColumn.vue';
const $props = defineProps({
@ -107,7 +106,7 @@ const components = {
},
},
checkbox: {
component: markRaw(VnCheckbox),
component: markRaw(QCheckbox),
event: updateEvent,
attrs: {
class: $props.showTitle ? 'q-py-sm' : 'q-px-md q-py-xs fit',

View File

@ -70,7 +70,7 @@ function textAlignToFlex(textAlign) {
:style="textAlignToFlex(align)"
>
<span :title="label">{{ label }}</span>
<div v-if="name && (model?.index || vertical)">
<div v-if="name && model?.index">
<QChip
:label="!vertical ? model?.index : ''"
:icon="
@ -83,14 +83,14 @@ function textAlignToFlex(textAlign) {
:size="vertical ? '' : 'sm'"
:class="[
model?.index ? 'color-vn-text' : 'bg-transparent',
vertical ? 'q-mx-none q-py-lg' : '',
vertical ? 'q-px-none' : '',
]"
class="no-box-shadow"
:clickable="true"
style="min-width: 40px; max-height: 30px"
>
<div
class="column justify-center text-center"
class="column flex-center"
v-if="vertical"
:style="!model?.index && 'color: #5d5d5d'"
>

View File

@ -55,10 +55,6 @@ const $props = defineProps({
type: [Function, Boolean],
default: null,
},
rowCtrlClick: {
type: [Function, Boolean],
default: null,
},
redirect: {
type: String,
default: null,
@ -140,7 +136,7 @@ const $props = defineProps({
},
dataCy: {
type: String,
default: 'vnTable',
default: 'vn-table',
},
});
@ -595,17 +591,18 @@ function cardClick(_, row) {
function removeTextValue(data, getChanges) {
let changes = data.updates;
if (changes) {
for (const change of changes) {
for (const key in change.data) {
if (key.endsWith('VnTableTextValue')) {
delete change.data[key];
}
if (!changes) return data;
for (const change of changes) {
for (const key in change.data) {
if (key.endsWith('VnTableTextValue')) {
delete change.data[key];
}
}
data.updates = changes.filter((change) => Object.keys(change.data).length > 0);
}
data.updates = changes.filter((change) => Object.keys(change.data).length > 0);
if ($attrs?.beforeSaveFn) data = $attrs.beforeSaveFn(data, getChanges);
return data;
@ -633,7 +630,6 @@ const rowCtrlClickFunction = computed(() => {
:data-key="$attrs['data-key']"
:columns="columns"
:redirect="redirect"
v-bind="$attrs?.['table-filter']"
>
<template
v-for="(_, slotName) in $slots"
@ -685,7 +681,6 @@ const rowCtrlClickFunction = computed(() => {
@update:selected="emit('update:selected', $event)"
@selection="(details) => handleSelection(details, rows)"
:hide-selected-banner="true"
:data-cy
>
<template #top-left v-if="!$props.withoutHeader">
<slot name="top-left"> </slot>
@ -782,7 +777,6 @@ const rowCtrlClickFunction = computed(() => {
text-overflow: ellipsis;
white-space: nowrap;
"
:data-cy="`vnTableCell_${col.name}`"
>
<slot
:name="`column-${col.name}`"
@ -897,7 +891,7 @@ const rowCtrlClickFunction = computed(() => {
{{ row[splittedColumns.title.name] }}
</span>
</QCardSection>
<!-- Fields -->
<!-- Fields -->
<QCardSection
class="q-pl-sm q-py-xs"
:class="$props.cardClass"
@ -921,24 +915,12 @@ const rowCtrlClickFunction = computed(() => {
:row-index="index"
>
<VnColumn
:column="{
...col,
disable:
col?.component ===
'checkbox'
? true
: false,
}"
:column="col"
:row="row"
:is-editable="false"
v-model="row[col.name]"
component-prop="columnField"
:show-label="
col?.component ===
'checkbox'
? false
: true
"
:show-label="true"
/>
</slot>
</span>
@ -979,8 +961,6 @@ const rowCtrlClickFunction = computed(() => {
v-for="col of cols.filter((cols) => cols.visible ?? true)"
:key="col?.id"
:class="getColAlign(col)"
:style="col?.width ? `max-width: ${col?.width}` : ''"
style="font-size: small"
>
<slot
:name="`column-footer-${col.name}`"
@ -1043,43 +1023,38 @@ const rowCtrlClickFunction = computed(() => {
@on-data-saved="(_, res) => createForm.onDataSaved(res)"
>
<template #form-inputs="{ data }">
<slot name="alter-create" :data="data">
<div :style="createComplement?.containerStyle">
<div
:style="createComplement?.previousStyle"
v-if="!quasar.screen.xs"
>
<slot name="previous-create-dialog" :data="data" />
</div>
<div
class="grid-create"
:style="createComplement?.columnGridStyle"
>
<slot
v-for="column of splittedColumns.create"
:key="column.name"
:name="`column-create-${column.name}`"
:data="data"
:column-name="column.name"
:label="column.label"
>
<VnColumn
:column="{
...column,
...column?.createAttrs,
}"
:row="{}"
default="input"
v-model="data[column.name]"
:show-label="true"
component-prop="columnCreate"
:data-cy="`${column.name}-create-popup`"
/>
</slot>
<slot name="more-create-dialog" :data="data" />
</div>
<div :style="createComplement?.containerStyle">
<div
:style="createComplement?.previousStyle"
v-if="!quasar.screen.xs"
>
<slot name="previous-create-dialog" :data="data" />
</div>
</slot>
<div class="grid-create" :style="createComplement?.columnGridStyle">
<slot
v-for="column of splittedColumns.create"
:key="column.name"
:name="`column-create-${column.name}`"
:data="data"
:column-name="column.name"
:label="column.label"
>
<VnColumn
:column="{
...column,
...{ disable: column?.createDisable ?? false },
}"
:row="{}"
default="input"
v-model="data[column.name]"
:show-label="true"
component-prop="columnCreate"
:data-cy="`${column.name}-create-popup`"
/>
</slot>
<slot name="more-create-dialog" :data="data" />
</div>
</div>
</template>
</FormModelPopup>
</QDialog>
@ -1157,12 +1132,8 @@ es:
.grid-create {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
max-width: 100%;
grid-gap: 20px;
margin: 0 auto;
.col-span-2 {
grid-column: span 2;
}
}
.flex-one {

View File

@ -26,12 +26,7 @@ function columnName(col) {
}
</script>
<template>
<VnFilterPanel
v-bind="$attrs"
:search-button="true"
:disable-submit-event="true"
:search-url
>
<VnFilterPanel v-bind="$attrs" :search-button="true" :disable-submit-event="true">
<template #body="{ params, orders, searchFn }">
<div
class="container"
@ -39,20 +34,13 @@ function columnName(col) {
:key="col.id"
>
<div class="filter">
<slot
:name="`filter-${col.name}`"
:params="params"
:column-name="columnName(col)"
:search-fn
>
<VnFilter
ref="tableFilterRef"
:column="col"
:data-key="$attrs['data-key']"
v-model="params[columnName(col)]"
:search-url="searchUrl"
/>
</slot>
<VnFilter
ref="tableFilterRef"
:column="col"
:data-key="$attrs['data-key']"
v-model="params[columnName(col)]"
:search-url="searchUrl"
/>
</div>
<div class="order">
<VnTableOrder
@ -89,13 +77,13 @@ function columnName(col) {
display: flex;
justify-content: center;
align-items: center;
min-height: 45px;
height: 45px;
gap: 10px;
}
.filter {
width: 70%;
min-height: 40px;
height: 40px;
text-align: center;
}
.order {

View File

@ -30,8 +30,8 @@ describe('CrudModel', () => {
saveFn: '',
},
});
wrapper = wrapper.wrapper;
vm = wrapper.vm;
wrapper=wrapper.wrapper;
vm=wrapper.vm;
});
beforeEach(() => {
@ -143,14 +143,14 @@ describe('CrudModel', () => {
});
it('should return true if object is empty', async () => {
dummyObj = {};
result = vm.isEmpty(dummyObj);
dummyObj ={};
result = vm.isEmpty(dummyObj);
expect(result).toBe(true);
});
it('should return false if object is not empty', async () => {
dummyObj = { a: 1, b: 2, c: 3 };
dummyObj = {a:1, b:2, c:3};
result = vm.isEmpty(dummyObj);
expect(result).toBe(false);
@ -158,31 +158,29 @@ describe('CrudModel', () => {
it('should return true if array is empty', async () => {
dummyArray = [];
result = vm.isEmpty(dummyArray);
result = vm.isEmpty(dummyArray);
expect(result).toBe(true);
});
it('should return false if array is not empty', async () => {
dummyArray = [1, 2, 3];
dummyArray = [1,2,3];
result = vm.isEmpty(dummyArray);
expect(result).toBe(false);
});
})
});
describe('resetData()', () => {
it('should add $index to elements in data[] and sets originalData and formData with data', async () => {
data = [
{
name: 'Tony',
lastName: 'Stark',
age: 42,
},
];
data = [{
name: 'Tony',
lastName: 'Stark',
age: 42,
}];
vm.resetData(data);
expect(vm.originalData).toEqual(data);
expect(vm.originalData[0].$index).toEqual(0);
expect(vm.formData).toEqual(data);
@ -202,7 +200,7 @@ describe('CrudModel', () => {
lastName: 'Stark',
age: 42,
};
vm.resetData(data);
expect(vm.originalData).toEqual(data);
@ -212,19 +210,17 @@ describe('CrudModel', () => {
});
describe('saveChanges()', () => {
data = [
{
name: 'Tony',
lastName: 'Stark',
age: 42,
},
];
data = [{
name: 'Tony',
lastName: 'Stark',
age: 42,
}];
it('should call saveFn if exists', async () => {
await wrapper.setProps({ saveFn: vi.fn() });
vm.saveChanges(data);
expect(vm.saveFn).toHaveBeenCalledOnce();
expect(vm.isLoading).toBe(false);
expect(vm.hasChanges).toBe(false);
@ -233,15 +229,13 @@ describe('CrudModel', () => {
});
it("should use default url if there's not saveFn", async () => {
const postMock = vi.spyOn(axios, 'post');
vm.formData = [
{
name: 'Bruce',
lastName: 'Wayne',
age: 45,
},
];
const postMock =vi.spyOn(axios, 'post');
vm.formData = [{
name: 'Bruce',
lastName: 'Wayne',
age: 45,
}]
await vm.saveChanges(data);

View File

@ -15,7 +15,10 @@ vi.mock('src/router/modules', () => ({
meta: {
title: 'customers',
icon: 'vn:client',
menu: ['CustomerList', 'CustomerCreate'],
},
menus: {
main: ['CustomerList', 'CustomerCreate'],
card: ['CustomerBasicData'],
},
children: [
{
@ -47,6 +50,14 @@ vi.mock('src/router/modules', () => ({
],
},
},
{
path: 'create',
name: 'CustomerCreate',
meta: {
title: 'createCustomer',
icon: 'vn:addperson',
},
},
],
},
],
@ -87,7 +98,7 @@ vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
icon: 'vn:client',
moduleName: 'Customer',
keyBinding: 'c',
menu: ['customer'],
menu: 'customer',
},
},
],
@ -249,6 +260,15 @@ describe('Leftmenu as main', () => {
});
});
it('should handle a single matched route with a menu', () => {
const route = {
matched: [{ meta: { menu: 'customer' } }],
};
const result = vm.betaGetRoutes();
expect(result.meta.menu).toEqual(route.matched[0].meta.menu);
});
it('should get routes for main source', () => {
vm.props.source = 'main';
vm.getRoutes();
@ -331,9 +351,8 @@ describe('addChildren', () => {
it('should handle routes with no meta menu', () => {
const route = {
meta: {
menu: [],
},
meta: {},
menus: {},
};
const parent = [];

View File

@ -56,12 +56,7 @@ async function confirm() {
{{ t('The notification will be sent to the following address') }}
</QCardSection>
<QCardSection class="q-pt-none">
<VnInput
v-model="address"
is-outlined
autofocus
data-cy="SendEmailNotifiactionDialogInput"
/>
<VnInput v-model="address" is-outlined autofocus />
</QCardSection>
<QCardActions align="right">
<QBtn :label="t('globals.cancel')" color="primary" flat v-close-popup />

View File

@ -1,15 +1,15 @@
<script setup>
import { useDialogPluginComponent } from 'quasar';
import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import {useDialogPluginComponent} from 'quasar';
import {useI18n} from 'vue-i18n';
import {computed, ref} from 'vue';
import VnInput from 'components/common/VnInput.vue';
import axios from 'axios';
import useNotify from 'composables/useNotify';
import useNotify from "composables/useNotify";
const MESSAGE_MAX_LENGTH = 160;
const { t } = useI18n();
const { notify } = useNotify();
const {t} = useI18n();
const {notify} = useNotify();
const props = defineProps({
title: {
type: String,
@ -34,7 +34,7 @@ const props = defineProps({
});
const emit = defineEmits([...useDialogPluginComponent.emits, 'sent']);
const { dialogRef, onDialogHide } = useDialogPluginComponent();
const {dialogRef, onDialogHide} = useDialogPluginComponent();
const smsRules = [
(val) => (val && val.length > 0) || t("The message can't be empty"),
@ -43,10 +43,10 @@ const smsRules = [
t("The message it's too long"),
];
const message = ref(t('routeDelay'));
const message = ref('');
const charactersRemaining = computed(
() => MESSAGE_MAX_LENGTH - new Blob([message.value]).size,
() => MESSAGE_MAX_LENGTH - new Blob([message.value]).size
);
const charactersChipColor = computed(() => {
@ -114,7 +114,7 @@ const onSubmit = async () => {
<QTooltip>
{{
t(
'Special characters like accents counts as a multiple',
'Special characters like accents counts as a multiple'
)
}}
</QTooltip>
@ -144,10 +144,7 @@ const onSubmit = async () => {
max-width: 450px;
}
</style>
<i18n>
en:
routeDelay: "Your order has been delayed in transit.\nDelivery will take place throughout the day.\nWe apologize for the inconvenience and appreciate your patience."
es:
Message: Mensaje
Send: Enviar
@ -156,5 +153,4 @@ es:
The destination can't be empty: El destinatario no puede estar vacio
The message can't be empty: El mensaje no puede estar vacio
The message it's too long: El mensaje es demasiado largo
routeDelay: "Retraso en ruta.\nInformamos que la ruta que lleva su pedido ha sufrido un retraso y la entrega se hará a lo largo del día.\nDisculpe las molestias."
</i18n>
</i18n>

View File

@ -1,14 +1,83 @@
<script setup>
import VnInput from './VnInput.vue';
import { useAccountShortToStandard } from 'src/composables/useAccountShortToStandard';
import { nextTick, ref, watch } from 'vue';
import { QInput } from 'quasar';
const model = defineModel({ prop: 'modelValue' });
const $props = defineProps({
modelValue: {
type: String,
default: '',
},
insertable: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
let internalValue = ref($props.modelValue);
watch(
() => $props.modelValue,
(newVal) => {
internalValue.value = newVal;
}
);
watch(
() => internalValue.value,
(newVal) => {
emit('update:modelValue', newVal);
accountShortToStandard();
}
);
const handleKeydown = (e) => {
if (e.key === 'Backspace') return;
if (e.key === '.') {
accountShortToStandard();
// TODO: Fix this setTimeout, with nextTick doesn't work
setTimeout(() => {
setCursorPosition(0, e.target);
}, 1);
return;
}
if ($props.insertable && e.key.match(/[0-9]/)) {
handleInsertMode(e);
}
};
function setCursorPosition(pos, el = vnInputRef.value) {
el.focus();
el.setSelectionRange(pos, pos);
}
const vnInputRef = ref(false);
const handleInsertMode = (e) => {
e.preventDefault();
const input = e.target;
const cursorPos = input.selectionStart;
const { maxlength } = vnInputRef.value;
let currentValue = internalValue.value;
if (!currentValue) currentValue = e.key;
const newValue = e.key;
if (newValue && !isNaN(newValue) && cursorPos < maxlength) {
internalValue.value =
currentValue.substring(0, cursorPos) +
newValue +
currentValue.substring(cursorPos + 1);
}
nextTick(() => {
input.setSelectionRange(cursorPos + 1, cursorPos + 1);
});
};
function accountShortToStandard() {
internalValue.value = internalValue.value?.replace(
'.',
'0'.repeat(11 - internalValue.value.length)
);
}
</script>
<template>
<VnInput
v-model="model"
ref="inputRef"
@keydown.tab="model = useAccountShortToStandard($event.target.value) ?? model"
@input="model = $event.target.value.replace(/[^\d.]/g, '')"
/>
<QInput @keydown="handleKeydown" ref="vnInputRef" v-model="internalValue" />
</template>

View File

@ -1,93 +1,89 @@
<script setup>
import { onBeforeMount, computed, markRaw } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate, onBeforeRouteLeave } from 'vue-router';
import { onBeforeMount, computed } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import { useStateStore } from 'stores/useStateStore';
import useCardSize from 'src/composables/useCardSize';
import VnSubToolbar from '../ui/VnSubToolbar.vue';
const emit = defineEmits(['onFetch']);
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import LeftMenu from 'components/LeftMenu.vue';
import RightMenu from 'components/common/RightMenu.vue';
const props = defineProps({
id: { type: Number, required: false, default: null },
dataKey: { type: String, required: true },
url: { type: String, default: undefined },
idInWhere: { type: Boolean, default: false },
filter: { type: Object, default: () => {} },
descriptor: { type: Object, required: true },
filterPanel: { type: Object, default: undefined },
idInWhere: { type: Boolean, default: false },
searchDataKey: { type: String, default: undefined },
searchbarProps: { type: Object, default: undefined },
redirectOnError: { type: Boolean, default: false },
visual: { type: Boolean, default: true },
});
const route = useRoute();
const stateStore = useStateStore();
const route = useRoute();
const router = useRouter();
const entityId = computed(() => props.id || route?.params?.id);
let arrayData = getArrayData(entityId.value, props.url);
const searchRightDataKey = computed(() => {
if (!props.searchDataKey) return route.name;
return props.searchDataKey;
});
onBeforeRouteLeave(() => {
stateStore.cardDescriptorChangeValue(null);
const arrayData = useArrayData(props.dataKey, {
url: props.url,
userFilter: props.filter,
oneRecord: true,
});
onBeforeMount(async () => {
stateStore.cardDescriptorChangeValue(markRaw(props.descriptor));
const route = router.currentRoute.value;
try {
await fetch(entityId.value);
await fetch(route.params.id);
} catch {
const { matched: matches } = route;
const { matched: matches } = router.currentRoute.value;
const { path } = matches.at(-1);
router.push({ path: path.replace(/:id.*/, '') });
}
});
onBeforeRouteUpdate(async (to, from) => {
if (hasRouteParam(to.params)) {
const { matched } = router.currentRoute.value;
const { name } = matched.at(-3);
if (name) {
router.push({ name, params: to.params });
}
}
if (entityId.value !== to.params.id) await fetch(to.params.id, true);
const id = to.params.id;
if (id !== from.params.id) await fetch(id, true);
});
async function fetch(id, append = false) {
if (props.idInWhere) arrayData.store.filter.where = { id };
else {
arrayData = getArrayData(id);
}
await arrayData.fetch({ append, updateRouter: false });
emit('onFetch', arrayData.store.data);
}
function hasRouteParam(params, valueToCheck = ':addressId') {
return Object.values(params).includes(valueToCheck);
}
function formatUrl(id) {
const newId = id || entityId.value;
const regex = /\/(\d+)/;
if (!regex.test(props.url)) return `${props.url}/${newId}`;
return props.url.replace(regex, `/${newId}`);
}
function getArrayData(id, url) {
return useArrayData(props.dataKey, {
url: url ?? formatUrl(id),
userFilter: props.filter,
oneRecord: true,
});
if (props.idInWhere) arrayData.store.filter.where = { id };
else if (!regex.test(props.url)) arrayData.store.url = `${props.url}/${id}`;
else arrayData.store.url = props.url.replace(regex, `/${id}`);
await arrayData.fetch({ append, updateRouter: false });
}
</script>
<template>
<template v-if="visual">
<VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]">
<RouterView :key="$route.path" />
</div>
</template>
<QDrawer
v-model="stateStore.leftDrawer"
show-if-above
:width="256"
v-if="stateStore.isHeaderMounted()"
>
<QScrollArea class="fit">
<component :is="descriptor" />
<QSeparator />
<LeftMenu source="card" />
</QScrollArea>
</QDrawer>
<slot name="searchbar" v-if="props.searchDataKey">
<VnSearchbar :data-key="props.searchDataKey" v-bind="props.searchbarProps" />
</slot>
<RightMenu>
<template #right-panel v-if="props.filterPanel">
<component :is="props.filterPanel" :data-key="searchRightDataKey" />
</template>
</RightMenu>
<QPageContainer>
<QPage>
<VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]">
<RouterView :key="$route.path" />
</div>
</QPage>
</QPageContainer>
</template>

View File

@ -0,0 +1,74 @@
<script setup>
import { onBeforeMount } from 'vue';
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import { useStateStore } from 'stores/useStateStore';
import useCardSize from 'src/composables/useCardSize';
import LeftMenu from 'components/LeftMenu.vue';
import VnSubToolbar from '../ui/VnSubToolbar.vue';
const props = defineProps({
dataKey: { type: String, required: true },
url: { type: String, default: undefined },
idInWhere: { type: Boolean, default: false },
filter: { type: Object, default: () => {} },
descriptor: { type: Object, required: true },
filterPanel: { type: Object, default: undefined },
searchDataKey: { type: String, default: undefined },
searchbarProps: { type: Object, default: undefined },
redirectOnError: { type: Boolean, default: false },
});
const stateStore = useStateStore();
const router = useRouter();
const arrayData = useArrayData(props.dataKey, {
url: props.url,
userFilter: props.filter,
oneRecord: true,
});
onBeforeMount(async () => {
const route = router.currentRoute.value;
try {
await fetch(route.params.id);
} catch {
const { matched: matches } = route;
const { path } = matches.at(-1);
router.push({ path: path.replace(/:id.*/, '') });
}
});
onBeforeRouteUpdate(async (to, from) => {
if (hasRouteParam(to.params)) {
const { matched } = router.currentRoute.value;
const { name } = matched.at(-3);
if (name) {
router.push({ name, params: to.params });
}
}
const id = to.params.id;
if (id !== from.params.id) await fetch(id, true);
});
async function fetch(id, append = false) {
const regex = /\/(\d+)/;
if (props.idInWhere) arrayData.store.filter.where = { id };
else if (!regex.test(props.url)) arrayData.store.url = `${props.url}/${id}`;
else arrayData.store.url = props.url.replace(regex, `/${id}`);
await arrayData.fetch({ append, updateRouter: false });
}
function hasRouteParam(params, valueToCheck = ':addressId') {
return Object.values(params).includes(valueToCheck);
}
</script>
<template>
<Teleport to="#left-panel" v-if="stateStore.isHeaderMounted()">
<component :is="descriptor" />
<QSeparator />
<LeftMenu source="card" />
</Teleport>
<VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]">
<RouterView :key="$route.path" />
</div>
</template>

View File

@ -27,11 +27,7 @@ const checkboxModel = computed({
</script>
<template>
<div>
<QCheckbox
v-bind="$attrs"
v-model="checkboxModel"
:data-cy="$attrs['data-cy'] ?? `vnCheckbox${$attrs['label'] ?? ''}`"
/>
<QCheckbox v-bind="$attrs" v-model="checkboxModel" />
<QIcon
v-if="info"
v-bind="$attrs"

View File

@ -35,10 +35,6 @@ const $props = defineProps({
type: String,
default: null,
},
hasFile: {
type: Boolean,
default: false,
},
});
const warehouses = ref();
@ -94,7 +90,6 @@ function defaultData() {
if ($props.formInitialData) return (dms.value = $props.formInitialData);
return addDefaultData({
reference: route.params.id,
hasFile: $props.hasFile,
});
}
@ -182,7 +177,6 @@ function addDefaultData(data) {
name="vn:attach"
class="cursor-pointer"
@click="inputFileRef.pickFiles()"
data-cy="attachFile"
>
<QTooltip>{{ t('globals.selectFile') }}</QTooltip>
</QIcon>

View File

@ -1,166 +0,0 @@
<script setup>
import VnConfirm from '../ui/VnConfirm.vue';
import VnInput from './VnInput.vue';
import VnDms from './VnDms.vue';
import axios from 'axios';
import { useQuasar } from 'quasar';
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { downloadFile } from 'src/composables/downloadFile';
const { t } = useI18n();
const quasar = useQuasar();
const documentDialogRef = ref({});
const editDownloadDisabled = ref(false);
const $props = defineProps({
defaultDmsCode: {
type: String,
default: 'invoiceIn',
},
disable: {
type: Boolean,
default: true,
},
data: {
type: Object,
default: null,
},
formRef: {
type: Object,
default: null,
},
});
function deleteFile(dmsFk) {
quasar
.dialog({
component: VnConfirm,
componentProps: {
title: t('globals.confirmDeletion'),
message: t('globals.confirmDeletionMessage'),
},
})
.onOk(async () => {
await axios.post(`dms/${dmsFk}/removeFile`);
$props.formRef.formData.dmsFk = null;
$props.formRef.formData.dms = undefined;
$props.formRef.hasChanges = true;
$props.formRef.save();
});
}
</script>
<template>
<div class="row no-wrap">
<VnInput
:label="t('Document')"
v-model="data.dmsFk"
clearable
clear-icon="close"
class="full-width"
:disable="disable"
/>
<div
v-if="data.dmsFk"
class="row no-wrap q-pa-xs q-gutter-x-xs"
data-cy="dms-buttons"
>
<QBtn
:disable="editDownloadDisabled"
@click="downloadFile(data.dmsFk)"
icon="cloud_download"
color="primary"
flat
:class="{
'no-pointer-events': editDownloadDisabled,
}"
padding="xs"
round
>
<QTooltip>{{ t('Download file') }}</QTooltip>
</QBtn>
<QBtn
:disable="editDownloadDisabled"
@click="
() => {
documentDialogRef.show = true;
documentDialogRef.dms = data.dms;
}
"
icon="edit"
color="primary"
flat
:class="{
'no-pointer-events': editDownloadDisabled,
}"
padding="xs"
round
>
<QTooltip>{{ t('Edit document') }}</QTooltip>
</QBtn>
<QBtn
:disable="editDownloadDisabled"
@click="deleteFile(data.dmsFk)"
icon="delete"
color="primary"
flat
round
:class="{
'no-pointer-events': editDownloadDisabled,
}"
padding="xs"
>
<QTooltip>{{ t('Delete file') }}</QTooltip>
</QBtn>
</div>
<QBtn
v-else
icon="add_circle"
color="primary"
flat
round
v-shortcut="'+'"
padding="xs"
@click="
() => {
documentDialogRef.show = true;
delete documentDialogRef.dms;
}
"
data-cy="dms-create"
>
<QTooltip>{{ t('Create document') }}</QTooltip>
</QBtn>
</div>
<QDialog v-model="documentDialogRef.show">
<VnDms
model="dms"
:default-dms-code="defaultDmsCode"
:form-initial-data="documentDialogRef.dms"
:url="
documentDialogRef.dms
? `Dms/${documentDialogRef.dms.id}/updateFile`
: 'Dms/uploadFile'
"
:description="documentDialogRef.supplierName"
@on-data-saved="
(_, { data }) => {
let dmsData = data;
if (Array.isArray(data)) dmsData = data[0];
formRef.formData.dmsFk = dmsData.id;
formRef.formData.dms = dmsData;
formRef.hasChanges = true;
formRef.save();
}
"
/>
</QDialog>
</template>
<i18n>
es:
Document: Documento
Download file: Descargar archivo
Edit document: Editar documento
Delete file: Eliminar archivo
Create document: Crear documento
</i18n>

View File

@ -389,7 +389,10 @@ defineExpose({
</div>
</template>
</QTable>
<div v-else class="info-row q-pa-md text-center">
<div
v-else
class="info-row q-pa-md text-center"
>
<h5>
{{ t('No data to display') }}
</h5>
@ -413,7 +416,6 @@ defineExpose({
v-shortcut
@click="showFormDialog()"
class="fill-icon"
data-cy="addButton"
>
<QTooltip>
{{ t('Upload file') }}

View File

@ -1,53 +0,0 @@
<script setup>
import { ref } from 'vue';
import VnSelect from './VnSelect.vue';
const stateBtnDropdownRef = ref();
const emit = defineEmits(['changeState']);
const $props = defineProps({
disable: {
type: Boolean,
default: null,
},
options: {
type: Array,
default: null,
},
optionLabel: {
type: String,
default: 'name',
},
optionValue: {
type: String,
default: 'id',
},
});
async function changeState(value) {
stateBtnDropdownRef.value?.hide();
emit('changeState', value);
}
</script>
<template>
<QBtnDropdown
ref="stateBtnDropdownRef"
color="black"
text-color="white"
:label="$t('globals.changeState')"
:disable="$props.disable"
>
<VnSelect
:options="$props.options"
:option-label="$props.optionLabel"
:option-value="$props.optionValue"
hide-selected
hide-dropdown-icon
focus-on-mount
@update:model-value="changeState"
>
</VnSelect>
</QBtnDropdown>
</template>

View File

@ -83,8 +83,8 @@ const mixinRules = [
requiredFieldRule,
...($attrs.rules ?? []),
(val) => {
const maxlength = $props.maxlength;
if (maxlength && +val?.length > maxlength)
const { maxlength } = vnInputRef.value;
if (maxlength && +val.length > maxlength)
return t(`maxLength`, { value: maxlength });
const { min, max } = vnInputRef.value.$attrs;
if (!min) return null;
@ -108,7 +108,7 @@ const handleInsertMode = (e) => {
e.preventDefault();
const input = e.target;
const cursorPos = input.selectionStart;
const maxlength = $props.maxlength;
const { maxlength } = vnInputRef.value;
let currentValue = value.value;
if (!currentValue) currentValue = e.key;
const newValue = e.key;
@ -143,7 +143,7 @@ const handleUppercase = () => {
:rules="mixinRules"
:lazy-rules="true"
hide-bottom-space
:data-cy="($attrs['data-cy'] ?? $attrs.label) + '_input'"
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
>
<template #prepend v-if="$slots.prepend">
<slot name="prepend" />

View File

@ -107,7 +107,7 @@ const manageDate = (date) => {
@click="isPopupOpen = !isPopupOpen"
@keydown="isPopupOpen = false"
hide-bottom-space
:data-cy="($attrs['data-cy'] ?? $attrs.label) + '_inputDate'"
:data-cy="$attrs.dataCy ?? $attrs.label + '_inputDate'"
>
<template #append>
<QIcon

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted, watch, computed } from 'vue';
import { ref, onUnmounted, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import axios from 'axios';
@ -10,12 +10,12 @@ import { useColor } from 'src/composables/useColor';
import { useCapitalize } from 'src/composables/useCapitalize';
import { useValidator } from 'src/composables/useValidator';
import VnAvatar from '../ui/VnAvatar.vue';
import VnLogValue from './VnLogValue.vue';
import VnJsonValue from '../common/VnJsonValue.vue';
import FetchData from '../FetchData.vue';
import VnSelect from './VnSelect.vue';
import VnUserLink from '../ui/VnUserLink.vue';
import VnPaginate from '../ui/VnPaginate.vue';
import VnLogFilter from 'src/components/common/VnLogFilter.vue';
import RightMenu from './RightMenu.vue';
import { useFilterParams } from 'src/composables/useFilterParams';
const stateStore = useStateStore();
const validationsStore = useValidator();
@ -72,8 +72,39 @@ const filter = {
};
const paginate = ref();
const dataKey = computed(() => `${props.model}Log`);
const userParams = ref(useFilterParams(dataKey.value).params);
const actions = ref();
const changeInput = ref();
const searchInput = ref();
const userRadio = ref();
const userSelect = ref();
const dateFrom = ref();
const dateFromDialog = ref(false);
const dateTo = ref();
const dateToDialog = ref(false);
const selectedFilters = ref({});
const userTypes = [
{ label: 'All', value: undefined },
{ label: 'User', value: { neq: null } },
{ label: 'System', value: null },
];
const checkboxOptions = ref({
insert: {
label: 'Creates',
selected: false,
},
update: {
label: 'Edits',
selected: false,
},
delete: {
label: 'Deletes',
selected: false,
},
select: {
label: 'Accesses',
selected: false,
},
});
let validations = models;
let pointRecord = ref(null);
@ -215,55 +246,131 @@ async function setLogTree(data) {
function filterByRecord(modelLog) {
byRecord.value = true;
const { id, model } = modelLog;
applyFilter({ changedModelId: id, changedModel: model });
searchInput.value = id;
selectedFilters.value.changedModelId = id;
selectedFilters.value.changedModel = model;
applyFilter();
}
async function applyFilter(params = {}) {
paginate.value.arrayData.resetPagination();
paginate.value.arrayData.applyFilter({
filter: {},
params: { originFk: route.params.id, ...params },
});
async function applyFilter() {
filter.where = { and: [] };
if (
!selectedFilters.value.changedModel ||
(!selectedFilters.value.changedModelValue &&
!selectedFilters.value.changedModelId)
)
byRecord.value = false;
if (!byRecord.value) filter.where.and.push({ originFk: route.params.id });
if (Object.keys(selectedFilters.value).length) {
filter.where.and.push(selectedFilters.value);
}
paginate.value.fetch({ filter });
}
function exprBuilder(param, value) {
switch (param) {
case 'changedModelValue':
return { [param]: { like: `%${value}%` } };
case 'change':
if (value)
return {
or: [
{ oldJson: { like: `%${value}%` } },
{ newJson: { like: `%${value}%` } },
{ description: { like: `%${value}%` } },
],
};
break;
case 'action':
if (value?.length) return { [param]: { inq: value } };
break;
function setDate(type) {
let from = dateFrom.value
? date.formatDate(dateFrom.value.split('-').reverse().join('-'), 'YYYY-MM-DD')
: undefined;
from = date.adjustDate(from, { hour: 0, minute: 0, second: 0, millisecond: 0 }, true);
let to = dateTo.value
? date.formatDate(dateTo.value.split('-').reverse().join('-'), 'YYYY-MM-DD')
: date.formatDate(dateFrom.value.split('-').reverse().join('-'), 'YYYY-MM-DD');
to = date.adjustDate(
to,
{ hour: 21, minute: 59, second: 59, millisecond: 999 },
true,
);
switch (type) {
case 'from':
return { creationDate: { gte: value } };
case 'to':
return { creationDate: { lte: value } };
case 'userType':
if (value === 'User') return { userFk: { neq: null } };
if (value === 'System') return { userFk: null };
break;
default:
return { [param]: value };
return { between: [from, to] };
case 'to': {
if (dateFrom.value) {
return {
between: [from, to],
};
}
return { lte: to };
}
}
}
function selectFilter(type, dateType) {
const filter = {};
const actions = { inq: [] };
let reload = true;
if (type === 'search') {
if (/^\s*[0-9]+\s*$/.test(searchInput.value) || props.byRecord) {
selectedFilters.value.changedModelId = searchInput.value.trim();
} else if (!searchInput.value) {
selectedFilters.value.changedModelId = undefined;
selectedFilters.value.changedModelValue = undefined;
} else {
selectedFilters.value.changedModelValue = { like: `%${searchInput.value}%` };
}
}
if (type === 'action' && selectedFilters.value.changedModel === null) {
selectedFilters.value.changedModel = undefined;
}
if (type === 'userRadio') {
selectedFilters.value.userFk = userRadio.value;
}
if (type === 'change') {
if (changeInput.value)
selectedFilters.value.or = [
{ oldJson: { like: `%${changeInput.value}%` } },
{ newJson: { like: `%${changeInput.value}%` } },
{ description: { like: `%${changeInput.value}%` } },
];
else selectedFilters.value.or = undefined;
}
if (type === 'userSelect') {
selectedFilters.value.userFk =
userSelect.value !== null ? userSelect.value : undefined;
}
if (type === 'date') {
if (!dateFrom.value && !dateTo.value) {
selectedFilters.value.creationDate = undefined;
} else if (dateType === 'to') {
selectedFilters.value.creationDate = setDate('to');
} else if (dateType === 'from') {
selectedFilters.value.creationDate = setDate('from');
}
}
Object.keys(checkboxOptions.value).forEach((key) => {
if (checkboxOptions.value[key].selected) actions.inq.push(key);
});
selectedFilters.value.action = actions.inq.length ? actions : undefined;
Object.keys(selectedFilters.value).forEach((key) => {
if (selectedFilters.value[key]) filter[key] = selectedFilters.value[key];
});
if (reload) applyFilter(filter);
}
async function clearFilter() {
selectedFilters.value = {};
byRecord.value = false;
userSelect.value = undefined;
searchInput.value = undefined;
changeInput.value = undefined;
dateFrom.value = undefined;
dateTo.value = undefined;
userRadio.value = undefined;
Object.keys(checkboxOptions.value).forEach(
(opt) => (checkboxOptions.value[opt].selected = false),
);
await applyFilter();
}
onMounted(() => {
stateStore.rightDrawerChangeValue(true);
});
onUnmounted(() => {
stateStore.rightDrawer = false;
});
@ -276,18 +383,32 @@ watch(
);
</script>
<template>
<FetchData
:url="`${props.model}Logs/${route.params.id}/models`"
:filter="{ order: ['changedModel'] }"
@on-fetch="
(data) =>
(actions = data.map((item) => {
const changedModel = item.changedModel;
return {
locale: useCapitalize(
validations[changedModel]?.locale?.name ?? changedModel,
),
value: changedModel,
};
}))
"
auto-load
/>
<VnPaginate
ref="paginate"
:data-key
:url="dataKey + 's'"
:data-key="`${model}Log`"
:url="`${model}Logs`"
:user-filter="filter"
:skeleton="false"
auto-load
@on-fetch="setLogTree"
@on-change="setLogTree"
search-url="logs"
:exprBuilder
:order="['creationDate DESC', 'id DESC']"
>
<template #body>
<div
@ -346,7 +467,6 @@ watch(
backgroundColor: useColor(modelLog.model),
}"
:title="`${modelLog.model} #${modelLog.id}`"
data-cy="vnLog-model-chip"
>
{{ t(modelLog.modelI18n) }}
</QChip>
@ -440,9 +560,10 @@ watch(
value.nameI18n
}}:
</span>
<VnLogValue
:value="value.val"
:name="value.name"
<VnJsonValue
:value="
value.val.val
"
/>
</QItem>
</QCardSection>
@ -460,7 +581,6 @@ watch(
}`,
)
"
data-cy="vnLog-action-icon"
/>
</div>
</QItem>
@ -494,10 +614,7 @@ watch(
>
{{ prop.nameI18n }}:
</span>
<VnLogValue
:value="prop.val"
:name="prop.name"
/>
<VnJsonValue :value="prop.val.val" />
<span
v-if="
propIndex <
@ -525,9 +642,8 @@ watch(
{{ prop.nameI18n }}:
</span>
<span v-if="log.action == 'update'">
<VnLogValue
:value="prop.old"
:name="prop.name"
<VnJsonValue
:value="prop.old.val"
/>
<span
v-if="prop.old.id"
@ -536,9 +652,8 @@ watch(
#{{ prop.old.id }}
</span>
<VnLogValue
:value="prop.val"
:name="prop.name"
<VnJsonValue
:value="prop.val.val"
/>
<span
v-if="prop.val.id"
@ -548,9 +663,8 @@ watch(
</span>
</span>
<span v-else="prop.old.val">
<VnLogValue
:value="prop.val"
:name="prop.name"
<VnJsonValue
:value="prop.val.val"
/>
<span
v-if="prop.old.id"
@ -578,12 +692,176 @@ watch(
</VnPaginate>
<RightMenu>
<template #right-panel>
<VnLogFilter :data-key />
<QList dense>
<QSeparator />
<QItem class="q-mt-sm">
<QInput
:label="t('globals.search')"
v-model="searchInput"
class="full-width"
clearable
clear-icon="close"
@keyup.enter="() => selectFilter('search')"
@focusout="() => selectFilter('search')"
@clear="() => selectFilter('search')"
>
<template #append>
<QIcon name="info" class="cursor-pointer">
<QTooltip>{{ t('tooltips.search') }}</QTooltip>
</QIcon>
</template>
</QInput>
</QItem>
<QItem>
<VnSelect
class="full-width"
:label="t('globals.entity')"
v-model="selectedFilters.changedModel"
option-label="locale"
option-value="value"
:options="actions"
@update:model-value="selectFilter('action')"
hide-selected
/>
</QItem>
<QItem class="q-mt-sm">
<QOptionGroup
size="sm"
v-model="userRadio"
:options="userTypes"
color="primary"
@update:model-value="selectFilter('userRadio')"
right-label
>
<template #label="{ label }">
{{ t(`Users.${label}`) }}
</template>
</QOptionGroup>
</QItem>
<QItem class="q-mt-sm">
<QItemSection v-if="userRadio !== null">
<VnSelect
class="full-width"
:label="t('globals.user')"
v-model="userSelect"
option-label="name"
option-value="id"
:url="`${model}Logs/${route.params.id}/editors`"
:fields="['id', 'nickname', 'name', 'image']"
sort-by="nickname"
@update:model-value="selectFilter('userSelect')"
hide-selected
>
<template #option="{ opt, itemProps }">
<QItem
v-bind="itemProps"
class="q-pa-xs row items-center"
>
<QItemSection class="col-3 items-center">
<VnAvatar :worker-id="opt.id" />
</QItemSection>
<QItemSection class="col-9 justify-center">
<span>{{ opt.name }}</span>
<span class="text-grey">{{ opt.nickname }}</span>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<QItem class="q-mt-sm">
<QInput
:label="t('globals.changes')"
v-model="changeInput"
class="full-width"
clearable
clear-icon="close"
@keyup.enter="selectFilter('change')"
@focusout="selectFilter('change')"
@clear="selectFilter('change')"
>
<template #append>
<QIcon name="info" class="cursor-pointer">
<QTooltip max-width="250px">{{
t('tooltips.changes')
}}</QTooltip>
</QIcon>
</template>
</QInput>
</QItem>
<QItem
:class="index == 'create' ? 'q-mt-md' : 'q-mt-xs'"
v-for="(checkboxOption, index) in checkboxOptions"
:key="index"
>
<QCheckbox
size="sm"
v-model="checkboxOption.selected"
:label="t(`actions.${checkboxOption.label}`)"
@update:model-value="selectFilter"
/>
</QItem>
<QItem class="q-mt-sm">
<QInput
class="full-width"
:label="t('globals.date')"
@click="dateFromDialog = true"
@focus="(evt) => evt.target.blur()"
@clear="selectFilter('date', 'to')"
v-model="dateFrom"
clearable
clear-icon="close"
/>
</QItem>
<QItem class="q-mt-sm">
<QInput
class="full-width"
:label="t('globals.to')"
@click="dateToDialog = true"
@focus="(evt) => evt.target.blur()"
@clear="selectFilter('date', 'from')"
v-model="dateTo"
clearable
clear-icon="close"
/>
</QItem>
</QList>
</template>
</RightMenu>
<QDialog v-model="dateFromDialog">
<QDate
:years-in-month-view="false"
v-model="dateFrom"
dense
flat
minimal
@update:model-value="
(value) => {
dateFromDialog = false;
dateFrom = date.formatDate(value, 'DD-MM-YYYY');
selectFilter('date', 'from');
}
"
/>
</QDialog>
<QDialog v-model="dateToDialog">
<QDate
v-model="dateTo"
dense
flat
minimal
@update:model-value="
(value) => {
dateToDialog = false;
dateTo = date.formatDate(value, 'DD-MM-YYYY');
selectFilter('date', 'to');
}
"
/>
</QDialog>
<QPageSticky position="bottom-right" :offset="[25, 25]">
<QBtn
v-if="Object.keys(userParams).some((filter) => filter !== 'originFk')"
v-if="Object.values(selectedFilters).some((filter) => filter !== undefined)"
color="primary"
icon="filter_alt_off"
size="md"

View File

@ -1,249 +1,77 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnTableFilter from '../VnTable/VnTableFilter.vue';
import VnSelect from './VnSelect.vue';
import { useRoute } from 'vue-router';
import VnInput from './VnInput.vue';
import { ref, computed, watch } from 'vue';
import VnInputDate from './VnInputDate.vue';
import { useFilterParams } from 'src/composables/useFilterParams';
import FetchData from '../FetchData.vue';
import { useValidator } from 'src/composables/useValidator';
import { useCapitalize } from 'src/composables/useCapitalize';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
const $props = defineProps({
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
default: null,
required: true,
},
});
const { t } = useI18n();
const route = useRoute();
const validationsStore = useValidator();
const { models } = validationsStore;
const entities = ref([]);
const editors = ref([]);
const userParams = ref(useFilterParams($props.dataKey).params);
let validations = models;
const userTypes = [
{ value: 'All', label: t(`Users.All`) },
{ value: 'User', label: t(`Users.User`) },
{ value: 'System', label: t(`Users.System`) },
];
const checkboxOptions = ref([
{ name: 'insert', label: 'Creates', selected: false },
{ name: 'update', label: 'Edits', selected: false },
{ name: 'delete', label: 'Deletes', selected: false },
{ name: 'select', label: 'Accesses', selected: false },
]);
const columns = computed(() => [
{ name: 'changedModelValue' },
{ name: 'changedModel' },
{ name: 'userType', orderBy: false },
{ name: 'userFk' },
{ name: 'change', orderBy: false },
{ name: 'action' },
{ name: 'from', orderBy: 'creationDate' },
{ name: 'to', orderBy: 'creationDate' },
]);
const userParamsWatcher = watch(
() => userParams.value,
(params) => {
if (params.action) {
params.action.forEach((option) => {
checkboxOptions.value.find((o) => o.name === option).selected = true;
});
userParamsWatcher();
}
},
);
function getActions() {
const actions = checkboxOptions.value
.filter((option) => option.selected)
?.map((o) => o.name);
return actions.length ? actions : null;
}
const workers = ref();
</script>
<template>
<FetchData
:url="`${dataKey}s/${route.params.id}/models`"
:filter="{ order: ['changedModel'] }"
@on-fetch="
(data) =>
(entities = data.map((item) => {
const changedModel = item.changedModel;
return {
locale: useCapitalize(
validations[changedModel]?.locale?.name ?? changedModel,
),
value: changedModel,
};
}))
"
url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }"
@on-fetch="(data) => (workers = data)"
auto-load
/>
<FetchData
:url="`${dataKey}s/${route.params.id}/editors`"
:filter="{ fields: ['id', 'nickname', 'name', 'image'] }"
sort-by="nickname"
@on-fetch="(data) => (editors = data)"
auto-load
/>
<VnTableFilter
v-if="dataKey"
:data-key
:columns="columns"
:redirect="false"
:hiddenTags="['originFk', 'creationDate']"
:exprBuilder
search-url="logs"
:showTagChips="false"
>
<template #filter-changedModelValue="{ params, columnName, searchFn }">
<VnInput
:label="t('globals.search')"
v-model="params[columnName]"
@keyup.enter="searchFn"
@blur="searchFn"
@remove="searchFn"
:info="t('tooltips.search')"
dense
filled
data-cy="vnLog-search"
/>
</template>
<template #filter-changedModel="{ params, columnName, searchFn }">
<VnSelect
:label="t('globals.entity')"
v-model="params[columnName]"
option-label="locale"
option-value="value"
:options="entities"
@update:model-value="() => searchFn()"
dense
filled
data-cy="vnLog-entity"
/>
</template>
<template #filter-userType="{ params, columnName, searchFn }">
<QOptionGroup
class="text-left"
size="sm"
v-model="params[columnName]"
:options="userTypes"
color="primary"
@update:model-value="
() => {
params.userFk = null;
searchFn();
}
"
/>
</template>
<template #filter-userFk="{ params, columnName, searchFn }">
<VnSelect
:label="t('globals.user')"
v-model="params[columnName]"
:options="editors"
@update:modelValue="() => searchFn()"
:disable="params.userType === 'System'"
dense
filled
>
<template #option="{ opt, itemProps }">
<QItem v-bind="itemProps" class="q-pa-xs row items-center">
<QItemSection class="col-3 items-center">
<VnAvatar :worker-id="opt.id" />
</QItemSection>
<QItemSection class="col-9 justify-center">
<span>{{ opt.name }}</span>
<span class="text-grey">{{ opt.nickname }}</span>
</QItemSection>
</QItem>
</template>
</VnSelect>
</template>
<template #filter-change="{ params, columnName, searchFn }">
<VnInput
:label="t('globals.changes')"
v-model="params[columnName]"
@keyup.enter="searchFn"
@blur="searchFn"
@remove="searchFn"
:info="t('tooltips.changes')"
dense
filled
/>
</template>
<template #filter-action="{ searchFn }">
<div class="column">
<QCheckbox
v-for="checkboxOption in checkboxOptions"
:key="checkboxOption"
size="sm"
v-model="checkboxOption.selected"
:label="t(`actions.${checkboxOption.label}`)"
@update:model-value="
() => searchFn(undefined, 'action', getActions())
"
data-cy="vnLog-checkbox"
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #filter-from="{ params, columnName, searchFn }">
<VnInputDate
:label="t('globals.from')"
v-model="params[columnName]"
<template #body="{ params, searchFn }">
<QDate
v-model="params.created"
@update:model-value="searchFn()"
dense
filled
@update:modelValue="() => searchFn()"
/>
flat
minimal
>
</QDate>
<QSeparator />
<QItem>
<QItemSection v-if="!workers">
<QSkeleton type="QInput" class="full-width" />
</QItemSection>
<QItemSection v-if="workers">
<QSelect
:label="t('User')"
v-model="params.userFk"
@update:model-value="searchFn()"
:options="workers"
option-value="id"
option-label="name"
emit-value
map-options
use-input
:input-debounce="0"
/>
</QItemSection>
</QItem>
</template>
<template #filter-to="{ params, columnName, searchFn }">
<VnInputDate
:label="t('globals.to')"
v-model="params[columnName]"
dense
filled
@update:modelValue="() => searchFn()"
/>
</template>
</VnTableFilter>
</VnFilterPanel>
</template>
<i18n>
es:
tooltips:
search: Buscar por identificador o concepto
changes: Buscar por cambios. Los atributos deben buscarse por su nombre interno, para obtenerlo situar el cursor sobre el atributo.
actions:
Creates: Crea
Edits: Modifica
Deletes: Elimina
Accesses: Accede
Users:
User: Usuario
All: Todo
System: Sistema
params:
changedModel: Entity
<i18n>
en:
tooltips:
search: Search by identifier or concept
changes: Search by changes. Attributes must be searched by their internal name, to get it place the cursor over the attribute.
actions:
Creates: Creates
Edits: Edits
Deletes: Deletes
Accesses: Accesses
Users:
User: User
All: All
System: System
params:
changedModel: Entidad
search: Contains
userFk: User
created: Created
es:
params:
search: Contiene
userFk: Usuario
created: Creada
User: Usuario
</i18n>

View File

@ -1,28 +0,0 @@
<script setup>
import { useDescriptorStore } from 'src/stores/useDescriptorStore';
import VnJsonValue from './VnJsonValue.vue';
import { computed } from 'vue';
const descriptorStore = useDescriptorStore();
const $props = defineProps({
value: { type: Object, default: () => {} },
name: { type: String, default: undefined },
});
const descriptor = computed(() => descriptorStore.has($props.name));
</script>
<template>
<VnJsonValue :value="value.val" />
<span
v-if="(value.id || typeof value.val == 'number') && descriptor"
style="margin-left: 2px"
>
<QIcon
name="launch"
class="link"
:data-cy="'iconLaunch-' + $props.name"
style="padding-bottom: 2px"
/>
<component :is="descriptor" :id="value.id ?? value.val" />
</span>
</template>

View File

@ -12,7 +12,7 @@ const $props = defineProps({
},
});
onMounted(
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false),
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false)
);
const teleportRef = ref({});
@ -35,14 +35,8 @@ onMounted(() => {
<template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8">
<div id="left-panel" ref="teleportRef">
<template v-if="stateStore.cardDescriptor">
<component :is="stateStore.cardDescriptor" />
<QSeparator />
<LeftMenu source="card" />
</template>
<template v-else> <LeftMenu /></template>
</div>
<div id="left-panel" ref="teleportRef"></div>
<LeftMenu v-if="!hasContent" />
</QScrollArea>
</QDrawer>
<QPageContainer>

View File

@ -40,6 +40,10 @@ const $props = defineProps({
type: Boolean,
default: true,
},
keepData: {
type: Boolean,
default: true,
},
});
const route = useRoute();
@ -57,6 +61,7 @@ onBeforeMount(() => {
if ($props.dataKey)
arrayData = useArrayData($props.dataKey, {
searchUrl: 'table',
keepData: $props.keepData,
...$props.arrayDataProps,
navigate: $props.redirect,
});

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, toRefs, computed, watch, onMounted, useAttrs, nextTick } from 'vue';
import { ref, toRefs, computed, watch, onMounted, useAttrs } from 'vue';
import { useI18n } from 'vue-i18n';
import { useArrayData } from 'src/composables/useArrayData';
import { useRequired } from 'src/composables/useRequired';
@ -152,10 +152,6 @@ const value = computed({
},
});
const computedSortBy = computed(() => {
return $props.sortBy || $props.optionLabel + ' ASC';
});
watch(options, (newValue) => {
setOptions(newValue);
});
@ -190,7 +186,7 @@ function findKeyInOptions() {
}
function setOptions(data) {
data = dataByOrder(data, computedSortBy.value);
data = dataByOrder(data, $props.sortBy);
myOptions.value = JSON.parse(JSON.stringify(data));
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
emit('update:options', data);
@ -220,8 +216,7 @@ function filter(val, options) {
async function fetchFilter(val) {
if (!$props.url) return;
const { fields, include, limit } = $props;
const sortBy = computedSortBy.value;
const { fields, include, sortBy, limit } = $props;
const key =
optionFilterValue.value ??
(new RegExp(/\d/g).test(val)
@ -252,7 +247,6 @@ async function fetchFilter(val) {
}
async function filterHandler(val, update) {
if (isLoading.value) return update();
if (!val && lastVal.value === val) {
lastVal.value = val;
return update();
@ -300,7 +294,6 @@ async function onScroll({ to, direction, from, index }) {
await arrayData.loadMore();
setOptions(arrayData.store.data);
vnSelectRef.value.scrollTo(lastIndex);
await nextTick();
isLoading.value = false;
}
}
@ -309,8 +302,6 @@ defineExpose({ opts: myOptions, vnSelectRef });
function handleKeyDown(event) {
if (event.key === 'Tab' && !event.shiftKey) {
event.preventDefault();
const inputValue = vnSelectRef.value?.inputValue;
if (inputValue) {

View File

@ -4,15 +4,12 @@ import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
describe('VnDmsList', () => {
let vm;
const dms = {
userFk: 1,
name: 'DMS 1',
const dms = {
userFk: 1,
name: 'DMS 1'
};
beforeAll(() => {
vi.mock('src/composables/getUrl', () => ({
getUrl: vi.fn().mockResolvedValue(''),
}));
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
vm = createWrapper(VnDmsList, {
props: {
@ -21,8 +18,8 @@ describe('VnDmsList', () => {
filter: 'wd.workerFk',
updateModel: 'Workers',
deleteModel: 'WorkerDms',
downloadModel: 'WorkerDms',
},
downloadModel: 'WorkerDms'
}
}).vm;
});
@ -32,45 +29,46 @@ describe('VnDmsList', () => {
describe('setData()', () => {
const data = [
{
userFk: 1,
{
userFk: 1,
name: 'Jessica',
lastName: 'Jones',
file: '4.jpg',
created: '2021-07-28 21:00:00',
created: '2021-07-28 21:00:00'
},
{
userFk: 2,
{
userFk: 2,
name: 'Bruce',
lastName: 'Banner',
created: '2022-07-28 21:00:00',
dms: {
userFk: 2,
userFk: 2,
name: 'Bruce',
lastName: 'BannerDMS',
created: '2022-07-28 21:00:00',
file: '4.jpg',
},
}
},
{
userFk: 3,
name: 'Natasha',
lastName: 'Romanoff',
file: '4.jpg',
created: '2021-10-28 21:00:00',
},
];
created: '2021-10-28 21:00:00'
}
]
it('Should replace objects that contain the "dms" property with the value of the same and sort by creation date', () => {
vm.setData(data);
expect([vm.rows][0][0].lastName).toEqual('BannerDMS');
expect([vm.rows][0][1].lastName).toEqual('Romanoff');
});
});
describe('parseDms()', () => {
const resultDms = { ...dms, userId: 1 };
const resultDms = { ...dms, userId:1};
it('Should add properties that end with "Fk" by changing the suffix to "Id"', () => {
const parsedDms = vm.parseDms(dms);
expect(parsedDms).toEqual(resultDms);
@ -78,12 +76,12 @@ describe('VnDmsList', () => {
});
describe('showFormDialog()', () => {
const resultDms = { ...dms, userId: 1 };
const resultDms = { ...dms, userId:1};
it('should call fn parseDms() and set show true if dms is defined', () => {
vm.showFormDialog(dms);
expect(vm.formDialog.show).toEqual(true);
expect(vm.formDialog.dms).toEqual(resultDms);
});
});
});
});

View File

@ -108,4 +108,27 @@ describe('VnLog', () => {
expect(vm.logTree[0].originFk).toEqual(1);
expect(vm.logTree[0].logs[0].user.name).toEqual('salesPerson');
});
it('should correctly set the selectedFilters when filtering', () => {
vm.searchInput = '1';
vm.userSelect = '21';
vm.checkboxOptions.insert.selected = true;
vm.checkboxOptions.update.selected = true;
vm.selectFilter('search');
vm.selectFilter('userSelect');
expect(vm.selectedFilters.changedModelId).toEqual('1');
expect(vm.selectedFilters.userFk).toEqual('21');
expect(vm.selectedFilters.action).toEqual({ inq: ['insert', 'update'] });
});
it('should correctly set the date from', () => {
vm.dateFrom = '18-09-2023';
vm.selectFilter('date', 'from');
expect(vm.selectedFilters.creationDate.between).toEqual([
new Date('2023-09-18T00:00:00.000Z'),
new Date('2023-09-18T21:59:59.999Z'),
]);
});
});

View File

@ -1,28 +0,0 @@
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
import { createWrapper } from 'app/test/vitest/helper';
import VnLogFilter from 'src/components/common/VnLogFilter.vue';
describe('VnLogFilter', () => {
let vm;
beforeAll(async () => {
vm = createWrapper(VnLogFilter, {
props: {
dataKey: 'ClaimLog',
},
}).vm;
});
afterEach(() => {
vi.clearAllMocks();
});
it('should getActions selected', async () => {
vm.checkboxOptions.find((o) => o.name == 'insert').selected = true;
vm.checkboxOptions.find((o) => o.name == 'update').selected = true;
const actions = vm.getActions();
expect(actions.length).toEqual(2);
expect(actions).toEqual(['insert', 'update']);
});
});

View File

@ -1,26 +0,0 @@
import { describe, it, expect } from 'vitest';
import VnLogValue from 'src/components/common/VnLogValue.vue';
import { createWrapper } from 'app/test/vitest/helper';
const buildComponent = (props) => {
return createWrapper(VnLogValue, {
props,
global: {},
}).wrapper;
};
describe('VnLogValue', () => {
const id = 1;
it('renders without descriptor', async () => {
expect(getIcon('inventFk').exists()).toBe(false);
});
it('renders with descriptor', async () => {
expect(getIcon('claimFk').text()).toBe('launch');
});
function getIcon(name) {
const wrapper = buildComponent({ value: { val: id }, name });
return wrapper.find('.q-icon');
}
});

View File

@ -1,6 +1,16 @@
import { describe, it, expect, vi, afterEach, beforeEach, afterAll } from 'vitest';
import {
describe,
it,
expect,
vi,
beforeAll,
afterEach,
beforeEach,
afterAll,
} from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import VnNotes from 'src/components/ui/VnNotes.vue';
import vnDate from 'src/boot/vnDate';
describe('VnNotes', () => {
let vm;
@ -8,7 +18,6 @@ describe('VnNotes', () => {
let spyFetch;
let postMock;
let patchMock;
let deleteMock;
let expectedInsertBody;
let expectedUpdateBody;
const defaultOptions = {
@ -48,7 +57,6 @@ describe('VnNotes', () => {
beforeEach(() => {
postMock = vi.spyOn(axios, 'post');
patchMock = vi.spyOn(axios, 'patch');
deleteMock = vi.spyOn(axios, 'delete');
});
afterEach(() => {
@ -145,16 +153,4 @@ describe('VnNotes', () => {
);
});
});
describe('delete', () => {
it('Should call axios.delete with url and vnPaginateRef.fetch', async () => {
generateWrapper();
createSpyFetch();
await vm.deleteNote({ id: 1 });
expect(deleteMock).toHaveBeenCalledWith(`${vm.$props.url}/1`);
expect(spyFetch).toHaveBeenCalled();
});
});
});

View File

@ -1,38 +1,337 @@
<script setup>
import { ref } from 'vue';
import VnDescriptor from './VnDescriptor.vue';
import { onBeforeMount, watch, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
import { useArrayData } from 'composables/useArrayData';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useState } from 'src/composables/useState';
import { useRoute } from 'vue-router';
import { useClipboard } from 'src/composables/useClipboard';
import VnMoreOptions from './VnMoreOptions.vue';
const $props = defineProps({
id: {
type: Number,
default: false,
default: null,
},
card: {
url: {
type: String,
default: '',
},
filter: {
type: Object,
default: null,
},
title: {
type: String,
default: '',
},
subtitle: {
type: Number,
default: null,
},
dataKey: {
type: String,
default: null,
},
summary: {
type: Object,
default: null,
},
width: {
type: String,
default: 'md-width',
},
});
const state = useState();
const route = useRoute();
const { t } = useI18n();
const { copyText } = useClipboard();
const { viewSummary } = useSummaryDialog();
let arrayData;
let store;
let entity;
const isLoading = ref(false);
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
defineExpose({ getData });
onBeforeMount(async () => {
arrayData = useArrayData($props.dataKey, {
url: $props.url,
userFilter: $props.filter,
skip: 0,
oneRecord: true,
});
store = arrayData.store;
entity = computed(() => {
const data = store.data ?? {};
if (data) emit('onFetch', data);
return data;
});
// It enables to load data only once if the module is the same as the dataKey
if (!isSameDataKey.value || !route.params.id || $props.id !== route.params.id)
await getData();
watch(
() => [$props.url, $props.filter],
async () => {
if (!isSameDataKey.value) await getData();
},
);
});
const routeName = computed(() => {
const DESCRIPTOR_PROXY = 'DescriptorProxy';
let name = $props.dataKey;
if ($props.dataKey.includes(DESCRIPTOR_PROXY)) {
name = name.split(DESCRIPTOR_PROXY)[0];
}
return `${name}Summary`;
});
async function getData() {
store.url = $props.url;
store.filter = $props.filter ?? {};
isLoading.value = true;
try {
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
state.set($props.dataKey, data);
emit('onFetch', data);
} finally {
isLoading.value = false;
}
}
function getValueFromPath(path) {
if (!path) return;
const keys = path.toString().split('.');
let current = entity.value;
for (const key of keys) {
if (current[key] === undefined) return undefined;
else current = current[key];
}
return current;
}
function copyIdText(id) {
copyText(id, {
component: {
copyValue: id,
},
});
}
const emit = defineEmits(['onFetch']);
const entity = ref();
const iconModule = computed(() => route.matched[1].meta.icon);
const toModule = computed(() =>
route.matched[1].path.split('/').length > 2
? route.matched[1].redirect
: route.matched[1].children[0].redirect,
);
</script>
<template>
<component
:is="card"
:id
:visual="false"
v-bind="$attrs"
@on-fetch="
(data) => {
entity = data;
emit('onFetch', data);
}
"
/>
<VnDescriptor v-model="entity" v-bind="$attrs">
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
<div class="descriptor">
<template v-if="entity && !isLoading">
<div class="header bg-primary q-pa-sm justify-between">
<slot name="header-extra-action"
><QBtn
round
flat
dense
size="md"
:icon="iconModule"
color="white"
class="link"
:to="$attrs['to-module'] ?? toModule"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}
</QTooltip>
</QBtn></slot
>
<QBtn
@click.stop="viewSummary(entity.id, $props.summary, $props.width)"
round
flat
dense
size="md"
icon="preview"
color="white"
class="link"
v-if="summary"
>
<QTooltip>
{{ t('components.smartCard.openSummary') }}
</QTooltip>
</QBtn>
<RouterLink :to="{ name: routeName, params: { id: entity.id } }">
<QBtn
class="link"
color="white"
dense
flat
icon="launch"
round
size="md"
>
<QTooltip>
{{ t('components.cardDescriptor.summary') }}
</QTooltip>
</QBtn>
</RouterLink>
<VnMoreOptions v-if="$slots.menu">
<template #menu="{ menuRef }">
<slot name="menu" :entity="entity" :menu-ref="menuRef" />
</template>
</VnMoreOptions>
</div>
<slot name="before" />
<div class="body q-py-sm">
<QList dense>
<QItemLabel header class="ellipsis text-h5" :lines="1">
<div class="title">
<span v-if="$props.title" :title="getValueFromPath(title)">
{{ getValueFromPath(title) ?? $props.title }}
</span>
<slot v-else name="description" :entity="entity">
<span :title="entity.name">
{{ entity.name }}
</span>
</slot>
</div>
</QItemLabel>
<QItem>
<QItemLabel class="subtitle">
#{{ getValueFromPath(subtitle) ?? entity.id }}
</QItemLabel>
<QBtn
round
flat
dense
size="sm"
icon="content_copy"
color="primary"
@click.stop="copyIdText(entity.id)"
>
<QTooltip>
{{ t('globals.copyId') }}
</QTooltip>
</QBtn>
</QItem>
</QList>
<div class="list-box q-mt-xs">
<slot name="body" :entity="entity" />
</div>
</div>
<div class="icons">
<slot name="icons" :entity="entity" />
</div>
<div class="actions justify-center" data-cy="descriptor_actions">
<slot name="actions" :entity="entity" />
</div>
<slot name="after" />
</template>
</VnDescriptor>
<!-- Skeleton -->
<SkeletonDescriptor v-if="!entity || isLoading" />
</div>
<QInnerLoading
:label="t('globals.pleaseWait')"
:showing="isLoading"
color="primary"
/>
</template>
<style lang="scss">
.body {
background-color: var(--vn-section-color);
.text-h5 {
font-size: 20px;
padding-top: 5px;
padding-bottom: 0px;
}
.q-item {
min-height: 20px;
.link {
margin-left: 10px;
}
}
.vn-label-value {
display: flex;
padding: 0px 16px;
.label {
color: var(--vn-label-color);
font-size: 14px;
&:not(:has(a))::after {
content: ':';
}
}
.value {
color: var(--vn-text-color);
font-size: 14px;
margin-left: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
}
.info {
margin-left: 5px;
}
}
}
</style>
<style lang="scss" scoped>
.title {
overflow: hidden;
text-overflow: ellipsis;
span {
color: var(--vn-text-color);
font-weight: bold;
}
}
.subtitle {
color: var(--vn-text-color);
font-size: 16px;
margin-bottom: 2px;
}
.list-box {
.q-item__label {
color: var(--vn-label-color);
padding-bottom: 0%;
}
}
.descriptor {
width: 256px;
.header {
display: flex;
align-items: center;
}
.icons {
margin: 0 10px;
display: flex;
justify-content: center;
.q-icon {
margin-right: 5px;
}
}
.actions {
margin: 0 5px;
justify-content: center !important;
}
}
</style>
<i18n>
en:
globals:
copyId: Copy ID
es:
globals:
copyId: Copiar ID
</i18n>

View File

@ -81,7 +81,6 @@ async function fetch() {
name: `${moduleName ?? route.meta.moduleName}Summary`,
params: { id: entityId || entity.id },
}"
data-cy="goToSummaryBtn"
>
<QIcon name="open_in_new" color="white" size="sm" />
</router-link>
@ -159,7 +158,6 @@ async function fetch() {
display: flex;
flex-direction: row;
margin-top: 2px;
align-items: start;
.label {
color: var(--vn-label-color);
width: 9em;
@ -170,10 +168,6 @@ async function fetch() {
flex-grow: 0;
flex-shrink: 0;
}
&.ellipsis > .value {
text-overflow: ellipsis;
white-space: pre;
}
.value {
color: var(--vn-text-color);
overflow: hidden;
@ -206,29 +200,6 @@ async function fetch() {
}
}
}
.vn-card-group {
display: flex;
flex-direction: column;
}
.vn-card-content {
display: flex;
flex-direction: column;
text-overflow: ellipsis;
> div {
max-height: 70px;
}
}
@media (min-width: 1010px) {
.vn-card-group {
flex-direction: row;
}
.vn-card-content {
flex: 1;
}
}
</style>
<style lang="scss" scoped>
.summaryHeader .vn-label-value {

View File

@ -132,8 +132,7 @@ const card = toRef(props, 'item');
display: flex;
flex-direction: column;
gap: 4px;
white-space: nowrap;
width: 192px;
p {
margin-bottom: 0;
}

View File

@ -1,78 +0,0 @@
<script setup>
import { onBeforeMount, watch, computed, ref } from 'vue';
import { useArrayData } from 'composables/useArrayData';
import { useState } from 'src/composables/useState';
import { useRoute } from 'vue-router';
import VnDescriptor from './VnDescriptor.vue';
const $props = defineProps({
url: {
type: String,
default: '',
},
filter: {
type: Object,
default: null,
},
dataKey: {
type: String,
default: null,
},
});
const state = useState();
const route = useRoute();
let arrayData;
let store;
let entity;
const isLoading = ref(false);
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
defineExpose({ getData });
onBeforeMount(async () => {
arrayData = useArrayData($props.dataKey, {
url: $props.url,
userFilter: $props.filter,
skip: 0,
oneRecord: true,
});
store = arrayData.store;
entity = computed(() => {
const data = store.data ?? {};
if (data) emit('onFetch', data);
return data;
});
// It enables to load data only once if the module is the same as the dataKey
if (!isSameDataKey.value || !route.params.id) await getData();
watch(
() => [$props.url, $props.filter],
async () => {
if (!isSameDataKey.value) await getData();
},
);
});
async function getData() {
store.url = $props.url;
store.filter = $props.filter ?? {};
isLoading.value = true;
try {
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
state.set($props.dataKey, data);
emit('onFetch', data);
} finally {
isLoading.value = false;
}
}
const emit = defineEmits(['onFetch']);
</script>
<template>
<VnDescriptor v-model="entity" v-bind="$attrs" :module="dataKey">
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template>
</VnDescriptor>
</template>

View File

@ -1,318 +0,0 @@
<script setup>
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useRoute, useRouter } from 'vue-router';
import { useClipboard } from 'src/composables/useClipboard';
import VnMoreOptions from './VnMoreOptions.vue';
const entity = defineModel({ type: Object, default: null });
const $props = defineProps({
title: {
type: String,
default: '',
},
subtitle: {
type: Number,
default: null,
},
summary: {
type: Object,
default: null,
},
width: {
type: String,
default: 'md-width',
},
module: {
type: String,
default: null,
},
toModule: {
type: Object,
default: null,
},
});
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const { copyText } = useClipboard();
const { viewSummary } = useSummaryDialog();
const DESCRIPTOR_PROXY = 'DescriptorProxy';
const moduleName = ref();
const isSameModuleName = route.matched[1].meta.moduleName !== moduleName.value;
function getName() {
let name = $props.module;
if ($props.module.includes(DESCRIPTOR_PROXY)) {
name = name.split(DESCRIPTOR_PROXY)[0];
}
return name;
}
const routeName = computed(() => {
let routeName = getName();
return `${routeName}Summary`;
});
function getValueFromPath(path) {
if (!path) return;
const keys = path.toString().split('.');
let current = entity.value;
for (const key of keys) {
if (current[key] === undefined) return undefined;
else current = current[key];
}
return current;
}
function copyIdText(id) {
copyText(id, {
component: {
copyValue: id,
},
});
}
const emit = defineEmits(['onFetch']);
const iconModule = computed(() => {
moduleName.value = getName();
if ($props.toModule) {
return router.getRoutes().find((r) => r.name === $props.toModule.name).meta.icon;
}
if (isSameModuleName) {
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
?.meta?.icon;
} else {
return route.matched[1].meta.icon;
}
});
const toModule = computed(() => {
moduleName.value = getName();
if ($props.toModule) return $props.toModule;
if (isSameModuleName) {
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
?.redirect;
} else {
return route.matched[1].path.split('/').length > 2
? route.matched[1].redirect
: route.matched[1].children[0].redirect;
}
});
</script>
<template>
<div class="descriptor" data-cy="vnDescriptor">
<template v-if="entity && entity?.id">
<div class="header bg-primary q-pa-sm justify-between">
<slot name="header-extra-action">
<QBtn
round
flat
dense
size="md"
:icon="iconModule"
color="white"
class="link"
:to="toModule"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}
</QTooltip>
</QBtn>
</slot>
<QBtn
@click.stop="viewSummary(entity.id, summary, width)"
round
flat
dense
size="md"
icon="preview"
color="white"
class="link"
v-if="summary"
data-cy="openSummaryBtn"
>
<QTooltip>
{{ t('components.smartCard.openSummary') }}
</QTooltip>
</QBtn>
<RouterLink :to="{ name: routeName, params: { id: entity.id } }">
<QBtn
class="link"
color="white"
dense
flat
icon="launch"
round
size="md"
data-cy="goToSummaryBtn"
>
<QTooltip>
{{ t('components.vnDescriptor.summary') }}
</QTooltip>
</QBtn>
</RouterLink>
<VnMoreOptions v-if="$slots.menu">
<template #menu="{ menuRef }">
<slot name="menu" :entity="entity" :menu-ref="menuRef" />
</template>
</VnMoreOptions>
</div>
<slot name="before" />
<div class="body q-py-sm">
<QList dense>
<QItemLabel header class="ellipsis text-h5" :lines="1">
<div class="title">
<span
v-if="title"
:title="getValueFromPath(title)"
:data-cy="`${$attrs['data-cy'] ?? 'vnDescriptor'}_title`"
>
{{ getValueFromPath(title) ?? title }}
</span>
<slot v-else name="description" :entity="entity">
<span
:title="entity.name"
:data-cy="`${$attrs['data-cy'] ?? 'vnDescriptor'}_description`"
v-text="entity.name"
/>
</slot>
</div>
</QItemLabel>
<QItem>
<QItemLabel
class="subtitle"
:data-cy="`${$attrs['data-cy'] ?? 'vnDescriptor'}_subtitle`"
>
#{{ getValueFromPath(subtitle) ?? entity.id }}
</QItemLabel>
<QBtn
round
flat
dense
size="sm"
icon="content_copy"
color="primary"
@click.stop="copyIdText(entity.id)"
>
<QTooltip>
{{ t('globals.copyId') }}
</QTooltip>
</QBtn>
</QItem>
</QList>
<div
class="list-box q-mt-xs"
:data-cy="`${$attrs['data-cy'] ?? 'vnDescriptor'}_listbox`"
>
<slot name="body" :entity="entity" />
</div>
</div>
<div class="icons">
<slot name="icons" :entity="entity" />
</div>
<div class="actions justify-center" data-cy="descriptor_actions">
<slot name="actions" :entity="entity" />
</div>
<slot name="after" />
</template>
<SkeletonDescriptor v-if="!entity" />
</div>
<QInnerLoading :label="t('globals.pleaseWait')" :showing="!entity" color="primary" />
</template>
<style lang="scss">
.body {
background-color: var(--vn-section-color);
.text-h5 {
font-size: 20px;
padding-top: 5px;
padding-bottom: 0px;
}
.q-item {
min-height: 20px;
.link {
margin-left: 10px;
}
}
.vn-label-value {
display: flex;
padding: 0px 16px;
.label {
color: var(--vn-label-color);
font-size: 14px;
&:not(:has(a))::after {
content: ':';
}
}
.value {
color: var(--vn-text-color);
font-size: 14px;
margin-left: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
}
.info {
margin-left: 5px;
}
}
}
</style>
<style lang="scss" scoped>
.title {
overflow: hidden;
text-overflow: ellipsis;
span {
color: var(--vn-text-color);
font-weight: bold;
}
}
.subtitle {
color: var(--vn-text-color);
font-size: 16px;
margin-bottom: 2px;
}
.list-box {
.q-item__label {
color: var(--vn-label-color);
padding-bottom: 0%;
}
}
.descriptor {
width: 256px;
.header {
display: flex;
align-items: center;
}
.icons {
margin: 0 10px;
display: flex;
justify-content: center;
.q-icon {
margin-right: 5px;
}
}
.actions {
margin: 0 5px;
justify-content: center !important;
}
}
</style>
<i18n>
en:
globals:
copyId: Copy ID
es:
globals:
copyId: Copiar ID
</i18n>

View File

@ -54,17 +54,13 @@ const $props = defineProps({
default: 'table',
},
redirect: {
type: [String, Boolean],
type: Boolean,
default: true,
},
arrayData: {
type: Object,
default: null,
},
showTagChips: {
type: Boolean,
default: true,
},
});
const emit = defineEmits([
@ -92,14 +88,13 @@ const userOrders = ref(useFilterParams($props.dataKey).orders);
defineExpose({ search, params: userParams, remove });
const isLoading = ref(false);
async function search(evt, name, value) {
async function search(evt) {
try {
if (evt && $props.disableSubmitEvent) return;
store.filter.where = {};
isLoading.value = true;
const filter = { ...userParams.value, ...$props.modelValue };
if (name) filter[name] = value;
store.userParamsChanged = true;
await arrayData.addFilter({
params: filter,
@ -219,7 +214,7 @@ const getLocale = (label) => {
</QTooltip>
</QBtn>
<QForm @submit="search" id="filterPanelForm" @keyup.enter="search()">
<QList dense v-if="showTagChips">
<QList dense>
<QItem class="q-mt-xs">
<QItemSection top>
<QItemLabel header lines="1" class="text-uppercase q-py-xs q-px-none">
@ -254,7 +249,7 @@ const getLocale = (label) => {
:key="chip.label"
:removable="!unremovableParams?.includes(chip.label)"
@remove="remove(chip.label)"
:data-cy="`vnFilterPanelChip_${chip.label}`"
data-cy="vnFilterPanelChip"
>
<slot
name="tags"

View File

@ -1,11 +1,8 @@
<script setup>
import { dashIfEmpty } from 'src/filters';
defineProps({ email: { type: [String], default: null } });
</script>
<template>
<QBtn
class="q-pr-xs"
v-if="email"
flat
round
@ -16,5 +13,4 @@ defineProps({ email: { type: [String], default: null } });
:href="`mailto:${email}`"
@click.stop
/>
<span>{{ dashIfEmpty(email) }}</span>
</template>

View File

@ -1,7 +1,7 @@
<script setup>
import { ref, reactive, useAttrs, onBeforeMount, capitalize } from 'vue';
import axios from 'axios';
import { dashIfEmpty, parsePhone } from 'src/filters';
import { parsePhone } from 'src/filters';
import useOpenURL from 'src/composables/useOpenURL';
const props = defineProps({
@ -12,65 +12,49 @@ const props = defineProps({
const phone = ref(props.phoneNumber);
const config = reactive({
sip: { icon: 'phone', href: `sip:${props.phoneNumber}` },
'say-simple': {
icon: 'vn:saysimple',
url: null,
channel: props.channel,
},
sip: { icon: 'phone', href: `sip:${props.phoneNumber}` },
});
const attrs = useAttrs();
const types = Object.keys(config)
.filter((key) => key in attrs)
.sort();
const activeTypes = types.length ? types : ['sip'];
const type = Object.keys(config).find((key) => key in useAttrs()) || 'sip';
onBeforeMount(async () => {
if (!phone.value) return;
let { channel } = config[type];
for (const type of activeTypes) {
if (type === 'say-simple') {
let { channel } = config[type];
const { url, defaultChannel } = (await axios.get('SaySimpleConfigs/findOne'))
.data;
if (!channel) channel = defaultChannel;
if (type === 'say-simple') {
const { url, defaultChannel } = (await axios.get('SaySimpleConfigs/findOne'))
.data;
if (!channel) channel = defaultChannel;
phone.value = await parsePhone(
props.phoneNumber,
props.country?.toLowerCase(),
);
config[type].url =
`${url}?customerIdentity=%2B${phone.value}&channelId=${channel}`;
}
phone.value = await parsePhone(props.phoneNumber, props.country?.toLowerCase());
config[
type
].url = `${url}?customerIdentity=%2B${phone.value}&channelId=${channel}`;
}
});
function handleClick(type) {
function handleClick() {
if (config[type].url) useOpenURL(config[type].url);
else if (config[type].href) window.location.href = config[type].href;
}
</script>
<template>
<div class="flex items-center gap-2">
<template v-for="type in activeTypes">
<QBtn
:key="type"
v-if="phone"
flat
round
:icon="config[type].icon"
size="sm"
color="primary"
padding="none"
@click.stop="() => handleClick(type)"
>
<QTooltip>
{{ capitalize(type).replace('-', '') }}
</QTooltip>
</QBtn></template
>
<span>{{ dashIfEmpty(phone) }}</span>
</div>
<QBtn
v-if="phone"
flat
round
:icon="config[type].icon"
size="sm"
color="primary"
padding="none"
@click.stop="handleClick"
>
<QTooltip>
{{ capitalize(type).replace('-', '') }}
</QTooltip>
</QBtn>
</template>

View File

@ -28,14 +28,13 @@ function copyValueText() {
const val = computed(() => $props.value);
</script>
<template>
<div class="vn-label-value" :data-cy="`${$attrs['data-cy'] ?? 'vnLv'}${label ?? ''}`">
<div class="vn-label-value">
<QCheckbox
v-if="typeof value === 'boolean'"
v-model="val"
:label="label"
disable
dense
size="sm"
/>
<template v-else>
<div v-if="label || $slots.label" class="label">
@ -43,9 +42,9 @@ const val = computed(() => $props.value);
<span style="color: var(--vn-label-color)">{{ label }}</span>
</slot>
</div>
<div class="value" v-if="value || $slots.value">
<div class="value">
<slot name="value">
<span :title="value" style="text-overflow: ellipsis">
<span :title="value">
{{ dash ? dashIfEmpty(value) : value }}
</span>
</slot>

View File

@ -9,10 +9,10 @@
data-cy="descriptor-more-opts"
>
<QTooltip>
{{ $t('components.vnDescriptor.moreOptions') }}
{{ $t('components.cardDescriptor.moreOptions') }}
</QTooltip>
<QMenu ref="menuRef" data-cy="descriptor-more-opts-menu">
<QList data-cy="descriptor-more-opts_list">
<QList>
<slot name="menu" :menu-ref="$refs.menuRef" />
</QList>
</QMenu>

View File

@ -19,15 +19,19 @@ import VnInput from 'components/common/VnInput.vue';
const emit = defineEmits(['onFetch']);
const originalAttrs = useAttrs();
const $attrs = computed(() => {
const { required, deletable, ...rest } = originalAttrs;
const { style, ...rest } = originalAttrs;
return rest;
});
const isRequired = computed(() => {
return Object.keys($attrs).includes('required')
});
const $props = defineProps({
url: { type: String, default: null },
saveUrl: { type: String, default: null },
userFilter: { type: Object, default: () => {} },
saveUrl: {type: String, default: null},
filter: { type: Object, default: () => {} },
body: { type: Object, default: () => {} },
addNote: { type: Boolean, default: false },
@ -40,11 +44,6 @@ const quasar = useQuasar();
const newNote = reactive({ text: null, observationTypeFk: null });
const observationTypes = ref([]);
const vnPaginateRef = ref();
const defaultObservationType = computed(() =>
observationTypes.value.find(ot => ot.code === 'salesPerson')?.id
);
let originalText;
function handleClick(e) {
@ -53,11 +52,6 @@ function handleClick(e) {
else insert();
}
async function deleteNote(e) {
await axios.delete(`${$props.url}/${e.id}`);
await vnPaginateRef.value.fetch();
}
async function insert() {
if (!newNote.text || ($props.selectType && !newNote.observationTypeFk)) return;
@ -71,7 +65,7 @@ async function insert() {
}
function confirmAndUpdate() {
if (!newNote.text && originalText)
if(!newNote.text && originalText)
quasar
.dialog({
component: VnConfirm,
@ -94,17 +88,11 @@ async function update() {
...body,
...{ notes: newNote.text },
};
await axios.patch(
`${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`,
newBody,
);
await axios.patch(`${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`, newBody);
}
onBeforeRouteLeave((to, from, next) => {
if (
(newNote.text && !$props.justInput) ||
(newNote.text !== originalText && $props.justInput)
)
if ((newNote.text && !$props.justInput) || (newNote.text !== originalText) && $props.justInput)
quasar.dialog({
component: VnConfirm,
componentProps: {
@ -116,27 +104,20 @@ onBeforeRouteLeave((to, from, next) => {
else next();
});
function fetchData([data]) {
function fetchData([ data ]) {
newNote.text = data?.notes;
originalText = data?.notes;
emit('onFetch', data);
}
const handleObservationTypes = (data) => {
observationTypes.value = data;
if(defaultObservationType.value) {
newNote.observationTypeFk = defaultObservationType.value;
}
};
</script>
<template>
<FetchData
v-if="selectType"
url="ObservationTypes"
:filter="{ fields: ['id', 'description', 'code'] }"
:filter="{ fields: ['id', 'description'] }"
auto-load
@on-fetch="handleObservationTypes"
@on-fetch="(data) => (observationTypes = data)"
/>
<FetchData
v-if="justInput"
@ -145,8 +126,8 @@ const handleObservationTypes = (data) => {
@on-fetch="fetchData"
auto-load
/>
<QCard
class="q-pa-xs q-mb-lg full-width"
<QCard
class="q-pa-xs q-mb-lg full-width"
:class="{ 'just-input': $props.justInput }"
v-if="$props.addNote || $props.justInput"
>
@ -162,7 +143,7 @@ const handleObservationTypes = (data) => {
v-model="newNote.observationTypeFk"
option-label="description"
style="flex: 0.15"
:required="'required' in originalAttrs"
:required="isRequired"
@keyup.enter.stop="insert"
/>
<VnInput
@ -170,10 +151,10 @@ const handleObservationTypes = (data) => {
type="textarea"
:label="$props.justInput && newNote.text ? '' : t('Add note here...')"
filled
size="lg"
autogrow
autofocus
@keyup.enter.stop="handleClick"
:required="'required' in originalAttrs"
:required="isRequired"
clearable
>
<template #append>
@ -198,15 +179,15 @@ const handleObservationTypes = (data) => {
:url="$props.url"
order="created DESC"
:limit="0"
:user-filter="userFilter"
:filter="filter"
:user-filter="$props.filter"
auto-load
ref="vnPaginateRef"
class="show"
v-bind="$attrs"
:search-url="false"
search-url="notes"
@on-fetch="
newNote.text = '';
newNote.observationTypeFk = null;
"
>
<template #body="{ rows }">
@ -237,27 +218,12 @@ const handleObservationTypes = (data) => {
>
{{
observationTypes.find(
(ot) => ot.id === note.observationTypeFk,
(ot) => ot.id === note.observationTypeFk
)?.description
}}
</QBadge>
</div>
<span v-text="toDateHourMin(note.created)" />
<div>
<QIcon
v-if="'deletable' in originalAttrs"
name="delete"
size="sm"
class="cursor-pointer"
color="primary"
@click="deleteNote(note)"
data-cy="notesRemoveNoteBtn"
>
<QTooltip>
{{ t('ticketNotes.removeNote') }}
</QTooltip>
</QIcon>
</div>
</div>
</QCardSection>
<QCardSection class="q-pa-xs q-my-none q-py-none">

View File

@ -115,7 +115,7 @@ onMounted(async () => {
});
onBeforeUnmount(() => {
arrayData.reset(['data']);
if (!store.keepData) arrayData.reset(['data']);
arrayData.resetPagination();
});
@ -215,7 +215,6 @@ defineExpose({
paginate,
userParams: arrayData.store.userParams,
currentFilter: arrayData.store.currentFilter,
arrayData,
});
</script>

View File

@ -33,10 +33,6 @@ const props = defineProps({
type: String,
default: '',
},
userFilter: {
type: Object,
default: null,
},
filter: {
type: Object,
default: null,

View File

@ -26,7 +26,6 @@ const id = props.entityId;
:to="{ name: routeName, params: { id: id } }"
class="header link"
:href="url"
data-cy="goToSummaryBtn"
>
<QIcon name="open_in_new" color="white" size="sm" />
</router-link>

View File

@ -6,12 +6,10 @@ const session = useSession();
const token = session.getToken();
describe('downloadFile', () => {
const baseUrl = 'http://localhost:9000';
let defaulCreateObjectURL;
beforeAll(() => {
vi.mock('src/composables/getUrl', () => ({
getUrl: vi.fn().mockResolvedValue(''),
}));
defaulCreateObjectURL = window.URL.createObjectURL;
window.URL.createObjectURL = vi.fn(() => 'blob:http://localhost:9000/blob-id');
});
@ -24,14 +22,15 @@ describe('downloadFile', () => {
headers: { 'content-disposition': 'attachment; filename="test-file.txt"' },
};
vi.spyOn(axios, 'get').mockImplementation((url) => {
if (url.includes('downloadFile')) return Promise.resolve(res);
if (url == 'Urls/getUrl') return Promise.resolve({ data: baseUrl });
else if (url.includes('downloadFile')) return Promise.resolve(res);
});
await downloadFile(1);
expect(axios.get).toHaveBeenCalledWith(
`/api/dms/1/downloadFile?access_token=${token}`,
{ responseType: 'blob' },
`${baseUrl}/api/dms/1/downloadFile?access_token=${token}`,
{ responseType: 'blob' }
);
});
});

View File

@ -23,19 +23,18 @@ describe('useRole', () => {
name: `T'Challa`,
nickname: 'Black Panther',
lang: 'en',
worker: { department: { departmentFk: 155 } },
};
const expectedUser = {
id: 999,
name: `T'Challa`,
nickname: 'Black Panther',
lang: 'en',
departmentFk: 155,
};
const expectedRoles = ['salesPerson', 'admin'];
vi.spyOn(axios, 'get').mockResolvedValueOnce({
vi.spyOn(axios, 'get')
.mockResolvedValueOnce({
data: { roles: rolesData, user: fetchedUser },
});
})
vi.spyOn(role.state, 'setUser');
vi.spyOn(role.state, 'setRoles');

View File

@ -75,7 +75,6 @@ describe('session', () => {
userConfig: {
darkMode: false,
},
worker: { department: { departmentFk: 155 } },
};
const rolesData = [
{
@ -144,7 +143,7 @@ describe('session', () => {
await session.destroy(); // this clears token and user for any other test
});
},
{},
{}
);
describe('RenewToken', () => {
@ -176,7 +175,7 @@ describe('session', () => {
await session.checkValidity();
expect(sessionStorage.getItem('token')).toEqual(expectedToken);
expect(sessionStorage.getItem('tokenMultimedia')).toEqual(
expectedTokenMultimedia,
expectedTokenMultimedia
);
});
it('Should renewToken', async () => {
@ -205,7 +204,7 @@ describe('session', () => {
await session.checkValidity();
expect(sessionStorage.getItem('token')).not.toEqual(expectedToken);
expect(sessionStorage.getItem('tokenMultimedia')).not.toEqual(
expectedTokenMultimedia,
expectedTokenMultimedia
);
});
});

View File

@ -7,33 +7,18 @@ const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
const appUrl = await getAppUrl();
const appUrl = (await getUrl('', 'lilium')).replace('/#/', '');
const response = await axios.get(
url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`,
{ responseType: 'blob' },
{ responseType: 'blob' }
);
download(response);
}
export async function downloadDocuware(url, params) {
const appUrl = await getAppUrl();
const response = await axios.get(`${appUrl}/api/` + url, {
responseType: 'blob',
params,
});
download(response);
}
function download(response) {
const contentDisposition = response.headers['content-disposition'];
const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(contentDisposition);
const filename = matches?.[1] ? matches[1].replace(/['"]/g, '') : 'downloaded-file';
const filename =
matches != null && matches[1]
? matches[1].replace(/['"]/g, '')
: 'downloaded-file';
exportFile(filename, response.data);
}
async function getAppUrl() {
return (await getUrl('', 'lilium')).replace('/#/', '');
}

View File

@ -9,8 +9,6 @@ export function getColAlign(col) {
case 'number':
align = 'right';
break;
case 'time':
case 'date':
case 'checkbox':
align = 'center';
break;

View File

@ -0,0 +1,31 @@
import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
export function showResultsAsTable() {
const quasar = useQuasar();
const { t } = useI18n();
function openTable(dialog, results, tag, action, title) {
quasar.notify({
message: t('bulkEdit.completed'),
color: 'positive',
actions: [
{
label: t('bulkEdit.openTable'),
color: 'white',
handler: () => {
quasar.dialog({
component: dialog,
componentProps: {
title,
results,
tag,
action,
},
});
},
},
],
});
}
return { openTable };
}

View File

@ -30,16 +30,9 @@ export function useAcl() {
return false;
}
function hasAcl(model, prop, accessType) {
const modelAcl = state.getAcls().value[model];
const propAcl = modelAcl?.[prop] || modelAcl?.['*'];
return !!(propAcl?.[accessType] || propAcl?.['*']);
}
return {
fetch,
hasAny,
state,
hasAcl,
};
}

View File

@ -56,6 +56,7 @@ export function useArrayData(key, userOptions) {
'searchUrl',
'navigate',
'mapKey',
'keepData',
'oneRecord',
];
if (typeof userOptions === 'object') {
@ -107,7 +108,7 @@ export function useArrayData(key, userOptions) {
store.hasMoreData = limit && response.data.length >= limit;
if (!append && !isDialogOpened() && updateRouter) {
if (updateStateParams(response.data)?.redirect) return;
if (updateStateParams(response.data)?.redirect && !store.keepData) return;
}
store.isLoading = false;
canceller = null;
@ -147,7 +148,8 @@ export function useArrayData(key, userOptions) {
}
async function applyFilter({ filter, params }, fetchOptions = {}) {
if (filter) store.filter = filter;
if (filter) store.userFilter = filter;
store.filter = {};
if (params) store.userParams = { ...params };
const response = await fetch(fetchOptions);
@ -188,7 +190,7 @@ export function useArrayData(key, userOptions) {
store.order = order;
resetPagination();
await fetch({});
fetch({});
index++;
return { index, order };
@ -243,7 +245,7 @@ export function useArrayData(key, userOptions) {
async function loadMore() {
if (!store.hasMoreData) return;
store.skip = (store?.filter?.limit ?? store.limit) * store.page;
store.skip = store.limit * store.page;
store.page += 1;
await fetch({ append: true });

View File

@ -14,7 +14,7 @@ export function useFilterParams(key) {
watch(
() => arrayData.value.store?.currentFilter,
(val, oldValue) => (val || oldValue) && setUserParams(val),
{ immediate: true, deep: true },
{ immediate: true, deep: true }
);
function parseOrder(urlOrders) {
@ -54,7 +54,7 @@ export function useFilterParams(key) {
Object.assign(params, item);
});
delete params[key];
} else if (value && typeof value === 'object' && !Array.isArray(value)) {
} else if (value && typeof value === 'object') {
const param = Object.values(value)[0];
if (typeof param == 'string') params[key] = param.replaceAll('%', '');
}

View File

@ -13,7 +13,6 @@ export function useRole() {
name: data.user.name,
nickname: data.user.nickname,
lang: data.user.lang || 'es',
departmentFk: data.user.worker.department.departmentFk,
};
state.setUser(userData);
state.setRoles(roles);

View File

@ -15,7 +15,6 @@ body.body--light {
--vn-empty-tag: #acacac;
--vn-black-text-color: black;
--vn-text-color-contrast: white;
--vn-link-color: #1e90ff;
background-color: var(--vn-page-color);
@ -39,7 +38,6 @@ body.body--dark {
--vn-empty-tag: #2d2d2d;
--vn-black-text-color: black;
--vn-text-color-contrast: black;
--vn-link-color: #66bfff;
background-color: var(--vn-page-color);
@ -51,7 +49,7 @@ a {
}
.link {
color: var(--vn-link-color);
color: $color-link;
cursor: pointer;
&--white {
@ -60,14 +58,14 @@ a {
}
.tx-color-link {
color: var(--vn-link-color) !important;
color: $color-link !important;
}
.tx-color-font {
color: var(--vn-link-color) !important;
color: $color-link !important;
}
.header-link {
color: var(--vn-link-color) !important;
color: $color-link !important;
cursor: pointer;
border-bottom: solid $primary;
border-width: 2px;
@ -325,6 +323,7 @@ input::-webkit-inner-spin-button {
min-height: auto !important;
display: flex;
align-items: flex-end;
padding-bottom: 2px;
.q-field__native.row {
min-height: auto !important;
}
@ -338,5 +337,5 @@ input::-webkit-inner-spin-button {
}
.containerShrinked {
width: 70%;
width: 80%;
}

View File

@ -24,6 +24,7 @@ $alert: $negative;
$white: #fff;
$dark: #3d3d3d;
// custom
$color-link: #66bfff;
$color-spacer-light: #a3a3a31f;
$color-spacer: #7979794d;
$border-thin-light: 1px solid $color-spacer-light;

View File

@ -99,6 +99,7 @@ globals:
file: File
selectFile: Select a file
copyClipboard: Copy on clipboard
salesPerson: SalesPerson
send: Send
code: Code
since: Since
@ -157,9 +158,7 @@ globals:
changeState: Change state
raid: 'Raid {daysInForward} days'
isVies: Vies
department: Department
noData: No data available
vehicle: Vehicle
pageTitles:
logIn: Login
addressEdit: Update address
@ -347,6 +346,7 @@ globals:
params:
description: Description
clientFk: Client id
salesPersonFk: Sales person
warehouseFk: Warehouse
provinceFk: Province
stateFk: State
@ -369,12 +369,6 @@ globals:
countryFk: Country
countryCodeFk: Country
companyFk: Company
nickname: Alias
changedModel: Entity
changedModelValue: Search
changedModelId: Entity id
userFk: User
action: Action
model: Model
fuel: Fuel
active: Active
@ -536,7 +530,6 @@ ticket:
customerCard: Customer card
ticketList: Ticket List
newOrder: New Order
ticketClaimed: Claimed ticket
boxing:
expedition: Expedition
created: Created
@ -609,6 +602,7 @@ worker:
balance: Balance
medical: Medical
list:
department: Department
schedule: Schedule
newWorker: New worker
summary:
@ -651,7 +645,6 @@ worker:
model: Model
serialNumber: Serial number
removePDA: Deallocate PDA
sendToTablet: Send to tablet
create:
lastName: Last name
birth: Birth
@ -822,7 +815,6 @@ travel:
search: Search travel
searchInfo: You can search by travel id or name
id: Id
awbFk: AWB
travelList:
tableVisibleColumns:
ref: Reference
@ -847,7 +839,6 @@ travel:
availabledHour: Availabled hour
thermographs: Thermographs
hb: HB
roundedCc: Rounded CC
basicData:
daysInForward: Automatic movement (Raid)
isRaid: Raid
@ -870,6 +861,7 @@ components:
mine: For me
hasMinPrice: Minimum price
# LatestBuysFilter
salesPersonFk: Buyer
supplierFk: Supplier
from: From
to: To
@ -890,7 +882,7 @@ components:
openCard: View
openSummary: Summary
viewSummary: Summary
vnDescriptor:
cardDescriptor:
mainList: Main list
summary: Summary
moreOptions: More options
@ -900,8 +892,6 @@ components:
VnLv:
copyText: '{copyValue} has been copied to the clipboard'
iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789'
VnNotes:
clientWithoutPhone: 'The following clients do not have a phone number and the message will not be sent to them: {clientWithoutPhone}'
weekdays:
sun: Sunday
mon: Monday
@ -923,3 +913,8 @@ months:
oct: October
nov: November
dec: December
bulkEdit:
completed: Bulk edit completed
failed: Bulk edit failed
edit: Bulk edit
inProgress: Bulk edit in progress

View File

@ -103,6 +103,7 @@ globals:
file: Fichero
selectFile: Seleccione un fichero
copyClipboard: Copiar en portapapeles
salesPerson: Comercial
send: Enviar
code: Código
since: Desde
@ -162,8 +163,6 @@ globals:
raid: 'Redada {daysInForward} días'
isVies: Vies
noData: Datos no disponibles
department: Departamento
vehicle: Vehículo
pageTitles:
logIn: Inicio de sesión
addressEdit: Modificar consignatario
@ -350,6 +349,7 @@ globals:
params:
description: Descripción
clientFk: Id cliente
salesPersonFk: Comercial
warehouseFk: Almacén
provinceFk: Provincia
stateFk: Estado
@ -370,12 +370,6 @@ globals:
countryFk: País
countryCodeFk: País
companyFk: Empresa
nickname: Alias
changedModel: Entidad
changedModelValue: Buscar
changedModelId: Id de entidad
userFk: Usuario
action: Acción
errors:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor
@ -536,13 +530,13 @@ ticket:
state: Estado
shipped: Enviado
landed: Entregado
salesPerson: Comercial
total: Total
card:
customerId: ID cliente
customerCard: Ficha del cliente
ticketList: Listado de tickets
newOrder: Nuevo pedido
ticketClaimed: Ticket reclamado
boxing:
expedition: Expedición
created: Creado
@ -627,6 +621,8 @@ invoiceOut:
errors:
downloadCsvFailed: Error al descargar CSV
order:
field:
salesPersonFk: Comercial
form:
clientFk: Cliente
addressFk: Dirección
@ -694,6 +690,7 @@ worker:
formation: Formación
medical: Mutua
list:
department: Departamento
schedule: Horario
newWorker: Nuevo trabajador
summary:
@ -736,7 +733,6 @@ worker:
model: Modelo
serialNumber: Número de serie
removePDA: Desasignar PDA
sendToTablet: Enviar a la tablet
create:
lastName: Apellido
birth: Fecha de nacimiento
@ -905,7 +901,6 @@ travel:
search: Buscar envío
searchInfo: Buscar envío por id o nombre
id: Id
awbFk: Guía aérea
travelList:
tableVisibleColumns:
ref: Referencia
@ -930,7 +925,6 @@ travel:
availabled: F. Disponible
availabledHour: Hora Disponible
hb: HB
roundedCc: CC redondeado
basicData:
daysInForward: Desplazamiento automatico (redada)
isRaid: Redada
@ -954,6 +948,7 @@ components:
hasMinPrice: Precio mínimo
wareHouseFk: Almacén
# LatestBuysFilter
salesPersonFk: Comprador
supplierFk: Proveedor
visible: Visible
active: Activo
@ -974,7 +969,7 @@ components:
openCard: Ficha
openSummary: Detalles
viewSummary: Vista previa
vnDescriptor:
cardDescriptor:
mainList: Listado principal
summary: Resumen
moreOptions: Más opciones
@ -984,8 +979,6 @@ components:
VnLv:
copyText: '{copyValue} se ha copiado al portapepeles'
iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789'
VnNotes:
clientWithoutPhone: 'Estos clientes no tienen asociado número de télefono y el sms no les será enviado: {clientWithoutPhone}'
weekdays:
sun: Domingo
mon: Lunes
@ -1007,3 +1000,9 @@ months:
oct: Octubre
nov: Noviembre
dec: Diciembre
bulkEdit:
completed: Edición masiva completada
failed: Edición masiva fallida
edit: Edición masiva
inProgress: Edición masiva en progreso
openTable: Abrir resultados

View File

@ -47,7 +47,7 @@ const rolesOptions = ref([]);
:label="t('globals.name')"
v-model="params.name"
lazy-rules
filled
is-outlined
/>
</QItemSection>
</QItem>
@ -57,7 +57,7 @@ const rolesOptions = ref([]);
:label="t('account.card.alias')"
v-model="params.nickname"
lazy-rules
filled
is-outlined
/>
</QItemSection>
</QItem>
@ -75,7 +75,8 @@ const rolesOptions = ref([]);
use-input
hide-selected
dense
filled
outlined
rounded
:input-debounce="0"
/>
</QItemSection>

View File

@ -149,12 +149,14 @@ const columns = computed(() => [
:right-search="false"
>
<template #more-create-dialog="{ data }">
<QCardSection>
<VnInputPassword
:label="t('Password')"
v-model="data.password"
:required="true"
autocomplete="new-password"
/>
</QCardSection>
</template>
</VnTable>
</template>

View File

@ -56,7 +56,8 @@ onBeforeMount(() => {
option-label="name"
use-input
dense
filled
outlined
rounded
/>
</QItemSection>
</QItem>
@ -71,7 +72,8 @@ onBeforeMount(() => {
option-label="name"
use-input
dense
filled
outlined
rounded
/>
</QItemSection>
</QItem>
@ -81,7 +83,7 @@ onBeforeMount(() => {
:label="t('acls.aclFilter.property')"
v-model="params.property"
lazy-rules
filled
is-outlined
/>
</QItemSection>
</QItem>
@ -96,7 +98,8 @@ onBeforeMount(() => {
option-label="name"
use-input
dense
filled
outlined
rounded
/>
</QItemSection>
</QItem>
@ -111,7 +114,8 @@ onBeforeMount(() => {
option-label="name"
use-input
dense
filled
outlined
rounded
/>
</QItemSection>
</QItem>

View File

@ -1,10 +1,10 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import VnCardBeta from 'components/common/VnCardBeta.vue';
import AliasDescriptor from './AliasDescriptor.vue';
</script>
<template>
<VnCard
<VnCardBeta
data-key="Alias"
url="MailAliases"
:descriptor="AliasDescriptor"

View File

@ -4,7 +4,7 @@ import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import EntityDescriptor from 'components/ui/EntityDescriptor.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import axios from 'axios';
@ -48,12 +48,11 @@ const removeAlias = () => {
</script>
<template>
<EntityDescriptor
<CardDescriptor
ref="descriptor"
:url="`MailAliases/${entityId}`"
data-key="Alias"
title="alias"
:to-module="{ name: 'AccountAlias' }"
>
<template #menu>
<QItem v-ripple clickable @click="removeAlias()">
@ -63,7 +62,7 @@ const removeAlias = () => {
<template #body="{ entity }">
<VnLv :label="t('role.description')" :value="entity.description" />
</template>
</EntityDescriptor>
</CardDescriptor>
</template>
<i18n>

View File

@ -5,7 +5,6 @@ import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
const route = useRoute();
const { t } = useI18n();
@ -28,10 +27,13 @@ const entityId = computed(() => $props.id || route.params.id);
<template #body="{ entity: alias }">
<QCard class="vn-one">
<QCardSection class="q-pa-none">
<VnTitle
:url="`#/account/alias/${entityId}/basic-data`"
:text="t('globals.summary.basicData')"
/>
<router-link
:to="{ name: 'AliasBasicData', params: { id: entityId } }"
class="header header-link"
>
{{ t('globals.summary.basicData') }}
<QIcon name="open_in_new" />
</router-link>
</QCardSection>
<VnLv :label="t('role.id')" :value="alias.id" />
<VnLv :label="t('role.description')" :value="alias.description" />

View File

@ -1,10 +1,10 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import VnCardBeta from 'components/common/VnCardBeta.vue';
import AccountDescriptor from './AccountDescriptor.vue';
import filter from './AccountFilter.js';
</script>
<template>
<VnCard
<VnCardBeta
url="VnUsers/preview"
:id-in-where="true"
data-key="Account"

View File

@ -1,7 +1,7 @@
<script setup>
import { ref, computed, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import EntityDescriptor from 'components/ui/EntityDescriptor.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
import VnImg from 'src/components/ui/VnImg.vue';
@ -20,7 +20,7 @@ onMounted(async () => {
</script>
<template>
<EntityDescriptor
<CardDescriptor
ref="descriptor"
:url="`VnUsers/preview`"
:filter="{ ...filter, where: { id: entityId } }"
@ -78,7 +78,7 @@ onMounted(async () => {
</QIcon>
</QCardActions>
</template>
</EntityDescriptor>
</CardDescriptor>
</template>
<style scoped>
.q-item__label {

View File

@ -100,8 +100,12 @@ const onChangePass = (oldPass) => {
};
onMounted(() => {
hasitManagementAccess.value = useAcl().hasAcl('VnUser', 'higherPrivileges', 'WRITE');
hasSysadminAccess.value = useAcl().hasAcl('VnUser', 'adminUser', 'WRITE');
hasitManagementAccess.value = useAcl().hasAny([
{ model: 'VnUser', props: 'higherPrivileges', accessType: 'WRITE' },
]);
hasSysadminAccess.value = useAcl().hasAny([
{ model: 'VnUser', props: 'adminUser', accessType: 'WRITE' },
]);
});
</script>
<template>
@ -223,7 +227,7 @@ onMounted(() => {
<QItemSection>{{ t('account.card.actions.deactivateUser.name') }}</QItemSection>
</QItem>
<QItem
v-if="useAcl().hasAcl('VnRole', '*', 'WRITE')"
v-if="useAcl().hasAny([{ model: 'VnRole', props: '*', accessType: 'WRITE' }])"
v-ripple
clickable
@click="showSyncDialog = true"

View File

@ -1,14 +0,0 @@
<script setup>
import AccountDescriptor from './AccountDescriptor.vue';
import AccountSummary from './AccountSummary.vue';
</script>
<template>
<QPopupProxy style="max-width: 10px">
<AccountDescriptor
v-if="$attrs.id"
v-bind="$attrs"
:summary="AccountSummary"
:proxy-render="true"
/>
</QPopupProxy>
</template>

View File

@ -5,7 +5,6 @@ import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import filter from './AccountFilter.js';
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
const $props = defineProps({ id: { type: Number, default: 0 } });
@ -18,7 +17,7 @@ const entityId = computed(() => $props.id || route.params.id);
data-key="Account"
ref="AccountSummary"
url="VnUsers/preview"
:filter="{ ...filter, where: { id: entityId } }"
:filter="filter"
>
<template #header="{ entity }">{{ entity.id }} - {{ entity.nickname }}</template>
<template #menu>
@ -27,10 +26,13 @@ const entityId = computed(() => $props.id || route.params.id);
<template #body="{ entity }">
<QCard class="vn-one">
<QCardSection class="q-pa-none">
<VnTitle
:url="`#/account/${entityId}/basic-data`"
:text="$t('globals.pageTitles.basicData')"
/>
<router-link
:to="{ name: 'AccountBasicData', params: { id: entityId } }"
class="header header-link"
>
{{ $t('globals.pageTitles.basicData') }}
<QIcon name="open_in_new" />
</router-link>
</QCardSection>
<VnLv :label="$t('account.card.nickname')" :value="entity.name" />
<VnLv :label="$t('account.card.role')" :value="entity.role?.name" />

View File

@ -27,7 +27,7 @@ const props = defineProps({
:label="t('globals.name')"
v-model="params.name"
lazy-rules
filled
is-outlined
/>
</QItemSection>
</QItem>
@ -37,7 +37,7 @@ const props = defineProps({
:label="t('role.description')"
v-model="params.description"
lazy-rules
filled
is-outlined
/>
</QItemSection>
</QItem>

View File

@ -1,9 +1,9 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import VnCardBeta from 'components/common/VnCardBeta.vue';
import RoleDescriptor from './RoleDescriptor.vue';
</script>
<template>
<VnCard
<VnCardBeta
url="VnRoles"
data-key="Role"
:id-in-where="true"

View File

@ -2,7 +2,7 @@
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import EntityDescriptor from 'components/ui/EntityDescriptor.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
@ -32,12 +32,11 @@ const removeRole = async () => {
</script>
<template>
<EntityDescriptor
<CardDescriptor
url="VnRoles"
:filter="{ where: { id: entityId } }"
data-key="Role"
:summary="$props.summary"
:to-module="{ name: 'AccountRoles' }"
>
<template #menu>
<QItem v-ripple clickable @click="removeRole()">
@ -47,7 +46,7 @@ const removeRole = async () => {
<template #body="{ entity }">
<VnLv :label="t('role.description')" :value="entity.description" />
</template>
</EntityDescriptor>
</CardDescriptor>
</template>
<style scoped>
.q-item__label {

View File

@ -4,7 +4,6 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
const route = useRoute();
const { t } = useI18n();
@ -30,10 +29,13 @@ const entityId = computed(() => $props.id || route.params.id);
<template #body="{ entity }">
<QCard class="vn-one">
<QCardSection class="q-pa-none">
<VnTitle
:url="`#/account/role/${entityId}/basic-data`"
:text="$t('globals.pageTitles.basicData')"
/>
<a
class="header header-link"
:href="`#/VnUser/${entityId}/basic-data`"
>
{{ t('globals.pageTitles.basicData') }}
<QIcon name="open_in_new" />
</a>
</QCardSection>
<VnLv :label="t('role.id')" :value="entity.id" />
<VnLv :label="t('globals.name')" :value="entity.name" />

View File

@ -328,7 +328,7 @@ async function post(query, params) {
<QTd>
<VnSelect
v-model="row.shelvingFk"
url="Shelvings"
:options="shelvings"
option-label="code"
option-value="id"
style="width: 100px"

View File

@ -2,7 +2,6 @@
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { getDifferences, getUpdatedValues } from 'src/filters';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
import FetchData from 'components/FetchData.vue';
@ -10,18 +9,12 @@ import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
const route = useRoute();
const { t } = useI18n();
const workersOptions = ref([]);
function onBeforeSave(formData, originalData) {
return getUpdatedValues(
Object.keys(getDifferences(formData, originalData)),
formData,
);
}
</script>
<template>
<FetchData
@ -34,7 +27,6 @@ function onBeforeSave(formData, originalData) {
<FormModel
model="Claim"
:url-update="`Claims/updateClaim/${route.params.id}`"
:mapper="onBeforeSave"
auto-load
>
<template #form="{ data, validate }">

View File

@ -1,10 +1,10 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import VnCardBeta from 'components/common/VnCardBeta.vue';
import ClaimDescriptor from './ClaimDescriptor.vue';
import filter from './ClaimFilter.js';
</script>
<template>
<VnCard
<VnCardBeta
data-key="Claim"
url="Claims"
:descriptor="ClaimDescriptor"

View File

@ -5,8 +5,7 @@ import { useI18n } from 'vue-i18n';
import { toDateHourMinSec, toPercentage } from 'src/filters';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
import EntityDescriptor from 'components/ui/EntityDescriptor.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
import { getUrl } from 'src/composables/getUrl';
@ -44,7 +43,7 @@ onMounted(async () => {
</script>
<template>
<EntityDescriptor
<CardDescriptor
:url="`Claims/${entityId}`"
:filter="filter"
title="client.name"
@ -66,12 +65,12 @@ onMounted(async () => {
</template>
</VnLv>
<VnLv :label="t('claim.created')" :value="toDateHourMinSec(entity.created)" />
<VnLv :label="t('globals.department')">
<VnLv :label="t('claim.commercial')">
<template #value>
<span class="link">
{{ entity?.client?.department?.name || '-' }}
<DepartmentDescriptorProxy :id="entity?.client?.departmentFk" />
</span>
<VnUserLink
:name="entity.client?.salesPersonUser?.name"
:worker-id="entity.client?.salesPersonFk"
/>
</template>
</VnLv>
<VnLv
@ -147,7 +146,7 @@ onMounted(async () => {
</QBtn>
</QCardActions>
</template>
</EntityDescriptor>
</CardDescriptor>
</template>
<style scoped>
.q-item__label {

View File

@ -1,14 +0,0 @@
<script setup>
import ClaimDescriptor from './ClaimDescriptor.vue';
import ClaimSummary from './ClaimSummary.vue';
</script>
<template>
<QPopupProxy style="max-width: 10px">
<ClaimDescriptor
v-if="$attrs.id"
v-bind="$attrs.id"
:summary="ClaimSummary"
:proxy-render="true"
/>
</QPopupProxy>
</template>

View File

@ -14,7 +14,7 @@ export default {
relation: 'client',
scope: {
include: [
{ relation: 'department' },
{ relation: 'salesPersonUser' },
{
relation: 'claimsRatio',
scope: {

View File

@ -117,7 +117,7 @@ const selected = ref([]);
const mana = ref(0);
async function fetchMana() {
const ticketId = claim.value.ticketFk;
const response = await axios.get(`Tickets/${ticketId}/getDepartmentMana`);
const response = await axios.get(`Tickets/${ticketId}/getSalesPersonMana`);
mana.value = response.data;
}

View File

@ -1,5 +1,5 @@
<script setup>
import { computed } from 'vue';
import { computed, useAttrs } from 'vue';
import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import VnNotes from 'src/components/ui/VnNotes.vue';
@ -7,6 +7,7 @@ import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute();
const state = useState();
const user = state.getUser();
const $attrs = useAttrs();
const $props = defineProps({
id: { type: [Number, String], default: null },
@ -14,21 +15,24 @@ const $props = defineProps({
});
const claimId = computed(() => $props.id || route.params.id);
const claimFilter = {
fields: ['id', 'created', 'workerFk', 'text'],
include: {
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName'],
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname', 'name'],
const claimFilter = computed(() => {
return {
where: { claimFk: claimId.value },
fields: ['id', 'created', 'workerFk', 'text'],
include: {
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName'],
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname', 'name'],
},
},
},
},
},
};
};
});
const body = {
claimFk: claimId.value,
@ -39,8 +43,7 @@ const body = {
<VnNotes
url="claimObservations"
:add-note="$props.addNote"
:user-filter="claimFilter"
:filter="{ where: { claimFk: claimId } }"
:filter="claimFilter"
:body="body"
v-bind="$attrs"
style="overflow-y: auto"

View File

@ -210,7 +210,6 @@ function onDrag() {
class="all-pointer-events absolute delete-button zindex"
@click.stop="viewDeleteDms(index)"
round
:data-cy="`delete-button-${index+1}`"
/>
<QIcon
name="play_circle"
@ -228,7 +227,6 @@ function onDrag() {
class="rounded-borders cursor-pointer fit"
@click="openDialog(media.dmsFk)"
v-if="!media.isVideo"
:data-cy="`file-${index+1}`"
>
</QImg>
<video
@ -237,7 +235,6 @@ function onDrag() {
muted="muted"
v-if="media.isVideo"
@click="openDialog(media.dmsFk)"
:data-cy="`file-${index+1}`"
/>
</QCard>
</div>

View File

@ -19,9 +19,7 @@ import ClaimNotes from 'src/pages/Claim/Card/ClaimNotes.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
import ClaimDescriptorMenu from './ClaimDescriptorMenu.vue';
import VnDropdown from 'src/components/common/VnDropdown.vue';
const route = useRoute();
const router = useRouter();
@ -37,7 +35,7 @@ const $props = defineProps({
});
const entityId = computed(() => $props.id || route.params.id);
const claimStates = ref([]);
const ClaimStates = ref([]);
const claimDmsRef = ref();
const claimDms = ref([]);
const multimediaDialog = ref();
@ -174,9 +172,7 @@ function openDialog(dmsId) {
}
async function changeState(value) {
await axios.patch(`Claims/updateClaim/${entityId.value}`, {
claimStateFk: value,
});
await axios.patch(`Claims/updateClaim/${entityId.value}`, { claimStateFk: value });
router.go(route.fullPath);
}
@ -186,18 +182,13 @@ function claimUrl(section) {
</script>
<template>
<FetchData
url="ClaimStates"
:filter="{ fields: ['id', 'description'] }"
@on-fetch="(data) => (claimStates = data)"
auto-load
/>
<FetchData
url="ClaimDms"
:filter="claimDmsFilter"
@on-fetch="(data) => setClaimDms(data)"
ref="claimDmsRef"
/>
<FetchData url="ClaimStates" @on-fetch="(data) => (ClaimStates = data)" auto-load />
<CardSummary
ref="summary"
:url="`Claims/${entityId}/getSummary`"
@ -209,11 +200,34 @@ function claimUrl(section) {
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
</template>
<template #header-right>
<VnDropdown
:options="claimStates"
option-label="description"
@change-state="changeState"
/>
<QBtnDropdown
side
top
color="black"
text-color="white"
:label="t('globals.changeState')"
>
<QList>
<QVirtualScroll
class="max-container-height"
:items="ClaimStates"
separator
v-slot="{ item, index }"
>
<QItem
:key="index"
dense
clickable
v-close-popup
@click="changeState(item.id)"
>
<QItemSection>
<QItemLabel>{{ item.description }}</QItemLabel>
</QItemSection>
</QItem>
</QVirtualScroll>
</QList>
</QBtnDropdown>
</template>
<template #menu="{ entity }">
<ClaimDescriptorMenu :claim="entity.claim" />
@ -238,15 +252,13 @@ function claimUrl(section) {
</VnLv>
<VnLv
v-if="$route.name != 'ClaimSummary'"
:label="t('customer.summary.team')"
:label="t('globals.salesPerson')"
>
<template #value>
<span class="link">
{{ claim?.client?.department?.name || '-' }}
<DepartmentDescriptorProxy
:id="claim?.client?.departmentFk"
/>
</span>
<VnUserLink
:name="claim.client?.salesPersonUser?.name"
:worker-id="claim.client?.salesPersonFk"
/>
</template>
</VnLv>
<VnLv v-if="$route.name != 'ClaimSummary'" :label="t('claim.attendedBy')">
@ -259,7 +271,7 @@ function claimUrl(section) {
</VnLv>
<VnLv v-if="$route.name != 'ClaimSummary'" :label="t('claim.customer')">
<template #value>
<span class="link">
<span class="link cursor-pointer">
{{ claim.client?.name }}
<CustomerDescriptorProxy :id="claim.clientFk" />
</span>

View File

@ -80,7 +80,7 @@ const columns = [
:right-search="false"
:column-search="false"
:disable-option="{ card: true, table: true }"
:search-url="false"
search-url="actions"
:filter="{ where: { claimFk: $props.id } }"
:columns="columns"
:limit="0"

Some files were not shown because too many files have changed in this diff Show More