Merge branch 'dev' into 6802-Clientes-gestionados-por-equipos

This commit is contained in:
Javi Gallego 2025-03-12 16:16:29 +01:00
commit 345e9532e6
190 changed files with 14441 additions and 9453 deletions

1
.gitignore vendored
View File

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

View File

@ -1,3 +1,187 @@
# 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 # Version 25.08 - 2025-03-04
### Added 🆕 ### Added 🆕

4
Jenkinsfile vendored
View File

@ -122,8 +122,8 @@ pipeline {
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY' sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh "docker-compose ${env.COMPOSE_PARAMS} up -d" sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") { image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
sh 'cypress run --browser chromium || true' sh 'sh test/cypress/cypressParallel.sh 2'
} }
} }
} }

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -196,7 +196,7 @@ const selectTravel = ({ id }) => {
> >
<template #body-cell-id="{ row }"> <template #body-cell-id="{ row }">
<QTd auto-width @click.stop data-cy="travelFk-travel-form"> <QTd auto-width @click.stop data-cy="travelFk-travel-form">
<QBtn flat color="blue">{{ row.id }}</QBtn> <QBtn flat class="link">{{ row.id }}</QBtn>
<TravelDescriptorProxy :id="row.id" /> <TravelDescriptorProxy :id="row.id" />
</QTd> </QTd>
</template> </template>

View File

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

View File

@ -57,7 +57,7 @@ const refresh = () => window.location.reload();
:class="{ :class="{
'no-visible': !stateQuery.isLoading().value, 'no-visible': !stateQuery.isLoading().value,
}" }"
size="xs" size="sm"
data-cy="loading-spinner" data-cy="loading-spinner"
/> />
<QSpace /> <QSpace />

View File

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

View File

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

View File

@ -1136,9 +1136,13 @@ es:
.grid-create { .grid-create {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, max-content)); grid-template-columns: 1fr 1fr;
max-width: 100%;
grid-gap: 20px; grid-gap: 20px;
margin: 0 auto; margin: 0 auto;
.col-span-2 {
grid-column: span 2;
}
} }
.flex-one { .flex-one {

View File

@ -15,10 +15,7 @@ vi.mock('src/router/modules', () => ({
meta: { meta: {
title: 'customers', title: 'customers',
icon: 'vn:client', icon: 'vn:client',
}, menu: ['CustomerList', 'CustomerCreate'],
menus: {
main: ['CustomerList'],
card: ['CustomerBasicData'],
}, },
children: [ children: [
{ {
@ -90,7 +87,7 @@ vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
icon: 'vn:client', icon: 'vn:client',
moduleName: 'Customer', moduleName: 'Customer',
keyBinding: 'c', keyBinding: 'c',
menu: 'customer', menu: ['customer'],
}, },
}, },
], ],
@ -252,15 +249,6 @@ 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', () => { it('should get routes for main source', () => {
vm.props.source = 'main'; vm.props.source = 'main';
vm.getRoutes(); vm.getRoutes();
@ -343,8 +331,9 @@ describe('addChildren', () => {
it('should handle routes with no meta menu', () => { it('should handle routes with no meta menu', () => {
const route = { const route = {
meta: {}, meta: {
menus: {}, menu: [],
},
}; };
const parent = []; const parent = [];

View File

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

View File

@ -1,50 +1,56 @@
<script setup> <script setup>
import { onBeforeMount, computed } from 'vue'; import { onBeforeMount } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router'; import { useRouter, onBeforeRouteUpdate, onBeforeRouteLeave } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import useCardSize from 'src/composables/useCardSize'; import useCardSize from 'src/composables/useCardSize';
import VnSubToolbar from '../ui/VnSubToolbar.vue'; import VnSubToolbar from '../ui/VnSubToolbar.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import LeftMenu from 'components/LeftMenu.vue';
import RightMenu from 'components/common/RightMenu.vue';
const props = defineProps({ const props = defineProps({
dataKey: { type: String, required: true }, dataKey: { type: String, required: true },
url: { type: String, default: undefined }, url: { type: String, default: undefined },
idInWhere: { type: Boolean, default: false },
filter: { type: Object, default: () => {} }, filter: { type: Object, default: () => {} },
descriptor: { type: Object, required: true }, descriptor: { type: Object, required: true },
filterPanel: { type: Object, default: undefined }, filterPanel: { type: Object, default: undefined },
idInWhere: { type: Boolean, default: false },
searchDataKey: { type: String, default: undefined }, searchDataKey: { type: String, default: undefined },
searchbarProps: { type: Object, default: undefined }, searchbarProps: { type: Object, default: undefined },
redirectOnError: { type: Boolean, default: false }, redirectOnError: { type: Boolean, default: false },
}); });
const stateStore = useStateStore(); const stateStore = useStateStore();
const route = useRoute();
const router = useRouter(); const router = useRouter();
const searchRightDataKey = computed(() => {
if (!props.searchDataKey) return route.name;
return props.searchDataKey;
});
const arrayData = useArrayData(props.dataKey, { const arrayData = useArrayData(props.dataKey, {
url: props.url, url: props.url,
userFilter: props.filter, userFilter: props.filter,
oneRecord: true, oneRecord: true,
}); });
onBeforeRouteLeave(() => {
stateStore.cardDescriptorChangeValue(null);
});
onBeforeMount(async () => { onBeforeMount(async () => {
stateStore.cardDescriptorChangeValue(props.descriptor);
const route = router.currentRoute.value;
try { try {
await fetch(route.params.id); await fetch(route.params.id);
} catch { } catch {
const { matched: matches } = router.currentRoute.value; const { matched: matches } = route;
const { path } = matches.at(-1); const { path } = matches.at(-1);
router.push({ path: path.replace(/:id.*/, '') }); router.push({ path: path.replace(/:id.*/, '') });
} }
}); });
onBeforeRouteUpdate(async (to, from) => { 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; const id = to.params.id;
if (id !== from.params.id) await fetch(id, true); if (id !== from.params.id) await fetch(id, true);
}); });
@ -56,34 +62,13 @@ async function fetch(id, append = false) {
else arrayData.store.url = props.url.replace(regex, `/${id}`); else arrayData.store.url = props.url.replace(regex, `/${id}`);
await arrayData.fetch({ append, updateRouter: false }); await arrayData.fetch({ append, updateRouter: false });
} }
function hasRouteParam(params, valueToCheck = ':addressId') {
return Object.values(params).includes(valueToCheck);
}
</script> </script>
<template> <template>
<QDrawer <VnSubToolbar />
v-model="stateStore.leftDrawer" <div :class="[useCardSize(), $attrs.class]">
show-if-above <RouterView :key="$route.path" />
:width="256" </div>
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> </template>

View File

@ -1,74 +0,0 @@
<script setup>
import { onBeforeMount } from 'vue';
import { useRouter, onBeforeRouteUpdate, onBeforeRouteLeave } 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 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,
});
onBeforeRouteLeave(() => {
stateStore.cardDescriptorChangeValue(null);
});
onBeforeMount(async () => {
stateStore.cardDescriptorChangeValue(props.descriptor);
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>
<VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]">
<RouterView :key="$route.path" />
</div>
</template>

View File

@ -5,7 +5,7 @@ import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
import { useArrayData } from 'composables/useArrayData'; import { useArrayData } from 'composables/useArrayData';
import { useSummaryDialog } from 'src/composables/useSummaryDialog'; import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useState } from 'src/composables/useState'; import { useState } from 'src/composables/useState';
import { useRoute } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useClipboard } from 'src/composables/useClipboard'; import { useClipboard } from 'src/composables/useClipboard';
import VnMoreOptions from './VnMoreOptions.vue'; import VnMoreOptions from './VnMoreOptions.vue';
@ -42,6 +42,7 @@ const $props = defineProps({
const state = useState(); const state = useState();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const { copyText } = useClipboard(); const { copyText } = useClipboard();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -50,6 +51,9 @@ let store;
let entity; let entity;
const isLoading = ref(false); const isLoading = ref(false);
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName); const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
const DESCRIPTOR_PROXY = 'DescriptorProxy';
const moduleName = ref();
const isSameModuleName = route.matched[1].meta.moduleName !== moduleName.value;
defineExpose({ getData }); defineExpose({ getData });
onBeforeMount(async () => { onBeforeMount(async () => {
@ -76,15 +80,18 @@ onBeforeMount(async () => {
); );
}); });
const routeName = computed(() => { function getName() {
const DESCRIPTOR_PROXY = 'DescriptorProxy';
let name = $props.dataKey; let name = $props.dataKey;
if ($props.dataKey.includes(DESCRIPTOR_PROXY)) { if ($props.dataKey.includes(DESCRIPTOR_PROXY)) {
name = name.split(DESCRIPTOR_PROXY)[0]; name = name.split(DESCRIPTOR_PROXY)[0];
} }
return `${name}Summary`; return name;
}
const routeName = computed(() => {
let routeName = getName();
return `${routeName}Summary`;
}); });
async function getData() { async function getData() {
store.url = $props.url; store.url = $props.url;
store.filter = $props.filter ?? {}; store.filter = $props.filter ?? {};
@ -120,20 +127,35 @@ function copyIdText(id) {
const emit = defineEmits(['onFetch']); const emit = defineEmits(['onFetch']);
const iconModule = computed(() => route.matched[1].meta.icon); const iconModule = computed(() => {
const toModule = computed(() => moduleName.value = getName();
route.matched[1].path.split('/').length > 2 if (isSameModuleName) {
? route.matched[1].redirect return router.options.routes[1].children.find((r) => r.name === moduleName.value)
: route.matched[1].children[0].redirect, ?.meta?.icon;
); } else {
return route.matched[1].meta.icon;
}
});
const toModule = computed(() => {
moduleName.value = getName();
if (isSameModuleName) {
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
?.children[0]?.redirect;
} else {
return route.matched[1].path.split('/').length > 2
? route.matched[1].redirect
: route.matched[1].children[0].redirect;
}
});
</script> </script>
<template> <template>
<div class="descriptor"> <div class="descriptor">
<template v-if="entity && !isLoading"> <template v-if="entity && !isLoading">
<div class="header bg-primary q-pa-sm justify-between"> <div class="header bg-primary q-pa-sm justify-between">
<slot name="header-extra-action" <slot name="header-extra-action">
><QBtn <QBtn
round round
flat flat
dense dense
@ -141,13 +163,13 @@ const toModule = computed(() =>
:icon="iconModule" :icon="iconModule"
color="white" color="white"
class="link" class="link"
:to="$attrs['to-module'] ?? toModule" :to="toModule"
> >
<QTooltip> <QTooltip>
{{ t('globals.goToModuleIndex') }} {{ t('globals.goToModuleIndex') }}
</QTooltip> </QTooltip>
</QBtn></slot </QBtn>
> </slot>
<QBtn <QBtn
@click.stop="viewSummary(entity.id, $props.summary, $props.width)" @click.stop="viewSummary(entity.id, $props.summary, $props.width)"
round round
@ -230,7 +252,6 @@ const toModule = computed(() =>
</div> </div>
<slot name="after" /> <slot name="after" />
</template> </template>
<!-- Skeleton -->
<SkeletonDescriptor v-if="!entity || isLoading" /> <SkeletonDescriptor v-if="!entity || isLoading" />
</div> </div>
<QInnerLoading <QInnerLoading

View File

@ -54,7 +54,7 @@ const $props = defineProps({
default: 'table', default: 'table',
}, },
redirect: { redirect: {
type: Boolean, type: [String, Boolean],
default: true, default: true,
}, },
arrayData: { arrayData: {

View File

@ -186,7 +186,7 @@ function fetchData([data]) {
ref="vnPaginateRef" ref="vnPaginateRef"
class="show" class="show"
v-bind="$attrs" v-bind="$attrs"
search-url="notes" :search-url="false"
@on-fetch=" @on-fetch="
newNote.text = ''; newNote.text = '';
newNote.observationTypeFk = null; newNote.observationTypeFk = null;

View File

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

View File

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

View File

@ -148,8 +148,7 @@ export function useArrayData(key, userOptions) {
} }
async function applyFilter({ filter, params }, fetchOptions = {}) { async function applyFilter({ filter, params }, fetchOptions = {}) {
if (filter) store.userFilter = filter; if (filter) store.filter = filter;
store.filter = {};
if (params) store.userParams = { ...params }; if (params) store.userParams = { ...params };
const response = await fetch(fetchOptions); const response = await fetch(fetchOptions);

View File

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

View File

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

View File

@ -159,6 +159,7 @@ globals:
isVies: Vies isVies: Vies
department: Department department: Department
noData: No data available noData: No data available
vehicle: Vehicle
pageTitles: pageTitles:
logIn: Login logIn: Login
addressEdit: Update address addressEdit: Update address
@ -530,6 +531,7 @@ ticket:
customerCard: Customer card customerCard: Customer card
ticketList: Ticket List ticketList: Ticket List
newOrder: New Order newOrder: New Order
ticketClaimed: Claimed ticket
boxing: boxing:
expedition: Expedition expedition: Expedition
created: Created created: Created

View File

@ -163,6 +163,7 @@ globals:
isVies: Vies isVies: Vies
noData: Datos no disponibles noData: Datos no disponibles
department: Departamento department: Departamento
vehicle: Vehículo
pageTitles: pageTitles:
logIn: Inicio de sesión logIn: Inicio de sesión
addressEdit: Modificar consignatario addressEdit: Modificar consignatario
@ -536,6 +537,7 @@ ticket:
customerCard: Ficha del cliente customerCard: Ficha del cliente
ticketList: Listado de tickets ticketList: Listado de tickets
newOrder: Nuevo pedido newOrder: Nuevo pedido
ticketClaimed: Ticket reclamado
boxing: boxing:
expedition: Expedición expedition: Expedición
created: Creado created: Creado

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -274,7 +274,7 @@ function claimUrl(section) {
</VnLv> </VnLv>
<VnLv v-if="$route.name != 'ClaimSummary'" :label="t('claim.customer')"> <VnLv v-if="$route.name != 'ClaimSummary'" :label="t('claim.customer')">
<template #value> <template #value>
<span class="link cursor-pointer"> <span class="link">
{{ claim.client?.name }} {{ claim.client?.name }}
<CustomerDescriptorProxy :id="claim.clientFk" /> <CustomerDescriptorProxy :id="claim.clientFk" />
</span> </span>

View File

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

View File

@ -1,10 +1,10 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import CustomerDescriptor from './CustomerDescriptor.vue'; import CustomerDescriptor from './CustomerDescriptor.vue';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Customer" data-key="Customer"
:url="`Clients/${$route.params.id}/getCard`" :url="`Clients/${$route.params.id}/getCard`"
:descriptor="CustomerDescriptor" :descriptor="CustomerDescriptor"

View File

@ -86,12 +86,12 @@ const tableColumnComponents = {
}, },
file: { file: {
component: QBtn, component: QBtn,
props: () => ({ flat: true, color: 'blue' }), props: () => ({ flat: true }),
event: ({ row }) => downloadFile(row.dmsFk), event: ({ row }) => downloadFile(row.dmsFk),
}, },
employee: { employee: {
component: QBtn, component: QBtn,
props: () => ({ flat: true, color: 'blue' }), props: () => ({ flat: true }),
event: () => {}, event: () => {},
}, },
created: { created: {
@ -214,8 +214,17 @@ const toCustomerFileManagementCreate = () => {
v-bind="tableColumnComponents[props.col.name].props(props)" v-bind="tableColumnComponents[props.col.name].props(props)"
> >
<template v-if="props.col.name !== 'original'"> <template v-if="props.col.name !== 'original'">
{{ props.value }} <span
:class="{
link:
props.col.name === 'employee' ||
props.col.name === 'file',
}"
>
{{ props.value }}
</span>
</template> </template>
<WorkerDescriptorProxy <WorkerDescriptorProxy
:id="props.row.dms.workerFk" :id="props.row.dms.workerFk"
v-if="props.col.name === 'employee'" v-if="props.col.name === 'employee'"

View File

@ -16,9 +16,7 @@ const filter = {
{ relation: 'mandateType', scope: { fields: ['id', 'code'] } }, { relation: 'mandateType', scope: { fields: ['id', 'code'] } },
{ relation: 'company', scope: { fields: ['id', 'code'] } }, { relation: 'company', scope: { fields: ['id', 'code'] } },
], ],
where: { clientFk: route.params.id },
order: ['created DESC'], order: ['created DESC'],
limit: 20,
}; };
const columns = computed(() => [ const columns = computed(() => [
@ -32,7 +30,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
cardVisible: true, cardVisible: true,
format: ({ company }) => company.code, format: ({ company }) => company?.code,
label: t('globals.company'), label: t('globals.company'),
name: 'company', name: 'company',
}, },
@ -65,7 +63,8 @@ const columns = computed(() => [
<VnTable <VnTable
data-key="Mandates" data-key="Mandates"
url="Mandates" url="Mandates"
:filter="filter" :user-filter="filter"
:filter="{ where: { clientFk: route.params.id } }"
auto-load auto-load
:columns="columns" :columns="columns"
class="full-width q-mt-md" class="full-width q-mt-md"

View File

@ -5,7 +5,7 @@ import { useRoute } from 'vue-router';
import axios from 'axios'; import axios from 'axios';
import { getClientRisk } from '../composables/getClientRisk'; import { getClientRisk } from '../composables/getClientRisk';
import { useDialogPluginComponent } from 'quasar'; import { useDialogPluginComponent } from 'quasar';
import FormModelPopup from 'components/FormModelPopup.vue';
import { usePrintService } from 'composables/usePrintService'; import { usePrintService } from 'composables/usePrintService';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
@ -74,26 +74,24 @@ onBeforeMount(() => {
urlCreate.value = `Clients/${route.params.id}/createReceipt`; urlCreate.value = `Clients/${route.params.id}/createReceipt`;
}); });
function setPaymentType(accounting) { function setPaymentType(data, accounting) {
data.bankFk = accounting.id;
if (!accounting) return; if (!accounting) return;
accountingType.value = accounting.accountingType; accountingType.value = accounting.accountingType;
initialData.description = []; data.description = [];
initialData.payed = Date.vnNew(); data.payed = Date.vnNew();
isCash.value = accountingType.value.code == 'cash'; isCash.value = accountingType.value.code == 'cash';
viewReceipt.value = isCash.value; viewReceipt.value = isCash.value;
if (accountingType.value.daysInFuture) if (accountingType.value.daysInFuture)
initialData.payed.setDate( data.payed.setDate(data.payed.getDate() + accountingType.value.daysInFuture);
initialData.payed.getDate() + accountingType.value.daysInFuture,
);
maxAmount.value = accountingType.value && accountingType.value.maxAmount; maxAmount.value = accountingType.value && accountingType.value.maxAmount;
if (accountingType.value.code == 'compensation') if (accountingType.value.code == 'compensation') return (data.description = '');
return (initialData.description = '');
let descriptions = []; let descriptions = [];
if (accountingType.value.receiptDescription) if (accountingType.value.receiptDescription)
descriptions.push(accountingType.value.receiptDescription); descriptions.push(accountingType.value.receiptDescription);
if (initialData.description) descriptions.push(initialData.description); if (data.description) descriptions.push(data.description);
initialData.description = descriptions.join(', '); data.description = descriptions.join(', ');
} }
const calculateFromAmount = (event) => { const calculateFromAmount = (event) => {
@ -113,7 +111,6 @@ function onBeforeSave(data) {
if (isCash.value && shouldSendEmail.value && !data.email) if (isCash.value && shouldSendEmail.value && !data.email)
return notify(t('There is no assigned email for this client'), 'negative'); return notify(t('There is no assigned email for this client'), 'negative');
data.bankFk = data.bankFk?.id;
return data; return data;
} }
@ -181,42 +178,19 @@ async function getAmountPaid() {
auto-load auto-load
url="Clients/findOne" url="Clients/findOne"
/> />
<FormModel <FormModelPopup
ref="formModelRef" ref="formModelRef"
:form-initial-data="initialData" :form-initial-data="initialData"
:observe-form-changes="false"
:url-create="urlCreate" :url-create="urlCreate"
:mapper="onBeforeSave" :mapper="onBeforeSave"
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
prevent-submit :prevent-submit="true"
> >
<template #form="{ data, validate }"> <template #form-inputs="{ data, validate }">
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
<QIcon name="close" size="sm" />
</span>
<h5 class="q-mt-none">{{ t('New payment') }}</h5> <h5 class="q-mt-none">{{ t('New payment') }}</h5>
<VnRow>
<VnInputDate
:label="t('Date')"
:required="true"
v-model="data.payed"
/>
<VnSelect
:label="t('Company')"
:options="companyOptions"
:required="true"
:rules="validate('entry.companyFk')"
hide-selected
option-label="code"
option-value="id"
v-model="data.companyFk"
@update:model-value="getAmountPaid()"
/>
</VnRow>
<VnRow> <VnRow>
<VnSelect <VnSelect
autofocus
:label="t('Bank')" :label="t('Bank')"
v-model="data.bankFk" v-model="data.bankFk"
url="Accountings" url="Accountings"
@ -225,9 +199,10 @@ async function getAmountPaid() {
sort-by="id" sort-by="id"
:limit="0" :limit="0"
@update:model-value=" @update:model-value="
(value, options) => setPaymentType(value, options) (value, options) => setPaymentType(data, value, options)
" "
:emit-value="false" :emit-value="false"
data-cy="paymentBank"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -245,8 +220,28 @@ async function getAmountPaid() {
@update:model-value="calculateFromAmount($event)" @update:model-value="calculateFromAmount($event)"
clearable clearable
v-model.number="data.amountPaid" v-model.number="data.amountPaid"
data-cy="paymentAmount"
/> />
</VnRow> </VnRow>
<VnRow>
<VnInputDate
:label="t('Date')"
v-model="data.payed"
:required="true"
/>
<VnSelect
:label="t('Company')"
:options="companyOptions"
:required="true"
:rules="validate('entry.companyFk')"
hide-selected
option-label="code"
option-value="id"
v-model="data.companyFk"
@update:model-value="getAmountPaid()"
/>
</VnRow>
<div v-if="data.bankFk?.accountingType?.code == 'compensation'"> <div v-if="data.bankFk?.accountingType?.code == 'compensation'">
<div class="text-h6"> <div class="text-h6">
{{ t('Compensation') }} {{ t('Compensation') }}
@ -287,27 +282,8 @@ async function getAmountPaid() {
<QCheckbox v-model="shouldSendEmail" :label="t('Send email')" /> <QCheckbox v-model="shouldSendEmail" :label="t('Send email')" />
</VnRow> </VnRow>
</div> </div>
<div class="q-mt-lg row justify-end">
<QBtn
:disabled="formModelRef.isLoading"
:label="t('globals.cancel')"
:loading="formModelRef.isLoading"
class="q-ml-sm"
color="primary"
flat
type="reset"
v-close-popup
/>
<QBtn
:disabled="formModelRef.isLoading"
:label="t('globals.save')"
:loading="formModelRef.isLoading"
color="primary"
@click="formModelRef.save()"
/>
</div>
</template> </template>
</FormModel> </FormModelPopup>
</QDialog> </QDialog>
</template> </template>

View File

@ -22,6 +22,12 @@ describe('getAddresses', () => {
relation: 'client', relation: 'client',
scope: { scope: {
fields: ['defaultAddressFk'], fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
}, },
}, },
], ],

View File

@ -9,6 +9,12 @@ export async function getAddresses(clientId, _filter = {}) {
relation: 'client', relation: 'client',
scope: { scope: {
fields: ['defaultAddressFk'], fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
}, },
}, },
], ],

View File

@ -1,10 +1,10 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import EntryDescriptor from './EntryDescriptor.vue'; import EntryDescriptor from './EntryDescriptor.vue';
import filter from './EntryFilter.js'; import filter from './EntryFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Entry" data-key="Entry"
url="Entries" url="Entries"
:descriptor="EntryDescriptor" :descriptor="EntryDescriptor"

View File

@ -146,9 +146,8 @@ async function deleteEntry() {
<template> <template>
<CardDescriptor <CardDescriptor
ref="entryDescriptorRef"
:url="`Entries/${entityId}`" :url="`Entries/${entityId}`"
:userFilter="entryFilter" :filter="entryFilter"
title="supplier.nickname" title="supplier.nickname"
data-key="Entry" data-key="Entry"
width="lg-width" width="lg-width"

View File

@ -283,7 +283,11 @@ onBeforeMount(async () => {
</script> </script>
<template> <template>
<VnSection :data-key="dataKey" prefix="entry"> <VnSection
:data-key="dataKey"
prefix="entry"
:array-data-props="{ url: 'Entries/filter' }"
>
<template #advanced-menu> <template #advanced-menu>
<EntryFilter :data-key="dataKey" /> <EntryFilter :data-key="dataKey" />
</template> </template>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import InvoiceInDescriptor from './InvoiceInDescriptor.vue'; import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
import { onBeforeRouteUpdate } from 'vue-router'; import { onBeforeRouteUpdate } from 'vue-router';
import { setRectificative } from '../composables/setRectificative'; import { setRectificative } from '../composables/setRectificative';
@ -9,7 +9,7 @@ onBeforeRouteUpdate(async (to) => await setRectificative(to));
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="InvoiceIn" data-key="InvoiceIn"
url="InvoiceIns" url="InvoiceIns"
:descriptor="InvoiceInDescriptor" :descriptor="InvoiceInDescriptor"

View File

@ -1,10 +1,10 @@
<script setup> <script setup>
import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue'; import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue';
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import filter from './InvoiceOutFilter.js'; import filter from './InvoiceOutFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="InvoiceOut" data-key="InvoiceOut"
url="InvoiceOuts" url="InvoiceOuts"
:filter="filter" :filter="filter"

View File

@ -70,6 +70,7 @@ function ticketFilter(invoice) {
icon="vn:client" icon="vn:client"
color="primary" color="primary"
:to="{ name: 'CustomerCard', params: { id: entity.client.id } }" :to="{ name: 'CustomerCard', params: { id: entity.client.id } }"
data-cy="invoiceOutDescriptorCustomerCard"
> >
<QTooltip>{{ t('invoiceOut.card.customerCard') }}</QTooltip> <QTooltip>{{ t('invoiceOut.card.customerCard') }}</QTooltip>
</QBtn> </QBtn>
@ -81,6 +82,7 @@ function ticketFilter(invoice) {
name: 'TicketList', name: 'TicketList',
query: { table: ticketFilter(entity) }, query: { table: ticketFilter(entity) },
}" }"
data-cy="invoiceOutDescriptorTicketList"
> >
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip> <QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip>
</QBtn> </QBtn>

View File

@ -7,6 +7,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputDate from 'components/common/VnInputDate.vue';
import VnInputNumber from 'src/components/common/VnInputNumber.vue'; import VnInputNumber from 'src/components/common/VnInputNumber.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps({ const props = defineProps({
@ -30,7 +31,7 @@ const states = ref();
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
:label="t('Customer ID')" :label="t('globals.params.clientFk')"
v-model="params.clientFk" v-model="params.clientFk"
is-outlined is-outlined
/> />
@ -38,13 +39,17 @@ const states = ref();
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput v-model="params.fi" :label="t('FI')" is-outlined /> <VnInput
v-model="params.fi"
:label="t('globals.params.fi')"
is-outlined
/>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInputNumber <VnInputNumber
:label="t('Amount')" :label="t('globals.amount')"
v-model="params.amount" v-model="params.amount"
is-outlined is-outlined
data-cy="InvoiceOutFilterAmountBtn" data-cy="InvoiceOutFilterAmountBtn"
@ -54,7 +59,7 @@ const states = ref();
<QItem> <QItem>
<QItemSection> <QItemSection>
<QInput <QInput
:label="t('Min')" :label="t('invoiceOut.params.min')"
dense dense
lazy-rules lazy-rules
outlined outlined
@ -65,7 +70,7 @@ const states = ref();
</QItemSection> </QItemSection>
<QItemSection> <QItemSection>
<QInput <QInput
:label="t('Max')" :label="t('invoiceOut.params.max')"
dense dense
lazy-rules lazy-rules
outlined outlined
@ -78,7 +83,7 @@ const states = ref();
<QItem> <QItem>
<QItemSection> <QItemSection>
<QCheckbox <QCheckbox
:label="t('Has PDF')" :label="t('invoiceOut.params.hasPdf')"
toggle-indeterminate toggle-indeterminate
v-model="params.hasPdf" v-model="params.hasPdf"
/> />
@ -88,14 +93,31 @@ const states = ref();
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
v-model="params.created" v-model="params.created"
:label="t('Created')" :label="t('invoiceOut.params.created')"
is-outlined is-outlined
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInputDate v-model="params.dued" :label="t('Dued')" is-outlined /> <VnInputDate
v-model="params.dued"
:label="t('invoiceOut.params.dued')"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
outlined
rounded
:label="t('globals.params.departmentFk')"
v-model="params.departmentFk"
option-value="id"
option-label="name"
url="Departments"
/>
</QItemSection> </QItemSection>
</QItem> </QItem>
</template> </template>

View File

@ -200,7 +200,7 @@ watchEffect(selectedRows);
prefix="invoiceOut" prefix="invoiceOut"
:array-data-props="{ :array-data-props="{
url: 'InvoiceOuts/filter', url: 'InvoiceOuts/filter',
order: ['id DESC'], order: 'id DESC',
}" }"
> >
<template #advanced-menu> <template #advanced-menu>
@ -247,11 +247,15 @@ watchEffect(selectedRows);
<template #column-departmentFk="{ row }"> <template #column-departmentFk="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.departmentName || '-' }} {{ row.departmentName || '-' }}
<<<<<<< HEAD
<DepartmentDescriptorProxy :id="row.departmentFk" /> <DepartmentDescriptorProxy :id="row.departmentFk" />
=======
<DepartmentDescriptorProxy :id="row?.departmentFk" />
>>>>>>> dev
</span> </span>
</template> </template>
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<div class="row q-col-gutter-xs"> <div class="row q-col-gutter-xs col-span-2">
<div class="col-12"> <div class="col-12">
<div class="q-col-gutter-xs"> <div class="q-col-gutter-xs">
<VnRow fixed> <VnRow fixed>
@ -417,7 +421,6 @@ watchEffect(selectedRows);
:label=" :label="
t('invoiceOutList.tableVisibleColumns.taxArea') t('invoiceOutList.tableVisibleColumns.taxArea')
" "
:options="taxAreasOptions"
option-label="code" option-label="code"
option-value="code" option-value="code"
/> />

View File

@ -20,7 +20,7 @@ const props = defineProps({
<VnFilterPanel <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:search-button="true" :search-button="true"
:un-removable-params="['from', 'to']" :unremovable-params="['from', 'to']"
:hidden-tags="['from', 'to']" :hidden-tags="['from', 'to']"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">

View File

@ -1,9 +1,9 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import ItemDescriptor from './ItemDescriptor.vue'; import ItemDescriptor from './ItemDescriptor.vue';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Item" data-key="Item"
:url="`Items/${$route.params.id}/getCard`" :url="`Items/${$route.params.id}/getCard`"
:descriptor="ItemDescriptor" :descriptor="ItemDescriptor"

View File

@ -221,7 +221,7 @@ en:
attenderFk: Atender attenderFk: Atender
clientFk: Client id clientFk: Client id
warehouseFk: Warehouse warehouseFk: Warehouse
requesterFk: Salesperson requesterFk: Requester
from: From from: From
to: To to: To
mine: For me mine: For me
@ -239,7 +239,7 @@ es:
attenderFk: Comprador attenderFk: Comprador
clientFk: Id cliente clientFk: Id cliente
warehouseFk: Almacén warehouseFk: Almacén
requesterFk: Comercial requesterFk: Solicitante
from: Desde from: Desde
to: Hasta to: Hasta
mine: Para mi mine: Para mi

View File

@ -1,11 +1,11 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import ItemTypeDescriptor from 'src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue'; import ItemTypeDescriptor from 'src/pages/Item/ItemType/Card/ItemTypeDescriptor.vue';
import filter from './ItemTypeFilter.js'; import filter from './ItemTypeFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="ItemType" data-key="ItemType"
url="ItemTypes" url="ItemTypes"
:filter="filter" :filter="filter"

View File

@ -7,6 +7,7 @@ import filter from './ItemTypeFilter.js';
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue'; import VnToSummary from 'src/components/ui/VnToSummary.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
onUpdated(() => summaryRef.value.fetch()); onUpdated(() => summaryRef.value.fetch());
@ -62,13 +63,10 @@ async function setItemTypeData(data) {
</template> </template>
<template #body> <template #body>
<QCard class="vn-one"> <QCard class="vn-one">
<router-link <VnTitle
:to="{ name: 'ItemTypeBasicData', params: { id: entityId } }" :url="`#/item/item-type/${entityId}/basic-data`"
class="header header-link" :text="$t('globals.summary.basicData')"
> />
{{ t('globals.summary.basicData') }}
<QIcon name="open_in_new" />
</router-link>
<VnLv :label="t('itemType.summary.id')" :value="itemType.id" /> <VnLv :label="t('itemType.summary.id')" :value="itemType.id" />
<VnLv :label="t('itemType.shared.code')" :value="itemType.code" /> <VnLv :label="t('itemType.shared.code')" :value="itemType.code" />
<VnLv :label="t('itemType.shared.name')" :value="itemType.name" /> <VnLv :label="t('itemType.shared.name')" :value="itemType.name" />

View File

@ -84,7 +84,7 @@ item:
attenderFk: Atender attenderFk: Atender
clientFk: Client id clientFk: Client id
warehouseFk: Warehouse warehouseFk: Warehouse
requesterFk: Salesperson requesterFk: Requester
from: From from: From
to: To to: To
mine: For me mine: For me

View File

@ -93,7 +93,7 @@ item:
attenderFk: Comprador attenderFk: Comprador
clientFk: Id cliente clientFk: Id cliente
warehouseFk: Almacén warehouseFk: Almacén
requesterFk: Comercial requesterFk: Solicitante
from: Desde from: Desde
to: Hasta to: Hasta
mine: Para mi mine: Para mi

View File

@ -1,11 +1,11 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue'; import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue';
import filter from './OrderFilter.js'; import filter from './OrderFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Order" data-key="Order"
url="Orders" url="Orders"
:filter="filter" :filter="filter"

View File

@ -151,13 +151,11 @@ const columns = computed(() => [
onMounted(async () => { onMounted(async () => {
if (!route.query) return; if (!route.query) return;
if (route.query?.createForm) { if (route.query?.createForm) {
const query = JSON.parse(route.query?.createForm); await onClientSelected(JSON.parse(route.query?.createForm));
formInitialData.value = query;
await onClientSelected({ ...formInitialData.value, clientId: query?.clientFk });
} else if (route.query?.table) { } else if (route.query?.table) {
const query = JSON.parse(route.query?.table); const query = JSON.parse(route.query?.table);
const clientId = query?.clientFk; const clientFk = query?.clientFk;
if (clientId) await onClientSelected({ clientId }); if (clientFk) await onClientSelected({ clientFk });
} }
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value; if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
}); });
@ -166,27 +164,36 @@ watch(
() => route.query.table, () => route.query.table,
async (newValue) => { async (newValue) => {
if (newValue) { if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk; const clientFk = +JSON.parse(newValue)?.clientFk;
if (clientId) await onClientSelected({ clientId }); if (clientFk) await onClientSelected({ clientFk });
if (tableRef.value) if (tableRef.value)
tableRef.value.create.formInitialData = formInitialData.value; tableRef.value.create.formInitialData = formInitialData.value;
} }
}, },
{ immediate: true },
); );
async function onClientSelected({ clientId: id }, formData = {}) { async function onClientSelected({ clientFk }, formData = {}) {
const { data } = await getAddresses(id); if (!clientFk) {
addressOptions.value = [];
formData.defaultAddressFk = null;
formData.addressId = null;
return;
}
const { data } = await getAddresses(clientFk);
addressOptions.value = data; addressOptions.value = data;
formData.defaultAddressFk = data[0].client.defaultAddressFk; formData.defaultAddressFk = data[0].client.defaultAddressFk;
formData.addressId = formData.defaultAddressFk; formData.addressId = formData.defaultAddressFk;
formInitialData.value = { ...formData, clientFk };
formInitialData.value = { addressId: formData.addressId, clientFk: id };
await fetchAgencies(formData); await fetchAgencies(formData);
} }
async function fetchAgencies({ landed, addressId }) { async function fetchAgencies(formData) {
if (!landed || !addressId) return (agencyList.value = []); const { landed, addressId } = formData;
if (!landed || !addressId) {
formData.defaultAddressFk = formInitialData.value.defaultAddressFk;
return (agencyList.value = []);
}
const { data } = await axios.get('Agencies/landsThatDay', { const { data } = await axios.get('Agencies/landsThatDay', {
params: { params: {
@ -209,6 +216,11 @@ const getDateColor = (date) => {
if (difference == 0) return 'bg-warning'; if (difference == 0) return 'bg-warning';
if (difference < 0) return 'bg-success'; if (difference < 0) return 'bg-success';
}; };
const isDefaultAddress = (opt, data) => {
const addressId = data.defaultAddressFk ?? data.addressId;
return addressId === opt.id && opt.isActive;
};
</script> </script>
<template> <template>
@ -266,7 +278,9 @@ const getDateColor = (date) => {
:include="{ relation: 'addresses' }" :include="{ relation: 'addresses' }"
v-model="data.clientFk" v-model="data.clientFk"
:label="t('module.customer')" :label="t('module.customer')"
@update:model-value="(id) => onClientSelected(id, data)" @update:model-value="
(id) => onClientSelected({ clientFk: id }, data)
"
> >
<template #option="scope"> <template #option="scope">
<QItem v-bind="scope.itemProps"> <QItem v-bind="scope.itemProps">
@ -297,10 +311,7 @@ const getDateColor = (date) => {
> >
<QItemSection style="min-width: min-content" avatar> <QItemSection style="min-width: min-content" avatar>
<QIcon <QIcon
v-if=" v-if="isDefaultAddress(scope.opt, data)"
scope.opt.isActive &&
data.defaultAddressFk === scope.opt.id
"
size="sm" size="sm"
color="grey" color="grey"
name="star" name="star"

View File

@ -2,10 +2,13 @@
import { computed } from 'vue'; import { computed } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnSection from 'src/components/common/VnSection.vue'; import VnSection from 'src/components/common/VnSection.vue';
import AgencySummary from 'pages/Route/Agency/Card/AgencySummary.vue';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const router = useRouter(); const router = useRouter();
const dataKey = 'AgencyList'; const dataKey = 'AgencyList';
function navigate(id) { function navigate(id) {
@ -60,7 +63,8 @@ const columns = computed(() => [
{ {
title: t('Client ticket list'), title: t('Client ticket list'),
icon: 'preview', icon: 'preview',
action: (row) => navigate(row.id), action: (row) => viewSummary(row?.id, AgencySummary),
isPrimary: true,
}, },
], ],
}, },
@ -82,7 +86,7 @@ const columns = computed(() => [
<VnTable <VnTable
:data-key :data-key
:columns="columns" :columns="columns"
is-editable="false" :is-editable="false"
:right-search="false" :right-search="false"
:use-model="true" :use-model="true"
redirect="route/agency" redirect="route/agency"

View File

@ -21,7 +21,7 @@ const warehouses = ref([]);
@on-fetch="(data) => (warehouses = data)" @on-fetch="(data) => (warehouses = data)"
auto-load auto-load
/> />
<FormModel :update-url="`Agencies/${routeId}`" model="Agency" auto-load> <FormModel :url-update="`Agencies/${routeId}`" model="Agency" auto-load>
<template #form="{ data }"> <template #form="{ data }">
<VnRow> <VnRow>
<VnInput v-model="data.name" :label="t('globals.name')" /> <VnInput v-model="data.name" :label="t('globals.name')" />

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import AgencyDescriptor from 'pages/Route/Agency/Card/AgencyDescriptor.vue'; import AgencyDescriptor from 'pages/Route/Agency/Card/AgencyDescriptor.vue';
import VnCardBeta from 'src/components/common/VnCardBeta.vue'; import VnCard from 'src/components/common/VnCard.vue';
</script> </script>
<template> <template>
<VnCardBeta data-key="Agency" url="Agencies" :descriptor="AgencyDescriptor" /> <VnCard data-key="Agency" url="Agencies" :descriptor="AgencyDescriptor" />
</template> </template>

View File

@ -0,0 +1,20 @@
<script setup>
import AgencyDescriptor from 'pages/Route/Agency/Card/AgencyDescriptor.vue';
import AgencySummary from './AgencySummary.vue';
const $props = defineProps({
id: {
type: Number,
required: true,
},
summary: {
type: Object,
default: null,
},
});
</script>
<template>
<QPopupProxy>
<AgencyDescriptor v-if="$props.id" :id="$props.id" :summary="AgencySummary" />
</QPopupProxy>
</template>

View File

@ -7,19 +7,20 @@ import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue'; import VnLv from 'components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue'; import VnTitle from 'src/components/common/VnTitle.vue';
const route = useRoute();
const $props = defineProps({ id: { type: Number, default: 0 } }); const $props = defineProps({ id: { type: Number, default: 0 } });
const { t } = useI18n(); const { t } = useI18n();
const entityId = computed(() => $props.id || useRoute().params.id); const entityId = computed(() => $props.id || route.params.id);
</script> </script>
<template> <template>
<div class="q-pa-md"> <div class="q-pa-md">
<CardSummary :url="`Agencies/${entityId}`" data-key="Agency"> <CardSummary :url="`Agencies/${entityId}`" data-key="Agency" module-name="Agency">
<template #header="{ entity: agency }">{{ agency.name }}</template> <template #header="{ entity: agency }">{{ agency.name }}</template>
<template #body="{ entity: agency }"> <template #body="{ entity: agency }">
<QCard class="vn-one"> <QCard class="vn-one">
<VnTitle <VnTitle
:url="`#/agency/${entityId}/basic-data`" :url="`#/${route.meta.moduleName.toLowerCase()}/agency/${entityId}/basic-data`"
:text="t('globals.pageTitles.basicData')" :text="t('globals.pageTitles.basicData')"
/> />
<VnLv :label="t('globals.name')" :value="agency.name" /> <VnLv :label="t('globals.name')" :value="agency.name" />

View File

@ -80,6 +80,7 @@ async function deleteWorCenter(id) {
color="primary" color="primary"
round round
flat flat
data-cy="removeWorkCenterBtn"
/> />
</QItemSection> </QItemSection>
</QItem> </QItem>

View File

@ -1,10 +1,10 @@
<script setup> <script setup>
import RouteDescriptor from 'pages/Route/Card/RouteDescriptor.vue'; import RouteDescriptor from 'pages/Route/Card/RouteDescriptor.vue';
import VnCardBeta from 'src/components/common/VnCardBeta.vue'; import VnCard from 'src/components/common/VnCard.vue';
import filter from './RouteFilter.js'; import filter from './RouteFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Route" data-key="Route"
url="Routes" url="Routes"
:filter="filter" :filter="filter"

View File

@ -27,12 +27,16 @@ const getZone = async () => {
const filter = { const filter = {
where: { routeFk: $props.id ? $props.id : route.params.id }, where: { routeFk: $props.id ? $props.id : route.params.id },
}; };
const { data } = await axios.get('Tickets/findOne', { const { data } = await axios.get('Tickets/filter', {
params: { params: {
filter: JSON.stringify(filter), filter: JSON.stringify(filter),
}, },
}); });
zoneId.value = data.zoneFk;
if (!data.length) return;
const firstRecord = data[0];
zoneId.value = firstRecord.zoneFk;
const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`); const { data: zoneData } = await axios.get(`Zones/${zoneId.value}`);
zone.value = zoneData.name; zone.value = zoneData.name;
}; };

View File

@ -7,6 +7,10 @@ const $props = defineProps({
type: Number, type: Number,
required: true, required: true,
}, },
summary: {
type: Object,
default: null,
},
}); });
</script> </script>
<template> <template>

View File

@ -25,7 +25,7 @@ const emit = defineEmits(['search']);
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong> <strong>{{ t(`route.params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span> <span>{{ formatFn(tag.value) }}</span>
</div> </div>
</template> </template>
@ -33,6 +33,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection> <QItemSection>
<VnSelectWorker <VnSelectWorker
:label="t('globals.worker')"
v-model="params.workerFk" v-model="params.workerFk"
dense dense
outlined outlined
@ -44,7 +45,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('Agency')" :label="t('globals.agency')"
v-model="params.agencyModeFk" v-model="params.agencyModeFk"
url="AgencyModes/isActive" url="AgencyModes/isActive"
sort-by="name ASC" sort-by="name ASC"
@ -61,7 +62,7 @@ const emit = defineEmits(['search']);
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
v-model="params.from" v-model="params.from"
:label="t('From')" :label="t('globals.from')"
is-outlined is-outlined
:disable="Boolean(params.scopeDays)" :disable="Boolean(params.scopeDays)"
@update:model-value="params.scopeDays = null" @update:model-value="params.scopeDays = null"
@ -72,7 +73,7 @@ const emit = defineEmits(['search']);
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate
v-model="params.to" v-model="params.to"
:label="t('To')" :label="t('globals.to')"
is-outlined is-outlined
:disable="Boolean(params.scopeDays)" :disable="Boolean(params.scopeDays)"
@update:model-value="params.scopeDays = null" @update:model-value="params.scopeDays = null"
@ -84,7 +85,7 @@ const emit = defineEmits(['search']);
<VnInput <VnInput
v-model="params.scopeDays" v-model="params.scopeDays"
type="number" type="number"
:label="t('Days Onward')" :label="t('globals.daysOnward')"
is-outlined is-outlined
clearable clearable
:disable="Boolean(params.from || params.to)" :disable="Boolean(params.from || params.to)"
@ -98,7 +99,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('Vehicle')" :label="t('globals.vehicle')"
v-model="params.vehicleFk" v-model="params.vehicleFk"
url="Vehicles/active" url="Vehicles/active"
sort-by="numberPlate ASC" sort-by="numberPlate ASC"
@ -120,7 +121,7 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm"> <QItem class="q-my-sm">
<QItemSection> <QItemSection>
<VnSelect <VnSelect
:label="t('Warehouse')" :label="t('globals.warehouse')"
v-model="params.warehouseFk" v-model="params.warehouseFk"
url="Warehouses" url="Warehouses"
option-value="id" option-value="id"
@ -136,7 +137,7 @@ const emit = defineEmits(['search']);
<QItemSection> <QItemSection>
<VnInput <VnInput
v-model="params.description" v-model="params.description"
:label="t('Description')" :label="t('globals.description')"
is-outlined is-outlined
clearable clearable
/> />
@ -146,7 +147,7 @@ const emit = defineEmits(['search']);
<QItemSection> <QItemSection>
<QCheckbox <QCheckbox
v-model="params.isOk" v-model="params.isOk"
:label="t('Served')" :label="t('route.filter.Served')"
toggle-indeterminate toggle-indeterminate
/> />
</QItemSection> </QItemSection>
@ -154,38 +155,3 @@ const emit = defineEmits(['search']);
</template> </template>
</VnFilterPanel> </VnFilterPanel>
</template> </template>
<i18n>
en:
params:
warehouseFk: Warehouse
description: Description
m3:
scopeDays: Days Onward
vehicleFk: Vehicle
agencyModeFk: Agency
workerFk: Worker
from: From
to: To
Served: Served
es:
params:
warehouseFk: Almacén
description: Descripción
m3:
scopeDays: Días en adelante
vehicleFk: Vehículo
agencyModeFk: Agencia
workerFk: Trabajador
from: Desde
to: Hasta
Warehouse: Almacén
Description: Descripción
Vehicle: Vehículo
Agency: Agencia
Worker: Trabajador
From: Desde
To: Hasta
Served: Servida
Days Onward: Días en adelante
</i18n>

View File

@ -135,7 +135,7 @@ const ticketColumns = ref([
<template #body="{ entity }"> <template #body="{ entity }">
<QCard class="vn-max"> <QCard class="vn-max">
<VnTitle <VnTitle
:url="`#/route/${entityId}/basic-data`" :url="`#/${route.meta.moduleName.toLowerCase()}/${entityId}/basic-data`"
:text="t('globals.pageTitles.basicData')" :text="t('globals.pageTitles.basicData')"
/> />
</QCard> </QCard>
@ -168,7 +168,7 @@ const ticketColumns = ref([
<VnLv <VnLv
:label="t('route.summary.volume')" :label="t('route.summary.volume')"
:value="`${dashIfEmpty(entity?.route?.m3)} / ${dashIfEmpty( :value="`${dashIfEmpty(entity?.route?.m3)} / ${dashIfEmpty(
entity?.route?.vehicle?.m3 entity?.route?.vehicle?.m3,
)} `" )} `"
/> />
<VnLv <VnLv
@ -221,7 +221,7 @@ const ticketColumns = ref([
<template #body-cell-city="{ value, row }"> <template #body-cell-city="{ value, row }">
<QTd auto-width> <QTd auto-width>
<span <span
class="link cursor-pointer" class="link"
@click="openBuscaman(entity?.route?.vehicleFk, [row])" @click="openBuscaman(entity?.route?.vehicleFk, [row])"
> >
{{ value }} {{ value }}
@ -230,7 +230,7 @@ const ticketColumns = ref([
</template> </template>
<template #body-cell-client="{ value, row }"> <template #body-cell-client="{ value, row }">
<QTd auto-width> <QTd auto-width>
<span class="link cursor-pointer"> <span class="link">
{{ value }} {{ value }}
<CustomerDescriptorProxy :id="row?.clientFk" /> <CustomerDescriptorProxy :id="row?.clientFk" />
</span> </span>
@ -238,7 +238,7 @@ const ticketColumns = ref([
</template> </template>
<template #body-cell-ticket="{ value, row }"> <template #body-cell-ticket="{ value, row }">
<QTd auto-width class="text-center"> <QTd auto-width class="text-center">
<span class="link cursor-pointer"> <span class="link">
{{ value }} {{ value }}
<TicketDescriptorProxy :id="row?.id" /> <TicketDescriptorProxy :id="row?.id" />
</span> </span>

View File

@ -2,28 +2,38 @@
import { onBeforeMount, onMounted, computed, ref } from 'vue'; import { onBeforeMount, onMounted, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { Notify } from 'quasar'; import { Notify } from 'quasar';
import { useRoute } from 'vue-router';
import { useSession } from 'src/composables/useSession'; import { useSession } from 'src/composables/useSession';
import { toDateHourMin } from 'filters/index'; import { toDateHourMin } from 'filters/index';
import { useStateStore } from 'src/stores/useStateStore'; import { useStateStore } from 'src/stores/useStateStore';
import axios from 'axios';
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue'; import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue'; import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const { getTokenMultimedia } = useSession(); const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia(); const token = getTokenMultimedia();
const state = useStateStore(); const state = useStateStore();
const warehouses = ref([]);
const selectedRows = ref([]); const selectedRows = ref([]);
const dataKey = 'CmrList';
const shipped = Date.vnNew();
shipped.setHours(0, 0, 0, 0);
shipped.setDate(shipped.getDate() - 1);
const userParams = {
shipped: null,
};
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'cmrFk', name: 'cmrFk',
label: t('route.cmr.list.cmrFk'), label: t('route.cmr.params.cmrFk'),
chip: { chip: {
condition: () => true, condition: () => true,
}, },
@ -32,62 +42,67 @@ const columns = computed(() => [
{ {
align: 'center', align: 'center',
name: 'hasCmrDms', name: 'hasCmrDms',
label: t('route.cmr.list.hasCmrDms'), label: t('route.cmr.params.hasCmrDms'),
component: 'checkbox', component: 'checkbox',
cardVisible: true, cardVisible: true,
}, },
{ {
align: 'left', align: 'left',
label: t('route.cmr.list.ticketFk'), label: t('route.cmr.params.ticketFk'),
name: 'ticketFk', name: 'ticketFk',
}, },
{ {
align: 'left', align: 'left',
label: t('route.cmr.list.routeFk'), label: t('route.cmr.params.routeFk'),
name: 'routeFk', name: 'routeFk',
}, },
{ {
align: 'left', align: 'left',
label: t('route.cmr.list.clientFk'), label: t('route.cmr.params.clientFk'),
name: 'clientFk', name: 'clientFk',
}, },
{ {
align: 'right', align: 'right',
label: t('route.cmr.list.country'), label: t('route.cmr.params.countryFk'),
name: 'countryFk', name: 'countryFk',
cardVisible: true, component: 'select',
attrs: { attrs: {
url: 'countries', url: 'countries',
fields: ['id', 'name'], fields: ['id', 'name'],
optionLabel: 'name',
optionValue: 'id',
}, },
columnFilter: { columnFilter: {
inWhere: true, name: 'countryFk',
component: 'select', attrs: {
url: 'countries',
fields: ['id', 'name'],
},
}, },
format: ({ countryName }) => countryName, format: ({ countryName }) => countryName,
}, },
{ {
align: 'right', align: 'right',
label: t('route.cmr.list.shipped'), label: t('route.cmr.params.shipped'),
name: 'shipped', name: 'shipped',
cardVisible: true, cardVisible: true,
columnFilter: { component: 'date',
component: 'date',
inWhere: true,
},
format: ({ shipped }) => toDateHourMin(shipped), format: ({ shipped }) => toDateHourMin(shipped),
}, },
{ {
align: 'right', align: 'right',
label: t('route.cmr.params.warehouseFk'),
name: 'warehouseFk', name: 'warehouseFk',
label: t('globals.warehouse'), component: 'select',
columnFilter: {
component: 'select',
},
attrs: { attrs: {
options: warehouses.value, url: 'warehouses',
fields: ['id', 'name'],
},
columnFilter: {
inWhere: true,
name: 'warehouseFk',
attrs: {
url: 'warehouses',
fields: ['id', 'name'],
},
}, },
format: ({ warehouseName }) => warehouseName, format: ({ warehouseName }) => warehouseName,
}, },
@ -96,7 +111,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('Ver cmr'), title: t('route.cmr.params.viewCmr'),
icon: 'visibility', icon: 'visibility',
isPrimary: true, isPrimary: true,
action: (row) => window.open(getCmrUrl(row?.cmrFk), '_blank'), action: (row) => window.open(getCmrUrl(row?.cmrFk), '_blank'),
@ -105,13 +120,17 @@ const columns = computed(() => [
}, },
]); ]);
onBeforeMount(async () => { onBeforeMount(() => {
const { data } = await axios.get('Warehouses'); initializeFromQuery();
warehouses.value = data;
}); });
onMounted(() => (state.rightDrawer = true)); onMounted(() => (state.rightDrawer = true));
const initializeFromQuery = () => {
const query = route.query.table ? JSON.parse(route.query.table) : {};
shipped.value = query.shipped || shipped.toISOString();
Object.assign(userParams, { shipped });
};
function getApiUrl() { function getApiUrl() {
return new URL(window.location).origin; return new URL(window.location).origin;
} }
@ -133,6 +152,11 @@ function downloadPdfs() {
} }
</script> </script>
<template> <template>
<VnSearchbar
:data-key
:label="t('route.cmr.search')"
:info="t('route.cmr.searchInfo')"
/>
<VnSubToolbar> <VnSubToolbar>
<template #st-actions> <template #st-actions>
<QBtn <QBtn
@ -142,16 +166,16 @@ function downloadPdfs() {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="downloadPdfs" @click="downloadPdfs"
> >
<QTooltip>{{ t('route.cmr.list.downloadCmrs') }}</QTooltip> <QTooltip>{{ t('route.cmr.params.downloadCmrs') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
<VnTable <VnTable
ref="tableRef" ref="tableRef"
data-key="CmrList" :data-key
url="Cmrs/filter" url="Cmrs/filter"
:columns="columns" :columns="columns"
:right-search="true" :user-params="userParams"
default-mode="table" default-mode="table"
v-model:selected="selectedRows" v-model:selected="selectedRows"
table-height="85vh" table-height="85vh"

View File

@ -17,7 +17,7 @@ const onSave = (data, response) => {
</script> </script>
<template> <template>
<FormModel <FormModel
:update-url="`Roadmaps/${$route.params?.id}`" :url-update="`Roadmaps/${$route.params?.id}`"
:url="`Roadmaps/${$route.params?.id}`" :url="`Roadmaps/${$route.params?.id}`"
observe-form-changes observe-form-changes
model="Roadmap" model="Roadmap"

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import RoadmapDescriptor from 'pages/Route/Roadmap/RoadmapDescriptor.vue'; import RoadmapDescriptor from 'pages/Route/Roadmap/RoadmapDescriptor.vue';
</script> </script>
<template> <template>
<VnCardBeta data-key="Roadmap" url="Roadmaps" :descriptor="RoadmapDescriptor" /> <VnCard data-key="Roadmap" url="Roadmaps" :descriptor="RoadmapDescriptor" />
</template> </template>

View File

@ -15,6 +15,10 @@ const $props = defineProps({
required: false, required: false,
default: null, default: null,
}, },
summary: {
type: Object,
default: null,
},
}); });
const route = useRoute(); const route = useRoute();
@ -26,7 +30,12 @@ const entityId = computed(() => {
</script> </script>
<template> <template>
<CardDescriptor :url="`Roadmaps/${entityId}`" :filter="filter" data-key="Roadmap"> <CardDescriptor
:url="`Roadmaps/${entityId}`"
:filter="filter"
data-key="Roadmap"
:summary="summary"
>
<template #body="{ entity }"> <template #body="{ entity }">
<VnLv :label="t('Roadmap')" :value="entity?.name" /> <VnLv :label="t('Roadmap')" :value="entity?.name" />
<VnLv :label="t('ETD')" :value="toDateHourMin(entity?.etd)" /> <VnLv :label="t('ETD')" :value="toDateHourMin(entity?.etd)" />

View File

@ -13,6 +13,7 @@ import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
import RouteDescriptorProxy from 'pages/Route/Card/RouteDescriptorProxy.vue'; import RouteDescriptorProxy from 'pages/Route/Card/RouteDescriptorProxy.vue';
import InvoiceInDescriptorProxy from 'pages/InvoiceIn/Card/InvoiceInDescriptorProxy.vue'; import InvoiceInDescriptorProxy from 'pages/InvoiceIn/Card/InvoiceInDescriptorProxy.vue';
import SupplierDescriptorProxy from 'pages/Supplier/Card/SupplierDescriptorProxy.vue'; import SupplierDescriptorProxy from 'pages/Supplier/Card/SupplierDescriptorProxy.vue';
import AgencyDescriptorProxy from 'pages/Route/Agency/Card/AgencyDescriptorProxy.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnDms from 'components/common/VnDms.vue'; import VnDms from 'components/common/VnDms.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
@ -236,10 +237,16 @@ onUnmounted(() => (stateStore.rightDrawer = false));
selection: 'multiple', selection: 'multiple',
}" }"
> >
<template #column-id="{ row }"> <template #column-agencyModeName="{ row }">
<span class="link" @click.stop> <span class="link" @click.stop>
{{ row.routeFk }} {{ row?.agencyModeName }}
<RouteDescriptorProxy :id="row.route.id" /> <AgencyDescriptorProxy :id="row?.agencyModeFk" v-if="row?.agencyModeFk" />
</span>
</template>
<template #column-agencyAgreement="{ row }">
<span class="link" @click.stop>
{{ row?.agencyAgreement }}
<AgencyDescriptorProxy :id="row?.agencyFk" v-if="row?.agencyFk" />
</span> </span>
</template> </template>
<template #column-invoiceInFk="{ row }"> <template #column-invoiceInFk="{ row }">

View File

@ -38,7 +38,7 @@ const routeFilter = {
}; };
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'center', align: 'right',
name: 'id', name: 'id',
label: 'Id', label: 'Id',
chip: { chip: {
@ -46,11 +46,11 @@ const columns = computed(() => [
}, },
isId: true, isId: true,
columnFilter: false, columnFilter: false,
width: '25px',
}, },
{ {
align: 'center',
name: 'workerFk', name: 'workerFk',
label: t('route.Worker'), label: t('globals.worker'),
create: true, create: true,
component: 'select', component: 'select',
attrs: { attrs: {
@ -71,9 +71,8 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.workerUserName), format: (row, dashIfEmpty) => dashIfEmpty(row.workerUserName),
}, },
{ {
align: 'center',
name: 'agencyModeFk', name: 'agencyModeFk',
label: t('route.Agency'), label: t('globals.agency'),
isTitle: true, isTitle: true,
cardVisible: true, cardVisible: true,
create: true, create: true,
@ -90,9 +89,8 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.agencyName), format: (row, dashIfEmpty) => dashIfEmpty(row.agencyName),
}, },
{ {
align: 'center',
name: 'vehicleFk', name: 'vehicleFk',
label: t('route.Vehicle'), label: t('globals.vehicle'),
cardVisible: true, cardVisible: true,
create: true, create: true,
component: 'select', component: 'select',
@ -111,9 +109,8 @@ const columns = computed(() => [
format: (row, dashIfEmpty) => dashIfEmpty(row.vehiclePlateNumber), format: (row, dashIfEmpty) => dashIfEmpty(row.vehiclePlateNumber),
}, },
{ {
align: 'center',
name: 'dated', name: 'dated',
label: t('route.Date'), label: t('globals.date'),
columnFilter: false, columnFilter: false,
cardVisible: true, cardVisible: true,
create: true, create: true,
@ -122,9 +119,8 @@ const columns = computed(() => [
dated === '0000-00-00' ? dashIfEmpty(null) : toDate(dated), dated === '0000-00-00' ? dashIfEmpty(null) : toDate(dated),
}, },
{ {
align: 'center',
name: 'from', name: 'from',
label: t('route.From'), label: t('globals.from'),
visible: false, visible: false,
cardVisible: true, cardVisible: true,
create: true, create: true,
@ -132,9 +128,8 @@ const columns = computed(() => [
format: ({ from }) => toDate(from), format: ({ from }) => toDate(from),
}, },
{ {
align: 'center',
name: 'to', name: 'to',
label: t('route.To'), label: t('globals.to'),
visible: false, visible: false,
cardVisible: true, cardVisible: true,
create: true, create: true,
@ -142,30 +137,31 @@ const columns = computed(() => [
format: ({ date }) => toDate(date), format: ({ date }) => toDate(date),
}, },
{ {
align: 'center', align: 'right',
name: 'm3', name: 'm3',
label: 'm3', label: 'm3',
cardVisible: true, cardVisible: true,
columnClass: 'shrink', columnClass: 'shrink',
width: '50px',
}, },
{ {
align: 'center',
name: 'started', name: 'started',
label: t('route.hourStarted'), label: t('route.hourStarted'),
component: 'time', component: 'time',
columnFilter: false, columnFilter: false,
format: ({ started }) => toHour(started), format: ({ started }) => toHour(started),
width: '50px',
}, },
{ {
align: 'center',
name: 'finished', name: 'finished',
label: t('route.hourFinished'), label: t('route.hourFinished'),
component: 'time', component: 'time',
columnFilter: false, columnFilter: false,
format: ({ finished }) => toHour(finished), format: ({ finished }) => toHour(finished),
width: '50px',
}, },
{ {
align: 'center', align: 'right',
name: 'kmStart', name: 'kmStart',
label: t('route.KmStart'), label: t('route.KmStart'),
columnClass: 'shrink', columnClass: 'shrink',
@ -173,7 +169,7 @@ const columns = computed(() => [
visible: false, visible: false,
}, },
{ {
align: 'center', align: 'right',
name: 'kmEnd', name: 'kmEnd',
label: t('route.KmEnd'), label: t('route.KmEnd'),
columnClass: 'shrink', columnClass: 'shrink',
@ -181,16 +177,15 @@ const columns = computed(() => [
visible: false, visible: false,
}, },
{ {
align: 'center', align: 'left',
name: 'description', name: 'description',
label: t('route.Description'), label: t('globals.description'),
isTitle: true, isTitle: true,
create: true, create: true,
component: 'input', component: 'input',
field: 'description', field: 'description',
}, },
{ {
align: 'center',
name: 'isOk', name: 'isOk',
label: t('route.Served'), label: t('route.Served'),
component: 'checkbox', component: 'checkbox',
@ -202,7 +197,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('route.Add tickets'), title: t('route.addTicket'),
icon: 'vn:ticketAdd', icon: 'vn:ticketAdd',
action: (row) => openTicketsDialog(row?.id), action: (row) => openTicketsDialog(row?.id),
isPrimary: true, isPrimary: true,
@ -214,7 +209,7 @@ const columns = computed(() => [
isPrimary: true, isPrimary: true,
}, },
{ {
title: t('route.Route summary'), title: t('route.routeSummary'),
icon: 'arrow_forward', icon: 'arrow_forward',
action: (row) => navigate(row?.id), action: (row) => navigate(row?.id),
isPrimary: true, isPrimary: true,
@ -276,11 +271,13 @@ const openTicketsDialog = (id) => {
<QDialog v-model="confirmationDialog"> <QDialog v-model="confirmationDialog">
<QCard style="min-width: 350px"> <QCard style="min-width: 350px">
<QCardSection> <QCardSection>
<p class="text-h6 q-ma-none">{{ t('route.Select the starting date') }}</p> <p class="text-h6 q-ma-none">
{{ t('route.extendedList.selectStartingDate') }}
</p>
</QCardSection> </QCardSection>
<QCardSection class="q-pt-none"> <QCardSection class="q-pt-none">
<VnInputDate <VnInputDate
:label="t('route.Starting date')" :label="t('route.extendedList.startingDate')"
v-model="startingDate" v-model="startingDate"
autofocus autofocus
/> />
@ -288,7 +285,7 @@ const openTicketsDialog = (id) => {
<QCardActions align="right"> <QCardActions align="right">
<QBtn <QBtn
flat flat
:label="t('route.Cancel')" :label="t('globals.cancel')"
v-close-popup v-close-popup
class="text-primary" class="text-primary"
/> />
@ -339,7 +336,7 @@ const openTicketsDialog = (id) => {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="confirmationDialog = true" @click="confirmationDialog = true"
> >
<QTooltip>{{ t('route.Clone Selected Routes') }}</QTooltip> <QTooltip>{{ t('route.extendedList.cloneSelectedRoutes') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
icon="cloud_download" icon="cloud_download"
@ -348,7 +345,9 @@ const openTicketsDialog = (id) => {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="showRouteReport" @click="showRouteReport"
> >
<QTooltip>{{ t('route.Download selected routes as PDF') }}</QTooltip> <QTooltip>{{
t('route.extendedList.downloadSelectedRoutes')
}}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
icon="check" icon="check"
@ -357,7 +356,7 @@ const openTicketsDialog = (id) => {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="markAsServed()" @click="markAsServed()"
> >
<QTooltip>{{ t('route.Mark as served') }}</QTooltip> <QTooltip>{{ t('route.extendedList.markServed') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
</VnTable> </VnTable>

View File

@ -7,8 +7,11 @@ import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
import RouteFilter from 'pages/Route/Card/RouteFilter.vue'; import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue'; import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import AgencyDescriptorProxy from 'src/pages/Route/Agency/Card/AgencyDescriptorProxy.vue';
import VehicleDescriptorProxy from 'src/pages/Route/Vehicle/Card/VehicleDescriptorProxy.vue';
import VnSection from 'src/components/common/VnSection.vue'; import VnSection from 'src/components/common/VnSection.vue';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue'; import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
import RouteTickets from './RouteTickets.vue';
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
@ -24,6 +27,12 @@ const routeFilter = {
}, },
], ],
}; };
function redirectToTickets(id) {
const url = `#/route/${id}/tickets`;
window.open(url, '_blank');
}
const columns = computed(() => [ const columns = computed(() => [
{ {
align: 'right', align: 'right',
@ -34,25 +43,29 @@ const columns = computed(() => [
condition: () => true, condition: () => true,
}, },
columnFilter: false, columnFilter: false,
width: '25px',
}, },
{ {
align: 'left',
name: 'workerFk', name: 'workerFk',
label: t('route.Worker'), label: t('gloabls.worker'),
component: markRaw(VnSelectWorker), component: markRaw(VnSelectWorker),
create: true, create: true,
cardVisible: true,
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef), format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
columnFilter: false, columnFilter: false,
width: '100px',
}, },
{ {
align: 'left', name: 'workerFk',
name: 'agencyName', label: t('globals.worker'),
label: t('route.Agency'), visible: false,
cardVisible: true, cardVisible: true,
}, },
{ {
label: t('route.Agency'), name: 'agencyName',
label: t('globals.agency'),
},
{
label: t('globals.Agency'),
name: 'agencyModeFk', name: 'agencyModeFk',
component: 'select', component: 'select',
attrs: { attrs: {
@ -68,14 +81,18 @@ const columns = computed(() => [
visible: false, visible: false,
}, },
{ {
align: 'left', name: 'agencyName',
name: 'vehiclePlateNumber', label: t('globals.agency'),
label: t('route.Vehicle'), visible: false,
cardVisible: true, cardVisible: true,
}, },
{
name: 'vehiclePlateNumber',
label: t('globals.vehicle'),
},
{ {
name: 'vehicleFk', name: 'vehicleFk',
label: t('route.Vehicle'), label: t('globals.Vehicle'),
cardVisible: true, cardVisible: true,
component: 'select', component: 'select',
attrs: { attrs: {
@ -93,25 +110,27 @@ const columns = computed(() => [
visible: false, visible: false,
}, },
{ {
align: 'left', align: 'center',
name: 'started', name: 'started',
label: t('route.hourStarted'), label: t('route.hourStarted'),
cardVisible: true, cardVisible: true,
columnFilter: false, columnFilter: false,
format: (row) => toHour(row.started), format: ({ started }) => toHour(started),
width: '50px',
}, },
{ {
align: 'left', align: 'center',
name: 'finished', name: 'finished',
label: t('route.hourFinished'), label: t('route.hourFinished'),
cardVisible: true, cardVisible: true,
columnFilter: false, columnFilter: false,
format: (row) => toHour(row.started), format: ({ finished }) => toHour(finished),
width: '50px',
}, },
{ {
align: 'left', align: 'left',
name: 'description', name: 'description',
label: t('route.Description'), label: t('globals.description'),
cardVisible: true, cardVisible: true,
isTitle: true, isTitle: true,
create: true, create: true,
@ -119,7 +138,6 @@ const columns = computed(() => [
columnFilter: false, columnFilter: false,
}, },
{ {
align: 'left',
name: 'isOk', name: 'isOk',
label: t('route.Served'), label: t('route.Served'),
component: 'checkbox', component: 'checkbox',
@ -130,6 +148,12 @@ const columns = computed(() => [
align: 'right', align: 'right',
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{
title: t('globals.pageTitles.tickets'),
icon: 'vn:ticket',
action: (row) => redirectToTickets(row?.id),
isPrimary: true,
},
{ {
title: t('components.smartCard.viewSummary'), title: t('components.smartCard.viewSummary'),
icon: 'preview', icon: 'preview',
@ -155,6 +179,7 @@ const columns = computed(() => [
</template> </template>
<template #body> <template #body>
<VnTable <VnTable
:with-filters="false"
:data-key :data-key
:columns="columns" :columns="columns"
ref="tableRef" ref="tableRef"
@ -174,6 +199,24 @@ const columns = computed(() => [
<WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" /> <WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" />
</span> </span>
</template> </template>
<template #column-agencyName="{ row }">
<span class="link" @click.stop>
{{ row?.agencyName }}
<AgencyDescriptorProxy
:id="row?.agencyModeFk"
v-if="row?.agencyModeFk"
/>
</span>
</template>
<template #column-vehiclePlateNumber="{ row }">
<span class="link" @click.stop>
{{ row?.vehiclePlateNumber }}
<VehicleDescriptorProxy
:id="row?.vehicleFk"
v-if="row?.vehicleFk"
/>
</span>
</template>
</VnTable> </VnTable>
</template> </template>
</VnSection> </VnSection>

View File

@ -2,13 +2,11 @@
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { dashIfEmpty } from 'src/filters'; import { dashIfEmpty } from 'src/filters';
import { toDate, toDateHourMin } from 'filters/index'; import { toDate, toDateHourMin, toCurrency } from 'filters/index';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useSummaryDialog } from 'composables/useSummaryDialog'; import { useSummaryDialog } from 'composables/useSummaryDialog';
import toCurrency from 'filters/toCurrency';
import axios from 'axios'; import axios from 'axios';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnTable from 'components/VnTable/VnTable.vue'; import VnTable from 'components/VnTable/VnTable.vue';
import RoadmapSummary from 'pages/Route/Roadmap/RoadmapSummary.vue'; import RoadmapSummary from 'pages/Route/Roadmap/RoadmapSummary.vue';
@ -17,6 +15,8 @@ import VnInputDate from 'components/common/VnInputDate.vue';
import VnInputTime from 'src/components/common/VnInputTime.vue'; import VnInputTime from 'src/components/common/VnInputTime.vue';
import VnSection from 'src/components/common/VnSection.vue'; import VnSection from 'src/components/common/VnSection.vue';
import RoadmapFilter from './Roadmap/RoadmapFilter.vue'; import RoadmapFilter from './Roadmap/RoadmapFilter.vue';
import VehicleDescriptorProxy from 'src/pages/Route/Vehicle/Card/VehicleDescriptorProxy.vue';
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
const { viewSummary } = useSummaryDialog(); const { viewSummary } = useSummaryDialog();
const { t } = useI18n(); const { t } = useI18n();
@ -33,7 +33,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'name', name: 'name',
label: t('Roadmap'), label: t('route.roadmap.roadmap'),
create: true, create: true,
cardVisible: true, cardVisible: true,
columnFilter: { columnFilter: {
@ -41,9 +41,9 @@ const columns = computed(() => [
}, },
}, },
{ {
align: 'left', align: 'center',
name: 'etd', name: 'etd',
label: t('ETD'), label: t('route.roadmap.etd'),
component: 'date', component: 'date',
columnFilter: { columnFilter: {
inWhere: true, inWhere: true,
@ -54,7 +54,7 @@ const columns = computed(() => [
{ {
align: 'left', align: 'left',
name: 'supplierFk', name: 'supplierFk',
label: t('Carrier'), label: t('route.roadmap.carrier'),
component: 'select', component: 'select',
attrs: { attrs: {
url: 'suppliers', url: 'suppliers',
@ -65,21 +65,21 @@ const columns = computed(() => [
}, },
{ {
name: 'tractorPlate', name: 'tractorPlate',
label: t('Plate'), label: t('route.roadmap.vehicle'),
field: (row) => row.tractorPlate, field: (row) => row.tractorPlate,
sortable: true, sortable: true,
align: 'left', align: 'left',
}, },
{ {
name: 'price', name: 'price',
label: t('Price'), label: t('route.roadmap.price'),
field: (row) => toCurrency(row.price), format: ({ price }) => toCurrency(price),
sortable: true, sortable: true,
align: 'left', align: 'right',
}, },
{ {
name: 'observations', name: 'observations',
label: t('Observations'), label: t('route.roadmap.observations'),
field: (row) => dashIfEmpty(row.observations), field: (row) => dashIfEmpty(row.observations),
sortable: true, sortable: true,
align: 'left', align: 'left',
@ -89,7 +89,7 @@ const columns = computed(() => [
name: 'tableActions', name: 'tableActions',
actions: [ actions: [
{ {
title: t('Ver cmr'), title: t('route.roadmap.seeCmr'),
icon: 'preview', icon: 'preview',
isPrimary: true, isPrimary: true,
action: (row) => viewSummary(row?.id, RoadmapSummary), action: (row) => viewSummary(row?.id, RoadmapSummary),
@ -124,8 +124,8 @@ function confirmRemove() {
.dialog({ .dialog({
component: VnConfirm, component: VnConfirm,
componentProps: { componentProps: {
title: t('Selected roadmaps will be removed'), title: t('route.roadmap.selectedRoadmapsRemoved'),
message: t('Are you sure you want to continue?'), message: t('route.roadmap.areYouSure'),
promise: removeSelection, promise: removeSelection,
}, },
}) })
@ -157,15 +157,24 @@ function exprBuilder(param, value) {
<QCard style="min-width: 350px"> <QCard style="min-width: 350px">
<QCardSection> <QCardSection>
<p class="text-h6 q-ma-none"> <p class="text-h6 q-ma-none">
{{ t('Select the estimated date of departure (ETD)') }} {{ t('route.roadmap.selectEtd') }}
</p> </p>
</QCardSection> </QCardSection>
<QCardSection class="q-pt-none"> <QCardSection class="q-pt-none">
<VnInputDate :label="t('ETD')" v-model="etdDate" autofocus /> <VnInputDate
:label="t('route.roadmap.etd')"
v-model="etdDate"
autofocus
/>
</QCardSection> </QCardSection>
<QCardActions align="right"> <QCardActions align="right">
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" /> <QBtn
flat
:label="t('globals.cancel')"
v-close-popup
class="text-primary"
/>
<QBtn color="primary" v-close-popup @click="cloneSelection"> <QBtn color="primary" v-close-popup @click="cloneSelection">
{{ t('globals.clone') }} {{ t('globals.clone') }}
</QBtn> </QBtn>
@ -181,7 +190,7 @@ function exprBuilder(param, value) {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="isCloneDialogOpen = true" @click="isCloneDialogOpen = true"
> >
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip> <QTooltip>{{ t('route.roadmap.cloneSelected') }}</QTooltip>
</QBtn> </QBtn>
<QBtn <QBtn
icon="delete" icon="delete"
@ -190,7 +199,7 @@ function exprBuilder(param, value) {
:disable="!selectedRows?.length" :disable="!selectedRows?.length"
@click="confirmRemove" @click="confirmRemove"
> >
<QTooltip>{{ t('Delete roadmap(s)') }}</QTooltip> <QTooltip>{{ t('route.roadmap.deleteRoadmap') }}</QTooltip>
</QBtn> </QBtn>
</template> </template>
</VnSubToolbar> </VnSubToolbar>
@ -222,7 +231,7 @@ function exprBuilder(param, value) {
redirect="route/roadmap" redirect="route/roadmap"
:create="{ :create="{
urlCreate: 'Roadmaps', urlCreate: 'Roadmaps',
title: t('Create routemap'), title: t('route.roadmap.createRoadmap'),
onDataSaved: ({ id }) => tableRef.redirect(id), onDataSaved: ({ id }) => tableRef.redirect(id),
formInitialData: {}, formInitialData: {},
}" }"
@ -232,7 +241,10 @@ function exprBuilder(param, value) {
{{ toDateHourMin(row.etd) }} {{ toDateHourMin(row.etd) }}
</template> </template>
<template #column-supplierFk="{ row }"> <template #column-supplierFk="{ row }">
{{ row.supplierFk }} <span class="link" @click.stop>
{{ row.driverName }}
<SupplierDescriptorProxy :id="row.supplierFk" />
</span>
</template> </template>
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<VnInputDate v-model="data.etd" /> <VnInputDate v-model="data.etd" />
@ -251,21 +263,3 @@ function exprBuilder(param, value) {
gap: 12px; gap: 12px;
} }
</style> </style>
<i18n>
es:
Create routemap: Crear troncal
Search roadmaps: Buscar troncales
You can search by roadmap reference: Puedes buscar por referencia del troncal
Delete roadmap(s): Eliminar troncal(es)
Selected roadmaps will be removed: Los troncales seleccionadas serán eliminados
Are you sure you want to continue?: ¿Seguro que quieres continuar?
The date can't be empty: La fecha no puede estar vacía
Clone Selected Routes: Clonar rutas seleccionadas
Create roadmap: Crear troncal
Roadmap: Troncal
Carrier: Transportista
Plate: Matrícula
Price: Precio
Observations: Observaciones
Select the estimated date of departure (ETD): Selecciona la fecha estimada de salida
</i18n>

View File

@ -37,9 +37,9 @@ const columns = computed(() => [
align: 'left', align: 'left',
}, },
{ {
name: 'city', name: 'client',
label: t('City'), label: t('Client'),
field: (row) => row?.city, field: (row) => row?.nickname,
sortable: false, sortable: false,
align: 'left', align: 'left',
}, },
@ -51,9 +51,9 @@ const columns = computed(() => [
align: 'center', align: 'center',
}, },
{ {
name: 'client', name: 'city',
label: t('Client'), label: t('City'),
field: (row) => row?.nickname, field: (row) => row?.city,
sortable: false, sortable: false,
align: 'left', align: 'left',
}, },

View File

@ -1,10 +1,10 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import VehicleDescriptor from './VehicleDescriptor.vue'; import VehicleDescriptor from './VehicleDescriptor.vue';
import VehicleFilter from '../VehicleFilter.js'; import VehicleFilter from '../VehicleFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Vehicle" data-key="Vehicle"
url="Vehicles" url="Vehicles"
:filter="VehicleFilter" :filter="VehicleFilter"

View File

@ -1,17 +1,29 @@
<script setup> <script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import CardDescriptor from 'components/ui/CardDescriptor.vue'; import CardDescriptor from 'components/ui/CardDescriptor.vue';
import axios from 'axios'; import axios from 'axios';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
const { notify } = useNotify(); const { notify } = useNotify();
const props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const route = useRoute();
const entityId = computed(() => props.id || route.params.id);
</script> </script>
<template> <template>
<CardDescriptor <CardDescriptor
:url="`Vehicles/${$route.params.id}`" :url="`Vehicles/${entityId}`"
data-key="Vehicle" data-key="Vehicle"
title="numberPlate" title="numberPlate"
:to-module="{ name: 'VehicleList' }"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
<QItem <QItem

View File

@ -0,0 +1,20 @@
<script setup>
import VehicleDescriptor from 'pages/Route/Vehicle/Card/VehicleDescriptor.vue';
import VehicleSummary from './VehicleSummary.vue';
const $props = defineProps({
id: {
type: Number,
required: true,
},
summary: {
type: Object,
default: null,
},
});
</script>
<template>
<QPopupProxy>
<VehicleDescriptor v-if="$props.id" :id="$props.id" :summary="VehicleSummary" />
</QPopupProxy>
</template>

View File

@ -13,12 +13,13 @@ const props = defineProps({ id: { type: [Number, String], default: null } });
const route = useRoute(); const route = useRoute();
const entityId = computed(() => props.id || +route.params.id); const entityId = computed(() => props.id || +route.params.id);
const baseLink = `#/${route.meta.moduleName.toLowerCase()}/vehicle/${entityId.value}`;
const links = { const links = {
'basic-data': `#/vehicle/${entityId.value}/basic-data`, 'basic-data': `${baseLink}/basic-data`,
notes: `#/vehicle/${entityId.value}/notes`, notes: `${baseLink}/notes`,
dms: `#/vehicle/${entityId.value}/dms`, dms: `${baseLink}/dms`,
'invoice-in': `#/vehicle/${entityId.value}/invoice-in`, 'invoice-in': `${baseLink}/invoice-in`,
events: `#/vehicle/${entityId.value}/events`, events: `${baseLink}/events`,
}; };
</script> </script>
<template> <template>
@ -54,7 +55,10 @@ const links = {
<template #value> <template #value>
<span class="link"> <span class="link">
{{ entity.supplier?.name }} {{ entity.supplier?.name }}
<SupplierDescriptorProxy :id="entity.supplierFk" /> <SupplierDescriptorProxy
v-if="entity.supplierFk"
:id="entity.supplierFk"
/>
</span> </span>
</template> </template>
</VnLv> </VnLv>
@ -63,6 +67,7 @@ const links = {
<span class="link"> <span class="link">
{{ entity.supplierCooler?.name }} {{ entity.supplierCooler?.name }}
<SupplierDescriptorProxy <SupplierDescriptorProxy
v-if="entity.supplierCoolerFk"
:id="entity.supplierCoolerFk" :id="entity.supplierCoolerFk"
/> />
</span> </span>

View File

@ -116,6 +116,7 @@ const columns = computed(() => [
title: t('components.smartCard.openSummary'), title: t('components.smartCard.openSummary'),
icon: 'preview', icon: 'preview',
action: (row) => viewSummary(row.id, VehicleSummary), action: (row) => viewSummary(row.id, VehicleSummary),
isPrimary: true,
}, },
], ],
}, },

View File

@ -1,48 +1,73 @@
route: route:
filter:
Served: Served
extendedList:
selectStartingDate: Select the starting date
startingDate: Starting date
cloneSelectedRoutes: Clone selected routes
downloadSelectedRoutes: Download selected routes as PDF
markServed: Mark as served
roadmap: roadmap:
roadmap: Roadmap
carrier: Carrier
vehicle: Vehicle
price: Price
observations: Observations
etd: ETD
dateCantEmpty: The date can't be empty
createRoadmap: Create roadmap
deleteRoadmap: Delete roadmap(s)
cloneSelected: Clone selected routes
selectedRoadmapsRemoved: Selected roadmaps will be removed
areYouSure: Are you sure you want to continue?
selectEtd: Select the estimated date of departure (ETD)
search: Search roadmap search: Search roadmap
searchInfo: You can search by roadmap reference searchInfo: You can search by roadmap reference
params: params:
warehouseFk: Warehouse
description: Description
m3:
scopeDays: Days Onward
vehicleFk: Vehicle
agencyModeFk: Agency
workerFk: Worker
from: From
to: To
isOk: Served
etd: ETD etd: ETD
tractorPlate: Plate tractorPlate: Plate
price: Price price: Price
observations: Observations observations: Observations
id: ID id: Id
name: Name name: Name
cmrFk: CMR id cmrFk: CMR id
hasCmrDms: Attached in gestdoc hasCmrDms: Attached in gestdoc
ticketFk: Ticketd id ticketFk: Ticketd id
routeFk: Route id routeFk: Route id
clientFk: Client id
countryFk: Country
shipped: Shipped shipped: Shipped
agencyAgreement: Agency agreement agencyAgreement: Agency agreement
agencyModeName: Agency route agencyModeName: Agency route
Worker: Worker
Agency: Agency
Vehicle: Vehicle
Description: Description
hourStarted: H.Start hourStarted: H.Start
hourFinished: H.End hourFinished: H.End
dated: Dated createRoute: Create route
From: From
To: To
Date: Date Date: Date
KmStart: Km start KmStart: Km start
KmEnd: Km end KmEnd: Km end
Served: Served Served: Served
Clone Selected Routes: Clone selected routes addTicket: Add ticket
Select the starting date: Select the starting date routeSummary: Go to summary
Stating date: Starting date
Cancel: Cancel
Mark as served: Mark as served
Download selected routes as PDF: Download selected routes as PDF
Add ticket: Add ticket
Summary: Summary
Route is closed: Route is closed Route is closed: Route is closed
Route is not served: Route is not served Route is not served: Route is not served
search: Search route search: Search route
searchInfo: You can search by route reference searchInfo: You can search by route reference
dated: Dated
preview: Preview
cmr: cmr:
list: search: Search Cmr
searchInfo: You can search Cmr by Id
params:
results: results results: results
cmrFk: CMR id cmrFk: CMR id
hasCmrDms: Attached in gestdoc hasCmrDms: Attached in gestdoc
@ -50,8 +75,10 @@ route:
'false': 'No' 'false': 'No'
ticketFk: Ticketd id ticketFk: Ticketd id
routeFk: Route id routeFk: Route id
country: Country countryFk: Country
clientFk: Client id clientFk: Client id
warehouseFk: Warehouse
shipped: Preparation date shipped: Preparation date
viewCmr: View CMR viewCmr: View CMR
downloadCmrs: Download CMRs downloadCmrs: Download CMRs
search: General search

View File

@ -1,21 +1,55 @@
route: route:
filter:
Served: Servida
extendedList:
selectStartingDate: Seleccione la fecha de inicio
statingDate: Fecha de inicio
cloneSelectedRoutes: Clonar rutas seleccionadas
downloadSelectedRoutes: Descargar rutas seleccionadas como PDF
markServed: Marcar como servidas
roadmap: roadmap:
roadmap: Troncal
carrier: Transportista
vehicle: Vehículo
price: Precio
observations: Observaciones
etd: ETD
dateCantEmpty: La fecha no puede estar vacía
createRoadmap: Crear troncal
deleteRoadmap: Eliminar troncal(es)
cloneSelected: Clonar rutas seleccionadas
selectedRoadmapsRemoved: Los troncales seleccionadas serán eliminados
areYouSure: ¿Seguro que quieres continuar?
selectEtd: Selecciona la fecha estimada de salida
search: Buscar troncales search: Buscar troncales
searchInfo: Puedes buscar por referencia del troncal searchInfo: Puedes buscar por referencia del troncal
params: params:
agencyModeName: Agencia Ruta warehouseFk: Almacén
agencyAgreement: Agencia Acuerdo description: Descripción
id: Id m3:
name: Troncal scopeDays: Días adelante
vehicleFk: Vehículo
agencyModeFk: Agencia
workerFk: Trabajador
from: Desde
to: Hasta
isOk: Servida
etd: ETD etd: ETD
tractorPlate: Matrícula tractorPlate: Matrícula
price: Precio price: Precio
observations: Observaciones observations: Observaciones
id: Id
name: Troncal
cmrFk: Id CMR cmrFk: Id CMR
hasCmrDms: Gestdoc hasCmrDms: Gestdoc
search: Búsqueda general
ticketFk: Id ticket ticketFk: Id ticket
routeFK: Id ruta routeFk: Id ruta
clientFk: Id cliente
countryFk: Pais
shipped: Fecha preparación shipped: Fecha preparación
agencyModeName: Agencia Ruta
agencyAgreement: Agencia Acuerdo
Worker: Trabajador Worker: Trabajador
Agency: Agencia Agency: Agencia
Vehicle: Vehículo Vehicle: Vehículo
@ -23,25 +57,18 @@ route:
hourStarted: H.Inicio hourStarted: H.Inicio
hourFinished: H.Fin hourFinished: H.Fin
createRoute: Crear ruta createRoute: Crear ruta
From: Desde
To: Hasta
Date: Fecha Date: Fecha
KmStart: Km inicio KmStart: Km inicio
KmEnd: Km fin KmEnd: Km fin
Served: Servida Served: Servida
Clone Selected Routes: Clonar rutas seleccionadas addTicket: Añadir tickets
Select the starting date: Seleccione la fecha de inicio routeSummary: Ir a vista previa
Stating date: Fecha de inicio
Cancel: Cancelar
Mark as served: Marcar como servidas
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
Add ticket: Añadir tickets
preview: Vista previa
Summary: Resumen
Route is closed: La ruta está cerrada Route is closed: La ruta está cerrada
Route is not served: La ruta no está servida Route is not served: La ruta no está servida
search: Buscar rutas search: Buscar rutas
searchInfo: Puedes buscar por referencia de la ruta searchInfo: Puedes buscar por referencia de la ruta
dated: Fecha
preview: Vista previa
cmr: cmr:
list: list:
results: resultados results: resultados
@ -55,4 +82,4 @@ route:
clientFk: Id cliente clientFk: Id cliente
shipped: Fecha preparación shipped: Fecha preparación
viewCmr: Ver CMR viewCmr: Ver CMR
downloadCmrs: Descargar CMRs downloadCmrs: Descargar CMRs

View File

@ -1,11 +1,11 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import ShelvingDescriptor from 'pages/Shelving/Card/ShelvingDescriptor.vue'; import ShelvingDescriptor from 'pages/Shelving/Card/ShelvingDescriptor.vue';
import filter from './ShelvingFilter.js'; import filter from './ShelvingFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Shelving" data-key="Shelving"
url="Shelvings" url="Shelvings"
:filter="filter" :filter="filter"

View File

@ -6,6 +6,7 @@ import VnLv from 'components/ui/VnLv.vue';
import VnUserLink from 'components/ui/VnUserLink.vue'; import VnUserLink from 'components/ui/VnUserLink.vue';
import filter from './ShelvingFilter.js'; import filter from './ShelvingFilter.js';
import ShelvingDescriptorMenu from './ShelvingDescriptorMenu.vue'; import ShelvingDescriptorMenu from './ShelvingDescriptorMenu.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -38,13 +39,10 @@ const entityId = computed(() => $props.id || route.params.id);
</template> </template>
<template #body="{ entity }"> <template #body="{ entity }">
<QCard class="vn-one"> <QCard class="vn-one">
<RouterLink <VnTitle
class="header header-link" :url="`#/shelving/${entityId}/basic-data`"
:to="{ name: 'ShelvingBasicData', params: { id: entityId } }" :text="$t('globals.pageTitles.basicData')"
> />
{{ $t('globals.pageTitles.basicData') }}
<QIcon name="open_in_new" />
</RouterLink>
<VnLv :label="$t('globals.code')" :value="entity.code" /> <VnLv :label="$t('globals.code')" :value="entity.code" />
<VnLv <VnLv
:label="$t('shelving.list.parking')" :label="$t('shelving.list.parking')"

View File

@ -1,11 +1,11 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import ParkingDescriptor from 'pages/Shelving/Parking/Card/ParkingDescriptor.vue'; import ParkingDescriptor from 'pages/Shelving/Parking/Card/ParkingDescriptor.vue';
import filter from './ParkingFilter.js'; import filter from './ParkingFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Parking" data-key="Parking"
url="Parkings" url="Parkings"
:filter="filter" :filter="filter"

View File

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

View File

@ -1,10 +1,10 @@
<script setup> <script setup>
import SupplierDescriptor from './SupplierDescriptor.vue'; import SupplierDescriptor from './SupplierDescriptor.vue';
import VnCardBeta from 'src/components/common/VnCardBeta.vue'; import VnCard from 'src/components/common/VnCard.vue';
import filter from './SupplierFilter.js'; import filter from './SupplierFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Supplier" data-key="Supplier"
url="Suppliers" url="Suppliers"
:descriptor="SupplierDescriptor" :descriptor="SupplierDescriptor"

View File

@ -203,7 +203,7 @@ onMounted(async () => {
</QTr> </QTr>
<QTr v-for="(buy, index) in row.buys" :key="index"> <QTr v-for="(buy, index) in row.buys" :key="index">
<QTd no-hover> <QTd no-hover>
<QBtn flat color="blue" dense no-caps>{{ buy.itemName }}</QBtn> <QBtn flat class="link" dense no-caps>{{ buy.itemName }}</QBtn>
<ItemDescriptorProxy :id="buy.itemFk" /> <ItemDescriptorProxy :id="buy.itemFk" />
</QTd> </QTd>

View File

@ -172,6 +172,7 @@ const filterColumns = computed(() => {
> >
<template #more-create-dialog="{ data }"> <template #more-create-dialog="{ data }">
<VnInput <VnInput
class="col-span-2"
:label="t('globals.name')" :label="t('globals.name')"
v-model="data.socialName" v-model="data.socialName"
:uppercase="true" :uppercase="true"

View File

@ -1,10 +1,10 @@
<script setup> <script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue'; import VnCard from 'components/common/VnCard.vue';
import TicketDescriptor from './TicketDescriptor.vue'; import TicketDescriptor from './TicketDescriptor.vue';
import filter from './TicketFilter.js'; import filter from './TicketFilter.js';
</script> </script>
<template> <template>
<VnCardBeta <VnCard
data-key="Ticket" data-key="Ticket"
url="Tickets" url="Tickets"
:descriptor="TicketDescriptor" :descriptor="TicketDescriptor"

View File

@ -11,6 +11,7 @@ import { toDateTimeFormat } from 'src/filters/date';
import filter from './TicketFilter.js'; import filter from './TicketFilter.js';
import FetchData from 'src/components/FetchData.vue'; import FetchData from 'src/components/FetchData.vue';
import TicketProblems from 'src/components/TicketProblems.vue'; import TicketProblems from 'src/components/TicketProblems.vue';
import axios from 'axios';
const $props = defineProps({ const $props = defineProps({
id: { id: {
@ -31,23 +32,37 @@ const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
}); });
const problems = ref({}); const problems = ref({});
const originalTicket = ref();
function ticketFilter(ticket) { function ticketFilter(ticket) {
return JSON.stringify({ clientFk: ticket.clientFk }); return JSON.stringify({ clientFk: ticket.clientFk });
} }
async function getClaims() {
const userFilter = { where: { refundTicketFk: entityId.value } };
const { data } = await axios.get(`TicketRefunds`, {
params: { filter: JSON.stringify(userFilter) },
});
if (!data) return;
originalTicket.value = data[0]?.originalTicketFk;
}
async function getProblems() {
const { data } = await axios.get(`Tickets/${entityId.value}/getTicketProblems`);
if (!data) return;
problems.value = data[0];
}
function getInfo() {
getClaims();
getProblems();
}
</script> </script>
<template> <template>
<FetchData
:url="`Tickets/${entityId}/getTicketProblems`"
auto-load
@on-fetch="(data) => ([problems] = data)"
/>
<CardDescriptor <CardDescriptor
:url="`Tickets/${entityId}`" :url="`Tickets/${entityId}`"
:filter="filter" :filter="filter"
data-key="Ticket" data-key="Ticket"
:summary="$props.summary" :summary="$props.summary"
@on-fetch="getInfo"
width="lg-width" width="lg-width"
> >
<template #menu="{ entity }"> <template #menu="{ entity }">
@ -129,6 +144,15 @@ function ticketFilter(ticket) {
> >
<QTooltip>{{ t('ticket.card.newOrder') }}</QTooltip> <QTooltip>{{ t('ticket.card.newOrder') }}</QTooltip>
</QBtn> </QBtn>
<QBtn
v-if="originalTicket"
size="md"
icon="vn:claims"
color="primary"
:to="{ name: 'TicketCard', params: { id: originalTicket } }"
>
<QTooltip>{{ t('ticket.card.ticketClaimed') }}</QTooltip>
</QBtn>
</QCardActions> </QCardActions>
</template> </template>
</CardDescriptor> </CardDescriptor>

View File

@ -123,7 +123,7 @@ async function handleSave() {
} }
function validateFields(item) { function validateFields(item) {
// Only validate fields that are being updated // Only validate fields that are being updated
const shouldExist = (field) => !isUpdate || field in item; const shouldExist = (field) => field in item;
if (!shouldExist('ticketServiceTypeFk') && !item.ticketServiceTypeFk) { if (!shouldExist('ticketServiceTypeFk') && !item.ticketServiceTypeFk) {
notify('Description is required', 'negative'); notify('Description is required', 'negative');

View File

@ -81,6 +81,7 @@ const openCreateModal = () => createTrackingDialogRef.value.show();
ref="paginateRef" ref="paginateRef"
data-key="TicketTracking" data-key="TicketTracking"
:user-filter="paginateFilter" :user-filter="paginateFilter"
search-url="table"
url="TicketTrackings" url="TicketTrackings"
auto-load auto-load
order="created DESC" order="created DESC"

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