Compare commits
1353 Commits
warmfix_vn
...
dev
Author | SHA1 | Date |
---|---|---|
|
c7b753a4ef | |
|
f494021dc8 | |
|
3e2d7fad61 | |
|
f71a83d587 | |
|
4da25bb564 | |
|
e0362801db | |
|
1a14440850 | |
|
ade49b2bb0 | |
|
deaeee07e0 | |
|
15a1098506 | |
|
088fd0b710 | |
|
de9f3f32fd | |
|
1a137f5f3d | |
|
22a173b7f7 | |
|
9350c512ff | |
|
d2d06f012d | |
|
0c68265408 | |
|
cf678b423d | |
|
b4bde21d06 | |
|
ebcd1bf6e6 | |
|
c744d3f6aa | |
|
3dfce751dc | |
|
a45e632e31 | |
|
c121e7d864 | |
|
5927fb4548 | |
|
20e767991b | |
|
b45ff6817d | |
|
17e837c35e | |
|
669257e98d | |
|
5928b7a05c | |
|
58cf8ab29d | |
|
56da517c0d | |
|
d2b1cd4067 | |
|
b611430d7a | |
|
1163b9dc2e | |
|
206cecd213 | |
|
0277d1eb86 | |
|
090e314112 | |
|
a15c8b3bf3 | |
|
794da6d1e6 | |
|
efb9747ef4 | |
|
7fd0570929 | |
|
ea6874c0db | |
|
484ceb709a | |
|
d94ec64615 | |
|
eb1fe0fbd7 | |
|
c0eb5444fb | |
|
7b98d1a34f | |
|
e32fdfa0d8 | |
|
c7ea352720 | |
|
a12d1f0647 | |
|
c9b9c91809 | |
|
1d05f9549a | |
|
aa0ea0ef68 | |
|
faa8962271 | |
|
95307b87b1 | |
|
3a82103b86 | |
|
36da27f14f | |
|
a4b0f6b9c6 | |
|
28f2919b46 | |
|
d7b4e25ce2 | |
|
7e738633a1 | |
|
dfbfd34900 | |
|
b5342cc130 | |
|
5d671531ca | |
|
0378ec36c2 | |
|
e3bd8e59ca | |
|
50637e8415 | |
|
525d2b9389 | |
|
4892e96755 | |
|
5caa4d1e1f | |
|
d8507fe852 | |
|
5b5ed2c34f | |
|
b32d30c90b | |
|
16a30daf8e | |
|
3529af45d9 | |
|
a4fa89f15e | |
|
743e07cd64 | |
|
0f5f5b847e | |
|
416916a92b | |
|
0a9c11a54e | |
|
d495b38479 | |
|
9d67bbd8ae | |
|
c00b0f321c | |
|
2889253c07 | |
|
7633207bf3 | |
|
ae0158d529 | |
|
bdd5843d14 | |
|
f9c2d9e641 | |
|
78552a49fa | |
|
47d53e9c87 | |
|
763d7679a1 | |
|
f999304ea8 | |
|
3d6cf29afa | |
|
61cccf5a63 | |
|
602ffc589b | |
|
a1015825ed | |
|
de7a7c5144 | |
|
af2b8f95c5 | |
|
523e97760e | |
|
b8e6b27303 | |
|
b2184635d3 | |
|
874fbb48f5 | |
|
09d48acfb2 | |
|
380965fbea | |
|
ab5b36a895 | |
|
7ade3f4f84 | |
|
a2fd01844d | |
|
2deeb51f5e | |
|
54b2cdbb8f | |
|
6a3d13144c | |
|
46f7cd41fd | |
|
154b302005 | |
|
a2216571b6 | |
|
fd986fa11c | |
|
00f43b36b8 | |
|
35c0fefbc9 | |
|
2e26a0b32a | |
|
e61e0ea473 | |
|
d03b409c3c | |
|
d33bb451a3 | |
|
45f98ab25d | |
|
35253c8127 | |
|
3bf64d126d | |
|
a557b63f3f | |
|
1de829f016 | |
|
f9ba72a2bc | |
|
bd522c301f | |
|
eab18e4d14 | |
|
536eb5996e | |
|
06eb1bc8cb | |
|
4bdc6a5361 | |
|
b2dab7ba59 | |
|
cfc377847f | |
|
ee23bf60dc | |
|
29140b821d | |
|
a096ac5b48 | |
|
a34e21c925 | |
|
40c8daa2ab | |
|
0b1ed3010f | |
|
fc6eb49a07 | |
|
d02f4d0d8f | |
|
251e45160c | |
|
a741419141 | |
|
49e84497eb | |
|
99424e0971 | |
|
75495b4437 | |
|
8108aca31f | |
|
b52955276a | |
|
058a2e65e4 | |
|
4d058e09da | |
|
5f5ef3df41 | |
|
12e1e8ac3d | |
|
807ee381fc | |
|
8b238d0098 | |
|
2c3d1a8c03 | |
|
c52f13e35a | |
|
d5dd8b98bf | |
|
974241a9b3 | |
|
09a63112fc | |
|
45bf813c0a | |
|
736415c876 | |
|
ecd278946e | |
|
416d697ba2 | |
|
e5fe743e0e | |
|
a8a36b6f6f | |
|
c2e97f001e | |
|
47dbfdda94 | |
|
af3f7a7f78 | |
|
ca50259d50 | |
|
df32ea4046 | |
|
4b6784d732 | |
|
8bfe7211b0 | |
|
da9f94c76b | |
|
5e7989aa0a | |
|
e2edc8bc57 | |
|
6025947cb6 | |
|
d6b8cdf175 | |
|
c660a46402 | |
|
74c40c7808 | |
|
1771846b43 | |
|
a4dc3ae8c8 | |
|
98239e0105 | |
|
0188bc7bc3 | |
|
e0c7e0519d | |
|
e85acaac66 | |
|
52edf79716 | |
|
a289c548f8 | |
|
e758df4a4c | |
|
b8b195b570 | |
|
72fba4992d | |
|
bb2ba2b599 | |
|
289d9b211e | |
|
a1db140d67 | |
|
1772c31047 | |
|
0e9f50f6c3 | |
|
28613c1e96 | |
|
630a578522 | |
|
52503c221d | |
|
4ccae7981c | |
|
11277795d8 | |
|
53fc5c4c80 | |
|
7b41728958 | |
|
d3104939ae | |
|
6bef98bd10 | |
|
91e06d5ef9 | |
|
c3f786214f | |
|
cdccabcb32 | |
|
b386041f8e | |
|
49236b3c0e | |
|
e03a18a62a | |
|
c47ca095c5 | |
|
ea872ec246 | |
|
e8877b900a | |
|
dafb0ada59 | |
|
11848a1cd7 | |
|
d56e20d057 | |
|
a2bb7c44f3 | |
|
927c40e356 | |
|
b3e724c684 | |
|
485d9203c2 | |
|
20cb9f91e8 | |
|
bb507973d4 | |
|
352b5942c8 | |
|
66d623b883 | |
|
e514c9cf73 | |
|
ee582b52b4 | |
|
4d49404105 | |
|
a766ba1633 | |
|
a7a592505b | |
|
a3c91d702d | |
|
79d29fc071 | |
|
ced34ccec3 | |
|
8955c3c1a6 | |
|
a8d0f4374e | |
|
5ce7c7f597 | |
|
ab62cd5627 | |
|
bbaca64cc9 | |
|
ec24b928a9 | |
|
8a81621076 | |
|
190e5a8b2d | |
|
aa0ac3fc26 | |
|
f7f3146e77 | |
|
29920a2939 | |
|
93401dfcdc | |
|
6bb758b88c | |
|
07e6cebf04 | |
|
22bedf2fc4 | |
|
3e2caa18d2 | |
|
9e6ab80e74 | |
|
6365fc7477 | |
|
039f075187 | |
|
be76de2fa2 | |
|
43181cb1f7 | |
|
306658c470 | |
|
b7f4e2d1b6 | |
|
88167d8c2d | |
|
e2c4954a11 | |
|
50019a298c | |
|
574ecba4d6 | |
|
3e111d144e | |
|
f2335d7bda | |
|
6f2d8d0a93 | |
|
10abc4ddae | |
|
e6f6577fc1 | |
|
7265ac6fc0 | |
|
873e31da43 | |
|
9227f935b0 | |
|
c93f0bdf11 | |
|
38df9c27ae | |
|
8b6c0c05d6 | |
|
2177cd3979 | |
|
1bfbdd2d0d | |
|
4dd180a983 | |
|
aa3c22a250 | |
|
985eac702f | |
|
1d3be4856b | |
|
b590574a8c | |
|
d99253ab79 | |
|
a5b4341c97 | |
|
533b41ad78 | |
|
8daf425adf | |
|
46c4bd02ea | |
|
05d4b08979 | |
|
accea946d1 | |
|
0c79f7f5d2 | |
|
75f6a31c8c | |
|
8cd8d90925 | |
|
a3804d5e10 | |
|
54b4791849 | |
|
a8dbcfbd74 | |
|
3d7cb05661 | |
|
f0b1c66c27 | |
|
fc80946817 | |
|
c6c18e82fa | |
|
63659a1a77 | |
|
fb0cc0272f | |
|
32be95e241 | |
|
5dd63006be | |
|
7c6112c896 | |
|
7f4a946011 | |
|
759f910e77 | |
|
3a68771bc1 | |
|
04e35f0d42 | |
|
fff129e913 | |
|
18828384ff | |
|
4492b9e70f | |
|
886213c95e | |
|
368063750f | |
|
7704c764e8 | |
|
0d7ae72c64 | |
|
b7c05d700b | |
|
872e9ade02 | |
|
3a8d15030f | |
|
4eee490a6c | |
|
2c2498d2b2 | |
|
04ef8e1886 | |
|
bf6bb954bb | |
|
bc42d892ed | |
|
11dc113213 | |
|
eb9512fafb | |
|
90a34d56f7 | |
|
7f64fbb368 | |
|
029c9157e7 | |
|
69e77b57ba | |
|
96a04d20b1 | |
|
caa8682180 | |
|
503e3e084c | |
|
2654f03446 | |
|
67e318f979 | |
|
4e1d7b9c4f | |
|
a050184f6e | |
|
940cb09dae | |
|
00f23bffd8 | |
|
012da1edfb | |
|
2355d7daa7 | |
|
2d22b8c28a | |
|
ce49daf591 | |
|
6d2268e433 | |
|
53acb513ca | |
|
c401bbb7fb | |
|
6f2790f6f8 | |
|
88e3bfa2b8 | |
|
47649d6186 | |
|
f821949740 | |
|
d38a07f881 | |
|
6c2502d2c5 | |
|
d46bffe860 | |
|
75914f1870 | |
|
3a2cf9ae77 | |
|
4cb163db63 | |
|
23d6c18ebd | |
|
cd76e91980 | |
|
e9389a00fd | |
|
969570d099 | |
|
5375e98c91 | |
|
8dba602771 | |
|
3d8c397094 | |
|
0a16b4cb52 | |
|
8f9f1281f2 | |
|
cbccf89b6f | |
|
5dc73614a3 | |
|
2e0b4a5322 | |
|
56db3ffc51 | |
|
da77015ae8 | |
|
872318a00c | |
|
1faa5b74df | |
|
480ab7552e | |
|
c72e8d9fed | |
|
8eb60e1700 | |
|
4d0b03a480 | |
|
211877fcc1 | |
|
5f9b768d2d | |
|
79e2a7ee25 | |
|
aad0e1f0ba | |
|
03c758dfa9 | |
|
a6a0c134da | |
|
de79da779f | |
|
8539e93389 | |
|
9ffafa7514 | |
|
65e48f6194 | |
|
614b953d63 | |
|
23e029b225 | |
|
a0dbb63346 | |
|
ae060b0cf4 | |
|
273cae5df8 | |
|
8eb875b5b8 | |
|
3fc076b006 | |
|
aee9be59aa | |
|
1f89233372 | |
|
cc2d1ed09d | |
|
5f12532983 | |
|
4950ca6822 | |
|
fa4802cd6d | |
|
ef2e3c5351 | |
|
224d554a37 | |
|
b221e56aae | |
|
96d1f76bf2 | |
|
cce9016e4e | |
|
701cb875d3 | |
|
7e993cab73 | |
|
7b34433898 | |
|
a0b7f0083d | |
|
c9ffaae3b3 | |
|
75e0b37798 | |
|
81548caca9 | |
|
90ff0636a5 | |
|
fe8873571d | |
|
decdcea2d8 | |
|
68210f817d | |
|
b403daff0e | |
|
5605654bb8 | |
|
61ee7ced54 | |
|
bd7672c1ca | |
|
9c306e4420 | |
|
2463684d38 | |
|
7b2240b01d | |
|
52e50ddc24 | |
|
fcf6957b74 | |
|
c04adf0e7d | |
|
06a07d4fd3 | |
|
4a2074dc9d | |
|
3a95e22f67 | |
|
54585691c3 | |
|
4bd9e69bf1 | |
|
c975943eb1 | |
|
115b60751a | |
|
012acb76b3 | |
|
722cb938ab | |
|
7cd6716308 | |
|
cc7251a336 | |
|
034f27432d | |
|
ce89d4a31b | |
|
f6c5891e0b | |
|
45f4a1cea8 | |
|
94f1b2d709 | |
|
f4e210734b | |
|
86184b905e | |
|
7534a61118 | |
|
69e57154cf | |
|
a56378242e | |
|
9274ce903c | |
|
c3f8e30852 | |
|
822597f22b | |
|
93ade9c4e0 | |
|
53b79ff6d6 | |
|
0b4ee0f416 | |
|
b629cd3c06 | |
|
d7f643d1a3 | |
|
5b3cbaed79 | |
|
3de59d6fb8 | |
|
5474129a18 | |
|
21e61a3213 | |
|
7117684ee0 | |
|
106633b847 | |
|
f1e83967d5 | |
|
af1b553483 | |
|
5d5c31a739 | |
|
33b37fad90 | |
|
6b67ac7762 | |
|
55c520100d | |
|
9a0cf2def8 | |
|
a4fb5d8774 | |
|
5ed5a24828 | |
|
49d4787790 | |
|
e9336fe20f | |
|
f29cd752ab | |
|
d8ff52411f | |
|
81ad9402ee | |
|
d4212e6e07 | |
|
b2a50e23bf | |
|
aae343fb25 | |
|
5e167876a9 | |
|
1c1d6a0ff6 | |
|
c0e03bd467 | |
|
73f02cf8bd | |
|
13baf95902 | |
|
ed0dd1823d | |
|
d7b763d3a3 | |
|
6d7199b2ff | |
|
2fcc7c94b8 | |
|
a3c3a60e98 | |
|
aa6c6f0e69 | |
|
a31d6cf819 | |
|
69fb218b21 | |
|
1a2d46ddcc | |
|
2a5eeac8d5 | |
|
93197b7bd2 | |
|
5f624bbf7f | |
|
cdf600cbd0 | |
|
257edbbd13 | |
|
b8b7af6907 | |
|
6fe67e847b | |
|
95a8c0c3d0 | |
|
6ae6b86dbf | |
|
66559a1c9e | |
|
0a40dd598e | |
|
8c499e3fc3 | |
|
cf851c3cb2 | |
|
18da0e9922 | |
|
1c4afcb7cc | |
|
73cd08ebc3 | |
|
cc21b74626 | |
|
5bcda5324e | |
|
1beab6810e | |
|
0e1f04323c | |
|
6b87d2f816 | |
|
585bb9973e | |
|
311eab363a | |
|
a287844860 | |
|
73dfce4104 | |
|
634d07ab46 | |
|
a7a97fd205 | |
|
b2f011e7cc | |
|
6568e2525c | |
|
b95d8f3b44 | |
|
248edf9d88 | |
|
4b78d9f9ec | |
|
bdc175aa9d | |
|
f5758d0fe9 | |
|
1507febd91 | |
|
062389626e | |
|
30b0630c88 | |
|
884ad672b1 | |
|
03ef6f01e5 | |
|
6ac24586d0 | |
|
af2cbda077 | |
|
b37923e194 | |
|
dc3c800342 | |
|
1948ee9c52 | |
|
c3fb92e26d | |
|
40569b1ede | |
|
ca6cfb4c5e | |
|
b3fd818b13 | |
|
ce17e124a0 | |
|
55719fbce7 | |
|
9dc22b39e2 | |
|
63af730838 | |
|
8101e014f5 | |
|
9a946c0f39 | |
|
e1605e0610 | |
|
c2facd5f99 | |
|
2aabef2e11 | |
|
bcb2d5f850 | |
|
705f3d7d62 | |
|
f8b41101d3 | |
|
d060e88ebb | |
|
b75578b6fb | |
|
8380808ffa | |
|
dd958fffd0 | |
|
b1f0cc7f1d | |
|
94849d0cdf | |
|
0692de7bfb | |
|
2d65811360 | |
|
f01e5b824e | |
|
e41ed4eff5 | |
|
bf160dc1b0 | |
|
d9897b3ea2 | |
|
de6020626f | |
|
05f6e1ec20 | |
|
0adb86d4f2 | |
|
b334807c5b | |
|
86b77c2022 | |
|
0901c57b12 | |
|
154a893580 | |
|
780e7839f4 | |
|
acb1ce39e0 | |
|
be894f52c1 | |
|
1f1fa1e2b6 | |
|
6dd3a7b00d | |
|
89df2e837c | |
|
c72d4e9f04 | |
|
2550add549 | |
|
314f656965 | |
|
14c7ec2e39 | |
|
eb9ab710c4 | |
|
1a420abfb2 | |
|
f6e53e478f | |
|
e77e96ffed | |
|
fc44424dda | |
|
4994a94369 | |
|
48e40cdc46 | |
|
220fb057e6 | |
|
5e17af2fae | |
|
d7b9a01c57 | |
|
f51e8b2e4d | |
|
ceef46eccc | |
|
504fee11a0 | |
|
1395c0da80 | |
|
95a2a21c80 | |
|
16805afc88 | |
|
e8a90faa62 | |
|
68d2b97ced | |
|
d673d30248 | |
|
2e3271b9a1 | |
|
0f59354933 | |
|
86b6a33af4 | |
|
5ec44279d4 | |
|
7e72ce2c94 | |
|
9b4645282c | |
|
9d49f136fe | |
|
f8d9ffeb13 | |
|
07eacdcebf | |
|
035979cb70 | |
|
117ce937fe | |
|
64a52e0183 | |
|
78781d0302 | |
|
dd4e12c174 | |
|
38b1cddb71 | |
|
38b94a8892 | |
|
063ac0cb7b | |
|
3dc792db7f | |
|
299fb4f186 | |
|
4546f19432 | |
|
828bb61f52 | |
|
63a8f0f3c7 | |
|
9767668798 | |
|
f991aa0aa8 | |
|
848d00a8b3 | |
|
4ff071c775 | |
|
85c4d79443 | |
|
f37294f229 | |
|
017f435da6 | |
|
93584c64cd | |
|
ae36d676f5 | |
|
72796d8d61 | |
|
5d7bfec177 | |
|
ded1dae481 | |
|
502f41993a | |
|
60d96c8030 | |
|
d047a9deea | |
|
12edc10272 | |
|
662d679ad1 | |
|
a4eed47df6 | |
|
cd69cf5b54 | |
|
b07ff84f19 | |
|
dc8aa396fa | |
|
c1903a8e55 | |
|
02fc8fce52 | |
|
b532047516 | |
|
4ad2f936e8 | |
|
62682237e4 | |
|
a06cfa12a4 | |
|
85140999ab | |
|
0e4c4a33de | |
|
9d5fd916a2 | |
|
852e51c06f | |
|
b8f2df59cd | |
|
841195eca0 | |
|
698edfbe72 | |
|
97dfeca20d | |
|
b1d6f9dd9c | |
|
5cb2b326f1 | |
|
d8bc37b627 | |
|
4f4071f13b | |
|
aa53feea39 | |
|
fdb6e6c105 | |
|
63133f6a18 | |
|
fac0e21ffd | |
|
6eae05b7d0 | |
|
41c8760707 | |
|
1ee6469ef7 | |
|
b5b52dcda0 | |
|
7ece059610 | |
|
fcdc69d7c8 | |
|
a338dbed70 | |
|
3aa5bdac92 | |
|
c6cf2ed144 | |
|
c8943e43fd | |
|
b0b04ad017 | |
|
0d2aada01f | |
|
4848a89ca2 | |
|
7c47d19a9a | |
|
e597552dc3 | |
|
018327a9ec | |
|
896626a1fd | |
|
b45e529879 | |
|
e121cc5d5c | |
|
962a49868e | |
|
4b09c18930 | |
|
2eb38382f4 | |
|
5078559668 | |
|
82cc153c98 | |
|
93ece4bf07 | |
|
4b66a8dea5 | |
|
0b7f2895a7 | |
|
2f6adfc515 | |
|
7364f055b7 | |
|
1f38a34269 | |
|
f7ce244bf2 | |
|
ad5d824d8c | |
|
3946e78dbf | |
|
e8788cf2d0 | |
|
5e2158daf4 | |
|
808dfe7122 | |
|
629b89fe2f | |
|
abce9c66ee | |
|
090814cd29 | |
|
f132912da7 | |
|
f88fb130c6 | |
|
dbea92cb53 | |
|
607e33e45a | |
|
23ae5d7b4c | |
|
dc8612fc73 | |
|
526c79566f | |
|
0ecdaf89e7 | |
|
e8325edefe | |
|
96ca2829d7 | |
|
134d718c6e | |
|
8d923a8b75 | |
|
de454313cf | |
|
c65f1524c6 | |
|
74c0c64d50 | |
|
bdb35e24ee | |
|
7b7a8085e7 | |
|
419353e18b | |
|
2f53406e8d | |
|
727b8dcbcc | |
|
568f523e36 | |
|
2c0370d3db | |
|
de6b1a8d5d | |
|
5c5a6069ce | |
|
6388d4e0f4 | |
|
1971534876 | |
|
6fe44481b6 | |
|
c254c89bd8 | |
|
0bdd2a8113 | |
|
b7e3401d06 | |
|
c11993c413 | |
|
42ba6969ad | |
|
eabe29ed5c | |
|
ca01ceacde | |
|
4ad8bfc210 | |
|
edbdf221ff | |
|
30f13b65f0 | |
|
b8761d3e4c | |
|
e71278d7c8 | |
|
d0ba2f41e1 | |
|
6b9f9188a2 | |
|
1da88fd70c | |
|
b258c4eaac | |
|
2e8caf6e8f | |
|
258ff52e3c | |
|
39ba6e9175 | |
|
13f09f13d2 | |
|
7abe89775f | |
|
86d5ae781a | |
|
7d9f59e147 | |
|
5147967bc0 | |
|
b278dec6c9 | |
|
e3706094c2 | |
|
010e76a3b8 | |
|
5a82c48046 | |
|
31cedc8a7e | |
|
778d8fbb67 | |
|
49d7b6bc44 | |
|
859071ca4d | |
|
6f839df311 | |
|
c9679ac835 | |
|
97b93b5e38 | |
|
0264e85aa7 | |
|
38fea35f4f | |
|
5d71a16ec7 | |
|
035a42a895 | |
|
e28e5217bd | |
|
eb8792f0b7 | |
|
1ea6af8eb9 | |
|
040673f500 | |
|
db6783e9d4 | |
|
32dbdbddbb | |
|
9955dc73d7 | |
|
3a14c76ad0 | |
|
1ca6fd15b5 | |
|
35f90f5ea1 | |
|
97df1d8fd2 | |
|
f18da15262 | |
|
c2042276ae | |
|
d8073e78ab | |
|
66665ba5dd | |
|
caf76e4071 | |
|
940bc7f1ff | |
|
c83854c4c6 | |
|
8f0f993a64 | |
|
900b76a4db | |
|
359e67c734 | |
|
930da78f6c | |
|
34d44cfa3e | |
|
290a7273d0 | |
|
c47bdd6b9d | |
|
8d0d19d4c7 | |
|
5b692612ae | |
|
6a7fcd1afe | |
|
60430e4005 | |
|
3ad58311e2 | |
|
0a2b481667 | |
|
41bd5a424a | |
|
42b86f05ce | |
|
7811e44d8b | |
|
8dd2659d9f | |
|
e9d4d79da0 | |
|
3e61b93ba3 | |
|
8720371827 | |
|
a5e9b2f455 | |
|
4d23c9f24b | |
|
0724e768ee | |
|
84651c8a17 | |
|
9f3a7aa452 | |
|
45a77a86f1 | |
|
ddf8238914 | |
|
502b55a8ce | |
|
d9602307c9 | |
|
194e7a3eb4 | |
|
fb902b54bc | |
|
c8754ae4df | |
|
cc07cc7824 | |
|
2e793164ec | |
|
107b8a7692 | |
|
0b084ae371 | |
|
055a0b8751 | |
|
8e761f711d | |
|
65a8a78622 | |
|
c067006d08 | |
|
af940c67c6 | |
|
89cdd466b1 | |
|
311a40deef | |
|
58ec845402 | |
|
169389b5b8 | |
|
78da5f5393 | |
|
d5373ecbd6 | |
|
f26290a952 | |
|
ca7ae30991 | |
|
d4a93484c4 | |
|
399f2fd8fe | |
|
b083dada83 | |
|
19fd0ee71b | |
|
ba68907f42 | |
|
6033ff4790 | |
|
ffcf52a490 | |
|
ff625f683a | |
|
321c6b46a7 | |
|
1d435d1816 | |
|
87eeacfcfb | |
|
b4c56d0dbb | |
|
ab55703550 | |
|
8cfc0770e1 | |
|
7db0950535 | |
|
1082d62a7f | |
|
c95708d359 | |
|
eacb240d56 | |
|
56d1c0ca30 | |
|
a85cc20603 | |
|
712d23b632 | |
|
7ebb27a217 | |
|
cfde6e508f | |
|
ff08b44b3f | |
|
b7cc5fdce2 | |
|
96f0c470f9 | |
|
c144da665e | |
|
e86c8f6263 | |
|
9c861f7544 | |
|
262ab78305 | |
|
223e14a850 | |
|
dca1500991 | |
|
bcfe5556f7 | |
|
c97b5bffd2 | |
|
d2161b41e8 | |
|
b43ab0f9c2 | |
|
31d829ac05 | |
|
07ad4b1655 | |
|
2d85ce32f9 | |
|
eabb71834f | |
|
ceb0c1fc75 | |
|
03bef91066 | |
|
2ee2002876 | |
|
a3beba5906 | |
|
973209abed | |
|
1e2c86c74f | |
|
5e89b773ff | |
|
ed73a1459b | |
|
4d4598adf8 | |
|
b55ddf4cec | |
|
264881274d | |
|
a28b2183ad | |
|
4050c2d3d0 | |
|
6ff774f1b0 | |
|
0a88479a9e | |
|
d3cc62d910 | |
|
ba49d03647 | |
|
3bf10aa32a | |
|
ce19a98751 | |
|
04fe560a7b | |
|
9803d65415 | |
|
539a452137 | |
|
d635be0e97 | |
|
89b0791da3 | |
|
f5b56ff5d4 | |
|
144d1fe620 | |
|
9b5c8303bd | |
|
9b80f4023e | |
|
b1e6dd0ee3 | |
|
a2dd8a7d87 | |
|
ed9f21170e | |
|
38b8a13225 | |
|
413891ce10 | |
|
bded06082a | |
|
53aff479e6 | |
|
a167c983d7 | |
|
cc193ce160 | |
|
533f8cfa93 | |
|
1d80d75e6a | |
|
c083eba66c | |
|
abe894c8bd | |
|
2e0575052c | |
|
d0a0d19be2 | |
|
a46e5b07f9 | |
|
9e6b174ae6 | |
|
23aa972a85 | |
|
804fb28e11 | |
|
0a6c38f959 | |
|
1f35adeb30 | |
|
964671963e | |
|
813f5e9331 | |
|
f86b213a12 | |
|
68015056ab | |
|
08f73acc3e | |
|
f7c93c8416 | |
|
a337bdf474 | |
|
ae4731c7e6 | |
|
755fd3a076 | |
|
231f67df5c | |
|
faacff875a | |
|
805e56b9d3 | |
|
822058b491 | |
|
e413acf85d | |
|
84c92b8a98 | |
|
ece705b0ae | |
|
f33c4d42bf | |
|
36a67e4c73 | |
|
100a380f95 | |
|
dea3535ad4 | |
|
0a4da26d3d | |
|
fa83c2d49c | |
|
c88be1c6a8 | |
|
ebca833d73 | |
|
db777bec72 | |
|
3d18d2d652 | |
|
d9237c4a38 | |
|
85a0e328e3 | |
|
21ea6a278d | |
|
266c3d26ad | |
|
1069960d98 | |
|
5e5f1fe88b | |
|
cc0c73a91a | |
|
a06696df01 | |
|
fceb5dd5fd | |
|
aa1aaa98ff | |
|
51c1e8a2e1 | |
|
9baa32f6d2 | |
|
282ca08605 | |
|
559bf0db02 | |
|
74eb296285 | |
|
cd82a208cc | |
|
5ec1d7d311 | |
|
d4d4bed74b | |
|
eaaeb028e3 | |
|
71967591d3 | |
|
012b401414 | |
|
d86548f70e | |
|
d40b6fb06b | |
|
2e4610847d | |
|
55ab885ef9 | |
|
864e187a4e | |
|
686bacd38a | |
|
5161aaf53d | |
|
9f815937a5 | |
|
01dd584028 | |
|
834f686475 | |
|
6601e2e0ae | |
|
d45bf43f6e | |
|
a53f41a0b7 | |
|
3a2fca110c | |
|
39180c1b3a | |
|
37d8cc1b49 | |
|
4836b14e3e | |
|
adc9d1630b | |
|
8599974437 | |
|
3b4af9c749 | |
|
0c59ca8e49 | |
|
60e9346333 | |
|
f97bd98c00 | |
|
d4fecd8d85 | |
|
1ba24b46db | |
|
14ac4f7de6 | |
|
c6a20d80d6 | |
|
8ff78a0a76 | |
|
83064c3813 | |
|
f1b1163611 | |
|
1cf9a46286 | |
|
45caf8ac2f | |
|
29401f4d67 | |
|
2a5942a9a9 | |
|
365597e5cf | |
|
38d1beff5b | |
|
d1a9e13a4b | |
|
24eaaacb19 | |
|
05a310d9af | |
|
907cb87c34 | |
|
2f3b0c59ad | |
|
0338e0ea45 | |
|
89947f96cd | |
|
442f74fce0 | |
|
518dc56eb2 | |
|
5b5dba868a | |
|
b7061de689 | |
|
656b736119 | |
|
8aaab2c25c | |
|
5c295ebd33 | |
|
af56321377 | |
|
57e53e43c6 | |
|
1f622317e7 | |
|
9d90d041ee | |
|
6c3a271ee2 | |
|
58d2c21e5b | |
|
ee00f7f5b5 | |
|
011344b761 | |
|
9ba7fec42f | |
|
4826b681ce | |
|
bf85a0f1c7 | |
|
ae137e8244 | |
|
13490719c4 | |
|
29e8bb6344 | |
|
390dd05a06 | |
|
21f0c80bc9 | |
|
c1108945ff | |
|
e98cc7a92a | |
|
285ba4ef7b | |
|
3ad63ed354 | |
|
b94df214ff | |
|
ccb558f4e9 | |
|
94d2fbb5ca | |
|
628ed69bdb | |
|
3a8808452d | |
|
74f151800d | |
|
105f149503 | |
|
67b29c5d24 | |
|
caa50a16ce | |
|
9084d918c0 | |
|
a46d3affde | |
|
9e06a48841 | |
|
b7f2a320c7 | |
|
ad8618a51b | |
|
622c875dc5 | |
|
39f0873fb8 | |
|
d23eb052f4 | |
|
2462b5f38e | |
|
c725dd446d | |
|
fe4a681894 | |
|
4fe6b7584d | |
|
fd68e997c5 | |
|
c379491df0 | |
|
a4e415f0ab | |
|
42c2401c24 | |
|
8c77f6fe40 | |
|
74dd49ffe0 | |
|
52e1cfc828 | |
|
9ebb7b85b2 | |
|
69a32231e2 | |
|
7f8c8b07c4 | |
|
618d358256 | |
|
d573389871 | |
|
43fc2e2312 | |
|
793084eb74 | |
|
f4b1e18582 | |
|
336a5ccafc | |
|
42f113ccf6 | |
|
e5940ff785 | |
|
3c5b8d4fbf | |
|
072deeea5e | |
|
b8856194c4 | |
|
94c9e1e84a | |
|
4618ba87fa | |
|
12715adbdb | |
|
710532bc4e | |
|
dd90af9b6c | |
|
6f5aed2cbe | |
|
f1f2b94747 | |
|
2bfc6606f0 | |
|
4cc895b69c | |
|
6f31eeeeec | |
|
0d146cb3bc | |
|
9528f4572b | |
|
5027b9a174 | |
|
b61badc723 | |
|
be946a4f8b | |
|
062c306cf4 | |
|
3807e74fe4 | |
|
1e3aa0c8c0 | |
|
20ef8a5a12 | |
|
66555806f2 | |
|
2851291a27 | |
|
458e48d4c6 | |
|
d63941adca | |
|
d4f559f2c7 | |
|
9b037e77ff | |
|
f2ac15829d | |
|
742fa231f1 | |
|
88c2640ddc | |
|
9afa5df0c7 | |
|
e9a9c4bcef | |
|
9d1c375d59 | |
|
f96dc2c696 | |
|
286ef502c7 | |
|
d703144dd5 | |
|
18219eea3a | |
|
e6c48ce468 | |
|
6573b04dab | |
|
ebcb356230 | |
|
cc464c631e | |
|
35201cb2d3 | |
|
b590c91892 | |
|
386f2e3126 | |
|
06b61a52f6 | |
|
79d6f133a1 | |
|
51b3283ff7 | |
|
fc247ae413 | |
|
efcf3be585 | |
|
5b9f9d38a2 | |
|
96e7bf78c5 | |
|
96e9d1a00a | |
|
617af7b7cb | |
|
a44ea9384a | |
|
dcd681b656 | |
|
02a1554b21 | |
|
72ce3615d0 | |
|
7962dbc26a | |
|
1c86c874e0 | |
|
4ecc8c213e | |
|
3477b24c93 | |
|
c2e4380f18 | |
|
71e469542a | |
|
f20660839a | |
|
8af09d46ed | |
|
00b7883aed | |
|
0f48b6fa4d | |
|
94c8f538ea | |
|
fec9ef25bf | |
|
84f22cfeb8 | |
|
b67489aae8 | |
|
565ec15589 | |
|
11e570360d | |
|
e10ee60f62 | |
|
9c6c379977 | |
|
9aeaac7648 | |
|
e18d129b32 | |
|
54ace8c682 | |
|
6b06ccd3ff | |
|
f558c4db87 | |
|
f40e5f6cdf | |
|
358c624511 | |
|
c3fa4839c0 | |
|
ca2e0cb277 | |
|
6dd0b32389 | |
|
f6051ae15c | |
|
70decb68ea | |
|
b52b98f3d7 | |
|
8985d04d62 | |
|
e4b709013e | |
|
f7bc5f5aff | |
|
779bc29a9f | |
|
99d0b0cb98 | |
|
154fc7d79e | |
|
3013da930d | |
|
0f08e151bc | |
|
efcb70e741 | |
|
422d3428c5 | |
|
764849ffd8 | |
|
a9fdd8cafd | |
|
d41a6e9142 | |
|
6c5ae8d7e6 | |
|
43f0b72ff8 | |
|
91538acfaf | |
|
8781905cab | |
|
064ce8042b | |
|
04962de8e2 | |
|
7b4d3d45ba | |
|
421ac4b9ac | |
|
da61df0a2a | |
|
81cbeff449 | |
|
7a1a51711e | |
|
a42222c5e6 | |
|
a36c52f31a | |
|
fdf6fd2bba | |
|
fea760d2f9 | |
|
38967931b9 | |
|
d7f37eff32 | |
|
7da3f132ea | |
|
aa682d0ca5 | |
|
316ca6f97e | |
|
fdc60b6322 | |
|
5e1d4ea529 | |
|
d0eb1d97ac | |
|
53b522c488 | |
|
1c7bcc8902 | |
|
01cc2d4e75 | |
|
71236c0a01 | |
|
9379e80df7 | |
|
8c6e399fd2 | |
|
26eae51585 | |
|
2c81ddb4aa | |
|
b5db786b06 | |
|
0a3703532e | |
|
8be1a42c53 | |
|
fb20a89e59 | |
|
d16786d3e1 | |
|
ff918b8a1c | |
|
9ec1c5ff4b | |
|
373ca0b3f1 | |
|
5e89bbe19e | |
|
d6bb39236d | |
|
b0a439c26c | |
|
78c5836431 | |
|
437d70d415 | |
|
a53f4bd957 | |
|
3979a328e9 | |
|
28213bcce6 | |
|
7c8ddf9c2b | |
|
c45ff7009c | |
|
a6cd75a210 | |
|
189784872f | |
|
8714be1fa7 | |
|
87928ea7b6 | |
|
f52ba11f42 | |
|
9c8094a3d8 | |
|
32fe76aaab | |
|
c3d97231d2 | |
|
e76daac3be | |
|
3ff0d2139a | |
|
bb92d75e00 | |
|
1367c372e3 | |
|
86cfbace72 | |
|
185160aeba | |
|
cd5a64fcc6 | |
|
20e439f31e | |
|
6ef53e790a | |
|
7b047e1637 | |
|
679710eb4d | |
|
bb58f72e3f | |
|
1641ad396c | |
|
f816cb9240 | |
|
4226c52fc5 | |
|
8d9bfd8f1d | |
|
b370fe673b | |
|
fd4ff94f4c | |
|
5b1819f7da | |
|
79548f5041 | |
|
d3b93b710d | |
|
577c21e601 | |
|
36d166ab44 | |
|
1eedb6f79b | |
|
ceae5eaa9e | |
|
f0333dfd01 | |
|
372e797059 | |
|
b03578eb65 | |
|
1c15a02a5f | |
|
bb6a8c0052 | |
|
58597bdddf | |
|
1ca7420207 | |
|
fffd662cee | |
|
e07e62abb4 | |
|
df911e0210 | |
|
ad64ee4755 | |
|
3e39ab7fc2 | |
|
e6b360ee4b | |
|
99ea8e843c | |
|
ebdc1e9906 | |
|
0eab0a9a98 | |
|
881e059121 | |
|
0984d05220 | |
|
61519595a9 | |
|
c03875838f | |
|
6323f165a0 | |
|
1907301852 | |
|
2c59e6acc3 | |
|
1929545e5b | |
|
0988936884 | |
|
1d4549439c | |
|
b7bfb4b056 | |
|
56a6f24071 | |
|
1ccad36020 | |
|
df29ad31fd | |
|
7108444a44 | |
|
5425902918 | |
|
4049fa5c4a | |
|
46aefa67d1 | |
|
cc241c6a4e | |
|
5779d37bbd | |
|
91c5d7092d | |
|
a5350f686d | |
|
cf0454669a | |
|
6804196dbb | |
|
6c2c3b8f60 | |
|
f6eaa99aeb | |
|
2951e69a6a | |
|
85fa394be0 | |
|
5a497289da | |
|
75e02bf328 | |
|
370e52f7c4 | |
|
6b4dea6bf9 | |
|
648a98d49d | |
|
207097fa98 | |
|
f56934fcc4 | |
|
48f88b5871 | |
|
130c98ef17 | |
|
c16cc78ce6 | |
|
0c88efc291 | |
|
967fb4592b | |
|
697c467006 | |
|
737ab9e99b | |
|
30a32ad17d | |
|
3a024e81b5 | |
|
fe12968dd6 | |
|
81436a1641 | |
|
d65caaad07 | |
|
48aa8dad79 | |
|
1e09e9e4bb | |
|
6b564bb648 | |
|
41cf7d242b | |
|
174d159d04 | |
|
6e701bd455 | |
|
527c845356 | |
|
c51feab746 | |
|
b3cbc64efb | |
|
92555f8ddb | |
|
674b8bb1dc | |
|
e264a13234 | |
|
5326d9db88 | |
|
79e2bddeea | |
|
2436db1c28 | |
|
bffc496965 | |
|
322c195175 | |
|
80b881edb5 | |
|
d10c04d4f2 | |
|
0dd89ec3f0 | |
|
51b8667938 | |
|
7254f91645 | |
|
59e260d448 | |
|
3a7e092efe | |
|
67eb21b707 | |
|
f44643fc61 | |
|
1c51faaff4 | |
|
f6f84e191b | |
|
d78c20d14b | |
|
c95b738e0c |
|
@ -0,0 +1 @@
|
||||||
|
node_modules
|
3095
CHANGELOG.md
3095
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env groovy
|
#!/usr/bin/env groovy
|
||||||
|
|
||||||
def PROTECTED_BRANCH
|
def PROTECTED_BRANCH
|
||||||
|
def IS_LATEST
|
||||||
|
|
||||||
def BRANCH_ENV = [
|
def BRANCH_ENV = [
|
||||||
test: 'test',
|
test: 'test',
|
||||||
|
@ -10,16 +11,18 @@ def BRANCH_ENV = [
|
||||||
|
|
||||||
node {
|
node {
|
||||||
stage('Setup') {
|
stage('Setup') {
|
||||||
env.FRONT_REPLICAS = 1
|
|
||||||
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
||||||
|
|
||||||
PROTECTED_BRANCH = [
|
PROTECTED_BRANCH = [
|
||||||
'dev',
|
'dev',
|
||||||
'test',
|
'test',
|
||||||
'master',
|
'master',
|
||||||
|
'main',
|
||||||
'beta'
|
'beta'
|
||||||
].contains(env.BRANCH_NAME)
|
].contains(env.BRANCH_NAME)
|
||||||
|
|
||||||
|
IS_LATEST = ['master', 'main'].contains(env.BRANCH_NAME)
|
||||||
|
|
||||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||||
|
@ -58,6 +61,19 @@ pipeline {
|
||||||
PROJECT_NAME = 'lilium'
|
PROJECT_NAME = 'lilium'
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
|
stage('Version') {
|
||||||
|
when {
|
||||||
|
expression { PROTECTED_BRANCH }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def packageJson = readJSON file: 'package.json'
|
||||||
|
def version = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
|
writeFile(file: 'VERSION.txt', text: version)
|
||||||
|
echo "VERSION: ${version}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Install') {
|
stage('Install') {
|
||||||
environment {
|
environment {
|
||||||
NODE_ENV = ""
|
NODE_ENV = ""
|
||||||
|
@ -71,17 +87,48 @@ pipeline {
|
||||||
expression { !PROTECTED_BRANCH }
|
expression { !PROTECTED_BRANCH }
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
NODE_ENV = ""
|
NODE_ENV = ''
|
||||||
|
CI = 'true'
|
||||||
|
TZ = 'Europe/Madrid'
|
||||||
}
|
}
|
||||||
steps {
|
parallel {
|
||||||
sh 'pnpm run test:unit:ci'
|
stage('Unit') {
|
||||||
}
|
steps {
|
||||||
post {
|
sh 'pnpm run test:unit:ci'
|
||||||
always {
|
}
|
||||||
junit(
|
post {
|
||||||
testResults: 'junitresults.xml',
|
always {
|
||||||
allowEmptyResults: true
|
junit(
|
||||||
)
|
testResults: 'junit/vitest.xml',
|
||||||
|
allowEmptyResults: true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('E2E') {
|
||||||
|
environment {
|
||||||
|
CREDENTIALS = credentials('docker-registry')
|
||||||
|
COMPOSE_PROJECT = "${PROJECT_NAME}-${env.BUILD_ID}"
|
||||||
|
COMPOSE_PARAMS = "-p ${env.COMPOSE_PROJECT} -f test/cypress/docker-compose.yml --project-directory ."
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def image = docker.build('lilium-dev', '-f docs/Dockerfile.dev docs')
|
||||||
|
sh "docker-compose ${env.COMPOSE_PARAMS} up -d"
|
||||||
|
image.inside("--network ${env.COMPOSE_PROJECT}_default -e CI -e TZ") {
|
||||||
|
sh 'cypress run --browser chromium'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
sh "docker-compose ${env.COMPOSE_PARAMS} down"
|
||||||
|
junit(
|
||||||
|
testResults: 'junit/e2e.xml',
|
||||||
|
allowEmptyResults: true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,25 +138,30 @@ pipeline {
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
CREDENTIALS = credentials('docker-registry')
|
CREDENTIALS = credentials('docker-registry')
|
||||||
|
VERSION = readFile 'VERSION.txt'
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
sh 'quasar build'
|
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
sh 'quasar build'
|
||||||
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
|
||||||
|
def baseImage = "salix-frontend:${env.VERSION}"
|
||||||
|
def image = docker.build(baseImage, ".")
|
||||||
|
docker.withRegistry("https://${env.REGISTRY}", 'docker-registry') {
|
||||||
|
image.push()
|
||||||
|
image.push(env.BRANCH_NAME)
|
||||||
|
if (IS_LATEST) image.push('latest')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dockerBuild()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
when {
|
when {
|
||||||
expression { PROTECTED_BRANCH }
|
expression { PROTECTED_BRANCH }
|
||||||
}
|
}
|
||||||
|
environment {
|
||||||
|
VERSION = readFile 'VERSION.txt'
|
||||||
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
|
||||||
def packageJson = readJSON file: 'package.json'
|
|
||||||
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
|
||||||
}
|
|
||||||
withKubeConfig([
|
withKubeConfig([
|
||||||
serverUrl: "$KUBERNETES_API",
|
serverUrl: "$KUBERNETES_API",
|
||||||
credentialsId: 'kubernetes',
|
credentialsId: 'kubernetes',
|
||||||
|
|
|
@ -3,10 +3,39 @@ import { defineConfig } from 'cypress';
|
||||||
// https://docs.cypress.io/app/references/configuration
|
// https://docs.cypress.io/app/references/configuration
|
||||||
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
// https://www.npmjs.com/package/cypress-mochawesome-reporter
|
||||||
|
|
||||||
|
let urlHost,
|
||||||
|
reporter,
|
||||||
|
reporterOptions;
|
||||||
|
|
||||||
|
if (process.env.CI) {
|
||||||
|
urlHost = 'front';
|
||||||
|
reporter = 'junit';
|
||||||
|
reporterOptions = {
|
||||||
|
mochaFile: 'junit/e2e.xml',
|
||||||
|
toConsole: false,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
urlHost = 'localhost';
|
||||||
|
reporter = 'cypress-mochawesome-reporter';
|
||||||
|
reporterOptions = {
|
||||||
|
charts: true,
|
||||||
|
reportPageTitle: 'Cypress Inline Reporter',
|
||||||
|
reportFilename: '[status]_[datetime]-report',
|
||||||
|
embeddedScreenshots: true,
|
||||||
|
reportDir: 'test/cypress/reports',
|
||||||
|
inlineAssets: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: 'http://localhost:9000/',
|
baseUrl: `http://${urlHost}:9000`,
|
||||||
experimentalStudio: true,
|
experimentalStudio: false, // Desactivado para evitar tiempos de espera innecesarios
|
||||||
|
defaultCommandTimeout: 10000,
|
||||||
|
trashAssetsBeforeRuns: false,
|
||||||
|
requestTimeout: 10000,
|
||||||
|
responseTimeout: 30000,
|
||||||
|
pageLoadTimeout: 60000,
|
||||||
fixturesFolder: 'test/cypress/fixtures',
|
fixturesFolder: 'test/cypress/fixtures',
|
||||||
screenshotsFolder: 'test/cypress/screenshots',
|
screenshotsFolder: 'test/cypress/screenshots',
|
||||||
supportFile: 'test/cypress/support/index.js',
|
supportFile: 'test/cypress/support/index.js',
|
||||||
|
@ -16,27 +45,33 @@ export default defineConfig({
|
||||||
specPattern: 'test/cypress/integration/**/*.spec.js',
|
specPattern: 'test/cypress/integration/**/*.spec.js',
|
||||||
experimentalRunAllSpecs: true,
|
experimentalRunAllSpecs: true,
|
||||||
watchForFileChanges: true,
|
watchForFileChanges: true,
|
||||||
reporter: 'cypress-mochawesome-reporter',
|
reporter,
|
||||||
reporterOptions: {
|
reporterOptions,
|
||||||
charts: true,
|
|
||||||
reportPageTitle: 'Cypress Inline Reporter',
|
|
||||||
reportFilename: '[status]_[datetime]-report',
|
|
||||||
embeddedScreenshots: true,
|
|
||||||
reportDir: 'test/cypress/reports',
|
|
||||||
inlineAssets: true,
|
|
||||||
},
|
|
||||||
component: {
|
component: {
|
||||||
componentFolder: 'src',
|
componentFolder: 'src',
|
||||||
testFiles: '**/*.spec.js',
|
testFiles: '**/*.spec.js',
|
||||||
supportFile: 'test/cypress/support/unit.js',
|
supportFile: 'test/cypress/support/unit.js',
|
||||||
},
|
},/*
|
||||||
setupNodeEvents: async (on, config) => {
|
setupNodeEvents: async (on, config) => {
|
||||||
const plugin = await import('cypress-mochawesome-reporter/plugin');
|
const plugin = await import('cypress-mochawesome-reporter/plugin');
|
||||||
plugin.default(on);
|
plugin.default(on);
|
||||||
|
const fs = await import('fs');
|
||||||
|
on('task', {
|
||||||
|
deleteFile(filePath) {
|
||||||
|
if (fs.existsSync(filePath)) {
|
||||||
|
fs.unlinkSync(filePath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},*/
|
||||||
viewportWidth: 1280,
|
viewportWidth: 1280,
|
||||||
viewportHeight: 720,
|
viewportHeight: 720,
|
||||||
},
|
},
|
||||||
|
experimentalMemoryManagement: true,
|
||||||
|
defaultCommandTimeout: 10000,
|
||||||
|
numTestsKeptInMemory: 2,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
version: '3.7'
|
|
||||||
services:
|
|
||||||
main:
|
|
||||||
image: registry.verdnatura.es/salix-frontend:${VERSION:?}
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ./Dockerfile
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
FROM debian:12.9-slim
|
||||||
|
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
gnupg2 \
|
||||||
|
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
||||||
|
&& apt-get install -y --no-install-recommends nodejs \
|
||||||
|
&& npm install -g corepack@0.31.0 \
|
||||||
|
&& corepack enable pnpm \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get -y --no-install-recommends install \
|
||||||
|
apt-utils \
|
||||||
|
chromium \
|
||||||
|
libasound2 \
|
||||||
|
libgbm-dev \
|
||||||
|
libgtk-3-0 \
|
||||||
|
libgtk2.0-0 \
|
||||||
|
libnotify-dev \
|
||||||
|
libnss3 \
|
||||||
|
libxss1 \
|
||||||
|
libxtst6 \
|
||||||
|
xauth \
|
||||||
|
xvfb \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN groupadd -r -g 1000 app \
|
||||||
|
&& useradd -r -u 1000 -g app -m -d /home/app app
|
||||||
|
USER app
|
||||||
|
|
||||||
|
ENV SHELL=bash
|
||||||
|
ENV PNPM_HOME="/home/app/.local/share/pnpm"
|
||||||
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
|
||||||
|
RUN pnpm setup \
|
||||||
|
&& pnpm install --global cypress@13.6.6 \
|
||||||
|
&& cypress install
|
||||||
|
|
||||||
|
WORKDIR /app
|
144
package.json
144
package.json
|
@ -1,74 +1,74 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "25.06.0",
|
"version": "25.10.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@8.15.1",
|
"packageManager": "pnpm@8.15.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"resetDatabase": "cd ../salix && gulp docker",
|
"resetDatabase": "cd ../salix && gulp docker",
|
||||||
"lint": "eslint --ext .js,.vue ./",
|
"lint": "eslint --ext .js,.vue ./",
|
||||||
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
|
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
|
||||||
"test:e2e": "cypress open",
|
"test:e2e": "cypress open",
|
||||||
"test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run",
|
"test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run",
|
||||||
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
||||||
"test:unit": "vitest",
|
"test:unit": "vitest",
|
||||||
"test:unit:ci": "vitest run",
|
"test:unit:ci": "vitest run",
|
||||||
"commitlint": "commitlint --edit",
|
"commitlint": "commitlint --edit",
|
||||||
"prepare": "npx husky install",
|
"prepare": "npx husky install",
|
||||||
"addReferenceTag": "node .husky/addReferenceTag.js",
|
"addReferenceTag": "node .husky/addReferenceTag.js",
|
||||||
"docs:dev": "vitepress dev docs",
|
"docs:dev": "vitepress dev docs",
|
||||||
"docs:build": "vitepress build docs",
|
"docs:build": "vitepress build docs",
|
||||||
"docs:preview": "vitepress preview docs"
|
"docs:preview": "vitepress preview docs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@quasar/cli": "^2.4.1",
|
"@quasar/cli": "^2.4.1",
|
||||||
"@quasar/extras": "^1.16.16",
|
"@quasar/extras": "^1.16.16",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"chromium": "^3.0.3",
|
"chromium": "^3.0.3",
|
||||||
"croppie": "^2.6.5",
|
"croppie": "^2.6.5",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"pinia": "^2.1.3",
|
"pinia": "^2.1.3",
|
||||||
"quasar": "^2.17.7",
|
"quasar": "^2.17.7",
|
||||||
"validator": "^13.9.0",
|
"validator": "^13.9.0",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
"vue-i18n": "^9.3.0",
|
"vue-i18n": "^9.3.0",
|
||||||
"vue-router": "^4.2.5"
|
"vue-router": "^4.2.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^19.2.1",
|
"@commitlint/cli": "^19.2.1",
|
||||||
"@commitlint/config-conventional": "^19.1.0",
|
"@commitlint/config-conventional": "^19.1.0",
|
||||||
"@intlify/unplugin-vue-i18n": "^0.8.2",
|
"@intlify/unplugin-vue-i18n": "^0.8.2",
|
||||||
"@pinia/testing": "^0.1.2",
|
"@pinia/testing": "^0.1.2",
|
||||||
"@quasar/app-vite": "^2.0.8",
|
"@quasar/app-vite": "^2.0.8",
|
||||||
"@quasar/quasar-app-extension-qcalendar": "^4.0.2",
|
"@quasar/quasar-app-extension-qcalendar": "^4.0.2",
|
||||||
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
||||||
"@vue/test-utils": "^2.4.4",
|
"@vue/test-utils": "^2.4.4",
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
"cypress": "^13.6.6",
|
"cypress": "^13.6.6",
|
||||||
"cypress-mochawesome-reporter": "^3.8.2",
|
"cypress-mochawesome-reporter": "^3.8.2",
|
||||||
"eslint": "^9.18.0",
|
"eslint": "^9.18.0",
|
||||||
"eslint-config-prettier": "^10.0.1",
|
"eslint-config-prettier": "^10.0.1",
|
||||||
"eslint-plugin-cypress": "^4.1.0",
|
"eslint-plugin-cypress": "^4.1.0",
|
||||||
"eslint-plugin-vue": "^9.32.0",
|
"eslint-plugin-vue": "^9.32.0",
|
||||||
"husky": "^8.0.0",
|
"husky": "^8.0.0",
|
||||||
"postcss": "^8.4.23",
|
"postcss": "^8.4.23",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"sass": "^1.83.4",
|
"sass": "^1.83.4",
|
||||||
"vitepress": "^1.6.3",
|
"vitepress": "^1.6.3",
|
||||||
"vitest": "^0.34.0"
|
"vitest": "^0.34.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^20 || ^18 || ^16",
|
"node": "^20 || ^18 || ^16",
|
||||||
"npm": ">= 8.1.2",
|
"npm": ">= 8.1.2",
|
||||||
"yarn": ">= 1.21.1",
|
"yarn": ">= 1.21.1",
|
||||||
"bun": ">= 1.0.25"
|
"bun": ">= 1.0.25"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
"vite": "^6.0.11",
|
"vite": "^6.0.11",
|
||||||
"vitest": "^0.31.1"
|
"vitest": "^0.31.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
path: '/api',
|
path: '/api',
|
||||||
rule: { target: 'http://0.0.0.0:3000' },
|
rule: { target: 'http://127.0.0.1:3000' },
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
import { configure } from 'quasar/wrappers';
|
import { configure } from 'quasar/wrappers';
|
||||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
const target = `http://${process.env.CI ? 'back' : 'localhost'}:3000`;
|
||||||
|
|
||||||
export default configure(function (/* ctx */) {
|
export default configure(function (/* ctx */) {
|
||||||
return {
|
return {
|
||||||
|
@ -30,7 +31,6 @@ export default configure(function (/* ctx */) {
|
||||||
// --> boot files are part of "main.js"
|
// --> boot files are part of "main.js"
|
||||||
// https://v2.quasar.dev/quasar-cli/boot-files
|
// https://v2.quasar.dev/quasar-cli/boot-files
|
||||||
boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar', 'quasar.defaults'],
|
boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar', 'quasar.defaults'],
|
||||||
|
|
||||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
|
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
|
||||||
css: ['app.scss'],
|
css: ['app.scss'],
|
||||||
|
|
||||||
|
@ -109,13 +109,17 @@ export default configure(function (/* ctx */) {
|
||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://0.0.0.0:3000',
|
target: target,
|
||||||
logLevel: 'debug',
|
logLevel: 'debug',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
secure: false,
|
secure: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
open: false,
|
open: false,
|
||||||
|
allowedHosts: [
|
||||||
|
'front', // Agrega este nombre de host
|
||||||
|
'localhost', // Opcional, para pruebas locales
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework
|
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
export const langs = ['en', 'es'];
|
||||||
|
export const decimalPlaces = 2;
|
|
@ -1,6 +1,6 @@
|
||||||
export default {
|
export default {
|
||||||
mounted: function (el, binding) {
|
mounted(el, binding) {
|
||||||
const shortcut = binding.value ?? '+';
|
const shortcut = binding.value || '+';
|
||||||
|
|
||||||
const { key, ctrl, alt, callback } =
|
const { key, ctrl, alt, callback } =
|
||||||
typeof shortcut === 'string'
|
typeof shortcut === 'string'
|
||||||
|
@ -8,25 +8,24 @@ export default {
|
||||||
key: shortcut,
|
key: shortcut,
|
||||||
ctrl: true,
|
ctrl: true,
|
||||||
alt: true,
|
alt: true,
|
||||||
callback: () =>
|
callback: () => el?.click(),
|
||||||
document
|
|
||||||
.querySelector(`button[shortcut="${shortcut}"]`)
|
|
||||||
?.click(),
|
|
||||||
}
|
}
|
||||||
: binding.value;
|
: binding.value;
|
||||||
|
|
||||||
|
if (!el.hasAttribute('shortcut')) {
|
||||||
|
el.setAttribute('shortcut', key);
|
||||||
|
}
|
||||||
|
|
||||||
const handleKeydown = (event) => {
|
const handleKeydown = (event) => {
|
||||||
if (event.key === key && (!ctrl || event.ctrlKey) && (!alt || event.altKey)) {
|
if (event.key === key && (!ctrl || event.ctrlKey) && (!alt || event.altKey)) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Attach the event listener to the window
|
|
||||||
window.addEventListener('keydown', handleKeydown);
|
window.addEventListener('keydown', handleKeydown);
|
||||||
|
|
||||||
el._handleKeydown = handleKeydown;
|
el._handleKeydown = handleKeydown;
|
||||||
},
|
},
|
||||||
unmounted: function (el) {
|
unmounted(el) {
|
||||||
if (el._handleKeydown) {
|
if (el._handleKeydown) {
|
||||||
window.removeEventListener('keydown', el._handleKeydown);
|
window.removeEventListener('keydown', el._handleKeydown);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,19 +9,19 @@ export default {
|
||||||
if (!form) return;
|
if (!form) return;
|
||||||
try {
|
try {
|
||||||
const inputsFormCard = form.querySelectorAll(
|
const inputsFormCard = form.querySelectorAll(
|
||||||
`input:not([disabled]):not([type="checkbox"])`
|
`input:not([disabled]):not([type="checkbox"])`,
|
||||||
);
|
);
|
||||||
if (inputsFormCard.length) {
|
if (inputsFormCard.length) {
|
||||||
focusFirstInput(inputsFormCard[0]);
|
focusFirstInput(inputsFormCard[0]);
|
||||||
}
|
}
|
||||||
const textareas = document.querySelectorAll(
|
const textareas = document.querySelectorAll(
|
||||||
'textarea:not([disabled]), [contenteditable]:not([disabled])'
|
'textarea:not([disabled]), [contenteditable]:not([disabled])',
|
||||||
);
|
);
|
||||||
if (textareas.length) {
|
if (textareas.length) {
|
||||||
focusFirstInput(textareas[textareas.length - 1]);
|
focusFirstInput(textareas[textareas.length - 1]);
|
||||||
}
|
}
|
||||||
const inputs = document.querySelectorAll(
|
const inputs = document.querySelectorAll(
|
||||||
'form#formModel input:not([disabled]):not([type="checkbox"])'
|
'form#formModel input:not([disabled]):not([type="checkbox"])',
|
||||||
);
|
);
|
||||||
const input = inputs[0];
|
const input = inputs[0];
|
||||||
if (!input) return;
|
if (!input) return;
|
||||||
|
@ -30,22 +30,5 @@ export default {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
form.addEventListener('keyup', function (evt) {
|
|
||||||
if (evt.key === 'Enter' && !that.$attrs['prevent-submit']) {
|
|
||||||
const input = evt.target;
|
|
||||||
if (input.type == 'textarea' && evt.shiftKey) {
|
|
||||||
evt.preventDefault();
|
|
||||||
let { selectionStart, selectionEnd } = input;
|
|
||||||
input.value =
|
|
||||||
input.value.substring(0, selectionStart) +
|
|
||||||
'\n' +
|
|
||||||
input.value.substring(selectionEnd);
|
|
||||||
selectionStart = selectionEnd = selectionStart + 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
evt.preventDefault();
|
|
||||||
that.onSubmit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,4 +51,5 @@ export default boot(({ app }) => {
|
||||||
|
|
||||||
await useCau(response, message);
|
await useCau(response, message);
|
||||||
};
|
};
|
||||||
|
app.provide('app', app);
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@ const { t } = useI18n();
|
||||||
const bicInputRef = ref(null);
|
const bicInputRef = ref(null);
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
|
||||||
const customer = computed(() => state.get('customer'));
|
const customer = computed(() => state.get('Customer'));
|
||||||
|
|
||||||
const countriesFilter = {
|
const countriesFilter = {
|
||||||
fields: ['id', 'name', 'code'],
|
fields: ['id', 'name', 'code'],
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnSelectProvince from 'src/components/VnSelectProvince.vue';
|
import VnSelectProvince from 'src/components/VnSelectProvince.vue';
|
||||||
|
@ -21,14 +20,11 @@ const postcodeFormData = reactive({
|
||||||
provinceFk: null,
|
provinceFk: null,
|
||||||
townFk: null,
|
townFk: null,
|
||||||
});
|
});
|
||||||
const townsFetchDataRef = ref(false);
|
|
||||||
const townFilter = ref({});
|
const townFilter = ref({});
|
||||||
|
|
||||||
const countriesRef = ref(false);
|
const countriesRef = ref(false);
|
||||||
const provincesOptions = ref([]);
|
const provincesOptions = ref([]);
|
||||||
const townsOptions = ref([]);
|
|
||||||
const town = ref({});
|
const town = ref({});
|
||||||
const countryFilter = ref({});
|
|
||||||
|
|
||||||
function onDataSaved(formData) {
|
function onDataSaved(formData) {
|
||||||
const newPostcode = {
|
const newPostcode = {
|
||||||
|
@ -51,7 +47,6 @@ async function setCountry(countryFk, data) {
|
||||||
data.townFk = null;
|
data.townFk = null;
|
||||||
data.provinceFk = null;
|
data.provinceFk = null;
|
||||||
data.countryFk = countryFk;
|
data.countryFk = countryFk;
|
||||||
await fetchTowns();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Province
|
// Province
|
||||||
|
@ -60,22 +55,11 @@ async function setProvince(id, data) {
|
||||||
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
||||||
if (newProvince) data.countryFk = newProvince.countryFk;
|
if (newProvince) data.countryFk = newProvince.countryFk;
|
||||||
postcodeFormData.provinceFk = id;
|
postcodeFormData.provinceFk = id;
|
||||||
await fetchTowns();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onProvinceCreated(data) {
|
async function onProvinceCreated(data) {
|
||||||
postcodeFormData.provinceFk = data.id;
|
postcodeFormData.provinceFk = data.id;
|
||||||
}
|
}
|
||||||
function provinceByCountry(countryFk = postcodeFormData.countryFk) {
|
|
||||||
return provincesOptions.value
|
|
||||||
.filter((province) => province.countryFk === countryFk)
|
|
||||||
.map(({ id }) => id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Town
|
|
||||||
async function handleTowns(data) {
|
|
||||||
townsOptions.value = data;
|
|
||||||
}
|
|
||||||
function setTown(newTown, data) {
|
function setTown(newTown, data) {
|
||||||
town.value = newTown;
|
town.value = newTown;
|
||||||
data.provinceFk = newTown?.provinceFk ?? newTown;
|
data.provinceFk = newTown?.provinceFk ?? newTown;
|
||||||
|
@ -88,18 +72,6 @@ async function onCityCreated(newTown, formData) {
|
||||||
formData.townFk = newTown;
|
formData.townFk = newTown;
|
||||||
setTown(newTown, formData);
|
setTown(newTown, formData);
|
||||||
}
|
}
|
||||||
async function fetchTowns(countryFk = postcodeFormData.countryFk) {
|
|
||||||
if (!countryFk) return;
|
|
||||||
const provinces = postcodeFormData.provinceFk
|
|
||||||
? [postcodeFormData.provinceFk]
|
|
||||||
: provinceByCountry();
|
|
||||||
townFilter.value.where = {
|
|
||||||
provinceFk: {
|
|
||||||
inq: provinces,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
await townsFetchDataRef.value?.fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function filterTowns(name) {
|
async function filterTowns(name) {
|
||||||
if (name !== '') {
|
if (name !== '') {
|
||||||
|
@ -108,22 +80,11 @@ async function filterTowns(name) {
|
||||||
like: `%${name}%`,
|
like: `%${name}%`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
await townsFetchDataRef.value?.fetch();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
ref="townsFetchDataRef"
|
|
||||||
:sort-by="['name ASC']"
|
|
||||||
:limit="30"
|
|
||||||
:filter="townFilter"
|
|
||||||
@on-fetch="handleTowns"
|
|
||||||
auto-load
|
|
||||||
url="Towns/location"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
url-create="postcodes"
|
url-create="postcodes"
|
||||||
model="postcode"
|
model="postcode"
|
||||||
|
@ -149,14 +110,13 @@ async function filterTowns(name) {
|
||||||
@filter="filterTowns"
|
@filter="filterTowns"
|
||||||
:tooltip="t('Create city')"
|
:tooltip="t('Create city')"
|
||||||
v-model="data.townFk"
|
v-model="data.townFk"
|
||||||
:options="townsOptions"
|
url="Towns/location"
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
:rules="validate('postcode.city')"
|
:rules="validate('postcode.city')"
|
||||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||||
:emit-value="false"
|
:emit-value="false"
|
||||||
required
|
required
|
||||||
data-cy="locationTown"
|
data-cy="locationTown"
|
||||||
|
sort-by="name ASC"
|
||||||
>
|
>
|
||||||
<template #option="{ itemProps, opt }">
|
<template #option="{ itemProps, opt }">
|
||||||
<QItem v-bind="itemProps">
|
<QItem v-bind="itemProps">
|
||||||
|
@ -197,16 +157,12 @@ async function filterTowns(name) {
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
ref="countriesRef"
|
ref="countriesRef"
|
||||||
:limit="30"
|
|
||||||
:filter="countryFilter"
|
|
||||||
:sort-by="['name ASC']"
|
:sort-by="['name ASC']"
|
||||||
auto-load
|
auto-load
|
||||||
url="Countries"
|
url="Countries"
|
||||||
required
|
required
|
||||||
:label="t('Country')"
|
:label="t('Country')"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="data.countryFk"
|
v-model="data.countryFk"
|
||||||
:rules="validate('postcode.countryFk')"
|
:rules="validate('postcode.countryFk')"
|
||||||
@update:model-value="(value) => setCountry(value, data)"
|
@update:model-value="(value) => setCountry(value, data)"
|
||||||
|
|
|
@ -62,12 +62,9 @@ const where = computed(() => {
|
||||||
auto-load
|
auto-load
|
||||||
:where="where"
|
:where="where"
|
||||||
url="Autonomies/location"
|
url="Autonomies/location"
|
||||||
:sort-by="['name ASC']"
|
sort-by="name ASC"
|
||||||
:limit="30"
|
|
||||||
:label="t('Autonomy')"
|
:label="t('Autonomy')"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="data.autonomyFk"
|
v-model="data.autonomyFk"
|
||||||
:rules="validate('province.autonomyFk')"
|
:rules="validate('province.autonomyFk')"
|
||||||
>
|
>
|
||||||
|
|
|
@ -64,6 +64,10 @@ const $props = defineProps({
|
||||||
type: Function,
|
type: Function,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
beforeSaveFn: {
|
||||||
|
type: Function,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
goTo: {
|
goTo: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -176,7 +180,11 @@ async function saveChanges(data) {
|
||||||
hasChanges.value = false;
|
hasChanges.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const changes = data || getChanges();
|
let changes = data || getChanges();
|
||||||
|
if ($props.beforeSaveFn) {
|
||||||
|
changes = await $props.beforeSaveFn(changes, getChanges);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -229,12 +237,12 @@ async function remove(data) {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
title: t('globals.confirmDeletion'),
|
title: t('globals.confirmDeletion'),
|
||||||
message: t('globals.confirmDeletionMessage'),
|
message: t('globals.confirmDeletionMessage'),
|
||||||
newData,
|
data: { deletes: ids },
|
||||||
ids,
|
ids,
|
||||||
|
promise: saveChanges,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.onOk(async () => {
|
.onOk(async () => {
|
||||||
await saveChanges({ deletes: ids });
|
|
||||||
newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
|
newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
|
||||||
fetch(newData);
|
fetch(newData);
|
||||||
});
|
});
|
||||||
|
@ -374,6 +382,8 @@ watch(formUrl, async () => {
|
||||||
@click="onSubmit"
|
@click="onSubmit"
|
||||||
:disable="!hasChanges"
|
:disable="!hasChanges"
|
||||||
:title="t('globals.save')"
|
:title="t('globals.save')"
|
||||||
|
v-shortcut="'s'"
|
||||||
|
shortcut="s"
|
||||||
data-cy="crudModelDefaultSaveBtn"
|
data-cy="crudModelDefaultSaveBtn"
|
||||||
/>
|
/>
|
||||||
<slot name="moreAfterActions" />
|
<slot name="moreAfterActions" />
|
||||||
|
|
|
@ -42,7 +42,6 @@ const itemFilter = {
|
||||||
const itemFilterParams = reactive({});
|
const itemFilterParams = reactive({});
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const producersOptions = ref([]);
|
|
||||||
const ItemTypesOptions = ref([]);
|
const ItemTypesOptions = ref([]);
|
||||||
const InksOptions = ref([]);
|
const InksOptions = ref([]);
|
||||||
const tableRows = ref([]);
|
const tableRows = ref([]);
|
||||||
|
@ -121,23 +120,17 @@ const selectItem = ({ id }) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
url="Producers"
|
|
||||||
@on-fetch="(data) => (producersOptions = data)"
|
|
||||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
url="ItemTypes"
|
url="ItemTypes"
|
||||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||||
order="name"
|
order="name ASC"
|
||||||
@on-fetch="(data) => (ItemTypesOptions = data)"
|
@on-fetch="(data) => (ItemTypesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Inks"
|
url="Inks"
|
||||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||||
order="name"
|
order="name ASC"
|
||||||
@on-fetch="(data) => (InksOptions = data)"
|
@on-fetch="(data) => (InksOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
@ -152,11 +145,11 @@ const selectItem = ({ id }) => {
|
||||||
<VnInput :label="t('entry.buys.size')" v-model="itemFilterParams.size" />
|
<VnInput :label="t('entry.buys.size')" v-model="itemFilterParams.size" />
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('globals.producer')"
|
:label="t('globals.producer')"
|
||||||
:options="producersOptions"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="itemFilterParams.producerFk"
|
v-model="itemFilterParams.producerFk"
|
||||||
|
url="Producers"
|
||||||
|
:fields="['id', 'name']"
|
||||||
|
sort-by="name ASC"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('globals.type')"
|
:label="t('globals.type')"
|
||||||
|
|
|
@ -124,7 +124,7 @@ const selectTravel = ({ id }) => {
|
||||||
<FetchData
|
<FetchData
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
@on-fetch="(data) => (agenciesOptions = data)"
|
@on-fetch="(data) => (agenciesOptions = data)"
|
||||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -181,6 +181,7 @@ const selectTravel = ({ id }) => {
|
||||||
color="primary"
|
color="primary"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
|
data-cy="save-filter-travel-form"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<QTable
|
<QTable
|
||||||
|
@ -191,9 +192,10 @@ const selectTravel = ({ id }) => {
|
||||||
:no-data-label="t('Enter a new search')"
|
:no-data-label="t('Enter a new search')"
|
||||||
class="q-mt-lg"
|
class="q-mt-lg"
|
||||||
@row-click="(_, row) => selectTravel(row)"
|
@row-click="(_, row) => selectTravel(row)"
|
||||||
|
data-cy="table-filter-travel-form"
|
||||||
>
|
>
|
||||||
<template #body-cell-id="{ row }">
|
<template #body-cell-id="{ row }">
|
||||||
<QTd auto-width @click.stop>
|
<QTd auto-width @click.stop data-cy="travelFk-travel-form">
|
||||||
<QBtn flat color="blue">{{ row.id }}</QBtn>
|
<QBtn flat color="blue">{{ row.id }}</QBtn>
|
||||||
<TravelDescriptorProxy :id="row.id" />
|
<TravelDescriptorProxy :id="row.id" />
|
||||||
</QTd>
|
</QTd>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { onMounted, onUnmounted, computed, ref, watch, nextTick } from 'vue';
|
import { onMounted, onUnmounted, computed, ref, watch, nextTick, useAttrs } from 'vue';
|
||||||
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router';
|
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
@ -12,6 +12,7 @@ import SkeletonForm from 'components/ui/SkeletonForm.vue';
|
||||||
import VnConfirm from './ui/VnConfirm.vue';
|
import VnConfirm from './ui/VnConfirm.vue';
|
||||||
import { tMobile } from 'src/composables/tMobile';
|
import { tMobile } from 'src/composables/tMobile';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import { getDifferences, getUpdatedValues } from 'src/filters';
|
||||||
|
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
@ -22,6 +23,7 @@ const { validate } = useValidator();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const myForm = ref(null);
|
const myForm = ref(null);
|
||||||
|
const attrs = useAttrs();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
url: {
|
url: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -84,7 +86,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
reload: {
|
reload: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: true,
|
||||||
},
|
},
|
||||||
defaultTrim: {
|
defaultTrim: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -97,7 +99,7 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
const emit = defineEmits(['onFetch', 'onDataSaved']);
|
||||||
const modelValue = computed(
|
const modelValue = computed(
|
||||||
() => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`
|
() => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`,
|
||||||
).value;
|
).value;
|
||||||
const componentIsRendered = ref(false);
|
const componentIsRendered = ref(false);
|
||||||
const arrayData = useArrayData(modelValue);
|
const arrayData = useArrayData(modelValue);
|
||||||
|
@ -105,15 +107,15 @@ const isLoading = ref(false);
|
||||||
// Si elegimos observar los cambios del form significa que inicialmente las actions estaran deshabilitadas
|
// Si elegimos observar los cambios del form significa que inicialmente las actions estaran deshabilitadas
|
||||||
const isResetting = ref(false);
|
const isResetting = ref(false);
|
||||||
const hasChanges = ref(!$props.observeFormChanges);
|
const hasChanges = ref(!$props.observeFormChanges);
|
||||||
const originalData = ref({});
|
const originalData = computed(() => state.get(modelValue));
|
||||||
const formData = computed(() => state.get(modelValue));
|
const formData = ref();
|
||||||
const defaultButtons = computed(() => ({
|
const defaultButtons = computed(() => ({
|
||||||
save: {
|
save: {
|
||||||
dataCy: 'saveDefaultBtn',
|
dataCy: 'saveDefaultBtn',
|
||||||
color: 'primary',
|
color: 'primary',
|
||||||
icon: 'save',
|
icon: 'save',
|
||||||
label: 'globals.save',
|
label: 'globals.save',
|
||||||
click: () => myForm.value.submit(),
|
click: async () => await save(),
|
||||||
type: 'submit',
|
type: 'submit',
|
||||||
},
|
},
|
||||||
reset: {
|
reset: {
|
||||||
|
@ -127,8 +129,6 @@ const defaultButtons = computed(() => ({
|
||||||
}));
|
}));
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
originalData.value = JSON.parse(JSON.stringify($props.formInitialData ?? {}));
|
|
||||||
|
|
||||||
nextTick(() => (componentIsRendered.value = true));
|
nextTick(() => (componentIsRendered.value = true));
|
||||||
|
|
||||||
// Podemos enviarle al form la estructura de data inicial sin necesidad de fetchearla
|
// Podemos enviarle al form la estructura de data inicial sin necesidad de fetchearla
|
||||||
|
@ -136,7 +136,8 @@ onMounted(async () => {
|
||||||
|
|
||||||
if (!$props.formInitialData) {
|
if (!$props.formInitialData) {
|
||||||
if ($props.autoLoad && $props.url) await fetch();
|
if ($props.autoLoad && $props.url) await fetch();
|
||||||
else if (arrayData.store.data) updateAndEmit('onFetch', arrayData.store.data);
|
else if (arrayData.store.data)
|
||||||
|
updateAndEmit('onFetch', { val: arrayData.store.data });
|
||||||
}
|
}
|
||||||
if ($props.observeFormChanges) {
|
if ($props.observeFormChanges) {
|
||||||
watch(
|
watch(
|
||||||
|
@ -148,7 +149,7 @@ onMounted(async () => {
|
||||||
JSON.stringify(newVal) !== JSON.stringify(originalData.value);
|
JSON.stringify(newVal) !== JSON.stringify(originalData.value);
|
||||||
isResetting.value = false;
|
isResetting.value = false;
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -156,16 +157,24 @@ onMounted(async () => {
|
||||||
if (!$props.url)
|
if (!$props.url)
|
||||||
watch(
|
watch(
|
||||||
() => arrayData.store.data,
|
() => arrayData.store.data,
|
||||||
(val) => updateAndEmit('onFetch', val)
|
(val) => updateAndEmit('onFetch', { val }),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
originalData,
|
||||||
|
(val) => {
|
||||||
|
if (val) formData.value = JSON.parse(JSON.stringify(val));
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [$props.url, $props.filter],
|
() => [$props.url, $props.filter],
|
||||||
async () => {
|
async () => {
|
||||||
originalData.value = null;
|
state.set(modelValue, null);
|
||||||
reset();
|
reset();
|
||||||
await fetch();
|
await fetch();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
onBeforeRouteLeave((to, from, next) => {
|
onBeforeRouteLeave((to, from, next) => {
|
||||||
|
@ -194,10 +203,9 @@ async function fetch() {
|
||||||
});
|
});
|
||||||
if (Array.isArray(data)) data = data[0] ?? {};
|
if (Array.isArray(data)) data = data[0] ?? {};
|
||||||
|
|
||||||
updateAndEmit('onFetch', data);
|
updateAndEmit('onFetch', { val: data });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
state.set(modelValue, {});
|
state.set(modelValue, {});
|
||||||
originalData.value = {};
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,7 +230,11 @@ async function save() {
|
||||||
|
|
||||||
if ($props.urlCreate) notify('globals.dataCreated', 'positive');
|
if ($props.urlCreate) notify('globals.dataCreated', 'positive');
|
||||||
|
|
||||||
updateAndEmit('onDataSaved', formData.value, response?.data);
|
updateAndEmit('onDataSaved', {
|
||||||
|
val: formData.value,
|
||||||
|
res: response?.data,
|
||||||
|
old: originalData.value,
|
||||||
|
});
|
||||||
if ($props.reload) await arrayData.fetch({});
|
if ($props.reload) await arrayData.fetch({});
|
||||||
hasChanges.value = false;
|
hasChanges.value = false;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -236,7 +248,8 @@ async function saveAndGo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
updateAndEmit('onFetch', originalData.value);
|
formData.value = JSON.parse(JSON.stringify(originalData.value));
|
||||||
|
updateAndEmit('onFetch', { val: originalData.value });
|
||||||
if ($props.observeFormChanges) {
|
if ($props.observeFormChanges) {
|
||||||
hasChanges.value = false;
|
hasChanges.value = false;
|
||||||
isResetting.value = true;
|
isResetting.value = true;
|
||||||
|
@ -254,16 +267,15 @@ function filter(value, update, filterOptions) {
|
||||||
(ref) => {
|
(ref) => {
|
||||||
ref.setOptionIndex(-1);
|
ref.setOptionIndex(-1);
|
||||||
ref.moveOptionSelection(1, true);
|
ref.moveOptionSelection(1, true);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAndEmit(evt, val, res) {
|
function updateAndEmit(evt, { val, res, old } = { val: null, res: null, old: null }) {
|
||||||
state.set(modelValue, val);
|
state.set(modelValue, val);
|
||||||
originalData.value = val && JSON.parse(JSON.stringify(val));
|
|
||||||
if (!$props.url) arrayData.store.data = val;
|
if (!$props.url) arrayData.store.data = val;
|
||||||
|
|
||||||
emit(evt, state.get(modelValue), res);
|
emit(evt, state.get(modelValue), res, old);
|
||||||
}
|
}
|
||||||
|
|
||||||
function trimData(data) {
|
function trimData(data) {
|
||||||
|
@ -273,6 +285,27 @@ function trimData(data) {
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
function onBeforeSave(formData, originalData) {
|
||||||
|
return getUpdatedValues(
|
||||||
|
Object.keys(getDifferences(formData, originalData)),
|
||||||
|
formData,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
async function onKeyup(evt) {
|
||||||
|
if (evt.key === 'Enter' && !('prevent-submit' in attrs)) {
|
||||||
|
const input = evt.target;
|
||||||
|
if (input.type == 'textarea' && evt.shiftKey) {
|
||||||
|
let { selectionStart, selectionEnd } = input;
|
||||||
|
input.value =
|
||||||
|
input.value.substring(0, selectionStart) +
|
||||||
|
'\n' +
|
||||||
|
input.value.substring(selectionEnd);
|
||||||
|
selectionStart = selectionEnd = selectionStart + 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
save,
|
save,
|
||||||
|
@ -288,12 +321,13 @@ defineExpose({
|
||||||
<QForm
|
<QForm
|
||||||
ref="myForm"
|
ref="myForm"
|
||||||
v-if="formData"
|
v-if="formData"
|
||||||
@submit="save"
|
@submit.prevent
|
||||||
|
@keyup.prevent="onKeyup"
|
||||||
@reset="reset"
|
@reset="reset"
|
||||||
class="q-pa-md"
|
class="q-pa-md"
|
||||||
:style="maxWidth ? 'max-width: ' + maxWidth : ''"
|
:style="maxWidth ? 'max-width: ' + maxWidth : ''"
|
||||||
id="formModel"
|
id="formModel"
|
||||||
:prevent-submit="$attrs['prevent-submit']"
|
:mapper="onBeforeSave"
|
||||||
>
|
>
|
||||||
<QCard>
|
<QCard>
|
||||||
<slot
|
<slot
|
||||||
|
|
|
@ -15,23 +15,35 @@ defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
showSaveAndContinueBtn: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const formModelRef = ref(null);
|
const formModelRef = ref(null);
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
|
const isSaveAndContinue = ref(false);
|
||||||
const onDataSaved = (formData, requestResponse) => {
|
const onDataSaved = (formData, requestResponse) => {
|
||||||
if (closeButton.value) closeButton.value.click();
|
if (closeButton.value && !isSaveAndContinue.value) closeButton.value.click();
|
||||||
emit('onDataSaved', formData, requestResponse);
|
emit('onDataSaved', formData, requestResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onClick = async (saveAndContinue) => {
|
||||||
|
isSaveAndContinue.value = saveAndContinue;
|
||||||
|
await formModelRef.value.save();
|
||||||
|
};
|
||||||
|
|
||||||
const isLoading = computed(() => formModelRef.value?.isLoading);
|
const isLoading = computed(() => formModelRef.value?.isLoading);
|
||||||
|
const reset = computed(() => formModelRef.value?.reset);
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
isLoading,
|
isLoading,
|
||||||
onDataSaved,
|
onDataSaved,
|
||||||
|
isSaveAndContinue,
|
||||||
|
reset,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -59,15 +71,19 @@ defineExpose({
|
||||||
flat
|
flat
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
@click="emit('onDataCanceled')"
|
|
||||||
v-close-popup
|
|
||||||
data-cy="FormModelPopup_cancel"
|
data-cy="FormModelPopup_cancel"
|
||||||
|
v-close-popup
|
||||||
z-max
|
z-max
|
||||||
|
@click="
|
||||||
|
isSaveAndContinue = false;
|
||||||
|
emit('onDataCanceled');
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
:flat="showSaveAndContinueBtn"
|
||||||
:label="t('globals.save')"
|
:label="t('globals.save')"
|
||||||
:title="t('globals.save')"
|
:title="t('globals.save')"
|
||||||
type="submit"
|
@click="onClick(false)"
|
||||||
color="primary"
|
color="primary"
|
||||||
class="q-ml-sm"
|
class="q-ml-sm"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
|
@ -75,6 +91,18 @@ defineExpose({
|
||||||
data-cy="FormModelPopup_save"
|
data-cy="FormModelPopup_save"
|
||||||
z-max
|
z-max
|
||||||
/>
|
/>
|
||||||
|
<QBtn
|
||||||
|
v-if="showSaveAndContinueBtn"
|
||||||
|
:label="t('globals.isSaveAndContinue')"
|
||||||
|
:title="t('globals.isSaveAndContinue')"
|
||||||
|
color="primary"
|
||||||
|
class="q-ml-sm"
|
||||||
|
:disabled="isLoading"
|
||||||
|
:loading="isLoading"
|
||||||
|
data-cy="FormModelPopup_isSaveAndContinue"
|
||||||
|
z-max
|
||||||
|
@click="onClick(true)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
|
|
|
@ -121,23 +121,25 @@ const removeTag = (index, params, search) => {
|
||||||
applyTags(params, search);
|
applyTags(params, search);
|
||||||
};
|
};
|
||||||
const setCategoryList = (data) => {
|
const setCategoryList = (data) => {
|
||||||
categoryList.value = (data || [])
|
categoryList.value = (data || []).map((category) => ({
|
||||||
.filter((category) => category.display)
|
...category,
|
||||||
.map((category) => ({
|
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
||||||
...category,
|
}));
|
||||||
icon: `vn:${(category.icon || '').split('-')[1]}`,
|
|
||||||
}));
|
|
||||||
fetchItemTypes();
|
fetchItemTypes();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData url="ItemCategories" limit="30" auto-load @on-fetch="setCategoryList" />
|
<FetchData
|
||||||
|
url="ItemCategories"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="setCategoryList"
|
||||||
|
:where="{ display: { neq: 0 } }"
|
||||||
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Tags"
|
url="Tags"
|
||||||
:filter="{ fields: ['id', 'name', 'isFree'] }"
|
:filter="{ fields: ['id', 'name', 'isFree'] }"
|
||||||
auto-load
|
auto-load
|
||||||
limit="30"
|
|
||||||
@on-fetch="(data) => (tagOptions = data)"
|
@on-fetch="(data) => (tagOptions = data)"
|
||||||
/>
|
/>
|
||||||
<VnFilterPanel
|
<VnFilterPanel
|
||||||
|
@ -195,8 +197,6 @@ const setCategoryList = (data) => {
|
||||||
:label="t('components.itemsFilterPanel.typeFk')"
|
:label="t('components.itemsFilterPanel.typeFk')"
|
||||||
v-model="params.typeFk"
|
v-model="params.typeFk"
|
||||||
:options="itemTypesOptions"
|
:options="itemTypesOptions"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
|
@ -234,7 +234,6 @@ const setCategoryList = (data) => {
|
||||||
:label="t('globals.tag')"
|
:label="t('globals.tag')"
|
||||||
v-model="value.selectedTag"
|
v-model="value.selectedTag"
|
||||||
:options="tagOptions"
|
:options="tagOptions"
|
||||||
option-label="name"
|
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
|
@ -282,7 +281,7 @@ const setCategoryList = (data) => {
|
||||||
<QItem class="q-mt-lg">
|
<QItem class="q-mt-lg">
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
shortcut="+"
|
v-shortcut="'+'"
|
||||||
flat
|
flat
|
||||||
class="fill-icon-on-hover q-px-xs"
|
class="fill-icon-on-hover q-px-xs"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -328,7 +327,6 @@ en:
|
||||||
active: Is active
|
active: Is active
|
||||||
visible: Is visible
|
visible: Is visible
|
||||||
floramondo: Is floramondo
|
floramondo: Is floramondo
|
||||||
salesPersonFk: Buyer
|
|
||||||
categoryFk: Category
|
categoryFk: Category
|
||||||
|
|
||||||
es:
|
es:
|
||||||
|
@ -339,7 +337,6 @@ es:
|
||||||
active: Activo
|
active: Activo
|
||||||
visible: Visible
|
visible: Visible
|
||||||
floramondo: Floramondo
|
floramondo: Floramondo
|
||||||
salesPersonFk: Comprador
|
|
||||||
categoryFk: Categoría
|
categoryFk: Categoría
|
||||||
Plant: Planta natural
|
Plant: Planta natural
|
||||||
Flower: Flor fresca
|
Flower: Flor fresca
|
||||||
|
|
|
@ -41,7 +41,6 @@ const filteredItems = computed(() => {
|
||||||
return locale.includes(normalizedSearch);
|
return locale.includes(normalizedSearch);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredPinnedModules = computed(() => {
|
const filteredPinnedModules = computed(() => {
|
||||||
if (!search.value) return pinnedModules.value;
|
if (!search.value) return pinnedModules.value;
|
||||||
const normalizedSearch = search.value
|
const normalizedSearch = search.value
|
||||||
|
@ -72,7 +71,7 @@ watch(
|
||||||
items.value = [];
|
items.value = [];
|
||||||
getRoutes();
|
getRoutes();
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
function findMatches(search, item) {
|
function findMatches(search, item) {
|
||||||
|
@ -104,33 +103,40 @@ function addChildren(module, route, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRoutes() {
|
function getRoutes() {
|
||||||
if (props.source === 'main') {
|
const handleRoutes = {
|
||||||
const modules = Object.assign([], navigation.getModules().value);
|
main: getMainRoutes,
|
||||||
|
card: getCardRoutes,
|
||||||
for (const item of modules) {
|
};
|
||||||
const moduleDef = routes.find(
|
try {
|
||||||
(route) => toLowerCamel(route.name) === item.module
|
handleRoutes[props.source]();
|
||||||
);
|
} catch (error) {
|
||||||
if (!moduleDef) continue;
|
throw new Error(`Method is not defined`);
|
||||||
item.children = [];
|
|
||||||
|
|
||||||
addChildren(item.module, moduleDef, item.children);
|
|
||||||
}
|
|
||||||
|
|
||||||
items.value = modules;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
function getMainRoutes() {
|
||||||
|
const modules = Object.assign([], navigation.getModules().value);
|
||||||
|
|
||||||
if (props.source === 'card') {
|
for (const item of modules) {
|
||||||
const currentRoute = route.matched[1];
|
const moduleDef = routes.find(
|
||||||
const currentModule = toLowerCamel(currentRoute.name);
|
(route) => toLowerCamel(route.name) === item.module,
|
||||||
let moduleDef = routes.find(
|
|
||||||
(route) => toLowerCamel(route.name) === currentModule
|
|
||||||
);
|
);
|
||||||
|
if (!moduleDef) continue;
|
||||||
|
item.children = [];
|
||||||
|
|
||||||
if (!moduleDef) return;
|
addChildren(item.module, moduleDef, item.children);
|
||||||
if (!moduleDef?.menus) moduleDef = betaGetRoutes();
|
|
||||||
addChildren(currentModule, moduleDef, items.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
items.value = modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCardRoutes() {
|
||||||
|
const currentRoute = route.matched[1];
|
||||||
|
const currentModule = toLowerCamel(currentRoute.name);
|
||||||
|
let moduleDef = routes.find((route) => toLowerCamel(route.name) === currentModule);
|
||||||
|
|
||||||
|
if (!moduleDef) return;
|
||||||
|
if (!moduleDef?.menus) moduleDef = betaGetRoutes();
|
||||||
|
addChildren(currentModule, moduleDef, items.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function betaGetRoutes() {
|
function betaGetRoutes() {
|
||||||
|
@ -223,9 +229,16 @@ const searchModule = () => {
|
||||||
</template>
|
</template>
|
||||||
<template v-for="(item, index) in filteredItems" :key="item.name">
|
<template v-for="(item, index) in filteredItems" :key="item.name">
|
||||||
<template
|
<template
|
||||||
v-if="search ||item.children && !filteredPinnedModules.has(item.name)"
|
v-if="
|
||||||
|
search ||
|
||||||
|
(item.children && !filteredPinnedModules.has(item.name))
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<LeftMenuItem :item="item" group="modules" :class="search && index === 0 ? 'searched' : ''">
|
<LeftMenuItem
|
||||||
|
:item="item"
|
||||||
|
group="modules"
|
||||||
|
:class="search && index === 0 ? 'searched' : ''"
|
||||||
|
>
|
||||||
<template #side>
|
<template #side>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="item.isPinned === true"
|
v-if="item.isPinned === true"
|
||||||
|
@ -342,7 +355,7 @@ const searchModule = () => {
|
||||||
.header {
|
.header {
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
}
|
}
|
||||||
.searched{
|
.searched {
|
||||||
background-color: var(--vn-section-hover-color);
|
background-color: var(--vn-section-hover-color);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -26,6 +26,7 @@ const itemComputed = computed(() => {
|
||||||
:to="{ name: itemComputed.name }"
|
:to="{ name: itemComputed.name }"
|
||||||
clickable
|
clickable
|
||||||
v-ripple
|
v-ripple
|
||||||
|
:data-cy="`${itemComputed.name}-menu-item`"
|
||||||
>
|
>
|
||||||
<QItemSection avatar v-if="itemComputed.icon">
|
<QItemSection avatar v-if="itemComputed.icon">
|
||||||
<QIcon :name="itemComputed.icon" />
|
<QIcon :name="itemComputed.icon" />
|
||||||
|
|
|
@ -85,7 +85,15 @@ const refresh = () => window.location.reload();
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
<PinnedModules ref="pinnedModulesRef" />
|
<PinnedModules ref="pinnedModulesRef" />
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<QBtn class="q-pa-none" rounded dense flat no-wrap id="user">
|
<QBtn
|
||||||
|
class="q-pa-none"
|
||||||
|
rounded
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
no-wrap
|
||||||
|
id="user"
|
||||||
|
data-cy="userPanel_btn"
|
||||||
|
>
|
||||||
<VnAvatar
|
<VnAvatar
|
||||||
:worker-id="user.id"
|
:worker-id="user.id"
|
||||||
:title="user.name"
|
:title="user.name"
|
||||||
|
|
|
@ -9,6 +9,7 @@ import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import FormPopup from './FormPopup.vue';
|
import FormPopup from './FormPopup.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
invoiceOutData: {
|
invoiceOutData: {
|
||||||
|
@ -131,15 +132,11 @@ const refund = async () => {
|
||||||
:required="true"
|
:required="true"
|
||||||
/> </VnRow
|
/> </VnRow
|
||||||
><VnRow>
|
><VnRow>
|
||||||
<div>
|
<VnCheckbox
|
||||||
<QCheckbox
|
v-model="invoiceParams.inheritWarehouse"
|
||||||
:label="t('Inherit warehouse')"
|
:label="t('Inherit warehouse')"
|
||||||
v-model="invoiceParams.inheritWarehouse"
|
:info="t('Inherit warehouse tooltip')"
|
||||||
/>
|
/>
|
||||||
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
|
||||||
<QTooltip>{{ t('Inherit warehouse tooltip') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormPopup>
|
</FormPopup>
|
||||||
|
|
|
@ -1,39 +1,84 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { toCurrency } from 'src/filters';
|
||||||
|
|
||||||
defineProps({ row: { type: Object, required: true } });
|
defineProps({ row: { type: Object, required: true } });
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<span>
|
<span class="q-gutter-x-xs">
|
||||||
|
<router-link
|
||||||
|
v-if="row.claim?.claimFk"
|
||||||
|
:to="{ name: 'ClaimBasicData', params: { id: row.claim?.claimFk } }"
|
||||||
|
class="link"
|
||||||
|
>
|
||||||
|
<QIcon name="vn:claims" size="xs">
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('ticketSale.claim') }}:
|
||||||
|
{{ row.claim?.claimFk }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</router-link>
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="row.isTaxDataChecked === 0"
|
v-if="row?.risk"
|
||||||
|
name="vn:risk"
|
||||||
|
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ $t('salesTicketsTable.risk') }}:
|
||||||
|
{{ toCurrency(row.risk - row.credit) }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="row?.hasComponentLack"
|
||||||
|
name="vn:components"
|
||||||
|
color="primary"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row?.hasItemDelay" color="primary" size="xs" name="vn:hasItemDelay">
|
||||||
|
<QTooltip>
|
||||||
|
{{ $t('ticket.summary.hasItemDelay') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row?.hasItemLost" color="primary" size="xs" name="vn:hasItemLost">
|
||||||
|
<QTooltip>
|
||||||
|
{{ $t('salesTicketsTable.hasItemLost') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="row?.hasItemShortage"
|
||||||
|
name="vn:unavailable"
|
||||||
|
color="primary"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon v-if="row?.hasRounding" color="primary" name="sync_problem" size="xs">
|
||||||
|
<QTooltip>
|
||||||
|
{{ $t('ticketList.rounding') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="row?.hasTicketRequest"
|
||||||
|
name="vn:buyrequest"
|
||||||
|
color="primary"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="row?.isTaxDataChecked !== 0"
|
||||||
name="vn:no036"
|
name="vn:no036"
|
||||||
color="primary"
|
color="primary"
|
||||||
size="xs"
|
size="xs"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
<QTooltip>{{ $t('salesTicketsTable.noVerifiedData') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon v-if="row.hasTicketRequest" name="vn:buyrequest" color="primary" size="xs">
|
<QIcon v-if="row?.isFreezed" name="vn:frozen" color="primary" size="xs">
|
||||||
<QTooltip>{{ $t('salesTicketsTable.purchaseRequest') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.itemShortage" name="vn:unavailable" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.notVisible') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.isFreezed" name="vn:frozen" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
<QTooltip>{{ $t('salesTicketsTable.clientFrozen') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon v-if="row?.isTooLittle" name="vn:isTooLittle" color="primary" size="xs">
|
||||||
v-if="row.risk"
|
|
||||||
name="vn:risk"
|
|
||||||
:color="row.hasHighRisk ? 'negative' : 'primary'"
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ $t('salesTicketsTable.risk') }}: {{ row.risk - row.credit }}
|
|
||||||
</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.hasComponentLack" name="vn:components" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.componentLack') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
<QIcon v-if="row.isTooLittle" name="vn:isTooLittle" color="primary" size="xs">
|
|
||||||
<QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
|
<QTooltip>{{ $t('salesTicketsTable.tooLittle') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -10,6 +10,7 @@ import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import FormPopup from './FormPopup.vue';
|
import FormPopup from './FormPopup.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import VnCheckbox from './common/VnCheckbox.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
invoiceOutData: {
|
invoiceOutData: {
|
||||||
|
@ -186,15 +187,11 @@ const makeInvoice = async () => {
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div>
|
<VnCheckbox
|
||||||
<QCheckbox
|
v-model="checked"
|
||||||
:label="t('Bill destination client')"
|
:label="t('Bill destination client')"
|
||||||
v-model="checked"
|
:info="t('transferInvoiceInfo')"
|
||||||
/>
|
/>
|
||||||
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
|
||||||
<QTooltip>{{ t('transferInvoiceInfo') }}</QTooltip>
|
|
||||||
</QIcon>
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormPopup>
|
</FormPopup>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { markRaw, computed } from 'vue';
|
import { markRaw, computed } from 'vue';
|
||||||
import { QIcon, QCheckbox } from 'quasar';
|
import { QIcon, QToggle } from 'quasar';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
|
|
||||||
/* basic input */
|
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnSelectCache from 'components/common/VnSelectCache.vue';
|
import VnSelectCache from 'components/common/VnSelectCache.vue';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
|
@ -12,8 +11,11 @@ import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||||
import VnComponent from 'components/common/VnComponent.vue';
|
import VnComponent from 'components/common/VnComponent.vue';
|
||||||
import VnUserLink from 'components/ui/VnUserLink.vue';
|
import VnUserLink from 'components/ui/VnUserLink.vue';
|
||||||
|
import VnSelectEnum from '../common/VnSelectEnum.vue';
|
||||||
|
import VnCheckbox from '../common/VnCheckbox.vue';
|
||||||
|
|
||||||
const model = defineModel(undefined, { required: true });
|
const model = defineModel(undefined, { required: true });
|
||||||
|
const emit = defineEmits(['blur']);
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
column: {
|
column: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -39,10 +41,18 @@ const $props = defineProps({
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
autofocus: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
showLabel: {
|
showLabel: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
eventHandlers: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const defaultSelect = {
|
const defaultSelect = {
|
||||||
|
@ -99,7 +109,8 @@ const defaultComponents = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
checkbox: {
|
checkbox: {
|
||||||
component: markRaw(QCheckbox),
|
ref: 'checkbox',
|
||||||
|
component: markRaw(VnCheckbox),
|
||||||
attrs: ({ model }) => {
|
attrs: ({ model }) => {
|
||||||
const defaultAttrs = {
|
const defaultAttrs = {
|
||||||
disable: !$props.isEditable,
|
disable: !$props.isEditable,
|
||||||
|
@ -115,6 +126,10 @@ const defaultComponents = {
|
||||||
},
|
},
|
||||||
forceAttrs: {
|
forceAttrs: {
|
||||||
label: $props.showLabel && $props.column.label,
|
label: $props.showLabel && $props.column.label,
|
||||||
|
autofocus: true,
|
||||||
|
},
|
||||||
|
events: {
|
||||||
|
blur: () => emit('blur'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
|
@ -125,12 +140,19 @@ const defaultComponents = {
|
||||||
component: markRaw(VnSelect),
|
component: markRaw(VnSelect),
|
||||||
...defaultSelect,
|
...defaultSelect,
|
||||||
},
|
},
|
||||||
|
selectEnum: {
|
||||||
|
component: markRaw(VnSelectEnum),
|
||||||
|
...defaultSelect,
|
||||||
|
},
|
||||||
icon: {
|
icon: {
|
||||||
component: markRaw(QIcon),
|
component: markRaw(QIcon),
|
||||||
},
|
},
|
||||||
userLink: {
|
userLink: {
|
||||||
component: markRaw(VnUserLink),
|
component: markRaw(VnUserLink),
|
||||||
},
|
},
|
||||||
|
toggle: {
|
||||||
|
component: markRaw(QToggle),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const value = computed(() => {
|
const value = computed(() => {
|
||||||
|
@ -160,7 +182,28 @@ const col = computed(() => {
|
||||||
return newColumn;
|
return newColumn;
|
||||||
});
|
});
|
||||||
|
|
||||||
const components = computed(() => $props.components ?? defaultComponents);
|
const components = computed(() => {
|
||||||
|
const sourceComponents = $props.components ?? defaultComponents;
|
||||||
|
|
||||||
|
return Object.keys(sourceComponents).reduce((acc, key) => {
|
||||||
|
const component = sourceComponents[key];
|
||||||
|
|
||||||
|
if (!component || typeof component !== 'object') {
|
||||||
|
acc[key] = component;
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
|
||||||
|
acc[key] = {
|
||||||
|
...component,
|
||||||
|
attrs: {
|
||||||
|
...(component.attrs || {}),
|
||||||
|
autofocus: $props.autofocus,
|
||||||
|
},
|
||||||
|
event: { ...component?.event, ...$props?.eventHandlers },
|
||||||
|
};
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="row no-wrap">
|
<div class="row no-wrap">
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { markRaw, computed } from 'vue';
|
import { markRaw, computed } from 'vue';
|
||||||
import { QCheckbox } from 'quasar';
|
import { QCheckbox, QToggle } from 'quasar';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
|
||||||
/* basic input */
|
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
import VnColumn from 'components/VnTable/VnColumn.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
column: {
|
column: {
|
||||||
|
@ -27,6 +25,10 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: 'table',
|
default: 'table',
|
||||||
},
|
},
|
||||||
|
customClass: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
defineExpose({ addFilter, props: $props });
|
defineExpose({ addFilter, props: $props });
|
||||||
|
@ -34,7 +36,7 @@ defineExpose({ addFilter, props: $props });
|
||||||
const model = defineModel(undefined, { required: true });
|
const model = defineModel(undefined, { required: true });
|
||||||
const arrayData = useArrayData(
|
const arrayData = useArrayData(
|
||||||
$props.dataKey,
|
$props.dataKey,
|
||||||
$props.searchUrl ? { searchUrl: $props.searchUrl } : null
|
$props.searchUrl ? { searchUrl: $props.searchUrl } : null,
|
||||||
);
|
);
|
||||||
const columnFilter = computed(() => $props.column?.columnFilter);
|
const columnFilter = computed(() => $props.column?.columnFilter);
|
||||||
|
|
||||||
|
@ -46,19 +48,18 @@ const enterEvent = {
|
||||||
|
|
||||||
const defaultAttrs = {
|
const defaultAttrs = {
|
||||||
filled: !$props.showTitle,
|
filled: !$props.showTitle,
|
||||||
class: 'q-px-xs q-pb-xs q-pt-none fit',
|
|
||||||
dense: true,
|
dense: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const forceAttrs = {
|
const forceAttrs = {
|
||||||
label: $props.showTitle ? '' : columnFilter.value?.label ?? $props.column.label,
|
label: $props.showTitle ? '' : (columnFilter.value?.label ?? $props.column.label),
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectComponent = {
|
const selectComponent = {
|
||||||
component: markRaw(VnSelect),
|
component: markRaw(VnSelect),
|
||||||
event: updateEvent,
|
event: updateEvent,
|
||||||
attrs: {
|
attrs: {
|
||||||
class: 'q-px-sm q-pb-xs q-pt-none fit',
|
class: `q-pt-none fit ${$props.customClass}`,
|
||||||
dense: true,
|
dense: true,
|
||||||
filled: !$props.showTitle,
|
filled: !$props.showTitle,
|
||||||
},
|
},
|
||||||
|
@ -109,14 +110,24 @@ const components = {
|
||||||
component: markRaw(QCheckbox),
|
component: markRaw(QCheckbox),
|
||||||
event: updateEvent,
|
event: updateEvent,
|
||||||
attrs: {
|
attrs: {
|
||||||
dense: true,
|
class: $props.showTitle ? 'q-py-sm' : 'q-px-md q-py-xs fit',
|
||||||
class: $props.showTitle ? 'q-py-sm q-mt-md' : 'q-px-md q-py-xs fit',
|
|
||||||
'toggle-indeterminate': true,
|
'toggle-indeterminate': true,
|
||||||
|
size: 'sm',
|
||||||
},
|
},
|
||||||
forceAttrs,
|
forceAttrs,
|
||||||
},
|
},
|
||||||
select: selectComponent,
|
select: selectComponent,
|
||||||
rawSelect: selectComponent,
|
rawSelect: selectComponent,
|
||||||
|
toggle: {
|
||||||
|
component: markRaw(QToggle),
|
||||||
|
event: updateEvent,
|
||||||
|
attrs: {
|
||||||
|
class: $props.showTitle ? 'q-py-sm' : 'q-px-md q-py-xs fit',
|
||||||
|
'toggle-indeterminate': true,
|
||||||
|
size: 'sm',
|
||||||
|
},
|
||||||
|
forceAttrs,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
async function addFilter(value, name) {
|
async function addFilter(value, name) {
|
||||||
|
@ -132,19 +143,8 @@ async function addFilter(value, name) {
|
||||||
await arrayData.addFilter({ params: { [field]: value } });
|
await arrayData.addFilter({ params: { [field]: value } });
|
||||||
}
|
}
|
||||||
|
|
||||||
function alignRow() {
|
|
||||||
switch ($props.column.align) {
|
|
||||||
case 'left':
|
|
||||||
return 'justify-start items-start';
|
|
||||||
case 'right':
|
|
||||||
return 'justify-end items-end';
|
|
||||||
default:
|
|
||||||
return 'flex-center';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const showFilter = computed(
|
const showFilter = computed(
|
||||||
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
|
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions',
|
||||||
);
|
);
|
||||||
|
|
||||||
const onTabPressed = async () => {
|
const onTabPressed = async () => {
|
||||||
|
@ -152,13 +152,8 @@ const onTabPressed = async () => {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div v-if="showFilter" class="full-width" style="overflow: hidden">
|
||||||
v-if="showFilter"
|
<VnColumn
|
||||||
class="full-width"
|
|
||||||
:class="alignRow()"
|
|
||||||
style="max-height: 45px; overflow: hidden"
|
|
||||||
>
|
|
||||||
<VnTableColumn
|
|
||||||
:column="$props.column"
|
:column="$props.column"
|
||||||
default="input"
|
default="input"
|
||||||
v-model="model"
|
v-model="model"
|
||||||
|
@ -168,3 +163,8 @@ const onTabPressed = async () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
label.vn-label-padding > .q-field__inner > .q-field__control {
|
||||||
|
padding: inherit !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -23,6 +23,10 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
align: {
|
||||||
|
type: String,
|
||||||
|
default: 'end',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const hover = ref();
|
const hover = ref();
|
||||||
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl });
|
||||||
|
@ -41,55 +45,78 @@ async function orderBy(name, direction) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!direction) return await arrayData.deleteOrder(name);
|
if (!direction) return await arrayData.deleteOrder(name);
|
||||||
|
|
||||||
await arrayData.addOrder(name, direction);
|
await arrayData.addOrder(name, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ orderBy });
|
defineExpose({ orderBy });
|
||||||
|
|
||||||
|
function textAlignToFlex(textAlign) {
|
||||||
|
return `justify-content: ${
|
||||||
|
{
|
||||||
|
'text-center': 'center',
|
||||||
|
'text-left': 'start',
|
||||||
|
'text-right': 'end',
|
||||||
|
}[textAlign] || 'start'
|
||||||
|
};`;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
@mouseenter="hover = true"
|
@mouseenter="hover = true"
|
||||||
@mouseleave="hover = false"
|
@mouseleave="hover = false"
|
||||||
@click="orderBy(name, model?.direction)"
|
@click="orderBy(name, model?.direction)"
|
||||||
class="row items-center no-wrap cursor-pointer"
|
class="items-center no-wrap cursor-pointer title"
|
||||||
|
:style="textAlignToFlex(align)"
|
||||||
>
|
>
|
||||||
<span :title="label">{{ label }}</span>
|
<span :title="label">{{ label }}</span>
|
||||||
<QChip
|
<div v-if="name && model?.index">
|
||||||
v-if="name"
|
<QChip
|
||||||
:label="!vertical ? model?.index : ''"
|
:label="!vertical ? model?.index : ''"
|
||||||
:icon="
|
:icon="
|
||||||
(model?.index || hover) && !vertical
|
(model?.index || hover) && !vertical
|
||||||
? model?.direction == 'DESC'
|
? model?.direction == 'DESC'
|
||||||
? 'arrow_downward'
|
? 'arrow_downward'
|
||||||
: 'arrow_upward'
|
: 'arrow_upward'
|
||||||
: undefined
|
: undefined
|
||||||
"
|
"
|
||||||
:size="vertical ? '' : 'sm'"
|
:size="vertical ? '' : 'sm'"
|
||||||
:class="[
|
:class="[
|
||||||
model?.index ? 'color-vn-text' : 'bg-transparent',
|
model?.index ? 'color-vn-text' : 'bg-transparent',
|
||||||
vertical ? 'q-px-none' : '',
|
vertical ? 'q-px-none' : '',
|
||||||
]"
|
]"
|
||||||
class="no-box-shadow"
|
class="no-box-shadow"
|
||||||
:clickable="true"
|
:clickable="true"
|
||||||
style="min-width: 40px"
|
style="min-width: 40px; max-height: 30px"
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="column flex-center"
|
|
||||||
v-if="vertical"
|
|
||||||
:style="!model?.index && 'color: #5d5d5d'"
|
|
||||||
>
|
>
|
||||||
{{ model?.index }}
|
<div
|
||||||
<QIcon
|
class="column flex-center"
|
||||||
:name="
|
v-if="vertical"
|
||||||
model?.index
|
:style="!model?.index && 'color: #5d5d5d'"
|
||||||
? model?.direction == 'DESC'
|
>
|
||||||
? 'arrow_downward'
|
{{ model?.index }}
|
||||||
: 'arrow_upward'
|
<QIcon
|
||||||
: 'swap_vert'
|
:name="
|
||||||
"
|
model?.index
|
||||||
size="xs"
|
? model?.direction == 'DESC'
|
||||||
/>
|
? 'arrow_downward'
|
||||||
</div>
|
: 'arrow_upward'
|
||||||
</QChip>
|
: 'swap_vert'
|
||||||
|
"
|
||||||
|
size="xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</QChip>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 30px;
|
||||||
|
width: 100%;
|
||||||
|
color: var(--vn-label-color);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -1,22 +1,38 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onBeforeMount, onMounted, computed, watch, useAttrs } from 'vue';
|
import {
|
||||||
|
ref,
|
||||||
|
onBeforeMount,
|
||||||
|
onMounted,
|
||||||
|
onUnmounted,
|
||||||
|
computed,
|
||||||
|
watch,
|
||||||
|
h,
|
||||||
|
render,
|
||||||
|
inject,
|
||||||
|
useAttrs,
|
||||||
|
nextTick,
|
||||||
|
} from 'vue';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar, date } from 'quasar';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useFilterParams } from 'src/composables/useFilterParams';
|
import { useFilterParams } from 'src/composables/useFilterParams';
|
||||||
|
import { dashIfEmpty, toDate } from 'src/filters';
|
||||||
|
|
||||||
import CrudModel from 'src/components/CrudModel.vue';
|
import CrudModel from 'src/components/CrudModel.vue';
|
||||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||||
|
|
||||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
import VnColumn from 'components/VnTable/VnColumn.vue';
|
||||||
import VnFilter from 'components/VnTable/VnFilter.vue';
|
import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||||
import VnTableChip from 'components/VnTable/VnChip.vue';
|
import VnTableChip from 'components/VnTable/VnChip.vue';
|
||||||
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||||
import VnTableFilter from './VnTableFilter.vue';
|
import VnTableFilter from './VnTableFilter.vue';
|
||||||
|
import { getColAlign } from 'src/composables/getColAlign';
|
||||||
|
|
||||||
|
const arrayData = useArrayData(useAttrs()['data-key']);
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
columns: {
|
columns: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
@ -42,10 +58,6 @@ const $props = defineProps({
|
||||||
type: [Function, Boolean],
|
type: [Function, Boolean],
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
rowCtrlClick: {
|
|
||||||
type: [Function, Boolean],
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
redirect: {
|
redirect: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -114,7 +126,19 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
withFilters: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
overlay: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
createComplement: {
|
||||||
|
type: Object,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -132,10 +156,17 @@ const showForm = ref(false);
|
||||||
const splittedColumns = ref({ columns: [] });
|
const splittedColumns = ref({ columns: [] });
|
||||||
const columnsVisibilitySkipped = ref();
|
const columnsVisibilitySkipped = ref();
|
||||||
const createForm = ref();
|
const createForm = ref();
|
||||||
|
const createRef = ref(null);
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const params = ref(useFilterParams($attrs['data-key']).params);
|
const params = ref(useFilterParams($attrs['data-key']).params);
|
||||||
const orders = ref(useFilterParams($attrs['data-key']).orders);
|
const orders = ref(useFilterParams($attrs['data-key']).orders);
|
||||||
|
const app = inject('app');
|
||||||
|
|
||||||
|
const editingRow = ref(null);
|
||||||
|
const editingField = ref(null);
|
||||||
|
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||||
|
const selectRegex = /select/;
|
||||||
|
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||||
const tableModes = [
|
const tableModes = [
|
||||||
{
|
{
|
||||||
icon: 'view_column',
|
icon: 'view_column',
|
||||||
|
@ -156,7 +187,8 @@ onBeforeMount(() => {
|
||||||
hasParams.value = urlParams && Object.keys(urlParams).length !== 0;
|
hasParams.value = urlParams && Object.keys(urlParams).length !== 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
|
if ($props.isEditable) document.addEventListener('click', clickHandler);
|
||||||
mode.value =
|
mode.value =
|
||||||
quasar.platform.is.mobile && !$props.disableOption?.card
|
quasar.platform.is.mobile && !$props.disableOption?.card
|
||||||
? CARD_MODE
|
? CARD_MODE
|
||||||
|
@ -178,14 +210,25 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(async () => {
|
||||||
|
if ($props.isEditable) document.removeEventListener('click', clickHandler);
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => $props.columns,
|
() => $props.columns,
|
||||||
(value) => splitColumns(value),
|
(value) => splitColumns(value),
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
defineExpose({
|
||||||
const showRightIcon = computed(() => $props.rightSearch || $props.rightSearchIcon);
|
create: createForm,
|
||||||
|
reload,
|
||||||
|
redirect: redirectFn,
|
||||||
|
selected,
|
||||||
|
CrudModelRef,
|
||||||
|
params,
|
||||||
|
tableRef,
|
||||||
|
});
|
||||||
|
|
||||||
function splitColumns(columns) {
|
function splitColumns(columns) {
|
||||||
splittedColumns.value = {
|
splittedColumns.value = {
|
||||||
|
@ -231,16 +274,6 @@ const rowClickFunction = computed(() => {
|
||||||
return () => {};
|
return () => {};
|
||||||
});
|
});
|
||||||
|
|
||||||
const rowCtrlClickFunction = computed(() => {
|
|
||||||
if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick;
|
|
||||||
if ($props.redirect)
|
|
||||||
return (evt, { id }) => {
|
|
||||||
stopEventPropagation(evt);
|
|
||||||
window.open(`/#/${$props.redirect}/${id}`, '_blank');
|
|
||||||
};
|
|
||||||
return () => {};
|
|
||||||
});
|
|
||||||
|
|
||||||
function redirectFn(id) {
|
function redirectFn(id) {
|
||||||
router.push({ path: `/${$props.redirect}/${id}` });
|
router.push({ path: `/${$props.redirect}/${id}` });
|
||||||
}
|
}
|
||||||
|
@ -262,21 +295,6 @@ function columnName(col) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getColAlign(col) {
|
|
||||||
return 'text-' + (col.align ?? 'left');
|
|
||||||
}
|
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
|
||||||
defineExpose({
|
|
||||||
create: createForm,
|
|
||||||
reload,
|
|
||||||
redirect: redirectFn,
|
|
||||||
selected,
|
|
||||||
CrudModelRef,
|
|
||||||
params,
|
|
||||||
tableRef,
|
|
||||||
});
|
|
||||||
|
|
||||||
function handleOnDataSaved(_) {
|
function handleOnDataSaved(_) {
|
||||||
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
|
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
|
||||||
else $props.create.onDataSaved(_);
|
else $props.create.onDataSaved(_);
|
||||||
|
@ -305,6 +323,237 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isEditableColumn(column) {
|
||||||
|
const isEditableCol = column?.isEditable ?? true;
|
||||||
|
const isVisible = column?.visible ?? true;
|
||||||
|
const hasComponent = column?.component;
|
||||||
|
|
||||||
|
return $props.isEditable && isVisible && hasComponent && isEditableCol;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasEditableFormat(column) {
|
||||||
|
if (isEditableColumn(column)) return 'editable-text';
|
||||||
|
}
|
||||||
|
|
||||||
|
const clickHandler = async (event) => {
|
||||||
|
const clickedElement = event.target.closest('td');
|
||||||
|
|
||||||
|
const isDateElement = event.target.closest('.q-date');
|
||||||
|
const isTimeElement = event.target.closest('.q-time');
|
||||||
|
const isQselectDropDown = event.target.closest('.q-select__dropdown-icon');
|
||||||
|
|
||||||
|
if (isDateElement || isTimeElement || isQselectDropDown) return;
|
||||||
|
|
||||||
|
if (clickedElement === null) {
|
||||||
|
await destroyInput(editingRow.value, editingField.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const rowIndex = clickedElement.getAttribute('data-row-index');
|
||||||
|
const colField = clickedElement.getAttribute('data-col-field');
|
||||||
|
const column = $props.columns.find((col) => col.name === colField);
|
||||||
|
|
||||||
|
if (editingRow.value !== null && editingField.value !== null) {
|
||||||
|
if (editingRow.value == rowIndex && editingField.value == colField) return;
|
||||||
|
|
||||||
|
await destroyInput(editingRow.value, editingField.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEditableColumn(column)) {
|
||||||
|
await renderInput(Number(rowIndex), colField, clickedElement);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
async function handleTabKey(event, rowIndex, colField) {
|
||||||
|
if (editingRow.value == rowIndex && editingField.value == colField)
|
||||||
|
await destroyInput(editingRow.value, editingField.value);
|
||||||
|
|
||||||
|
const direction = event.shiftKey ? -1 : 1;
|
||||||
|
const { nextRowIndex, nextColumnName } = await handleTabNavigation(
|
||||||
|
rowIndex,
|
||||||
|
colField,
|
||||||
|
direction,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (nextRowIndex < 0 || nextRowIndex >= arrayData.store.data.length) return;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
await renderInput(nextRowIndex, nextColumnName, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function renderInput(rowId, field, clickedElement) {
|
||||||
|
editingField.value = field;
|
||||||
|
editingRow.value = rowId;
|
||||||
|
|
||||||
|
const originalColumn = $props.columns.find((col) => col.name === field);
|
||||||
|
const column = { ...originalColumn, ...{ label: '' } };
|
||||||
|
const row = CrudModelRef.value.formData[rowId];
|
||||||
|
const oldValue = CrudModelRef.value.formData[rowId][column?.name];
|
||||||
|
|
||||||
|
if (!clickedElement)
|
||||||
|
clickedElement = document.querySelector(
|
||||||
|
`[data-row-index="${rowId}"][data-col-field="${field}"]`,
|
||||||
|
);
|
||||||
|
|
||||||
|
Array.from(clickedElement.childNodes).forEach((child) => {
|
||||||
|
child.style.visibility = 'hidden';
|
||||||
|
child.style.position = 'relative';
|
||||||
|
});
|
||||||
|
|
||||||
|
const isSelect = selectRegex.test(column?.component);
|
||||||
|
if (isSelect) column.attrs = { ...column.attrs, 'emit-value': false };
|
||||||
|
|
||||||
|
const node = h(VnColumn, {
|
||||||
|
row: row,
|
||||||
|
class: 'temp-input',
|
||||||
|
column: column,
|
||||||
|
modelValue: row[column.name],
|
||||||
|
componentProp: 'columnField',
|
||||||
|
autofocus: true,
|
||||||
|
focusOnMount: true,
|
||||||
|
eventHandlers: {
|
||||||
|
'update:modelValue': async (value) => {
|
||||||
|
if (isSelect && value) {
|
||||||
|
row[column.name] = value[column.attrs?.optionValue ?? 'id'];
|
||||||
|
row[column?.name + 'TextValue'] =
|
||||||
|
value[column.attrs?.optionLabel ?? 'name'];
|
||||||
|
await column?.cellEvent?.['update:modelValue']?.(
|
||||||
|
value,
|
||||||
|
oldValue,
|
||||||
|
row,
|
||||||
|
);
|
||||||
|
} else row[column.name] = value;
|
||||||
|
await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row);
|
||||||
|
},
|
||||||
|
keyup: async (event) => {
|
||||||
|
if (event.key === 'Enter')
|
||||||
|
await destroyInput(rowIndex, field, clickedElement);
|
||||||
|
},
|
||||||
|
keydown: async (event) => {
|
||||||
|
switch (event.key) {
|
||||||
|
case 'Tab':
|
||||||
|
await handleTabKey(event, rowId, field);
|
||||||
|
event.stopPropagation();
|
||||||
|
break;
|
||||||
|
case 'Escape':
|
||||||
|
await destroyInput(rowId, field, clickedElement);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
click: (event) => {
|
||||||
|
column?.cellEvent?.['click']?.(event, row);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
node.appContext = app._context;
|
||||||
|
render(node, clickedElement);
|
||||||
|
|
||||||
|
if (['toggle'].includes(column?.component))
|
||||||
|
node.el?.querySelector('span > div').focus();
|
||||||
|
|
||||||
|
if (['checkbox', undefined].includes(column?.component))
|
||||||
|
node.el?.querySelector('span > div > div').focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function destroyInput(rowIndex, field, clickedElement) {
|
||||||
|
if (!clickedElement)
|
||||||
|
clickedElement = document.querySelector(
|
||||||
|
`[data-row-index="${rowIndex}"][data-col-field="${field}"]`,
|
||||||
|
);
|
||||||
|
if (clickedElement) {
|
||||||
|
await nextTick();
|
||||||
|
render(null, clickedElement);
|
||||||
|
Array.from(clickedElement.childNodes).forEach((child) => {
|
||||||
|
child.style.visibility = 'visible';
|
||||||
|
child.style.position = '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (editingRow.value !== rowIndex || editingField.value !== field) return;
|
||||||
|
editingRow.value = null;
|
||||||
|
editingField.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleTabNavigation(rowIndex, colName, direction) {
|
||||||
|
const columns = $props.columns;
|
||||||
|
const totalColumns = columns.length;
|
||||||
|
let currentColumnIndex = columns.findIndex((col) => col.name === colName);
|
||||||
|
|
||||||
|
let iterations = 0;
|
||||||
|
let newColumnIndex = currentColumnIndex;
|
||||||
|
|
||||||
|
do {
|
||||||
|
iterations++;
|
||||||
|
newColumnIndex = (newColumnIndex + direction + totalColumns) % totalColumns;
|
||||||
|
|
||||||
|
if (isEditableColumn(columns[newColumnIndex])) break;
|
||||||
|
} while (iterations < totalColumns);
|
||||||
|
|
||||||
|
if (iterations >= totalColumns + 1) return;
|
||||||
|
|
||||||
|
if (direction === 1 && newColumnIndex <= currentColumnIndex) {
|
||||||
|
rowIndex++;
|
||||||
|
} else if (direction === -1 && newColumnIndex >= currentColumnIndex) {
|
||||||
|
rowIndex--;
|
||||||
|
}
|
||||||
|
return { nextRowIndex: rowIndex, nextColumnName: columns[newColumnIndex].name };
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCheckboxIcon(value) {
|
||||||
|
switch (typeof value) {
|
||||||
|
case 'boolean':
|
||||||
|
return value ? 'check' : 'close';
|
||||||
|
case 'number':
|
||||||
|
return value === 0 ? 'close' : 'check';
|
||||||
|
case 'undefined':
|
||||||
|
return 'indeterminate_check_box';
|
||||||
|
default:
|
||||||
|
return 'indeterminate_check_box';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getToggleIcon(value) {
|
||||||
|
if (value === null) return 'help_outline';
|
||||||
|
return value ? 'toggle_on' : 'toggle_off';
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatColumnValue(col, row, dashIfEmpty) {
|
||||||
|
if (col?.format || row[col?.name + 'TextValue']) {
|
||||||
|
if (selectRegex.test(col?.component) && row[col?.name + 'TextValue']) {
|
||||||
|
return dashIfEmpty(row[col?.name + 'TextValue']);
|
||||||
|
} else {
|
||||||
|
return col.format(row, dashIfEmpty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (col?.component === 'date') return dashIfEmpty(toDate(row[col?.name]));
|
||||||
|
|
||||||
|
if (col?.component === 'time')
|
||||||
|
return row[col?.name] >= 5
|
||||||
|
? dashIfEmpty(date.formatDate(new Date(row[col?.name]), 'HH:mm'))
|
||||||
|
: row[col?.name];
|
||||||
|
|
||||||
|
if (selectRegex.test(col?.component) && $props.isEditable) {
|
||||||
|
const { find, url } = col.attrs;
|
||||||
|
const urlRelation = url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
||||||
|
|
||||||
|
if (col?.attrs.options) {
|
||||||
|
const find = col?.attrs.options.find((option) => option.id === row[col.name]);
|
||||||
|
if (!col.attrs?.optionLabel || !find) return dashIfEmpty(row[col?.name]);
|
||||||
|
return dashIfEmpty(find[col.attrs?.optionLabel ?? 'name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof row[urlRelation] == 'object') {
|
||||||
|
if (typeof find == 'object')
|
||||||
|
return dashIfEmpty(row[urlRelation][find?.label ?? 'name']);
|
||||||
|
|
||||||
|
return dashIfEmpty(row[urlRelation][col?.attrs.optionLabel ?? 'name']);
|
||||||
|
}
|
||||||
|
if (typeof row[urlRelation] == 'string') return dashIfEmpty(row[urlRelation]);
|
||||||
|
}
|
||||||
|
return dashIfEmpty(row[col?.name]);
|
||||||
|
}
|
||||||
function cardClick(_, row) {
|
function cardClick(_, row) {
|
||||||
if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` });
|
if ($props.redirect) router.push({ path: `/${$props.redirect}/${row.id}` });
|
||||||
}
|
}
|
||||||
|
@ -315,7 +564,7 @@ function cardClick(_, row) {
|
||||||
v-model="stateStore.rightDrawer"
|
v-model="stateStore.rightDrawer"
|
||||||
side="right"
|
side="right"
|
||||||
:width="256"
|
:width="256"
|
||||||
show-if-above
|
:overlay="$props.overlay"
|
||||||
>
|
>
|
||||||
<QScrollArea class="fit">
|
<QScrollArea class="fit">
|
||||||
<VnTableFilter
|
<VnTableFilter
|
||||||
|
@ -336,7 +585,7 @@ function cardClick(_, row) {
|
||||||
<CrudModel
|
<CrudModel
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
:class="$attrs['class'] ?? 'q-px-md'"
|
:class="$attrs['class'] ?? 'q-px-md'"
|
||||||
:limit="$attrs['limit'] ?? 20"
|
:limit="$attrs['limit'] ?? 100"
|
||||||
ref="CrudModelRef"
|
ref="CrudModelRef"
|
||||||
@on-fetch="(...args) => emit('onFetch', ...args)"
|
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
|
@ -352,8 +601,12 @@ function cardClick(_, row) {
|
||||||
<QTable
|
<QTable
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
v-bind="table"
|
v-bind="table"
|
||||||
class="vnTable"
|
:class="[
|
||||||
:class="{ 'last-row-sticky': $props.footer }"
|
'vnTable',
|
||||||
|
table ? 'selection-cell' : '',
|
||||||
|
$props.footer ? 'last-row-sticky' : '',
|
||||||
|
]"
|
||||||
|
wrap-cells
|
||||||
:columns="splittedColumns.columns"
|
:columns="splittedColumns.columns"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
v-model:selected="selected"
|
v-model:selected="selected"
|
||||||
|
@ -367,11 +620,13 @@ function cardClick(_, row) {
|
||||||
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
@row-click="(_, row) => rowClickFunction && rowClickFunction(row)"
|
||||||
@update:selected="emit('update:selected', $event)"
|
@update:selected="emit('update:selected', $event)"
|
||||||
@selection="(details) => handleSelection(details, rows)"
|
@selection="(details) => handleSelection(details, rows)"
|
||||||
|
:hide-selected-banner="true"
|
||||||
>
|
>
|
||||||
<template #top-left v-if="!$props.withoutHeader">
|
<template #top-left v-if="!$props.withoutHeader">
|
||||||
<slot name="top-left"></slot>
|
<slot name="top-left"> </slot>
|
||||||
</template>
|
</template>
|
||||||
<template #top-right v-if="!$props.withoutHeader">
|
<template #top-right v-if="!$props.withoutHeader">
|
||||||
|
<slot name="top-right"></slot>
|
||||||
<VnVisibleColumn
|
<VnVisibleColumn
|
||||||
v-if="isTableMode"
|
v-if="isTableMode"
|
||||||
v-model="splittedColumns.columns"
|
v-model="splittedColumns.columns"
|
||||||
|
@ -385,43 +640,43 @@ function cardClick(_, row) {
|
||||||
dense
|
dense
|
||||||
:options="tableModes.filter((mode) => !mode.disable)"
|
:options="tableModes.filter((mode) => !mode.disable)"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
|
||||||
v-if="showRightIcon"
|
|
||||||
icon="filter_alt"
|
|
||||||
class="bg-vn-section-color q-ml-sm"
|
|
||||||
dense
|
|
||||||
@click="stateStore.toggleRightDrawer()"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<template #header-cell="{ col }">
|
<template #header-cell="{ col }">
|
||||||
<QTh
|
<QTh
|
||||||
v-if="col.visible ?? true"
|
v-if="col.visible ?? true"
|
||||||
:style="col.headerStyle"
|
v-bind:class="col.headerClass"
|
||||||
:class="col.headerClass"
|
class="body-cell"
|
||||||
|
:style="col?.width ? `max-width: ${col?.width}` : ''"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="column ellipsis"
|
class="no-padding"
|
||||||
:class="`text-${col?.align ?? 'left'}`"
|
:style="[
|
||||||
:style="$props.columnSearch ? 'height: 75px' : ''"
|
withFilters && $props.columnSearch ? 'height: 75px' : '',
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<div class="row items-center no-wrap" style="height: 30px">
|
<div style="height: 30px">
|
||||||
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip>
|
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip>
|
||||||
<VnTableOrder
|
<VnTableOrder
|
||||||
v-model="orders[col.orderBy ?? col.name]"
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
:name="col.orderBy ?? col.name"
|
:name="col.orderBy ?? col.name"
|
||||||
:label="col?.label"
|
:label="col?.labelAbbreviation ?? col?.label"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
|
:align="getColAlign(col)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<VnFilter
|
<VnFilter
|
||||||
v-if="$props.columnSearch"
|
v-if="
|
||||||
|
$props.columnSearch &&
|
||||||
|
col.columnSearch !== false &&
|
||||||
|
withFilters
|
||||||
|
"
|
||||||
:column="col"
|
:column="col"
|
||||||
:show-title="true"
|
:show-title="true"
|
||||||
:data-key="$attrs['data-key']"
|
:data-key="$attrs['data-key']"
|
||||||
v-model="params[columnName(col)]"
|
v-model="params[columnName(col)]"
|
||||||
:search-url="searchUrl"
|
:search-url="searchUrl"
|
||||||
class="full-width"
|
customClass="header-filter"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</QTh>
|
</QTh>
|
||||||
|
@ -439,32 +694,67 @@ function cardClick(_, row) {
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell="{ col, row, rowIndex }">
|
<template #body-cell="{ col, row, rowIndex }">
|
||||||
<!-- Columns -->
|
|
||||||
<QTd
|
<QTd
|
||||||
auto-width
|
class="no-margin q-px-xs"
|
||||||
class="no-margin"
|
|
||||||
:class="[getColAlign(col), col.columnClass]"
|
|
||||||
:style="col.style"
|
|
||||||
v-if="col.visible ?? true"
|
v-if="col.visible ?? true"
|
||||||
@click.ctrl="
|
:style="{
|
||||||
($event) =>
|
'max-width': col?.width ?? false,
|
||||||
rowCtrlClickFunction && rowCtrlClickFunction($event, row)
|
position: 'relative',
|
||||||
"
|
}"
|
||||||
|
:class="[
|
||||||
|
col.columnClass,
|
||||||
|
'body-cell no-margin no-padding',
|
||||||
|
getColAlign(col),
|
||||||
|
]"
|
||||||
|
:data-row-index="rowIndex"
|
||||||
|
:data-col-field="col?.name"
|
||||||
>
|
>
|
||||||
<slot
|
<div
|
||||||
:name="`column-${col.name}`"
|
class="no-padding no-margin peter"
|
||||||
:col="col"
|
style="
|
||||||
:row="row"
|
overflow: hidden;
|
||||||
:row-index="rowIndex"
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<VnTableColumn
|
<slot
|
||||||
:column="col"
|
:name="`column-${col.name}`"
|
||||||
|
:col="col"
|
||||||
:row="row"
|
:row="row"
|
||||||
:is-editable="col.isEditable ?? isEditable"
|
:row-index="rowIndex"
|
||||||
v-model="row[col.name]"
|
>
|
||||||
component-prop="columnField"
|
<QIcon
|
||||||
/>
|
v-if="col?.component === 'toggle'"
|
||||||
</slot>
|
:name="
|
||||||
|
col?.getIcon
|
||||||
|
? col.getIcon(row[col?.name])
|
||||||
|
: getToggleIcon(row[col?.name])
|
||||||
|
"
|
||||||
|
style="color: var(--vn-text-color)"
|
||||||
|
:class="hasEditableFormat(col)"
|
||||||
|
size="14px"
|
||||||
|
/>
|
||||||
|
<QIcon
|
||||||
|
v-else-if="col?.component === 'checkbox'"
|
||||||
|
:name="getCheckboxIcon(row[col?.name])"
|
||||||
|
style="color: var(--vn-text-color)"
|
||||||
|
:class="hasEditableFormat(col)"
|
||||||
|
size="14px"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
v-else
|
||||||
|
:class="hasEditableFormat(col)"
|
||||||
|
:style="
|
||||||
|
typeof col?.style == 'function'
|
||||||
|
? col.style(row)
|
||||||
|
: col?.style
|
||||||
|
"
|
||||||
|
style="bottom: 0"
|
||||||
|
>
|
||||||
|
{{ formatColumnValue(col, row, dashIfEmpty) }}
|
||||||
|
</span>
|
||||||
|
</slot>
|
||||||
|
</div>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-tableActions="{ col, row }">
|
<template #body-cell-tableActions="{ col, row }">
|
||||||
|
@ -485,7 +775,7 @@ function cardClick(_, row) {
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
:class="
|
:class="
|
||||||
btn.isPrimary ? 'text-primary-light' : 'color-vn-text '
|
btn.isPrimary ? 'text-primary-light' : 'color-vn-label'
|
||||||
"
|
"
|
||||||
:style="`visibility: ${
|
:style="`visibility: ${
|
||||||
((btn.show && btn.show(row)) ?? true)
|
((btn.show && btn.show(row)) ?? true)
|
||||||
|
@ -493,6 +783,7 @@ function cardClick(_, row) {
|
||||||
: 'hidden'
|
: 'hidden'
|
||||||
}`"
|
}`"
|
||||||
@click="btn.action(row)"
|
@click="btn.action(row)"
|
||||||
|
:data-cy="btn?.name ?? `tableAction-${index}`"
|
||||||
/>
|
/>
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
|
@ -541,7 +832,7 @@ function cardClick(_, row) {
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<!-- Fields -->
|
<!-- Fields -->
|
||||||
<QCardSection
|
<QCardSection
|
||||||
class="q-pl-sm q-pr-lg q-py-xs"
|
class="q-pl-sm q-py-xs"
|
||||||
:class="$props.cardClass"
|
:class="$props.cardClass"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -562,7 +853,7 @@ function cardClick(_, row) {
|
||||||
:row="row"
|
:row="row"
|
||||||
:row-index="index"
|
:row-index="index"
|
||||||
>
|
>
|
||||||
<VnTableColumn
|
<VnColumn
|
||||||
:column="col"
|
:column="col"
|
||||||
:row="row"
|
:row="row"
|
||||||
:is-editable="false"
|
:is-editable="false"
|
||||||
|
@ -588,13 +879,14 @@ function cardClick(_, row) {
|
||||||
:key="index"
|
:key="index"
|
||||||
:title="btn.title"
|
:title="btn.title"
|
||||||
:icon="btn.icon"
|
:icon="btn.icon"
|
||||||
|
data-cy="cardBtn"
|
||||||
class="q-pa-xs"
|
class="q-pa-xs"
|
||||||
flat
|
|
||||||
:class="
|
:class="
|
||||||
btn.isPrimary
|
btn.isPrimary
|
||||||
? 'text-primary-light'
|
? 'text-primary-light'
|
||||||
: 'color-vn-text '
|
: 'color-vn-label'
|
||||||
"
|
"
|
||||||
|
flat
|
||||||
@click="btn.action(row)"
|
@click="btn.action(row)"
|
||||||
/>
|
/>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
|
@ -602,14 +894,17 @@ function cardClick(_, row) {
|
||||||
</component>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
<template #bottom-row="{ cols }" v-if="$props.footer">
|
<template #bottom-row="{ cols }" v-if="$props.footer">
|
||||||
<QTr v-if="rows.length" style="height: 30px">
|
<QTr v-if="rows.length" style="height: 45px">
|
||||||
|
<QTh v-if="table.selection" />
|
||||||
<QTh
|
<QTh
|
||||||
v-for="col of cols.filter((cols) => cols.visible ?? true)"
|
v-for="col of cols.filter((cols) => cols.visible ?? true)"
|
||||||
:key="col?.id"
|
:key="col?.id"
|
||||||
class="text-center"
|
|
||||||
:class="getColAlign(col)"
|
:class="getColAlign(col)"
|
||||||
>
|
>
|
||||||
<slot :name="`column-footer-${col.name}`" />
|
<slot
|
||||||
|
:name="`column-footer-${col.name}`"
|
||||||
|
:isEditableColumn="isEditableColumn(col)"
|
||||||
|
/>
|
||||||
</QTh>
|
</QTh>
|
||||||
</QTr>
|
</QTr>
|
||||||
</template>
|
</template>
|
||||||
|
@ -628,7 +923,7 @@ function cardClick(_, row) {
|
||||||
size="md"
|
size="md"
|
||||||
round
|
round
|
||||||
flat
|
flat
|
||||||
shortcut="+"
|
v-shortcut="'+'"
|
||||||
:disabled="!disabledAttr"
|
:disabled="!disabledAttr"
|
||||||
/>
|
/>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
|
@ -646,39 +941,60 @@ function cardClick(_, row) {
|
||||||
color="primary"
|
color="primary"
|
||||||
fab
|
fab
|
||||||
icon="add"
|
icon="add"
|
||||||
shortcut="+"
|
v-shortcut="'+'"
|
||||||
data-cy="vnTableCreateBtn"
|
data-cy="vnTableCreateBtn"
|
||||||
/>
|
/>
|
||||||
<QTooltip self="top right">
|
<QTooltip self="top right">
|
||||||
{{ createForm?.title }}
|
{{ createForm?.title }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
<QDialog
|
||||||
|
v-model="showForm"
|
||||||
|
transition-show="scale"
|
||||||
|
transition-hide="scale"
|
||||||
|
:full-width="createComplement?.isFullWidth ?? false"
|
||||||
|
@before-hide="
|
||||||
|
() => {
|
||||||
|
if (createRef.isSaveAndContinue) {
|
||||||
|
showForm = true;
|
||||||
|
createForm.formInitialData = { ...create.formInitialData };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
|
data-cy="vn-table-create-dialog"
|
||||||
|
>
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
|
ref="createRef"
|
||||||
v-bind="createForm"
|
v-bind="createForm"
|
||||||
:model="$attrs['data-key'] + 'Create'"
|
:model="$attrs['data-key'] + 'Create'"
|
||||||
@on-data-saved="(_, res) => createForm.onDataSaved(res)"
|
@on-data-saved="(_, res) => createForm.onDataSaved(res)"
|
||||||
>
|
>
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
<div class="grid-create">
|
<div :style="createComplement?.containerStyle">
|
||||||
<slot
|
<div>
|
||||||
v-for="column of splittedColumns.create"
|
<slot name="previous-create-dialog" :data="data" />
|
||||||
:key="column.name"
|
</div>
|
||||||
:name="`column-create-${column.name}`"
|
<div class="grid-create" :style="createComplement?.columnGridStyle">
|
||||||
:data="data"
|
<slot
|
||||||
:column-name="column.name"
|
v-for="column of splittedColumns.create"
|
||||||
:label="column.label"
|
:key="column.name"
|
||||||
>
|
:name="`column-create-${column.name}`"
|
||||||
<VnTableColumn
|
:data="data"
|
||||||
:column="column"
|
:column-name="column.name"
|
||||||
:row="{}"
|
:label="column.label"
|
||||||
default="input"
|
>
|
||||||
v-model="data[column.name]"
|
<VnColumn
|
||||||
:show-label="true"
|
:column="column"
|
||||||
component-prop="columnCreate"
|
:row="{}"
|
||||||
/>
|
default="input"
|
||||||
</slot>
|
v-model="data[column.name]"
|
||||||
<slot name="more-create-dialog" :data="data" />
|
:show-label="true"
|
||||||
|
component-prop="columnCreate"
|
||||||
|
:data-cy="`${column.name}-create-popup`"
|
||||||
|
/>
|
||||||
|
</slot>
|
||||||
|
<slot name="more-create-dialog" :data="data" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</FormModelPopup>
|
</FormModelPopup>
|
||||||
|
@ -696,6 +1012,42 @@ es:
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
.selection-cell {
|
||||||
|
table td:first-child {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.side-padding {
|
||||||
|
padding-left: 1px;
|
||||||
|
padding-right: 1px;
|
||||||
|
}
|
||||||
|
.editable-text:hover {
|
||||||
|
border-bottom: 1px dashed var(--q-primary);
|
||||||
|
@extend .side-padding;
|
||||||
|
}
|
||||||
|
.editable-text {
|
||||||
|
border-bottom: 1px dashed var(--vn-label-color);
|
||||||
|
@extend .side-padding;
|
||||||
|
}
|
||||||
|
.cell-input {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
padding-top: 0px !important;
|
||||||
|
}
|
||||||
|
.q-field--labeled .q-field__native,
|
||||||
|
.q-field--labeled .q-field__prefix,
|
||||||
|
.q-field--labeled .q-field__suffix {
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-cell {
|
||||||
|
padding-left: 4px !important;
|
||||||
|
padding-right: 4px !important;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
.bg-chip-secondary {
|
.bg-chip-secondary {
|
||||||
background-color: var(--vn-page-color);
|
background-color: var(--vn-page-color);
|
||||||
color: var(--vn-text-color);
|
color: var(--vn-text-color);
|
||||||
|
@ -712,8 +1064,8 @@ es:
|
||||||
|
|
||||||
.grid-three {
|
.grid-three {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(350px, max-content));
|
grid-template-columns: repeat(auto-fit, minmax(300px, max-content));
|
||||||
max-width: 100%;
|
width: 100%;
|
||||||
grid-gap: 20px;
|
grid-gap: 20px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
@ -721,7 +1073,6 @@ es:
|
||||||
.grid-create {
|
.grid-create {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
|
grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
|
||||||
max-width: 100%;
|
|
||||||
grid-gap: 20px;
|
grid-gap: 20px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
@ -737,7 +1088,9 @@ es:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.q-table tbody tr td {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
.q-table {
|
.q-table {
|
||||||
th {
|
th {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -786,6 +1139,7 @@ es:
|
||||||
.vn-label-value {
|
.vn-label-value {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
color: var(--vn-text-color);
|
color: var(--vn-text-color);
|
||||||
.value {
|
.value {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -837,4 +1191,15 @@ es:
|
||||||
.q-table__middle.q-virtual-scroll.q-virtual-scroll--vertical.scroll {
|
.q-table__middle.q-virtual-scroll.q-virtual-scroll--vertical.scroll {
|
||||||
background-color: var(--vn-section-color);
|
background-color: var(--vn-section-color);
|
||||||
}
|
}
|
||||||
|
.temp-input {
|
||||||
|
top: 0;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
label.header-filter > .q-field__inner > .q-field__control {
|
||||||
|
padding: inherit;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -27,31 +27,36 @@ function columnName(col) {
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnFilterPanel v-bind="$attrs" :search-button="true" :disable-submit-event="true">
|
<VnFilterPanel v-bind="$attrs" :search-button="true" :disable-submit-event="true">
|
||||||
<template #body="{ params, orders }">
|
<template #body="{ params, orders, searchFn }">
|
||||||
<div
|
<div
|
||||||
class="row no-wrap flex-center"
|
class="container"
|
||||||
v-for="col of columns.filter((c) => c.columnFilter ?? true)"
|
v-for="col of columns.filter((c) => c.columnFilter ?? true)"
|
||||||
:key="col.id"
|
:key="col.id"
|
||||||
>
|
>
|
||||||
<VnFilter
|
<div class="filter">
|
||||||
ref="tableFilterRef"
|
<VnFilter
|
||||||
:column="col"
|
ref="tableFilterRef"
|
||||||
:data-key="$attrs['data-key']"
|
:column="col"
|
||||||
v-model="params[columnName(col)]"
|
:data-key="$attrs['data-key']"
|
||||||
:search-url="searchUrl"
|
v-model="params[columnName(col)]"
|
||||||
/>
|
:search-url="searchUrl"
|
||||||
<VnTableOrder
|
/>
|
||||||
v-if="col?.columnFilter !== false && col?.name !== 'tableActions'"
|
</div>
|
||||||
v-model="orders[col.orderBy ?? col.name]"
|
<div class="order">
|
||||||
:name="col.orderBy ?? col.name"
|
<VnTableOrder
|
||||||
:data-key="$attrs['data-key']"
|
v-if="col?.columnFilter !== false && col?.name !== 'tableActions'"
|
||||||
:search-url="searchUrl"
|
v-model="orders[col.orderBy ?? col.name]"
|
||||||
:vertical="true"
|
:name="col.orderBy ?? col.name"
|
||||||
/>
|
:data-key="$attrs['data-key']"
|
||||||
|
:search-url="searchUrl"
|
||||||
|
:vertical="true"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<slot
|
<slot
|
||||||
name="moreFilterPanel"
|
name="moreFilterPanel"
|
||||||
:params="params"
|
:params="params"
|
||||||
|
:search-fn="searchFn"
|
||||||
:orders="orders"
|
:orders="orders"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
/>
|
/>
|
||||||
|
@ -67,3 +72,21 @@ function columnName(col) {
|
||||||
</template>
|
</template>
|
||||||
</VnFilterPanel>
|
</VnFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 45px;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter {
|
||||||
|
width: 70%;
|
||||||
|
height: 40px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.order {
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -32,16 +32,21 @@ const areAllChecksMarked = computed(() => {
|
||||||
|
|
||||||
function setUserConfigViewData(data, isLocal) {
|
function setUserConfigViewData(data, isLocal) {
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
// Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config
|
|
||||||
if (!isLocal) localColumns.value = [];
|
if (!isLocal) localColumns.value = [];
|
||||||
// Array to Object
|
|
||||||
const skippeds = $props.skip.reduce((a, v) => ({ ...a, [v]: v }), {});
|
const skippeds = $props.skip.reduce((a, v) => ({ ...a, [v]: v }), {});
|
||||||
|
|
||||||
for (let column of columns.value) {
|
for (let column of columns.value) {
|
||||||
const { label, name } = column;
|
const { label, name, labelAbbreviation } = column;
|
||||||
if (skippeds[name]) continue;
|
if (skippeds[name]) continue;
|
||||||
column.visible = data[name] ?? true;
|
column.visible = data[name] ?? true;
|
||||||
if (!isLocal) localColumns.value.push({ name, label, visible: column.visible });
|
if (!isLocal)
|
||||||
|
localColumns.value.push({
|
||||||
|
name,
|
||||||
|
label,
|
||||||
|
labelAbbreviation,
|
||||||
|
visible: column.visible,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +157,11 @@ onMounted(async () => {
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-for="col in localColumns"
|
v-for="col in localColumns"
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:label="col.label ?? col.name"
|
:label="
|
||||||
|
col?.labelAbbreviation
|
||||||
|
? col.labelAbbreviation + ` (${col.label ?? col.name})`
|
||||||
|
: (col.label ?? col.name)
|
||||||
|
"
|
||||||
v-model="col.visible"
|
v-model="col.visible"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -57,6 +57,7 @@ describe('FormModel', () => {
|
||||||
vm.state.set(model, formInitialData);
|
vm.state.set(model, formInitialData);
|
||||||
expect(vm.hasChanges).toBe(false);
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
|
||||||
|
await vm.$nextTick();
|
||||||
vm.formData.mockKey = 'newVal';
|
vm.formData.mockKey = 'newVal';
|
||||||
await vm.$nextTick();
|
await vm.$nextTick();
|
||||||
expect(vm.hasChanges).toBe(true);
|
expect(vm.hasChanges).toBe(true);
|
||||||
|
@ -93,9 +94,13 @@ describe('FormModel', () => {
|
||||||
|
|
||||||
it('should call axios.patch with the right data', async () => {
|
it('should call axios.patch with the right data', async () => {
|
||||||
const spy = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
const spy = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||||
const { vm } = mount({ propsData: { url, model, formInitialData } });
|
const { vm } = mount({ propsData: { url, model } });
|
||||||
vm.formData.mockKey = 'newVal';
|
|
||||||
|
vm.formData = {};
|
||||||
await vm.$nextTick();
|
await vm.$nextTick();
|
||||||
|
vm.formData = { mockKey: 'newVal' };
|
||||||
|
await vm.$nextTick();
|
||||||
|
|
||||||
await vm.save();
|
await vm.save();
|
||||||
expect(spy).toHaveBeenCalled();
|
expect(spy).toHaveBeenCalled();
|
||||||
vm.formData.mockKey = 'mockVal';
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
@ -106,6 +111,7 @@ describe('FormModel', () => {
|
||||||
const { vm } = mount({
|
const { vm } = mount({
|
||||||
propsData: { url, model, formInitialData, urlCreate: 'mockUrlCreate' },
|
propsData: { url, model, formInitialData, urlCreate: 'mockUrlCreate' },
|
||||||
});
|
});
|
||||||
|
await vm.$nextTick();
|
||||||
vm.formData.mockKey = 'newVal';
|
vm.formData.mockKey = 'newVal';
|
||||||
await vm.$nextTick();
|
await vm.$nextTick();
|
||||||
await vm.save();
|
await vm.save();
|
||||||
|
@ -119,7 +125,7 @@ describe('FormModel', () => {
|
||||||
});
|
});
|
||||||
const spyPatch = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
const spyPatch = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||||
const spySaveFn = vi.spyOn(vm.$props, 'saveFn');
|
const spySaveFn = vi.spyOn(vm.$props, 'saveFn');
|
||||||
|
await vm.$nextTick();
|
||||||
vm.formData.mockKey = 'newVal';
|
vm.formData.mockKey = 'newVal';
|
||||||
await vm.$nextTick();
|
await vm.$nextTick();
|
||||||
await vm.save();
|
await vm.save();
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
import { vi, describe, expect, it, beforeAll } from 'vitest';
|
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
import Leftmenu from 'components/LeftMenu.vue';
|
import Leftmenu from 'components/LeftMenu.vue';
|
||||||
|
import * as vueRouter from 'vue-router';
|
||||||
import { useNavigationStore } from 'src/stores/useNavigationStore';
|
import { useNavigationStore } from 'src/stores/useNavigationStore';
|
||||||
|
|
||||||
|
let vm;
|
||||||
|
let navigation;
|
||||||
|
|
||||||
vi.mock('src/router/modules', () => ({
|
vi.mock('src/router/modules', () => ({
|
||||||
default: [
|
default: [
|
||||||
{
|
{
|
||||||
|
@ -21,6 +24,16 @@ vi.mock('src/router/modules', () => ({
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
name: 'CustomerMain',
|
name: 'CustomerMain',
|
||||||
|
meta: {
|
||||||
|
menu: 'Customer',
|
||||||
|
menuChildren: [
|
||||||
|
{
|
||||||
|
name: 'CustomerCreditContracts',
|
||||||
|
title: 'creditContracts',
|
||||||
|
icon: 'vn:solunion',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'list',
|
path: 'list',
|
||||||
|
@ -28,6 +41,13 @@ vi.mock('src/router/modules', () => ({
|
||||||
meta: {
|
meta: {
|
||||||
title: 'list',
|
title: 'list',
|
||||||
icon: 'view_list',
|
icon: 'view_list',
|
||||||
|
menuChildren: [
|
||||||
|
{
|
||||||
|
name: 'CustomerCreditContracts',
|
||||||
|
title: 'creditContracts',
|
||||||
|
icon: 'vn:solunion',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -44,51 +64,325 @@ vi.mock('src/router/modules', () => ({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}));
|
}));
|
||||||
|
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
|
||||||
describe('Leftmenu', () => {
|
matched: [
|
||||||
let vm;
|
{
|
||||||
let navigation;
|
path: '/',
|
||||||
beforeAll(() => {
|
redirect: {
|
||||||
vi.spyOn(axios, 'get').mockResolvedValue({
|
name: 'Dashboard',
|
||||||
data: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
vm = createWrapper(Leftmenu, {
|
|
||||||
propsData: {
|
|
||||||
source: 'main',
|
|
||||||
},
|
},
|
||||||
}).vm;
|
name: 'Main',
|
||||||
|
meta: {},
|
||||||
navigation = useNavigationStore();
|
props: {
|
||||||
navigation.fetchPinned = vi.fn().mockReturnValue(Promise.resolve(true));
|
default: false,
|
||||||
navigation.getModules = vi.fn().mockReturnValue({
|
},
|
||||||
value: [
|
children: [
|
||||||
{
|
{
|
||||||
name: 'customer',
|
path: '/dashboard',
|
||||||
title: 'customer.pageTitles.customers',
|
name: 'Dashboard',
|
||||||
icon: 'vn:customer',
|
meta: {
|
||||||
module: 'customer',
|
title: 'dashboard',
|
||||||
|
icon: 'dashboard',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/customer',
|
||||||
|
redirect: {
|
||||||
|
name: 'CustomerMain',
|
||||||
|
},
|
||||||
|
name: 'Customer',
|
||||||
|
meta: {
|
||||||
|
title: 'customers',
|
||||||
|
icon: 'vn:client',
|
||||||
|
moduleName: 'Customer',
|
||||||
|
keyBinding: 'c',
|
||||||
|
menu: 'customer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
query: {},
|
||||||
|
params: {},
|
||||||
|
meta: { moduleName: 'mockName' },
|
||||||
|
path: 'mockName/1',
|
||||||
|
name: 'Customer',
|
||||||
|
});
|
||||||
|
function mount(source = 'main') {
|
||||||
|
vi.spyOn(axios, 'get').mockResolvedValue({
|
||||||
|
data: [],
|
||||||
|
});
|
||||||
|
const wrapper = createWrapper(Leftmenu, {
|
||||||
|
propsData: {
|
||||||
|
source,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
navigation = useNavigationStore();
|
||||||
|
navigation.fetchPinned = vi.fn().mockReturnValue(Promise.resolve(true));
|
||||||
|
navigation.getModules = vi.fn().mockReturnValue({
|
||||||
|
value: [
|
||||||
|
{
|
||||||
|
name: 'customer',
|
||||||
|
title: 'customer.pageTitles.customers',
|
||||||
|
icon: 'vn:customer',
|
||||||
|
module: 'customer',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('getRoutes', () => {
|
||||||
|
afterEach(() => vi.clearAllMocks());
|
||||||
|
const getRoutes = vi.fn().mockImplementation((props, getMethodA, getMethodB) => {
|
||||||
|
const handleRoutes = {
|
||||||
|
methodA: getMethodA,
|
||||||
|
methodB: getMethodB,
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
handleRoutes[props.source]();
|
||||||
|
} catch (error) {
|
||||||
|
throw Error('Method not defined');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const getMethodA = vi.fn();
|
||||||
|
const getMethodB = vi.fn();
|
||||||
|
const fn = (props) => getRoutes(props, getMethodA, getMethodB);
|
||||||
|
|
||||||
|
it('should call getMethodB when source is card', () => {
|
||||||
|
let props = { source: 'methodB' };
|
||||||
|
fn(props);
|
||||||
|
|
||||||
|
expect(getMethodB).toHaveBeenCalled();
|
||||||
|
expect(getMethodA).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
it('should call getMethodA when source is main', () => {
|
||||||
|
let props = { source: 'methodA' };
|
||||||
|
fn(props);
|
||||||
|
|
||||||
|
expect(getMethodA).toHaveBeenCalled();
|
||||||
|
expect(getMethodB).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call getMethodA when source is not exists or undefined', () => {
|
||||||
|
let props = { source: 'methodC' };
|
||||||
|
expect(() => fn(props)).toThrowError('Method not defined');
|
||||||
|
|
||||||
|
expect(getMethodA).not.toHaveBeenCalled();
|
||||||
|
expect(getMethodB).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Leftmenu as card', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
vm = mount('card').vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should get routes for card source', async () => {
|
||||||
|
vm.getRoutes();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('Leftmenu as main', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
vm = mount().vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should initialize with default props', () => {
|
||||||
|
expect(vm.source).toBe('main');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should filter items based on search input', async () => {
|
||||||
|
vm.search = 'cust';
|
||||||
|
await vm.$nextTick();
|
||||||
|
expect(vm.filteredItems[0].name).toEqual('customer');
|
||||||
|
expect(vm.filteredItems[0].module).toEqual('customer');
|
||||||
|
});
|
||||||
|
it('should filter items based on search input', async () => {
|
||||||
|
vm.search = 'Rou';
|
||||||
|
await vm.$nextTick();
|
||||||
|
expect(vm.filteredItems).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return pinned items', () => {
|
||||||
|
vm.items = [
|
||||||
|
{ name: 'Item 1', isPinned: false },
|
||||||
|
{ name: 'Item 2', isPinned: true },
|
||||||
|
];
|
||||||
|
expect(vm.pinnedModules).toEqual(
|
||||||
|
new Map([['Item 2', { name: 'Item 2', isPinned: true }]]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should find matches in routes', () => {
|
||||||
|
const search = 'child1';
|
||||||
|
const item = {
|
||||||
|
children: [
|
||||||
|
{ name: 'child1', children: [] },
|
||||||
|
{ name: 'child2', children: [] },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const matches = vm.findMatches(search, item);
|
||||||
|
expect(matches).toEqual([{ name: 'child1', children: [] }]);
|
||||||
|
});
|
||||||
|
it('should not proceed if event is already prevented', async () => {
|
||||||
|
const item = { module: 'testModule', isPinned: false };
|
||||||
|
const event = {
|
||||||
|
preventDefault: vi.fn(),
|
||||||
|
stopPropagation: vi.fn(),
|
||||||
|
defaultPrevented: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
await vm.togglePinned(item, event);
|
||||||
|
|
||||||
|
expect(event.preventDefault).not.toHaveBeenCalled();
|
||||||
|
expect(event.stopPropagation).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call quasar.notify with success message', async () => {
|
||||||
|
const item = { module: 'testModule', isPinned: false };
|
||||||
|
const event = {
|
||||||
|
preventDefault: vi.fn(),
|
||||||
|
stopPropagation: vi.fn(),
|
||||||
|
defaultPrevented: false,
|
||||||
|
};
|
||||||
|
const response = { data: { id: 1 } };
|
||||||
|
|
||||||
|
vi.spyOn(axios, 'post').mockResolvedValue(response);
|
||||||
|
vi.spyOn(vm.quasar, 'notify');
|
||||||
|
|
||||||
|
await vm.togglePinned(item, event);
|
||||||
|
|
||||||
|
expect(vm.quasar.notify).toHaveBeenCalledWith({
|
||||||
|
message: 'Data saved',
|
||||||
|
type: 'positive',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a proper formated object with two child items', async () => {
|
it('should handle a single matched route with a menu', () => {
|
||||||
const expectedMenuItem = [
|
const route = {
|
||||||
{
|
matched: [{ meta: { menu: 'customer' } }],
|
||||||
children: null,
|
};
|
||||||
name: 'CustomerList',
|
|
||||||
title: 'globals.pageTitles.list',
|
const result = vm.betaGetRoutes();
|
||||||
icon: 'view_list',
|
|
||||||
},
|
expect(result.meta.menu).toEqual(route.matched[0].meta.menu);
|
||||||
{
|
});
|
||||||
children: null,
|
it('should get routes for main source', () => {
|
||||||
name: 'CustomerCreate',
|
vm.props.source = 'main';
|
||||||
title: 'globals.pageTitles.createCustomer',
|
vm.getRoutes();
|
||||||
icon: 'vn:addperson',
|
expect(navigation.getModules).toHaveBeenCalled();
|
||||||
},
|
});
|
||||||
];
|
|
||||||
const firstMenuItem = vm.items[0];
|
it('should find direct child matches', () => {
|
||||||
expect(firstMenuItem.children).toEqual(expect.arrayContaining(expectedMenuItem));
|
const search = 'child1';
|
||||||
|
const item = {
|
||||||
|
children: [{ name: 'child1' }, { name: 'child2' }],
|
||||||
|
};
|
||||||
|
const result = vm.findMatches(search, item);
|
||||||
|
expect(result).toEqual([{ name: 'child1' }]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should find nested child matches', () => {
|
||||||
|
const search = 'child3';
|
||||||
|
const item = {
|
||||||
|
children: [
|
||||||
|
{ name: 'child1' },
|
||||||
|
{
|
||||||
|
name: 'child2',
|
||||||
|
children: [{ name: 'child3' }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const result = vm.findMatches(search, item);
|
||||||
|
expect(result).toEqual([{ name: 'child3' }]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('normalize', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
vm = mount('card').vm;
|
||||||
|
});
|
||||||
|
it('should normalize and lowercase text', () => {
|
||||||
|
const input = 'ÁÉÍÓÚáéíóú';
|
||||||
|
const expected = 'aeiouaeiou';
|
||||||
|
expect(vm.normalize(input)).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle empty string', () => {
|
||||||
|
const input = '';
|
||||||
|
const expected = '';
|
||||||
|
expect(vm.normalize(input)).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle text without diacritics', () => {
|
||||||
|
const input = 'hello';
|
||||||
|
const expected = 'hello';
|
||||||
|
expect(vm.normalize(input)).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle mixed text', () => {
|
||||||
|
const input = 'Héllo Wórld!';
|
||||||
|
const expected = 'hello world!';
|
||||||
|
expect(vm.normalize(input)).toBe(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('addChildren', () => {
|
||||||
|
const module = 'testModule';
|
||||||
|
beforeEach(() => {
|
||||||
|
vm = mount().vm;
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add menu items to parent if matches are found', () => {
|
||||||
|
const parent = 'testParent';
|
||||||
|
const route = {
|
||||||
|
meta: {
|
||||||
|
menu: 'testMenu',
|
||||||
|
},
|
||||||
|
children: [{ name: 'child1' }, { name: 'child2' }],
|
||||||
|
};
|
||||||
|
vm.addChildren(module, route, parent);
|
||||||
|
|
||||||
|
expect(navigation.addMenuItem).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle routes with no meta menu', () => {
|
||||||
|
const route = {
|
||||||
|
meta: {},
|
||||||
|
menus: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
const parent = [];
|
||||||
|
|
||||||
|
vm.addChildren(module, route, parent);
|
||||||
|
expect(navigation.addMenuItem).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle empty parent array', () => {
|
||||||
|
const parent = [];
|
||||||
|
const route = {
|
||||||
|
meta: {
|
||||||
|
menu: 'child11',
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'child1',
|
||||||
|
meta: {
|
||||||
|
menuChildren: [
|
||||||
|
{
|
||||||
|
name: 'CustomerCreditContracts',
|
||||||
|
title: 'creditContracts',
|
||||||
|
icon: 'vn:solunion',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
vm.addChildren(module, route, parent);
|
||||||
|
expect(navigation.addMenuItem).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,61 +1,65 @@
|
||||||
import { vi, describe, expect, it, beforeEach, beforeAll, afterEach } from 'vitest';
|
import { vi, describe, expect, it, beforeEach, afterEach } from 'vitest';
|
||||||
import { createWrapper } from 'app/test/vitest/helper';
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
import UserPanel from 'src/components/UserPanel.vue';
|
import UserPanel from 'src/components/UserPanel.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
|
vi.mock('src/utils/quasarLang', () => ({
|
||||||
|
default: vi.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
describe('UserPanel', () => {
|
describe('UserPanel', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let vm;
|
let vm;
|
||||||
let state;
|
let state;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = createWrapper(UserPanel, {});
|
wrapper = createWrapper(UserPanel, {});
|
||||||
state = useState();
|
state = useState();
|
||||||
state.setUser({
|
state.setUser({
|
||||||
id: 115,
|
id: 115,
|
||||||
name: 'itmanagement',
|
name: 'itmanagement',
|
||||||
nickname: 'itManagementNick',
|
nickname: 'itManagementNick',
|
||||||
lang: 'en',
|
lang: 'en',
|
||||||
darkMode: false,
|
darkMode: false,
|
||||||
companyFk: 442,
|
companyFk: 442,
|
||||||
warehouseFk: 1,
|
warehouseFk: 1,
|
||||||
});
|
|
||||||
wrapper = wrapper.wrapper;
|
|
||||||
vm = wrapper.vm;
|
|
||||||
});
|
});
|
||||||
|
wrapper = wrapper.wrapper;
|
||||||
|
vm = wrapper.vm;
|
||||||
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fetch warehouses data on mounted', async () => {
|
it('should fetch warehouses data on mounted', async () => {
|
||||||
const fetchData = wrapper.findComponent({ name: 'FetchData' });
|
const fetchData = wrapper.findComponent({ name: 'FetchData' });
|
||||||
expect(fetchData.props('url')).toBe('Warehouses');
|
expect(fetchData.props('url')).toBe('Warehouses');
|
||||||
expect(fetchData.props('autoLoad')).toBe(true);
|
expect(fetchData.props('autoLoad')).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should toggle dark mode correctly and update preferences', async () => {
|
it('should toggle dark mode correctly and update preferences', async () => {
|
||||||
await vm.saveDarkMode(true);
|
await vm.saveDarkMode(true);
|
||||||
expect(axios.patch).toHaveBeenCalledWith('/UserConfigs/115', { darkMode: true });
|
expect(axios.patch).toHaveBeenCalledWith('/UserConfigs/115', { darkMode: true });
|
||||||
expect(vm.user.darkMode).toBe(true);
|
expect(vm.user.darkMode).toBe(true);
|
||||||
vm.updatePreferences();
|
await vm.updatePreferences();
|
||||||
expect(vm.darkMode).toBe(true);
|
expect(vm.darkMode).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should change user language and update preferences', async () => {
|
it('should change user language and update preferences', async () => {
|
||||||
const userLanguage = 'es';
|
const userLanguage = 'es';
|
||||||
await vm.saveLanguage(userLanguage);
|
await vm.saveLanguage(userLanguage);
|
||||||
expect(axios.patch).toHaveBeenCalledWith('/VnUsers/115', { lang: userLanguage });
|
expect(axios.patch).toHaveBeenCalledWith('/VnUsers/115', { lang: userLanguage });
|
||||||
expect(vm.user.lang).toBe(userLanguage);
|
expect(vm.user.lang).toBe(userLanguage);
|
||||||
vm.updatePreferences();
|
await vm.updatePreferences();
|
||||||
expect(vm.locale).toBe(userLanguage);
|
expect(vm.locale).toBe(userLanguage);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update user data', async () => {
|
it('should update user data', async () => {
|
||||||
const key = 'name';
|
const key = 'name';
|
||||||
const value = 'itboss';
|
const value = 'itboss';
|
||||||
await vm.saveUserData(key, value);
|
await vm.saveUserData(key, value);
|
||||||
expect(axios.post).toHaveBeenCalledWith('UserConfigs/setUserConfig', { [key]: value });
|
expect(axios.post).toHaveBeenCalledWith('UserConfigs/setUserConfig', { [key]: value });
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -10,11 +10,11 @@ import LeftMenu from 'components/LeftMenu.vue';
|
||||||
import RightMenu from 'components/common/RightMenu.vue';
|
import RightMenu from 'components/common/RightMenu.vue';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
dataKey: { type: String, required: true },
|
dataKey: { type: String, required: true },
|
||||||
baseUrl: { type: String, default: undefined },
|
url: { type: String, default: undefined },
|
||||||
customUrl: { type: String, default: undefined },
|
|
||||||
filter: { type: Object, default: () => {} },
|
filter: { type: Object, default: () => {} },
|
||||||
descriptor: { type: Object, required: true },
|
descriptor: { type: Object, required: true },
|
||||||
filterPanel: { type: Object, default: undefined },
|
filterPanel: { type: Object, default: undefined },
|
||||||
|
idInWhere: { type: Boolean, default: false },
|
||||||
searchDataKey: { type: String, default: undefined },
|
searchDataKey: { type: String, default: undefined },
|
||||||
searchbarProps: { type: Object, default: undefined },
|
searchbarProps: { type: Object, default: undefined },
|
||||||
redirectOnError: { type: Boolean, default: false },
|
redirectOnError: { type: Boolean, default: false },
|
||||||
|
@ -23,25 +23,20 @@ const props = defineProps({
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const url = computed(() => {
|
|
||||||
if (props.baseUrl) {
|
|
||||||
return `${props.baseUrl}/${route.params.id}`;
|
|
||||||
}
|
|
||||||
return props.customUrl;
|
|
||||||
});
|
|
||||||
const searchRightDataKey = computed(() => {
|
const searchRightDataKey = computed(() => {
|
||||||
if (!props.searchDataKey) return route.name;
|
if (!props.searchDataKey) return route.name;
|
||||||
return props.searchDataKey;
|
return props.searchDataKey;
|
||||||
});
|
});
|
||||||
|
|
||||||
const arrayData = useArrayData(props.dataKey, {
|
const arrayData = useArrayData(props.dataKey, {
|
||||||
url: url.value,
|
url: props.url,
|
||||||
filter: props.filter,
|
userFilter: props.filter,
|
||||||
|
oneRecord: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
try {
|
try {
|
||||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
await fetch(route.params.id);
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
|
||||||
} catch {
|
} catch {
|
||||||
const { matched: matches } = router.currentRoute.value;
|
const { matched: matches } = router.currentRoute.value;
|
||||||
const { path } = matches.at(-1);
|
const { path } = matches.at(-1);
|
||||||
|
@ -49,13 +44,17 @@ onBeforeMount(async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (props.baseUrl) {
|
onBeforeRouteUpdate(async (to, from) => {
|
||||||
onBeforeRouteUpdate(async (to, from) => {
|
const id = to.params.id;
|
||||||
if (to.params.id !== from.params.id) {
|
if (id !== from.params.id) await fetch(id, true);
|
||||||
arrayData.store.url = `${props.baseUrl}/${to.params.id}`;
|
});
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
|
||||||
}
|
async function fetch(id, append = false) {
|
||||||
});
|
const regex = /\/(\d+)/;
|
||||||
|
if (props.idInWhere) arrayData.store.filter.where = { id };
|
||||||
|
else if (!regex.test(props.url)) arrayData.store.url = `${props.url}/${id}`;
|
||||||
|
else arrayData.store.url = props.url.replace(regex, `/${id}`);
|
||||||
|
await arrayData.fetch({ append, updateRouter: false });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
@ -83,7 +82,7 @@ if (props.baseUrl) {
|
||||||
<QPage>
|
<QPage>
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
<div :class="[useCardSize(), $attrs.class]">
|
<div :class="[useCardSize(), $attrs.class]">
|
||||||
<RouterView :key="route.path" />
|
<RouterView :key="$route.path" />
|
||||||
</div>
|
</div>
|
||||||
</QPage>
|
</QPage>
|
||||||
</QPageContainer>
|
</QPageContainer>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onBeforeMount, computed } from 'vue';
|
import { onBeforeMount } from 'vue';
|
||||||
import { useRoute, useRouter, onBeforeRouteUpdate } from 'vue-router';
|
import { useRouter, onBeforeRouteUpdate } from 'vue-router';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import useCardSize from 'src/composables/useCardSize';
|
import useCardSize from 'src/composables/useCardSize';
|
||||||
|
@ -9,10 +9,9 @@ import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
dataKey: { type: String, required: true },
|
dataKey: { type: String, required: true },
|
||||||
baseUrl: { type: String, default: undefined },
|
url: { type: String, default: undefined },
|
||||||
customUrl: { type: String, default: undefined },
|
idInWhere: { type: Boolean, default: false },
|
||||||
filter: { type: Object, default: () => {} },
|
filter: { type: Object, default: () => {} },
|
||||||
userFilter: { type: Object, default: () => {} },
|
|
||||||
descriptor: { type: Object, required: true },
|
descriptor: { type: Object, required: true },
|
||||||
filterPanel: { type: Object, default: undefined },
|
filterPanel: { type: Object, default: undefined },
|
||||||
searchDataKey: { type: String, default: undefined },
|
searchDataKey: { type: String, default: undefined },
|
||||||
|
@ -21,39 +20,45 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const route = useRoute();
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const url = computed(() => {
|
|
||||||
if (props.baseUrl) {
|
|
||||||
return `${props.baseUrl}/${route.params.id}`;
|
|
||||||
}
|
|
||||||
return props.customUrl;
|
|
||||||
});
|
|
||||||
|
|
||||||
const arrayData = useArrayData(props.dataKey, {
|
const arrayData = useArrayData(props.dataKey, {
|
||||||
url: url.value,
|
url: props.url,
|
||||||
filter: props.filter,
|
userFilter: props.filter,
|
||||||
userFilter: props.userFilter,
|
oneRecord: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
|
const route = router.currentRoute.value;
|
||||||
try {
|
try {
|
||||||
if (!props.baseUrl) arrayData.store.filter.where = { id: route.params.id };
|
await fetch(route.params.id);
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
|
||||||
} catch {
|
} catch {
|
||||||
const { matched: matches } = router.currentRoute.value;
|
const { matched: matches } = route;
|
||||||
const { path } = matches.at(-1);
|
const { path } = matches.at(-1);
|
||||||
router.push({ path: path.replace(/:id.*/, '') });
|
router.push({ path: path.replace(/:id.*/, '') });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (props.baseUrl) {
|
onBeforeRouteUpdate(async (to, from) => {
|
||||||
onBeforeRouteUpdate(async (to, from) => {
|
if (hasRouteParam(to.params)) {
|
||||||
if (to.params.id !== from.params.id) {
|
const { matched } = router.currentRoute.value;
|
||||||
arrayData.store.url = `${props.baseUrl}/${to.params.id}`;
|
const { name } = matched.at(-3);
|
||||||
await arrayData.fetch({ append: false, updateRouter: false });
|
if (name) {
|
||||||
|
router.push({ name, params: to.params });
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
const id = to.params.id;
|
||||||
|
if (id !== from.params.id) await fetch(id, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
async function fetch(id, append = false) {
|
||||||
|
const regex = /\/(\d+)/;
|
||||||
|
if (props.idInWhere) arrayData.store.filter.where = { id };
|
||||||
|
else if (!regex.test(props.url)) arrayData.store.url = `${props.url}/${id}`;
|
||||||
|
else arrayData.store.url = props.url.replace(regex, `/${id}`);
|
||||||
|
await arrayData.fetch({ append, updateRouter: false });
|
||||||
|
}
|
||||||
|
function hasRouteParam(params, valueToCheck = ':addressId') {
|
||||||
|
return Object.values(params).includes(valueToCheck);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
@ -64,6 +69,6 @@ if (props.baseUrl) {
|
||||||
</Teleport>
|
</Teleport>
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
<div :class="[useCardSize(), $attrs.class]">
|
<div :class="[useCardSize(), $attrs.class]">
|
||||||
<RouterView :key="route.path" />
|
<RouterView :key="$route.path" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
const model = defineModel({ type: [Number, Boolean] });
|
||||||
|
const $props = defineProps({
|
||||||
|
info: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const checkboxModel = computed({
|
||||||
|
get() {
|
||||||
|
if (typeof model.value === 'number') {
|
||||||
|
return model.value !== 0;
|
||||||
|
}
|
||||||
|
return model.value;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
if (typeof model.value === 'number') {
|
||||||
|
model.value = value ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
model.value = value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<QCheckbox v-bind="$attrs" v-on="$attrs" v-model="checkboxModel" />
|
||||||
|
<QIcon
|
||||||
|
v-if="info"
|
||||||
|
v-bind="$attrs"
|
||||||
|
class="cursor-info q-ml-sm"
|
||||||
|
name="info"
|
||||||
|
size="sm"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ info }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<script setup>
|
||||||
|
const $props = defineProps({
|
||||||
|
colors: {
|
||||||
|
type: String,
|
||||||
|
default: '{"value": []}',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const colorArray = JSON.parse($props.colors)?.value;
|
||||||
|
const maxHeight = 30;
|
||||||
|
const colorHeight = maxHeight / colorArray?.length;
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div v-if="colors" class="color-div" :style="{ height: `${maxHeight}px` }">
|
||||||
|
<div
|
||||||
|
v-for="(color, index) in colorArray"
|
||||||
|
:key="index"
|
||||||
|
:style="{
|
||||||
|
backgroundColor: `#${color}`,
|
||||||
|
height: `${colorHeight}px`,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<style scoped>
|
||||||
|
.color-div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -17,6 +17,8 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['blur']);
|
||||||
|
|
||||||
const componentArray = computed(() => {
|
const componentArray = computed(() => {
|
||||||
if (typeof $props.prop === 'object') return [$props.prop];
|
if (typeof $props.prop === 'object') return [$props.prop];
|
||||||
return $props.prop;
|
return $props.prop;
|
||||||
|
@ -46,7 +48,8 @@ function toValueAttrs(attrs) {
|
||||||
<span
|
<span
|
||||||
v-for="toComponent of componentArray"
|
v-for="toComponent of componentArray"
|
||||||
:key="toComponent.name"
|
:key="toComponent.name"
|
||||||
class="column flex-center fit"
|
class="column fit"
|
||||||
|
:class="toComponent?.component == 'checkbox' ? 'flex-center' : ''"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
v-if="toComponent?.component"
|
v-if="toComponent?.component"
|
||||||
|
@ -54,6 +57,7 @@ function toValueAttrs(attrs) {
|
||||||
v-bind="mix(toComponent).attrs"
|
v-bind="mix(toComponent).attrs"
|
||||||
v-on="mix(toComponent).event ?? {}"
|
v-on="mix(toComponent).event ?? {}"
|
||||||
v-model="model"
|
v-model="model"
|
||||||
|
@blur="emit('blur')"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { useSession } from 'src/composables/useSession';
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const rows = ref();
|
const rows = ref([]);
|
||||||
const dmsRef = ref();
|
const dmsRef = ref();
|
||||||
const formDialog = ref({});
|
const formDialog = ref({});
|
||||||
const token = useSession().getTokenMultimedia();
|
const token = useSession().getTokenMultimedia();
|
||||||
|
@ -389,6 +389,14 @@ defineExpose({
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</QTable>
|
</QTable>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
class="info-row q-pa-md text-center"
|
||||||
|
>
|
||||||
|
<h5>
|
||||||
|
{{ t('No data to display') }}
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VnPaginate>
|
</VnPaginate>
|
||||||
<QDialog v-model="formDialog.show">
|
<QDialog v-model="formDialog.show">
|
||||||
|
@ -405,7 +413,7 @@ defineExpose({
|
||||||
fab
|
fab
|
||||||
color="primary"
|
color="primary"
|
||||||
icon="add"
|
icon="add"
|
||||||
shortcut="+"
|
v-shortcut
|
||||||
@click="showFormDialog()"
|
@click="showFormDialog()"
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
>
|
>
|
||||||
|
|
|
@ -11,6 +11,7 @@ const emit = defineEmits([
|
||||||
'update:options',
|
'update:options',
|
||||||
'keyup.enter',
|
'keyup.enter',
|
||||||
'remove',
|
'remove',
|
||||||
|
'blur',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -136,6 +137,7 @@ const handleUppercase = () => {
|
||||||
:type="$attrs.type"
|
:type="$attrs.type"
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
@keyup.enter="emit('keyup.enter')"
|
@keyup.enter="emit('keyup.enter')"
|
||||||
|
@blur="emit('blur')"
|
||||||
@keydown="handleKeydown"
|
@keydown="handleKeydown"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
|
@ -143,7 +145,7 @@ const handleUppercase = () => {
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend v-if="$slots.prepend">
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
</template>
|
</template>
|
||||||
<template #append>
|
<template #append>
|
||||||
|
@ -172,7 +174,7 @@ const handleUppercase = () => {
|
||||||
<QIcon
|
<QIcon
|
||||||
name="match_case"
|
name="match_case"
|
||||||
size="xs"
|
size="xs"
|
||||||
v-if="!$attrs.disabled && !($attrs.readonly) && $props.uppercase"
|
v-if="!$attrs.disabled && !$attrs.readonly && $props.uppercase"
|
||||||
@click="handleUppercase"
|
@click="handleUppercase"
|
||||||
class="uppercase-icon"
|
class="uppercase-icon"
|
||||||
>
|
>
|
||||||
|
@ -194,13 +196,15 @@ const handleUppercase = () => {
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.uppercase-icon {
|
.uppercase-icon {
|
||||||
transition: color 0.3s, transform 0.2s;
|
transition:
|
||||||
cursor: pointer;
|
color 0.3s,
|
||||||
|
transform 0.2s;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uppercase-icon:hover {
|
.uppercase-icon:hover {
|
||||||
color: #ed9937;
|
color: #ed9937;
|
||||||
transform: scale(1.2);
|
transform: scale(1.2);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -42,7 +42,7 @@ const formattedDate = computed({
|
||||||
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
|
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
|
||||||
value = date.formatDate(
|
value = date.formatDate(
|
||||||
new Date(value).toISOString(),
|
new Date(value).toISOString(),
|
||||||
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const [year, month, day] = value.split('-').map((e) => parseInt(e));
|
const [year, month, day] = value.split('-').map((e) => parseInt(e));
|
||||||
|
@ -55,7 +55,7 @@ const formattedDate = computed({
|
||||||
orgDate.getHours(),
|
orgDate.getHours(),
|
||||||
orgDate.getMinutes(),
|
orgDate.getMinutes(),
|
||||||
orgDate.getSeconds(),
|
orgDate.getSeconds(),
|
||||||
orgDate.getMilliseconds()
|
orgDate.getMilliseconds(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ const formattedDate = computed({
|
||||||
});
|
});
|
||||||
|
|
||||||
const popupDate = computed(() =>
|
const popupDate = computed(() =>
|
||||||
model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value
|
model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value,
|
||||||
);
|
);
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// fix quasar bug
|
// fix quasar bug
|
||||||
|
@ -73,7 +73,7 @@ onMounted(() => {
|
||||||
watch(
|
watch(
|
||||||
() => model.value,
|
() => model.value,
|
||||||
(val) => (formattedDate.value = val),
|
(val) => (formattedDate.value = val),
|
||||||
{ immediate: true }
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const styleAttrs = computed(() => {
|
const styleAttrs = computed(() => {
|
||||||
|
@ -107,6 +107,7 @@ const manageDate = (date) => {
|
||||||
@click="isPopupOpen = !isPopupOpen"
|
@click="isPopupOpen = !isPopupOpen"
|
||||||
@keydown="isPopupOpen = false"
|
@keydown="isPopupOpen = false"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
|
:data-cy="$attrs.dataCy ?? $attrs.label + '_inputDate'"
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
|
|
@ -8,6 +8,7 @@ defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const model = defineModel({ type: [Number, String] });
|
const model = defineModel({ type: [Number, String] });
|
||||||
|
const emit = defineEmits(['blur']);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -24,5 +25,6 @@ const model = defineModel({ type: [Number, String] });
|
||||||
model = parseFloat(val).toFixed(decimalPlaces);
|
model = parseFloat(val).toFixed(decimalPlaces);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
@blur="emit('blur')"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -85,6 +85,7 @@ const handleModelValue = (data) => {
|
||||||
:tooltip="t('Create new location')"
|
:tooltip="t('Create new location')"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
:lazy-rules="true"
|
:lazy-rules="true"
|
||||||
|
required
|
||||||
>
|
>
|
||||||
<template #form>
|
<template #form>
|
||||||
<CreateNewPostcode
|
<CreateNewPostcode
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
label: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: 'primary',
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const popupProxyRef = ref(null);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<QBtn :color="$props.color" :icon="$props.icon" :label="$t($props.label)">
|
||||||
|
<template #default>
|
||||||
|
<slot name="extraIcon"></slot>
|
||||||
|
<QPopupProxy ref="popupProxyRef" style="max-width: none">
|
||||||
|
<QCard>
|
||||||
|
<slot :popup="popupProxyRef"></slot>
|
||||||
|
</QCard>
|
||||||
|
</QPopupProxy>
|
||||||
|
<QTooltip>{{ $t($props.tooltip) }}</QTooltip>
|
||||||
|
</template>
|
||||||
|
</QBtn>
|
||||||
|
</template>
|
|
@ -106,7 +106,14 @@ function checkIsMain() {
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
:array-data="arrayData"
|
:array-data="arrayData"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
/>
|
>
|
||||||
|
<template #moreFilterPanel="{ params, orders, searchFn }">
|
||||||
|
<slot
|
||||||
|
name="moreFilterPanel"
|
||||||
|
v-bind="{ params, orders, searchFn }"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</VnTableFilter>
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
</RightAdvancedMenu>
|
</RightAdvancedMenu>
|
||||||
|
|
|
@ -171,7 +171,8 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const arrayDataKey =
|
const arrayDataKey =
|
||||||
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
$props.dataKey ??
|
||||||
|
($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label));
|
||||||
|
|
||||||
const arrayData = useArrayData(arrayDataKey, {
|
const arrayData = useArrayData(arrayDataKey, {
|
||||||
url: $props.url,
|
url: $props.url,
|
||||||
|
@ -220,7 +221,7 @@ async function fetchFilter(val) {
|
||||||
optionFilterValue.value ??
|
optionFilterValue.value ??
|
||||||
(new RegExp(/\d/g).test(val)
|
(new RegExp(/\d/g).test(val)
|
||||||
? optionValue.value
|
? optionValue.value
|
||||||
: optionFilter.value ?? optionLabel.value);
|
: (optionFilter.value ?? optionLabel.value));
|
||||||
|
|
||||||
let defaultWhere = {};
|
let defaultWhere = {};
|
||||||
if ($props.filterOptions.length) {
|
if ($props.filterOptions.length) {
|
||||||
|
@ -239,7 +240,7 @@ async function fetchFilter(val) {
|
||||||
|
|
||||||
const { data } = await arrayData.applyFilter(
|
const { data } = await arrayData.applyFilter(
|
||||||
{ filter: filterOptions },
|
{ filter: filterOptions },
|
||||||
{ updateRouter: false }
|
{ updateRouter: false },
|
||||||
);
|
);
|
||||||
setOptions(data);
|
setOptions(data);
|
||||||
return data;
|
return data;
|
||||||
|
@ -272,7 +273,7 @@ async function filterHandler(val, update) {
|
||||||
ref.setOptionIndex(-1);
|
ref.setOptionIndex(-1);
|
||||||
ref.moveOptionSelection(1, true);
|
ref.moveOptionSelection(1, true);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +309,7 @@ function handleKeyDown(event) {
|
||||||
if (inputValue) {
|
if (inputValue) {
|
||||||
const matchingOption = myOptions.value.find(
|
const matchingOption = myOptions.value.find(
|
||||||
(option) =>
|
(option) =>
|
||||||
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase()
|
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (matchingOption) {
|
if (matchingOption) {
|
||||||
|
@ -320,11 +321,11 @@ function handleKeyDown(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const focusableElements = document.querySelectorAll(
|
const focusableElements = document.querySelectorAll(
|
||||||
'a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])'
|
'a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])',
|
||||||
);
|
);
|
||||||
const currentIndex = Array.prototype.indexOf.call(
|
const currentIndex = Array.prototype.indexOf.call(
|
||||||
focusableElements,
|
focusableElements,
|
||||||
event.target
|
event.target,
|
||||||
);
|
);
|
||||||
if (currentIndex >= 0 && currentIndex < focusableElements.length - 1) {
|
if (currentIndex >= 0 && currentIndex < focusableElements.length - 1) {
|
||||||
focusableElements[currentIndex + 1].focus();
|
focusableElements[currentIndex + 1].focus();
|
||||||
|
|
|
@ -14,7 +14,7 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const options = ref([]);
|
const options = ref([]);
|
||||||
|
const emit = defineEmits(['blur']);
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
const { url, optionValue, optionLabel } = useAttrs();
|
const { url, optionValue, optionLabel } = useAttrs();
|
||||||
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
||||||
|
@ -35,5 +35,5 @@ onBeforeMount(async () => {
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" />
|
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" @blur="emit('blur')" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -37,7 +37,6 @@ const isAllowedToCreate = computed(() => {
|
||||||
|
|
||||||
defineExpose({ vnSelectDialogRef: select });
|
defineExpose({ vnSelectDialogRef: select });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
ref="select"
|
ref="select"
|
||||||
|
@ -67,7 +66,6 @@ defineExpose({ vnSelectDialogRef: select });
|
||||||
</template>
|
</template>
|
||||||
</VnSelect>
|
</VnSelect>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.default-icon {
|
.default-icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
|
||||||
const model = defineModel({ type: [String, Number, Object] });
|
const model = defineModel({ type: [String, Number, Object] });
|
||||||
const url = 'Suppliers';
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -11,11 +9,13 @@ const url = 'Suppliers';
|
||||||
:label="$t('globals.supplier')"
|
:label="$t('globals.supplier')"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
v-model="model"
|
v-model="model"
|
||||||
:url="url"
|
url="Suppliers"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
:fields="['id', 'name', 'nickname', 'nif']"
|
:fields="['id', 'name', 'nickname', 'nif']"
|
||||||
|
:filter-options="['id', 'name', 'nickname', 'nif']"
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
|
data-cy="vnSupplierSelect"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
<script setup>
|
||||||
|
import VnSelectDialog from './VnSelectDialog.vue';
|
||||||
|
import FilterTravelForm from 'src/components/FilterTravelForm.vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { toDate } from 'src/filters';
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
onFilterTravelSelected: {
|
||||||
|
type: Function,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<VnSelectDialog
|
||||||
|
:label="t('entry.basicData.travel')"
|
||||||
|
v-bind="$attrs"
|
||||||
|
url="Travels/filter"
|
||||||
|
:fields="['id', 'warehouseInName']"
|
||||||
|
option-value="id"
|
||||||
|
option-label="warehouseInName"
|
||||||
|
map-options
|
||||||
|
hide-selected
|
||||||
|
:required="true"
|
||||||
|
action-icon="filter_alt"
|
||||||
|
:roles-allowed-to-create="['buyer']"
|
||||||
|
>
|
||||||
|
<template #form>
|
||||||
|
<FilterTravelForm @travel-selected="onFilterTravelSelected(data, $event)" />
|
||||||
|
</template>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>
|
||||||
|
{{ scope.opt?.agencyModeName }} -
|
||||||
|
{{ scope.opt?.warehouseInName }}
|
||||||
|
({{ toDate(scope.opt?.shipped) }}) →
|
||||||
|
{{ scope.opt?.warehouseOutName }}
|
||||||
|
({{ toDate(scope.opt?.landed) }})
|
||||||
|
</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelectDialog>
|
||||||
|
</template>
|
|
@ -1,51 +1,78 @@
|
||||||
import { describe, it, expect, vi, beforeAll, afterEach, beforeEach } from 'vitest';
|
import {
|
||||||
|
describe,
|
||||||
|
it,
|
||||||
|
expect,
|
||||||
|
vi,
|
||||||
|
beforeAll,
|
||||||
|
afterEach,
|
||||||
|
beforeEach,
|
||||||
|
afterAll,
|
||||||
|
} from 'vitest';
|
||||||
import { createWrapper, axios } from 'app/test/vitest/helper';
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
import VnNotes from 'src/components/ui/VnNotes.vue';
|
import VnNotes from 'src/components/ui/VnNotes.vue';
|
||||||
|
import vnDate from 'src/boot/vnDate';
|
||||||
|
|
||||||
describe('VnNotes', () => {
|
describe('VnNotes', () => {
|
||||||
let vm;
|
let vm;
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let spyFetch;
|
let spyFetch;
|
||||||
let postMock;
|
let postMock;
|
||||||
let expectedBody;
|
let patchMock;
|
||||||
const mockData= {name: 'Tony', lastName: 'Stark', text: 'Test Note', observationTypeFk: 1};
|
let expectedInsertBody;
|
||||||
|
let expectedUpdateBody;
|
||||||
function generateExpectedBody() {
|
const defaultOptions = {
|
||||||
expectedBody = {...vm.$props.body, ...{ text: vm.newNote.text, observationTypeFk: vm.newNote.observationTypeFk }};
|
url: '/test',
|
||||||
}
|
body: { name: 'Tony', lastName: 'Stark' },
|
||||||
|
selectType: false,
|
||||||
async function setTestParams(text, observationType, type){
|
saveUrl: null,
|
||||||
vm.newNote.text = text;
|
justInput: false,
|
||||||
vm.newNote.observationTypeFk = observationType;
|
};
|
||||||
wrapper.setProps({ selectType: type });
|
function generateWrapper(
|
||||||
}
|
options = defaultOptions,
|
||||||
|
text = null,
|
||||||
beforeAll(async () => {
|
observationType = null,
|
||||||
vi.spyOn(axios, 'get').mockReturnValue({ data: [] });
|
) {
|
||||||
|
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
|
||||||
wrapper = createWrapper(VnNotes, {
|
wrapper = createWrapper(VnNotes, {
|
||||||
propsData: {
|
propsData: options,
|
||||||
url: '/test',
|
|
||||||
body: { name: 'Tony', lastName: 'Stark' },
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
wrapper = wrapper.wrapper;
|
wrapper = wrapper.wrapper;
|
||||||
vm = wrapper.vm;
|
vm = wrapper.vm;
|
||||||
});
|
vm.newNote.text = text;
|
||||||
|
vm.newNote.observationTypeFk = observationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createSpyFetch() {
|
||||||
|
spyFetch = vi.spyOn(vm.$refs.vnPaginateRef, 'fetch');
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateExpectedBody() {
|
||||||
|
expectedInsertBody = {
|
||||||
|
...vm.$props.body,
|
||||||
|
...{ text: vm.newNote.text, observationTypeFk: vm.newNote.observationTypeFk },
|
||||||
|
};
|
||||||
|
expectedUpdateBody = { ...vm.$props.body, ...{ notes: vm.newNote.text } };
|
||||||
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
postMock = vi.spyOn(axios, 'post').mockResolvedValue(mockData);
|
postMock = vi.spyOn(axios, 'post');
|
||||||
spyFetch = vi.spyOn(vm.vnPaginateRef, 'fetch').mockImplementation(() => vi.fn());
|
patchMock = vi.spyOn(axios, 'patch');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
expectedBody = {};
|
expectedInsertBody = {};
|
||||||
|
expectedUpdateBody = {};
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
vi.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('insert', () => {
|
describe('insert', () => {
|
||||||
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is null', async () => {
|
it('should not call axios.post and vnPaginateRef.fetch when newNote.text is null', async () => {
|
||||||
await setTestParams( null, null, true );
|
generateWrapper({ selectType: true });
|
||||||
|
createSpyFetch();
|
||||||
|
|
||||||
await vm.insert();
|
await vm.insert();
|
||||||
|
|
||||||
|
@ -53,8 +80,9 @@ describe('VnNotes', () => {
|
||||||
expect(spyFetch).not.toHaveBeenCalled();
|
expect(spyFetch).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not call axios.post and vnPaginateRef.fetch if newNote.text is empty', async () => {
|
it('should not call axios.post and vnPaginateRef.fetch when newNote.text is empty', async () => {
|
||||||
await setTestParams( "", null, false );
|
generateWrapper(null, '');
|
||||||
|
createSpyFetch();
|
||||||
|
|
||||||
await vm.insert();
|
await vm.insert();
|
||||||
|
|
||||||
|
@ -62,8 +90,9 @@ describe('VnNotes', () => {
|
||||||
expect(spyFetch).not.toHaveBeenCalled();
|
expect(spyFetch).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is true', async () => {
|
it('should not call axios.post and vnPaginateRef.fetch when observationTypeFk is null and selectType is true', async () => {
|
||||||
await setTestParams( "Test Note", null, true );
|
generateWrapper({ selectType: true }, 'Test Note');
|
||||||
|
createSpyFetch();
|
||||||
|
|
||||||
await vm.insert();
|
await vm.insert();
|
||||||
|
|
||||||
|
@ -71,37 +100,57 @@ describe('VnNotes', () => {
|
||||||
expect(spyFetch).not.toHaveBeenCalled();
|
expect(spyFetch).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is missing and selectType is false', async () => {
|
it('should call axios.post and vnPaginateRef.fetch when observationTypeFk is missing and selectType is false', async () => {
|
||||||
await setTestParams( "Test Note", null, false );
|
generateWrapper(null, 'Test Note');
|
||||||
|
createSpyFetch();
|
||||||
generateExpectedBody();
|
generateExpectedBody();
|
||||||
|
|
||||||
await vm.insert();
|
await vm.insert();
|
||||||
|
|
||||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedInsertBody);
|
||||||
expect(spyFetch).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should call axios.post and vnPaginateRef.fetch if observationTypeFk is setted and selectType is false', async () => {
|
|
||||||
await setTestParams( "Test Note", 1, false );
|
|
||||||
|
|
||||||
generateExpectedBody();
|
|
||||||
|
|
||||||
await vm.insert();
|
|
||||||
|
|
||||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
|
||||||
expect(spyFetch).toHaveBeenCalled();
|
expect(spyFetch).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call axios.post and vnPaginateRef.fetch when newNote is valid', async () => {
|
it('should call axios.post and vnPaginateRef.fetch when newNote is valid', async () => {
|
||||||
await setTestParams( "Test Note", 1, true );
|
generateWrapper({ selectType: true }, 'Test Note', 1);
|
||||||
|
createSpyFetch();
|
||||||
generateExpectedBody();
|
generateExpectedBody();
|
||||||
|
|
||||||
await vm.insert();
|
await vm.insert();
|
||||||
|
|
||||||
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedBody);
|
expect(postMock).toHaveBeenCalledWith(vm.$props.url, expectedInsertBody);
|
||||||
expect(spyFetch).toHaveBeenCalled();
|
expect(spyFetch).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('update', () => {
|
||||||
|
it('should call axios.patch with saveUrl when saveUrl is set and justInput is true', async () => {
|
||||||
|
generateWrapper({
|
||||||
|
url: '/business',
|
||||||
|
justInput: true,
|
||||||
|
saveUrl: '/saveUrlTest',
|
||||||
|
});
|
||||||
|
generateExpectedBody();
|
||||||
|
|
||||||
|
await vm.update();
|
||||||
|
|
||||||
|
expect(patchMock).toHaveBeenCalledWith(vm.$props.saveUrl, expectedUpdateBody);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call axios.patch with url when saveUrl is not set and justInput is true', async () => {
|
||||||
|
generateWrapper({
|
||||||
|
url: '/business',
|
||||||
|
body: { workerFk: 1110 },
|
||||||
|
justInput: true,
|
||||||
|
});
|
||||||
|
generateExpectedBody();
|
||||||
|
|
||||||
|
await vm.update();
|
||||||
|
|
||||||
|
expect(patchMock).toHaveBeenCalledWith(
|
||||||
|
`${vm.$props.url}/${vm.$props.body.workerFk}`,
|
||||||
|
expectedUpdateBody,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
|
@ -6,6 +6,7 @@ import { useArrayData } from 'composables/useArrayData';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useClipboard } from 'src/composables/useClipboard';
|
||||||
import VnMoreOptions from './VnMoreOptions.vue';
|
import VnMoreOptions from './VnMoreOptions.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -29,10 +30,6 @@ const $props = defineProps({
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
module: {
|
|
||||||
type: String,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
summary: {
|
summary: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null,
|
default: null,
|
||||||
|
@ -46,6 +43,7 @@ const $props = defineProps({
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { copyText } = useClipboard();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
let arrayData;
|
let arrayData;
|
||||||
let store;
|
let store;
|
||||||
|
@ -57,12 +55,13 @@ defineExpose({ getData });
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
arrayData = useArrayData($props.dataKey, {
|
arrayData = useArrayData($props.dataKey, {
|
||||||
url: $props.url,
|
url: $props.url,
|
||||||
filter: $props.filter,
|
userFilter: $props.filter,
|
||||||
skip: 0,
|
skip: 0,
|
||||||
|
oneRecord: true,
|
||||||
});
|
});
|
||||||
store = arrayData.store;
|
store = arrayData.store;
|
||||||
entity = computed(() => {
|
entity = computed(() => {
|
||||||
const data = (Array.isArray(store.data) ? store.data[0] : store.data) ?? {};
|
const data = store.data ?? {};
|
||||||
if (data) emit('onFetch', data);
|
if (data) emit('onFetch', data);
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
@ -73,7 +72,7 @@ onBeforeMount(async () => {
|
||||||
() => [$props.url, $props.filter],
|
() => [$props.url, $props.filter],
|
||||||
async () => {
|
async () => {
|
||||||
if (!isSameDataKey.value) await getData();
|
if (!isSameDataKey.value) await getData();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -84,7 +83,7 @@ async function getData() {
|
||||||
try {
|
try {
|
||||||
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
||||||
state.set($props.dataKey, data);
|
state.set($props.dataKey, data);
|
||||||
emit('onFetch', Array.isArray(data) ? data[0] : data);
|
emit('onFetch', data);
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
|
@ -102,13 +101,21 @@ function getValueFromPath(path) {
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyIdText(id) {
|
||||||
|
copyText(id, {
|
||||||
|
component: {
|
||||||
|
copyValue: id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const emit = defineEmits(['onFetch']);
|
const emit = defineEmits(['onFetch']);
|
||||||
|
|
||||||
const iconModule = computed(() => route.matched[1].meta.icon);
|
const iconModule = computed(() => route.matched[1].meta.icon);
|
||||||
const toModule = computed(() =>
|
const toModule = computed(() =>
|
||||||
route.matched[1].path.split('/').length > 2
|
route.matched[1].path.split('/').length > 2
|
||||||
? route.matched[1].redirect
|
? route.matched[1].redirect
|
||||||
: route.matched[1].children[0].redirect
|
: route.matched[1].children[0].redirect,
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -147,7 +154,9 @@ const toModule = computed(() =>
|
||||||
{{ t('components.smartCard.openSummary') }}
|
{{ t('components.smartCard.openSummary') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<RouterLink :to="{ name: `${module}Summary`, params: { id: entity.id } }">
|
<RouterLink
|
||||||
|
:to="{ name: `${dataKey}Summary`, params: { id: entity.id } }"
|
||||||
|
>
|
||||||
<QBtn
|
<QBtn
|
||||||
class="link"
|
class="link"
|
||||||
color="white"
|
color="white"
|
||||||
|
@ -183,10 +192,25 @@ const toModule = computed(() =>
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
<QItem dense>
|
<QItem>
|
||||||
<QItemLabel class="subtitle" caption>
|
<QItemLabel class="subtitle">
|
||||||
#{{ getValueFromPath(subtitle) ?? entity.id }}
|
#{{ getValueFromPath(subtitle) ?? entity.id }}
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
|
|
||||||
|
<QBtn
|
||||||
|
round
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
size="sm"
|
||||||
|
icon="content_copy"
|
||||||
|
color="primary"
|
||||||
|
@click.stop="copyIdText(entity.id)"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('globals.copyId') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
<!-- </QItemLabel> -->
|
||||||
</QItem>
|
</QItem>
|
||||||
</QList>
|
</QList>
|
||||||
<div class="list-box q-mt-xs">
|
<div class="list-box q-mt-xs">
|
||||||
|
@ -293,3 +317,11 @@ const toModule = computed(() =>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
globals:
|
||||||
|
copyId: Copy ID
|
||||||
|
es:
|
||||||
|
globals:
|
||||||
|
copyId: Copiar ID
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -40,9 +40,10 @@ const arrayData = useArrayData(props.dataKey, {
|
||||||
filter: props.filter,
|
filter: props.filter,
|
||||||
userFilter: props.userFilter,
|
userFilter: props.userFilter,
|
||||||
skip: 0,
|
skip: 0,
|
||||||
|
oneRecord: true,
|
||||||
});
|
});
|
||||||
const { store } = arrayData;
|
const { store } = arrayData;
|
||||||
const entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data));
|
const entity = computed(() => store.data);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
@ -61,7 +62,7 @@ async function fetch() {
|
||||||
store.filter = props.filter ?? {};
|
store.filter = props.filter ?? {};
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
||||||
emit('onFetch', Array.isArray(data) ? data[0] : data);
|
emit('onFetch', data);
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -208,4 +209,13 @@ async function fetch() {
|
||||||
.summaryHeader {
|
.summaryHeader {
|
||||||
color: $white;
|
color: $white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cardSummary :deep(.q-card__section[content]) {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 0;
|
||||||
|
> * {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,53 +1,32 @@
|
||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
hasImage: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div id="descriptor-skeleton">
|
<div id="descriptor-skeleton" class="bg-vn-page">
|
||||||
<div class="row justify-between q-pa-sm">
|
<div class="row justify-between q-pa-sm">
|
||||||
<QSkeleton square size="40px" />
|
<QSkeleton square size="30px" v-for="i in 3" :key="i" />
|
||||||
<QSkeleton square size="40px" />
|
|
||||||
<QSkeleton square height="40px" width="20px" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col justify-between q-pa-sm q-gutter-y-xs">
|
<div class="q-pa-xs" v-if="hasImage">
|
||||||
<QSkeleton square height="40px" width="150px" />
|
<QSkeleton square height="200px" width="100%" />
|
||||||
<QSkeleton square height="30px" width="70px" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col q-pl-sm q-pa-sm q-mb-md">
|
<div class="col justify-between q-pa-md q-gutter-y-xs">
|
||||||
<div class="row justify-between">
|
<QSkeleton square height="25px" width="150px" />
|
||||||
<QSkeleton type="text" square height="30px" width="20%" />
|
<QSkeleton square height="15px" width="70px" />
|
||||||
<QSkeleton type="text" square height="30px" width="60%" />
|
</div>
|
||||||
</div>
|
<div class="q-pl-sm q-pa-sm q-mb-md">
|
||||||
<div class="row justify-between">
|
<div class="row q-gutter-x-sm q-pa-none q-ma-none" v-for="i in 5" :key="i">
|
||||||
<QSkeleton type="text" square height="30px" width="20%" />
|
<QSkeleton type="text" square height="20px" width="30%" />
|
||||||
<QSkeleton type="text" square height="30px" width="60%" />
|
<QSkeleton type="text" square height="20px" width="60%" />
|
||||||
</div>
|
|
||||||
<div class="row justify-between">
|
|
||||||
<QSkeleton type="text" square height="30px" width="20%" />
|
|
||||||
<QSkeleton type="text" square height="30px" width="60%" />
|
|
||||||
</div>
|
|
||||||
<div class="row justify-between">
|
|
||||||
<QSkeleton type="text" square height="30px" width="20%" />
|
|
||||||
<QSkeleton type="text" square height="30px" width="60%" />
|
|
||||||
</div>
|
|
||||||
<div class="row justify-between">
|
|
||||||
<QSkeleton type="text" square height="30px" width="20%" />
|
|
||||||
<QSkeleton type="text" square height="30px" width="60%" />
|
|
||||||
</div>
|
|
||||||
<div class="row justify-between">
|
|
||||||
<QSkeleton type="text" square height="30px" width="20%" />
|
|
||||||
<QSkeleton type="text" square height="30px" width="60%" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<QCardActions>
|
<QCardActions class="q-gutter-x-sm justify-between">
|
||||||
<QSkeleton size="40px" />
|
<QSkeleton size="40px" v-for="i in 5" :key="i" />
|
||||||
<QSkeleton size="40px" />
|
|
||||||
<QSkeleton size="40px" />
|
|
||||||
<QSkeleton size="40px" />
|
|
||||||
<QSkeleton size="40px" />
|
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
#descriptor-skeleton .q-card__actions {
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ function cancel() {
|
||||||
@click="cancel()"
|
@click="cancel()"
|
||||||
/>
|
/>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="q-pb-none">
|
<QCardSection class="q-pb-none" data-cy="VnConfirm_message">
|
||||||
<span v-if="message !== false" v-html="message" />
|
<span v-if="message !== false" v-html="message" />
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="row items-center q-pt-none">
|
<QCardSection class="row items-center q-pt-none">
|
||||||
|
@ -95,6 +95,7 @@ function cancel() {
|
||||||
:disable="isLoading"
|
:disable="isLoading"
|
||||||
flat
|
flat
|
||||||
@click="cancel()"
|
@click="cancel()"
|
||||||
|
data-cy="VnConfirm_cancel"
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('globals.confirm')"
|
:label="t('globals.confirm')"
|
||||||
|
|
|
@ -114,7 +114,7 @@ async function clearFilters() {
|
||||||
arrayData.resetPagination();
|
arrayData.resetPagination();
|
||||||
// Filtrar los params no removibles
|
// Filtrar los params no removibles
|
||||||
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
||||||
$props.unremovableParams.includes(param)
|
$props.unremovableParams.includes(param),
|
||||||
);
|
);
|
||||||
const newParams = {};
|
const newParams = {};
|
||||||
// Conservar solo los params que no son removibles
|
// Conservar solo los params que no son removibles
|
||||||
|
@ -162,13 +162,13 @@ const formatTags = (tags) => {
|
||||||
|
|
||||||
const tags = computed(() => {
|
const tags = computed(() => {
|
||||||
const filteredTags = tagsList.value.filter(
|
const filteredTags = tagsList.value.filter(
|
||||||
(tag) => !($props.customTags || []).includes(tag.label)
|
(tag) => !($props.customTags || []).includes(tag.label),
|
||||||
);
|
);
|
||||||
return formatTags(filteredTags);
|
return formatTags(filteredTags);
|
||||||
});
|
});
|
||||||
|
|
||||||
const customTags = computed(() =>
|
const customTags = computed(() =>
|
||||||
tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.label))
|
tagsList.value.filter((tag) => ($props.customTags || []).includes(tag.label)),
|
||||||
);
|
);
|
||||||
|
|
||||||
async function remove(key) {
|
async function remove(key) {
|
||||||
|
@ -188,10 +188,13 @@ function formatValue(value) {
|
||||||
const getLocale = (label) => {
|
const getLocale = (label) => {
|
||||||
const param = label.split('.').at(-1);
|
const param = label.split('.').at(-1);
|
||||||
const globalLocale = `globals.params.${param}`;
|
const globalLocale = `globals.params.${param}`;
|
||||||
|
const moduleName = route.meta.moduleName;
|
||||||
|
const moduleLocale = `${moduleName.toLowerCase()}.${param}`;
|
||||||
if (te(globalLocale)) return t(globalLocale);
|
if (te(globalLocale)) return t(globalLocale);
|
||||||
else if (te(t(`params.${param}`)));
|
else if (te(moduleLocale)) return t(moduleLocale);
|
||||||
else {
|
else {
|
||||||
const camelCaseModuleName = route.meta.moduleName.charAt(0).toLowerCase() + route.meta.moduleName.slice(1);
|
const camelCaseModuleName =
|
||||||
|
moduleName.charAt(0).toLowerCase() + moduleName.slice(1);
|
||||||
return t(`${camelCaseModuleName}.params.${param}`);
|
return t(`${camelCaseModuleName}.params.${param}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -290,6 +293,9 @@ const getLocale = (label) => {
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.q-field__label.no-pointer-events.absolute.ellipsis {
|
||||||
|
margin-left: 6px !important;
|
||||||
|
}
|
||||||
.list {
|
.list {
|
||||||
width: 256px;
|
width: 256px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ $t('components.cardDescriptor.moreOptions') }}
|
{{ $t('components.cardDescriptor.moreOptions') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
<QMenu ref="menuRef">
|
<QMenu ref="menuRef" data-cy="descriptor-more-opts-menu">
|
||||||
<QList>
|
<QList>
|
||||||
<slot name="menu" :menu-ref="$refs.menuRef" />
|
<slot name="menu" :menu-ref="$refs.menuRef" />
|
||||||
</QList>
|
</QList>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ref, reactive } from 'vue';
|
import { ref, reactive, useAttrs, computed } from 'vue';
|
||||||
import { onBeforeRouteLeave } from 'vue-router';
|
import { onBeforeRouteLeave } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
@ -16,12 +16,27 @@ import VnSelect from 'components/common/VnSelect.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import VnInput from 'components/common/VnInput.vue';
|
import VnInput from 'components/common/VnInput.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['onFetch']);
|
||||||
|
|
||||||
|
const originalAttrs = useAttrs();
|
||||||
|
|
||||||
|
const $attrs = computed(() => {
|
||||||
|
const { style, ...rest } = originalAttrs;
|
||||||
|
return rest;
|
||||||
|
});
|
||||||
|
|
||||||
|
const isRequired = computed(() => {
|
||||||
|
return Object.keys($attrs).includes('required')
|
||||||
|
});
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
url: { type: String, default: null },
|
url: { type: String, default: null },
|
||||||
|
saveUrl: {type: String, default: null},
|
||||||
filter: { type: Object, default: () => {} },
|
filter: { type: Object, default: () => {} },
|
||||||
body: { type: Object, default: () => {} },
|
body: { type: Object, default: () => {} },
|
||||||
addNote: { type: Boolean, default: false },
|
addNote: { type: Boolean, default: false },
|
||||||
selectType: { type: Boolean, default: false },
|
selectType: { type: Boolean, default: false },
|
||||||
|
justInput: { type: Boolean, default: false },
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -29,6 +44,13 @@ const quasar = useQuasar();
|
||||||
const newNote = reactive({ text: null, observationTypeFk: null });
|
const newNote = reactive({ text: null, observationTypeFk: null });
|
||||||
const observationTypes = ref([]);
|
const observationTypes = ref([]);
|
||||||
const vnPaginateRef = ref();
|
const vnPaginateRef = ref();
|
||||||
|
let originalText;
|
||||||
|
|
||||||
|
function handleClick(e) {
|
||||||
|
if (e.shiftKey && e.key === 'Enter') return;
|
||||||
|
if ($props.justInput) confirmAndUpdate();
|
||||||
|
else insert();
|
||||||
|
}
|
||||||
|
|
||||||
async function insert() {
|
async function insert() {
|
||||||
if (!newNote.text || ($props.selectType && !newNote.observationTypeFk)) return;
|
if (!newNote.text || ($props.selectType && !newNote.observationTypeFk)) return;
|
||||||
|
@ -41,8 +63,36 @@ async function insert() {
|
||||||
await axios.post($props.url, newBody);
|
await axios.post($props.url, newBody);
|
||||||
await vnPaginateRef.value.fetch();
|
await vnPaginateRef.value.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function confirmAndUpdate() {
|
||||||
|
if(!newNote.text && originalText)
|
||||||
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t('New note is empty'),
|
||||||
|
message: t('Are you sure remove this note?'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(update)
|
||||||
|
.onCancel(() => {
|
||||||
|
newNote.text = originalText;
|
||||||
|
});
|
||||||
|
else update();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update() {
|
||||||
|
originalText = newNote.text;
|
||||||
|
const body = $props.body;
|
||||||
|
const newBody = {
|
||||||
|
...body,
|
||||||
|
...{ notes: newNote.text },
|
||||||
|
};
|
||||||
|
await axios.patch(`${$props.saveUrl ?? `${$props.url}/${$props.body.workerFk}`}`, newBody);
|
||||||
|
}
|
||||||
|
|
||||||
onBeforeRouteLeave((to, from, next) => {
|
onBeforeRouteLeave((to, from, next) => {
|
||||||
if (newNote.text)
|
if ((newNote.text && !$props.justInput) || (newNote.text !== originalText) && $props.justInput)
|
||||||
quasar.dialog({
|
quasar.dialog({
|
||||||
component: VnConfirm,
|
component: VnConfirm,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
@ -53,6 +103,13 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
});
|
});
|
||||||
else next();
|
else next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function fetchData([ data ]) {
|
||||||
|
newNote.text = data?.notes;
|
||||||
|
originalText = data?.notes;
|
||||||
|
emit('onFetch', data);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -62,8 +119,19 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
auto-load
|
auto-load
|
||||||
@on-fetch="(data) => (observationTypes = data)"
|
@on-fetch="(data) => (observationTypes = data)"
|
||||||
/>
|
/>
|
||||||
<QCard class="q-pa-xs q-mb-lg full-width" v-if="$props.addNote">
|
<FetchData
|
||||||
<QCardSection horizontal>
|
v-if="justInput"
|
||||||
|
:url="url"
|
||||||
|
:filter="filter"
|
||||||
|
@on-fetch="fetchData"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<QCard
|
||||||
|
class="q-pa-xs q-mb-lg full-width"
|
||||||
|
:class="{ 'just-input': $props.justInput }"
|
||||||
|
v-if="$props.addNote || $props.justInput"
|
||||||
|
>
|
||||||
|
<QCardSection horizontal v-if="!$props.justInput">
|
||||||
{{ t('New note') }}
|
{{ t('New note') }}
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<QCardSection class="q-px-xs q-my-none q-py-none">
|
<QCardSection class="q-px-xs q-my-none q-py-none">
|
||||||
|
@ -75,19 +143,19 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
v-model="newNote.observationTypeFk"
|
v-model="newNote.observationTypeFk"
|
||||||
option-label="description"
|
option-label="description"
|
||||||
style="flex: 0.15"
|
style="flex: 0.15"
|
||||||
:required="true"
|
:required="isRequired"
|
||||||
@keyup.enter.stop="insert"
|
@keyup.enter.stop="insert"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model.trim="newNote.text"
|
v-model.trim="newNote.text"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:label="t('Add note here...')"
|
:label="$props.justInput && newNote.text ? '' : t('Add note here...')"
|
||||||
filled
|
filled
|
||||||
size="lg"
|
size="lg"
|
||||||
autogrow
|
autogrow
|
||||||
@keyup.enter.stop="insert"
|
@keyup.enter.stop="handleClick"
|
||||||
|
:required="isRequired"
|
||||||
clearable
|
clearable
|
||||||
:required="true"
|
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -95,7 +163,7 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
icon="save"
|
icon="save"
|
||||||
color="primary"
|
color="primary"
|
||||||
flat
|
flat
|
||||||
@click="insert"
|
@click="handleClick"
|
||||||
class="q-mb-xs"
|
class="q-mb-xs"
|
||||||
dense
|
dense
|
||||||
data-cy="saveNote"
|
data-cy="saveNote"
|
||||||
|
@ -106,6 +174,7 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
</QCard>
|
</QCard>
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
|
v-if="!$props.justInput"
|
||||||
:data-key="$props.url"
|
:data-key="$props.url"
|
||||||
:url="$props.url"
|
:url="$props.url"
|
||||||
order="created DESC"
|
order="created DESC"
|
||||||
|
@ -198,6 +267,11 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.just-input {
|
||||||
|
padding-right: 18px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
|
@ -205,4 +279,6 @@ onBeforeRouteLeave((to, from, next) => {
|
||||||
New note: Nueva nota
|
New note: Nueva nota
|
||||||
Save (Enter): Guardar (Intro)
|
Save (Enter): Guardar (Intro)
|
||||||
Observation type: Tipo de observación
|
Observation type: Tipo de observación
|
||||||
|
New note is empty: La nueva nota esta vacia
|
||||||
|
Are you sure remove this note?: Estas seguro de quitar esta nota?
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<script setup>
|
||||||
|
import { toPercentage } from 'filters/index';
|
||||||
|
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
value: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const valueClass = computed(() =>
|
||||||
|
props.value === 0 ? 'neutral' : props.value > 0 ? 'positive' : 'negative',
|
||||||
|
);
|
||||||
|
const iconName = computed(() =>
|
||||||
|
props.value === 0 ? 'equal' : props.value > 0 ? 'arrow_upward' : 'arrow_downward',
|
||||||
|
);
|
||||||
|
const formattedValue = computed(() => props.value);
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<span :class="valueClass">
|
||||||
|
<QIcon :name="iconName" size="sm" class="value-icon" />
|
||||||
|
{{ toPercentage(formattedValue) }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.positive {
|
||||||
|
color: $secondary;
|
||||||
|
}
|
||||||
|
.negative {
|
||||||
|
color: $negative;
|
||||||
|
}
|
||||||
|
.neutral {
|
||||||
|
color: $primary;
|
||||||
|
}
|
||||||
|
.value-icon {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -19,23 +19,26 @@ onMounted(() => {
|
||||||
const observer = new MutationObserver(
|
const observer = new MutationObserver(
|
||||||
() =>
|
() =>
|
||||||
(hasContent.value =
|
(hasContent.value =
|
||||||
actions.value?.childNodes?.length + data.value?.childNodes?.length)
|
actions.value?.childNodes?.length + data.value?.childNodes?.length),
|
||||||
);
|
);
|
||||||
if (actions.value) observer.observe(actions.value, opts);
|
if (actions.value) observer.observe(actions.value, opts);
|
||||||
if (data.value) observer.observe(data.value, opts);
|
if (data.value) observer.observe(data.value, opts);
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => stateStore.toggleSubToolbar());
|
const actionsChildCount = () => !!actions.value?.childNodes?.length;
|
||||||
|
|
||||||
|
onBeforeUnmount(() => stateStore.toggleSubToolbar() && hasSubToolbar);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QToolbar
|
<QToolbar
|
||||||
id="subToolbar"
|
id="subToolbar"
|
||||||
class="justify-end sticky"
|
|
||||||
v-show="hasContent || $slots['st-actions'] || $slots['st-data']"
|
v-show="hasContent || $slots['st-actions'] || $slots['st-data']"
|
||||||
|
class="justify-end sticky"
|
||||||
>
|
>
|
||||||
<slot name="st-data">
|
<slot name="st-data">
|
||||||
<div id="st-data"></div>
|
<div id="st-data" :class="{ 'full-width': !actionsChildCount() }">
|
||||||
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<slot name="st-actions">
|
<slot name="st-actions">
|
||||||
|
|
|
@ -53,3 +53,8 @@ const manaCode = ref(props.manaCode);
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Promotion mana: Maná promoción
|
||||||
|
Claim mana: Maná reclamación
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -51,16 +51,6 @@ describe('CardSummary', () => {
|
||||||
expect(vm.store.filter).toEqual('cardFilter');
|
expect(vm.store.filter).toEqual('cardFilter');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should compute entity correctly from store data', () => {
|
|
||||||
vm.store.data = [{ id: 1, name: 'Entity 1' }];
|
|
||||||
expect(vm.entity).toEqual({ id: 1, name: 'Entity 1' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle empty data gracefully', () => {
|
|
||||||
vm.store.data = [];
|
|
||||||
expect(vm.entity).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should respond to prop changes and refetch data', async () => {
|
it('should respond to prop changes and refetch data', async () => {
|
||||||
const newUrl = 'CardSummary/35';
|
const newUrl = 'CardSummary/35';
|
||||||
const newKey = 'cardSummaryKey/35';
|
const newKey = 'cardSummaryKey/35';
|
||||||
|
@ -72,7 +62,7 @@ describe('CardSummary', () => {
|
||||||
expect(vm.store.filter).toEqual({ key: newKey });
|
expect(vm.store.filter).toEqual({ key: newKey });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true if route path ends with /summary' , () => {
|
it('should return true if route path ends with /summary', () => {
|
||||||
expect(vm.isSummary).toBe(true);
|
expect(vm.isSummary).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -16,7 +16,7 @@ describe('useArrayData', () => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fetch and repalce url with new params', async () => {
|
it('should fetch and replace url with new params', async () => {
|
||||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [] });
|
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [] });
|
||||||
|
|
||||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl' });
|
const arrayData = useArrayData('ArrayData', { url: 'mockUrl' });
|
||||||
|
@ -33,11 +33,11 @@ describe('useArrayData', () => {
|
||||||
});
|
});
|
||||||
expect(routerReplace.path).toEqual('mockSection/list');
|
expect(routerReplace.path).toEqual('mockSection/list');
|
||||||
expect(JSON.parse(routerReplace.query.params)).toEqual(
|
expect(JSON.parse(routerReplace.query.params)).toEqual(
|
||||||
expect.objectContaining(params)
|
expect.objectContaining(params),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should get data and send new URL without keeping parameters, if there is only one record', async () => {
|
it('should get data and send new URL without keeping parameters, if there is only one record', async () => {
|
||||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }] });
|
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }] });
|
||||||
|
|
||||||
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', navigate: {} });
|
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', navigate: {} });
|
||||||
|
@ -56,7 +56,7 @@ describe('useArrayData', () => {
|
||||||
expect(routerPush.query).toBeUndefined();
|
expect(routerPush.query).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should get data and send new URL keeping parameters, if you have more than one record', async () => {
|
it('should get data and send new URL keeping parameters, if you have more than one record', async () => {
|
||||||
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }, { id: 2 }] });
|
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [{ id: 1 }, { id: 2 }] });
|
||||||
|
|
||||||
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
|
vi.spyOn(vueRouter, 'useRoute').mockReturnValue({
|
||||||
|
@ -95,4 +95,25 @@ describe('useArrayData', () => {
|
||||||
expect(routerPush.path).toEqual('mockName/');
|
expect(routerPush.path).toEqual('mockName/');
|
||||||
expect(routerPush.query.params).toBeDefined();
|
expect(routerPush.query.params).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return one record', async () => {
|
||||||
|
vi.spyOn(axios, 'get').mockReturnValueOnce({
|
||||||
|
data: [
|
||||||
|
{ id: 1, name: 'Entity 1' },
|
||||||
|
{ id: 2, name: 'Entity 2' },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', oneRecord: true });
|
||||||
|
await arrayData.fetch({});
|
||||||
|
|
||||||
|
expect(arrayData.store.data).toEqual({ id: 1, name: 'Entity 1' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle empty data gracefully if has to return one record', async () => {
|
||||||
|
vi.spyOn(axios, 'get').mockReturnValueOnce({ data: [] });
|
||||||
|
const arrayData = useArrayData('ArrayData', { url: 'mockUrl', oneRecord: true });
|
||||||
|
await arrayData.fetch({});
|
||||||
|
|
||||||
|
expect(arrayData.store.data).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
import { describe, it, expect, vi } from 'vitest';
|
||||||
|
import { useRequired } from '../useRequired';
|
||||||
|
|
||||||
|
vi.mock('../useValidator', () => ({
|
||||||
|
useValidator: () => ({
|
||||||
|
validations: () => ({
|
||||||
|
required: vi.fn((isRequired, val) => {
|
||||||
|
if (!isRequired) return true;
|
||||||
|
return val !== null && val !== undefined && val !== '';
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('useRequired', () => {
|
||||||
|
it('should detect required when attr is boolean true', () => {
|
||||||
|
const attrs = { required: true };
|
||||||
|
const { isRequired } = useRequired(attrs);
|
||||||
|
expect(isRequired).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should detect required when attr is boolean false', () => {
|
||||||
|
const attrs = { required: false };
|
||||||
|
const { isRequired } = useRequired(attrs);
|
||||||
|
expect(isRequired).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should detect required when attr exists without value', () => {
|
||||||
|
const attrs = { required: '' };
|
||||||
|
const { isRequired } = useRequired(attrs);
|
||||||
|
expect(isRequired).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false when required attr does not exist', () => {
|
||||||
|
const attrs = { someOtherAttr: 'value' };
|
||||||
|
const { isRequired } = useRequired(attrs);
|
||||||
|
expect(isRequired).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('requiredFieldRule', () => {
|
||||||
|
it('should validate required field with value', () => {
|
||||||
|
const attrs = { required: true };
|
||||||
|
const { requiredFieldRule } = useRequired(attrs);
|
||||||
|
expect(requiredFieldRule('some value')).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate required field with empty value', () => {
|
||||||
|
const attrs = { required: true };
|
||||||
|
const { requiredFieldRule } = useRequired(attrs);
|
||||||
|
expect(requiredFieldRule('')).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should pass validation when field is not required', () => {
|
||||||
|
const attrs = { required: false };
|
||||||
|
const { requiredFieldRule } = useRequired(attrs);
|
||||||
|
expect(requiredFieldRule('')).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle null and undefined values', () => {
|
||||||
|
const attrs = { required: true };
|
||||||
|
const { requiredFieldRule } = useRequired(attrs);
|
||||||
|
expect(requiredFieldRule(null)).toBe(false);
|
||||||
|
expect(requiredFieldRule(undefined)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,65 @@
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import axios from 'axios';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
|
||||||
|
export async function checkEntryLock(entryFk, userFk) {
|
||||||
|
const { t } = useI18n();
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const { push } = useRouter();
|
||||||
|
const { data } = await axios.get(`Entries/${entryFk}`, {
|
||||||
|
params: {
|
||||||
|
filter: JSON.stringify({
|
||||||
|
fields: ['id', 'locked', 'lockerUserFk'],
|
||||||
|
include: { relation: 'user', scope: { fields: ['id', 'nickname'] } },
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const entryConfig = await axios.get('EntryConfigs/findOne');
|
||||||
|
|
||||||
|
if (data?.lockerUserFk && data?.locked) {
|
||||||
|
const now = new Date(Date.vnNow()).getTime();
|
||||||
|
const lockedTime = new Date(data.locked).getTime();
|
||||||
|
const timeDiff = (now - lockedTime) / 1000;
|
||||||
|
const isMaxTimeLockExceeded = entryConfig.data.maxLockTime > timeDiff;
|
||||||
|
|
||||||
|
if (data?.lockerUserFk !== userFk && isMaxTimeLockExceeded) {
|
||||||
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
'data-cy': 'entry-lock-confirm',
|
||||||
|
title: t('entry.lock.title'),
|
||||||
|
message: t('entry.lock.message', {
|
||||||
|
userName: data?.user?.nickname,
|
||||||
|
time: timeDiff / 60,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(
|
||||||
|
async () =>
|
||||||
|
await axios.patch(`Entries/${entryFk}`, {
|
||||||
|
locked: Date.vnNow(),
|
||||||
|
lockerUserFk: userFk,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.onCancel(() => {
|
||||||
|
push({ path: `summary` });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await axios
|
||||||
|
.patch(`Entries/${entryFk}`, {
|
||||||
|
locked: Date.vnNow(),
|
||||||
|
lockerUserFk: userFk,
|
||||||
|
})
|
||||||
|
.then(
|
||||||
|
quasar.notify({
|
||||||
|
message: t('entry.lock.success'),
|
||||||
|
color: 'positive',
|
||||||
|
group: false,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
export function getColAlign(col) {
|
||||||
|
let align;
|
||||||
|
switch (col.component) {
|
||||||
|
case 'time':
|
||||||
|
case 'date':
|
||||||
|
case 'select':
|
||||||
|
align = 'left';
|
||||||
|
break;
|
||||||
|
case 'number':
|
||||||
|
align = 'right';
|
||||||
|
break;
|
||||||
|
case 'checkbox':
|
||||||
|
align = 'center';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
align = col?.align;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/^is[A-Z]/.test(col.name) || /^has[A-Z]/.test(col.name)) align = 'center';
|
||||||
|
|
||||||
|
return 'text-' + (align ?? 'center');
|
||||||
|
}
|
|
@ -57,6 +57,7 @@ export function useArrayData(key, userOptions) {
|
||||||
'navigate',
|
'navigate',
|
||||||
'mapKey',
|
'mapKey',
|
||||||
'keepData',
|
'keepData',
|
||||||
|
'oneRecord',
|
||||||
];
|
];
|
||||||
if (typeof userOptions === 'object') {
|
if (typeof userOptions === 'object') {
|
||||||
for (const option in userOptions) {
|
for (const option in userOptions) {
|
||||||
|
@ -112,7 +113,11 @@ export function useArrayData(key, userOptions) {
|
||||||
store.isLoading = false;
|
store.isLoading = false;
|
||||||
canceller = null;
|
canceller = null;
|
||||||
|
|
||||||
processData(response.data, { map: !!store.mapKey, append });
|
processData(response.data, {
|
||||||
|
map: !!store.mapKey,
|
||||||
|
append,
|
||||||
|
oneRecord: store.oneRecord,
|
||||||
|
});
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +319,11 @@ export function useArrayData(key, userOptions) {
|
||||||
return { params, limit };
|
return { params, limit };
|
||||||
}
|
}
|
||||||
|
|
||||||
function processData(data, { map = true, append = true }) {
|
function processData(data, { map = true, append = true, oneRecord = false }) {
|
||||||
|
if (oneRecord) {
|
||||||
|
store.data = Array.isArray(data) ? data[0] : data;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!append) {
|
if (!append) {
|
||||||
store.data = [];
|
store.data = [];
|
||||||
store.map = new Map();
|
store.map = new Map();
|
||||||
|
|
|
@ -11,7 +11,7 @@ export async function useCau(res, message) {
|
||||||
const { config, headers, request, status, statusText, data } = res || {};
|
const { config, headers, request, status, statusText, data } = res || {};
|
||||||
const { params, url, method, signal, headers: confHeaders } = config || {};
|
const { params, url, method, signal, headers: confHeaders } = config || {};
|
||||||
const { message: resMessage, code, name } = data?.error || {};
|
const { message: resMessage, code, name } = data?.error || {};
|
||||||
delete confHeaders.Authorization;
|
delete confHeaders?.Authorization;
|
||||||
|
|
||||||
const additionalData = {
|
const additionalData = {
|
||||||
path: location.hash,
|
path: location.hash,
|
||||||
|
|
|
@ -2,14 +2,10 @@ import { useValidator } from 'src/composables/useValidator';
|
||||||
|
|
||||||
export function useRequired($attrs) {
|
export function useRequired($attrs) {
|
||||||
const { validations } = useValidator();
|
const { validations } = useValidator();
|
||||||
const hasRequired = Object.keys($attrs).includes('required');
|
const isRequired =
|
||||||
let isRequired = false;
|
typeof $attrs['required'] === 'boolean'
|
||||||
if (hasRequired) {
|
? $attrs['required']
|
||||||
const required = $attrs['required'];
|
: Object.keys($attrs).includes('required');
|
||||||
if (typeof required === 'boolean') {
|
|
||||||
isRequired = required;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const requiredFieldRule = (val) => validations().required(isRequired, val);
|
const requiredFieldRule = (val) => validations().required(isRequired, val);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -27,6 +27,15 @@ export function useRole() {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
function likeAny(roles) {
|
||||||
|
const roleStore = state.getRoles();
|
||||||
|
for (const role of roles) {
|
||||||
|
if (!roleStore.value.findIndex((rs) => rs.startsWith(role)) !== -1)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
function isEmployee() {
|
function isEmployee() {
|
||||||
return hasAny(['employee']);
|
return hasAny(['employee']);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +44,7 @@ export function useRole() {
|
||||||
isEmployee,
|
isEmployee,
|
||||||
fetch,
|
fetch,
|
||||||
hasAny,
|
hasAny,
|
||||||
|
likeAny,
|
||||||
state,
|
state,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,10 @@ body.body--light {
|
||||||
.q-header .q-toolbar {
|
.q-header .q-toolbar {
|
||||||
color: var(--vn-text-color);
|
color: var(--vn-text-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--vn-color-negative: $negative;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.body--dark {
|
body.body--dark {
|
||||||
--vn-header-color: #5d5d5d;
|
--vn-header-color: #5d5d5d;
|
||||||
--vn-page-color: #222;
|
--vn-page-color: #222;
|
||||||
|
@ -37,6 +40,8 @@ body.body--dark {
|
||||||
--vn-text-color-contrast: black;
|
--vn-text-color-contrast: black;
|
||||||
|
|
||||||
background-color: var(--vn-page-color);
|
background-color: var(--vn-page-color);
|
||||||
|
|
||||||
|
--vn-color-negative: $negative;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
@ -75,7 +80,6 @@ a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removes chrome autofill background
|
|
||||||
input:-webkit-autofill,
|
input:-webkit-autofill,
|
||||||
select:-webkit-autofill {
|
select:-webkit-autofill {
|
||||||
color: var(--vn-text-color);
|
color: var(--vn-text-color);
|
||||||
|
@ -149,11 +153,6 @@ select:-webkit-autofill {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vn-table-separation-row {
|
|
||||||
height: 16px !important;
|
|
||||||
background-color: var(--vn-section-color) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Estilo para el asterisco en campos requeridos */
|
/* Estilo para el asterisco en campos requeridos */
|
||||||
.q-field.required .q-field__label:after {
|
.q-field.required .q-field__label:after {
|
||||||
content: ' *';
|
content: ' *';
|
||||||
|
@ -212,6 +211,10 @@ select:-webkit-autofill {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.q-card__section[dense] {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
input[type='number'] {
|
input[type='number'] {
|
||||||
-moz-appearance: textfield;
|
-moz-appearance: textfield;
|
||||||
}
|
}
|
||||||
|
@ -226,10 +229,12 @@ input::-webkit-inner-spin-button {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.q-table__container {
|
.remove-bg {
|
||||||
/* ===== Scrollbar CSS ===== /
|
filter: brightness(1.1);
|
||||||
/ Firefox */
|
mix-blend-mode: multiply;
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-table__container {
|
||||||
* {
|
* {
|
||||||
scrollbar-width: auto;
|
scrollbar-width: auto;
|
||||||
scrollbar-color: var(--vn-label-color) transparent;
|
scrollbar-color: var(--vn-label-color) transparent;
|
||||||
|
@ -270,8 +275,6 @@ input::-webkit-inner-spin-button {
|
||||||
font-size: 11pt;
|
font-size: 11pt;
|
||||||
}
|
}
|
||||||
td {
|
td {
|
||||||
font-size: 11pt;
|
|
||||||
border-top: 1px solid var(--vn-page-color);
|
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,9 +318,6 @@ input::-webkit-inner-spin-button {
|
||||||
max-width: fit-content;
|
max-width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
.row > .column:has(.q-checkbox) {
|
|
||||||
max-width: fit-content;
|
|
||||||
}
|
|
||||||
.q-field__inner {
|
.q-field__inner {
|
||||||
.q-field__control {
|
.q-field__control {
|
||||||
min-height: auto !important;
|
min-height: auto !important;
|
||||||
|
@ -335,3 +335,7 @@ input::-webkit-inner-spin-button {
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
box-shadow: 0 4px 6px #00000000;
|
box-shadow: 0 4px 6px #00000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.containerShrinked {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// Tip: Use the "Theme Builder" on Quasar's documentation website.
|
// Tip: Use the "Theme Builder" on Quasar's documentation website.
|
||||||
// Tip: to add new colors https://quasar.dev/style/color-palette/#adding-your-own-colors
|
// Tip: to add new colors https://quasar.dev/style/color-palette/#adding-your-own-colors
|
||||||
$primary: #ec8916;
|
$primary: #ec8916;
|
||||||
$secondary: $primary;
|
$secondary: #89be34;
|
||||||
$positive: #c8e484;
|
$positive: #c8e484;
|
||||||
$negative: #fb5252;
|
$negative: #fb5252;
|
||||||
$info: #84d0e2;
|
$info: #84d0e2;
|
||||||
|
@ -30,7 +30,9 @@ $color-spacer: #7979794d;
|
||||||
$border-thin-light: 1px solid $color-spacer-light;
|
$border-thin-light: 1px solid $color-spacer-light;
|
||||||
$primary-light: #f5b351;
|
$primary-light: #f5b351;
|
||||||
$dark-shadow-color: black;
|
$dark-shadow-color: black;
|
||||||
$layout-shadow-dark: 0 0 10px 2px #00000033, 0 0px 10px #0000003d;
|
$layout-shadow-dark:
|
||||||
|
0 0 10px 2px #00000033,
|
||||||
|
0 0px 10px #0000003d;
|
||||||
$spacing-md: 16px;
|
$spacing-md: 16px;
|
||||||
$color-font-secondary: #777;
|
$color-font-secondary: #777;
|
||||||
$width-xs: 400px;
|
$width-xs: 400px;
|
||||||
|
|
|
@ -3,6 +3,8 @@ import { useI18n } from 'vue-i18n';
|
||||||
export default function (value, options = {}) {
|
export default function (value, options = {}) {
|
||||||
if (!value) return;
|
if (!value) return;
|
||||||
|
|
||||||
|
if (!isValidDate(value)) return null;
|
||||||
|
|
||||||
if (!options.dateStyle && !options.timeStyle) {
|
if (!options.dateStyle && !options.timeStyle) {
|
||||||
options.day = '2-digit';
|
options.day = '2-digit';
|
||||||
options.month = '2-digit';
|
options.month = '2-digit';
|
||||||
|
@ -10,7 +12,12 @@ export default function (value, options = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const date = new Date(value);
|
const newDate = new Date(value);
|
||||||
|
|
||||||
return new Intl.DateTimeFormat(locale.value, options).format(date);
|
return new Intl.DateTimeFormat(locale.value, options).format(newDate);
|
||||||
|
}
|
||||||
|
// handle 0000-00-00
|
||||||
|
function isValidDate(date) {
|
||||||
|
const parsedDate = new Date(date);
|
||||||
|
return parsedDate instanceof Date && !isNaN(parsedDate.getTime());
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ globals:
|
||||||
reset: Reset
|
reset: Reset
|
||||||
close: Close
|
close: Close
|
||||||
cancel: Cancel
|
cancel: Cancel
|
||||||
|
isSaveAndContinue: Save and continue
|
||||||
clone: Clone
|
clone: Clone
|
||||||
confirm: Confirm
|
confirm: Confirm
|
||||||
assign: Assign
|
assign: Assign
|
||||||
|
@ -48,6 +49,7 @@ globals:
|
||||||
rowRemoved: Row removed
|
rowRemoved: Row removed
|
||||||
pleaseWait: Please wait...
|
pleaseWait: Please wait...
|
||||||
noPinnedModules: You don't have any pinned modules
|
noPinnedModules: You don't have any pinned modules
|
||||||
|
enterToConfirm: Press Enter to confirm
|
||||||
summary:
|
summary:
|
||||||
basicData: Basic data
|
basicData: Basic data
|
||||||
daysOnward: Days onward
|
daysOnward: Days onward
|
||||||
|
@ -155,6 +157,7 @@ globals:
|
||||||
changeState: Change state
|
changeState: Change state
|
||||||
raid: 'Raid {daysInForward} days'
|
raid: 'Raid {daysInForward} days'
|
||||||
isVies: Vies
|
isVies: Vies
|
||||||
|
noData: No data available
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Login
|
logIn: Login
|
||||||
addressEdit: Update address
|
addressEdit: Update address
|
||||||
|
@ -167,6 +170,7 @@ globals:
|
||||||
workCenters: Work centers
|
workCenters: Work centers
|
||||||
modes: Modes
|
modes: Modes
|
||||||
zones: Zones
|
zones: Zones
|
||||||
|
negative: Negative
|
||||||
zonesList: List
|
zonesList: List
|
||||||
deliveryDays: Delivery days
|
deliveryDays: Delivery days
|
||||||
upcomingDeliveries: Upcoming deliveries
|
upcomingDeliveries: Upcoming deliveries
|
||||||
|
@ -174,6 +178,7 @@ globals:
|
||||||
alias: Alias
|
alias: Alias
|
||||||
aliasUsers: Users
|
aliasUsers: Users
|
||||||
subRoles: Subroles
|
subRoles: Subroles
|
||||||
|
myAccount: Mi cuenta
|
||||||
inheritedRoles: Inherited Roles
|
inheritedRoles: Inherited Roles
|
||||||
customers: Customers
|
customers: Customers
|
||||||
customerCreate: New customer
|
customerCreate: New customer
|
||||||
|
@ -332,10 +337,13 @@ globals:
|
||||||
wasteRecalc: Waste recaclulate
|
wasteRecalc: Waste recaclulate
|
||||||
operator: Operator
|
operator: Operator
|
||||||
parking: Parking
|
parking: Parking
|
||||||
|
vehicleList: Vehicles
|
||||||
|
vehicle: Vehicle
|
||||||
unsavedPopup:
|
unsavedPopup:
|
||||||
title: Unsaved changes will be lost
|
title: Unsaved changes will be lost
|
||||||
subtitle: Are you sure exit without saving?
|
subtitle: Are you sure exit without saving?
|
||||||
params:
|
params:
|
||||||
|
description: Description
|
||||||
clientFk: Client id
|
clientFk: Client id
|
||||||
salesPersonFk: Sales person
|
salesPersonFk: Sales person
|
||||||
warehouseFk: Warehouse
|
warehouseFk: Warehouse
|
||||||
|
@ -358,7 +366,13 @@ globals:
|
||||||
correctingFk: Rectificative
|
correctingFk: Rectificative
|
||||||
daysOnward: Days onward
|
daysOnward: Days onward
|
||||||
countryFk: Country
|
countryFk: Country
|
||||||
|
countryCodeFk: Country
|
||||||
companyFk: Company
|
companyFk: Company
|
||||||
|
model: Model
|
||||||
|
fuel: Fuel
|
||||||
|
active: Active
|
||||||
|
inactive: Inactive
|
||||||
|
deliveryPoint: Delivery point
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Access denied
|
statusUnauthorized: Access denied
|
||||||
statusInternalServerError: An internal server error has ocurred
|
statusInternalServerError: An internal server error has ocurred
|
||||||
|
@ -397,6 +411,106 @@ cau:
|
||||||
subtitle: By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.
|
subtitle: By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.
|
||||||
inputLabel: Explain why this error should not appear
|
inputLabel: Explain why this error should not appear
|
||||||
askPrivileges: Ask for privileges
|
askPrivileges: Ask for privileges
|
||||||
|
entry:
|
||||||
|
list:
|
||||||
|
newEntry: New entry
|
||||||
|
tableVisibleColumns:
|
||||||
|
isExcludedFromAvailable: Exclude from inventory
|
||||||
|
isOrdered: Ordered
|
||||||
|
isConfirmed: Ready to label
|
||||||
|
isReceived: Received
|
||||||
|
isRaid: Raid
|
||||||
|
landed: Date
|
||||||
|
supplierFk: Supplier
|
||||||
|
reference: Ref/Alb/Guide
|
||||||
|
invoiceNumber: Invoice
|
||||||
|
agencyModeId: Agency
|
||||||
|
isBooked: Booked
|
||||||
|
companyFk: Company
|
||||||
|
evaNotes: Notes
|
||||||
|
warehouseOutFk: Origin
|
||||||
|
warehouseInFk: Destiny
|
||||||
|
entryTypeDescription: Entry type
|
||||||
|
invoiceAmount: Import
|
||||||
|
travelFk: Travel
|
||||||
|
summary:
|
||||||
|
invoiceAmount: Amount
|
||||||
|
commission: Commission
|
||||||
|
currency: Currency
|
||||||
|
invoiceNumber: Invoice number
|
||||||
|
ordered: Ordered
|
||||||
|
booked: Booked
|
||||||
|
excludedFromAvailable: Inventory
|
||||||
|
travelReference: Reference
|
||||||
|
travelAgency: Agency
|
||||||
|
travelShipped: Shipped
|
||||||
|
travelDelivered: Delivered
|
||||||
|
travelLanded: Landed
|
||||||
|
travelReceived: Received
|
||||||
|
buys: Buys
|
||||||
|
stickers: Stickers
|
||||||
|
package: Package
|
||||||
|
packing: Pack.
|
||||||
|
grouping: Group.
|
||||||
|
buyingValue: Buying value
|
||||||
|
import: Import
|
||||||
|
pvp: PVP
|
||||||
|
basicData:
|
||||||
|
travel: Travel
|
||||||
|
currency: Currency
|
||||||
|
commission: Commission
|
||||||
|
observation: Observation
|
||||||
|
booked: Booked
|
||||||
|
excludedFromAvailable: Inventory
|
||||||
|
buys:
|
||||||
|
observations: Observations
|
||||||
|
packagingFk: Box
|
||||||
|
color: Color
|
||||||
|
printedStickers: Printed stickers
|
||||||
|
notes:
|
||||||
|
observationType: Observation type
|
||||||
|
latestBuys:
|
||||||
|
tableVisibleColumns:
|
||||||
|
image: Picture
|
||||||
|
itemFk: Item ID
|
||||||
|
weightByPiece: Weight/Piece
|
||||||
|
isActive: Active
|
||||||
|
family: Family
|
||||||
|
entryFk: Entry
|
||||||
|
freightValue: Freight value
|
||||||
|
comissionValue: Commission value
|
||||||
|
packageValue: Package value
|
||||||
|
isIgnored: Is ignored
|
||||||
|
price2: Grouping
|
||||||
|
price3: Packing
|
||||||
|
minPrice: Min
|
||||||
|
ektFk: Ekt
|
||||||
|
packingOut: Package out
|
||||||
|
landing: Landing
|
||||||
|
isExcludedFromAvailable: Exclude from inventory
|
||||||
|
isRaid: Raid
|
||||||
|
invoiceNumber: Invoice
|
||||||
|
reference: Ref/Alb/Guide
|
||||||
|
params:
|
||||||
|
isExcludedFromAvailable: Excluir del inventario
|
||||||
|
isOrdered: Pedida
|
||||||
|
isConfirmed: Lista para etiquetar
|
||||||
|
isReceived: Recibida
|
||||||
|
isRaid: Redada
|
||||||
|
landed: Fecha
|
||||||
|
supplierFk: Proveedor
|
||||||
|
invoiceNumber: Nº Factura
|
||||||
|
reference: Ref/Alb/Guía
|
||||||
|
agencyModeId: Agencia
|
||||||
|
isBooked: Asentado
|
||||||
|
companyFk: Empresa
|
||||||
|
travelFk: Envio
|
||||||
|
evaNotes: Notas
|
||||||
|
warehouseOutFk: Origen
|
||||||
|
warehouseInFk: Destino
|
||||||
|
entryTypeDescription: Tipo entrada
|
||||||
|
invoiceAmount: Importe
|
||||||
|
dated: Fecha
|
||||||
ticket:
|
ticket:
|
||||||
params:
|
params:
|
||||||
ticketFk: Ticket ID
|
ticketFk: Ticket ID
|
||||||
|
@ -626,6 +740,8 @@ wagon:
|
||||||
name: Name
|
name: Name
|
||||||
|
|
||||||
supplier:
|
supplier:
|
||||||
|
search: Search supplier
|
||||||
|
searchInfo: Search supplier by id or name
|
||||||
list:
|
list:
|
||||||
payMethod: Pay method
|
payMethod: Pay method
|
||||||
account: Account
|
account: Account
|
||||||
|
@ -715,6 +831,8 @@ travel:
|
||||||
CloneTravelAndEntries: Clone travel and his entries
|
CloneTravelAndEntries: Clone travel and his entries
|
||||||
deleteTravel: Delete travel
|
deleteTravel: Delete travel
|
||||||
AddEntry: Add entry
|
AddEntry: Add entry
|
||||||
|
availabled: Availabled
|
||||||
|
availabledHour: Availabled hour
|
||||||
thermographs: Thermographs
|
thermographs: Thermographs
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
|
|
|
@ -33,9 +33,11 @@ globals:
|
||||||
reset: Restaurar
|
reset: Restaurar
|
||||||
close: Cerrar
|
close: Cerrar
|
||||||
cancel: Cancelar
|
cancel: Cancelar
|
||||||
|
isSaveAndContinue: Guardar y continuar
|
||||||
clone: Clonar
|
clone: Clonar
|
||||||
confirm: Confirmar
|
confirm: Confirmar
|
||||||
assign: Asignar
|
assign: Asignar
|
||||||
|
replace: Sustituir
|
||||||
back: Volver
|
back: Volver
|
||||||
yes: Si
|
yes: Si
|
||||||
no: No
|
no: No
|
||||||
|
@ -48,6 +50,8 @@ globals:
|
||||||
rowRemoved: Fila eliminada
|
rowRemoved: Fila eliminada
|
||||||
pleaseWait: Por favor espera...
|
pleaseWait: Por favor espera...
|
||||||
noPinnedModules: No has fijado ningún módulo
|
noPinnedModules: No has fijado ningún módulo
|
||||||
|
split: Split
|
||||||
|
enterToConfirm: Pulsa Enter para confirmar
|
||||||
summary:
|
summary:
|
||||||
basicData: Datos básicos
|
basicData: Datos básicos
|
||||||
daysOnward: Días adelante
|
daysOnward: Días adelante
|
||||||
|
@ -55,8 +59,8 @@ globals:
|
||||||
today: Hoy
|
today: Hoy
|
||||||
yesterday: Ayer
|
yesterday: Ayer
|
||||||
dateFormat: es-ES
|
dateFormat: es-ES
|
||||||
microsip: Abrir en MicroSIP
|
|
||||||
noSelectedRows: No tienes ninguna línea seleccionada
|
noSelectedRows: No tienes ninguna línea seleccionada
|
||||||
|
microsip: Abrir en MicroSIP
|
||||||
downloadCSVSuccess: Descarga de CSV exitosa
|
downloadCSVSuccess: Descarga de CSV exitosa
|
||||||
reference: Referencia
|
reference: Referencia
|
||||||
agency: Agencia
|
agency: Agencia
|
||||||
|
@ -76,8 +80,10 @@ globals:
|
||||||
requiredField: Campo obligatorio
|
requiredField: Campo obligatorio
|
||||||
class: clase
|
class: clase
|
||||||
type: Tipo
|
type: Tipo
|
||||||
reason: motivo
|
reason: Motivo
|
||||||
|
removeSelection: Eliminar selección
|
||||||
noResults: Sin resultados
|
noResults: Sin resultados
|
||||||
|
results: resultados
|
||||||
system: Sistema
|
system: Sistema
|
||||||
notificationSent: Notificación enviada
|
notificationSent: Notificación enviada
|
||||||
warehouse: Almacén
|
warehouse: Almacén
|
||||||
|
@ -155,6 +161,7 @@ globals:
|
||||||
changeState: Cambiar estado
|
changeState: Cambiar estado
|
||||||
raid: 'Redada {daysInForward} días'
|
raid: 'Redada {daysInForward} días'
|
||||||
isVies: Vies
|
isVies: Vies
|
||||||
|
noData: Datos no disponibles
|
||||||
pageTitles:
|
pageTitles:
|
||||||
logIn: Inicio de sesión
|
logIn: Inicio de sesión
|
||||||
addressEdit: Modificar consignatario
|
addressEdit: Modificar consignatario
|
||||||
|
@ -166,6 +173,7 @@ globals:
|
||||||
agency: Agencia
|
agency: Agencia
|
||||||
workCenters: Centros de trabajo
|
workCenters: Centros de trabajo
|
||||||
modes: Modos
|
modes: Modos
|
||||||
|
negative: Tickets negativos
|
||||||
zones: Zonas
|
zones: Zonas
|
||||||
zonesList: Listado
|
zonesList: Listado
|
||||||
deliveryDays: Días de entrega
|
deliveryDays: Días de entrega
|
||||||
|
@ -286,9 +294,9 @@ globals:
|
||||||
buyRequest: Peticiones de compra
|
buyRequest: Peticiones de compra
|
||||||
wasteBreakdown: Deglose de mermas
|
wasteBreakdown: Deglose de mermas
|
||||||
itemCreate: Nuevo artículo
|
itemCreate: Nuevo artículo
|
||||||
tax: 'IVA'
|
tax: IVA
|
||||||
botanical: 'Botánico'
|
botanical: Botánico
|
||||||
barcode: 'Código de barras'
|
barcode: Código de barras
|
||||||
itemTypeCreate: Nueva familia
|
itemTypeCreate: Nueva familia
|
||||||
family: Familia
|
family: Familia
|
||||||
lastEntries: Últimas entradas
|
lastEntries: Últimas entradas
|
||||||
|
@ -332,10 +340,13 @@ globals:
|
||||||
wasteRecalc: Recalcular mermas
|
wasteRecalc: Recalcular mermas
|
||||||
operator: Operario
|
operator: Operario
|
||||||
parking: Parking
|
parking: Parking
|
||||||
|
vehicleList: Vehículos
|
||||||
|
vehicle: Vehículo
|
||||||
unsavedPopup:
|
unsavedPopup:
|
||||||
title: Los cambios que no haya guardado se perderán
|
title: Los cambios que no haya guardado se perderán
|
||||||
subtitle: ¿Seguro que quiere salir sin guardar?
|
subtitle: ¿Seguro que quiere salir sin guardar?
|
||||||
params:
|
params:
|
||||||
|
description: Descripción
|
||||||
clientFk: Id cliente
|
clientFk: Id cliente
|
||||||
salesPersonFk: Comercial
|
salesPersonFk: Comercial
|
||||||
warehouseFk: Almacén
|
warehouseFk: Almacén
|
||||||
|
@ -349,13 +360,14 @@ globals:
|
||||||
from: Desde
|
from: Desde
|
||||||
to: Hasta
|
to: Hasta
|
||||||
supplierFk: Proveedor
|
supplierFk: Proveedor
|
||||||
supplierRef: Ref. proveedor
|
supplierRef: Nº factura
|
||||||
serial: Serie
|
serial: Serie
|
||||||
amount: Importe
|
amount: Importe
|
||||||
awbCode: AWB
|
awbCode: AWB
|
||||||
daysOnward: Días adelante
|
daysOnward: Días adelante
|
||||||
packing: ITP
|
packing: ITP
|
||||||
countryFk: País
|
countryFk: País
|
||||||
|
countryCodeFk: País
|
||||||
companyFk: Empresa
|
companyFk: Empresa
|
||||||
errors:
|
errors:
|
||||||
statusUnauthorized: Acceso denegado
|
statusUnauthorized: Acceso denegado
|
||||||
|
@ -393,6 +405,87 @@ cau:
|
||||||
subtitle: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
|
subtitle: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
|
||||||
inputLabel: Explique el motivo por el que no deberia aparecer este fallo
|
inputLabel: Explique el motivo por el que no deberia aparecer este fallo
|
||||||
askPrivileges: Solicitar permisos
|
askPrivileges: Solicitar permisos
|
||||||
|
entry:
|
||||||
|
list:
|
||||||
|
newEntry: Nueva entrada
|
||||||
|
tableVisibleColumns:
|
||||||
|
isExcludedFromAvailable: Excluir del inventario
|
||||||
|
isOrdered: Pedida
|
||||||
|
isConfirmed: Lista para etiquetar
|
||||||
|
isReceived: Recibida
|
||||||
|
isRaid: Redada
|
||||||
|
landed: Fecha
|
||||||
|
supplierFk: Proveedor
|
||||||
|
invoiceNumber: Nº Factura
|
||||||
|
reference: Ref/Alb/Guía
|
||||||
|
agencyModeId: Agencia
|
||||||
|
isBooked: Asentado
|
||||||
|
companyFk: Empresa
|
||||||
|
travelFk: Envio
|
||||||
|
evaNotes: Notas
|
||||||
|
warehouseOutFk: Origen
|
||||||
|
warehouseInFk: Destino
|
||||||
|
entryTypeDescription: Tipo entrada
|
||||||
|
invoiceAmount: Importe
|
||||||
|
summary:
|
||||||
|
invoiceAmount: Importe
|
||||||
|
commission: Comisión
|
||||||
|
currency: Moneda
|
||||||
|
invoiceNumber: Núm. factura
|
||||||
|
ordered: Pedida
|
||||||
|
booked: Contabilizada
|
||||||
|
excludedFromAvailable: Inventario
|
||||||
|
travelReference: Referencia
|
||||||
|
travelAgency: Agencia
|
||||||
|
travelShipped: F. envio
|
||||||
|
travelWarehouseOut: Alm. salida
|
||||||
|
travelDelivered: Enviada
|
||||||
|
travelLanded: F. entrega
|
||||||
|
travelReceived: Recibida
|
||||||
|
buys: Compras
|
||||||
|
stickers: Etiquetas
|
||||||
|
package: Embalaje
|
||||||
|
packing: Pack.
|
||||||
|
grouping: Group.
|
||||||
|
buyingValue: Coste
|
||||||
|
import: Importe
|
||||||
|
pvp: PVP
|
||||||
|
basicData:
|
||||||
|
travel: Envío
|
||||||
|
currency: Moneda
|
||||||
|
observation: Observación
|
||||||
|
commission: Comisión
|
||||||
|
booked: Asentado
|
||||||
|
excludedFromAvailable: Inventario
|
||||||
|
buys:
|
||||||
|
observations: Observaciónes
|
||||||
|
packagingFk: Embalaje
|
||||||
|
color: Color
|
||||||
|
printedStickers: Etiquetas impresas
|
||||||
|
notes:
|
||||||
|
observationType: Tipo de observación
|
||||||
|
latestBuys:
|
||||||
|
tableVisibleColumns:
|
||||||
|
image: Foto
|
||||||
|
itemFk: Id Artículo
|
||||||
|
weightByPiece: Peso (gramos)/tallo
|
||||||
|
isActive: Activo
|
||||||
|
family: Familia
|
||||||
|
entryFk: Entrada
|
||||||
|
freightValue: Porte
|
||||||
|
comissionValue: Comisión
|
||||||
|
packageValue: Embalaje
|
||||||
|
isIgnored: Ignorado
|
||||||
|
price2: Grouping
|
||||||
|
price3: Packing
|
||||||
|
minPrice: Min
|
||||||
|
ektFk: Ekt
|
||||||
|
packingOut: Embalaje envíos
|
||||||
|
landing: Llegada
|
||||||
|
isExcludedFromAvailable: Excluir del inventario
|
||||||
|
isRaid: Redada
|
||||||
|
invoiceNumber: Nº Factura
|
||||||
|
reference: Ref/Alb/Guía
|
||||||
ticket:
|
ticket:
|
||||||
params:
|
params:
|
||||||
ticketFk: ID de ticket
|
ticketFk: ID de ticket
|
||||||
|
@ -406,6 +499,38 @@ ticket:
|
||||||
freightItemName: Nombre
|
freightItemName: Nombre
|
||||||
packageItemName: Embalaje
|
packageItemName: Embalaje
|
||||||
longName: Descripción
|
longName: Descripción
|
||||||
|
pageTitles:
|
||||||
|
tickets: Tickets
|
||||||
|
list: Listado
|
||||||
|
ticketCreate: Nuevo ticket
|
||||||
|
summary: Resumen
|
||||||
|
basicData: Datos básicos
|
||||||
|
boxing: Encajado
|
||||||
|
sms: Sms
|
||||||
|
notes: Notas
|
||||||
|
sale: Lineas del pedido
|
||||||
|
dms: Gestión documental
|
||||||
|
negative: Tickets negativos
|
||||||
|
volume: Volumen
|
||||||
|
observation: Notas
|
||||||
|
ticketAdvance: Adelantar tickets
|
||||||
|
futureTickets: Tickets a futuro
|
||||||
|
expedition: Expedición
|
||||||
|
purchaseRequest: Petición de compra
|
||||||
|
weeklyTickets: Tickets programados
|
||||||
|
saleTracking: Líneas preparadas
|
||||||
|
services: Servicios
|
||||||
|
tracking: Estados
|
||||||
|
components: Componentes
|
||||||
|
pictures: Fotos
|
||||||
|
packages: Bultos
|
||||||
|
list:
|
||||||
|
nickname: Alias
|
||||||
|
state: Estado
|
||||||
|
shipped: Enviado
|
||||||
|
landed: Entregado
|
||||||
|
salesPerson: Comercial
|
||||||
|
total: Total
|
||||||
card:
|
card:
|
||||||
customerId: ID cliente
|
customerId: ID cliente
|
||||||
customerCard: Ficha del cliente
|
customerCard: Ficha del cliente
|
||||||
|
@ -452,15 +577,11 @@ ticket:
|
||||||
consigneeStreet: Dirección
|
consigneeStreet: Dirección
|
||||||
create:
|
create:
|
||||||
address: Dirección
|
address: Dirección
|
||||||
order:
|
invoiceOut:
|
||||||
field:
|
card:
|
||||||
salesPersonFk: Comercial
|
issued: Fecha emisión
|
||||||
form:
|
customerCard: Ficha del cliente
|
||||||
clientFk: Cliente
|
ticketList: Listado de tickets
|
||||||
addressFk: Dirección
|
|
||||||
agencyModeFk: Agencia
|
|
||||||
list:
|
|
||||||
newOrder: Nuevo Pedido
|
|
||||||
summary:
|
summary:
|
||||||
issued: Fecha
|
issued: Fecha
|
||||||
dued: Fecha límite
|
dued: Fecha límite
|
||||||
|
@ -471,6 +592,71 @@ order:
|
||||||
fee: Cuota
|
fee: Cuota
|
||||||
tickets: Tickets
|
tickets: Tickets
|
||||||
totalWithVat: Importe
|
totalWithVat: Importe
|
||||||
|
globalInvoices:
|
||||||
|
errors:
|
||||||
|
chooseValidClient: Selecciona un cliente válido
|
||||||
|
chooseValidCompany: Selecciona una empresa válida
|
||||||
|
chooseValidPrinter: Selecciona una impresora válida
|
||||||
|
chooseValidSerialType: Selecciona una tipo de serie válida
|
||||||
|
fillDates: La fecha de la factura y la fecha máxima deben estar completas
|
||||||
|
invoiceDateLessThanMaxDate: La fecha de la factura no puede ser menor que la fecha máxima
|
||||||
|
invoiceWithFutureDate: Existe una factura con una fecha futura
|
||||||
|
noTicketsToInvoice: No existen tickets para facturar
|
||||||
|
criticalInvoiceError: Error crítico en la facturación proceso detenido
|
||||||
|
invalidSerialTypeForAll: El tipo de serie debe ser global cuando se facturan todos los clientes
|
||||||
|
table:
|
||||||
|
addressId: Id dirección
|
||||||
|
streetAddress: Dirección fiscal
|
||||||
|
statusCard:
|
||||||
|
percentageText: '{getPercentage}% {getAddressNumber} de {getNAddresses}'
|
||||||
|
pdfsNumberText: '{nPdfs} de {totalPdfs} PDFs'
|
||||||
|
negativeBases:
|
||||||
|
clientId: Id cliente
|
||||||
|
base: Base
|
||||||
|
active: Activo
|
||||||
|
hasToInvoice: Facturar
|
||||||
|
verifiedData: Datos comprobados
|
||||||
|
comercial: Comercial
|
||||||
|
errors:
|
||||||
|
downloadCsvFailed: Error al descargar CSV
|
||||||
|
order:
|
||||||
|
field:
|
||||||
|
salesPersonFk: Comercial
|
||||||
|
form:
|
||||||
|
clientFk: Cliente
|
||||||
|
addressFk: Dirección
|
||||||
|
agencyModeFk: Agencia
|
||||||
|
list:
|
||||||
|
newOrder: Nuevo Pedido
|
||||||
|
summary:
|
||||||
|
basket: Cesta
|
||||||
|
notConfirmed: No confirmada
|
||||||
|
created: Creado
|
||||||
|
createdFrom: Creado desde
|
||||||
|
address: Dirección
|
||||||
|
total: Total
|
||||||
|
vat: IVA
|
||||||
|
state: Estado
|
||||||
|
alias: Alias
|
||||||
|
items: Artículos
|
||||||
|
orderTicketList: Tickets del pedido
|
||||||
|
amount: Monto
|
||||||
|
confirm: Confirmar
|
||||||
|
confirmLines: Confirmar lineas
|
||||||
|
shelving:
|
||||||
|
list:
|
||||||
|
parking: Parking
|
||||||
|
priority: Prioridad
|
||||||
|
newShelving: Nuevo Carro
|
||||||
|
summary:
|
||||||
|
recyclable: Reciclable
|
||||||
|
parking:
|
||||||
|
pickingOrder: Orden de recogida
|
||||||
|
row: Fila
|
||||||
|
column: Columna
|
||||||
|
searchBar:
|
||||||
|
info: Puedes buscar por código de parking
|
||||||
|
label: Buscar parking...
|
||||||
department:
|
department:
|
||||||
chat: Chat
|
chat: Chat
|
||||||
bossDepartment: Jefe de departamento
|
bossDepartment: Jefe de departamento
|
||||||
|
@ -631,8 +817,8 @@ wagon:
|
||||||
volumeNotEmpty: El volumen no puede estar vacío
|
volumeNotEmpty: El volumen no puede estar vacío
|
||||||
typeNotEmpty: El tipo no puede estar vacío
|
typeNotEmpty: El tipo no puede estar vacío
|
||||||
maxTrays: Has alcanzado el número máximo de bandejas
|
maxTrays: Has alcanzado el número máximo de bandejas
|
||||||
minHeightBetweenTrays: 'La distancia mínima entre bandejas es '
|
minHeightBetweenTrays: La distancia mínima entre bandejas es
|
||||||
maxWagonHeight: 'La altura máxima del vagón es '
|
maxWagonHeight: La altura máxima del vagón es
|
||||||
uncompleteTrays: Hay bandejas sin completar
|
uncompleteTrays: Hay bandejas sin completar
|
||||||
params:
|
params:
|
||||||
label: Etiqueta
|
label: Etiqueta
|
||||||
|
@ -640,6 +826,8 @@ wagon:
|
||||||
volume: Volumen
|
volume: Volumen
|
||||||
name: Nombre
|
name: Nombre
|
||||||
supplier:
|
supplier:
|
||||||
|
search: Buscar proveedor
|
||||||
|
searchInfo: Buscar proveedor por id o nombre
|
||||||
list:
|
list:
|
||||||
payMethod: Método de pago
|
payMethod: Método de pago
|
||||||
account: Cuenta
|
account: Cuenta
|
||||||
|
@ -652,6 +840,7 @@ supplier:
|
||||||
verified: Verificado
|
verified: Verificado
|
||||||
isActive: Está activo
|
isActive: Está activo
|
||||||
billingData: Forma de pago
|
billingData: Forma de pago
|
||||||
|
financialData: Datos financieros
|
||||||
payDeadline: Plazo de pago
|
payDeadline: Plazo de pago
|
||||||
payDay: Día de pago
|
payDay: Día de pago
|
||||||
account: Cuenta
|
account: Cuenta
|
||||||
|
@ -729,6 +918,8 @@ travel:
|
||||||
deleteTravel: Eliminar envío
|
deleteTravel: Eliminar envío
|
||||||
AddEntry: Añadir entrada
|
AddEntry: Añadir entrada
|
||||||
thermographs: Termógrafos
|
thermographs: Termógrafos
|
||||||
|
availabled: F. Disponible
|
||||||
|
availabledHour: Hora Disponible
|
||||||
hb: HB
|
hb: HB
|
||||||
basicData:
|
basicData:
|
||||||
daysInForward: Desplazamiento automatico (redada)
|
daysInForward: Desplazamiento automatico (redada)
|
||||||
|
@ -777,7 +968,7 @@ components:
|
||||||
cardDescriptor:
|
cardDescriptor:
|
||||||
mainList: Listado principal
|
mainList: Listado principal
|
||||||
summary: Resumen
|
summary: Resumen
|
||||||
moreOptions: 'Más opciones'
|
moreOptions: Más opciones
|
||||||
leftMenu:
|
leftMenu:
|
||||||
addToPinned: Añadir a fijados
|
addToPinned: Añadir a fijados
|
||||||
removeFromPinned: Eliminar de fijados
|
removeFromPinned: Eliminar de fijados
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import Navbar from 'src/components/NavBar.vue';
|
import Navbar from 'src/components/NavBar.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QLayout view="hHh LpR fFf" v-shortcut>
|
<QLayout view="hHh LpR fFf">
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<RouterView></RouterView>
|
<RouterView></RouterView>
|
||||||
<QFooter v-if="$q.platform.is.mobile"></QFooter>
|
<QFooter v-if="$q.platform.is.mobile"></QFooter>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Dark, Quasar } from 'quasar';
|
import { Dark, Quasar } from 'quasar';
|
||||||
import { computed } from 'vue';
|
import { computed, onMounted } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { localeEquivalence } from 'src/i18n/index';
|
import { localeEquivalence } from 'src/i18n/index';
|
||||||
import quasarLang from 'src/utils/quasarLang';
|
import quasarLang from 'src/utils/quasarLang';
|
||||||
|
import { langs } from 'src/boot/defaults/constants.js';
|
||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
|
||||||
const userLocale = computed({
|
const userLocale = computed({
|
||||||
get() {
|
get() {
|
||||||
return locale.value;
|
return locale.value;
|
||||||
|
@ -28,7 +28,6 @@ const darkMode = computed({
|
||||||
Dark.set(value);
|
Dark.set(value);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const langs = ['en', 'es'];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnSection from 'src/components/common/VnSection.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
import exprBuilder from './Alias/AliasExprBuilder';
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -31,15 +32,6 @@ const columns = computed(() => [
|
||||||
create: true,
|
create: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
|
||||||
switch (param) {
|
|
||||||
case 'search':
|
|
||||||
return /^\d+$/.test(value)
|
|
||||||
? { id: value }
|
|
||||||
: { alias: { like: `%${value}%` } };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
export default (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return /^\d+$/.test(value)
|
||||||
|
? { id: value }
|
||||||
|
: {
|
||||||
|
or: [
|
||||||
|
{ name: { like: `%${value}%` } },
|
||||||
|
{ nickname: { like: `%${value}%` } },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
case 'name':
|
||||||
|
case 'nickname':
|
||||||
|
return { [param]: { like: `%${value}%` } };
|
||||||
|
case 'roleFk':
|
||||||
|
return { [param]: value };
|
||||||
|
}
|
||||||
|
};
|
|
@ -4,15 +4,16 @@ import { computed, ref } from 'vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import AccountSummary from './Card/AccountSummary.vue';
|
import AccountSummary from './Card/AccountSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
import exprBuilder from './AccountExprBuilder.js';
|
||||||
|
import filter from './Card/AccountFilter.js';
|
||||||
import VnSection from 'src/components/common/VnSection.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
|
import VnInputPassword from 'src/components/common/VnInputPassword.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const filter = {
|
const tableRef = ref();
|
||||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
|
||||||
};
|
|
||||||
const dataKey = 'AccountList';
|
const dataKey = 'AccountList';
|
||||||
const roles = ref([]);
|
const roles = ref([]);
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
@ -117,25 +118,6 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function exprBuilder(param, value) {
|
|
||||||
switch (param) {
|
|
||||||
case 'search':
|
|
||||||
return /^\d+$/.test(value)
|
|
||||||
? { id: value }
|
|
||||||
: {
|
|
||||||
or: [
|
|
||||||
{ name: { like: `%${value}%` } },
|
|
||||||
{ nickname: { like: `%${value}%` } },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
case 'name':
|
|
||||||
case 'nickname':
|
|
||||||
return { [param]: { like: `%${value}%` } };
|
|
||||||
case 'roleFk':
|
|
||||||
return { [param]: value };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData url="VnRoles" @on-fetch="(data) => (roles = data)" auto-load />
|
<FetchData url="VnRoles" @on-fetch="(data) => (roles = data)" auto-load />
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
export default (param, value) => {
|
||||||
|
switch (param) {
|
||||||
|
case 'search':
|
||||||
|
return /^\d+$/.test(value)
|
||||||
|
? { id: value }
|
||||||
|
: { alias: { like: `%${value}%` } };
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,21 +1,13 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||||
import AliasDescriptor from './AliasDescriptor.vue';
|
import AliasDescriptor from './AliasDescriptor.vue';
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnCardBeta
|
<VnCardBeta
|
||||||
data-key="Alias"
|
data-key="Alias"
|
||||||
base-url="MailAliases"
|
url="MailAliases"
|
||||||
:descriptor="AliasDescriptor"
|
:descriptor="AliasDescriptor"
|
||||||
search-data-key="AccountAliasList"
|
search-data-key="AccountAliasList"
|
||||||
:searchbar-props="{
|
|
||||||
url: 'MailAliases',
|
|
||||||
info: t('mailAlias.searchInfo'),
|
|
||||||
label: t('mailAlias.search'),
|
|
||||||
searchUrl: 'table',
|
|
||||||
}"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -7,7 +7,6 @@ import { useQuasar } from 'quasar';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
|
||||||
|
@ -29,9 +28,6 @@ const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity.alias, entity.id));
|
|
||||||
|
|
||||||
const removeAlias = () => {
|
const removeAlias = () => {
|
||||||
quasar
|
quasar
|
||||||
.dialog({
|
.dialog({
|
||||||
|
@ -55,11 +51,8 @@ const removeAlias = () => {
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
ref="descriptor"
|
ref="descriptor"
|
||||||
:url="`MailAliases/${entityId}`"
|
:url="`MailAliases/${entityId}`"
|
||||||
module="Alias"
|
data-key="Alias"
|
||||||
@on-fetch="setData"
|
title="alias"
|
||||||
data-key="aliasData"
|
|
||||||
:title="data.title"
|
|
||||||
:subtitle="data.subtitle"
|
|
||||||
>
|
>
|
||||||
<template #menu>
|
<template #menu>
|
||||||
<QItem v-ripple clickable @click="removeAlias()">
|
<QItem v-ripple clickable @click="removeAlias()">
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -18,20 +16,15 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { store } = useArrayData('Alias');
|
|
||||||
const alias = ref(store.data);
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary ref="summary" :url="`MailAliases/${entityId}`" data-key="Alias">
|
||||||
ref="summary"
|
<template #header="{ entity: alias }">
|
||||||
:url="`MailAliases/${entityId}`"
|
{{ alias.id }} - {{ alias.alias }}
|
||||||
@on-fetch="(data) => (alias = data)"
|
</template>
|
||||||
data-key="MailAliasesSummary"
|
<template #body="{ entity: alias }">
|
||||||
>
|
|
||||||
<template #header> {{ alias.id }} - {{ alias.alias }} </template>
|
|
||||||
<template #body>
|
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
<router-link
|
<router-link
|
||||||
|
|
|
@ -1,46 +1,20 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
|
import VnSelectEnum from 'src/components/common/VnSelectEnum.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import { ref, watch } from 'vue';
|
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
const { t } = useI18n();
|
|
||||||
const formModelRef = ref(null);
|
|
||||||
|
|
||||||
const accountFilter = {
|
|
||||||
where: { id: route.params.id },
|
|
||||||
fields: ['id', 'email', 'nickname', 'name', 'accountStateFk', 'packages', 'pickup'],
|
|
||||||
include: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => route.params.id,
|
|
||||||
() => formModelRef.value.reset()
|
|
||||||
);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FormModel
|
<FormModel :url-update="`VnUsers/${$route.params.id}/update-user`" model="Account">
|
||||||
ref="formModelRef"
|
|
||||||
url="VnUsers/preview"
|
|
||||||
:url-update="`VnUsers/${route.params.id}/update-user`"
|
|
||||||
:filter="accountFilter"
|
|
||||||
model="Accounts"
|
|
||||||
auto-load
|
|
||||||
@on-data-saved="formModelRef.fetch()"
|
|
||||||
>
|
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<div class="q-gutter-y-sm">
|
<div class="q-gutter-y-sm">
|
||||||
<VnInput v-model="data.name" :label="t('account.card.nickname')" />
|
<VnInput v-model="data.name" :label="$t('account.card.nickname')" />
|
||||||
<VnInput v-model="data.nickname" :label="t('account.card.alias')" />
|
<VnInput v-model="data.nickname" :label="$t('account.card.alias')" />
|
||||||
<VnInput v-model="data.email" :label="t('globals.params.email')" />
|
<VnInput v-model="data.email" :label="$t('globals.params.email')" />
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="Languages"
|
url="Languages"
|
||||||
v-model="data.lang"
|
v-model="data.lang"
|
||||||
:label="t('account.card.lang')"
|
:label="$t('account.card.lang')"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
/>
|
/>
|
||||||
|
@ -49,7 +23,7 @@ watch(
|
||||||
table="user"
|
table="user"
|
||||||
column="twoFactor"
|
column="twoFactor"
|
||||||
v-model="data.twoFactor"
|
v-model="data.twoFactor"
|
||||||
:label="t('account.card.twoFactor')"
|
:label="$t('account.card.twoFactor')"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
option-label="code"
|
option-label="code"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||||
import AccountDescriptor from './AccountDescriptor.vue';
|
import AccountDescriptor from './AccountDescriptor.vue';
|
||||||
|
import filter from './AccountFilter.js';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnCardBeta data-key="AccountId" :descriptor="AccountDescriptor" />
|
<VnCardBeta
|
||||||
|
url="VnUsers/preview"
|
||||||
|
:id-in-where="true"
|
||||||
|
data-key="Account"
|
||||||
|
:descriptor="AccountDescriptor"
|
||||||
|
:filter="filter"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,36 +1,18 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
||||||
import VnImg from 'src/components/ui/VnImg.vue';
|
import VnImg from 'src/components/ui/VnImg.vue';
|
||||||
|
import filter from './AccountFilter.js';
|
||||||
import useHasAccount from 'src/composables/useHasAccount.js';
|
import useHasAccount from 'src/composables/useHasAccount.js';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({ id: { type: Number, default: null } });
|
||||||
id: {
|
|
||||||
type: Number,
|
|
||||||
required: false,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const entityId = computed(() => {
|
|
||||||
return $props.id || route.params.id;
|
|
||||||
});
|
|
||||||
const data = ref(useCardDescription());
|
|
||||||
const hasAccount = ref();
|
const hasAccount = ref();
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity.nickname, entity.id));
|
|
||||||
|
|
||||||
const filter = {
|
|
||||||
where: { id: entityId },
|
|
||||||
fields: ['id', 'nickname', 'name', 'role'],
|
|
||||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
hasAccount.value = await useHasAccount(entityId.value);
|
hasAccount.value = await useHasAccount(entityId.value);
|
||||||
|
@ -41,12 +23,9 @@ onMounted(async () => {
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
ref="descriptor"
|
ref="descriptor"
|
||||||
:url="`VnUsers/preview`"
|
:url="`VnUsers/preview`"
|
||||||
:filter="filter"
|
:filter="{ ...filter, where: { id: entityId } }"
|
||||||
module="Account"
|
data-key="Account"
|
||||||
@on-fetch="setData"
|
title="nickname"
|
||||||
data-key="AccountId"
|
|
||||||
:title="data.title"
|
|
||||||
:subtitle="data.subtitle"
|
|
||||||
>
|
>
|
||||||
<template #menu>
|
<template #menu>
|
||||||
<AccountDescriptorMenu :entity-id="entityId" />
|
<AccountDescriptorMenu :entity-id="entityId" />
|
||||||
|
@ -62,7 +41,7 @@ onMounted(async () => {
|
||||||
<QIcon name="vn:claims" />
|
<QIcon name="vn:claims" />
|
||||||
</div>
|
</div>
|
||||||
<div class="text-grey-5" style="opacity: 0.4">
|
<div class="text-grey-5" style="opacity: 0.4">
|
||||||
{{ t('account.imageNotFound') }}
|
{{ $t('account.imageNotFound') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -70,8 +49,8 @@ onMounted(async () => {
|
||||||
</VnImg>
|
</VnImg>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('account.card.nickname')" :value="entity.name" />
|
<VnLv :label="$t('account.card.nickname')" :value="entity.name" />
|
||||||
<VnLv :label="t('account.card.role')" :value="entity.role.name" />
|
<VnLv :label="$t('account.card.role')" :value="entity.role?.name" />
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ entity }">
|
<template #actions="{ entity }">
|
||||||
<QCardActions class="q-gutter-x-md">
|
<QCardActions class="q-gutter-x-md">
|
||||||
|
@ -84,7 +63,7 @@ onMounted(async () => {
|
||||||
size="sm"
|
size="sm"
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('account.card.deactivated') }}</QTooltip>
|
<QTooltip>{{ $t('account.card.deactivated') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
<QIcon
|
<QIcon
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -95,7 +74,7 @@ onMounted(async () => {
|
||||||
size="sm"
|
size="sm"
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('account.card.enabled') }}</QTooltip>
|
<QTooltip>{{ $t('account.card.enabled') }}</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</QCardActions>
|
</QCardActions>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -12,6 +12,7 @@ import VnInputPassword from 'src/components/common/VnInputPassword.vue';
|
||||||
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
hasAccount: {
|
hasAccount: {
|
||||||
|
@ -29,7 +30,7 @@ const router = useRouter();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const { notify } = useQuasar();
|
const { notify } = useQuasar();
|
||||||
const account = computed(() => useArrayData('AccountId').store.data[0]);
|
const account = computed(() => useArrayData('Account').store.data[0]);
|
||||||
account.value.hasAccount = hasAccount.value;
|
account.value.hasAccount = hasAccount.value;
|
||||||
const entityId = computed(() => +route.params.id);
|
const entityId = computed(() => +route.params.id);
|
||||||
const hasitManagementAccess = ref();
|
const hasitManagementAccess = ref();
|
||||||
|
@ -124,18 +125,14 @@ onMounted(() => {
|
||||||
:promise="sync"
|
:promise="sync"
|
||||||
>
|
>
|
||||||
<template #customHTML>
|
<template #customHTML>
|
||||||
{{ shouldSyncPassword }}
|
<VnCheckbox
|
||||||
<QCheckbox
|
|
||||||
:label="t('account.card.actions.sync.checkbox')"
|
|
||||||
v-model="shouldSyncPassword"
|
v-model="shouldSyncPassword"
|
||||||
class="full-width"
|
:label="t('account.card.actions.sync.checkbox')"
|
||||||
|
:info="t('account.card.actions.sync.tooltip')"
|
||||||
clearable
|
clearable
|
||||||
clear-icon="close"
|
clear-icon="close"
|
||||||
>
|
color="primary"
|
||||||
<QIcon style="padding-left: 10px" color="primary" name="info" size="sm">
|
/>
|
||||||
<QTooltip>{{ t('account.card.actions.sync.tooltip') }}</QTooltip>
|
|
||||||
</QIcon></QCheckbox
|
|
||||||
>
|
|
||||||
<VnInputPassword
|
<VnInputPassword
|
||||||
v-if="shouldSyncPassword"
|
v-if="shouldSyncPassword"
|
||||||
:label="t('login.password')"
|
:label="t('login.password')"
|
||||||
|
@ -155,13 +152,13 @@ onMounted(() => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('account.card.actions.disableAccount.title'),
|
t('account.card.actions.disableAccount.title'),
|
||||||
t('account.card.actions.disableAccount.subtitle'),
|
t('account.card.actions.disableAccount.subtitle'),
|
||||||
() => deleteAccount()
|
() => deleteAccount(),
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<QItemSection>{{ t('globals.delete') }}</QItemSection>
|
<QItemSection>{{ t('globals.delete') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem v-if="hasSysadminAccess" v-ripple clickable>
|
<QItem v-if="hasSysadminAccess || isHimself" v-ripple clickable>
|
||||||
<QItemSection @click="onChangePass(isHimself)">
|
<QItemSection @click="onChangePass(isHimself)">
|
||||||
{{ isHimself ? t('globals.changePass') : t('globals.setPass') }}
|
{{ isHimself ? t('globals.changePass') : t('globals.setPass') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
@ -174,7 +171,7 @@ onMounted(() => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('account.card.actions.enableAccount.title'),
|
t('account.card.actions.enableAccount.title'),
|
||||||
t('account.card.actions.enableAccount.subtitle'),
|
t('account.card.actions.enableAccount.subtitle'),
|
||||||
() => updateStatusAccount(true)
|
() => updateStatusAccount(true),
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -188,7 +185,7 @@ onMounted(() => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('account.card.actions.disableAccount.title'),
|
t('account.card.actions.disableAccount.title'),
|
||||||
t('account.card.actions.disableAccount.subtitle'),
|
t('account.card.actions.disableAccount.subtitle'),
|
||||||
() => updateStatusAccount(false)
|
() => updateStatusAccount(false),
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -203,7 +200,7 @@ onMounted(() => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('account.card.actions.activateUser.title'),
|
t('account.card.actions.activateUser.title'),
|
||||||
t('account.card.actions.activateUser.title'),
|
t('account.card.actions.activateUser.title'),
|
||||||
() => updateStatusUser(true)
|
() => updateStatusUser(true),
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -217,7 +214,7 @@ onMounted(() => {
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('account.card.actions.deactivateUser.title'),
|
t('account.card.actions.deactivateUser.title'),
|
||||||
t('account.card.actions.deactivateUser.title'),
|
t('account.card.actions.deactivateUser.title'),
|
||||||
() => updateStatusUser(false)
|
() => updateStatusUser(false),
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default {
|
||||||
|
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||||
|
};
|
|
@ -86,7 +86,7 @@ watch(
|
||||||
() => route.params.id,
|
() => route.params.id,
|
||||||
() => {
|
() => {
|
||||||
getAccountData();
|
getAccountData();
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
onMounted(async () => await getAccountData(false));
|
onMounted(async () => await getAccountData(false));
|
||||||
|
@ -130,7 +130,8 @@ onMounted(async () => await getAccountData(false));
|
||||||
openConfirmationModal(
|
openConfirmationModal(
|
||||||
t('User will be removed from alias'),
|
t('User will be removed from alias'),
|
||||||
t('¿Seguro que quieres continuar?'),
|
t('¿Seguro que quieres continuar?'),
|
||||||
() => deleteMailAlias(row, rows, rowIndex)
|
() =>
|
||||||
|
deleteMailAlias(row, rows, rowIndex),
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -157,7 +158,7 @@ onMounted(async () => await getAccountData(false));
|
||||||
icon="add"
|
icon="add"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="openCreateMailAliasForm()"
|
@click="openCreateMailAliasForm()"
|
||||||
shortcut="+"
|
v-shortcut="'+'"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('warehouses.add') }}</QTooltip>
|
<QTooltip>{{ t('warehouses.add') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
|
|
@ -1,58 +1,41 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
import filter from './AccountFilter.js';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
|
||||||
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
||||||
|
|
||||||
|
const $props = defineProps({ id: { type: Number, default: 0 } });
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const $props = defineProps({
|
|
||||||
id: {
|
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const { store } = useArrayData('Account');
|
|
||||||
const account = ref(store.data);
|
|
||||||
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const filter = {
|
|
||||||
where: { id: entityId },
|
|
||||||
fields: ['id', 'nickname', 'name', 'role'],
|
|
||||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
data-key="AccountId"
|
data-key="Account"
|
||||||
|
ref="AccountSummary"
|
||||||
url="VnUsers/preview"
|
url="VnUsers/preview"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
@on-fetch="(data) => (account = data)"
|
|
||||||
>
|
>
|
||||||
<template #header>{{ account.id }} - {{ account.nickname }}</template>
|
<template #header="{ entity }">{{ entity.id }} - {{ entity.nickname }}</template>
|
||||||
<template #menu="">
|
<template #menu>
|
||||||
<AccountDescriptorMenu :entity-id="entityId" />
|
<AccountDescriptorMenu :entity-id="entityId" />
|
||||||
</template>
|
</template>
|
||||||
<template #body>
|
<template #body="{ entity }">
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
<router-link
|
<router-link
|
||||||
:to="{ name: 'AccountBasicData', params: { id: entityId } }"
|
:to="{ name: 'AccountBasicData', params: { id: entityId } }"
|
||||||
class="header header-link"
|
class="header header-link"
|
||||||
>
|
>
|
||||||
{{ t('globals.pageTitles.basicData') }}
|
{{ $t('globals.pageTitles.basicData') }}
|
||||||
<QIcon name="open_in_new" />
|
<QIcon name="open_in_new" />
|
||||||
</router-link>
|
</router-link>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<VnLv :label="t('account.card.nickname')" :value="account.name" />
|
<VnLv :label="$t('account.card.nickname')" :value="entity.name" />
|
||||||
<VnLv :label="t('account.card.role')" :value="account.role.name" />
|
<VnLv :label="$t('account.card.role')" :value="entity.role?.name" />
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import RoleSummary from './Card/RoleSummary.vue';
|
import RoleSummary from './Card/RoleSummary.vue';
|
||||||
|
import exprBuilder from './RoleExprBuilder.js';
|
||||||
import VnSection from 'src/components/common/VnSection.vue';
|
import VnSection from 'src/components/common/VnSection.vue';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -66,24 +67,7 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const exprBuilder = (param, value) => {
|
|
||||||
switch (param) {
|
|
||||||
case 'search':
|
|
||||||
return /^\d+$/.test(value)
|
|
||||||
? { id: value }
|
|
||||||
: {
|
|
||||||
or: [
|
|
||||||
{ name: { like: `%${value}%` } },
|
|
||||||
{ nickname: { like: `%${value}%` } },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
case 'name':
|
|
||||||
case 'description':
|
|
||||||
return { [param]: { like: `%${value}%` } };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSection
|
<VnSection
|
||||||
:data-key="dataKey"
|
:data-key="dataKey"
|
||||||
|
|
|
@ -1,24 +1,16 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
const route = useRoute();
|
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FormModel :url="`VnRoles/${route.params.id}`" model="VnRole" auto-load>
|
<FormModel model="Role" auto-load>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<VnInput v-model="data.name" :label="$t('globals.name')" />
|
||||||
<VnInput v-model="data.name" :label="t('globals.name')" />
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<div class="col">
|
<VnInput v-model="data.description" :label="$t('role.description')" />
|
||||||
<VnInput v-model="data.description" :label="t('role.description')" />
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
|
|
|
@ -3,5 +3,10 @@ import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||||
import RoleDescriptor from './RoleDescriptor.vue';
|
import RoleDescriptor from './RoleDescriptor.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCardBeta data-key="Role" :descriptor="RoleDescriptor" />
|
<VnCardBeta
|
||||||
|
url="VnRoles"
|
||||||
|
data-key="Role"
|
||||||
|
:id-in-where="true"
|
||||||
|
:descriptor="RoleDescriptor"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -26,11 +25,6 @@ const { t } = useI18n();
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
const data = ref(useCardDescription());
|
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity.name, entity.id));
|
|
||||||
const filter = {
|
|
||||||
where: { id: entityId },
|
|
||||||
};
|
|
||||||
const removeRole = async () => {
|
const removeRole = async () => {
|
||||||
await axios.delete(`VnRoles/${entityId.value}`);
|
await axios.delete(`VnRoles/${entityId.value}`);
|
||||||
notify(t('Role removed'), 'positive');
|
notify(t('Role removed'), 'positive');
|
||||||
|
@ -39,13 +33,9 @@ const removeRole = async () => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardDescriptor
|
<CardDescriptor
|
||||||
:url="`VnRoles/${entityId}`"
|
url="VnRoles"
|
||||||
:filter="filter"
|
:filter="{ where: { id: entityId } }"
|
||||||
module="Role"
|
|
||||||
@on-fetch="setData"
|
|
||||||
data-key="Role"
|
data-key="Role"
|
||||||
:title="data.title"
|
|
||||||
:subtitle="data.subtitle"
|
|
||||||
:summary="$props.summary"
|
:summary="$props.summary"
|
||||||
>
|
>
|
||||||
<template #menu>
|
<template #menu>
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import CardSummary from 'components/ui/CardSummary.vue';
|
import CardSummary from 'components/ui/CardSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -16,24 +15,18 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { store } = useArrayData('Role');
|
|
||||||
const role = ref(store.data);
|
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
const filter = {
|
|
||||||
where: { id: entityId },
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CardSummary
|
<CardSummary
|
||||||
ref="summary"
|
ref="summary"
|
||||||
:url="`VnRoles/${entityId}`"
|
url="VnRoles"
|
||||||
:filter="filter"
|
:filter="{ where: { id: entityId } }"
|
||||||
@on-fetch="(data) => (role = data)"
|
|
||||||
data-key="Role"
|
data-key="Role"
|
||||||
>
|
>
|
||||||
<template #header> {{ role.id }} - {{ role.name }} </template>
|
<template #header="{ entity }"> {{ entity.id }} - {{ entity.name }} </template>
|
||||||
<template #body>
|
<template #body="{ entity }">
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
<QCardSection class="q-pa-none">
|
<QCardSection class="q-pa-none">
|
||||||
<a
|
<a
|
||||||
|
@ -44,9 +37,9 @@ const filter = {
|
||||||
<QIcon name="open_in_new" />
|
<QIcon name="open_in_new" />
|
||||||
</a>
|
</a>
|
||||||
</QCardSection>
|
</QCardSection>
|
||||||
<VnLv :label="t('role.id')" :value="role.id" />
|
<VnLv :label="t('role.id')" :value="entity.id" />
|
||||||
<VnLv :label="t('globals.name')" :value="role.name" />
|
<VnLv :label="t('globals.name')" :value="entity.name" />
|
||||||
<VnLv :label="t('role.description')" :value="role.description" />
|
<VnLv :label="t('role.description')" :value="entity.description" />
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
</CardSummary>
|
</CardSummary>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue