Compare commits

..

61 Commits

Author SHA1 Message Date
PAU ROVIRA ROSALENY a6adec0407 Merge pull request 'feat: #7103 created test for VnSearchbar' (!1256) from 7103-testVnSearchbar into dev
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #1256
Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
2025-01-22 11:15:20 +00:00
PAU ROVIRA ROSALENY d361ecd514 Merge branch 'dev' into 7103-testVnSearchbar
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 11:13:37 +00:00
Alex Moreno 273d086154 Merge pull request 'feat: refs #7196 update vite and q-calendar' (!1264) from 7196-updateVite into dev
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #1264
Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
2025-01-22 11:05:56 +00:00
Alex Moreno a8870ec46a Merge branch 'dev' into 7196-updateVite
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 11:02:17 +00:00
PAU ROVIRA ROSALENY ffe17751d9 Merge branch 'dev' into 7103-testVnSearchbar
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 10:43:41 +00:00
Javier Segarra 88ce527bf1 Merge pull request '#7308 - Warning inject' (!1065) from 7308_warning into dev
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #1065
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2025-01-22 10:41:32 +00:00
PAU ROVIRA ROSALENY f94c457263 Merge branch 'dev' into 7103-testVnSearchbar
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 10:40:49 +00:00
PAU ROVIRA ROSALENY ea4a46d9c7 fix: refs #7103 used consts for repeated variables
gitea/salix-front/pipeline/pr-dev Build queued... Details
2025-01-22 11:40:25 +01:00
Alex Moreno 0b17da1b76 Merge branch '7196-updateVite' of https://gitea.verdnatura.es/verdnatura/salix-front into 7196-updateVite
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 11:11:42 +01:00
Alex Moreno 675820eff6 fix: refs #7196 not neccessary 2025-01-22 11:11:41 +01:00
Javier Segarra 48a1f89399 Merge branch 'dev' into 7196-updateVite
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-01-22 10:01:38 +00:00
Javier Segarra c19f49dcdd Merge branch 'dev' into 7308_warning
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 10:01:05 +00:00
Alex Moreno 650a5409b1 Merge branch '7196-updateVite' of https://gitea.verdnatura.es/verdnatura/salix-front into 7196-updateVite
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 10:58:01 +01:00
Alex Moreno 155b8b3743 fix: refs #7196 sass 2025-01-22 10:57:59 +01:00
Alex Moreno 1bbee11ec0 Merge pull request 'refactor: refs #8316 used VnSection and VnCardBeta' (!1142) from 8316-customerCardWithVnCardBeta into dev
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #1142
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2025-01-22 09:11:30 +00:00
Javier Segarra 8dc277ec2a Merge branch 'dev' into 7196-updateVite
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-01-22 08:58:28 +00:00
Alex Moreno 467cd8faf7 Merge branch 'dev' into 8316-customerCardWithVnCardBeta
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 08:42:53 +00:00
Jon Elias 6b84f24a08 Merge pull request 'Fix[VnLocation]: fixed label and warnings' (!1268) from Fix-VnLocationLabel into dev
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #1268
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2025-01-22 08:41:17 +00:00
Jon Elias 82010f1684 Merge branch 'dev' into Fix-VnLocationLabel
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 08:40:18 +00:00
Jon Elias f536d08317 fix: fixed VnLocation and warnings
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 09:27:58 +01:00
Alex Moreno 18737878a0 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8316-customerCardWithVnCardBeta
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 09:27:41 +01:00
Alex Moreno ba8db3b73f Merge branch 'dev' into 7196-updateVite
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-01-22 08:26:55 +00:00
Jose Antonio Tubau d499565ca3 Merge pull request 'test: refs #7075 add unit tests for VnInput component' (!1209) from 7075-createTestToVnInput into dev
gitea/salix-front/pipeline/head This commit looks good Details
Reviewed-on: #1209
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
2025-01-22 08:23:39 +00:00
Jose Antonio Tubau 47cb1c2586 Merge branch 'dev' into 7075-createTestToVnInput
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 08:18:58 +00:00
Alex Moreno 092745a069 perf: refs #7196 update eslint
gitea/salix-front/pipeline/pr-dev Build queued... Details
2025-01-22 09:13:30 +01:00
Alex Moreno 9cd56bb33d Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7196-updateVite
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-01-22 09:05:58 +01:00
Javier Segarra 1ec91add8e Merge branch 'dev' into 7308_warning
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 06:45:37 +00:00
PAU ROVIRA ROSALENY d33909ad01 Merge branch '7103-testVnSearchbar' of https://gitea.verdnatura.es/verdnatura/salix-front into 7103-testVnSearchbar
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-22 07:30:31 +01:00
PAU ROVIRA ROSALENY 2aa7177449 fix: refs #7103 updated tests for new changes 2025-01-22 07:30:28 +01:00
PAU ROVIRA ROSALENY 4f31e7c553 Merge branch 'dev' into 7103-testVnSearchbar
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-01-22 06:29:52 +00:00
Jose Antonio Tubau 5618c1f53a Merge branch 'dev' into 7075-createTestToVnInput
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-21 13:51:53 +00:00
PAU ROVIRA ROSALENY 247701125c Merge branch 'dev' into 7103-testVnSearchbar
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-01-21 13:50:37 +00:00
PAU ROVIRA ROSALENY 95a673a8ed Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 7103-testVnSearchbar 2025-01-21 14:48:35 +01:00
PAU ROVIRA ROSALENY 1f5823536f Merge branch 'dev' into 7103-testVnSearchbar
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-01-21 13:41:45 +00:00
PAU ROVIRA ROSALENY 6758c0a4e0 Merge branch '7103-testVnSearchbar' of https://gitea.verdnatura.es/verdnatura/salix-front into 7103-testVnSearchbar 2025-01-21 14:41:31 +01:00
PAU ROVIRA ROSALENY 5e6a83c001 fix: refs #7103 removed unused code on spies 2025-01-21 14:41:28 +01:00
Alex Moreno 7054ad1d40 feat: refs #7196 update vite and q-calendar
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2025-01-21 14:15:57 +01:00
Alex Moreno 350dedd78d feat: refs #8316 add slots on VnTable from VnFilterPanel
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-21 13:19:46 +01:00
Alex Moreno aee29345a5 build: refs #8316 merge dev 2025-01-21 13:05:55 +01:00
PAU ROVIRA ROSALENY df403e35e6 Merge branch 'dev' into 7103-testVnSearchbar
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-21 08:46:12 +00:00
PAU ROVIRA ROSALENY e8cee99b78 feat: refs #7103 created test for VnSearchbar 2025-01-21 09:45:47 +01:00
Javier Segarra a5a2feb8fd Merge branch 'dev' into 7308_warning
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-16 11:49:25 +00:00
Javier Segarra 0da3bcdf40 Merge branch 'dev' into 7308_warning
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-15 20:10:05 +00:00
Javier Segarra 2d8dd46d15 fix: remove console
gitea/salix-front/pipeline/pr-dev Build queued... Details
2025-01-15 20:09:56 +00:00
Jose Antonio Tubau b5bdb975b8 test: refs #7075 add TODO for handling keydown behavior in VnInput component
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-15 15:41:19 +01:00
Jose Antonio Tubau f16e956a53 Merge branch 'dev' into 7075-createTestToVnInput
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-14 07:45:54 +00:00
Jose Antonio Tubau 0a577e0524 Merge branch '7075-createTestToVnInput' of https://gitea.verdnatura.es/verdnatura/salix-front into 7075-createTestToVnInput
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-14 08:45:23 +01:00
Jose Antonio Tubau d0e2093a1c test: refs #7075 update VnInput tests to include label and data-cy attribute 2025-01-14 08:45:21 +01:00
Jose Antonio Tubau 1485166fdd Merge branch 'dev' into 7075-createTestToVnInput
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-13 14:05:49 +00:00
Jose Antonio Tubau 10767615de test: refs #7075 add unit tests for VnInput component
gitea/salix-front/pipeline/pr-dev Build queued... Details
2025-01-13 15:05:15 +01:00
Alex Moreno 074bb6c94c Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8316-customerCardWithVnCardBeta 2025-01-13 13:34:55 +01:00
Alex Moreno d0e6c28ea2 Merge branch 'dev' of https: refs #8316//gitea.verdnatura.es/verdnatura/salix-front into 8316-customerCardWithVnCardBeta
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-13 13:15:49 +01:00
Alex Moreno e9645cf86c Merge branch '8316-customerCardWithVnCardBeta' of https://gitea.verdnatura.es/verdnatura/salix-front into 8316-customerCardWithVnCardBeta 2025-01-13 13:15:05 +01:00
Javier Segarra 7f281b8630 perf: refs #7308 call 1 time useSession
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-13 12:30:07 +01:00
Javier Segarra 70000e3eca Merge branch 'dev' into 7308_warning 2025-01-13 12:19:44 +01:00
Jose Antonio Tubau 1a90be0561 feat: refs #8316 added order param
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2025-01-03 12:47:24 +01:00
Alex Moreno 268ddb027b Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 8316-customerCardWithVnCardBeta 2025-01-02 08:45:52 +01:00
Jose Antonio Tubau 37a87fa8e1 refactor: refs #8316 used VnSection and VnCardBeta
gitea/salix-front/pipeline/pr-test Build queued... Details
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-12-27 13:45:01 +01:00
Javier Segarra aaa08b9d2b Merge branch 'dev' into 7308_warning
gitea/salix-front/pipeline/pr-dev This commit looks good Details
2024-12-27 07:59:50 +01:00
Javier Segarra 8b3076640d test: refs #7308 fix axios.spec.js
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
2024-12-10 15:36:35 +01:00
Javier Segarra 632f7bbdeb feat: refs #7308 remove warning 2024-12-10 15:36:25 +01:00
36 changed files with 2792 additions and 2757 deletions

View File

@ -1,4 +1,4 @@
module.exports = {
export default {
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
// This option interrupts the configuration hierarchy at this file
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
@ -58,7 +58,7 @@ module.exports = {
rules: {
'prefer-promise-reject-errors': 'off',
'no-unused-vars': 'warn',
"vue/no-multiple-template-root": "off" ,
'vue/no-multiple-template-root': 'off',
// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},

View File

@ -1,23 +1,24 @@
const fs = require('fs');
const path = require('path');
import { existsSync, readFileSync, writeFileSync } from 'fs';
import { join, resolve } from 'path';
function getCurrentBranchName(p = process.cwd()) {
if (!fs.existsSync(p)) return false;
if (!existsSync(p)) return false;
const gitHeadPath = path.join(p, '.git', 'HEAD');
const gitHeadPath = join(p, '.git', 'HEAD');
if (!fs.existsSync(gitHeadPath))
return getCurrentBranchName(path.resolve(p, '..'));
if (!existsSync(gitHeadPath)) {
return getCurrentBranchName(resolve(p, '..'));
}
const headContent = fs.readFileSync(gitHeadPath, 'utf-8');
const headContent = readFileSync(gitHeadPath, 'utf-8');
return headContent.trim().split('/')[2];
}
const branchName = getCurrentBranchName();
if (branchName) {
const msgPath = `.git/COMMIT_EDITMSG`;
const msg = fs.readFileSync(msgPath, 'utf-8');
const msgPath = '.git/COMMIT_EDITMSG';
const msg = readFileSync(msgPath, 'utf-8');
const reference = branchName.match(/^\d+/);
const referenceTag = `refs #${reference}`;
@ -26,8 +27,7 @@ if (branchName) {
if (splitedMsg.length > 1) {
const finalMsg = splitedMsg[0] + ': ' + referenceTag + splitedMsg.slice(1).join(':');
fs.writeFileSync(msgPath, finalMsg);
writeFileSync(msgPath, finalMsg);
}
}
}

View File

@ -1,4 +1,4 @@
module.exports = {
export default {
singleQuote: true,
printWidth: 90,
tabWidth: 4,

View File

@ -1 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
export default { extends: ['@commitlint/config-conventional'] };

View File

@ -1,9 +1,9 @@
const { defineConfig } = require('cypress');
import { defineConfig } from 'cypress';
// https://docs.cypress.io/app/tooling/reporters
// https://docs.cypress.io/app/references/configuration
// https://www.npmjs.com/package/cypress-mochawesome-reporter
module.exports = defineConfig({
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:9000/',
experimentalStudio: true,
@ -31,7 +31,7 @@ module.exports = defineConfig({
supportFile: 'test/cypress/support/unit.js',
},
setupNodeEvents(on, config) {
require('cypress-mochawesome-reporter/plugin')(on);
import('cypress-mochawesome-reporter/plugin').then((plugin) => plugin.default(on));
// implement node event listeners here
},
viewportWidth: 1280,

View File

@ -6,6 +6,7 @@
"author": "Verdnatura",
"private": true,
"packageManager": "pnpm@8.15.1",
"type": "module",
"scripts": {
"resetDatabase": "cd ../salix && gulp docker",
"lint": "eslint --ext .js,.vue ./",
@ -20,14 +21,14 @@
"addReferenceTag": "node .husky/addReferenceTag.js"
},
"dependencies": {
"@quasar/cli": "^2.3.0",
"@quasar/extras": "^1.16.14",
"@quasar/cli": "^2.4.1",
"@quasar/extras": "^1.16.16",
"axios": "^1.4.0",
"chromium": "^3.0.3",
"croppie": "^2.6.5",
"moment": "^2.30.1",
"pinia": "^2.1.3",
"quasar": "^2.17.4",
"quasar": "^2.17.7",
"validator": "^13.9.0",
"vue": "^3.5.13",
"vue-i18n": "^9.3.0",
@ -36,22 +37,23 @@
"devDependencies": {
"@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0",
"@intlify/unplugin-vue-i18n": "^0.8.1",
"@intlify/unplugin-vue-i18n": "^0.8.2",
"@pinia/testing": "^0.1.2",
"@quasar/app-vite": "^1.11.0",
"@quasar/quasar-app-extension-qcalendar": "4.0.0-beta.15",
"@quasar/app-vite": "^2.0.8",
"@quasar/quasar-app-extension-qcalendar": "^4.0.2",
"@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-mochawesome-reporter": "^3.8.2",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-vue": "^9.14.1",
"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",
"postcss": "^8.4.23",
"prettier": "^2.8.8",
"prettier": "^3.4.2",
"sass": "^1.83.4",
"vitest": "^0.34.0"
},
"engines": {
@ -61,8 +63,8 @@
"bun": ">= 1.0.25"
},
"overrides": {
"@vitejs/plugin-vue": "^5.0.4",
"vite": "^5.1.4",
"@vitejs/plugin-vue": "^5.2.1",
"vite": "^6.0.11",
"vitest": "^0.31.1"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,14 @@
/* eslint-disable */
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
import autoprefixer from 'autoprefixer';
// Uncomment the following line if you want to support RTL CSS
// import rtlcss from 'postcss-rtlcss';
export default {
plugins: [
// https://github.com/postcss/autoprefixer
require('autoprefixer')({
autoprefixer({
overrideBrowserslist: [
'last 4 Chrome versions',
'last 4 Firefox versions',
@ -18,10 +22,7 @@ module.exports = {
}),
// https://github.com/elchininet/postcss-rtlcss
// If you want to support RTL css, then
// 1. yarn/npm install postcss-rtlcss
// 2. optionally set quasar.config.js > framework > lang to an RTL language
// 3. uncomment the following line:
// require('postcss-rtlcss')
// If you want to support RTL CSS, uncomment the following line:
// rtlcss(),
],
};

View File

@ -8,11 +8,11 @@
// Configuration for your app
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js
const { configure } = require('quasar/wrappers');
const VueI18nPlugin = require('@intlify/unplugin-vue-i18n/vite');
const path = require('path');
import { configure } from 'quasar/wrappers';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import path from 'path';
module.exports = configure(function (/* ctx */) {
export default configure(function (/* ctx */) {
return {
eslint: {
// fix: true,

View File

@ -1,6 +1,8 @@
{
"@quasar/testing-unit-vitest": {
"options": ["scripts"]
"options": [
"scripts"
]
},
"@quasar/qcalendar": {}
}

View File

@ -20,7 +20,7 @@ describe('Axios boot', () => {
describe('onRequest()', async () => {
it('should set the "Authorization" property on the headers', async () => {
const config = { headers: {} };
localStorage.setItem('token', 'DEFAULT_TOKEN');
const resultConfig = onRequest(config);
expect(resultConfig).toEqual(

View File

@ -3,9 +3,9 @@ import { useSession } from 'src/composables/useSession';
import { Router } from 'src/router';
import useNotify from 'src/composables/useNotify.js';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
import { getToken, isLoggedIn } from 'src/utils/session';
import { i18n } from 'src/boot/i18n';
const session = useSession();
const { notify } = useNotify();
const stateQuery = useStateQueryStore();
const baseUrl = '/api/';
@ -13,7 +13,7 @@ axios.defaults.baseURL = baseUrl;
const axiosNoError = axios.create({ baseURL: baseUrl });
const onRequest = (config) => {
const token = session.getToken();
const token = getToken();
if (token.length && !config.headers.Authorization) {
config.headers.Authorization = token;
config.headers['Accept-Language'] = i18n.global.locale.value;
@ -37,15 +37,15 @@ const onResponse = (response) => {
return response;
};
const onResponseError = (error) => {
const onResponseError = async (error) => {
stateQuery.remove(error.config);
if (session.isLoggedIn() && error.response?.status === 401) {
session.destroy(false);
if (isLoggedIn() && error.response?.status === 401) {
await useSession().destroy(false);
const hash = window.location.hash;
const url = hash.slice(1);
Router.push(`/login?redirect=${url}`);
} else if (!session.isLoggedIn()) {
} else if (!isLoggedIn()) {
return Promise.reject(error);
}

View File

@ -33,16 +33,13 @@ const pinnedModules = computed(() => {
const search = ref(null);
const filteredItems = computed(() => {
return filterItems();
});
function filterItems() {
if (!search.value) return items.value;
const normalizedSearch = normalize(search.value);
return items.value.filter((item) => {
const locale = normalize(t(item.title));
return locale.includes(normalizedSearch);
});
}
});
const filteredPinnedModules = computed(() => {
if (!search.value) return pinnedModules.value;
@ -106,17 +103,7 @@ function addChildren(module, route, parent) {
}
function getRoutes() {
const handleRoutes = {
main: getMainRoutes,
card: getCardRoutes,
};
try {
handleRoutes[props.source]();
} catch (error) {
throw new Error(`Method is not defined`);
}
}
function getMainRoutes() {
if (props.source === 'main') {
const modules = Object.assign([], navigation.getModules().value);
for (const item of modules) {
@ -130,16 +117,19 @@ function getMainRoutes() {
}
items.value = modules;
}
}
function getCardRoutes() {
if (props.source === 'card') {
const currentRoute = route.matched[1];
const currentModule = toLowerCamel(currentRoute.name);
let moduleDef = routes.find((route) => toLowerCamel(route.name) === currentModule);
let moduleDef = routes.find(
(route) => toLowerCamel(route.name) === currentModule
);
if (!moduleDef) return;
if (!moduleDef?.menus) moduleDef = betaGetRoutes();
addChildren(currentModule, moduleDef, items.value);
}
}
function betaGetRoutes() {

View File

@ -314,7 +314,19 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
show-if-above
>
<QScrollArea class="fit">
<VnTableFilter :data-key="$attrs['data-key']" :columns="columns" :redirect="redirect" />
<VnTableFilter
:data-key="$attrs['data-key']"
:columns="columns"
:redirect="redirect"
>
<template
v-for="(_, slotName) in $slots"
#[slotName]="slotData"
:key="slotName"
>
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template>
</VnTableFilter>
</QScrollArea>
</QDrawer>
<CrudModel

View File

@ -62,5 +62,8 @@ function columnName(col) {
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template>
</VnFilterPanel>
</template>

View File

@ -1,11 +1,8 @@
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
import { vi, describe, expect, it, beforeAll } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import Leftmenu from 'components/LeftMenu.vue';
import * as vueRouter from 'vue-router';
import { useNavigationStore } from 'src/stores/useNavigationStore';
let vm;
let navigation;
import { useNavigationStore } from 'src/stores/useNavigationStore';
vi.mock('src/router/modules', () => ({
default: [
@ -24,16 +21,6 @@ vi.mock('src/router/modules', () => ({
{
path: '',
name: 'CustomerMain',
meta: {
menu: 'Customer',
menuChildren: [
{
name: 'CustomerCreditContracts',
title: 'creditContracts',
icon: 'vn:solunion',
},
],
},
children: [
{
path: 'list',
@ -41,13 +28,6 @@ vi.mock('src/router/modules', () => ({
meta: {
title: 'list',
icon: 'view_list',
menuChildren: [
{
name: 'CustomerCreditContracts',
title: 'creditContracts',
icon: 'vn:solunion',
},
],
},
},
{
@ -64,59 +44,20 @@ vi.mock('src/router/modules', () => ({
},
],
}));
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
matched: [
{
path: '/',
redirect: {
name: 'Dashboard',
},
name: 'Main',
meta: {},
props: {
default: false,
},
children: [
{
path: '/dashboard',
name: 'Dashboard',
meta: {
title: 'dashboard',
icon: 'dashboard',
},
},
],
},
{
path: '/customer',
redirect: {
name: 'CustomerMain',
},
name: 'Customer',
meta: {
title: 'customers',
icon: 'vn:client',
moduleName: 'Customer',
keyBinding: 'c',
menu: 'customer',
},
},
],
query: {},
params: {},
meta: { moduleName: 'mockName' },
path: 'mockName/1',
name: 'Customer',
});
function mount(source = 'main') {
describe('Leftmenu', () => {
let vm;
let navigation;
beforeAll(() => {
vi.spyOn(axios, 'get').mockResolvedValue({
data: [],
});
const wrapper = createWrapper(Leftmenu, {
vm = createWrapper(Leftmenu, {
propsData: {
source,
source: 'main',
},
});
}).vm;
navigation = useNavigationStore();
navigation.fetchPinned = vi.fn().mockReturnValue(Promise.resolve(true));
@ -130,253 +71,24 @@ function mount(source = 'main') {
},
],
});
return wrapper;
}
describe('getRoutes', () => {
afterEach(() => vi.clearAllMocks());
const getRoutes = vi.fn().mockImplementation((props, getMethodA, getMethodB) => {
const handleRoutes = {
methodA: getMethodA,
methodB: getMethodB,
};
try {
handleRoutes[props.source]();
} catch (error) {
throw Error('Method not defined');
}
});
const getMethodA = vi.fn();
const getMethodB = vi.fn();
const fn = (props) => getRoutes(props, getMethodA, getMethodB);
it('should call getMethodB when source is card', () => {
let props = { source: 'methodB' };
fn(props);
expect(getMethodB).toHaveBeenCalled();
expect(getMethodA).not.toHaveBeenCalled();
});
it('should call getMethodA when source is main', () => {
let props = { source: 'methodA' };
fn(props);
expect(getMethodA).toHaveBeenCalled();
expect(getMethodB).not.toHaveBeenCalled();
});
it('should call getMethodA when source is main', () => {
let props = { source: 'methodC' };
expect(() => fn(props)).toThrowError('Method not defined');
expect(getMethodA).not.toHaveBeenCalled();
expect(getMethodB).not.toHaveBeenCalled();
});
});
describe('Leftmenu as card', () => {
beforeAll(() => {
vm = mount('card').vm;
});
it('should get routes for card source', async () => {
vm.getRoutes();
});
});
describe('Leftmenu as main', () => {
beforeEach(() => {
vm = mount().vm;
});
it('should initialize with default props', () => {
expect(vm.source).toBe('main');
});
it('should filter items based on search input', async () => {
vm.search = 'Rou';
await vm.$nextTick();
expect(vm.filterItems()).toEqual([]);
});
it('should return pinned items', () => {
vm.items = [
{ name: 'Item 1', isPinned: false },
{ name: 'Item 2', isPinned: true },
it('should return a proper formated object with two child items', async () => {
const expectedMenuItem = [
{
children: null,
name: 'CustomerList',
title: 'globals.pageTitles.list',
icon: 'view_list',
},
{
children: null,
name: 'CustomerCreate',
title: 'globals.pageTitles.createCustomer',
icon: 'vn:addperson',
},
];
expect(vm.pinnedModules).toEqual(
new Map([['Item 2', { name: 'Item 2', isPinned: true }]])
);
});
it('should find matches in routes', () => {
const search = 'child1';
const item = {
children: [
{ name: 'child1', children: [] },
{ name: 'child2', children: [] },
],
};
const matches = vm.findMatches(search, item);
expect(matches).toEqual([{ name: 'child1', children: [] }]);
});
it('should not proceed if event is already prevented', async () => {
const item = { module: 'testModule', isPinned: false };
const event = {
preventDefault: vi.fn(),
stopPropagation: vi.fn(),
defaultPrevented: true,
};
await vm.togglePinned(item, event);
expect(event.preventDefault).not.toHaveBeenCalled();
expect(event.stopPropagation).not.toHaveBeenCalled();
});
it('should call quasar.notify with success message', async () => {
const item = { module: 'testModule', isPinned: false };
const event = {
preventDefault: vi.fn(),
stopPropagation: vi.fn(),
defaultPrevented: false,
};
const response = { data: { id: 1 } };
vi.spyOn(axios, 'post').mockResolvedValue(response);
vi.spyOn(vm.quasar, 'notify');
await vm.togglePinned(item, event);
expect(vm.quasar.notify).toHaveBeenCalledWith({
message: 'Data saved',
type: 'positive',
});
});
it('should handle a single matched route with a menu', () => {
const route = {
matched: [{ meta: { menu: 'customer' } }],
};
const result = vm.betaGetRoutes();
expect(result.meta.menu).toEqual(route.matched[0].meta.menu);
});
it('should get routes for main source', () => {
vm.props.source = 'main';
vm.getRoutes();
expect(useNavigationStore().getModules).toHaveBeenCalled();
});
it('should find direct child matches', () => {
const search = 'child1';
const item = {
children: [{ name: 'child1' }, { name: 'child2' }],
};
const result = vm.findMatches(search, item);
expect(result).toEqual([{ name: 'child1' }]);
});
it('should find nested child matches', () => {
const search = 'child3';
const item = {
children: [
{ name: 'child1' },
{
name: 'child2',
children: [{ name: 'child3' }],
},
],
};
const result = vm.findMatches(search, item);
expect(result).toEqual([{ name: 'child3' }]);
});
});
describe('normalize', () => {
beforeAll(() => {
vm = mount('card').vm;
});
it('should normalize and lowercase text', () => {
const input = 'ÁÉÍÓÚáéíóú';
const expected = 'aeiouaeiou';
expect(vm.normalize(input)).toBe(expected);
});
it('should handle empty string', () => {
const input = '';
const expected = '';
expect(vm.normalize(input)).toBe(expected);
});
it('should handle text without diacritics', () => {
const input = 'hello';
const expected = 'hello';
expect(vm.normalize(input)).toBe(expected);
});
it('should handle mixed text', () => {
const input = 'Héllo Wórld!';
const expected = 'hello world!';
expect(vm.normalize(input)).toBe(expected);
});
});
describe('addChildren', () => {
const module = 'testModule';
beforeEach(() => {
vm = mount().vm;
vi.clearAllMocks();
});
it('should add menu items to parent if matches are found', () => {
const parent = 'testParent';
const route = {
meta: {
menu: 'testMenu',
},
children: [{ name: 'child1' }, { name: 'child2' }],
};
vm.addChildren(module, route, parent);
expect(useNavigationStore().addMenuItem).toHaveBeenCalled();
});
it('should handle routes with no meta menu', () => {
const route = {
meta: {},
menus: {},
};
const parent = [];
vm.addChildren(module, route, parent);
expect(useNavigationStore().addMenuItem).toHaveBeenCalled();
});
it('should handle empty parent array', () => {
const parent = [];
const route = {
meta: {
menu: 'child11',
},
children: [
{
name: 'child1',
meta: {
menuChildren: [
{
name: 'CustomerCreditContracts',
title: 'creditContracts',
icon: 'vn:solunion',
},
],
},
},
],
};
vm.addChildren(module, route, parent);
expect(useNavigationStore().addMenuItem).toHaveBeenCalled();
const firstMenuItem = vm.items[0];
expect(firstMenuItem.children).toEqual(expect.arrayContaining(expectedMenuItem));
});
});

View File

@ -102,7 +102,7 @@ const columns = computed(() => [
storage: 'dms',
collection: null,
resolution: null,
id: prop.row.file.split('.')[0],
id: Number(prop.row.file.split('.')[0]),
token: token,
class: 'rounded',
ratio: 1,

View File

@ -70,6 +70,9 @@ const handleModelValue = (data) => {
<VnSelectDialog
v-model="modelValue"
option-filter-value="search"
:option-label="
(opt) => (typeof modelValue === 'string' ? modelValue : showLabel(opt))
"
url="Postcodes/filter"
@update:model-value="handleModelValue"
:use-like="false"

View File

@ -27,7 +27,7 @@ const $props = defineProps({
default: () => [],
},
optionLabel: {
type: [String],
type: [String, Function],
default: 'name',
},
optionValue: {

View File

@ -0,0 +1,91 @@
import { createWrapper } from 'app/test/vitest/helper';
import { vi, describe, expect, it } from 'vitest';
import VnInput from 'src/components/common/VnInput.vue';
describe('VnInput', () => {
let vm;
let wrapper;
let input;
function generateWrapper(value, isOutlined, emptyToNull, insertable) {
wrapper = createWrapper(VnInput, {
props: {
modelValue: value,
isOutlined, emptyToNull, insertable,
maxlength: 101
},
attrs: {
label: 'test',
required: true,
maxlength: 101,
maxLength: 10,
'max-length':20
},
});
wrapper = wrapper.wrapper;
vm = wrapper.vm;
input = wrapper.find('[data-cy="test_input"]');
};
describe('value', () => {
it('should emit update:modelValue when value changes', async () => {
generateWrapper('12345', false, false, true)
await input.setValue('123');
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
expect(wrapper.emitted('update:modelValue')[0]).toEqual(['123']);
});
it('should emit update:modelValue with null when input is empty', async () => {
generateWrapper('12345', false, true, true);
await input.setValue('');
expect(wrapper.emitted('update:modelValue')[0]).toEqual([null]);
});
});
describe('styleAttrs', () => {
it('should return empty styleAttrs when isOutlined is false', async () => {
generateWrapper('123', false, false, false);
expect(vm.styleAttrs).toEqual({});
});
it('should set styleAttrs when isOutlined is true', async () => {
generateWrapper('123', true, false, false);
expect(vm.styleAttrs.outlined).toBe(true);
});
});
describe('handleKeydown', () => {
it('should do nothing when "Backspace" key is pressed', async () => {
generateWrapper('12345', false, false, true);
await input.trigger('keydown', { key: 'Backspace' });
expect(wrapper.emitted('update:modelValue')).toBeUndefined();
const spyhandler = vi.spyOn(vm, 'handleInsertMode');
expect(spyhandler).not.toHaveBeenCalled();
});
/*
TODO: #8399 REDMINE
*/
it.skip('handleKeydown respects insertable behavior', async () => {
const expectedValue = '12345';
generateWrapper('1234', false, false, true);
vm.focus()
await input.trigger('keydown', { key: '5' });
await vm.$nextTick();
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
expect(wrapper.emitted('update:modelValue')[0]).toEqual([expectedValue ]);
expect(vm.value).toBe( expectedValue);
});
});
describe('focus', () => {
it('should call focus method when input is focused', async () => {
generateWrapper('123', false, false, true);
const focusSpy = vi.spyOn(input.element, 'focus');
vm.focus();
expect(focusSpy).toHaveBeenCalled();
});
});
});

View File

@ -1,7 +1,7 @@
<script setup>
import { computed } from 'vue';
import { useQuasar } from 'quasar';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.sass';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
const $props = defineProps({
bordered: {

View File

@ -0,0 +1,71 @@
import { vi, describe, expect, it, beforeEach, afterEach } from 'vitest';
import { createWrapper } from 'app/test/vitest/helper';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
describe('VnSearchbar', () => {
let vm;
let wrapper;
let applyFilterSpy;
const searchText = 'Bolas de madera';
const userParams = {staticKey: 'staticValue'};
beforeEach(async () => {
wrapper = createWrapper(VnSearchbar, {
propsData: {
dataKey: 'testKey',
filter: null,
whereFilter: null,
searchRemoveParams: true,
},
});
wrapper = wrapper.wrapper;
vm = wrapper.vm;
vm.searchText = searchText;
vm.arrayData.store.userParams = userParams;
applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {});
});
afterEach(() => {
vi.clearAllMocks();
});
it('search resets pagination and applies filter', async () => {
const resetPaginationSpy = vi.spyOn(vm.arrayData, 'resetPagination').mockImplementation(() => {});
await vm.search();
expect(resetPaginationSpy).toHaveBeenCalled();
expect(applyFilterSpy).toHaveBeenCalledWith({
params: { search: searchText },
});
});
it('search includes static params if searchRemoveParams is false', async () => {
wrapper.setProps({ searchRemoveParams: false });
await vm.$nextTick();
await vm.search();
expect(applyFilterSpy).toHaveBeenCalledWith({
params: { staticKey: 'staticValue', search: searchText },
filter: {skip: 0},
});
});
it('updates store when dataKey changes', async () => {
expect(vm.store.userParams).toEqual(userParams);
wrapper.setProps({ dataKey: 'newTestKey' });
await vm.$nextTick();
expect(vm.store.userParams).toEqual({});
});
it('computes the "to" property correctly for redirection', () => {
vm.arrayData.store.searchUrl = 'searchParam';
vm.arrayData.store.currentFilter = { category: 'plants' };
const expectedQuery = JSON.stringify({
...vm.arrayData.store.currentFilter,
search: searchText,
});
expect(vm.to.query.searchParam).toBe(expectedQuery);
});
});

View File

@ -6,6 +6,7 @@ import axios from 'axios';
import { useRouter } from 'vue-router';
import useNotify from './useNotify';
import { useTokenConfig } from './useTokenConfig';
import { getToken, getTokenMultimedia } from 'src/utils/session';
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
const TOKEN = 'token';
@ -15,19 +16,6 @@ export function useSession() {
let isCheckingToken = false;
let intervalId = null;
function getToken() {
const localToken = localStorage.getItem(TOKEN);
const sessionToken = sessionStorage.getItem(TOKEN);
return localToken || sessionToken || '';
}
function getTokenMultimedia() {
const localTokenMultimedia = localStorage.getItem(TOKEN_MULTIMEDIA);
const sessionTokenMultimedia = sessionStorage.getItem(TOKEN_MULTIMEDIA);
return localTokenMultimedia || sessionTokenMultimedia || '';
}
function setSession(data) {
let keepLogin = data.keepLogin;
const storage = keepLogin ? localStorage : sessionStorage;

View File

@ -1,6 +1,6 @@
// app global css in SCSS form
@import './icons.scss';
@import '@quasar/quasar-ui-qcalendar/src/QCalendarMonth.sass';
@import '@quasar/quasar-ui-qcalendar/src/QCalendarMonth.scss';
body.body--light {
--vn-header-color: #cecece;

View File

@ -1,25 +1,12 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import VnCard from 'components/common/VnCard.vue';
import VnCardBeta from 'components/common/VnCardBeta.vue';
import CustomerDescriptor from './CustomerDescriptor.vue';
import CustomerFilter from '../CustomerFilter.vue';
const route = useRoute();
const routeName = computed(() => route.name);
</script>
<template>
<VnCard
<VnCardBeta
data-key="Client"
base-url="Clients"
:descriptor="CustomerDescriptor"
:filter-panel="routeName != 'CustomerConsumption' && CustomerFilter"
search-data-key="CustomerList"
:searchbar-props="{
url: 'Clients/filter',
label: 'Search customer',
info: 'You can search by customer id or name',
}"
/>
</template>

View File

@ -1,177 +0,0 @@
<script setup>
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
import VnInput from 'src/components/common/VnInput.vue';
import { QItem } from 'quasar';
import VnSelect from 'src/components/common/VnSelect.vue';
import { QItemSection } from 'quasar';
import VnInputDate from 'src/components/common/VnInputDate.vue';
import { toDate } from 'src/filters';
const { t } = useI18n();
defineProps({ dataKey: { type: String, required: true } });
</script>
<template>
<VnFilterPanel :data-key="dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params }">
<QItem>
<QItemSection>
<VnInput
:label="t('params.item')"
v-model="params.itemId"
is-outlined
lazy-rules
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
v-model="params.buyerId"
url="TicketRequests/getItemTypeWorker"
:fields="['id', 'nickname']"
sort-by="nickname ASC"
:label="t('params.buyer')"
option-value="id"
option-label="nickname"
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
v-model="params.typeId"
url="ItemTypes"
:include="['category']"
:fields="['id', 'name', 'categoryFk']"
sort-by="name ASC"
:label="t('params.typeId')"
option-label="name"
option-value="id"
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>{{
scope.opt?.category?.name
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
v-model="params.categoryId"
url="ItemCategories"
:fields="['id', 'name']"
sort-by="name ASC"
:label="t('params.categoryId')"
option-label="name"
option-value="id"
dense
outlined
rounded
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelect
v-model="params.campaignId"
url="Campaigns/latest"
sort-by="dated DESC"
:label="t('params.campaignId')"
option-label="code"
option-value="id"
dense
outlined
rounded
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{
t(`params.${scope.opt?.code}`)
}}</QItemLabel>
<QItemLabel caption>{{
toDate(scope.opt.dated)
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('params.from')"
v-model="params.from"
@update:model-value="searchFn()"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('params.to')"
v-model="params.to"
@update:model-value="searchFn()"
is-outlined
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
item: Item id
buyer: Buyer
type: Type
category: Category
itemId: Item id
buyerId: Buyer
typeId: Type
categoryId: Category
from: From
to: To
campaignId: Campaña
valentinesDay: Valentine's Day
mothersDay: Mother's Day
allSaints: All Saints' Day
es:
params:
item: Id artículo
buyer: Comprador
type: Tipo
category: Categoría
itemId: Id Artículo
buyerId: Comprador
typeId: Tipo
categoryId: Reino
from: Desde
to: Hasta
campaignId: Campaña
valentinesDay: Día de San Valentín
mothersDay: Día de la Madre
allSaints: Día de Todos los Santos
</i18n>

View File

@ -5,18 +5,19 @@ import { useRouter } from 'vue-router';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { toDate } from 'src/filters';
import RightMenu from 'src/components/common/RightMenu.vue';
import CustomerSummary from './Card/CustomerSummary.vue';
import CustomerFilter from './CustomerFilter.vue';
import VnTable from 'components/VnTable/VnTable.vue';
import VnLocation from 'src/components/common/VnLocation.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
import VnSection from 'src/components/common/VnSection.vue';
const { t } = useI18n();
const router = useRouter();
const tableRef = ref();
const dataKey = 'CustomerList';
const columns = computed(() => [
{
align: 'left',
@ -398,21 +399,23 @@ function handleLocation(data, location) {
</script>
<template>
<VnSearchbar
:info="t('You can search by customer id or name')"
:label="t('Search customer')"
data-key="CustomerList"
/>
<RightMenu>
<template #right-panel>
<VnSection
:data-key="dataKey"
:columns="columns"
prefix="customer"
:array-data-props="{
url: 'Clients/filter',
order: ['id DESC'],
}"
>
<template #rightMenu>
<CustomerFilter data-key="CustomerList" />
</template>
</RightMenu>
<template #body>
<VnTable
ref="tableRef"
data-key="CustomerList"
:data-key="dataKey"
url="Clients/filter"
order="id DESC"
:create="{
urlCreate: 'Clients/createWithUser',
title: t('globals.pageTitles.customerCreate'),
@ -431,7 +434,7 @@ function handleLocation(data, location) {
:label="t('customer.summary.salesPerson')"
v-model="data.salesPersonFk"
:params="{
departmentCodes: ['VT'],
departmentCodes: ['VT', 'shopping'],
}"
:has-avatar="true"
:id-value="data.salesPersonFk"
@ -463,7 +466,12 @@ function handleLocation(data, location) {
@update:model-value="(location) => handleLocation(data, location)"
/>
<QInput v-model="data.userName" :label="t('Web user')" />
<QInput :label="t('Email')" clearable type="email" v-model="data.email">
<QInput
:label="t('Email')"
clearable
type="email"
v-model="data.email"
>
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip max-width="400px">{{
@ -474,6 +482,8 @@ function handleLocation(data, location) {
</QInput>
</template>
</VnTable>
</template>
</VnSection>
</template>
<i18n>
es:

View File

@ -94,6 +94,8 @@ customer:
hasToInvoiceByAddress: Invoice by address
isToBeMailed: Mailing
hasSepaVnl: VNL B2B received
search: Search customer
searchInfo: You can search by customer ID
params:
id: Id
isWorker: Is Worker

View File

@ -1,5 +1,3 @@
Search customer: Buscar cliente
You can search by customer id or name: Puedes buscar por id o nombre del cliente
customer:
card:
debt: Riesgo
@ -96,6 +94,8 @@ customer:
hasToInvoiceByAddress: Factura por consigna
isToBeMailed: Env. emails
hasSepaVnl: Recibido B2B VNL
search: Buscar cliente
searchInfo: Puedes buscar por id o nombre del cliente
params:
id: ID
isWorker: Es trabajador

View File

@ -6,7 +6,7 @@ import { useRoute } from 'vue-router';
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.sass';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import useNotify from 'src/composables/useNotify.js';

View File

@ -196,7 +196,7 @@ async function autofillBic(worker) {
prefix="workerSearch"
:array-data-props="{
url: 'Workers/filter',
order: ['id DESC'],
order: 'id DESC',
}"
>
<template #rightMenu>

View File

@ -7,7 +7,7 @@ import { useRoute } from 'vue-router';
import ZoneClosingTable from './ZoneClosingTable.vue';
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.sass';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.scss';
import { useWeekdayStore } from 'src/stores/useWeekdayStore';
import axios from 'axios';

View File

@ -1,4 +1,4 @@
import { route } from 'quasar/wrappers';
import { route as defineRouter } from 'quasar/wrappers';
import {
createRouter,
createMemoryHistory,
@ -8,14 +8,14 @@ import {
import routes from './routes';
import { i18n } from 'src/boot/i18n';
import { useState } from 'src/composables/useState';
import { useSession } from 'src/composables/useSession';
import { useRole } from 'src/composables/useRole';
import { useUserConfig } from 'src/composables/useUserConfig';
import { useTokenConfig } from 'src/composables/useTokenConfig';
import { useAcl } from 'src/composables/useAcl';
import { isLoggedIn } from 'src/utils/session';
import { useSession } from 'src/composables/useSession';
const state = useState();
const session = useSession();
let session = null;
const { t, te } = i18n.global;
const createHistory = process.env.SERVER
@ -43,11 +43,12 @@ const Router = createRouter({
* with the Router instance.
*/
export { Router };
export default route(function (/* { store, ssrContext } */) {
export default defineRouter(function (/* { store, ssrContext } */) {
const state = useState();
Router.beforeEach(async (to, from, next) => {
const { isLoggedIn } = session;
if (!session) session = useSession();
const outLayout = Router.options.routes[0].children.map((r) => r.name);
if (!isLoggedIn() && !outLayout.includes(to.name)) {
if (!session.isLoggedIn() && !outLayout.includes(to.name)) {
return next({ name: 'Login', query: { redirect: to.fullPath } });
}

View File

@ -1,24 +1,12 @@
import { RouterView } from 'vue-router';
export default {
path: '/customer',
name: 'Customer',
const customerCard = {
name: 'CustomerCard',
path: ':id',
component: () => import('src/pages/Customer/Card/CustomerCard.vue'),
redirect: { name: 'CustomerSummary' },
meta: {
title: 'customers',
icon: 'vn:client',
moduleName: 'Customer',
keyBinding: 'c',
},
component: RouterView,
redirect: { name: 'CustomerMain' },
menus: {
main: [
'CustomerList',
'CustomerPayments',
'CustomerNotifications',
'CustomerDefaulter',
],
card: [
menu: [
'CustomerBasicData',
'CustomerFiscalData',
'CustomerBillingData',
@ -35,70 +23,6 @@ export default {
'CustomerOthers',
],
},
children: [
{
path: '',
name: 'CustomerMain',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'CustomerList' },
children: [
{
path: 'list',
name: 'CustomerList',
meta: {
title: 'list',
icon: 'view_list',
},
component: () => import('src/pages/Customer/CustomerList.vue'),
},
{
path: 'create',
name: 'CustomerCreate',
meta: {
title: 'customerCreate',
icon: 'add',
},
component: () => import('src/pages/Customer/CustomerCreate.vue'),
},
{
path: 'payments',
name: 'CustomerPayments',
meta: {
title: 'webPayments',
icon: 'vn:onlinepayment',
},
component: () =>
import('src/pages/Customer/Payments/CustomerPayments.vue'),
},
{
path: 'notifications',
name: 'CustomerNotifications',
meta: {
title: 'notifications',
icon: 'campaign',
},
component: () =>
import(
'src/pages/Customer/Notifications/CustomerNotifications.vue'
),
},
{
path: 'defaulter',
name: 'CustomerDefaulter',
meta: {
title: 'defaulter',
icon: 'vn:defaulter',
},
component: () =>
import('src/pages/Customer/Defaulter/CustomerDefaulter.vue'),
},
],
},
{
name: 'CustomerCard',
path: ':id',
component: () => import('src/pages/Customer/Card/CustomerCard.vue'),
redirect: { name: 'CustomerSummary' },
children: [
{
name: 'CustomerSummary',
@ -107,8 +31,7 @@ export default {
title: 'summary',
icon: 'launch',
},
component: () =>
import('src/pages/Customer/Card/CustomerSummary.vue'),
component: () => import('src/pages/Customer/Card/CustomerSummary.vue'),
},
{
path: 'basic-data',
@ -503,6 +426,91 @@ export default {
],
},
],
};
export default {
name: 'Customer',
path: '/customer',
meta: {
title: 'customers',
icon: 'vn:client',
moduleName: 'Customer',
keyBinding: 'c',
menu: [
'CustomerList',
'CustomerPayments',
'CustomerNotifications',
'CustomerDefaulter',
],
},
component: RouterView,
redirect: { name: 'CustomerMain' },
children: [
{
name: 'CustomerMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'CustomerIndexMain' },
children: [
{
path: '',
name: 'CustomerIndexMain',
redirect: { name: 'CustomerList' },
component: () => import('src/pages/Customer/CustomerList.vue'),
children: [
{
name: 'CustomerList',
path: 'list',
meta: {
title: 'list',
icon: 'view_list',
},
},
customerCard,
],
},
{
path: 'create',
name: 'CustomerCreate',
meta: {
title: 'customerCreate',
icon: 'add',
},
component: () => import('src/pages/Customer/CustomerCreate.vue'),
},
{
path: 'payments',
name: 'CustomerPayments',
meta: {
title: 'webPayments',
icon: 'vn:onlinepayment',
},
component: () =>
import('src/pages/Customer/Payments/CustomerPayments.vue'),
},
{
path: 'notifications',
name: 'CustomerNotifications',
meta: {
title: 'notifications',
icon: 'campaign',
},
component: () =>
import(
'src/pages/Customer/Notifications/CustomerNotifications.vue'
),
},
{
path: 'defaulter',
name: 'CustomerDefaulter',
meta: {
title: 'defaulter',
icon: 'vn:defaulter',
},
component: () =>
import('src/pages/Customer/Defaulter/CustomerDefaulter.vue'),
},
],
},
],
};

23
src/utils/session.js Normal file
View File

@ -0,0 +1,23 @@
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
const TOKEN = 'token';
function getToken() {
const localToken = localStorage.getItem(TOKEN);
const sessionToken = sessionStorage.getItem(TOKEN);
return localToken || sessionToken || '';
}
function getTokenMultimedia() {
const localTokenMultimedia = localStorage.getItem(TOKEN_MULTIMEDIA);
const sessionTokenMultimedia = sessionStorage.getItem(TOKEN_MULTIMEDIA);
return localTokenMultimedia || sessionTokenMultimedia || '';
}
function isLoggedIn() {
const localToken = localStorage.getItem(TOKEN);
const sessionToken = sessionStorage.getItem(TOKEN);
return !!(localToken || sessionToken);
}
export { getToken, getTokenMultimedia, isLoggedIn };