Merge branch 'dev' into 8440-createVehicleNotes
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jose Antonio Tubau 2025-03-11 11:02:14 +00:00
commit ff92c03c16
160 changed files with 3454 additions and 1975 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ yarn-error.log*
# Cypress directories and files
/test/cypress/videos
/test/cypress/screenshots
/junit
# VitePress directories and files
/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
### Added 🆕

12
Jenkinsfile vendored
View File

@ -108,18 +108,22 @@ pipeline {
}
stage('E2E') {
environment {
CREDENTIALS = credentials('docker-registry')
CREDS = credentials('docker-registry')
COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}"
COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ."
}
steps {
script {
sh 'rm junit/e2e-*.xml || true'
sh 'rm -f junit/e2e-*.xml'
env.COMPOSE_TAG = PROTECTED_BRANCH.contains(env.CHANGE_TARGET) ? env.CHANGE_TARGET : 'dev'
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
sh 'cypress run --browser chromium || true'
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ --init") {
sh 'sh test/cypress/cypressParallel.sh 2'
}
}
}

View File

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

View File

@ -39,7 +39,7 @@ ENV PNPM_HOME="/home/app/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN pnpm setup \
&& pnpm install --global cypress@13.6.6 \
&& pnpm install --global cypress@14.1.0 \
&& cypress install
WORKDIR /app

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -12,7 +12,7 @@ defineProps({ row: { type: Object, required: true } });
>
<QIcon name="vn:claims" size="xs">
<QTooltip>
{{ t('ticketSale.claim') }}:
{{ $t('ticketSale.claim') }}:
{{ row.claim?.claimFk }}
</QTooltip>
</QIcon>

View File

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

View File

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

View File

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

View File

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

View File

@ -1,50 +1,56 @@
<script setup>
import { onBeforeMount, computed } from 'vue';
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
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';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import LeftMenu from 'components/LeftMenu.vue';
import RightMenu from 'components/common/RightMenu.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 },
idInWhere: { type: Boolean, default: false },
searchDataKey: { type: String, default: undefined },
searchbarProps: { type: Object, default: undefined },
redirectOnError: { type: Boolean, default: false },
});
const stateStore = useStateStore();
const route = useRoute();
const router = useRouter();
const searchRightDataKey = computed(() => {
if (!props.searchDataKey) return route.name;
return props.searchDataKey;
});
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 } = router.currentRoute.value;
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);
});
@ -56,34 +62,13 @@ async function fetch(id, append = false) {
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>
<QDrawer
v-model="stateStore.leftDrawer"
show-if-above
:width="256"
v-if="stateStore.isHeaderMounted()"
>
<QScrollArea class="fit">
<component :is="descriptor" />
<QSeparator />
<LeftMenu source="card" />
</QScrollArea>
</QDrawer>
<slot name="searchbar" v-if="props.searchDataKey">
<VnSearchbar :data-key="props.searchDataKey" v-bind="props.searchbarProps" />
</slot>
<RightMenu>
<template #right-panel v-if="props.filterPanel">
<component :is="props.filterPanel" :data-key="searchRightDataKey" />
</template>
</RightMenu>
<QPageContainer>
<QPage>
<VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]">
<RouterView :key="$route.path" />
</div>
</QPage>
</QPageContainer>
<VnSubToolbar />
<div :class="[useCardSize(), $attrs.class]">
<RouterView :key="$route.path" />
</div>
</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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -148,8 +148,7 @@ export function useArrayData(key, userOptions) {
}
async function applyFilter({ filter, params }, fetchOptions = {}) {
if (filter) store.userFilter = filter;
store.filter = {};
if (filter) store.filter = filter;
if (params) store.userParams = { ...params };
const response = await fetch(fetchOptions);
@ -245,7 +244,7 @@ export function useArrayData(key, userOptions) {
async function loadMore() {
if (!store.hasMoreData) return;
store.skip = store.limit * store.page;
store.skip = (store?.filter?.limit ?? store.limit) * store.page;
store.page += 1;
await fetch({ append: true });

View File

@ -337,5 +337,5 @@ input::-webkit-inner-spin-button {
}
.containerShrinked {
width: 80%;
width: 70%;
}

View File

@ -369,6 +369,7 @@ globals:
countryFk: Country
countryCodeFk: Country
companyFk: Company
nickname: Alias
model: Model
fuel: Fuel
active: Active

View File

@ -370,6 +370,7 @@ globals:
countryFk: País
countryCodeFk: País
companyFk: Empresa
nickname: Alias
errors:
statusUnauthorized: Acceso denegado
statusInternalServerError: Ha ocurrido un error interno del servidor

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -118,14 +118,6 @@ const debtWarning = computed(() => {
>
<QTooltip>{{ t('Allowed substitution') }}</QTooltip>
</QIcon>
<QIcon
v-if="customer?.isFreezed"
name="vn:frozen"
size="xs"
color="primary"
>
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
</QIcon>
<QIcon
v-if="!entity.account?.active"
color="primary"
@ -150,6 +142,14 @@ const debtWarning = computed(() => {
>
<QTooltip>{{ t('customer.card.notChecked') }}</QTooltip>
</QIcon>
<QIcon
v-if="entity?.isFreezed"
name="vn:frozen"
size="xs"
color="primary"
>
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
</QIcon>
<QBtn
v-if="entity.unpaid"
flat
@ -163,13 +163,13 @@ const debtWarning = computed(() => {
<br />
{{
t('unpaidDated', {
dated: toDate(customer.unpaid?.dated),
dated: toDate(entity.unpaid?.dated),
})
}}
<br />
{{
t('unpaidAmount', {
amount: toCurrency(customer.unpaid?.amount),
amount: toCurrency(entity.unpaid?.amount),
})
}}
</QTooltip>

View File

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

View File

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

View File

@ -17,7 +17,21 @@ describe('getAddresses', () => {
expect(axios.get).toHaveBeenCalledWith(`Clients/${clientId}/addresses`, {
params: {
filter: JSON.stringify({
fields: ['nickname', 'street', 'city', 'id', 'isActive'],
include: [
{
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
},
},
],
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
where: { isActive: true },
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
}),

View File

@ -4,7 +4,21 @@ export async function getAddresses(clientId, _filter = {}) {
if (!clientId) return;
const filter = {
..._filter,
fields: ['nickname', 'street', 'city', 'id', 'isActive'],
include: [
{
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: ['id', 'agencyModeFk'],
},
},
},
},
],
fields: ['nickname', 'street', 'city', 'id', 'isActive', 'clientFk'],
where: { isActive: true },
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -185,7 +185,7 @@ watchEffect(selectedRows);
prefix="invoiceOut"
:array-data-props="{
url: 'InvoiceOuts/filter',
order: ['id DESC'],
order: 'id DESC',
}"
>
<template #advanced-menu>
@ -230,7 +230,7 @@ watchEffect(selectedRows);
</span>
</template>
<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="q-col-gutter-xs">
<VnRow fixed>
@ -396,7 +396,6 @@ watchEffect(selectedRows);
:label="
t('invoiceOutList.tableVisibleColumns.taxArea')
"
:options="taxAreasOptions"
option-label="code"
option-value="code"
/>

View File

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

View File

@ -94,6 +94,7 @@ const submit = async (rows) => {
icon="add_circle"
v-shortcut="'+'"
flat
data-cy="addBarcode_input"
>
<QTooltip>
{{ t('Add barcode') }}

View File

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

View File

@ -226,7 +226,6 @@ const onDenyAccept = (_, responseData) => {
order="shipped ASC, isOk ASC"
:columns="columns"
:user-params="userParams"
:is-editable="true"
:right-search="false"
auto-load
:disable-option="{ card: true }"

View File

@ -1,11 +1,11 @@
<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 filter from './ItemTypeFilter.js';
</script>
<template>
<VnCardBeta
<VnCard
data-key="ItemType"
url="ItemTypes"
:filter="filter"

View File

@ -1,11 +1,11 @@
<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 filter from './OrderFilter.js';
</script>
<template>
<VnCardBeta
<VnCard
data-key="Order"
url="Orders"
:filter="filter"

View File

@ -1,6 +1,6 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { computed, ref, onMounted } from 'vue';
import { computed, ref, onMounted, watch } from 'vue';
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
import { toDateTimeFormat } from 'src/filters/date';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
@ -16,6 +16,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnSection from 'src/components/common/VnSection.vue';
import { getAddresses } from '../Customer/composables/getAddresses';
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
@ -24,6 +25,11 @@ const agencyList = ref([]);
const route = useRoute();
const addressOptions = ref([]);
const dataKey = 'OrderList';
const formInitialData = ref({
active: true,
addressId: null,
clientFk: null,
});
const columns = computed(() => [
{
@ -147,41 +153,57 @@ const columns = computed(() => [
],
},
]);
onMounted(() => {
if (!route.query.createForm) return;
const clientId = route.query.createForm;
const id = JSON.parse(clientId);
fetchClientAddress(id.clientFk);
onMounted(async () => {
if (!route.query) return;
if (route.query?.createForm) {
await onClientSelected(JSON.parse(route.query?.createForm));
} else if (route.query?.table) {
const query = JSON.parse(route.query?.table);
const clientFk = query?.clientFk;
if (clientFk) await onClientSelected({ clientFk });
}
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
});
async function fetchClientAddress(id, formData = {}) {
const { data } = await axios.get(`Clients/${id}/addresses`, {
params: {
filter: JSON.stringify({
include: [
{
relation: 'client',
scope: {
fields: ['defaultAddressFk'],
},
},
],
order: ['isActive DESC'],
}),
},
});
watch(
() => route.query.table,
async (newValue) => {
if (newValue) {
const clientFk = +JSON.parse(newValue)?.clientFk;
if (clientFk) await onClientSelected({ clientFk });
if (tableRef.value)
tableRef.value.create.formInitialData = formInitialData.value;
}
},
);
async function onClientSelected({ clientFk }, formData = {}) {
if (!clientFk) {
addressOptions.value = [];
formData.defaultAddressFk = null;
formData.addressId = null;
return;
}
const { data } = await getAddresses(clientFk);
addressOptions.value = data;
formData.addressId = data[0].client.defaultAddressFk;
fetchAgencies(formData);
formData.defaultAddressFk = data[0].client.defaultAddressFk;
formData.addressId = formData.defaultAddressFk;
formInitialData.value = { ...formData, clientFk };
await fetchAgencies(formData);
}
async function fetchAgencies({ landed, addressId }) {
if (!landed || !addressId) return (agencyList.value = []);
async function fetchAgencies(formData) {
const { landed, addressId } = formData;
if (!landed || !addressId) {
formData.defaultAddressFk = formInitialData.value.defaultAddressFk;
return (agencyList.value = []);
}
const { data } = await axios.get('Agencies/landsThatDay', {
params: {
filter: JSON.stringify({
order: ['agencyMode DESC', 'agencyModeFk ASC'],
order: ['name ASC', 'agencyMode DESC', 'agencyModeFk ASC'],
}),
addressFk: addressId,
landed,
@ -199,6 +221,11 @@ const getDateColor = (date) => {
if (difference == 0) return 'bg-warning';
if (difference < 0) return 'bg-success';
};
const isDefaultAddress = (opt, data) => {
const addressId = data.defaultAddressFk ?? data.addressId;
return addressId === opt.id && opt.isActive;
};
</script>
<template>
@ -224,11 +251,7 @@ const getDateColor = (date) => {
onDataSaved: (url) => {
tableRef.redirect(`${url}/catalog`);
},
formInitialData: {
active: true,
addressId: null,
clientFk: null,
},
formInitialData,
}"
:user-params="{ showEmpty: false }"
:columns="columns"
@ -260,7 +283,9 @@ const getDateColor = (date) => {
:include="{ relation: 'addresses' }"
v-model="data.clientFk"
:label="t('module.customer')"
@update:model-value="(id) => fetchClientAddress(id, data)"
@update:model-value="
(id) => onClientSelected({ clientFk: id }, data)
"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -285,7 +310,19 @@ const getDateColor = (date) => {
@update:model-value="() => fetchAgencies(data)"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItem
v-bind="scope.itemProps"
:class="{ disabled: !scope.opt.isActive }"
>
<QItemSection style="min-width: min-content" avatar>
<QIcon
v-if="isDefaultAddress(scope.opt, data)"
size="sm"
color="grey"
name="star"
class="fill-icon"
/>
</QItemSection>
<QItemSection>
<QItemLabel
:class="{
@ -313,6 +350,7 @@ const getDateColor = (date) => {
<VnInputDate
v-model="data.landed"
:label="t('module.landed')"
data-cy="landedDate"
@update:model-value="() => fetchAgencies(data)"
/>
<VnSelect

View File

@ -1,7 +1,7 @@
<script setup>
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>
<template>
<VnCardBeta data-key="Agency" url="Agencies" :descriptor="AgencyDescriptor" />
<VnCard data-key="Agency" url="Agencies" :descriptor="AgencyDescriptor" />
</template>

View File

@ -1,10 +1,10 @@
<script setup>
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';
</script>
<template>
<VnCardBeta
<VnCard
data-key="Route"
url="Routes"
:filter="filter"

View File

@ -27,12 +27,16 @@ const getZone = async () => {
const filter = {
where: { routeFk: $props.id ? $props.id : route.params.id },
};
const { data } = await axios.get('Tickets/findOne', {
const { data } = await axios.get('Tickets/filter', {
params: {
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}`);
zone.value = zoneData.name;
};

View File

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

View File

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

View File

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

View File

@ -3,16 +3,19 @@ route:
search: Search roadmap
searchInfo: You can search by roadmap reference
params:
id: Id
name: Name
etd: ETD
tractorPlate: Plate
price: Price
observations: Observations
id: ID
name: Name
cmrFk: CMR id
hasCmrDms: Attached in gestdoc
ticketFk: Ticketd id
routeFk: Route id
clientFk: Client id
countryFk: Country
warehouseFk: Warehouse
shipped: Shipped
agencyAgreement: Agency agreement
agencyModeName: Agency route
@ -42,7 +45,9 @@ route:
search: Search route
searchInfo: You can search by route reference
cmr:
list:
search: Search Cmr
searchInfo: You can search Cmr by Id
params:
results: results
cmrFk: CMR id
hasCmrDms: Attached in gestdoc
@ -50,8 +55,10 @@ route:
'false': 'No'
ticketFk: Ticketd id
routeFk: Route id
country: Country
countryFk: Country
clientFk: Client id
warehouseFk: Warehouse
shipped: Preparation date
viewCmr: View CMR
downloadCmrs: Download CMRs
downloadCmrs: Download CMRs
search: General search

View File

@ -3,8 +3,6 @@ route:
search: Buscar troncales
searchInfo: Puedes buscar por referencia del troncal
params:
agencyModeName: Agencia Ruta
agencyAgreement: Agencia Acuerdo
id: Id
name: Troncal
etd: ETD
@ -13,9 +11,15 @@ route:
observations: Observaciones
cmrFk: Id CMR
hasCmrDms: Gestdoc
search: Búsqueda general
ticketFk: Id ticket
routeFK: Id ruta
routeFk: Id ruta
clientFk: Id cliente
countryFk: Pais
warehouseFk: Almacén
shipped: Fecha preparación
agencyModeName: Agencia Ruta
agencyAgreement: Agencia Acuerdo
Worker: Trabajador
Agency: Agencia
Vehicle: Vehículo
@ -55,4 +59,4 @@ route:
clientFk: Id cliente
shipped: Fecha preparación
viewCmr: Ver CMR
downloadCmrs: Descargar CMRs
downloadCmrs: Descargar CMRs

View File

@ -1,11 +1,11 @@
<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 filter from './ShelvingFilter.js';
</script>
<template>
<VnCardBeta
<VnCard
data-key="Shelving"
url="Shelvings"
:filter="filter"

View File

@ -1,11 +1,11 @@
<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 filter from './ParkingFilter.js';
</script>
<template>
<VnCardBeta
<VnCard
data-key="Parking"
url="Parkings"
:filter="filter"

View File

@ -1,14 +1,17 @@
<script setup>
import VnPaginate from 'components/ui/VnPaginate.vue';
import CardList from 'components/ui/CardList.vue';
import VnLv from 'components/ui/VnLv.vue';
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
import ShelvingSummary from 'pages/Shelving/Card/ShelvingSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useI18n } from 'vue-i18n';
import VnTable from 'components/VnTable/VnTable.vue';
import VnSection from 'src/components/common/VnSection.vue';
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
import ShelvingSummary from './Card/ShelvingSummary.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import exprBuilder from './ShelvingExprBuilder.js';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
const { t } = useI18n();
const router = useRouter();
const { viewSummary } = useSummaryDialog();
const dataKey = 'ShelvingList';
@ -17,9 +20,56 @@ const filter = {
include: [{ relation: 'parking' }],
};
function navigate(id) {
router.push({ path: `/shelving/${id}` });
}
const columns = computed(() => [
{
align: 'left',
name: 'code',
label: t('globals.code'),
isId: true,
isTitle: true,
columnFilter: false,
create: true,
},
{
align: 'left',
name: 'parking',
label: t('shelving.list.parking'),
sortable: true,
format: (val) => val?.code ?? '',
cardVisible: true,
},
{
align: 'left',
name: 'priority',
label: t('shelving.list.priority'),
sortable: true,
cardVisible: true,
create: true,
},
{
align: 'left',
name: 'isRecyclable',
label: t('shelving.summary.recyclable'),
sortable: true,
},
{
align: 'right',
label: '',
name: 'tableActions',
actions: [
{
title: t('components.smartCard.viewSummary'),
icon: 'preview',
action: (row) => viewSummary(row.id, ShelvingSummary),
isPrimary: true,
},
],
},
]);
const onDataSaved = ({ id }) => {
router.push({ name: 'ShelvingBasicData', params: { id } });
};
</script>
<template>
@ -37,48 +87,75 @@ function navigate(id) {
<ShelvingFilter data-key="ShelvingList" />
</template>
<template #body>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate :data-key="dataKey">
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:id="row.id"
:title="row.code"
@click="navigate(row.id)"
>
<template #list-items>
<VnLv
:label="$t('shelving.list.parking')"
:title-label="$t('shelving.list.parking')"
:value="row.parking?.code"
/>
<VnLv
:label="$t('shelving.list.priority')"
:value="row?.priority"
/>
</template>
<template #actions>
<QBtn
:label="$t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, ShelvingSummary)"
color="primary"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
<QPageSticky :offset="[20, 20]">
<RouterLink :to="{ name: 'ShelvingCreate' }">
<QBtn fab icon="add" color="primary" v-shortcut="'+'" />
<QTooltip>
{{ $t('shelving.list.newShelving') }}
</QTooltip>
</RouterLink>
</QPageSticky>
</QPage>
<VnTable
:data-key="dataKey"
:columns="columns"
is-editable="false"
:right-search="false"
:use-model="true"
:disable-option="{ table: true }"
redirect="shelving"
default-mode="card"
:create="{
urlCreate: 'Shelvings',
title: t('globals.pageTitles.shelvingCreate'),
onDataSaved,
formInitialData: {
parkingFk: null,
priority: null,
code: '',
isRecyclable: false,
},
}"
>
<template #more-create-dialog="{ data }">
<VnSelect
v-model="data.parkingFk"
url="Parkings"
option-value="id"
option-label="code"
:label="t('shelving.list.parking')"
:filter-options="['id', 'code']"
:fields="['id', 'code']"
/>
<VnCheckbox
v-model="data.isRecyclable"
:label="t('shelving.summary.recyclable')"
/>
</template>
</VnTable>
</template>
</VnSection>
</template>
<style lang="scss" scoped>
.list {
display: flex;
flex-direction: column;
align-items: center;
width: 55%;
}
.list-container {
display: flex;
justify-content: center;
}
</style>
<i18n>
es:
shelving:
list:
parking: Estacionamiento
priority: Prioridad
summary:
recyclable: Reciclable
en:
shelving:
list:
parking: Parking
priority: Priority
summary:
recyclable: Recyclable
</i18n>

View File

@ -1,10 +1,10 @@
<script setup>
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';
</script>
<template>
<VnCardBeta
<VnCard
data-key="Supplier"
url="Suppliers"
:descriptor="SupplierDescriptor"

View File

@ -108,7 +108,6 @@ function handleLocation(data, location) {
<VnAccountNumber
v-model="data.account"
:label="t('supplier.fiscalData.account')"
clearable
data-cy="supplierFiscalDataAccount"
insertable
:maxlength="10"
@ -185,8 +184,8 @@ function handleLocation(data, location) {
/>
<VnCheckbox
v-model="data.isVies"
:label="t('globals.isVies')"
:info="t('whenActivatingIt')"
:label="t('globals.isVies')"
:info="t('whenActivatingIt')"
/>
</div>
</VnRow>

View File

@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import VnTable from 'components/VnTable/VnTable.vue';
import VnSection from 'src/components/common/VnSection.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import FetchData from 'src/components/FetchData.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import SupplierSummary from './Card/SupplierSummary.vue';
@ -53,7 +52,7 @@ const columns = computed(() => [
label: t('globals.alias'),
name: 'alias',
columnFilter: {
name: 'search',
name: 'nickname',
},
cardVisible: true,
},
@ -120,6 +119,21 @@ const columns = computed(() => [
],
},
]);
const filterColumns = computed(() => {
const copy = [...columns.value];
copy.splice(copy.length - 1, 0, {
align: 'left',
label: t('globals.params.provinceFk'),
name: 'provinceFk',
options: provincesOptions.value,
columnFilter: {
component: 'select',
},
});
return copy;
});
</script>
<template>
<FetchData
@ -130,7 +144,7 @@ const columns = computed(() => [
/>
<VnSection
:data-key="dataKey"
:columns="columns"
:columns="filterColumns"
prefix="supplier"
:array-data-props="{
url: 'Suppliers/filter',
@ -158,6 +172,7 @@ const columns = computed(() => [
>
<template #more-create-dialog="{ data }">
<VnInput
class="col-span-2"
:label="t('globals.name')"
v-model="data.socialName"
:uppercase="true"
@ -165,17 +180,6 @@ const columns = computed(() => [
</template>
</VnTable>
</template>
<template #moreFilterPanel="{ params, searchFn }">
<VnSelect
:label="t('globals.params.provinceFk')"
v-model="params.provinceFk"
@update:model-value="searchFn()"
:options="provincesOptions"
filled
dense
class="q-px-sm q-pr-lg"
/>
</template>
</VnSection>
</template>

View File

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

View File

@ -681,6 +681,17 @@ watch(
:disabled-attr="isTicketEditable"
>
<template #column-statusIcons="{ row }">
<QIcon
v-if="row.saleGroupFk"
name="inventory_2"
size="xs"
color="primary"
class="cursor-pointer"
>
<QTooltip class="no-pointer-events">
{{ `saleGroup: ${row.saleGroupFk}` }}
</QTooltip>
</QIcon>
<TicketProblems :row="row" />
</template>
<template #body-cell-picture="{ row }">
@ -740,7 +751,7 @@ watch(
{{ row?.item?.subName.toUpperCase() }}
</div>
</div>
<FetchedTags :item="row" :max-length="6" />
<FetchedTags :item="row.item" :max-length="6" />
<QPopupProxy v-if="row.id && isTicketEditable">
<VnInput
v-model="row.concept"

View File

@ -123,7 +123,7 @@ async function handleSave() {
}
function validateFields(item) {
// 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) {
notify('Description is required', 'negative');

View File

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

View File

@ -1,6 +1,6 @@
<script setup>
import axios from 'axios';
import { computed, ref, onBeforeMount, watch } from 'vue';
import { computed, ref, onBeforeMount, watch, onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStateStore } from 'stores/useStateStore';
import { useI18n } from 'vue-i18n';
@ -22,7 +22,6 @@ import { toTimeFormat } from 'src/filters/date';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import TicketProblems from 'src/components/TicketProblems.vue';
import VnSection from 'src/components/common/VnSection.vue';
import { getClient } from 'src/pages/Customer/composables/getClient';
import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
@ -51,10 +50,20 @@ const userParams = {
onBeforeMount(() => {
initializeFromQuery();
stateStore.rightDrawer = true;
if (!route.query.createForm) return;
onClientSelected(JSON.parse(route.query.createForm));
});
onMounted(async () => {
if (!route.query) return;
if (route.query?.createForm) {
await onClientSelected(JSON.parse(route.query?.createForm));
} else if (route.query?.table) {
const query = route.query?.table;
const clientId = +JSON.parse(query)?.clientFk;
if (clientId) await onClientSelected({ clientId });
}
if (tableRef.value) tableRef.value.create.formInitialData = formInitialData.value;
});
const initializeFromQuery = () => {
if (!route) return;
const query = route.query.table ? JSON.parse(route.query.table) : {};
from.value = query.from || from.toISOString();
to.value = query.to || to.toISOString();
@ -69,7 +78,6 @@ const companiesOptions = ref([]);
const accountingOptions = ref([]);
const amountToReturn = ref();
const dataKey = 'TicketList';
const filterPanelRef = ref(null);
const formInitialData = ref({});
const columns = computed(() => [
@ -251,7 +259,44 @@ const columns = computed(() => [
],
},
]);
const onClientSelected = async (formData) => {
resetAgenciesSelector(formData);
await fetchAddresses(formData);
};
const fetchAddresses = async (formData) => {
if (!formData.clientId) {
addressesOptions.value = [];
formData.defaultAddressFk = null;
formData.addressId = null;
return;
}
const { data } = await getAddresses(formData.clientId);
if (!data) {
formInitialData.value = { clientId: formData.clientId };
return;
}
addressesOptions.value = data;
selectedClient.value = data[0].client;
formData.addressId = selectedClient.value.defaultAddressFk;
formInitialData.value = {
clientId: formData.clientId,
addressId: formData.addressId,
};
};
watch(
() => route.query.table,
async (newValue) => {
if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk;
if (clientId) await onClientSelected({ clientId });
if (tableRef.value)
tableRef.value.create.formInitialData = formInitialData.value;
}
},
{ immediate: true },
);
function resetAgenciesSelector(formData) {
agenciesOptions.value = [];
if (formData) formData.agencyModeId = null;
@ -262,12 +307,6 @@ function redirectToLines(id) {
window.open(url, '_blank');
}
const onClientSelected = async (formData) => {
resetAgenciesSelector(formData);
await fetchClient(formData);
await fetchAddresses(formData);
};
const fetchAvailableAgencies = async (formData) => {
resetAgenciesSelector(formData);
const response = await getAgencies(formData, selectedClient.value);
@ -278,22 +317,6 @@ const fetchAvailableAgencies = async (formData) => {
if (agency) formData.agencyModeId = agency.agencyModeFk;
};
const fetchClient = async (formData) => {
const response = await getClient(formData.clientId);
if (!response) return;
const [client] = response.data;
selectedClient.value = client;
};
const fetchAddresses = async (formData) => {
const response = await getAddresses(formData.clientId);
if (!response) return;
addressesOptions.value = response.data;
const { defaultAddress } = selectedClient.value;
formData.addressId = defaultAddress.id;
};
const getColor = (row) => {
if (row.alertLevelCode === 'OK') return 'bg-success';
else if (row.alertLevelCode === 'FREE') return 'bg-notice';
@ -445,22 +468,6 @@ function setReference(data) {
dialogData.value.value.description = newDescription;
}
watch(
() => route.query.table,
(newValue) => {
if (newValue) {
const clientId = +JSON.parse(newValue)?.clientFk;
if (!clientId) return;
formInitialData.value = {
clientId,
};
if (tableRef.value) tableRef.value.create.formInitialData = { clientId };
onClientSelected({ clientId });
}
},
{ immediate: true },
);
</script>
<template>

View File

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

View File

@ -1,6 +1,6 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import VnCard from 'src/components/common/VnCard.vue';
</script>
<template>
<VnCard data-key="Wagon" url="Wagons" />
<VnCard data-key="Wagon" url="Wagons" :descriptor="{}" />
</template>

View File

@ -8,6 +8,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import { computed, ref } from 'vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSection from 'src/components/common/VnSection.vue';
const quasar = useQuasar();
const arrayData = useArrayData('WagonList');
@ -15,6 +16,7 @@ const store = arrayData.store;
const router = useRouter();
const { t } = useI18n();
const tableRef = ref();
const dataKey = 'WagonList';
const filter = {
include: {
relation: 'type',
@ -75,101 +77,110 @@ function navigate(id) {
}
async function remove(row) {
try {
await axios.delete(`Wagons/${row.id}`).then(async () => {
quasar.notify({
message: t('wagon.list.removeItem'),
type: 'positive',
});
store.data.splice(store.data.indexOf(row), 1);
window.location.reload();
await axios.delete(`Wagons/${row.id}`).then(async () => {
quasar.notify({
message: t('wagon.list.removeItem'),
type: 'positive',
});
} catch (error) {
//
}
store.data.splice(store.data.indexOf(row), 1);
window.location.reload();
});
}
</script>
<template>
<QPage class="column items-center q-pa-md">
<VnTable
ref="tableRef"
data-key="WagonList"
url="Wagons"
:filter="filter"
<VnSection
:data-key="dataKey"
:columns="columns"
order="id DESC"
:column-search="false"
:default-mode="'card'"
:disable-option="{ table: true }"
:create="{
urlCreate: 'Wagons',
title: t('Create new wagon'),
onDataSaved: () => tableRef.reload(),
formInitialData: {},
prefix="card"
:array-data-props="{
url: 'Wagons',
exprBuilder,
order: 'id DESC',
}"
>
<template #more-create-dialog="{ data }">
<VnInput
filled
v-model="data.label"
:label="t('wagon.create.label')"
type="number"
min="0"
:rules="[(val) => !!val || t('wagon.warnings.labelNotEmpty')]"
/>
<VnInput
filled
v-model="data.plate"
:label="t('wagon.list.plate')"
:rules="[(val) => !!val || t('wagon.warnings.plateNotEmpty')]"
/>
<VnInput
filled
v-model="data.volume"
:label="t('wagon.list.volume')"
type="number"
min="0"
:rules="[(val) => !!val || t('wagon.warnings.volumeNotEmpty')]"
/>
<VnSelect
url="WagonTypes"
filled
v-model="data.typeFk"
use-input
fill-input
hide-selected
input-debounce="0"
option-label="name"
option-value="id"
emit-value
map-options
:label="t('globals.type')"
:options="filteredWagonTypes"
:rules="[(val) => !!val || t('wagon.warnings.typeNotEmpty')]"
@filter="filterType"
<template #body>
<VnTable
ref="tableRef"
:data-key="dataKey"
:create="{
urlCreate: 'Wagons',
title: t('Create new wagon'),
onDataSaved: () => tableRef.reload(),
formInitialData: {},
}"
:filter="filter"
:columns="columns"
:column-search="false"
:default-mode="'card'"
:disable-option="{ table: true }"
:right-search="false"
>
<template v-if="data.typeFk" #append>
<QIcon
name="cancel"
@click.stop.prevent="data.typeFk = null"
class="cursor-pointer"
<template #more-create-dialog="{ data }">
<VnInput
filled
v-model="data.label"
:label="t('wagon.create.label')"
type="number"
min="0"
:rules="[(val) => !!val || t('wagon.warnings.labelNotEmpty')]"
/>
<VnInput
filled
v-model="data.plate"
:label="t('wagon.list.plate')"
:rules="[(val) => !!val || t('wagon.warnings.plateNotEmpty')]"
/>
<VnInput
filled
v-model="data.volume"
:label="t('wagon.list.volume')"
type="number"
min="0"
:rules="[
(val) => !!val || t('wagon.warnings.volumeNotEmpty'),
]"
/>
<VnSelect
url="WagonTypes"
filled
v-model="data.typeFk"
use-input
fill-input
hide-selected
input-debounce="0"
option-label="name"
option-value="id"
emit-value
map-options
:label="t('globals.type')"
:options="filteredWagonTypes"
:rules="[(val) => !!val || t('wagon.warnings.typeNotEmpty')]"
@filter="filterType"
>
<template v-if="data.typeFk" #append>
<QIcon
name="cancel"
@click.stop.prevent="data.typeFk = null"
class="cursor-pointer"
/>
</template>
<template #no-option>
<QItem>
<QItemSection class="text-grey">
{{ t('wagon.warnings.noData') }}
</QItemSection>
</QItem>
</template>
</VnSelect>
</template>
<template #no-option>
<QItem>
<QItemSection class="text-grey">
{{ t('wagon.warnings.noData') }}
</QItemSection>
</QItem>
</template>
</VnSelect>
</VnTable>
</template>
</VnTable>
</VnSection>
</QPage>
</template>
<i18n>
es:
Create new wagon: Crear nuevo vagón
</i18n>
</i18n>

View File

@ -96,6 +96,7 @@ async function setAdvancedSummary(data) {
option-label="name"
option-value="code"
v-model="data.maritalStatus"
data-cy="MaritalStatus"
/>
</VnRow>
@ -107,6 +108,7 @@ async function setAdvancedSummary(data) {
option-label="name"
option-value="id"
v-model="data.originCountryFk"
data-cy="country"
/>
<VnSelect
:label="t('Education level')"
@ -132,7 +134,7 @@ async function setAdvancedSummary(data) {
<VnInputDate :label="t('seniority')" v-model="data.seniority" />
</VnRow>
<VnRow>
<VnInput v-model="data.fi" :label="t('fi')" />
<VnInput v-model="data.fi" :label="t('fi')" data-cy="fi" />
<VnInputDate :label="t('birth')" v-model="data.birth" />
</VnRow>
<VnRow wrap>

View File

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

View File

@ -98,12 +98,14 @@ watch(
<VnInput
:label="t('worker.operator.numberOfWagons')"
v-model="row.numberOfWagons"
data-cy="numberOfWagons"
/>
<VnSelect
:label="t('worker.operator.train')"
:options="trainsData"
hide-selected
v-model="row.trainFk"
data-cy="train"
:required="true"
/>
</VnRow>
@ -116,6 +118,7 @@ watch(
option-value="code"
v-model="row.itemPackingTypeFk"
:required="true"
data-cy="itemPackingType"
/>
<VnSelect
:label="t('worker.operator.warehouse')"
@ -123,6 +126,7 @@ watch(
hide-selected
v-model="row.warehouseFk"
:required="true"
data-cy="warehouse"
/>
</VnRow>
<VnRow>
@ -132,6 +136,7 @@ watch(
hide-selected
option-label="description"
v-model="row.sectorFk"
data-cy="sector"
/>
<VnSelect
:label="t('worker.operator.labeler')"
@ -139,6 +144,7 @@ watch(
hide-selected
option-label="name"
v-model="row.labelerFk"
data-cy="labeler"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
@ -160,11 +166,13 @@ watch(
:label="t('worker.operator.linesLimit')"
v-model="row.linesLimit"
lazy-rules
data-cy="linesLimit"
/>
<VnInput
:label="t('worker.operator.volumeLimit')"
v-model="row.volumeLimit"
lazy-rules
data-cy="volumeLimit"
/>
</VnRow>
<VnRow>
@ -172,6 +180,7 @@ watch(
:label="t('worker.operator.sizeLimit')"
v-model="row.sizeLimit"
lazy-rules
data-cy="sizeLimit"
/>
<VnInput
:label="t('worker.operator.isOnReservationMode')"

View File

@ -68,8 +68,14 @@ const deleteRelative = async (id) => {
:label="t('familySituation')"
clearable
v-model="data.familySituation"
data-cy="familySituation"
/>
<VnInput
:label="t('spouseNif')"
clearable
v-model="data.spouseNif"
data-cy="spouseNif"
/>
<VnInput :label="t('spouseNif')" clearable v-model="data.spouseNif" />
</VnRow>
<VnRow>
<VnSelect
@ -93,11 +99,13 @@ const deleteRelative = async (id) => {
clearable
v-model="data.childPension"
:label="t(`childPension`)"
data-cy="childPension"
/>
<VnInput
clearable
v-model="data.spousePension"
:label="t(`spousePension`)"
data-cy="spousePension"
/>
</VnRow>
<VnRow wrap>
@ -190,12 +198,14 @@ const deleteRelative = async (id) => {
type="number"
v-model="row.birthed"
:label="t(`birthed`)"
data-cy="birthed"
/>
<VnInput
type="number"
v-model="row.adoptionYear"
:label="t(`adoptionYear`)"
data-cy="adoptionYear"
/>
<QCheckbox
v-model="row.isDependend"

View File

@ -53,7 +53,7 @@ const title = computed(() => (isEditMode.value ? t('Edit entry') : t('Add time')
const urlCreate = computed(() =>
isEditMode.value
? `WorkerTimeControls/${$props.entryId}/updateTimeEntry`
: `WorkerTimeControls/${route.params.id}/addTimeEntry`
: `WorkerTimeControls/${route.params.id}/addTimeEntry`,
);
onBeforeMount(() => {
@ -83,6 +83,7 @@ onBeforeMount(() => {
autofocus
:required="true"
:is-clearable="false"
data-cy="entryHour"
/>
<VnSelect
:label="t('Type')"
@ -91,6 +92,7 @@ onBeforeMount(() => {
option-value="code"
option-label="description"
hide-selected
data-cy="entryType"
/>
</template>
</FormModelPopup>

View File

@ -1,9 +1,9 @@
<script setup>
import VnCardBeta from 'components/common/VnCardBeta.vue';
import VnCard from 'components/common/VnCard.vue';
import DepartmentDescriptor from 'pages/Worker/Department/Card/DepartmentDescriptor.vue';
</script>
<template>
<VnCardBeta
<VnCard
class="q-pa-md column items-center"
v-bind="{ ...$attrs }"
data-key="Department"

View File

@ -223,7 +223,7 @@ async function autofillBic(worker) {
:right-search="false"
>
<template #more-create-dialog="{ data }">
<div class="q-pa-lg full-width">
<div class="col-span-2">
<VnRadio
v-model="data.isFreelance"
:val="false"
@ -279,7 +279,11 @@ async function autofillBic(worker) {
/>
</VnRow>
<VnRow>
<VnInput v-model="data.fi" :label="t('worker.create.fi')" />
<VnInput
v-model="data.fi"
:label="t('worker.create.fi')"
required
/>
<VnInputDate
v-model="data.birth"
:label="t('worker.create.birth')"

View File

@ -29,10 +29,10 @@ const setFilteredAddresses = (data) => {
<template #form="{ data, validate }">
<VnRow>
<VnInput
data-cy="zone-basic-data-name"
:label="t('Name')"
clearable
v-model="data.name"
data-cy="ZoneBasicDataName"
:required="true"
/>
</VnRow>
@ -75,7 +75,6 @@ const setFilteredAddresses = (data) => {
min="0"
/>
</VnRow>
<VnRow>
<VnInput
v-model="data.travelingDays"
@ -86,7 +85,6 @@ const setFilteredAddresses = (data) => {
/>
<VnInputTime v-model="data.hour" :label="t('Closing')" :required="true" />
</VnRow>
<VnRow>
<VnInput
v-model="data.price"
@ -95,6 +93,7 @@ const setFilteredAddresses = (data) => {
min="0"
:required="true"
clearable
data-cy="ZoneBasicDataPrice"
/>
<VnInput
v-model="data.priceOptimum"
@ -120,11 +119,10 @@ const setFilteredAddresses = (data) => {
option-label="nickname"
:options="addresses"
:fields="['id', 'nickname']"
sort-by="id"
sort-by="nickname ASC"
hide-selected
map-options
:rules="validate('data.addressFk')"
:filter-options="['id']"
/>
</VnRow>
<VnRow>

View File

@ -1,38 +1,7 @@
<script setup>
import { useRoute } from 'vue-router';
import { computed } from 'vue';
import VnCard from 'components/common/VnCard.vue';
import VnCard from 'src/components/common/VnCard.vue';
import ZoneDescriptor from './ZoneDescriptor.vue';
import ZoneFilterPanel from '../ZoneFilterPanel.vue';
import filter from './ZoneFilter.js';
const route = useRoute();
const routeName = computed(() => route.name);
function notIsLocations(ifIsFalse, ifIsTrue) {
if (routeName.value != 'ZoneLocations') return ifIsFalse;
return ifIsTrue;
}
</script>
<template>
<VnCard
data-key="Zone"
:url="notIsLocations('Zones', undefined)"
:descriptor="ZoneDescriptor"
:filter="filter"
:filter-panel="notIsLocations(ZoneFilterPanel, undefined)"
:search-data-key="notIsLocations('ZoneList', undefined)"
:searchbar-props="{
url: notIsLocations('Zones', 'ZoneLocations'),
label: notIsLocations($t('list.searchZone'), $t('list.searchLocation')),
info: $t('list.searchInfo'),
whereFilter: notIsLocations((value) => {
return /^\d+$/.test(value)
? { id: value }
: { name: { like: `%${value}%` } };
}),
}"
/>
<VnCard data-key="Zone" url="Zones" :descriptor="ZoneDescriptor" />
</template>

View File

@ -36,13 +36,13 @@ function openConfirmDialog(callback) {
}
</script>
<template>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable>
<QItem @click="openConfirmDialog('remove')" v-ripple clickable data-cy="Delete_button">
<QItemSection avatar>
<QIcon name="delete" />
</QItemSection>
<QItemSection>{{ t('deleteZone') }}</QItemSection>
</QItem>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
<QItem @click="openConfirmDialog('clone')" v-ripple clickable data-cy="Clone_button">
<QItemSection avatar>
<QIcon name="content_copy" />
</QItemSection>

View File

@ -171,9 +171,10 @@ onMounted(() => {
openConfirmationModal(
t('eventsPanel.deleteTitle'),
t('eventsPanel.deleteSubtitle'),
() => deleteEvent()
() => deleteEvent(),
)
"
data-cy="ZoneEventExclusionDeleteBtn"
/>
<QBtn
:label="isNew ? t('globals.add') : t('globals.save')"

View File

@ -18,7 +18,6 @@ import axios from 'axios';
const props = defineProps({
date: {
type: Date,
required: true,
default: null,
},
event: {
@ -58,7 +57,7 @@ const arrayData = useArrayData('ZoneEvents');
const createEvent = async () => {
eventInclusionFormData.value.weekDays = weekdayStore.toSet(
eventInclusionFormData.value.wdays
eventInclusionFormData.value.wdays,
);
if (inclusionType.value == 'day') eventInclusionFormData.value.weekDays = '';
@ -74,7 +73,7 @@ const createEvent = async () => {
else
await axios.put(
`Zones/${route.params.id}/events/${props.event?.id}`,
eventInclusionFormData.value
eventInclusionFormData.value,
);
await refetchEvents();
@ -123,12 +122,14 @@ onMounted(() => {
dense
val="day"
:label="t('eventsInclusionForm.oneDay')"
data-cy="ZoneEventInclusionDayRadio"
/>
<QRadio
v-model="inclusionType"
dense
val="indefinitely"
:label="t('eventsInclusionForm.indefinitely')"
data-cy="ZoneEventInclusionIndefinitelyRadio"
/>
<QRadio
v-model="inclusionType"
@ -136,6 +137,7 @@ onMounted(() => {
val="range"
:label="t('eventsInclusionForm.rangeOfDates')"
class="q-mb-sm"
data-cy="ZoneEventInclusionRangeRadio"
/>
</div>
<VnRow>
@ -221,7 +223,7 @@ onMounted(() => {
openConfirmationModal(
t('zone.deleteTitle'),
t('zone.deleteSubtitle'),
() => deleteEvent()
() => deleteEvent(),
)
"
/>

View File

@ -1,18 +1,14 @@
<script setup>
import { ref } from 'vue';
import { ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import ZoneEventsPanel from './ZoneEventsPanel.vue';
import ZoneCalendarGrid from '../ZoneCalendarGrid.vue';
import ZoneEventInclusionForm from './ZoneEventInclusionForm.vue';
import ZoneEventExclusionForm from './ZoneEventExclusionForm.vue';
import { useStateStore } from 'stores/useStateStore';
import { reactive } from 'vue';
import RightMenu from 'src/components/common/RightMenu.vue';
const { t } = useI18n();
const stateStore = useStateStore();
const firstDay = ref();
const lastDay = ref();
@ -43,14 +39,16 @@ const onZoneEventFormClose = () => {
</script>
<template>
<Teleport to="#right-panel" v-if="stateStore.isHeaderMounted()">
<ZoneEventsPanel
:first-day="firstDay"
:last-day="lastDay"
:events="events"
v-model:formModeName="formModeName"
/>
</Teleport>
<RightMenu>
<template #right-panel>
<ZoneEventsPanel
:first-day="firstDay"
:last-day="lastDay"
:events="events"
v-model:formModeName="formModeName"
/>
</template>
</RightMenu>
<QPage class="q-pa-md flex justify-center">
<ZoneCalendarGrid
v-model:events="events"

View File

@ -14,12 +14,10 @@ import { useVnConfirm } from 'composables/useVnConfirm';
const props = defineProps({
firstDay: {
type: Date,
required: true,
default: null,
},
lastDay: {
type: Date,
required: true,
default: null,
},
events: {
@ -67,7 +65,7 @@ watch(
async () => {
await fetchData();
},
{ immediate: true, deep: true }
{ immediate: true, deep: true },
);
const formatWdays = (event) => {
@ -178,9 +176,10 @@ onMounted(async () => {
openConfirmationModal(
t('zone.deleteTitle'),
t('zone.deleteSubtitle'),
() => deleteEvent(event.id)
() => deleteEvent(event.id),
)
"
data-cy="ZoneEventsPanelDeleteBtn"
>
<QTooltip>{{ t('eventsPanel.delete') }}</QTooltip>
</QBtn>

View File

@ -1,6 +1,7 @@
<script setup>
import { onMounted, ref, computed, watch, onUnmounted } from 'vue';
import { useRoute } from 'vue-router';
import { useStateStore } from 'stores/useStateStore';
import VnInput from 'src/components/common/VnInput.vue';
import { useState } from 'src/composables/useState';
import axios from 'axios';
@ -30,7 +31,7 @@ const emit = defineEmits(['update:tickedNodes']);
const route = useRoute();
const state = useState();
const stateStore = useStateStore();
const treeRef = ref();
const expanded = ref([]);
@ -82,7 +83,7 @@ const onNodeExpanded = async (nodeKeysArray) => {
await fetchNodeLeaves(lastNodeKey, true);
} else {
const difference = new Set(
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x))
[...previousExpandedNodes.value].filter((x) => !nodeKeysSet.has(x)),
);
const collapsedNode = Array.from(difference).pop();
const node = treeRef.value?.getNodeByKey(collapsedNode);
@ -135,7 +136,7 @@ watch(
}
previousExpandedNodes.value = new Set(expanded.value);
},
{ immediate: true }
{ immediate: true },
);
const reFetch = async () => {
@ -153,6 +154,17 @@ onUnmounted(() => {
</script>
<template>
<Teleport to="#section-searchbar" v-if="stateStore.isHeaderMounted()">
<VnSearchbar
v-if="!showSearchBar"
:data-key="datakey"
:url="url"
:redirect="false"
:search-remove-params="false"
:label="$t('zone.searchLocations')"
:info="$t('zone.searchLocationsInfo')"
/>
</Teleport>
<VnInput
v-if="showSearchBar"
v-model="store.userParams.search"
@ -163,13 +175,6 @@ onUnmounted(() => {
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
</template>
</VnInput>
<VnSearchbar
v-if="!showSearchBar"
:data-key="datakey"
:url="url"
:redirect="false"
:search-remove-params="false"
/>
<QTree
ref="treeRef"
:nodes="nodes"

View File

@ -2,5 +2,5 @@
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="Zone" url="/ZoneLogs"></VnLog>
<VnLog model="Zone" />
</template>

View File

@ -1,74 +0,0 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
const { t } = useI18n();
const exprBuilder = (param, value) => {
switch (param) {
case 'name':
return {
name: { like: `%${value}%` },
};
case 'code':
return {
code: { like: `%${value}%` },
};
case 'agencyModeFk':
return {
agencyModeFk: value,
};
case 'search':
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
}
};
const tableFilter = {
include: [
{
relation: 'agencyMode',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'address',
scope: {
fields: ['id', 'nickname', 'provinceFk', 'postalCode'],
include: [
{
relation: 'province',
scope: {
fields: ['id', 'name'],
},
},
{
relation: 'postcode',
scope: {
fields: ['code', 'townFk'],
include: {
relation: 'town',
scope: {
fields: ['id', 'name'],
},
},
},
},
],
},
},
],
};
</script>
<template>
<VnSearchbar
data-key="ZonesList"
url="Zones"
:filter="tableFilter"
:expr-builder="exprBuilder"
:label="t('list.searchZone')"
:info="t('list.searchInfo')"
custom-route-redirect-name="ZoneSummary"
/>
</template>

View File

@ -60,10 +60,11 @@ onMounted(async () => {
<template>
<CardSummary
data-key="Zone"
data-key="ZoneSummary"
ref="summary"
:url="`Zones/${entityId}`"
:filter="filter"
:entity-id="entityId"
>
<template #header="{ entity }">
<div>#{{ entity.id }} - {{ entity.name }}</div>

View File

@ -185,6 +185,7 @@ const handleDateClick = (timestamp) => {
:class="{
'--today': isToday(timestamp),
}"
data-cy="ZoneCalendarDay"
>
<QPopupProxy v-if="isZoneDeliveryView">
<ZoneClosingTable

View File

@ -3,7 +3,6 @@ import { ref } from 'vue';
import ZoneDeliveryPanel from './ZoneDeliveryPanel.vue';
import ZoneCalendarGrid from './ZoneCalendarGrid.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const firstDay = ref(null);
const lastDay = ref(null);
@ -11,7 +10,6 @@ const events = ref([]);
</script>
<template>
<ZoneSearchbar />
<RightMenu>
<template #right-panel>
<ZoneDeliveryPanel />

View File

@ -46,7 +46,7 @@ watch(
inq.value = {
deliveryMethodFk: { inq: deliveryMethods.value[deliveryMethodFk.value] },
};
}
},
);
</script>
@ -89,7 +89,7 @@ watch(
v-model="formData.geoFk"
url="Postcodes/location"
:fields="['geoFk', 'code', 'townFk', 'countryFk']"
:sort-by="['code ASC']"
:sort-by="'code ASC'"
option-value="geoFk"
option-label="code"
:filter-options="['code']"
@ -98,6 +98,7 @@ watch(
outlined
rounded
map-key="geoFk"
data-cy="ZoneDeliveryDaysPostcodeSelect"
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
@ -129,6 +130,7 @@ watch(
dense
outlined
rounded
data-cy="ZoneDeliveryDaysAgencySelect"
/>
<VnSelect
v-else

View File

@ -1,69 +0,0 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnInput from 'components/common/VnInput.vue';
import FetchData from 'components/FetchData.vue';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnSelect from 'components/common/VnSelect.vue';
import order from 'src/router/modules/order';
const { t } = useI18n();
const props = defineProps({
dataKey: {
type: String,
required: true,
},
exprBuilder: {
type: Function,
default: null,
},
});
const agencies = ref([]);
</script>
<template>
<FetchData
url="AgencyModes"
:filter="{ fields: ['id', 'name'], order: ['name ASC'] }"
@on-fetch="(data) => (agencies = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag }">
<div class="q-gutter-x-xs">
<strong>{{ t(`filterPanel.${tag.label}`) }}: </strong>
<span>{{ tag.value }}</span>
</div>
</template>
<template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInput
:label="t('list.name')"
v-model="params.name"
is-outlined
data-cy="zoneFilterPanelNameInput"
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
:label="t('filterPanel.agencyModeFk')"
v-model="params.agencyModeFk"
:options="agencies"
option-value="id"
option-label="name"
@update:model-value="searchFn()"
dense
outlined
rounded
data-cy="zoneFilterPanelAgencySelect"
>
</VnSelect>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>

View File

@ -14,9 +14,7 @@ import VnTable from 'src/components/VnTable/VnTable.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputTime from 'src/components/common/VnInputTime.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import ZoneFilterPanel from './ZoneFilterPanel.vue';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n();
const router = useRouter();
@ -25,7 +23,7 @@ const { viewSummary } = useSummaryDialog();
const { openConfirmationModal } = useVnConfirm();
const tableRef = ref();
const warehouseOptions = ref([]);
const dataKey = 'ZoneList';
const tableFilter = {
include: [
{
@ -114,6 +112,7 @@ const columns = computed(() => [
columnFilter: {
inWhere: true,
},
columnClass: 'shrink-column',
},
{
align: 'left',
@ -169,77 +168,128 @@ function formatRow(row) {
return dashIfEmpty(`${row?.address?.nickname},
${row?.address?.postcode?.town?.name} (${row?.address?.province?.name})`);
}
const exprBuilder = (param, value) => {
switch (param) {
case 'name':
return {
name: { like: `%${value}%` },
};
case 'code':
return {
code: { like: `%${value}%` },
};
case 'agencyModeFk':
return {
agencyModeFk: value,
};
case 'search':
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
case 'price':
return {
price: value,
};
}
};
</script>
<template>
<ZoneSearchbar />
<RightMenu>
<template #right-panel>
<ZoneFilterPanel data-key="ZonesList" />
</template>
</RightMenu>
<VnTable
ref="tableRef"
data-key="ZonesList"
url="Zones"
:create="{
urlCreate: 'Zones',
title: t('list.createZone'),
onDataSaved: ({ id }) => tableRef.redirect(`${id}/location`),
formInitialData: {},
}"
:user-filter="tableFilter"
<VnSection
:data-key="dataKey"
:columns="columns"
redirect="zone"
:right-search="false"
prefix="zone"
:array-data-props="{
url: 'Zones',
order: ['id ASC'],
userFilter: tableFilter,
exprBuilder,
}"
>
<template #column-addressFk="{ row }">
{{ dashIfEmpty(formatRow(row)) }}
<template #body>
<div class="table-container">
<div class="column items-center">
<VnTable
ref="tableRef"
:data-key="dataKey"
:columns="columns"
redirect="Zone"
:create="{
urlCreate: 'Zones',
title: t('list.createZone'),
onDataSaved: ({ id }) => tableRef.redirect(`${id}/location`),
formInitialData: {},
}"
table-height="85vh"
>
<template #column-addressFk="{ row }">
{{ dashIfEmpty(formatRow(row)) }}
</template>
<template #more-create-dialog="{ data }">
<VnSelect
url="AgencyModes"
v-model="data.agencyModeFk"
option-value="id"
option-label="name"
:label="t('list.agency')"
/>
<VnInput
v-model="data.price"
:label="t('list.price')"
min="0"
type="number"
required="true"
/>
<VnInput
v-model="data.bonus"
:label="t('zone.bonus')"
min="0"
type="number"
/>
<VnInput
v-model="data.travelingDays"
:label="t('zone.travelingDays')"
type="number"
min="0"
/>
<VnInputTime v-model="data.hour" :label="t('list.close')" />
<VnSelect
url="Warehouses"
v-model="data.warehouseFK"
option-value="id"
option-label="name"
:label="t('list.warehouse')"
:options="warehouseOptions"
/>
<QCheckbox
v-model="data.isVolumetric"
:label="t('list.isVolumetric')"
:toggle-indeterminate="false"
/>
</template>
</VnTable>
</div>
</div>
</template>
<template #more-create-dialog="{ data }">
<VnSelect
url="AgencyModes"
sort-by="name ASC"
v-model="data.agencyModeFk"
:label="t('list.agency')"
/>
<VnInput
v-model="data.price"
:label="t('list.price')"
min="0"
type="number"
required="true"
/>
<VnInput
v-model="data.bonus"
:label="t('zone.bonus')"
min="0"
type="number"
/>
<VnInput
v-model="data.travelingDays"
:label="t('zone.travelingDays')"
type="number"
min="0"
/>
<VnInputTime v-model="data.hour" :label="t('list.close')" />
<VnSelect
url="Warehouses"
v-model="data.warehouseFK"
option-value="id"
option-label="name"
:label="t('list.warehouse')"
:options="warehouseOptions"
/>
<QCheckbox
v-model="data.isVolumetric"
:label="t('list.isVolumetric')"
:toggle-indeterminate="false"
/>
</template>
</VnTable>
</VnSection>
</template>
<style lang="scss" scoped>
.table-container {
display: flex;
justify-content: center;
}
.column {
display: flex;
flex-direction: column;
align-items: center;
min-width: 70%;
}
:deep(.shrink-column) {
width: 8%;
}
</style>
<i18n>
es:
Search zone: Buscar zona

View File

@ -7,7 +7,6 @@ import FetchData from 'components/FetchData.vue';
import { toDateFormat } from 'src/filters/date.js';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
const { t } = useI18n();
const weekdayStore = useWeekdayStore();
@ -31,7 +30,7 @@ const columns = computed(() => [
label: t('list.id'),
name: 'id',
field: 'zoneFk',
align: 'left',
align: 'center',
},
]);
@ -53,7 +52,6 @@ onMounted(() => weekdayStore.initStore());
@on-fetch="(data) => (details = data)"
auto-load
/>
<ZoneSearchbar />
<VnSubToolbar />
<QPage class="column items-center q-pa-md">
<QCard class="containerShrinked q-pa-md">

View File

@ -11,10 +11,13 @@ zone:
m3Max: Max m³
deleteTitle: This item will be deleted
deleteSubtitle: Are you sure you want to continue?
volumetric: Volumetric
bonus: Bonus
closing: Closing
travelingDays: Traveling days
search: Search zone
searchInfo: Search zone by id or name
searchLocations: Search locations
searchLocationsInfo: Search locations by post code
list:
clone: Clone
id: Id
@ -30,6 +33,7 @@ list:
confirmCloneTitle: All it's properties will be copied
confirmCloneSubtitle: Do you want to clone this zone?
warehouse: Warehouse
isVolumetric: Volumetric
createZone: Create zone
zoneSummary: Summary
addressFk: Address

View File

@ -15,6 +15,10 @@ zone:
bonus: Bonificación
closing: Cierre
travelingDays: Días de viaje
search: Buscar zona
searchInfo: Buscar zona por Id o nombre
searchLocations: Buscar localización
searchLocationsInfo: Buscar localización por código postal
list:
clone: Clonar
id: Id

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