mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 01:25:00 +00:00
Compare commits
533 Commits
ameliorati
...
small_issu
Author | SHA1 | Date | |
---|---|---|---|
868a94d66b | |||
3d35faede9 | |||
e9d485f814 | |||
b3b54486b5 | |||
461b96ea37 | |||
fc237db98a | |||
43daab1f7b | |||
85e8fe59a4 | |||
262fefa92f | |||
1403ee2ba5 | |||
548247188f | |||
6a34046e93 | |||
88b8ff86d1 | |||
cc258ba164 | |||
5d69e48787 | |||
cb4059e5c3 | |||
8411c909ff | |||
41fc41b1da | |||
cb5b45cbe8 | |||
4c47a35457 | |||
34dd35f2e2 | |||
6e3ce06fcf | |||
537518b66f | |||
4ad9714e8b | |||
5a936cd20b | |||
1fb14834b7 | |||
53fc5b8399 | |||
8318458805 | |||
9851efa804 | |||
327fcbef8b | |||
d60b6aa3c4 | |||
f0d0f16d3c | |||
832c7bab9f | |||
78b56dc32d | |||
62f8d2c01d | |||
388db459bf | |||
d1e28b1afc | |||
d3bf64a00c | |||
84223316c4 | |||
9f07e6a272 | |||
47d6270b7f | |||
1d4b1d852f | |||
430177f0c7 | |||
72b1916da8 | |||
b5c2dd7bd2 | |||
a9ce72034b | |||
f93c2d8d32 | |||
463b615595 | |||
95e0198952 | |||
f93c13234a | |||
ee3776288b | |||
694213e79a | |||
6b91808987 | |||
d5f1de1fbc | |||
fa9b571d6b | |||
|
d172ae9682 | ||
|
1a6c37e5a6 | ||
|
99f2692684 | ||
|
c6bbe46bae | ||
|
17036e83ba | ||
|
e8d8a57b4b | ||
|
3385cb2dda | ||
|
5b81bffcf6 | ||
|
27674985bd | ||
3c3baed1ce | |||
efd9380d13 | |||
0808f5a6f3 | |||
1c568a75ec | |||
e7676c5c2e | |||
a8024ba38f | |||
d994612987 | |||
3ee0f4bf20 | |||
ca86eb3c56 | |||
14fdeac4fd | |||
98f1f19e9a | |||
4630e2b80c | |||
5d99e261e1 | |||
f7ec87e012 | |||
0ed2dc8b13 | |||
d52ab2188c | |||
4768785bb5 | |||
47d0043462 | |||
f8d5dcf937 | |||
851fa663ca | |||
019a66c915 | |||
dfc6ed9bf3 | |||
dbb9e6a663 | |||
d6f6f49090 | |||
7c2422743e | |||
e336990b16 | |||
dee27ee01f | |||
f1c29a8bd3 | |||
7df923c669 | |||
b06e726ad1 | |||
c62254caec | |||
c382008b4d | |||
f5348daddf | |||
e13b7bf195 | |||
7fe0f08300 | |||
7d2e82d69b | |||
3f3dd83132 | |||
f3b755e46e | |||
8ba74f8de8 | |||
690f649dd1 | |||
75a240a2d6 | |||
717cd03d95 | |||
1e829707be | |||
e7928c222d | |||
120f7d8026 | |||
b6c58a5c31 | |||
74598ee926 | |||
cf40f38463 | |||
ebb2f5d243 | |||
50b7554aea | |||
f63d4fcfba | |||
6bc83edfe9 | |||
f87f03b5c0 | |||
addcf72ae6 | |||
b4e78a948b | |||
9b38e486df | |||
960bac8c37 | |||
dc09c9424a | |||
5b70fb2ee5 | |||
2450655452 | |||
41d76542b4 | |||
7faddbe3fe | |||
eec798cfd3 | |||
03e8624528 | |||
501ffe7829 | |||
a842229d5e | |||
4b87e16f6d | |||
2788170f03 | |||
1b4e5c4956 | |||
bde9e44f87 | |||
4855ec2065 | |||
c440d8a2bd | |||
7515415888 | |||
27a52ce166 | |||
17b6f287dc | |||
01ae50aca7 | |||
210d819125 | |||
8204107ceb | |||
3f3b7af42b | |||
331dd286e7 | |||
f048395a89 | |||
6a60758c0d | |||
782f0bc332 | |||
4bafa83b65 | |||
6e42b08627 | |||
3c5f0ce15e | |||
7ab57eba9a | |||
3279db85de | |||
6ab1391bd8 | |||
ce40814aa9 | |||
c58d1eccc5 | |||
f66df3b77c | |||
2aa0bbf371 | |||
0bb0b24c21 | |||
aae2ee32f6 | |||
8dbdc28df1 | |||
9ff58fe0c3 | |||
da32afeb3f | |||
a5ceb551eb | |||
17a3f45247 | |||
a156bd0863 | |||
9ef91eabfb | |||
310e9f5a82 | |||
9725970c56 | |||
546a2e4fa1 | |||
c2f75654dd | |||
683eac91d8 | |||
6e31e01e51 | |||
e94790b8ab | |||
92fae5cba2 | |||
df28494f16 | |||
4046a7ca9b | |||
910016f722 | |||
a4f446c6b9 | |||
b1dbd8b011 | |||
d7a4e6c037 | |||
e03f41ffbc | |||
2e5c2de363 | |||
|
951d686366 | ||
|
fe533bc716 | ||
|
6c47ce53e7 | ||
4448547fcd | |||
b80d109d8e | |||
dd0e695ac2 | |||
6a21bcc520 | |||
f7cb93fdac | |||
7dc85b8474 | |||
ee01020ae6 | |||
dcbac34b96 | |||
6fe78b7177 | |||
6fa0d229af | |||
e4cfb4804b | |||
6c61b2da30 | |||
dc2f094ca2 | |||
4525f01d5f | |||
3fe7e131a2 | |||
db92531257 | |||
5512e25cdf | |||
a0df8d8c61 | |||
a6826623bc | |||
267c3bae6e | |||
a131510ea8 | |||
eca00d155f | |||
6680ba19ce | |||
|
813da1f9e0 | ||
337a6eb974 | |||
ed31dc3157 | |||
98729af065 | |||
75aa600a20 | |||
caca9ad71f | |||
5a4cb31ea5 | |||
|
c82efc4fd5 | ||
6ab0007f02 | |||
672133fb5e | |||
|
503c97d8c6 | ||
|
5dc430ed31 | ||
|
855686c0ba | ||
da9d81dc05 | |||
fa938471aa | |||
c89e2662b1 | |||
b28b4e5fba | |||
ead96f3836 | |||
|
f6f24d0beb | ||
|
29c148f924 | ||
|
0ab53f4659 | ||
|
c42ec1d493 | ||
|
82e76d7d5a | ||
|
0a274eb2a4 | ||
|
6bfc180951 | ||
|
e1ccc8aba5 | ||
|
25b85fcc68 | ||
|
bcb36ddc11 | ||
|
6d607e3939 | ||
|
0fe6d7d00b | ||
|
329d3cc3d8 | ||
|
ee4d23ff82 | ||
|
54ea954a5a | ||
|
864f84fede | ||
|
68538f0e85 | ||
|
74957154b1 | ||
ff7cb6ca79 | |||
753e6c1105 | |||
27077c9d96 | |||
88c192c22e | |||
8a38712525 | |||
05aaa32881 | |||
5211fb2fe9 | |||
3a6a0da1dd | |||
e99a371f3a | |||
dba3ede9e1 | |||
a94a757ae6 | |||
cf78c59e76 | |||
6e57d16ebf | |||
f4ce634061 | |||
f9402ec981 | |||
98b0b3beeb | |||
1a95b44577 | |||
93c08f7e18 | |||
1262d8cc16 | |||
e5690b7575 | |||
406426111a | |||
374ac652d4 | |||
2208518ca0 | |||
d51752fa41 | |||
3ccc82147b | |||
81f97980fc | |||
8b945dc38b | |||
b11592fb6d | |||
d575b48e76 | |||
3fefaf1e4d | |||
9b8b60ed75 | |||
f2f39d0922 | |||
eb067fe59b | |||
aad0d295ef | |||
46560da67d | |||
3bb0e470bc | |||
81b7e769e1 | |||
7c37a5f583 | |||
c51b129a5e | |||
21630a37af | |||
f2248a1e9c | |||
d8b2d3cd90 | |||
b14b27c110 | |||
f6e65dddbe | |||
b940348452 | |||
90faa27461 | |||
a4118b1235 | |||
903d57ea9d | |||
820def6294 | |||
19a4542e2b | |||
9961c38b3c | |||
f41997e6da | |||
3927fd738c | |||
b69fdd459a | |||
1a2cb22b5b | |||
3fa4f1b28b | |||
c0d2454473 | |||
2cffd61b86 | |||
b9602aa720 | |||
219a41e034 | |||
983bca97ac | |||
c1d19640a9 | |||
5fd7d869bf | |||
4f6011348d | |||
d4430246f7 | |||
8182e35c9c | |||
c258179017 | |||
2333b5c6b4 | |||
a302f0fdbf | |||
52a0c0e95b | |||
c5f40c53ea | |||
5194cad354 | |||
34df295801 | |||
ccb302ad28 | |||
a0fd3cd481 | |||
25f43bc758 | |||
e369e43b00 | |||
88362bd284 | |||
5884fbaffc | |||
ddd1eb5d10 | |||
7d6def733c | |||
bfed062910 | |||
d3e52e81f1 | |||
647bdb2749 | |||
8fb4a7110e | |||
cd6aeefb07 | |||
668b3e182e | |||
a0b914380b | |||
bbc3399e19 | |||
52fa4b5549 | |||
3894c7a56d | |||
4933edaa94 | |||
9fd455b622 | |||
3451bcaab1 | |||
d1344d6d54 | |||
73a1d42ee7 | |||
3ceb3d4b2b | |||
10b1edda11 | |||
a0f0e4e9ad | |||
b79c1f02da | |||
c798b1290c | |||
af0905c6e0 | |||
bd528c9025 | |||
4fed96f988 | |||
3bffde6123 | |||
9fa82fc44c | |||
4001bb0996 | |||
d6135641c5 | |||
075f22e79c | |||
09e5cc1545 | |||
37b73931c4 | |||
4ad6786bf2 | |||
d11c493e2d | |||
9795704532 | |||
883cb858a9 | |||
b301c1d405 | |||
6959de4e39 | |||
9c25132216 | |||
87a917d11c | |||
026562c32f | |||
b37de4cd4f | |||
14cbb1dd28 | |||
4d65c54996 | |||
2a3f869882 | |||
d198c33f9c | |||
949a453b48 | |||
4f1a9c205f | |||
638af4728f | |||
742445e7b3 | |||
|
223efba655 | ||
|
fec8fa50ed | ||
d2b0b9d7da | |||
|
de8478f3e5 | ||
bf0a24b38e | |||
|
026ac91e69 | ||
|
6a6b1760f5 | ||
38dcca7397 | |||
176b68417a | |||
1d2299e143 | |||
20ef04683d | |||
b9674d7d28 | |||
ffec80c5fd | |||
7f28effc1e | |||
28f69d8dec | |||
80672a038c | |||
|
9fc7ed0fb6 | ||
|
975f27f780 | ||
|
043e865eb0 | ||
|
0479ddb42b | ||
f2b5cd7636 | |||
d100de4fcd | |||
e711ac1feb | |||
5b8439e13c | |||
06abefd576 | |||
|
3799627bf1 | ||
8295788d7f | |||
71e6b356c3 | |||
bbcf9cc4ca | |||
07030922e8 | |||
c16c517e97 | |||
a0afaa568d | |||
75d3dfb830 | |||
a797143511 | |||
|
4ae9b29924 | ||
|
364346d0aa | ||
|
1a025ead1b | ||
|
73c90f8c6a | ||
|
772388298d | ||
|
4184a74e7e | ||
|
237476dc28 | ||
|
e6f5ef91ec | ||
|
c9cc0dd2a9 | ||
|
10c9526b49 | ||
|
53cad32910 | ||
|
2a40645604 | ||
|
da505ed106 | ||
|
fe4b9647b9 | ||
|
1d7ef9300c | ||
|
bb9e175849 | ||
|
5a3fd2712c | ||
|
7e64ec0a45 | ||
|
0a183c8cfc | ||
|
60328032d8 | ||
|
cf4f25aaff | ||
|
71900010f6 | ||
|
3599508a3b | ||
|
b1c15ec8ce | ||
|
6a609eb1ab | ||
|
96ade5bd36 | ||
|
6383c1ca7b | ||
|
8be99bfe50 | ||
13ff55c967 | |||
8c0d8692b0 | |||
|
65bce1aacb | ||
60f7bdc926 | |||
|
4f39676e97 | ||
|
84a460c4e7 | ||
|
494573e5b4 | ||
|
c16fc77d01 | ||
|
282539ae6b | ||
|
50f1d3cd10 | ||
|
4e04714a42 | ||
|
8992b99d56 | ||
|
62536ab2ff | ||
|
b189726380 | ||
|
a63c26482e | ||
|
c208797daf | ||
|
0366d0cb17 | ||
|
2b7fa630fc | ||
|
a41b959fbd | ||
|
e4d9129af2 | ||
|
72fc6e05cc | ||
|
47a2af6f19 | ||
|
1bd01aefae | ||
|
c6b6fa5bf6 | ||
|
36d582c8ab | ||
|
df544bdfa4 | ||
|
12e17fac82 | ||
|
b2d84a7677 | ||
|
ebb679dbbb | ||
|
61bb595bba | ||
|
c7aafc6730 | ||
|
24b675ce97 | ||
|
3c888238c5 | ||
|
1bd00535ce | ||
|
d616e00660 | ||
|
5d5ad9e4f7 | ||
|
28af73db19 | ||
|
d8ca9cf082 | ||
|
0457ee2b8d | ||
bab06796f1 | |||
|
7c4f976230 | ||
9447516694 | |||
|
dbf72774c2 | ||
|
a70d5cc263 | ||
|
07eb5c797a | ||
|
a54434a677 | ||
|
ca9738b55a | ||
|
b40c25595a | ||
|
e6deb6bc7a | ||
|
e499ebdf8b | ||
|
07f086dd61 | ||
|
f2d79919f0 | ||
|
02a9e21f62 | ||
|
323434f34e | ||
|
afad23eb0f | ||
|
981c819f56 | ||
|
9907b59379 | ||
|
dc3c8a4032 | ||
|
95b50f2b99 | ||
|
b106a03534 | ||
|
b7c5a459f7 | ||
|
4a6914be22 | ||
|
5181098339 | ||
|
cc3e7f54a7 | ||
df7e76a2e7 | |||
ccd5ac74fd | |||
29c2ed3ce8 | |||
4c17ce7926 | |||
d49fd9738b | |||
892e43d195 | |||
|
fe3cbdadab | ||
|
c54290a265 | ||
|
de6df983a0 | ||
|
0585455bbe | ||
|
f508971b6a | ||
|
5c8b247f40 | ||
|
9c7c890943 | ||
|
7e02b284ca | ||
|
d4ec5d137e | ||
|
d542f582e6 | ||
|
3c37802821 | ||
|
227be0b482 | ||
|
4b8736ae57 | ||
|
206347de91 | ||
|
516c286519 | ||
|
adc462b735 | ||
|
43d6dc835f | ||
|
1557b8f80a | ||
|
20d113b1db | ||
|
114df16e0f | ||
|
b01eba2533 | ||
|
75caf3fa14 | ||
|
fdccdfe7b1 | ||
|
38ec2b5de9 | ||
|
3010df2016 | ||
|
3e7a9522b6 | ||
|
364aff36a4 | ||
|
3f1b5b2319 |
122
composer.json
122
composer.json
@@ -1,12 +1,70 @@
|
|||||||
{
|
{
|
||||||
"name": "chill-project/chill-bundles",
|
"name": "chill-project/chill-bundles",
|
||||||
"license": "AGPL-3.0-only",
|
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"description": "Most used bundles for chill-project",
|
"description": "Most used bundles for chill-project",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"chill",
|
"chill",
|
||||||
"social worker"
|
"social worker"
|
||||||
],
|
],
|
||||||
|
"license": "AGPL-3.0-only",
|
||||||
|
"require": {
|
||||||
|
"champs-libres/async-uploader-bundle": "dev-sf4",
|
||||||
|
"champs-libres/wopi-bundle": "dev-master",
|
||||||
|
"composer/package-versions-deprecated": "^1.10",
|
||||||
|
"doctrine/doctrine-bundle": "^2.1",
|
||||||
|
"doctrine/doctrine-migrations-bundle": "^3.0",
|
||||||
|
"doctrine/orm": "^2.7",
|
||||||
|
"erusev/parsedown": "^1.7",
|
||||||
|
"graylog2/gelf-php": "^1.5",
|
||||||
|
"knplabs/knp-menu": "^3.1",
|
||||||
|
"knplabs/knp-menu-bundle": "^3.0",
|
||||||
|
"knplabs/knp-time-bundle": "^1.12",
|
||||||
|
"league/csv": "^9.7.1",
|
||||||
|
"nyholm/psr7": "^1.4",
|
||||||
|
"phpoffice/phpspreadsheet": "^1.16",
|
||||||
|
"sensio/framework-extra-bundle": "^5.5",
|
||||||
|
"symfony/asset": "4.*",
|
||||||
|
"symfony/browser-kit": "^5.2",
|
||||||
|
"symfony/css-selector": "^5.2",
|
||||||
|
"symfony/expression-language": "4.*",
|
||||||
|
"symfony/form": "4.*",
|
||||||
|
"symfony/intl": "4.*",
|
||||||
|
"symfony/monolog-bundle": "^3.5",
|
||||||
|
"symfony/security-bundle": "4.*",
|
||||||
|
"symfony/serializer": "^5.2",
|
||||||
|
"symfony/swiftmailer-bundle": "^3.5",
|
||||||
|
"symfony/templating": "4.*",
|
||||||
|
"symfony/translation": "4.*",
|
||||||
|
"symfony/twig-bundle": "^4.4",
|
||||||
|
"symfony/validator": "4.*",
|
||||||
|
"symfony/webpack-encore-bundle": "^1.11",
|
||||||
|
"symfony/workflow": "4.*",
|
||||||
|
"symfony/yaml": "4.*",
|
||||||
|
"twig/extra-bundle": "^2.12 || ^3.0",
|
||||||
|
"twig/intl-extra": "^3.0",
|
||||||
|
"twig/markdown-extra": "^3.3",
|
||||||
|
"twig/twig": "^2.12 || ^3.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"symfony/symfony": "*"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/doctrine-fixtures-bundle": "^3.3",
|
||||||
|
"fakerphp/faker": "^1.13",
|
||||||
|
"nelmio/alice": "^3.8",
|
||||||
|
"phpunit/phpunit": "^7.0",
|
||||||
|
"symfony/debug-bundle": "^5.1",
|
||||||
|
"symfony/dotenv": "^5.1",
|
||||||
|
"symfony/maker-bundle": "^1.20",
|
||||||
|
"symfony/phpunit-bridge": "^5.2",
|
||||||
|
"symfony/stopwatch": "^5.1",
|
||||||
|
"symfony/var-dumper": "4.*",
|
||||||
|
"symfony/web-profiler-bundle": "^5.0"
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"bin-dir": "bin",
|
||||||
|
"vendor-dir": "tests/app/vendor"
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
|
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
|
||||||
@@ -21,7 +79,9 @@
|
|||||||
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
||||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
||||||
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src",
|
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src",
|
||||||
"Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle"
|
"Chill\\DocGeneratorBundle\\": "src/Bundle/ChillDocGeneratorBundle",
|
||||||
|
"Chill\\CalendarBundle\\": "src/Bundle/ChillCalendarBundle",
|
||||||
|
"Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
@@ -29,66 +89,12 @@
|
|||||||
"App\\": "tests/app/src/"
|
"App\\": "tests/app/src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require": {
|
"minimum-stability": "dev",
|
||||||
"champs-libres/async-uploader-bundle": "dev-sf4",
|
"prefer-stable": true,
|
||||||
"graylog2/gelf-php": "^1.5",
|
|
||||||
"symfony/form": "4.*",
|
|
||||||
"symfony/twig-bundle": "^4.4",
|
|
||||||
"twig/extra-bundle": "^2.12|^3.0",
|
|
||||||
"twig/twig": "^2.12|^3.0",
|
|
||||||
"composer/package-versions-deprecated": "^1.10",
|
|
||||||
"doctrine/doctrine-bundle": "^2.1",
|
|
||||||
"doctrine/doctrine-migrations-bundle": "^3.0",
|
|
||||||
"doctrine/orm": "^2.7",
|
|
||||||
"symfony/asset": "4.*",
|
|
||||||
"symfony/monolog-bundle": "^3.5",
|
|
||||||
"symfony/security-bundle": "4.*",
|
|
||||||
"symfony/translation": "4.*",
|
|
||||||
"symfony/validator": "4.*",
|
|
||||||
"sensio/framework-extra-bundle": "^5.5",
|
|
||||||
"symfony/yaml": "4.*",
|
|
||||||
"symfony/webpack-encore-bundle": "^1.11",
|
|
||||||
"knplabs/knp-menu": "^3.1",
|
|
||||||
"knplabs/knp-menu-bundle": "^3.0",
|
|
||||||
"symfony/templating": "4.*",
|
|
||||||
"twig/intl-extra": "^3.0",
|
|
||||||
"symfony/workflow": "4.*",
|
|
||||||
"symfony/expression-language": "4.*",
|
|
||||||
"knplabs/knp-time-bundle": "^1.12",
|
|
||||||
"symfony/intl": "4.*",
|
|
||||||
"symfony/swiftmailer-bundle": "^3.5",
|
|
||||||
"league/csv": "^9.7.1",
|
|
||||||
"phpoffice/phpspreadsheet": "^1.16",
|
|
||||||
"symfony/browser-kit": "^5.2",
|
|
||||||
"symfony/css-selector": "^5.2",
|
|
||||||
"twig/markdown-extra": "^3.3",
|
|
||||||
"erusev/parsedown": "^1.7",
|
|
||||||
"symfony/serializer": "^5.2",
|
|
||||||
"symfony/webpack-encore-bundle": "^1.11"
|
|
||||||
},
|
|
||||||
"conflict": {
|
|
||||||
"symfony/symfony": "*"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"fakerphp/faker": "^1.13",
|
|
||||||
"phpunit/phpunit": "^7.0",
|
|
||||||
"symfony/dotenv": "^5.1",
|
|
||||||
"symfony/maker-bundle": "^1.20",
|
|
||||||
"doctrine/doctrine-fixtures-bundle": "^3.3",
|
|
||||||
"symfony/stopwatch": "^5.1",
|
|
||||||
"symfony/web-profiler-bundle": "^5.0",
|
|
||||||
"symfony/var-dumper": "4.*",
|
|
||||||
"symfony/debug-bundle": "^5.1",
|
|
||||||
"symfony/phpunit-bridge": "^5.2",
|
|
||||||
"nelmio/alice": "^3.8"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"auto-scripts": {
|
"auto-scripts": {
|
||||||
"cache:clear": "symfony-cmd",
|
"cache:clear": "symfony-cmd",
|
||||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"bin-dir": "bin"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
<php>
|
<php>
|
||||||
<ini name="error_reporting" value="-1" />
|
<ini name="error_reporting" value="-1" />
|
||||||
<server name="APP_ENV" value="test" force="true" />
|
<server name="APP_ENV" value="test" force="true" />
|
||||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||||
<server name="SHELL_VERBOSITY" value="-1" />
|
<server name="SHELL_VERBOSITY" value="-1" />
|
||||||
</php>
|
</php>
|
||||||
|
|
||||||
@@ -31,6 +31,12 @@
|
|||||||
<!-- temporarily removed, the time to find a fix -->
|
<!-- temporarily removed, the time to find a fix -->
|
||||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php</exclude>
|
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php</exclude>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
|
<testsuite name="AsideActivityBundle">
|
||||||
|
<directory suffix="Test.php">src/Bundle/ChillAsideActivityBundle/src/Tests/</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="CalendarBundle">
|
||||||
|
<directory suffix="Test.php">src/Bundle/ChillCalendarBundle/Tests/</directory>
|
||||||
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
|
||||||
<listeners>
|
<listeners>
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Controller;
|
namespace Chill\ActivityBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Repository\ActivityACLAwareRepository;
|
||||||
|
use Chill\ActivityBundle\Repository\ActivityACLAwareRepositoryInterface;
|
||||||
|
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
@@ -36,6 +39,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Form\ActivityType;
|
use Chill\ActivityBundle\Form\ActivityType;
|
||||||
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,12 +57,16 @@ class ActivityController extends AbstractController
|
|||||||
|
|
||||||
protected SerializerInterface $serializer;
|
protected SerializerInterface $serializer;
|
||||||
|
|
||||||
|
protected ActivityACLAwareRepositoryInterface $activityACLAwareRepository;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
ActivityACLAwareRepositoryInterface $activityACLAwareRepository,
|
||||||
EventDispatcherInterface $eventDispatcher,
|
EventDispatcherInterface $eventDispatcher,
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper,
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,
|
||||||
SerializerInterface $serializer
|
SerializerInterface $serializer
|
||||||
) {
|
) {
|
||||||
|
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
||||||
$this->eventDispatcher = $eventDispatcher;
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
@@ -77,13 +85,9 @@ class ActivityController extends AbstractController
|
|||||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
if ($person instanceof Person) {
|
if ($person instanceof Person) {
|
||||||
$reachableScopes = $this->authorizationHelper
|
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $person);
|
||||||
->getReachableCircles($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
$activities = $this->activityACLAwareRepository
|
||||||
$person->getCenter());
|
->findByPerson($person, ActivityVoter::SEE, 0, null);
|
||||||
|
|
||||||
$activities = $em->getRepository(Activity::class)
|
|
||||||
->findByPersonImplied($person, $reachableScopes)
|
|
||||||
;
|
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, array(
|
$event = new PrivacyEvent($person, array(
|
||||||
'element_class' => Activity::class,
|
'element_class' => Activity::class,
|
||||||
@@ -93,10 +97,10 @@ class ActivityController extends AbstractController
|
|||||||
|
|
||||||
$view = 'ChillActivityBundle:Activity:listPerson.html.twig';
|
$view = 'ChillActivityBundle:Activity:listPerson.html.twig';
|
||||||
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
$activities = $em->getRepository('ChillActivityBundle:Activity')->findBy(
|
$this->denyAccessUnlessGranted(ActivityVoter::SEE, $accompanyingPeriod);
|
||||||
['accompanyingPeriod' => $accompanyingPeriod],
|
|
||||||
['date' => 'DESC'],
|
$activities = $this->activityACLAwareRepository
|
||||||
);
|
->findByAccompanyingPeriod($accompanyingPeriod, ActivityVoter::SEE);
|
||||||
|
|
||||||
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
|
$view = 'ChillActivityBundle:Activity:listAccompanyingCourse.html.twig';
|
||||||
}
|
}
|
||||||
@@ -136,6 +140,12 @@ class ActivityController extends AbstractController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->query->has('activityData')) {
|
||||||
|
$activityData = $request->query->get('activityData');
|
||||||
|
} else {
|
||||||
|
$activityData = [];
|
||||||
|
}
|
||||||
|
|
||||||
if ($view === null) {
|
if ($view === null) {
|
||||||
throw $this->createNotFoundException('Template not found');
|
throw $this->createNotFoundException('Template not found');
|
||||||
}
|
}
|
||||||
@@ -144,6 +154,7 @@ class ActivityController extends AbstractController
|
|||||||
'person' => $person,
|
'person' => $person,
|
||||||
'accompanyingCourse' => $accompanyingPeriod,
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
|
'activityData' => $activityData
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,10 +174,19 @@ class ActivityController extends AbstractController
|
|||||||
$activityType = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
|
$activityType = $em->getRepository(\Chill\ActivityBundle\Entity\ActivityType::class)
|
||||||
->find($activityType_id);
|
->find($activityType_id);
|
||||||
|
|
||||||
|
$activityData = null;
|
||||||
|
if ($request->query->has('activityData')) {
|
||||||
|
$activityData = $request->query->get('activityData');
|
||||||
|
}
|
||||||
|
|
||||||
if (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType ||
|
if (!$activityType instanceof \Chill\ActivityBundle\Entity\ActivityType ||
|
||||||
!$activityType->isActive()) {
|
!$activityType->isActive()) {
|
||||||
|
|
||||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
|
|
||||||
|
if (null !== $activityData) {
|
||||||
|
$params['activityData'] = $activityData;
|
||||||
|
}
|
||||||
return $this->redirectToRoute('chill_activity_activity_select_type', $params);
|
return $this->redirectToRoute('chill_activity_activity_select_type', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,6 +204,50 @@ class ActivityController extends AbstractController
|
|||||||
$entity->setType($activityType);
|
$entity->setType($activityType);
|
||||||
$entity->setDate(new \DateTime('now'));
|
$entity->setDate(new \DateTime('now'));
|
||||||
|
|
||||||
|
if ($request->query->has('activityData')) {
|
||||||
|
$activityData = $request->query->get('activityData');
|
||||||
|
|
||||||
|
if (array_key_exists('durationTime', $activityData)) {
|
||||||
|
$durationTimeInMinutes = $activityData['durationTime'];
|
||||||
|
$hours = floor($durationTimeInMinutes / 60);
|
||||||
|
$minutes = $durationTimeInMinutes % 60;
|
||||||
|
$duration = \DateTime::createFromFormat("H:i", $hours.':'.$minutes);
|
||||||
|
if ($duration) {
|
||||||
|
$entity->setDurationTime($duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('date', $activityData)) {
|
||||||
|
$date = \DateTime::createFromFormat('Y-m-d', $activityData['date']);
|
||||||
|
if ($date) {
|
||||||
|
$entity->setDate($date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('personsId', $activityData)) {
|
||||||
|
foreach($activityData['personsId'] as $personId){
|
||||||
|
$concernedPerson = $em->getRepository(\Chill\PersonBundle\Entity\Person::class)->find($personId);
|
||||||
|
$entity->addPerson($concernedPerson);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('professionalsId', $activityData)) {
|
||||||
|
foreach($activityData['professionalsId'] as $professionalsId){
|
||||||
|
$professional = $em->getRepository(\Chill\ThirdPartyBundle\Entity\ThirdParty::class)->find($professionalsId);
|
||||||
|
$entity->addThirdParty($professional);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('comment', $activityData)) {
|
||||||
|
$comment = new CommentEmbeddable();
|
||||||
|
$comment->setComment($activityData['comment']);
|
||||||
|
$comment->setUserId($this->getUser()->getid());
|
||||||
|
$comment->setDate(new \DateTime('now'));
|
||||||
|
$entity->setComment($comment);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
|
// TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période
|
||||||
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
|
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
|
||||||
|
|
||||||
@@ -201,6 +265,7 @@ class ActivityController extends AbstractController
|
|||||||
$this->addFlash('success', $this->get('translator')->trans('Success : activity created!'));
|
$this->addFlash('success', $this->get('translator')->trans('Success : activity created!'));
|
||||||
|
|
||||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||||
|
|
||||||
$params['id'] = $entity->getId();
|
$params['id'] = $entity->getId();
|
||||||
|
|
||||||
return $this->redirectToRoute('chill_activity_activity_show', $params);
|
return $this->redirectToRoute('chill_activity_activity_show', $params);
|
||||||
@@ -238,7 +303,7 @@ class ActivityController extends AbstractController
|
|||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $accompanyingPeriod) {
|
if (null !== $accompanyingPeriod) {
|
||||||
$entity->personsAssociated = $entity->getPersonsAssociated();
|
$entity->personsAssociated = $entity->getPersonsAssociated();
|
||||||
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
|
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
|
||||||
|
@@ -55,6 +55,7 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
|||||||
$loader->load('services/controller.yaml');
|
$loader->load('services/controller.yaml');
|
||||||
$loader->load('services/form.yaml');
|
$loader->load('services/form.yaml');
|
||||||
$loader->load('services/templating.yaml');
|
$loader->load('services/templating.yaml');
|
||||||
|
$loader->load('services/accompanyingPeriodConsistency.yaml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
|
@@ -23,6 +23,7 @@ namespace Chill\ActivityBundle\Entity;
|
|||||||
use Chill\DocStoreBundle\Entity\Document;
|
use Chill\DocStoreBundle\Entity\Document;
|
||||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
|
use Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodLinkedWithSocialIssuesEntityInterface;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||||
@@ -60,7 +61,7 @@ use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
|||||||
* path="scope")
|
* path="scope")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Activity implements HasCenterInterface, HasScopeInterface
|
class Activity implements HasCenterInterface, HasScopeInterface, AccompanyingPeriodLinkedWithSocialIssuesEntityInterface
|
||||||
{
|
{
|
||||||
const SENTRECEIVED_SENT = 'sent';
|
const SENTRECEIVED_SENT = 'sent';
|
||||||
const SENTRECEIVED_RECEIVED = 'received';
|
const SENTRECEIVED_RECEIVED = 'received';
|
||||||
@@ -417,7 +418,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
return $this->persons;
|
return $this->persons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPersonsAssociated(): array
|
public function getPersonsAssociated(): array
|
||||||
{
|
{
|
||||||
if (null !== $this->accompanyingPeriod) {
|
if (null !== $this->accompanyingPeriod) {
|
||||||
$personsAssociated = [];
|
$personsAssociated = [];
|
||||||
@@ -426,11 +427,11 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
$personsAssociated[] = $participation->getPerson();
|
$personsAssociated[] = $participation->getPerson();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $personsAssociated;
|
return $personsAssociated;
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPersonsNotAssociated(): array
|
public function getPersonsNotAssociated(): array
|
||||||
{
|
{
|
||||||
if (null !== $this->accompanyingPeriod) {
|
if (null !== $this->accompanyingPeriod) {
|
||||||
@@ -443,7 +444,7 @@ class Activity implements HasCenterInterface, HasScopeInterface
|
|||||||
return $personsNotAssociated;
|
return $personsNotAssociated;
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setPersons(?Collection $persons): self
|
public function setPersons(?Collection $persons): self
|
||||||
{
|
{
|
||||||
|
@@ -36,7 +36,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
$period = $parameters['accompanyingCourse'];
|
$period = $parameters['accompanyingCourse'];
|
||||||
|
|
||||||
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
|
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
|
||||||
$menu->addChild($this->translator->trans('Activity list'), [
|
$menu->addChild($this->translator->trans('Activity'), [
|
||||||
'route' => 'chill_activity_activity_list',
|
'route' => 'chill_activity_activity_list',
|
||||||
'routeParameters' => [
|
'routeParameters' => [
|
||||||
'accompanying_period_id' => $period->getId(),
|
'accompanying_period_id' => $period->getId(),
|
||||||
|
@@ -23,6 +23,8 @@
|
|||||||
namespace Chill\ActivityBundle\Repository;
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||||
@@ -33,9 +35,10 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
|||||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
|
|
||||||
final class ActivityACLAwareRepository
|
final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInterface
|
||||||
{
|
{
|
||||||
private AuthorizationHelper $authorizationHelper;
|
private AuthorizationHelper $authorizationHelper;
|
||||||
|
|
||||||
@@ -45,16 +48,63 @@ final class ActivityACLAwareRepository
|
|||||||
|
|
||||||
private EntityManagerInterface $em;
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private Security $security;
|
||||||
|
|
||||||
|
private CenterResolverDispatcher $centerResolverDispatcher;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AuthorizationHelper $authorizationHelper,
|
AuthorizationHelper $authorizationHelper,
|
||||||
|
CenterResolverDispatcher $centerResolverDispatcher,
|
||||||
TokenStorageInterface $tokenStorage,
|
TokenStorageInterface $tokenStorage,
|
||||||
ActivityRepository $repository,
|
ActivityRepository $repository,
|
||||||
EntityManagerInterface $em
|
EntityManagerInterface $em,
|
||||||
|
Security $security
|
||||||
) {
|
) {
|
||||||
$this->authorizationHelper = $authorizationHelper;
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->centerResolverDispatcher = $centerResolverDispatcher;
|
||||||
$this->tokenStorage = $tokenStorage;
|
$this->tokenStorage = $tokenStorage;
|
||||||
$this->repository = $repository;
|
$this->repository = $repository;
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
|
$this->security = $security;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Person $person
|
||||||
|
* @param string $role
|
||||||
|
* @param int|null $start
|
||||||
|
* @param int|null $limit
|
||||||
|
* @param array $orderBy
|
||||||
|
* @return array|Activity[]
|
||||||
|
*/
|
||||||
|
public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array
|
||||||
|
{
|
||||||
|
$user = $this->security->getUser();
|
||||||
|
$center = $this->centerResolverDispatcher->resolveCenter($person);
|
||||||
|
if (0 === count($orderBy)) {
|
||||||
|
$orderBy = ['date' => 'DESC'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$reachableScopes = $this->authorizationHelper
|
||||||
|
->getReachableCircles($user, $role, $center);
|
||||||
|
|
||||||
|
return $this->em->getRepository(Activity::class)
|
||||||
|
->findByPersonImplied($person, $reachableScopes, $orderBy, $limit, $start);
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array
|
||||||
|
{
|
||||||
|
$user = $this->security->getUser();
|
||||||
|
$center = $this->centerResolverDispatcher->resolveCenter($period);
|
||||||
|
if (0 === count($orderBy)) {
|
||||||
|
$orderBy = ['date' => 'DESC'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$scopes = $this->authorizationHelper
|
||||||
|
->getReachableCircles($user, $role, $center);
|
||||||
|
|
||||||
|
return $this->em->getRepository(Activity::class)
|
||||||
|
->findByAccompanyingPeriod($period, $scopes, true, $limit, $start, $orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function queryTimelineIndexer(string $context, array $args = []): array
|
public function queryTimelineIndexer(string $context, array $args = []): array
|
||||||
@@ -81,7 +131,7 @@ final class ActivityACLAwareRepository
|
|||||||
$metadataActivity = $this->em->getClassMetadata(Activity::class);
|
$metadataActivity = $this->em->getClassMetadata(Activity::class);
|
||||||
$metadataPerson = $this->em->getClassMetadata(Person::class);
|
$metadataPerson = $this->em->getClassMetadata(Person::class);
|
||||||
$associationMapping = $metadataActivity->getAssociationMapping('person');
|
$associationMapping = $metadataActivity->getAssociationMapping('person');
|
||||||
|
|
||||||
return $metadataActivity->getTableName().' JOIN '
|
return $metadataActivity->getTableName().' JOIN '
|
||||||
.$metadataPerson->getTableName().' ON '
|
.$metadataPerson->getTableName().' ON '
|
||||||
.$metadataPerson->getTableName().'.'.
|
.$metadataPerson->getTableName().'.'.
|
||||||
@@ -95,7 +145,7 @@ final class ActivityACLAwareRepository
|
|||||||
{
|
{
|
||||||
$where = '';
|
$where = '';
|
||||||
$parameters = [];
|
$parameters = [];
|
||||||
|
|
||||||
$metadataActivity = $this->em->getClassMetadata(Activity::class);
|
$metadataActivity = $this->em->getClassMetadata(Activity::class);
|
||||||
$metadataPerson = $this->em->getClassMetadata(Person::class);
|
$metadataPerson = $this->em->getClassMetadata(Person::class);
|
||||||
$activityToPerson = $metadataActivity->getAssociationMapping('person')['joinColumns'][0]['name'];
|
$activityToPerson = $metadataActivity->getAssociationMapping('person')['joinColumns'][0]['name'];
|
||||||
@@ -105,20 +155,20 @@ final class ActivityACLAwareRepository
|
|||||||
|
|
||||||
// acls:
|
// acls:
|
||||||
$role = new Role(ActivityVoter::SEE);
|
$role = new Role(ActivityVoter::SEE);
|
||||||
$reachableCenters = $this->authorizationHelper->getReachableCenters($this->tokenStorage->getToken()->getUser(),
|
$reachableCenters = $this->authorizationHelper->getReachableCenters($this->tokenStorage->getToken()->getUser(),
|
||||||
$role);
|
$role);
|
||||||
|
|
||||||
if (count($reachableCenters) === 0) {
|
if (count($reachableCenters) === 0) {
|
||||||
// insert a dummy condition
|
// insert a dummy condition
|
||||||
return 'FALSE = TRUE';
|
return 'FALSE = TRUE';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($context === 'person') {
|
if ($context === 'person') {
|
||||||
// we start with activities having the person_id linked to person
|
// we start with activities having the person_id linked to person
|
||||||
$where .= sprintf('%s = ? AND ', $activityToPerson);
|
$where .= sprintf('%s = ? AND ', $activityToPerson);
|
||||||
$parameters[] = $person->getId();
|
$parameters[] = $person->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
// we add acl (reachable center and scopes)
|
// we add acl (reachable center and scopes)
|
||||||
$where .= '('; // first loop for the for centers
|
$where .= '('; // first loop for the for centers
|
||||||
$centersI = 0; // like centers#i
|
$centersI = 0; // like centers#i
|
||||||
@@ -131,7 +181,7 @@ final class ActivityACLAwareRepository
|
|||||||
$reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), $role, $center);
|
$reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), $role, $center);
|
||||||
// we get the ids for those scopes
|
// we get the ids for those scopes
|
||||||
$reachablesScopesId = array_map(
|
$reachablesScopesId = array_map(
|
||||||
function(Scope $scope) { return $scope->getId(); },
|
function(Scope $scope) { return $scope->getId(); },
|
||||||
$reachableScopes
|
$reachableScopes
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -162,7 +212,7 @@ final class ActivityACLAwareRepository
|
|||||||
}
|
}
|
||||||
// close loop for centers
|
// close loop for centers
|
||||||
$where .= ')';
|
$where .= ')';
|
||||||
|
|
||||||
return [$where, $parameters];
|
return [$where, $parameters];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
|
||||||
|
interface ActivityACLAwareRepositoryInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return array|Activity[]
|
||||||
|
*/
|
||||||
|
public function findByPerson(Person $person, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array|Activity[]
|
||||||
|
*/
|
||||||
|
public function findByAccompanyingPeriod(AccompanyingPeriod $period, string $role, ?int $start = 0, ?int $limit = 1000, ?array $orderBy = []): array;
|
||||||
|
}
|
@@ -23,6 +23,8 @@
|
|||||||
namespace Chill\ActivityBundle\Repository;
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
@@ -39,15 +41,22 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
parent::__construct($registry, Activity::class);
|
parent::__construct($registry, Activity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findByPersonImplied($person, array $scopes, $orderBy = [ 'date' => 'DESC'], $limit = 100, $offset = 0)
|
/**
|
||||||
|
* @param $person
|
||||||
|
* @param array $scopes
|
||||||
|
* @param string[] $orderBy
|
||||||
|
* @param int $limit
|
||||||
|
* @param int $offset
|
||||||
|
* @return array|Activity[]
|
||||||
|
*/
|
||||||
|
public function findByPersonImplied(Person $person, array $scopes, ?array $orderBy = [ 'date' => 'DESC'], ?int $limit = 100, ?int $offset = 0): array
|
||||||
{
|
{
|
||||||
$qb = $this->createQueryBuilder('a');
|
$qb = $this->createQueryBuilder('a');
|
||||||
$qb->select('a');
|
$qb->select('a');
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
// TODO add acl
|
->where($qb->expr()->in('a.scope', ':scopes'))
|
||||||
//->where($qb->expr()->in('a.scope', ':scopes'))
|
->setParameter('scopes', $scopes)
|
||||||
//->setParameter('scopes', $scopes)
|
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->orX(
|
$qb->expr()->orX(
|
||||||
$qb->expr()->eq('a.person', ':person'),
|
$qb->expr()->eq('a.person', ':person'),
|
||||||
@@ -61,7 +70,56 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
$qb->addOrderBy('a.'.$k, $dir);
|
$qb->addOrderBy('a.'.$k, $dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$qb->setMaxResults($limit)->setFirstResult($offset);
|
||||||
|
|
||||||
return $qb->getQuery()
|
return $qb->getQuery()
|
||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param AccompanyingPeriod $period
|
||||||
|
* @param array $scopes
|
||||||
|
* @param int|null $limit
|
||||||
|
* @param int|null $offset
|
||||||
|
* @param array|string[] $orderBy
|
||||||
|
* @return array|Activity[]
|
||||||
|
*/
|
||||||
|
public function findByAccompanyingPeriod(AccompanyingPeriod $period, array $scopes, ?bool $allowNullScope = false, ?int $limit = 100, ?int $offset = 0, array $orderBy = ['date' => 'desc']): array
|
||||||
|
{
|
||||||
|
$qb = $this->createQueryBuilder('a');
|
||||||
|
$qb->select('a');
|
||||||
|
|
||||||
|
if (!$allowNullScope) {
|
||||||
|
$qb
|
||||||
|
->where($qb->expr()->in('a.scope', ':scopes'))
|
||||||
|
->setParameter('scopes', $scopes)
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
$qb
|
||||||
|
->where(
|
||||||
|
$qb->expr()->orX(
|
||||||
|
$qb->expr()->in('a.scope', ':scopes'),
|
||||||
|
$qb->expr()->isNull('a.scope')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('scopes', $scopes)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->eq('a.accompanyingPeriod', ':period')
|
||||||
|
)
|
||||||
|
->setParameter('period', $period)
|
||||||
|
;
|
||||||
|
|
||||||
|
foreach ($orderBy as $k => $dir) {
|
||||||
|
$qb->addOrderBy('a.'.$k, $dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$qb->setMaxResults($limit)->setFirstResult($offset);
|
||||||
|
|
||||||
|
return $qb->getQuery()
|
||||||
|
->getResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ div.activity-list {
|
|||||||
div.item-row.main {
|
div.item-row.main {
|
||||||
div.item-col {
|
div.item-col {
|
||||||
&:first-child {
|
&:first-child {
|
||||||
flex-basis: 27%;
|
flex-basis: 15%;
|
||||||
}
|
}
|
||||||
ul.list-content {
|
ul.list-content {
|
||||||
li.social-issues, li.social-actions {
|
li.social-issues, li.social-actions {
|
||||||
@@ -48,42 +48,45 @@ div.activity-list {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
div.item-row.comment {
|
||||||
|
margin-left: 15%;
|
||||||
|
blockquote.chill-user-quote {
|
||||||
|
margin-top: 0.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
}
|
||||||
div.item-row.details {
|
div.item-row.details {
|
||||||
flex-direction: row;
|
margin-left: 15%;
|
||||||
& > div.item-col {
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-self: center;
|
|
||||||
&:nth-child(1) {
|
|
||||||
flex-grow: 1; flex-shrink: 0; flex-basis: 30%;
|
|
||||||
}
|
|
||||||
&:nth-child(2) {
|
|
||||||
flex-grow: 0; flex-shrink: 1; flex-basis: 70%;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:only-child {
|
// override flex-bloc to adapt in list
|
||||||
flex-grow: 0; flex-shrink: 0; flex-basis: 100%;
|
// TODO refund this
|
||||||
& > div.concerned-groups {
|
div.accompanyingCourse.flex-bloc.concerned-groups {
|
||||||
flex-grow: 0; flex-shrink: 0; flex-basis: 100%;
|
margin: 0;
|
||||||
display: flex;
|
width: 100%;
|
||||||
flex-direction: column; // TODO pas fini
|
justify-content: space-around;
|
||||||
div.group {
|
div.item-bloc {
|
||||||
flex-grow: 1; flex-shrink: 0; flex-basis: 30%;
|
box-shadow: unset;
|
||||||
h4 {}
|
padding: 0;
|
||||||
ul.list-content {
|
flex-basis: 25%;
|
||||||
li {
|
div.item-row {
|
||||||
display: inline;
|
flex-direction: column;
|
||||||
|
div.item-col {
|
||||||
|
&:first-child {
|
||||||
|
width: unset;
|
||||||
|
}
|
||||||
|
&:last-child {
|
||||||
|
border-top: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
ul.list-content {
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
div.concerned-groups {
|
|
||||||
font-size: 85%;
|
|
||||||
h4 {
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ul.list-content {
|
ul.list-content {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
@@ -127,3 +130,13 @@ div.flex-bloc.concerned-groups {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// CHILL ENTITY RENDER BOX
|
||||||
|
.chill-entity {
|
||||||
|
|
||||||
|
/// ACTIVITY-REASON
|
||||||
|
&.entity-activity-reason {
|
||||||
|
margin-right: 0.3em;
|
||||||
|
font-size: 120%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
<teleport to="#add-persons">
|
<teleport to="#add-persons">
|
||||||
|
|
||||||
<div class="flex-bloc concerned-groups" :class="getContext">
|
<div class="flex-bloc concerned-groups" :class="getContext">
|
||||||
<persons-bloc
|
<persons-bloc
|
||||||
v-for="bloc in contextPersonsBlocs"
|
v-for="bloc in contextPersonsBlocs"
|
||||||
v-bind:key="bloc.key"
|
v-bind:key="bloc.key"
|
||||||
v-bind:bloc="bloc"
|
v-bind:bloc="bloc"
|
||||||
@@ -10,7 +10,15 @@
|
|||||||
</persons-bloc>
|
</persons-bloc>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<add-persons
|
<div v-if="getContext === 'accompanyingCourse' && filterSuggestedPersons.length > 0">
|
||||||
|
<ul>
|
||||||
|
<li v-for="p in filterSuggestedPersons" @click="addNewPerson(p)">
|
||||||
|
{{ p.text }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<add-persons
|
||||||
buttonTitle="activity.add_persons"
|
buttonTitle="activity.add_persons"
|
||||||
modalTitle="activity.add_persons"
|
modalTitle="activity.add_persons"
|
||||||
v-bind:key="addPersons.key"
|
v-bind:key="addPersons.key"
|
||||||
@@ -18,12 +26,12 @@
|
|||||||
@addNewPersons="addNewPersons"
|
@addNewPersons="addNewPersons"
|
||||||
ref="addPersons">
|
ref="addPersons">
|
||||||
</add-persons>
|
</add-persons>
|
||||||
|
|
||||||
</teleport>
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex';
|
import { mapState, mapGetters } from 'vuex';
|
||||||
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
|
||||||
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
|
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
|
||||||
|
|
||||||
@@ -36,29 +44,29 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
personsBlocs: [
|
personsBlocs: [
|
||||||
{ key: 'persons',
|
{ key: 'persons',
|
||||||
title: 'activity.bloc_persons',
|
title: 'activity.bloc_persons',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: false
|
included: false
|
||||||
},
|
},
|
||||||
{ key: 'personsAssociated',
|
{ key: 'personsAssociated',
|
||||||
title: 'activity.bloc_persons_associated',
|
title: 'activity.bloc_persons_associated',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: false
|
included: false
|
||||||
},
|
},
|
||||||
{ key: 'personsNotAssociated',
|
{ key: 'personsNotAssociated',
|
||||||
title: 'activity.bloc_persons_not_associated',
|
title: 'activity.bloc_persons_not_associated',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: false
|
included: false
|
||||||
},
|
},
|
||||||
{ key: 'thirdparty',
|
{ key: 'thirdparty',
|
||||||
title: 'activity.bloc_thirdparty',
|
title: 'activity.bloc_thirdparty',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: true
|
included: true
|
||||||
},
|
},
|
||||||
{ key: 'users',
|
{ key: 'users',
|
||||||
title: 'activity.bloc_users',
|
title: 'activity.bloc_users',
|
||||||
persons: [],
|
persons: [],
|
||||||
included: true
|
included: true
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -79,6 +87,9 @@ export default {
|
|||||||
users: state => state.activity.users,
|
users: state => state.activity.users,
|
||||||
accompanyingCourse: state => state.activity.accompanyingPeriod
|
accompanyingCourse: state => state.activity.accompanyingPeriod
|
||||||
}),
|
}),
|
||||||
|
...mapGetters([
|
||||||
|
'filterSuggestedPersons'
|
||||||
|
]),
|
||||||
getContext() {
|
getContext() {
|
||||||
return (this.accompanyingCourse) ? "accompanyingCourse" : "person";
|
return (this.accompanyingCourse) ? "accompanyingCourse" : "person";
|
||||||
},
|
},
|
||||||
@@ -91,10 +102,10 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setPersonsInBloc() {
|
setPersonsInBloc() {
|
||||||
let groups;
|
let groups;
|
||||||
if (this.accompanyingCourse) {
|
if (this.accompanyingCourse) {
|
||||||
groups = this.splitPersonsInGroups();
|
groups = this.splitPersonsInGroups();
|
||||||
}
|
}
|
||||||
this.personsBlocs.forEach(bloc => {
|
this.personsBlocs.forEach(bloc => {
|
||||||
if (this.accompanyingCourse) {
|
if (this.accompanyingCourse) {
|
||||||
switch (bloc.key) {
|
switch (bloc.key) {
|
||||||
@@ -109,7 +120,7 @@ export default {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (bloc.key) {
|
switch (bloc.key) {
|
||||||
case 'persons':
|
case 'persons':
|
||||||
bloc.persons = this.persons;
|
bloc.persons = this.persons;
|
||||||
bloc.included = true;
|
bloc.included = true;
|
||||||
break;
|
break;
|
||||||
@@ -128,7 +139,7 @@ export default {
|
|||||||
splitPersonsInGroups() {
|
splitPersonsInGroups() {
|
||||||
let personsAssociated = [];
|
let personsAssociated = [];
|
||||||
let personsNotAssociated = this.persons;
|
let personsNotAssociated = this.persons;
|
||||||
let participations = this.getCourseParticipations();
|
let participations = this.getCourseParticipations();
|
||||||
this.persons.forEach(person => {
|
this.persons.forEach(person => {
|
||||||
participations.forEach(participation => {
|
participations.forEach(participation => {
|
||||||
if (person.id === participation.id) {
|
if (person.id === participation.id) {
|
||||||
@@ -138,9 +149,9 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
'personsAssociated': personsAssociated,
|
'personsAssociated': personsAssociated,
|
||||||
'personsNotAssociated': personsNotAssociated
|
'personsNotAssociated': personsNotAssociated
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getCourseParticipations() {
|
getCourseParticipations() {
|
||||||
@@ -161,7 +172,11 @@ export default {
|
|||||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||||
modal.showModal = false;
|
modal.showModal = false;
|
||||||
this.setPersonsInBloc();
|
this.setPersonsInBloc();
|
||||||
}
|
},
|
||||||
|
addNewPerson(person) {
|
||||||
|
this.$store.dispatch('addPersonsInvolved', { result: person, type: 'person' });
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@@ -5,165 +5,175 @@ const debug = process.env.NODE_ENV !== 'production';
|
|||||||
//console.log('window.activity', window.activity);
|
//console.log('window.activity', window.activity);
|
||||||
|
|
||||||
const addIdToValue = (string, id) => {
|
const addIdToValue = (string, id) => {
|
||||||
let array = string ? string.split(',') : [];
|
let array = string ? string.split(',') : [];
|
||||||
array.push(id.toString());
|
array.push(id.toString());
|
||||||
let str = array.join();
|
let str = array.join();
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeIdFromValue = (string, id) => {
|
const removeIdFromValue = (string, id) => {
|
||||||
let array = string.split(',');
|
let array = string.split(',');
|
||||||
array = array.filter(el => el !== id.toString());
|
array = array.filter(el => el !== id.toString());
|
||||||
let str = array.join();
|
let str = array.join();
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
const store = createStore({
|
const store = createStore({
|
||||||
strict: debug,
|
strict: debug,
|
||||||
state: {
|
state: {
|
||||||
activity: window.activity,
|
activity: window.activity,
|
||||||
socialIssuesOther: [],
|
socialIssuesOther: [],
|
||||||
socialActionsList: [],
|
socialActionsList: [],
|
||||||
},
|
},
|
||||||
mutations: {
|
getters: {
|
||||||
|
filterSuggestedPersons(state) {
|
||||||
// SocialIssueAcc
|
if (typeof(state.activity.accompanyingPeriod) === 'undefined') {
|
||||||
addIssueInList(state, issue) {
|
return [];
|
||||||
//console.log('add issue list', issue.id);
|
|
||||||
state.activity.accompanyingPeriod.socialIssues.push(issue);
|
|
||||||
},
|
|
||||||
addIssueSelected(state, issue) {
|
|
||||||
//console.log('add issue selected', issue.id);
|
|
||||||
state.activity.socialIssues.push(issue);
|
|
||||||
},
|
|
||||||
updateIssuesSelected(state, issues) {
|
|
||||||
//console.log('update issues selected', issues);
|
|
||||||
state.activity.socialIssues = issues;
|
|
||||||
},
|
|
||||||
updateIssuesOther(state, payload) {
|
|
||||||
//console.log('update issues other');
|
|
||||||
state.socialIssuesOther = payload;
|
|
||||||
},
|
|
||||||
removeIssueInOther(state, issue) {
|
|
||||||
//console.log('remove issue other', issue.id);
|
|
||||||
state.socialIssuesOther = state.socialIssuesOther.filter(i => i.id !== issue.id);
|
|
||||||
},
|
|
||||||
resetActionsList(state) {
|
|
||||||
//console.log('reset list actions');
|
|
||||||
state.socialActionsList = [];
|
|
||||||
},
|
|
||||||
addActionInList(state, action) {
|
|
||||||
//console.log('add action list', action.id);
|
|
||||||
state.socialActionsList.push(action);
|
|
||||||
},
|
|
||||||
updateActionsSelected(state, actions) {
|
|
||||||
//console.log('update actions selected', actions);
|
|
||||||
state.activity.socialActions = actions;
|
|
||||||
},
|
|
||||||
filterList(state, list) {
|
|
||||||
const filterList = (list) => {
|
|
||||||
// remove duplicates entries
|
|
||||||
list = list.filter((value, index) => list.findIndex(array => array.id === value.id) === index);
|
|
||||||
// alpha sort
|
|
||||||
list.sort((a,b) => (a.text > b.text) ? 1 : ((b.text > a.text) ? -1 : 0));
|
|
||||||
return list;
|
|
||||||
};
|
|
||||||
if (list === 'issues') {
|
|
||||||
state.activity.accompanyingPeriod.socialIssues = filterList(state.activity.accompanyingPeriod.socialIssues);
|
|
||||||
}
|
|
||||||
if (list === 'actions') {
|
|
||||||
state.socialActionsList = filterList(state.socialActionsList);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// ConcernedGroups
|
|
||||||
addPersonsInvolved(state, payload) {
|
|
||||||
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
|
||||||
switch (payload.result.type) {
|
|
||||||
case 'person':
|
|
||||||
state.activity.persons.push(payload.result);
|
|
||||||
break;
|
|
||||||
case 'thirdparty':
|
|
||||||
state.activity.thirdParties.push(payload.result);
|
|
||||||
break;
|
|
||||||
case 'user':
|
|
||||||
state.activity.users.push(payload.result);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
},
|
|
||||||
removePersonInvolved(state, payload) {
|
|
||||||
//console.log('### mutation removePersonInvolved', payload.type);
|
|
||||||
switch (payload.type) {
|
|
||||||
case 'person':
|
|
||||||
state.activity.persons = state.activity.persons.filter(person => person !== payload);
|
|
||||||
break;
|
|
||||||
case 'thirdparty':
|
|
||||||
state.activity.thirdParties = state.activity.thirdParties.filter(thirdparty => thirdparty !== payload);
|
|
||||||
break;
|
|
||||||
case 'user':
|
|
||||||
state.activity.users = state.activity.users.filter(user => user !== payload);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
},
|
let existingPersonIds = state.activity.persons.map(p => p.id);
|
||||||
actions: {
|
return state.activity.accompanyingPeriod.participations.filter(p => p.endDate === null)
|
||||||
addIssueSelected({ commit }, issue) {
|
.map(p => p.person)
|
||||||
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
|
.filter(p => !existingPersonIds.includes(p.id))
|
||||||
aSocialIssues.value = addIdToValue(aSocialIssues.value, issue.id);
|
}
|
||||||
commit('addIssueSelected', issue);
|
},
|
||||||
},
|
mutations: {
|
||||||
updateIssuesSelected({ commit }, payload) {
|
// SocialIssueAcc
|
||||||
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
|
addIssueInList(state, issue) {
|
||||||
aSocialIssues.value = '';
|
//console.log('add issue list', issue.id);
|
||||||
payload.forEach(item => {
|
state.activity.accompanyingPeriod.socialIssues.push(issue);
|
||||||
aSocialIssues.value = addIdToValue(aSocialIssues.value, item.id);
|
},
|
||||||
});
|
addIssueSelected(state, issue) {
|
||||||
commit('updateIssuesSelected', payload);
|
//console.log('add issue selected', issue.id);
|
||||||
},
|
state.activity.socialIssues.push(issue);
|
||||||
updateActionsSelected({ commit }, payload) {
|
},
|
||||||
let aSocialActions = document.getElementById("chill_activitybundle_activity_socialActions");
|
updateIssuesSelected(state, issues) {
|
||||||
aSocialActions.value = '';
|
//console.log('update issues selected', issues);
|
||||||
payload.forEach(item => {
|
state.activity.socialIssues = issues;
|
||||||
aSocialActions.value = addIdToValue(aSocialActions.value, item.id);
|
},
|
||||||
});
|
updateIssuesOther(state, payload) {
|
||||||
commit('updateActionsSelected', payload);
|
//console.log('update issues other');
|
||||||
},
|
state.socialIssuesOther = payload;
|
||||||
addPersonsInvolved({ commit }, payload) {
|
},
|
||||||
//console.log('### action addPersonsInvolved', payload.result.type);
|
removeIssueInOther(state, issue) {
|
||||||
switch (payload.result.type) {
|
//console.log('remove issue other', issue.id);
|
||||||
case 'person':
|
state.socialIssuesOther = state.socialIssuesOther.filter(i => i.id !== issue.id);
|
||||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
},
|
||||||
aPersons.value = addIdToValue(aPersons.value, payload.result.id);
|
resetActionsList(state) {
|
||||||
break;
|
//console.log('reset list actions');
|
||||||
case 'thirdparty':
|
state.socialActionsList = [];
|
||||||
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
|
},
|
||||||
aThirdParties.value = addIdToValue(aThirdParties.value, payload.result.id);
|
addActionInList(state, action) {
|
||||||
break;
|
//console.log('add action list', action.id);
|
||||||
case 'user':
|
state.socialActionsList.push(action);
|
||||||
let aUsers = document.getElementById("chill_activitybundle_activity_users");
|
},
|
||||||
aUsers.value = addIdToValue(aUsers.value, payload.result.id);
|
updateActionsSelected(state, actions) {
|
||||||
break;
|
//console.log('update actions selected', actions);
|
||||||
};
|
state.activity.socialActions = actions;
|
||||||
commit('addPersonsInvolved', payload);
|
},
|
||||||
},
|
filterList(state, list) {
|
||||||
removePersonInvolved({ commit }, payload) {
|
const filterList = (list) => {
|
||||||
//console.log('### action removePersonInvolved', payload);
|
// remove duplicates entries
|
||||||
switch (payload.type) {
|
list = list.filter((value, index) => list.findIndex(array => array.id === value.id) === index);
|
||||||
case 'person':
|
// alpha sort
|
||||||
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
list.sort((a,b) => (a.text > b.text) ? 1 : ((b.text > a.text) ? -1 : 0));
|
||||||
aPersons.value = removeIdFromValue(aPersons.value, payload.id);
|
return list;
|
||||||
break;
|
};
|
||||||
case 'thirdparty':
|
if (list === 'issues') {
|
||||||
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
|
state.activity.accompanyingPeriod.socialIssues = filterList(state.activity.accompanyingPeriod.socialIssues);
|
||||||
aThirdParties.value = removeIdFromValue(aThirdParties.value, payload.id);
|
|
||||||
break;
|
|
||||||
case 'user':
|
|
||||||
let aUsers = document.getElementById("chill_activitybundle_activity_users");
|
|
||||||
aUsers.value = removeIdFromValue(aUsers.value, payload.id);
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
commit('removePersonInvolved', payload);
|
|
||||||
}
|
}
|
||||||
|
if (list === 'actions') {
|
||||||
|
state.socialActionsList = filterList(state.socialActionsList);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// ConcernedGroups
|
||||||
|
addPersonsInvolved(state, payload) {
|
||||||
|
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
||||||
|
switch (payload.result.type) {
|
||||||
|
case 'person':
|
||||||
|
state.activity.persons.push(payload.result);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
state.activity.thirdParties.push(payload.result);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
state.activity.users.push(payload.result);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
removePersonInvolved(state, payload) {
|
||||||
|
//console.log('### mutation removePersonInvolved', payload.type);
|
||||||
|
switch (payload.type) {
|
||||||
|
case 'person':
|
||||||
|
state.activity.persons = state.activity.persons.filter(person => person !== payload);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
state.activity.thirdParties = state.activity.thirdParties.filter(thirdparty => thirdparty !== payload);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
state.activity.users = state.activity.users.filter(user => user !== payload);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
addIssueSelected({ commit }, issue) {
|
||||||
|
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
|
||||||
|
aSocialIssues.value = addIdToValue(aSocialIssues.value, issue.id);
|
||||||
|
commit('addIssueSelected', issue);
|
||||||
|
},
|
||||||
|
updateIssuesSelected({ commit }, payload) {
|
||||||
|
let aSocialIssues = document.getElementById("chill_activitybundle_activity_socialIssues");
|
||||||
|
aSocialIssues.value = '';
|
||||||
|
payload.forEach(item => {
|
||||||
|
aSocialIssues.value = addIdToValue(aSocialIssues.value, item.id);
|
||||||
|
});
|
||||||
|
commit('updateIssuesSelected', payload);
|
||||||
|
},
|
||||||
|
updateActionsSelected({ commit }, payload) {
|
||||||
|
let aSocialActions = document.getElementById("chill_activitybundle_activity_socialActions");
|
||||||
|
aSocialActions.value = '';
|
||||||
|
payload.forEach(item => {
|
||||||
|
aSocialActions.value = addIdToValue(aSocialActions.value, item.id);
|
||||||
|
});
|
||||||
|
commit('updateActionsSelected', payload);
|
||||||
|
},
|
||||||
|
addPersonsInvolved({ commit }, payload) {
|
||||||
|
//console.log('### action addPersonsInvolved', payload.result.type);
|
||||||
|
switch (payload.result.type) {
|
||||||
|
case 'person':
|
||||||
|
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||||
|
aPersons.value = addIdToValue(aPersons.value, payload.result.id);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
|
||||||
|
aThirdParties.value = addIdToValue(aThirdParties.value, payload.result.id);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
let aUsers = document.getElementById("chill_activitybundle_activity_users");
|
||||||
|
aUsers.value = addIdToValue(aUsers.value, payload.result.id);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
commit('addPersonsInvolved', payload);
|
||||||
|
},
|
||||||
|
removePersonInvolved({ commit }, payload) {
|
||||||
|
//console.log('### action removePersonInvolved', payload);
|
||||||
|
switch (payload.type) {
|
||||||
|
case 'person':
|
||||||
|
let aPersons = document.getElementById("chill_activitybundle_activity_persons");
|
||||||
|
aPersons.value = removeIdFromValue(aPersons.value, payload.id);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
let aThirdParties = document.getElementById("chill_activitybundle_activity_thirdParties");
|
||||||
|
aThirdParties.value = removeIdFromValue(aThirdParties.value, payload.id);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
let aUsers = document.getElementById("chill_activitybundle_activity_users");
|
||||||
|
aUsers.value = removeIdFromValue(aUsers.value, payload.id);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
commit('removePersonInvolved', payload);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Binary file not shown.
@@ -59,7 +59,7 @@
|
|||||||
{% for item in bloc.items %}
|
{% for item in bloc.items %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||||
<span class="badge bg-primary">
|
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
||||||
{{ item|chill_entity_render_box({
|
{{ item|chill_entity_render_box({
|
||||||
'render': 'raw',
|
'render': 'raw',
|
||||||
'addAltNames': false
|
'addAltNames': false
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
{% for item in bloc.items %}
|
{% for item in bloc.items %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
||||||
<span class="badge bg-primary">
|
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
||||||
{{ item|chill_entity_render_box({
|
{{ item|chill_entity_render_box({
|
||||||
'render': 'raw',
|
'render': 'raw',
|
||||||
'addAltNames': false
|
'addAltNames': false
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="duration">
|
<div class="duration">
|
||||||
{% if t.durationTimeVisible > 0 %}
|
{% if activity.durationTime and t.durationTimeVisible %}
|
||||||
<p>
|
<p>
|
||||||
<i class="fa fa-fw fa-hourglass-end"></i>
|
<i class="fa fa-fw fa-hourglass-end"></i>
|
||||||
{{ activity.durationTime|date('H:i') }}
|
{{ activity.durationTime|date('H:i') }}
|
||||||
@@ -34,127 +34,150 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
||||||
<div class="accompanyingPeriodLink" style="margin-top: 1rem">
|
<div class="mt-3">
|
||||||
<a href="{{ chill_path_add_return_path(
|
<a class="btn btn-sm btn-outline-primary"
|
||||||
"chill_person_accompanying_course_index",
|
title="{{ 'Period number %number%'|trans({'%number%': activity.accompanyingPeriod.id}) }}"
|
||||||
{ 'accompanying_period_id': activity.accompanyingPeriod.id }
|
href="{{ chill_path_add_return_path(
|
||||||
) }}">
|
"chill_person_accompanying_course_index",
|
||||||
<i class="fa fa-random"></i>
|
{ 'accompanying_period_id': activity.accompanyingPeriod.id }
|
||||||
{{ activity.accompanyingPeriod.id }}
|
) }}"><i class="fa fa-random"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
<ul class="list-content">
|
|
||||||
{% if activity.user and t.userVisible %}
|
|
||||||
<li>
|
|
||||||
<b>{{ 'by'|trans }}{{ activity.user.usernameCanonical }}</b>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<li>
|
<div class="float-button top">
|
||||||
<b>{{ activity.type.name | localize_translatable_string }}</b>
|
<div class="box">
|
||||||
|
|
||||||
{% if activity.attendee is not null and t.attendeeVisible %}
|
<div class="action">
|
||||||
{% if activity.attendee %}
|
<ul class="record_actions">
|
||||||
{{ '→ ' ~ 'present'|trans|capitalize }}
|
|
||||||
{% else %}
|
|
||||||
{{ '→ ' ~ 'not present'|trans|capitalize }}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<b>{{ 'location'|trans ~ ': ' }}</b>
|
|
||||||
Domicile de l'usager
|
|
||||||
{#
|
|
||||||
{% if activity.location %}{{ activity.location }}{% endif %}
|
|
||||||
#}
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{%- if t.reasonsVisible -%}
|
|
||||||
<li>
|
|
||||||
{%- if activity.reasons is not empty -%}
|
|
||||||
{% for r in activity.reasons %}
|
|
||||||
{{ r|chill_entity_render_box }}
|
|
||||||
{% endfor %}
|
|
||||||
{%- endif -%}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{%- if t.socialIssuesVisible %}
|
|
||||||
<li class="social-issues">
|
|
||||||
{%- if activity.socialIssues is not empty -%}
|
|
||||||
{% for r in activity.socialIssues %}
|
|
||||||
{{ r|chill_entity_render_box }}
|
|
||||||
{% endfor %}
|
|
||||||
{%- endif -%}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{%- if t.socialActionsVisible -%}
|
|
||||||
<li class="social-actions">
|
|
||||||
{%- if activity.socialActions is not empty -%}
|
|
||||||
{% for r in activity.socialActions %}
|
|
||||||
<span class="badge bg-primary">{{ r.title|localize_translatable_string }}</span>
|
|
||||||
{% endfor %}
|
|
||||||
{%- endif -%}
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
||||||
class="btn btn-sm btn-show "></a>
|
class="btn btn-sm btn-show "></a>
|
||||||
</li>
|
</li>
|
||||||
{# TOOD
|
{% if no_action is not defined or no_action == false %}
|
||||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
{# TODO
|
||||||
#}
|
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
||||||
<li>
|
#}
|
||||||
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
<li>
|
||||||
class="btn btn-sm btn-update "></a>
|
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}"
|
||||||
</li>
|
class="btn btn-sm btn-update "></a>
|
||||||
{# TOOD
|
</li>
|
||||||
{% endif %}
|
{# TODO
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
{% endif %}
|
||||||
#}
|
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
||||||
<li>
|
#}
|
||||||
<a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}"
|
<li>
|
||||||
class="btn btn-sm btn-delete "></a>
|
<a href="{{ path('chill_activity_activity_delete', { 'id': activity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}"
|
||||||
</li>
|
class="btn btn-sm btn-delete "></a>
|
||||||
{#
|
</li>
|
||||||
|
{# TODO
|
||||||
|
{% endif %}
|
||||||
|
#}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
#}
|
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="list-content">
|
||||||
|
|
||||||
|
{% if activity.user and t.userVisible %}
|
||||||
|
<li>
|
||||||
|
<abbr class="referrer" title="{{ 'Referrer'|trans }}">ref:</abbr>
|
||||||
|
<b>{{ activity.user.usernameCanonical }}</b>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<b>{{ activity.type.name | localize_translatable_string }}</b>
|
||||||
|
|
||||||
|
{% if activity.attendee is not null and t.attendeeVisible %}
|
||||||
|
{% if activity.attendee %}
|
||||||
|
{{ '→ ' ~ 'present'|trans|capitalize }}
|
||||||
|
{% else %}
|
||||||
|
{{ '→ ' ~ 'not present'|trans|capitalize }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<b>{{ 'location'|trans ~ ': ' }}</b>
|
||||||
|
Domicile de l'usager
|
||||||
|
|
||||||
|
{# TODO {% if activity.location %}{{ activity.location }}{% endif %}
|
||||||
|
#}
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{%- if t.reasonsVisible -%}
|
||||||
|
<li>
|
||||||
|
{%- if activity.reasons is not empty -%}
|
||||||
|
{% for r in activity.reasons %}
|
||||||
|
{{ r|chill_entity_render_box }}
|
||||||
|
{% endfor %}
|
||||||
|
{%- endif -%}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if t.socialIssuesVisible %}
|
||||||
|
<li class="social-issues">
|
||||||
|
{%- if activity.socialIssues is not empty -%}
|
||||||
|
{% for r in activity.socialIssues %}
|
||||||
|
{{ r|chill_entity_render_box }}
|
||||||
|
{% endfor %}
|
||||||
|
{%- endif -%}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if t.socialActionsVisible -%}
|
||||||
|
<li class="social-actions">
|
||||||
|
{%- if activity.socialActions is not empty -%}
|
||||||
|
{% for r in activity.socialActions %}
|
||||||
|
{{ r|chill_entity_render_box }}
|
||||||
|
{% endfor %}
|
||||||
|
{%- endif -%}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% if activity.comment.comment is not empty
|
{% if activity.comment.comment is not empty
|
||||||
or activity.persons|length > 0
|
or activity.persons|length > 0
|
||||||
or activity.thirdParties|length > 0
|
or activity.thirdParties|length > 0
|
||||||
or activity.users|length > 0
|
or activity.users|length > 0
|
||||||
%}
|
%}
|
||||||
<div class="item-row details">
|
<div class="item-row comment separator">
|
||||||
<div class="item-col">
|
|
||||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if activity.comment.comment is not empty %}
|
{% if activity.comment.comment is not empty %}
|
||||||
<div class="item-col">
|
{{ activity.comment|chill_entity_render_box({
|
||||||
{{ activity.comment|chill_entity_render_box({
|
'disable_markdown': false,
|
||||||
'disable_markdown': false,
|
'limit_lines': 3,
|
||||||
'limit_lines': 3,
|
'metadata': false,
|
||||||
'metadata': false,
|
}) }}
|
||||||
}) }}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="item-row details">
|
||||||
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {
|
||||||
|
'context': context,
|
||||||
|
'with_display': 'bloc',
|
||||||
|
'entity': activity,
|
||||||
|
'badge_person': true
|
||||||
|
} %}
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse'} %}
|
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create">
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create">
|
||||||
{{ 'Add a new activity' | trans }}
|
{{ 'Add a new activity' | trans }}
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
|
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
|
||||||
class="btn btn-create disabled" tabindex="-1" role="button" aria-disabled="true">{{ 'Add a new activity' | trans }}
|
class="btn btn-create disabled" tabindex="-1" role="button" aria-disabled="true">{{ 'Add a new activity' | trans }}
|
||||||
|
@@ -18,7 +18,12 @@
|
|||||||
{% set accompanying_course_id = accompanyingCourse.id %}
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'activityType_id': activityType.id, 'accompanying_period_id': accompanying_course_id }) }}">
|
<a href="{{ path('chill_activity_activity_new', {
|
||||||
|
'person_id': person_id,
|
||||||
|
'activityType_id': activityType.id,
|
||||||
|
'accompanying_period_id': accompanying_course_id,
|
||||||
|
'activityData': activityData
|
||||||
|
}) }}">
|
||||||
|
|
||||||
<div class="bloc btn btn-primary btn-lg btn-block">
|
<div class="bloc btn btn-primary btn-lg btn-block">
|
||||||
{{ activityType.name|localize_translatable_string }}
|
{{ activityType.name|localize_translatable_string }}
|
||||||
|
@@ -64,16 +64,26 @@
|
|||||||
|
|
||||||
{% if t.durationTimeVisible %}
|
{% if t.durationTimeVisible %}
|
||||||
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
|
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
|
||||||
<dd>{{ entity.durationTime|date('H:i') }}</dd>
|
<dd>{% if entity.durationTime is not null %}
|
||||||
|
{{ entity.durationTime|date('H:i') }}
|
||||||
|
{% else %}
|
||||||
|
{{ 'None'|trans|capitalize }}
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if t.travelTimeVisible %}
|
{% if t.travelTimeVisible %}
|
||||||
<dt class="inline">{{ 'Travel Time'|trans }}</dt>
|
<dt class="inline">{{ 'Travel Time'|trans }}</dt>
|
||||||
<dd>{{ entity.travelTime|date('H:i') }}</dd>
|
<dd>{% if entity.travelTime is not null %}
|
||||||
|
{{ entity.travelTime|date('H:i') }}
|
||||||
|
{% else %}
|
||||||
|
{{ 'None'|trans|capitalize }}
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if t.commentVisible %}
|
{% if t.commentVisible %}
|
||||||
<dt class="inline">{{ 'Comment'|trans }}</dt>
|
<dt class="inline">{{ 'activity.comment'|trans }}</dt>
|
||||||
{%- if entity.comment.empty -%}
|
{%- if entity.comment.empty -%}
|
||||||
<dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
|
<dd><span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span></dd>
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
@@ -120,17 +130,17 @@
|
|||||||
{{ 'Edit'|trans }}
|
{{ 'Edit'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{# TODO
|
{# TODO
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
||||||
#}
|
#}
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete">
|
<a href="{{ path('chill_activity_activity_delete', { 'id': entity.id, 'person_id' : person_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete">
|
||||||
{{ 'Delete'|trans }}
|
{{ 'Delete'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{#
|
{#
|
||||||
{% endif %}
|
{% endif %}
|
||||||
#}
|
#}
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||||
|
|
||||||
{% block title 'Activity'|trans %}
|
{% block title 'Show the activity'|trans %}
|
||||||
|
|
||||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
||||||
|
|
||||||
{% block content -%}
|
{% block content -%}
|
||||||
<div class="activity-show">
|
<div class="activity-show">
|
||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'accompanyingCourse'} %}
|
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||||
|
|
||||||
{% block title 'Activity'|trans %}
|
{% block title 'Show the activity'|trans %}
|
||||||
|
|
||||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
||||||
|
|
||||||
{% block personcontent -%}
|
{% block personcontent -%}
|
||||||
<div class="activity-show">
|
<div class="activity-show">
|
||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'person'} %}
|
{% include 'ChillActivityBundle:Activity:show.html.twig' with {'context': 'person'} %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock personcontent %}
|
{% endblock personcontent %}
|
||||||
|
@@ -19,6 +19,11 @@
|
|||||||
|
|
||||||
namespace Chill\ActivityBundle\Security\Authorization;
|
namespace Chill\ActivityBundle\Security\Authorization;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Security\Authorization\VoterHelperFactoryInterface;
|
||||||
|
use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
|
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||||
|
|
||||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||||
@@ -28,11 +33,10 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Voter for Activity class
|
||||||
*
|
|
||||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
|
||||||
*/
|
*/
|
||||||
class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||||
{
|
{
|
||||||
@@ -41,30 +45,37 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
const SEE_DETAILS = 'CHILL_ACTIVITY_SEE_DETAILS';
|
const SEE_DETAILS = 'CHILL_ACTIVITY_SEE_DETAILS';
|
||||||
const UPDATE = 'CHILL_ACTIVITY_UPDATE';
|
const UPDATE = 'CHILL_ACTIVITY_UPDATE';
|
||||||
const DELETE = 'CHILL_ACTIVITY_DELETE';
|
const DELETE = 'CHILL_ACTIVITY_DELETE';
|
||||||
|
const FULL = 'CHILL_ACTIVITY_FULL';
|
||||||
|
|
||||||
/**
|
private const ALL = [
|
||||||
*
|
self::CREATE,
|
||||||
* @var AuthorizationHelper
|
self::SEE,
|
||||||
*/
|
self::UPDATE,
|
||||||
protected $helper;
|
self::DELETE,
|
||||||
|
self::SEE_DETAILS,
|
||||||
|
self::FULL
|
||||||
|
];
|
||||||
|
|
||||||
public function __construct(AuthorizationHelper $helper)
|
protected VoterHelperInterface $voterHelper;
|
||||||
{
|
|
||||||
$this->helper = $helper;
|
protected Security $security;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
Security $security,
|
||||||
|
VoterHelperFactoryInterface $voterHelperFactory
|
||||||
|
) {
|
||||||
|
$this->security = $security;
|
||||||
|
$this->voterHelper = $voterHelperFactory->generate(self::class)
|
||||||
|
->addCheckFor(Person::class, [self::SEE, self::CREATE])
|
||||||
|
->addCheckFor(AccompanyingPeriod::class, [self::SEE, self::CREATE])
|
||||||
|
->addCheckFor(Activity::class, self::ALL)
|
||||||
|
->build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function supports($attribute, $subject)
|
protected function supports($attribute, $subject)
|
||||||
{
|
{
|
||||||
if ($subject instanceof Activity) {
|
return $this->voterHelper->supports($attribute, $subject);
|
||||||
return \in_array($attribute, $this->getAttributes());
|
|
||||||
} elseif ($subject instanceof Person) {
|
|
||||||
return $attribute === self::SEE
|
|
||||||
||
|
|
||||||
$attribute === self::CREATE;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||||
@@ -72,32 +83,34 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
if (!$token->getUser() instanceof User) {
|
if (!$token->getUser() instanceof User) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subject instanceof Person) {
|
if ($subject instanceof Activity) {
|
||||||
$centers = $this->helper->getReachableCenters($token->getUser(), new Role($attribute));
|
if ($subject->getPerson() instanceof Person) {
|
||||||
|
// the context is person: we must have the right to see the person
|
||||||
return \in_array($subject->getCenter(), $centers);
|
if (!$this->security->isGranted(PersonVoter::SEE, $subject->getPerson())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} elseif ($subject->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||||
|
if (!$this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject->getAccompanyingPeriod())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new \RuntimeException("could not determine context of activity");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @var $subject Activity */
|
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);
|
||||||
return $this->helper->userHasAccess($token->getUser(), $subject, $attribute);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getAttributes()
|
|
||||||
{
|
|
||||||
return [ self::CREATE, self::SEE, self::UPDATE, self::DELETE,
|
|
||||||
self::SEE_DETAILS ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getRoles()
|
public function getRoles()
|
||||||
{
|
{
|
||||||
return $this->getAttributes();
|
return self::ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRolesWithoutScope()
|
public function getRolesWithoutScope()
|
||||||
{
|
{
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -35,35 +35,37 @@ class ActivityReasonRender extends AbstractChillEntityRender
|
|||||||
* @var TranslatableStringHelper
|
* @var TranslatableStringHelper
|
||||||
*/
|
*/
|
||||||
protected $translatableStringHelper;
|
protected $translatableStringHelper;
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function renderBox($entity, array $options): string
|
public function renderBox($entity, array $options): string
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
$this->getDefaultOpeningBox('activity-reason').
|
$this->getDefaultOpeningBox('activity-reason').
|
||||||
|
'<span class="badge bg-chill-pink">'.
|
||||||
'<i class="fa fa-question-circle"></i> '.
|
'<i class="fa fa-question-circle"></i> '.
|
||||||
'<span class="activity-reason__category">'.
|
'<span class="category">'.
|
||||||
$this->translatableStringHelper->localize(
|
$this->translatableStringHelper->localize(
|
||||||
$entity->getCategory()->getName()
|
$entity->getCategory()->getName()
|
||||||
).
|
).
|
||||||
'</span>'.
|
'</span>'.
|
||||||
'<span class="activity-reason__separator"> > </span>'.
|
'<span class="separator"> > </span>'.
|
||||||
'<span class="activity-reason__reason">'.
|
'<span class="reason">'.
|
||||||
$this->translatableStringHelper->localize(
|
$this->translatableStringHelper->localize(
|
||||||
$entity->getName()
|
$entity->getName()
|
||||||
).
|
).
|
||||||
'</span>'.
|
'</span>'.
|
||||||
|
'</span>'.
|
||||||
$this->getDefaultClosingBox()
|
$this->getDefaultClosingBox()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param ActivityReason $entity
|
* @param ActivityReason $entity
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return string
|
* @return string
|
||||||
@@ -71,12 +73,12 @@ class ActivityReasonRender extends AbstractChillEntityRender
|
|||||||
public function renderString($entity, array $options): string
|
public function renderString($entity, array $options): string
|
||||||
{
|
{
|
||||||
$category = '';
|
$category = '';
|
||||||
|
|
||||||
if (null !== $entity->getCategory()) {
|
if (null !== $entity->getCategory()) {
|
||||||
$category = $this->translatableStringHelper->localize(
|
$category = $this->translatableStringHelper->localize(
|
||||||
$entity->getCategory()->getName()). ' > ';
|
$entity->getCategory()->getName()). ' > ';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $category .
|
return $category .
|
||||||
$this->translatableStringHelper->localize(
|
$this->translatableStringHelper->localize(
|
||||||
$entity->getName()
|
$entity->getName()
|
||||||
|
@@ -1,20 +1,4 @@
|
|||||||
services:
|
services:
|
||||||
chill.activity.security.authorization.activity_voter:
|
|
||||||
class: Chill\ActivityBundle\Security\Authorization\ActivityVoter
|
|
||||||
arguments:
|
|
||||||
- "@chill.main.security.authorization.helper"
|
|
||||||
tags:
|
|
||||||
- { name: security.voter }
|
|
||||||
- { name: chill.role }
|
|
||||||
|
|
||||||
chill.activity.security.authorization.activity_stats_voter:
|
|
||||||
class: Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter
|
|
||||||
arguments:
|
|
||||||
- "@chill.main.security.authorization.helper"
|
|
||||||
tags:
|
|
||||||
- { name: security.voter }
|
|
||||||
- { name: chill.role }
|
|
||||||
|
|
||||||
|
|
||||||
chill.activity.timeline:
|
chill.activity.timeline:
|
||||||
class: Chill\ActivityBundle\Timeline\TimelineActivityProvider
|
class: Chill\ActivityBundle\Timeline\TimelineActivityProvider
|
||||||
@@ -38,3 +22,8 @@ services:
|
|||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
resource: '../Notification'
|
resource: '../Notification'
|
||||||
|
|
||||||
|
Chill\ActivityBundle\Security\Authorization\:
|
||||||
|
resource: '../Security/Authorization/'
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
@@ -0,0 +1,14 @@
|
|||||||
|
services:
|
||||||
|
accompanying_period_social_issue_consistency_for_activity:
|
||||||
|
class: 'Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency\AccompanyingPeriodSocialIssueConsistencyEntityListener'
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
name: 'doctrine.orm.entity_listener'
|
||||||
|
event: 'prePersist'
|
||||||
|
entity: 'Chill\ActivityBundle\Entity\Activity'
|
||||||
|
lazy: true
|
||||||
|
-
|
||||||
|
name: 'doctrine.orm.entity_listener'
|
||||||
|
event: 'preUpdate'
|
||||||
|
entity: 'Chill\ActivityBundle\Entity\Activity'
|
||||||
|
lazy: true
|
@@ -1,8 +1,4 @@
|
|||||||
services:
|
services:
|
||||||
Chill\ActivityBundle\Controller\ActivityController:
|
Chill\ActivityBundle\Controller\ActivityController:
|
||||||
arguments:
|
autowire: true
|
||||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
|
||||||
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
|
||||||
$logger: '@chill.main.logger'
|
|
||||||
$serializer: '@Symfony\Component\Serializer\SerializerInterface'
|
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
||||||
|
@@ -24,9 +24,7 @@ services:
|
|||||||
- '@Doctrine\Persistence\ManagerRegistry'
|
- '@Doctrine\Persistence\ManagerRegistry'
|
||||||
|
|
||||||
Chill\ActivityBundle\Repository\ActivityACLAwareRepository:
|
Chill\ActivityBundle\Repository\ActivityACLAwareRepository:
|
||||||
arguments:
|
autowire: true
|
||||||
$tokenStorage: '@Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface'
|
autoconfigure: true
|
||||||
$authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper'
|
Chill\ActivityBundle\Repository\ActivityACLAwareRepositoryInterface: '@Chill\ActivityBundle\Repository\ActivityACLAwareRepository'
|
||||||
$repository: '@Chill\ActivityBundle\Repository\ActivityRepository'
|
|
||||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
|
||||||
|
|
||||||
|
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for activity configuration
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
* @author Champs Libres <info@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class AdminController extends AbstractController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function redirectToAdminIndexAction()
|
||||||
|
{
|
||||||
|
return $this->redirectToRoute('chill_main_admin_central');
|
||||||
|
}
|
||||||
|
}
|
@@ -1,14 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\AsideActivityBundle\Controller;
|
namespace Chill\AsideActivityBundle\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Doctrine\Common\Collections\Criteria;
|
||||||
|
|
||||||
|
final class AsideActivityController extends CRUDController
|
||||||
/**
|
|
||||||
* Class AsideActivityBundle
|
|
||||||
*/
|
|
||||||
class AsideActivityController extends CRUDController
|
|
||||||
{
|
{
|
||||||
|
protected function buildQueryEntities(string $action, Request $request)
|
||||||
|
{
|
||||||
|
$qb = parent::buildQueryEntities($action, $request);
|
||||||
|
|
||||||
|
if ('index' === $action) {
|
||||||
|
$qb->andWhere($qb->expr()->eq('e.agent', ':user'));
|
||||||
|
$qb->setParameter('user', $this->getUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function orderQuery(
|
||||||
|
string $action,
|
||||||
|
$query,
|
||||||
|
Request $request,
|
||||||
|
PaginatorInterface $paginator
|
||||||
|
) {
|
||||||
|
if ('index' === $action) {
|
||||||
|
return $query->orderBy('e.date', 'DESC');
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::orderQuery($action, $query, $request, $paginator);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||||
|
use Chill\MainBundle\Repository\UserRepository;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
|
||||||
|
{
|
||||||
|
private UserRepository $userRepository;
|
||||||
|
|
||||||
|
public function __construct(UserRepository $userRepository)
|
||||||
|
{
|
||||||
|
$this->userRepository = $userRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDependencies(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
LoadUsers::class,
|
||||||
|
LoadAsideActivityCategory::class
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
$user = $this->userRepository->findOneBy(['username' => 'center a_social']);
|
||||||
|
|
||||||
|
for ($i = 0; $i < 50; $i++) {
|
||||||
|
$activity = new AsideActivity();
|
||||||
|
$activity
|
||||||
|
->setAgent($user)
|
||||||
|
->setCreatedAt(new \DateTimeImmutable('now'))
|
||||||
|
->setCreatedBy($user)
|
||||||
|
->setUpdatedAt(new \DateTimeImmutable('now'))
|
||||||
|
->setUpdatedBy($user)
|
||||||
|
->setType(
|
||||||
|
$this->getReference('aside_activity_category_0')
|
||||||
|
)
|
||||||
|
->setDate((new \DateTimeImmutable('today'))
|
||||||
|
->sub(new \DateInterval('P'.\random_int(1, 100).'D')))
|
||||||
|
;
|
||||||
|
|
||||||
|
$manager->persist($activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
class LoadAsideActivityCategory extends \Doctrine\Bundle\FixturesBundle\Fixture
|
||||||
|
{
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
foreach ([
|
||||||
|
'Appel téléphonique',
|
||||||
|
'Formation'
|
||||||
|
] as $key => $label) {
|
||||||
|
$category = new AsideActivityCategory();
|
||||||
|
$category->setTitle(['fr' => $label]);
|
||||||
|
$manager->persist($category);
|
||||||
|
$this->setReference('aside_activity_category_'.$key, $category);
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@@ -25,8 +25,9 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte
|
|||||||
public function load(array $configs, ContainerBuilder $container): void
|
public function load(array $configs, ContainerBuilder $container): void
|
||||||
{
|
{
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||||
// $loader->load('services.yaml');
|
$loader->load('services.yaml');
|
||||||
$loader->load('services/form.yaml');
|
$loader->load('services/form.yaml');
|
||||||
|
$loader->load('services/menu.yaml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
|
@@ -13,7 +13,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
* @ORM\Table(schema="chill_asideactivity")
|
* @ORM\Table(schema="chill_asideactivity")
|
||||||
*/
|
*/
|
||||||
final class AsideActivity implements TrackUpdateInterface, TrackCreationInterface
|
class AsideActivity implements TrackUpdateInterface, TrackCreationInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
@@ -200,10 +200,4 @@ final class AsideActivity implements TrackUpdateInterface, TrackCreationInterfac
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function __toString()
|
|
||||||
// {
|
|
||||||
// // dump($this->type->getTitle());
|
|
||||||
// return $this->type->getTitle();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,9 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
|
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
@@ -26,8 +28,12 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
private TranslatableStringHelper $translatableStringHelper;
|
private TranslatableStringHelper $translatableStringHelper;
|
||||||
private TokenStorageInterface $storage;
|
private TokenStorageInterface $storage;
|
||||||
|
|
||||||
public function __construct (TranslatableStringHelper $translatableStringHelper, array $timeChoices, TokenStorageInterface $storage){
|
public function __construct (
|
||||||
$this->timeChoices = $timeChoices;
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
|
ParameterBagInterface $parameterBag,
|
||||||
|
TokenStorageInterface $storage
|
||||||
|
){
|
||||||
|
$this->timeChoices = $parameterBag->get('chill_activity.form.time_duration');
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->storage = $storage;
|
$this->storage = $storage;
|
||||||
}
|
}
|
||||||
@@ -47,12 +53,15 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
];
|
];
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('agent', EntityType::class,
|
->add('agent', EntityType::class,
|
||||||
[
|
[
|
||||||
'label' => 'Agent',
|
'label' => 'Agent',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'class' => User::class,
|
'class' => User::class,
|
||||||
'data' => $this->storage->getToken()->getUser(),
|
'data' => $this->storage->getToken()->getUser(),
|
||||||
|
'query_builder' => function(EntityRepository $er){
|
||||||
|
return $er->createQueryBuilder('u')->where('u.enabled = true');
|
||||||
|
},
|
||||||
'attr' => array('class' => 'select2 '),
|
'attr' => array('class' => 'select2 '),
|
||||||
'placeholder' => 'Choose the agent for whom this activity is created',
|
'placeholder' => 'Choose the agent for whom this activity is created',
|
||||||
'choice_label' => 'username'
|
'choice_label' => 'username'
|
||||||
@@ -85,7 +94,7 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
'required' => false,
|
'required' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach (['duration'] as $fieldName)
|
foreach (['duration'] as $fieldName)
|
||||||
{
|
{
|
||||||
$builder->get($fieldName)
|
$builder->get($fieldName)
|
||||||
->addModelTransformer($durationTimeTransformer);
|
->addModelTransformer($durationTimeTransformer);
|
||||||
@@ -108,7 +117,6 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
$seconds = $data->getTimezone()->getOffset($data);
|
$seconds = $data->getTimezone()->getOffset($data);
|
||||||
$data->setTimeZone($timezoneUTC);
|
$data->setTimeZone($timezoneUTC);
|
||||||
$data->add(new \DateInterval('PT'.$seconds.'S'));
|
$data->add(new \DateInterval('PT'.$seconds.'S'));
|
||||||
dump($data);
|
|
||||||
|
|
||||||
// test if the timestamp is in the choices.
|
// test if the timestamp is in the choices.
|
||||||
// If not, recreate the field with the new timestamp
|
// If not, recreate the field with the new timestamp
|
||||||
@@ -131,7 +139,7 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'data_class' => AsideActivity::class,
|
'data_class' => AsideActivity::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,4 +147,4 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
{
|
{
|
||||||
return 'chill_asideactivitybundle_asideactivity';
|
return 'chill_asideactivitybundle_asideactivity';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Menu;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SectionMenuBuilder
|
||||||
|
*
|
||||||
|
* @package Chill\AsideActivityBundle\Menu
|
||||||
|
*/
|
||||||
|
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||||
|
{
|
||||||
|
protected TranslatorInterface $translator;
|
||||||
|
|
||||||
|
public function __construct(TranslatorInterface $translator)
|
||||||
|
{
|
||||||
|
$this->translator = $translator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $menuId
|
||||||
|
* @param MenuItem $menu
|
||||||
|
* @param array $parameters
|
||||||
|
*/
|
||||||
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
{
|
||||||
|
$menu->addChild($this->translator->trans('Create an aside activity'), [
|
||||||
|
'route' => 'chill_crud_aside_activity_new'
|
||||||
|
])
|
||||||
|
->setExtras([
|
||||||
|
'order' => 11,
|
||||||
|
'icons' => [ 'plus' ]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getMenuIds(): array
|
||||||
|
{
|
||||||
|
return [ 'section' ];
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,14 @@
|
|||||||
|
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
|
||||||
|
|
||||||
|
{% block vertical_menu_content %}
|
||||||
|
{{ chill_menu('admin_aside_activity', {
|
||||||
|
'layout': '@ChillAsideActivity/Admin/menu_asideactivity.html.twig',
|
||||||
|
}) }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block layout_wvm_content %}
|
||||||
|
{% block admin_content %}
|
||||||
|
<!-- block personcontent empty -->
|
||||||
|
<h1>{{ 'Aside activity configuration' |trans }}</h1>
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
@@ -0,0 +1,4 @@
|
|||||||
|
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
|
||||||
|
{% block v_menu_title %}
|
||||||
|
{{ 'Aside activity configuration menu'|trans }}
|
||||||
|
{% endblock %}
|
@@ -1,37 +1,30 @@
|
|||||||
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
|
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
|
||||||
{% block crud_content_header %}
|
{% block crud_content_header %}
|
||||||
<h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</h1>
|
<h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</h1>
|
||||||
{% endblock crud_content_header %}
|
{% endblock crud_content_header %}
|
||||||
|
|
||||||
<p class="message-confirm">{{ ('crud.'~crud_name~'.confirm_message_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</p>
|
<p class="message-confirm">{{ ('crud.'~crud_name~'.confirm_message_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</p>
|
||||||
|
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
{% block content_form_actions_back %}
|
{% block content_form_actions_back %}
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">
|
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">
|
||||||
{{ 'Cancel'|trans }}
|
{{ 'Cancel'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content_form_actions_before %}{% endblock %}
|
{% block content_form_actions_before %}
|
||||||
{% block content_form_actions_view %}
|
|
||||||
{% if is_granted(chill_crud_config('role', crud_name, 'view'), entity) %}
|
|
||||||
<li class="">
|
|
||||||
<a class="btn btn-show" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_view', { 'id': entity.id }) }}">
|
|
||||||
{{ 'crud.edit.back_to_view'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
{% block content_form_actions_confirm_delete %}
|
|
||||||
<li>
|
|
||||||
<button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button>
|
|
||||||
</li>
|
|
||||||
{% endblock content_form_actions_confirm_delete %}
|
|
||||||
{% block content_form_actions_after %}{% endblock %}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{{ form_end(form) }}
|
{% endblock %}
|
||||||
</div>
|
{% block content_form_actions_confirm_delete %}
|
||||||
|
<li>
|
||||||
|
<button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button>
|
||||||
|
</li>
|
||||||
|
{% endblock content_form_actions_confirm_delete %}
|
||||||
|
{% block content_form_actions_after %}{% endblock %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{{ form_end(form) }}
|
||||||
|
</div>
|
||||||
|
@@ -3,6 +3,6 @@
|
|||||||
{# {% block title %}{{ ('crud.' ~ crud_name ~ '.delete.title')|trans({'%crud_name%': crud_name}) }}{% endblock %} #}
|
{# {% block title %}{{ ('crud.' ~ crud_name ~ '.delete.title')|trans({'%crud_name%': crud_name}) }}{% endblock %} #}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% embed '@ChillAsideActivity/AsideActivity/_delete.html.twig' %}
|
{% embed '@ChillAsideActivity/asideActivity/_delete.html.twig' %}
|
||||||
{% endembed %}
|
{% endembed %}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@@ -9,5 +9,6 @@
|
|||||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||||
{# we do not have "view" page. We empty the corresponding block #}
|
{# we do not have "view" page. We empty the corresponding block #}
|
||||||
{% block content_form_actions_view %}{% endblock %}
|
{% block content_form_actions_view %}{% endblock %}
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
{% endembed %}
|
{% endembed %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -1,107 +1,97 @@
|
|||||||
{% extends "@ChillMain/layout.html.twig" %}
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
{% block title %}{{ 'Aside activity list' |trans }}{% endblock title %}
|
{% block title %}
|
||||||
|
{{ 'Aside activity list' |trans }}
|
||||||
|
{% endblock title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-md-10 col-xxl asideactivity-list">
|
<div class="col-md-10 col-xxl asideactivity-list">
|
||||||
<h2>{{ 'My aside activities' |trans }}</h2>
|
<h2>{{ 'My aside activities' |trans }}</h2>
|
||||||
|
|
||||||
{% if entities|length == 0 %}
|
{% if entities|length == 0 %}
|
||||||
<p class="chill-no-data-statement">
|
<p class="chill-no-data-statement">
|
||||||
{{ "There aren't any aside activities."|trans }}
|
{{ "There aren't any aside activities."|trans }}
|
||||||
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a>
|
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a>
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<div class="flex-table my-4 list-records">
|
<div
|
||||||
{# Sort activities according to date in descending order #}
|
class="flex-table my-4 list-records">
|
||||||
{% for entity in entities|sort ((a, b) => b.date <=> a.date) %}
|
{# Sort activities according to date in descending order #}
|
||||||
{% set t = entity.type %}
|
{% for entity in entities %}
|
||||||
|
{% set t = entity.type %}
|
||||||
|
|
||||||
{# only load aside activities of current user. #}
|
<div class="item-bloc">
|
||||||
{% if entity.agent == app.user %}
|
<div class="item-row main">
|
||||||
|
<div class="item-col">
|
||||||
|
|
||||||
<div class="item-bloc">
|
<h3>
|
||||||
<div class="item-row main">
|
<b>{{ entity.type.title | localize_translatable_string }}</b>
|
||||||
<div class="item-col">
|
</h3>
|
||||||
|
|
||||||
<h3>
|
{% if entity.date %}
|
||||||
<b>{{ entity.type.title | localize_translatable_string }}</b>
|
<p>{{ entity.date|format_date('long') }}</p>
|
||||||
</h3>
|
{% endif %}
|
||||||
|
|
||||||
{% if entity.date %}
|
<div class="duration">
|
||||||
<p>{{ entity.date|format_date('long') }}</p>
|
<p>
|
||||||
{% endif %}
|
<i class="fa fa-fw fa-hourglass-end"></i>
|
||||||
|
{{ entity.duration|date('H:i') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="duration">
|
</div>
|
||||||
<p>
|
<div class="item-col">
|
||||||
<i class="fa fa-fw fa-hourglass-end"></i>
|
<ul class="list-content">
|
||||||
{{ entity.duration|date('H:i') }}
|
{% if entity.createdBy %}
|
||||||
</p>
|
<li>
|
||||||
</div>
|
<b>{{ 'Created by: '|trans }}{{ entity.createdBy.usernameCanonical }}</b>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
{# {%
|
||||||
<div class="item-col">
|
if entity.note is not empty
|
||||||
<ul class="list-content">
|
or entity.createdBy|length > 0
|
||||||
{% if entity.createdBy %}
|
%}
|
||||||
<li>
|
<div class="item-row details">
|
||||||
<b>{{ 'Created by: '|trans }}{{ entity.createdBy.usernameCanonical }}</b>
|
{% if entity.note is not empty %}
|
||||||
</li>
|
<div class="item-col comment">
|
||||||
{% endif %}
|
{{ entity.note|chill_markdown_to_html }}
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
</div>
|
|
||||||
|
|
||||||
{# {%
|
</div>
|
||||||
if entity.note is not empty
|
{% endif %} #}
|
||||||
or entity.createdBy|length > 0
|
<div class="item-col">
|
||||||
%}
|
<ul class="list-content">
|
||||||
<div class="item-row details">
|
<ul class="record_actions">
|
||||||
{% if entity.note is not empty %}
|
<li>
|
||||||
<div class="item-col comment">
|
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update btn-mini "></a>
|
||||||
{{ entity.note|chill_markdown_to_html }}
|
</li>
|
||||||
</div>
|
<li>
|
||||||
{% endif %}
|
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete btn-mini"></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
{% endfor %}
|
||||||
{% endif %} #}
|
</div>
|
||||||
<div class="item-col">
|
|
||||||
<ul class="list-content">
|
{{ chill_pagination(paginator) }}
|
||||||
<ul class="record_actions">
|
|
||||||
{# <li>
|
<ul class="record_actions">
|
||||||
<a href="{{ path('chill_crud_aside_activity_view', { 'id': entity.id} ) }}" class="btn btn-show "></a>
|
<li>
|
||||||
</li> #}
|
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_new') }}" class="btn btn-create">
|
||||||
{# TOOD
|
{{ 'Create' | trans }}
|
||||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
</a>
|
||||||
#}
|
</li>
|
||||||
<li>
|
</ul>
|
||||||
<a href="{{ path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update "></a>
|
</div>
|
||||||
</li>
|
{% endif %}
|
||||||
{# TOOD
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
|
||||||
#}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete "></a>
|
|
||||||
</li>
|
|
||||||
{#
|
|
||||||
{% endif %}
|
|
||||||
#}
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create">
|
|
||||||
{{ 'Add a new aside activity' | trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -1,44 +1,44 @@
|
|||||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% block admin_content %}
|
||||||
<h1>{{ 'ActivityType list'|trans }}</h1>
|
<h1>{{ 'ActivityType list'|trans }}</h1>
|
||||||
|
|
||||||
<table class="records_list table table-bordered border-dark">
|
<table class="records_list table table-bordered border-dark">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ 'Name'|trans }}</th>
|
<th>{{ 'Name'|trans }}</th>
|
||||||
<th>{{ 'Active'|trans }}</th>
|
<th>{{ 'Active'|trans }}</th>
|
||||||
<th>{{ 'Actions'|trans }}</th>
|
<th>{{ 'Actions'|trans }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for entity in entities %}
|
{% for entity in entities %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ entity.title|localize_translatable_string }}</td>
|
<td>{{ entity.title|localize_translatable_string }}</td>
|
||||||
<td style="text-align:center;">
|
<td style="text-align:center;">
|
||||||
{%- if entity.isActive -%}
|
{%- if entity.isActive -%}
|
||||||
<i class="fa fa-check-square-o"></i>
|
<i class="fa fa-check-square-o"></i>
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
<i class="fa fa-square-o"></i>
|
<i class="fa fa-square-o"></i>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_crud_aside_activity_category_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
|
<a href="{{ path('chill_crud_aside_activity_category_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_crud_aside_activity_category_new') }}" class="btn btn-create">
|
<a href="{{ path('chill_crud_aside_activity_category_new') }}" class="btn btn-create">
|
||||||
{{ 'Create a new aside activity type'|trans }}
|
{{ 'Create a new aside activity type'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Tests\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
|
||||||
|
class AccompanyingCourseControllerTest extends WebTestCase
|
||||||
|
{
|
||||||
|
use PrepareClientTrait;
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
self::bootKernel();
|
||||||
|
$this->client = $this->getClientAuthenticated();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIndexWithoutUsers()
|
||||||
|
{
|
||||||
|
$this->client->request('GET', '/fr/asideactivity');
|
||||||
|
|
||||||
|
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNewWithoutUsers()
|
||||||
|
{
|
||||||
|
$this->client->request('GET', '/fr/asideactivity/new');
|
||||||
|
|
||||||
|
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider generateAsideActivityId
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function testEditWithoutUsers(int $asideActivityId)
|
||||||
|
{
|
||||||
|
$this->client->request('GET', "/fr/asideactivity/{$asideActivityId}/edit");
|
||||||
|
|
||||||
|
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateAsideActivityId()
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$qb = self::$container->get(EntityManagerInterface::class)
|
||||||
|
->createQueryBuilder();
|
||||||
|
|
||||||
|
$asideActivityIds = $qb
|
||||||
|
->select('DISTINCT asideactivity.id')
|
||||||
|
->from(AsideActivity::class, 'asideactivity')
|
||||||
|
->innerJoin('asideactivity.agent', 'agent')
|
||||||
|
->where($qb->expr()->eq('agent.username', ':center_name'))
|
||||||
|
->setParameter('center_name', 'center a_social')
|
||||||
|
->setMaxResults(100)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
|
||||||
|
\shuffle($asideActivityIds);
|
||||||
|
|
||||||
|
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||||
|
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||||
|
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -1,3 +1,12 @@
|
|||||||
chill_asideactivities_controllers:
|
chill_asideactivities_controllers:
|
||||||
resource: "@ChillAsideActivityBundle/Controller"
|
resource: "@ChillAsideActivityBundle/Controller"
|
||||||
type: annotation
|
type: annotation
|
||||||
|
|
||||||
|
chill_admin_aside_activity_redirect_to_admin_index:
|
||||||
|
path: /{_locale}/admin/activity_redirect_to_main
|
||||||
|
controller: Chill\ActivityBundle\Controller\AdminController::redirectToAdminIndexAction
|
||||||
|
options:
|
||||||
|
menus:
|
||||||
|
admin_aside_activity:
|
||||||
|
order: 0
|
||||||
|
label: Main admin menu
|
||||||
|
@@ -1,8 +1,5 @@
|
|||||||
# services:
|
services:
|
||||||
# chill.asideactivity.form.type.asideactivity:
|
Chill\AsideActivityBundle\DataFixtures\:
|
||||||
# class: Chill\AsideActivityBundle\Form\AsideActivityFormType
|
resource: './../DataFixtures'
|
||||||
# arguments:
|
autowire: true
|
||||||
# - "@chill.main.helper.translatable_string"
|
autoconfigure: true
|
||||||
# # - "%chill_activity.form.time_duration%"
|
|
||||||
# tags:
|
|
||||||
# - { name: form.type, alias: chill_asideactivitybundle_asideactivity }
|
|
||||||
|
@@ -1,10 +1,6 @@
|
|||||||
---
|
---
|
||||||
services:
|
services:
|
||||||
chill.asideactivity.form.type.asideactivity:
|
Chill\AsideActivityBundle\Form\:
|
||||||
class: Chill\AsideActivityBundle\Form\AsideActivityFormType
|
resource: './../../Form'
|
||||||
arguments:
|
autowire: true
|
||||||
- "@chill.main.helper.translatable_string"
|
autoconfigure: true
|
||||||
- "%chill_activity.form.time_duration%"
|
|
||||||
- "@security.token_storage"
|
|
||||||
tags:
|
|
||||||
- { name: form.type, alias: chill_asideactivitybundle_asideactivity }
|
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
services:
|
||||||
|
Chill\AsideActivityBundle\Menu\:
|
||||||
|
resource: './../../Menu'
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
@@ -1,9 +1,10 @@
|
|||||||
#general
|
#general
|
||||||
Show the aside activity: Voir l'activité annexe
|
Show the aside activity: Voir l'activité annexe
|
||||||
Edit the aside activity: Modifier l'activité annexe
|
Edit the aside activity: Modifier l'activité annexe
|
||||||
|
Remove aside activity: Supprimer l'activité annexe
|
||||||
Aside activity: Activité annexe
|
Aside activity: Activité annexe
|
||||||
Duration time: Durée
|
Duration time: Durée
|
||||||
durationTime: durée
|
durationTime: durée
|
||||||
user_username: nom de l'utilisateur
|
user_username: nom de l'utilisateur
|
||||||
Remark: Commentaire
|
Remark: Commentaire
|
||||||
No comments: Aucun commentaire
|
No comments: Aucun commentaire
|
||||||
@@ -25,7 +26,7 @@ Required: Obligatoire
|
|||||||
Persons: Personnes
|
Persons: Personnes
|
||||||
Users: Utilisateurs
|
Users: Utilisateurs
|
||||||
Emergency: Urgent
|
Emergency: Urgent
|
||||||
by: 'Par '
|
by: "Par "
|
||||||
location: Lieu
|
location: Lieu
|
||||||
|
|
||||||
# Crud
|
# Crud
|
||||||
@@ -33,50 +34,42 @@ crud:
|
|||||||
aside_activity:
|
aside_activity:
|
||||||
title_view: Détail de l'activité annexe
|
title_view: Détail de l'activité annexe
|
||||||
title_new: Nouvelle activité annexe
|
title_new: Nouvelle activité annexe
|
||||||
title_edit: Edition d'une activité annexe
|
title_edit: Édition d'une activité annexe
|
||||||
title_delete: Supprimation d'une activité annexe
|
title_delete: Supprimer une activité annexe
|
||||||
button_delete: Supprimer
|
button_delete: Supprimer
|
||||||
confirm_message_delete: Êtes-vous sûr de vouloir supprimer cet activité annexe?
|
confirm_message_delete: Êtes-vous sûr de vouloir supprimer cette activité annexe?
|
||||||
aside_activity_category:
|
aside_activity_category:
|
||||||
title_new: Nouvelle catégorie d'activité annexe
|
title_new: Nouvelle catégorie d'activité annexe
|
||||||
title_edit: Edition d'une catégorie de type d'activité
|
title_edit: Edition d'une catégorie de type d'activité
|
||||||
|
|
||||||
#forms
|
#forms
|
||||||
Activity creation: Nouvelle activité annexe
|
Activity creation: Nouvelle activité annexe
|
||||||
Create a new aside activity type: Nouvelle categorie d'activité annexe
|
Create a new aside activity type: Nouvelle catégorie d'activité annexe
|
||||||
Create: Créer
|
Create: Créer
|
||||||
Back to the list: Retour à la liste
|
Back to the list: Retour à la liste
|
||||||
Save activity: Sauver l'activité
|
Save activity: Sauver l'activité
|
||||||
Reset form: Remise à zéro du formulaire
|
Reset form: Remise à zéro du formulaire
|
||||||
Choose the agent for whom this activity is created: Choissisez l'utilisateur pour qui l'activité est creéé.
|
Choose the agent for whom this activity is created: Choisissez l'utilisateur pour qui l'activité est créée.
|
||||||
Choose the activity category: Choissisez le type d'activité
|
Choose the activity category: Choisissez le type d'activité
|
||||||
Choose the duration: Choisir la durée
|
Choose the duration: Choisir la durée
|
||||||
Choose a category: Choisir un categorie
|
Choose a category: Choisir une catégorie
|
||||||
Is active: Actif
|
Is active: Actif
|
||||||
Agent: Utilisateur
|
Agent: Utilisateur
|
||||||
date: Date
|
date: Date
|
||||||
Duration: Durée
|
Duration: Durée
|
||||||
Note: Note
|
Note: Note
|
||||||
5 minutes: 5 minutes
|
|
||||||
10 minutes: 10 minutes
|
|
||||||
15 minutes: 15 minutes
|
|
||||||
20 minutes: 20 minutes
|
|
||||||
25 minutes: 25 minutes
|
|
||||||
30 minutes: 30 minutes
|
|
||||||
45 minutes: 45 minutes
|
|
||||||
1 hour: 1 heure
|
|
||||||
1 hour 15: 1 heure 15
|
|
||||||
1 hour 30: 1 heure 30
|
|
||||||
1 hour 45: 1 heure 45
|
|
||||||
2 hours: 2 heures
|
|
||||||
|
|
||||||
#list
|
#list
|
||||||
My aside activities: Mes activités annexes
|
My aside activities: Mes activités annexes
|
||||||
Date: Date
|
Date: Date
|
||||||
Created by: Creér par
|
Created by: Créée par
|
||||||
|
|
||||||
|
|
||||||
#Aside activity delete
|
#Aside activity delete
|
||||||
Delete aside activity: Supprimer une activité annexe
|
Delete aside activity: Supprimer une activité annexe
|
||||||
Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ?
|
Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ?
|
||||||
The activity has been successfully removed.: L'activité a été supprimée.
|
The activity has been successfully removed.: L'activité a été supprimée.
|
||||||
|
|
||||||
|
#Menu
|
||||||
|
Create an aside activity: "Créer une activité annexe"
|
||||||
|
Aside activity configuration menu: "Menu de configuration des activités annexes"
|
||||||
|
Aside activity configuration: "Configuration des activités annexes"
|
||||||
|
11
src/Bundle/ChillCalendarBundle/.gitignore
vendored
Normal file
11
src/Bundle/ChillCalendarBundle/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
composer.lock
|
||||||
|
vendor/*
|
||||||
|
parameters.yml
|
||||||
|
*~
|
||||||
|
*.DS_Store
|
||||||
|
*.sass-cache
|
||||||
|
Resources/node_modules/
|
||||||
|
Tests/Fixtures/App/app/config/parameters.yml
|
||||||
|
/nbproject/private/
|
||||||
|
Resources/test/Fixtures/App/bootstrap.php.cache
|
||||||
|
|
9
src/Bundle/ChillCalendarBundle/ChillCalendarBundle.php
Normal file
9
src/Bundle/ChillCalendarBundle/ChillCalendarBundle.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
|
class ChillCalendarBundle extends Bundle
|
||||||
|
{
|
||||||
|
}
|
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
|
||||||
|
class CalendarAPIController extends ApiController
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
protected function getContextForSerialization(string $action, Request $request, string $_format, $entity): array
|
||||||
|
{
|
||||||
|
switch($action) {
|
||||||
|
case '_index':
|
||||||
|
switch ($request->getMethod()) {
|
||||||
|
case Request::METHOD_GET:
|
||||||
|
return [ 'groups' => [ 'calendar:read' ] ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parent::getContextForSerialization($action, $request, $_format, $entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function customizeQuery(string $action, Request $request, $qb): void
|
||||||
|
{
|
||||||
|
if ($request->query->has('main_user')) {
|
||||||
|
|
||||||
|
$qb->where('e.mainUser = :main_user')
|
||||||
|
->setParameter('main_user', $request->query->get('main_user'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
432
src/Bundle/ChillCalendarBundle/Controller/CalendarController.php
Normal file
432
src/Bundle/ChillCalendarBundle/Controller/CalendarController.php
Normal file
@@ -0,0 +1,432 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||||
|
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
use Symfony\Component\Form\Form;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
use Chill\CalendarBundle\Entity\Calendar;
|
||||||
|
use Chill\CalendarBundle\Form\CalendarType;
|
||||||
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||||
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CalendarController
|
||||||
|
*
|
||||||
|
* @package Chill\CalendarBundle\Controller
|
||||||
|
*/
|
||||||
|
class CalendarController extends AbstractController
|
||||||
|
{
|
||||||
|
protected EventDispatcherInterface $eventDispatcher;
|
||||||
|
|
||||||
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
|
|
||||||
|
protected LoggerInterface $logger;
|
||||||
|
|
||||||
|
protected SerializerInterface $serializer;
|
||||||
|
|
||||||
|
protected PaginatorFactory $paginator;
|
||||||
|
|
||||||
|
private CalendarRepository $calendarRepository;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
EventDispatcherInterface $eventDispatcher,
|
||||||
|
AuthorizationHelper $authorizationHelper,
|
||||||
|
LoggerInterface $logger,
|
||||||
|
SerializerInterface $serializer,
|
||||||
|
PaginatorFactory $paginator,
|
||||||
|
CalendarRepository $calendarRepository
|
||||||
|
) {
|
||||||
|
$this->eventDispatcher = $eventDispatcher;
|
||||||
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->logger = $logger;
|
||||||
|
$this->serializer = $serializer;
|
||||||
|
$this->paginator = $paginator;
|
||||||
|
$this->calendarRepository = $calendarRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Calendar entities.
|
||||||
|
* @Route("/{_locale}/calendar/calendar/", name="chill_calendar_calendar_list")
|
||||||
|
*/
|
||||||
|
public function listAction(Request $request): Response
|
||||||
|
{
|
||||||
|
$view = null;
|
||||||
|
|
||||||
|
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
|
if ($user instanceof User) {
|
||||||
|
|
||||||
|
$calendarItems = $this->calendarRepository->findByUser($user);
|
||||||
|
|
||||||
|
$view = '@ChillCalendar/Calendar/listByUser.html.twig';
|
||||||
|
|
||||||
|
return $this->render($view, [
|
||||||
|
'calendarItems' => $calendarItems,
|
||||||
|
'user' => $user
|
||||||
|
]);
|
||||||
|
|
||||||
|
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
|
||||||
|
$total = $this->calendarRepository->countByAccompanyingPeriod($accompanyingPeriod);
|
||||||
|
$paginator = $this->paginator->create($total);
|
||||||
|
$calendarItems = $this->calendarRepository->findBy(
|
||||||
|
['accompanyingPeriod' => $accompanyingPeriod],
|
||||||
|
['startDate' => 'DESC'],
|
||||||
|
$paginator->getItemsPerPage(),
|
||||||
|
$paginator->getCurrentPageFirstItemNumber()
|
||||||
|
);
|
||||||
|
|
||||||
|
$view = '@ChillCalendar/Calendar/listByAccompanyingCourse.html.twig';
|
||||||
|
|
||||||
|
return $this->render($view, [
|
||||||
|
'calendarItems' => $calendarItems,
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
'paginator' => $paginator
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new calendar item
|
||||||
|
* @Route("/{_locale}/calendar/calendar/new", name="chill_calendar_calendar_new")
|
||||||
|
*/
|
||||||
|
public function newAction(Request $request): Response
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$view = '@ChillCalendar/Calendar/newByAccompanyingCourse.html.twig';
|
||||||
|
}
|
||||||
|
// elseif ($user instanceof User) {
|
||||||
|
// $view = '@ChillCalendar/Calendar/newUser.html.twig';
|
||||||
|
// }
|
||||||
|
|
||||||
|
$entity = new Calendar();
|
||||||
|
$entity->setUser($this->getUser());
|
||||||
|
$entity->setStatus($entity::STATUS_VALID);
|
||||||
|
|
||||||
|
// if ($user instanceof User) {
|
||||||
|
// $entity->setPerson($user);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$entity->setAccompanyingPeriod($accompanyingPeriod);
|
||||||
|
}
|
||||||
|
|
||||||
|
$form = $this->createForm(CalendarType::class, $entity, [
|
||||||
|
'accompanyingPeriod' => $accompanyingPeriod,
|
||||||
|
])->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$em->persist($entity);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item created!'));
|
||||||
|
|
||||||
|
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
|
||||||
|
|
||||||
|
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
|
||||||
|
} elseif ($form->isSubmitted() and !$form->isValid()) {
|
||||||
|
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($view === null) {
|
||||||
|
throw $this->createNotFoundException('Template not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$entity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
||||||
|
|
||||||
|
return $this->render($view, [
|
||||||
|
'user' => $user,
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
'entity' => $entity,
|
||||||
|
'form' => $form->createView(),
|
||||||
|
'entity_json' => $entity_array
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a calendar item
|
||||||
|
* @Route("/{_locale}/calendar/calendar/{id}/show", name="chill_calendar_calendar_show")
|
||||||
|
*/
|
||||||
|
public function showAction(Request $request, $id): Response
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$view = '@ChillCalendar/Calendar/showByAccompanyingCourse.html.twig';
|
||||||
|
}
|
||||||
|
elseif ($user instanceof User) {
|
||||||
|
$view = '@ChillCalendar/Calendar/showByUser.html.twig';
|
||||||
|
}
|
||||||
|
|
||||||
|
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
||||||
|
|
||||||
|
if (!$entity) {
|
||||||
|
throw $this->createNotFoundException('Unable to find Calendar entity.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $accompanyingPeriod) {
|
||||||
|
$entity->personsAssociated = $entity->getPersonsAssociated();
|
||||||
|
$entity->personsNotAssociated = $entity->getPersonsNotAssociated();
|
||||||
|
}
|
||||||
|
|
||||||
|
// $deleteForm = $this->createDeleteForm($id, $accompanyingPeriod);
|
||||||
|
|
||||||
|
if ($view === null) {
|
||||||
|
throw $this->createNotFoundException('Template not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$personsId = [];
|
||||||
|
foreach ($entity->getPersons() as $p) {
|
||||||
|
array_push($personsId, $p->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
$professionalsId = [];
|
||||||
|
foreach ($entity->getProfessionals() as $p) {
|
||||||
|
array_push($professionalsId, $p->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
$durationTime = $entity->getEndDate()->diff($entity->getStartDate());
|
||||||
|
$durationTimeInMinutes = $durationTime->days*1440 + $durationTime->h*60 + $durationTime->i;
|
||||||
|
|
||||||
|
$activityData = [
|
||||||
|
'calendarId' => $id,
|
||||||
|
'personsId' => $personsId,
|
||||||
|
'professionalsId' => $professionalsId,
|
||||||
|
'date' => $entity->getStartDate()->format('Y-m-d'),
|
||||||
|
'durationTime' => $durationTimeInMinutes,
|
||||||
|
'comment' => $entity->getComment()->getComment(),
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->render($view, [
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
'entity' => $entity,
|
||||||
|
'user' => $user,
|
||||||
|
'activityData' => $activityData
|
||||||
|
//'delete_form' => $deleteForm->createView(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit a calendar item
|
||||||
|
* @Route("/{_locale}/calendar/calendar/{id}/edit", name="chill_calendar_calendar_edit")
|
||||||
|
*/
|
||||||
|
public function editAction($id, Request $request): Response
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$view = '@ChillCalendar/Calendar/editByAccompanyingCourse.html.twig';
|
||||||
|
}
|
||||||
|
elseif ($user instanceof User) {
|
||||||
|
$view = '@ChillCalendar/Calendar/editByUser.html.twig';
|
||||||
|
}
|
||||||
|
|
||||||
|
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
||||||
|
|
||||||
|
if (!$entity) {
|
||||||
|
throw $this->createNotFoundException('Unable to find Calendar entity.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$form = $this->createForm(CalendarType::class, $entity, [
|
||||||
|
'accompanyingPeriod' => $accompanyingPeriod,
|
||||||
|
])->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
$em->persist($entity);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item updated!'));
|
||||||
|
|
||||||
|
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
|
||||||
|
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
|
||||||
|
} elseif ($form->isSubmitted() and !$form->isValid()) {
|
||||||
|
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$deleteForm = $this->createDeleteForm($id, $user, $accompanyingPeriod);
|
||||||
|
|
||||||
|
if ($view === null) {
|
||||||
|
throw $this->createNotFoundException('Template not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$entity_array = $this->serializer->normalize($entity, 'json', ['groups' => 'read']);
|
||||||
|
|
||||||
|
return $this->render($view, [
|
||||||
|
'entity' => $entity,
|
||||||
|
'form' => $form->createView(),
|
||||||
|
'delete_form' => $deleteForm->createView(),
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
'user' => $user,
|
||||||
|
'entity_json' => $entity_array
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a calendar item
|
||||||
|
* @Route("/{_locale}/calendar/{id}/delete", name="chill_calendar_calendar_delete")
|
||||||
|
*/
|
||||||
|
public function deleteAction(Request $request, $id)
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
|
$view = '@ChillCalendar/Calendar/confirm_deleteByAccompanyingCourse.html.twig';
|
||||||
|
}
|
||||||
|
elseif ($user instanceof User) {
|
||||||
|
$view = '@ChillCalendar/Calendar/confirm_deleteByUser.html.twig';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @var $entity Calendar */
|
||||||
|
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
||||||
|
|
||||||
|
if (!$entity) {
|
||||||
|
throw $this->createNotFoundException('Unable to find Calendar entity.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$form = $this->createDeleteForm($id, $user, $accompanyingPeriod);
|
||||||
|
|
||||||
|
if ($request->getMethod() === Request::METHOD_DELETE) {
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isValid()) {
|
||||||
|
|
||||||
|
$this->logger->notice("A calendar event has been removed", [
|
||||||
|
'by_user' => $this->getUser()->getUsername(),
|
||||||
|
'calendar_id' => $entity->getId()
|
||||||
|
]);
|
||||||
|
|
||||||
|
$em->remove($entity);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
$this->addFlash('success', $this->get('translator')
|
||||||
|
->trans("The calendar item has been successfully removed."));
|
||||||
|
|
||||||
|
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
|
||||||
|
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($view === null) {
|
||||||
|
throw $this->createNotFoundException('Template not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render($view, [
|
||||||
|
'calendar' => $entity,
|
||||||
|
'delete_form' => $form->createView(),
|
||||||
|
'accompanyingCourse' => $accompanyingPeriod,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a form to delete a Calendar entity by id.
|
||||||
|
*/
|
||||||
|
private function createDeleteForm(int $id, ?User $user, ?AccompanyingPeriod $accompanyingPeriod): Form
|
||||||
|
{
|
||||||
|
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
|
||||||
|
$params['id'] = $id;
|
||||||
|
|
||||||
|
return $this->createFormBuilder()
|
||||||
|
->setAction($this->generateUrl('chill_calendar_calendar_delete', $params))
|
||||||
|
->setMethod('DELETE')
|
||||||
|
->add('submit', SubmitType::class, ['label' => 'Delete'])
|
||||||
|
->getForm()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getEntity(Request $request): array
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$user = $accompanyingPeriod = null;
|
||||||
|
|
||||||
|
if ($request->query->has('user_id')) {
|
||||||
|
$user_id = $request->get('user_id');
|
||||||
|
$user = $em->getRepository(User::class)->find($user_id);
|
||||||
|
|
||||||
|
if ($user === null) {
|
||||||
|
throw $this->createNotFoundException('User not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Add permission
|
||||||
|
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $user);
|
||||||
|
} elseif ($request->query->has('accompanying_period_id')) {
|
||||||
|
$accompanying_period_id = $request->get('accompanying_period_id');
|
||||||
|
$accompanyingPeriod = $em->getRepository(AccompanyingPeriod::class)->find($accompanying_period_id);
|
||||||
|
|
||||||
|
if ($accompanyingPeriod === null) {
|
||||||
|
throw $this->createNotFoundException('Accompanying Period not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Add permission
|
||||||
|
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
|
} else {
|
||||||
|
throw $this->createNotFoundException("Person or Accompanying Period not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
$user, $accompanyingPeriod
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildParamsToUrl(
|
||||||
|
?User $user,
|
||||||
|
?AccompanyingPeriod $accompanyingPeriod
|
||||||
|
): array {
|
||||||
|
$params = [];
|
||||||
|
|
||||||
|
if ($user) {
|
||||||
|
$params['user_id'] = $user->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($accompanyingPeriod) {
|
||||||
|
$params['accompanying_period_id'] = $accompanyingPeriod->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $params;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Chill\MainBundle\Serializer\Model\Collection;
|
||||||
|
|
||||||
|
class CalendarRangeAPIController extends ApiController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Route("/api/1.0/calendar/calendar-range-available.{_format}", name="chill_api_single_calendar_range_available")
|
||||||
|
*/
|
||||||
|
public function availableRanges(Request $request, string $_format): JsonResponse
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
$sql = 'SELECT c FROM ChillCalendarBundle:CalendarRange c
|
||||||
|
WHERE NOT EXISTS (SELECT cal.id FROM ChillCalendarBundle:Calendar cal WHERE cal.calendarRange = c.id)';
|
||||||
|
|
||||||
|
if ($request->query->has('user')) {
|
||||||
|
$user = $request->query->get('user');
|
||||||
|
$sql = $sql . ' AND c.user = :user';
|
||||||
|
$query = $em->createQuery($sql)
|
||||||
|
->setParameter('user', $user);
|
||||||
|
} else {
|
||||||
|
$query = $em->createQuery($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = $query->getResult();
|
||||||
|
|
||||||
|
return $this->json(['count' => count($results), 'results' => $results], Response::HTTP_OK, [], [ 'groups' => [ 'read' ]]);
|
||||||
|
//TODO use also the paginator, eg return $this->serializeCollection('get', $request, $_format, $paginator, $results);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Entity\CalendarRange;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use DateTimeImmutable;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||||
|
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
|
||||||
|
class LoadCalendarRange extends Fixture implements FixtureGroupInterface, OrderedFixtureInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
EntityManagerInterface $em
|
||||||
|
) {
|
||||||
|
$this->userRepository = $em->getRepository(User::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrder(): int
|
||||||
|
{
|
||||||
|
return 40003;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getGroups(): array
|
||||||
|
{
|
||||||
|
return ['calendar'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static $references = [];
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager): void
|
||||||
|
{
|
||||||
|
$arr = range(-50, 50);
|
||||||
|
|
||||||
|
print "Creating calendar range ('plage de disponibilités')\n";
|
||||||
|
|
||||||
|
$users = $this->userRepository->findAll();
|
||||||
|
|
||||||
|
$days = [
|
||||||
|
'2021-08-23',
|
||||||
|
'2021-08-24',
|
||||||
|
'2021-08-25',
|
||||||
|
'2021-08-26',
|
||||||
|
'2021-08-30',
|
||||||
|
'2021-08-31',
|
||||||
|
'2021-09-01',
|
||||||
|
'2021-09-02',
|
||||||
|
];
|
||||||
|
|
||||||
|
$hours = [
|
||||||
|
'10:00:00',
|
||||||
|
'11:30:00',
|
||||||
|
'13:30:00',
|
||||||
|
'15:00:00'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($users as $u) {
|
||||||
|
foreach ($days as $d) {
|
||||||
|
foreach ($hours as $h){
|
||||||
|
$event = $d.' '.$h;
|
||||||
|
$startEvent = new DateTimeImmutable($event);
|
||||||
|
$endEvent = new DateTimeImmutable($event.' + 1 hours');
|
||||||
|
$calendarRange= (new CalendarRange())
|
||||||
|
->setUser($u)
|
||||||
|
->setStartDate($startEvent)
|
||||||
|
->setEndDate($endEvent);
|
||||||
|
|
||||||
|
$manager->persist($calendarRange);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Entity\CancelReason;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
|
||||||
|
class LoadCancelReason extends Fixture implements FixtureGroupInterface
|
||||||
|
{
|
||||||
|
public function getOrder(): int
|
||||||
|
{
|
||||||
|
return 40001;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getGroups(): array
|
||||||
|
{
|
||||||
|
return ['calendar'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static $references = [];
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager): void
|
||||||
|
{
|
||||||
|
$arr = [
|
||||||
|
['name' => CancelReason::CANCELEDBY_USER],
|
||||||
|
['name' => CancelReason::CANCELEDBY_PERSON],
|
||||||
|
['name' => CancelReason::CANCELEDBY_DONOTCOUNT],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($arr as $a) {
|
||||||
|
print "Creating calendar cancel reason : " . $a['name'] . "\n";
|
||||||
|
$cancelReason= (new CancelReason())
|
||||||
|
->setCanceledBy($a['name'])
|
||||||
|
->setActive(true);
|
||||||
|
$manager->persist($cancelReason);
|
||||||
|
$reference = 'CancelReason_'.$a['name'];
|
||||||
|
$this->addReference($reference, $cancelReason);
|
||||||
|
static::$references[] = $reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Entity\Invite;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
|
||||||
|
class LoadInvite extends Fixture implements FixtureGroupInterface
|
||||||
|
{
|
||||||
|
public function getOrder(): int
|
||||||
|
{
|
||||||
|
return 40002;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getGroups(): array
|
||||||
|
{
|
||||||
|
return ['calendar'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static $references = [];
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager): void
|
||||||
|
{
|
||||||
|
$arr = [
|
||||||
|
['name' => ['fr' => 'Rendez-vous décliné']],
|
||||||
|
['name' => ['fr' => 'Rendez-vous accepté']],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($arr as $a) {
|
||||||
|
print "Creating calendar invite : " . $a['name']['fr'] . "\n";
|
||||||
|
$invite= (new Invite())
|
||||||
|
->setStatus($a['name']);
|
||||||
|
$manager->persist($invite);
|
||||||
|
$reference = 'Invite_'.$a['name']['fr'];
|
||||||
|
$this->addReference($reference, $invite);
|
||||||
|
static::$references[] = $reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,110 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\DependencyInjection;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\Config\FileLocator;
|
||||||
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader;
|
||||||
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the class that loads and manages your bundle configuration.
|
||||||
|
*
|
||||||
|
* @link http://symfony.com/doc/current/cookbook/bundles/extension.html
|
||||||
|
*/
|
||||||
|
class ChillCalendarExtension extends Extension implements PrependExtensionInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$configuration = new Configuration();
|
||||||
|
$config = $this->processConfiguration($configuration, $configs);
|
||||||
|
|
||||||
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||||
|
$loader->load('services.yml');
|
||||||
|
$loader->load('services/controller.yml');
|
||||||
|
$loader->load('services/fixtures.yml');
|
||||||
|
$loader->load('services/form.yml');
|
||||||
|
$loader->load('services/event.yml');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function prepend(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$this->preprendRoutes($container);
|
||||||
|
$this->prependCruds($container);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function preprendRoutes(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
|
||||||
|
$container->prependExtensionConfig('chill_main', [
|
||||||
|
'routing' => [
|
||||||
|
'resources' => [
|
||||||
|
'@ChillCalendarBundle/Resources/config/routing.yml'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ContainerBuilder $container
|
||||||
|
*/
|
||||||
|
protected function prependCruds(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$container->prependExtensionConfig('chill_main', [
|
||||||
|
'apis' => [
|
||||||
|
[
|
||||||
|
'controller' => \Chill\CalendarBundle\Controller\CalendarRangeAPIController::class,
|
||||||
|
'class' => \Chill\CalendarBundle\Entity\CalendarRange::class,
|
||||||
|
'name' => 'calendar_range',
|
||||||
|
'base_path' => '/api/1.0/calendar/calendar-range',
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'_entity' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
Request::METHOD_POST => true,
|
||||||
|
Request::METHOD_PATCH => true,
|
||||||
|
Request::METHOD_DELETE => true,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'controller' => \Chill\CalendarBundle\Controller\CalendarAPIController::class,
|
||||||
|
'class' => \Chill\CalendarBundle\Entity\Calendar::class,
|
||||||
|
'name' => 'calendar',
|
||||||
|
'base_path' => '/api/1.0/calendar/calendar',
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'_entity' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\DependencyInjection;
|
||||||
|
|
||||||
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||||
|
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the class that validates and merges configuration from your app/config files.
|
||||||
|
*
|
||||||
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/configuration.html}
|
||||||
|
*/
|
||||||
|
class Configuration implements ConfigurationInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getConfigTreeBuilder()
|
||||||
|
{
|
||||||
|
$treeBuilder = new TreeBuilder('chill_calendar');
|
||||||
|
$rootNode = $treeBuilder->getRootNode('chill_calendar');
|
||||||
|
|
||||||
|
// Here you should define the parameters that are allowed to
|
||||||
|
// configure your bundle. See the documentation linked above for
|
||||||
|
// more information on that topic.
|
||||||
|
|
||||||
|
return $treeBuilder;
|
||||||
|
}
|
||||||
|
}
|
410
src/Bundle/ChillCalendarBundle/Entity/Calendar.php
Normal file
410
src/Bundle/ChillCalendarBundle/Entity/Calendar.php
Normal file
@@ -0,0 +1,410 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Entity;
|
||||||
|
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
|
use Chill\CalendarBundle\Entity\CancelReason;
|
||||||
|
use Chill\CalendarBundle\Entity\CalendarRange;
|
||||||
|
use Chill\CalendarBundle\Entity\Invite;
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use DateInterval;
|
||||||
|
use DateTimeImmutable;
|
||||||
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Symfony\Component\Validator\Constraints\Range;
|
||||||
|
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||||
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Table(name="chill_calendar.calendar")
|
||||||
|
* @ORM\Entity(repositoryClass=CalendarRepository::class)
|
||||||
|
*/
|
||||||
|
class Calendar
|
||||||
|
{
|
||||||
|
const STATUS_VALID = 'valid';
|
||||||
|
const STATUS_CANCELED = 'canceled';
|
||||||
|
const STATUS_MOVED = 'moved';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\GeneratedValue
|
||||||
|
* @ORM\Column(type="integer")
|
||||||
|
* @Serializer\Groups({"calendar:read"})
|
||||||
|
*/
|
||||||
|
private ?int $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
|
* @Groups({"read"})
|
||||||
|
* @Serializer\Groups({"calendar:read"})
|
||||||
|
*/
|
||||||
|
private ?User $user = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
|
||||||
|
*/
|
||||||
|
private AccompanyingPeriod $accompanyingPeriod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
|
* @Serializer\Groups({"calendar:read"})
|
||||||
|
*/
|
||||||
|
private ?User $mainUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ORM\ManyToMany(
|
||||||
|
* targetEntity="Chill\PersonBundle\Entity\Person",
|
||||||
|
* cascade={"persist", "remove", "merge", "detach"})
|
||||||
|
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
|
||||||
|
* @Groups({"read"})
|
||||||
|
* @Serializer\Groups({"calendar:read"})
|
||||||
|
*/
|
||||||
|
private Collection $persons;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ORM\ManyToMany(
|
||||||
|
* targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty",
|
||||||
|
* cascade={"persist", "remove", "merge", "detach"})
|
||||||
|
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
|
||||||
|
* @Groups({"read"})
|
||||||
|
* @Serializer\Groups({"calendar:read"})
|
||||||
|
*/
|
||||||
|
private Collection $professionals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ORM\ManyToMany(
|
||||||
|
* targetEntity="Invite",
|
||||||
|
* cascade={"persist", "remove", "merge", "detach"})
|
||||||
|
* @ORM\JoinTable(name="chill_calendar.calendar_to_invites")
|
||||||
|
* @Groups({"read"})
|
||||||
|
*/
|
||||||
|
private Collection $invites;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
|
||||||
|
* @Serializer\Groups({"calendar:read"})
|
||||||
|
*/
|
||||||
|
private CommentEmbeddable $comment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetimetz_immutable")
|
||||||
|
* @Serializer\Groups({"calendar:read"})
|
||||||
|
*/
|
||||||
|
private ?\DateTimeImmutable $startDate = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetimetz_immutable")
|
||||||
|
* @Serializer\Groups({"calendar:read"})
|
||||||
|
*/
|
||||||
|
private ?\DateTimeImmutable $endDate = null;
|
||||||
|
|
||||||
|
//TODO Lieu
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", length=255)
|
||||||
|
*/
|
||||||
|
private ?string $status = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="CancelReason")
|
||||||
|
*/
|
||||||
|
private ?CancelReason $cancelReason = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="CalendarRange", inversedBy="calendars")
|
||||||
|
*/
|
||||||
|
private ?CalendarRange $calendarRange = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\Activity")
|
||||||
|
*/
|
||||||
|
private ?Activity $activity = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean", nullable=true)
|
||||||
|
*/
|
||||||
|
private ?bool $sendSMS;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->comment = new CommentEmbeddable();
|
||||||
|
$this->persons = new ArrayCollection();
|
||||||
|
$this->professionals = new ArrayCollection();
|
||||||
|
$this->invites = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSendSMS(): ?bool
|
||||||
|
{
|
||||||
|
return $this->sendSMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSendSMS(?bool $sendSMS): self
|
||||||
|
{
|
||||||
|
$this->sendSMS = $sendSMS;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getComment(): CommentEmbeddable
|
||||||
|
{
|
||||||
|
return $this->comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setComment(CommentEmbeddable $comment): self
|
||||||
|
{
|
||||||
|
$this->comment = $comment;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStartDate(): ?\DateTimeImmutable
|
||||||
|
{
|
||||||
|
return $this->startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStartDate(\DateTimeImmutable $startDate): self
|
||||||
|
{
|
||||||
|
$this->startDate = $startDate;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEndDate(): ?\DateTimeImmutable
|
||||||
|
{
|
||||||
|
return $this->endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEndDate(\DateTimeImmutable $endDate): self
|
||||||
|
{
|
||||||
|
$this->endDate = $endDate;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus(): ?string
|
||||||
|
{
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStatus(string $status): self
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser(): ?User
|
||||||
|
{
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUser(?User $user): self
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAccompanyingPeriod(): ?AccompanyingPeriod
|
||||||
|
{
|
||||||
|
return $this->accompanyingPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAccompanyingPeriod(?AccompanyingPeriod $accompanyingPeriod): self
|
||||||
|
{
|
||||||
|
$this->accompanyingPeriod = $accompanyingPeriod;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMainUser(): ?User
|
||||||
|
{
|
||||||
|
return $this->mainUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMainUser(?User $mainUser): self
|
||||||
|
{
|
||||||
|
$this->mainUser = $mainUser;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|Person[]
|
||||||
|
*/
|
||||||
|
public function getPersons(): Collection
|
||||||
|
{
|
||||||
|
return $this->persons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPerson(?Person $person): self
|
||||||
|
{
|
||||||
|
if (null !== $person) {
|
||||||
|
$this->persons[] = $person;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removePerson(Person $person): self
|
||||||
|
{
|
||||||
|
$this->persons->removeElement($person);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|ThirdParty[]
|
||||||
|
*/
|
||||||
|
public function getProfessionals(): Collection
|
||||||
|
{
|
||||||
|
return $this->professionals;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addProfessional(?ThirdParty $professional): self
|
||||||
|
{
|
||||||
|
if (null !== $professional) {
|
||||||
|
$this->professionals[] = $professional;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeProfessional(ThirdParty $professional): self
|
||||||
|
{
|
||||||
|
$this->professionals->removeElement($professional);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection|Invite[]
|
||||||
|
*/
|
||||||
|
public function getInvites(): Collection
|
||||||
|
{
|
||||||
|
return $this->invites;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addInvite(?Invite $invite): self
|
||||||
|
{
|
||||||
|
if (null !== $invite) {
|
||||||
|
$this->invites[] = $invite;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeInvite(Invite $invite): self
|
||||||
|
{
|
||||||
|
$this->invites->removeElement($invite);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCancelReason(): ?CancelReason
|
||||||
|
{
|
||||||
|
return $this->cancelReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCancelReason(?CancelReason $cancelReason): self
|
||||||
|
{
|
||||||
|
$this->cancelReason = $cancelReason;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCalendarRange(): ?CalendarRange
|
||||||
|
{
|
||||||
|
return $this->calendarRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCalendarRange(?CalendarRange $calendarRange): self
|
||||||
|
{
|
||||||
|
$this->calendarRange = $calendarRange;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getActivity(): ?Activity
|
||||||
|
{
|
||||||
|
return $this->activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setActivity(?Activity $activity): self
|
||||||
|
{
|
||||||
|
$this->activity = $activity;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonsAssociated(): array
|
||||||
|
{
|
||||||
|
if (null !== $this->accompanyingPeriod) {
|
||||||
|
$personsAssociated = [];
|
||||||
|
foreach ($this->accompanyingPeriod->getParticipations() as $participation) {
|
||||||
|
if ($this->persons->contains($participation->getPerson())) {
|
||||||
|
$personsAssociated[] = $participation->getPerson();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $personsAssociated;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPersonsNotAssociated(): array
|
||||||
|
{
|
||||||
|
if (null !== $this->accompanyingPeriod) {
|
||||||
|
$personsNotAssociated = [];
|
||||||
|
foreach ($this->persons as $person) {
|
||||||
|
if (!in_array($person, $this->getPersonsAssociated())) {
|
||||||
|
$personsNotAssociated[] = $person;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $personsNotAssociated;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getThirdParties(): Collection
|
||||||
|
{
|
||||||
|
return $this->getProfessionals();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getusers(): Collection
|
||||||
|
{
|
||||||
|
return $this->getInvites(); //TODO get users of the invite
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function loadValidatorMetadata(ClassMetadata $metadata): void
|
||||||
|
{
|
||||||
|
$metadata->addPropertyConstraint('startDate', new NotBlank());
|
||||||
|
$metadata->addPropertyConstraint('startDate', new Range([
|
||||||
|
'min' => '2 years ago',
|
||||||
|
'max' => '+ 2 years',
|
||||||
|
]));
|
||||||
|
$metadata->addPropertyConstraint('endDate', new NotBlank());
|
||||||
|
$metadata->addPropertyConstraint('endDate', new Range([
|
||||||
|
'min' => '2 years ago',
|
||||||
|
'max' => '+ 2 years',
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
99
src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php
Normal file
99
src/Bundle/ChillCalendarBundle/Entity/CalendarRange.php
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Repository\CalendarRangeRepository;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Serializer\Annotation\Groups;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Table(name="chill_calendar.calendar_range")
|
||||||
|
* @ORM\Entity(repositoryClass=CalendarRangeRepository::class)
|
||||||
|
*/
|
||||||
|
class CalendarRange
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\GeneratedValue
|
||||||
|
* @ORM\Column(type="integer")
|
||||||
|
* @groups({"read"})
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
|
* @groups({"read", "write"})
|
||||||
|
*/
|
||||||
|
private ?User $user = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetimetz_immutable")
|
||||||
|
* @groups({"read", "write"})
|
||||||
|
*/
|
||||||
|
private ?\DateTimeImmutable $startDate = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="datetimetz_immutable")
|
||||||
|
* @groups({"read", "write"})
|
||||||
|
*/
|
||||||
|
private ?\DateTimeImmutable $endDate = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity=Calendar::class,
|
||||||
|
* mappedBy="calendarRange")
|
||||||
|
*/
|
||||||
|
private Collection $calendars;
|
||||||
|
|
||||||
|
//TODO Lieu
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->calendars = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStartDate(): ?\DateTimeImmutable
|
||||||
|
{
|
||||||
|
return $this->startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStartDate(\DateTimeImmutable $startDate): self
|
||||||
|
{
|
||||||
|
$this->startDate = $startDate;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEndDate(): ?\DateTimeImmutable
|
||||||
|
{
|
||||||
|
return $this->endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setEndDate(\DateTimeImmutable $endDate): self
|
||||||
|
{
|
||||||
|
$this->endDate = $endDate;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser(): ?User
|
||||||
|
{
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUser(?User $user): self
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
81
src/Bundle/ChillCalendarBundle/Entity/CancelReason.php
Normal file
81
src/Bundle/ChillCalendarBundle/Entity/CancelReason.php
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Repository\CancelReasonRepository;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Table(name="chill_calendar.cancel_reason")
|
||||||
|
* @ORM\Entity(repositoryClass=CancelReasonRepository::class)
|
||||||
|
*/
|
||||||
|
class CancelReason
|
||||||
|
{
|
||||||
|
|
||||||
|
const CANCELEDBY_USER = 'CANCELEDBY_USER';
|
||||||
|
const CANCELEDBY_PERSON = 'CANCELEDBY_PERSON';
|
||||||
|
const CANCELEDBY_DONOTCOUNT = 'CANCELEDBY_DONOTCOUNT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\GeneratedValue
|
||||||
|
* @ORM\Column(type="integer")
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="boolean")
|
||||||
|
*/
|
||||||
|
private $active;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", length=255)
|
||||||
|
*/
|
||||||
|
private $canceledBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="json_array")
|
||||||
|
*/
|
||||||
|
private $name = [];
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getActive(): ?bool
|
||||||
|
{
|
||||||
|
return $this->active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setActive(bool $active): self
|
||||||
|
{
|
||||||
|
$this->active = $active;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCanceledBy(): ?string
|
||||||
|
{
|
||||||
|
return $this->canceledBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCanceledBy(string $canceledBy): self
|
||||||
|
{
|
||||||
|
$this->canceledBy = $canceledBy;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): ?array
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(array $name): self
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
60
src/Bundle/ChillCalendarBundle/Entity/Invite.php
Normal file
60
src/Bundle/ChillCalendarBundle/Entity/Invite.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Repository\InviteRepository;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Table(name="chill_calendar.invite")
|
||||||
|
* @ORM\Entity(repositoryClass=InviteRepository::class)
|
||||||
|
*/
|
||||||
|
class Invite
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @ORM\Id
|
||||||
|
* @ORM\GeneratedValue
|
||||||
|
* @ORM\Column(type="integer")
|
||||||
|
*/
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||||
|
*/
|
||||||
|
private User $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="json_array")
|
||||||
|
*/
|
||||||
|
private array $status = [];
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus(): ?array
|
||||||
|
{
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStatus(array $status): self
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser(): ?User
|
||||||
|
{
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUser(?User $user): self
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Event;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Doctrine\Persistence\Event\LifecycleEventArgs;
|
||||||
|
use Symfony\Component\HttpFoundation\RequestStack;
|
||||||
|
|
||||||
|
class ListenToActivityCreate
|
||||||
|
{
|
||||||
|
|
||||||
|
private RequestStack $requestStack;
|
||||||
|
|
||||||
|
public function __construct(RequestStack $requestStack)
|
||||||
|
{
|
||||||
|
$this->requestStack = $requestStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postPersist(Activity $activity, LifecycleEventArgs $event): void
|
||||||
|
{
|
||||||
|
// Get the calendarId from the request
|
||||||
|
$request = $this->requestStack->getCurrentRequest();
|
||||||
|
|
||||||
|
if (null === $request) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->query->has('activityData')) {
|
||||||
|
$activityData = $request->query->get('activityData');
|
||||||
|
if (array_key_exists('calendarId', $activityData)) {
|
||||||
|
$calendarId = $activityData['calendarId'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach the activity to the calendar
|
||||||
|
$em = $event->getObjectManager();
|
||||||
|
|
||||||
|
$calendar = $em->getRepository(\Chill\CalendarBundle\Entity\Calendar::class)->find($calendarId);
|
||||||
|
$calendar->setActivity($activity);
|
||||||
|
|
||||||
|
$em->persist($calendar);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
228
src/Bundle/ChillCalendarBundle/Form/CalendarType.php
Normal file
228
src/Bundle/ChillCalendarBundle/Form/CalendarType.php
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Form;
|
||||||
|
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
use Symfony\Component\Form\CallbackTransformer;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Form\Type\CommentType;
|
||||||
|
use Chill\CalendarBundle\Entity\Calendar;
|
||||||
|
use Chill\CalendarBundle\Entity\CalendarRange;
|
||||||
|
use Chill\CalendarBundle\Entity\CancelReason;
|
||||||
|
use Chill\CalendarBundle\Entity\Invite;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||||
|
use DateTimeImmutable;
|
||||||
|
|
||||||
|
class CalendarType extends AbstractType
|
||||||
|
{
|
||||||
|
|
||||||
|
protected TranslatableStringHelper $translatableStringHelper;
|
||||||
|
protected ObjectManager $om;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
|
ObjectManager $om
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
|
$this->om = $om;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
$builder
|
||||||
|
->add('comment', CommentType::class, [
|
||||||
|
'required' => false
|
||||||
|
])
|
||||||
|
// ->add('cancelReason', EntityType::class, [
|
||||||
|
// 'required' => false,
|
||||||
|
// 'class' => CancelReason::class,
|
||||||
|
// 'choice_label' => function (CancelReason $entity) {
|
||||||
|
// return $entity->getCanceledBy();
|
||||||
|
// },
|
||||||
|
// ])
|
||||||
|
->add('sendSMS', ChoiceType::class, [
|
||||||
|
'required' => false,
|
||||||
|
'choices' => [
|
||||||
|
'Oui' => true,
|
||||||
|
'Non' => false
|
||||||
|
],
|
||||||
|
'expanded' => true
|
||||||
|
])
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
$builder->add('mainUser', HiddenType::class);
|
||||||
|
$builder->get('mainUser')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (?User $user): int {
|
||||||
|
if (NULL !== $user) {
|
||||||
|
$res = $user->getId();
|
||||||
|
} else {
|
||||||
|
$res = -1; //TODO cannot be null in any ways...
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
},
|
||||||
|
function (?int $userId): User {
|
||||||
|
return $this->om->getRepository(user::class)->findOneBy(['id' => (int) $userId]);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder->add('startDate', HiddenType::class);
|
||||||
|
$builder->get('startDate')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (?DateTimeImmutable $dateTimeImmutable): string {
|
||||||
|
if (NULL !== $dateTimeImmutable) {
|
||||||
|
$res = date_format($dateTimeImmutable, 'Y-m-d H:i:s');
|
||||||
|
} else {
|
||||||
|
$res = '';
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
},
|
||||||
|
function (?string $dateAsString): DateTimeImmutable {
|
||||||
|
dump($dateAsString);
|
||||||
|
return new DateTimeImmutable($dateAsString);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder->add('endDate', HiddenType::class);
|
||||||
|
$builder->get('endDate')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (?DateTimeImmutable $dateTimeImmutable): string {
|
||||||
|
if (NULL !== $dateTimeImmutable) {
|
||||||
|
$res = date_format($dateTimeImmutable, 'Y-m-d H:i:s');
|
||||||
|
} else {
|
||||||
|
$res = '';
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
},
|
||||||
|
function (?string $dateAsString): DateTimeImmutable {
|
||||||
|
return new DateTimeImmutable($dateAsString);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder->add('persons', HiddenType::class);
|
||||||
|
$builder->get('persons')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (iterable $personsAsIterable): string {
|
||||||
|
$personIds = [];
|
||||||
|
foreach ($personsAsIterable as $value) {
|
||||||
|
$personIds[] = $value->getId();
|
||||||
|
}
|
||||||
|
return implode(',', $personIds);
|
||||||
|
},
|
||||||
|
function (?string $personsAsString): array {
|
||||||
|
return array_map(
|
||||||
|
fn(string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
|
||||||
|
explode(',', $personsAsString)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder->add('professionals', HiddenType::class);
|
||||||
|
$builder->get('professionals')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (iterable $thirdpartyAsIterable): string {
|
||||||
|
$thirdpartyIds = [];
|
||||||
|
foreach ($thirdpartyAsIterable as $value) {
|
||||||
|
$thirdpartyIds[] = $value->getId();
|
||||||
|
}
|
||||||
|
return implode(',', $thirdpartyIds);
|
||||||
|
},
|
||||||
|
function (?string $thirdpartyAsString): array {
|
||||||
|
return array_map(
|
||||||
|
fn(string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
|
||||||
|
explode(',', $thirdpartyAsString)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder->add('calendarRange', HiddenType::class);
|
||||||
|
$builder->get('calendarRange')
|
||||||
|
->addModelTransformer(new CallbackTransformer(
|
||||||
|
function (?CalendarRange $calendarRange): ?int {
|
||||||
|
if (NULL !== $calendarRange) {
|
||||||
|
$res = $calendarRange->getId();
|
||||||
|
} else {
|
||||||
|
$res = -1;
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
},
|
||||||
|
function (?string $calendarRangeId): ?CalendarRange {
|
||||||
|
if (NULL !== $calendarRangeId) {
|
||||||
|
$res = $this->om->getRepository(CalendarRange::class)->findOneBy(['id' => (int) $calendarRangeId]);
|
||||||
|
} else {
|
||||||
|
$res = NULL;
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
))
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
// $builder->add('invites', HiddenType::class);
|
||||||
|
// $builder->get('invites')
|
||||||
|
// ->addModelTransformer(new CallbackTransformer(
|
||||||
|
// function (iterable $usersAsIterable): string {
|
||||||
|
// $userIds = [];
|
||||||
|
// foreach ($usersAsIterable as $value) {
|
||||||
|
// $userIds[] = $value->getId();
|
||||||
|
// }
|
||||||
|
// return implode(',', $userIds);
|
||||||
|
// },
|
||||||
|
// function (?string $usersAsString): array {
|
||||||
|
// return array_map(
|
||||||
|
// fn(string $id): ?Invite => $this->om->getRepository(Invite::class)->findOneBy(['id' => (int) $id]),
|
||||||
|
// explode(',', $usersAsString)
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// ))
|
||||||
|
// ;
|
||||||
|
|
||||||
|
|
||||||
|
}/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => Calendar::class
|
||||||
|
]);
|
||||||
|
|
||||||
|
$resolver
|
||||||
|
->setRequired(['accompanyingPeriod'])
|
||||||
|
->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null'])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getBlockPrefix()
|
||||||
|
{
|
||||||
|
return 'chill_calendarbundle_calendar';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
661
src/Bundle/ChillCalendarBundle/LICENSE
Normal file
661
src/Bundle/ChillCalendarBundle/LICENSE
Normal file
@@ -0,0 +1,661 @@
|
|||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Menu;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
|
||||||
|
{
|
||||||
|
protected TokenStorageInterface $tokenStorage;
|
||||||
|
|
||||||
|
protected AuthorizationHelper $authorizationHelper;
|
||||||
|
|
||||||
|
protected TranslatorInterface $translator;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
TokenStorageInterface $tokenStorage,
|
||||||
|
AuthorizationHelper $authorizationHelper,
|
||||||
|
TranslatorInterface $translator
|
||||||
|
) {
|
||||||
|
$this->translator = $translator;
|
||||||
|
$this->authorizationHelper = $authorizationHelper;
|
||||||
|
$this->tokenStorage = $tokenStorage;
|
||||||
|
}
|
||||||
|
public static function getMenuIds(): array
|
||||||
|
{
|
||||||
|
return ['accompanyingCourse'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
{
|
||||||
|
$period = $parameters['accompanyingCourse'];
|
||||||
|
|
||||||
|
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
|
||||||
|
$menu->addChild($this->translator->trans('Calendar'), [
|
||||||
|
'route' => 'chill_calendar_calendar_list',
|
||||||
|
'routeParameters' => [
|
||||||
|
'accompanying_period_id' => $period->getId(),
|
||||||
|
]])
|
||||||
|
->setExtras(['order' => 41]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
src/Bundle/ChillCalendarBundle/README.md
Normal file
6
src/Bundle/ChillCalendarBundle/README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Calendar bundle
|
||||||
|
===============
|
||||||
|
|
||||||
|
This bundle adds a calendar to chill.
|
||||||
|
|
||||||
|
|
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Entity\CalendarRange;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method CalendarRange|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method CalendarRange|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method CalendarRange[] findAll()
|
||||||
|
* @method CalendarRange[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class CalendarRangeRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, CalendarRange::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return CalendarRange[] Returns an array of CalendarRange objects
|
||||||
|
// */
|
||||||
|
/*
|
||||||
|
public function findByExampleField($value)
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('c')
|
||||||
|
->andWhere('c.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->orderBy('c.id', 'ASC')
|
||||||
|
->setMaxResults(10)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function findOneBySomeField($value): ?CalendarRange
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('c')
|
||||||
|
->andWhere('c.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->getQuery()
|
||||||
|
->getOneOrNullResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Entity\Calendar;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method Calendar|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method Calendar|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method Calendar[] findAll()
|
||||||
|
* @method Calendar[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class CalendarRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
|
||||||
|
// private EntityRepository $repository;
|
||||||
|
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Calendar::class);
|
||||||
|
// $this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return Calendar[] Returns an array of Calendar objects
|
||||||
|
// */
|
||||||
|
/*
|
||||||
|
public function findByExampleField($value)
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('c')
|
||||||
|
->andWhere('c.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->orderBy('c.id', 'ASC')
|
||||||
|
->setMaxResults(10)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function findOneBySomeField($value): ?Calendar
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('c')
|
||||||
|
->andWhere('c.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->getQuery()
|
||||||
|
->getOneOrNullResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Entity\CancelReason;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method CancelReason|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method CancelReason|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method CancelReason[] findAll()
|
||||||
|
* @method CancelReason[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class CancelReasonRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, CancelReason::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return CancelReason[] Returns an array of CancelReason objects
|
||||||
|
// */
|
||||||
|
/*
|
||||||
|
public function findByExampleField($value)
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('c')
|
||||||
|
->andWhere('c.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->orderBy('c.id', 'ASC')
|
||||||
|
->setMaxResults(10)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function findOneBySomeField($value): ?CancelReason
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('c')
|
||||||
|
->andWhere('c.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->getQuery()
|
||||||
|
->getOneOrNullResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\CalendarBundle\Repository;
|
||||||
|
|
||||||
|
use Chill\CalendarBundle\Entity\Invite;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method Invite|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method Invite|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method Invite[] findAll()
|
||||||
|
* @method Invite[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class InviteRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Invite::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return Invite[] Returns an array of Invite objects
|
||||||
|
// */
|
||||||
|
/*
|
||||||
|
public function findByExampleField($value)
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('i')
|
||||||
|
->andWhere('i.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->orderBy('i.id', 'ASC')
|
||||||
|
->setMaxResults(10)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function findOneBySomeField($value): ?Invite
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('i')
|
||||||
|
->andWhere('i.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->getQuery()
|
||||||
|
->getOneOrNullResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
@@ -1,3 +1,3 @@
|
|||||||
chill_docgen_controllers:
|
chill_calendar_controllers:
|
||||||
resource: '../../Controller/'
|
resource: '../../Controller/'
|
||||||
type: annotation
|
type: annotation
|
14
src/Bundle/ChillCalendarBundle/Resources/config/services.yml
Normal file
14
src/Bundle/ChillCalendarBundle/Resources/config/services.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
|
||||||
|
Chill\CalendarBundle\Repository\:
|
||||||
|
autowire: true
|
||||||
|
resource: '../../Repository/'
|
||||||
|
tags:
|
||||||
|
- { name: 'doctrine.repository_service' }
|
||||||
|
|
||||||
|
Chill\CalendarBundle\Menu\:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
resource: '../../Menu/'
|
||||||
|
tags: ['chill.menu_builder']
|
@@ -1,5 +1,5 @@
|
|||||||
services:
|
services:
|
||||||
Chill\DocGeneratorBundle\Controller\:
|
Chill\CalendarBundle\Controller\:
|
||||||
autowire: true
|
autowire: true
|
||||||
resource: '../../../Controller'
|
resource: '../../../Controller'
|
||||||
tags: ['controller.service_arguments']
|
tags: ['controller.service_arguments']
|
@@ -0,0 +1,10 @@
|
|||||||
|
services:
|
||||||
|
Chill\CalendarBundle\Event\ListenToActivityCreate:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
tags:
|
||||||
|
-
|
||||||
|
name: 'doctrine.orm.entity_listener'
|
||||||
|
event: 'postPersist'
|
||||||
|
entity: 'Chill\ActivityBundle\Entity\Activity'
|
||||||
|
|
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
Chill\CalendarBundle\DataFixtures\ORM\LoadCancelReason:
|
||||||
|
tags:
|
||||||
|
- { 'name': doctrine.fixture.orm }
|
||||||
|
Chill\CalendarBundle\DataFixtures\ORM\LoadInvite:
|
||||||
|
tags:
|
||||||
|
- { 'name': doctrine.fixture.orm }
|
||||||
|
Chill\CalendarBundle\DataFixtures\ORM\LoadCalendarRange:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
tags:
|
||||||
|
- { 'name': doctrine.fixture.orm }
|
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
chill.calendar.form.type.calendar:
|
||||||
|
class: Chill\CalendarBundle\Form\CalendarType
|
||||||
|
arguments:
|
||||||
|
- "@chill.main.helper.translatable_string"
|
||||||
|
- "@doctrine.orm.entity_manager"
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- { name: form.type, alias: chill_calendarbundle_calendar }
|
@@ -0,0 +1 @@
|
|||||||
|
require('./scss/calendar.scss');
|
@@ -0,0 +1,20 @@
|
|||||||
|
div#calendarControls {
|
||||||
|
height: 50%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#fullCalendar{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
span.calendarRangeItems {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,153 @@
|
|||||||
|
<template>
|
||||||
|
<concerned-groups></concerned-groups>
|
||||||
|
<teleport to="#calendarControls">
|
||||||
|
<calendar-user-selector
|
||||||
|
v-bind:users="users"
|
||||||
|
v-bind:calendarEvents="calendarEvents"
|
||||||
|
v-bind:updateEventsSource="updateEventsSource"
|
||||||
|
v-bind:showMyCalendar="showMyCalendar"
|
||||||
|
v-bind:toggleMyCalendar="toggleMyCalendar"
|
||||||
|
v-bind:toggleWeekends="toggleWeekends" >
|
||||||
|
</calendar-user-selector>
|
||||||
|
</teleport>
|
||||||
|
<teleport to="#fullCalendar">
|
||||||
|
<FullCalendar ref="fullCalendar" :options="calendarOptions">
|
||||||
|
<template v-slot:eventContent='arg'>
|
||||||
|
<b>{{ arg.timeText }}</b>
|
||||||
|
<i> {{ arg.event.title }}</i>
|
||||||
|
</template>
|
||||||
|
</FullCalendar>
|
||||||
|
</teleport>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ConcernedGroups from 'ChillActivityAssets/vuejs/Activity/components/ConcernedGroups.vue';
|
||||||
|
import CalendarUserSelector from '../_components/CalendarUserSelector/CalendarUserSelector.vue';
|
||||||
|
import '@fullcalendar/core/vdom'; // solves problem with Vite
|
||||||
|
import frLocale from '@fullcalendar/core/locales/fr';
|
||||||
|
import FullCalendar from '@fullcalendar/vue3';
|
||||||
|
import dayGridPlugin from '@fullcalendar/daygrid';
|
||||||
|
import interactionPlugin from '@fullcalendar/interaction';
|
||||||
|
import timeGridPlugin from '@fullcalendar/timegrid';
|
||||||
|
// import listPlugin from '@fullcalendar/list';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "App",
|
||||||
|
components: {
|
||||||
|
ConcernedGroups,
|
||||||
|
CalendarUserSelector,
|
||||||
|
FullCalendar
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
errorMsg: [],
|
||||||
|
users: {
|
||||||
|
loaded: [],
|
||||||
|
selected: [],
|
||||||
|
logged: null
|
||||||
|
},
|
||||||
|
calendarEvents: {
|
||||||
|
loaded: [],
|
||||||
|
selected: [],
|
||||||
|
user: [],
|
||||||
|
current: {
|
||||||
|
events: [{
|
||||||
|
title: 'plage prévue',
|
||||||
|
start: window.startDate,
|
||||||
|
end: window.endDate
|
||||||
|
}],
|
||||||
|
id: window.mainUser,
|
||||||
|
color: '#bbbbbb'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectedEvent: null,
|
||||||
|
previousSelectedEvent: null,
|
||||||
|
previousSelectedEventColor: null,
|
||||||
|
showMyCalendar: false,
|
||||||
|
calendarOptions: {
|
||||||
|
locale: frLocale,
|
||||||
|
plugins: [ dayGridPlugin, interactionPlugin, timeGridPlugin ],
|
||||||
|
initialView: 'timeGridWeek',
|
||||||
|
initialDate: window.startDate !== undefined ? window.startDate : new Date(),
|
||||||
|
eventSource: [],
|
||||||
|
selectable: true,
|
||||||
|
select: this.onDateSelect,
|
||||||
|
eventChange: this.onEventChange,
|
||||||
|
eventClick: this.onEventClick,
|
||||||
|
// eventMouseEnter: this.onEventMouseEnter,
|
||||||
|
// eventMouseLeave: this.onEventMouseLeave,
|
||||||
|
selectMirror: true,
|
||||||
|
editable: true,
|
||||||
|
weekends: false,
|
||||||
|
headerToolbar: {
|
||||||
|
left: 'prev,next today',
|
||||||
|
center: 'title',
|
||||||
|
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth,listWeek,listDay'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
this.updateEventsSource();
|
||||||
|
},
|
||||||
|
toggleMyCalendar(value) {
|
||||||
|
this.showMyCalendar = value;
|
||||||
|
},
|
||||||
|
toggleWeekends: function() {
|
||||||
|
this.calendarOptions.weekends = !this.calendarOptions.weekends;
|
||||||
|
},
|
||||||
|
updateEventsSource() {
|
||||||
|
this.calendarOptions.eventSources = [];
|
||||||
|
this.calendarOptions.eventSources.push(...this.calendarEvents.selected);
|
||||||
|
if (window.startDate !== undefined) {
|
||||||
|
this.calendarOptions.eventSources.push(this.calendarEvents.current);
|
||||||
|
}
|
||||||
|
if (this.showMyCalendar) {
|
||||||
|
this.calendarOptions.eventSources.push(this.calendarEvents.user);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
unSelectPreviousEvent(event) {
|
||||||
|
if (event) {
|
||||||
|
if (typeof event.setProp === 'function') {
|
||||||
|
event.setProp('backgroundColor', this.previousSelectedEventColor);
|
||||||
|
event.setProp('borderColor', this.previousSelectedEventColor);
|
||||||
|
event.setProp('textColor','#444444');
|
||||||
|
event.setProp('title','');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDateSelect(payload) {
|
||||||
|
console.log(payload)
|
||||||
|
this.unSelectPreviousEvent(this.selectedEvent);
|
||||||
|
Object.assign(payload, {users: this.users});
|
||||||
|
Object.assign(payload, {title: 'Choisir cette plage'}); //TODO does not display
|
||||||
|
//payload.event.setProp('title', 'Choisir cette plage');
|
||||||
|
this.$store.dispatch('createEvent', payload);
|
||||||
|
},
|
||||||
|
onEventChange(payload) {
|
||||||
|
this.$store.dispatch('updateEvent', payload);
|
||||||
|
},
|
||||||
|
onEventClick(payload) {
|
||||||
|
this.previousSelectedEvent = this.selectedEvent;
|
||||||
|
this.previousSelectedEventColor = payload.event.extendedProps.sourceColor;
|
||||||
|
this.selectedEvent = payload.event;
|
||||||
|
this.unSelectPreviousEvent(this.previousSelectedEvent);
|
||||||
|
payload.event.setProp('backgroundColor','#3788d8');
|
||||||
|
payload.event.setProp('borderColor','#3788d8');
|
||||||
|
payload.event.setProp('title', 'Choisir cette plage');
|
||||||
|
payload.event.setProp('textColor','#ffffff');
|
||||||
|
},
|
||||||
|
onEventMouseEnter(payload) {
|
||||||
|
payload.event.setProp('borderColor','#444444');
|
||||||
|
},
|
||||||
|
onEventMouseLeave(payload) {
|
||||||
|
payload.event.setProp('borderColor','#ffffff');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@@ -0,0 +1,23 @@
|
|||||||
|
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
|
||||||
|
import { calendarUserSelectorMessages } from '../_components/CalendarUserSelector/js/i18n';
|
||||||
|
|
||||||
|
const appMessages = {
|
||||||
|
fr: {
|
||||||
|
choose_your_date: "Sélectionnez votre plage",
|
||||||
|
activity: {
|
||||||
|
add_persons: "Ajouter des personnes concernées",
|
||||||
|
bloc_persons: "Usagers",
|
||||||
|
bloc_persons_associated: "Usagers du parcours",
|
||||||
|
bloc_persons_not_associated: "Tiers non-pro.",
|
||||||
|
bloc_thirdparty: "Tiers professionnels",
|
||||||
|
bloc_users: "T(M)S",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(appMessages.fr, personMessages.fr);
|
||||||
|
Object.assign(appMessages.fr, calendarUserSelectorMessages.fr);
|
||||||
|
|
||||||
|
export {
|
||||||
|
appMessages
|
||||||
|
};
|
@@ -0,0 +1,16 @@
|
|||||||
|
import { createApp } from 'vue';
|
||||||
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
|
||||||
|
import { appMessages } from './i18n'
|
||||||
|
import store from './store'
|
||||||
|
|
||||||
|
import App from './App.vue';
|
||||||
|
|
||||||
|
const i18n = _createI18n(appMessages);
|
||||||
|
|
||||||
|
const app = createApp({
|
||||||
|
template: `<app></app>`,
|
||||||
|
})
|
||||||
|
.use(store)
|
||||||
|
.use(i18n)
|
||||||
|
.component('app', App)
|
||||||
|
.mount('#calendar');
|
@@ -0,0 +1,136 @@
|
|||||||
|
import 'es6-promise/auto';
|
||||||
|
import { createStore } from 'vuex';
|
||||||
|
|
||||||
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
const addIdToValue = (string, id) => {
|
||||||
|
let array = string ? string.split(',') : [];
|
||||||
|
array.push(id.toString());
|
||||||
|
let str = array.join();
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
const removeIdFromValue = (string, id) => {
|
||||||
|
let array = string.split(',');
|
||||||
|
array = array.filter(el => el !== id.toString());
|
||||||
|
let str = array.join();
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Assign missing keys for the ConcernedGroups component
|
||||||
|
*/
|
||||||
|
const mapEntity = (entity) => {
|
||||||
|
Object.assign(entity, {thirdParties: entity.professionals, users: entity.invites});
|
||||||
|
return entity;
|
||||||
|
};
|
||||||
|
|
||||||
|
const store = createStore({
|
||||||
|
strict: debug,
|
||||||
|
state: {
|
||||||
|
activity: mapEntity(window.entity),
|
||||||
|
currentEvent: null
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
|
||||||
|
// ConcernedGroups
|
||||||
|
addPersonsInvolved(state, payload) {
|
||||||
|
//console.log('### mutation addPersonsInvolved', payload.result.type);
|
||||||
|
switch (payload.result.type) {
|
||||||
|
case 'person':
|
||||||
|
state.activity.persons.push(payload.result);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
state.activity.thirdParties.push(payload.result);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
state.activity.users.push(payload.result);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
removePersonInvolved(state, payload) {
|
||||||
|
//console.log('### mutation removePersonInvolved', payload.type);
|
||||||
|
switch (payload.type) {
|
||||||
|
case 'person':
|
||||||
|
state.activity.persons = state.activity.persons.filter(person => person !== payload);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
state.activity.thirdParties = state.activity.thirdParties.filter(thirdparty => thirdparty !== payload);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
state.activity.users = state.activity.users.filter(user => user !== payload);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// Calendar
|
||||||
|
setEvents(state, payload) {
|
||||||
|
console.log(payload)
|
||||||
|
state.currentEvent = {start: payload.start, end: payload.end}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
addPersonsInvolved({ commit }, payload) {
|
||||||
|
console.log('### action addPersonsInvolved', payload.result.type);
|
||||||
|
switch (payload.result.type) {
|
||||||
|
case 'person':
|
||||||
|
let aPersons = document.getElementById("chill_calendarbundle_calendar_persons");
|
||||||
|
aPersons.value = addIdToValue(aPersons.value, payload.result.id);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
let aThirdParties = document.getElementById("chill_calendarbundle_calendar_professionals");
|
||||||
|
aThirdParties.value = addIdToValue(aThirdParties.value, payload.result.id);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
let aUsers = document.getElementById("chill_calendarbundle_calendar_invites");
|
||||||
|
aUsers.value = addIdToValue(aUsers.value, payload.result.id);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
commit('addPersonsInvolved', payload);
|
||||||
|
},
|
||||||
|
removePersonInvolved({ commit }, payload) {
|
||||||
|
//console.log('### action removePersonInvolved', payload);
|
||||||
|
switch (payload.type) {
|
||||||
|
case 'person':
|
||||||
|
let aPersons = document.getElementById("chill_calendarbundle_calendar_persons");
|
||||||
|
aPersons.value = removeIdFromValue(aPersons.value, payload.id);
|
||||||
|
break;
|
||||||
|
case 'thirdparty':
|
||||||
|
let aThirdParties = document.getElementById("chill_calendarbundle_calendar_professionals");
|
||||||
|
aThirdParties.value = removeIdFromValue(aThirdParties.value, payload.id);
|
||||||
|
break;
|
||||||
|
case 'user':
|
||||||
|
let aUsers = document.getElementById("chill_calendarbundle_calendar_invites");
|
||||||
|
aUsers.value = removeIdFromValue(aUsers.value, payload.id);
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
commit('removePersonInvolved', payload);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Calendar
|
||||||
|
createEvent({ commit }, payload) {
|
||||||
|
console.log('### action createEvent', payload);
|
||||||
|
let startDateInput = document.getElementById("chill_calendarbundle_calendar_startDate");
|
||||||
|
startDateInput.value = payload.startStr;
|
||||||
|
let endDateInput = document.getElementById("chill_calendarbundle_calendar_endDate");
|
||||||
|
endDateInput.value = payload.endStr;
|
||||||
|
let mainUserInput = document.getElementById("chill_calendarbundle_calendar_mainUser");
|
||||||
|
mainUserInput.value = payload.users.logged.id;
|
||||||
|
commit('setEvents', payload);
|
||||||
|
},
|
||||||
|
updateEvent({ commit }, payload) {
|
||||||
|
console.log('### action updateEvent', payload);
|
||||||
|
let startDateInput = document.getElementById("chill_calendarbundle_calendar_startDate");
|
||||||
|
startDateInput.value = payload.event.start.toISOString();
|
||||||
|
let endDateInput = document.getElementById("chill_calendarbundle_calendar_endDate");
|
||||||
|
endDateInput.value = payload.event.end.toISOString();
|
||||||
|
let calendarRangeInput = document.getElementById("chill_calendarbundle_calendar_calendarRange");
|
||||||
|
calendarRangeInput.value = Number(payload.event.extendedProps.calendarRangeId);
|
||||||
|
let mainUserInput = document.getElementById("chill_calendarbundle_calendar_mainUser");
|
||||||
|
mainUserInput.value = Number(payload.event.source.id);
|
||||||
|
commit('setEvents', payload);
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default store;
|
@@ -0,0 +1,468 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h2 class="chill-red">{{ $t('edit_your_calendar_range') }}</h2>
|
||||||
|
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" id="myCalendar" class="form-check-input" v-model="showMyCalendarWidget" />
|
||||||
|
<label class="form-check-label" for="myCalendar">{{ $t('show_my_calendar') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" id="weekends" class="form-check-input" @click="toggleWeekends" />
|
||||||
|
<label class="form-check-label" for="weekends">{{ $t('show_weekends') }}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<FullCalendar ref="fullCalendar" :options="calendarOptions">
|
||||||
|
<template v-slot:eventContent='arg' >
|
||||||
|
<span class='calendarRangeItems'>
|
||||||
|
<b v-if="arg.event.extendedProps.myCalendar" style="text-decoration: underline" >{{ arg.timeText }}</b>
|
||||||
|
<b v-else-if="!arg.event.extendedProps.myCalendar && arg.event.extendedProps.toDelete" style="text-decoration: line-through red" >{{ arg.timeText }}</b>
|
||||||
|
<b v-else >{{ arg.timeText }}</b>
|
||||||
|
<i> {{ arg.event.title }}</i>
|
||||||
|
<a v-if=!arg.event.extendedProps.myCalendar class="fa fa-fw fa-times"
|
||||||
|
@click.prevent="onClickDelete(arg.event)">
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</FullCalendar>
|
||||||
|
<div>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<button class="btn btn-save" :disabled="!dirty"
|
||||||
|
@click.prevent="onClickSave">
|
||||||
|
{{ $t('action.save')}}
|
||||||
|
</button>
|
||||||
|
<span v-if="flag.loading" class="loading">
|
||||||
|
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
|
||||||
|
<span class="sr-only">{{ $t('loading') }}</span>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button v-if="disableCopyDayButton" class="btn btn-action" disabled>
|
||||||
|
{{ $t('copy_range_to_next_day')}}
|
||||||
|
</button>
|
||||||
|
<button v-else class="btn btn-action"
|
||||||
|
@click.prevent="copyDay">
|
||||||
|
{{ $t('copy_range_from_day')}} {{this.lastNewDate.toLocaleDateString()}} {{ $t('to_the_next_day')}}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div v-if="newCalendarRanges.length > 0">
|
||||||
|
<h4>{{ $t('new_range_to_save') }}</h4>
|
||||||
|
<ul>
|
||||||
|
<li v-for="i in newCalendarRanges" :key="i.start">
|
||||||
|
{{ i.start.toLocaleString() }} - {{ i.end.toLocaleString() }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div v-if="updateCalendarRanges.length > 0">
|
||||||
|
<h4>{{ $t('update_range_to_save') }}</h4>
|
||||||
|
<ul>
|
||||||
|
<li v-for="i in updateCalendarRanges" :key="i.start">
|
||||||
|
{{ i.start.toLocaleString() }} - {{ i.end.toLocaleString() }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div v-if="deleteCalendarRanges.length > 0">
|
||||||
|
<h4>{{ $t('delete_range_to_save') }}</h4>
|
||||||
|
<ul>
|
||||||
|
<li v-for="i in deleteCalendarRanges" :key="i.start">
|
||||||
|
{{ i.start.toLocaleString() }} - {{ i.end.toLocaleString() }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<teleport to="body">
|
||||||
|
<modal v-if="modal.showModal"
|
||||||
|
:modalDialogClass="modal.modalDialogClass"
|
||||||
|
@close="modal.showModal = false">
|
||||||
|
|
||||||
|
<template v-slot:header>
|
||||||
|
<h2 class="modal-title">{{ this.renderEventDate() }}</h2>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:body>
|
||||||
|
<p>{{ $t('by')}} {{this.myCalendarClickedEvent.user.username }}</p>
|
||||||
|
<p>{{ $t('main_user_concerned') }} : {{ this.myCalendarClickedEvent.mainUser.username }}</p>
|
||||||
|
<p v-if="myCalendarClickedEvent.comment.length > 0" >{{ this.myCalendarClickedEvent.comment }}</p>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:footer>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
class="btn btn-show"
|
||||||
|
:href=myCalendarEventShowLink() >
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
class="btn btn-update"
|
||||||
|
:href=myCalendarEventUpdateLink() >
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
class="btn btn-delete"
|
||||||
|
:href=myCalendarEventDeleteLink() >
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</modal>
|
||||||
|
</teleport>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import '@fullcalendar/core/vdom'; // solves problem with Vite
|
||||||
|
import frLocale from '@fullcalendar/core/locales/fr';
|
||||||
|
import FullCalendar from '@fullcalendar/vue3';
|
||||||
|
import dayGridPlugin from '@fullcalendar/daygrid';
|
||||||
|
import interactionPlugin from '@fullcalendar/interaction';
|
||||||
|
import timeGridPlugin from '@fullcalendar/timegrid';
|
||||||
|
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
|
||||||
|
import { deleteCalendarRange, fetchCalendar, fetchCalendarRangesByUser, patchCalendarRange, postCalendarRange } from '../_api/api';
|
||||||
|
import { mapState } from 'vuex';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "App",
|
||||||
|
components: {
|
||||||
|
FullCalendar,
|
||||||
|
Modal
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
errorMsg: [],
|
||||||
|
modal: {
|
||||||
|
showModal: false,
|
||||||
|
modalDialogClass: "modal-dialog-scrollable modal-m"
|
||||||
|
},
|
||||||
|
flag: {
|
||||||
|
loading: false
|
||||||
|
},
|
||||||
|
userId: window.userId,
|
||||||
|
showMyCalendar: true,
|
||||||
|
myCalendarClickedEvent: null,
|
||||||
|
calendarEvents: {
|
||||||
|
userCalendar: null,
|
||||||
|
userCalendarRange: null,
|
||||||
|
new: {
|
||||||
|
events: [],
|
||||||
|
color: "#3788d8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lastNewDate: null,
|
||||||
|
disableCopyDayButton: true,
|
||||||
|
calendarOptions: {
|
||||||
|
locale: frLocale,
|
||||||
|
plugins: [ dayGridPlugin, interactionPlugin, timeGridPlugin ],
|
||||||
|
initialView: 'timeGridWeek',
|
||||||
|
initialDate: window.startDate !== undefined ? window.startDate : new Date(),
|
||||||
|
eventSource: [],
|
||||||
|
selectable: true,
|
||||||
|
select: this.onDateSelect,
|
||||||
|
eventChange: this.onEventChange,
|
||||||
|
eventDrop: this.onEventDropOrResize,
|
||||||
|
eventResize: this.onEventDropOrResize,
|
||||||
|
eventClick: this.onEventClick,
|
||||||
|
selectMirror: false,
|
||||||
|
editable: true,
|
||||||
|
weekends: false,
|
||||||
|
headerToolbar: {
|
||||||
|
left: 'prev,next today',
|
||||||
|
center: 'title',
|
||||||
|
right: 'dayGridMonth,timeGridWeek,timeGridDay'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
newCalendarRanges: state => state.newCalendarRanges,
|
||||||
|
updateCalendarRanges: state => state.updateCalendarRanges,
|
||||||
|
deleteCalendarRanges: state => state.deleteCalendarRanges,
|
||||||
|
dirty: state => state.newCalendarRanges.length > 0 || state.updateCalendarRanges.length > 0 || state.deleteCalendarRanges.length > 0
|
||||||
|
}),
|
||||||
|
showMyCalendarWidget: {
|
||||||
|
set(value) {
|
||||||
|
this.toggleMyCalendar(value);
|
||||||
|
this.updateEventsSource();
|
||||||
|
},
|
||||||
|
get() {
|
||||||
|
return this.showMyCalendar;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
this.fetchData();
|
||||||
|
},
|
||||||
|
openModal() {
|
||||||
|
this.modal.showModal = true;
|
||||||
|
},
|
||||||
|
myCalendarEventShowLink() {
|
||||||
|
return `/fr/calendar/calendar/${this.myCalendarClickedEvent.id}/show?user_id=${ this.userId }`
|
||||||
|
},
|
||||||
|
myCalendarEventUpdateLink() {
|
||||||
|
return `/fr/calendar/calendar/${this.myCalendarClickedEvent.id}/edit?user_id=${ this.userId }`
|
||||||
|
},
|
||||||
|
myCalendarEventDeleteLink() {
|
||||||
|
return `/fr/calendar/calendar/${this.myCalendarClickedEvent.id}/delete?user_id=${ this.userId }`
|
||||||
|
},
|
||||||
|
resetCalendar() {
|
||||||
|
this.fetchData();
|
||||||
|
this.calendarEvents.new = {
|
||||||
|
events: [],
|
||||||
|
color: "#3788d8"
|
||||||
|
};
|
||||||
|
this.updateEventsSource();
|
||||||
|
},
|
||||||
|
fetchData() {
|
||||||
|
this.flag.loading = true;
|
||||||
|
fetchCalendarRangesByUser(this.userId).then(calendarRanges => new Promise((resolve, reject) => {
|
||||||
|
let events = calendarRanges.results.map(i =>
|
||||||
|
({
|
||||||
|
start: i.startDate.datetime,
|
||||||
|
end: i.endDate.datetime,
|
||||||
|
calendarRangeId: i.id,
|
||||||
|
toDelete: false
|
||||||
|
})
|
||||||
|
);
|
||||||
|
let calendarRangeEvents = {
|
||||||
|
events: events,
|
||||||
|
borderColor: "#3788d8",
|
||||||
|
backgroundColor: '#ffffff',
|
||||||
|
textColor: '#444444',
|
||||||
|
};
|
||||||
|
this.calendarEvents.userCalendarRange = calendarRangeEvents;
|
||||||
|
|
||||||
|
fetchCalendar(this.userId).then(calendar => new Promise((resolve, reject) => {
|
||||||
|
let events = calendar.results.map(i =>
|
||||||
|
({
|
||||||
|
myCalendar: true,
|
||||||
|
calendarId: i.id,
|
||||||
|
start: i.startDate.datetime,
|
||||||
|
end: i.endDate.datetime,
|
||||||
|
user: i.user,
|
||||||
|
mainUser: i.mainUser,
|
||||||
|
persons: i.persons,
|
||||||
|
professionals: i.professionals,
|
||||||
|
comment: i.comment
|
||||||
|
})
|
||||||
|
);
|
||||||
|
let calendarEventsCurrentUser = {
|
||||||
|
events: events,
|
||||||
|
color: 'darkblue',
|
||||||
|
id: 1000,
|
||||||
|
editable: false
|
||||||
|
};
|
||||||
|
this.calendarEvents.userCalendar = calendarEventsCurrentUser;
|
||||||
|
this.updateEventsSource();
|
||||||
|
this.flag.loading = false;
|
||||||
|
resolve();
|
||||||
|
}));
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
updateEventsSource() {
|
||||||
|
this.calendarOptions.eventSources = [];
|
||||||
|
this.calendarOptions.eventSources.push(this.calendarEvents.new);
|
||||||
|
this.calendarOptions.eventSources.push(this.calendarEvents.userCalendarRange);
|
||||||
|
if (this.showMyCalendar) {
|
||||||
|
this.calendarOptions.eventSources.push(this.calendarEvents.userCalendar);
|
||||||
|
}
|
||||||
|
console.log(this.calendarOptions.eventSources);
|
||||||
|
},
|
||||||
|
toggleMyCalendar(value) {
|
||||||
|
this.showMyCalendar = value;
|
||||||
|
},
|
||||||
|
toggleWeekends: function() {
|
||||||
|
this.calendarOptions.weekends = !this.calendarOptions.weekends;
|
||||||
|
},
|
||||||
|
onDateSelect(payload) {
|
||||||
|
let events = this.calendarEvents.new.events;
|
||||||
|
events.push({
|
||||||
|
start: payload.startStr,
|
||||||
|
end: payload.endStr
|
||||||
|
});
|
||||||
|
this.calendarEvents.new = {
|
||||||
|
events: events,
|
||||||
|
borderColor: "#3788d8",
|
||||||
|
backgroundColor: '#fffadf ',
|
||||||
|
textColor: '#444444',
|
||||||
|
};
|
||||||
|
this.disableCopyDayButton = false;
|
||||||
|
this.lastNewDate = new Date(payload.startStr);
|
||||||
|
this.updateEventsSource();
|
||||||
|
this.$store.dispatch('createRange', payload);
|
||||||
|
},
|
||||||
|
onEventChange(payload) {
|
||||||
|
},
|
||||||
|
onEventDropOrResize(payload) {
|
||||||
|
payload.event.setProp('borderColor', '#3788d8');
|
||||||
|
payload.event.setProp('backgroundColor', '#fffadf');
|
||||||
|
payload.event.setProp('textColor', '#444444');
|
||||||
|
this.$store.dispatch('updateRange', payload);
|
||||||
|
},
|
||||||
|
onEventClick(payload) {
|
||||||
|
if (payload.event.extendedProps.myCalendar) {
|
||||||
|
this.myCalendarClickedEvent = {
|
||||||
|
id: payload.event.extendedProps.calendarId,
|
||||||
|
start: payload.event.start,
|
||||||
|
end: payload.event.end,
|
||||||
|
user: payload.event.extendedProps.user,
|
||||||
|
mainUser: payload.event.extendedProps.mainUser,
|
||||||
|
persons: payload.event.extendedProps.persons,
|
||||||
|
professionals: payload.event.extendedProps.professionals,
|
||||||
|
comment: payload.event.extendedProps.comment
|
||||||
|
};
|
||||||
|
console.log(this.myCalendarClickedEvent)
|
||||||
|
this.openModal();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onClickSave(payload) {
|
||||||
|
this.flag.loading = true;
|
||||||
|
if (this.$store.state.newCalendarRanges.length > 0){
|
||||||
|
Promise.all(this.$store.state.newCalendarRanges.map(cr => {
|
||||||
|
postCalendarRange({
|
||||||
|
user: {
|
||||||
|
type: 'user',
|
||||||
|
id: window.userId,
|
||||||
|
},
|
||||||
|
startDate: {
|
||||||
|
datetime: `${cr.start.toISOString().split('.')[0]}+0000`, //should be like "2021-08-20T15:00:00+0200",
|
||||||
|
},
|
||||||
|
endDate: {
|
||||||
|
datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
).then((_r) => this.resetCalendar());
|
||||||
|
|
||||||
|
this.$store.dispatch('clearNewCalendarRanges', payload);
|
||||||
|
}
|
||||||
|
if (this.$store.state.updateCalendarRanges.length > 0){
|
||||||
|
Promise.all(this.$store.state.updateCalendarRanges.map(cr => {
|
||||||
|
patchCalendarRange(cr.id,
|
||||||
|
{
|
||||||
|
startDate: {
|
||||||
|
datetime: `${cr.start.toISOString().split('.')[0]}+0000`, //should be like "2021-08-20T15:00:00+0200",
|
||||||
|
},
|
||||||
|
endDate: {
|
||||||
|
datetime: `${cr.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
).then((_r) => this.resetCalendar());
|
||||||
|
this.$store.dispatch('clearUpdateCalendarRanges', payload);
|
||||||
|
}
|
||||||
|
if (this.$store.state.deleteCalendarRanges.length > 0){
|
||||||
|
Promise.all(this.$store.state.deleteCalendarRanges.map(cr => {
|
||||||
|
deleteCalendarRange(cr.id)
|
||||||
|
})
|
||||||
|
).then((_r) => this.resetCalendar());
|
||||||
|
this.$store.dispatch('clearDeleteCalendarRanges', payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
onClickDelete(payload) {
|
||||||
|
if (payload.extendedProps.hasOwnProperty("calendarRangeId")) {
|
||||||
|
if (payload.extendedProps.toDelete) {
|
||||||
|
payload.setExtendedProp('toDelete', false)
|
||||||
|
payload.setProp('borderColor', '#79bafc');
|
||||||
|
this.$store.dispatch('removeFromDeleteRange', payload);
|
||||||
|
} else {
|
||||||
|
payload.setExtendedProp('toDelete', true)
|
||||||
|
payload.setProp('borderColor', '#dddddd');
|
||||||
|
this.$store.dispatch('deleteRange', payload);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let newEvents = this.calendarEvents.new.events;
|
||||||
|
let filterEvents = newEvents.filter((e) =>
|
||||||
|
e.start !== payload.startStr && e.end !== payload.endStr
|
||||||
|
);
|
||||||
|
this.calendarEvents.new = {
|
||||||
|
events: filterEvents,
|
||||||
|
color: "#3788d8"
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$store.dispatch('removeNewCalendarRanges', payload);
|
||||||
|
|
||||||
|
this.updateEventsSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
isSameDay(date1, date2) {
|
||||||
|
return date1.getFullYear() === date2.getFullYear() &&
|
||||||
|
date1.getMonth() === date2.getMonth() &&
|
||||||
|
date1.getDate() === date2.getDate();
|
||||||
|
},
|
||||||
|
isFriday(date) {
|
||||||
|
return date.getDay() === 5
|
||||||
|
},
|
||||||
|
copyDay(_payload) {
|
||||||
|
console.log(this.calendarEvents.new);
|
||||||
|
if (this.calendarEvents.new.events.length > 0) {
|
||||||
|
// Create the copied events
|
||||||
|
let increment = !this.calendarOptions.weekends && this.isFriday(this.lastNewDate) ? 24*60*60*1000*3 : 24*60*60*1000;
|
||||||
|
let events = this.calendarEvents.new.events.filter(
|
||||||
|
i => this.isSameDay(new Date(i.start), this.lastNewDate)).map(
|
||||||
|
i => {
|
||||||
|
let startDate = new Date(new Date(i.start).getTime() + increment);
|
||||||
|
let endDate = new Date(new Date(i.end).getTime() + increment);
|
||||||
|
return ({
|
||||||
|
start: startDate.toISOString(),
|
||||||
|
end: endDate.toISOString()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
let copiedEvents = {
|
||||||
|
events: events,
|
||||||
|
color: "#3788d8"
|
||||||
|
};
|
||||||
|
console.log(copiedEvents);
|
||||||
|
|
||||||
|
// Add to the calendar
|
||||||
|
let newEvents = this.calendarEvents.new.events;
|
||||||
|
newEvents.push(...copiedEvents.events);
|
||||||
|
this.calendarEvents.new = {
|
||||||
|
events: newEvents,
|
||||||
|
color: "#3788d8"
|
||||||
|
};
|
||||||
|
this.updateEventsSource();
|
||||||
|
|
||||||
|
// Set the last new date
|
||||||
|
this.lastNewDate = new Date(copiedEvents.events[copiedEvents.events.length - 1].start);
|
||||||
|
|
||||||
|
// Dispatch in store for saving
|
||||||
|
for (let i = 0; i < copiedEvents.events.length; i++) {
|
||||||
|
let eventObj = {
|
||||||
|
start: new Date(copiedEvents.events[i].start),
|
||||||
|
end: new Date(copiedEvents.events[i].end)
|
||||||
|
}
|
||||||
|
this.$store.dispatch('createRange', eventObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log('no new events to copy-paste!')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
renderEventDate() {
|
||||||
|
let start = this.myCalendarClickedEvent.start;
|
||||||
|
let end = this.myCalendarClickedEvent.end;
|
||||||
|
return start.getDate() === end.getDate() ?
|
||||||
|
`${start.toLocaleDateString()}, ${start.toLocaleTimeString()} - ${end.toLocaleTimeString()}` :
|
||||||
|
`${start.toLocaleString()} - ${end.toLocaleString()}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@@ -0,0 +1,21 @@
|
|||||||
|
const appMessages = {
|
||||||
|
fr: {
|
||||||
|
edit_your_calendar_range: "Planifiez vos plages de disponibilités",
|
||||||
|
show_my_calendar: "Afficher mon calendrier",
|
||||||
|
show_weekends: "Afficher les week-ends",
|
||||||
|
copy_range_to_next_day: "Copier les plages du jour au jour suivant",
|
||||||
|
copy_range_from_day: "Copier les plages du ",
|
||||||
|
to_the_next_day: " au jour suivant",
|
||||||
|
copy_range_to_next_week: "Copier les plages de la semaine à la semaine suivante",
|
||||||
|
copy_range_how_to: "Créez les plages de disponibilités durant une journée et copiez-les facilement au jour suivant avec ce bouton. Si les week-ends sont cachés, le jour suivant un vendredi sera le lundi.",
|
||||||
|
new_range_to_save: "Nouvelles plages à enregistrer",
|
||||||
|
update_range_to_save: "Plages à modifier",
|
||||||
|
delete_range_to_save: "Plages à supprimer",
|
||||||
|
by: "Par",
|
||||||
|
main_user_concerned: "Utilisateur concerné"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
appMessages
|
||||||
|
};
|
@@ -0,0 +1,16 @@
|
|||||||
|
import { createApp } from 'vue';
|
||||||
|
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
|
||||||
|
import { appMessages } from './i18n'
|
||||||
|
import store from './store'
|
||||||
|
|
||||||
|
import App from './App.vue';
|
||||||
|
|
||||||
|
const i18n = _createI18n(appMessages);
|
||||||
|
|
||||||
|
const app = createApp({
|
||||||
|
template: `<app></app>`,
|
||||||
|
})
|
||||||
|
.use(store)
|
||||||
|
.use(i18n)
|
||||||
|
.component('app', App)
|
||||||
|
.mount('#myCalendar');
|
@@ -0,0 +1,89 @@
|
|||||||
|
import 'es6-promise/auto';
|
||||||
|
import { createStore } from 'vuex';
|
||||||
|
import { postCalendarRange, patchCalendarRange, deleteCalendarRange } from '../_api/api';
|
||||||
|
|
||||||
|
const debug = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
const store = createStore({
|
||||||
|
strict: debug,
|
||||||
|
state: {
|
||||||
|
newCalendarRanges: [],
|
||||||
|
updateCalendarRanges: [],
|
||||||
|
deleteCalendarRanges: []
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
updateRange(state, payload) {
|
||||||
|
state.updateCalendarRanges.push({
|
||||||
|
id: payload.event.extendedProps.calendarRangeId,
|
||||||
|
start: payload.event.start,
|
||||||
|
end: payload.event.end
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addRange(state, payload) {
|
||||||
|
state.newCalendarRanges.push({
|
||||||
|
start: payload.start,
|
||||||
|
end: payload.end
|
||||||
|
});
|
||||||
|
},
|
||||||
|
deleteRange(state, payload) {
|
||||||
|
state.deleteCalendarRanges.push({
|
||||||
|
id: payload.extendedProps.calendarRangeId,
|
||||||
|
start: payload.start,
|
||||||
|
end: payload.end
|
||||||
|
});
|
||||||
|
},
|
||||||
|
clearNewCalendarRanges(state) {
|
||||||
|
state.newCalendarRanges = [];
|
||||||
|
},
|
||||||
|
clearUpdateCalendarRanges(state) {
|
||||||
|
state.updateCalendarRanges = [];
|
||||||
|
},
|
||||||
|
clearDeleteCalendarRanges(state) {
|
||||||
|
state.deleteCalendarRanges = [];
|
||||||
|
},
|
||||||
|
removeNewCalendarRanges(state, payload) {
|
||||||
|
let filteredCollection = state.newCalendarRanges.filter(
|
||||||
|
(e) => e.start.toString() !== payload.start.toString() && e.end.toString() !== payload.end.toString()
|
||||||
|
)
|
||||||
|
state.newCalendarRanges = filteredCollection;
|
||||||
|
},
|
||||||
|
removeFromDeleteRange(state, payload) {
|
||||||
|
let filteredCollection = state.deleteCalendarRanges.filter(
|
||||||
|
(e) => e.start.toString() !== payload.start.toString() && e.end.toString() !== payload.end.toString()
|
||||||
|
)
|
||||||
|
state.deleteCalendarRanges = filteredCollection;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
createRange({ commit }, payload) {
|
||||||
|
console.log('### action createRange', payload);
|
||||||
|
commit('addRange', payload);
|
||||||
|
},
|
||||||
|
updateRange({ commit }, payload) {
|
||||||
|
console.log('### action updateRange', payload);
|
||||||
|
commit('updateRange', payload);
|
||||||
|
},
|
||||||
|
deleteRange({ commit }, payload) {
|
||||||
|
console.log('### action deleteRange', payload);
|
||||||
|
commit('deleteRange', payload);
|
||||||
|
},
|
||||||
|
clearNewCalendarRanges({ commit }, payload) {
|
||||||
|
commit('clearNewCalendarRanges', payload);
|
||||||
|
},
|
||||||
|
clearUpdateCalendarRanges({ commit }, payload) {
|
||||||
|
commit('clearUpdateCalendarRanges', payload);
|
||||||
|
},
|
||||||
|
clearDeleteCalendarRanges({ commit }, payload) {
|
||||||
|
commit('clearDeleteCalendarRanges', payload);
|
||||||
|
},
|
||||||
|
removeNewCalendarRanges({ commit }, payload) {
|
||||||
|
commit('removeNewCalendarRanges', payload);
|
||||||
|
},
|
||||||
|
removeFromDeleteRange({ commit }, payload) {
|
||||||
|
commit('removeFromDeleteRange', payload);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
export default store;
|
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Endpoint chill_api_single_calendar_range
|
||||||
|
* method GET, get Calendar ranges
|
||||||
|
* @returns {Promise} a promise containing all Calendar ranges objects
|
||||||
|
*/
|
||||||
|
const fetchCalendarRanges = () => {
|
||||||
|
const url = `/api/1.0/calendar/calendar-range-available.json`;
|
||||||
|
return fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchCalendarRangesByUser = (userId) => {
|
||||||
|
const url = `/api/1.0/calendar/calendar-range-available.json?user=${userId}`;
|
||||||
|
return fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Endpoint chill_api_single_calendar
|
||||||
|
* method GET, get Calendar events, can be filtered by mainUser
|
||||||
|
* @returns {Promise} a promise containing all Calendar objects
|
||||||
|
*/
|
||||||
|
const fetchCalendar = (mainUserId) => {
|
||||||
|
const url = `/api/1.0/calendar/calendar.json?main_user=${mainUserId}&item_per_page=1000`;
|
||||||
|
return fetch(url)
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Endpoint chill_api_single_calendar_range__entity_create
|
||||||
|
* method POST, post CalendarRange entity
|
||||||
|
*/
|
||||||
|
const postCalendarRange = (body) => {
|
||||||
|
const url = `/api/1.0/calendar/calendar-range.json?`;
|
||||||
|
return fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json;charset=utf-8'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(body)
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Endpoint chill_api_single_calendar_range__entity
|
||||||
|
* method PATCH, patch CalendarRange entity
|
||||||
|
*/
|
||||||
|
const patchCalendarRange = (id, body) => {
|
||||||
|
console.log(body)
|
||||||
|
const url = `/api/1.0/calendar/calendar-range/${id}.json`;
|
||||||
|
return fetch(url, {
|
||||||
|
method: 'PATCH',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json;charset=utf-8'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(body)
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Endpoint chill_api_single_calendar_range__entity
|
||||||
|
* method DELETE, delete CalendarRange entity
|
||||||
|
*/
|
||||||
|
const deleteCalendarRange = (id) => {
|
||||||
|
const url = `/api/1.0/calendar/calendar-range/${id}.json`;
|
||||||
|
return fetch(url, {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json;charset=utf-8'
|
||||||
|
},
|
||||||
|
}).then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
fetchCalendarRanges,
|
||||||
|
fetchCalendar,
|
||||||
|
fetchCalendarRangesByUser,
|
||||||
|
postCalendarRange,
|
||||||
|
patchCalendarRange,
|
||||||
|
deleteCalendarRange
|
||||||
|
};
|
@@ -0,0 +1,203 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h2 class="chill-red">{{ $t('choose_your_calendar_user') }}</h2>
|
||||||
|
<VueMultiselect
|
||||||
|
name="field"
|
||||||
|
id="calendarUserSelector"
|
||||||
|
v-model="value"
|
||||||
|
track-by="id"
|
||||||
|
label="value"
|
||||||
|
:custom-label="transName"
|
||||||
|
:placeholder="$t('select_user')"
|
||||||
|
:multiple="true"
|
||||||
|
:close-on-select="false"
|
||||||
|
:allow-empty="true"
|
||||||
|
:model-value="value"
|
||||||
|
@select="selectUsers"
|
||||||
|
@remove="unSelectUsers"
|
||||||
|
@close="coloriseSelectedValues"
|
||||||
|
:options="options">
|
||||||
|
</VueMultiselect>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" id="myCalendar" class="form-check-input" v-model="showMyCalendarWidget" />
|
||||||
|
<label class="form-check-label" for="myCalendar">{{ $t('show_my_calendar') }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" id="weekends" class="form-check-input" @click="toggleWeekends" />
|
||||||
|
<label class="form-check-label" for="weekends">{{ $t('show_weekends') }}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import { fetchCalendarRanges, fetchCalendar } from '../../_api/api'
|
||||||
|
import VueMultiselect from 'vue-multiselect';
|
||||||
|
import { whoami } from 'ChillPersonAssets/vuejs/AccompanyingCourse/api';
|
||||||
|
|
||||||
|
const COLORS = [ /* from https://colorbrewer2.org/#type=qualitative&scheme=Set3&n=12 */
|
||||||
|
'#8dd3c7',
|
||||||
|
'#ffffb3',
|
||||||
|
'#bebada',
|
||||||
|
'#fb8072',
|
||||||
|
'#80b1d3',
|
||||||
|
'#fdb462',
|
||||||
|
'#b3de69',
|
||||||
|
'#fccde5',
|
||||||
|
'#d9d9d9',
|
||||||
|
'#bc80bd',
|
||||||
|
'#ccebc5',
|
||||||
|
'#ffed6f'
|
||||||
|
];
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'CalendarUserSelector',
|
||||||
|
components: { VueMultiselect },
|
||||||
|
props: ['users', 'updateEventsSource', 'calendarEvents', 'showMyCalendar', 'toggleMyCalendar', 'toggleWeekends'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
errorMsg: [],
|
||||||
|
value: [],
|
||||||
|
options: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
showMyCalendarWidget: {
|
||||||
|
set(value) {
|
||||||
|
this.toggleMyCalendar(value);
|
||||||
|
this.updateEventsSource();
|
||||||
|
},
|
||||||
|
get() {
|
||||||
|
return this.showMyCalendar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
fetchData() {
|
||||||
|
fetchCalendarRanges().then(calendarRanges => new Promise((resolve, reject) => {
|
||||||
|
let results = calendarRanges.results;
|
||||||
|
|
||||||
|
let users = [];
|
||||||
|
|
||||||
|
results.forEach(i => {
|
||||||
|
if (!(users.some(j => i.user.id === j.id))){
|
||||||
|
let ratio = Math.floor(users.length / COLORS.length);
|
||||||
|
let colorIndex = users.length - ratio * COLORS.length;
|
||||||
|
users.push({
|
||||||
|
id: i.user.id,
|
||||||
|
username: i.user.username,
|
||||||
|
color: COLORS[colorIndex]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let calendarEvents = [];
|
||||||
|
users.forEach(u => {
|
||||||
|
let arr = results.filter(i => i.user.id === u.id).map(i =>
|
||||||
|
({
|
||||||
|
start: i.startDate.datetime,
|
||||||
|
end: i.endDate.datetime,
|
||||||
|
calendarRangeId: i.id,
|
||||||
|
sourceColor: u.color
|
||||||
|
//display: 'background' // can be an option for the disponibility
|
||||||
|
})
|
||||||
|
);
|
||||||
|
calendarEvents.push({
|
||||||
|
events: arr,
|
||||||
|
color: u.color,
|
||||||
|
textColor: '#444444',
|
||||||
|
editable: false,
|
||||||
|
id: u.id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
this.users.loaded = users;
|
||||||
|
this.options = users;
|
||||||
|
|
||||||
|
this.calendarEvents.loaded = calendarEvents;
|
||||||
|
whoami().then(me => new Promise((resolve, reject) => {
|
||||||
|
this.users.logged = me;
|
||||||
|
let currentUser = users.find(u => u.id === me.id);
|
||||||
|
this.value = currentUser;
|
||||||
|
|
||||||
|
fetchCalendar(currentUser.id).then(calendar => new Promise((resolve, reject) => {
|
||||||
|
let results = calendar.results;
|
||||||
|
let events = results.map(i =>
|
||||||
|
({
|
||||||
|
start: i.startDate.datetime,
|
||||||
|
end: i.endDate.datetime,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
let calendarEventsCurrentUser = {
|
||||||
|
events: events,
|
||||||
|
color: 'darkblue',
|
||||||
|
id: 1000,
|
||||||
|
editable: false
|
||||||
|
};
|
||||||
|
this.calendarEvents.user = calendarEventsCurrentUser;
|
||||||
|
|
||||||
|
this.selectUsers(currentUser);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
}));
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
}));
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
}))
|
||||||
|
.catch((error) => {
|
||||||
|
this.errorMsg.push(error.message);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
transName(value) {
|
||||||
|
return `${value.username}`;
|
||||||
|
},
|
||||||
|
coloriseSelectedValues() {
|
||||||
|
let tags = document.querySelectorAll('div.multiselect__tags-wrap')[0];
|
||||||
|
|
||||||
|
if (tags.hasChildNodes()) {
|
||||||
|
let children = tags.childNodes;
|
||||||
|
for (let i = 0; i < children.length; i++) {
|
||||||
|
let child = children[i];
|
||||||
|
if (child.nodeType === Node.ELEMENT_NODE) {
|
||||||
|
this.users.selected.forEach(u => {
|
||||||
|
if (child.hasChildNodes()) {
|
||||||
|
if (child.firstChild.innerText == u.username) {
|
||||||
|
child.style.background = u.color;
|
||||||
|
child.firstChild.style.color = '#444444';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectEvents() {
|
||||||
|
let selectedUsersId = this.users.selected.map(a => a.id);
|
||||||
|
this.calendarEvents.selected = this.calendarEvents.loaded.filter(a => selectedUsersId.includes(a.id));
|
||||||
|
},
|
||||||
|
selectUsers(value) {
|
||||||
|
this.users.selected.push(value);
|
||||||
|
this.coloriseSelectedValues();
|
||||||
|
this.selectEvents();
|
||||||
|
this.updateEventsSource();
|
||||||
|
},
|
||||||
|
unSelectUsers(value) {
|
||||||
|
this.users.selected = this.users.selected.filter(a => a.id != value.id);
|
||||||
|
this.selectEvents();
|
||||||
|
this.updateEventsSource();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style src="vue-multiselect/dist/vue-multiselect.css"></style>
|
||||||
|
|
@@ -0,0 +1,13 @@
|
|||||||
|
const calendarUserSelectorMessages = {
|
||||||
|
fr: {
|
||||||
|
choose_your_calendar_user: "Afficher les plages de disponibilités",
|
||||||
|
select_user: "Sélectionnez des calendriers",
|
||||||
|
show_my_calendar: "Afficher mon calendrier",
|
||||||
|
show_weekends: "Afficher les week-ends"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
calendarUserSelectorMessages
|
||||||
|
};
|
||||||
|
|
@@ -0,0 +1,16 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
|
||||||
|
|
||||||
|
{% block title 'Remove calendar item'|trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{{ include('@ChillMain/Util/confirmation_template.html.twig',
|
||||||
|
{
|
||||||
|
'title' : 'Remove calendar item'|trans,
|
||||||
|
'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans,
|
||||||
|
'cancel_route' : 'chill_calendar_calendar_list',
|
||||||
|
'cancel_parameters' : { 'accompanying_period_id' : accompanyingCourse.id, 'id' : calendar.id },
|
||||||
|
'form' : delete_form
|
||||||
|
} ) }}
|
||||||
|
{% endblock %}
|
@@ -0,0 +1,18 @@
|
|||||||
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set user = calendar.user %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
|
||||||
|
|
||||||
|
{% block title 'Remove activity'|trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{{ include('@ChillMain/Util/confirmation_template.html.twig',
|
||||||
|
{
|
||||||
|
'title' : 'Remove calendar item'|trans,
|
||||||
|
'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans,
|
||||||
|
'cancel_route' : 'chill_calendar_calendar_list',
|
||||||
|
'cancel_parameters' : { 'user_id' : calendar.user.id, 'id' : calendar.id },
|
||||||
|
'form' : delete_form
|
||||||
|
} ) }}
|
||||||
|
{% endblock %}
|
@@ -0,0 +1,77 @@
|
|||||||
|
<h1>{{ "Update calendar"|trans }}</h1>
|
||||||
|
|
||||||
|
{{ form_start(form) }}
|
||||||
|
{{ form_errors(form) }}
|
||||||
|
|
||||||
|
{%- if form.mainUser is defined -%}
|
||||||
|
{{ form_row(form.mainUser) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||||
|
|
||||||
|
{%- if form.persons is defined -%}
|
||||||
|
{{ form_widget(form.persons) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.professionals is defined -%}
|
||||||
|
{{ form_widget(form.professionals) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.nonProfessionals is defined -%}
|
||||||
|
{{ form_widget(form.nonProfessionals) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.users is defined -%}
|
||||||
|
{{ form_widget(form.users) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div id="add-persons"></div>
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Calendar data'|trans }}</h2>
|
||||||
|
|
||||||
|
{%- if form.startDate is defined -%}
|
||||||
|
{{ form_row(form.startDate) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if form.endDate is defined -%}
|
||||||
|
{{ form_row(form.endDate) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if form.calendarRange is defined -%}
|
||||||
|
{{ form_row(form.calendarRange) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
.. location
|
||||||
|
|
||||||
|
{%- if form.comment is defined -%}
|
||||||
|
{{ form_row(form.comment) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if form.sendSMS is defined -%}
|
||||||
|
{{ form_row(form.sendSMS) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if context == 'user' %}
|
||||||
|
<div id="calendarControls"></div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div id="fullCalendar"></div>
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li class="cancel">
|
||||||
|
<a
|
||||||
|
class="btn btn-cancel"
|
||||||
|
{%- if context == 'user' -%}
|
||||||
|
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'user_id': user.id } )}}"
|
||||||
|
{%- elseif context == 'accompanyingCourse' -%}
|
||||||
|
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'accompanying_period_id': accompanyingCourse.id } )}}"
|
||||||
|
{%- endif -%}
|
||||||
|
>
|
||||||
|
{{ 'Cancel'|trans|chill_return_path_label }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button class="btn btn-create" type="submit">
|
||||||
|
{{ 'Update'|trans }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{{ form_end(form) }}
|
||||||
|
|
@@ -0,0 +1,43 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
|
||||||
|
|
||||||
|
{% block title 'Update calendar'|trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="calendar-edit">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-10 col-xxl">
|
||||||
|
|
||||||
|
<div id="calendar"></div> {# <=== vue component #}
|
||||||
|
{% include 'ChillCalendarBundle:Calendar:edit.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ parent() }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.addEventListener('DOMContentLoaded', function (e) {
|
||||||
|
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||||
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
|
});
|
||||||
|
window.entity = {{ entity_json|json_encode|raw }};
|
||||||
|
window.startDate = {{ entity.startDate|date('Y-m-d H:i:s')|json_encode|raw }};
|
||||||
|
window.endDate = {{ entity.endDate|date('Y-m-d H:i:s')|json_encode|raw }};
|
||||||
|
window.mainUser = {{ entity.mainUser.id }};
|
||||||
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_calendar') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ parent() }}
|
||||||
|
{{ encore_entry_link_tags('vue_calendar') }}
|
||||||
|
{{ encore_entry_link_tags('page_calendar') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block block_post_menu %}
|
||||||
|
<div id="calendarControls"></div>
|
||||||
|
{% endblock %}
|
@@ -0,0 +1,36 @@
|
|||||||
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% block title 'Update calendar'|trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="calendar-edit">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-10 col-xxl">
|
||||||
|
|
||||||
|
<div id="calendar"></div> {# <=== vue component #}
|
||||||
|
{% include 'ChillCalendarBundle:Calendar:edit.html.twig' with {'context': 'user'} %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ parent() }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.addEventListener('DOMContentLoaded', function (e) {
|
||||||
|
chill.displayAlertWhenLeavingModifiedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||||
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
|
});
|
||||||
|
window.entity = {{ entity_json|json_encode|raw }};
|
||||||
|
window.startDate = {{ entity.startDate|date('Y-m-d H:i:s')|json_encode|raw }};
|
||||||
|
window.endDate = {{ entity.endDate|date('Y-m-d H:i:s')|json_encode|raw }};
|
||||||
|
window.mainUser = {{ entity.mainUser.id }};
|
||||||
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_calendar') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ parent() }}
|
||||||
|
{{ encore_entry_link_tags('vue_calendar') }}
|
||||||
|
{% endblock %}
|
@@ -0,0 +1,126 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
|
||||||
|
|
||||||
|
{% block title %}{{ 'Calendar list' |trans }}{% endblock title %}
|
||||||
|
|
||||||
|
{% set user_id = null %}
|
||||||
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1>{{ 'Calendar list' |trans }}</h1>
|
||||||
|
|
||||||
|
{% if calendarItems|length == 0 %}
|
||||||
|
<p class="chill-no-data-statement">
|
||||||
|
{{ "There is no calendar items."|trans }}
|
||||||
|
<a href="{{ path('chill_calendar_calendar_new', {'user_id': user_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create button-small"></a>
|
||||||
|
</p>
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
<div class="flex-table list-records context-accompanyingCourse">
|
||||||
|
|
||||||
|
{% for calendar in calendarItems %}
|
||||||
|
|
||||||
|
<div class="item-bloc">
|
||||||
|
<div class="item-row main">
|
||||||
|
<div class="item-col">
|
||||||
|
|
||||||
|
{% if calendar.startDate and calendar.endDate %}
|
||||||
|
{% if calendar.endDate.diff(calendar.startDate).days >= 1 %}
|
||||||
|
<h3>{{ "From the day"|trans }} {{ calendar.startDate|format_datetime('medium', 'short') }} </h3>
|
||||||
|
<h3>{{ "to the day"|trans }} {{ calendar.endDate|format_datetime('medium', 'short') }}</h3>
|
||||||
|
{% else %}
|
||||||
|
<h3>{{ calendar.startDate|format_date('full') }} </h3>
|
||||||
|
<h3>{{ calendar.startDate|format_datetime('none', 'short', locale='fr') }} - {{ calendar.endDate|format_datetime('none', 'short', locale='fr') }}</h3>
|
||||||
|
|
||||||
|
<div class="duration">
|
||||||
|
<p>
|
||||||
|
<i class="fa fa-fw fa-hourglass-end"></i>
|
||||||
|
{{ calendar.endDate.diff(calendar.startDate)|date("%H:%M")}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="item-col">
|
||||||
|
<ul class="list-content">
|
||||||
|
{% if calendar.user %}
|
||||||
|
<li>
|
||||||
|
<b>{{ 'by'|trans }}{{ calendar.user.usernameCanonical }}</b>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if calendar.mainUser is not empty %}
|
||||||
|
<li>
|
||||||
|
<b>{{ 'main user concerned'|trans }}: {{ calendar.mainUser.usernameCanonical }}</b>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_calendar_calendar_show', { 'id': calendar.id, 'user_id': user_id, 'accompanying_period_id': accompanying_course_id }) }}" class="btn btn-show "></a>
|
||||||
|
</li>
|
||||||
|
{# TOOD
|
||||||
|
{% if is_granted('CHILL_ACTIVITY_UPDATE', calendar) %}
|
||||||
|
#}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_calendar_calendar_edit', { 'id': calendar.id, 'user_id': user_id, 'accompanying_period_id': accompanying_course_id }) }}" class="btn btn-update "></a>
|
||||||
|
</li>
|
||||||
|
{# TOOD
|
||||||
|
{% endif %}
|
||||||
|
{% if is_granted('CHILL_ACTIVITY_DELETE', calendar) %}
|
||||||
|
#}
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_calendar_calendar_delete', { 'id': calendar.id, 'user_id' : user_id, 'accompanying_period_id': accompanying_course_id } ) }}" class="btn btn-delete "></a>
|
||||||
|
</li>
|
||||||
|
{#
|
||||||
|
{% endif %}
|
||||||
|
#}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{%
|
||||||
|
if calendar.comment.comment is not empty
|
||||||
|
or calendar.users|length > 0
|
||||||
|
or calendar.thirdParties|length > 0
|
||||||
|
or calendar.users|length > 0
|
||||||
|
%}
|
||||||
|
<div class="item-row details">
|
||||||
|
<div class="item-col">
|
||||||
|
|
||||||
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': accompanyingCourse, 'with_display': 'row', 'entity': calendar } %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if calendar.comment.comment is not empty %}
|
||||||
|
<div class="item-col comment">
|
||||||
|
{{ calendar.comment|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if calendarItems|length < paginator.getTotalItems %}
|
||||||
|
{{ chill_pagination(paginator) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_calendar_calendar_new', {'user_id': user_id, 'accompanying_period_id': accompanying_course_id}) }}" class="btn btn-create">
|
||||||
|
{{ 'Add a new calendar' | trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% endblock %}
|
@@ -0,0 +1,26 @@
|
|||||||
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
|
||||||
|
|
||||||
|
{% block title %}{{ 'My calendar list' |trans }}{% endblock title %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1>{{ 'My calendar list' |trans }}</h1>
|
||||||
|
<div id="myCalendar"></div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ parent() }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.userId = {{ user.id }};
|
||||||
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_mycalendarrange') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ parent() }}
|
||||||
|
{{ encore_entry_link_tags('vue_calendar') }}
|
||||||
|
{{ encore_entry_link_tags('page_calendar') }}
|
||||||
|
{% endblock %}
|
@@ -0,0 +1,68 @@
|
|||||||
|
<h1>{{ "Calendar item creation"|trans }}</h1>
|
||||||
|
|
||||||
|
{{ form_start(form) }}
|
||||||
|
{{ form_errors(form) }}
|
||||||
|
|
||||||
|
{%- if form.mainUser is defined -%}
|
||||||
|
{{ form_row(form.mainUser) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||||
|
|
||||||
|
{%- if form.persons is defined -%}
|
||||||
|
{{ form_widget(form.persons) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.professionals is defined -%}
|
||||||
|
{{ form_widget(form.professionals) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.nonProfessionals is defined -%}
|
||||||
|
{{ form_widget(form.nonProfessionals) }}
|
||||||
|
{% endif %}
|
||||||
|
{%- if form.users is defined -%}
|
||||||
|
{{ form_widget(form.users) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div id="add-persons"></div>
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Calendar data'|trans }}</h2>
|
||||||
|
|
||||||
|
{%- if form.startDate is defined -%}
|
||||||
|
{{ form_row(form.startDate) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if form.endDate is defined -%}
|
||||||
|
{{ form_row(form.endDate) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
.. location
|
||||||
|
|
||||||
|
{%- if form.comment is defined -%}
|
||||||
|
{{ form_row(form.comment) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{%- if form.sendSMS is defined -%}
|
||||||
|
{{ form_row(form.sendSMS) }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div id="fullCalendar"></div>
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li class="cancel">
|
||||||
|
<a
|
||||||
|
class="btn btn-cancel"
|
||||||
|
{%- if context == 'person' -%}
|
||||||
|
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'person_id': person.id } )}}"
|
||||||
|
{%- else -%}
|
||||||
|
href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'accompanying_period_id': accompanyingCourse.id } )}}"
|
||||||
|
{%- endif -%}
|
||||||
|
>
|
||||||
|
{{ 'Cancel'|trans|chill_return_path_label }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<button class="btn btn-create" type="submit">
|
||||||
|
{{ 'Create'|trans }}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{{ form_end(form) }}
|
@@ -0,0 +1,39 @@
|
|||||||
|
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
|
||||||
|
|
||||||
|
{% set activeRouteKey = 'chill_calendar_calendar_new' %}
|
||||||
|
|
||||||
|
{% block title 'Calendar item creation' |trans %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="calendar-new">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-10 col-xxl">
|
||||||
|
|
||||||
|
<div id="calendar"></div> {# <=== vue component #}
|
||||||
|
{% include 'ChillCalendarBundle:Calendar:new.html.twig' with {'context': 'accompanyingCourse'} %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ parent() }}
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.addEventListener('DOMContentLoaded', function (e) {
|
||||||
|
chill.displayAlertWhenLeavingUnsubmittedForm('form[name="{{ form.vars.form.vars.name }}"]',
|
||||||
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
|
});
|
||||||
|
window.entity = {{ entity_json|json_encode|raw }};
|
||||||
|
</script>
|
||||||
|
{{ encore_entry_script_tags('vue_calendar') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
{{ parent() }}
|
||||||
|
{{ encore_entry_link_tags('vue_calendar') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block block_post_menu %}
|
||||||
|
<div id="calendarControls"></div>
|
||||||
|
{% endblock %}
|
@@ -0,0 +1,107 @@
|
|||||||
|
<h1>{{ "Calendar"|trans }}</h1>
|
||||||
|
|
||||||
|
<dl class="chill_view_data">
|
||||||
|
<dt class="inline">{{ 'main user concerned'|trans }}</dt>
|
||||||
|
<dd>{{ entity.mainUser }}</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Concerned groups'|trans }}</h2>
|
||||||
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'bloc' } %}
|
||||||
|
|
||||||
|
|
||||||
|
<h2 class="chill-red">{{ 'Calendar data'|trans }}</h2>
|
||||||
|
|
||||||
|
{% if entity.endDate.diff(entity.startDate).days >= 1 %}
|
||||||
|
<dt>{{ "From the day"|trans }} {{ entity.startDate|format_datetime('medium', 'short') }}
|
||||||
|
{{ "to the day"|trans }} {{ entity.endDate|format_datetime('medium', 'short') }}
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
{% else %}
|
||||||
|
<dt>
|
||||||
|
{{ entity.startDate|format_date('full') }},
|
||||||
|
{{ entity.startDate|format_datetime('none', 'short', locale='fr') }} - {{ entity.endDate|format_datetime('none', 'short', locale='fr') }}
|
||||||
|
</dt>
|
||||||
|
<dd></dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<dt class="inline">{{ 'cancel reason'|trans }}</dt>
|
||||||
|
<dd>
|
||||||
|
{% if entity.cancelReason is not null %}
|
||||||
|
{{ entity.cancelReason.canceledBy|localize_translatable_string }}
|
||||||
|
{% else %}
|
||||||
|
<span class="chill-no-data-statement">{{ 'Unknown'|trans }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt class="inline">{{ 'status'|trans }}</dt>
|
||||||
|
<dd>{{ entity.status }}</dd>
|
||||||
|
|
||||||
|
{% if not entity.comment.isEmpty %}
|
||||||
|
<dt class="inline">{{ 'calendar comment'|trans }}</dt>
|
||||||
|
<dd>{{ entity.comment|chill_entity_render_box }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<dt class="inline">{{ 'sendSMS'|trans }}</dt>
|
||||||
|
<dd>
|
||||||
|
{% if entity.sendSMS is not null %}
|
||||||
|
{% if entity.sendSMS %}{{ 'Yes'|trans }}{% else %}{{ 'No'|trans }}{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<span class="chill-no-data-statement">{{ 'Unknown'|trans }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
{% set accompanying_course_id = null %}
|
||||||
|
{% if accompanyingCourse %}
|
||||||
|
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set user_id = null %}
|
||||||
|
{% if user %}
|
||||||
|
{% set user_id = user.id %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<ul class="record_actions sticky-form-buttons">
|
||||||
|
<li class="cancel">
|
||||||
|
<a class="btn btn-cancel" href="{{ path('chill_calendar_calendar_list',
|
||||||
|
{ 'accompanying_period_id': accompanying_course_id, 'user_id': user_id }) }}">
|
||||||
|
{{ 'Back to the list'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-create" href="{{ chill_path_add_return_path('chill_activity_activity_new',
|
||||||
|
{ 'accompanying_period_id': accompanying_course_id, 'activityData': activityData }) }}">
|
||||||
|
{{ 'Transform to activity'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% if accompanyingCourse %}
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-update" href="{{ path('chill_calendar_calendar_edit',
|
||||||
|
{ 'id': entity.id, 'accompanying_period_id': accompanying_course_id }) }}">
|
||||||
|
{{ 'Edit'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if user %}
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-update" href="{{ path('chill_calendar_calendar_edit', { 'id': entity.id, 'user_id': user_id }) }}">
|
||||||
|
{{ 'Edit'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{# TODO
|
||||||
|
{% if is_granted('CHILL_ACTIVITY_DELETE', entity) %}
|
||||||
|
#}
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_calendar_calendar_delete', { 'id': entity.id, 'accompanying_period_id': accompanying_course_id, 'user_id': user_id } ) }}" class="btn btn-delete">
|
||||||
|
{{ 'Delete'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{#
|
||||||
|
{% endif %}
|
||||||
|
#}
|
||||||
|
</ul>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user