Merge branch '8612-shelvinge2e' of https://gitea.verdnatura.es/verdnatura/salix-front into 8612-shelvinge2e
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
188d0d878e
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env groovy
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
def PROTECTED_BRANCH
|
def PROTECTED_BRANCH
|
||||||
|
def IS_LATEST
|
||||||
|
|
||||||
def BRANCH_ENV = [
|
def BRANCH_ENV = [
|
||||||
test: 'test',
|
test: 'test',
|
||||||
|
@ -10,16 +11,18 @@ def BRANCH_ENV = [
|
||||||
|
|
||||||
node {
|
node {
|
||||||
stage('Setup') {
|
stage('Setup') {
|
||||||
env.FRONT_REPLICAS = 1
|
|
||||||
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
||||||
|
|
||||||
PROTECTED_BRANCH = [
|
PROTECTED_BRANCH = [
|
||||||
'dev',
|
'dev',
|
||||||
'test',
|
'test',
|
||||||
'master',
|
'master',
|
||||||
|
'main',
|
||||||
'beta'
|
'beta'
|
||||||
].contains(env.BRANCH_NAME)
|
].contains(env.BRANCH_NAME)
|
||||||
|
|
||||||
|
IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME)
|
||||||
|
|
||||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||||
|
@ -58,6 +61,19 @@ pipeline {
|
||||||
PROJECT_NAME = 'lilium'
|
PROJECT_NAME = 'lilium'
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
|
stage('Version') {
|
||||||
|
when {
|
||||||
|
expression { PROTECTED_BRANCH }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def packageJson = readJSON file: 'package.json'
|
||||||
|
def version = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
|
writeFile(file: 'VERSION.txt', text: version)
|
||||||
|
echo "VERSION: ${version}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Install') {
|
stage('Install') {
|
||||||
environment {
|
environment {
|
||||||
NODE_ENV = ""
|
NODE_ENV = ""
|
||||||
|
@ -71,45 +87,81 @@ pipeline {
|
||||||
expression { !PROTECTED_BRANCH }
|
expression { !PROTECTED_BRANCH }
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
NODE_ENV = ""
|
NODE_ENV = ''
|
||||||
|
CI = 'true'
|
||||||
|
TZ = 'Europe/Madrid'
|
||||||
}
|
}
|
||||||
|
parallel {
|
||||||
|
stage('Unit') {
|
||||||
steps {
|
steps {
|
||||||
sh 'pnpm run test:unit:ci'
|
sh 'pnpm run test:unit:ci'
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
junit(
|
junit(
|
||||||
testResults: 'junitresults.xml',
|
testResults: 'junit/vitest.xml',
|
||||||
allowEmptyResults: true
|
allowEmptyResults: true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('E2E') {
|
||||||
|
environment {
|
||||||
|
CREDENTIALS = credentials('docker-registry')
|
||||||
|
COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}"
|
||||||
|
COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ."
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
|
||||||
|
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
|
||||||
|
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
|
||||||
|
sh 'cypress run --browser chromium'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
sh "docker-compose ${env.COMPOSE_PARAMS} down"
|
||||||
|
junit(
|
||||||
|
testResults: 'junit/e2e.xml',
|
||||||
|
allowEmptyResults: true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
when {
|
when {
|
||||||
expression { PROTECTED_BRANCH }
|
expression { PROTECTED_BRANCH }
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
CREDENTIALS = credentials('docker-registry')
|
CREDENTIALS = credentials('docker-registry')
|
||||||
|
VERSION = readFile 'VERSION.txt'
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'quasar build'
|
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
sh 'quasar build'
|
||||||
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
|
||||||
|
def baseImage = "salix-frontend:${env.VERSION}"
|
||||||
|
def image = docker.build(baseImage, ".")
|
||||||
|
docker.withRegistry("https://${env.REGISTRY}", 'docker-registry') {
|
||||||
|
image.push()
|
||||||
|
image.push(env.BRANCH_NAME)
|
||||||
|
if (IS_LATEST) image.push('latest')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dockerBuild()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
when {
|
when {
|
||||||
expression { PROTECTED_BRANCH }
|
expression { PROTECTED_BRANCH }
|
||||||
}
|
}
|
||||||
steps {
|
environment {
|
||||||
script {
|
VERSION = readFile 'VERSION.txt'
|
||||||
def packageJson = readJSON file: 'package.json'
|
|
||||||
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
|
||||||
}
|
}
|
||||||
|
steps {
|
||||||
withKubeConfig([
|
withKubeConfig([
|
||||||
serverUrl: "$KUBERNETES_API",
|
serverUrl: "$KUBERNETES_API",
|
||||||
credentialsId: 'kubernetes',
|
credentialsId: 'kubernetes',
|
||||||
|
|
|
@ -3,10 +3,39 @@ import { defineConfig } from 'cypress';
|
||||||
// https://docs.cypress.io/app/references/configuration
|
// https://docs.cypress.io/app/references/configuration
|
||||||
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
||||||
|
|
||||||
|
let urlHost,
|
||||||
|
reporter,
|
||||||
|
reporterOptions;
|
||||||
|
|
||||||
|
if (process.env.CI) {
|
||||||
|
urlHost = 'front';
|
||||||
|
reporter = 'junit';
|
||||||
|
reporterOptions = {
|
||||||
|
mochaFile: 'junit/e2e.xml',
|
||||||
|
toConsole: false,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
urlHost = 'localhost';
|
||||||
|
reporter = 'cypress-mochawesome-reporter';
|
||||||
|
reporterOptions = {
|
||||||
|
charts: true,
|
||||||
|
reportPageTitle: 'Cypress Inline Reporter',
|
||||||
|
reportFilename: '[status]_[datetime]-report',
|
||||||
|
embeddedScreenshots: true,
|
||||||
|
reportDir: 'test/cypress/reports',
|
||||||
|
inlineAssets: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: 'http://localhost:9000/',
|
baseUrl: `http://${urlHost}:9000`,
|
||||||
experimentalStudio: true,
|
experimentalStudio: false, // Desactivado para evitar tiempos de espera innecesarios
|
||||||
|
defaultCommandTimeout: 10000,
|
||||||
|
trashAssetsBeforeRuns: false,
|
||||||
|
requestTimeout: 10000,
|
||||||
|
responseTimeout: 30000,
|
||||||
|
pageLoadTimeout: 60000,
|
||||||
fixturesFolder: 'test/cypress/fixtures',
|
fixturesFolder: 'test/cypress/fixtures',
|
||||||
screenshotsFolder: 'test/cypress/screenshots',
|
screenshotsFolder: 'test/cypress/screenshots',
|
||||||
supportFile: 'test/cypress/support/index.js',
|
supportFile: 'test/cypress/support/index.js',
|
||||||
|
@ -14,29 +43,35 @@ export default defineConfig({
|
||||||
downloadsFolder: 'test/cypress/downloads',
|
downloadsFolder: 'test/cypress/downloads',
|
||||||
video: false,
|
video: false,
|
||||||
specPattern: 'test/cypress/integration/**/*.spec.js',
|
specPattern: 'test/cypress/integration/**/*.spec.js',
|
||||||
experimentalRunAllSpecs: false,
|
experimentalRunAllSpecs: true,
|
||||||
watchForFileChanges: false,
|
watchForFileChanges: true,
|
||||||
reporter: 'cypress-mochawesome-reporter',
|
reporter,
|
||||||
reporterOptions: {
|
reporterOptions,
|
||||||
charts: true,
|
|
||||||
reportPageTitle: 'Cypress Inline Reporter',
|
|
||||||
reportFilename: '[status]_[datetime]-report',
|
|
||||||
embeddedScreenshots: true,
|
|
||||||
reportDir: 'test/cypress/reports',
|
|
||||||
inlineAssets: true,
|
|
||||||
},
|
|
||||||
component: {
|
component: {
|
||||||
componentFolder: 'src',
|
componentFolder: 'src',
|
||||||
testFiles: '**/*.spec.js',
|
testFiles: '**/*.spec.js',
|
||||||
supportFile: 'test/cypress/support/unit.js',
|
supportFile: 'test/cypress/support/unit.js',
|
||||||
},
|
},/*
|
||||||
setupNodeEvents: async (on, config) => {
|
setupNodeEvents: async (on, config) => {
|
||||||
const plugin = await import('cypress-mochawesome-reporter/plugin');
|
const plugin = await import('cypress-mochawesome-reporter/plugin');
|
||||||
plugin.default(on);
|
plugin.default(on);
|
||||||
|
const fs = await import('fs');
|
||||||
|
on('task', {
|
||||||
|
deleteFile(filePath) {
|
||||||
|
if (fs.existsSync(filePath)) {
|
||||||
|
fs.unlinkSync(filePath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},*/
|
||||||
viewportWidth: 1280,
|
viewportWidth: 1280,
|
||||||
viewportHeight: 720,
|
viewportHeight: 720,
|
||||||
},
|
},
|
||||||
|
experimentalMemoryManagement: true,
|
||||||
|
defaultCommandTimeout: 10000,
|
||||||
|
numTestsKeptInMemory: 2,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
version: '3.7'
|
|
||||||
services:
|
|
||||||
main:
|
|
||||||
image: registry.verdnatura.es/salix-frontend:${VERSION:?}
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ./Dockerfile
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
FROM debian:12.9-slim
|
||||||
|
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
gnupg2 \
|
||||||
|
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
||||||
|
&& apt-get install -y --no-install-recommends nodejs \
|
||||||
|
&& npm install -g corepack@0.31.0 \
|
||||||
|
&& corepack enable pnpm \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get -y --no-install-recommends install \
|
||||||
|
apt-utils \
|
||||||
|
chromium \
|
||||||
|
libasound2 \
|
||||||
|
libgbm-dev \
|
||||||
|
libgtk-3-0 \
|
||||||
|
libgtk2.0-0 \
|
||||||
|
libnotify-dev \
|
||||||
|
libnss3 \
|
||||||
|
libxss1 \
|
||||||
|
libxtst6 \
|
||||||
|
xauth \
|
||||||
|
xvfb \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN groupadd -r -g 1000 app \
|
||||||
|
&& useradd -r -u 1000 -g app -m -d /home/app app
|
||||||
|
USER app
|
||||||
|
|
||||||
|
ENV SHELL=bash
|
||||||
|
ENV PNPM_HOME="/home/app/.local/share/pnpm"
|
||||||
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
|
||||||
|
RUN pnpm setup \
|
||||||
|
&& pnpm install --global cypress@13.6.6 \
|
||||||
|
&& cypress install
|
||||||
|
|
||||||
|
WORKDIR /app
|
|
@ -1,6 +1,6 @@
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
path: '/api',
|
path: '/api',
|
||||||
rule: { target: 'http://0.0.0.0:3000' },
|
rule: { target: 'http://127.0.0.1:3000' },
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
import { configure } from 'quasar/wrappers';
|
import { configure } from 'quasar/wrappers';
|
||||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
const target = `http://${process.env.CI ? 'back' : 'localhost'}:3000`;
|
||||||
|
|
||||||
export default configure(function (/* ctx */) {
|
export default configure(function (/* ctx */) {
|
||||||
return {
|
return {
|
||||||
|
@ -108,13 +109,17 @@ export default configure(function (/* ctx */) {
|
||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://0.0.0.0:3000',
|
target: target,
|
||||||
logLevel: 'debug',
|
logLevel: 'debug',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
open: false,
|
open: false,
|
||||||
|
allowedHosts: [
|
||||||
|
'front', // Agrega este nombre de host
|
||||||
|
'localhost', // Opcional, para pruebas locales
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework
|
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework
|
||||||
|
|
|
@ -30,22 +30,5 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
form.addEventListener('keyup', function (evt) {
|
|
||||||
if (evt.key === 'Enter' && !that.$attrs['prevent-submit']) {
|
|
||||||
const input = evt.target;
|
|
||||||
if (input.type == 'textarea' && evt.shiftKey) {
|
|
||||||
evt.preventDefault();
|
|
||||||
let { selectionStart, selectionEnd } = input;
|
|
||||||
input.value =
|
|
||||||
input.value.substring(0, selectionStart) +
|
|
||||||
'\n' +
|
|
||||||
input.value.substring(selectionEnd);
|
|
||||||
selectionStart = selectionEnd = selectionStart + 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
evt.preventDefault();
|
|
||||||
that.onSubmit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { onMounted, onUnmounted, computed, ref, watch, nextTick } from 'vue';
|
import { onMounted, onUnmounted, computed, ref, watch, nextTick, useAttrs } from 'vue';
|
||||||
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router';
|
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
@ -22,6 +22,7 @@ const { validate } = useValidator();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const myForm = ref(null);
|
const myForm = ref(null);
|
||||||
|
const attrs = useAttrs();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
url: {
|
url: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -113,7 +114,7 @@ const defaultButtons = computed(() => ({
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
icon: 'save',
|
icon: 'save',
|
||||||
label: 'globals.save',
|
label: 'globals.save',
|
||||||
click: () => myForm.value.onSubmit(false),
|
click: async () => await save(),
|
||||||
type: 'submit',
|
type: 'submit',
|
||||||
},
|
},
|
||||||
reset: {
|
reset: {
|
||||||
|
@ -208,8 +209,7 @@ async function fetch() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function save(prevent = false) {
|
async function save() {
|
||||||
if (prevent) return;
|
|
||||||
if ($props.observeFormChanges && !hasChanges.value)
|
if ($props.observeFormChanges && !hasChanges.value)
|
||||||
return notify('globals.noChanges', 'negative');
|
return notify('globals.noChanges', 'negative');
|
||||||
|
|
||||||
|
@ -247,6 +247,7 @@ async function saveAndGo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
|
formData.value = JSON.parse(JSON.stringify(originalData.value));
|
||||||
updateAndEmit('onFetch', { val: originalData.value });
|
updateAndEmit('onFetch', { val: originalData.value });
|
||||||
if ($props.observeFormChanges) {
|
if ($props.observeFormChanges) {
|
||||||
hasChanges.value = false;
|
hasChanges.value = false;
|
||||||
|
@ -284,6 +285,22 @@ function trimData(data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function onKeyup(evt) {
|
||||||
|
if (evt.key === 'Enter' && !('prevent-submit' in attrs)) {
|
||||||
|
const input = evt.target;
|
||||||
|
if (input.type == 'textarea' && evt.shiftKey) {
|
||||||
|
let { selectionStart, selectionEnd } = input;
|
||||||
|
input.value =
|
||||||
|
input.value.substring(0, selectionStart) +
|
||||||
|
'\n' +
|
||||||
|
input.value.substring(selectionEnd);
|
||||||
|
selectionStart = selectionEnd = selectionStart + 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
save,
|
save,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
@ -298,12 +315,12 @@ defineExpose({
|
||||||
<QForm
|
<QForm
|
||||||
ref="myForm"
|
ref="myForm"
|
||||||
v-if="formData"
|
v-if="formData"
|
||||||
@submit="save(!!$event)"
|
@submit.prevent
|
||||||
|
@keyup.prevent="onKeyup"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
class="q-pa-md"
|
class="q-pa-md"
|
||||||
:style="maxWidth ? 'max-width: ' + maxWidth : ''"
|
:style="maxWidth ? 'max-width: ' + maxWidth : ''"
|
||||||
id="formModel"
|
id="formModel"
|
||||||
:prevent-submit="$attrs['prevent-submit']"
|
|
||||||
>
|
>
|
||||||
<QCard>
|
<QCard>
|
||||||
<slot
|
<slot
|
||||||
|
|
|
@ -27,10 +27,15 @@ const formModelRef = ref(null);
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
const isSaveAndContinue = ref(false);
|
const isSaveAndContinue = ref(false);
|
||||||
const onDataSaved = (formData, requestResponse) => {
|
const onDataSaved = (formData, requestResponse) => {
|
||||||
if (closeButton.value && isSaveAndContinue) closeButton.value.click();
|
if (closeButton.value && !isSaveAndContinue.value) closeButton.value.click();
|
||||||
emit('onDataSaved', formData, requestResponse);
|
emit('onDataSaved', formData, requestResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onClick = async (saveAndContinue) => {
|
||||||
|
isSaveAndContinue.value = saveAndContinue;
|
||||||
|
await formModelRef.value.save();
|
||||||
|
};
|
||||||
|
|
||||||
const isLoading = computed(() => formModelRef.value?.isLoading);
|
const isLoading = computed(() => formModelRef.value?.isLoading);
|
||||||
const reset = computed(() => formModelRef.value?.reset);
|
const reset = computed(() => formModelRef.value?.reset);
|
||||||
|
|
||||||
|
@ -78,10 +83,7 @@ defineExpose({
|
||||||
:flat="showSaveAndContinueBtn"
|
:flat="showSaveAndContinueBtn"
|
||||||
:label="t('globals.save')"
|
:label="t('globals.save')"
|
||||||
:title="t('globals.save')"
|
:title="t('globals.save')"
|
||||||
@click="
|
@click="onClick(false)"
|
||||||
formModelRef.save();
|
|
||||||
isSaveAndContinue = false;
|
|
||||||
"
|
|
||||||
color="primary"
|
color="primary"
|
||||||
class="q-ml-sm"
|
class="q-ml-sm"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
|
@ -99,10 +101,7 @@ defineExpose({
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
data-cy="FormModelPopup_isSaveAndContinue"
|
data-cy="FormModelPopup_isSaveAndContinue"
|
||||||
z-max
|
z-max
|
||||||
@click="
|
@click="onClick(true)"
|
||||||
isSaveAndContinue = true;
|
|
||||||
formModelRef.save();
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -85,7 +85,15 @@ const refresh = () => window.location.reload();
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
<PinnedModules ref="pinnedModulesRef" />
|
<PinnedModules ref="pinnedModulesRef" />
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<QBtn class="q-pa-none" rounded dense flat no-wrap id="user">
|
<QBtn
|
||||||
|
class="q-pa-none"
|
||||||
|
rounded
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
no-wrap
|
||||||
|
id="user"
|
||||||
|
data-cy="userPanel_btn"
|
||||||
|
>
|
||||||
<VnAvatar
|
<VnAvatar
|
||||||
:worker-id="user.id"
|
:worker-id="user.id"
|
||||||
:title="user.name"
|
:title="user.name"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { markRaw, computed } from 'vue';
|
import { markRaw, computed } from 'vue';
|
||||||
import { QIcon, QCheckbox, QToggle } from 'quasar';
|
import { QIcon, QToggle } from 'quasar';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
|
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
|
|
@ -152,7 +152,7 @@ const onTabPressed = async () => {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-if="showFilter" class="full-width flex-center" style="overflow: hidden">
|
<div v-if="showFilter" class="full-width" style="overflow: hidden">
|
||||||
<VnColumn
|
<VnColumn
|
||||||
:column="$props.column"
|
:column="$props.column"
|
||||||
default="input"
|
default="input"
|
||||||
|
|
|
@ -23,6 +23,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
align: {
|
||||||
|
type: String,
|
||||||
|
default: 'end',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const hover = ref();
|
const hover = ref();
|
||||||
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
||||||
|
@ -46,16 +50,27 @@ async function orderBy(name, direction) {
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ orderBy });
|
defineExpose({ orderBy });
|
||||||
|
|
||||||
|
function textAlignToFlex(textAlign) {
|
||||||
|
return `justify-content: ${
|
||||||
|
{
|
||||||
|
'text-center': 'center',
|
||||||
|
'text-left': 'start',
|
||||||
|
'text-right': 'end',
|
||||||
|
}[textAlign] || 'start'
|
||||||
|
};`;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
@mouseenter="hover = true"
|
@mouseenter="hover = true"
|
||||||
@mouseleave="hover = false"
|
@mouseleave="hover = false"
|
||||||
@click="orderBy(name, model?.direction)"
|
@click="orderBy(name, model?.direction)"
|
||||||
class="row items-center no-wrap cursor-pointer title"
|
class="items-center no-wrap cursor-pointer title"
|
||||||
|
:style="textAlignToFlex(align)"
|
||||||
>
|
>
|
||||||
<span :title="label">{{ label }}</span>
|
<span :title="label">{{ label }}</span>
|
||||||
<sup v-if="name && model?.index">
|
<div v-if="name && model?.index">
|
||||||
<QChip
|
<QChip
|
||||||
:label="!vertical ? model?.index : ''"
|
:label="!vertical ? model?.index : ''"
|
||||||
:icon="
|
:icon="
|
||||||
|
@ -92,20 +107,16 @@ defineExpose({ orderBy });
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</QChip>
|
</QChip>
|
||||||
</sup>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.title {
|
.title {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
}
|
white-space: nowrap;
|
||||||
sup {
|
|
||||||
vertical-align: super; /* Valor predeterminado */
|
|
||||||
/* También puedes usar otros valores como "baseline", "top", "text-top", etc. */
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -10,14 +10,15 @@ import {
|
||||||
render,
|
render,
|
||||||
inject,
|
inject,
|
||||||
useAttrs,
|
useAttrs,
|
||||||
|
nextTick,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar, date } from 'quasar';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useFilterParams } from 'src/composables/useFilterParams';
|
import { useFilterParams } from 'src/composables/useFilterParams';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty, toDate } from 'src/filters';
|
||||||
|
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
|
@ -164,7 +165,6 @@ const app = inject('app');
|
||||||
const editingRow = ref(null);
|
const editingRow = ref(null);
|
||||||
const editingField = ref(null);
|
const editingField = ref(null);
|
||||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||||
const showRightIcon = computed(() => $props.rightSearch || $props.rightSearchIcon);
|
|
||||||
const selectRegex = /select/;
|
const selectRegex = /select/;
|
||||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||||
const tableModes = [
|
const tableModes = [
|
||||||
|
@ -345,7 +345,7 @@ const clickHandler = async (event) => {
|
||||||
if (isDateElement || isTimeElement || isQselectDropDown) return;
|
if (isDateElement || isTimeElement || isQselectDropDown) return;
|
||||||
|
|
||||||
if (clickedElement === null) {
|
if (clickedElement === null) {
|
||||||
destroyInput(editingRow.value, editingField.value);
|
await destroyInput(editingRow.value, editingField.value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const rowIndex = clickedElement.getAttribute('data-row-index');
|
const rowIndex = clickedElement.getAttribute('data-row-index');
|
||||||
|
@ -355,7 +355,7 @@ const clickHandler = async (event) => {
|
||||||
if (editingRow.value !== null && editingField.value !== null) {
|
if (editingRow.value !== null && editingField.value !== null) {
|
||||||
if (editingRow.value == rowIndex && editingField.value == colField) return;
|
if (editingRow.value == rowIndex && editingField.value == colField) return;
|
||||||
|
|
||||||
destroyInput(editingRow.value, editingField.value);
|
await destroyInput(editingRow.value, editingField.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEditableColumn(column)) {
|
if (isEditableColumn(column)) {
|
||||||
|
@ -365,7 +365,7 @@ const clickHandler = async (event) => {
|
||||||
|
|
||||||
async function handleTabKey(event, rowIndex, colField) {
|
async function handleTabKey(event, rowIndex, colField) {
|
||||||
if (editingRow.value == rowIndex && editingField.value == colField)
|
if (editingRow.value == rowIndex && editingField.value == colField)
|
||||||
destroyInput(editingRow.value, editingField.value);
|
await destroyInput(editingRow.value, editingField.value);
|
||||||
|
|
||||||
const direction = event.shiftKey ? -1 : 1;
|
const direction = event.shiftKey ? -1 : 1;
|
||||||
const { nextRowIndex, nextColumnName } = await handleTabNavigation(
|
const { nextRowIndex, nextColumnName } = await handleTabNavigation(
|
||||||
|
@ -425,7 +425,8 @@ async function renderInput(rowId, field, clickedElement) {
|
||||||
await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row);
|
await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row);
|
||||||
},
|
},
|
||||||
keyup: async (event) => {
|
keyup: async (event) => {
|
||||||
if (event.key === 'Enter') handleBlur(rowId, field, clickedElement);
|
if (event.key === 'Enter')
|
||||||
|
await destroyInput(rowIndex, field, clickedElement);
|
||||||
},
|
},
|
||||||
keydown: async (event) => {
|
keydown: async (event) => {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
|
@ -434,7 +435,7 @@ async function renderInput(rowId, field, clickedElement) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
break;
|
break;
|
||||||
case 'Escape':
|
case 'Escape':
|
||||||
destroyInput(rowId, field, clickedElement);
|
await destroyInput(rowId, field, clickedElement);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -456,12 +457,13 @@ async function renderInput(rowId, field, clickedElement) {
|
||||||
node.el?.querySelector('span > div > div').focus();
|
node.el?.querySelector('span > div > div').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function destroyInput(rowIndex, field, clickedElement) {
|
async function destroyInput(rowIndex, field, clickedElement) {
|
||||||
if (!clickedElement)
|
if (!clickedElement)
|
||||||
clickedElement = document.querySelector(
|
clickedElement = document.querySelector(
|
||||||
`[data-row-index="${rowIndex}"][data-col-field="${field}"]`,
|
`[data-row-index="${rowIndex}"][data-col-field="${field}"]`,
|
||||||
);
|
);
|
||||||
if (clickedElement) {
|
if (clickedElement) {
|
||||||
|
await nextTick();
|
||||||
render(null, clickedElement);
|
render(null, clickedElement);
|
||||||
Array.from(clickedElement.childNodes).forEach((child) => {
|
Array.from(clickedElement.childNodes).forEach((child) => {
|
||||||
child.style.visibility = 'visible';
|
child.style.visibility = 'visible';
|
||||||
|
@ -473,10 +475,6 @@ function destroyInput(rowIndex, field, clickedElement) {
|
||||||
editingField.value = null;
|
editingField.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleBlur(rowIndex, field, clickedElement) {
|
|
||||||
destroyInput(rowIndex, field, clickedElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleTabNavigation(rowIndex, colName, direction) {
|
async function handleTabNavigation(rowIndex, colName, direction) {
|
||||||
const columns = $props.columns;
|
const columns = $props.columns;
|
||||||
const totalColumns = columns.length;
|
const totalColumns = columns.length;
|
||||||
|
@ -521,17 +519,41 @@ function getToggleIcon(value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatColumnValue(col, row, dashIfEmpty) {
|
function formatColumnValue(col, row, dashIfEmpty) {
|
||||||
if (col?.format) {
|
if (col?.format || row[col?.name + 'TextValue']) {
|
||||||
if (selectRegex.test(col?.component) && row[col?.name + 'TextValue']) {
|
if (selectRegex.test(col?.component) && row[col?.name + 'TextValue']) {
|
||||||
return dashIfEmpty(row[col?.name + 'TextValue']);
|
return dashIfEmpty(row[col?.name + 'TextValue']);
|
||||||
} else {
|
} else {
|
||||||
return col.format(row, dashIfEmpty);
|
return col.format(row, dashIfEmpty);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (col?.component === 'date') return dashIfEmpty(toDate(row[col?.name]));
|
||||||
|
|
||||||
|
if (col?.component === 'time')
|
||||||
|
return row[col?.name] >= 5
|
||||||
|
? dashIfEmpty(date.formatDate(new Date(row[col?.name]), 'HH:mm'))
|
||||||
|
: row[col?.name];
|
||||||
|
|
||||||
|
if (selectRegex.test(col?.component) && $props.isEditable) {
|
||||||
|
const { find, url } = col.attrs;
|
||||||
|
const urlRelation = url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
||||||
|
|
||||||
|
if (col?.attrs.options) {
|
||||||
|
const find = col?.attrs.options.find((option) => option.id === row[col.name]);
|
||||||
|
if (!col.attrs?.optionLabel || !find) return dashIfEmpty(row[col?.name]);
|
||||||
|
return dashIfEmpty(find[col.attrs?.optionLabel ?? 'name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof row[urlRelation] == 'object') {
|
||||||
|
if (typeof find == 'object')
|
||||||
|
return dashIfEmpty(row[urlRelation][find?.label ?? 'name']);
|
||||||
|
|
||||||
|
return dashIfEmpty(row[urlRelation][col?.attrs.optionLabel ?? 'name']);
|
||||||
|
}
|
||||||
|
if (typeof row[urlRelation] == 'string') return dashIfEmpty(row[urlRelation]);
|
||||||
|
}
|
||||||
return dashIfEmpty(row[col?.name]);
|
return dashIfEmpty(row[col?.name]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
const checkbox = ref(null);
|
|
||||||
function cardClick(_, row) {
|
function cardClick(_, row) {
|
||||||
if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` });
|
if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` });
|
||||||
}
|
}
|
||||||
|
@ -618,14 +640,6 @@ function cardClick(_, row) {
|
||||||
dense
|
dense
|
||||||
:options="tableModes.filter((mode) => !mode.disable)"
|
:options="tableModes.filter((mode) => !mode.disable)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<QBtn
|
|
||||||
v-if="showRightIcon"
|
|
||||||
icon="filter_alt"
|
|
||||||
class="bg-vn-section-color q-ml-sm"
|
|
||||||
dense
|
|
||||||
@click="stateStore.toggleRightDrawer()"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<template #header-cell="{ col }">
|
<template #header-cell="{ col }">
|
||||||
<QTh
|
<QTh
|
||||||
|
@ -633,15 +647,14 @@ function cardClick(_, row) {
|
||||||
v-bind:class="col.headerClass"
|
v-bind:class="col.headerClass"
|
||||||
class="body-cell"
|
class="body-cell"
|
||||||
:style="col?.width ? `max-width: ${col?.width}` : ''"
|
:style="col?.width ? `max-width: ${col?.width}` : ''"
|
||||||
style="padding: inherit"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="no-padding"
|
class="no-padding"
|
||||||
:style="
|
:style="[
|
||||||
withFilters && $props.columnSearch ? 'height: 75px' : ''
|
withFilters && $props.columnSearch ? 'height: 75px' : '',
|
||||||
"
|
]"
|
||||||
>
|
>
|
||||||
<div class="text-center" style="height: 30px">
|
<div style="height: 30px">
|
||||||
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip>
|
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip>
|
||||||
<VnTableOrder
|
<VnTableOrder
|
||||||
v-model="orders[col.orderBy ?? col.name]"
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
|
@ -649,6 +662,7 @@ function cardClick(_, row) {
|
||||||
:label="col?.labelAbbreviation ?? col?.label"
|
:label="col?.labelAbbreviation ?? col?.label"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
|
:align="getColAlign(col)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<VnFilter
|
<VnFilter
|
||||||
|
@ -730,7 +744,11 @@ function cardClick(_, row) {
|
||||||
<span
|
<span
|
||||||
v-else
|
v-else
|
||||||
:class="hasEditableFormat(col)"
|
:class="hasEditableFormat(col)"
|
||||||
:style="col?.style ? col.style(row) : null"
|
:style="
|
||||||
|
typeof col?.style == 'function'
|
||||||
|
? col.style(row)
|
||||||
|
: col?.style
|
||||||
|
"
|
||||||
style="bottom: 0"
|
style="bottom: 0"
|
||||||
>
|
>
|
||||||
{{ formatColumnValue(col, row, dashIfEmpty) }}
|
{{ formatColumnValue(col, row, dashIfEmpty) }}
|
||||||
|
@ -783,7 +801,7 @@ function cardClick(_, row) {
|
||||||
<QCardSection
|
<QCardSection
|
||||||
vertical
|
vertical
|
||||||
class="no-margin no-padding"
|
class="no-margin no-padding"
|
||||||
:class="colsMap.tableActions ? '' : 'fit'"
|
:class="colsMap.tableActions ? 'w-80' : 'fit'"
|
||||||
>
|
>
|
||||||
<!-- Chips -->
|
<!-- Chips -->
|
||||||
<QCardSection
|
<QCardSection
|
||||||
|
@ -1026,8 +1044,8 @@ es:
|
||||||
}
|
}
|
||||||
|
|
||||||
.body-cell {
|
.body-cell {
|
||||||
padding-left: 2px !important;
|
padding-left: 4px !important;
|
||||||
padding-right: 2px !important;
|
padding-right: 4px !important;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.bg-chip-secondary {
|
.bg-chip-secondary {
|
||||||
|
|
|
@ -48,7 +48,8 @@ function toValueAttrs(attrs) {
|
||||||
<span
|
<span
|
||||||
v-for="toComponent of componentArray"
|
v-for="toComponent of componentArray"
|
||||||
:key="toComponent.name"
|
:key="toComponent.name"
|
||||||
class="column flex-center fit"
|
class="column fit"
|
||||||
|
:class="toComponent?.component == 'checkbox' ? 'flex-center' : ''"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
v-if="toComponent?.component"
|
v-if="toComponent?.component"
|
||||||
|
|
|
@ -107,6 +107,7 @@ const manageDate = (date) => {
|
||||||
@click="isPopupOpen = !isPopupOpen"
|
@click="isPopupOpen = !isPopupOpen"
|
||||||
@keydown="isPopupOpen = false"
|
@keydown="isPopupOpen = false"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_inputDate'"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -193,8 +193,10 @@ const toModule = computed(() =>
|
||||||
</div>
|
</div>
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemLabel class="subtitle" caption>
|
<QItemLabel class="subtitle">
|
||||||
#{{ getValueFromPath(subtitle) ?? entity.id }}
|
#{{ getValueFromPath(subtitle) ?? entity.id }}
|
||||||
|
</QItemLabel>
|
||||||
|
|
||||||
<QBtn
|
<QBtn
|
||||||
round
|
round
|
||||||
flat
|
flat
|
||||||
|
@ -208,7 +210,7 @@ const toModule = computed(() =>
|
||||||
{{ t('globals.copyId') }}
|
{{ t('globals.copyId') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</QItemLabel>
|
<!-- </QItemLabel> -->
|
||||||
</QItem>
|
</QItem>
|
||||||
</QList>
|
</QList>
|
||||||
<div class="list-box q-mt-xs">
|
<div class="list-box q-mt-xs">
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
export function getColAlign(col) {
|
export function getColAlign(col) {
|
||||||
let align;
|
let align;
|
||||||
switch (col.component) {
|
switch (col.component) {
|
||||||
|
case 'time':
|
||||||
|
case 'date':
|
||||||
case 'select':
|
case 'select':
|
||||||
align = 'left';
|
align = 'left';
|
||||||
break;
|
break;
|
||||||
case 'number':
|
case 'number':
|
||||||
align = 'right';
|
align = 'right';
|
||||||
break;
|
break;
|
||||||
case 'date':
|
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
align = 'center';
|
align = 'center';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -335,3 +335,7 @@ input::-webkit-inner-spin-button {
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
box-shadow: 0 4px 6px #00000000;
|
box-shadow: 0 4px 6px #00000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.containerShrinked {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ import { useI18n } from 'vue-i18n';
|
||||||
export default function (value, options = {}) {
|
export default function (value, options = {}) {
|
||||||
if (!value) return;
|
if (!value) return;
|
||||||
|
|
||||||
|
if (!isValidDate(value)) return null;
|
||||||
|
|
||||||
if (!options.dateStyle && !options.timeStyle) {
|
if (!options.dateStyle && !options.timeStyle) {
|
||||||
options.day = '2-digit';
|
options.day = '2-digit';
|
||||||
options.month = '2-digit';
|
options.month = '2-digit';
|
||||||
|
@ -10,7 +12,12 @@ export default function (value, options = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const date = new Date(value);
|
const newDate = new Date(value);
|
||||||
|
|
||||||
return new Intl.DateTimeFormat(locale.value, options).format(date);
|
return new Intl.DateTimeFormat(locale.value, options).format(newDate);
|
||||||
|
}
|
||||||
|
// handle 0000-00-00
|
||||||
|
function isValidDate(date) {
|
||||||
|
const parsedDate = new Date(date);
|
||||||
|
return parsedDate instanceof Date && !isNaN(parsedDate.getTime());
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ globals:
|
||||||
rowRemoved: Row removed
|
rowRemoved: Row removed
|
||||||
pleaseWait: Please wait...
|
pleaseWait: Please wait...
|
||||||
noPinnedModules: You don't have any pinned modules
|
noPinnedModules: You don't have any pinned modules
|
||||||
|
enterToConfirm: Press Enter to confirm
|
||||||
summary:
|
summary:
|
||||||
basicData: Basic data
|
basicData: Basic data
|
||||||
daysOnward: Days onward
|
daysOnward: Days onward
|
||||||
|
|
|
@ -51,6 +51,7 @@ globals:
|
||||||
pleaseWait: Por favor espera...
|
pleaseWait: Por favor espera...
|
||||||
noPinnedModules: No has fijado ningún módulo
|
noPinnedModules: No has fijado ningún módulo
|
||||||
split: Split
|
split: Split
|
||||||
|
enterToConfirm: Pulsa Enter para confirmar
|
||||||
summary:
|
summary:
|
||||||
basicData: Datos básicos
|
basicData: Datos básicos
|
||||||
daysOnward: Días adelante
|
daysOnward: Días adelante
|
||||||
|
|
|
@ -114,7 +114,7 @@ function onBeforeSave(data) {
|
||||||
if (isCash.value && shouldSendEmail.value && !data.email)
|
if (isCash.value && shouldSendEmail.value && !data.email)
|
||||||
return notify(t('There is no assigned email for this client'), 'negative');
|
return notify(t('There is no assigned email for this client'), 'negative');
|
||||||
|
|
||||||
data.bankFk = data.bankFk.id;
|
data.bankFk = data.bankFk?.id;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ async function getAmountPaid() {
|
||||||
:url-create="urlCreate"
|
:url-create="urlCreate"
|
||||||
:mapper="onBeforeSave"
|
:mapper="onBeforeSave"
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
:prevent-submit="true"
|
prevent-submit
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
|
||||||
|
|
|
@ -16,7 +16,6 @@ import ItemDescriptor from 'src/pages/Item/Card/ItemDescriptor.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
|
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
|
||||||
import { checkEntryLock } from 'src/composables/checkEntryLock';
|
import { checkEntryLock } from 'src/composables/checkEntryLock';
|
||||||
import SkeletonDescriptor from 'src/components/ui/SkeletonDescriptor.vue';
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -103,7 +102,7 @@ const columns = [
|
||||||
name: 'itemFk',
|
name: 'itemFk',
|
||||||
component: 'number',
|
component: 'number',
|
||||||
isEditable: false,
|
isEditable: false,
|
||||||
width: '40px',
|
width: '35px',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
labelAbbreviation: '',
|
labelAbbreviation: '',
|
||||||
|
@ -111,7 +110,7 @@ const columns = [
|
||||||
name: 'hex',
|
name: 'hex',
|
||||||
columnSearch: false,
|
columnSearch: false,
|
||||||
isEditable: false,
|
isEditable: false,
|
||||||
width: '5px',
|
width: '9px',
|
||||||
component: 'select',
|
component: 'select',
|
||||||
attrs: {
|
attrs: {
|
||||||
url: 'Inks',
|
url: 'Inks',
|
||||||
|
@ -181,6 +180,7 @@ const columns = [
|
||||||
url: 'packagings',
|
url: 'packagings',
|
||||||
fields: ['id'],
|
fields: ['id'],
|
||||||
optionLabel: 'id',
|
optionLabel: 'id',
|
||||||
|
optionValue: 'id',
|
||||||
},
|
},
|
||||||
create: true,
|
create: true,
|
||||||
width: '40px',
|
width: '40px',
|
||||||
|
@ -192,7 +192,7 @@ const columns = [
|
||||||
component: 'number',
|
component: 'number',
|
||||||
create: true,
|
create: true,
|
||||||
width: '35px',
|
width: '35px',
|
||||||
format: (row, dashIfEmpty) => parseFloat(row['weight']).toFixed(1),
|
format: (row) => parseFloat(row['weight']).toFixed(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
labelAbbreviation: 'P',
|
labelAbbreviation: 'P',
|
||||||
|
@ -330,6 +330,25 @@ const columns = [
|
||||||
create: true,
|
create: true,
|
||||||
format: (row) => parseFloat(row['price3']).toFixed(2),
|
format: (row) => parseFloat(row['price3']).toFixed(2),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
align: 'center',
|
||||||
|
labelAbbreviation: 'CM',
|
||||||
|
label: t('Check min price'),
|
||||||
|
toolTip: t('Check min price'),
|
||||||
|
name: 'hasMinPrice',
|
||||||
|
attrs: {
|
||||||
|
toggleIndeterminate: false,
|
||||||
|
},
|
||||||
|
component: 'checkbox',
|
||||||
|
cellEvent: {
|
||||||
|
'update:modelValue': async (value, oldValue, row) => {
|
||||||
|
await axios.patch(`Items/${row['itemFk']}`, {
|
||||||
|
hasMinPrice: value,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
width: '25px',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
labelAbbreviation: 'Min.',
|
labelAbbreviation: 'Min.',
|
||||||
|
@ -350,25 +369,6 @@ const columns = [
|
||||||
},
|
},
|
||||||
format: (row) => parseFloat(row['minPrice']).toFixed(2),
|
format: (row) => parseFloat(row['minPrice']).toFixed(2),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
align: 'center',
|
|
||||||
labelAbbreviation: 'CM',
|
|
||||||
label: t('Check min price'),
|
|
||||||
toolTip: t('Check min price'),
|
|
||||||
name: 'hasMinPrice',
|
|
||||||
attrs: {
|
|
||||||
toggleIndeterminate: false,
|
|
||||||
},
|
|
||||||
component: 'checkbox',
|
|
||||||
cellEvent: {
|
|
||||||
'update:modelValue': async (value, oldValue, row) => {
|
|
||||||
await axios.patch(`Items/${row['itemFk']}`, {
|
|
||||||
hasMinPrice: value,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
width: '25px',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
labelAbbreviation: t('P.Sen'),
|
labelAbbreviation: t('P.Sen'),
|
||||||
|
@ -378,6 +378,9 @@ const columns = [
|
||||||
component: 'number',
|
component: 'number',
|
||||||
isEditable: false,
|
isEditable: false,
|
||||||
width: '40px',
|
width: '40px',
|
||||||
|
style: () => {
|
||||||
|
return { color: 'var(--vn-label-color)' };
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
@ -417,6 +420,9 @@ const columns = [
|
||||||
component: 'input',
|
component: 'input',
|
||||||
isEditable: false,
|
isEditable: false,
|
||||||
width: '35px',
|
width: '35px',
|
||||||
|
style: () => {
|
||||||
|
return { color: 'var(--vn-label-color)' };
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -644,8 +650,8 @@ onMounted(() => {
|
||||||
:is-editable="editableMode"
|
:is-editable="editableMode"
|
||||||
:without-header="!editableMode"
|
:without-header="!editableMode"
|
||||||
:with-filters="editableMode"
|
:with-filters="editableMode"
|
||||||
:right-search="false"
|
:right-search="true"
|
||||||
:right-search-icon="false"
|
:right-search-icon="true"
|
||||||
:row-click="false"
|
:row-click="false"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:beforeSaveFn="beforeSave"
|
:beforeSaveFn="beforeSave"
|
||||||
|
|
|
@ -199,7 +199,6 @@ const columns = computed(() => [
|
||||||
optionValue: 'code',
|
optionValue: 'code',
|
||||||
optionLabel: 'description',
|
optionLabel: 'description',
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
|
||||||
width: '65px',
|
width: '65px',
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(row.entryTypeDescription),
|
format: (row, dashIfEmpty) => dashIfEmpty(row.entryTypeDescription),
|
||||||
},
|
},
|
||||||
|
|
|
@ -57,7 +57,7 @@ const columns = computed(() => [
|
||||||
create: true,
|
create: true,
|
||||||
component: 'number',
|
component: 'number',
|
||||||
summation: true,
|
summation: true,
|
||||||
width: '60px',
|
width: '50px',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
@ -286,7 +286,7 @@ function round(value) {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.column {
|
.column {
|
||||||
min-width: 30%;
|
min-width: 40%;
|
||||||
margin-top: 5%;
|
margin-top: 5%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -101,7 +101,8 @@ const columns = [
|
||||||
</template>
|
</template>
|
||||||
<style lang="css" scoped>
|
<style lang="css" scoped>
|
||||||
.container {
|
.container {
|
||||||
max-width: 50vw;
|
max-width: 100%;
|
||||||
|
width: 50%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -109,9 +110,6 @@ const columns = [
|
||||||
background-color: var(--vn-section-color);
|
background-color: var(--vn-section-color);
|
||||||
padding: 2%;
|
padding: 2%;
|
||||||
}
|
}
|
||||||
.container > div > div > .q-table__top.relative-position.row.items-center {
|
|
||||||
background-color: red !important;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
|
|
|
@ -103,7 +103,7 @@ const refundInvoice = async (withWarehouse) => {
|
||||||
t('refundInvoiceSuccessMessage', {
|
t('refundInvoiceSuccessMessage', {
|
||||||
refundTicket: data[0].id,
|
refundTicket: data[0].id,
|
||||||
}),
|
}),
|
||||||
'positive'
|
'positive',
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -124,6 +124,13 @@ const showRefundInvoiceForm = () => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const showExportationLetter = () => {
|
||||||
|
openReport(`InvoiceOuts/${$props.invoiceOutData.ref}/exportation-pdf`, {
|
||||||
|
recipientId: $props.invoiceOutData.client.id,
|
||||||
|
refFk: $props.invoiceOutData.ref,
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -156,10 +163,14 @@ const showRefundInvoiceForm = () => {
|
||||||
<QMenu anchor="top end" self="top start">
|
<QMenu anchor="top end" self="top start">
|
||||||
<QList>
|
<QList>
|
||||||
<QItem v-ripple clickable @click="showSendInvoiceDialog('pdf')">
|
<QItem v-ripple clickable @click="showSendInvoiceDialog('pdf')">
|
||||||
<QItemSection>{{ t('Send PDF') }}</QItemSection>
|
<QItemSection data-cy="InvoiceOutDescriptorMenuSendPdfOption">
|
||||||
|
{{ t('Send PDF') }}
|
||||||
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-ripple clickable @click="showSendInvoiceDialog('csv')">
|
<QItem v-ripple clickable @click="showSendInvoiceDialog('csv')">
|
||||||
<QItemSection>{{ t('Send CSV') }}</QItemSection>
|
<QItemSection data-cy="InvoiceOutDescriptorMenuSendCsvOption">
|
||||||
|
{{ t('Send CSV') }}
|
||||||
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</QList>
|
</QList>
|
||||||
</QMenu>
|
</QMenu>
|
||||||
|
@ -172,7 +183,7 @@ const showRefundInvoiceForm = () => {
|
||||||
t('Confirm deletion'),
|
t('Confirm deletion'),
|
||||||
t('Are you sure you want to delete this invoice?'),
|
t('Are you sure you want to delete this invoice?'),
|
||||||
deleteInvoice,
|
deleteInvoice,
|
||||||
redirectToInvoiceOutList
|
redirectToInvoiceOutList,
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -185,7 +196,7 @@ const showRefundInvoiceForm = () => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
'',
|
'',
|
||||||
t('Are you sure you want to book this invoice?'),
|
t('Are you sure you want to book this invoice?'),
|
||||||
bookInvoice
|
bookInvoice,
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -198,7 +209,7 @@ const showRefundInvoiceForm = () => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('Generate PDF invoice document'),
|
t('Generate PDF invoice document'),
|
||||||
t('Are you sure you want to generate/regenerate the PDF invoice?'),
|
t('Are you sure you want to generate/regenerate the PDF invoice?'),
|
||||||
generateInvoicePdf
|
generateInvoicePdf,
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -226,6 +237,14 @@ const showRefundInvoiceForm = () => {
|
||||||
{{ t('Create a single ticket with all the content of the current invoice') }}
|
{{ t('Create a single ticket with all the content of the current invoice') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem
|
||||||
|
v-if="$props.invoiceOutData.serial === 'E'"
|
||||||
|
v-ripple
|
||||||
|
clickable
|
||||||
|
@click="showExportationLetter()"
|
||||||
|
>
|
||||||
|
<QItemSection>{{ t('Show CITES letter') }}</QItemSection>
|
||||||
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
@ -255,7 +274,7 @@ es:
|
||||||
Create a single ticket with all the content of the current invoice: Crear un ticket único con todo el contenido de la factura actual
|
Create a single ticket with all the content of the current invoice: Crear un ticket único con todo el contenido de la factura actual
|
||||||
refundInvoiceSuccessMessage: Se ha creado el siguiente ticket de abono {refundTicket}
|
refundInvoiceSuccessMessage: Se ha creado el siguiente ticket de abono {refundTicket}
|
||||||
The email can't be empty: El email no puede estar vacío
|
The email can't be empty: El email no puede estar vacío
|
||||||
|
Show CITES letter: Ver carta CITES
|
||||||
en:
|
en:
|
||||||
refundInvoiceSuccessMessage: The following refund ticket have been created {refundTicket}
|
refundInvoiceSuccessMessage: The following refund ticket have been created {refundTicket}
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -22,7 +22,7 @@ const states = ref();
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`invoiceOut.params.${tag.label}`) }}: </strong>
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -84,15 +84,6 @@ const states = ref();
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
|
||||||
<QItemSection>
|
|
||||||
<VnInputDate
|
|
||||||
v-model="params.issued"
|
|
||||||
:label="t('Issued')"
|
|
||||||
is-outlined
|
|
||||||
/>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
|
@ -110,37 +101,3 @@ const states = ref();
|
||||||
</template>
|
</template>
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
|
||||||
en:
|
|
||||||
params:
|
|
||||||
search: Contains
|
|
||||||
clientFk: Customer
|
|
||||||
fi: FI
|
|
||||||
amount: Amount
|
|
||||||
min: Min
|
|
||||||
max: Max
|
|
||||||
hasPdf: Has PDF
|
|
||||||
issued: Issued
|
|
||||||
created: Created
|
|
||||||
dued: Dued
|
|
||||||
es:
|
|
||||||
params:
|
|
||||||
search: Contiene
|
|
||||||
clientFk: Cliente
|
|
||||||
fi: CIF
|
|
||||||
amount: Importe
|
|
||||||
min: Min
|
|
||||||
max: Max
|
|
||||||
hasPdf: Tiene PDF
|
|
||||||
issued: Emitida
|
|
||||||
created: Creada
|
|
||||||
dued: Vencida
|
|
||||||
Customer ID: ID cliente
|
|
||||||
FI: CIF
|
|
||||||
Amount: Importe
|
|
||||||
Has PDF: Tiene PDF
|
|
||||||
Issued: Fecha emisión
|
|
||||||
Created: Fecha creación
|
|
||||||
Dued: Fecha vencimiento
|
|
||||||
</i18n>
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import VnSection from 'src/components/common/VnSection.vue';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const invoiceOutSerialsOptions = ref([]);
|
|
||||||
const customerOptions = ref([]);
|
const customerOptions = ref([]);
|
||||||
const selectedRows = ref([]);
|
const selectedRows = ref([]);
|
||||||
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
const hasSelectedCards = computed(() => selectedRows.value.length > 0);
|
||||||
|
@ -71,14 +70,6 @@ const columns = computed(() => [
|
||||||
inWhere: true,
|
inWhere: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'issued',
|
|
||||||
label: t('invoiceOut.summary.issued'),
|
|
||||||
component: 'date',
|
|
||||||
format: (row) => toDate(row.issued),
|
|
||||||
columnField: { component: null },
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'clientFk',
|
name: 'clientFk',
|
||||||
|
@ -376,7 +367,6 @@ watchEffect(selectedRows);
|
||||||
url="InvoiceOutSerials"
|
url="InvoiceOutSerials"
|
||||||
v-model="data.serial"
|
v-model="data.serial"
|
||||||
:label="t('invoiceOutModule.serial')"
|
:label="t('invoiceOutModule.serial')"
|
||||||
:options="invoiceOutSerialsOptions"
|
|
||||||
option-label="description"
|
option-label="description"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
option-filter
|
option-filter
|
||||||
|
|
|
@ -10,6 +10,8 @@ import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vu
|
||||||
import TicketDescriptorProxy from '../Ticket/Card/TicketDescriptorProxy.vue';
|
import TicketDescriptorProxy from '../Ticket/Card/TicketDescriptorProxy.vue';
|
||||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
|
import InvoiceOutNegativeBasesFilter from './InvoiceOutNegativeBasesFilter.vue';
|
||||||
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
@ -97,16 +99,19 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'isActive',
|
name: 'isActive',
|
||||||
label: t('invoiceOut.negativeBases.active'),
|
label: t('invoiceOut.negativeBases.active'),
|
||||||
|
component: 'checkbox',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'hasToInvoice',
|
name: 'hasToInvoice',
|
||||||
label: t('invoiceOut.negativeBases.hasToInvoice'),
|
label: t('invoiceOut.negativeBases.hasToInvoice'),
|
||||||
|
component: 'checkbox',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'hasVerifiedData',
|
name: 'isTaxDataChecked',
|
||||||
label: t('invoiceOut.negativeBases.verifiedData'),
|
label: t('invoiceOut.negativeBases.verifiedData'),
|
||||||
|
component: 'checkbox',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -142,7 +147,7 @@ const downloadCSV = async () => {
|
||||||
await invoiceOutGlobalStore.getNegativeBasesCsv(
|
await invoiceOutGlobalStore.getNegativeBasesCsv(
|
||||||
userParams.from,
|
userParams.from,
|
||||||
userParams.to,
|
userParams.to,
|
||||||
filterParams
|
filterParams,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -154,6 +159,11 @@ const downloadCSV = async () => {
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
|
<RightMenu>
|
||||||
|
<template #right-panel>
|
||||||
|
<InvoiceOutNegativeBasesFilter data-key="negativeFilter" />
|
||||||
|
</template>
|
||||||
|
</RightMenu>
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="negativeFilter"
|
data-key="negativeFilter"
|
||||||
|
@ -174,6 +184,7 @@ const downloadCSV = async () => {
|
||||||
auto-load
|
auto-load
|
||||||
:is-editable="false"
|
:is-editable="false"
|
||||||
:use-model="true"
|
:use-model="true"
|
||||||
|
:right-search="false"
|
||||||
>
|
>
|
||||||
<template #column-clientId="{ row }">
|
<template #column-clientId="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -24,11 +25,11 @@ const props = defineProps({
|
||||||
>
|
>
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`invoiceOut.params.${tag.label}`) }}: </strong>
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ params }">
|
<template #body="{ params, searchFn }">
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
|
@ -49,38 +50,70 @@ const props = defineProps({
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnSelect
|
||||||
v-model="params.company"
|
url="Companies"
|
||||||
:label="t('globals.company')"
|
:label="t('globals.company')"
|
||||||
is-outlined
|
v-model="params.company"
|
||||||
/>
|
option-label="code"
|
||||||
|
option-value="code"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
@update:model-value="searchFn()"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt?.code }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ `#${scope.opt?.id}` }}
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnSelect
|
||||||
|
url="Countries"
|
||||||
|
:label="t('globals.params.countryFk')"
|
||||||
v-model="params.country"
|
v-model="params.country"
|
||||||
:label="t('globals.country')"
|
option-label="name"
|
||||||
is-outlined
|
option-value="name"
|
||||||
/>
|
outlined
|
||||||
|
dense
|
||||||
|
rounded
|
||||||
|
@update:model-value="searchFn()"
|
||||||
|
>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt?.name }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel caption>
|
||||||
|
{{ `#${scope.opt?.id}` }}
|
||||||
|
</QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
</template>
|
||||||
<QItem>
|
</VnSelect>
|
||||||
<QItemSection>
|
|
||||||
<VnInput
|
|
||||||
v-model="params.clientId"
|
|
||||||
:label="t('invoiceOut.negativeBases.clientId')"
|
|
||||||
is-outlined
|
|
||||||
/>
|
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnSelect
|
||||||
v-model="params.clientSocialName"
|
url="Clients"
|
||||||
:label="t('globals.client')"
|
:label="t('globals.client')"
|
||||||
is-outlined
|
v-model="params.clientId"
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
rounded
|
||||||
|
@update:model-value="searchFn()"
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -90,15 +123,18 @@ const props = defineProps({
|
||||||
v-model="params.amount"
|
v-model="params.amount"
|
||||||
:label="t('globals.amount')"
|
:label="t('globals.amount')"
|
||||||
is-outlined
|
is-outlined
|
||||||
|
:positive="false"
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnSelectWorker
|
||||||
v-model="params.comercialName"
|
|
||||||
:label="t('invoiceOut.negativeBases.comercial')"
|
:label="t('invoiceOut.negativeBases.comercial')"
|
||||||
|
v-model="params.workerName"
|
||||||
|
option-value="name"
|
||||||
is-outlined
|
is-outlined
|
||||||
|
@update:model-value="searchFn()"
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
|
@ -4,7 +4,7 @@ invoiceOut:
|
||||||
params:
|
params:
|
||||||
company: Company
|
company: Company
|
||||||
country: Country
|
country: Country
|
||||||
clientId: Client ID
|
clientId: Client
|
||||||
clientSocialName: Client
|
clientSocialName: Client
|
||||||
taxableBase: Base
|
taxableBase: Base
|
||||||
ticketFk: Ticket
|
ticketFk: Ticket
|
||||||
|
@ -12,6 +12,19 @@ invoiceOut:
|
||||||
hasToInvoice: Has to invoice
|
hasToInvoice: Has to invoice
|
||||||
hasVerifiedData: Verified data
|
hasVerifiedData: Verified data
|
||||||
workerName: Worker
|
workerName: Worker
|
||||||
|
isTaxDataChecked: Verified data
|
||||||
|
amount: Amount
|
||||||
|
clientFk: Client
|
||||||
|
companyFk: Company
|
||||||
|
created: Created
|
||||||
|
dued: Dued
|
||||||
|
customsAgentFk: Custom Agent
|
||||||
|
ref: Reference
|
||||||
|
fi: FI
|
||||||
|
min: Min
|
||||||
|
max: Max
|
||||||
|
hasPdf: Has PDF
|
||||||
|
search: Contains
|
||||||
card:
|
card:
|
||||||
issued: Issued
|
issued: Issued
|
||||||
customerCard: Customer card
|
customerCard: Customer card
|
||||||
|
@ -53,7 +66,7 @@ invoiceOut:
|
||||||
active: Active
|
active: Active
|
||||||
hasToInvoice: Has to Invoice
|
hasToInvoice: Has to Invoice
|
||||||
verifiedData: Verified Data
|
verifiedData: Verified Data
|
||||||
comercial: Commercial
|
comercial: Sales person
|
||||||
errors:
|
errors:
|
||||||
downloadCsvFailed: CSV download failed
|
downloadCsvFailed: CSV download failed
|
||||||
invoiceOutModule:
|
invoiceOutModule:
|
||||||
|
|
|
@ -4,7 +4,7 @@ invoiceOut:
|
||||||
params:
|
params:
|
||||||
company: Empresa
|
company: Empresa
|
||||||
country: País
|
country: País
|
||||||
clientId: ID del cliente
|
clientId: Cliente
|
||||||
clientSocialName: Cliente
|
clientSocialName: Cliente
|
||||||
taxableBase: Base
|
taxableBase: Base
|
||||||
ticketFk: Ticket
|
ticketFk: Ticket
|
||||||
|
@ -12,6 +12,19 @@ invoiceOut:
|
||||||
hasToInvoice: Debe facturar
|
hasToInvoice: Debe facturar
|
||||||
hasVerifiedData: Datos verificados
|
hasVerifiedData: Datos verificados
|
||||||
workerName: Comercial
|
workerName: Comercial
|
||||||
|
isTaxDataChecked: Datos comprobados
|
||||||
|
amount: Importe
|
||||||
|
clientFk: Cliente
|
||||||
|
companyFk: Empresa
|
||||||
|
created: Creada
|
||||||
|
dued: Vencida
|
||||||
|
customsAgentFk: Agente aduanas
|
||||||
|
ref: Referencia
|
||||||
|
fi: CIF
|
||||||
|
min: Min
|
||||||
|
max: Max
|
||||||
|
hasPdf: Tiene PDF
|
||||||
|
search: Contiene
|
||||||
card:
|
card:
|
||||||
issued: Fecha emisión
|
issued: Fecha emisión
|
||||||
customerCard: Ficha del cliente
|
customerCard: Ficha del cliente
|
||||||
|
|
|
@ -8,6 +8,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -52,7 +53,7 @@ onMounted(async () => {
|
||||||
name: key,
|
name: key,
|
||||||
value,
|
value,
|
||||||
selectedField: { name: key, label: t(`params.${key}`) },
|
selectedField: { name: key, label: t(`params.${key}`) },
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
exprBuilder('state', arrayData.store?.userParams?.state);
|
exprBuilder('state', arrayData.store?.userParams?.state);
|
||||||
|
@ -157,6 +158,32 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInputDate
|
||||||
|
v-model="params.from"
|
||||||
|
:label="t('params.from')"
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInputDate
|
||||||
|
v-model="params.to"
|
||||||
|
:label="t('params.to')"
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInput
|
||||||
|
:label="t('params.daysOnward')"
|
||||||
|
v-model="params.daysOnward"
|
||||||
|
lazy-rules
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
@ -175,11 +202,10 @@ onMounted(async () => {
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<QCheckbox
|
||||||
:label="t('params.daysOnward')"
|
:label="t('params.mine')"
|
||||||
v-model="params.daysOnward"
|
v-model="params.mine"
|
||||||
lazy-rules
|
:toggle-indeterminate="false"
|
||||||
is-outlined
|
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
|
@ -280,7 +280,7 @@ const openTicketsDialog = (id) => {
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="q-pt-none">
|
<QCardSection class="q-pt-none">
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('route.Stating date')"
|
:label="t('route.Starting date')"
|
||||||
v-model="startingDate"
|
v-model="startingDate"
|
||||||
autofocus
|
autofocus
|
||||||
/>
|
/>
|
||||||
|
@ -335,6 +335,7 @@ const openTicketsDialog = (id) => {
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="vn:clone"
|
icon="vn:clone"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
flat
|
||||||
class="q-mr-sm"
|
class="q-mr-sm"
|
||||||
:disable="!selectedRows?.length"
|
:disable="!selectedRows?.length"
|
||||||
@click="confirmationDialog = true"
|
@click="confirmationDialog = true"
|
||||||
|
@ -344,6 +345,7 @@ const openTicketsDialog = (id) => {
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="cloud_download"
|
icon="cloud_download"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
flat
|
||||||
class="q-mr-sm"
|
class="q-mr-sm"
|
||||||
:disable="!selectedRows?.length"
|
:disable="!selectedRows?.length"
|
||||||
@click="showRouteReport"
|
@click="showRouteReport"
|
||||||
|
@ -353,6 +355,7 @@ const openTicketsDialog = (id) => {
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="check"
|
icon="check"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
flat
|
||||||
class="q-mr-sm"
|
class="q-mr-sm"
|
||||||
:disable="!selectedRows?.length"
|
:disable="!selectedRows?.length"
|
||||||
@click="markAsServed()"
|
@click="markAsServed()"
|
||||||
|
|
|
@ -21,6 +21,10 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: 'mana',
|
default: 'mana',
|
||||||
},
|
},
|
||||||
|
sale: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['save', 'cancel']);
|
const emit = defineEmits(['save', 'cancel']);
|
||||||
|
@ -29,8 +33,8 @@ const { t } = useI18n();
|
||||||
const QPopupProxyRef = ref(null);
|
const QPopupProxyRef = ref(null);
|
||||||
const manaCode = ref($props.manaCode);
|
const manaCode = ref($props.manaCode);
|
||||||
|
|
||||||
const save = () => {
|
const save = (sale = $props.sale) => {
|
||||||
emit('save');
|
emit('save', sale);
|
||||||
QPopupProxyRef.value.hide();
|
QPopupProxyRef.value.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,10 +42,11 @@ const cancel = () => {
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
QPopupProxyRef.value.hide();
|
QPopupProxyRef.value.hide();
|
||||||
};
|
};
|
||||||
|
defineExpose({ save });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy ref="QPopupProxyRef">
|
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketEditManaProxy">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<QSpinner v-if="!mana" color="primary" size="md" />
|
<QSpinner v-if="!mana" color="primary" size="md" />
|
||||||
<div v-else>
|
<div v-else>
|
||||||
|
|
|
@ -22,7 +22,6 @@ import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import VnUsesMana from 'src/components/ui/VnUsesMana.vue';
|
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
import TicketProblems from 'src/components/TicketProblems.vue';
|
import TicketProblems from 'src/components/TicketProblems.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
@ -33,6 +32,7 @@ const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const editPriceProxyRef = ref(null);
|
const editPriceProxyRef = ref(null);
|
||||||
|
const editManaProxyRef = ref(null);
|
||||||
const stateBtnDropdownRef = ref(null);
|
const stateBtnDropdownRef = ref(null);
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const arrayData = useArrayData('Ticket');
|
const arrayData = useArrayData('Ticket');
|
||||||
|
@ -53,7 +53,6 @@ const transfer = ref({
|
||||||
sales: [],
|
sales: [],
|
||||||
});
|
});
|
||||||
const tableRef = ref([]);
|
const tableRef = ref([]);
|
||||||
const canProceed = ref();
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
|
@ -133,7 +132,6 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('globals.amount'),
|
label: t('globals.amount'),
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
format: (row) => toCurrency(getSaleTotal(row)),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -183,8 +181,6 @@ const resetChanges = async () => {
|
||||||
};
|
};
|
||||||
const rowToUpdate = ref(null);
|
const rowToUpdate = ref(null);
|
||||||
const changeQuantity = async (sale) => {
|
const changeQuantity = async (sale) => {
|
||||||
canProceed.value = await isSalePrepared(sale);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
if (
|
if (
|
||||||
!sale.itemFk ||
|
!sale.itemFk ||
|
||||||
sale.quantity == null ||
|
sale.quantity == null ||
|
||||||
|
@ -193,11 +189,21 @@ const changeQuantity = async (sale) => {
|
||||||
return;
|
return;
|
||||||
if (!sale.id) return addSale(sale);
|
if (!sale.id) return addSale(sale);
|
||||||
|
|
||||||
|
if (await isSalePrepared(sale)) {
|
||||||
|
await confirmUpdate(() => updateQuantity(sale));
|
||||||
|
} else await updateQuantity(sale);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateQuantity = async (sale) => {
|
||||||
try {
|
try {
|
||||||
|
let { quantity, id } = sale;
|
||||||
if (!rowToUpdate.value) return;
|
if (!rowToUpdate.value) return;
|
||||||
rowToUpdate.value = null;
|
rowToUpdate.value = null;
|
||||||
sale.isNew = false;
|
sale.isNew = false;
|
||||||
await updateQuantity(sale);
|
const params = { quantity: quantity };
|
||||||
|
await axios.post(`Sales/${id}/updateQuantity`, params);
|
||||||
|
notify('globals.dataSaved', 'positive');
|
||||||
|
tableRef.value.reload();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
|
const { quantity } = tableRef.value.CrudModelRef.originalData.find(
|
||||||
(s) => s.id === sale.id,
|
(s) => s.id === sale.id,
|
||||||
|
@ -207,12 +213,6 @@ const changeQuantity = async (sale) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateQuantity = async ({ quantity, id }) => {
|
|
||||||
const params = { quantity: quantity };
|
|
||||||
await axios.post(`Sales/${id}/updateQuantity`, params);
|
|
||||||
notify('globals.dataSaved', 'positive');
|
|
||||||
};
|
|
||||||
|
|
||||||
const addSale = async (sale) => {
|
const addSale = async (sale) => {
|
||||||
const params = {
|
const params = {
|
||||||
barcode: sale.itemFk,
|
barcode: sale.itemFk,
|
||||||
|
@ -237,13 +237,17 @@ const addSale = async (sale) => {
|
||||||
sale.isNew = false;
|
sale.isNew = false;
|
||||||
arrayData.fetch({});
|
arrayData.fetch({});
|
||||||
};
|
};
|
||||||
|
const changeConcept = async (sale) => {
|
||||||
|
if (await isSalePrepared(sale)) {
|
||||||
|
await confirmUpdate(() => updateConcept(sale));
|
||||||
|
} else await updateConcept(sale);
|
||||||
|
};
|
||||||
|
|
||||||
const updateConcept = async (sale) => {
|
const updateConcept = async (sale) => {
|
||||||
canProceed.value = await isSalePrepared(sale);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
const data = { newConcept: sale.concept };
|
const data = { newConcept: sale.concept };
|
||||||
await axios.post(`Sales/${sale.id}/updateConcept`, data);
|
await axios.post(`Sales/${sale.id}/updateConcept`, data);
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
|
tableRef.value.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_EDIT = {
|
const DEFAULT_EDIT = {
|
||||||
|
@ -295,33 +299,43 @@ const onOpenEditDiscountPopover = async (sale) => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const changePrice = async (sale) => {
|
||||||
const updatePrice = async (sale) => {
|
|
||||||
canProceed.value = await isSalePrepared(sale);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
const newPrice = edit.value.price;
|
const newPrice = edit.value.price;
|
||||||
if (newPrice != null && newPrice != sale.price) {
|
if (newPrice != null && newPrice != sale.price) {
|
||||||
|
if (await isSalePrepared(sale)) {
|
||||||
|
await confirmUpdate(() => updatePrice(sale, newPrice));
|
||||||
|
} else updatePrice(sale, newPrice);
|
||||||
|
}
|
||||||
|
await getMana();
|
||||||
|
};
|
||||||
|
const updatePrice = async (sale, newPrice) => {
|
||||||
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
|
await axios.post(`Sales/${sale.id}/updatePrice`, { newPrice });
|
||||||
sale.price = newPrice;
|
sale.price = newPrice;
|
||||||
edit.value = { ...DEFAULT_EDIT };
|
edit.value = { ...DEFAULT_EDIT };
|
||||||
notify('globals.dataSaved', 'positive');
|
notify('globals.dataSaved', 'positive');
|
||||||
}
|
tableRef.value.reload();
|
||||||
|
|
||||||
await getMana();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeDiscount = async (sale) => {
|
const changeDiscount = async (sale) => {
|
||||||
canProceed.value = await isSalePrepared(sale);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
const newDiscount = edit.value.discount;
|
const newDiscount = edit.value.discount;
|
||||||
if (newDiscount != null && newDiscount != sale.discount) updateDiscount([sale]);
|
if (newDiscount != null && newDiscount != sale.discount) {
|
||||||
|
if (await isSalePrepared(sale))
|
||||||
|
await confirmUpdate(() => updateDiscount([sale], newDiscount));
|
||||||
|
else await updateDiscount([sale], newDiscount);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateDiscounts = async (sales, newDiscount = null) => {
|
||||||
|
const salesTracking = await fetchSalesTracking();
|
||||||
|
|
||||||
|
const someSaleIsPrepared = salesTracking.some((sale) =>
|
||||||
|
matchSale(salesTracking, sale),
|
||||||
|
);
|
||||||
|
if (someSaleIsPrepared) await confirmUpdate(() => updateDiscount(sales, newDiscount));
|
||||||
|
else updateDiscount(sales, newDiscount);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateDiscount = async (sales, newDiscount = null) => {
|
const updateDiscount = async (sales, newDiscount = null) => {
|
||||||
for (const sale of sales) {
|
|
||||||
const canProceed = await isSalePrepared(sale);
|
|
||||||
if (!canProceed) return;
|
|
||||||
}
|
|
||||||
const saleIds = sales.map((sale) => sale.id);
|
const saleIds = sales.map((sale) => sale.id);
|
||||||
const _newDiscount = newDiscount || edit.value.discount;
|
const _newDiscount = newDiscount || edit.value.discount;
|
||||||
const params = {
|
const params = {
|
||||||
|
@ -424,9 +438,13 @@ onMounted(async () => {
|
||||||
const items = ref([]);
|
const items = ref([]);
|
||||||
const newRow = ref({});
|
const newRow = ref({});
|
||||||
|
|
||||||
|
const changeItem = async (sale) => {
|
||||||
|
if (await isSalePrepared(sale)) {
|
||||||
|
await confirmUpdate(() => updateItem(sale));
|
||||||
|
} else await updateItem(sale);
|
||||||
|
};
|
||||||
|
|
||||||
const updateItem = async (row) => {
|
const updateItem = async (row) => {
|
||||||
canProceed.value = await isSalePrepared(row);
|
|
||||||
if (!canProceed.value) return;
|
|
||||||
const selectedItem = items.value.find((item) => item.id === row.itemFk);
|
const selectedItem = items.value.find((item) => item.id === row.itemFk);
|
||||||
if (selectedItem) {
|
if (selectedItem) {
|
||||||
row.item = selectedItem;
|
row.item = selectedItem;
|
||||||
|
@ -470,7 +488,18 @@ const endNewRow = (row) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function isSalePrepared(item) {
|
async function confirmUpdate(cb) {
|
||||||
|
await quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('Item prepared'),
|
||||||
|
message: t('This item is already prepared. Do you want to continue?'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(cb);
|
||||||
|
}
|
||||||
|
async function fetchSalesTracking() {
|
||||||
const filter = {
|
const filter = {
|
||||||
params: {
|
params: {
|
||||||
where: { ticketFk: route.params.id },
|
where: { ticketFk: route.params.id },
|
||||||
|
@ -482,48 +511,37 @@ async function isSalePrepared(item) {
|
||||||
filter: JSON.stringify(filter),
|
filter: JSON.stringify(filter),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
return data;
|
||||||
const matchingSale = data.find((sale) => sale.itemFk === item.itemFk);
|
|
||||||
if (!matchingSale) {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
async function isSalePrepared(sale) {
|
||||||
matchingSale.hasSaleGroupDetail ||
|
const data = await fetchSalesTracking();
|
||||||
matchingSale.isControled ||
|
return matchSale(data, sale);
|
||||||
matchingSale.isPrepared ||
|
}
|
||||||
matchingSale.isPrevious ||
|
function matchSale(data, sale) {
|
||||||
matchingSale.isPreviousSelected
|
const matchingSale = data.find(({ itemFk }) => itemFk === sale.itemFk);
|
||||||
) {
|
|
||||||
try {
|
if (!matchingSale) {
|
||||||
await new Promise((resolve, reject) => {
|
|
||||||
quasar
|
|
||||||
.dialog({
|
|
||||||
component: VnConfirm,
|
|
||||||
componentProps: {
|
|
||||||
title: t('Item prepared'),
|
|
||||||
message: t(
|
|
||||||
'This item is already prepared. Do you want to continue?',
|
|
||||||
),
|
|
||||||
data: item,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.onOk(() => resolve(true))
|
|
||||||
.onCancel(() => reject(new Error('cancelled')));
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
tableRef.value.reload();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return isPrepared(matchingSale);
|
||||||
|
}
|
||||||
|
function isPrepared(sale) {
|
||||||
|
const flagsToCheck = [
|
||||||
|
'hasSaleGroupDetail',
|
||||||
|
'isControled',
|
||||||
|
'isPrepared',
|
||||||
|
'isPrevious',
|
||||||
|
'isPreviousSelected',
|
||||||
|
];
|
||||||
|
return flagsToCheck.some((flag) => sale[flag] === 1);
|
||||||
|
}
|
||||||
watch(
|
watch(
|
||||||
() => newRow.value.itemFk,
|
() => newRow.value.itemFk,
|
||||||
(newItemFk) => {
|
(newItemFk) => {
|
||||||
if (newItemFk) {
|
if (newItemFk) {
|
||||||
updateItem(newRow.value);
|
changeItem(newRow.value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -584,7 +602,7 @@ watch(
|
||||||
:mana="mana"
|
:mana="mana"
|
||||||
:ticket-config="ticketConfig"
|
:ticket-config="ticketConfig"
|
||||||
@get-mana="getMana()"
|
@get-mana="getMana()"
|
||||||
@update-discounts="updateDiscount"
|
@update-discounts="updateDiscounts"
|
||||||
@refresh-table="resetChanges"
|
@refresh-table="resetChanges"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -715,7 +733,7 @@ watch(
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="row.itemFk"
|
v-model="row.itemFk"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
@update:model-value="updateItem(row)"
|
@update:model-value="changeItem(row)"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -741,16 +759,21 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
<FetchedTags :item="row" :max-length="6" />
|
<FetchedTags :item="row" :max-length="6" />
|
||||||
<QPopupProxy v-if="row.id && isTicketEditable">
|
<QPopupProxy v-if="row.id && isTicketEditable">
|
||||||
<VnInput v-model="row.concept" @change="updateConcept(row)" />
|
<VnInput
|
||||||
|
v-model="row.concept"
|
||||||
|
@keyup.enter.stop="changeConcept(row)"
|
||||||
|
:hint="t('globals.enterToConfirm')"
|
||||||
|
/>
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
<template #column-quantity="{ row }">
|
<template #column-quantity="{ row }">
|
||||||
<VnInput
|
<VnInput
|
||||||
|
data-cy="ticketSaleQuantityInput"
|
||||||
v-if="row.isNew || isTicketEditable"
|
v-if="row.isNew || isTicketEditable"
|
||||||
type="number"
|
type="number"
|
||||||
v-model.number="row.quantity"
|
v-model.number="row.quantity"
|
||||||
@blur="changeQuantity(row)"
|
@blur="changeQuantity(row)"
|
||||||
@keyup.enter="changeQuantity(row)"
|
@keyup.enter.stop="changeQuantity(row)"
|
||||||
@update:model-value="() => (rowToUpdate = row)"
|
@update:model-value="() => (rowToUpdate = row)"
|
||||||
@focus="edit.oldQuantity = row.quantity"
|
@focus="edit.oldQuantity = row.quantity"
|
||||||
/>
|
/>
|
||||||
|
@ -764,10 +787,12 @@ watch(
|
||||||
<TicketEditManaProxy
|
<TicketEditManaProxy
|
||||||
ref="editPriceProxyRef"
|
ref="editPriceProxyRef"
|
||||||
:mana="mana"
|
:mana="mana"
|
||||||
|
:sale="row"
|
||||||
:new-price="getNewPrice"
|
:new-price="getNewPrice"
|
||||||
@save="updatePrice(row)"
|
@save="changePrice"
|
||||||
>
|
>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@keyup.enter.stop="() => editManaProxyRef.save(row)"
|
||||||
v-model.number="edit.price"
|
v-model.number="edit.price"
|
||||||
:label="t('basicData.price')"
|
:label="t('basicData.price')"
|
||||||
type="number"
|
type="number"
|
||||||
|
@ -781,31 +806,30 @@ watch(
|
||||||
<QBtn flat class="link" dense @click="onOpenEditDiscountPopover(row)">
|
<QBtn flat class="link" dense @click="onOpenEditDiscountPopover(row)">
|
||||||
{{ toPercentage(row.discount / 100) }}
|
{{ toPercentage(row.discount / 100) }}
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
||||||
<TicketEditManaProxy
|
<TicketEditManaProxy
|
||||||
|
ref="editManaProxyRef"
|
||||||
:mana="mana"
|
:mana="mana"
|
||||||
|
:sale="row"
|
||||||
:new-price="getNewPrice"
|
:new-price="getNewPrice"
|
||||||
:uses-mana="usesMana"
|
:uses-mana="usesMana"
|
||||||
:mana-code="manaCode"
|
:mana-code="manaCode"
|
||||||
@save="changeDiscount(row)"
|
@save="changeDiscount"
|
||||||
>
|
>
|
||||||
<template #default="{ popup }">
|
|
||||||
<VnInput
|
<VnInput
|
||||||
autofocus
|
autofocus
|
||||||
@keyup.enter="
|
@keyup.enter.stop="() => editManaProxyRef.save(row)"
|
||||||
() => {
|
|
||||||
changeDiscount(row);
|
|
||||||
popup.hide();
|
|
||||||
}
|
|
||||||
"
|
|
||||||
v-model.number="edit.discount"
|
v-model.number="edit.discount"
|
||||||
:label="t('ticketSale.discount')"
|
:label="t('ticketSale.discount')"
|
||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
</template>
|
|
||||||
</TicketEditManaProxy>
|
</TicketEditManaProxy>
|
||||||
</template>
|
</template>
|
||||||
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-amount="{ row }">
|
||||||
|
{{ toCurrency(getSaleTotal(row)) }}
|
||||||
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
|
||||||
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
||||||
|
|
|
@ -209,7 +209,7 @@ const onThermographCreated = async (data) => {
|
||||||
}"
|
}"
|
||||||
sort-by="thermographFk ASC"
|
sort-by="thermographFk ASC"
|
||||||
option-label="thermographFk"
|
option-label="thermographFk"
|
||||||
option-filter-value="id"
|
option-filter-value="thermographFk"
|
||||||
:disable="viewAction === 'edit'"
|
:disable="viewAction === 'edit'"
|
||||||
:tooltip="t('New thermograph')"
|
:tooltip="t('New thermograph')"
|
||||||
:roles-allowed-to-create="['logistic']"
|
:roles-allowed-to-create="['logistic']"
|
||||||
|
|
|
@ -119,7 +119,7 @@ const columns = computed(() => [
|
||||||
:url="`Workers/${entityId}/trainingCourse`"
|
:url="`Workers/${entityId}/trainingCourse`"
|
||||||
:url-create="`Workers/${entityId}/trainingCourse`"
|
:url-create="`Workers/${entityId}/trainingCourse`"
|
||||||
save-url="TrainingCourses/crud"
|
save-url="TrainingCourses/crud"
|
||||||
:filter="courseFilter"
|
:user-filter="courseFilter"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'trainingCourses',
|
urlCreate: 'trainingCourses',
|
||||||
title: t('Create training course'),
|
title: t('Create training course'),
|
||||||
|
|
|
@ -3,11 +3,23 @@ import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
|
import { dashIfEmpty } from 'src/filters';
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const entityId = computed(() => route.params.id);
|
const entityId = computed(() => route.params.id);
|
||||||
|
|
||||||
|
const centerFilter = {
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'center',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -36,6 +48,9 @@ const columns = [
|
||||||
url: 'medicalCenters',
|
url: 'medicalCenters',
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
},
|
},
|
||||||
|
format: (row, dashIfEmpty) => {
|
||||||
|
return dashIfEmpty(row.center?.name);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -84,6 +99,7 @@ const columns = [
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="WorkerMedical"
|
data-key="WorkerMedical"
|
||||||
:url="`Workers/${entityId}/medicalReview`"
|
:url="`Workers/${entityId}/medicalReview`"
|
||||||
|
:user-filter="centerFilter"
|
||||||
save-url="MedicalReviews/crud"
|
save-url="MedicalReviews/crud"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'medicalReviews',
|
urlCreate: 'medicalReviews',
|
||||||
|
|
|
@ -176,6 +176,7 @@ const deleteRelative = async (id) => {
|
||||||
:label="t('isDescendant')"
|
:label="t('isDescendant')"
|
||||||
v-model="row.isDescendant"
|
v-model="row.isDescendant"
|
||||||
class="q-gutter-xs q-mb-xs"
|
class="q-gutter-xs q-mb-xs"
|
||||||
|
data-cy="Descendant/Ascendant"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('disabilityGrades')"
|
:label="t('disabilityGrades')"
|
||||||
|
|
|
@ -25,7 +25,7 @@ const setFilteredAddresses = (data) => {
|
||||||
@on-fetch="(data) => (validAddresses = data)"
|
@on-fetch="(data) => (validAddresses = data)"
|
||||||
/>
|
/>
|
||||||
<FetchData url="Addresses" auto-load @on-fetch="setFilteredAddresses" />
|
<FetchData url="Addresses" auto-load @on-fetch="setFilteredAddresses" />
|
||||||
<FormModel auto-load model="zone">
|
<FormModel auto-load model="Zone">
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -33,6 +33,7 @@ const setFilteredAddresses = (data) => {
|
||||||
:label="t('Name')"
|
:label="t('Name')"
|
||||||
clearable
|
clearable
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
|
:required="true"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
@ -83,7 +84,7 @@ const setFilteredAddresses = (data) => {
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
/>
|
/>
|
||||||
<VnInputTime v-model="data.hour" :label="t('Closing')" />
|
<VnInputTime v-model="data.hour" :label="t('Closing')" :required="true" />
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
@ -92,7 +93,7 @@ const setFilteredAddresses = (data) => {
|
||||||
:label="t('Price')"
|
:label="t('Price')"
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
required="true"
|
:required="true"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -100,7 +101,7 @@ const setFilteredAddresses = (data) => {
|
||||||
:label="t('Price optimum')"
|
:label="t('Price optimum')"
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
required="true"
|
:required="true"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
|
@ -38,7 +38,12 @@ const agencies = ref([]);
|
||||||
<template #body="{ params, searchFn }">
|
<template #body="{ params, searchFn }">
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput :label="t('list.name')" v-model="params.name" is-outlined />
|
<VnInput
|
||||||
|
:label="t('list.name')"
|
||||||
|
v-model="params.name"
|
||||||
|
is-outlined
|
||||||
|
data-cy="zoneFilterPanelNameInput"
|
||||||
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem>
|
||||||
|
@ -53,6 +58,7 @@ const agencies = ref([]);
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
|
data-cy="zoneFilterPanelAgencySelect"
|
||||||
>
|
>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -65,7 +65,6 @@ const tableFilter = {
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: t('list.id'),
|
label: t('list.id'),
|
||||||
chip: {
|
chip: {
|
||||||
|
@ -75,6 +74,8 @@ const columns = computed(() => [
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
inWhere: true,
|
inWhere: true,
|
||||||
},
|
},
|
||||||
|
columnClass: 'shrink-column',
|
||||||
|
component: 'number',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -106,7 +107,6 @@ const columns = computed(() => [
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(row?.agencyMode?.name),
|
format: (row, dashIfEmpty) => dashIfEmpty(row?.agencyMode?.name),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
|
||||||
name: 'price',
|
name: 'price',
|
||||||
label: t('list.price'),
|
label: t('list.price'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
|
@ -114,9 +114,11 @@ const columns = computed(() => [
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
inWhere: true,
|
inWhere: true,
|
||||||
},
|
},
|
||||||
|
columnClass: 'shrink-column',
|
||||||
|
component: 'number',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'center',
|
||||||
name: 'hour',
|
name: 'hour',
|
||||||
label: t('list.close'),
|
label: t('list.close'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
|
@ -129,6 +131,7 @@ const columns = computed(() => [
|
||||||
label: t('list.addressFk'),
|
label: t('list.addressFk'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
|
columnClass: 'expand',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -177,6 +180,8 @@ function formatRow(row) {
|
||||||
<ZoneFilterPanel data-key="ZonesList" />
|
<ZoneFilterPanel data-key="ZonesList" />
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
|
<div class="table-container">
|
||||||
|
<div class="column items-center">
|
||||||
<VnTable
|
<VnTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="ZonesList"
|
data-key="ZonesList"
|
||||||
|
@ -191,6 +196,8 @@ function formatRow(row) {
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="zone"
|
redirect="zone"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
table-height="85vh"
|
||||||
|
order="id ASC"
|
||||||
>
|
>
|
||||||
<template #column-addressFk="{ row }">
|
<template #column-addressFk="{ row }">
|
||||||
{{ dashIfEmpty(formatRow(row)) }}
|
{{ dashIfEmpty(formatRow(row)) }}
|
||||||
|
@ -238,6 +245,8 @@ function formatRow(row) {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
@ -245,3 +254,20 @@ es:
|
||||||
Search zone: Buscar zona
|
Search zone: Buscar zona
|
||||||
You can search zones by id or name: Puedes buscar zonas por id o nombre
|
You can search zones by id or name: Puedes buscar zonas por id o nombre
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
|
@ -56,7 +56,7 @@ onMounted(() => weekdayStore.initStore());
|
||||||
<ZoneSearchbar />
|
<ZoneSearchbar />
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QCard class="full-width q-pa-md">
|
<QCard class="containerShrinked q-pa-md">
|
||||||
<div
|
<div
|
||||||
v-for="(detail, index) in details"
|
v-for="(detail, index) in details"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
|
|
@ -44,6 +44,8 @@ summary:
|
||||||
filterPanel:
|
filterPanel:
|
||||||
name: Name
|
name: Name
|
||||||
agencyModeFk: Agency
|
agencyModeFk: Agency
|
||||||
|
id: ID
|
||||||
|
price: Price
|
||||||
deliveryPanel:
|
deliveryPanel:
|
||||||
pickup: Pick up
|
pickup: Pick up
|
||||||
delivery: Delivery
|
delivery: Delivery
|
||||||
|
|
|
@ -45,6 +45,8 @@ summary:
|
||||||
filterPanel:
|
filterPanel:
|
||||||
name: Nombre
|
name: Nombre
|
||||||
agencyModeFk: Agencia
|
agencyModeFk: Agencia
|
||||||
|
id: ID
|
||||||
|
price: Precio
|
||||||
deliveryPanel:
|
deliveryPanel:
|
||||||
pickup: Recogida
|
pickup: Recogida
|
||||||
delivery: Entrega
|
delivery: Entrega
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
reports/*
|
reports/*
|
||||||
|
videos/*
|
||||||
screenshots/*
|
screenshots/*
|
||||||
downloads/*
|
downloads/*
|
||||||
|
storage/*
|
||||||
|
reports/*
|
||||||
|
docker/logs/*
|
||||||
|
|
|
@ -0,0 +1,149 @@
|
||||||
|
{
|
||||||
|
"db": {
|
||||||
|
"connector": "memory",
|
||||||
|
"timezone": "local"
|
||||||
|
},
|
||||||
|
"vn": {
|
||||||
|
"connector": "vn-mysql",
|
||||||
|
"database": "vn",
|
||||||
|
"debug": false,
|
||||||
|
"host": "db",
|
||||||
|
"port": "3306",
|
||||||
|
"username": "root",
|
||||||
|
"password": "root",
|
||||||
|
"connectionLimit": 100,
|
||||||
|
"queueLimit": 100,
|
||||||
|
"multipleStatements": true,
|
||||||
|
"legacyUtcDateProcessing": false,
|
||||||
|
"timezone": "local",
|
||||||
|
"connectTimeout": 40000,
|
||||||
|
"acquireTimeout": 90000,
|
||||||
|
"waitForConnections": true,
|
||||||
|
"maxIdleTime": 60000,
|
||||||
|
"idleTimeout": 60000
|
||||||
|
},
|
||||||
|
"osticket": {
|
||||||
|
"connector": "memory",
|
||||||
|
"timezone": "local"
|
||||||
|
},
|
||||||
|
"tempStorage": {
|
||||||
|
"name": "tempStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/tmp",
|
||||||
|
"maxFileSize": "262144000",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"application/x-7z-compressed",
|
||||||
|
"application/x-zip-compressed",
|
||||||
|
"application/x-rar-compressed",
|
||||||
|
"application/octet-stream",
|
||||||
|
"application/pdf",
|
||||||
|
"application/zip",
|
||||||
|
"application/rar",
|
||||||
|
"multipart/x-zip",
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
|
"video/mp4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dmsStorage": {
|
||||||
|
"name": "dmsStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/dms",
|
||||||
|
"maxFileSize": "262144000",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"application/x-7z-compressed",
|
||||||
|
"application/x-zip-compressed",
|
||||||
|
"application/x-rar-compressed",
|
||||||
|
"application/octet-stream",
|
||||||
|
"application/pdf",
|
||||||
|
"application/zip",
|
||||||
|
"application/rar",
|
||||||
|
"multipart/x-zip",
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"imageStorage": {
|
||||||
|
"name": "imageStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/image",
|
||||||
|
"maxFileSize": "52428800",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"invoiceStorage": {
|
||||||
|
"name": "invoiceStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/pdfs/invoice",
|
||||||
|
"maxFileSize": "52428800",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"application/octet-stream",
|
||||||
|
"application/pdf"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"claimStorage": {
|
||||||
|
"name": "claimStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/dms",
|
||||||
|
"maxFileSize": "31457280",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
|
"video/mp4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"entryStorage": {
|
||||||
|
"name": "entryStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/dms",
|
||||||
|
"maxFileSize": "31457280",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
|
"video/mp4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"supplierStorage": {
|
||||||
|
"name": "supplierStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/dms",
|
||||||
|
"maxFileSize": "31457280",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
|
"video/mp4",
|
||||||
|
"application/pdf"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"accessStorage": {
|
||||||
|
"name": "accessStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/access",
|
||||||
|
"maxFileSize": "524288000",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"application/x-7z-compressed"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
version: '3.7'
|
||||||
|
services:
|
||||||
|
back:
|
||||||
|
image: registry.verdnatura.es/salix-back:dev
|
||||||
|
volumes:
|
||||||
|
- ./test/cypress/storage:/salix/storage
|
||||||
|
- ./test/cypress/back/datasources.json:/salix/loopback/server/datasources.json
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
dns_search: .
|
||||||
|
front:
|
||||||
|
image: lilium-dev:latest
|
||||||
|
command: pnpm exec quasar dev
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
environment:
|
||||||
|
- CI
|
||||||
|
- TZ
|
||||||
|
dns_search: .
|
||||||
|
db:
|
||||||
|
image: registry.verdnatura.es/salix-db:dev
|
|
@ -41,7 +41,7 @@ describe('OrderCatalog', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cy.get(
|
cy.get(
|
||||||
'[data-cy="vn-searchbar"] > .q-field > .q-field__inner > .q-field__control'
|
'[data-cy="vn-searchbar"] > .q-field > .q-field__inner > .q-field__control',
|
||||||
).type('{enter}');
|
).type('{enter}');
|
||||||
cy.get(':nth-child(1) > [data-cy="catalogFilterCategory"]').click();
|
cy.get(':nth-child(1) > [data-cy="catalogFilterCategory"]').click();
|
||||||
cy.dataCy('catalogFilterValueDialogBtn').last().click();
|
cy.dataCy('catalogFilterValueDialogBtn').last().click();
|
||||||
|
|
|
@ -24,9 +24,9 @@ describe('ClaimAction', () => {
|
||||||
const rowData = [true];
|
const rowData = [true];
|
||||||
|
|
||||||
cy.fillRow(firstRow, rowData);
|
cy.fillRow(firstRow, rowData);
|
||||||
cy.get('[title="Change destination"]').click();
|
cy.get('[title="Change destination"]').click({ force: true });
|
||||||
cy.selectOption(destinationRow, 'Confeccion');
|
cy.selectOption(destinationRow, 'Confeccion');
|
||||||
cy.get('.q-card > .q-card__actions > .q-btn--standard').click();
|
cy.get('.q-card > .q-card__actions > .q-btn--standard').click({ force: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should regularize', () => {
|
it('should regularize', () => {
|
||||||
|
|
|
@ -8,7 +8,11 @@ describe('ClaimNotes', () => {
|
||||||
|
|
||||||
it('should add a new note', () => {
|
it('should add a new note', () => {
|
||||||
const message = 'This is a new message.';
|
const message = 'This is a new message.';
|
||||||
cy.get('.q-textarea').type(message);
|
cy.get('.q-textarea')
|
||||||
|
.should('be.visible')
|
||||||
|
.should('not.be.disabled')
|
||||||
|
.type(message);
|
||||||
|
|
||||||
cy.get(saveBtn).click();
|
cy.get(saveBtn).click();
|
||||||
cy.get(firstNote).should('have.text', message);
|
cy.get(firstNote).should('have.text', message);
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,14 +23,12 @@ describe.skip('ClaimPhoto', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open first image dialog change to second and close', () => {
|
it('should open first image dialog change to second and close', () => {
|
||||||
cy.get(
|
cy.get(':nth-last-child(1) > .q-card').click();
|
||||||
':nth-child(1) > .q-card > .q-img > .q-img__container > .q-img__image'
|
|
||||||
).click();
|
|
||||||
cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should(
|
cy.get('.q-carousel__slide > .q-img > .q-img__container > .q-img__image').should(
|
||||||
'be.visible'
|
'be.visible'
|
||||||
);
|
);
|
||||||
|
|
||||||
cy.get('.q-carousel__control > .q-btn > .q-btn__content > .q-icon').click();
|
cy.get('.q-carousel__control > button').click();
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon'
|
'.q-dialog__inner > .q-toolbar > .q-btn > .q-btn__content > .q-icon'
|
||||||
|
@ -42,7 +40,7 @@ describe.skip('ClaimPhoto', () => {
|
||||||
|
|
||||||
it('should remove third and fourth file', () => {
|
it('should remove third and fourth file', () => {
|
||||||
cy.get(
|
cy.get(
|
||||||
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
|
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon'
|
||||||
).click();
|
).click();
|
||||||
cy.get(
|
cy.get(
|
||||||
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
|
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
|
||||||
|
@ -50,7 +48,7 @@ describe.skip('ClaimPhoto', () => {
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data deleted');
|
cy.get('.q-notification__message').should('have.text', 'Data deleted');
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'.multimediaParent > :nth-child(3) > .q-btn > .q-btn__content > .q-icon'
|
'.multimediaParent > :nth-last-child(1) > .q-btn > .q-btn__content > .q-icon'
|
||||||
).click();
|
).click();
|
||||||
cy.get(
|
cy.get(
|
||||||
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
|
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block'
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('Client basic data', () => {
|
||||||
it('Should load layout', () => {
|
it('Should load layout', () => {
|
||||||
cy.get('.q-card').should('be.visible');
|
cy.get('.q-card').should('be.visible');
|
||||||
cy.dataCy('customerPhone').find('input').should('be.visible');
|
cy.dataCy('customerPhone').find('input').should('be.visible');
|
||||||
cy.dataCy('customerPhone').find('input').type('123456789');
|
cy.dataCy('customerPhone').find('input').clear().type('123456789');
|
||||||
cy.get('.q-btn-group > .q-btn--standard').click();
|
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||||
cy.intercept('PATCH', '/api/Clients/1102', (req) => {
|
cy.intercept('PATCH', '/api/Clients/1102', (req) => {
|
||||||
const { body } = req;
|
const { body } = req;
|
||||||
|
|
|
@ -20,7 +20,7 @@ describe('Entry', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Create entry, modify travel and add buys', () => {
|
it.skip('Create entry, modify travel and add buys', () => {
|
||||||
createEntryAndBuy();
|
createEntryAndBuy();
|
||||||
cy.get('a[data-cy="EntryBasicData-menu-item"]').click();
|
cy.get('a[data-cy="EntryBasicData-menu-item"]').click();
|
||||||
selectTravel('two');
|
selectTravel('two');
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe('EntryStockBought', () => {
|
||||||
cy.get('[data-col-field="reserve"][data-row-index="0"]').click();
|
cy.get('[data-col-field="reserve"][data-row-index="0"]').click();
|
||||||
cy.get('input[name="reserve"]').type('10{enter}');
|
cy.get('input[name="reserve"]').type('10{enter}');
|
||||||
cy.get('button[title="Save"]').click();
|
cy.get('button[title="Save"]').click();
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
cy.checkNotification('Data saved');
|
||||||
});
|
});
|
||||||
it('Should add a new reserved space for buyerBoss', () => {
|
it('Should add a new reserved space for buyerBoss', () => {
|
||||||
cy.addBtnClick();
|
cy.addBtnClick();
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('InvoiceOut list', () => {
|
describe('InvoiceOut list', () => {
|
||||||
const serial = 'Española rapida';
|
const serial = 'Española rapida';
|
||||||
|
const columnCheckbox =
|
||||||
|
'.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner';
|
||||||
|
const firstRowDescriptor =
|
||||||
|
'tbody > :nth-child(1) > [data-col-field="clientFk"] > .no-padding > .link';
|
||||||
|
const firstRowCheckbox =
|
||||||
|
'tbody > :nth-child(1) > :nth-child(1) > .q-checkbox > .q-checkbox__inner ';
|
||||||
|
const summaryPopupIcon = '.header > :nth-child(2) > .q-btn__content > .q-icon';
|
||||||
|
const filterBtn = '.q-scrollarea__content > .q-btn--standard > .q-btn__content';
|
||||||
|
const firstSummaryIcon =
|
||||||
|
':nth-child(1) > .text-right > [data-cy="tableAction-0"] > .q-btn__content > .q-icon';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
|
@ -9,18 +19,32 @@ describe('InvoiceOut list', () => {
|
||||||
cy.typeSearchbar('{enter}');
|
cy.typeSearchbar('{enter}');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search and filter an invoice and enter to the summary', () => {
|
it('should download one pdf from the subtoolbar button', () => {
|
||||||
cy.typeSearchbar('1{enter}');
|
cy.get(firstRowCheckbox).click();
|
||||||
cy.get('.q-virtual-scroll__content > :nth-child(2) > :nth-child(7)').click();
|
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
|
||||||
cy.get('.header > a.q-btn > .q-btn__content').click();
|
|
||||||
cy.typeSearchbar('{enter}');
|
|
||||||
cy.dataCy('InvoiceOutFilterAmountBtn').find('input').type('8.88{enter}');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should download all pdfs', () => {
|
it('should download all pdfs', () => {
|
||||||
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
|
cy.get(columnCheckbox).click();
|
||||||
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
|
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
|
||||||
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
|
});
|
||||||
|
|
||||||
|
it('should open the invoice descriptor from table icon', () => {
|
||||||
|
cy.get(firstSummaryIcon).click();
|
||||||
|
cy.get('.cardSummary').should('be.visible');
|
||||||
|
cy.get('.summaryHeader > div').should('include.text', 'A1111111');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open the client descriptor', () => {
|
||||||
|
cy.get(firstRowDescriptor).click();
|
||||||
|
cy.get(summaryPopupIcon).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should filter the results by client ID, then check the first result is correct', () => {
|
||||||
|
cy.dataCy('Customer ID_input').type('1103');
|
||||||
|
cy.get(filterBtn).click();
|
||||||
|
cy.get(firstRowDescriptor).click();
|
||||||
|
cy.get('.q-item > .q-item__label').should('include.text', '1103');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should give an error when manual invoicing a ticket that is already invoiced', () => {
|
it('should give an error when manual invoicing a ticket that is already invoiced', () => {
|
||||||
|
@ -31,11 +55,14 @@ describe('InvoiceOut list', () => {
|
||||||
cy.checkNotification('This ticket is already invoiced');
|
cy.checkNotification('This ticket is already invoiced');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a manual invoice and enter to its summary', () => {
|
it('should create a manual invoice and enter to its summary, then delete that invoice', () => {
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
cy.dataCy('InvoiceOutCreateTicketinput').type(8);
|
cy.dataCy('InvoiceOutCreateTicketinput').type(9);
|
||||||
cy.selectOption('[data-cy="InvoiceOutCreateSerialSelect"]', serial);
|
cy.selectOption('[data-cy="InvoiceOutCreateSerialSelect"]', serial);
|
||||||
cy.dataCy('FormModelPopup_save').click();
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
cy.checkNotification('Data created');
|
cy.checkNotification('Data created');
|
||||||
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
|
cy.get('.q-menu > .q-list > :nth-child(4)').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,26 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('InvoiceOut negative bases', () => {
|
describe('InvoiceOut negative bases', () => {
|
||||||
|
const getDescriptors = (opt) =>
|
||||||
|
`:nth-child(1) > [data-col-field="${opt}"] > .no-padding > .link`;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/invoice-out/negative-bases`);
|
cy.visit(`/#/invoice-out/negative-bases`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should open the posible descriptors', () => {
|
||||||
|
cy.get(getDescriptors('clientId')).click();
|
||||||
|
cy.get('.descriptor').should('be.visible');
|
||||||
|
cy.get('.q-item > .q-item__label').should('include.text', '1101');
|
||||||
|
cy.get(getDescriptors('ticketFk')).click();
|
||||||
|
cy.get('.descriptor').should('be.visible');
|
||||||
|
cy.get('.q-item > .q-item__label').should('include.text', '23');
|
||||||
|
cy.get(getDescriptors('workerName')).click();
|
||||||
|
cy.get('.descriptor').should('be.visible');
|
||||||
|
cy.get('.q-item > .q-item__label').should('include.text', '18');
|
||||||
|
});
|
||||||
|
|
||||||
it('should filter and download as CSV', () => {
|
it('should filter and download as CSV', () => {
|
||||||
cy.get('input[name="ticketFk"]').type('23{enter}');
|
cy.get('input[name="ticketFk"]').type('23{enter}');
|
||||||
cy.get('#subToolbar > .q-btn').click();
|
cy.get('#subToolbar > .q-btn').click();
|
||||||
|
|
|
@ -1,44 +1,95 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('InvoiceOut summary', () => {
|
describe.skip('InvoiceOut summary', () => {
|
||||||
const transferInvoice = {
|
const transferInvoice = {
|
||||||
Client: { val: 'employee', type: 'select' },
|
Client: { val: 'employee', type: 'select' },
|
||||||
Type: { val: 'Error in customer data', type: 'select' },
|
Type: { val: 'Error in customer data', type: 'select' },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const firstRowDescriptors = (opt) =>
|
||||||
|
`tbody > :nth-child(1) > :nth-child(${opt}) > .q-btn`;
|
||||||
|
const toCustomerSummary = '[href="#/customer/1101"]';
|
||||||
|
const toTicketList = '[href="#/ticket/list?table={%22refFk%22:%22T1111111%22}"]';
|
||||||
|
const selectMenuOption = (opt) => `.q-menu > .q-list > :nth-child(${opt})`;
|
||||||
|
const confirmSend = '.q-btn--unelevated';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/invoice-out/list`);
|
cy.visit(`/#/invoice-out/1/summary`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate the invoice PDF', () => {
|
it('open the descriptors', () => {
|
||||||
cy.typeSearchbar('T1111111{enter}');
|
cy.get(firstRowDescriptors(1)).click();
|
||||||
cy.dataCy('descriptor-more-opts').click();
|
cy.get('.descriptor').should('be.visible');
|
||||||
cy.get('.q-menu > .q-list > :nth-child(6)').click();
|
cy.get('.q-item > .q-item__label').should('include.text', '1');
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.get(firstRowDescriptors(2)).click();
|
||||||
cy.checkNotification('The invoice PDF document has been regenerated');
|
cy.get('.descriptor').should('be.visible');
|
||||||
|
cy.get('.q-item > .q-item__label').should('include.text', '1101');
|
||||||
});
|
});
|
||||||
it('should refund the invoice ', () => {
|
|
||||||
|
it('should open the client summary and the ticket list', () => {
|
||||||
|
cy.get(toCustomerSummary).click();
|
||||||
|
cy.get('.descriptor').should('be.visible');
|
||||||
|
cy.get('.q-item > .q-item__label').should('include.text', '1101');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should open the ticket list', () => {
|
||||||
|
cy.get(toTicketList).click();
|
||||||
|
cy.get('.descriptor').should('be.visible');
|
||||||
|
cy.dataCy('vnFilterPanelChip').should('include.text', 'T1111111');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should transfer the invoice ', () => {
|
||||||
cy.typeSearchbar('T1111111{enter}');
|
cy.typeSearchbar('T1111111{enter}');
|
||||||
cy.dataCy('descriptor-more-opts').click();
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
cy.get('.q-menu > .q-list > :nth-child(7)').click();
|
cy.get(selectMenuOption(1)).click();
|
||||||
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
|
cy.fillInForm(transferInvoice);
|
||||||
cy.checkNotification('The following refund ticket have been created');
|
cy.get('.q-mt-lg > .q-btn').click();
|
||||||
|
cy.checkNotification('Transferred invoice');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should send the invoice as PDF', () => {
|
||||||
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
|
cy.get(selectMenuOption(3)).click();
|
||||||
|
cy.dataCy('InvoiceOutDescriptorMenuSendPdfOption').click();
|
||||||
|
cy.get(confirmSend).click();
|
||||||
|
cy.checkNotification('Notification sent');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should send the invoice as CSV', () => {
|
||||||
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
|
cy.get(selectMenuOption(3)).click();
|
||||||
|
cy.dataCy('InvoiceOutDescriptorMenuSendCsvOption').click();
|
||||||
|
cy.get(confirmSend).click();
|
||||||
|
cy.checkNotification('Notification sent');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should delete an invoice ', () => {
|
it('should delete an invoice ', () => {
|
||||||
cy.typeSearchbar('T2222222{enter}');
|
cy.typeSearchbar('T2222222{enter}');
|
||||||
cy.dataCy('descriptor-more-opts').click();
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
cy.get('.q-menu > .q-list > :nth-child(4)').click();
|
cy.get(selectMenuOption(4)).click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
cy.checkNotification('InvoiceOut deleted');
|
cy.checkNotification('InvoiceOut deleted');
|
||||||
});
|
});
|
||||||
it('should transfer the invoice ', () => {
|
|
||||||
cy.typeSearchbar('T1111111{enter}');
|
it('should book the invoice', () => {
|
||||||
cy.dataCy('descriptor-more-opts').click();
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
cy.get('.q-menu > .q-list > :nth-child(1)').click();
|
cy.get(selectMenuOption(5)).click();
|
||||||
cy.fillInForm(transferInvoice);
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
cy.get('.q-mt-lg > .q-btn').click();
|
cy.checkNotification('InvoiceOut booked');
|
||||||
cy.checkNotification('Transferred invoice');
|
});
|
||||||
|
|
||||||
|
it('should generate the invoice PDF', () => {
|
||||||
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
|
cy.get(selectMenuOption(6)).click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.checkNotification('The invoice PDF document has been regenerated');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should refund the invoice ', () => {
|
||||||
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
|
cy.get(selectMenuOption(7)).click();
|
||||||
|
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
|
||||||
|
cy.checkNotification('The following refund ticket have been created');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,25 +4,21 @@ describe('Item tag', () => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/item/1/tags`);
|
cy.visit(`/#/item/1/tags`);
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
cy.waitForElement('[data-cy="itemTags"]');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error adding an existent tag', () => {
|
it('should throw an error adding an existent tag', () => {
|
||||||
cy.get('.q-page').should('be.visible');
|
|
||||||
cy.get('.q-page-sticky > div').click();
|
cy.get('.q-page-sticky > div').click();
|
||||||
cy.get('.q-page-sticky > div').click();
|
cy.selectOption(':nth-child(8) > .q-select', 'Tallos');
|
||||||
cy.dataCy('Tag_select').eq(7).type('Tallos');
|
|
||||||
cy.get('.q-menu .q-item').contains('Tallos').click();
|
|
||||||
cy.get(':nth-child(8) > [label="Value"]').type('1');
|
cy.get(':nth-child(8) > [label="Value"]').type('1');
|
||||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
cy.checkNotification("The tag or priority can't be repeated for an item");
|
cy.checkNotification("The tag or priority can't be repeated for an item");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a new tag', () => {
|
it('should add a new tag', () => {
|
||||||
cy.get('.q-page').should('be.visible');
|
|
||||||
cy.get('.q-page-sticky > div').click();
|
cy.get('.q-page-sticky > div').click();
|
||||||
cy.get('.q-page-sticky > div').click();
|
cy.selectOption(':nth-child(8) > .q-select', 'Ancho de la base');
|
||||||
cy.dataCy('Tag_select').eq(7).click();
|
|
||||||
cy.get('.q-menu .q-item').contains('Ancho de la base').type('{enter}');
|
|
||||||
cy.get(':nth-child(8) > [label="Value"]').type('50');
|
cy.get(':nth-child(8) > [label="Value"]').type('50');
|
||||||
cy.dataCy('crudModelDefaultSaveBtn').click();
|
cy.dataCy('crudModelDefaultSaveBtn').click();
|
||||||
cy.checkNotification('Data saved');
|
cy.checkNotification('Data saved');
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe('Recover Password', () => {
|
||||||
it('should change password to user', () => {
|
it('should change password to user', () => {
|
||||||
// Get token from mail
|
// Get token from mail
|
||||||
cy.request(
|
cy.request(
|
||||||
`http://localhost:3000/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
|
`/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
|
||||||
).then((response) => {
|
).then((response) => {
|
||||||
const regex = /access_token=([a-zA-Z0-9]+)/;
|
const regex = /access_token=([a-zA-Z0-9]+)/;
|
||||||
const [match] = response.body[0].body.match(regex);
|
const [match] = response.body[0].body.match(regex);
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe('Two Factor', () => {
|
||||||
it('should enable two factor to sysadmin', () => {
|
it('should enable two factor to sysadmin', () => {
|
||||||
cy.request(
|
cy.request(
|
||||||
'PATCH',
|
'PATCH',
|
||||||
`http://localhost:3000/api/VnUsers/${userId}/update-user?access_token=DEFAULT_TOKEN`,
|
`/api/VnUsers/${userId}/update-user?access_token=DEFAULT_TOKEN`,
|
||||||
{ twoFactor: 'email' }
|
{ twoFactor: 'email' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -41,7 +41,7 @@ describe('Two Factor', () => {
|
||||||
|
|
||||||
// Get code from mail
|
// Get code from mail
|
||||||
cy.request(
|
cy.request(
|
||||||
`http://localhost:3000/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
|
`/api/Mails?filter=%7B%22where%22%3A%20%7B%22receiver%22%3A%20%22${username}%40mydomain.com%22%7D%2C%20%22order%22%3A%20%5B%22id%20DESC%22%5D%7D&access_token=DEFAULT_TOKEN`
|
||||||
).then((response) => {
|
).then((response) => {
|
||||||
const tempDiv = document.createElement('div');
|
const tempDiv = document.createElement('div');
|
||||||
tempDiv.innerHTML = response.body[0].body;
|
tempDiv.innerHTML = response.body[0].body;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('AgencyWorkCenter', () => {
|
describe.skip('AgencyWorkCenter', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
|
|
|
@ -0,0 +1,205 @@
|
||||||
|
describe.skip('Route extended list', () => {
|
||||||
|
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
|
||||||
|
|
||||||
|
const selectors = {
|
||||||
|
worker: getSelector('workerFk'),
|
||||||
|
agency: getSelector('agencyModeFk'),
|
||||||
|
vehicle: getSelector('vehicleFk'),
|
||||||
|
date: getSelector('dated'),
|
||||||
|
description: getSelector('description'),
|
||||||
|
served: getSelector('isOk'),
|
||||||
|
lastRowSelectCheckBox: 'tbody > tr:last-child > :nth-child(1) .q-checkbox__inner',
|
||||||
|
removeBtn: '[title="Remove"]',
|
||||||
|
resetBtn: '[title="Reset"]',
|
||||||
|
confirmBtn: 'VnConfirm_confirm',
|
||||||
|
saveBtn: 'crudModelDefaultSaveBtn',
|
||||||
|
saveFormBtn: 'FormModelPopup_save',
|
||||||
|
cloneBtn: '#st-actions > .q-btn-group > :nth-child(1)',
|
||||||
|
downloadBtn: '#st-actions > .q-btn-group > :nth-child(2)',
|
||||||
|
markServedBtn: '#st-actions > .q-btn-group > :nth-child(3)',
|
||||||
|
searchbar: 'searchbar',
|
||||||
|
firstTicketsRowSelectCheckBox:
|
||||||
|
'.q-card > :nth-child(2) > .q-table__container > .q-table__middle > .q-table > tbody > :nth-child(1) > .q-table--col-auto-width > .q-checkbox > .q-checkbox__inner > .q-checkbox__bg > .q-checkbox__svg',
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkboxState = {
|
||||||
|
check: 'check',
|
||||||
|
uncheck: 'close',
|
||||||
|
};
|
||||||
|
const url = '/#/route/extended-list';
|
||||||
|
const dataCreated = 'Data created';
|
||||||
|
const dataSaved = 'Data saved';
|
||||||
|
|
||||||
|
const originalFields = [
|
||||||
|
{ selector: selectors.worker, type: 'select', value: 'logistic' },
|
||||||
|
{ selector: selectors.agency, type: 'select', value: 'Super-Man delivery' },
|
||||||
|
{ selector: selectors.vehicle, type: 'select', value: '3333-IMK' },
|
||||||
|
{ selector: selectors.date, type: 'date', value: '01/02/2024' },
|
||||||
|
{ selector: selectors.description, type: 'input', value: 'Test route' },
|
||||||
|
{ selector: selectors.served, type: 'checkbox', value: checkboxState.uncheck },
|
||||||
|
];
|
||||||
|
|
||||||
|
const updateFields = [
|
||||||
|
{ selector: selectors.worker, type: 'select', value: 'salesperson' },
|
||||||
|
{ selector: selectors.agency, type: 'select', value: 'inhouse pickup' },
|
||||||
|
{ selector: selectors.vehicle, type: 'select', value: '1111-IMK' },
|
||||||
|
{ selector: selectors.date, type: 'date', value: '01/01/2001' },
|
||||||
|
{ selector: selectors.description, type: 'input', value: 'Description updated' },
|
||||||
|
{ selector: selectors.served, type: 'checkbox', value: checkboxState.check },
|
||||||
|
];
|
||||||
|
|
||||||
|
function fillField(selector, type, value) {
|
||||||
|
switch (type) {
|
||||||
|
case 'select':
|
||||||
|
cy.get(selector).should('be.visible').click();
|
||||||
|
cy.dataCy('null_select').clear().type(value);
|
||||||
|
cy.get('.q-item').contains(value).click();
|
||||||
|
break;
|
||||||
|
case 'input':
|
||||||
|
cy.get(selector).should('be.visible').click();
|
||||||
|
cy.dataCy('null_input').clear().type(`${value}{enter}`);
|
||||||
|
break;
|
||||||
|
case 'date':
|
||||||
|
cy.get(selector).should('be.visible').click();
|
||||||
|
cy.dataCy('null_inputDate').clear().type(`${value}{enter}`);
|
||||||
|
break;
|
||||||
|
case 'checkbox':
|
||||||
|
cy.get(selector).should('be.visible').click().click();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit(url);
|
||||||
|
cy.typeSearchbar('{enter}');
|
||||||
|
});
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
cy.visit(url);
|
||||||
|
cy.typeSearchbar('{enter}');
|
||||||
|
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||||
|
|
||||||
|
cy.get(selectors.removeBtn).click();
|
||||||
|
cy.dataCy(selectors.confirmBtn).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should list routes', () => {
|
||||||
|
cy.get('.q-table')
|
||||||
|
.children()
|
||||||
|
.should('be.visible')
|
||||||
|
.should('have.length.greaterThan', 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should create new route', () => {
|
||||||
|
cy.addBtnClick();
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
Worker: { val: 'logistic', type: 'select' },
|
||||||
|
Agency: { val: 'Super-Man delivery', type: 'select' },
|
||||||
|
Vehicle: { val: '3333-IMK', type: 'select' },
|
||||||
|
Date: { val: '02-01-2024', type: 'date' },
|
||||||
|
From: { val: '01-01-2024', type: 'date' },
|
||||||
|
To: { val: '10-01-2024', type: 'date' },
|
||||||
|
'Km start': { val: 1000 },
|
||||||
|
'Km end': { val: 1200 },
|
||||||
|
Description: { val: 'Test route' },
|
||||||
|
};
|
||||||
|
|
||||||
|
cy.fillInForm(data);
|
||||||
|
|
||||||
|
cy.dataCy(selectors.saveFormBtn).click();
|
||||||
|
cy.checkNotification(dataCreated);
|
||||||
|
cy.url().should('include', '/summary');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should reset changed values when click reset button', () => {
|
||||||
|
updateFields.forEach(({ selector, type, value }) => {
|
||||||
|
fillField(selector, type, value);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('[title="Reset"]').click();
|
||||||
|
|
||||||
|
originalFields.forEach(({ selector, value }) => {
|
||||||
|
cy.validateContent(selector, value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should clone selected route', () => {
|
||||||
|
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||||
|
cy.get(selectors.cloneBtn).click();
|
||||||
|
cy.dataCy('route.Starting date_inputDate').type('10-05-2001{enter}');
|
||||||
|
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
||||||
|
cy.validateContent(selectors.date, '05/10/2001');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should download selected route', () => {
|
||||||
|
const downloadsFolder = Cypress.config('downloadsFolder');
|
||||||
|
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||||
|
cy.get(selectors.downloadBtn).click();
|
||||||
|
cy.wait(5000);
|
||||||
|
|
||||||
|
const fileName = 'download.zip';
|
||||||
|
cy.readFile(`${downloadsFolder}/${fileName}`).should('exist');
|
||||||
|
|
||||||
|
cy.task('deleteFile', `${downloadsFolder}/${fileName}`).then((deleted) => {
|
||||||
|
expect(deleted).to.be.true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should mark as served the selected route', () => {
|
||||||
|
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||||
|
cy.get(selectors.markServedBtn).click();
|
||||||
|
|
||||||
|
cy.typeSearchbar('{enter}');
|
||||||
|
cy.validateContent(selectors.served, checkboxState.check);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should delete the selected route', () => {
|
||||||
|
cy.get(selectors.lastRowSelectCheckBox).click();
|
||||||
|
|
||||||
|
cy.get(selectors.removeBtn).click();
|
||||||
|
cy.dataCy(selectors.confirmBtn).click();
|
||||||
|
|
||||||
|
cy.checkNotification(dataSaved);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should save changes in route', () => {
|
||||||
|
updateFields.forEach(({ selector, type, value }) => {
|
||||||
|
fillField(selector, type, value);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.dataCy(selectors.saveBtn).should('not.be.disabled').click();
|
||||||
|
cy.checkNotification(dataSaved);
|
||||||
|
|
||||||
|
cy.typeSearchbar('{enter}');
|
||||||
|
|
||||||
|
updateFields.forEach(({ selector, value }) => {
|
||||||
|
cy.validateContent(selector, value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should add ticket to route', () => {
|
||||||
|
cy.dataCy('tableAction-0').last().click();
|
||||||
|
cy.get(selectors.firstTicketsRowSelectCheckBox).click();
|
||||||
|
cy.get('.q-card__actions > .q-btn--standard > .q-btn__content').click();
|
||||||
|
cy.checkNotification(dataSaved);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should open summary pop-up when click summuary icon', () => {
|
||||||
|
cy.dataCy('tableAction-1').last().click();
|
||||||
|
cy.get('.summaryHeader > :nth-child(2').should('contain', updateFields[4].value);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to the summary from the route summary pop-up', () => {
|
||||||
|
cy.dataCy('tableAction-1').last().click();
|
||||||
|
cy.get('.header > .q-icon').should('be.visible').click();
|
||||||
|
cy.url().should('include', '/summary');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to the summary when click go to summary icon', () => {
|
||||||
|
cy.dataCy('tableAction-2').last().click();
|
||||||
|
cy.url().should('include', '/summary');
|
||||||
|
});
|
||||||
|
});
|
|
@ -7,7 +7,7 @@ describe('Route', () => {
|
||||||
|
|
||||||
it('Route list create route', () => {
|
it('Route list create route', () => {
|
||||||
cy.addBtnClick();
|
cy.addBtnClick();
|
||||||
cy.get('input[name="description"]').type('routeTestOne{enter}');
|
cy.get('.q-card input[name="description"]').type('routeTestOne{enter}');
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
cy.get('.q-notification__message').should('have.text', 'Data created');
|
||||||
cy.url().should('include', '/summary');
|
cy.url().should('include', '/summary');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
describe('TicketSale', () => {
|
describe('TicketSale', () => {
|
||||||
|
describe.skip('Free ticket #31', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
|
@ -120,3 +121,88 @@ describe('TicketSale', () => {
|
||||||
cy.url().should('match', /\/ticket\/31\/log/);
|
cy.url().should('match', /\/ticket\/31\/log/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe.skip('Ticket prepared #23', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/23/sale');
|
||||||
|
});
|
||||||
|
|
||||||
|
const firstRow = 'tbody > :nth-child(1)';
|
||||||
|
|
||||||
|
const selectFirstRow = () => {
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.get(firstRow).find('.q-checkbox__inner').click();
|
||||||
|
};
|
||||||
|
|
||||||
|
it('update price', () => {
|
||||||
|
const price = Number((Math.random() * 99 + 1).toFixed(2));
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.get(':nth-child(10) > .q-btn').click();
|
||||||
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
||||||
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||||
|
cy.waitForElement('[data-cy="Price_input"]');
|
||||||
|
cy.dataCy('Price_input').clear();
|
||||||
|
cy.dataCy('Price_input').type(price);
|
||||||
|
cy.dataCy('saveManaBtn').click();
|
||||||
|
handleVnConfirm();
|
||||||
|
|
||||||
|
cy.get(':nth-child(10) > .q-btn > .q-btn__content').should(
|
||||||
|
'have.text',
|
||||||
|
`€${price}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('update dicount', () => {
|
||||||
|
const discount = Math.floor(Math.random() * 100) + 1;
|
||||||
|
selectFirstRow();
|
||||||
|
cy.get(':nth-child(11) > .q-btn').click();
|
||||||
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
||||||
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||||
|
cy.waitForElement('[data-cy="Disc_input"]');
|
||||||
|
cy.dataCy('Disc_input').clear();
|
||||||
|
cy.dataCy('Disc_input').type(discount);
|
||||||
|
cy.dataCy('saveManaBtn').click();
|
||||||
|
handleVnConfirm();
|
||||||
|
|
||||||
|
cy.get(':nth-child(11) > .q-btn > .q-btn__content').should(
|
||||||
|
'have.text',
|
||||||
|
`${discount}.00%`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('change concept', () => {
|
||||||
|
const quantity = Math.floor(Math.random() * 100) + 1;
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.get(':nth-child(8) > .row').click();
|
||||||
|
cy.get(
|
||||||
|
'.q-menu > [data-v-ca3f07a4=""] > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > [data-cy="undefined_input"]',
|
||||||
|
)
|
||||||
|
.type(quantity)
|
||||||
|
.type('{enter}');
|
||||||
|
handleVnConfirm();
|
||||||
|
|
||||||
|
cy.get(':nth-child(8) >.row').should('contain.text', `${quantity}`);
|
||||||
|
});
|
||||||
|
it('changequantity ', () => {
|
||||||
|
const quantity = Math.floor(Math.random() * 100) + 1;
|
||||||
|
cy.waitForElement(firstRow);
|
||||||
|
cy.dataCy('ticketSaleQuantityInput').clear();
|
||||||
|
cy.dataCy('ticketSaleQuantityInput').type(quantity).trigger('tab');
|
||||||
|
cy.get('.q-page > :nth-child(6)').click();
|
||||||
|
|
||||||
|
handleVnConfirm();
|
||||||
|
|
||||||
|
cy.get('[data-cy="ticketSaleQuantityInput"]')
|
||||||
|
.find('[data-cy="undefined_input"]')
|
||||||
|
.should('have.value', `${quantity}`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleVnConfirm() {
|
||||||
|
cy.get('[data-cy="VnConfirm_confirm"] > .q-btn__content > .block').click();
|
||||||
|
cy.waitForElement('.q-notification__message');
|
||||||
|
|
||||||
|
cy.get('.q-notification__message').should('be.visible');
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ describe('VnLocation', () => {
|
||||||
cy.selectOption(countrySelector, country);
|
cy.selectOption(countrySelector, country);
|
||||||
cy.dataCy('locationProvince').type(`${province}{enter}`);
|
cy.dataCy('locationProvince').type(`${province}{enter}`);
|
||||||
cy.get(
|
cy.get(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(3) `,
|
||||||
).click();
|
).click();
|
||||||
cy.dataCy('locationProvince').should('have.value', province);
|
cy.dataCy('locationProvince').should('have.value', province);
|
||||||
});
|
});
|
||||||
|
@ -87,7 +87,7 @@ describe('VnLocation', () => {
|
||||||
.get(':nth-child(1)')
|
.get(':nth-child(1)')
|
||||||
.should('have.length.at.least', 2);
|
.should('have.length.at.least', 2);
|
||||||
cy.get(
|
cy.get(
|
||||||
firstOption.concat(' > .q-item__section > .q-item__label--caption')
|
firstOption.concat(' > .q-item__section > .q-item__label--caption'),
|
||||||
).should('have.text', postCodeLabel);
|
).should('have.text', postCodeLabel);
|
||||||
cy.get(firstOption).click();
|
cy.get(firstOption).click();
|
||||||
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click();
|
cy.get('.q-btn-group > .q-btn--standard > .q-btn__content > .q-icon').click();
|
||||||
|
@ -103,7 +103,7 @@ describe('VnLocation', () => {
|
||||||
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
cy.get('.q-card > h1').should('have.text', 'New postcode');
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
||||||
province
|
province,
|
||||||
);
|
);
|
||||||
cy.get(dialogInputs).eq(0).clear();
|
cy.get(dialogInputs).eq(0).clear();
|
||||||
cy.get(dialogInputs).eq(0).type(postCode);
|
cy.get(dialogInputs).eq(0).type(postCode);
|
||||||
|
@ -156,7 +156,7 @@ describe('VnLocation', () => {
|
||||||
cy.get(createLocationButton).click();
|
cy.get(createLocationButton).click();
|
||||||
cy.selectOption(
|
cy.selectOption(
|
||||||
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
`${createForm.prefix} > :nth-child(5) > :nth-child(3) `,
|
||||||
'España'
|
'España',
|
||||||
);
|
);
|
||||||
cy.dataCy('Province_icon').click();
|
cy.dataCy('Province_icon').click();
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('WagonTypeCreate', () => {
|
||||||
|
|
||||||
it('should create a new wagon type and then delete it', () => {
|
it('should create a new wagon type and then delete it', () => {
|
||||||
cy.get('.q-page-sticky > div > .q-btn').click();
|
cy.get('.q-page-sticky > div > .q-btn').click();
|
||||||
cy.get('input').first().type('Example for testing');
|
cy.dataCy('Name_input').type('Example for testing');
|
||||||
cy.get('[data-cy="FormModelPopup_save"]').click();
|
cy.get('[data-cy="FormModelPopup_save"]').click();
|
||||||
cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
|
cy.get('[title="Remove"] > .q-btn__content > .q-icon').first().click();
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,9 +2,24 @@ describe('WorkerCreate', () => {
|
||||||
const externalRadio = '.q-radio:nth-child(2)';
|
const externalRadio = '.q-radio:nth-child(2)';
|
||||||
const developerBossId = 120;
|
const developerBossId = 120;
|
||||||
const payMethodCross =
|
const payMethodCross =
|
||||||
'.grid-create .full-width > :nth-child(9) .q-select .q-field__append:not(.q-anchor--skip)';
|
':nth-child(9) > .q-select > .q-field__inner > .q-field__control > :nth-child(2)';
|
||||||
const saveBtn = '.q-mt-lg > .q-btn--standard';
|
const saveBtn = '.q-mt-lg > .q-btn--standard';
|
||||||
|
|
||||||
|
const internalWithOutPay = {
|
||||||
|
Fi: { val: '78457139E' },
|
||||||
|
'Web user': { val: 'manolo' },
|
||||||
|
Name: { val: 'Manolo' },
|
||||||
|
'Last name': { val: 'Hurtado' },
|
||||||
|
'Personal email': { val: 'manolo@mydomain.com' },
|
||||||
|
Company: { val: 'VNL', type: 'select' },
|
||||||
|
Street: { val: 'S/ DEFAULTWORKERSTREET' },
|
||||||
|
Location: { val: 1, type: 'select' },
|
||||||
|
Phone: { val: '123456789' },
|
||||||
|
'Worker code': { val: 'DWW' },
|
||||||
|
Boss: { val: developerBossId, type: 'select' },
|
||||||
|
Birth: { val: '11-12-2022', type: 'date' },
|
||||||
|
};
|
||||||
|
|
||||||
const internal = {
|
const internal = {
|
||||||
Fi: { val: '78457139E' },
|
Fi: { val: '78457139E' },
|
||||||
'Web user': { val: 'manolo' },
|
'Web user': { val: 'manolo' },
|
||||||
|
@ -14,6 +29,7 @@ describe('WorkerCreate', () => {
|
||||||
Company: { val: 'VNL', type: 'select' },
|
Company: { val: 'VNL', type: 'select' },
|
||||||
Street: { val: 'S/ DEFAULTWORKERSTREET' },
|
Street: { val: 'S/ DEFAULTWORKERSTREET' },
|
||||||
Location: { val: 1, type: 'select' },
|
Location: { val: 1, type: 'select' },
|
||||||
|
'Pay method': { val: 1, type: 'select' },
|
||||||
Phone: { val: '123456789' },
|
Phone: { val: '123456789' },
|
||||||
'Worker code': { val: 'DWW' },
|
'Worker code': { val: 'DWW' },
|
||||||
Boss: { val: developerBossId, type: 'select' },
|
Boss: { val: developerBossId, type: 'select' },
|
||||||
|
@ -37,17 +53,14 @@ describe('WorkerCreate', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error if a pay method has not been selected', () => {
|
it('should throw an error if a pay method has not been selected', () => {
|
||||||
cy.fillInForm(internal);
|
cy.fillInForm(internalWithOutPay);
|
||||||
cy.get(payMethodCross).click();
|
cy.get(payMethodCross).click();
|
||||||
cy.get(saveBtn).click();
|
cy.get(saveBtn).click();
|
||||||
cy.checkNotification('Payment method is required');
|
cy.checkNotification('Payment method is required');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create an internal', () => {
|
it('should create an internal', () => {
|
||||||
cy.fillInForm({
|
cy.fillInForm(internal);
|
||||||
...internal,
|
|
||||||
'Pay method': { val: 'PayMethod one', type: 'select' },
|
|
||||||
});
|
|
||||||
cy.get(saveBtn).click();
|
cy.get(saveBtn).click();
|
||||||
cy.checkNotification('Data created');
|
cy.checkNotification('Data created');
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,11 +18,11 @@ describe('WorkerNotificationsManager', () => {
|
||||||
cy.visit(`/#/worker/${salesPersonId}/notifications`);
|
cy.visit(`/#/worker/${salesPersonId}/notifications`);
|
||||||
cy.get(firstAvailableNotification).click();
|
cy.get(firstAvailableNotification).click();
|
||||||
cy.checkNotification(
|
cy.checkNotification(
|
||||||
'The notification subscription of this worker cant be modified'
|
'The notification subscription of this worker cant be modified',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should active a notification that is yours', () => {
|
it.skip('should active a notification that is yours', () => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/worker/${developerId}/notifications`);
|
cy.visit(`/#/worker/${developerId}/notifications`);
|
||||||
cy.waitForElement(activeList);
|
cy.waitForElement(activeList);
|
||||||
|
|
|
@ -8,7 +8,8 @@ describe('WorkerPit', () => {
|
||||||
const spousePensionInput = '[data-cy="Spouse Pension_input"]';
|
const spousePensionInput = '[data-cy="Spouse Pension_input"]';
|
||||||
const spousePension = '120';
|
const spousePension = '120';
|
||||||
const addRelative = '[data-cy="addRelative"]';
|
const addRelative = '[data-cy="addRelative"]';
|
||||||
const isDescendantSelect = '[data-cy="Descendant/Ascendant_select"]';
|
const isDescendantSelect = '[data-cy="Descendant/Ascendant"]';
|
||||||
|
const Descendant = 'Descendiente';
|
||||||
const birthedInput = '[data-cy="Birth Year_input"]';
|
const birthedInput = '[data-cy="Birth Year_input"]';
|
||||||
const birthed = '2002';
|
const birthed = '2002';
|
||||||
const adoptionYearInput = '[data-cy="Adoption Year_input"]';
|
const adoptionYearInput = '[data-cy="Adoption Year_input"]';
|
||||||
|
@ -28,11 +29,8 @@ describe('WorkerPit', () => {
|
||||||
cy.get(spouseNifInput).type(spouseNif);
|
cy.get(spouseNifInput).type(spouseNif);
|
||||||
cy.get(spousePensionInput).type(spousePension);
|
cy.get(spousePensionInput).type(spousePension);
|
||||||
cy.get(savePIT).click();
|
cy.get(savePIT).click();
|
||||||
});
|
|
||||||
|
|
||||||
it('complete relative', () => {
|
|
||||||
cy.get(addRelative).click();
|
cy.get(addRelative).click();
|
||||||
cy.get(isDescendantSelect).type('{downArrow}{downArrow}{enter}');
|
cy.get(isDescendantSelect).type(Descendant);
|
||||||
cy.get(birthedInput).type(birthed);
|
cy.get(birthedInput).type(birthed);
|
||||||
cy.get(adoptionYearInput).type(adoptionYear);
|
cy.get(adoptionYearInput).type(adoptionYear);
|
||||||
cy.get(saveRelative).click();
|
cy.get(saveRelative).click();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
describe('ZoneList', () => {
|
describe('ZoneList', () => {
|
||||||
|
const agency = 'inhouse pickup';
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1280, 720);
|
cy.viewport(1280, 720);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
|
@ -6,11 +7,15 @@ describe('ZoneList', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should filter by agency', () => {
|
it('should filter by agency', () => {
|
||||||
cy.get('input[aria-label="Agency"]').type('{downArrow}{enter}');
|
cy.dataCy('zoneFilterPanelNameInput').type('{downArrow}{enter}');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the zone summary', () => {
|
it('should open the zone summary', () => {
|
||||||
cy.get('input[aria-label="Name"]').type('zone refund');
|
cy.dataCy('zoneFilterPanelAgencySelect').type(agency);
|
||||||
cy.get('.q-scrollarea__content > .q-btn--standard > .q-btn__content').click();
|
cy.get('.q-menu .q-item').contains(agency).click();
|
||||||
|
cy.get(':nth-child(1) > [data-col-field="agencyModeFk"]').should(
|
||||||
|
'include.text',
|
||||||
|
agency,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,7 @@ describe('ZoneWarehouse', () => {
|
||||||
Warehouse: { val: 'Warehouse One', type: 'select' },
|
Warehouse: { val: 'Warehouse One', type: 'select' },
|
||||||
};
|
};
|
||||||
|
|
||||||
const dataError = 'ER_DUP_ENTRY: Duplicate entry';
|
const dataError = 'The introduced warehouse already exists';
|
||||||
const saveBtn = '.q-btn--standard > .q-btn__content > .block';
|
const saveBtn = '.q-btn--standard > .q-btn__content > .block';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
// DO NOT REMOVE
|
// DO NOT REMOVE
|
||||||
// Imports Quasar Cypress AE predefined commands
|
// Imports Quasar Cypress AE predefined commands
|
||||||
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
|
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
|
||||||
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, require('./waitUntil'));
|
import waitUntil from './waitUntil';
|
||||||
|
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
|
||||||
|
|
||||||
Cypress.Commands.add('resetDB', () => {
|
Cypress.Commands.add('resetDB', () => {
|
||||||
cy.exec('pnpm run resetDatabase');
|
cy.exec('pnpm run resetDatabase');
|
||||||
});
|
});
|
||||||
|
@ -57,7 +59,7 @@ Cypress.Commands.add('login', (user) => {
|
||||||
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
|
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
|
||||||
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
|
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
|
||||||
});
|
});
|
||||||
Cypress.Commands.add('waitForElement', (element, timeout = 5000) => {
|
Cypress.Commands.add('waitForElement', (element, timeout = 10000) => {
|
||||||
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
|
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -321,19 +323,14 @@ Cypress.Commands.add('clickButtonDescriptor', (id) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('openUserPanel', () => {
|
Cypress.Commands.add('openUserPanel', () => {
|
||||||
cy.get(
|
cy.dataCy('userPanel_btn').click();
|
||||||
'.column > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image',
|
|
||||||
).click();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('checkNotification', (text) => {
|
Cypress.Commands.add('checkNotification', (text) => {
|
||||||
cy.get('.q-notification')
|
cy.get('.q-notification', { timeout: 10000 })
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.last()
|
.filter((_, el) => Cypress.$(el).text().includes(text))
|
||||||
.then(($lastNotification) => {
|
.should('have.length.greaterThan', 0);
|
||||||
if (!Cypress.$($lastNotification).text().includes(text))
|
|
||||||
throw new Error(`Notification not found: "${text}"`);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('openActions', (row) => {
|
Cypress.Commands.add('openActions', (row) => {
|
||||||
|
|
|
@ -27,7 +27,17 @@ function randomNumber(options = { length: 10 }) {
|
||||||
|
|
||||||
function randomizeValue(characterSet, options) {
|
function randomizeValue(characterSet, options) {
|
||||||
return Array.from({ length: options.length }, () =>
|
return Array.from({ length: options.length }, () =>
|
||||||
characterSet.charAt(Math.floor(Math.random() * characterSet.length))
|
characterSet.charAt(Math.floor(Math.random() * characterSet.length)),
|
||||||
).join('');
|
).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const style = document.createElement('style');
|
||||||
|
style.innerHTML = `
|
||||||
|
* {
|
||||||
|
transition: none !important;
|
||||||
|
animation: none !important;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
document.head.appendChild(style);
|
||||||
|
|
||||||
export { randomString, randomNumber, randomizeValue };
|
export { randomString, randomNumber, randomizeValue };
|
||||||
|
|
|
@ -5,9 +5,21 @@ import jsconfigPaths from 'vite-jsconfig-paths';
|
||||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
let reporters,
|
||||||
|
outputFile;
|
||||||
|
|
||||||
|
if (process.env.CI) {
|
||||||
|
reporters = ['junit', 'default'];
|
||||||
|
outputFile = {junit: './junit/vitest.xml'};
|
||||||
|
} else {
|
||||||
|
reporters = 'default';
|
||||||
|
}
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
|
reporters,
|
||||||
|
outputFile,
|
||||||
environment: 'happy-dom',
|
environment: 'happy-dom',
|
||||||
setupFiles: 'test/vitest/setup-file.js',
|
setupFiles: 'test/vitest/setup-file.js',
|
||||||
include: [
|
include: [
|
||||||
|
|
Loading…
Reference in New Issue