forked from verdnatura/salix-front
Compare commits
463 Commits
Hotfix-Rec
...
dev
Author | SHA1 | Date |
---|---|---|
Alex Moreno | fd72f4dd45 | |
Alex Moreno | 9daed096db | |
Alex Moreno | e86afd57a0 | |
Alex Moreno | d529676ab5 | |
Jorge Penadés | 4828e32c9e | |
Alex Moreno | 48fdc9e624 | |
Jorge Penadés | f1350dece5 | |
Jorge Penadés | 2779e7ac8d | |
Alex Moreno | de7f55c589 | |
Alex Moreno | 32b4636706 | |
Alex Moreno | f26976b744 | |
Alex Moreno | d1e4017869 | |
Alex Moreno | 5d4b5ad598 | |
Alex Moreno | 2420c6dee2 | |
Alex Moreno | 0528474250 | |
Alex Moreno | e7acdfd4f7 | |
Javi Gallego | 3cbd294168 | |
Javi Gallego | 1bf1844c8f | |
Javi Gallego | ae56c06628 | |
Alex Moreno | 735ee09ef8 | |
Alex Moreno | aaf749db6c | |
Alex Moreno | f9392464e5 | |
Alex Moreno | ee31bc8262 | |
Alex Moreno | 0d3e8bb5d2 | |
Alex Moreno | dd2dc86eea | |
Alex Moreno | cd00a3c67f | |
Alex Moreno | 0c9c01b6e9 | |
Alex Moreno | 2d81cffb33 | |
Alex Moreno | a732ec05fb | |
Alex Moreno | 9db1c4f721 | |
Alex Moreno | ffd4a402ab | |
Carlos Satorres | c799d17e19 | |
Alex Moreno | 36221121f5 | |
Alex Moreno | b4d4844100 | |
Jon Elias | 665e84d338 | |
Jon Elias | cd4b17048c | |
Alex Moreno | c69f7af390 | |
Alex Moreno | 8478d89183 | |
Alex Moreno | 9780fe596f | |
Alex Moreno | 6f79275521 | |
Alex Moreno | 52981953f7 | |
Javier Segarra | bc1a082fe1 | |
Javier Segarra | e5064e8a37 | |
Javier Segarra | 76b69a7588 | |
Javier Segarra | cdce4d063c | |
Alex Moreno | fbd6633bdb | |
Alex Moreno | 0afcba0b07 | |
Alex Moreno | d61c690a70 | |
Alex Moreno | d221b8e3c4 | |
Alex Moreno | fcc213f307 | |
Jon Elias | 2a7bebb0b6 | |
Alex Moreno | f2147311d3 | |
Alex Moreno | 0cc1090739 | |
Jon Elias | fbfb1c654a | |
Jon Elias | 11092866b8 | |
Jon Elias | 64c0496f7a | |
Alex Moreno | f4caf6aecc | |
Alex Moreno | 175ebbc343 | |
Jorge Penadés | 55f8b78eba | |
Jorge Penadés | 2aaba93c3c | |
Jorge Penadés | 0c2d9e6ec6 | |
Jon Elias | 5c5393db6d | |
Jon Elias | 7d78ce7781 | |
Carlos Satorres | da3364b424 | |
Carlos Satorres | 8bc06593c5 | |
Carlos Satorres | 1f4b681b5b | |
Jorge Penadés | c42c811444 | |
Carlos Satorres | 3cdba5dafa | |
Javier Segarra | 70ae50a5f1 | |
Javier Segarra | 4115b1b303 | |
Javier Segarra | 6b9dc8f3a6 | |
Javier Segarra | 8262406eda | |
Alex Moreno | 3069ac27d0 | |
Alex Moreno | e0c294bce6 | |
Carlos Satorres | e06ce4f8a4 | |
Carlos Satorres | cad3fddc3e | |
Carlos Satorres | a30915f99e | |
Jon Elias | 4fb3e0dadf | |
Jon Elias | c4670b57de | |
Jon Elias | 15f171da0f | |
Carlos Satorres | b4245d05fb | |
Carlos Satorres | 22cc9d689d | |
Carlos Satorres | 3badfbcff9 | |
Carlos Satorres | af830591b3 | |
Alex Moreno | 0f84baf1a8 | |
Alex Moreno | a33dde3dcf | |
Jon Elias | cdce0771c9 | |
Jon Elias | d416a34560 | |
Alex Moreno | 3bb5f66ce7 | |
Alex Moreno | d87e8ec4ae | |
Alex Moreno | a68416244c | |
Carlos Satorres | bc581caa4e | |
Carlos Satorres | dfceb9403c | |
Jorge Penadés | 523423cce6 | |
Jorge Penadés | 245c027357 | |
Javier Segarra | 6633e65ee2 | |
Jorge Penadés | 0fb9b22935 | |
Carlos Satorres | 1a2c5c96fa | |
Carlos Satorres | 8258fbb91e | |
Carlos Satorres | b225f6a4c8 | |
Jorge Penadés | 4ff3c18f33 | |
Jorge Penadés | 6f2187cb68 | |
Jon Elias | 720042bed9 | |
Javier Segarra | 0fae36c239 | |
Jorge Penadés | 12392444b9 | |
Jorge Penadés | fdbae5c0b5 | |
Carlos Satorres | 2edeb1043e | |
Javier Segarra | b6bce0c2f3 | |
Javier Segarra | adbb745f0f | |
Javier Segarra | 914f6022be | |
Alex Moreno | 55b9fb1a87 | |
Jon Elias | eebac7b36c | |
Jorge Penadés | db5449444a | |
Alex Moreno | 64c8d264af | |
Javier Segarra | 3d9d08146c | |
Jorge Penadés | 50042ed45b | |
Jorge Penadés | 6d674f2a2b | |
Javier Segarra | f72761f36c | |
Javier Segarra | 2ff99d3faa | |
Javier Segarra | 3dfb836f8e | |
Jorge Penadés | 5af14b1b52 | |
Jorge Penadés | 44c4c378f9 | |
Jorge Penadés | 830decb6db | |
Jorge Penadés | 480f243205 | |
Jorge Penadés | 00dc2c6edc | |
Jon Elias | 2dd3e09928 | |
Javier Segarra | 801b6585e8 | |
Javier Segarra | 9edf35fba2 | |
Carlos Satorres | 855032e4a6 | |
Javier Segarra | 6a79746080 | |
Javier Segarra | e0f60ed118 | |
Alex Moreno | b6778aaf17 | |
Alex Moreno | 3dad27e463 | |
Carlos Satorres | 68a54ebe22 | |
Carlos Satorres | 73e5039ec3 | |
Jorge Penadés | 1723331615 | |
Jorge Penadés | e6535a5dd8 | |
Jorge Penadés | 4344458bb0 | |
Jorge Penadés | c815066953 | |
Guillermo Bonet | 26b4110d22 | |
Guillermo Bonet | 50eed83d05 | |
Jorge Penadés | d1b3e01d87 | |
Jon Elias | 27dca7c35f | |
Jon Elias | afc52f6cea | |
Jorge Penadés | d88fadca55 | |
Guillermo Bonet | a6944561de | |
Guillermo Bonet | c3eaab44ed | |
Guillermo Bonet | 178fa8cd21 | |
Alex Moreno | b1385cf08a | |
Guillermo Bonet | f98739f0ed | |
Guillermo Bonet | 4f3e7e2630 | |
Jorge Penadés | 5c5a359986 | |
Jorge Penadés | 947f913679 | |
Alex Moreno | ef5ae0f723 | |
Jon Elias | 33d6d529c5 | |
Jon Elias | bd3de77cbd | |
Alex Moreno | b8407140f9 | |
Alex Moreno | 426b7254d6 | |
Jorge Penadés | 120f96fedc | |
Jorge Penadés | 355c84ad06 | |
Javier Segarra | a69a4577a3 | |
Pako Natek | 355b1357b7 | |
Jorge Penadés | 9383a71adb | |
Jorge Penadés | 055b1b0a88 | |
Jon Elias | aee23c75e8 | |
Pablo Natek | d325459beb | |
Jorge Penadés | 9c5ce6dbfd | |
Jorge Penadés | 905841e0d6 | |
Jorge Penadés | 9fe3de22ac | |
Jorge Penadés | b735ccb3a0 | |
Pablo Natek | efe5208d30 | |
Jorge Penadés | 9f433afb51 | |
Pablo Natek | 1869e3315a | |
Pablo Natek | 7dc019cfbb | |
Jorge Penadés | ae8e4ba4b9 | |
Jorge Penadés | 67c2e284ba | |
Carlos Satorres | 0d31adaa4b | |
Jorge Penadés | e43ba9b58a | |
Jorge Penadés | cebb3b2b16 | |
Pablo Natek | 222e83cad8 | |
Jon Elias | 4b9588c189 | |
Pablo Natek | 4ba52f1a56 | |
Pablo Natek | 7d0e3e6fd4 | |
Pablo Natek | 4a357c5be6 | |
Pablo Natek | 99ba7a39fa | |
Jorge Penadés | c64fe8c044 | |
Jorge Penadés | b0ba6a5e0f | |
Jorge Penadés | cd20db637c | |
Jorge Penadés | aca10b81af | |
Pablo Natek | c04dad38f1 | |
Jorge Penadés | e10088ed06 | |
Jorge Penadés | c78e816f0c | |
Jorge Penadés | fadfafbb1d | |
Pablo Natek | 05a1d0e8fb | |
Jorge Penadés | 01dc25da8c | |
Jorge Penadés | a8c48789ca | |
Jorge Penadés | 30e34ea299 | |
Pablo Natek | 629524d63f | |
Jorge Penadés | 9b8e388525 | |
Pablo Natek | 06fa5b13a4 | |
Jorge Penadés | 739671a6da | |
Jorge Penadés | 1536cbe205 | |
Jon Elias | b93375f5a4 | |
Jon Elias | 6a1bb6d41f | |
Jon Elias | 8ee4edc5d5 | |
Javi Gallego | ed5cf137b0 | |
Javi Gallego | b08a5e63e9 | |
Javier Segarra | fef875270e | |
Pablo Natek | 5e59ecdb43 | |
Jon Elias | be53b466b9 | |
Jon Elias | 0b76d0d556 | |
Carlos Satorres | f9e3c92e68 | |
Carlos Satorres | ba3b2198b8 | |
Jon Elias | 0650380b7b | |
Jon Elias | e6dc2f16b8 | |
Jon Elias | 375adfab76 | |
Carlos Satorres | e374059f41 | |
Jon Elias | c54189e06a | |
Jon Elias | 98df741f1b | |
Carlos Satorres | 49da7168ab | |
Jon Elias | 12727e93eb | |
Jon Elias | 8fc3b2e86d | |
Jon Elias | 7db166974f | |
Carlos Satorres | c2c4acfc30 | |
Javier Segarra | c987a1151c | |
Javier Segarra | 692c649b8c | |
Jon Elias | 03a3d6bd50 | |
Javier Segarra | 2bd004f52b | |
Javier Segarra | 6b38bdf868 | |
Pablo Natek | c0fd5a1c21 | |
Javi Gallego | 38599be9bd | |
Javi Gallego | 36457f704d | |
Javi Gallego | 2f5358d439 | |
Javier Segarra | 2ca99a51ae | |
Jon Elias | 209c88884f | |
Javier Segarra | 1a697aa018 | |
Carlos Satorres | d69336c82a | |
Javi Gallego | 4399a91e99 | |
Javi Gallego | 589c672ab2 | |
Javier Segarra | ea7c799909 | |
Jon Elias | 7b63bb38f2 | |
Jon Elias | 21edf4b5d9 | |
Javier Segarra | 6e4677848f | |
Alex Moreno | ddffd5b1c7 | |
Alex Moreno | 7ae90908c4 | |
Javier Segarra | 696c9ca9b3 | |
Javier Segarra | 27b2d0232c | |
Jon Elias | 90ce9b2cd3 | |
Jon Elias | de01dda2ed | |
Carlos Satorres | e64e6eefe3 | |
Javier Segarra | 8fa82c818d | |
Javier Segarra | 30767b110f | |
Javier Segarra | d6efd21db6 | |
Javier Segarra | e9364f69d4 | |
Javier Segarra | 778e6299ce | |
Jon Elias | 86ab9f9540 | |
Jon Elias | 10bada7463 | |
Javier Segarra | 41acf0e1e2 | |
Javier Segarra | e7a2d3aa85 | |
Jon Elias | 3c5a5c3905 | |
Jon Elias | 76a77dcee9 | |
Pablo Natek | 6014ccebb4 | |
Pablo Natek | deb608cc96 | |
Javier Segarra | 2d9dbbd23d | |
Javier Segarra | 7001a707b9 | |
Javier Segarra | da78edb6d2 | |
Javier Segarra | d4dc12ebe3 | |
Javier Segarra | cf509d608a | |
Javier Segarra | b3c36e555f | |
Javier Segarra | b41026806f | |
Javier Segarra | cf67865b0b | |
Pablo Natek | 90762f1d1c | |
Pablo Natek | 7fa0a5b28c | |
Javier Segarra | 63d2b06b70 | |
Pablo Natek | 37d32a7934 | |
Pablo Natek | c815177be9 | |
Pablo Natek | 868e6a312f | |
Pablo Natek | cb0d3c5bca | |
Javier Segarra | fd202f30d2 | |
Javier Segarra | 9d7db2020b | |
Javier Segarra | 12a452d774 | |
Javier Segarra | cffd97a521 | |
Javier Segarra | bec50d6eed | |
Javier Segarra | 157370ec26 | |
Javier Segarra | e06d567e3c | |
Javier Segarra | 6b2e0df9c2 | |
Javier Segarra | d2067c633d | |
Javier Segarra | 3caeb9e738 | |
Jorge Penadés | 71201f1007 | |
Javi Gallego | a2b7e81982 | |
Jorge Penadés | 11c135e8c4 | |
Jorge Penadés | ba9f1407ac | |
Jorge Penadés | 7eb951ef13 | |
Jorge Penadés | 14b7654db3 | |
Jorge Penadés | 18ea23adf1 | |
Pablo Natek | 6e6b88d340 | |
Javier Segarra | 428c6966f2 | |
Jorge Penadés | 01b62adba9 | |
Javier Segarra | a0b3e933a8 | |
Jon Elias | 9386d648d0 | |
Jon Elias | 1c99c01d1d | |
Jon Elias | 51aae0f726 | |
Jon Elias | 6d5a8cba6f | |
Jorge Penadés | c2b52473a1 | |
Jorge Penadés | e827d3aabf | |
Jorge Penadés | 478d4695b8 | |
Jorge Penadés | 0cffe0b586 | |
Jorge Penadés | 709a662ceb | |
Pablo Natek | 6e6b65771a | |
Javi Gallego | 9095c579db | |
Pablo Natek | c388d5ab2a | |
Jon Elias | 56af4d3736 | |
Javi Gallego | dcfdabde32 | |
Javier Segarra | 73c45b8c4a | |
Jorge Penadés | 68ebda625b | |
Javi Gallego | eb0e18bf58 | |
Javi Gallego | bd2fa37450 | |
Alex Moreno | 8c13ceb3fe | |
Alex Moreno | 8dd2c44832 | |
Pablo Natek | cea5edd506 | |
Pablo Natek | ca568c31ca | |
Pablo Natek | 27b699ebf4 | |
Javier Segarra | a0c324c339 | |
Javier Segarra | 72ddeaa90a | |
Jorge Penadés | 45b3ed6e17 | |
Jorge Penadés | b54d358617 | |
Javier Segarra | 8c7ee3024f | |
Jorge Penadés | dc6acfadb7 | |
Pablo Natek | 1ee3691cc0 | |
Jon Elias | a14eb53f14 | |
Jon Elias | 4ff068aa8a | |
Javier Segarra | c1087614c6 | |
Javier Segarra | e8a0d44292 | |
Jon Elias | ff3ab83727 | |
Javier Segarra | bc37e372f5 | |
Javier Segarra | 2a64d9643e | |
Jorge Penadés | 86a82c5aad | |
Alex Moreno | d35b40a891 | |
Pablo Natek | f0c2baa60e | |
Pablo Natek | 70d640dc37 | |
Jon Elias | 67a1c28670 | |
Alex Moreno | 32328da370 | |
Alex Moreno | c9e4ab490d | |
Jon Elias | 8315eb2b4c | |
Javier Segarra | 41f168ebbe | |
Javier Segarra | 3affd8712c | |
Jon Elias | 8ac0083b9c | |
Jon Elias | 21f7613f21 | |
Jon Elias | f34e81038e | |
Jon Elias | cd96003c0e | |
Jorge Penadés | 3eb846b70c | |
Javier Segarra | 6e57306026 | |
Jorge Penadés | 42e4493fb6 | |
Pablo Natek | c400929c99 | |
Pablo Natek | 8124a341a0 | |
Javier Segarra | a5c6d628ca | |
Javier Segarra | 55e017b0cc | |
Jorge Penadés | 2cb9899de1 | |
Javier Segarra | b4b31c0c92 | |
Javier Segarra | e9e2caee85 | |
Javier Segarra | ac8aa6bcc1 | |
Jon Elias | 4fc3f08f77 | |
Jon Elias | b728b7c5bd | |
Jon Elias | 3716507f93 | |
Jorge Penadés | f809e0fb31 | |
Javier Segarra | 7713e33c67 | |
Javier Segarra | 013a76cbce | |
Javier Segarra | f06723a919 | |
Jorge Penadés | 7bbad14f53 | |
Jon Elias | 0dd79ed708 | |
Jon Elias | f025b4361e | |
Jorge Penadés | 37545b4cab | |
Jon Elias | 4c071aea8b | |
Jorge Penadés | 6cc8ca6731 | |
Jorge Penadés | fc23f9a8dd | |
Jon Elias | edea17340d | |
Javier Segarra | 271e33a999 | |
Jon Elias | d7fb8bdaf5 | |
Jon Elias | 2c15f79a2d | |
Jon Elias | 44d98865fe | |
Jon Elias | 34f70d026e | |
Jorge Penadés | 5625ef4ce1 | |
Jon Elias | 07cd9d5aae | |
Jon Elias | 98faf22e73 | |
Jon Elias | 3a95cf123e | |
Jon Elias | 566d657f70 | |
Jorge Penadés | 41c43fde76 | |
Jorge Penadés | 84cf3bea95 | |
Jorge Penadés | 47de2caed7 | |
Jon Elias | 6edabd856c | |
Jon Elias | 479f2a8e53 | |
Jorge Penadés | da7d0326c0 | |
Jorge Penadés | 1ff15da8ca | |
Jorge Penadés | b015397822 | |
Jorge Penadés | 91dccd10d3 | |
Jorge Penadés | 9ec2fb4c77 | |
Jorge Penadés | 153c9b743f | |
Jorge Penadés | 98cdeabe9f | |
Jon Elias | 6f9e46f7a0 | |
Jorge Penadés | 4bf8e1224d | |
Jorge Penadés | e90b78c4c5 | |
Jorge Penadés | 6983245d7d | |
Jon Elias | c291ea267c | |
Jon Elias | 4a0b92eded | |
Jon Elias | bb1eb30a25 | |
Jon Elias | b4c46dc153 | |
Jon Elias | 4a1f5e922c | |
Jon Elias | 6a5f31ff1e | |
Jon Elias | 422907447b | |
Jon Elias | d1138529b2 | |
Jon Elias | ff7bcfb00a | |
Jon Elias | 8e35737c8e | |
Jon Elias | e7a89138ba | |
Jon Elias | 8f8462db94 | |
Jon Elias | 6248a4117d | |
Jon Elias | 0b961050a0 | |
Jon Elias | 94ae74ca7f | |
Jon Elias | 4630496361 | |
Jon Elias | 4636e2f2e6 | |
Jon Elias | 04f4521a59 | |
Jon Elias | 0e5607d685 | |
Jon Elias | e962063753 | |
Jon Elias | 8ff9dae1d8 | |
Jon Elias | 102f7fb13e | |
Jon Elias | 9f24a7bc29 | |
Jon Elias | db6f4fd15a | |
Jon Elias | 65e3fd874d | |
Jon Elias | f5eacea483 | |
Jon Elias | 1889aa85b5 | |
Jon Elias | 5edea7cad1 | |
Jon Elias | 0d9773a30f | |
Jon Elias | 4bc148f16b | |
Jon Elias | 5471607d32 | |
Jon Elias | cb7d729b0f | |
Jon Elias | f35e33cf10 | |
Jon Elias | d18ca14b4e | |
Jon Elias | 3d683c1da3 | |
Jon Elias | b622f6ef96 | |
Jon Elias | 8bcecb91c6 | |
Jon Elias | 45d9322892 | |
Javier Segarra | b8dea8551d | |
Javier Segarra | 071f3ba4d0 | |
Javier Segarra | 390ab9cfd1 | |
Javier Segarra | 14961d0aec | |
Jon Elias | ffa6ef57fe | |
Jon Elias | 6b2df03b06 | |
Jon Elias | 56c461f085 | |
Javier Segarra | 6218463e7e | |
Javier Segarra | 87eca93ef8 | |
Jon Elias | 79a26d7b94 | |
Jon Elias | 5f63a9b058 | |
Jon Elias | 85bc610298 | |
Jon Elias | 511d53d109 | |
Jon Elias | 574a2efc92 | |
Jon Elias | 23e5072d38 | |
Jon Elias | 4a57c53c3d | |
Jon Elias | 954a6ff6c0 | |
Jon Elias | 3330e43e25 | |
Jon Elias | 61f1eae282 | |
Jon Elias | 7c5f5aee77 | |
Jon Elias | 1dace39882 | |
Jon Elias | 2ab7d48b0c | |
Javier Segarra | 3f1c0b95fa |
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "24.40.0",
|
||||
"version": "24.44.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
|
|
|
@ -2,9 +2,11 @@ import axios from 'axios';
|
|||
import { useSession } from 'src/composables/useSession';
|
||||
import { Router } from 'src/router';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||
|
||||
const session = useSession();
|
||||
const { notify } = useNotify();
|
||||
const stateQuery = useStateQueryStore();
|
||||
const baseUrl = '/api/';
|
||||
|
||||
axios.defaults.baseURL = baseUrl;
|
||||
|
@ -15,7 +17,7 @@ const onRequest = (config) => {
|
|||
if (token.length && !config.headers.Authorization) {
|
||||
config.headers.Authorization = token;
|
||||
}
|
||||
|
||||
stateQuery.add(config);
|
||||
return config;
|
||||
};
|
||||
|
||||
|
@ -24,10 +26,10 @@ const onRequestError = (error) => {
|
|||
};
|
||||
|
||||
const onResponse = (response) => {
|
||||
const { method } = response.config;
|
||||
const config = response.config;
|
||||
stateQuery.remove(config);
|
||||
|
||||
const isSaveRequest = method === 'patch';
|
||||
if (isSaveRequest) {
|
||||
if (config.method === 'patch') {
|
||||
notify('globals.dataSaved', 'positive');
|
||||
}
|
||||
|
||||
|
@ -35,37 +37,9 @@ const onResponse = (response) => {
|
|||
};
|
||||
|
||||
const onResponseError = (error) => {
|
||||
let message = '';
|
||||
stateQuery.remove(error.config);
|
||||
|
||||
const response = error.response;
|
||||
const responseData = response && response.data;
|
||||
const responseError = responseData && response.data.error;
|
||||
if (responseError) {
|
||||
message = responseError.message;
|
||||
}
|
||||
|
||||
switch (response?.status) {
|
||||
case 422:
|
||||
if (error.name == 'ValidationError')
|
||||
message +=
|
||||
' "' +
|
||||
responseError.details.context +
|
||||
'.' +
|
||||
Object.keys(responseError.details.codes).join(',') +
|
||||
'"';
|
||||
break;
|
||||
case 500:
|
||||
message = 'errors.statusInternalServerError';
|
||||
break;
|
||||
case 502:
|
||||
message = 'errors.statusBadGateway';
|
||||
break;
|
||||
case 504:
|
||||
message = 'errors.statusGatewayTimeout';
|
||||
break;
|
||||
}
|
||||
|
||||
if (session.isLoggedIn() && response?.status === 401) {
|
||||
if (session.isLoggedIn() && error.response?.status === 401) {
|
||||
session.destroy(false);
|
||||
const hash = window.location.hash;
|
||||
const url = hash.slice(1);
|
||||
|
@ -74,8 +48,6 @@ const onResponseError = (error) => {
|
|||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
notify(message, 'negative');
|
||||
|
||||
return Promise.reject(error);
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
import { QInput } from 'quasar';
|
||||
import setDefault from './setDefault';
|
||||
|
||||
setDefault(QInput, 'dense', true);
|
|
@ -0,0 +1,4 @@
|
|||
import { QSelect } from 'quasar';
|
||||
import setDefault from './setDefault';
|
||||
|
||||
setDefault(QSelect, 'dense', true);
|
|
@ -1 +1,3 @@
|
|||
export * from './defaults/qTable';
|
||||
export * from './defaults/qInput';
|
||||
export * from './defaults/qSelect';
|
||||
|
|
|
@ -3,14 +3,51 @@ import qFormMixin from './qformMixin';
|
|||
import mainShortcutMixin from './mainShortcutMixin';
|
||||
import keyShortcut from './keyShortcut';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { CanceledError } from 'axios';
|
||||
|
||||
const { notify } = useNotify();
|
||||
|
||||
export default boot(({ app }) => {
|
||||
app.mixin(qFormMixin);
|
||||
app.mixin(mainShortcutMixin);
|
||||
app.directive('shortcut', keyShortcut);
|
||||
app.config.errorHandler = function (err) {
|
||||
console.error(err);
|
||||
notify('globals.error', 'negative', 'error');
|
||||
app.config.errorHandler = (error) => {
|
||||
let message;
|
||||
const response = error.response;
|
||||
const responseData = response?.data;
|
||||
const responseError = responseData && response.data.error;
|
||||
if (responseError) {
|
||||
message = responseError.message;
|
||||
}
|
||||
|
||||
switch (response?.status) {
|
||||
case 422:
|
||||
if (error.name == 'ValidationError')
|
||||
message +=
|
||||
' "' +
|
||||
responseError.details.context +
|
||||
'.' +
|
||||
Object.keys(responseError.details.codes).join(',') +
|
||||
'"';
|
||||
break;
|
||||
case 500:
|
||||
message = 'errors.statusInternalServerError';
|
||||
break;
|
||||
case 502:
|
||||
message = 'errors.statusBadGateway';
|
||||
break;
|
||||
case 504:
|
||||
message = 'errors.statusGatewayTimeout';
|
||||
break;
|
||||
}
|
||||
|
||||
console.error(error);
|
||||
if (error instanceof CanceledError) {
|
||||
const env = process.env.NODE_ENV;
|
||||
if (env && env !== 'development') return;
|
||||
message = 'Duplicate request';
|
||||
}
|
||||
|
||||
notify(message ?? 'globals.error', 'negative', 'error');
|
||||
};
|
||||
});
|
||||
|
|
|
@ -31,8 +31,8 @@ const countriesFilter = {
|
|||
|
||||
const countriesOptions = ref([]);
|
||||
|
||||
const onDataSaved = (formData, requestResponse) => {
|
||||
emit('onDataSaved', formData, requestResponse);
|
||||
const onDataSaved = (...args) => {
|
||||
emit('onDataSaved', ...args);
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
|
@ -1,35 +1,42 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelectProvince from 'components/VnSelectProvince.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import FormModelPopup from './FormModelPopup.vue';
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
|
||||
const $props = defineProps({
|
||||
countryFk: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinceSelected: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinces: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const { t } = useI18n();
|
||||
|
||||
const cityFormData = reactive({
|
||||
const cityFormData = ref({
|
||||
name: null,
|
||||
provinceFk: null,
|
||||
});
|
||||
|
||||
const provincesOptions = ref([]);
|
||||
|
||||
onMounted(() => {
|
||||
cityFormData.value.provinceFk = $props.provinceSelected;
|
||||
});
|
||||
const onDataSaved = (...args) => {
|
||||
emit('onDataSaved', ...args);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (provincesOptions = data)"
|
||||
auto-load
|
||||
url="Provinces"
|
||||
/>
|
||||
<FormModelPopup
|
||||
:title="t('New city')"
|
||||
:subtitle="t('Please, ensure you put the correct data!')"
|
||||
|
@ -41,11 +48,16 @@ const onDataSaved = (...args) => {
|
|||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('Name')"
|
||||
:label="t('Names')"
|
||||
v-model="data.name"
|
||||
:rules="validate('city.name')"
|
||||
/>
|
||||
<VnSelectProvince v-model="data.provinceFk" />
|
||||
<VnSelectProvince
|
||||
:province-selected="$props.provinceSelected"
|
||||
:country-fk="$props.countryFk"
|
||||
v-model="data.provinceFk"
|
||||
:provinces="$props.provinces"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -22,9 +22,11 @@ const postcodeFormData = reactive({
|
|||
townFk: null,
|
||||
});
|
||||
|
||||
const townsFetchDataRef = ref(null);
|
||||
const provincesFetchDataRef = ref(null);
|
||||
const countriesOptions = ref([]);
|
||||
const provincesOptions = ref([]);
|
||||
const townsOptions = ref([]);
|
||||
const town = ref({});
|
||||
|
||||
function onDataSaved(formData) {
|
||||
|
@ -61,23 +63,94 @@ function setTown(newTown, data) {
|
|||
}
|
||||
|
||||
async function setProvince(id, data) {
|
||||
await provincesFetchDataRef.value.fetch();
|
||||
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
||||
if (!newProvince) return;
|
||||
|
||||
data.countryFk = newProvince.countryFk;
|
||||
}
|
||||
|
||||
async function onProvinceCreated(data) {
|
||||
await provincesFetchDataRef.value.fetch({
|
||||
where: { countryFk: postcodeFormData.countryFk },
|
||||
});
|
||||
postcodeFormData.provinceFk.value = data.id;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [postcodeFormData.countryFk],
|
||||
async (newCountryFk, oldValueFk) => {
|
||||
if (Array.isArray(newCountryFk)) {
|
||||
newCountryFk = newCountryFk[0];
|
||||
}
|
||||
if (Array.isArray(oldValueFk)) {
|
||||
oldValueFk = oldValueFk[0];
|
||||
}
|
||||
if (!!oldValueFk && newCountryFk !== oldValueFk) {
|
||||
postcodeFormData.provinceFk = null;
|
||||
postcodeFormData.townFk = null;
|
||||
}
|
||||
if (oldValueFk !== newCountryFk) {
|
||||
await provincesFetchDataRef.value.fetch({
|
||||
where: {
|
||||
countryFk: newCountryFk,
|
||||
},
|
||||
});
|
||||
await townsFetchDataRef.value.fetch({
|
||||
where: {
|
||||
provinceFk: {
|
||||
inq: provincesOptions.value.map(({ id }) => id),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => postcodeFormData.provinceFk,
|
||||
async (newProvinceFk) => {
|
||||
if (Array.isArray(newProvinceFk)) {
|
||||
newProvinceFk = newProvinceFk[0];
|
||||
}
|
||||
if (newProvinceFk !== postcodeFormData.provinceFk) {
|
||||
await townsFetchDataRef.value.fetch({
|
||||
where: { provinceFk: newProvinceFk },
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
async function handleProvinces(data) {
|
||||
provincesOptions.value = data;
|
||||
}
|
||||
async function handleTowns(data) {
|
||||
townsOptions.value = data;
|
||||
}
|
||||
async function handleCountries(data) {
|
||||
countriesOptions.value = data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="provincesFetchDataRef"
|
||||
@on-fetch="(data) => (provincesOptions = data)"
|
||||
@on-fetch="handleProvinces"
|
||||
:sort-by="['name ASC']"
|
||||
:limit="30"
|
||||
auto-load
|
||||
url="Provinces/location"
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (countriesOptions = data)"
|
||||
ref="townsFetchDataRef"
|
||||
:sort-by="['name ASC']"
|
||||
:limit="30"
|
||||
@on-fetch="handleTowns"
|
||||
auto-load
|
||||
url="Towns/location"
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="handleCountries"
|
||||
:sort-by="['name ASC']"
|
||||
:limit="30"
|
||||
auto-load
|
||||
url="Countries"
|
||||
/>
|
||||
|
@ -96,18 +169,20 @@ async function setProvince(id, data) {
|
|||
:label="t('Postcode')"
|
||||
v-model="data.code"
|
||||
:rules="validate('postcode.code')"
|
||||
clearable
|
||||
/>
|
||||
<VnSelectDialog
|
||||
:label="t('City')"
|
||||
url="Towns/location"
|
||||
@update:model-value="(value) => setTown(value, data)"
|
||||
:tooltip="t('Create city')"
|
||||
v-model="data.townFk"
|
||||
:options="townsOptions"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:rules="validate('postcode.city')"
|
||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||
:emit-value="false"
|
||||
clearable
|
||||
:clearable="true"
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
|
@ -122,6 +197,9 @@ async function setProvince(id, data) {
|
|||
</template>
|
||||
<template #form>
|
||||
<CreateNewCityForm
|
||||
:country-fk="data.countryFk"
|
||||
:province-selected="data.provinceFk"
|
||||
:provinces="provincesOptions"
|
||||
@on-data-saved="
|
||||
(_, requestResponse) =>
|
||||
onCityCreated(requestResponse, data)
|
||||
|
@ -132,8 +210,13 @@ async function setProvince(id, data) {
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelectProvince
|
||||
:country-fk="data.countryFk"
|
||||
:province-selected="data.provinceFk"
|
||||
@update:model-value="(value) => setProvince(value, data)"
|
||||
v-model="data.provinceFk"
|
||||
:clearable="true"
|
||||
:provinces="provincesOptions"
|
||||
@on-province-created="onProvinceCreated"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('Country')"
|
||||
|
@ -152,6 +235,7 @@ async function setProvince(id, data) {
|
|||
<i18n>
|
||||
es:
|
||||
New postcode: Nuevo código postal
|
||||
Create city: Crear población
|
||||
Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos!
|
||||
City: Población
|
||||
Province: Provincia
|
||||
|
|
|
@ -16,7 +16,16 @@ const provinceFormData = reactive({
|
|||
name: null,
|
||||
autonomyFk: null,
|
||||
});
|
||||
|
||||
const $props = defineProps({
|
||||
countryFk: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinces: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const autonomiesOptions = ref([]);
|
||||
|
||||
const onDataSaved = (dataSaved, requestResponse) => {
|
||||
|
@ -31,7 +40,14 @@ const onDataSaved = (dataSaved, requestResponse) => {
|
|||
<FetchData
|
||||
@on-fetch="(data) => (autonomiesOptions = data)"
|
||||
auto-load
|
||||
:filter="{
|
||||
where: {
|
||||
countryFk: $props.countryFk,
|
||||
},
|
||||
}"
|
||||
url="Autonomies/location"
|
||||
:sort-by="['name ASC']"
|
||||
:limit="30"
|
||||
/>
|
||||
<FormModelPopup
|
||||
:title="t('New province')"
|
||||
|
|
|
@ -50,7 +50,7 @@ const onDataSaved = (dataSaved) => {
|
|||
model="thermograph"
|
||||
:title="t('New thermograph')"
|
||||
:form-initial-data="thermographFormData"
|
||||
@on-data-saved="onDataSaved($event)"
|
||||
@on-data-saved="(_, response) => onDataSaved(response)"
|
||||
>
|
||||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow>
|
||||
|
|
|
@ -234,6 +234,8 @@ async function remove(data) {
|
|||
newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
|
||||
fetch(newData);
|
||||
});
|
||||
} else {
|
||||
reset();
|
||||
}
|
||||
emit('update:selected', []);
|
||||
}
|
||||
|
|
|
@ -217,9 +217,6 @@ async function save() {
|
|||
updateAndEmit('onDataSaved', formData.value, response?.data);
|
||||
if ($props.reload) await arrayData.fetch({});
|
||||
hasChanges.value = false;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
notify('errors.writeRequest', 'negative');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ defineExpose({
|
|||
:loading="isLoading"
|
||||
@click="emit('onDataCanceled')"
|
||||
v-close-popup
|
||||
data-cy="FormModelPopup_cancel"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.save')"
|
||||
|
@ -70,6 +71,7 @@ defineExpose({
|
|||
class="q-ml-sm"
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
data-cy="FormModelPopup_save"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -44,7 +44,6 @@ const itemComputed = computed(() => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.q-item {
|
||||
min-height: 5vh;
|
||||
|
|
|
@ -3,6 +3,7 @@ import { onMounted, ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||
import { useQuasar } from 'quasar';
|
||||
import PinnedModules from './PinnedModules.vue';
|
||||
import UserPanel from 'components/UserPanel.vue';
|
||||
|
@ -12,6 +13,7 @@ import VnAvatar from './ui/VnAvatar.vue';
|
|||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
const quasar = useQuasar();
|
||||
const stateQuery = useStateQueryStore();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
const appName = 'Lilium';
|
||||
|
@ -50,6 +52,14 @@ const pinnedModulesRef = ref();
|
|||
</QBtn>
|
||||
</RouterLink>
|
||||
<VnBreadcrumbs v-if="$q.screen.gt.sm" />
|
||||
<QSpinner
|
||||
color="primary"
|
||||
class="q-ml-md"
|
||||
:class="{
|
||||
'no-visible': !stateQuery.isLoading().value,
|
||||
}"
|
||||
size="xs"
|
||||
/>
|
||||
<QSpace />
|
||||
<div id="searchbar" class="searchbar"></div>
|
||||
<QSpace />
|
||||
|
|
|
@ -13,12 +13,14 @@ import FetchData from 'components/FetchData.vue';
|
|||
import { useClipboard } from 'src/composables/useClipboard';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import VnAvatar from './ui/VnAvatar.vue';
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
const state = useState();
|
||||
const session = useSession();
|
||||
const router = useRouter();
|
||||
const { t, locale } = useI18n();
|
||||
const { copyText } = useClipboard();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const userLocale = computed({
|
||||
get() {
|
||||
|
@ -53,6 +55,7 @@ const user = state.getUser();
|
|||
const warehousesData = ref();
|
||||
const companiesData = ref();
|
||||
const accountBankData = ref();
|
||||
const isEmployee = computed(() => useRole().isEmployee());
|
||||
|
||||
onMounted(async () => {
|
||||
updatePreferences();
|
||||
|
@ -70,18 +73,28 @@ function updatePreferences() {
|
|||
|
||||
async function saveDarkMode(value) {
|
||||
const query = `/UserConfigs/${user.value.id}`;
|
||||
await axios.patch(query, {
|
||||
darkMode: value,
|
||||
});
|
||||
user.value.darkMode = value;
|
||||
try {
|
||||
await axios.patch(query, {
|
||||
darkMode: value,
|
||||
});
|
||||
user.value.darkMode = value;
|
||||
onDataSaved();
|
||||
} catch (error) {
|
||||
onDataError();
|
||||
}
|
||||
}
|
||||
|
||||
async function saveLanguage(value) {
|
||||
const query = `/VnUsers/${user.value.id}`;
|
||||
await axios.patch(query, {
|
||||
lang: value,
|
||||
});
|
||||
user.value.lang = value;
|
||||
try {
|
||||
await axios.patch(query, {
|
||||
lang: value,
|
||||
});
|
||||
user.value.lang = value;
|
||||
onDataSaved();
|
||||
} catch (error) {
|
||||
onDataError();
|
||||
}
|
||||
}
|
||||
|
||||
function logout() {
|
||||
|
@ -97,11 +110,23 @@ function localUserData() {
|
|||
state.setUser(user.value);
|
||||
}
|
||||
|
||||
function saveUserData(param, value) {
|
||||
axios.post('UserConfigs/setUserConfig', { [param]: value });
|
||||
localUserData();
|
||||
async function saveUserData(param, value) {
|
||||
try {
|
||||
await axios.post('UserConfigs/setUserConfig', { [param]: value });
|
||||
localUserData();
|
||||
onDataSaved();
|
||||
} catch (error) {
|
||||
onDataError();
|
||||
}
|
||||
}
|
||||
const isEmployee = computed(() => useRole().isEmployee());
|
||||
|
||||
const onDataSaved = () => {
|
||||
notify('globals.dataSaved', 'positive');
|
||||
};
|
||||
|
||||
const onDataError = () => {
|
||||
notify('errors.updateUserConfig', 'negative');
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
|
@ -8,33 +8,55 @@ import FetchData from 'components/FetchData.vue';
|
|||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||
|
||||
const emit = defineEmits(['onProvinceCreated']);
|
||||
const provinceFk = defineModel({ type: Number });
|
||||
watch(provinceFk, async () => await provincesFetchDataRef.value.fetch());
|
||||
const $props = defineProps({
|
||||
countryFk: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinceSelected: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinces: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const provinceFk = defineModel({ type: Number, default: null });
|
||||
|
||||
const { validate } = useValidator();
|
||||
const { t } = useI18n();
|
||||
|
||||
const provincesOptions = ref();
|
||||
const provincesOptions = ref($props.provinces);
|
||||
provinceFk.value = $props.provinceSelected;
|
||||
const provincesFetchDataRef = ref();
|
||||
|
||||
async function onProvinceCreated(_, data) {
|
||||
await provincesFetchDataRef.value.fetch();
|
||||
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
||||
provinceFk.value = data.id;
|
||||
emit('onProvinceCreated', data);
|
||||
}
|
||||
async function handleProvinces(data) {
|
||||
provincesOptions.value = data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="provincesFetchDataRef"
|
||||
:filter="{ include: { relation: 'country' } }"
|
||||
@on-fetch="(data) => (provincesOptions = data)"
|
||||
auto-load
|
||||
:filter="{
|
||||
include: { relation: 'country' },
|
||||
where: {
|
||||
countryFk: $props.countryFk,
|
||||
},
|
||||
}"
|
||||
@on-fetch="handleProvinces"
|
||||
url="Provinces"
|
||||
/>
|
||||
<VnSelectDialog
|
||||
:label="t('Province')"
|
||||
:options="provincesOptions"
|
||||
:options="$props.provinces"
|
||||
:tooltip="t('Create province')"
|
||||
hide-selected
|
||||
v-model="provinceFk"
|
||||
:rules="validate && validate('postcode.provinceFk')"
|
||||
|
@ -49,11 +71,15 @@ async function onProvinceCreated(_, data) {
|
|||
</QItem>
|
||||
</template>
|
||||
<template #form>
|
||||
<CreateNewProvinceForm @on-data-saved="onProvinceCreated" />
|
||||
<CreateNewProvinceForm
|
||||
:country-fk="$props.countryFk"
|
||||
@on-data-saved="onProvinceCreated"
|
||||
/>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Province: Provincia
|
||||
Create province: Crear provincia
|
||||
</i18n>
|
||||
|
|
|
@ -10,7 +10,7 @@ import FormModelPopup from 'components/FormModelPopup.vue';
|
|||
|
||||
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
||||
import VnTableFilter from 'components/VnTable/VnFilter.vue';
|
||||
import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||
import VnTableChip from 'components/VnTable/VnChip.vue';
|
||||
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
||||
import VnLv from 'components/ui/VnLv.vue';
|
||||
|
@ -53,6 +53,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
bottom: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
cardClass: {
|
||||
type: String,
|
||||
default: 'flex-one',
|
||||
|
@ -69,7 +73,6 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
hasSubToolbar: {
|
||||
type: Boolean,
|
||||
default: null,
|
||||
|
@ -106,6 +109,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
disabledAttr: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
|
@ -316,6 +323,13 @@ function handleOnDataSaved(_) {
|
|||
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
|
||||
else $props.create.onDataSaved(_);
|
||||
}
|
||||
|
||||
function handleScroll() {
|
||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer
|
||||
|
@ -349,7 +363,7 @@ function handleOnDataSaved(_) {
|
|||
)"
|
||||
:key="col.id"
|
||||
>
|
||||
<VnTableFilter
|
||||
<VnFilter
|
||||
ref="tableFilterRef"
|
||||
:column="col"
|
||||
:data-key="$attrs['data-key']"
|
||||
|
@ -403,6 +417,7 @@ function handleOnDataSaved(_) {
|
|||
ref="tableRef"
|
||||
v-bind="table"
|
||||
class="vnTable"
|
||||
:class="{ 'last-row-sticky': $props.footer }"
|
||||
:columns="splittedColumns.columns"
|
||||
:rows="rows"
|
||||
v-model:selected="selected"
|
||||
|
@ -412,12 +427,7 @@ function handleOnDataSaved(_) {
|
|||
flat
|
||||
:style="isTableMode && `max-height: ${tableHeight}`"
|
||||
:virtual-scroll="isTableMode"
|
||||
@virtual-scroll="
|
||||
(event) =>
|
||||
event.index > rows.length - 2 &&
|
||||
($props.crudModel?.paginate ?? true) &&
|
||||
CrudModelRef.vnPaginateRef.paginate()
|
||||
"
|
||||
@virtual-scroll="handleScroll"
|
||||
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
||||
@update:selected="emit('update:selected', $event)"
|
||||
>
|
||||
|
@ -467,7 +477,7 @@ function handleOnDataSaved(_) {
|
|||
:search-url="searchUrl"
|
||||
/>
|
||||
</div>
|
||||
<VnTableFilter
|
||||
<VnFilter
|
||||
v-if="$props.columnSearch"
|
||||
:column="col"
|
||||
:show-title="true"
|
||||
|
@ -497,6 +507,7 @@ function handleOnDataSaved(_) {
|
|||
auto-width
|
||||
class="no-margin q-px-xs"
|
||||
:class="[getColAlign(col), col.columnClass]"
|
||||
:style="col.style"
|
||||
v-if="col.visible ?? true"
|
||||
@click.ctrl="
|
||||
($event) =>
|
||||
|
@ -525,6 +536,7 @@ function handleOnDataSaved(_) {
|
|||
:class="getColAlign(col)"
|
||||
class="sticky no-padding"
|
||||
@click="stopEventPropagation($event)"
|
||||
:style="col.style"
|
||||
>
|
||||
<QBtn
|
||||
v-for="(btn, index) of col.actions"
|
||||
|
@ -545,6 +557,29 @@ function handleOnDataSaved(_) {
|
|||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #bottom v-if="bottom">
|
||||
<slot name="bottom-table">
|
||||
<QBtn
|
||||
@click="
|
||||
() =>
|
||||
createAsDialog
|
||||
? (showForm = !showForm)
|
||||
: handleOnDataSaved(create)
|
||||
"
|
||||
class="cursor-pointer fill-icon"
|
||||
color="primary"
|
||||
icon="add_circle"
|
||||
size="md"
|
||||
round
|
||||
flat
|
||||
shortcut="+"
|
||||
:disabled="!disabledAttr"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ createForm.title }}
|
||||
</QTooltip>
|
||||
</slot>
|
||||
</template>
|
||||
<template #item="{ row, colsMap }">
|
||||
<component
|
||||
:is="$props.redirect ? 'router-link' : 'span'"
|
||||
|
@ -661,17 +696,15 @@ function handleOnDataSaved(_) {
|
|||
</QCard>
|
||||
</component>
|
||||
</template>
|
||||
<template #bottom-row="{ cols }" v-if="footer">
|
||||
<QTr v-if="rows.length" class="bg-header" style="height: 30px">
|
||||
<template #bottom-row="{ cols }" v-if="$props.footer">
|
||||
<QTr v-if="rows.length" style="height: 30px">
|
||||
<QTh
|
||||
v-for="col of cols.filter((cols) => cols.visible ?? true)"
|
||||
:key="col?.id"
|
||||
class="text-center"
|
||||
:class="getColAlign(col)"
|
||||
>
|
||||
<slot
|
||||
:name="`column-footer-${col.name}`"
|
||||
:class="getColAlign(col)"
|
||||
/>
|
||||
<slot :name="`column-footer-${col.name}`" />
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
|
@ -689,7 +722,7 @@ function handleOnDataSaved(_) {
|
|||
icon="add"
|
||||
shortcut="+"
|
||||
/>
|
||||
<QTooltip>
|
||||
<QTooltip self="top right">
|
||||
{{ createForm?.title }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
|
@ -750,16 +783,6 @@ es:
|
|||
color: var(--vn-text-color);
|
||||
}
|
||||
|
||||
.q-table--dark .q-table__bottom,
|
||||
.q-table--dark thead,
|
||||
.q-table--dark tr {
|
||||
border-color: var(--vn-section-color);
|
||||
}
|
||||
|
||||
.q-table__container > div:first-child {
|
||||
background-color: var(--vn-page-color);
|
||||
}
|
||||
|
||||
.grid-three {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(400px, max-content));
|
||||
|
@ -834,6 +857,18 @@ es:
|
|||
background-color: var(--vn-section-color);
|
||||
z-index: 1;
|
||||
}
|
||||
table tbody th {
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
.last-row-sticky {
|
||||
tbody:nth-last-child(1) {
|
||||
@extend .bg-header;
|
||||
position: sticky;
|
||||
z-index: 2;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.vn-label-value {
|
||||
|
@ -879,4 +914,12 @@ es:
|
|||
cursor: text;
|
||||
user-select: all;
|
||||
}
|
||||
|
||||
.q-table__container {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.q-table__middle.q-virtual-scroll.q-virtual-scroll--vertical.scroll {
|
||||
background-color: var(--vn-section-color);
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnRow from '../ui/VnRow.vue';
|
||||
import VnInput from './VnInput.vue';
|
||||
import FetchData from '../FetchData.vue';
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
const props = defineProps({
|
||||
submitFn: { type: Function, default: () => {} },
|
||||
askOldPass: { type: Boolean, default: false },
|
||||
});
|
||||
const emit = defineEmits(['onSubmit']);
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const form = ref();
|
||||
const changePassDialog = ref();
|
||||
const passwords = ref({ newPassword: null, repeatPassword: null });
|
||||
const requirements = ref([]);
|
||||
const isLoading = ref(false);
|
||||
|
||||
const validate = async () => {
|
||||
const { newPassword, repeatPassword, oldPassword } = passwords.value;
|
||||
|
||||
if (!newPassword) {
|
||||
notify(t('You must enter a new password'), 'negative');
|
||||
return;
|
||||
}
|
||||
if (newPassword !== repeatPassword) {
|
||||
notify(t("Passwords don't match"), 'negative');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
isLoading.value = true;
|
||||
await props.submitFn(newPassword, oldPassword);
|
||||
emit('onSubmit');
|
||||
} catch (e) {
|
||||
notify('errors.writeRequest', 'negative');
|
||||
} finally {
|
||||
changePassDialog.value.hide();
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({ show: () => changePassDialog.value.show() });
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="UserPasswords/findOne"
|
||||
auto-load
|
||||
@on-fetch="(data) => (requirements = data)"
|
||||
/>
|
||||
<QDialog ref="changePassDialog">
|
||||
<QCard style="width: 350px">
|
||||
<QCardSection>
|
||||
<slot name="header">
|
||||
<VnRow class="items-center" style="flex-direction: row">
|
||||
<span class="text-h6" v-text="t('globals.changePass')" />
|
||||
<QIcon
|
||||
class="cursor-pointer"
|
||||
name="close"
|
||||
size="xs"
|
||||
style="flex: 0"
|
||||
v-close-popup
|
||||
/>
|
||||
</VnRow>
|
||||
</slot>
|
||||
</QCardSection>
|
||||
<QForm ref="form">
|
||||
<QCardSection>
|
||||
<VnInput
|
||||
v-if="props.askOldPass"
|
||||
:label="t('Old password')"
|
||||
v-model="passwords.oldPassword"
|
||||
type="password"
|
||||
:required="true"
|
||||
autofocus
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('New password')"
|
||||
v-model="passwords.newPassword"
|
||||
type="password"
|
||||
:required="true"
|
||||
:info="
|
||||
t('passwordRequirements', {
|
||||
length: requirements.length,
|
||||
nAlpha: requirements.nAlpha,
|
||||
nUpper: requirements.nUpper,
|
||||
nDigits: requirements.nDigits,
|
||||
nPunct: requirements.nPunct,
|
||||
})
|
||||
"
|
||||
autofocus
|
||||
/>
|
||||
|
||||
<VnInput
|
||||
:label="t('Repeat password')"
|
||||
v-model="passwords.repeatPassword"
|
||||
type="password"
|
||||
/>
|
||||
</QCardSection>
|
||||
</QForm>
|
||||
<QCardActions>
|
||||
<slot name="actions">
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
:label="t('globals.cancel')"
|
||||
class="q-ml-sm"
|
||||
color="primary"
|
||||
flat
|
||||
type="reset"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
@click="validate"
|
||||
/>
|
||||
</slot>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
New password: Nueva contraseña
|
||||
Repeat password: Repetir contraseña
|
||||
You must enter a new password: Debes introducir la nueva contraseña
|
||||
Passwords don't match: Las contraseñas no coinciden
|
||||
</i18n>
|
|
@ -0,0 +1,29 @@
|
|||
<script setup>
|
||||
const model = defineModel({ type: [String, Number], required: true });
|
||||
</script>
|
||||
<template>
|
||||
<QDate v-model="model" :today-btn="true" :options="$attrs.options" />
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.q-date {
|
||||
width: 245px;
|
||||
min-width: unset;
|
||||
|
||||
:deep(.q-date__calendar) {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
:deep(.q-date__view) {
|
||||
min-height: 245px;
|
||||
padding: 8px;
|
||||
}
|
||||
:deep(.q-date__calendar-days-container) {
|
||||
min-height: 160px;
|
||||
height: unset;
|
||||
}
|
||||
|
||||
:deep(.q-date__header) {
|
||||
padding: 2px 2px 5px 12px;
|
||||
height: 60px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -103,6 +103,7 @@ const mixinRules = [
|
|||
@click="
|
||||
() => {
|
||||
value = null;
|
||||
vnInputRef.focus();
|
||||
emit('remove');
|
||||
}
|
||||
"
|
||||
|
|
|
@ -3,6 +3,7 @@ import { onMounted, watch, computed, ref } from 'vue';
|
|||
import { date } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useAttrs } from 'vue';
|
||||
import VnDate from './VnDate.vue';
|
||||
|
||||
const model = defineModel({ type: [String, Date] });
|
||||
const $props = defineProps({
|
||||
|
@ -20,6 +21,7 @@ const { validations } = useValidator();
|
|||
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||
const vnInputDateRef = ref(null);
|
||||
|
||||
const dateFormat = 'DD/MM/YYYY';
|
||||
const isPopupOpen = ref();
|
||||
|
@ -86,11 +88,17 @@ const styleAttrs = computed(() => {
|
|||
}
|
||||
: {};
|
||||
});
|
||||
|
||||
const manageDate = (date) => {
|
||||
formattedDate.value = date;
|
||||
isPopupOpen.value = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||
<QInput
|
||||
ref="vnInputDateRef"
|
||||
v-model="formattedDate"
|
||||
class="vn-input-date"
|
||||
:mask="mask"
|
||||
|
@ -113,6 +121,7 @@ const styleAttrs = computed(() => {
|
|||
!$attrs.disable
|
||||
"
|
||||
@click="
|
||||
vnInputDateRef.focus();
|
||||
model = null;
|
||||
isPopupOpen = false;
|
||||
"
|
||||
|
@ -126,6 +135,7 @@ const styleAttrs = computed(() => {
|
|||
/>
|
||||
</template>
|
||||
<QMenu
|
||||
v-if="$q.screen.gt.xs"
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
v-model="isPopupOpen"
|
||||
|
@ -134,19 +144,11 @@ const styleAttrs = computed(() => {
|
|||
:no-focus="true"
|
||||
:no-parent-event="true"
|
||||
>
|
||||
<QDate
|
||||
v-model="popupDate"
|
||||
:landscape="true"
|
||||
:today-btn="true"
|
||||
:options="$attrs.options"
|
||||
@update:model-value="
|
||||
(date) => {
|
||||
formattedDate = date;
|
||||
isPopupOpen = false;
|
||||
}
|
||||
"
|
||||
/>
|
||||
<VnDate v-model="popupDate" @update:model-value="manageDate" />
|
||||
</QMenu>
|
||||
<QDialog v-else v-model="isPopupOpen">
|
||||
<VnDate v-model="popupDate" @update:model-value="manageDate" />
|
||||
</QDialog>
|
||||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -3,6 +3,8 @@ import { computed, ref, useAttrs } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { date } from 'quasar';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
import VnTime from './VnTime.vue';
|
||||
|
||||
const { validations } = useValidator();
|
||||
const $attrs = useAttrs();
|
||||
const model = defineModel({ type: String });
|
||||
|
@ -16,6 +18,7 @@ const props = defineProps({
|
|||
default: false,
|
||||
},
|
||||
});
|
||||
const vnInputTimeRef = ref(null);
|
||||
const initialDate = ref(model.value ?? Date.vnNew());
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||
|
@ -69,6 +72,7 @@ function dateToTime(newDate) {
|
|||
<template>
|
||||
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||
<QInput
|
||||
ref="vnInputTimeRef"
|
||||
class="vn-input-time"
|
||||
mask="##:##"
|
||||
placeholder="--:--"
|
||||
|
@ -92,6 +96,7 @@ function dateToTime(newDate) {
|
|||
!$attrs.disable
|
||||
"
|
||||
@click="
|
||||
vnInputTimeRef.focus();
|
||||
model = null;
|
||||
isPopupOpen = false;
|
||||
"
|
||||
|
@ -104,6 +109,7 @@ function dateToTime(newDate) {
|
|||
/>
|
||||
</template>
|
||||
<QMenu
|
||||
v-if="$q.screen.gt.xs"
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
v-model="isPopupOpen"
|
||||
|
@ -112,8 +118,11 @@ function dateToTime(newDate) {
|
|||
:no-focus="true"
|
||||
:no-parent-event="true"
|
||||
>
|
||||
<QTime v-model="formattedTime" mask="HH:mm" landscape now-btn />
|
||||
<VnTime v-model="formattedTime" />
|
||||
</QMenu>
|
||||
<QDialog v-else v-model="isPopupOpen">
|
||||
<VnTime v-model="formattedTime" />
|
||||
</QDialog>
|
||||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -12,6 +12,16 @@ const props = defineProps({
|
|||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const locationProperties = [
|
||||
'postcode',
|
||||
(obj) =>
|
||||
obj.city
|
||||
? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
|
||||
: null,
|
||||
(obj) => obj.country?.name,
|
||||
];
|
||||
|
||||
const formatLocation = (obj, properties) => {
|
||||
const parts = properties.map((prop) => {
|
||||
if (typeof prop === 'string') {
|
||||
|
@ -29,23 +39,10 @@ const formatLocation = (obj, properties) => {
|
|||
return filteredParts.join(', ');
|
||||
};
|
||||
|
||||
const locationProperties = [
|
||||
'postcode',
|
||||
(obj) =>
|
||||
obj.city
|
||||
? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
|
||||
: null,
|
||||
(obj) => obj.country?.name,
|
||||
];
|
||||
|
||||
const modelValue = ref(
|
||||
props.location ? formatLocation(props.location, locationProperties) : null
|
||||
);
|
||||
|
||||
const handleModelValue = (data) => {
|
||||
emit('update:model-value', data);
|
||||
};
|
||||
|
||||
function showLabel(data) {
|
||||
const dataProperties = [
|
||||
'code',
|
||||
|
@ -54,6 +51,10 @@ function showLabel(data) {
|
|||
];
|
||||
return formatLocation(data, dataProperties);
|
||||
}
|
||||
|
||||
const handleModelValue = (data) => {
|
||||
emit('update:model-value', data);
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<VnSelectDialog
|
||||
|
@ -72,6 +73,7 @@ function showLabel(data) {
|
|||
v-bind="$attrs"
|
||||
clearable
|
||||
:emit-value="false"
|
||||
:tooltip="t('Create new location')"
|
||||
>
|
||||
<template #form>
|
||||
<CreateNewPostcode
|
||||
|
@ -104,7 +106,9 @@ function showLabel(data) {
|
|||
<i18n>
|
||||
en:
|
||||
search_by_postalcode: Search by postalcode, town, province or country
|
||||
Create new location: Create new location
|
||||
es:
|
||||
Location: Ubicación
|
||||
Create new location: Crear nueva ubicación
|
||||
search_by_postalcode: Buscar por código postal, ciudad o país
|
||||
</i18n>
|
||||
|
|
|
@ -141,6 +141,7 @@ function findKeyInOptions() {
|
|||
function setOptions(data) {
|
||||
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||
emit('update:options', data);
|
||||
}
|
||||
|
||||
function filter(val, options) {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<script setup>
|
||||
const model = defineModel({ type: [String, Number], required: true });
|
||||
</script>
|
||||
<template>
|
||||
<QTime v-model="model" now-btn mask="HH:mm" />
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.q-time {
|
||||
width: 230px;
|
||||
min-width: unset;
|
||||
:deep(.q-time__header) {
|
||||
min-height: unset;
|
||||
height: 50px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -47,6 +47,7 @@ let store;
|
|||
let entity;
|
||||
const isLoading = ref(false);
|
||||
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
|
||||
const menuRef = ref();
|
||||
defineExpose({ getData });
|
||||
|
||||
onBeforeMount(async () => {
|
||||
|
@ -170,7 +171,7 @@ const toModule = computed(() =>
|
|||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.moreOptions') }}
|
||||
</QTooltip>
|
||||
<QMenu ref="menuRef">
|
||||
<QMenu :ref="menuRef">
|
||||
<QList>
|
||||
<slot name="menu" :entity="entity" :menu-ref="menuRef" />
|
||||
</QList>
|
||||
|
|
|
@ -3,7 +3,6 @@ import { onMounted, ref, computed, watch } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { date } from 'quasar';
|
||||
import toDate from 'filters/toDate';
|
||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||
|
||||
|
@ -59,7 +58,6 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
defineExpose({ search, sanitizer });
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:modelValue',
|
||||
'refresh',
|
||||
|
@ -114,9 +112,9 @@ watch(
|
|||
);
|
||||
|
||||
const isLoading = ref(false);
|
||||
async function search() {
|
||||
async function search(evt) {
|
||||
try {
|
||||
if ($props.disableSubmitEvent) return;
|
||||
if (evt && $props.disableSubmitEvent) return;
|
||||
|
||||
store.filter.where = {};
|
||||
isLoading.value = true;
|
||||
|
@ -167,7 +165,7 @@ const tagsList = computed(() => {
|
|||
for (const key of Object.keys(userParams.value)) {
|
||||
const value = userParams.value[key];
|
||||
if (value == null || ($props.hiddenTags || []).includes(key)) continue;
|
||||
tagList.push({ label: aliasField(key), value });
|
||||
tagList.push({ label: key, value });
|
||||
}
|
||||
return tagList;
|
||||
});
|
||||
|
@ -187,7 +185,6 @@ async function remove(key) {
|
|||
}
|
||||
|
||||
function formatValue(value) {
|
||||
if (value instanceof Date) return date.formatDate(value, 'DD/MM/YYYY');
|
||||
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
||||
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
||||
|
||||
|
@ -203,11 +200,6 @@ function sanitizer(params) {
|
|||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
function aliasField(field) {
|
||||
const split = field.split('.');
|
||||
return split[1] ?? split[0];
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -219,7 +211,7 @@ function aliasField(field) {
|
|||
icon="search"
|
||||
@click="search()"
|
||||
></QBtn>
|
||||
<QForm @submit="search" id="filterPanelForm">
|
||||
<QForm @submit="search" id="filterPanelForm" @keyup.enter="search()">
|
||||
<QList dense>
|
||||
<QItem class="q-mt-xs">
|
||||
<QItemSection top>
|
||||
|
|
|
@ -58,7 +58,7 @@ defineExpose({
|
|||
:class="{ zoomIn: zoom }"
|
||||
:src="getUrl()"
|
||||
v-bind="$attrs"
|
||||
@click.stop="show = $props.zoom ? true : false"
|
||||
@click.stop="show = $props.zoom"
|
||||
spinner-color="primary"
|
||||
/>
|
||||
<QDialog v-if="$props.zoom" v-model="show">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref } from 'vue';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { onBeforeRouteLeave } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -12,36 +12,40 @@ import VnPaginate from 'components/ui/VnPaginate.vue';
|
|||
import VnUserLink from 'components/ui/VnUserLink.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import VnAvatar from 'components/ui/VnAvatar.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
url: { type: String, default: null },
|
||||
filter: { type: Object, default: () => {} },
|
||||
body: { type: Object, default: () => {} },
|
||||
addNote: { type: Boolean, default: false },
|
||||
selectType: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const state = useState();
|
||||
const quasar = useQuasar();
|
||||
const currentUser = ref(state.getUser());
|
||||
const newNote = ref('');
|
||||
const newNote = reactive({ text: null, observationTypeFk: null });
|
||||
const observationTypes = ref([]);
|
||||
const vnPaginateRef = ref();
|
||||
function handleKeyUp(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
if (!event.shiftKey) insert();
|
||||
}
|
||||
}
|
||||
|
||||
async function insert() {
|
||||
if (!newNote.text || ($props.selectType && !newNote.observationTypeFk)) return;
|
||||
|
||||
const body = $props.body;
|
||||
const newBody = { ...body, ...{ text: newNote.value } };
|
||||
const newBody = {
|
||||
...body,
|
||||
...{ text: newNote.text, observationTypeFk: newNote.observationTypeFk },
|
||||
};
|
||||
await axios.post($props.url, newBody);
|
||||
await vnPaginateRef.value.fetch();
|
||||
newNote.value = '';
|
||||
}
|
||||
|
||||
onBeforeRouteLeave((to, from, next) => {
|
||||
if (newNote.value)
|
||||
if (newNote.text)
|
||||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
|
@ -54,6 +58,13 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
});
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
v-if="selectType"
|
||||
url="ObservationTypes"
|
||||
:filter="{ fields: ['id', 'description'] }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (observationTypes = data)"
|
||||
/>
|
||||
<QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote">
|
||||
<QCardSection horizontal>
|
||||
<VnAvatar :worker-id="currentUser.id" size="md" />
|
||||
|
@ -62,29 +73,42 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
{{ t('globals.now') }}
|
||||
</div>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pa-xs q-my-none q-py-none" horizontal>
|
||||
<QInput
|
||||
v-model="newNote"
|
||||
class="full-width"
|
||||
type="textarea"
|
||||
:label="t('Add note here...')"
|
||||
filled
|
||||
size="lg"
|
||||
autogrow
|
||||
autofocus
|
||||
@keyup="handleKeyUp"
|
||||
clearable
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
:title="t('Save (Enter)')"
|
||||
icon="save"
|
||||
color="primary"
|
||||
flat
|
||||
@click="insert"
|
||||
/>
|
||||
</template>
|
||||
</QInput>
|
||||
<QCardSection class="q-px-xs q-my-none q-py-none">
|
||||
<VnRow class="full-width">
|
||||
<VnSelect
|
||||
:label="t('Observation type')"
|
||||
v-if="selectType"
|
||||
url="ObservationTypes"
|
||||
v-model="newNote.observationTypeFk"
|
||||
option-label="description"
|
||||
style="flex: 0.15"
|
||||
:required="true"
|
||||
@keyup.enter.stop="insert"
|
||||
/>
|
||||
<VnInput
|
||||
v-model.trim="newNote.text"
|
||||
type="textarea"
|
||||
:label="t('Add note here...')"
|
||||
filled
|
||||
size="lg"
|
||||
autogrow
|
||||
@keyup.enter.stop="insert"
|
||||
clearable
|
||||
:required="true"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
:title="t('Save (Enter)')"
|
||||
icon="save"
|
||||
color="primary"
|
||||
flat
|
||||
@click="insert"
|
||||
class="q-mb-xs"
|
||||
dense
|
||||
/>
|
||||
</template>
|
||||
</VnInput>
|
||||
</VnRow>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<VnPaginate
|
||||
|
@ -98,6 +122,10 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
class="show"
|
||||
v-bind="$attrs"
|
||||
search-url="notes"
|
||||
@on-fetch="
|
||||
newNote.text = '';
|
||||
newNote.observationTypeFk = null;
|
||||
"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<TransitionGroup name="list" tag="div" class="column items-center full-width">
|
||||
|
@ -111,13 +139,28 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
:descriptor="false"
|
||||
:worker-id="note.workerFk"
|
||||
size="md"
|
||||
:title="note.worker?.user.nickname"
|
||||
/>
|
||||
<div class="full-width row justify-between q-pa-xs">
|
||||
<VnUserLink
|
||||
:name="`${note.worker.user.nickname}`"
|
||||
:worker-id="note.worker.id"
|
||||
/>
|
||||
{{ toDateHourMin(note.created) }}
|
||||
<div>
|
||||
<VnUserLink
|
||||
:name="`${note.worker.user.nickname}`"
|
||||
:worker-id="note.worker.id"
|
||||
/>
|
||||
<QBadge
|
||||
class="q-ml-xs"
|
||||
outline
|
||||
color="grey"
|
||||
v-if="selectType && note.observationTypeFk"
|
||||
>
|
||||
{{
|
||||
observationTypes.find(
|
||||
(ot) => ot.id === note.observationTypeFk
|
||||
)?.description
|
||||
}}
|
||||
</QBadge>
|
||||
</div>
|
||||
<span v-text="toDateHourMin(note.created)" />
|
||||
</div>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pa-xs q-my-none q-py-none">
|
||||
|
@ -131,12 +174,6 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
<style lang="scss" scoped>
|
||||
.q-card {
|
||||
width: 90%;
|
||||
@media (max-width: $breakpoint-sm) {
|
||||
width: 100%;
|
||||
}
|
||||
&__section {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
.q-dialog .q-card {
|
||||
width: 400px;
|
||||
|
@ -150,11 +187,28 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
opacity: 0;
|
||||
background-color: $primary;
|
||||
}
|
||||
|
||||
.vn-row > :nth-child(2) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
.vn-row > :deep(*) {
|
||||
margin-left: 0;
|
||||
}
|
||||
.q-card {
|
||||
width: 100%;
|
||||
|
||||
&__section {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Add note here...: Añadir nota aquí...
|
||||
New note: Nueva nota
|
||||
Save (Enter): Guardar (Intro)
|
||||
|
||||
Observation type: Tipo de observación
|
||||
</i18n>
|
||||
|
|
|
@ -108,6 +108,7 @@ async function search() {
|
|||
...Object.fromEntries(staticParams),
|
||||
search: searchText.value,
|
||||
},
|
||||
...{ filter: props.filter },
|
||||
};
|
||||
|
||||
if (props.whereFilter) {
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { defineProps } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
routeName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
entityId: {
|
||||
type: [String, Number],
|
||||
required: true,
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const id = props.entityId;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<router-link
|
||||
v-if="route?.name !== routeName"
|
||||
:to="{ name: routeName, params: { id: id } }"
|
||||
class="header link"
|
||||
:href="url"
|
||||
>
|
||||
<QIcon name="open_in_new" color="white" size="sm" />
|
||||
</router-link>
|
||||
</template>
|
|
@ -0,0 +1,55 @@
|
|||
<script setup>
|
||||
import { defineProps, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
usesMana: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
manaCode: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
manaVal: {
|
||||
type: String,
|
||||
default: 'mana',
|
||||
},
|
||||
manaLabel: {
|
||||
type: String,
|
||||
default: 'Promotion mana',
|
||||
},
|
||||
manaClaimVal: {
|
||||
type: String,
|
||||
default: 'manaClaim',
|
||||
},
|
||||
claimLabel: {
|
||||
type: String,
|
||||
default: 'Claim mana',
|
||||
},
|
||||
});
|
||||
|
||||
const manaCode = ref(props.manaCode);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="column q-gutter-y-sm q-mt-sm">
|
||||
<QRadio
|
||||
v-model="manaCode"
|
||||
dense
|
||||
:val="manaVal"
|
||||
:label="t(manaLabel)"
|
||||
:dark="true"
|
||||
class="q-mb-sm"
|
||||
/>
|
||||
<QRadio
|
||||
v-model="manaCode"
|
||||
dense
|
||||
:val="manaClaimVal"
|
||||
:label="t(claimLabel)"
|
||||
:dark="true"
|
||||
class="q-mb-sm"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
|
@ -114,7 +114,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
for (const row of response.data) store.data.push(row);
|
||||
} else {
|
||||
store.data = response.data;
|
||||
if (!document.querySelectorAll('[role="dialog"]').length)
|
||||
if (!document.querySelectorAll('[role="dialog"][aria-modal="true"]').length)
|
||||
updateRouter && updateStateParams();
|
||||
}
|
||||
|
||||
|
|
|
@ -288,3 +288,7 @@ input::-webkit-inner-spin-button {
|
|||
color: $info;
|
||||
}
|
||||
}
|
||||
|
||||
.no-visible {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ export default function toHour(date) {
|
|||
if (!isValidDate(date)) {
|
||||
return '--:--';
|
||||
}
|
||||
return (new Date(date || '')).toLocaleTimeString([], {
|
||||
return new Date(date || '').toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
|
|
|
@ -50,6 +50,7 @@ globals:
|
|||
summary:
|
||||
basicData: Basic data
|
||||
daysOnward: Days onward
|
||||
daysAgo: Days ago
|
||||
today: Today
|
||||
yesterday: Yesterday
|
||||
dateFormat: en-GB
|
||||
|
@ -104,6 +105,7 @@ globals:
|
|||
campaign: Campaign
|
||||
weight: Weight
|
||||
error: Ups! Something went wrong
|
||||
recalc: Recalculate
|
||||
pageTitles:
|
||||
logIn: Login
|
||||
addressEdit: Update address
|
||||
|
@ -111,7 +113,7 @@ globals:
|
|||
basicData: Basic data
|
||||
log: Logs
|
||||
parkingList: Parkings list
|
||||
agencyList: Agencies list
|
||||
agencyList: Agencies
|
||||
agency: Agency
|
||||
workCenters: Work centers
|
||||
modes: Modes
|
||||
|
@ -135,7 +137,7 @@ globals:
|
|||
fiscalData: Fiscal data
|
||||
billingData: Billing data
|
||||
consignees: Consignees
|
||||
'address-create': New address
|
||||
address-create: New address
|
||||
notes: Notes
|
||||
credits: Credits
|
||||
greuges: Greuges
|
||||
|
@ -207,7 +209,7 @@ globals:
|
|||
roadmap: Roadmap
|
||||
stops: Stops
|
||||
routes: Routes
|
||||
cmrsList: CMRs list
|
||||
cmrsList: CMRs
|
||||
RouteList: List
|
||||
routeCreate: New route
|
||||
RouteRoadmap: Roadmaps
|
||||
|
@ -273,6 +275,9 @@ globals:
|
|||
clientsActionsMonitor: Clients and actions
|
||||
serial: Serial
|
||||
medical: Mutual
|
||||
RouteExtendedList: Router
|
||||
wasteRecalc: Waste recaclulate
|
||||
operator: Operator
|
||||
supplier: Supplier
|
||||
created: Created
|
||||
worker: Worker
|
||||
|
@ -288,7 +293,10 @@ globals:
|
|||
createInvoiceIn: Create invoice in
|
||||
myAccount: My account
|
||||
noOne: No one
|
||||
maxTemperature: Max
|
||||
minTemperature: Min
|
||||
params:
|
||||
id: ID
|
||||
clientFk: Client id
|
||||
salesPersonFk: Sales person
|
||||
warehouseFk: Warehouse
|
||||
|
@ -296,8 +304,13 @@ globals:
|
|||
from: From
|
||||
To: To
|
||||
stateFk: State
|
||||
email: Email
|
||||
SSN: SSN
|
||||
fi: FI
|
||||
myTeam: My team
|
||||
departmentFk: Department
|
||||
changePass: Change password
|
||||
deleteConfirmTitle: Delete selected elements
|
||||
changeState: Change state
|
||||
errors:
|
||||
statusUnauthorized: Access denied
|
||||
|
@ -305,6 +318,7 @@ errors:
|
|||
statusBadGateway: It seems that the server has fall down
|
||||
statusGatewayTimeout: Could not contact the server
|
||||
userConfig: Error fetching user config
|
||||
updateUserConfig: Error updating user config
|
||||
tokenConfig: Error fetching token config
|
||||
writeRequest: The requested operation could not be completed
|
||||
login:
|
||||
|
@ -498,6 +512,8 @@ ticket:
|
|||
warehouse: Warehouse
|
||||
customerCard: Customer card
|
||||
alias: Alias
|
||||
ticketList: Ticket List
|
||||
newOrder: New Order
|
||||
boxing:
|
||||
expedition: Expedition
|
||||
item: Item
|
||||
|
@ -519,6 +535,7 @@ ticket:
|
|||
landed: Landed
|
||||
consigneePhone: Consignee phone
|
||||
consigneeMobile: Consignee mobile
|
||||
consigneeAddress: Consignee address
|
||||
clientPhone: Client phone
|
||||
clientMobile: Client mobile
|
||||
consignee: Consignee
|
||||
|
@ -547,6 +564,11 @@ ticket:
|
|||
weight: Weight
|
||||
goTo: Go to
|
||||
summaryAmount: Summary
|
||||
purchaseRequest: Purchase request
|
||||
service: Service
|
||||
description: Description
|
||||
attender: Attender
|
||||
ok: Ok
|
||||
create:
|
||||
client: Client
|
||||
address: Address
|
||||
|
@ -570,7 +592,6 @@ invoiceOut:
|
|||
client: Client
|
||||
company: Company
|
||||
customerCard: Customer card
|
||||
ticketList: Ticket List
|
||||
summary:
|
||||
issued: Issued
|
||||
created: Created
|
||||
|
@ -724,6 +745,7 @@ worker:
|
|||
locker: Locker
|
||||
balance: Balance
|
||||
medical: Medical
|
||||
operator: Operator
|
||||
list:
|
||||
name: Name
|
||||
email: Email
|
||||
|
@ -796,14 +818,14 @@ worker:
|
|||
bankEntity: Swift / BIC
|
||||
formation:
|
||||
tableVisibleColumns:
|
||||
course: Curso
|
||||
startDate: Fecha Inicio
|
||||
endDate: Fecha Fin
|
||||
center: Centro Formación
|
||||
invoice: Factura
|
||||
amount: Importe
|
||||
remark: Bonficado
|
||||
hasDiploma: Diploma
|
||||
course: Course
|
||||
startDate: Start date
|
||||
endDate: End date
|
||||
center: Training center
|
||||
invoice: Invoice
|
||||
amount: Amount
|
||||
remark: Remark
|
||||
hasDiploma: Has diploma
|
||||
medical:
|
||||
tableVisibleColumns:
|
||||
date: Date
|
||||
|
@ -821,6 +843,18 @@ worker:
|
|||
debit: Debt
|
||||
credit: Have
|
||||
concept: Concept
|
||||
operator:
|
||||
numberOfWagons: Number of wagons
|
||||
train: Train
|
||||
itemPackingType: Item packing type
|
||||
warehouse: Warehouse
|
||||
sector: Sector
|
||||
labeler: Printer
|
||||
linesLimit: Lines limit
|
||||
volumeLimit: Volume limit
|
||||
sizeLimit: Size limit
|
||||
isOnReservationMode: Reservation mode
|
||||
machine: Machine
|
||||
wagon:
|
||||
pageTitles:
|
||||
wagons: Wagons
|
||||
|
@ -860,34 +894,7 @@ wagon:
|
|||
minHeightBetweenTrays: 'The minimum height between trays is '
|
||||
maxWagonHeight: 'The maximum height of the wagon is '
|
||||
uncompleteTrays: There are incomplete trays
|
||||
route:
|
||||
pageTitles:
|
||||
agency: Agency List
|
||||
routes: Routes
|
||||
cmrsList: CMRs list
|
||||
RouteList: List
|
||||
routeCreate: New route
|
||||
basicData: Basic Data
|
||||
summary: Summary
|
||||
RouteRoadmap: Roadmaps
|
||||
RouteRoadmapCreate: Create roadmap
|
||||
tickets: Tickets
|
||||
log: Log
|
||||
autonomous: Autonomous
|
||||
cmr:
|
||||
list:
|
||||
results: results
|
||||
cmrFk: CMR id
|
||||
hasCmrDms: Attached in gestdoc
|
||||
'true': 'Yes'
|
||||
'false': 'No'
|
||||
ticketFk: Ticketd id
|
||||
routeFk: Route id
|
||||
country: Country
|
||||
clientFk: Client id
|
||||
shipped: Preparation date
|
||||
viewCmr: View CMR
|
||||
downloadCmrs: Download CMRs
|
||||
|
||||
supplier:
|
||||
list:
|
||||
payMethod: Pay method
|
||||
|
|
|
@ -49,6 +49,7 @@ globals:
|
|||
summary:
|
||||
basicData: Datos básicos
|
||||
daysOnward: Días adelante
|
||||
daysAgo: Días atras
|
||||
today: Hoy
|
||||
yesterday: Ayer
|
||||
dateFormat: es-ES
|
||||
|
@ -63,7 +64,7 @@ globals:
|
|||
shipped: F. envío
|
||||
totalEntries: Ent. totales
|
||||
amount: Importe
|
||||
packages: Bultos
|
||||
packages: Embalajes
|
||||
download: Descargar
|
||||
downloadPdf: Descargar PDF
|
||||
selectRows: 'Seleccionar las { numberRows } filas(s)'
|
||||
|
@ -106,6 +107,7 @@ globals:
|
|||
campaign: Campaña
|
||||
weight: Peso
|
||||
error: ¡Ups! Algo salió mal
|
||||
recalc: Recalcular
|
||||
pageTitles:
|
||||
logIn: Inicio de sesión
|
||||
addressEdit: Modificar consignatario
|
||||
|
@ -113,7 +115,7 @@ globals:
|
|||
basicData: Datos básicos
|
||||
log: Historial
|
||||
parkingList: Listado de parkings
|
||||
agencyList: Listado de agencias
|
||||
agencyList: Agencias
|
||||
agency: Agencia
|
||||
workCenters: Centros de trabajo
|
||||
modes: Modos
|
||||
|
@ -211,12 +213,13 @@ globals:
|
|||
roadmap: Troncales
|
||||
stops: Paradas
|
||||
routes: Rutas
|
||||
cmrsList: Listado de CMRs
|
||||
cmrsList: CMRs
|
||||
RouteList: Listado
|
||||
routeCreate: Nueva ruta
|
||||
RouteRoadmap: Troncales
|
||||
RouteRoadmapCreate: Crear troncal
|
||||
autonomous: Autónomos
|
||||
RouteExtendedList: Enrutador
|
||||
suppliers: Proveedores
|
||||
supplier: Proveedor
|
||||
supplierCreate: Nuevo proveedor
|
||||
|
@ -267,7 +270,7 @@ globals:
|
|||
tracking: Estados
|
||||
components: Componentes
|
||||
pictures: Fotos
|
||||
packages: Bultos
|
||||
packages: Embalajes
|
||||
ldap: LDAP
|
||||
samba: Samba
|
||||
twoFactor: Doble factor
|
||||
|
@ -277,6 +280,8 @@ globals:
|
|||
clientsActionsMonitor: Clientes y acciones
|
||||
serial: Facturas por serie
|
||||
medical: Mutua
|
||||
wasteRecalc: Recalcular mermas
|
||||
operator: Operario
|
||||
supplier: Proveedor
|
||||
created: Fecha creación
|
||||
worker: Trabajador
|
||||
|
@ -292,7 +297,10 @@ globals:
|
|||
createInvoiceIn: Crear factura recibida
|
||||
myAccount: Mi cuenta
|
||||
noOne: Nadie
|
||||
maxTemperature: Máx
|
||||
minTemperature: Mín
|
||||
params:
|
||||
id: Id
|
||||
clientFk: Id cliente
|
||||
salesPersonFk: Comercial
|
||||
warehouseFk: Almacén
|
||||
|
@ -300,8 +308,13 @@ globals:
|
|||
from: Desde
|
||||
To: Hasta
|
||||
stateFk: Estado
|
||||
myTeam: Mi equipo
|
||||
departmentFk: Departamento
|
||||
email: Correo
|
||||
SSN: NSS
|
||||
fi: NIF
|
||||
myTeam: Mi equipo
|
||||
changePass: Cambiar contraseña
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
changeState: Cambiar estado
|
||||
errors:
|
||||
statusUnauthorized: Acceso denegado
|
||||
|
@ -309,6 +322,7 @@ errors:
|
|||
statusBadGateway: Parece ser que el servidor ha caído
|
||||
statusGatewayTimeout: No se ha podido contactar con el servidor
|
||||
userConfig: Error al obtener configuración de usuario
|
||||
updateUserConfig: Error al actualizar la configuración de usuario
|
||||
tokenConfig: Error al obtener configuración de token
|
||||
writeRequest: No se pudo completar la operación solicitada
|
||||
login:
|
||||
|
@ -489,7 +503,7 @@ ticket:
|
|||
tracking: Estados
|
||||
components: Componentes
|
||||
pictures: Fotos
|
||||
packages: Bultos
|
||||
packages: Embalajes
|
||||
list:
|
||||
nickname: Alias
|
||||
state: Estado
|
||||
|
@ -507,6 +521,8 @@ ticket:
|
|||
warehouse: Almacén
|
||||
customerCard: Ficha del cliente
|
||||
alias: Alias
|
||||
ticketList: Listado de tickets
|
||||
newOrder: Nuevo pedido
|
||||
boxing:
|
||||
expedition: Expedición
|
||||
item: Artículo
|
||||
|
@ -528,6 +544,7 @@ ticket:
|
|||
landed: Entregado
|
||||
consigneePhone: Tel. consignatario
|
||||
consigneeMobile: Móv. consignatario
|
||||
consigneeAddress: Dir. consignatario
|
||||
clientPhone: Tel. cliente
|
||||
clientMobile: Móv. cliente
|
||||
consignee: Consignatario
|
||||
|
@ -556,6 +573,10 @@ ticket:
|
|||
weight: Peso
|
||||
goTo: Ir a
|
||||
summaryAmount: Resumen
|
||||
purchaseRequest: Petición de compra
|
||||
service: Servicio
|
||||
description: Descripción
|
||||
attender: Consignatario
|
||||
create:
|
||||
client: Cliente
|
||||
address: Dirección
|
||||
|
@ -731,6 +752,7 @@ worker:
|
|||
balance: Balance
|
||||
formation: Formación
|
||||
medical: Mutua
|
||||
operator: Operario
|
||||
list:
|
||||
name: Nombre
|
||||
email: Email
|
||||
|
@ -819,6 +841,19 @@ worker:
|
|||
debit: Debe
|
||||
credit: Haber
|
||||
concept: Concepto
|
||||
operator:
|
||||
numberOfWagons: Número de vagones
|
||||
train: tren
|
||||
itemPackingType: Tipo de embalaje
|
||||
warehouse: Almacén
|
||||
sector: Sector
|
||||
labeler: Impresora
|
||||
linesLimit: Líneas límite
|
||||
volumeLimit: Volumen límite
|
||||
sizeLimit: Tamaño límite
|
||||
isOnReservationMode: Modo de reserva
|
||||
machine: Máquina
|
||||
|
||||
wagon:
|
||||
pageTitles:
|
||||
wagons: Vagones
|
||||
|
@ -858,21 +893,6 @@ wagon:
|
|||
minHeightBetweenTrays: 'La distancia mínima entre bandejas es '
|
||||
maxWagonHeight: 'La altura máxima del vagón es '
|
||||
uncompleteTrays: Hay bandejas sin completar
|
||||
route:
|
||||
cmr:
|
||||
list:
|
||||
results: resultados
|
||||
cmrFk: Id CMR
|
||||
hasCmrDms: Gestdoc
|
||||
'true': Sí
|
||||
'false': 'No'
|
||||
ticketFk: Id ticket
|
||||
routeFk: Id ruta
|
||||
country: País
|
||||
clientFk: Id cliente
|
||||
shipped: Fecha preparación
|
||||
viewCmr: Ver CMR
|
||||
downloadCmrs: Descargar CMRs
|
||||
supplier:
|
||||
list:
|
||||
payMethod: Método de pago
|
||||
|
|
|
@ -10,7 +10,9 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
|||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
|
||||
const filter = {
|
||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -22,7 +24,22 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'username',
|
||||
name: 'roleFk',
|
||||
label: t('role'),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
name: 'roleFk',
|
||||
attrs: {
|
||||
url: 'VnRoles',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
},
|
||||
},
|
||||
format: ({ role }, dashIfEmpty) => dashIfEmpty(role?.name),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'nickname',
|
||||
label: t('Nickname'),
|
||||
isTitle: true,
|
||||
component: 'input',
|
||||
|
@ -91,6 +108,7 @@ const exprBuilder = (param, value) => {
|
|||
:expr-builder="exprBuilder"
|
||||
:label="t('account.search')"
|
||||
:info="t('account.searchInfo')"
|
||||
:filter="filter"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
|
@ -101,6 +119,7 @@ const exprBuilder = (param, value) => {
|
|||
ref="tableRef"
|
||||
data-key="AccountUsers"
|
||||
url="VnUsers/preview"
|
||||
:filter="filter"
|
||||
order="id DESC"
|
||||
:columns="columns"
|
||||
default-mode="table"
|
||||
|
|
|
@ -46,13 +46,9 @@ const columns = computed(() => [
|
|||
]);
|
||||
|
||||
const deleteAlias = async (row) => {
|
||||
try {
|
||||
await axios.delete(`${urlPath.value}/${row.id}`);
|
||||
notify(t('User removed'), 'positive');
|
||||
fetchAliases();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
await axios.delete(`${urlPath.value}/${row.id}`);
|
||||
notify(t('User removed'), 'positive');
|
||||
fetchAliases();
|
||||
};
|
||||
|
||||
watch(
|
||||
|
|
|
@ -4,9 +4,12 @@ import { computed, ref, toRefs } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const $props = defineProps({
|
||||
hasAccount: {
|
||||
type: Boolean,
|
||||
|
@ -62,6 +65,19 @@ async function sync() {
|
|||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnChangePassword
|
||||
ref="changePassRef"
|
||||
:ask-old-pass="true"
|
||||
:submit-fn="
|
||||
async (newPassword, oldPassword) => {
|
||||
await axios.patch(`Accounts/change-password`, {
|
||||
userId: entityId,
|
||||
newPassword,
|
||||
oldPassword,
|
||||
});
|
||||
}
|
||||
"
|
||||
/>
|
||||
<VnConfirm
|
||||
v-model="showSyncDialog"
|
||||
:message="t('account.card.actions.sync.message')"
|
||||
|
@ -92,6 +108,17 @@ async function sync() {
|
|||
/>
|
||||
</template>
|
||||
</VnConfirm>
|
||||
<QItem
|
||||
v-if="
|
||||
entityId == account.id &&
|
||||
useAcl().hasAny([{ model: 'Account', props: '*', accessType: 'WRITE' }])
|
||||
"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="$refs.changePassRef.show()"
|
||||
>
|
||||
<QItemSection>{{ t('globals.changePass') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="account.hasAccount"
|
||||
v-ripple
|
||||
|
@ -138,6 +165,5 @@ async function sync() {
|
|||
<QItem v-ripple clickable @click="showSyncDialog = true">
|
||||
<QItemSection>{{ t('account.card.actions.sync.name') }}</QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QSeparator />
|
||||
</template>
|
||||
|
|
|
@ -61,23 +61,15 @@ const fetchAccountExistence = async () => {
|
|||
};
|
||||
|
||||
const deleteMailAlias = async (row) => {
|
||||
try {
|
||||
await axios.delete(`${urlPath}/${row.id}`);
|
||||
fetchMailAliases();
|
||||
notify(t('Unsubscribed from alias!'), 'positive');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
await axios.delete(`${urlPath}/${row.id}`);
|
||||
fetchMailAliases();
|
||||
notify(t('Unsubscribed from alias!'), 'positive');
|
||||
};
|
||||
|
||||
const createMailAlias = async (mailAliasFormData) => {
|
||||
try {
|
||||
await axios.post(urlPath, mailAliasFormData);
|
||||
notify(t('Subscribed to alias!'), 'positive');
|
||||
fetchMailAliases();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
await axios.post(urlPath, mailAliasFormData);
|
||||
notify(t('Subscribed to alias!'), 'positive');
|
||||
fetchMailAliases();
|
||||
};
|
||||
|
||||
const fetchMailAliases = async () => {
|
||||
|
|
|
@ -46,29 +46,15 @@ const columns = computed(() => [
|
|||
]);
|
||||
|
||||
const deleteSubRole = async (row) => {
|
||||
try {
|
||||
await axios.delete(`${urlPath.value}/${row.id}`);
|
||||
fetchSubRoles();
|
||||
notify(
|
||||
t('Role removed. Changes will take a while to fully propagate.'),
|
||||
'positive'
|
||||
);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
await axios.delete(`${urlPath.value}/${row.id}`);
|
||||
fetchSubRoles();
|
||||
notify(t('Role removed. Changes will take a while to fully propagate.'), 'positive');
|
||||
};
|
||||
|
||||
const createSubRole = async (subRoleFormData) => {
|
||||
try {
|
||||
await axios.post(urlPath.value, subRoleFormData);
|
||||
notify(
|
||||
t('Role added! Changes will take a while to fully propagate.'),
|
||||
'positive'
|
||||
);
|
||||
fetchSubRoles();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
await axios.post(urlPath.value, subRoleFormData);
|
||||
notify(t('Role added! Changes will take a while to fully propagate.'), 'positive');
|
||||
fetchSubRoles();
|
||||
};
|
||||
|
||||
watch(
|
||||
|
|
|
@ -0,0 +1,177 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import { QItem } from 'quasar';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { QItemSection } from 'quasar';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
const { t } = useI18n();
|
||||
defineProps({ dataKey: { type: String, required: true } });
|
||||
</script>
|
||||
<template>
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.item')"
|
||||
v-model="params.itemId"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
v-model="params.buyerId"
|
||||
url="TicketRequests/getItemTypeWorker"
|
||||
:fields="['id', 'nickname']"
|
||||
sort-by="nickname ASC"
|
||||
:label="t('params.buyer')"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
v-model="params.typeId"
|
||||
url="ItemTypes"
|
||||
:include="['category']"
|
||||
:fields="['id', 'name', 'categoryFk']"
|
||||
sort-by="name ASC"
|
||||
:label="t('params.typeId')"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>{{
|
||||
scope.opt?.category?.name
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
v-model="params.categoryId"
|
||||
url="ItemCategories"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="name ASC"
|
||||
:label="t('params.categoryId')"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
v-model="params.campaignId"
|
||||
url="Campaigns/latest"
|
||||
sort-by="dated DESC"
|
||||
:label="t('params.campaignId')"
|
||||
option-label="code"
|
||||
option-value="id"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
t(`params.${scope.opt?.code}`)
|
||||
}}</QItemLabel>
|
||||
<QItemLabel caption>{{
|
||||
toDate(scope.opt.dated)
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('params.from')"
|
||||
v-model="params.from"
|
||||
@update:model-value="searchFn()"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('params.to')"
|
||||
v-model="params.to"
|
||||
@update:model-value="searchFn()"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
item: Item id
|
||||
buyer: Buyer
|
||||
type: Type
|
||||
category: Category
|
||||
itemId: Item id
|
||||
buyerId: Buyer
|
||||
typeId: Type
|
||||
categoryId: Category
|
||||
from: From
|
||||
to: To
|
||||
campaignId: Campaña
|
||||
valentinesDay: Valentine's Day
|
||||
mothersDay: Mother's Day
|
||||
allSaints: All Saints' Day
|
||||
es:
|
||||
params:
|
||||
item: Id artículo
|
||||
buyer: Comprador
|
||||
type: Tipo
|
||||
category: Categoría
|
||||
itemId: Id Artículo
|
||||
buyerId: Comprador
|
||||
typeId: Tipo
|
||||
categoryId: Reino
|
||||
from: Desde
|
||||
to: Hasta
|
||||
campaignId: Campaña
|
||||
valentinesDay: Día de San Valentín
|
||||
mothersDay: Día de la Madre
|
||||
allSaints: Día de Todos los Santos
|
||||
</i18n>
|
|
@ -22,5 +22,6 @@ const noteFilter = computed(() => {
|
|||
:filter="noteFilter"
|
||||
:body="{ clientFk: route.params.id }"
|
||||
style="overflow-y: auto"
|
||||
:select-type="true"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -92,7 +92,7 @@ const onSubmit = async () => {
|
|||
notify('globals.dataSaved', 'positive');
|
||||
unpaidClient.value = true;
|
||||
} catch (error) {
|
||||
notify('errors.create', 'negative');
|
||||
notify('errors.writeRequest', 'negative');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
|
|
@ -3,14 +3,11 @@ import { computed, ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const route = useRoute();
|
||||
const canChangePassword = ref(0);
|
||||
|
||||
|
@ -21,21 +18,11 @@ const filter = computed(() => {
|
|||
};
|
||||
});
|
||||
|
||||
const showChangePasswordDialog = () => {
|
||||
quasar.dialog({
|
||||
component: CustomerChangePassword,
|
||||
componentProps: {
|
||||
id: route.params.id,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
async function hasCustomerRole() {
|
||||
const { data } = await axios(`Clients/${route.params.id}/hasCustomerRole`);
|
||||
canChangePassword.value = data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormModel
|
||||
url="VnUsers/preview"
|
||||
|
@ -69,21 +56,29 @@ async function hasCustomerRole() {
|
|||
</template>
|
||||
<template #moreActions>
|
||||
<QBtn
|
||||
:label="t('Change password')"
|
||||
:label="t('globals.changePass')"
|
||||
color="primary"
|
||||
icon="edit"
|
||||
:disable="!canChangePassword"
|
||||
@click="showChangePasswordDialog()"
|
||||
@click="$refs.changePassRef.show"
|
||||
/>
|
||||
</template>
|
||||
</FormModel>
|
||||
<VnChangePassword
|
||||
ref="changePassRef"
|
||||
:submit-fn="
|
||||
async (newPass) => {
|
||||
await axios.patch(`Clients/${$route.params.id}/setPassword`, {
|
||||
newPassword: newPass,
|
||||
});
|
||||
}
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Enable web access: Habilitar acceso web
|
||||
User: Usuario
|
||||
Recovery email: Correo de recuperacion
|
||||
This email is used for user to regain access their account: Este correo electrónico se usa para que el usuario recupere el acceso a su cuenta
|
||||
Change password: Cambiar contraseña
|
||||
</i18n>
|
||||
|
|
|
@ -25,19 +25,31 @@ const { notify } = useNotify();
|
|||
const { t } = useI18n();
|
||||
|
||||
const newObservation = ref(null);
|
||||
const obsId = ref(null);
|
||||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
const data = $props.clients.map((item) => {
|
||||
return { clientFk: item.clientFk, text: newObservation.value };
|
||||
});
|
||||
await axios.post('ClientObservations', data);
|
||||
if (!obsId.value)
|
||||
obsId.value = (
|
||||
await axios.get('ObservationTypes/findOne', {
|
||||
params: { filter: { where: { description: 'Finance' } } },
|
||||
})
|
||||
).data?.id;
|
||||
|
||||
const payload = {
|
||||
const bodyObs = $props.clients.map((item) => {
|
||||
return {
|
||||
clientFk: item.clientFk,
|
||||
text: newObservation.value,
|
||||
observationTypeFk: obsId.value,
|
||||
};
|
||||
});
|
||||
await axios.post('ClientObservations', bodyObs);
|
||||
|
||||
const bodyObsMail = {
|
||||
defaulters: $props.clients,
|
||||
observation: newObservation.value,
|
||||
};
|
||||
await axios.post('Defaulters/observationEmail', payload);
|
||||
await axios.post('Defaulters/observationEmail', bodyObsMail);
|
||||
|
||||
await $props.promise();
|
||||
|
||||
|
|
|
@ -240,39 +240,33 @@ function handleLocation(data, location) {
|
|||
class="row q-gutter-md q-mb-md"
|
||||
v-for="(note, index) in notes"
|
||||
>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('Observation type')"
|
||||
:options="observationTypes"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
v-model="note.observationTypeFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Description')"
|
||||
:rules="validate('route.description')"
|
||||
clearable
|
||||
v-model="note.description"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<QIcon
|
||||
@click.stop="deleteNote(note.id, index)"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Remove note') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnSelect
|
||||
:label="t('Observation type')"
|
||||
:options="observationTypes"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
v-model="note.observationTypeFk"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('Description')"
|
||||
:rules="validate('route.description')"
|
||||
clearable
|
||||
v-model="note.description"
|
||||
/>
|
||||
<QIcon
|
||||
:style="{ flex: 0, 'align-self': $q.screen.gt.xs ? 'end' : 'center' }"
|
||||
@click.stop="deleteNote(note.id, index)"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Remove note') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</VnRow>
|
||||
|
||||
<QBtn
|
||||
@click.stop="addNote()"
|
||||
class="cursor-pointer add-icon q-mt-md"
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import axios from 'axios';
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
|
||||
const { dialogRef } = useDialogPluginComponent();
|
||||
const { notify } = useNotify();
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
promise: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const userPasswords = ref({});
|
||||
|
||||
const closeButton = ref(null);
|
||||
const isLoading = ref(false);
|
||||
const newPassword = ref('');
|
||||
const requestPassword = ref('');
|
||||
|
||||
const onSubmit = async () => {
|
||||
isLoading.value = true;
|
||||
|
||||
if (newPassword.value !== requestPassword.value) {
|
||||
notify(t("Passwords don't match"), 'negative');
|
||||
isLoading.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
newPassword: newPassword.value,
|
||||
};
|
||||
try {
|
||||
await axios.patch(`Clients/${$props.id}/setPassword`, payload);
|
||||
} catch (error) {
|
||||
notify('errors.create', 'negative');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef">
|
||||
<FetchData
|
||||
@on-fetch="(data) => (userPasswords = data[0])"
|
||||
auto-load
|
||||
url="UserPasswords"
|
||||
/>
|
||||
<QCard class="q-pa-lg">
|
||||
<QCardSection>
|
||||
<QForm @submit.prevent="onSubmit">
|
||||
<span
|
||||
ref="closeButton"
|
||||
class="row justify-end close-icon"
|
||||
v-close-popup
|
||||
>
|
||||
<QIcon name="close" size="sm" />
|
||||
</span>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md" style="flex-direction: column">
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('New password')"
|
||||
clearable
|
||||
v-model="newPassword"
|
||||
type="password"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-info">
|
||||
<QTooltip>
|
||||
{{
|
||||
t('customer.card.passwordRequirements', {
|
||||
...userPasswords,
|
||||
})
|
||||
}}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Request password')"
|
||||
clearable
|
||||
v-model="requestPassword"
|
||||
type="password"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:label="t('globals.cancel')"
|
||||
:loading="isLoading"
|
||||
class="q-ml-sm"
|
||||
color="primary"
|
||||
flat
|
||||
type="reset"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:label="t('Change password')"
|
||||
:loading="isLoading"
|
||||
color="primary"
|
||||
type="submit"
|
||||
/>
|
||||
</div>
|
||||
</QForm>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
New password: Nueva contraseña
|
||||
Request password: Repetir contraseña
|
||||
Change password: Cambiar contraseña
|
||||
Passwords don't match: Las contraseñas no coinciden
|
||||
</i18n>
|
|
@ -138,7 +138,7 @@ const onSubmit = async () => {
|
|||
notify('globals.dataSaved', 'positive');
|
||||
onDataSaved(data);
|
||||
} catch (error) {
|
||||
notify('errors.create', 'negative');
|
||||
notify('errors.writeRequest', 'negative');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import { useRoute, useRouter } from 'vue-router';
|
|||
import { date } from 'quasar';
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
|
||||
import { toCurrency } from 'src/filters';
|
||||
import { dashIfEmpty, toCurrency } from 'src/filters';
|
||||
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import TicketSummary from 'src/pages/Ticket/Card/TicketSummary.vue';
|
||||
|
@ -32,6 +32,16 @@ const filter = {
|
|||
},
|
||||
{ relation: 'invoiceOut', scope: { fields: ['id'] } },
|
||||
{ relation: 'agencyMode', scope: { fields: ['name'] } },
|
||||
{
|
||||
relation: 'ticketSales',
|
||||
scope: {
|
||||
fields: ['id', 'concept', 'itemFk'],
|
||||
include: { relation: 'item' },
|
||||
scope: {
|
||||
fields: ['id', 'name', 'itemPackingTypeFk'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
where: { clientFk: route.params.id },
|
||||
order: ['shipped DESC', 'id'],
|
||||
|
@ -87,7 +97,12 @@ const columns = computed(() => [
|
|||
label: t('Total'),
|
||||
name: 'total',
|
||||
},
|
||||
|
||||
{
|
||||
align: 'left',
|
||||
name: 'itemPackingTypeFk',
|
||||
label: t('ticketSale.packaging'),
|
||||
format: (row) => getItemPackagingType(row),
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
|
@ -135,6 +150,15 @@ const setShippedColor = (date) => {
|
|||
if (difference == 0) return 'warning';
|
||||
if (difference < 0) return 'success';
|
||||
};
|
||||
|
||||
const getItemPackagingType = (row) => {
|
||||
const packagingType = row?.ticketSales
|
||||
.map((sale) => sale.item?.itemPackingTypeFk || '-')
|
||||
.filter((value) => value !== '-')
|
||||
.join(', ');
|
||||
|
||||
return dashIfEmpty(packagingType);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -11,6 +11,7 @@ import { toDate, toCurrency } from 'src/filters';
|
|||
import { getUrl } from 'src/composables/getUrl';
|
||||
import axios from 'axios';
|
||||
import FetchedTags from 'src/components/ui/FetchedTags.vue';
|
||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -163,14 +164,12 @@ const fetchEntryBuys = async () => {
|
|||
data-key="EntrySummary"
|
||||
>
|
||||
<template #header-left>
|
||||
<router-link
|
||||
<VnToSummary
|
||||
v-if="route?.name !== 'EntrySummary'"
|
||||
:to="{ name: 'EntrySummary', params: { id: entityId } }"
|
||||
class="header link"
|
||||
:href="entryUrl"
|
||||
>
|
||||
<QIcon name="open_in_new" color="white" size="sm" />
|
||||
</router-link>
|
||||
:route-name="'EntrySummary'"
|
||||
:entity-id="entityId"
|
||||
:url="entryUrl"
|
||||
/>
|
||||
</template>
|
||||
<template #header>
|
||||
<span>{{ entry.id }} - {{ entry.supplier.nickname }}</span>
|
||||
|
|
|
@ -0,0 +1,301 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import EntryStockBoughtFilter from './EntryStockBoughtFilter.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import EntryStockBoughtDetail from 'src/pages/Entry/EntryStockBoughtDetail.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
const columns = [
|
||||
{
|
||||
align: 'left',
|
||||
label: 'Id',
|
||||
name: 'id',
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('Buyer'),
|
||||
isTitle: true,
|
||||
component: 'select',
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
where: { role: 'buyer' },
|
||||
optionFilter: 'firstName',
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
useLike: false,
|
||||
},
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
label: t('Reserve'),
|
||||
name: 'reserve',
|
||||
columnFilter: false,
|
||||
create: true,
|
||||
component: 'number',
|
||||
summation: true,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
label: t('Bought'),
|
||||
name: 'bought',
|
||||
summation: true,
|
||||
cardVisible: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('Date'),
|
||||
name: 'dated',
|
||||
component: 'date',
|
||||
visible: false,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('View more details'),
|
||||
icon: 'search',
|
||||
isPrimary: true,
|
||||
action: (row) => {
|
||||
quasar.dialog({
|
||||
component: EntryStockBoughtDetail,
|
||||
componentProps: {
|
||||
workerFk: row.workerFk,
|
||||
dated: userParams.value.dated,
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const fetchDataRef = ref();
|
||||
const travelDialogRef = ref(false);
|
||||
const tableRef = ref();
|
||||
const travel = ref(null);
|
||||
const userParams = ref({
|
||||
dated: Date.vnNew(),
|
||||
});
|
||||
|
||||
const filter = ref({
|
||||
fields: ['id', 'm3', 'warehouseInFk'],
|
||||
include: [
|
||||
{
|
||||
relation: 'warehouseIn',
|
||||
scope: {
|
||||
fields: ['code'],
|
||||
},
|
||||
},
|
||||
],
|
||||
where: {
|
||||
shipped: (userParams.value.dated
|
||||
? new Date(userParams.value.dated)
|
||||
: Date.vnNew()
|
||||
).setHours(0, 0, 0, 0),
|
||||
m3: { neq: null },
|
||||
},
|
||||
});
|
||||
|
||||
const setUserParams = async ({ dated }) => {
|
||||
const shipped = (dated ? new Date(dated) : Date.vnNew()).setHours(0, 0, 0, 0);
|
||||
filter.value.where.shipped = shipped;
|
||||
fetchDataRef.value?.fetch();
|
||||
};
|
||||
|
||||
function openDialog() {
|
||||
travelDialogRef.value = true;
|
||||
}
|
||||
|
||||
function setFooter(data) {
|
||||
const footer = {
|
||||
bought: 0,
|
||||
reserve: 0,
|
||||
};
|
||||
data.forEach((row) => {
|
||||
footer.bought += row?.bought;
|
||||
footer.reserve += row?.reserve;
|
||||
});
|
||||
tableRef.value.footer = footer;
|
||||
}
|
||||
|
||||
function round(value) {
|
||||
return Math.round(value * 100) / 100;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnSubToolbar>
|
||||
<template #st-data>
|
||||
<FetchData
|
||||
ref="fetchDataRef"
|
||||
url="Travels"
|
||||
auto-load
|
||||
:filter="filter"
|
||||
@on-fetch="
|
||||
(data) => {
|
||||
travel = data.find(
|
||||
(data) => data.warehouseIn?.code.toLowerCase() === 'vnh'
|
||||
);
|
||||
}
|
||||
"
|
||||
/>
|
||||
<VnRow class="travel">
|
||||
<div v-if="travel">
|
||||
<span style="color: var(--vn-label-color)">
|
||||
{{ t('Purchase Spaces') }}:
|
||||
</span>
|
||||
<span>
|
||||
{{ travel?.m3 }}
|
||||
</span>
|
||||
<QBtn
|
||||
v-if="travel?.m3"
|
||||
style="max-width: 20%"
|
||||
flat
|
||||
icon="edit"
|
||||
@click="openDialog()"
|
||||
:title="t('Edit travel')"
|
||||
color="primary"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<QDialog v-model="travelDialogRef" :maximized="true" :class="['vn-row', 'wrap']">
|
||||
<FormModelPopup
|
||||
:url-update="`Travels/${travel?.id}`"
|
||||
model="travel"
|
||||
:title="t('Travel m3')"
|
||||
:form-initial-data="{ id: travel?.id, m3: travel?.m3 }"
|
||||
@on-data-saved="fetchDataRef.fetch()"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<VnInput
|
||||
v-model="data.id"
|
||||
:label="t('id')"
|
||||
type="number"
|
||||
disable
|
||||
readonly
|
||||
/>
|
||||
<VnInput v-model="data.m3" :label="t('m3')" type="number" />
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
</QDialog>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<EntryStockBoughtFilter
|
||||
data-key="StockBoughts"
|
||||
@set-user-params="setUserParams"
|
||||
/>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<div class="table-container">
|
||||
<div class="column items-center">
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="StockBoughts"
|
||||
url="StockBoughts/getStockBought"
|
||||
save-url="StockBoughts/crud"
|
||||
order="reserve DESC"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
@on-fetch="(data) => setFooter(data)"
|
||||
:create="{
|
||||
urlCreate: 'StockBoughts',
|
||||
title: t('Reserve some space'),
|
||||
onDataSaved: () => tableRef.reload(),
|
||||
formInitialData: {
|
||||
workerFk: user.id,
|
||||
dated: Date.vnNow(),
|
||||
},
|
||||
}"
|
||||
:columns="columns"
|
||||
:user-params="userParams"
|
||||
:footer="true"
|
||||
table-height="80vh"
|
||||
auto-load
|
||||
:column-search="false"
|
||||
>
|
||||
<template #column-workerFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row?.worker?.user?.name }}
|
||||
<WorkerDescriptorProxy :id="row?.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-bought="{ row }">
|
||||
<span :class="{ 'text-negative': row.reserve < row.bought }">
|
||||
{{ row?.bought }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-footer-reserve>
|
||||
<span>
|
||||
{{ round(tableRef.footer.reserve) }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-footer-bought>
|
||||
<span
|
||||
:class="{
|
||||
'text-negative':
|
||||
tableRef.footer.reserve < tableRef.footer.bought,
|
||||
}"
|
||||
>
|
||||
{{ round(tableRef.footer.bought) }}
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.travel {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.table-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.text-negative {
|
||||
color: $negative !important;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Edit travel: Editar envío
|
||||
Travel: Envíos
|
||||
Purchase Spaces: Espacios de compra
|
||||
Buyer: Comprador
|
||||
Reserve: Reservado
|
||||
Bought: Comprado
|
||||
Date: Fecha
|
||||
View more details: Ver más detalles
|
||||
Reserve some space: Reservar espacio
|
||||
This buyer has already made a reservation for this date: Este comprador ya ha hecho una reserva para esta fecha
|
||||
</i18n>
|
|
@ -0,0 +1,126 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const $props = defineProps({
|
||||
workerFk: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
dated: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const customUrl = `StockBoughts/getStockBoughtDetail?workerFk=${$props.workerFk}&date=${$props.dated}`;
|
||||
const columns = [
|
||||
{
|
||||
align: 'left',
|
||||
label: t('Entry'),
|
||||
name: 'entryFk',
|
||||
isTitle: true,
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'itemFk',
|
||||
label: t('Item'),
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('Name'),
|
||||
name: 'itemName',
|
||||
create: true,
|
||||
columnClass: 'expand',
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'volume',
|
||||
label: t('Volume'),
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('Packaging'),
|
||||
name: 'packagingFk',
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: 'Packing',
|
||||
name: 'packing',
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
},
|
||||
];
|
||||
</script>
|
||||
<template>
|
||||
<QDialog>
|
||||
<div class="container">
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="StockBoughtsDetail"
|
||||
:url="customUrl"
|
||||
order="itemName DESC"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:disable-infinite-scroll="true"
|
||||
:disable-option="{ card: true }"
|
||||
:limit="0"
|
||||
auto-load
|
||||
>
|
||||
<template #column-entryFk="{ row }">
|
||||
<span class="link">
|
||||
{{ row?.entryFk }}
|
||||
<EntryDescriptorProxy :id="row.entryFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-itemName="{ row }">
|
||||
<span class="link">
|
||||
{{ row?.itemName }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</div>
|
||||
</QDialog>
|
||||
</template>
|
||||
<style lang="css" scoped>
|
||||
.container {
|
||||
max-width: 50vw;
|
||||
overflow: auto;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: auto;
|
||||
background-color: var(--vn-section-color);
|
||||
padding: 4px;
|
||||
}
|
||||
.container > div > div > .q-table__top.relative-position.row.items-center {
|
||||
background-color: red !important;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Buyer: Comprador
|
||||
Reserve: Reservado
|
||||
Bought: Comprado
|
||||
More: Más
|
||||
Date: Fecha
|
||||
Entry: Entrada
|
||||
Item: Artículo
|
||||
Name: Nombre
|
||||
Volume: Volumen
|
||||
Packaging: Embalage
|
||||
</i18n>
|
|
@ -0,0 +1,63 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { onMounted } from 'vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const stateStore = useStateStore();
|
||||
const emit = defineEmits(['set-user-params']);
|
||||
const setUserParams = (params) => {
|
||||
emit('set-user-params', params);
|
||||
};
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
search-url="table"
|
||||
@set-user-params="setUserParams"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
id="date"
|
||||
v-model="params.dated"
|
||||
:label="t('Date')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
dated: Date
|
||||
workerFk: Worker
|
||||
es:
|
||||
Date: Fecha
|
||||
params:
|
||||
dated: Date
|
||||
workerFk: Trabajador
|
||||
</i18n>
|
|
@ -0,0 +1,72 @@
|
|||
<script setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const isLoading = ref(false);
|
||||
const dateFrom = ref();
|
||||
const dateTo = ref();
|
||||
|
||||
const optionsTo = computed(() => (date) => {
|
||||
if (!dateFrom.value) return true;
|
||||
return new Date(date) >= new Date(dateFrom.value);
|
||||
});
|
||||
|
||||
watch(dateFrom, (newDateFrom) => {
|
||||
if (dateTo.value && new Date(dateTo.value) < new Date(newDateFrom))
|
||||
dateTo.value = newDateFrom;
|
||||
});
|
||||
|
||||
const recalc = async () => {
|
||||
const { notify } = useNotify();
|
||||
|
||||
const params = {
|
||||
schema: 'bs',
|
||||
params: [new Date(dateFrom.value), new Date(dateTo.value)],
|
||||
};
|
||||
|
||||
try {
|
||||
isLoading.value = true;
|
||||
await axios.post('Applications/waste_addSales/execute-proc', params);
|
||||
notify('wasteRecalc.recalcOk', 'positive');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="q-pa-lg row justify-center">
|
||||
<QCard class="bg-light" style="width: 300px">
|
||||
<QCardSection>
|
||||
<VnInputDate
|
||||
class="q-mb-lg"
|
||||
v-model="dateFrom"
|
||||
:label="$t('globals.from')"
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
<VnInputDate
|
||||
class="q-mb-lg"
|
||||
v-model="dateTo"
|
||||
:options="optionsTo"
|
||||
:label="$t('globals.to')"
|
||||
:disable="!dateFrom"
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
<QBtn
|
||||
color="primary"
|
||||
text-color="white"
|
||||
:label="$t('globals.recalc')"
|
||||
:loading="isLoading"
|
||||
:disable="isLoading || !(dateFrom && dateTo)"
|
||||
@click="recalc()"
|
||||
/>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</div>
|
||||
</template>
|
|
@ -9,22 +9,27 @@ import VnTable from 'components/VnTable/VnTable.vue';
|
|||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const params = {
|
||||
daysOnward: 7,
|
||||
daysAgo: 3,
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'id',
|
||||
label: t('customer.extendedList.tableVisibleColumns.id'),
|
||||
label: t('myEntries.id'),
|
||||
columnFilter: false,
|
||||
isTitle: true,
|
||||
},
|
||||
{
|
||||
visible: false,
|
||||
align: 'right',
|
||||
label: t('shipped'),
|
||||
label: t('myEntries.shipped'),
|
||||
name: 'shipped',
|
||||
columnFilter: {
|
||||
name: 'fromShipped',
|
||||
label: t('fromShipped'),
|
||||
label: t('myEntries.fromShipped'),
|
||||
component: 'date',
|
||||
},
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
|
@ -32,11 +37,11 @@ const columns = computed(() => [
|
|||
{
|
||||
visible: false,
|
||||
align: 'left',
|
||||
label: t('shipped'),
|
||||
label: t('myEntries.shipped'),
|
||||
name: 'shipped',
|
||||
columnFilter: {
|
||||
name: 'toShipped',
|
||||
label: t('toShipped'),
|
||||
label: t('myEntries.toShipped'),
|
||||
component: 'date',
|
||||
},
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
|
@ -44,14 +49,14 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: t('shipped'),
|
||||
label: t('myEntries.shipped'),
|
||||
name: 'shipped',
|
||||
columnFilter: false,
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: t('landed'),
|
||||
label: t('myEntries.landed'),
|
||||
name: 'landed',
|
||||
columnFilter: false,
|
||||
format: ({ landed }) => toDate(landed),
|
||||
|
@ -59,26 +64,36 @@ const columns = computed(() => [
|
|||
|
||||
{
|
||||
align: 'right',
|
||||
label: t('globals.wareHouseIn'),
|
||||
label: t('myEntries.wareHouseIn'),
|
||||
name: 'warehouseInFk',
|
||||
format: (row) => row.warehouseInName,
|
||||
format: (row) => {
|
||||
row.warehouseInName;
|
||||
},
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
name: 'warehouseInFk',
|
||||
label: t('myEntries.warehouseInFk'),
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'warehouses',
|
||||
fields: ['id', 'name'],
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
alias: 't',
|
||||
},
|
||||
alias: 't',
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.daysOnward'),
|
||||
name: 'days',
|
||||
label: t('myEntries.daysOnward'),
|
||||
name: 'daysOnward',
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('myEntries.daysAgo'),
|
||||
name: 'daysAgo',
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
|
@ -88,6 +103,7 @@ const columns = computed(() => [
|
|||
{
|
||||
title: t('printLabels'),
|
||||
icon: 'print',
|
||||
isPrimary: true,
|
||||
action: (row) => printBuys(row.id),
|
||||
},
|
||||
],
|
||||
|
@ -114,9 +130,11 @@ const printBuys = (rowId) => {
|
|||
data-key="myEntriesList"
|
||||
url="Entries/filter"
|
||||
:columns="columns"
|
||||
:user-params="params"
|
||||
default-mode="card"
|
||||
order="shipped DESC"
|
||||
auto-load
|
||||
chip-locale="myEntries"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -6,9 +6,17 @@ entryFilter:
|
|||
filter:
|
||||
search: General search
|
||||
reference: Reference
|
||||
landed: Landed
|
||||
shipped: Shipped
|
||||
fromShipped: Shipped(from)
|
||||
toShipped: Shipped(to)
|
||||
printLabels: Print stickers
|
||||
viewLabel: View sticker
|
||||
myEntries:
|
||||
id: ID
|
||||
landed: Landed
|
||||
shipped: Shipped
|
||||
fromShipped: Shipped(from)
|
||||
toShipped: Shipped(to)
|
||||
printLabels: Print stickers
|
||||
viewLabel: View sticker
|
||||
wareHouseIn: Warehouse in
|
||||
warehouseInFk: Warehouse in
|
||||
daysOnward: Days onward
|
||||
daysAgo: Days ago
|
||||
wasteRecalc:
|
||||
recalcOk: The wastes were successfully recalculated
|
||||
|
|
|
@ -9,10 +9,17 @@ entryFilter:
|
|||
filter:
|
||||
search: Búsqueda general
|
||||
reference: Referencia
|
||||
|
||||
landed: F. llegada
|
||||
shipped: F. salida
|
||||
fromShipped: F. salida(desde)
|
||||
toShipped: F. salida(hasta)
|
||||
printLabels: Imprimir etiquetas
|
||||
viewLabel: Ver etiqueta
|
||||
myEntries:
|
||||
id: ID
|
||||
landed: F. llegada
|
||||
shipped: F. salida
|
||||
fromShipped: F. salida(desde)
|
||||
toShipped: F. salida(hasta)
|
||||
printLabels: Imprimir etiquetas
|
||||
viewLabel: Ver etiqueta
|
||||
wareHouseIn: Alm. entrada
|
||||
warehouseInFk: Alm. entrada
|
||||
daysOnward: Días adelante
|
||||
daysAgo: Días atras
|
||||
wasteRecalc:
|
||||
recalcOk: Se han recalculado las mermas correctamente
|
||||
|
|
|
@ -274,10 +274,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
:label="t('invoiceIn.summary.company')"
|
||||
:value="entity.company?.code"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.booked')"
|
||||
:value="invoiceIn?.isBooked"
|
||||
/>
|
||||
<VnLv :label="t('invoiceIn.isBooked')" :value="invoiceIn?.isBooked" />
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
|
|
|
@ -116,7 +116,7 @@ const activities = ref([]);
|
|||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.isBooked')"
|
||||
:label="t('invoiceIn.isBooked')"
|
||||
v-model="params.isBooked"
|
||||
@update:model-value="searchFn()"
|
||||
toggle-indeterminate
|
||||
|
@ -170,7 +170,7 @@ es:
|
|||
awb: AWB
|
||||
amount: Importe
|
||||
issued: Emitida
|
||||
isBooked: Conciliada
|
||||
isBooked: Contabilizada
|
||||
account: Cuenta contable
|
||||
created: Creada
|
||||
dued: Vencida
|
||||
|
|
|
@ -65,7 +65,7 @@ const cols = computed(() => [
|
|||
{
|
||||
align: 'left',
|
||||
name: 'isBooked',
|
||||
label: t('invoiceIn.list.isBooked'),
|
||||
label: t('invoiceIn.isBooked'),
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
invoiceIn:
|
||||
serial: Serial
|
||||
isBooked: Is booked
|
||||
list:
|
||||
ref: Reference
|
||||
supplier: Supplier
|
||||
|
@ -7,7 +8,6 @@ invoiceIn:
|
|||
serial: Serial
|
||||
file: File
|
||||
issued: Issued
|
||||
isBooked: Is booked
|
||||
awb: AWB
|
||||
amount: Amount
|
||||
card:
|
||||
|
@ -31,7 +31,6 @@ invoiceIn:
|
|||
sage: Sage withholding
|
||||
vat: Undeductible VAT
|
||||
company: Company
|
||||
booked: Booked
|
||||
expense: Expense
|
||||
taxableBase: Taxable base
|
||||
rate: Rate
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
invoiceIn:
|
||||
serial: Serie
|
||||
isBooked: Contabilizada
|
||||
list:
|
||||
ref: Referencia
|
||||
supplier: Proveedor
|
||||
|
@ -7,7 +8,6 @@ invoiceIn:
|
|||
shortIssued: F. emisión
|
||||
file: Fichero
|
||||
issued: Fecha emisión
|
||||
isBooked: Conciliada
|
||||
awb: AWB
|
||||
amount: Importe
|
||||
card:
|
||||
|
@ -31,7 +31,6 @@ invoiceIn:
|
|||
sage: Retención sage
|
||||
vat: Iva no deducible
|
||||
company: Empresa
|
||||
booked: Contabilizada
|
||||
expense: Gasto
|
||||
taxableBase: Base imp.
|
||||
rate: Tasa
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue';
|
||||
import InvoiceOutSummary from './InvoiceOutSummary.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -10,6 +11,10 @@ const $props = defineProps({
|
|||
</script>
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<InvoiceOutDescriptor v-if="$props.id" :id="$props.id" />
|
||||
<InvoiceOutDescriptor
|
||||
v-if="$props.id"
|
||||
:id="$props.id"
|
||||
:summary="InvoiceOutSummary"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -29,13 +29,16 @@ const { openReport } = usePrintService();
|
|||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'id',
|
||||
label: t('invoiceOutList.tableVisibleColumns.id'),
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: {
|
||||
name: 'search',
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
|
|
@ -9,6 +9,7 @@ import { useArrayData } from 'src/composables/useArrayData';
|
|||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import TicketDescriptorProxy from '../Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
|
@ -64,7 +65,8 @@ const columns = computed(() => [
|
|||
cardVisible: true,
|
||||
attrs: {
|
||||
url: 'Clients',
|
||||
fields: ['id', 'name'],
|
||||
optionLabel: 'socialName',
|
||||
optionValue: 'socialName',
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
|
@ -191,10 +193,33 @@ const downloadCSV = async () => {
|
|||
<WorkerDescriptorProxy :id="row.comercialId" />
|
||||
</span>
|
||||
</template>
|
||||
<template #moreFilterPanel="{ params }">
|
||||
<VnInputDate
|
||||
:label="t('params.from')"
|
||||
v-model="params.from"
|
||||
class="q-px-xs q-pr-lg"
|
||||
filled
|
||||
dense
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('params.to')"
|
||||
v-model="params.to"
|
||||
class="q-px-xs q-pr-lg"
|
||||
filled
|
||||
dense
|
||||
/>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Download as CSV: Descargar como CSV
|
||||
params:
|
||||
from: Desde
|
||||
to: Hasta
|
||||
en:
|
||||
params:
|
||||
from: From
|
||||
to: To
|
||||
</i18n>
|
||||
|
|
|
@ -514,7 +514,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</template>
|
||||
<template #column-minPrice="props">
|
||||
<QTd class="col">
|
||||
<div class="row">
|
||||
<div class="row" style="align-items: center">
|
||||
<QCheckbox
|
||||
:model-value="props.row.hasMinPrice"
|
||||
@update:model-value="updateMinPrice($event, props)"
|
||||
|
@ -600,11 +600,14 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
.q-table th,
|
||||
.q-table td {
|
||||
padding-inline: 5px !important;
|
||||
// text-align: -webkit-right;
|
||||
}
|
||||
.q-table tr td {
|
||||
font-size: 10pt;
|
||||
border-top: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.q-table tbody td {
|
||||
max-width: none;
|
||||
|
||||
.q-td.col {
|
||||
& .vnInputDate {
|
||||
min-width: 90px;
|
||||
|
|
|
@ -229,7 +229,7 @@ onBeforeMount(() => {
|
|||
>
|
||||
<template #body-cell-id="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary"> {{ row.ticketFk }}</QBtn>
|
||||
<QBtn flat class="link"> {{ row.ticketFk }}</QBtn>
|
||||
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
|
@ -251,22 +251,35 @@ onBeforeMount(() => {
|
|||
</template>
|
||||
<template #body-cell-requester="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat dense color="primary"> {{ row.requesterName }}</QBtn>
|
||||
<QBtn flat dense class="link"> {{ row.requesterName }}</QBtn>
|
||||
<WorkerDescriptorProxy :id="row.requesterFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-attender="{ row }">
|
||||
<QTd>
|
||||
<VnSelect
|
||||
url="Workers/search"
|
||||
v-model="row.attenderFk"
|
||||
:where="{ role: 'buyer' }"
|
||||
sort-by="id"
|
||||
url="Workers"
|
||||
:params="{ departmentCodes: ['shopping'] }"
|
||||
:fields="['id', 'nickname']"
|
||||
sort-by="nickname ASC"
|
||||
hide-selected
|
||||
option-label="firstName"
|
||||
option-label="nickname"
|
||||
option-value="id"
|
||||
dense
|
||||
/>
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption
|
||||
>{{ scope.opt?.nickname }},
|
||||
{{ scope.opt?.code }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-item="{ row }">
|
||||
|
@ -292,7 +305,7 @@ onBeforeMount(() => {
|
|||
</template>
|
||||
<template #body-cell-concept="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat dense color="primary"> {{ row.itemDescription }}</QBtn>
|
||||
<QBtn flat dense class="link"> {{ row.itemDescription }}</QBtn>
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</QTd>
|
||||
</template>
|
||||
|
|
|
@ -174,6 +174,16 @@ const decrement = (paramsObj, key) => {
|
|||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
v-model="params.myTeam"
|
||||
:label="t('params.myTeam')"
|
||||
@update:model-value="searchFn()"
|
||||
toggle-indeterminate
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QCard bordered>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
|
@ -274,11 +284,11 @@ en:
|
|||
to: To
|
||||
mine: For me
|
||||
state: State
|
||||
myTeam: My team
|
||||
dateFiltersTooltip: Cannot choose a range of dates and days onward at the same time
|
||||
denied: Denied
|
||||
accepted: Accepted
|
||||
pending: Pending
|
||||
|
||||
es:
|
||||
params:
|
||||
search: Búsqueda general
|
||||
|
@ -291,6 +301,7 @@ es:
|
|||
to: Hasta
|
||||
mine: Para mi
|
||||
state: Estado
|
||||
myTeam: Mi equipo
|
||||
dateFiltersTooltip: No se puede seleccionar un rango de fechas y días en adelante a la vez
|
||||
denied: Denegada
|
||||
accepted: Aceptada
|
||||
|
|
|
@ -52,15 +52,27 @@ const redirectToItemTypeBasicData = (_, { id }) => {
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
url="Workers/search"
|
||||
v-model="data.workerFk"
|
||||
:label="t('itemType.shared.worker')"
|
||||
url="Workers"
|
||||
sort-by="firstName ASC"
|
||||
:fields="['id', 'firstName']"
|
||||
:label="t('shared.worker')"
|
||||
sort-by="nickname ASC"
|
||||
:fields="['id', 'nickname']"
|
||||
:params="{ departmentCodes: ['shopping'] }"
|
||||
option-label="nickname"
|
||||
option-value="id"
|
||||
option-label="firstName"
|
||||
hide-selected
|
||||
/>
|
||||
><template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption
|
||||
>{{ scope.opt?.nickname }},
|
||||
{{ scope.opt?.code }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelect
|
||||
v-model="data.categoryFk"
|
||||
:label="t('itemType.shared.category')"
|
||||
|
|
|
@ -41,15 +41,27 @@ const temperaturesOptions = ref([]);
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
url="Workers/search"
|
||||
v-model="data.workerFk"
|
||||
:label="t('shared.worker')"
|
||||
url="Workers"
|
||||
sort-by="firstName ASC"
|
||||
:fields="['id', 'firstName']"
|
||||
sort-by="nickname ASC"
|
||||
:fields="['id', 'nickname']"
|
||||
:params="{ departmentCodes: ['shopping'] }"
|
||||
option-label="nickname"
|
||||
option-value="id"
|
||||
option-label="firstName"
|
||||
hide-selected
|
||||
/>
|
||||
><template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption
|
||||
>{{ scope.opt?.nickname }},
|
||||
{{ scope.opt?.code }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template></VnSelect
|
||||
>
|
||||
<VnSelect
|
||||
v-model="data.categoryFk"
|
||||
:label="t('shared.category')"
|
||||
|
|
|
@ -6,6 +6,7 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
|
|||
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||
|
||||
onUpdated(() => summaryRef.value.fetch());
|
||||
|
||||
|
@ -55,6 +56,11 @@ async function setItemTypeData(data) {
|
|||
>
|
||||
<QIcon name="open_in_new" color="white" size="sm" />
|
||||
</router-link>
|
||||
<VnToSummary
|
||||
v-if="route?.name !== 'ItemTypeSummary'"
|
||||
:route-name="'ItemTypeSummary'"
|
||||
:entity-id="entityId"
|
||||
/>
|
||||
</template>
|
||||
<template #header>
|
||||
<span>
|
||||
|
|
|
@ -139,33 +139,35 @@ const openTab = (id) =>
|
|||
:disable-option="{ card: true }"
|
||||
>
|
||||
<template #top-left>
|
||||
<QBtn
|
||||
icon="refresh"
|
||||
size="md"
|
||||
color="primary"
|
||||
dense
|
||||
flat
|
||||
@click="$refs.table.reload()"
|
||||
>
|
||||
<QTooltip>{{ $t('globals.refresh') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
v-if="selectedRows.length"
|
||||
icon="delete"
|
||||
size="md"
|
||||
dense
|
||||
flat
|
||||
color="primary"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
$t('salesOrdersTable.deleteConfirmTitle'),
|
||||
$t('salesOrdersTable.deleteConfirmMessage'),
|
||||
removeOrders
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip>
|
||||
</QBtn>
|
||||
<div class="q-mt-sm">
|
||||
<QBtn
|
||||
icon="refresh"
|
||||
size="md"
|
||||
color="primary"
|
||||
dense
|
||||
flat
|
||||
@click="$refs.table.reload()"
|
||||
>
|
||||
<QTooltip>{{ $t('globals.refresh') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
v-if="selectedRows.length"
|
||||
icon="delete"
|
||||
size="md"
|
||||
dense
|
||||
flat
|
||||
color="primary"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
$t('globals.deleteConfirmTitle'),
|
||||
$t('salesOrdersTable.deleteConfirmMessage'),
|
||||
removeOrders
|
||||
)
|
||||
"
|
||||
>
|
||||
<QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-dateSend="{ row }">
|
||||
<QTd>
|
||||
|
|
|
@ -15,7 +15,6 @@ salesOrdersTable:
|
|||
dateMake: Make date
|
||||
client: Client
|
||||
salesPerson: Salesperson
|
||||
deleteConfirmTitle: Delete selected elements
|
||||
deleteConfirmMessage: All the selected elements will be deleted. Are you sure you want to continue?
|
||||
agency: Agency
|
||||
import: Import
|
||||
|
|
|
@ -15,7 +15,6 @@ salesOrdersTable:
|
|||
dateMake: Fecha de realización
|
||||
client: Cliente
|
||||
salesPerson: Comercial
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
deleteConfirmMessage: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
|
||||
agency: Agencia
|
||||
import: Importe
|
||||
|
|
|
@ -249,7 +249,7 @@ watch(
|
|||
@on-fetch="(data) => (orderSummary.vat = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QDrawer side="right" :width="270" v-model="stateStore.rightDrawer">
|
||||
<QDrawer side="right" :width="265" v-model="stateStore.rightDrawer">
|
||||
<QCard
|
||||
class="order-lines-summary q-pa-lg"
|
||||
v-if="orderSummary.vat && orderSummary.total"
|
||||
|
|
|
@ -14,14 +14,15 @@ import OrderFilter from './Card/OrderFilter.vue';
|
|||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
import { onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
const agencyList = ref([]);
|
||||
const addressesList = ref([]);
|
||||
const clientId = ref();
|
||||
|
||||
const route = useRoute();
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -169,6 +170,13 @@ const getDateColor = (date) => {
|
|||
if (comparation == 0) return 'bg-warning';
|
||||
if (comparation < 0) return 'bg-success';
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (!route.query.createForm) return;
|
||||
const clientId = route.query.createForm;
|
||||
const id = JSON.parse(clientId);
|
||||
fetchClientAddress(id.clientFk, id);
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<OrderSearchbar />
|
||||
|
@ -184,13 +192,14 @@ const getDateColor = (date) => {
|
|||
:order="['landed DESC', 'clientFk ASC', 'id DESC']"
|
||||
:create="{
|
||||
urlCreate: 'Orders/new',
|
||||
title: 'Create Order',
|
||||
title: t('module.cerateOrder'),
|
||||
onDataSaved: (url) => {
|
||||
tableRef.redirect(url);
|
||||
},
|
||||
formInitialData: {
|
||||
active: true,
|
||||
addressId: null,
|
||||
clientFk: null,
|
||||
},
|
||||
}"
|
||||
:user-params="{ showEmpty: false }"
|
||||
|
@ -221,7 +230,7 @@ const getDateColor = (date) => {
|
|||
<VnSelect
|
||||
url="Clients"
|
||||
:include="{ relation: 'addresses' }"
|
||||
v-model="clientId"
|
||||
v-model="data.clientFk"
|
||||
:label="t('module.customer')"
|
||||
@update:model-value="(id) => fetchClientAddress(id, data)"
|
||||
/>
|
||||
|
|
|
@ -10,6 +10,7 @@ module:
|
|||
total: Total
|
||||
salesPerson: Sales Person
|
||||
address: Address
|
||||
cerateOrder: Create order
|
||||
lines:
|
||||
item: Item
|
||||
warehouse: Warehouse
|
||||
|
|
|
@ -10,6 +10,7 @@ module:
|
|||
total: Total
|
||||
salesPerson: Comercial
|
||||
address: Dirección
|
||||
cerateOrder: Crear cesta
|
||||
lines:
|
||||
item: Artículo
|
||||
warehouse: Almacén
|
||||
|
|
|
@ -27,12 +27,15 @@ const columns = computed(() => [
|
|||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.name'),
|
||||
name: 'name',
|
||||
isTitle: true,
|
||||
columnFilter: false,
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -70,18 +73,33 @@ const columns = computed(() => [
|
|||
data-key="AgencyList"
|
||||
:expr-builder="exprBuilder"
|
||||
/>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="AgencyList"
|
||||
url="Agencies"
|
||||
order="name"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:use-model="true"
|
||||
redirect="agency"
|
||||
default-mode="card"
|
||||
/>
|
||||
<div class="list-container">
|
||||
<div class="list">
|
||||
<VnTable
|
||||
data-key="AgencyList"
|
||||
url="Agencies"
|
||||
order="name"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:use-model="true"
|
||||
redirect="agency"
|
||||
default-mode="card"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 55%;
|
||||
}
|
||||
.list-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
isOwn: Tiene propietario
|
||||
|
|
|
@ -46,13 +46,13 @@ async function deleteWorCenter(id) {
|
|||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="workCenters"
|
||||
sort-by="name"
|
||||
@on-fetch="(data) => (warehouses = data)"
|
||||
auto-load
|
||||
/>
|
||||
<div class="centerCard">
|
||||
<FetchData
|
||||
url="workCenters"
|
||||
sort-by="name"
|
||||
@on-fetch="(data) => (warehouses = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnPaginate
|
||||
ref="paginate"
|
||||
data-key="AgencyWorkCenters"
|
||||
|
|
|
@ -167,8 +167,8 @@ const setTicketsRoute = async () => {
|
|||
<QTd :props="props">
|
||||
<span class="link">
|
||||
{{ props.value }}
|
||||
<TicketDescriptorProxy :id="props?.row?.id" />
|
||||
</span>
|
||||
<TicketDescriptorProxy :id="props?.row?.id" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-client="props">
|
||||
|
|
|
@ -0,0 +1,360 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { toDate } from 'src/filters';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { usePrintService } from 'src/composables/usePrintService';
|
||||
|
||||
import axios from 'axios';
|
||||
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
||||
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
|
||||
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
|
||||
const { openReport } = usePrintService();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const quasar = useQuasar();
|
||||
const selectedRows = ref([]);
|
||||
const tableRef = ref([]);
|
||||
const confirmationDialog = ref(false);
|
||||
const startingDate = ref(null);
|
||||
const router = useRouter();
|
||||
const routeFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'workers',
|
||||
scope: {
|
||||
fields: ['id', 'firstName'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'id',
|
||||
label: 'Id',
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('route.Worker'),
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
useLike: false,
|
||||
optionFilter: 'firstName',
|
||||
find: {
|
||||
value: 'workerFk',
|
||||
label: 'workerUserName',
|
||||
},
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
useLike: false,
|
||||
cardVisible: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'agencyModeFk',
|
||||
label: t('route.Agency'),
|
||||
isTitle: true,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'agencyModes',
|
||||
fields: ['id', 'name'],
|
||||
find: {
|
||||
value: 'agencyModeFk',
|
||||
label: 'agencyName',
|
||||
},
|
||||
},
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'vehicleFk',
|
||||
label: t('route.Vehicle'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'vehicles',
|
||||
fields: ['id', 'numberPlate'],
|
||||
optionLabel: 'numberPlate',
|
||||
optionFilterValue: 'numberPlate',
|
||||
find: {
|
||||
value: 'vehicleFk',
|
||||
label: 'vehiclePlateNumber',
|
||||
},
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'created',
|
||||
label: t('route.Date'),
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'from',
|
||||
label: t('route.From'),
|
||||
visible: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'to',
|
||||
label: t('route.To'),
|
||||
visible: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'm3',
|
||||
label: 'm3',
|
||||
cardVisible: true,
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'started',
|
||||
label: t('route.hourStarted'),
|
||||
component: 'time',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'finished',
|
||||
label: t('route.hourFinished'),
|
||||
component: 'time',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'kmStart',
|
||||
label: t('route.KmStart'),
|
||||
columnClass: 'shrink',
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'kmEnd',
|
||||
label: t('route.KmEnd'),
|
||||
columnClass: 'shrink',
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'description',
|
||||
label: t('route.Description'),
|
||||
isTitle: true,
|
||||
create: true,
|
||||
component: 'input',
|
||||
field: 'description',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'isOk',
|
||||
label: t('route.Served'),
|
||||
component: 'checkbox',
|
||||
columnFilter: false,
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('route.Add tickets'),
|
||||
icon: 'vn:ticketAdd',
|
||||
action: (row) => openTicketsDialog(row?.id),
|
||||
isPrimary: true,
|
||||
},
|
||||
{
|
||||
title: t('route.components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row?.id, RouteSummary),
|
||||
isPrimary: true,
|
||||
},
|
||||
{
|
||||
title: t('route.Route summary'),
|
||||
icon: 'arrow_forward',
|
||||
action: (row) => navigate(row?.id),
|
||||
isPrimary: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/route/${id}` });
|
||||
}
|
||||
|
||||
const cloneRoutes = () => {
|
||||
if (!selectedRows.value.length || !startingDate.value) return;
|
||||
axios.post('Routes/clone', {
|
||||
created: startingDate.value,
|
||||
ids: selectedRows.value.map((row) => row?.id),
|
||||
});
|
||||
startingDate.value = null;
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
const showRouteReport = () => {
|
||||
const ids = selectedRows.value.map((row) => row?.id);
|
||||
const idString = ids.join(',');
|
||||
let url = `Routes/${idString}/driver-route-pdf`;
|
||||
let params = {};
|
||||
if (selectedRows.value.length >= 1) {
|
||||
params = {
|
||||
id: idString,
|
||||
};
|
||||
url = `Routes/downloadZip`;
|
||||
}
|
||||
openReport(url, params, '_blank');
|
||||
};
|
||||
|
||||
function markAsServed() {
|
||||
selectedRows.value.forEach(async (row) => {
|
||||
await axios.patch(`Routes/${row?.id}`, { isOk: true });
|
||||
});
|
||||
tableRef.value.reload();
|
||||
startingDate.value = null;
|
||||
}
|
||||
|
||||
const openTicketsDialog = (id) => {
|
||||
quasar
|
||||
.dialog({
|
||||
component: RouteListTicketsDialog,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
.onOk(() => tableRef.value.reload());
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouteSearchbar />
|
||||
<QDialog v-model="confirmationDialog">
|
||||
<QCard style="min-width: 350px">
|
||||
<QCardSection>
|
||||
<p class="text-h6 q-ma-none">{{ t('route.Select the starting date') }}</p>
|
||||
</QCardSection>
|
||||
|
||||
<QCardSection class="q-pt-none">
|
||||
<VnInputDate
|
||||
:label="t('route.Stating date')"
|
||||
v-model="startingDate"
|
||||
autofocus
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn
|
||||
flat
|
||||
:label="t('route.Cancel')"
|
||||
v-close-popup
|
||||
class="text-primary"
|
||||
/>
|
||||
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
||||
{{ t('globals.clone') }}
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
<VnSubToolbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<RouteFilter data-key="RouteList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
class="route-list"
|
||||
ref="tableRef"
|
||||
data-key="RouteList"
|
||||
url="Routes/filter"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
:filter="routeFilter"
|
||||
redirect="route"
|
||||
:row-click="false"
|
||||
:create="{
|
||||
urlCreate: 'Routes',
|
||||
title: t('route.createRoute'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
}"
|
||||
save-url="Routes/crud"
|
||||
:disable-option="{ card: true }"
|
||||
table-height="85vh"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
icon="vn:clone"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="confirmationDialog = true"
|
||||
>
|
||||
<QTooltip>{{ t('route.Clone Selected Routes') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="cloud_download"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="showRouteReport"
|
||||
>
|
||||
<QTooltip>{{ t('route.Download selected routes as PDF') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="check"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="markAsServed()"
|
||||
>
|
||||
<QTooltip>{{ t('route.Mark as served') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
|
@ -1,34 +1,19 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useSession } from 'composables/useSession';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { toDate } from 'src/filters';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { toHour } from 'src/filters';
|
||||
|
||||
import axios from 'axios';
|
||||
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
||||
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
|
||||
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { usePrintService } from 'src/composables/usePrintService';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
|
||||
const { openReport } = usePrintService();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const quasar = useQuasar();
|
||||
const session = useSession();
|
||||
const selectedRows = ref([]);
|
||||
const tableRef = ref([]);
|
||||
const confirmationDialog = ref(false);
|
||||
const startingDate = ref(null);
|
||||
const router = useRouter();
|
||||
const routeFilter = {
|
||||
include: [
|
||||
{
|
||||
|
@ -42,156 +27,70 @@ const routeFilter = {
|
|||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
isId: true,
|
||||
name: 'id',
|
||||
label: 'Id',
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('Worker'),
|
||||
label: t('route.Worker'),
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
useLike: false,
|
||||
optionFilter: 'firstName',
|
||||
find: {
|
||||
value: 'workerFk',
|
||||
label: 'workerUserName',
|
||||
},
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
useLike: false,
|
||||
cardVisible: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'agencyModeFk',
|
||||
label: t('Agency'),
|
||||
isTitle: true,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'agencyModes',
|
||||
fields: ['id', 'name'],
|
||||
find: {
|
||||
value: 'agencyModeFk',
|
||||
label: 'agencyName',
|
||||
},
|
||||
},
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'vehicleFk',
|
||||
label: t('Vehicle'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'vehicles',
|
||||
fields: ['id', 'numberPlate'],
|
||||
optionLabel: 'numberPlate',
|
||||
optionFilterValue: 'numberPlate',
|
||||
find: {
|
||||
value: 'vehicleFk',
|
||||
label: 'vehiclePlateNumber',
|
||||
},
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'created',
|
||||
label: t('Date'),
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'from',
|
||||
label: t('From'),
|
||||
visible: false,
|
||||
name: 'agencyName',
|
||||
label: t('route.Agency'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
columnClass: 'expand',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'to',
|
||||
label: t('To'),
|
||||
visible: false,
|
||||
name: 'vehiclePlateNumber',
|
||||
label: t('route.Vehicle'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'm3',
|
||||
label: t('Volume'),
|
||||
cardVisible: true,
|
||||
columnClass: 'shrink',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'started',
|
||||
label: t('hourStarted'),
|
||||
component: 'time',
|
||||
label: t('route.hourStarted'),
|
||||
cardVisible: true,
|
||||
columnFilter: false,
|
||||
format: (row) => toHour(row.started),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'finished',
|
||||
label: t('hourFinished'),
|
||||
component: 'time',
|
||||
label: t('route.hourFinished'),
|
||||
cardVisible: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'kmStart',
|
||||
label: t('KmStart'),
|
||||
columnClass: 'shrink',
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'kmEnd',
|
||||
label: t('KmEnd'),
|
||||
columnClass: 'shrink',
|
||||
create: true,
|
||||
visible: false,
|
||||
format: (row) => toHour(row.started),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'description',
|
||||
label: t('Description'),
|
||||
label: t('route.Description'),
|
||||
cardVisible: true,
|
||||
isTitle: true,
|
||||
create: true,
|
||||
component: 'input',
|
||||
field: 'description',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'isOk',
|
||||
label: t('Served'),
|
||||
label: t('route.Served'),
|
||||
component: 'checkbox',
|
||||
columnFilter: false,
|
||||
columnClass: 'shrink',
|
||||
|
@ -200,212 +99,43 @@ const columns = computed(() => [
|
|||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('Add tickets'),
|
||||
icon: 'vn:ticketAdd',
|
||||
action: (row) => openTicketsDialog(row?.id),
|
||||
},
|
||||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row?.id, RouteSummary),
|
||||
},
|
||||
{
|
||||
title: t('Route summary'),
|
||||
icon: 'arrow_forward',
|
||||
isPrimary: true,
|
||||
action: (row) => navigate(row?.id),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/route/${id}` });
|
||||
}
|
||||
|
||||
const cloneRoutes = () => {
|
||||
if (!selectedRows.value.length || !startingDate.value) return;
|
||||
axios.post('Routes/clone', {
|
||||
created: startingDate.value,
|
||||
ids: selectedRows.value.map((row) => row?.id),
|
||||
});
|
||||
startingDate.value = null;
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
const showRouteReport = () => {
|
||||
const ids = selectedRows.value.map((row) => row?.id);
|
||||
const idString = ids.join(',');
|
||||
let url = `Routes/${idString}/driver-route-pdf`;
|
||||
let params = {};
|
||||
if (selectedRows.value.length >= 1) {
|
||||
params = {
|
||||
id: idString,
|
||||
};
|
||||
url = `Routes/downloadZip`;
|
||||
}
|
||||
openReport(url, params, '_blank');
|
||||
};
|
||||
|
||||
function markAsServed() {
|
||||
selectedRows.value.forEach(async (row) => {
|
||||
await axios.patch(`Routes/${row?.id}`, { isOk: true });
|
||||
});
|
||||
tableRef.value.reload();
|
||||
startingDate.value = null;
|
||||
}
|
||||
|
||||
const openTicketsDialog = (id) => {
|
||||
quasar
|
||||
.dialog({
|
||||
component: RouteListTicketsDialog,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
.onOk(() => tableRef.value.reload());
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouteSearchbar />
|
||||
<QDialog v-model="confirmationDialog">
|
||||
<QCard style="min-width: 350px">
|
||||
<QCardSection>
|
||||
<p class="text-h6 q-ma-none">{{ t('Select the starting date') }}</p>
|
||||
</QCardSection>
|
||||
|
||||
<QCardSection class="q-pt-none">
|
||||
<VnInputDate
|
||||
:label="t('Stating date')"
|
||||
v-model="startingDate"
|
||||
autofocus
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
|
||||
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
||||
{{ t('globals.clone') }}
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
<VnSubToolbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<RouteFilter data-key="RouteList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
class="route-list"
|
||||
ref="tableRef"
|
||||
data-key="RouteList"
|
||||
url="Routes/filter"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
:filter="routeFilter"
|
||||
redirect="route"
|
||||
:row-click="false"
|
||||
:create="{
|
||||
urlCreate: 'Routes',
|
||||
title: t('Create route'),
|
||||
title: t('route.createRoute'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
}"
|
||||
save-url="Routes/crud"
|
||||
:disable-option="{ card: true }"
|
||||
table-height="85vh"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
icon="vn:clone"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="confirmationDialog = true"
|
||||
>
|
||||
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="cloud_download"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="showRouteReport"
|
||||
>
|
||||
<QTooltip>{{ t('Download selected routes as PDF') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="check"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="markAsServed()"
|
||||
>
|
||||
<QTooltip>{{ t('Mark as served') }}</QTooltip>
|
||||
</QBtn>
|
||||
<template #column-workerFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row?.workerUserName }}
|
||||
<WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.table-input-cell {
|
||||
max-width: 143px;
|
||||
}
|
||||
|
||||
.route-list {
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.table-actions {
|
||||
gap: 12px;
|
||||
}
|
||||
th:last-child,
|
||||
td:last-child {
|
||||
background-color: var(--vn-section-color);
|
||||
position: sticky;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
newRoute: New Route
|
||||
hourStarted: Started hour
|
||||
hourFinished: Finished hour
|
||||
es:
|
||||
From: Desde
|
||||
To: Hasta
|
||||
Worker: Trabajador
|
||||
Agency: Agencia
|
||||
Vehicle: Vehículo
|
||||
Volume: Volumen
|
||||
Date: Fecha
|
||||
Description: Descripción
|
||||
Hour started: Hora inicio
|
||||
Hour finished: Hora fin
|
||||
KmStart: Km inicio
|
||||
KmEnd: Km fin
|
||||
Served: Servida
|
||||
newRoute: Nueva Ruta
|
||||
Clone Selected Routes: Clonar rutas seleccionadas
|
||||
Select the starting date: Seleccione la fecha de inicio
|
||||
Stating date: Fecha de inicio
|
||||
Cancel: Cancelar
|
||||
Mark as served: Marcar como servidas
|
||||
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
|
||||
Add ticket: Añadir tickets
|
||||
Preview: Vista previa
|
||||
Summary: Resumen
|
||||
Route is closed: La ruta está cerrada
|
||||
Route is not served: La ruta no está servida
|
||||
hourStarted: Hora de inicio
|
||||
hourFinished: Hora de fin
|
||||
</i18n>
|
||||
|
|
|
@ -87,7 +87,7 @@ const columns = computed(() => [
|
|||
actions: [
|
||||
{
|
||||
title: t('Ver cmr'),
|
||||
icon: 'visibility',
|
||||
icon: 'preview',
|
||||
isPrimary: true,
|
||||
action: (row) => viewSummary(row?.id, RoadmapSummary),
|
||||
},
|
||||
|
|
|
@ -342,10 +342,7 @@ const openSmsDialog = async () => {
|
|||
</template>
|
||||
<template #body-cell-city="{ value, row }">
|
||||
<QTd auto-width>
|
||||
<span
|
||||
class="text-primary cursor-pointer"
|
||||
@click="goToBuscaman(row)"
|
||||
>
|
||||
<span class="link" @click="goToBuscaman(row)">
|
||||
{{ value }}
|
||||
<QTooltip>{{ t('Open buscaman') }}</QTooltip>
|
||||
</span>
|
||||
|
@ -353,7 +350,7 @@ const openSmsDialog = async () => {
|
|||
</template>
|
||||
<template #body-cell-client="{ value, row }">
|
||||
<QTd auto-width>
|
||||
<span class="text-primary cursor-pointer">
|
||||
<span class="link">
|
||||
{{ value }}
|
||||
<CustomerDescriptorProxy :id="row?.clientFk" />
|
||||
</span>
|
||||
|
@ -361,7 +358,7 @@ const openSmsDialog = async () => {
|
|||
</template>
|
||||
<template #body-cell-ticket="{ value, row }">
|
||||
<QTd auto-width class="text-center">
|
||||
<span class="text-primary cursor-pointer">
|
||||
<span class="link">
|
||||
{{ value }}
|
||||
<TicketDescriptorProxy :id="row?.id" />
|
||||
</span>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
route:
|
||||
Worker: Worker
|
||||
Agency: Agency
|
||||
Vehicle: Vehicle
|
||||
Description: Description
|
||||
hourStarted: H.Start
|
||||
hourFinished: H.End
|
||||
createRoute: Create route
|
||||
From: From
|
||||
To: To
|
||||
Date: Date
|
||||
KmStart: Km start
|
||||
KmEnd: Km end
|
||||
Served: Served
|
||||
Clone Selected Routes: Clone selected routes
|
||||
Select the starting date: Select the starting date
|
||||
Stating date: Starting date
|
||||
Cancel: Cancel
|
||||
Mark as served: Mark as served
|
||||
Download selected routes as PDF: Download selected routes as PDF
|
||||
Add ticket: Add ticket
|
||||
Preview: Preview
|
||||
Summary: Summary
|
||||
Route is closed: Route is closed
|
||||
Route is not served: Route is not served
|
||||
cmr:
|
||||
list:
|
||||
results: results
|
||||
cmrFk: CMR id
|
||||
hasCmrDms: Attached in gestdoc
|
||||
'true': 'Yes'
|
||||
'false': 'No'
|
||||
ticketFk: Ticketd id
|
||||
routeFk: Route id
|
||||
country: Country
|
||||
clientFk: Client id
|
||||
shipped: Preparation date
|
||||
viewCmr: View CMR
|
||||
downloadCmrs: Download CMRs
|
|
@ -0,0 +1,39 @@
|
|||
route:
|
||||
Worker: Trabajador
|
||||
Agency: Agencia
|
||||
Vehicle: Vehículo
|
||||
Description: Descripción
|
||||
hourStarted: H.Inicio
|
||||
hourFinished: H.Fin
|
||||
createRoute: Crear ruta
|
||||
From: Desde
|
||||
To: Hasta
|
||||
Date: Fecha
|
||||
KmStart: Km inicio
|
||||
KmEnd: Km fin
|
||||
Served: Servida
|
||||
Clone Selected Routes: Clonar rutas seleccionadas
|
||||
Select the starting date: Seleccione la fecha de inicio
|
||||
Stating date: Fecha de inicio
|
||||
Cancel: Cancelar
|
||||
Mark as served: Marcar como servidas
|
||||
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
|
||||
Add ticket: Añadir tickets
|
||||
Preview: Vista previa
|
||||
Summary: Resumen
|
||||
Route is closed: La ruta está cerrada
|
||||
Route is not served: La ruta no está servida
|
||||
cmr:
|
||||
list:
|
||||
results: resultados
|
||||
cmrFk: Id CMR
|
||||
hasCmrDms: Gestdoc
|
||||
'true': Sí
|
||||
'false': 'No'
|
||||
ticketFk: Id ticket
|
||||
routeFk: Id ruta
|
||||
country: País
|
||||
clientFk: Id cliente
|
||||
shipped: Fecha preparación
|
||||
viewCmr: Ver CMR
|
||||
downloadCmrs: Descargar CMRs
|
|
@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
|
|||
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
@ -115,7 +114,7 @@ const totalNewPrice = computed(() => {
|
|||
const totalDifference = computed(() => {
|
||||
return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0);
|
||||
});
|
||||
const showMovablecolumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
|
||||
const showMovableColumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
|
||||
const haveDifferences = computed(() => _ticketData.value.sale?.haveDifferences);
|
||||
const ticketHaveNegatives = () => {
|
||||
let _haveNegatives = false;
|
||||
|
@ -145,85 +144,83 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
@on-fetch="(data) => (ticketUpdateActions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<QCard
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
<QDrawer side="right" :width="265" v-model="stateStore.rightDrawer">
|
||||
<QCard
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('basicData.total') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-left" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.price') }}:
|
||||
{{ toCurrency(totalPrice) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-left" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.newPrice') }}: {{ toCurrency(totalNewPrice) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-left" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.difference') }}: {{ toCurrency(totalDifference) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
v-if="totalDifference"
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('basicData.chargeDifference') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection
|
||||
v-for="(action, index) in ticketUpdateActions"
|
||||
:key="index"
|
||||
horizontal
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('basicData.total') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.price') }}:
|
||||
{{ toCurrency(totalPrice) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.newPrice') }}: {{ toCurrency(totalNewPrice) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.difference') }}: {{ toCurrency(totalDifference) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
v-if="totalDifference"
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('basicData.chargeDifference') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection
|
||||
v-for="(action, index) in ticketUpdateActions"
|
||||
:key="index"
|
||||
horizontal
|
||||
>
|
||||
<QRadio
|
||||
v-model="_ticketData.option"
|
||||
:val="action.code"
|
||||
:label="action.description"
|
||||
dense
|
||||
/>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
v-if="haveNegatives"
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal class="flex row items-center">
|
||||
<QCheckbox
|
||||
:label="t('basicData.withoutNegatives')"
|
||||
v-model="_ticketData.withoutNegatives"
|
||||
:toggle-indeterminate="false"
|
||||
/>
|
||||
<QIcon name="info" size="xs" class="q-ml-sm">
|
||||
<QTooltip max-width="350px">
|
||||
{{ t('basicData.withoutNegativesInfo') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QRadio
|
||||
v-model="_ticketData.option"
|
||||
:val="action.code"
|
||||
:label="action.description"
|
||||
dense
|
||||
/>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
v-if="haveNegatives"
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal class="flex row items-center">
|
||||
<QCheckbox
|
||||
:label="t('basicData.withoutNegatives')"
|
||||
v-model="_ticketData.withoutNegatives"
|
||||
:toggle-indeterminate="false"
|
||||
/>
|
||||
<QIcon name="info" size="xs" class="q-ml-sm">
|
||||
<QTooltip max-width="350px">
|
||||
{{ t('basicData.withoutNegativesInfo') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QDrawer>
|
||||
<QTable
|
||||
:visible-columns="showMovablecolumn"
|
||||
:visible-columns="showMovableColumn"
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
|
@ -233,15 +230,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
flat
|
||||
>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
<QTd @click.stop class="link">
|
||||
<QBtn flat>
|
||||
{{ row.itemFk }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd>
|
||||
<QTd style="display: contents">
|
||||
<div class="column">
|
||||
<span>{{ row.item.name }}</span>
|
||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
|
@ -12,6 +12,8 @@ import VnInputTime from 'components/common/VnInputTime.vue';
|
|||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
import { toTimeFormat } from 'filters/date.js';
|
||||
|
||||
const $props = defineProps({
|
||||
|
@ -23,18 +25,21 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const emit = defineEmits(['updateForm']);
|
||||
|
||||
const { validate } = useValidator();
|
||||
const { notify } = useNotify();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const agencyFetchRef = ref(null);
|
||||
const zonesFetchRef = ref(null);
|
||||
const canEditZone = useAcl().hasAny([
|
||||
{ model: 'Ticket', props: 'editZone', accessType: 'WRITE' },
|
||||
]);
|
||||
|
||||
const agencyFetchRef = ref();
|
||||
const warehousesOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
const agenciesOptions = ref([]);
|
||||
const zonesOptions = ref([]);
|
||||
const addresses = ref([]);
|
||||
const zoneSelectRef = ref();
|
||||
const formData = ref($props.formData);
|
||||
|
||||
watch(
|
||||
|
@ -43,6 +48,8 @@ watch(
|
|||
{ deep: true }
|
||||
);
|
||||
|
||||
onMounted(() => onFormModelInit());
|
||||
|
||||
const agencyByWarehouseFilter = computed(() => ({
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
|
@ -51,18 +58,16 @@ const agencyByWarehouseFilter = computed(() => ({
|
|||
},
|
||||
}));
|
||||
|
||||
const zonesFilter = computed(() => ({
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
where: formData.value?.agencyModeFk
|
||||
const zoneWhere = computed(() => {
|
||||
return formData.value?.agencyModeFk
|
||||
? {
|
||||
shipped: formData.value?.shipped,
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
warehouseFk: formData.value?.warehouseFk,
|
||||
}
|
||||
: {},
|
||||
}));
|
||||
: {};
|
||||
});
|
||||
|
||||
const getLanded = async (params) => {
|
||||
try {
|
||||
|
@ -107,32 +112,20 @@ const getShipped = async (params) => {
|
|||
};
|
||||
|
||||
const onChangeZone = async (zoneId) => {
|
||||
try {
|
||||
formData.value.agencyModeFk = null;
|
||||
const { data } = await axios.get(`Zones/${zoneId}`);
|
||||
formData.value.agencyModeFk = data.agencyModeFk;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
formData.value.agencyModeFk = null;
|
||||
const { data } = await axios.get(`Zones/${zoneId}`);
|
||||
formData.value.agencyModeFk = data.agencyModeFk;
|
||||
};
|
||||
|
||||
const onChangeAddress = async (addressId) => {
|
||||
try {
|
||||
formData.value.nickname = null;
|
||||
const { data } = await axios.get(`Addresses/${addressId}`);
|
||||
formData.value.nickname = data.nickname;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
formData.value.nickname = null;
|
||||
const { data } = await axios.get(`Addresses/${addressId}`);
|
||||
formData.value.nickname = data.nickname;
|
||||
};
|
||||
|
||||
const getClientDefaultAddress = async (clientId) => {
|
||||
try {
|
||||
const { data } = await axios.get(`Clients/${clientId}`);
|
||||
if (data) addressId.value = data.defaultAddressFk;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
const { data } = await axios.get(`Clients/${clientId}`);
|
||||
if (data) addressId.value = data.defaultAddressFk;
|
||||
};
|
||||
|
||||
const clientAddressesList = async (value) => {
|
||||
|
@ -269,7 +262,17 @@ const redirectToCustomerAddress = () => {
|
|||
});
|
||||
};
|
||||
|
||||
onMounted(() => onFormModelInit());
|
||||
async function getZone(options) {
|
||||
if (!zoneId.value) return;
|
||||
|
||||
const zone = options.find((z) => z.id == zoneId.value);
|
||||
if (zone) return;
|
||||
|
||||
const { data } = await axios.get('Zones/' + zoneId.value, {
|
||||
params: { filter: JSON.stringify({ fields: ['id', 'name'] }) },
|
||||
});
|
||||
zoneSelectRef.value.opts.push(data);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -293,13 +296,6 @@ onMounted(() => onFormModelInit());
|
|||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
ref="zonesFetchRef"
|
||||
url="Zones/includingExpired"
|
||||
:filter="zonesFilter"
|
||||
@on-fetch="(data) => (zonesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QForm>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
|
@ -313,6 +309,7 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:rules="validate('basicData.client')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -333,6 +330,7 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:rules="validate('basicData.warehouse')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
@ -345,6 +343,7 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:rules="validate('basicData.address')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -392,6 +391,7 @@ onMounted(() => onFormModelInit());
|
|||
:label="t('basicData.alias')"
|
||||
v-model="formData.nickname"
|
||||
:required="true"
|
||||
:rules="validate('basicData.alias')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md no-wrap">
|
||||
|
@ -404,6 +404,7 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:rules="validate('basicData.company')"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('basicData.agency')"
|
||||
|
@ -414,17 +415,22 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
@focus="agencyFetchRef.fetch()"
|
||||
:rules="validate('basicData.agency')"
|
||||
/>
|
||||
<VnSelect
|
||||
ref="zoneSelectRef"
|
||||
:label="t('basicData.zone')"
|
||||
v-model="zoneId"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:options="zonesOptions"
|
||||
hide-selected
|
||||
map-options
|
||||
url="Zones/includingExpired"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="id"
|
||||
:where="zoneWhere"
|
||||
:rules="validate('basicData.zone')"
|
||||
:required="true"
|
||||
@focus="zonesFetchRef.fetch()"
|
||||
:disable="!canEditZone"
|
||||
@update:options="getZone"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -444,16 +450,19 @@ onMounted(() => onFormModelInit());
|
|||
:label="t('basicData.shipped')"
|
||||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
:rules="validate('basicData.shipped')"
|
||||
/>
|
||||
<VnInputTime
|
||||
:label="t('basicData.shippedHour')"
|
||||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
:rules="validate('basicData.shippedHour')"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('basicData.landed')"
|
||||
v-model="formData.landed"
|
||||
:required="true"
|
||||
:rules="validate('basicData.landed')"
|
||||
/>
|
||||
</VnRow>
|
||||
</QForm>
|
||||
|
|
|
@ -3,7 +3,7 @@ import { ref, onBeforeMount } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import BasicDataTable from './BasicDataTable.vue';
|
||||
import TicketBasicData from './TicketBasicData.vue';
|
||||
import TicketBasicDataForm from './TicketBasicDataForm.vue';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
||||
|
@ -70,60 +70,51 @@ const isFormInvalid = () => {
|
|||
};
|
||||
|
||||
const getPriceDifference = async () => {
|
||||
try {
|
||||
const params = {
|
||||
landed: formData.value.landed,
|
||||
addressId: formData.value.addressFk,
|
||||
agencyModeId: formData.value.agencyModeFk,
|
||||
zoneId: formData.value.zoneFk,
|
||||
warehouseId: formData.value.warehouseFk,
|
||||
shipped: formData.value.shipped,
|
||||
};
|
||||
const { data } = await axios.post(
|
||||
`tickets/${formData.value.id}/priceDifference`,
|
||||
params
|
||||
);
|
||||
formData.value.sale = data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
const params = {
|
||||
landed: formData.value.landed,
|
||||
addressId: formData.value.addressFk,
|
||||
agencyModeId: formData.value.agencyModeFk,
|
||||
zoneId: formData.value.zoneFk,
|
||||
warehouseId: formData.value.warehouseFk,
|
||||
shipped: formData.value.shipped,
|
||||
};
|
||||
const { data } = await axios.post(
|
||||
`tickets/${formData.value.id}/priceDifference`,
|
||||
params
|
||||
);
|
||||
formData.value.sale = data;
|
||||
};
|
||||
|
||||
const submit = async () => {
|
||||
try {
|
||||
if (!formData.value.option)
|
||||
return notify(t('basicData.chooseAnOption'), 'negative');
|
||||
if (!formData.value.option) return notify(t('basicData.chooseAnOption'), 'negative');
|
||||
|
||||
const params = {
|
||||
clientFk: formData.value.clientFk,
|
||||
nickname: formData.value.nickname,
|
||||
agencyModeFk: formData.value.agencyModeFk,
|
||||
addressFk: formData.value.addressFk,
|
||||
zoneFk: formData.value.zoneFk,
|
||||
warehouseFk: formData.value.warehouseFk,
|
||||
companyFk: formData.value.companyFk,
|
||||
shipped: formData.value.shipped,
|
||||
landed: formData.value.landed,
|
||||
isDeleted: formData.value.isDeleted,
|
||||
option: formData.value.option,
|
||||
isWithoutNegatives: formData.value.withoutNegatives,
|
||||
withWarningAccept: formData.value.withWarningAccept,
|
||||
keepPrice: false,
|
||||
};
|
||||
const params = {
|
||||
clientFk: formData.value.clientFk,
|
||||
nickname: formData.value.nickname,
|
||||
agencyModeFk: formData.value.agencyModeFk,
|
||||
addressFk: formData.value.addressFk,
|
||||
zoneFk: formData.value.zoneFk,
|
||||
warehouseFk: formData.value.warehouseFk,
|
||||
companyFk: formData.value.companyFk,
|
||||
shipped: formData.value.shipped,
|
||||
landed: formData.value.landed,
|
||||
isDeleted: formData.value.isDeleted,
|
||||
option: formData.value.option,
|
||||
isWithoutNegatives: formData.value.withoutNegatives,
|
||||
withWarningAccept: formData.value.withWarningAccept,
|
||||
keepPrice: false,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(
|
||||
`tickets/${formData.value.id}/componentUpdate`,
|
||||
params
|
||||
);
|
||||
const { data } = await axios.post(
|
||||
`tickets/${formData.value.id}/componentUpdate`,
|
||||
params
|
||||
);
|
||||
|
||||
if (!data) return;
|
||||
if (!data) return;
|
||||
|
||||
const ticketToMove = data.id;
|
||||
notify(t('basicData.unroutedTicket'), 'positive');
|
||||
router.push({ name: 'TicketSummary', params: { id: ticketToMove } });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
const ticketToMove = data.id;
|
||||
notify(t('basicData.unroutedTicket'), 'positive');
|
||||
router.push({ name: 'TicketSummary', params: { id: ticketToMove } });
|
||||
};
|
||||
|
||||
const submitWithNegatives = async () => {
|
||||
|
@ -158,7 +149,10 @@ onBeforeMount(async () => await getTicketData());
|
|||
color="primary"
|
||||
animated
|
||||
keep-alive
|
||||
style="max-width: 800px; margin: auto"
|
||||
style="margin: auto"
|
||||
:style="{
|
||||
'max-width': step > 1 ? 'none' : '800px',
|
||||
}"
|
||||
>
|
||||
<QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1">
|
||||
<TicketBasicDataForm
|
||||
|
@ -168,7 +162,7 @@ onBeforeMount(async () => await getTicketData());
|
|||
/>
|
||||
</QStep>
|
||||
<QStep :name="2" :title="t('basicData.priceDifference')">
|
||||
<BasicDataTable
|
||||
<TicketBasicData
|
||||
:form-data="formData"
|
||||
v-model:haveNegatives="haveNegatives"
|
||||
@update-form="($event) => (formData = $event)"
|
||||
|
|
|
@ -31,28 +31,23 @@ const router = useRouter();
|
|||
const { notify } = useNotify();
|
||||
|
||||
const newTicketFormData = reactive({});
|
||||
const date = new Date();
|
||||
|
||||
const createTicket = async () => {
|
||||
try {
|
||||
const expeditionIds = $props.selectedExpeditions.map(
|
||||
(expedition) => expedition.id
|
||||
);
|
||||
const params = {
|
||||
clientId: $props.ticket.clientFk,
|
||||
landed: newTicketFormData.landed,
|
||||
warehouseId: $props.ticket.warehouseFk,
|
||||
addressId: $props.ticket.addressFk,
|
||||
agencyModeId: $props.ticket.agencyModeFk,
|
||||
routeId: newTicketFormData.routeFk,
|
||||
expeditionIds: expeditionIds,
|
||||
};
|
||||
const expeditionIds = $props.selectedExpeditions.map((expedition) => expedition.id);
|
||||
const params = {
|
||||
clientId: $props.ticket.clientFk,
|
||||
landed: newTicketFormData.landed,
|
||||
warehouseId: $props.ticket.warehouseFk,
|
||||
addressId: $props.ticket.addressFk,
|
||||
agencyModeId: $props.ticket.agencyModeFk,
|
||||
routeId: newTicketFormData.routeFk,
|
||||
expeditionIds: expeditionIds,
|
||||
};
|
||||
|
||||
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
const { data } = await axios.post('Expeditions/moveExpeditions', params);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
router.push({ name: 'TicketSummary', params: { id: data.id } });
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -64,7 +59,11 @@ const createTicket = async () => {
|
|||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<VnRow>
|
||||
<VnInputDate :label="t('expedition.landed')" v-model="data.landed" />
|
||||
<VnInputDate
|
||||
:label="t('expedition.landed')"
|
||||
v-model="data.landed"
|
||||
:model-value="date"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
|
|
|
@ -5,15 +5,16 @@ import { useRoute } from 'vue-router';
|
|||
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import axios from 'axios';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const stateStore = useStateStore();
|
||||
|
@ -75,22 +76,39 @@ const columns = computed(() => [
|
|||
name: 'item',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('lines.image'),
|
||||
name: 'image',
|
||||
columnField: {
|
||||
component: VnImg,
|
||||
attrs: (id) => {
|
||||
return {
|
||||
id,
|
||||
width: '50px',
|
||||
};
|
||||
},
|
||||
},
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
label: t('ticketComponents.description'),
|
||||
name: 'description',
|
||||
align: 'left',
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
label: t('ticketComponents.quantity'),
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
format: (row) => dashIfEmpty(row.quantity),
|
||||
},
|
||||
{
|
||||
label: t('ticketComponents.serie'),
|
||||
name: 'serie',
|
||||
align: 'left',
|
||||
format: (row) => dashIfEmpty(row.serie),
|
||||
},
|
||||
{
|
||||
label: t('ticketComponents.components'),
|
||||
|
@ -132,31 +150,19 @@ const getTotal = computed(() => {
|
|||
});
|
||||
|
||||
const getComponentsSum = async () => {
|
||||
try {
|
||||
const { data } = await axios.get(`Tickets/${route.params.id}/getComponentsSum`);
|
||||
componentsList.value = data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
const { data } = await axios.get(`Tickets/${route.params.id}/getComponentsSum`);
|
||||
componentsList.value = data;
|
||||
};
|
||||
|
||||
const getTheoricalCost = async () => {
|
||||
try {
|
||||
const { data } = await axios.get(`Tickets/${route.params.id}/freightCost`);
|
||||
theoricalCost.value = data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
const { data } = await axios.get(`Tickets/${route.params.id}/freightCost`);
|
||||
theoricalCost.value = data;
|
||||
};
|
||||
|
||||
const getTicketVolume = async () => {
|
||||
try {
|
||||
if (!ticketData.value) return;
|
||||
const { data } = await axios.get(`Tickets/${ticketData.value.id}/getVolume`);
|
||||
ticketVolume.value = data[0].volume;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
if (!ticketData.value) return;
|
||||
const { data } = await axios.get(`Tickets/${ticketData.value.id}/getVolume`);
|
||||
ticketVolume.value = data[0].volume;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
@ -174,181 +180,166 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
@on-fetch="(data) => (components = data)"
|
||||
auto-load
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<QCard
|
||||
class="q-pa-sm color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
<QDrawer side="right" :width="265" v-model="stateStore.rightDrawer">
|
||||
<QCard class="q-pa-sm color-vn-text" bordered flat style="border-color: black">
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.total') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label"
|
||||
>{{ t('ticketComponents.baseToCommission') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(getBase) }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label"
|
||||
>{{ t('ticketComponents.totalWithoutVat') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(getTotal) }}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard class="q-pa-sm color-vn-text" bordered flat style="border-color: black">
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.components') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection
|
||||
v-for="(component, index) in componentsList"
|
||||
:key="index"
|
||||
horizontal
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.total') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label"
|
||||
>{{ t('ticketComponents.baseToCommission') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(getBase) }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label"
|
||||
>{{ t('ticketComponents.totalWithoutVat') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(getTotal) }}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
class="q-pa-sm color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.components') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection
|
||||
v-for="(component, index) in componentsList"
|
||||
:key="index"
|
||||
horizontal
|
||||
>
|
||||
<span v-if="component.name" class="q-mr-xs color-vn-label">
|
||||
{{ component.name }}:
|
||||
</span>
|
||||
<span v-if="component.value">{{
|
||||
toCurrency(component.value, 'EUR', 3)
|
||||
}}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
class="q-pa-sm color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.zoneBreakdown') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.price') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(ticketData?.zonePrice, 'EUR', 2) }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.bonus') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(ticketData?.zoneBonus, 'EUR', 2) }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.zone') }}:
|
||||
</span>
|
||||
<span class="link">
|
||||
{{ dashIfEmpty(ticketData?.zone?.name) }}
|
||||
<ZoneDescriptorProxy :id="ticketData?.zone?.id" />
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection v-if="ticketData?.zone?.isVolumetric" horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.volume') }}:
|
||||
</span>
|
||||
<span>{{ ticketVolume }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.packages') }}:
|
||||
</span>
|
||||
<span>{{ dashIfEmpty(ticketData?.packages) }}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
class="q-pa-sm color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.theoricalCost') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.totalPrice') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(theoricalCost, 'EUR', 2) }}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QTable
|
||||
:rows="components"
|
||||
<span v-if="component.name" class="q-mr-xs color-vn-label">
|
||||
{{ component.name }}:
|
||||
</span>
|
||||
<span v-if="component.value">{{
|
||||
toCurrency(component.value, 'EUR', 3)
|
||||
}}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard class="q-pa-sm color-vn-text" bordered flat style="border-color: black">
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.zoneBreakdown') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.price') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(ticketData?.zonePrice, 'EUR', 2) }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.bonus') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(ticketData?.zoneBonus, 'EUR', 2) }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.zone') }}:
|
||||
</span>
|
||||
<span class="link">
|
||||
{{ dashIfEmpty(ticketData?.zone?.name) }}
|
||||
<ZoneDescriptorProxy :id="ticketData?.zone?.id" />
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection v-if="ticketData?.zone?.isVolumetric" horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.volume') }}:
|
||||
</span>
|
||||
<span>{{ ticketVolume }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.packages') }}:
|
||||
</span>
|
||||
<span>{{ dashIfEmpty(ticketData?.packages) }}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard class="q-pa-sm color-vn-text" bordered flat style="border-color: black">
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.theoricalCost') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection horizontal>
|
||||
<span class="q-mr-xs color-vn-label">
|
||||
{{ t('ticketComponents.totalPrice') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(theoricalCost, 'EUR', 2) }}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QDrawer>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="TicketComponents"
|
||||
url="Sales"
|
||||
:user-filter="salesFilter"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
:right-search="false"
|
||||
auto-load
|
||||
:disable-option="{ card: true }"
|
||||
:column-search="false"
|
||||
>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
<span class="link">{{ row.itemFk }}</span>
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
<template #column-item="{ row }">
|
||||
<span @click.stop flat class="link">
|
||||
{{ row.itemFk }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd>
|
||||
<div class="column">
|
||||
<span>{{ row.item.name }}</span>
|
||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
||||
<FetchedTags :item="row.item" />
|
||||
</div>
|
||||
</QTd>
|
||||
<template #column-image="{ row }">
|
||||
<div class="image-wrapper">
|
||||
<VnImg :id="parseInt(row?.item?.id)" class="rounded" />
|
||||
</div>
|
||||
</template>
|
||||
<template #body-cell-serie="{ row }">
|
||||
<QTd>
|
||||
<div class="column">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ saleComponent.component?.componentType?.name }}
|
||||
</span>
|
||||
</div>
|
||||
</QTd>
|
||||
<template #column-description="{ row }">
|
||||
<div class="column">
|
||||
<span>{{ row.item.name }}</span>
|
||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
||||
<FetchedTags :item="row.item" />
|
||||
</div>
|
||||
</template>
|
||||
<template #body-cell-components="{ row }">
|
||||
<QTd>
|
||||
<div class="column">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ saleComponent.component?.name }}
|
||||
</span>
|
||||
</div>
|
||||
</QTd>
|
||||
<template #column-serie="{ row }">
|
||||
<div class="column">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ saleComponent.component?.componentType?.name }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body-cell-import="{ row }">
|
||||
<QTd>
|
||||
<div class="column text-right">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
<template #column-components="{ row }">
|
||||
<div class="column">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ saleComponent.component?.name }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-import="{ row }">
|
||||
<div class="column text-left">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ toCurrency(saleComponent.value, 'EUR', 3) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-total="{ row }">
|
||||
<div class="column">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ toCurrency(saleComponent.value * row.quantity, 'EUR', 3) }}
|
||||
<!-- <QTooltip>
|
||||
{{ saleComponent.component?.name }}:
|
||||
{{ toCurrency(saleComponent.value, 'EUR', 3) }}
|
||||
</span>
|
||||
</div>
|
||||
</QTd>
|
||||
</QTooltip> -->
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body-cell-total="{ row }">
|
||||
<QTd>
|
||||
<div class="column text-right">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ toCurrency(saleComponent.value * row.quantity, 'EUR', 3) }}
|
||||
</span>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.image-wrapper {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate } from 'src/filters';
|
||||
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -30,13 +30,24 @@ const filter = {
|
|||
{
|
||||
relation: 'address',
|
||||
scope: {
|
||||
fields: ['id', 'name', 'mobile', 'phone'],
|
||||
fields: ['id', 'name', 'mobile', 'phone', 'incotermsFk'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['id', 'name', 'salesPersonFk', 'phone', 'mobile', 'email'],
|
||||
fields: [
|
||||
'id',
|
||||
'name',
|
||||
'salesPersonFk',
|
||||
'phone',
|
||||
'mobile',
|
||||
'email',
|
||||
'isActive',
|
||||
'isFreezed',
|
||||
'isTaxDataChecked',
|
||||
'hasElectronicInvoice',
|
||||
],
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
|
@ -87,6 +98,10 @@ const filter = {
|
|||
};
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
|
||||
function ticketFilter(ticket) {
|
||||
return JSON.stringify({ clientFk: ticket.clientFk });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -128,7 +143,10 @@ const data = ref(useCardDescription());
|
|||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('ticket.card.shipped')" :value="toDate(entity.shipped)" />
|
||||
<VnLv
|
||||
:label="t('ticket.card.shipped')"
|
||||
:value="toDateTimeFormat(entity.shipped)"
|
||||
/>
|
||||
<VnLv
|
||||
v-if="entity.agencyMode"
|
||||
:label="t('ticket.card.agency')"
|
||||
|
@ -138,7 +156,39 @@ const data = ref(useCardDescription());
|
|||
<VnLv :label="t('ticket.card.alias')" :value="entity.nickname" />
|
||||
</template>
|
||||
<template #icons="{ entity }">
|
||||
<QCardActions>
|
||||
<QCardActions class="q-gutter-x-xs">
|
||||
<QIcon
|
||||
v-if="entity.client.isActive == false"
|
||||
name="vn:disabled"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client inactive') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.client.isFreezed == true"
|
||||
name="vn:frozen"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.problem.includes('hasRisk')"
|
||||
name="vn:risk"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client has debt') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.client.isTaxDataChecked == false"
|
||||
name="vn:no036"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client not checked') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.isDeleted == true"
|
||||
name="vn:deletedTicket"
|
||||
|
@ -159,6 +209,27 @@ const data = ref(useCardDescription());
|
|||
>
|
||||
<QTooltip>{{ t('ticket.card.customerCard') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
size="md"
|
||||
icon="vn:ticket"
|
||||
color="primary"
|
||||
:to="{ name: 'TicketList', query: { table: ticketFilter(entity) } }"
|
||||
>
|
||||
<QTooltip>{{ t('ticket.card.ticketList') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
size="md"
|
||||
icon="vn:basketadd"
|
||||
color="primary"
|
||||
:to="{
|
||||
name: 'OrderList',
|
||||
query: {
|
||||
createForm: JSON.stringify({ clientFk: entity.clientFk }),
|
||||
},
|
||||
}"
|
||||
>
|
||||
<QTooltip>{{ t('ticket.card.newOrder') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
|
@ -168,4 +239,8 @@ const data = ref(useCardDescription());
|
|||
es:
|
||||
This ticket is deleted: Este ticket está eliminado
|
||||
Go to module index: Ir al índice del modulo
|
||||
Client inactive: Cliente inactivo
|
||||
Client not checked: Cliente no verificado
|
||||
Client has debt: Cliente con deuda
|
||||
Client Frozen: Cliente congelado
|
||||
</i18n>
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref } from 'vue';
|
||||
import { ref, toRefs } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import VnSmsDialog from 'components/common/VnSmsDialog.vue';
|
||||
import toDate from 'filters/toDate';
|
||||
import FormPopup from 'components/FormPopup.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
|
@ -18,15 +23,26 @@ const props = defineProps({
|
|||
required: true,
|
||||
},
|
||||
});
|
||||
const route = useRoute();
|
||||
|
||||
const { push, currentRoute } = useRouter();
|
||||
const { dialog, notify } = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const { openReport, sendEmail } = usePrintService();
|
||||
const ticketSummary = useArrayData('TicketSummary');
|
||||
const ticket = ref(props.ticket);
|
||||
const { ticket } = toRefs(props);
|
||||
const ticketId = currentRoute.value.params.id;
|
||||
const client = ref();
|
||||
const showTransferDialog = ref(false);
|
||||
const showTurnDialog = ref(false);
|
||||
const showChangeTimeDialog = ref(false);
|
||||
const dialogRef = ref();
|
||||
const isEditable = ref();
|
||||
const hasInvoicing = useAcl('invoicing');
|
||||
const hasPdf = ref();
|
||||
const weight = ref();
|
||||
const hasDocuwareFile = ref();
|
||||
const quasar = useQuasar();
|
||||
const actions = {
|
||||
clone: async () => {
|
||||
const opts = { message: t('Ticket cloned'), type: 'positive' };
|
||||
|
@ -76,6 +92,7 @@ const actions = {
|
|||
notify({
|
||||
message: t('You can undo this action within the first hour'),
|
||||
icon: 'info',
|
||||
type: 'warning',
|
||||
});
|
||||
|
||||
push({ name: 'TicketList' });
|
||||
|
@ -87,10 +104,14 @@ const actions = {
|
|||
|
||||
function openDeliveryNote(type = 'deliveryNote', documentType = 'pdf') {
|
||||
const path = `Tickets/${ticket.value.id}/delivery-note-${documentType}`;
|
||||
openReport(path, {
|
||||
recipientId: ticket.value.clientFk,
|
||||
type: type,
|
||||
});
|
||||
openReport(
|
||||
path,
|
||||
{
|
||||
recipientId: ticket.value.clientFk,
|
||||
type: type,
|
||||
},
|
||||
'_blank'
|
||||
);
|
||||
}
|
||||
|
||||
function sendDeliveryNoteConfirmation(type = 'deliveryNote', documentType = 'pdf') {
|
||||
|
@ -173,34 +194,334 @@ function openConfirmDialog(callback) {
|
|||
dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('This ticket will be removed from current route! Continue anyway?'),
|
||||
message: t('You are going to delete this ticket'),
|
||||
promise: actions[callback],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function generatePdfDialog() {
|
||||
dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
promise: generatePdfInvoice,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function generatePdfInvoice() {
|
||||
const { data } = await axios.get('invoiceOuts', {
|
||||
params: {
|
||||
filter: JSON.stringify({
|
||||
where: { ref: ticket.value.refFk },
|
||||
}),
|
||||
},
|
||||
});
|
||||
const invoiceId = data[0].id;
|
||||
const { response } = await axios.post(`InvoiceOuts/${invoiceId}/createPdf`);
|
||||
if (!response) {
|
||||
notify({
|
||||
message: 'The invoice PDF document has been regenerated',
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function makeInvoiceDialog() {
|
||||
dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('Are you sure you want to invoice this ticket?'),
|
||||
message: t('You are going to invoice this ticket'),
|
||||
promise: makeInvoice,
|
||||
},
|
||||
});
|
||||
}
|
||||
async function makeInvoice() {
|
||||
const params = {
|
||||
ticketsIds: [parseInt(ticketId)],
|
||||
};
|
||||
await axios.post(`Tickets/invoiceTicketsAndPdf`, params);
|
||||
|
||||
notify({
|
||||
message: t('Ticket invoiced'),
|
||||
type: 'positive',
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
async function transferClient(client) {
|
||||
const params = {
|
||||
clientFk: client,
|
||||
};
|
||||
|
||||
const { data } = await axios.patch(`Tickets/${ticketId}/transferClient`, params);
|
||||
|
||||
if (data) window.location.reload();
|
||||
}
|
||||
|
||||
async function addTurn(day) {
|
||||
const params = {
|
||||
ticketFk: parseInt(ticketId),
|
||||
weekDay: day,
|
||||
agencyModeFk: ticket.value.agencyModeFk,
|
||||
};
|
||||
await axios.patch(`TicketWeeklies`, params);
|
||||
|
||||
notify({
|
||||
message: t('Current ticket deleted and added to shift'),
|
||||
type: 'positive',
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
async function createRefund(withWarehouse) {
|
||||
const params = {
|
||||
ticketsIds: [parseInt(ticketId)],
|
||||
withWarehouse: withWarehouse,
|
||||
negative: true,
|
||||
};
|
||||
const { data } = await axios.post(`Tickets/cloneAll`, params);
|
||||
|
||||
if (data) {
|
||||
const [refundTicket] = data;
|
||||
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
|
||||
push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||
}
|
||||
}
|
||||
|
||||
async function changeShippedHour(time) {
|
||||
const params = {
|
||||
shipped: time,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(`Tickets/${ticketId}/updateEditableTicket`, params);
|
||||
|
||||
if (data) window.location.reload();
|
||||
}
|
||||
|
||||
function openRecalculateDialog() {
|
||||
dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('Recalculate components'),
|
||||
message: t('Are you sure you want to recalculate components?'),
|
||||
promise: recalculateComponents,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function recalculateComponents() {
|
||||
await axios.post(`Tickets/${ticketId}/recalculateComponents`);
|
||||
notify({
|
||||
message: t('Data saved'),
|
||||
type: 'positive',
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
const handleFetchData = (data) => {
|
||||
isEditable.value = data;
|
||||
handleInvoiceOutData();
|
||||
};
|
||||
|
||||
async function handleInvoiceOutData() {
|
||||
const { data } = await axios.get(`InvoiceOuts`, {
|
||||
params: {
|
||||
filter: JSON.stringify({ where: { ref: ticket.value.refFk } }),
|
||||
},
|
||||
});
|
||||
hasPdf.value = data[0]?.hasPdf;
|
||||
}
|
||||
|
||||
async function docuwareDownload() {
|
||||
await axios.get(`Tickets/${ticketId}/docuwareDownload`);
|
||||
}
|
||||
|
||||
async function hasDocuware() {
|
||||
const { data } = await axios.post(`Docuwares/${ticketId}/checkFile`, {
|
||||
fileCabinet: 'deliveryNote',
|
||||
signed: true,
|
||||
});
|
||||
hasDocuwareFile.value = data;
|
||||
}
|
||||
|
||||
async function uploadDocuware(force) {
|
||||
console.log('force: ', force);
|
||||
if (!force)
|
||||
return quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('Send PDF to tablet'),
|
||||
message: t('Are you sure you want to replace this delivery note?'),
|
||||
},
|
||||
})
|
||||
.onOk(async () => {
|
||||
uploadDocuware(true);
|
||||
});
|
||||
|
||||
const { data } = await axios.post(`Docuwares/upload`, {
|
||||
fileCabinet: 'deliveryNote',
|
||||
ticketIds: [parseInt(ticketId)],
|
||||
});
|
||||
|
||||
if (data) notify({ message: t('PDF sent!'), type: 'positive' });
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
:url="
|
||||
route.path.startsWith('/ticket')
|
||||
? `Tickets/${ticketId}/isEditable`
|
||||
: `Tickets/${ticket}/isEditable`
|
||||
"
|
||||
auto-load
|
||||
@on-fetch="handleFetchData"
|
||||
/>
|
||||
<QItem @click="showTransferDialog = !showTransferDialog" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="content_paste" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Transfer client') }}</QItemSection>
|
||||
</QItem>
|
||||
<QDialog ref="dialogRef" v-model="showTransferDialog">
|
||||
<FormPopup
|
||||
@on-submit="transferClient(client)"
|
||||
:title="t('Transfer client')"
|
||||
:custom-submit-button-label="t('Transfer client')"
|
||||
:default-cancel-button="false"
|
||||
>
|
||||
<template #form-inputs>
|
||||
<VnSelect
|
||||
url="Clients"
|
||||
:fields="['id', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="client"
|
||||
:label="t('Client')"
|
||||
auto-load
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ `#${scope.opt.id} - ` }}
|
||||
{{ scope.opt.name }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
</FormPopup>
|
||||
</QDialog>
|
||||
<QItem @click="showTurnDialog = !showTurnDialog" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="vn:calendar" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('addTurn') }}</QItemSection>
|
||||
</QItem>
|
||||
<QDialog ref="dialogRef" v-model="showTurnDialog">
|
||||
<FormPopup
|
||||
@on-submit="addTurn"
|
||||
:title="t('What is the day of receipt of the ticket?')"
|
||||
:default-submit-button="false"
|
||||
:default-cancel-button="false"
|
||||
style="text-align: center"
|
||||
>
|
||||
<template #form-inputs>
|
||||
<QBtnGroup spread>
|
||||
<QBtn
|
||||
:label="t('weekdays.mon')"
|
||||
color="primary"
|
||||
@click="addTurn(0)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.tue')"
|
||||
color="primary"
|
||||
@click="addTurn(1)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.wed')"
|
||||
color="primary"
|
||||
@click="addTurn(2)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.thu')"
|
||||
color="primary"
|
||||
@click="addTurn(3)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.fri')"
|
||||
color="primary"
|
||||
@click="addTurn(4)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.sat')"
|
||||
color="primary"
|
||||
@click="addTurn(5)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.sun')"
|
||||
color="primary"
|
||||
@click="addTurn(6)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
</QBtnGroup>
|
||||
</template>
|
||||
</FormPopup>
|
||||
</QDialog>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="picture_as_pdf" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Open Delivery Note...') }}</QItemSection>
|
||||
<QItemSection>{{ t('Show Delivery Note...') }}</QItemSection>
|
||||
<QItemSection side>
|
||||
<QIcon name="keyboard_arrow_right" />
|
||||
</QItemSection>
|
||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||
<QMenu
|
||||
anchor="top end"
|
||||
self="top start"
|
||||
auto-close
|
||||
bordered
|
||||
@click="hasDocuware()"
|
||||
>
|
||||
<QList>
|
||||
<QItem @click="openDeliveryNote('deliveryNote')" v-ripple clickable>
|
||||
<QItemSection>{{ t('With prices') }}</QItemSection>
|
||||
<QItemSection>{{ t('as PDF') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem @click="openDeliveryNote('withoutPrices')" v-ripple clickable>
|
||||
<QItemSection>{{ t('Without prices') }}</QItemSection>
|
||||
<QItemSection>{{ t('as PDF without prices') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="hasDocuwareFile"
|
||||
@click="docuwareDownload()"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('as PDF signed') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="openDeliveryNote('deliveryNote', 'csv')"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('As CSV') }}</QItemSection>
|
||||
<QItemSection>{{ t('as CSV') }}</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
|
@ -213,28 +534,24 @@ function openConfirmDialog(callback) {
|
|||
<QItemSection side>
|
||||
<QIcon name="keyboard_arrow_right" />
|
||||
</QItemSection>
|
||||
<QMenu anchor="top end" self="top start" auto-close>
|
||||
<QMenu anchor="top end" self="top start" auto-close @click="hasDocuware()">
|
||||
<QList>
|
||||
<QItem
|
||||
@click="sendDeliveryNoteConfirmation('deliveryNote')"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('With prices') }}</QItemSection>
|
||||
<QItemSection>{{ t('Send PDF') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="sendDeliveryNoteConfirmation('withoutPrices')"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('Without prices') }}</QItemSection>
|
||||
<QItem @click="uploadDocuware(!hasDocuwareFile)" v-ripple clickable>
|
||||
<QItemSection>{{ t('Send PDF to tablet') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="sendDeliveryNoteConfirmation('deliveryNote', 'csv')"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('As CSV') }}</QItemSection>
|
||||
<QItemSection>{{ t('Send CSV') }}</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
|
@ -243,8 +560,26 @@ function openConfirmDialog(callback) {
|
|||
<QItemSection avatar>
|
||||
<QIcon name="receipt" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Open Proforma Invoice') }}</QItemSection>
|
||||
<QItemSection>{{ t('Show Proforma') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isEditable"
|
||||
@click="showChangeTimeDialog = !showChangeTimeDialog"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="schedule" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Change shipped hour') }}</QItemSection>
|
||||
</QItem>
|
||||
<QDialog ref="dialogRef" v-model="showChangeTimeDialog">
|
||||
<FormPopup @on-submit="changeShippedHour(time)" :title="t('Change shipped hour')">
|
||||
<template #form-inputs>
|
||||
<VnInputTime v-model="time" :label="t('Shipped hour')" clearable />
|
||||
</template>
|
||||
</FormPopup>
|
||||
</QDialog>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="sms" />
|
||||
|
@ -259,24 +594,72 @@ function openConfirmDialog(callback) {
|
|||
<QItemSection>{{ t('Pending payment') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem @click="showSmsDialog('minAmount')" v-ripple clickable>
|
||||
<QItemSection>{{ t('Minimum amount') }}</QItemSection>
|
||||
<QItemSection>{{ t('Minimum import') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="showSmsDialogWithChanges('orderChanges')"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('Order changes') }}</QItemSection>
|
||||
<QItemSection>{{ t('Notify changes') }}</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QItem>
|
||||
<QItem @click="makeInvoiceDialog()" v-ripple clickable v-if="isEditable">
|
||||
<QItemSection avatar>
|
||||
<QIcon name="picture_as_pdf" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Make invoice') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="generatePdfDialog()"
|
||||
v-ripple
|
||||
clickable
|
||||
v-if="ticket.refFk !== null && (hasInvoicing || hasPdf)"
|
||||
>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="picture_as_pdf" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{
|
||||
hasPdf ? t('Regenerate PDF invoice') : t('Generate PDF invoice')
|
||||
}}</QItemSection>
|
||||
</QItem>
|
||||
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="content_copy" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('To clone ticket') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-if="isEditable" @click="openRecalculateDialog()" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="refresh" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Recalculate components') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="monetization_on" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Refund all...') }}</QItemSection>
|
||||
<QItemSection side>
|
||||
<QIcon name="keyboard_arrow_right" />
|
||||
</QItemSection>
|
||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||
<QList>
|
||||
<QItem v-ripple clickable @click="createRefund(true)">
|
||||
<QItemSection>
|
||||
{{ t('with warehouse') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable @click="createRefund(false)">
|
||||
<QItemSection>
|
||||
{{ t('without warehouse') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QItem>
|
||||
<QItem @click="$refs.weightDialog.show()" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="weight" />
|
||||
|
@ -307,29 +690,63 @@ function openConfirmDialog(callback) {
|
|||
</template>
|
||||
</VnConfirm>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.weekdaysBtn {
|
||||
margin: 1%;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
addTurn: Add turn
|
||||
invoiceIds: "Invoices have been generated with the following ids: {invoiceIds}"
|
||||
|
||||
es:
|
||||
Open Delivery Note...: Abrir albarán...
|
||||
Show Delivery Note...: Ver albarán...
|
||||
Send Delivery Note...: Enviar albarán...
|
||||
With prices: Con precios
|
||||
Without prices: Sin precios
|
||||
As CSV: Como CSV
|
||||
Open Proforma Invoice: Abrir factura proforma
|
||||
as PDF: como PDF
|
||||
as PDF without prices: como PDF sin precios
|
||||
as CSV: Como CSV
|
||||
Send PDF: Enviar PDF
|
||||
Send PDF to tablet: Enviar PDF a tablet
|
||||
Send CSV: Enviar CSV
|
||||
Show Proforma: Ver proforma
|
||||
Delete ticket: Eliminar ticket
|
||||
Send SMS...: Enviar SMS
|
||||
Send SMS...: Enviar SMS...
|
||||
Pending payment: Pago pendiente
|
||||
Minimum amount: Importe mínimo
|
||||
Order changes: Cambios del pedido
|
||||
Minimum import: Importe mínimo
|
||||
Notify changes: Notificar cambios
|
||||
Ticket deleted: Ticket eliminado
|
||||
You can undo this action within the first hour: Puedes deshacer esta acción dentro de la primera hora
|
||||
To clone ticket: Clonar ticket
|
||||
Ticket cloned: Ticked clonado
|
||||
It was not able to clone the ticket: No se pudo clonar el ticket
|
||||
Generate PDF invoice: Generar PDF factura
|
||||
Regenerate PDF invoice: Regenerar PDF factura
|
||||
The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado
|
||||
Transfer client: Transferir cliente
|
||||
Client: Cliente
|
||||
addTurn: Añadir a turno
|
||||
What is the day of receipt of the ticket?: ¿Cuál es el día de preparación del pedido?
|
||||
Current ticket deleted and added to shift: Ticket actual eliminado y añadido al turno
|
||||
Refund all...: Abonar todo...
|
||||
with warehouse: con almacén
|
||||
without warehouse: sin almacén
|
||||
Make invoice: Crear factura
|
||||
Change shipped hour: Cambiar hora de envío
|
||||
Shipped hour: Hora de envío
|
||||
Recalculate components: Recalcular componentes
|
||||
Are you sure you want to recalculate components?: ¿Seguro que quieres recalcular los componentes?
|
||||
Data saved: Datos guardados
|
||||
Are you sure you want to invoice this ticket?: ¿Seguro que quieres facturar este ticket?
|
||||
You are going to invoice this ticket: Vas a facturar este ticket
|
||||
Ticket invoiced: Ticket facturado
|
||||
Set weight: Establecer peso
|
||||
Weight set: Peso establecido
|
||||
This ticket may be invoiced, do you want to continue?: Es posible que se facture este ticket, desea continuar?
|
||||
invoiceIds: "Se han generado las facturas con los siguientes ids: {invoiceIds}"
|
||||
This ticket will be removed from current route! Continue anyway?: ¡Se eliminará el ticket de la ruta actual! ¿Continuar de todas formas?
|
||||
You are going to delete this ticket: Vas a eliminar este ticket
|
||||
as PDF signed: como PDF firmado
|
||||
Are you sure you want to replace this delivery note?: ¿Seguro que quieres reemplazar este albarán?
|
||||
</i18n>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { toCurrency } from 'src/filters';
|
||||
import VnUsesMana from 'components/ui/VnUsesMana.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
|
@ -13,12 +13,21 @@ const $props = defineProps({
|
|||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
usesMana: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
manaCode: {
|
||||
type: String,
|
||||
default: 'mana',
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['save', 'cancel']);
|
||||
|
||||
const { t } = useI18n();
|
||||
const QPopupProxyRef = ref(null);
|
||||
const manaCode = ref($props.manaCode);
|
||||
|
||||
const save = () => {
|
||||
emit('save');
|
||||
|
@ -47,6 +56,9 @@ const cancel = () => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
|
||||
<VnUsesMana :mana-code="manaCode" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<QBtn
|
||||
color="primary"
|
||||
|
|
|
@ -163,16 +163,12 @@ const showNewTicketDialog = (withRoute = false) => {
|
|||
};
|
||||
|
||||
const deleteExpedition = async () => {
|
||||
try {
|
||||
const expeditionIds = selectedRows.value.map((expedition) => expedition.id);
|
||||
const params = { expeditionIds };
|
||||
await axios.post('Expeditions/deleteExpeditions', params);
|
||||
vnTableRef.value.reload();
|
||||
selectedExpeditions.value = [];
|
||||
notify(t('expedition.expeditionRemoved'), 'positive');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
const expeditionIds = selectedRows.value.map((expedition) => expedition.id);
|
||||
const params = { expeditionIds };
|
||||
await axios.post('Expeditions/deleteExpeditions', params);
|
||||
vnTableRef.value.reload();
|
||||
selectedExpeditions.value = [];
|
||||
notify(t('expedition.expeditionRemoved'), 'positive');
|
||||
};
|
||||
|
||||
const showLog = async (expedition) => {
|
||||
|
@ -181,23 +177,19 @@ const showLog = async (expedition) => {
|
|||
};
|
||||
|
||||
const getExpeditionState = async (expedition) => {
|
||||
try {
|
||||
const filter = {
|
||||
where: { expeditionFk: expedition.id },
|
||||
order: ['created DESC'],
|
||||
};
|
||||
const filter = {
|
||||
where: { expeditionFk: expedition.id },
|
||||
order: ['created DESC'],
|
||||
};
|
||||
|
||||
const { data: expeditionStates } = await axios.get(`ExpeditionStates/filter`, {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
const { data: expeditionStates } = await axios.get(`ExpeditionStates/filter`, {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
|
||||
expeditionsLogsData.value = expeditionStates.map((state) => ({
|
||||
...state,
|
||||
isScanned: !!state.isScanned,
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
expeditionsLogsData.value = expeditionStates.map((state) => ({
|
||||
...state,
|
||||
isScanned: !!state.isScanned,
|
||||
}));
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue