Merge branch '8441-createVehicleInvoiceInSection' of https://gitea.verdnatura.es/verdnatura/salix-front into 8441-createVehicleInvoiceInSection
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
3029265402
|
@ -18,6 +18,8 @@
|
||||||
"test:e2e:summary": "bash ./test/cypress/summary.sh",
|
"test:e2e:summary": "bash ./test/cypress/summary.sh",
|
||||||
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
||||||
"test:front": "vitest",
|
"test:front": "vitest",
|
||||||
|
"test:ui": "vitest --ui",
|
||||||
|
"test:coverage": "vitest run --coverage",
|
||||||
"test:front:ci": "vitest run",
|
"test:front:ci": "vitest run",
|
||||||
"commitlint": "commitlint --edit",
|
"commitlint": "commitlint --edit",
|
||||||
"prepare": "npx husky install",
|
"prepare": "npx husky install",
|
||||||
|
@ -27,6 +29,8 @@
|
||||||
"docs:preview": "vitepress preview docs"
|
"docs:preview": "vitepress preview docs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@eslint/eslintrc": "^3.2.0",
|
||||||
|
"@eslint/js": "^9.20.0",
|
||||||
"@quasar/cli": "^2.4.1",
|
"@quasar/cli": "^2.4.1",
|
||||||
"@quasar/extras": "^1.16.16",
|
"@quasar/extras": "^1.16.16",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
|
@ -40,8 +44,6 @@
|
||||||
"validator": "^13.9.0",
|
"validator": "^13.9.0",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
"vue-i18n": "^9.4.0",
|
"vue-i18n": "^9.4.0",
|
||||||
"@eslint/eslintrc": "^3.2.0",
|
|
||||||
"@eslint/js": "^9.20.0",
|
|
||||||
"vue-router": "^4.2.5"
|
"vue-router": "^4.2.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -54,6 +56,7 @@
|
||||||
"@quasar/app-vite": "^2.0.8",
|
"@quasar/app-vite": "^2.0.8",
|
||||||
"@quasar/quasar-app-extension-qcalendar": "^4.0.2",
|
"@quasar/quasar-app-extension-qcalendar": "^4.0.2",
|
||||||
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
||||||
|
"@vitest/ui": "3.1.1",
|
||||||
"@vue/compiler-sfc": "^3.5.13",
|
"@vue/compiler-sfc": "^3.5.13",
|
||||||
"@vue/test-utils": "^2.4.4",
|
"@vue/test-utils": "^2.4.4",
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
|
|
|
@ -75,7 +75,10 @@ devDependencies:
|
||||||
version: 4.1.2
|
version: 4.1.2
|
||||||
'@quasar/quasar-app-extension-testing-unit-vitest':
|
'@quasar/quasar-app-extension-testing-unit-vitest':
|
||||||
specifier: ^0.4.0
|
specifier: ^0.4.0
|
||||||
version: 0.4.0(@vue/test-utils@2.4.6)(quasar@2.18.1)(typescript@5.8.3)(vite@6.2.5)(vitest@3.1.1)(vue@3.5.13)
|
version: 0.4.0(@vitest/ui@3.1.1)(@vue/test-utils@2.4.6)(quasar@2.18.1)(typescript@5.8.3)(vite@6.2.5)(vitest@3.1.1)(vue@3.5.13)
|
||||||
|
'@vitest/ui':
|
||||||
|
specifier: 3.1.1
|
||||||
|
version: 3.1.1(vitest@3.1.1)
|
||||||
'@vue/compiler-sfc':
|
'@vue/compiler-sfc':
|
||||||
specifier: ^3.5.13
|
specifier: ^3.5.13
|
||||||
version: 3.5.13
|
version: 3.5.13
|
||||||
|
@ -132,7 +135,7 @@ devDependencies:
|
||||||
version: 1.86.3
|
version: 1.86.3
|
||||||
vitest:
|
vitest:
|
||||||
specifier: ^3.0.3
|
specifier: ^3.0.3
|
||||||
version: 3.1.1(@types/node@22.14.0)(sass@1.86.3)
|
version: 3.1.1(@types/node@22.14.0)(@vitest/ui@3.1.1)(sass@1.86.3)
|
||||||
xunit-viewer:
|
xunit-viewer:
|
||||||
specifier: ^10.6.1
|
specifier: ^10.6.1
|
||||||
version: 10.6.1(@babel/runtime@7.27.0)(@codemirror/autocomplete@6.18.6)(@codemirror/language@6.11.0)(@codemirror/lint@6.8.5)(@codemirror/search@6.5.10)(@codemirror/state@6.5.2)(@codemirror/theme-one-dark@6.1.2)(@codemirror/view@6.36.5)(codemirror@6.0.1)(react-dom@19.1.0)(react@19.1.0)
|
version: 10.6.1(@babel/runtime@7.27.0)(@codemirror/autocomplete@6.18.6)(@codemirror/language@6.11.0)(@codemirror/lint@6.8.5)(@codemirror/search@6.5.10)(@codemirror/state@6.5.2)(@codemirror/theme-one-dark@6.1.2)(@codemirror/view@6.36.5)(codemirror@6.0.1)(react-dom@19.1.0)(react@19.1.0)
|
||||||
|
@ -1139,6 +1142,10 @@ packages:
|
||||||
config-chain: 1.1.13
|
config-chain: 1.1.13
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@polka/url@1.0.0-next.28:
|
||||||
|
resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/@quasar/app-vite@2.2.0(@types/node@22.14.0)(eslint@9.24.0)(pinia@2.3.1)(quasar@2.18.1)(sass@1.86.3)(typescript@5.8.3)(vue-router@4.5.0)(vue@3.5.13):
|
/@quasar/app-vite@2.2.0(@types/node@22.14.0)(eslint@9.24.0)(pinia@2.3.1)(quasar@2.18.1)(sass@1.86.3)(typescript@5.8.3)(vue-router@4.5.0)(vue@3.5.13):
|
||||||
resolution: {integrity: sha512-MvCfJrCbxUYvoGaK5jPq0h0hjO8mbxYOWngf+dIKrxhwb+1h5ERh6aVYEUuCtMIwTMEVfPkCez4DIfZIoReuDw==}
|
resolution: {integrity: sha512-MvCfJrCbxUYvoGaK5jPq0h0hjO8mbxYOWngf+dIKrxhwb+1h5ERh6aVYEUuCtMIwTMEVfPkCez4DIfZIoReuDw==}
|
||||||
engines: {node: ^30 || ^28 || ^26 || ^24 || ^22 || ^20 || ^18, npm: '>= 6.14.12', yarn: '>= 1.17.3'}
|
engines: {node: ^30 || ^28 || ^26 || ^24 || ^22 || ^20 || ^18, npm: '>= 6.14.12', yarn: '>= 1.17.3'}
|
||||||
|
@ -1262,7 +1269,7 @@ packages:
|
||||||
'@quasar/quasar-ui-qcalendar': 4.1.2
|
'@quasar/quasar-ui-qcalendar': 4.1.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@quasar/quasar-app-extension-testing-unit-vitest@0.4.0(@vue/test-utils@2.4.6)(quasar@2.18.1)(typescript@5.8.3)(vite@6.2.5)(vitest@3.1.1)(vue@3.5.13):
|
/@quasar/quasar-app-extension-testing-unit-vitest@0.4.0(@vitest/ui@3.1.1)(@vue/test-utils@2.4.6)(quasar@2.18.1)(typescript@5.8.3)(vite@6.2.5)(vitest@3.1.1)(vue@3.5.13):
|
||||||
resolution: {integrity: sha512-eyzdUdmZiCueNS+5nedjMmzdbpCetSrtdGIwW6KplW1dTzRbLiNvYUjpBOxQGmJCgEhWy9zuswJ7MZ/bTql24Q==}
|
resolution: {integrity: sha512-eyzdUdmZiCueNS+5nedjMmzdbpCetSrtdGIwW6KplW1dTzRbLiNvYUjpBOxQGmJCgEhWy9zuswJ7MZ/bTql24Q==}
|
||||||
engines: {node: '>= 12.22.1', npm: '>= 6.14.12', yarn: '>= 1.17.3'}
|
engines: {node: '>= 12.22.1', npm: '>= 6.14.12', yarn: '>= 1.17.3'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
@ -1275,13 +1282,14 @@ packages:
|
||||||
'@vitest/ui':
|
'@vitest/ui':
|
||||||
optional: true
|
optional: true
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@vitest/ui': 3.1.1(vitest@3.1.1)
|
||||||
'@vue/test-utils': 2.4.6
|
'@vue/test-utils': 2.4.6
|
||||||
happy-dom: 11.2.0
|
happy-dom: 11.2.0
|
||||||
lodash-es: 4.17.21
|
lodash-es: 4.17.21
|
||||||
quasar: 2.18.1
|
quasar: 2.18.1
|
||||||
vite-jsconfig-paths: 2.0.1(vite@6.2.5)
|
vite-jsconfig-paths: 2.0.1(vite@6.2.5)
|
||||||
vite-tsconfig-paths: 4.3.2(typescript@5.8.3)(vite@6.2.5)
|
vite-tsconfig-paths: 4.3.2(typescript@5.8.3)(vite@6.2.5)
|
||||||
vitest: 3.1.1(@types/node@22.14.0)(sass@1.86.3)
|
vitest: 3.1.1(@types/node@22.14.0)(@vitest/ui@3.1.1)(sass@1.86.3)
|
||||||
vue: 3.5.13(typescript@5.8.3)
|
vue: 3.5.13(typescript@5.8.3)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
@ -1813,6 +1821,21 @@ packages:
|
||||||
tinyspy: 3.0.2
|
tinyspy: 3.0.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@vitest/ui@3.1.1(vitest@3.1.1):
|
||||||
|
resolution: {integrity: sha512-2HpiRIYg3dlvAJBV9RtsVswFgUSJK4Sv7QhpxoP0eBGkYwzGIKP34PjaV00AULQi9Ovl6LGyZfsetxDWY5BQdQ==}
|
||||||
|
peerDependencies:
|
||||||
|
vitest: 3.1.1
|
||||||
|
dependencies:
|
||||||
|
'@vitest/utils': 3.1.1
|
||||||
|
fflate: 0.8.2
|
||||||
|
flatted: 3.3.3
|
||||||
|
pathe: 2.0.3
|
||||||
|
sirv: 3.0.1
|
||||||
|
tinyglobby: 0.2.12
|
||||||
|
tinyrainbow: 2.0.0
|
||||||
|
vitest: 3.1.1(@types/node@22.14.0)(@vitest/ui@3.1.1)(sass@1.86.3)
|
||||||
|
dev: true
|
||||||
|
|
||||||
/@vitest/utils@3.1.1:
|
/@vitest/utils@3.1.1:
|
||||||
resolution: {integrity: sha512-1XIjflyaU2k3HMArJ50bwSh3wKWPD6Q47wz/NUSmRV0zNywPc4w79ARjg/i/aNINHwA+mIALhUVqD9/aUvZNgg==}
|
resolution: {integrity: sha512-1XIjflyaU2k3HMArJ50bwSh3wKWPD6Q47wz/NUSmRV0zNywPc4w79ARjg/i/aNINHwA+mIALhUVqD9/aUvZNgg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -4021,6 +4044,10 @@ packages:
|
||||||
picomatch: 4.0.2
|
picomatch: 4.0.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/fflate@0.8.2:
|
||||||
|
resolution: {integrity: sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/figures@3.2.0:
|
/figures@3.2.0:
|
||||||
resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==}
|
resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -5588,6 +5615,11 @@ packages:
|
||||||
resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
|
resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/mrmime@2.0.1:
|
||||||
|
resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==}
|
||||||
|
engines: {node: '>=10'}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/ms@2.0.0:
|
/ms@2.0.0:
|
||||||
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
|
resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==}
|
||||||
|
|
||||||
|
@ -6964,6 +6996,15 @@ packages:
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/sirv@3.0.1:
|
||||||
|
resolution: {integrity: sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A==}
|
||||||
|
engines: {node: '>=18'}
|
||||||
|
dependencies:
|
||||||
|
'@polka/url': 1.0.0-next.28
|
||||||
|
mrmime: 2.0.1
|
||||||
|
totalist: 3.0.1
|
||||||
|
dev: true
|
||||||
|
|
||||||
/slash@3.0.0:
|
/slash@3.0.0:
|
||||||
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
|
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -7364,6 +7405,11 @@ packages:
|
||||||
resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
|
resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==}
|
||||||
engines: {node: '>=0.6'}
|
engines: {node: '>=0.6'}
|
||||||
|
|
||||||
|
/totalist@3.0.1:
|
||||||
|
resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==}
|
||||||
|
engines: {node: '>=6'}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/tough-cookie@5.1.2:
|
/tough-cookie@5.1.2:
|
||||||
resolution: {integrity: sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==}
|
resolution: {integrity: sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
|
@ -7772,7 +7818,7 @@ packages:
|
||||||
fsevents: 2.3.3
|
fsevents: 2.3.3
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/vitest@3.1.1(@types/node@22.14.0)(sass@1.86.3):
|
/vitest@3.1.1(@types/node@22.14.0)(@vitest/ui@3.1.1)(sass@1.86.3):
|
||||||
resolution: {integrity: sha512-kiZc/IYmKICeBAZr9DQ5rT7/6bD9G7uqQEki4fxazi1jdVl2mWGzedtBs5s6llz59yQhVb7FFY2MbHzHCnT79Q==}
|
resolution: {integrity: sha512-kiZc/IYmKICeBAZr9DQ5rT7/6bD9G7uqQEki4fxazi1jdVl2mWGzedtBs5s6llz59yQhVb7FFY2MbHzHCnT79Q==}
|
||||||
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
|
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
@ -7807,6 +7853,7 @@ packages:
|
||||||
'@vitest/runner': 3.1.1
|
'@vitest/runner': 3.1.1
|
||||||
'@vitest/snapshot': 3.1.1
|
'@vitest/snapshot': 3.1.1
|
||||||
'@vitest/spy': 3.1.1
|
'@vitest/spy': 3.1.1
|
||||||
|
'@vitest/ui': 3.1.1(vitest@3.1.1)
|
||||||
'@vitest/utils': 3.1.1
|
'@vitest/utils': 3.1.1
|
||||||
chai: 5.2.0
|
chai: 5.2.0
|
||||||
debug: 4.4.0(supports-color@8.1.1)
|
debug: 4.4.0(supports-color@8.1.1)
|
||||||
|
|
|
@ -332,6 +332,7 @@ watch(formUrl, async () => {
|
||||||
:disable="!selected?.length"
|
:disable="!selected?.length"
|
||||||
:title="t('globals.remove')"
|
:title="t('globals.remove')"
|
||||||
v-if="$props.defaultRemove"
|
v-if="$props.defaultRemove"
|
||||||
|
data-cy="crudModelDefaultRemoveBtn"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="tMobile('globals.reset')"
|
:label="tMobile('globals.reset')"
|
||||||
|
|
|
@ -13,13 +13,12 @@ import VnConfirm from './ui/VnConfirm.vue';
|
||||||
import { tMobile } from 'src/composables/tMobile';
|
import { tMobile } from 'src/composables/tMobile';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { getDifferences, getUpdatedValues } from 'src/filters';
|
import { getDifferences, getUpdatedValues } from 'src/filters';
|
||||||
|
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { validate } = useValidator();
|
const { validate, validations } = useValidator();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const myForm = ref(null);
|
const myForm = ref(null);
|
||||||
|
@ -119,7 +118,7 @@ const defaultButtons = computed(() => ({
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
icon: 'save',
|
icon: 'save',
|
||||||
label: 'globals.save',
|
label: 'globals.save',
|
||||||
click: async () => await save(),
|
click: async (evt) => submitForm(evt),
|
||||||
type: 'submit',
|
type: 'submit',
|
||||||
},
|
},
|
||||||
reset: {
|
reset: {
|
||||||
|
@ -132,6 +131,13 @@ const defaultButtons = computed(() => ({
|
||||||
...$props.defaultButtons,
|
...$props.defaultButtons,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const submitForm = async (evt) => {
|
||||||
|
const isFormValid = await myForm.value.validate();
|
||||||
|
if (isFormValid) {
|
||||||
|
await save(evt);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
nextTick(() => (componentIsRendered.value = true));
|
nextTick(() => (componentIsRendered.value = true));
|
||||||
|
|
||||||
|
@ -227,10 +233,9 @@ async function save() {
|
||||||
const method = $props.urlCreate ? 'post' : 'patch';
|
const method = $props.urlCreate ? 'post' : 'patch';
|
||||||
const url =
|
const url =
|
||||||
$props.urlCreate || $props.urlUpdate || $props.url || arrayData.store.url;
|
$props.urlCreate || $props.urlUpdate || $props.url || arrayData.store.url;
|
||||||
let response;
|
const response = await Promise.resolve(
|
||||||
|
$props.saveFn ? $props.saveFn(body) : axios[method](url, body),
|
||||||
if ($props.saveFn) response = await $props.saveFn(body);
|
);
|
||||||
else response = await axios[method](url, body);
|
|
||||||
|
|
||||||
if ($props.urlCreate) notify('globals.dataCreated', 'positive');
|
if ($props.urlCreate) notify('globals.dataCreated', 'positive');
|
||||||
|
|
||||||
|
@ -307,11 +312,13 @@ async function onKeyup(evt) {
|
||||||
selectionStart = selectionEnd = selectionStart + 1;
|
selectionStart = selectionEnd = selectionStart + 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await save();
|
await myForm.value.submit(evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
submitForm,
|
||||||
|
myForm,
|
||||||
save,
|
save,
|
||||||
isLoading,
|
isLoading,
|
||||||
hasChanges,
|
hasChanges,
|
||||||
|
@ -325,7 +332,7 @@ defineExpose({
|
||||||
<QForm
|
<QForm
|
||||||
ref="myForm"
|
ref="myForm"
|
||||||
v-if="formData"
|
v-if="formData"
|
||||||
@submit.prevent
|
@submit.prevent="save"
|
||||||
@keyup.prevent="onKeyup"
|
@keyup.prevent="onKeyup"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
class="q-pa-md"
|
class="q-pa-md"
|
||||||
|
@ -339,6 +346,7 @@ defineExpose({
|
||||||
name="form"
|
name="form"
|
||||||
:data="formData"
|
:data="formData"
|
||||||
:validate="validate"
|
:validate="validate"
|
||||||
|
:validations="validations()"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
/>
|
/>
|
||||||
<SkeletonForm v-else />
|
<SkeletonForm v-else />
|
||||||
|
|
|
@ -41,9 +41,12 @@ const onDataSaved = async (formData, requestResponse) => {
|
||||||
emit('onDataSaved', formData, requestResponse);
|
emit('onDataSaved', formData, requestResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClick = async (saveAndContinue) => {
|
const onClick = async (saveAndContinue = showSaveAndContinueBtn) => {
|
||||||
|
await formModelRef.value.myForm.validate(true);
|
||||||
isSaveAndContinue.value = saveAndContinue;
|
isSaveAndContinue.value = saveAndContinue;
|
||||||
await formModelRef.value.save();
|
if (formModelRef.value) {
|
||||||
|
await formModelRef.value.submitForm();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
@ -59,16 +62,23 @@ defineExpose({
|
||||||
ref="formModelRef"
|
ref="formModelRef"
|
||||||
:observe-form-changes="false"
|
:observe-form-changes="false"
|
||||||
:default-actions="false"
|
:default-actions="false"
|
||||||
|
@submit="onClick"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@on-data-saved="onDataSaved"
|
@on-data-saved="onDataSaved"
|
||||||
|
:prevent-submit="false"
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate, validations }">
|
||||||
<span ref="closeButton" class="close-icon" v-close-popup>
|
<span ref="closeButton" class="close-icon" v-close-popup>
|
||||||
<QIcon name="close" size="sm" />
|
<QIcon name="close" size="sm" />
|
||||||
</span>
|
</span>
|
||||||
<h1 class="title">{{ title }}</h1>
|
<h1 class="title">{{ title }}</h1>
|
||||||
<p>{{ subtitle }}</p>
|
<p>{{ subtitle }}</p>
|
||||||
<slot name="form-inputs" :data="data" :validate="validate" />
|
<slot
|
||||||
|
name="form-inputs"
|
||||||
|
:data="data"
|
||||||
|
:validate="validate"
|
||||||
|
:validations="validations"
|
||||||
|
/>
|
||||||
<div class="q-mt-lg row justify-end">
|
<div class="q-mt-lg row justify-end">
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('globals.cancel')"
|
:label="t('globals.cancel')"
|
||||||
|
@ -87,12 +97,13 @@ defineExpose({
|
||||||
:flat="showSaveAndContinueBtn"
|
:flat="showSaveAndContinueBtn"
|
||||||
:label="t('globals.save')"
|
:label="t('globals.save')"
|
||||||
:title="t('globals.save')"
|
:title="t('globals.save')"
|
||||||
@click="onClick(false)"
|
:type="!showSaveAndContinueBtn ? 'submit' : 'button'"
|
||||||
color="primary"
|
color="primary"
|
||||||
class="q-ml-sm"
|
class="q-ml-sm"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
data-cy="FormModelPopup_save"
|
data-cy="FormModelPopup_save"
|
||||||
|
@click="showSaveAndContinueBtn ? onClick(false) : null"
|
||||||
z-max
|
z-max
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -100,12 +111,13 @@ defineExpose({
|
||||||
:label="t('globals.isSaveAndContinue')"
|
:label="t('globals.isSaveAndContinue')"
|
||||||
:title="t('globals.isSaveAndContinue')"
|
:title="t('globals.isSaveAndContinue')"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
:type="showSaveAndContinueBtn ? 'submit' : 'button'"
|
||||||
class="q-ml-sm"
|
class="q-ml-sm"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
data-cy="FormModelPopup_isSaveAndContinue"
|
data-cy="FormModelPopup_isSaveAndContinue"
|
||||||
|
@click="showSaveAndContinueBtn ? onClick(true) : null"
|
||||||
z-max
|
z-max
|
||||||
@click="onClick(true)"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -229,6 +229,7 @@ watch(
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
create: createForm,
|
create: createForm,
|
||||||
|
showForm,
|
||||||
reload,
|
reload,
|
||||||
redirect: redirectFn,
|
redirect: redirectFn,
|
||||||
selected,
|
selected,
|
||||||
|
@ -1044,7 +1045,7 @@ const rowCtrlClickFunction = computed(() => {
|
||||||
:model="$attrs['data-key'] + 'Create'"
|
:model="$attrs['data-key'] + 'Create'"
|
||||||
@on-data-saved="(_, res) => createForm.onDataSaved(res)"
|
@on-data-saved="(_, res) => createForm.onDataSaved(res)"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data, validations }">
|
||||||
<slot name="alter-create" :data="data">
|
<slot name="alter-create" :data="data">
|
||||||
<div :style="createComplement?.containerStyle">
|
<div :style="createComplement?.containerStyle">
|
||||||
<div
|
<div
|
||||||
|
@ -1062,6 +1063,7 @@ const rowCtrlClickFunction = computed(() => {
|
||||||
:key="column.name"
|
:key="column.name"
|
||||||
:name="`column-create-${column.name}`"
|
:name="`column-create-${column.name}`"
|
||||||
:data="data"
|
:data="data"
|
||||||
|
:validations="validations"
|
||||||
:column-name="column.name"
|
:column-name="column.name"
|
||||||
:label="column.label"
|
:label="column.label"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
import { createWrapper } from 'app/test/vitest/helper';
|
|
||||||
import { default as axios } from 'axios';
|
|
||||||
import EditForm from 'components/EditTableCellValueForm.vue';
|
|
||||||
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|
||||||
|
|
||||||
const fieldA = 'fieldA';
|
|
||||||
const fieldB = 'fieldB';
|
|
||||||
|
|
||||||
describe('EditForm', () => {
|
|
||||||
let vm;
|
|
||||||
const mockRows = [
|
|
||||||
{ id: 1, itemFk: 101 },
|
|
||||||
{ id: 2, itemFk: 102 },
|
|
||||||
];
|
|
||||||
const mockFieldsOptions = [
|
|
||||||
{ label: 'Field A', field: fieldA, component: 'input', attrs: {} },
|
|
||||||
{ label: 'Field B', field: fieldB, component: 'date', attrs: {} },
|
|
||||||
];
|
|
||||||
const editUrl = '/api/edit';
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
vi.spyOn(axios, 'post').mockResolvedValue({ status: 200 });
|
|
||||||
vm = createWrapper(EditForm, {
|
|
||||||
props: {
|
|
||||||
rows: mockRows,
|
|
||||||
fieldsOptions: mockFieldsOptions,
|
|
||||||
editUrl,
|
|
||||||
},
|
|
||||||
}).vm;
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
vi.clearAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('onSubmit()', () => {
|
|
||||||
it('should call axios.post with the correct parameters in the payload', async () => {
|
|
||||||
const selectedField = { field: fieldA, component: 'input', attrs: {} };
|
|
||||||
const newValue = 'Test Value';
|
|
||||||
|
|
||||||
vm.selectedField = selectedField;
|
|
||||||
vm.newValue = newValue;
|
|
||||||
|
|
||||||
await vm.onSubmit();
|
|
||||||
|
|
||||||
const payload = axios.post.mock.calls[0][1];
|
|
||||||
|
|
||||||
expect(axios.post).toHaveBeenCalledWith(editUrl, expect.any(Object));
|
|
||||||
expect(payload.field).toEqual(fieldA);
|
|
||||||
expect(payload.newValue).toEqual(newValue);
|
|
||||||
|
|
||||||
expect(payload.lines).toEqual(expect.arrayContaining(mockRows));
|
|
||||||
|
|
||||||
expect(vm.isLoading).toEqual(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,4 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
colors: {
|
colors: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -6,9 +8,9 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const colorArray = JSON.parse($props.colors)?.value;
|
const colorArray = computed(() => JSON.parse($props.colors)?.value);
|
||||||
const maxHeight = 30;
|
const maxHeight = 30;
|
||||||
const colorHeight = maxHeight / colorArray?.length;
|
const colorHeight = maxHeight / colorArray.value?.length;
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-if="colors" class="color-div" :style="{ height: `${maxHeight}px` }">
|
<div v-if="colors" class="color-div" :style="{ height: `${maxHeight}px` }">
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
<script setup>
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const model = defineModel({ type: [Number, String] });
|
||||||
|
const emit = defineEmits(['updateBic']);
|
||||||
|
|
||||||
|
const getIbanCountry = (bank) => {
|
||||||
|
return bank.substr(0, 2);
|
||||||
|
};
|
||||||
|
|
||||||
|
const autofillBic = async (iban) => {
|
||||||
|
if (!iban) return;
|
||||||
|
|
||||||
|
const bankEntityId = parseInt(iban.substr(4, 4));
|
||||||
|
const ibanCountry = getIbanCountry(iban);
|
||||||
|
|
||||||
|
if (ibanCountry != 'ES') return;
|
||||||
|
|
||||||
|
const filter = { where: { id: bankEntityId.value } };
|
||||||
|
const params = { filter: JSON.stringify(filter) };
|
||||||
|
|
||||||
|
const { data } = await axios.get(`BankEntities`, { params });
|
||||||
|
|
||||||
|
emit('updateBic', data[0].id);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnInput
|
||||||
|
:label="t('IBAN')"
|
||||||
|
clearable
|
||||||
|
v-model="model"
|
||||||
|
@update:model-value="autofillBic($event)"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<QIcon name="info" class="cursor-info">
|
||||||
|
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
|
</template>
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { watch } from 'vue';
|
import { watch } from 'vue';
|
||||||
import { toDateString } from 'src/filters';
|
import { toDateHourMinSec } from 'src/filters';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: { type: [String, Number, Boolean, Object], default: undefined },
|
value: { type: [String, Number, Boolean, Object], default: undefined },
|
||||||
|
@ -40,7 +40,7 @@ const updateValue = () => {
|
||||||
break;
|
break;
|
||||||
case 'object':
|
case 'object':
|
||||||
if (props.value instanceof Date) {
|
if (props.value instanceof Date) {
|
||||||
t = toDateString(props.value);
|
t = toDateHourMinSec(props.value);
|
||||||
} else {
|
} else {
|
||||||
t = props.value.toString();
|
t = props.value.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ describe('VnJsonValue', () => {
|
||||||
const date = new Date('2023-01-01');
|
const date = new Date('2023-01-01');
|
||||||
const wrapper = buildComponent({ value: date });
|
const wrapper = buildComponent({ value: date });
|
||||||
const span = wrapper.find('span');
|
const span = wrapper.find('span');
|
||||||
expect(span.text()).toBe('2023-01-01');
|
expect(span.text()).toBe('01/01/2023, 01:00:00');
|
||||||
expect(span.classes()).toContain('json-object');
|
expect(span.classes()).toContain('json-object');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
export async function beforeSave(data, getChanges, modelOrigin) {
|
||||||
|
try {
|
||||||
|
const changes = data.updates;
|
||||||
|
if (!changes) return data;
|
||||||
|
const patchPromises = [];
|
||||||
|
|
||||||
|
for (const change of changes) {
|
||||||
|
let patchData = {};
|
||||||
|
|
||||||
|
if ('hasMinPrice' in change.data) {
|
||||||
|
patchData.hasMinPrice = change.data?.hasMinPrice;
|
||||||
|
delete change.data.hasMinPrice;
|
||||||
|
}
|
||||||
|
if ('minPrice' in change.data) {
|
||||||
|
patchData.minPrice = change.data?.minPrice;
|
||||||
|
delete change.data.minPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Object.keys(patchData).length > 0) {
|
||||||
|
const promise = axios
|
||||||
|
.get(`${modelOrigin}/findOne`, {
|
||||||
|
params: {
|
||||||
|
filter: {
|
||||||
|
fields: ['itemFk'],
|
||||||
|
where: { id: change.where.id },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((row) => {
|
||||||
|
return axios.patch(`Items/${row.data.itemFk}`, patchData);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error processing change: ', change, error);
|
||||||
|
});
|
||||||
|
|
||||||
|
patchPromises.push(promise);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await Promise.all(patchPromises);
|
||||||
|
|
||||||
|
data.updates = changes.filter((change) => Object.keys(change.data).length > 0);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error in beforeSave:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
|
@ -78,7 +78,8 @@ export function useValidator() {
|
||||||
if (min >= 0)
|
if (min >= 0)
|
||||||
if (Math.floor(value) < min) return t('inputMin', { value: min });
|
if (Math.floor(value) < min) return t('inputMin', { value: min });
|
||||||
},
|
},
|
||||||
custom: (value) => validation.bindedFunction(value) || 'Invalid value',
|
custom: (value) =>
|
||||||
|
eval(`(${validation.bindedFunction})`)(value) || 'Invalid value',
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -877,6 +877,11 @@ components:
|
||||||
active: Is active
|
active: Is active
|
||||||
floramondo: Is floramondo
|
floramondo: Is floramondo
|
||||||
showBadDates: Show future items
|
showBadDates: Show future items
|
||||||
|
name: Nombre
|
||||||
|
rate2: Grouping price
|
||||||
|
rate3: Packing price
|
||||||
|
minPrice: Min. Price
|
||||||
|
itemFk: Item id
|
||||||
userPanel:
|
userPanel:
|
||||||
copyToken: Token copied to clipboard
|
copyToken: Token copied to clipboard
|
||||||
settings: Settings
|
settings: Settings
|
||||||
|
|
|
@ -961,6 +961,11 @@ components:
|
||||||
to: Hasta
|
to: Hasta
|
||||||
floramondo: Floramondo
|
floramondo: Floramondo
|
||||||
showBadDates: Ver items a futuro
|
showBadDates: Ver items a futuro
|
||||||
|
name: Nombre
|
||||||
|
rate2: Precio grouping
|
||||||
|
rate3: Precio packing
|
||||||
|
minPrice: Precio mínimo
|
||||||
|
itemFk: Id item
|
||||||
userPanel:
|
userPanel:
|
||||||
copyToken: Token copiado al portapapeles
|
copyToken: Token copiado al portapapeles
|
||||||
settings: Configuración
|
settings: Configuración
|
||||||
|
|
|
@ -123,8 +123,8 @@ async function fetchMana() {
|
||||||
|
|
||||||
async function updateDiscount({ saleFk, discount, canceller }) {
|
async function updateDiscount({ saleFk, discount, canceller }) {
|
||||||
const body = { salesIds: [saleFk], newDiscount: discount };
|
const body = { salesIds: [saleFk], newDiscount: discount };
|
||||||
const claimId = claim.value.ticketFk;
|
const ticketFk = claim.value.ticketFk;
|
||||||
const query = `Tickets/${claimId}/updateDiscount`;
|
const query = `Tickets/${ticketFk}/updateDiscount`;
|
||||||
|
|
||||||
await axios.post(query, body, {
|
await axios.post(query, body, {
|
||||||
signal: canceller.signal,
|
signal: canceller.signal,
|
||||||
|
|
|
@ -88,13 +88,13 @@ const columns = [
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #column-itemFk="{ row }">
|
<template #column-itemFk="{ row }">
|
||||||
<span class="link">
|
<span class="link" @click.stop>
|
||||||
{{ row.itemFk }}
|
{{ row.itemFk }}
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-ticketFk="{ row }">
|
<template #column-ticketFk="{ row }">
|
||||||
<span class="link">
|
<span class="link" @click.stop>
|
||||||
{{ row.ticketFk }}
|
{{ row.ticketFk }}
|
||||||
<TicketDescriptorProxy :id="row.ticketFk" />
|
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||||
|
import VnInputBic from 'src/components/common/VnInputBic.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -17,7 +18,7 @@ const bankEntitiesRef = ref(null);
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: ['id', 'bic', 'name'],
|
fields: ['id', 'bic', 'name'],
|
||||||
order: 'bic ASC'
|
order: 'bic ASC',
|
||||||
};
|
};
|
||||||
|
|
||||||
const getBankEntities = (data, formData) => {
|
const getBankEntities = (data, formData) => {
|
||||||
|
@ -43,13 +44,11 @@ const getBankEntities = (data, formData) => {
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput :label="t('IBAN')" clearable v-model="data.iban">
|
<VnInputBic
|
||||||
<template #append>
|
:label="t('IBAN')"
|
||||||
<QIcon name="info" class="cursor-info">
|
v-model="data.iban"
|
||||||
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
|
@update-bic="(bankEntityFk) => (data.bankEntityFk = bankEntityFk)"
|
||||||
</QIcon>
|
/>
|
||||||
</template>
|
|
||||||
</VnInput>
|
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('Swift / BIC')"
|
:label="t('Swift / BIC')"
|
||||||
ref="bankEntitiesRef"
|
ref="bankEntitiesRef"
|
||||||
|
|
|
@ -79,7 +79,7 @@ async function acceptPropagate({ isEqualizated }) {
|
||||||
observe-form-changes
|
observe-form-changes
|
||||||
@on-data-saved="checkEtChanges"
|
@on-data-saved="checkEtChanges"
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate, validations }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('Social name')"
|
:label="t('Social name')"
|
||||||
|
@ -112,6 +112,7 @@ async function acceptPropagate({ isEqualizated }) {
|
||||||
v-model="data.sageTaxTypeFk"
|
v-model="data.sageTaxTypeFk"
|
||||||
data-cy="sageTaxTypeFk"
|
data-cy="sageTaxTypeFk"
|
||||||
:required="data.isTaxDataChecked"
|
:required="data.isTaxDataChecked"
|
||||||
|
:rules="[(val) => validations.required(data.isTaxDataChecked, val)]"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Sage transaction type')"
|
:label="t('Sage transaction type')"
|
||||||
|
@ -122,6 +123,9 @@ async function acceptPropagate({ isEqualizated }) {
|
||||||
data-cy="sageTransactionTypeFk"
|
data-cy="sageTransactionTypeFk"
|
||||||
v-model="data.sageTransactionTypeFk"
|
v-model="data.sageTransactionTypeFk"
|
||||||
:required="data.isTaxDataChecked"
|
:required="data.isTaxDataChecked"
|
||||||
|
:rules="[
|
||||||
|
(val) => validations.required(data.sageTransactionTypeFk, val),
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
|
|
@ -181,7 +181,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<VnTitle
|
<VnTitle
|
||||||
:url="`#/customer/${entityId}/billing-data`"
|
:url="`#/customer/${entityId}/billing-data`"
|
||||||
:text="t('customer.summary.billingData')"
|
:text="t('customer.summary.payMethodFk')"
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.payMethod')"
|
:label="t('customer.summary.payMethod')"
|
||||||
|
@ -289,7 +289,7 @@ const sumRisk = ({ clientRisks }) => {
|
||||||
<VnLv
|
<VnLv
|
||||||
v-if="entity.creditInsurance"
|
v-if="entity.creditInsurance"
|
||||||
:label="t('customer.summary.securedCredit')"
|
:label="t('customer.summary.securedCredit')"
|
||||||
:value="toCurrency(entity.creditInsurance)"
|
:value="`${toCurrency(entity.creditInsurance)} (${entity.classifications[0]?.insurances[0]?.grade || ''})`"
|
||||||
:info="t('customer.summary.securedCreditInfo')"
|
:info="t('customer.summary.securedCreditInfo')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { checkEntryLock } from 'src/composables/checkEntryLock';
|
||||||
import VnRow from 'src/components/ui/VnRow.vue';
|
import VnRow from 'src/components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import { beforeSave } from 'src/composables/updateMinPriceBeforeSave';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -415,56 +416,6 @@ function getAmountStyle(row) {
|
||||||
return { color: 'var(--vn-label-color)' };
|
return { color: 'var(--vn-label-color)' };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function beforeSave(data, getChanges) {
|
|
||||||
try {
|
|
||||||
const changes = data.updates;
|
|
||||||
if (!changes) return data;
|
|
||||||
const patchPromises = [];
|
|
||||||
|
|
||||||
for (const change of changes) {
|
|
||||||
let patchData = {};
|
|
||||||
|
|
||||||
if ('hasMinPrice' in change.data) {
|
|
||||||
patchData.hasMinPrice = change.data?.hasMinPrice;
|
|
||||||
delete change.data.hasMinPrice;
|
|
||||||
}
|
|
||||||
if ('minPrice' in change.data) {
|
|
||||||
patchData.minPrice = change.data?.minPrice;
|
|
||||||
delete change.data.minPrice;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Object.keys(patchData).length > 0) {
|
|
||||||
const promise = axios
|
|
||||||
.get('Buys/findOne', {
|
|
||||||
params: {
|
|
||||||
filter: {
|
|
||||||
fields: ['itemFk'],
|
|
||||||
where: { id: change.where.id },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then((buy) => {
|
|
||||||
return axios.patch(`Items/${buy.data.itemFk}`, patchData);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Error processing change: ', change, error);
|
|
||||||
});
|
|
||||||
|
|
||||||
patchPromises.push(promise);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await Promise.all(patchPromises);
|
|
||||||
|
|
||||||
data.updates = changes.filter((change) => Object.keys(change.data).length > 0);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error in beforeSave:', error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function invertQuantitySign(rows, sign) {
|
function invertQuantitySign(rows, sign) {
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
if (sign > 0) row.quantity = Math.abs(row.quantity);
|
if (sign > 0) row.quantity = Math.abs(row.quantity);
|
||||||
|
@ -697,7 +648,7 @@ onMounted(() => {
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:row-click="false"
|
:row-click="false"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:beforeSaveFn="beforeSave"
|
:beforeSaveFn="(data, getChanges) => beforeSave(data, getChanges, 'Buys')"
|
||||||
class="buyList"
|
class="buyList"
|
||||||
:table-height="$props.tableHeight ?? '84vh'"
|
:table-height="$props.tableHeight ?? '84vh'"
|
||||||
auto-load
|
auto-load
|
||||||
|
@ -787,7 +738,7 @@ onMounted(() => {
|
||||||
<span data-cy="footer-amount">{{ footer?.amount }} / </span>
|
<span data-cy="footer-amount">{{ footer?.amount }} / </span>
|
||||||
<span style="color: var(--q-positive)">{{ footer?.checkedAmount }}</span>
|
<span style="color: var(--q-positive)">{{ footer?.checkedAmount }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #column-create-itemFk="{ data }">
|
<template #column-create-itemFk="{ data, validations }">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Items/search"
|
url="Items/search"
|
||||||
v-model="data.itemFk"
|
v-model="data.itemFk"
|
||||||
|
@ -801,7 +752,8 @@ onMounted(() => {
|
||||||
await setBuyUltimate(value, data);
|
await setBuyUltimate(value, data);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
:required="true"
|
required
|
||||||
|
:rules="[(val) => validations.required(true, val)]"
|
||||||
data-cy="itemFk-create-popup"
|
data-cy="itemFk-create-popup"
|
||||||
sort-by="nickname DESC"
|
sort-by="nickname DESC"
|
||||||
>
|
>
|
||||||
|
|
|
@ -79,6 +79,30 @@ 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',
|
||||||
|
name: 'created',
|
||||||
|
label: t('globals.created'),
|
||||||
|
component: 'date',
|
||||||
|
columnField: { component: null },
|
||||||
|
format: (row) => toDate(row.created),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'dued',
|
||||||
|
label: t('invoiceOut.summary.expirationDate'),
|
||||||
|
component: 'date',
|
||||||
|
columnField: { component: null },
|
||||||
|
format: (row) => toDate(row.dued),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'clientFk',
|
name: 'clientFk',
|
||||||
|
@ -132,22 +156,6 @@ const columns = computed(() => [
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
format: (row) => toCurrency(row.amount),
|
format: (row) => toCurrency(row.amount),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'created',
|
|
||||||
label: t('globals.created'),
|
|
||||||
component: 'date',
|
|
||||||
columnField: { component: null },
|
|
||||||
format: (row) => toDate(row.created),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
align: 'left',
|
|
||||||
name: 'dued',
|
|
||||||
label: t('invoiceOut.summary.dued'),
|
|
||||||
component: 'date',
|
|
||||||
columnField: { component: null },
|
|
||||||
format: (row) => toDate(row.dued),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'customsAgentFk',
|
name: 'customsAgentFk',
|
||||||
|
|
|
@ -22,7 +22,7 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy style="max-width: 10px">
|
<QPopupProxy style="max-width: 10px" data-cy="ItemDescriptor">
|
||||||
<ItemDescriptor
|
<ItemDescriptor
|
||||||
v-if="$props.id"
|
v-if="$props.id"
|
||||||
:id="$props.id"
|
:id="$props.id"
|
||||||
|
|
|
@ -1,574 +1,386 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, onUnmounted, nextTick, computed } from 'vue';
|
import { onMounted, ref, onUnmounted, computed, watch } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
|
||||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
|
||||||
import EditTableCellValueForm from 'src/components/EditTableCellValueForm.vue';
|
|
||||||
import ItemFixedPriceFilter from './ItemFixedPriceFilter.vue';
|
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
|
|
||||||
import { tMobile } from 'src/composables/tMobile';
|
|
||||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { toDate } from 'src/filters';
|
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
|
||||||
import axios from 'axios';
|
import { beforeSave } from 'src/composables/updateMinPriceBeforeSave';
|
||||||
import { isLower, isBigger } from 'src/filters/date.js';
|
|
||||||
|
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||||
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
import EditFixedPriceForm from 'src/pages/Item/components/EditFixedPriceForm.vue';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import { QCheckbox } from 'quasar';
|
import VnColor from 'src/components/common/VnColor.vue';
|
||||||
|
|
||||||
|
import { toDate } from 'src/filters';
|
||||||
|
import { isLower, isBigger } from 'src/filters/date.js';
|
||||||
|
import ItemFixedPriceFilter from './ItemFixedPriceFilter.vue';
|
||||||
|
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
|
||||||
|
import { toCurrency } from 'src/filters';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
|
||||||
const state = useState();
|
|
||||||
const { notify } = useNotify();
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const editTableCellDialogRef = ref(null);
|
const editFixedPriceForm = ref(null);
|
||||||
const user = state.getUser();
|
const selectedRows = ref([]);
|
||||||
const fixedPrices = ref([]);
|
const hasSelectedRows = computed(() => selectedRows.value.length > 0);
|
||||||
const warehousesOptions = ref([]);
|
const isToClone = ref(false);
|
||||||
const hasSelectedRows = computed(() => rowsSelected.value.length > 0);
|
const dateColor = 'var(--vn-label-text-color)';
|
||||||
const rowsSelected = ref([]);
|
const state = useState();
|
||||||
const itemFixedPriceFilterRef = ref();
|
const user = state.getUser().fn();
|
||||||
|
const warehouse = computed(() => user.warehouseFk);
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
});
|
});
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||||
|
|
||||||
const defaultColumnAttrs = {
|
|
||||||
align: 'left',
|
|
||||||
sortable: true,
|
|
||||||
};
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.itemFk'),
|
|
||||||
name: 'itemFk',
|
name: 'itemFk',
|
||||||
...defaultColumnAttrs,
|
label: t('item.fixedPrice.itemFk'),
|
||||||
isId: true,
|
labelAbbreviation: 'Id',
|
||||||
columnField: {
|
toolTip: t('item.fixedPrice.itemFk'),
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
columnClass: 'shrink',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('globals.name'),
|
|
||||||
name: 'name',
|
|
||||||
...defaultColumnAttrs,
|
|
||||||
create: true,
|
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'select',
|
|
||||||
attrs: {
|
attrs: {
|
||||||
|
component: 'select',
|
||||||
url: 'Items',
|
url: 'Items',
|
||||||
fields: ['id', 'name', 'subName'],
|
fields: ['id', 'name', 'subName'],
|
||||||
optionLabel: 'name',
|
optionLabel: 'name',
|
||||||
optionValue: 'name',
|
optionValue: 'id',
|
||||||
uppercase: false,
|
uppercase: false,
|
||||||
},
|
},
|
||||||
|
inWhere: true,
|
||||||
},
|
},
|
||||||
|
width: '55px',
|
||||||
|
isEditable: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
labelAbbreviation: '',
|
||||||
|
name: 'hex',
|
||||||
|
columnSearch: false,
|
||||||
|
isEditable: false,
|
||||||
|
width: '9px',
|
||||||
|
component: 'select',
|
||||||
|
attrs: {
|
||||||
|
url: 'Inks',
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('globals.name'),
|
||||||
|
name: 'name',
|
||||||
|
create: true,
|
||||||
|
component: 'input',
|
||||||
|
isEditable: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.groupingPrice'),
|
label: t('item.fixedPrice.groupingPrice'),
|
||||||
|
labelAbbreviation: 'P. Group',
|
||||||
|
toolTip: t('item.fixedPrice.groupingPrice'),
|
||||||
name: 'rate2',
|
name: 'rate2',
|
||||||
...defaultColumnAttrs,
|
component: 'number',
|
||||||
component: 'input',
|
create: true,
|
||||||
type: 'number',
|
createOrder: 3,
|
||||||
|
createAttrs: {
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
width: '50px',
|
||||||
|
format: (row) => toCurrency(row.rate2),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.packingPrice'),
|
label: t('item.fixedPrice.packingPrice'),
|
||||||
|
labelAbbreviation: 'P. Pack',
|
||||||
|
toolTip: t('item.fixedPrice.packingPrice'),
|
||||||
name: 'rate3',
|
name: 'rate3',
|
||||||
...defaultColumnAttrs,
|
component: 'number',
|
||||||
component: 'input',
|
create: true,
|
||||||
type: 'number',
|
createOrder: 4,
|
||||||
|
createAttrs: {
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
width: '50px',
|
||||||
|
format: (row) => toCurrency(row.rate3),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'hasMinPrice',
|
||||||
|
label: t('item.fixedPrice.hasMinPrice'),
|
||||||
|
labelAbbreviation: t('item.fixedPrice.MP'),
|
||||||
|
toolTip: t('item.fixedPrice.hasMinPrice'),
|
||||||
|
label: t('item.fixedPrice.hasMinPrice'),
|
||||||
|
component: 'checkbox',
|
||||||
|
attrs: {
|
||||||
|
toggleIndeterminate: false,
|
||||||
|
},
|
||||||
|
width: '50px',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.minPrice'),
|
label: t('item.fixedPrice.minPrice'),
|
||||||
|
labelAbbreviation: 'Min.P',
|
||||||
|
toolTip: t('item.fixedPrice.minPrice'),
|
||||||
name: 'minPrice',
|
name: 'minPrice',
|
||||||
...defaultColumnAttrs,
|
component: 'number',
|
||||||
component: 'input',
|
width: '50px',
|
||||||
type: 'number',
|
style: (row) => {
|
||||||
|
if (!row?.hasMinPrice) return { color: 'var(--vn-label-color)' };
|
||||||
|
},
|
||||||
|
format: (row) => toCurrency(row.minPrice),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.started'),
|
label: t('item.fixedPrice.started'),
|
||||||
field: 'started',
|
|
||||||
name: 'started',
|
name: 'started',
|
||||||
format: ({ started }) => toDate(started),
|
component: 'date',
|
||||||
...defaultColumnAttrs,
|
|
||||||
columnField: {
|
|
||||||
component: 'date',
|
|
||||||
class: 'shrink',
|
|
||||||
},
|
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'date',
|
component: 'date',
|
||||||
},
|
},
|
||||||
columnClass: 'expand',
|
createAttrs: {
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
create: true,
|
||||||
|
createOrder: 5,
|
||||||
|
width: '65px',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.ended'),
|
label: t('item.fixedPrice.ended'),
|
||||||
name: 'ended',
|
name: 'ended',
|
||||||
...defaultColumnAttrs,
|
component: 'date',
|
||||||
columnField: {
|
|
||||||
component: 'date',
|
|
||||||
class: 'shrink',
|
|
||||||
},
|
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
component: 'date',
|
component: 'date',
|
||||||
},
|
},
|
||||||
columnClass: 'expand',
|
createAttrs: {
|
||||||
format: (row) => toDate(row.ended),
|
required: true,
|
||||||
|
},
|
||||||
|
create: true,
|
||||||
|
createOrder: 6,
|
||||||
|
width: '65px',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
align: 'center',
|
||||||
label: t('globals.warehouse'),
|
label: t('globals.warehouse'),
|
||||||
name: 'warehouseFk',
|
name: 'warehouseFk',
|
||||||
...defaultColumnAttrs,
|
|
||||||
columnClass: 'shrink',
|
|
||||||
component: 'select',
|
component: 'select',
|
||||||
options: warehousesOptions,
|
attrs: {
|
||||||
columnFilter: {
|
url: 'Warehouses',
|
||||||
name: 'warehouseFk',
|
fields: ['id', 'name'],
|
||||||
inWhere: true,
|
optionLabel: 'name',
|
||||||
component: 'select',
|
optionValue: 'id',
|
||||||
attrs: {
|
|
||||||
options: warehousesOptions,
|
|
||||||
'option-label': 'name',
|
|
||||||
'option-value': 'id',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
create: true,
|
||||||
|
format: (row, dashIfEmpty) => dashIfEmpty(row.warehouseName),
|
||||||
|
width: '80px',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
name: 'tableActions',
|
name: 'tableActions',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
title: t('delete'),
|
title: t('globals.clone'),
|
||||||
icon: 'delete',
|
icon: 'vn:clone',
|
||||||
action: (row) => confirmRemove(row),
|
action: (row) => openCloneFixedPriceForm(row),
|
||||||
isPrimary: true,
|
isPrimary: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const editTableFieldsOptions = [
|
const openEditFixedPriceForm = () => {
|
||||||
{
|
editFixedPriceForm.value.show();
|
||||||
field: 'rate2',
|
|
||||||
label: t('item.fixedPrice.groupingPrice'),
|
|
||||||
component: 'input',
|
|
||||||
attrs: {
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'rate3',
|
|
||||||
label: t('item.fixedPrice.packingPrice'),
|
|
||||||
component: 'input',
|
|
||||||
attrs: {
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'minPrice',
|
|
||||||
label: t('item.fixedPrice.minPrice'),
|
|
||||||
component: 'input',
|
|
||||||
attrs: {
|
|
||||||
type: 'number',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'started',
|
|
||||||
label: t('item.fixedPrice.started'),
|
|
||||||
component: 'date',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'ended',
|
|
||||||
label: t('item.fixedPrice.ended'),
|
|
||||||
component: 'date',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'warehouseFk',
|
|
||||||
label: t('globals.warehouse'),
|
|
||||||
component: 'select',
|
|
||||||
attrs: {
|
|
||||||
options: [],
|
|
||||||
'option-label': 'name',
|
|
||||||
'option-value': 'id',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const getRowUpdateInputEvents = (props, resetMinPrice, inputType = 'text') => {
|
|
||||||
return inputType === 'text'
|
|
||||||
? {
|
|
||||||
'keyup.enter': () => upsertPrice(props, resetMinPrice),
|
|
||||||
blur: () => upsertPrice(props, resetMinPrice),
|
|
||||||
}
|
|
||||||
: { 'update:modelValue': () => upsertPrice(props, resetMinPrice) };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMinPrice = async (value, props) => {
|
const openCloneFixedPriceForm = (row) => {
|
||||||
props.row.hasMinPrice = value;
|
tableRef.value.showForm = true;
|
||||||
await upsertPrice({
|
isToClone.value = true;
|
||||||
row: props.row,
|
tableRef.value.create.title = t('Clone fixed price');
|
||||||
col: { field: 'hasMinPrice' },
|
tableRef.value.create.formInitialData = (({
|
||||||
rowIndex: props.rowIndex,
|
itemFk,
|
||||||
});
|
rate2,
|
||||||
|
rate3,
|
||||||
|
started,
|
||||||
|
ended,
|
||||||
|
warehouseFk,
|
||||||
|
}) => ({
|
||||||
|
itemFk,
|
||||||
|
rate2,
|
||||||
|
rate3,
|
||||||
|
started,
|
||||||
|
ended,
|
||||||
|
warehouseFk,
|
||||||
|
}))(JSON.parse(JSON.stringify(row)));
|
||||||
};
|
};
|
||||||
|
|
||||||
const validations = ({ row }) => {
|
|
||||||
const requiredFields = [
|
|
||||||
'itemFk',
|
|
||||||
'started',
|
|
||||||
'ended',
|
|
||||||
'rate2',
|
|
||||||
'rate3',
|
|
||||||
'warehouseFk',
|
|
||||||
];
|
|
||||||
const isValid = requiredFields.every(
|
|
||||||
(field) => row[field] !== null && row[field] !== undefined
|
|
||||||
);
|
|
||||||
return isValid;
|
|
||||||
};
|
|
||||||
const upsertPrice = async (props, resetMinPrice = false) => {
|
|
||||||
const isValid = validations({ ...props });
|
|
||||||
if (!isValid) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { row } = props;
|
|
||||||
const changes = tableRef.value.CrudModelRef.getChanges();
|
|
||||||
if (changes?.updates?.length > 0) {
|
|
||||||
if (resetMinPrice) row.hasMinPrice = 0;
|
|
||||||
}
|
|
||||||
if (!changes.updates && !changes.creates) return;
|
|
||||||
const data = await upsertFixedPrice(row);
|
|
||||||
Object.assign(tableRef.value.CrudModelRef.formData[props.rowIndex], data);
|
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
|
||||||
tableRef.value.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
async function upsertFixedPrice(row) {
|
|
||||||
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
|
||||||
data.hasMinPrice = data.hasMinPrice ? 1 : 0;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkLastVisibleRow() {
|
|
||||||
let lastVisibleRow = null;
|
|
||||||
|
|
||||||
getTableRows().forEach((row, index) => {
|
|
||||||
const rect = row.getBoundingClientRect();
|
|
||||||
if (rect.top >= 0 && rect.bottom <= window.innerHeight) {
|
|
||||||
lastVisibleRow = index;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return lastVisibleRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
const addRow = (original = null) => {
|
|
||||||
let copy = null;
|
|
||||||
const today = Date.vnNew();
|
|
||||||
const millisecsInDay = 86400000;
|
|
||||||
const daysInWeek = 7;
|
|
||||||
const nextWeek = new Date(today.getTime() + daysInWeek * millisecsInDay);
|
|
||||||
|
|
||||||
copy = {
|
|
||||||
id: 0,
|
|
||||||
started: today,
|
|
||||||
ended: nextWeek,
|
|
||||||
hasMinPrice: 0,
|
|
||||||
$index: 0,
|
|
||||||
};
|
|
||||||
return { original, copy };
|
|
||||||
};
|
|
||||||
|
|
||||||
const getTableRows = () =>
|
|
||||||
document.getElementsByClassName('q-table')[0].querySelectorAll('tr.cursor-pointer');
|
|
||||||
|
|
||||||
function highlightNewRow({ $index: index }) {
|
|
||||||
const row = getTableRows()[index];
|
|
||||||
if (row) {
|
|
||||||
row.classList.add('highlight');
|
|
||||||
setTimeout(() => {
|
|
||||||
row.classList.remove('highlight');
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const openEditTableCellDialog = () => {
|
|
||||||
editTableCellDialogRef.value.show();
|
|
||||||
};
|
|
||||||
|
|
||||||
const onEditCellDataSaved = async () => {
|
|
||||||
rowsSelected.value = [];
|
|
||||||
tableRef.value.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
const removeFuturePrice = async () => {
|
|
||||||
rowsSelected.value.forEach(({ id }) => {
|
|
||||||
const rowIndex = fixedPrices.value.findIndex(({ id }) => id === id);
|
|
||||||
removePrice(id, rowIndex);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
function confirmRemove(item, isFuture) {
|
|
||||||
const promise = async () =>
|
|
||||||
isFuture ? removeFuturePrice(item.id) : removePrice(item.id);
|
|
||||||
quasar.dialog({
|
|
||||||
component: VnConfirm,
|
|
||||||
componentProps: {
|
|
||||||
title: t('globals.rowWillBeRemoved'),
|
|
||||||
message: t('globals.confirmDeletion'),
|
|
||||||
promise,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const removePrice = async (id) => {
|
|
||||||
await axios.delete(`FixedPrices/${id}`);
|
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
|
||||||
tableRef.value.reload({});
|
|
||||||
};
|
|
||||||
const dateStyle = (date) =>
|
const dateStyle = (date) =>
|
||||||
date
|
date
|
||||||
? {
|
? {
|
||||||
'bg-color': 'warning',
|
color: 'var(--vn-black-text-color)',
|
||||||
'is-outlined': true,
|
|
||||||
}
|
}
|
||||||
: {};
|
: { color: dateColor, 'background-color': 'transparent' };
|
||||||
|
|
||||||
function handleOnDataSave({ CrudModelRef }) {
|
const onDataSaved = () => {
|
||||||
const { original, copy } = addRow(CrudModelRef.formData[checkLastVisibleRow()]);
|
tableRef.value.CrudModelRef.saveChanges();
|
||||||
if (original) {
|
selectedRows.value = [];
|
||||||
CrudModelRef.formData.splice(original?.$index ?? 0, 0, copy);
|
};
|
||||||
} else {
|
|
||||||
CrudModelRef.insert(copy);
|
onMounted(() => {
|
||||||
|
if (tableRef.value) {
|
||||||
|
tableRef.value.showForm = false;
|
||||||
}
|
}
|
||||||
nextTick(() => {
|
});
|
||||||
highlightNewRow(original ?? { $index: 0 });
|
|
||||||
});
|
watch(
|
||||||
}
|
() => tableRef.value?.showForm,
|
||||||
|
(newVal) => {
|
||||||
|
if (!newVal) {
|
||||||
|
tableRef.value.create.title = '';
|
||||||
|
tableRef.value.create.formInitialData = { warehouseFk: warehouse };
|
||||||
|
if (tableRef.value) {
|
||||||
|
isToClone.value = false;
|
||||||
|
tableRef.value.create.title = t('Create fixed price');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
@on-fetch="(data) => (warehousesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
url="Warehouses"
|
|
||||||
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
|
||||||
/>
|
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
<ItemFixedPriceFilter
|
<ItemFixedPriceFilter data-key="ItemFixedPrices" />
|
||||||
data-key="ItemFixedPrices"
|
|
||||||
ref="itemFixedPriceFilterRef"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</RightMenu>
|
</RightMenu>
|
||||||
<VnSubToolbar>
|
<VnSubToolbar />
|
||||||
<template #st-actions>
|
<Teleport to="#st-data" v-if="stateStore?.isSubToolbarShown()">
|
||||||
|
<QBtnGroup push style="column-gap: 10px">
|
||||||
<QBtn
|
<QBtn
|
||||||
:disable="!hasSelectedRows"
|
:disable="!hasSelectedRows"
|
||||||
@click="openEditTableCellDialog()"
|
@click="openEditFixedPriceForm()"
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="edit"
|
icon="edit"
|
||||||
|
flat
|
||||||
|
:label="t('globals.edit')"
|
||||||
|
data-cy="FixedPriceToolbarEditBtn"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('Edit fixed price(s)') }}
|
{{ t('Edit fixed price(s)') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<QBtn
|
</QBtnGroup>
|
||||||
:disable="!hasSelectedRows"
|
</Teleport>
|
||||||
:label="tMobile('globals.remove')"
|
|
||||||
color="primary"
|
|
||||||
icon="delete"
|
|
||||||
flat
|
|
||||||
@click="(row) => confirmRemove(row, true)"
|
|
||||||
:title="t('globals.remove')"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</VnSubToolbar>
|
|
||||||
<VnTable
|
<VnTable
|
||||||
:default-remove="false"
|
ref="tableRef"
|
||||||
:default-reset="false"
|
|
||||||
:default-save="false"
|
|
||||||
data-key="ItemFixedPrices"
|
data-key="ItemFixedPrices"
|
||||||
url="FixedPrices/filter"
|
url="FixedPrices/filter"
|
||||||
:order="['name DESC', 'itemFk DESC']"
|
:order="'name DESC'"
|
||||||
save-url="FixedPrices/crud"
|
save-url="FixedPrices/crud"
|
||||||
ref="tableRef"
|
|
||||||
dense
|
|
||||||
:filter="{
|
|
||||||
where: {
|
|
||||||
warehouseFk: user.warehouseFk,
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
default-mode="table"
|
|
||||||
auto-load
|
|
||||||
:is-editable="true"
|
:is-editable="true"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
:table="{
|
:table="{
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
}"
|
}"
|
||||||
v-model:selected="rowsSelected"
|
v-model:selected="selectedRows"
|
||||||
:create-as-dialog="false"
|
|
||||||
:create="{
|
:create="{
|
||||||
onDataSaved: handleOnDataSave,
|
urlCreate: 'FixedPrices',
|
||||||
|
title: t('Create fixed price'),
|
||||||
|
formInitialData: { warehouseFk: warehouse },
|
||||||
|
onDataSaved: () => tableRef.reload(),
|
||||||
|
showSaveAndContinueBtn: true,
|
||||||
}"
|
}"
|
||||||
:disable-option="{ card: true }"
|
:disable-option="{ card: true }"
|
||||||
:has-sub-toolbar="false"
|
auto-load
|
||||||
|
:beforeSaveFn="(data, getChanges) => beforeSave(data, getChanges, 'FixedPrices')"
|
||||||
>
|
>
|
||||||
<template #header-selection="scope">
|
<template #column-hex="{ row }">
|
||||||
<QCheckbox v-model="scope.selected" />
|
<VnColor :colors="row?.hexJson" style="height: 100%; min-width: 2000px" />
|
||||||
</template>
|
</template>
|
||||||
<template #body-selection="scope">
|
<template #column-name="{ row }">
|
||||||
{{ scope }}
|
<span class="link">
|
||||||
<QCheckbox flat v-model="scope.selected" />
|
{{ row.name }}
|
||||||
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
|
</span>
|
||||||
|
<span class="subName">{{ row.subName }}</span>
|
||||||
|
<FetchedTags :item="row" :columns="6" />
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-started="{ row }">
|
||||||
<template #column-itemFk="props">
|
<div class="editable-text q-pb-xxs">
|
||||||
|
<QBadge class="badge" :style="dateStyle(isLower(row?.ended))">
|
||||||
|
{{ toDate(row?.started) }}
|
||||||
|
</QBadge>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #column-ended="{ row }">
|
||||||
|
<div class="editable-text q-pb-xxs">
|
||||||
|
<QBadge class="badge" :style="dateStyle(isBigger(row?.ended))">
|
||||||
|
{{ toDate(row?.ended) }}
|
||||||
|
</QBadge>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #column-create-name="{ data }">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
style="max-width: 100px"
|
url="Items/search"
|
||||||
url="Items/withName"
|
v-model="data.itemFk"
|
||||||
hide-selected
|
:label="t('item.fixedPrice.itemName')"
|
||||||
option-label="id"
|
:fields="['id', 'name']"
|
||||||
|
:filter-options="['id', 'name']"
|
||||||
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
v-model="props.row.itemFk"
|
:required="true"
|
||||||
v-on="getRowUpdateInputEvents(props, true, 'select')"
|
sort-by="name ASC"
|
||||||
|
data-cy="FixedPriceCreateNameSelect"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
<QItemLabel>
|
||||||
<QItemLabel caption>{{ scope.opt?.name }}</QItemLabel>
|
{{ scope.opt.name }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel caption> #{{ scope.opt.id }} </QItemLabel>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</template>
|
</template>
|
||||||
<template #column-name="{ row }">
|
<template #column-create-warehouseFk="{ data }">
|
||||||
<span class="link">
|
<VnSelect
|
||||||
{{ row.name }}
|
:label="t('globals.warehouse')"
|
||||||
</span>
|
url="Warehouses"
|
||||||
<span class="subName">{{ row.subName }}</span>
|
v-model="data.warehouseFk"
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
:fields="['id', 'name']"
|
||||||
<FetchedTags :item="row" :columns="3" />
|
option-label="name"
|
||||||
</template>
|
option-value="id"
|
||||||
<template #column-rate2="props">
|
hide-selected
|
||||||
<QTd class="col">
|
:required="true"
|
||||||
<VnInput
|
sort-by="name ASC"
|
||||||
type="currency"
|
data-cy="FixedPriceCreateWarehouseSelect"
|
||||||
style="width: 75px"
|
|
||||||
v-model.number="props.row.rate2"
|
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
|
||||||
>
|
|
||||||
<template #append>€</template>
|
|
||||||
</VnInput>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #column-rate3="props">
|
|
||||||
<QTd class="col">
|
|
||||||
<VnInput
|
|
||||||
style="width: 75px"
|
|
||||||
type="currency"
|
|
||||||
v-model.number="props.row.rate3"
|
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
|
||||||
>
|
|
||||||
<template #append>€</template>
|
|
||||||
</VnInput>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #column-minPrice="props">
|
|
||||||
<QTd class="col">
|
|
||||||
<div class="row" style="align-items: center">
|
|
||||||
<QCheckbox
|
|
||||||
:model-value="props.row.hasMinPrice"
|
|
||||||
@update:model-value="updateMinPrice($event, props)"
|
|
||||||
:false-value="0"
|
|
||||||
:true-value="1"
|
|
||||||
:toggle-indeterminate="false"
|
|
||||||
/>
|
|
||||||
<VnInput
|
|
||||||
class="col"
|
|
||||||
type="currency"
|
|
||||||
mask="###.##"
|
|
||||||
:disable="props.row.hasMinPrice === 0"
|
|
||||||
v-model.number="props.row.minPrice"
|
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
|
||||||
>
|
|
||||||
<template #append>€</template>
|
|
||||||
</VnInput>
|
|
||||||
</div>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #column-started="props">
|
|
||||||
<VnInputDate
|
|
||||||
class="vnInputDate"
|
|
||||||
:show-event="true"
|
|
||||||
v-model="props.row.started"
|
|
||||||
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
|
||||||
v-bind="dateStyle(isBigger(props.row.started))"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #column-ended="props">
|
|
||||||
<VnInputDate
|
|
||||||
class="vnInputDate"
|
|
||||||
:show-event="true"
|
|
||||||
v-model="props.row.ended"
|
|
||||||
v-on="getRowUpdateInputEvents(props, false, 'date')"
|
|
||||||
v-bind="dateStyle(isLower(props.row.ended))"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #column-warehouseFk="props">
|
|
||||||
<QTd class="col">
|
|
||||||
<VnSelect
|
|
||||||
style="max-width: 150px"
|
|
||||||
:options="warehousesOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="props.row.warehouseFk"
|
|
||||||
v-on="getRowUpdateInputEvents(props, false, 'select')"
|
|
||||||
/>
|
|
||||||
</QTd>
|
|
||||||
</template>
|
|
||||||
<template #column-deleteAction="{ row, rowIndex }">
|
|
||||||
<QIcon
|
|
||||||
name="delete"
|
|
||||||
size="sm"
|
|
||||||
class="cursor-pointer fill-icon-on-hover"
|
|
||||||
color="primary"
|
|
||||||
@click.stop="
|
|
||||||
openConfirmationModal(
|
|
||||||
t('globals.rowWillBeRemoved'),
|
|
||||||
t('Do you want to clone this item?'),
|
|
||||||
() => removePrice(row.id, rowIndex)
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<QTooltip class="text-no-wrap">
|
<template #option="scope">
|
||||||
{{ t('globals.delete') }}
|
<QItem v-bind="scope.itemProps">
|
||||||
</QTooltip>
|
<QItemSection>
|
||||||
</QIcon>
|
<QItemLabel>
|
||||||
|
{{ scope.opt.name }}
|
||||||
|
</QItemLabel>
|
||||||
|
<QItemLabel caption> #{{ scope.opt.id }} </QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelect>
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
|
<QDialog ref="editFixedPriceForm">
|
||||||
<QDialog ref="editTableCellDialogRef">
|
<EditFixedPriceForm
|
||||||
<EditTableCellValueForm
|
|
||||||
edit-url="FixedPrices/editFixedPrice"
|
edit-url="FixedPrices/editFixedPrice"
|
||||||
:rows="rowsSelected"
|
:rows="selectedRows"
|
||||||
:fields-options="editTableFieldsOptions"
|
:fields-options="
|
||||||
@on-data-saved="onEditCellDataSaved()"
|
columns.filter(
|
||||||
|
({ isEditable, component, name }) =>
|
||||||
|
isEditable !== false && component && name !== 'itemFk',
|
||||||
|
)
|
||||||
|
"
|
||||||
|
:beforeSave="beforeSave"
|
||||||
|
@on-data-saved="onDataSaved"
|
||||||
/>
|
/>
|
||||||
</QDialog>
|
</QDialog>
|
||||||
</template>
|
</template>
|
||||||
|
@ -623,8 +435,17 @@ tbody tr.highlight .q-td {
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.badge {
|
||||||
|
background-color: $warning;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Add fixed price: Añadir precio fijado
|
Add fixed price: Añadir precio fijado
|
||||||
Edit fixed price(s): Editar precio(s) fijado(s)
|
Edit fixed price(s): Editar precio(s) fijado(s)
|
||||||
|
Create fixed price: Crear precio fijado
|
||||||
|
Clone fixed price: Clonar precio fijado
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -29,6 +29,7 @@ const props = defineProps({
|
||||||
dense
|
dense
|
||||||
filled
|
filled
|
||||||
use-input
|
use-input
|
||||||
|
:use-like="false"
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
sort-by="nickname ASC"
|
sort-by="nickname ASC"
|
||||||
/>
|
/>
|
||||||
|
@ -50,21 +51,19 @@ const props = defineProps({
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem class="q-my-md">
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('params.started')"
|
|
||||||
v-model="params.started"
|
v-model="params.started"
|
||||||
|
:label="t('params.started')"
|
||||||
filled
|
filled
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
|
||||||
<QItem class="q-my-md">
|
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('params.ended')"
|
|
||||||
v-model="params.ended"
|
v-model="params.ended"
|
||||||
|
:label="t('params.ended')"
|
||||||
filled
|
filled
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -8,11 +8,6 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import { QCheckbox } from 'quasar';
|
import { QCheckbox } from 'quasar';
|
||||||
|
|
||||||
import axios from 'axios';
|
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved']);
|
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
rows: {
|
rows: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -26,10 +21,14 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
beforeSave: {
|
||||||
|
type: Function,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const emit = defineEmits(['onDataSaved']);
|
||||||
|
|
||||||
const inputs = {
|
const inputs = {
|
||||||
input: markRaw(VnInput),
|
input: markRaw(VnInput),
|
||||||
|
@ -44,24 +43,13 @@ const selectedField = ref(null);
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
const onDataSaved = () => {
|
|
||||||
notify('globals.dataSaved', 'positive');
|
|
||||||
emit('onDataSaved');
|
|
||||||
closeForm();
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
$props.rows.forEach((row) => {
|
||||||
const payload = {
|
row[selectedField.value.name] = newValue.value;
|
||||||
field: selectedField.value.field,
|
});
|
||||||
newValue: newValue.value,
|
emit('onDataSaved', $props.rows);
|
||||||
lines: rowsToEdit,
|
closeForm();
|
||||||
};
|
|
||||||
|
|
||||||
await axios.post($props.editUrl, payload);
|
|
||||||
onDataSaved();
|
|
||||||
isLoading.value = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeForm = () => {
|
const closeForm = () => {
|
||||||
|
@ -78,21 +66,24 @@ const closeForm = () => {
|
||||||
<span class="title">{{ t('Edit') }}</span>
|
<span class="title">{{ t('Edit') }}</span>
|
||||||
<span class="countLines">{{ ` ${rows.length} ` }}</span>
|
<span class="countLines">{{ ` ${rows.length} ` }}</span>
|
||||||
<span class="title">{{ t('buy(s)') }}</span>
|
<span class="title">{{ t('buy(s)') }}</span>
|
||||||
<VnRow>
|
<VnRow class="q-mt-md">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
class="editOption"
|
||||||
:label="t('Field to edit')"
|
:label="t('Field to edit')"
|
||||||
:options="fieldsOptions"
|
:options="fieldsOptions"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="label"
|
option-label="label"
|
||||||
v-model="selectedField"
|
v-model="selectedField"
|
||||||
data-cy="field-to-edit"
|
data-cy="EditFixedPriceSelectOption"
|
||||||
|
@update:model-value="newValue = null"
|
||||||
|
:class="{ 'is-select': selectedField?.component === 'select' }"
|
||||||
/>
|
/>
|
||||||
<component
|
<component
|
||||||
:is="inputs[selectedField?.component || 'input']"
|
:is="inputs[selectedField?.component || 'input']"
|
||||||
v-bind="selectedField?.attrs || {}"
|
v-bind="selectedField?.attrs || {}"
|
||||||
v-model="newValue"
|
v-model="newValue"
|
||||||
:label="t('Value')"
|
:label="t('Value')"
|
||||||
data-cy="value-to-edit"
|
data-cy="EditFixedPriceValueOption"
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
@ -140,6 +131,15 @@ const closeForm = () => {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.editOption .q-field__inner .q-field__control {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
.editOption.is-select .q-field__inner .q-field__control {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Edit: Editar
|
Edit: Editar
|
|
@ -0,0 +1,46 @@
|
||||||
|
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
|
||||||
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import EditFixedPriceForm from 'src/pages/Item/components/EditFixedPriceForm.vue';
|
||||||
|
|
||||||
|
describe('EditFixedPriceForm.vue', () => {
|
||||||
|
let wrapper;
|
||||||
|
let vm;
|
||||||
|
|
||||||
|
const mockRows = [
|
||||||
|
{ id: 1, itemFk: 101 },
|
||||||
|
{ id: 2, itemFk: 102 },
|
||||||
|
];
|
||||||
|
|
||||||
|
const mockFieldsOptions = [
|
||||||
|
{
|
||||||
|
name: 'price',
|
||||||
|
label: 'Price',
|
||||||
|
component: 'input',
|
||||||
|
attrs: { type: 'number' },
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
wrapper = createWrapper(EditFixedPriceForm, {
|
||||||
|
props: {
|
||||||
|
rows: JSON.parse(JSON.stringify(mockRows)),
|
||||||
|
fieldsOptions: mockFieldsOptions,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
wrapper = wrapper.wrapper;
|
||||||
|
vm = wrapper.vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should emit "onDataSaved" with updated rows on submit', async () => {
|
||||||
|
vm.selectedField = mockFieldsOptions[0];
|
||||||
|
vm.newValue = 199.99;
|
||||||
|
|
||||||
|
await vm.onSubmit();
|
||||||
|
|
||||||
|
expect(wrapper.emitted('onDataSaved')).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -167,6 +167,8 @@ item:
|
||||||
started: Started
|
started: Started
|
||||||
ended: Ended
|
ended: Ended
|
||||||
warehouse: Warehouse
|
warehouse: Warehouse
|
||||||
|
MP: MP
|
||||||
|
itemName: Item
|
||||||
create:
|
create:
|
||||||
name: Name
|
name: Name
|
||||||
tag: Tag
|
tag: Tag
|
||||||
|
|
|
@ -173,6 +173,8 @@ item:
|
||||||
started: Inicio
|
started: Inicio
|
||||||
ended: Fin
|
ended: Fin
|
||||||
warehouse: Almacén
|
warehouse: Almacén
|
||||||
|
MP: PM
|
||||||
|
itemName: Nombre
|
||||||
create:
|
create:
|
||||||
name: Nombre
|
name: Nombre
|
||||||
tag: Etiqueta
|
tag: Etiqueta
|
||||||
|
|
|
@ -295,13 +295,11 @@ watch(
|
||||||
:user-filter="lineFilter"
|
:user-filter="lineFilter"
|
||||||
>
|
>
|
||||||
<template #column-image="{ row }">
|
<template #column-image="{ row }">
|
||||||
<div class="image-wrapper">
|
<VnImg
|
||||||
<VnImg
|
:id="parseInt(row?.item?.image)"
|
||||||
:id="parseInt(row?.item?.image)"
|
class="rounded"
|
||||||
class="rounded"
|
zoom-resolution="1600x900"
|
||||||
zoom-resolution="1600x900"
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<template #column-id="{ row }">
|
<template #column-id="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
|
@ -361,12 +359,6 @@ watch(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-wrapper {
|
|
||||||
height: 50px;
|
|
||||||
width: 50px;
|
|
||||||
margin-left: 30%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
color: $primary;
|
color: $primary;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
|
@ -91,7 +91,7 @@ const totalPrice = computed(() => {
|
||||||
const totalNewPrice = computed(() => {
|
const totalNewPrice = computed(() => {
|
||||||
return rows.value.reduce(
|
return rows.value.reduce(
|
||||||
(acc, item) => acc + item.component.newPrice * item.quantity,
|
(acc, item) => acc + item.component.newPrice * item.quantity,
|
||||||
0
|
0,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -210,18 +210,18 @@ onMounted(async () => {
|
||||||
flat
|
flat
|
||||||
>
|
>
|
||||||
<template #body-cell-item="{ row }">
|
<template #body-cell-item="{ row }">
|
||||||
<QTd @click.stop class="link">
|
<QTd align="center">
|
||||||
<QBtn flat>
|
<span @click.stop class="link">
|
||||||
{{ row.itemFk }}
|
{{ row.itemFk }}
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</QBtn>
|
</span>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-description="{ row }">
|
<template #body-cell-description="{ row }">
|
||||||
<QTd style="min-width: 120px; max-width: 120px">
|
<QTd style="min-width: 120px; max-width: 120px">
|
||||||
<div class="column q-pb-xs" style="min-width: 120px">
|
<div class="column q-pb-xs" style="min-width: 120px">
|
||||||
<span>{{ row.item.name }}</span>
|
<span>{{ row.item.name }}</span>
|
||||||
<FetchedTags :item="row.item" class="full-width" />
|
<FetchedTags :item="row.item" class="full-width" :columns="6" />
|
||||||
</div>
|
</div>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
|
|
||||||
import { useState } from 'src/composables/useState';
|
|
||||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
|
||||||
|
|
||||||
const emit = defineEmits(['onRequestCreated']);
|
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const { t } = useI18n();
|
|
||||||
const state = useState();
|
|
||||||
const user = state.getUser();
|
|
||||||
const stateFetchDataRef = ref(null);
|
|
||||||
const statesOptions = ref([]);
|
|
||||||
|
|
||||||
const onStateFkChange = (formData) => (formData.userFk = user.value.id);
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<FetchData
|
|
||||||
ref="stateFetchDataRef"
|
|
||||||
url="States"
|
|
||||||
auto-load
|
|
||||||
@on-fetch="(data) => (statesOptions = data)"
|
|
||||||
/>
|
|
||||||
<FormModelPopup
|
|
||||||
:title="t('Create tracking')"
|
|
||||||
url-create="Tickets/state"
|
|
||||||
model="CreateTicketTracking"
|
|
||||||
:form-initial-data="{ ticketFk: route.params.id }"
|
|
||||||
@on-data-saved="() => emit('onRequestCreated')"
|
|
||||||
>
|
|
||||||
<template #form-inputs="{ data }">
|
|
||||||
<VnRow>
|
|
||||||
<VnSelect
|
|
||||||
v-model="data.stateFk"
|
|
||||||
:label="t('ticketList.state')"
|
|
||||||
:options="statesOptions"
|
|
||||||
@update:model-value="onStateFkChange(data)"
|
|
||||||
hide-selected
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
/>
|
|
||||||
<VnSelectWorker v-model="data.userFk" :fields="['id', 'name']" />
|
|
||||||
</VnRow>
|
|
||||||
</template>
|
|
||||||
</FormModelPopup>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<i18n>
|
|
||||||
es:
|
|
||||||
Create tracking: Crear estado
|
|
||||||
</i18n>
|
|
|
@ -1,27 +1,23 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, watch, reactive } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import TicketCreateTracking from './TicketCreateTracking.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
import { toDateTimeFormat } from 'src/filters/date.js';
|
import { toDateTimeFormat } from 'src/filters/date.js';
|
||||||
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
const state = useState();
|
||||||
|
|
||||||
|
const user = state.getUser();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const createTrackingDialogRef = ref(null);
|
const tableRef = ref(null);
|
||||||
const paginateRef = ref(null);
|
const onStateFkChange = (formData) => (formData.userFk = user.value.id);
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.params.id,
|
|
||||||
async (val) => {
|
|
||||||
paginateFilter.where.ticketFk = val;
|
|
||||||
paginateRef.value.fetch();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const paginateFilter = reactive({
|
const paginateFilter = reactive({
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
|
@ -56,75 +52,68 @@ const columns = computed(() => [
|
||||||
name: 'state',
|
name: 'state',
|
||||||
field: 'state',
|
field: 'state',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
format: (val) => val.name,
|
format: (row) => row.state?.name,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('expedition.worker'),
|
label: t('expedition.worker'),
|
||||||
name: 'worker',
|
name: 'worker',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
field: 'user',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('expedition.created'),
|
label: t('expedition.created'),
|
||||||
name: 'created',
|
name: 'created',
|
||||||
field: 'created',
|
field: 'created',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
format: (val) => toDateTimeFormat(val),
|
format: ({ created }) => toDateTimeFormat(created),
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const openCreateModal = () => createTrackingDialogRef.value.show();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPage class="column items-center q-pa-md">
|
<VnTable
|
||||||
<VnPaginate
|
ref="tableRef"
|
||||||
ref="paginateRef"
|
:right-search="false"
|
||||||
data-key="TicketTracking"
|
:column-search="false"
|
||||||
:user-filter="paginateFilter"
|
:disable-option="{ card: true, table: true }"
|
||||||
search-url="table"
|
:search-url="false"
|
||||||
url="TicketTrackings"
|
:columns="columns"
|
||||||
auto-load
|
data-key="TicketTracking"
|
||||||
order="created DESC"
|
:user-filter="paginateFilter"
|
||||||
:limit="0"
|
url="TicketTrackings"
|
||||||
>
|
auto-load
|
||||||
<template #body="{ rows }">
|
order="created DESC"
|
||||||
<QTable
|
:limit="0"
|
||||||
:rows="rows"
|
:without-header="true"
|
||||||
:columns="columns"
|
:create="{
|
||||||
row-key="id"
|
urlCreate: 'Tickets/state',
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
title: t('Create tracking'),
|
||||||
class="full-width q-mt-md"
|
onDataSaved: () => tableRef.reload(),
|
||||||
:no-data-label="t('globals.noResults')"
|
formInitialData: {
|
||||||
>
|
ticketFk: route.params.id,
|
||||||
<template #body-cell-worker="{ row }">
|
},
|
||||||
<QTd>
|
}"
|
||||||
<QBtn flat class="link" @click.stop>
|
>
|
||||||
{{ row.user?.name }}
|
<template #more-create-dialog="{ data }">
|
||||||
<WorkerDescriptorProxy :id="row.user?.worker?.id" />
|
<VnSelect
|
||||||
</QBtn>
|
url="States"
|
||||||
</QTd>
|
v-model="data.stateFk"
|
||||||
</template>
|
:label="t('ticketList.state')"
|
||||||
</QTable>
|
auto-load
|
||||||
</template>
|
@update:model-value="onStateFkChange(data)"
|
||||||
</VnPaginate>
|
hide-selected
|
||||||
<QDialog
|
|
||||||
ref="createTrackingDialogRef"
|
|
||||||
transition-show="scale"
|
|
||||||
transition-hide="scale"
|
|
||||||
>
|
|
||||||
<TicketCreateTracking @on-request-created="paginateRef.fetch()" />
|
|
||||||
</QDialog>
|
|
||||||
<QPageSticky :offset="[20, 20]">
|
|
||||||
<QBtn
|
|
||||||
@click="openCreateModal()"
|
|
||||||
color="primary"
|
|
||||||
fab
|
|
||||||
icon="add"
|
|
||||||
v-shortcut="'+'"
|
|
||||||
/>
|
/>
|
||||||
<QTooltip class="text-no-wrap">
|
<VnSelectWorker v-model="data.userFk" :fields="['id', 'name']" />
|
||||||
{{ t('tracking.addState') }}
|
</template>
|
||||||
</QTooltip>
|
<template #column-worker="{ row }">
|
||||||
</QPageSticky>
|
<span class="link" @click.stop>
|
||||||
</QPage>
|
{{ row.user.name }}
|
||||||
|
<WorkerDescriptorProxy :id="row.user?.worker?.id" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Create tracking: Crear estado
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -134,7 +134,7 @@ onMounted(() => (stateStore.rightDrawer = true));
|
||||||
auto-load
|
auto-load
|
||||||
>
|
>
|
||||||
<template #column-itemFk="{ row }">
|
<template #column-itemFk="{ row }">
|
||||||
<span class="link">
|
<span class="link" @click.stop>
|
||||||
{{ row.itemFk }}
|
{{ row.itemFk }}
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -11,7 +11,7 @@ const $props = defineProps({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy>
|
<QPopupProxy data-cy="WorkerDescriptor">
|
||||||
<WorkerDescriptor
|
<WorkerDescriptor
|
||||||
v-if="$props.id"
|
v-if="$props.id"
|
||||||
:id="$props.id"
|
:id="$props.id"
|
||||||
|
|
|
@ -20,6 +20,7 @@ const { notify } = useNotify();
|
||||||
const loadingDocuware = ref(true);
|
const loadingDocuware = ref(true);
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const dialog = ref();
|
const dialog = ref();
|
||||||
|
const getAvailablePdaRef = ref();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const routeId = computed(() => route.params.id);
|
const routeId = computed(() => route.params.id);
|
||||||
|
@ -84,6 +85,7 @@ function reloadData() {
|
||||||
initialData.value.deviceProductionFk = null;
|
initialData.value.deviceProductionFk = null;
|
||||||
initialData.value.simFk = null;
|
initialData.value.simFk = null;
|
||||||
tableRef.value.reload();
|
tableRef.value.reload();
|
||||||
|
getAvailablePdaRef.value.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchDocuware() {
|
async function fetchDocuware() {
|
||||||
|
@ -135,6 +137,7 @@ async function deallocatePDA(deviceProductionFk) {
|
||||||
);
|
);
|
||||||
delete tableRef.value.CrudModelRef.formData[index];
|
delete tableRef.value.CrudModelRef.formData[index];
|
||||||
notify(t('PDA deallocated'), 'positive');
|
notify(t('PDA deallocated'), 'positive');
|
||||||
|
await getAvailablePdaRef.value.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSigned(row) {
|
function isSigned(row) {
|
||||||
|
@ -144,6 +147,7 @@ function isSigned(row) {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
ref="getAvailablePdaRef"
|
||||||
url="workers/getAvailablePda"
|
url="workers/getAvailablePda"
|
||||||
@on-fetch="(data) => (deviceProductions = data)"
|
@on-fetch="(data) => (deviceProductions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
|
|
|
@ -18,6 +18,8 @@ import { useState } from 'src/composables/useState';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
import VnSection from 'src/components/common/VnSection.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
import VnInputBic from 'src/components/common/VnInputBic.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
@ -161,16 +163,6 @@ function generateCodeUser(worker) {
|
||||||
|
|
||||||
if (!worker.companyFk) worker.companyFk = user.companyFk;
|
if (!worker.companyFk) worker.companyFk = user.companyFk;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function autofillBic(worker) {
|
|
||||||
if (!worker || !worker.iban) return;
|
|
||||||
|
|
||||||
let bankEntityId = parseInt(worker.iban.substr(4, 4));
|
|
||||||
let filter = { where: { id: bankEntityId } };
|
|
||||||
|
|
||||||
const { data } = await axios.get(`BankEntities`, { params: { filter } });
|
|
||||||
worker.bankEntityFk = data?.[0]?.id ?? undefined;
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -331,20 +323,14 @@ async function autofillBic(worker) {
|
||||||
(val) => !val && delete data.payMethodFk
|
(val) => !val && delete data.payMethodFk
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInputBic
|
||||||
|
:label="t('IBAN')"
|
||||||
v-model="data.iban"
|
v-model="data.iban"
|
||||||
:label="t('worker.create.iban')"
|
|
||||||
:disable="data.isFreelance"
|
:disable="data.isFreelance"
|
||||||
@update:model-value="autofillBic(data)"
|
@update-bic="
|
||||||
>
|
(bankEntityFk) => (data.bankEntityFk = bankEntityFk)
|
||||||
<template #append>
|
"
|
||||||
<QIcon name="info" class="cursor-info">
|
/>
|
||||||
<QTooltip>{{
|
|
||||||
t('components.iban_tooltip')
|
|
||||||
}}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</template>
|
|
||||||
</VnInput>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
|
@ -362,7 +348,6 @@ async function autofillBic(worker) {
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
:disable="data.isFreelance"
|
:disable="data.isFreelance"
|
||||||
@update:model-value="autofillBic(data)"
|
|
||||||
:filter-options="['bic', 'name']"
|
:filter-options="['bic', 'name']"
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
|
|
|
@ -11,7 +11,7 @@ const $props = defineProps({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QPopupProxy>
|
<QPopupProxy data-cy="ZoneDescriptor">
|
||||||
<ZoneDescriptor v-if="$props.id" :id="$props.id" :summary="ZoneSummary" />
|
<ZoneDescriptor v-if="$props.id" :id="$props.id" :summary="ZoneSummary" />
|
||||||
</QPopupProxy>
|
</QPopupProxy>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -44,7 +44,7 @@ export async function findImports(targetFile, visited = new Set(), identation =
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return getUniques(fullTree); // Remove duplicates
|
return getUniques([...fullTree, targetFile]); // Remove duplicates
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUniques(array) {
|
function getUniques(array) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ async function getChangedModules() {
|
||||||
if (change.startsWith(E2E_PATH)) changedArray.push(change);
|
if (change.startsWith(E2E_PATH)) changedArray.push(change);
|
||||||
changedModules = new Set(changedArray);
|
changedModules = new Set(changedArray);
|
||||||
}
|
}
|
||||||
return [...changedModules].join('\n');
|
return cleanSpecs(changedModules).join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
getChangedModules()
|
getChangedModules()
|
||||||
|
@ -34,3 +34,20 @@ getChangedModules()
|
||||||
console.error(e);
|
console.error(e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function cleanSpecs(changedModules) {
|
||||||
|
let specifics = [];
|
||||||
|
const modules = [];
|
||||||
|
for (const changed of changedModules) {
|
||||||
|
if (changed.endsWith('*.spec.js')) {
|
||||||
|
modules.push(changed);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
specifics.push(changed);
|
||||||
|
}
|
||||||
|
specifics = specifics.filter(
|
||||||
|
(spec) => !modules.some((module) => spec.startsWith(module.split('**')[0])),
|
||||||
|
);
|
||||||
|
|
||||||
|
return [...modules, ...specifics];
|
||||||
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
describe('InvoiceInList', () => {
|
describe('InvoiceInList', () => {
|
||||||
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
|
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
|
||||||
const firstId = `${firstRow} > td:nth-child(2) span`;
|
const firstId = `${firstRow} > td:nth-child(2) span`;
|
||||||
const firstDetailBtn = `${firstRow} .q-btn:nth-child(1)`;
|
const invoiceId = '6';
|
||||||
const summaryHeaders = (opt) => `.summaryBody > .${opt} > .q-pb-lg > .header-link`;
|
const summaryHeaders = (opt) => `.summaryBody > .${opt} > .q-pb-lg > .header-link`;
|
||||||
const mockInvoiceRef = `createMockInvoice${Math.floor(Math.random() * 100)}`;
|
const mockInvoiceRef = `createMockInvoice${Math.floor(Math.random() * 100)}`;
|
||||||
const mock = {
|
const mock = {
|
||||||
|
@ -31,7 +31,13 @@ describe('InvoiceInList', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open the details', () => {
|
it('should open the details', () => {
|
||||||
cy.get(firstDetailBtn).click();
|
cy.get('[data-col-field="id"]').then(($cells) => {
|
||||||
|
const exactMatch = [...$cells].find(
|
||||||
|
(cell) => cell.textContent.trim() === invoiceId,
|
||||||
|
);
|
||||||
|
expect(exactMatch).to.exist;
|
||||||
|
cy.wrap(exactMatch).closest('tr').find('.q-btn:nth-child(1)').click();
|
||||||
|
});
|
||||||
cy.get(summaryHeaders('max-width')).contains('Basic data');
|
cy.get(summaryHeaders('max-width')).contains('Basic data');
|
||||||
cy.get(summaryHeaders('vat')).contains('Vat');
|
cy.get(summaryHeaders('vat')).contains('Vat');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
function goTo(n = 1) {
|
|
||||||
return `.q-virtual-scroll__content > :nth-child(${n})`;
|
|
||||||
}
|
|
||||||
const firstRow = goTo();
|
|
||||||
describe('Handle Items FixedPrice', () => {
|
describe('Handle Items FixedPrice', () => {
|
||||||
|
const grouping = 'Grouping price';
|
||||||
|
const saveEditBtn = '.q-mt-lg > .q-btn--standard';
|
||||||
|
const createForm = {
|
||||||
|
'Grouping price': { val: '5' },
|
||||||
|
'Packing price': { val: '5' },
|
||||||
|
Started: { val: '01-01-2001', type: 'date' },
|
||||||
|
Ended: { val: '15-01-2001', type: 'date' },
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.viewport(1280, 720);
|
cy.viewport(1280, 720);
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
|
@ -13,50 +18,57 @@ describe('Handle Items FixedPrice', () => {
|
||||||
'.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon',
|
'.q-header > .q-toolbar > :nth-child(1) > .q-btn__content > .q-icon',
|
||||||
).click();
|
).click();
|
||||||
});
|
});
|
||||||
it.skip('filter', function () {
|
|
||||||
|
it('filter by category', () => {
|
||||||
cy.get('.category-filter > :nth-child(1) > .q-btn__content > .q-icon').click();
|
cy.get('.category-filter > :nth-child(1) > .q-btn__content > .q-icon').click();
|
||||||
cy.selectOption('.list > :nth-child(2)', 'Alstroemeria');
|
cy.get('.q-table__middle').should('be.visible').should('have.length', 1);
|
||||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
|
||||||
|
|
||||||
cy.addBtnClick();
|
|
||||||
cy.selectOption(`${firstRow} > :nth-child(2)`, '#13');
|
|
||||||
cy.get(`${firstRow} > :nth-child(4)`).find('input').type(1);
|
|
||||||
cy.get(`${firstRow} > :nth-child(5)`).find('input').type('2');
|
|
||||||
cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One');
|
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
|
||||||
/* ==== End Cypress Studio ==== */
|
|
||||||
});
|
|
||||||
it.skip('Create and delete ', function () {
|
|
||||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
|
||||||
cy.addBtnClick();
|
|
||||||
cy.selectOption(`${firstRow} > :nth-child(2)`, '#11');
|
|
||||||
cy.get(`${firstRow} > :nth-child(4)`).type('1');
|
|
||||||
cy.get(`${firstRow} > :nth-child(5)`).type('2');
|
|
||||||
cy.selectOption(`${firstRow} > :nth-child(9)`, 'Warehouse One');
|
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
|
||||||
cy.get('.q-gutter-x-sm > .q-btn > .q-btn__content > .q-icon').click();
|
|
||||||
cy.get(`${firstRow} > .text-right > .q-btn > .q-btn__content > .q-icon`).click();
|
|
||||||
cy.get(
|
|
||||||
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
|
|
||||||
).click();
|
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('Massive edit', function () {
|
it('should create a new fixed price, then delete it', () => {
|
||||||
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
|
cy.dataCy('vnTableCreateBtn').click();
|
||||||
cy.get('#subToolbar > .q-btn--standard').click();
|
cy.dataCy('FixedPriceCreateNameSelect').type('Melee weapon combat fist 15cm');
|
||||||
cy.selectOption("[data-cy='field-to-edit']", 'Min price');
|
cy.get('.q-menu .q-item').contains('Melee weapon combat fist 15cm').click();
|
||||||
cy.dataCy('value-to-edit').find('input').type('1');
|
cy.dataCy('FixedPriceCreateWarehouseSelect').type('Warehouse One');
|
||||||
cy.get('.countLines').should('have.text', ' 1 ');
|
cy.get('.q-menu .q-item').contains('Warehouse One').click();
|
||||||
cy.get('.q-mt-lg > .q-btn--standard').click();
|
cy.get('.q-menu').then(($menu) => {
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
if ($menu.is(':visible')) {
|
||||||
|
cy.dataCy('FixedPriceCreateWarehouseSelect').as('focusedElement').focus();
|
||||||
|
cy.dataCy('FixedPriceCreateWarehouseSelect').blur();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cy.fillInForm(createForm);
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
|
cy.checkNotification('Data created');
|
||||||
|
cy.get('[data-col-field="name"]').each(($el) => {
|
||||||
|
cy.wrap($el)
|
||||||
|
.invoke('text')
|
||||||
|
.then((text) => {
|
||||||
|
if (text.includes('Melee weapon combat fist 15cm')) {
|
||||||
|
cy.wrap($el).parent().find('.q-checkbox').click();
|
||||||
|
cy.get('[data-cy="crudModelDefaultRemoveBtn"]').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click().click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it.skip('Massive remove', function () {
|
|
||||||
cy.get(' .bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner ').click();
|
it('should edit all items', () => {
|
||||||
cy.get('#subToolbar > .q-btn--flat').click();
|
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
|
||||||
cy.get(
|
cy.dataCy('FixedPriceToolbarEditBtn').should('not.be.disabled');
|
||||||
'.q-card__actions > .q-btn--unelevated > .q-btn__content > .block',
|
cy.dataCy('FixedPriceToolbarEditBtn').click();
|
||||||
).click();
|
cy.dataCy('EditFixedPriceSelectOption').type(grouping);
|
||||||
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
cy.get('.q-menu .q-item').contains(grouping).click();
|
||||||
|
cy.dataCy('EditFixedPriceValueOption').type('5');
|
||||||
|
cy.get(saveEditBtn).click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should remove all items', () => {
|
||||||
|
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
|
||||||
|
cy.dataCy('crudModelDefaultRemoveBtn').should('not.be.disabled');
|
||||||
|
cy.dataCy('crudModelDefaultRemoveBtn').click();
|
||||||
|
cy.dataCy('VnConfirm_confirm').click();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,6 +19,7 @@ describe('Item summary', () => {
|
||||||
cy.get('.q-menu > .q-list > :nth-child(1) > .q-item__section').click();
|
cy.get('.q-menu > .q-list > :nth-child(1) > .q-item__section').click();
|
||||||
cy.dataCy('regularizeStockInput').type('10');
|
cy.dataCy('regularizeStockInput').type('10');
|
||||||
cy.dataCy('Warehouse_select').type('Warehouse One{enter}');
|
cy.dataCy('Warehouse_select').type('Warehouse One{enter}');
|
||||||
|
cy.dataCy('FormModelPopup_save').click();
|
||||||
cy.checkNotification('Data created');
|
cy.checkNotification('Data created');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
describe('Route extended list', () => {
|
describe.skip('Route extended list', () => {
|
||||||
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
|
const getSelector = (colField) => `tr:last-child > [data-col-field="${colField}"]`;
|
||||||
|
|
||||||
const selectors = {
|
const selectors = {
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketBasicData', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/basic-data');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should redirect to customer basic data', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
cy.get(':nth-child(2) > div > .text-primary').click();
|
||||||
|
cy.dataCy('Address_select').click();
|
||||||
|
cy.get('.q-btn-group ').find('.q-btn__content > .q-icon').click();
|
||||||
|
cy.get(
|
||||||
|
'[data-cy="CustomerBasicData-menu-item"] > .q-item__section--main',
|
||||||
|
).click();
|
||||||
|
cy.url().should('include', '/customer/1104/basic-data');
|
||||||
|
});
|
||||||
|
it.only('stepper', () => {
|
||||||
|
cy.get('.q-stepper__tab--active').should('have.class', 'q-stepper__tab--active');
|
||||||
|
|
||||||
|
cy.get('.q-stepper__nav > .q-btn--standard').click();
|
||||||
|
cy.get('.q-stepper__tab--done').should('have.class', 'q-stepper__tab--done');
|
||||||
|
cy.get('.q-stepper__tab--active').should('have.class', 'q-stepper__tab--active');
|
||||||
|
cy.get('tr:nth-child(1)>:nth-child(1)>span').should('have.class', 'link').click();
|
||||||
|
cy.dataCy('ItemDescriptor').should('exist');
|
||||||
|
|
||||||
|
cy.get('.q-drawer__content > :nth-child(1)').each(() => {
|
||||||
|
cy.get('span').should('contain.text', 'Price: €');
|
||||||
|
cy.get('span').should('contain.text', 'New price: €');
|
||||||
|
cy.get('span').should('contain.text', 'Difference: €');
|
||||||
|
});
|
||||||
|
cy.get(
|
||||||
|
':nth-child(3) > .q-radio > .q-radio__inner > .q-radio__bg > .q-radio__check',
|
||||||
|
).should('have.class', 'q-radio__check');
|
||||||
|
cy.get(
|
||||||
|
'.q-stepper__step-inner > .q-drawer-container > .q-drawer > .q-drawer__content',
|
||||||
|
).click();
|
||||||
|
cy.get(':nth-child(2) > :nth-child(1) > .text-weight-bold').click();
|
||||||
|
cy.get(':nth-child(3) > .q-radio > .q-radio__inner').should(
|
||||||
|
'have.class',
|
||||||
|
'q-radio__inner--truthy',
|
||||||
|
);
|
||||||
|
cy.get('.q-drawer__content > :nth-child(2)').click();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,30 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
describe('TicketComponents', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/1/components');
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
cy.validateScrollContent([
|
||||||
|
{ row: 2, col: 2, text: 'Base to commission: €799.20' },
|
||||||
|
{ row: 2, col: 3, text: 'Total without VAT: €807.20' },
|
||||||
|
{ row: 3, col: 2, text: 'valor de compra: €425.000' },
|
||||||
|
{ row: 3, col: 4, text: 'maná auto: €7.998' },
|
||||||
|
{ row: 4, col: 2, text: 'Price: €5.00' },
|
||||||
|
{ row: 4, col: 3, text: 'Bonus: €1.00' },
|
||||||
|
{ row: 4, col: 5, text: 'Packages: 6' },
|
||||||
|
{ row: 4, col: 4, text: 'Zone: Zone pickup A ' },
|
||||||
|
{ row: 5, col: 2, text: 'Total price: €16.00' },
|
||||||
|
]);
|
||||||
|
cy.get(':nth-child(4) > .link').click();
|
||||||
|
|
||||||
|
cy.dataCy('ZoneDescriptor').should('exist');
|
||||||
|
cy.getRowCol('total').should('have.text', '€250.000€247.000€4.970');
|
||||||
|
cy.getRowCol('import').should('have.text', '€50.000€49.400€0.994');
|
||||||
|
cy.getRowCol('components').should('have.text', 'valor de compramargenmaná auto');
|
||||||
|
cy.getRowCol('serie').should('have.text', 'costeempresacartera_comercial');
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,7 +1,5 @@
|
||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
describe('TicketList', () => {
|
describe('TicketList', () => {
|
||||||
const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)';
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
|
@ -11,7 +9,7 @@ describe('TicketList', () => {
|
||||||
const searchResults = (search) => {
|
const searchResults = (search) => {
|
||||||
if (search) cy.typeSearchbar().type(search);
|
if (search) cy.typeSearchbar().type(search);
|
||||||
cy.dataCy('vn-searchbar').find('input').type('{enter}');
|
cy.dataCy('vn-searchbar').find('input').type('{enter}');
|
||||||
cy.get(firstRow).should('exist');
|
cy.getRow().should('exist');
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should search results', () => {
|
it('should search results', () => {
|
||||||
|
@ -24,13 +22,13 @@ describe('TicketList', () => {
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
cy.stub(win, 'open').as('windowOpen');
|
cy.stub(win, 'open').as('windowOpen');
|
||||||
});
|
});
|
||||||
cy.get(firstRow).should('be.visible').find('.q-btn:first').click();
|
cy.getRow().should('be.visible').find('.q-btn:first').click();
|
||||||
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should open ticket summary', () => {
|
it('should open ticket summary', () => {
|
||||||
searchResults();
|
searchResults();
|
||||||
cy.get(firstRow).find('.q-btn:last').click();
|
cy.getRow().find('.q-btn:last').click();
|
||||||
cy.get('.summaryHeader').should('exist');
|
cy.get('.summaryHeader').should('exist');
|
||||||
cy.get('.summaryBody').should('exist');
|
cy.get('.summaryBody').should('exist');
|
||||||
});
|
});
|
||||||
|
@ -43,8 +41,9 @@ describe('TicketList', () => {
|
||||||
cy.dataCy('Customer ID_input').clear('1');
|
cy.dataCy('Customer ID_input').clear('1');
|
||||||
cy.dataCy('Customer ID_input').type('1101{enter}');
|
cy.dataCy('Customer ID_input').type('1101{enter}');
|
||||||
|
|
||||||
cy.get('[data-cy="vnTableCreateBtn"] > .q-btn__content > .q-icon').click();
|
cy.intercept('GET', /\/api\/Clients\?filter/).as('clientFilter');
|
||||||
cy.waitSpinner();
|
cy.vnTableCreateBtn();
|
||||||
|
cy.wait('@clientFilter');
|
||||||
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
|
cy.dataCy('Customer_select').should('have.value', 'Bruce Wayne');
|
||||||
cy.dataCy('Address_select').click();
|
cy.dataCy('Address_select').click();
|
||||||
|
|
||||||
|
@ -52,8 +51,7 @@ describe('TicketList', () => {
|
||||||
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
|
cy.dataCy('Address_select').should('have.value', 'Bruce Wayne');
|
||||||
});
|
});
|
||||||
it('Client list create new ticket', () => {
|
it('Client list create new ticket', () => {
|
||||||
cy.dataCy('vnTableCreateBtn').should('exist');
|
cy.vnTableCreateBtn();
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
|
||||||
const data = {
|
const data = {
|
||||||
Customer: { val: 1, type: 'select' },
|
Customer: { val: 1, type: 'select' },
|
||||||
Warehouse: { val: 'Warehouse One', type: 'select' },
|
Warehouse: { val: 'Warehouse One', type: 'select' },
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('TicketNotes', () => {
|
||||||
cy.checkNotification('Data saved');
|
cy.checkNotification('Data saved');
|
||||||
cy.dataCy('ticketNotesRemoveNoteBtn').should('exist');
|
cy.dataCy('ticketNotesRemoveNoteBtn').should('exist');
|
||||||
cy.dataCy('ticketNotesRemoveNoteBtn').click();
|
cy.dataCy('ticketNotesRemoveNoteBtn').click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.confirmVnConfirm();
|
||||||
cy.checkNotification('Data saved');
|
cy.checkNotification('Data saved');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketPackages', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/package');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
cy.get('.vn-row > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
|
cy.dataCy('Package_select').click();
|
||||||
|
cy.get('.q-menu :nth-child(1) >.q-item__section').click();
|
||||||
|
cy.dataCy('Quantity_input').clear().type('5');
|
||||||
|
cy.saveCrudModel();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
cy.get('.q-mb-md > .text-primary').click();
|
||||||
|
cy.confirmVnConfirm();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,18 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketPictures', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/picture');
|
||||||
|
});
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get(':nth-child(1) > .q-card > .content').should('be.visible');
|
||||||
|
cy.get('.content > .link').should('be.visible').click();
|
||||||
|
cy.dataCy('ItemDescriptor').should('exist');
|
||||||
|
cy.dataCy('vnLvColor:');
|
||||||
|
cy.dataCy('vnLvColor:');
|
||||||
|
cy.dataCy('vnLvTallos:');
|
||||||
|
cy.get('.q-mt-md').should('be.visible');
|
||||||
|
cy.get(':nth-child(1) > .q-card > .img-wrapper').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
|
@ -7,8 +7,7 @@ describe('TicketRequest', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Creates a new request', () => {
|
it('Creates a new request', () => {
|
||||||
cy.dataCy('vnTableCreateBtn').should('exist');
|
cy.vnTableCreateBtn();
|
||||||
cy.dataCy('vnTableCreateBtn').click();
|
|
||||||
const data = {
|
const data = {
|
||||||
Description: { val: 'Purchase description' },
|
Description: { val: 'Purchase description' },
|
||||||
Atender: { val: 'buyerNick', type: 'select' },
|
Atender: { val: 'buyerNick', type: 'select' },
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
const firstRow = 'tbody > :nth-child(1)';
|
const firstRow = 'tbody > :nth-child(1)';
|
||||||
|
|
||||||
describe('TicketSale', () => {
|
describe('TicketSale', () => {
|
||||||
describe('Ticket #23', () => {
|
describe('#23', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('salesBoss');
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
cy.visit('/#/ticket/23/sale');
|
cy.visit('/#/ticket/23/sale');
|
||||||
});
|
});
|
||||||
|
@ -16,10 +16,12 @@ describe('TicketSale', () => {
|
||||||
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
||||||
cy.dataCy('ticketEditManaProxy').should('exist');
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||||
cy.waitForElement('[data-cy="Price_input"]');
|
cy.waitForElement('[data-cy="Price_input"]');
|
||||||
cy.dataCy('Price_input').clear();
|
cy.dataCy('Price_input').clear().type(price);
|
||||||
cy.dataCy('Price_input').type(price);
|
cy.intercept('POST', /\/api\/Sales\/\d+\/updatePrice/).as('updatePrice');
|
||||||
|
|
||||||
cy.dataCy('saveManaBtn').click();
|
cy.dataCy('saveManaBtn').click();
|
||||||
handleVnConfirm();
|
handleVnConfirm();
|
||||||
|
cy.wait('@updatePrice').its('response.statusCode').should('eq', 200);
|
||||||
|
|
||||||
cy.get('[data-col-field="price"]')
|
cy.get('[data-col-field="price"]')
|
||||||
.find('.q-btn > .q-btn__content')
|
.find('.q-btn > .q-btn__content')
|
||||||
|
@ -32,10 +34,14 @@ describe('TicketSale', () => {
|
||||||
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
cy.waitForElement('[data-cy="ticketEditManaProxy"]');
|
||||||
cy.dataCy('ticketEditManaProxy').should('exist');
|
cy.dataCy('ticketEditManaProxy').should('exist');
|
||||||
cy.waitForElement('[data-cy="Disc_input"]');
|
cy.waitForElement('[data-cy="Disc_input"]');
|
||||||
cy.dataCy('Disc_input').clear();
|
cy.dataCy('Disc_input').clear().type(discount);
|
||||||
cy.dataCy('Disc_input').type(discount);
|
cy.intercept('POST', /\/api\/Tickets\/\d+\/updateDiscount/).as(
|
||||||
|
'updateDiscount',
|
||||||
|
);
|
||||||
|
|
||||||
cy.dataCy('saveManaBtn').click();
|
cy.dataCy('saveManaBtn').click();
|
||||||
handleVnConfirm();
|
handleVnConfirm();
|
||||||
|
cy.wait('@updateDiscount').its('response.statusCode').should('eq', 204);
|
||||||
|
|
||||||
cy.get('[data-col-field="discount"]')
|
cy.get('[data-col-field="discount"]')
|
||||||
.find('.q-btn > .q-btn__content')
|
.find('.q-btn > .q-btn__content')
|
||||||
|
@ -46,6 +52,8 @@ describe('TicketSale', () => {
|
||||||
const concept = Math.floor(Math.random() * 100) + 1;
|
const concept = Math.floor(Math.random() * 100) + 1;
|
||||||
cy.waitForElement(firstRow);
|
cy.waitForElement(firstRow);
|
||||||
cy.get('[data-col-field="item"]').click();
|
cy.get('[data-col-field="item"]').click();
|
||||||
|
cy.intercept('POST', '**/api').as('postRequest');
|
||||||
|
|
||||||
cy.get('.q-menu')
|
cy.get('.q-menu')
|
||||||
.find('[data-cy="undefined_input"]')
|
.find('[data-cy="undefined_input"]')
|
||||||
.type(concept)
|
.type(concept)
|
||||||
|
@ -58,6 +66,8 @@ describe('TicketSale', () => {
|
||||||
const quantity = Math.floor(Math.random() * 100) + 1;
|
const quantity = Math.floor(Math.random() * 100) + 1;
|
||||||
cy.waitForElement(firstRow);
|
cy.waitForElement(firstRow);
|
||||||
cy.dataCy('ticketSaleQuantityInput').find('input').clear();
|
cy.dataCy('ticketSaleQuantityInput').find('input').clear();
|
||||||
|
cy.intercept('POST', '**/api').as('postRequest');
|
||||||
|
|
||||||
cy.dataCy('ticketSaleQuantityInput')
|
cy.dataCy('ticketSaleQuantityInput')
|
||||||
.find('input')
|
.find('input')
|
||||||
.type(quantity)
|
.type(quantity)
|
||||||
|
@ -71,7 +81,7 @@ describe('TicketSale', () => {
|
||||||
.should('have.value', `${quantity}`);
|
.should('have.value', `${quantity}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Ticket to add claim #24', () => {
|
describe('#24 add claim', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
|
@ -82,15 +92,15 @@ describe('TicketSale', () => {
|
||||||
selectFirstRow();
|
selectFirstRow();
|
||||||
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
cy.dataCy('createClaimItem').click();
|
cy.dataCy('createClaimItem').click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.confirmVnConfirm();
|
||||||
cy.url().should('contain', 'claim/');
|
cy.url().should('contain', 'claim/');
|
||||||
// Delete created claim to avoid cluttering the database
|
// Delete created claim to avoid cluttering the database
|
||||||
cy.dataCy('descriptor-more-opts').click();
|
cy.dataCy('descriptor-more-opts').click();
|
||||||
cy.dataCy('deleteClaim').click();
|
cy.dataCy('deleteClaim').click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.confirmVnConfirm();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Free ticket #31', () => {
|
describe('#31 free ticket', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
|
@ -129,7 +139,9 @@ describe('TicketSale', () => {
|
||||||
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
|
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update discount when "Update discount" is clicked', () => {
|
it.only('should update discount when "Update discount" is clicked', () => {
|
||||||
|
const discount = Number((Math.random() * 99 + 1).toFixed(2));
|
||||||
|
|
||||||
selectFirstRow();
|
selectFirstRow();
|
||||||
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
cy.waitForElement('[data-cy="updateDiscountItem"]');
|
cy.waitForElement('[data-cy="updateDiscountItem"]');
|
||||||
|
@ -137,9 +149,13 @@ describe('TicketSale', () => {
|
||||||
cy.dataCy('updateDiscountItem').click();
|
cy.dataCy('updateDiscountItem').click();
|
||||||
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
|
cy.waitForElement('[data-cy="ticketSaleDiscountInput"]');
|
||||||
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
|
cy.dataCy('ticketSaleDiscountInput').find('input').focus();
|
||||||
cy.dataCy('ticketSaleDiscountInput').find('input').type('10');
|
cy.intercept('POST', /\/api\/Tickets\/\d+\/updateDiscount/).as(
|
||||||
|
'updateDiscount',
|
||||||
|
);
|
||||||
|
cy.dataCy('ticketSaleDiscountInput').find('input').type(discount);
|
||||||
|
|
||||||
cy.dataCy('saveManaBtn').click();
|
cy.dataCy('saveManaBtn').click();
|
||||||
cy.waitForElement('.q-notification__message');
|
cy.wait('@updateDiscount').its('response.statusCode').should('eq', 204);
|
||||||
cy.checkNotification('Data saved');
|
cy.checkNotification('Data saved');
|
||||||
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
|
cy.dataCy('ticketSaleMoreActionsDropdown').should('be.disabled');
|
||||||
});
|
});
|
||||||
|
@ -148,7 +164,7 @@ describe('TicketSale', () => {
|
||||||
selectFirstRow();
|
selectFirstRow();
|
||||||
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
cy.dataCy('ticketSaleMoreActionsDropdown').click();
|
||||||
cy.dataCy('createClaimItem').click();
|
cy.dataCy('createClaimItem').click();
|
||||||
cy.dataCy('VnConfirm_confirm').click();
|
cy.confirmVnConfirm();
|
||||||
cy.checkNotification('Future ticket date not allowed');
|
cy.checkNotification('Future ticket date not allowed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -173,7 +189,7 @@ describe('TicketSale', () => {
|
||||||
cy.url().should('match', /\/ticket\/31\/log/);
|
cy.url().should('match', /\/ticket\/31\/log/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Ticket to transfer #32', () => {
|
describe('#32 transfer', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.viewport(1920, 1080);
|
cy.viewport(1920, 1080);
|
||||||
|
@ -194,9 +210,7 @@ function selectFirstRow() {
|
||||||
cy.get(firstRow).find('.q-checkbox__inner').click();
|
cy.get(firstRow).find('.q-checkbox__inner').click();
|
||||||
}
|
}
|
||||||
function handleVnConfirm() {
|
function handleVnConfirm() {
|
||||||
cy.get('[data-cy="VnConfirm_confirm"]').click();
|
cy.confirmVnConfirm();
|
||||||
cy.waitForElement('.q-notification__message');
|
|
||||||
|
|
||||||
cy.get('.q-notification__message').should('be.visible');
|
|
||||||
cy.checkNotification('Data saved');
|
cy.checkNotification('Data saved');
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
function uncheckedSVG(className, state) {
|
||||||
|
cy.get(`${className} .q-checkbox__svg`).should(
|
||||||
|
state === 'checked' ? 'not.have.attr' : 'have.attr',
|
||||||
|
'fill',
|
||||||
|
'none',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function checkedSVG(className, state) {
|
||||||
|
cy.get(`${className} .q-checkbox__svg> .q-checkbox__truthy`).should(
|
||||||
|
state === 'checked' ? 'not.have.attr' : 'have.attr',
|
||||||
|
'fill',
|
||||||
|
'none',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clickIconAndCloseDialog(n) {
|
||||||
|
cy.get(
|
||||||
|
`:nth-child(1) > :nth-child(6) > :nth-child(${n}) > .q-btn__content > .q-icon`,
|
||||||
|
).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('TicketSaleTracking', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/1/sale-tracking');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
// Check checkbox states
|
||||||
|
uncheckedSVG('.pink', 'checked');
|
||||||
|
uncheckedSVG('.cyan', 'checked');
|
||||||
|
uncheckedSVG('.warning', 'checked');
|
||||||
|
uncheckedSVG('.info', 'checked');
|
||||||
|
checkedSVG('.yellow', 'unchecked');
|
||||||
|
|
||||||
|
cy.get('.q-page').click();
|
||||||
|
cy.get(
|
||||||
|
':nth-child(1) > :nth-child(6) > :nth-child(2) > .q-btn__content > .q-icon',
|
||||||
|
).click();
|
||||||
|
cy.get('body').type('{esc}');
|
||||||
|
cy.get(
|
||||||
|
':nth-child(1) > :nth-child(6) > :nth-child(1) > .q-btn__content > .q-icon',
|
||||||
|
).click();
|
||||||
|
cy.get(
|
||||||
|
'.q-dialog__inner > .q-table__container :nth-child(1) > :nth-child(2) .link.q-btn',
|
||||||
|
).click();
|
||||||
|
|
||||||
|
cy.dataCy('WorkerDescriptor').should('exist');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,23 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketService', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/service');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Add and remove service', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
cy.addBtnClick();
|
||||||
|
cy.dataCy('Description_icon').click();
|
||||||
|
cy.dataCy('Description_input').clear().type('test');
|
||||||
|
cy.saveFormModel();
|
||||||
|
cy.selectOption('[data-cy="Description_select"]', 'test');
|
||||||
|
|
||||||
|
cy.dataCy('Quantity_input').clear().type('1');
|
||||||
|
cy.dataCy('Price_input').clear().type('2');
|
||||||
|
cy.saveCrudModel();
|
||||||
|
cy.checkNotification('Data saved');
|
||||||
|
cy.get(':nth-child(5) > .q-icon').click();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,22 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('TicketSms', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/32/sms');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should load layout', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
cy.get('.q-infinite-scroll > :nth-child(1)').should(
|
||||||
|
'contain.text',
|
||||||
|
'0004 444444444Lorem ipsum dolor sit amet, consectetur adipiscing elit.2001-01-01 00:00:00OK',
|
||||||
|
);
|
||||||
|
cy.get(
|
||||||
|
':nth-child(1) > .q-item > .q-item__section--top > .column > .q-avatar',
|
||||||
|
).should('be.visible');
|
||||||
|
cy.get(
|
||||||
|
':nth-child(1) > .q-item > .q-item__section--side.justify-center > .center > .q-chip > .q-chip__content',
|
||||||
|
).should('have.class', 'q-chip__content');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,25 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('Ticket tracking', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/31/tracking');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Add new tracking', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
|
||||||
|
cy.getRowCol('worker').find('span').should('have.class', 'link').click();
|
||||||
|
cy.dataCy('WorkerDescriptor').should('exist');
|
||||||
|
cy.vnTableCreateBtn();
|
||||||
|
cy.selectOption('.q-field--float [data-cy="State_select"]', 'OK').click();
|
||||||
|
cy.saveFormModel();
|
||||||
|
cy.get(
|
||||||
|
':last-child > [data-col-field="state"] > [data-cy="vnTableCell_state"]',
|
||||||
|
).should('have.text', 'OK');
|
||||||
|
cy.get(':last-child > [data-col-field="worker"]').should(
|
||||||
|
'have.text',
|
||||||
|
'developer ',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,27 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
function checkRightLabel(index, value, tag = 'Volume: ') {
|
||||||
|
cy.get(`.q-scrollarea__content > :nth-child(${index}) > :nth-child(2) > span`)
|
||||||
|
.should('be.visible')
|
||||||
|
.should('have.text', `${tag}${value}`);
|
||||||
|
}
|
||||||
|
describe('TicketVolume', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.viewport(1920, 1080);
|
||||||
|
cy.visit('/#/ticket/1/volume');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Check right panel info', () => {
|
||||||
|
cy.get('.q-page').should('be.visible');
|
||||||
|
checkRightLabel(2, '0.028');
|
||||||
|
checkRightLabel(3, '0.014');
|
||||||
|
checkRightLabel(4, '1.526');
|
||||||
|
});
|
||||||
|
it('Descriptors', () => {
|
||||||
|
cy.get(':nth-child(1) > [data-col-field="itemFk"]')
|
||||||
|
.find('span')
|
||||||
|
.should('have.class', 'link')
|
||||||
|
.click();
|
||||||
|
cy.dataCy('ItemDescriptor').should('exist');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,3 @@
|
||||||
|
Cypress.Commands.add('saveCrudModel', () =>
|
||||||
|
cy.dataCy('crudModelDefaultSaveBtn').should('exist').click(),
|
||||||
|
);
|
|
@ -0,0 +1,3 @@
|
||||||
|
Cypress.Commands.add('saveFormModel', () =>
|
||||||
|
cy.dataCy('FormModelPopup_save').should('exist').click(),
|
||||||
|
);
|
|
@ -0,0 +1,3 @@
|
||||||
|
Cypress.Commands.add('confirmVnConfirm', () =>
|
||||||
|
cy.dataCy('VnConfirm_confirm').should('exist').click(),
|
||||||
|
);
|
|
@ -0,0 +1,3 @@
|
||||||
|
Cypress.Commands.add('clickOption', (index = 1) =>
|
||||||
|
cy.get(`.q-menu :nth-child(${index}) >.q-item__section`).click(),
|
||||||
|
);
|
|
@ -0,0 +1,16 @@
|
||||||
|
Cypress.Commands.add('getRow', (index = 1) =>
|
||||||
|
cy.get(`.vnTable .q-virtual-scroll__content tr:nth-child(${index})`),
|
||||||
|
);
|
||||||
|
Cypress.Commands.add('getRowCol', (field, index = 1) =>
|
||||||
|
cy.get(
|
||||||
|
`.vnTable .q-virtual-scroll__content > :nth-child(${index}) > [data-col-field="${field}"]`,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
Cypress.Commands.add('vnTableCreateBtn', () =>
|
||||||
|
cy.dataCy('vnTableCreateBtn').should('exist').click(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Cypress.Commands.add('waitTableScrollLoad', () =>
|
||||||
|
cy.waitForElement('[data-q-vs-anchor]'),
|
||||||
|
);
|
|
@ -29,7 +29,12 @@
|
||||||
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
|
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import waitUntil from './waitUntil';
|
import waitUntil from './waitUntil';
|
||||||
|
// Importar dinámicamente todos los archivos con el sufijo .commands.js dentro de la carpeta src/test/cypress/integration
|
||||||
|
const requireCommands = require.context('../integration', true, /\.commands\.js$/);
|
||||||
|
// Iterar sobre cada archivo y requerirlo
|
||||||
|
requireCommands.keys().forEach(requireCommands);
|
||||||
|
|
||||||
|
// Common comma
|
||||||
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
|
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
|
||||||
|
|
||||||
Cypress.Commands.add('resetDB', () => {
|
Cypress.Commands.add('resetDB', () => {
|
||||||
|
@ -606,6 +611,11 @@ Cypress.Commands.add('checkQueryParams', (expectedParams = {}) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('waitTableScrollLoad', () =>
|
Cypress.Commands.add('validateScrollContent', (validations) => {
|
||||||
cy.waitForElement('[data-q-vs-anchor]'),
|
validations.forEach(({ row, col, text }) => {
|
||||||
);
|
cy.get(`.q-scrollarea__content > :nth-child(${row}) > :nth-child(${col})`).should(
|
||||||
|
'have.text',
|
||||||
|
text,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -17,6 +17,7 @@ if (process.env.CI) {
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
|
globals: true,
|
||||||
reporters,
|
reporters,
|
||||||
outputFile,
|
outputFile,
|
||||||
environment: 'happy-dom',
|
environment: 'happy-dom',
|
||||||
|
|
Loading…
Reference in New Issue