mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 09:34:59 +00:00
Compare commits
216 Commits
v3.12.1
...
ticket/rea
Author | SHA1 | Date | |
---|---|---|---|
3aea3f502b
|
|||
def75cec6c
|
|||
41896b1dd4
|
|||
c5e6122d2c
|
|||
088b876e20 | |||
3400656d7c | |||
568c8be7fd
|
|||
538ecc42ea
|
|||
15d26d4b06
|
|||
d8bd9bd7cd
|
|||
dcdfba5ccd
|
|||
0204bdd38d
|
|||
392fd01b56
|
|||
a7e278204f
|
|||
4cfdcb2f02
|
|||
3b82ab0e7f
|
|||
ccfae1dc75 | |||
8bc16dadb0 | |||
35844f3b73 | |||
7506b918d7 | |||
c4cc0baa8e | |||
aed114c75c | |||
cfba291f2c | |||
|
04438c09d3 | ||
2a54d1b909 | |||
|
628eeac5e0 | ||
a2263b3fa1 | |||
74796d0fb0 | |||
c19481e40a
|
|||
|
6eeb717b1a | ||
beb7c462da
|
|||
|
dbf363a9e8 | ||
64a2f7c9ed
|
|||
e592b89c94 | |||
f26d9739c8 | |||
afa5edc1d8
|
|||
42d6c9e672
|
|||
2b22d4cb7c
|
|||
c8e5d0eb37
|
|||
2bf8ad5d6c | |||
11698a52e3 | |||
70955573e8 | |||
|
3df4043eb9 | ||
06e8264dde
|
|||
70e75adb7d | |||
6f7015b152 | |||
65dde1e6a0 | |||
d193c50922 | |||
840ef6eed8 | |||
b4bbb1a456 | |||
606435a6b3 | |||
b451d2c4a3 | |||
4f93150874 | |||
404143f8a6 | |||
ec957a2fe3 | |||
8ed5e35f1a | |||
0566ab0910 | |||
|
f4eeee1598 | ||
33cf16fc13 | |||
0a331aab37 | |||
d43b739654 | |||
c72432efae | |||
95975fae55
|
|||
95a7efa138
|
|||
45e193ff6d
|
|||
dfc146ff3f
|
|||
c2842148c6 | |||
10e4c7da23 | |||
b41fcf66a9 | |||
|
a8dd1b3548 | ||
f680a35f49 | |||
7d0fe06651 | |||
fca10ada71
|
|||
a35d456308
|
|||
2b99a480ac
|
|||
7633e587bb
|
|||
fc61dfdf3a
|
|||
f1a5b5c49e
|
|||
ec685dcd47
|
|||
631ae3eedd
|
|||
440a7837ac
|
|||
e0abf34784
|
|||
377ae9a9dc
|
|||
034dc30e30
|
|||
d615111a0f
|
|||
ffb756c712
|
|||
69daccb860
|
|||
16435423cf
|
|||
697b4ab436
|
|||
67d804e28e
|
|||
cf41fa9574
|
|||
b8b325f7d7
|
|||
e97bd8c4ef
|
|||
e28d7df533
|
|||
4b20b1bc01
|
|||
b15733076c
|
|||
25be5c9ea3
|
|||
b035020c6f
|
|||
128101dc46
|
|||
5f2711023e
|
|||
bdf2ed4bbd
|
|||
1df542603e
|
|||
80bcc68ce5
|
|||
154fc3e2f6
|
|||
e45af94c78
|
|||
166a6fde20
|
|||
631f047338
|
|||
a777588bb8
|
|||
ca78d112c2
|
|||
bcfd317d83
|
|||
348740f073
|
|||
0d74f0980f
|
|||
be19dc00db
|
|||
643028ffd6
|
|||
ac4e2e5bf2
|
|||
498572b96e
|
|||
d2a61ce69b
|
|||
a9c0567ee1
|
|||
76cec5b5a8
|
|||
efe8a67697
|
|||
26dfa9b028
|
|||
50025044d3
|
|||
e6202a2e34
|
|||
b863bd967d
|
|||
e65bcf7275
|
|||
e00ece4200
|
|||
640fd71402
|
|||
aae50ca290
|
|||
1fa483598b
|
|||
e4b6a468f8
|
|||
|
66c7758023 | ||
|
4750d2c24e | ||
|
ca05e3d979 | ||
|
a20f9b4f86 | ||
|
c73c1eb8d5 | ||
|
8778bb0731 | ||
|
c7d20eebc5 | ||
|
b9e130c159 | ||
|
3e8bc94af3 | ||
|
0c914c9f9f | ||
|
580a60c939 | ||
|
4996ac3b7c | ||
|
2a23bf19cb | ||
|
650d2596d9 | ||
|
2bdd5a329e | ||
78d1776733
|
|||
66dc603c85
|
|||
3a8154ecce
|
|||
c81828e04f
|
|||
|
ec17dd7de2 | ||
76c076a5f3 | |||
|
f0045edd6c | ||
|
d00b76ffcd | ||
|
8991f0ef3f | ||
|
d6f5eae0c9 | ||
|
821fce3dd8 | ||
|
1d33ae1e39 | ||
|
19af0feb57 | ||
|
1c09e9a692 | ||
|
d72e748388 | ||
|
ab850b7b70 | ||
|
3f9745d8cf | ||
|
473765366a | ||
|
6500c24a7f | ||
|
1d00457141 | ||
|
eb0bf56cff | ||
|
7b8cd90cf1 | ||
|
a27d92aba0 | ||
|
85bdfb9e21 | ||
|
4cffcf4de1 | ||
|
b2587a688f | ||
|
c9f0e9843b | ||
|
b40ad9e445 | ||
|
3e10e47e29 | ||
|
2a1963e993 | ||
34c171659b | |||
2d8b960d9e
|
|||
831ae03431 | |||
45828174d1
|
|||
ed45f14a45
|
|||
fa67835690
|
|||
b434d38091
|
|||
|
800a952532 | ||
9f355032a8
|
|||
0bc6e62d4d
|
|||
46fb1c04b5
|
|||
3b2c3d1464 | |||
|
0bd6038160 | ||
|
baab8e94ce | ||
e2deb55fdb
|
|||
|
2cdfb50058 | ||
39d701feb2
|
|||
613ee8b186
|
|||
56a1a488de
|
|||
3f789ad0f4 | |||
467bea7cde
|
|||
670b8eb82b
|
|||
a9760b323f
|
|||
71a3a1924a
|
|||
ecdc1e25bf
|
|||
dd37427be1
|
|||
c8467df1b1
|
|||
4c89a954fa
|
|||
7c1f3b114d
|
|||
36bc4dab24
|
|||
4b30d92282
|
|||
75fbec5489
|
|||
912fdd6349
|
|||
5832542978
|
|||
5c3585a1ed
|
|||
a2f1e20ddf
|
|||
4d67702a76
|
|||
18e442db29 | |||
|
deb3d92189 | ||
a59ea7db31
|
|||
a738b0cac9
|
6
.changes/unreleased/Feature-20240530-160003.yaml
Normal file
6
.changes/unreleased/Feature-20240530-160003.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
kind: Feature
|
||||||
|
body: |
|
||||||
|
Upgrade import of address list to the last version of compiled addresses of belgian-best-address
|
||||||
|
time: 2024-05-30T16:00:03.440767606+02:00
|
||||||
|
custom:
|
||||||
|
Issue: ""
|
6
.changes/unreleased/Feature-20240531-190242.yaml
Normal file
6
.changes/unreleased/Feature-20240531-190242.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
kind: Feature
|
||||||
|
body: |
|
||||||
|
Upgrade CKEditor and refactor configuration with use of typescript
|
||||||
|
time: 2024-05-31T19:02:42.776662753+02:00
|
||||||
|
custom:
|
||||||
|
Issue: ""
|
74
.changes/v4.0.0.md
Normal file
74
.changes/v4.0.0.md
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
## v4.0.0 - 2025-07-08
|
||||||
|
### Feature
|
||||||
|
* ([#359](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/359)) Allow the merge of two accompanying period works
|
||||||
|
### Fixed
|
||||||
|
* ([#390](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/390)) Display the list of participant in the results, even if there is only one participant and that the search result display the requestor
|
||||||
|
* Fix admin entity edit actions for event admin entities and activity reason (category) entities
|
||||||
|
* Fix translations for social action fields in admin form: results, goals, evaluations
|
||||||
|
### DX
|
||||||
|
* Rewrite exports to run them asynchronously
|
||||||
|
|
||||||
|
**Schema Change**: Add columns or tables
|
||||||
|
* Allow TranslatableMessage in flash messages
|
||||||
|
### UX
|
||||||
|
* Improve labeling of fields in person resource creation form
|
||||||
|
|
||||||
|
|
||||||
|
**Release notes**
|
||||||
|
|
||||||
|
- Add new methods to serialize data using the rector rule
|
||||||
|
- Remove all references to the Request in filters, aggregators, filters. Actually, the most frequent occurence is `$security->getUser()`.
|
||||||
|
- Refactor manually the initializeQuery method
|
||||||
|
- Remove the injection of ExportManager into the constructor of each export element:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
|
||||||
|
- class MyFormatter implements FormatterInterface
|
||||||
|
+ class MyFormatter implements FormatterInterface, \Chill\MainBundle\Export\ExportManagerAwareInterface
|
||||||
|
{
|
||||||
|
+ use \Chill\MainBundle\Export\Helper\ExportManagerAwareTrait;
|
||||||
|
|
||||||
|
- public function __construct(private ExportManager $exportmanager) {}
|
||||||
|
|
||||||
|
public function MyMethod(): void
|
||||||
|
{
|
||||||
|
- $this->exportManager->getFilter('alias');
|
||||||
|
+ $this->getExportManager()->getFilter('alias');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- configure messenger to handle export in a queue:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
# config/packages/messenger.yaml
|
||||||
|
framework:
|
||||||
|
messenger:
|
||||||
|
routing:
|
||||||
|
+ 'Chill\MainBundle\Export\Messenger\ExportRequestGenerationMessage': priority
|
||||||
|
```
|
||||||
|
|
||||||
|
- add missing methods to exports, aggregators, filters, formatter:
|
||||||
|
|
||||||
|
```php
|
||||||
|
public function normalizeFormData(array $formData): array;
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array;
|
||||||
|
```
|
||||||
|
|
||||||
|
There are rector rules to generate those methods:
|
||||||
|
|
||||||
|
- `Chill\Utils\Rector\Rector\ChillBundleAddNormalizationMethodsOnExportRector`
|
||||||
|
|
||||||
|
See:
|
||||||
|
|
||||||
|
```php
|
||||||
|
// upgrade chill exports
|
||||||
|
$rectorConfig->rules([\Chill\Utils\Rector\Rector\ChillBundleAddNormalizationMethodsOnExportRector::class]);
|
||||||
|
```
|
||||||
|
|
||||||
|
This rule will create most of the work necessary, but some manuals changes are still necessary:
|
||||||
|
|
||||||
|
- we must set manually the correct repository for method `denormalizeDoctrineEntity`;
|
||||||
|
- when the form data contains some entities, and the form type is not one of EntityType::class, PickUserDynamicType::class, PickUserLocationType::class, PickThirdpartyDynamicType::class, Select2CountryType::class, then we must handle the normalization manually (using the `\Chill\MainBundle\Export\ExportDataNormalizerTrait`)
|
||||||
|
|
||||||
|
|
4
.changes/v4.0.1.md
Normal file
4
.changes/v4.0.1.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
## v4.0.1 - 2025-07-08
|
||||||
|
### Fixed
|
||||||
|
* Fix package.json for compilation
|
||||||
|
|
@@ -19,11 +19,11 @@ max_line_length = 80
|
|||||||
[COMMIT_EDITMSG]
|
[COMMIT_EDITMSG]
|
||||||
max_line_length = 0
|
max_line_length = 0
|
||||||
|
|
||||||
[*.{js, vue, ts}]
|
[*.{js,vue,ts}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
indent_style = space
|
indent_style = space
|
||||||
|
|
||||||
[.rst]
|
[*.rst]
|
||||||
ident_size = 3
|
indent_size = 3
|
||||||
ident_style = space
|
indent_style = space
|
||||||
|
|
||||||
|
13
.env
13
.env
@@ -16,9 +16,6 @@ APP_ENV=prod
|
|||||||
APP_SECRET=!ChangeMeInAppEnv!
|
APP_SECRET=!ChangeMeInAppEnv!
|
||||||
###< symfony/framework-bundle ###
|
###< symfony/framework-bundle ###
|
||||||
|
|
||||||
## Wopi server for editing documents online
|
|
||||||
EDITOR_SERVER=http://collabora:9980
|
|
||||||
|
|
||||||
# must be manually set in .env.local
|
# must be manually set in .env.local
|
||||||
# ADMIN_PASSWORD=
|
# ADMIN_PASSWORD=
|
||||||
|
|
||||||
@@ -92,3 +89,13 @@ REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
|
|||||||
###> symfony/ovh-cloud-notifier ###
|
###> symfony/ovh-cloud-notifier ###
|
||||||
# OVHCLOUD_DSN=ovhcloud://APPLICATION_KEY:APPLICATION_SECRET@default?consumer_key=CONSUMER_KEY&service_name=SERVICE_NAME
|
# OVHCLOUD_DSN=ovhcloud://APPLICATION_KEY:APPLICATION_SECRET@default?consumer_key=CONSUMER_KEY&service_name=SERVICE_NAME
|
||||||
###< symfony/ovh-cloud-notifier ###
|
###< symfony/ovh-cloud-notifier ###
|
||||||
|
|
||||||
|
###> symfony/mercure-bundle ###
|
||||||
|
# See https://symfony.com/doc/current/mercure.html#configuration
|
||||||
|
# The URL of the Mercure hub, used by the app to publish updates (can be a local URL)
|
||||||
|
MERCURE_URL=https://example.com/.well-known/mercure
|
||||||
|
# The public URL of the Mercure hub, used by the browser to connect
|
||||||
|
MERCURE_PUBLIC_URL=https://example.com/.well-known/mercure
|
||||||
|
# The secret used to sign the JWTs
|
||||||
|
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
|
||||||
|
###< symfony/mercure-bundle ###
|
||||||
|
File diff suppressed because it is too large
Load Diff
4
.prettierrc
Normal file
4
.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false
|
||||||
|
}
|
30
.vscode/launch.json
vendored
Normal file
30
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Chill Debug",
|
||||||
|
"type": "php",
|
||||||
|
"request": "launch",
|
||||||
|
"port": 9000,
|
||||||
|
"pathMappings": {
|
||||||
|
"/var/www/html": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"preLaunchTask": "symfony"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Yarn Encore Dev (Watch)",
|
||||||
|
"type": "node-terminal",
|
||||||
|
"request": "launch",
|
||||||
|
"command": "yarn encore dev --watch",
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"compounds": [
|
||||||
|
{
|
||||||
|
"name": "Chill Debug + Yarn Encore Dev (Watch)",
|
||||||
|
"configurations": ["Chill Debug", "Yarn Encore Dev (Watch)"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
23
.vscode/tasks.json
vendored
Normal file
23
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"command": "symfony",
|
||||||
|
"args": [
|
||||||
|
"server:start",
|
||||||
|
"--allow-http",
|
||||||
|
"--no-tls",
|
||||||
|
"--port=8000",
|
||||||
|
"--allow-all-ip",
|
||||||
|
"-d"
|
||||||
|
],
|
||||||
|
"label": "symfony"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"command": "yarn",
|
||||||
|
"args": ["encore", "dev", "--watch"],
|
||||||
|
"label": "webpack"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
80
CHANGELOG.md
80
CHANGELOG.md
@@ -6,6 +6,86 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
|
|||||||
and is generated by [Changie](https://github.com/miniscruff/changie).
|
and is generated by [Changie](https://github.com/miniscruff/changie).
|
||||||
|
|
||||||
|
|
||||||
|
## v4.0.1 - 2025-07-08
|
||||||
|
### Fixed
|
||||||
|
* Fix package.json for compilation
|
||||||
|
|
||||||
|
|
||||||
|
## v4.0.0 - 2025-07-08
|
||||||
|
### Feature
|
||||||
|
* ([#359](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/359)) Allow the merge of two accompanying period works
|
||||||
|
### Fixed
|
||||||
|
* ([#390](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/390)) Display the list of participant in the results, even if there is only one participant and that the search result display the requestor
|
||||||
|
* Fix admin entity edit actions for event admin entities and activity reason (category) entities
|
||||||
|
* Fix translations for social action fields in admin form: results, goals, evaluations
|
||||||
|
### DX
|
||||||
|
* Rewrite exports to run them asynchronously
|
||||||
|
|
||||||
|
**Schema Change**: Add columns or tables
|
||||||
|
* Allow TranslatableMessage in flash messages
|
||||||
|
### UX
|
||||||
|
* Improve labeling of fields in person resource creation form
|
||||||
|
|
||||||
|
|
||||||
|
**Release notes**
|
||||||
|
|
||||||
|
- Add new methods to serialize data using the rector rule
|
||||||
|
- Remove all references to the Request in filters, aggregators, filters. Actually, the most frequent occurence is `$security->getUser()`.
|
||||||
|
- Refactor manually the initializeQuery method
|
||||||
|
- Remove the injection of ExportManager into the constructor of each export element:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
|
||||||
|
- class MyFormatter implements FormatterInterface
|
||||||
|
+ class MyFormatter implements FormatterInterface, \Chill\MainBundle\Export\ExportManagerAwareInterface
|
||||||
|
{
|
||||||
|
+ use \Chill\MainBundle\Export\Helper\ExportManagerAwareTrait;
|
||||||
|
|
||||||
|
- public function __construct(private ExportManager $exportmanager) {}
|
||||||
|
|
||||||
|
public function MyMethod(): void
|
||||||
|
{
|
||||||
|
- $this->exportManager->getFilter('alias');
|
||||||
|
+ $this->getExportManager()->getFilter('alias');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- configure messenger to handle export in a queue:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
# config/packages/messenger.yaml
|
||||||
|
framework:
|
||||||
|
messenger:
|
||||||
|
routing:
|
||||||
|
+ 'Chill\MainBundle\Export\Messenger\ExportRequestGenerationMessage': priority
|
||||||
|
```
|
||||||
|
|
||||||
|
- add missing methods to exports, aggregators, filters, formatter:
|
||||||
|
|
||||||
|
```php
|
||||||
|
public function normalizeFormData(array $formData): array;
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array;
|
||||||
|
```
|
||||||
|
|
||||||
|
There are rector rules to generate those methods:
|
||||||
|
|
||||||
|
- `Chill\Utils\Rector\Rector\ChillBundleAddNormalizationMethodsOnExportRector`
|
||||||
|
|
||||||
|
See:
|
||||||
|
|
||||||
|
```php
|
||||||
|
// upgrade chill exports
|
||||||
|
$rectorConfig->rules([\Chill\Utils\Rector\Rector\ChillBundleAddNormalizationMethodsOnExportRector::class]);
|
||||||
|
```
|
||||||
|
|
||||||
|
This rule will create most of the work necessary, but some manuals changes are still necessary:
|
||||||
|
|
||||||
|
- we must set manually the correct repository for method `denormalizeDoctrineEntity`;
|
||||||
|
- when the form data contains some entities, and the form type is not one of EntityType::class, PickUserDynamicType::class, PickUserLocationType::class, PickThirdpartyDynamicType::class, Select2CountryType::class, then we must handle the normalization manually (using the `\Chill\MainBundle\Export\ExportDataNormalizerTrait`)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## v3.12.1 - 2025-06-30
|
## v3.12.1 - 2025-06-30
|
||||||
### Fixed
|
### Fixed
|
||||||
* Fix loading of the list of documents
|
* Fix loading of the list of documents
|
||||||
|
@@ -54,7 +54,7 @@ Arborescence:
|
|||||||
- person
|
- person
|
||||||
- personvendee
|
- personvendee
|
||||||
- household_edit_metadata
|
- household_edit_metadata
|
||||||
- index.js
|
- index.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
## Organisation des feuilles de styles
|
## Organisation des feuilles de styles
|
||||||
|
@@ -32,3 +32,9 @@ services:
|
|||||||
hostname: my-rabbit
|
hostname: my-rabbit
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/rabbitmq/data:/var/lib/rabbitmq
|
- ./docker/rabbitmq/data:/var/lib/rabbitmq
|
||||||
|
|
||||||
|
###> symfony/mercure-bundle ###
|
||||||
|
mercure:
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:8043:443"
|
||||||
|
###< symfony/mercure-bundle ###
|
||||||
|
31
compose.yaml
31
compose.yaml
@@ -50,7 +50,36 @@ services:
|
|||||||
timeout: 30s
|
timeout: 30s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|
||||||
|
###> symfony/mercure-bundle ###
|
||||||
|
mercure:
|
||||||
|
image: dunglas/mercure
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
# Uncomment the following line to disable HTTPS,
|
||||||
|
#SERVER_NAME: ':80'
|
||||||
|
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
|
||||||
|
# Set the URL of your Symfony project (without trailing slash!) as value of the cors_origins directive
|
||||||
|
MERCURE_EXTRA_DIRECTIVES: |
|
||||||
|
cors_origins http://chill-bundles.wip https://chill-bundles.wip
|
||||||
|
# Comment the following line to disable the development mode
|
||||||
|
command: /usr/bin/caddy run --config /etc/caddy/dev.Caddyfile
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "curl", "-f", "https://localhost/healthz" ]
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 60s
|
||||||
|
volumes:
|
||||||
|
- mercure_data:/data
|
||||||
|
- mercure_config:/config
|
||||||
|
###< symfony/mercure-bundle ###
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
###> doctrine/doctrine-bundle ###
|
###> doctrine/doctrine-bundle ###
|
||||||
database_data:
|
database_data:
|
||||||
###< doctrine/doctrine-bundle ###
|
###< doctrine/doctrine-bundle ###
|
||||||
|
|
||||||
|
###> symfony/mercure-bundle ###
|
||||||
|
mercure_data:
|
||||||
|
mercure_config:
|
||||||
|
###< symfony/mercure-bundle ###
|
||||||
|
@@ -55,6 +55,7 @@
|
|||||||
"symfony/http-foundation": "^5.4",
|
"symfony/http-foundation": "^5.4",
|
||||||
"symfony/intl": "^5.4",
|
"symfony/intl": "^5.4",
|
||||||
"symfony/mailer": "^5.4",
|
"symfony/mailer": "^5.4",
|
||||||
|
"symfony/mercure-bundle": "^0.3.9",
|
||||||
"symfony/messenger": "^5.4",
|
"symfony/messenger": "^5.4",
|
||||||
"symfony/mime": "^5.4",
|
"symfony/mime": "^5.4",
|
||||||
"symfony/monolog-bundle": "^3.5",
|
"symfony/monolog-bundle": "^3.5",
|
||||||
@@ -133,6 +134,7 @@
|
|||||||
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
"Chill\\TaskBundle\\": "src/Bundle/ChillTaskBundle",
|
||||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle",
|
||||||
"Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src",
|
"Chill\\WopiBundle\\": "src/Bundle/ChillWopiBundle/src",
|
||||||
|
"Chill\\TicketBundle\\": "src/Bundle/ChillTicketBundle/src",
|
||||||
"Chill\\Utils\\Rector\\": "utils/rector/src"
|
"Chill\\Utils\\Rector\\": "utils/rector/src"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -35,6 +35,8 @@ return [
|
|||||||
Chill\ThirdPartyBundle\ChillThirdPartyBundle::class => ['all' => true],
|
Chill\ThirdPartyBundle\ChillThirdPartyBundle::class => ['all' => true],
|
||||||
Chill\BudgetBundle\ChillBudgetBundle::class => ['all' => true],
|
Chill\BudgetBundle\ChillBudgetBundle::class => ['all' => true],
|
||||||
Chill\WopiBundle\ChillWopiBundle::class => ['all' => true],
|
Chill\WopiBundle\ChillWopiBundle::class => ['all' => true],
|
||||||
|
Chill\TicketBundle\ChillTicketBundle::class => ['all' => true],
|
||||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||||
Symfony\UX\Translator\UxTranslatorBundle::class => ['all' => true],
|
Symfony\UX\Translator\UxTranslatorBundle::class => ['all' => true],
|
||||||
|
Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true],
|
||||||
];
|
];
|
||||||
|
@@ -17,6 +17,7 @@ chill_main:
|
|||||||
acl:
|
acl:
|
||||||
form_show_scopes: true
|
form_show_scopes: true
|
||||||
form_show_centers: true
|
form_show_centers: true
|
||||||
|
filter_stats_by_center: true
|
||||||
access_global_history: false
|
access_global_history: false
|
||||||
access_user_change_password: true
|
access_user_change_password: true
|
||||||
access_permissions_group_list: true
|
access_permissions_group_list: true
|
||||||
|
4
config/packages/chill_ticket.yaml
Normal file
4
config/packages/chill_ticket.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
chill_ticket:
|
||||||
|
ticket:
|
||||||
|
person_per_ticket: one # One of "one"; "many"
|
||||||
|
|
@@ -14,6 +14,7 @@ doctrine_migrations:
|
|||||||
'Chill\Migrations\Calendar': '@ChillCalendarBundle/migrations'
|
'Chill\Migrations\Calendar': '@ChillCalendarBundle/migrations'
|
||||||
'Chill\Migrations\Budget': '@ChillBudgetBundle/migrations'
|
'Chill\Migrations\Budget': '@ChillBudgetBundle/migrations'
|
||||||
'Chill\Migrations\Report': '@ChillReportBundle/migrations'
|
'Chill\Migrations\Report': '@ChillReportBundle/migrations'
|
||||||
|
'Chill\Migrations\Ticket': '@ChillTicketBundle/migrations'
|
||||||
all_or_nothing:
|
all_or_nothing:
|
||||||
true
|
true
|
||||||
|
|
||||||
|
8
config/packages/mercure.yaml
Normal file
8
config/packages/mercure.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
mercure:
|
||||||
|
hubs:
|
||||||
|
default:
|
||||||
|
url: '%env(MERCURE_URL)%'
|
||||||
|
public_url: '%env(MERCURE_PUBLIC_URL)%'
|
||||||
|
jwt:
|
||||||
|
secret: '%env(MERCURE_JWT_SECRET)%'
|
||||||
|
publish: '*'
|
@@ -5,7 +5,6 @@ framework:
|
|||||||
|
|
||||||
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
|
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
|
||||||
failure_transport: failed
|
failure_transport: failed
|
||||||
|
|
||||||
transports:
|
transports:
|
||||||
# those transports are added by chill-bundles recipes
|
# those transports are added by chill-bundles recipes
|
||||||
sync: sync://
|
sync: sync://
|
||||||
@@ -19,7 +18,9 @@ framework:
|
|||||||
async: ~
|
async: ~
|
||||||
auto_setup: true
|
auto_setup: true
|
||||||
|
|
||||||
priority: '%env(MESSENGER_TRANSPORT_DSN)%/priority'
|
priority:
|
||||||
|
dsn: '%env(MESSENGER_TRANSPORT_DSN)%/priority'
|
||||||
|
|
||||||
# end of transports added by chill-bundles recipes
|
# end of transports added by chill-bundles recipes
|
||||||
# https://symfony.com/doc/current/messenger.html#transport-configuration
|
# https://symfony.com/doc/current/messenger.html#transport-configuration
|
||||||
failed: 'doctrine://default?queue_name=failed'
|
failed: 'doctrine://default?queue_name=failed'
|
||||||
@@ -61,6 +62,8 @@ framework:
|
|||||||
'Chill\MainBundle\Workflow\Messenger\PostSignatureStateChangeMessage': priority
|
'Chill\MainBundle\Workflow\Messenger\PostSignatureStateChangeMessage': priority
|
||||||
'Chill\MainBundle\Workflow\Messenger\PostPublicViewMessage': async
|
'Chill\MainBundle\Workflow\Messenger\PostPublicViewMessage': async
|
||||||
'Chill\MainBundle\Service\Workflow\CancelStaleWorkflowMessage': async
|
'Chill\MainBundle\Service\Workflow\CancelStaleWorkflowMessage': async
|
||||||
|
'Chill\MainBundle\Export\Messenger\ExportRequestGenerationMessage': priority
|
||||||
|
'Chill\MainBundle\Export\Messenger\RemoveExportGenerationMessage': async
|
||||||
# end of routes added by chill-bundles recipes
|
# end of routes added by chill-bundles recipes
|
||||||
# Route your messages to the transports
|
# Route your messages to the transports
|
||||||
# 'App\Message\YourMessage': async
|
# 'App\Message\YourMessage': async
|
||||||
|
@@ -17,3 +17,8 @@ when@dev:
|
|||||||
defaults:
|
defaults:
|
||||||
template: '@ChillMain/Dev/dev.assets.test2.html.twig'
|
template: '@ChillMain/Dev/dev.assets.test2.html.twig'
|
||||||
|
|
||||||
|
dev_mercure:
|
||||||
|
path: /_dev/mercure
|
||||||
|
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController
|
||||||
|
defaults:
|
||||||
|
template: '@ChillMain/Dev/dev.mercure.html.twig'
|
||||||
|
2
config/routes/chill_ticket.yaml
Normal file
2
config/routes/chill_ticket.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
chill_ticket_bundle:
|
||||||
|
resource: '@ChillTicketBundle/config/routes.yaml'
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\PersonBundle\Export\Filter;
|
namespace Chill\PersonBundle\Export\Filter;
|
||||||
|
|
||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Doctrine\ORM\Query\Expr;
|
use Doctrine\ORM\Query\Expr;
|
||||||
@@ -20,6 +21,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||||||
|
|
||||||
class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface
|
class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
// add specific role for this filter
|
// add specific role for this filter
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
@@ -28,7 +30,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
// here, we alter the query created by Export
|
// here, we alter the query created by Export
|
||||||
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
|
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$where = $qb->getDQLPart('where');
|
$where = $qb->getDQLPart('where');
|
||||||
// we create the clause here
|
// we create the clause here
|
||||||
@@ -52,13 +54,13 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we give information on which type of export this filter applies
|
// we give information on which type of export this filter applies
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return 'person';
|
return 'person';
|
||||||
}
|
}
|
||||||
|
|
||||||
// we build a form to collect some parameters from the users
|
// we build a form to collect some parameters from the users
|
||||||
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
|
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('date_from', DateType::class, [
|
$builder->add('date_from', DateType::class, [
|
||||||
'label' => 'Born after this date',
|
'label' => 'Born after this date',
|
||||||
@@ -74,6 +76,18 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
|
|||||||
'format' => 'dd-MM-yyyy',
|
'format' => 'dd-MM-yyyy',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['date_from' => $this->normalizeDate($formData['date_from']), 'date_to' => $this->normalizeDate($formData['date_to'])];
|
||||||
|
}
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['date_from' => $this->denormalizeDate($formData['date_from']), 'date_to' => $this->denormalizeDate($formData['date_to'])];
|
||||||
|
}
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return ['date_from' => new DateTime(), 'date_to' => new DateTime()];
|
return ['date_from' => new DateTime(), 'date_to' => new DateTime()];
|
||||||
@@ -81,7 +95,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
|
|||||||
|
|
||||||
// here, we create a simple string which will describe the action of
|
// here, we create a simple string which will describe the action of
|
||||||
// the filter in the Response
|
// the filter in the Response
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, ExportGenerationContext $context): string|\Symfony\Contracts\Translation\TranslatableInterface|array
|
||||||
{
|
{
|
||||||
return ['Filtered by person\'s birtdate: '
|
return ['Filtered by person\'s birtdate: '
|
||||||
. 'between %date_from% and %date_to%', [
|
. 'between %date_from% and %date_to%', [
|
||||||
@@ -90,7 +104,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
|
|||||||
], ];
|
], ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Filter by person\'s birthdate';
|
return 'Filter by person\'s birthdate';
|
||||||
}
|
}
|
||||||
@@ -99,7 +113,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
|
|||||||
// is executed here. This function is added by the interface
|
// is executed here. This function is added by the interface
|
||||||
// `ExportElementValidatedInterface`, and can be ignore if there is
|
// `ExportElementValidatedInterface`, and can be ignore if there is
|
||||||
// no need for a validation
|
// no need for a validation
|
||||||
public function validateForm($data, ExecutionContextInterface $context)
|
public function validateForm($data, ExecutionContextInterface $context): void
|
||||||
{
|
{
|
||||||
$date_from = $data['date_from'];
|
$date_from = $data['date_from'];
|
||||||
$date_to = $data['date_to'];
|
$date_to = $data['date_to'];
|
||||||
|
@@ -36,6 +36,18 @@ class CountPerson implements ExportInterface
|
|||||||
{
|
{
|
||||||
// this export does not add any form
|
// this export does not add any form
|
||||||
}
|
}
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -60,29 +72,29 @@ class CountPerson implements ExportInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
// this array match the result keys in the query. We have only
|
// this array match the result keys in the query. We have only
|
||||||
// one column.
|
// one column.
|
||||||
return ['export_result'];
|
return ['export_result'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Count peoples';
|
return 'Count peoples';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType()
|
public function getType(): string
|
||||||
{
|
{
|
||||||
return Declarations::PERSON_TYPE;
|
return Declarations::PERSON_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
// we gather all center the user choose.
|
// we gather all center the user choose.
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
@@ -11,24 +11,94 @@
|
|||||||
Create a new bundle
|
Create a new bundle
|
||||||
*******************
|
*******************
|
||||||
|
|
||||||
Create your own bundle is not a trivial task.
|
|
||||||
|
|
||||||
The easiest way to achieve this is seems to be :
|
|
||||||
|
|
||||||
1. Prepare a fresh installation of the chill project, in a new directory
|
|
||||||
2. Create a new bundle in this project, in the src directory
|
|
||||||
3. Initialize a git repository **at the root bundle**, and create your initial commit.
|
|
||||||
4. Register the bundle with composer/packagist. If you do not plan to distribute your bundle with packagist, you may use a custom repository for achieve this [#f1]_
|
|
||||||
5. Move to a development installation, made as described in the :ref:`installation-for-development` section, and add your new repository to the composer.json file
|
|
||||||
6. Work as :ref:`usual <editing-code-and-commiting>`
|
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
This part of the doc is not yet tested
|
This part of the doc is not yet tested
|
||||||
|
|
||||||
TODO
|
Create a new directory with Bundle class
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
mkdir -p src/Bundle/ChillSomeBundle/src/config
|
||||||
|
mkdir -p src/Bundle/ChillSomeBundle/src/Controller
|
||||||
|
|
||||||
|
Add a bundle file
|
||||||
|
|
||||||
|
.. code-block:: php
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\SomeBundle;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
|
class ChillSomeBundle extends Bundle {}
|
||||||
|
|
||||||
|
And a route file:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
chill_ticket_controller:
|
||||||
|
resource: '@ChillTicketBundle/Controller/'
|
||||||
|
type: annotation
|
||||||
|
|
||||||
|
Register the new psr-4 namespace
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
In composer.json, add the new psr4 namespace
|
||||||
|
|
||||||
|
.. code-block:: diff
|
||||||
|
|
||||||
|
{
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
+ "Chill\\SomeBundle\\": "src/Bundle/ChillSomeBundle/src",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.. rubric:: Footnotes
|
Register the bundle
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Register in the file :code:`config/bundles.php`:
|
||||||
|
|
||||||
|
.. code-block:: php
|
||||||
|
|
||||||
|
Vendor\Bundle\YourBundle\YourBundle::class => ['all' => true],
|
||||||
|
|
||||||
|
And import routes in :code:`config/routes/chill_some_bundle.yaml`:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
chill_ticket_bundle:
|
||||||
|
resource: '@ChillSomeBundle/config/routes.yaml'
|
||||||
|
|
||||||
|
Add the doctrine_migration namespace
|
||||||
|
------------------------------------
|
||||||
|
|
||||||
|
Add the namespace to :code:`config/packages/doctrine_migrations_chill.yaml`
|
||||||
|
|
||||||
|
.. code-block:: diff
|
||||||
|
|
||||||
|
doctrine_migrations:
|
||||||
|
migrations_paths:
|
||||||
|
+ 'Chill\Some\Ticket': '@ChillSomeBundle/migrations'
|
||||||
|
|
||||||
|
Dump autoloading
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
symfony composer dump-autoload
|
||||||
|
|
||||||
.. [#f1] Be aware that we use the Affero GPL Licence, which ensure that all users must have access to derivative works done with this software.
|
|
||||||
|
84
docs/source/development/export-sequence.puml
Normal file
84
docs/source/development/export-sequence.puml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
@startuml
|
||||||
|
'https://plantuml.com/sequence-diagram
|
||||||
|
|
||||||
|
autonumber
|
||||||
|
|
||||||
|
User -> ExportController: configure export using form
|
||||||
|
activate ExportController
|
||||||
|
ExportController -> ExportForm: build form
|
||||||
|
activate ExportForm
|
||||||
|
|
||||||
|
loop for every ExportElement (Filter, Aggregator)
|
||||||
|
ExportForm -> ExportElement: `buildForm`
|
||||||
|
activate ExportElement
|
||||||
|
ExportElement -> ExportForm: add form to builders
|
||||||
|
deactivate ExportElement
|
||||||
|
end
|
||||||
|
|
||||||
|
ExportForm -> ExportController
|
||||||
|
deactivate ExportForm
|
||||||
|
|
||||||
|
ExportController -> User: show form
|
||||||
|
deactivate ExportController
|
||||||
|
|
||||||
|
note left of User: Configure the export:\ncheck filters, aggregators, …
|
||||||
|
|
||||||
|
User -> ExportController: post configuration of the export
|
||||||
|
activate ExportController
|
||||||
|
|
||||||
|
ExportController -> ExportForm: `getData`
|
||||||
|
activate ExportForm
|
||||||
|
ExportForm -> ExportController: return data: list of entities, etc.
|
||||||
|
deactivate ExportForm
|
||||||
|
|
||||||
|
loop for every ExportElement (Filter, Aggregator)
|
||||||
|
ExportController -> ExportElement: serializeData (data)
|
||||||
|
activate ExportElement
|
||||||
|
ExportElement -> ExportController: return serializedData (simple array with string, int, …)
|
||||||
|
deactivate ExportElement
|
||||||
|
end
|
||||||
|
|
||||||
|
ExportController -> Database: `INSERT INTO RequestGeneration_table` (insert new entity)
|
||||||
|
ExportController -> MessageQueue: warn about a new request
|
||||||
|
activate MessageQueue
|
||||||
|
ExportController -> User: "ok, generation is in process"
|
||||||
|
deactivate ExportController
|
||||||
|
|
||||||
|
note left of User: The user see a waiting screen
|
||||||
|
|
||||||
|
MessageQueue -> MessengerConsumer: forward the message to the MessengerConsumer
|
||||||
|
deactivate MessageQueue
|
||||||
|
activate MessengerConsumer
|
||||||
|
MessengerConsumer -> Database: `SELECT * FROM RequestGeneration_table WHERE id = %s`
|
||||||
|
activate Database
|
||||||
|
Database -> MessengerConsumer: return RequestGeneration with serializedData
|
||||||
|
deactivate Database
|
||||||
|
|
||||||
|
loop for every ExportElement (Filter, Aggregator)
|
||||||
|
MessengerConsumer -> ExportElement: deserializeData
|
||||||
|
activate ExportElement
|
||||||
|
ExportElement -> MessengerConsumer: return data (list of entities, etc.) from the serialized array
|
||||||
|
deactivate ExportElement
|
||||||
|
MessengerConsumer -> ExportElement: alter the sql query (`ExportElement::alterQuery`)
|
||||||
|
activate ExportElement
|
||||||
|
ExportElement -> MessengerConsumer: return the query with WHERE and GROUP BY clauses
|
||||||
|
deactivate ExportElement
|
||||||
|
end
|
||||||
|
|
||||||
|
MessengerConsumer -> MessengerConsumer: prepare the export
|
||||||
|
MessengerConsumer -> MessengerConsumer: save the export as a stored object
|
||||||
|
MessengerConsumer -> Database: `UPDATE RequestGeneration_table SET ready = true`
|
||||||
|
deactivate MessengerConsumer
|
||||||
|
|
||||||
|
User -> ExportController: pull every 5s to know if the export is generated
|
||||||
|
activate ExportController
|
||||||
|
ExportController -> User: warn the export is generated
|
||||||
|
deactivate ExportController
|
||||||
|
|
||||||
|
User -> ExportController: download the export from object storage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@enduml
|
@@ -20,19 +20,26 @@ The four following levels are defined :
|
|||||||
+-----------+----------------------------------------------------------------------------------------------+
|
+-----------+----------------------------------------------------------------------------------------------+
|
||||||
|Key |Intent |
|
|Key |Intent |
|
||||||
+===========+==============================================================================================+
|
+===========+==============================================================================================+
|
||||||
|alert |A message not linked with the user action, but which should require an action or a |
|
|
||||||
| |correction. |
|
|
||||||
+-----------+----------------------------------------------------------------------------------------------+
|
|
||||||
|success |The user action succeeds. |
|
|success |The user action succeeds. |
|
||||||
+-----------+----------------------------------------------------------------------------------------------+
|
+-----------+----------------------------------------------------------------------------------------------+
|
||||||
|notice |A simple message to give information to the user. The message may be linked or not linked with|
|
|notice |A simple message to give information to the user. The message may be linked or not linked with|
|
||||||
| |the user action. |
|
| |the user action. |
|
||||||
+-----------+----------------------------------------------------------------------------------------------+
|
+-----------+----------------------------------------------------------------------------------------------+
|
||||||
|warning |A message linked with an action, the user should correct. |
|
|
||||||
+-----------+----------------------------------------------------------------------------------------------+
|
|
||||||
|error |The user's action failed: he must correct something to process the action. |
|
|error |The user's action failed: he must correct something to process the action. |
|
||||||
+-----------+----------------------------------------------------------------------------------------------+
|
+-----------+----------------------------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
We can use :code:`TranslatableMessage` (and other :code:`TranslatableMessageInterface` instances) into the controller:
|
||||||
|
|
||||||
|
.. code-block:: php
|
||||||
|
|
||||||
|
// in a controller action:
|
||||||
|
if (($session = $request->getSession()) instanceof Session) {
|
||||||
|
$session->getFlashBag()->add(
|
||||||
|
'success',
|
||||||
|
new TranslatableMessage('saved_export.Saved export is saved!')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
`Flash Messages on Symfony documentation <http://symfony.com/doc/current/book/controller.html#flash-messages>`_
|
`Flash Messages on Symfony documentation <http://symfony.com/doc/current/book/controller.html#flash-messages>`_
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
"@hotwired/stimulus": "^3.0.0",
|
"@hotwired/stimulus": "^3.0.0",
|
||||||
"@luminateone/eslint-baseline": "^1.0.9",
|
"@luminateone/eslint-baseline": "^1.0.9",
|
||||||
"@symfony/stimulus-bridge": "^3.2.0",
|
"@symfony/stimulus-bridge": "^3.2.0",
|
||||||
|
"@symfony/ux-translator": "file:vendor/symfony/ux-translator/assets",
|
||||||
"@symfony/webpack-encore": "^4.1.0",
|
"@symfony/webpack-encore": "^4.1.0",
|
||||||
"@tsconfig/node20": "^20.1.4",
|
"@tsconfig/node20": "^20.1.4",
|
||||||
"@types/dompurify": "^3.0.5",
|
"@types/dompurify": "^3.0.5",
|
||||||
@@ -79,12 +80,12 @@
|
|||||||
"dev": "encore dev",
|
"dev": "encore dev",
|
||||||
"watch": "encore dev --watch",
|
"watch": "encore dev --watch",
|
||||||
"build": "encore production --progress",
|
"build": "encore production --progress",
|
||||||
"specs-build": "yaml-merge src/Bundle/ChillMainBundle/chill.api.specs.yaml src/Bundle/ChillPersonBundle/chill.api.specs.yaml src/Bundle/ChillCalendarBundle/chill.api.specs.yaml src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml src/Bundle/ChillDocStoreBundle/chill.api.specs.yaml> templates/api/specs.yaml",
|
"specs-build": "yaml-merge src/Bundle/ChillMainBundle/chill.api.specs.yaml src/Bundle/ChillPersonBundle/chill.api.specs.yaml src/Bundle/ChillCalendarBundle/chill.api.specs.yaml src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml src/Bundle/ChillDocStoreBundle/chill.api.specs.yaml src/Bundle/ChillTicketBundle/chill.api.specs.yaml> templates/api/specs.yaml",
|
||||||
"specs-validate": "swagger-cli validate templates/api/specs.yaml",
|
"specs-validate": "swagger-cli validate templates/api/specs.yaml",
|
||||||
"specs-create-dir": "mkdir -p templates/api",
|
"specs-create-dir": "mkdir -p templates/api",
|
||||||
"specs": "yarn run specs-create-dir && yarn run specs-build && yarn run specs-validate",
|
"specs": "yarn run specs-create-dir && yarn run specs-build && yarn run specs-validate",
|
||||||
"version": "node --version",
|
"version": "node --version",
|
||||||
"eslint": "npx eslint-baseline --fix \"src/**/*.{js,ts,vue}\""
|
"eslint": "eslint-baseline --fix \"src/**/*.{js,ts,vue}\""
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
||||||
|
@@ -2154,11 +2154,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
|
path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Instanceof between string and DateTimeInterface will always evaluate to false\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillMainBundle/Export/Formatter/SpreadsheetListFormatter.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^PHPDoc tag @var for property Chill\\\\MainBundle\\\\Export\\\\Helper\\\\ExportAddressHelper\\:\\:\\$unitNamesKeysCache contains unresolvable type\\.$#"
|
message: "#^PHPDoc tag @var for property Chill\\\\MainBundle\\\\Export\\\\Helper\\\\ExportAddressHelper\\:\\:\\$unitNamesKeysCache contains unresolvable type\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@@ -3,7 +3,7 @@ parameters:
|
|||||||
paths:
|
paths:
|
||||||
- src/
|
- src/
|
||||||
- utils/
|
- utils/
|
||||||
tmpDir: .cache/
|
tmpDir: var/cache/phpstan
|
||||||
reportUnmatchedIgnoredErrors: false
|
reportUnmatchedIgnoredErrors: false
|
||||||
excludePaths:
|
excludePaths:
|
||||||
- .php_cs*
|
- .php_cs*
|
||||||
|
@@ -1,13 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" failOnRisky="true" failOnWarning="true" colors="true" cacheDirectory="var/cache/phpunit.rector.cache" requireCoverageMetadata="true" beStrictAboutCoverageMetadata="true">
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<testsuites>
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
|
||||||
<testsuite name="default">
|
bootstrap="vendor/autoload.php"
|
||||||
<directory>utils/rector/tests</directory>
|
executionOrder="depends,defects"
|
||||||
</testsuite>
|
beStrictAboutOutputDuringTests="true"
|
||||||
</testsuites>
|
failOnRisky="true"
|
||||||
<source>
|
failOnWarning="true"
|
||||||
<include>
|
colors="true"
|
||||||
<directory suffix=".php">utils/rector/src</directory>
|
cacheDirectory="var/cache/phpunit.rector.cache"
|
||||||
</include>
|
requireCoverageMetadata="true"
|
||||||
</source>
|
beStrictAboutCoverageMetadata="true"
|
||||||
|
displayDetailsOnTestsThatTriggerWarnings="true">
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="default">
|
||||||
|
<directory>utils/rector/tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<source>
|
||||||
|
<include>
|
||||||
|
<directory suffix=".php">utils/rector/src</directory>
|
||||||
|
</include>
|
||||||
|
</source>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
@@ -58,6 +58,10 @@
|
|||||||
<!-- 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="TicketBundle">
|
||||||
|
<directory suffix="Test.php">src/Bundle/ChillTicketBundle/tests/</directory>
|
||||||
|
</testsuite>
|
||||||
<!--
|
<!--
|
||||||
<testsuite name="ReportBundle">
|
<testsuite name="ReportBundle">
|
||||||
<directory suffix="Test.php">src/Bundle/ChillReportBundle/Tests/</directory>
|
<directory suffix="Test.php">src/Bundle/ChillReportBundle/Tests/</directory>
|
||||||
|
19
rector.php
19
rector.php
@@ -18,14 +18,15 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
$rectorConfig->paths([
|
$rectorConfig->paths([
|
||||||
__DIR__ . '/docs',
|
__DIR__ . '/docs',
|
||||||
__DIR__ . '/src',
|
__DIR__ . '/src',
|
||||||
|
__DIR__ . '/rector.php',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rectorConfig->skip([
|
$rectorConfig->skip([
|
||||||
\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class => __DIR__ . 'src/Bundle/ChillMainBundle/Service/Notifier/LegacyOvhCloudFactory.php'
|
\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class => __DIR__ . 'src/Bundle/ChillMainBundle/Service/Notifier/LegacyOvhCloudFactory.php'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/test/App_KernelTestDebugContainer.xml ');
|
//$rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/test/App_KernelTestDebugContainer.xml ');
|
||||||
$rectorConfig->symfonyContainerPhp(__DIR__ . '/tests/symfony-container.php');
|
//$rectorConfig->symfonyContainerPhp(__DIR__ . '/tests/symfony-container.php');
|
||||||
|
|
||||||
//$rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class);
|
//$rectorConfig->cacheClass(\Rector\Caching\ValueObject\Storage\FileCacheStorage::class);
|
||||||
//$rectorConfig->cacheDirectory(__DIR__ . '/.cache/rector');
|
//$rectorConfig->cacheDirectory(__DIR__ . '/.cache/rector');
|
||||||
@@ -39,16 +40,11 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
// part of the symfony 54 rules
|
// part of the symfony 54 rules
|
||||||
$rectorConfig->rule(\Rector\Symfony\Symfony53\Rector\StaticPropertyFetch\KernelTestCaseContainerPropertyDeprecationRector::class);
|
$rectorConfig->rule(\Rector\Symfony\Symfony53\Rector\StaticPropertyFetch\KernelTestCaseContainerPropertyDeprecationRector::class);
|
||||||
$rectorConfig->rule(\Rector\Symfony\Symfony60\Rector\MethodCall\GetHelperControllerToServiceRector::class);
|
$rectorConfig->rule(\Rector\Symfony\Symfony60\Rector\MethodCall\GetHelperControllerToServiceRector::class);
|
||||||
$rectorConfig->disableParallel();
|
//$rectorConfig->disableParallel();
|
||||||
|
|
||||||
//define sets of rules
|
//define sets of rules
|
||||||
$rectorConfig->sets([
|
$rectorConfig->sets([
|
||||||
LevelSetList::UP_TO_PHP_82,
|
LevelSetList::UP_TO_PHP_82,
|
||||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_40,
|
|
||||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_41,
|
|
||||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_42,
|
|
||||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_43,
|
|
||||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_44,
|
|
||||||
\Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY,
|
\Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY,
|
||||||
\Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_90,
|
\Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_90,
|
||||||
]);
|
]);
|
||||||
@@ -66,11 +62,6 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
// some routes are added twice if it remains activated
|
// some routes are added twice if it remains activated
|
||||||
// $rectorConfig->rule(\Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector::class);
|
// $rectorConfig->rule(\Rector\Symfony\Configs\Rector\ClassMethod\AddRouteAnnotationRector::class);
|
||||||
|
|
||||||
// chill rules
|
|
||||||
$rectorConfig->rules([
|
|
||||||
\Chill\Utils\Rector\Rector\ChillBundleMakeDataProviderStaticForAbstractExportTestRector::class,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// skip some path...
|
// skip some path...
|
||||||
$rectorConfig->skip([
|
$rectorConfig->skip([
|
||||||
// waiting for fixing this bug: https://github.com/rectorphp/rector-doctrine/issues/342
|
// waiting for fixing this bug: https://github.com/rectorphp/rector-doctrine/issues/342
|
||||||
@@ -94,4 +85,6 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency'),
|
new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency'),
|
||||||
new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Workflow\Validator\EntityWorkflowCreation'),
|
new \Rector\Php80\ValueObject\AnnotationToAttribute('Chill\MainBundle\Workflow\Validator\EntityWorkflowCreation'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
20
resources/dev.Caddyfile
Normal file
20
resources/dev.Caddyfile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
# Désactive les redirections automatiques HTTP -> HTTPS
|
||||||
|
# auto_https off
|
||||||
|
# Désactive le port 80 par défaut
|
||||||
|
# default_bind :8080
|
||||||
|
}
|
||||||
|
|
||||||
|
localhost:8043 {
|
||||||
|
mercure {
|
||||||
|
# Publisher JWT key
|
||||||
|
publisher_jwt !ChangeThisMercureHubJWTSecretKey!
|
||||||
|
# Subscriber JWT key
|
||||||
|
subscriber_jwt !ChangeThisMercureHubJWTSecretKey!
|
||||||
|
cors_origins http://chill-bundles.wip https://chill-bundles.wip
|
||||||
|
ui
|
||||||
|
demo
|
||||||
|
}
|
||||||
|
|
||||||
|
respond "Not Found" 404
|
||||||
|
}
|
@@ -17,7 +17,6 @@ use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ActivityReason controller.
|
* ActivityReason controller.
|
||||||
|
@@ -24,7 +24,7 @@ class ByActivityNumberAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data): void
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb
|
$qb
|
||||||
->addSelect('(SELECT COUNT(activity.id) FROM '.Activity::class.' activity WHERE activity.accompanyingPeriod = acp) AS activity_by_number_aggregator')
|
->addSelect('(SELECT COUNT(activity.id) FROM '.Activity::class.' activity WHERE activity.accompanyingPeriod = acp) AS activity_by_number_aggregator')
|
||||||
@@ -41,12 +41,27 @@ class ByActivityNumberAggregator implements AggregatorInterface
|
|||||||
// No form needed
|
// No form needed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return static function ($value) {
|
return static function ($value) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -33,7 +33,7 @@ final readonly class ByActivityTypeAggregator implements AggregatorInterface
|
|||||||
private TranslatableStringHelperInterface $translatableStringHelper,
|
private TranslatableStringHelperInterface $translatableStringHelper,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('after_date', PickRollingDateType::class, [
|
->add('after_date', PickRollingDateType::class, [
|
||||||
@@ -46,6 +46,21 @@ final readonly class ByActivityTypeAggregator implements AggregatorInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['after_date' => $formData['after_date']->normalize(), 'before_date' => $formData['before_date']->normalize()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['after_date' => \Chill\MainBundle\Service\RollingDate\RollingDate::fromNormalized($formData['after_date']), 'before_date' => \Chill\MainBundle\Service\RollingDate\RollingDate::fromNormalized($formData['before_date'])];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -54,7 +69,7 @@ final readonly class ByActivityTypeAggregator implements AggregatorInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, mixed $data)
|
public function getLabels($key, array $values, mixed $data): callable
|
||||||
{
|
{
|
||||||
return function (int|string|null $value): string {
|
return function (int|string|null $value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
@@ -69,12 +84,12 @@ final readonly class ByActivityTypeAggregator implements AggregatorInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return [self::PREFIX.'_actype_id'];
|
return [self::PREFIX.'_actype_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.aggregator.acp.by_activity_type.title';
|
return 'export.aggregator.acp.by_activity_type.title';
|
||||||
}
|
}
|
||||||
@@ -84,7 +99,7 @@ final readonly class ByActivityTypeAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -115,7 +130,7 @@ final readonly class ByActivityTypeAggregator implements AggregatorInterface
|
|||||||
->addGroupBy("{$p}_actype_id");
|
->addGroupBy("{$p}_actype_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACP_TYPE;
|
return Declarations::ACP_TYPE;
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ class BySocialActionAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('actsocialaction', $qb->getAllAliases(), true)) {
|
if (!\in_array('actsocialaction', $qb->getAllAliases(), true)) {
|
||||||
$qb->leftJoin('activity.socialActions', 'actsocialaction');
|
$qb->leftJoin('activity.socialActions', 'actsocialaction');
|
||||||
@@ -42,17 +42,32 @@ class BySocialActionAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY_ACP;
|
return Declarations::ACTIVITY_ACP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// no form
|
// no form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value) {
|
return function ($value) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -27,7 +27,7 @@ class BySocialIssueAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('actsocialissue', $qb->getAllAliases(), true)) {
|
if (!\in_array('actsocialissue', $qb->getAllAliases(), true)) {
|
||||||
$qb->leftJoin('activity.socialIssues', 'actsocialissue');
|
$qb->leftJoin('activity.socialIssues', 'actsocialissue');
|
||||||
@@ -42,17 +42,32 @@ class BySocialIssueAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY_ACP;
|
return Declarations::ACTIVITY_ACP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// no form
|
// no form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -25,7 +25,7 @@ final readonly class ActivityLocationAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('actloc', $qb->getAllAliases(), true)) {
|
if (!\in_array('actloc', $qb->getAllAliases(), true)) {
|
||||||
$qb->leftJoin('activity.location', 'actloc');
|
$qb->leftJoin('activity.location', 'actloc');
|
||||||
@@ -39,17 +39,32 @@ final readonly class ActivityLocationAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// no form required for this aggregator
|
// no form required for this aggregator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data): \Closure
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
@@ -69,7 +84,7 @@ final readonly class ActivityLocationAggregator implements AggregatorInterface
|
|||||||
return [self::KEY];
|
return [self::KEY];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.aggregator.activity.by_location.Title';
|
return 'export.aggregator.activity.by_location.Title';
|
||||||
}
|
}
|
||||||
|
@@ -22,14 +22,29 @@ final readonly class ActivityPresenceAggregator implements AggregatorInterface
|
|||||||
{
|
{
|
||||||
public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private TranslatableStringHelperInterface $translatableStringHelper) {}
|
public function __construct(private ActivityPresenceRepositoryInterface $activityPresenceRepository, private TranslatableStringHelperInterface $translatableStringHelper) {}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder): void {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, mixed $data)
|
public function getLabels($key, array $values, mixed $data): callable
|
||||||
{
|
{
|
||||||
return function (int|string|null $value): string {
|
return function (int|string|null $value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
@@ -44,7 +59,7 @@ final readonly class ActivityPresenceAggregator implements AggregatorInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['activity_presence_aggregator_attendee'];
|
return ['activity_presence_aggregator_attendee'];
|
||||||
}
|
}
|
||||||
@@ -59,13 +74,13 @@ final readonly class ActivityPresenceAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data): void
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb->addSelect('IDENTITY(activity.attendee) AS activity_presence_aggregator_attendee');
|
$qb->addSelect('IDENTITY(activity.attendee) AS activity_presence_aggregator_attendee');
|
||||||
$qb->addGroupBy('activity_presence_aggregator_attendee');
|
$qb->addGroupBy('activity_presence_aggregator_attendee');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
// add select element
|
// add select element
|
||||||
if ('reasons' === $data['level']) {
|
if ('reasons' === $data['level']) {
|
||||||
@@ -72,7 +72,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add(
|
$builder->add(
|
||||||
'level',
|
'level',
|
||||||
@@ -89,6 +89,21 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['level' => $formData['level']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['level' => $formData['level']];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -96,7 +111,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value) use ($data) {
|
return function ($value) use ($data) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
@@ -125,7 +140,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
// add select element
|
// add select element
|
||||||
if ('reasons' === $data['level']) {
|
if ('reasons' === $data['level']) {
|
||||||
@@ -139,12 +154,12 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
|||||||
throw new \RuntimeException('The data provided are not recognised.');
|
throw new \RuntimeException('The data provided are not recognised.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Aggregate by activity reason';
|
return 'Aggregate by activity reason';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateForm($data, ExecutionContextInterface $context)
|
public function validateForm($data, ExecutionContextInterface $context): void
|
||||||
{
|
{
|
||||||
if (null === $data['level']) {
|
if (null === $data['level']) {
|
||||||
$context
|
$context
|
||||||
|
@@ -29,7 +29,7 @@ class ActivityTypeAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('acttype', $qb->getAllAliases(), true)) {
|
if (!\in_array('acttype', $qb->getAllAliases(), true)) {
|
||||||
$qb->leftJoin('activity.activityType', 'acttype');
|
$qb->leftJoin('activity.activityType', 'acttype');
|
||||||
@@ -44,17 +44,32 @@ class ActivityTypeAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// no form required for this aggregator
|
// no form required for this aggregator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data): \Closure
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function (int|string|null $value): string {
|
return function (int|string|null $value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
@@ -74,7 +89,7 @@ class ActivityTypeAggregator implements AggregatorInterface
|
|||||||
return [self::KEY];
|
return [self::KEY];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Aggregate by activity type';
|
return 'Aggregate by activity type';
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@ class ActivityUserAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
// add select element
|
// add select element
|
||||||
$qb->addSelect(sprintf('IDENTITY(activity.user) AS %s', self::KEY));
|
$qb->addSelect(sprintf('IDENTITY(activity.user) AS %s', self::KEY));
|
||||||
@@ -43,17 +43,32 @@ class ActivityUserAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// nothing to add
|
// nothing to add
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, $values, $data): \Closure
|
public function getLabels($key, $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value) {
|
return function ($value) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
@@ -70,7 +85,7 @@ class ActivityUserAggregator implements AggregatorInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return [self::KEY];
|
return [self::KEY];
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ class ActivityUsersAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('actusers', $qb->getAllAliases(), true)) {
|
if (!\in_array('actusers', $qb->getAllAliases(), true)) {
|
||||||
$qb->leftJoin('activity.users', 'actusers');
|
$qb->leftJoin('activity.users', 'actusers');
|
||||||
@@ -43,17 +43,32 @@ class ActivityUsersAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// nothing to add on the form
|
// nothing to add on the form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value) {
|
return function ($value) {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
@@ -70,12 +85,12 @@ class ActivityUsersAggregator implements AggregatorInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['activity_users_aggregator'];
|
return ['activity_users_aggregator'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Aggregate by activity users';
|
return 'Aggregate by activity users';
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ class ActivityUsersJobAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -65,14 +65,29 @@ class ActivityUsersJobAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder): void {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -34,7 +34,7 @@ class ActivityUsersScopeAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -65,14 +65,29 @@ class ActivityUsersScopeAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder): void {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -27,7 +27,7 @@ class ByCreatorAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb->addSelect('IDENTITY(activity.createdBy) AS creator_aggregator');
|
$qb->addSelect('IDENTITY(activity.createdBy) AS creator_aggregator');
|
||||||
$qb->addGroupBy('creator_aggregator');
|
$qb->addGroupBy('creator_aggregator');
|
||||||
@@ -38,17 +38,32 @@ class ByCreatorAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// no form
|
// no form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -27,7 +27,7 @@ class ByThirdpartyAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('acttparty', $qb->getAllAliases(), true)) {
|
if (!\in_array('acttparty', $qb->getAllAliases(), true)) {
|
||||||
$qb->leftJoin('activity.thirdParties', 'acttparty');
|
$qb->leftJoin('activity.thirdParties', 'acttparty');
|
||||||
@@ -42,17 +42,32 @@ class ByThirdpartyAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// no form
|
// no form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -34,7 +34,7 @@ class CreatorJobAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -65,14 +65,29 @@ class CreatorJobAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder): void {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -34,7 +34,7 @@ class CreatorScopeAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -65,14 +65,29 @@ class CreatorScopeAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder): void {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -32,7 +32,7 @@ class DateAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$order = null;
|
$order = null;
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ class DateAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('frequency', ChoiceType::class, [
|
$builder->add('frequency', ChoiceType::class, [
|
||||||
'choices' => self::CHOICES,
|
'choices' => self::CHOICES,
|
||||||
@@ -76,12 +76,27 @@ class DateAggregator implements AggregatorInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['frequency' => $formData['frequency']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['frequency' => $formData['frequency']];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return ['frequency' => self::DEFAULT_CHOICE];
|
return ['frequency' => self::DEFAULT_CHOICE];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return static function ($value) use ($data): string {
|
return static function ($value) use ($data): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -27,7 +27,7 @@ class LocationTypeAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('actloc', $qb->getAllAliases(), true)) {
|
if (!\in_array('actloc', $qb->getAllAliases(), true)) {
|
||||||
$qb->leftJoin('activity.location', 'actloc');
|
$qb->leftJoin('activity.location', 'actloc');
|
||||||
@@ -42,17 +42,32 @@ class LocationTypeAggregator implements AggregatorInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// no form
|
// no form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, $data)
|
public function getLabels($key, array $values, $data): callable
|
||||||
{
|
{
|
||||||
return function ($value): string {
|
return function ($value): string {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
|
@@ -24,17 +24,32 @@ final readonly class HouseholdAggregator implements AggregatorInterface
|
|||||||
{
|
{
|
||||||
public function __construct(private HouseholdRepository $householdRepository) {}
|
public function __construct(private HouseholdRepository $householdRepository) {}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// nothing to add here
|
// nothing to add here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, mixed $data)
|
public function getLabels($key, array $values, mixed $data): callable
|
||||||
{
|
{
|
||||||
return function (int|string|null $value): string|int {
|
return function (int|string|null $value): string|int {
|
||||||
if ('_header' === $value) {
|
if ('_header' === $value) {
|
||||||
@@ -49,12 +64,12 @@ final readonly class HouseholdAggregator implements AggregatorInterface
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['activity_household_agg'];
|
return ['activity_household_agg'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.aggregator.person.by_household.title';
|
return 'export.aggregator.person.by_household.title';
|
||||||
}
|
}
|
||||||
@@ -64,7 +79,7 @@ final readonly class HouseholdAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb->join(
|
$qb->join(
|
||||||
HouseholdMember::class,
|
HouseholdMember::class,
|
||||||
@@ -92,7 +107,7 @@ final readonly class HouseholdAggregator implements AggregatorInterface
|
|||||||
->addGroupBy('activity_household_agg');
|
->addGroupBy('activity_household_agg');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACTIVITY_PERSON;
|
return Declarations::ACTIVITY_PERSON;
|
||||||
}
|
}
|
||||||
|
@@ -21,27 +21,42 @@ final readonly class PersonAggregator implements AggregatorInterface
|
|||||||
{
|
{
|
||||||
public function __construct(private LabelPersonHelper $labelPersonHelper) {}
|
public function __construct(private LabelPersonHelper $labelPersonHelper) {}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// nothing to add here
|
// nothing to add here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, mixed $data)
|
public function getLabels($key, array $values, mixed $data): callable
|
||||||
{
|
{
|
||||||
return $this->labelPersonHelper->getLabel($key, $values, 'export.aggregator.person.by_person.person');
|
return $this->labelPersonHelper->getLabel($key, $values, 'export.aggregator.person.by_person.person');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['activity_by_person_agg'];
|
return ['activity_by_person_agg'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.aggregator.person.by_person.title';
|
return 'export.aggregator.person.by_person.title';
|
||||||
}
|
}
|
||||||
@@ -51,14 +66,14 @@ final readonly class PersonAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb
|
$qb
|
||||||
->addSelect('IDENTITY(activity.person) AS activity_by_person_agg')
|
->addSelect('IDENTITY(activity.person) AS activity_by_person_agg')
|
||||||
->addGroupBy('activity_by_person_agg');
|
->addGroupBy('activity_by_person_agg');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACTIVITY_PERSON;
|
return Declarations::ACTIVITY_PERSON;
|
||||||
}
|
}
|
||||||
|
@@ -27,17 +27,32 @@ final readonly class PersonsAggregator implements AggregatorInterface
|
|||||||
|
|
||||||
public function __construct(private LabelPersonHelper $labelPersonHelper) {}
|
public function __construct(private LabelPersonHelper $labelPersonHelper) {}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// nothing to add here
|
// nothing to add here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLabels($key, array $values, mixed $data)
|
public function getLabels($key, array $values, mixed $data): callable
|
||||||
{
|
{
|
||||||
if ($key !== self::PREFIX.'_pid') {
|
if ($key !== self::PREFIX.'_pid') {
|
||||||
throw new \UnexpectedValueException('this key should not be handled: '.$key);
|
throw new \UnexpectedValueException('this key should not be handled: '.$key);
|
||||||
@@ -46,12 +61,12 @@ final readonly class PersonsAggregator implements AggregatorInterface
|
|||||||
return $this->labelPersonHelper->getLabel($key, $values, 'export.aggregator.activity.by_persons.Persons');
|
return $this->labelPersonHelper->getLabel($key, $values, 'export.aggregator.activity.by_persons.Persons');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return [self::PREFIX.'_pid'];
|
return [self::PREFIX.'_pid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.aggregator.activity.by_persons.Group activity by persons';
|
return 'export.aggregator.activity.by_persons.Group activity by persons';
|
||||||
}
|
}
|
||||||
@@ -61,7 +76,7 @@ final readonly class PersonsAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -71,7 +86,7 @@ final readonly class PersonsAggregator implements AggregatorInterface
|
|||||||
->addGroupBy("{$p}_pid");
|
->addGroupBy("{$p}_pid");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@ class SentReceivedAggregator implements AggregatorInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data): void
|
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb->addSelect('activity.sentReceived AS activity_sentreceived_aggregator')
|
$qb->addSelect('activity.sentReceived AS activity_sentreceived_aggregator')
|
||||||
->addGroupBy('activity_sentreceived_aggregator');
|
->addGroupBy('activity_sentreceived_aggregator');
|
||||||
@@ -42,6 +42,21 @@ class SentReceivedAggregator implements AggregatorInterface
|
|||||||
// No form needed
|
// No form needed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
|
@@ -15,6 +15,7 @@ use Chill\ActivityBundle\Export\Declarations;
|
|||||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||||
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
@@ -38,6 +39,21 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -72,7 +88,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
return ['export_avg_activity_duration'];
|
return ['export_avg_activity_duration'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
@@ -87,7 +103,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\Activity;
|
|||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||||
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
@@ -46,6 +47,21 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
// TODO: Implement buildForm() method.
|
// TODO: Implement buildForm() method.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -80,7 +96,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
return ['export_avg_activity_visit_duration'];
|
return ['export_avg_activity_visit_duration'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
@@ -95,7 +111,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -43,6 +43,21 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -77,7 +92,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
return ['export_count_activity'];
|
return ['export_count_activity'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
@@ -92,7 +107,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -44,6 +44,21 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -78,7 +93,7 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe
|
|||||||
return ['export_count_activity'];
|
return ['export_count_activity'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
@@ -93,7 +108,7 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -43,6 +43,21 @@ class CountPersonsOnActivity implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -77,7 +92,7 @@ class CountPersonsOnActivity implements ExportInterface, GroupedExportInterface
|
|||||||
return ['export_count_activity'];
|
return ['export_count_activity'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
@@ -92,7 +107,7 @@ class CountPersonsOnActivity implements ExportInterface, GroupedExportInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -17,6 +17,7 @@ use Chill\ActivityBundle\Export\Export\ListActivityHelper;
|
|||||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
|
use Chill\MainBundle\Export\Helper\TranslatableStringExportLabelHelper;
|
||||||
use Chill\MainBundle\Export\ListInterface;
|
use Chill\MainBundle\Export\ListInterface;
|
||||||
@@ -38,6 +39,21 @@ final readonly class ListActivity implements ListInterface, GroupedExportInterfa
|
|||||||
$this->helper->buildForm($builder);
|
$this->helper->buildForm($builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -73,7 +89,7 @@ final readonly class ListActivity implements ListInterface, GroupedExportInterfa
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
array_merge(
|
array_merge(
|
||||||
@@ -85,25 +101,23 @@ final readonly class ListActivity implements ListInterface, GroupedExportInterfa
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $this->helper->getResult($query, $data);
|
return $this->helper->getResult($query, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return ListActivityHelper::MSG_KEY.'List activity linked to a course';
|
return ListActivityHelper::MSG_KEY.'List activity linked to a course';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getType()
|
public function getType(): string
|
||||||
{
|
{
|
||||||
return $this->helper->getType();
|
return $this->helper->getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
|
||||||
|
|
||||||
$qb = $this->entityManager->createQueryBuilder();
|
$qb = $this->entityManager->createQueryBuilder();
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
@@ -114,7 +128,7 @@ final readonly class ListActivity implements ListInterface, GroupedExportInterfa
|
|||||||
->leftJoin('acppart.person', 'person')
|
->leftJoin('acppart.person', 'person')
|
||||||
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL');
|
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL');
|
||||||
|
|
||||||
$this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $data);
|
$this->filterListAccompanyingPeriodHelper->addFilterAccompanyingPeriods($qb, $requiredModifiers, $acl, $context->byUser, $data);
|
||||||
|
|
||||||
$qb
|
$qb
|
||||||
// some grouping are necessary
|
// some grouping are necessary
|
||||||
|
@@ -40,9 +40,21 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
{
|
{
|
||||||
// TODO: Implement buildForm() method.
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
@@ -79,7 +91,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
return ['export_sum_activity_duration'];
|
return ['export_sum_activity_duration'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
@@ -94,7 +106,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -40,9 +40,21 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
{
|
{
|
||||||
// TODO: Implement buildForm() method.
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
@@ -79,7 +91,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
return ['export_sum_activity_visit_duration'];
|
return ['export_sum_activity_visit_duration'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
@@ -94,7 +106,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -35,6 +35,21 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -64,17 +79,17 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
return static fn ($value) => '_header' === $value ? 'Number of activities linked to a person' : $value;
|
return static fn ($value) => '_header' === $value ? 'Number of activities linked to a person' : $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['export_count_activity'];
|
return ['export_count_activity'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Count activities linked to a person';
|
return 'Count activities linked to a person';
|
||||||
}
|
}
|
||||||
@@ -84,7 +99,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -36,6 +36,21 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -65,17 +80,17 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe
|
|||||||
return static fn ($value) => '_header' === $value ? 'export.export.count_household_on_activity_person.header' : $value;
|
return static fn ($value) => '_header' === $value ? 'export.export.count_household_on_activity_person.header' : $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['export_count_activity'];
|
return ['export_count_activity'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.export.count_household_on_activity_person.title';
|
return 'export.export.count_household_on_activity_person.title';
|
||||||
}
|
}
|
||||||
@@ -85,7 +100,7 @@ final readonly class CountHouseholdOnActivity implements ExportInterface, Groupe
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -78,6 +78,21 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['fields' => $formData['fields']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['fields' => $formData['fields']];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -167,17 +182,17 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return $data['fields'];
|
return $data['fields'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'List activity linked to a person';
|
return 'List activity linked to a person';
|
||||||
}
|
}
|
||||||
@@ -187,7 +202,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
|
@@ -49,6 +49,21 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder) {}
|
public function buildForm(FormBuilderInterface $builder) {}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
@@ -84,17 +99,17 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
return static fn (string $value) => '_header' === $value ? $header : $value;
|
return static fn (string $value) => '_header' === $value ? $header : $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryKeys($data)
|
public function getQueryKeys($data): array
|
||||||
{
|
{
|
||||||
return ['export_stat_activity'];
|
return ['export_stat_activity'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResult($query, $data)
|
public function getResult($query, $data, \Chill\MainBundle\Export\ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
if (self::SUM === $this->action) {
|
if (self::SUM === $this->action) {
|
||||||
return 'Sum activity linked to a person duration';
|
return 'Sum activity linked to a person duration';
|
||||||
@@ -108,7 +123,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data, \Chill\MainBundle\Export\ExportGenerationContext $context): \Doctrine\ORM\QueryBuilder
|
||||||
{
|
{
|
||||||
$centers = array_map(
|
$centers = array_map(
|
||||||
static fn (array $el): Center => $el['center'],
|
static fn (array $el): Center => $el['center'],
|
||||||
|
@@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
|||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||||
@@ -25,6 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
final readonly class ActivityTypeFilter implements FilterInterface
|
final readonly class ActivityTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
private const BASE_EXISTS = 'SELECT 1 FROM '.Activity::class.' act_type_filter_activity WHERE act_type_filter_activity.accompanyingPeriod = acp';
|
private const BASE_EXISTS = 'SELECT 1 FROM '.Activity::class.' act_type_filter_activity WHERE act_type_filter_activity.accompanyingPeriod = acp';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -38,7 +40,7 @@ final readonly class ActivityTypeFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$exists = self::BASE_EXISTS;
|
$exists = self::BASE_EXISTS;
|
||||||
|
|
||||||
@@ -62,12 +64,12 @@ final readonly class ActivityTypeFilter implements FilterInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACP_TYPE;
|
return Declarations::ACP_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_activitytypes', EntityType::class, [
|
$builder->add('accepted_activitytypes', EntityType::class, [
|
||||||
'class' => ActivityType::class,
|
'class' => ActivityType::class,
|
||||||
@@ -92,6 +94,21 @@ final readonly class ActivityTypeFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_activitytypes' => $this->normalizeDoctrineEntity($formData['accepted_activitytypes']), 'date_after' => $formData['date_after']?->normalize(), 'date_before' => $formData['date_before']?->normalize()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_activitytypes' => $this->denormalizeDoctrineEntity($formData['accepted_activitytypes'], $this->activityTypeRepository), 'date_after' => \Chill\MainBundle\Service\RollingDate\RollingDate::fromNormalized($formData['date_after']), 'date_before' => \Chill\MainBundle\Service\RollingDate\RollingDate::fromNormalized($formData['date_before'])];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -101,7 +118,7 @@ final readonly class ActivityTypeFilter implements FilterInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$types = [];
|
$types = [];
|
||||||
|
|
||||||
|
@@ -12,23 +12,28 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||||
use Chill\PersonBundle\Form\Type\PickSocialActionType;
|
use Chill\PersonBundle\Form\Type\PickSocialActionType;
|
||||||
|
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
||||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class BySocialActionFilter implements FilterInterface
|
class BySocialActionFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly SocialActionRender $actionRender) {}
|
use ExportDataNormalizerTrait;
|
||||||
|
|
||||||
|
public function __construct(private readonly SocialActionRender $actionRender, private readonly SocialActionRepository $socialActionRepository) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('actsocialaction', $qb->getAllAliases(), true)) {
|
if (!\in_array('actsocialaction', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('activity.socialActions', 'actsocialaction');
|
$qb->join('activity.socialActions', 'actsocialaction');
|
||||||
@@ -48,19 +53,36 @@ class BySocialActionFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY_ACP;
|
return Declarations::ACTIVITY_ACP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_socialactions', PickSocialActionType::class, [
|
$builder->add('accepted_socialactions', PickSocialActionType::class, [
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getNormalizationVersion(): int
|
||||||
{
|
{
|
||||||
return [];
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_socialactions' => $this->normalizeDoctrineEntity($formData['accepted_socialactions'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_socialactions' => $this->denormalizeDoctrineEntity($formData['accepted_socialactions'], $this->socialActionRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormDefaultData(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'accepted_socialactions' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$actions = [];
|
$actions = [];
|
||||||
|
|
||||||
|
@@ -12,23 +12,28 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||||
use Chill\PersonBundle\Form\Type\PickSocialIssueType;
|
use Chill\PersonBundle\Form\Type\PickSocialIssueType;
|
||||||
|
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class BySocialIssueFilter implements FilterInterface
|
class BySocialIssueFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly SocialIssueRender $issueRender) {}
|
use ExportDataNormalizerTrait;
|
||||||
|
|
||||||
|
public function __construct(private readonly SocialIssueRender $issueRender, private readonly SocialIssueRepository $issueRepository) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('actsocialissue', $qb->getAllAliases(), true)) {
|
if (!\in_array('actsocialissue', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('activity.socialIssues', 'actsocialissue');
|
$qb->join('activity.socialIssues', 'actsocialissue');
|
||||||
@@ -48,19 +53,34 @@ class BySocialIssueFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY_ACP;
|
return Declarations::ACTIVITY_ACP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_socialissues', PickSocialIssueType::class, [
|
$builder->add('accepted_socialissues', PickSocialIssueType::class, [
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_socialissues' => $this->normalizeDoctrineEntity($formData['accepted_socialissues'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_socialissues' => $this->denormalizeDoctrineEntity($formData['accepted_socialissues'], $this->issueRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$issues = [];
|
$issues = [];
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@@ -27,7 +28,7 @@ class HasNoActivityFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb
|
$qb
|
||||||
->andWhere('
|
->andWhere('
|
||||||
@@ -43,17 +44,32 @@ class HasNoActivityFilter implements FilterInterface
|
|||||||
return Declarations::ACP_TYPE;
|
return Declarations::ACP_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
// no form needed
|
// no form needed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return ['Filtered acp which has no activities', []];
|
return ['Filtered acp which has no activities', []];
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
@@ -25,12 +26,12 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
|
|||||||
private RollingDateConverterInterface $rollingDateConverter,
|
private RollingDateConverterInterface $rollingDateConverter,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.filter.activity.course_having_activity_between_date.Title';
|
return 'export.filter.activity.course_having_activity_between_date.Title';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('start_date', PickRollingDateType::class, [
|
->add('start_date', PickRollingDateType::class, [
|
||||||
@@ -41,6 +42,21 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['start_date' => $formData['start_date']->normalize(), 'end_date' => $formData['end_date']->normalize()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['start_date' => RollingDate::fromNormalized($formData['start_date']), 'end_date' => RollingDate::fromNormalized($formData['end_date'])];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -49,7 +65,7 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, ExportGenerationContext $context): string|\Symfony\Contracts\Translation\TranslatableInterface|array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'export.filter.activity.course_having_activity_between_date.Only course having an activity between from and to',
|
'export.filter.activity.course_having_activity_between_date.Only course having an activity between from and to',
|
||||||
@@ -65,7 +81,7 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$alias = 'act_period_having_act_betw_date_alias';
|
$alias = 'act_period_having_act_betw_date_alias';
|
||||||
$from = 'act_period_having_act_betw_date_start';
|
$from = 'act_period_having_act_betw_date_start';
|
||||||
@@ -82,7 +98,7 @@ final readonly class PeriodHavingActivityBetweenDatesFilter implements FilterInt
|
|||||||
->setParameter($to, $this->rollingDateConverter->convert($data['end_date']));
|
->setParameter($to, $this->rollingDateConverter->convert($data['end_date']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return \Chill\PersonBundle\Export\Declarations::ACP_TYPE;
|
return \Chill\PersonBundle\Export\Declarations::ACP_TYPE;
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter;
|
namespace Chill\ActivityBundle\Export\Filter;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
@@ -30,7 +31,7 @@ class ActivityDateFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$where = $qb->getDQLPart('where');
|
$where = $qb->getDQLPart('where');
|
||||||
$clause = $qb->expr()->between(
|
$clause = $qb->expr()->between(
|
||||||
@@ -61,7 +62,7 @@ class ActivityDateFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('date_from', PickRollingDateType::class, [
|
->add('date_from', PickRollingDateType::class, [
|
||||||
@@ -72,12 +73,27 @@ class ActivityDateFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['date_from' => $formData['date_from']->normalize(), 'date_to' => $formData['date_to']->normalize()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['date_from' => RollingDate::fromNormalized($formData['date_from']), 'date_to' => RollingDate::fromNormalized($formData['date_to'])];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)];
|
return ['date_from' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'date_to' => new RollingDate(RollingDate::T_TODAY)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, ExportGenerationContext $context): string|\Symfony\Contracts\Translation\TranslatableInterface|array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'Filtered by date of activity: only between %date_from% and %date_to%',
|
'Filtered by date of activity: only between %date_from% and %date_to%',
|
||||||
@@ -88,7 +104,7 @@ class ActivityDateFilter implements FilterInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Filtered by date activity';
|
return 'Filtered by date activity';
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,8 @@ namespace Chill\ActivityBundle\Export\Filter;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\ActivityBundle\Repository\ActivityPresenceRepositoryInterface;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
@@ -23,17 +25,20 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
final readonly class ActivityPresenceFilter implements FilterInterface
|
final readonly class ActivityPresenceFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private TranslatableStringHelperInterface $translatableStringHelper,
|
private TranslatableStringHelperInterface $translatableStringHelper,
|
||||||
private TranslatorInterface $translator,
|
private TranslatorInterface $translator,
|
||||||
|
private ActivityPresenceRepositoryInterface $activityPresenceRepository,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.filter.activity.by_presence.Filter activity by activity presence';
|
return 'export.filter.activity.by_presence.Filter activity by activity presence';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('presences', EntityType::class, [
|
$builder->add('presences', EntityType::class, [
|
||||||
'class' => ActivityPresence::class,
|
'class' => ActivityPresence::class,
|
||||||
@@ -45,12 +50,27 @@ final readonly class ActivityPresenceFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['presences' => $this->normalizeDoctrineEntity($formData['presences'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['presences' => $this->denormalizeDoctrineEntity($formData['presences'], $this->activityPresenceRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, ExportGenerationContext $context): string|\Symfony\Contracts\Translation\TranslatableInterface|array
|
||||||
{
|
{
|
||||||
$presences = array_map(
|
$presences = array_map(
|
||||||
fn (ActivityPresence $presence) => $this->translatableStringHelper->localize($presence->getName()),
|
fn (ActivityPresence $presence) => $this->translatableStringHelper->localize($presence->getName()),
|
||||||
@@ -68,14 +88,14 @@ final readonly class ActivityPresenceFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb
|
$qb
|
||||||
->andWhere('activity.attendee IN (:activity_presence_filter_presences)')
|
->andWhere('activity.attendee IN (:activity_presence_filter_presences)')
|
||||||
->setParameter('activity_presence_filter_presences', $data['presences']);
|
->setParameter('activity_presence_filter_presences', $data['presences']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\ActivityType;
|
|||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
use Chill\ActivityBundle\Repository\ActivityTypeRepositoryInterface;
|
||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@@ -24,6 +25,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||||||
|
|
||||||
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected TranslatableStringHelperInterface $translatableStringHelper,
|
protected TranslatableStringHelperInterface $translatableStringHelper,
|
||||||
protected ActivityTypeRepositoryInterface $activityTypeRepository,
|
protected ActivityTypeRepositoryInterface $activityTypeRepository,
|
||||||
@@ -34,7 +37,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$clause = $qb->expr()->in('activity.activityType', ':selected_activity_types');
|
$clause = $qb->expr()->in('activity.activityType', ':selected_activity_types');
|
||||||
|
|
||||||
@@ -47,7 +50,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('types', EntityType::class, [
|
$builder->add('types', EntityType::class, [
|
||||||
'choices' => $this->activityTypeRepository->findAllActive(),
|
'choices' => $this->activityTypeRepository->findAllActive(),
|
||||||
@@ -70,12 +73,27 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['types' => $this->normalizeDoctrineEntity($formData['types'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['types' => $this->denormalizeDoctrineEntity($formData['types'], $this->activityTypeRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, ExportGenerationContext $context): string|\Symfony\Contracts\Translation\TranslatableInterface|array
|
||||||
{
|
{
|
||||||
// collect all the reasons'name used in this filter in one array
|
// collect all the reasons'name used in this filter in one array
|
||||||
$reasonsNames = array_map(
|
$reasonsNames = array_map(
|
||||||
@@ -88,12 +106,12 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
|||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Filter by activity type';
|
return 'Filter by activity type';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateForm($data, ExecutionContextInterface $context)
|
public function validateForm($data, ExecutionContextInterface $context): void
|
||||||
{
|
{
|
||||||
if (null === $data['types'] || 0 === \count($data['types'])) {
|
if (null === $data['types'] || 0 === \count($data['types'])) {
|
||||||
$context
|
$context
|
||||||
|
@@ -12,26 +12,30 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter;
|
namespace Chill\ActivityBundle\Export\Filter;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
use Chill\MainBundle\Form\Type\PickUserOrMeDynamicType;
|
||||||
|
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class ActivityUsersFilter implements FilterInterface
|
final readonly class ActivityUsersFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly UserRender $userRender) {}
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
|
||||||
|
public function __construct(private UserRender $userRender, private UserRepositoryInterface $userRepository) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$orX = $qb->expr()->orX();
|
$orX = $qb->expr()->orX();
|
||||||
|
|
||||||
foreach ($data['accepted_users'] as $key => $user) {
|
foreach ($this->userOrMe($data['accepted_users'], $exportGenerationContext) as $key => $user) {
|
||||||
$orX->add($qb->expr()->isMemberOf(':activity_users_filter_u'.$key, 'activity.users'));
|
$orX->add($qb->expr()->isMemberOf(':activity_users_filter_u'.$key, 'activity.users'));
|
||||||
$qb->setParameter('activity_users_filter_u'.$key, $user);
|
$qb->setParameter('activity_users_filter_u'.$key, $user);
|
||||||
}
|
}
|
||||||
@@ -39,29 +43,44 @@ class ActivityUsersFilter implements FilterInterface
|
|||||||
$qb->andWhere($orX);
|
$qb->andWhere($orX);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_users', PickUserDynamicType::class, [
|
$builder->add('accepted_users', PickUserOrMeDynamicType::class, [
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'label' => 'Users',
|
'label' => 'Users',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_users' => $this->normalizeUserOrMe($formData['accepted_users'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_users' => $this->denormalizeUserOrMe($formData['accepted_users'], $this->userRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, ExportGenerationContext $context): string|\Symfony\Contracts\Translation\TranslatableInterface|array
|
||||||
{
|
{
|
||||||
$users = [];
|
$users = [];
|
||||||
|
|
||||||
foreach ($data['accepted_users'] as $u) {
|
foreach ($this->userOrMe($data['accepted_users'], $context) as $u) {
|
||||||
$users[] = $this->userRender->renderString($u, []);
|
$users[] = $this->userRender->renderString($u, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,28 +12,32 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter;
|
namespace Chill\ActivityBundle\Export\Filter;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
use Chill\MainBundle\Form\Type\PickUserOrMeDynamicType;
|
||||||
|
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class ByCreatorFilter implements FilterInterface
|
class ByCreatorFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly UserRender $userRender) {}
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
|
||||||
|
public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb
|
$qb
|
||||||
->andWhere(
|
->andWhere(
|
||||||
$qb->expr()->in('activity.createdBy', ':users')
|
$qb->expr()->in('activity.createdBy', ':users')
|
||||||
)
|
)
|
||||||
->setParameter('users', $data['accepted_users']);
|
->setParameter('users', $this->userOrMe($data['accepted_users'], $exportGenerationContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@@ -41,23 +45,38 @@ class ByCreatorFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_users', PickUserDynamicType::class, [
|
$builder->add('accepted_users', PickUserOrMeDynamicType::class, [
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_users' => $this->normalizeUserOrMe($formData['accepted_users'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_users' => $this->denormalizeUserOrMe($formData['accepted_users'], $this->userRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$users = [];
|
$users = [];
|
||||||
|
|
||||||
foreach ($data['accepted_users'] as $u) {
|
foreach ($this->userOrMe($data['accepted_users'], $context) as $u) {
|
||||||
$users[] = $this->userRender->renderString($u, []);
|
$users[] = $this->userRender->renderString($u, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Filter;
|
|||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\MainBundle\Entity\User\UserJobHistory;
|
use Chill\MainBundle\Entity\User\UserJobHistory;
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
|
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
@@ -26,6 +27,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
final readonly class CreatorJobFilter implements FilterInterface
|
final readonly class CreatorJobFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
private const PREFIX = 'acp_act_filter_creator_job';
|
private const PREFIX = 'acp_act_filter_creator_job';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -39,7 +41,7 @@ final readonly class CreatorJobFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -75,7 +77,7 @@ final readonly class CreatorJobFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('jobs', EntityType::class, [
|
->add('jobs', EntityType::class, [
|
||||||
@@ -90,7 +92,22 @@ final readonly class CreatorJobFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['jobs' => $this->normalizeDoctrineEntity($formData['jobs'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->userJobRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$jobs = array_map(
|
$jobs = array_map(
|
||||||
fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()),
|
fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()),
|
||||||
|
@@ -14,6 +14,7 @@ namespace Chill\ActivityBundle\Export\Filter;
|
|||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User\UserScopeHistory;
|
use Chill\MainBundle\Entity\User\UserScopeHistory;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
@@ -24,6 +25,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class CreatorScopeFilter implements FilterInterface
|
class CreatorScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
private const PREFIX = 'acp_act_filter_creator_scope';
|
private const PREFIX = 'acp_act_filter_creator_scope';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -36,7 +38,7 @@ class CreatorScopeFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -72,7 +74,7 @@ class CreatorScopeFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('scopes', EntityType::class, [
|
->add('scopes', EntityType::class, [
|
||||||
@@ -86,7 +88,22 @@ class CreatorScopeFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['scopes' => $this->normalizeDoctrineEntity($formData['scopes'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->scopeRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$scopes = [];
|
$scopes = [];
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter;
|
namespace Chill\ActivityBundle\Export\Filter;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
use Doctrine\ORM\Query\Expr\Andx;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@@ -35,7 +36,7 @@ class EmergencyFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$where = $qb->getDQLPart('where');
|
$where = $qb->getDQLPart('where');
|
||||||
|
|
||||||
@@ -56,7 +57,7 @@ class EmergencyFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_emergency', ChoiceType::class, [
|
$builder->add('accepted_emergency', ChoiceType::class, [
|
||||||
'choices' => self::CHOICES,
|
'choices' => self::CHOICES,
|
||||||
@@ -66,12 +67,27 @@ class EmergencyFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_emergency' => $formData['accepted_emergency']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_emergency' => $formData['accepted_emergency']];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return ['accepted_emergency' => self::DEFAULT_CHOICE];
|
return ['accepted_emergency' => self::DEFAULT_CHOICE];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'Filtered by emergency: only %emergency%', [
|
'Filtered by emergency: only %emergency%', [
|
||||||
|
@@ -12,19 +12,27 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter;
|
namespace Chill\ActivityBundle\Export\Filter;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserLocationType;
|
use Chill\MainBundle\Form\Type\PickUserLocationType;
|
||||||
|
use Chill\MainBundle\Repository\LocationRepository;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class LocationFilter implements FilterInterface
|
final readonly class LocationFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private LocationRepository $locationRepository,
|
||||||
|
) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$qb->andWhere(
|
$qb->andWhere(
|
||||||
$qb->expr()->in('activity.location', ':location')
|
$qb->expr()->in('activity.location', ':location')
|
||||||
@@ -38,7 +46,7 @@ class LocationFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_location', PickUserLocationType::class, [
|
$builder->add('accepted_location', PickUserLocationType::class, [
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
@@ -46,12 +54,27 @@ class LocationFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_location' => $this->normalizeDoctrineEntity($formData['accepted_location'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_location' => $this->denormalizeDoctrineEntity($formData['accepted_location'], $this->locationRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$locations = [];
|
$locations = [];
|
||||||
|
|
||||||
|
@@ -12,8 +12,11 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter;
|
namespace Chill\ActivityBundle\Export\Filter;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickLocationTypeType;
|
use Chill\MainBundle\Form\Type\PickLocationTypeType;
|
||||||
|
use Chill\MainBundle\Repository\LocationTypeRepository;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
use Doctrine\ORM\Query\Expr\Andx;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@@ -21,14 +24,16 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class LocationTypeFilter implements FilterInterface
|
class LocationTypeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper) {}
|
use ExportDataNormalizerTrait;
|
||||||
|
|
||||||
|
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private LocationTypeRepository $locationTypeRepository) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
if (!\in_array('actloc', $qb->getAllAliases(), true)) {
|
if (!\in_array('actloc', $qb->getAllAliases(), true)) {
|
||||||
$qb->join('activity.location', 'actloc');
|
$qb->join('activity.location', 'actloc');
|
||||||
@@ -52,7 +57,7 @@ class LocationTypeFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_locationtype', PickLocationTypeType::class, [
|
$builder->add('accepted_locationtype', PickLocationTypeType::class, [
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
@@ -60,12 +65,27 @@ class LocationTypeFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getNormalizationVersion(): int
|
||||||
{
|
{
|
||||||
return [];
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_locationtype' => $this->normalizeDoctrineEntity($formData['accepted_locationtype'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_locationtype' => $this->denormalizeDoctrineEntity($formData['accepted_locationtype'], $this->locationTypeRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFormDefaultData(): array
|
||||||
|
{
|
||||||
|
return ['accepted_locationtype' => []];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$types = [];
|
$types = [];
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\ActivityReason;
|
|||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
@@ -26,6 +27,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||||||
|
|
||||||
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
|
||||||
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository) {}
|
public function __construct(protected TranslatableStringHelper $translatableStringHelper, protected ActivityReasonRepository $activityReasonRepository) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
@@ -33,7 +36,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$where = $qb->getDQLPart('where');
|
$where = $qb->getDQLPart('where');
|
||||||
$join = $qb->getDQLPart('join');
|
$join = $qb->getDQLPart('join');
|
||||||
@@ -58,7 +61,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
|||||||
return Declarations::ACTIVITY_PERSON;
|
return Declarations::ACTIVITY_PERSON;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('reasons', EntityType::class, [
|
$builder->add('reasons', EntityType::class, [
|
||||||
'class' => ActivityReason::class,
|
'class' => ActivityReason::class,
|
||||||
@@ -70,12 +73,27 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['reasons' => $this->normalizeDoctrineEntity($formData['reasons'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['reasons' => $this->denormalizeDoctrineEntity($formData['reasons'], $this->activityReasonRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, ExportGenerationContext $context): string|\Symfony\Contracts\Translation\TranslatableInterface|array
|
||||||
{
|
{
|
||||||
// collect all the reasons'name used in this filter in one array
|
// collect all the reasons'name used in this filter in one array
|
||||||
$reasonsNames = array_map(
|
$reasonsNames = array_map(
|
||||||
@@ -91,12 +109,12 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'Filter by reason';
|
return 'Filter by reason';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateForm($data, ExecutionContextInterface $context)
|
public function validateForm($data, ExecutionContextInterface $context): void
|
||||||
{
|
{
|
||||||
if (null === $data['reasons'] || 0 === \count($data['reasons'])) {
|
if (null === $data['reasons'] || 0 === \count($data['reasons'])) {
|
||||||
$context
|
$context
|
||||||
|
@@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\Activity;
|
|||||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||||
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
@@ -39,7 +40,7 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data): void
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
// create a subquery for activity
|
// create a subquery for activity
|
||||||
$sqb = $qb->getEntityManager()->createQueryBuilder();
|
$sqb = $qb->getEntityManager()->createQueryBuilder();
|
||||||
@@ -92,7 +93,7 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem
|
|||||||
return Declarations::PERSON_TYPE;
|
return Declarations::PERSON_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('date_from_rolling', PickRollingDateType::class, [
|
$builder->add('date_from_rolling', PickRollingDateType::class, [
|
||||||
'label' => 'export.filter.activity.person_between_dates.Implied in an activity after this date',
|
'label' => 'export.filter.activity.person_between_dates.Implied in an activity after this date',
|
||||||
@@ -116,6 +117,21 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['date_from_rolling' => $formData['date_from_rolling']->normalize(), 'date_to_rolling' => $formData['date_to_rolling']->normalize()];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['date_from_rolling' => RollingDate::fromNormalized($formData['date_from_rolling']), 'date_to_rolling' => RollingDate::fromNormalized($formData['date_to_rolling'])];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -125,7 +141,7 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[] === $data['reasons'] ?
|
[] === $data['reasons'] ?
|
||||||
@@ -150,7 +166,7 @@ final readonly class PersonHavingActivityBetweenDateFilter implements ExportElem
|
|||||||
return 'export.filter.activity.person_between_dates.title';
|
return 'export.filter.activity.person_between_dates.title';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateForm($data, ExecutionContextInterface $context)
|
public function validateForm($data, ExecutionContextInterface $context): void
|
||||||
{
|
{
|
||||||
if ($this->rollingDateConverter->convert($data['date_from_rolling'])
|
if ($this->rollingDateConverter->convert($data['date_from_rolling'])
|
||||||
>= $this->rollingDateConverter->convert($data['date_to_rolling'])) {
|
>= $this->rollingDateConverter->convert($data['date_to_rolling'])) {
|
||||||
|
@@ -13,6 +13,7 @@ namespace Chill\ActivityBundle\Export\Filter;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\ActivityBundle\Tests\Export\Filter\PersonsFilterTest;
|
use Chill\ActivityBundle\Tests\Export\Filter\PersonsFilterTest;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\PersonBundle\Form\Type\PickPersonDynamicType;
|
use Chill\PersonBundle\Form\Type\PickPersonDynamicType;
|
||||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
|
||||||
@@ -33,7 +34,7 @@ final readonly class PersonsFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -47,12 +48,12 @@ final readonly class PersonsFilter implements FilterInterface
|
|||||||
$qb->andWhere($orX);
|
$qb->andWhere($orX);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_persons', PickPersonDynamicType::class, [
|
$builder->add('accepted_persons', PickPersonDynamicType::class, [
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
@@ -60,6 +61,21 @@ final readonly class PersonsFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_persons' => $formData['accepted_persons']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_persons' => $formData['accepted_persons']];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -67,7 +83,7 @@ final readonly class PersonsFilter implements FilterInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function describeAction($data, ExportGenerationContext $context): string|\Symfony\Contracts\Translation\TranslatableInterface|array
|
||||||
{
|
{
|
||||||
$users = [];
|
$users = [];
|
||||||
|
|
||||||
|
@@ -13,6 +13,7 @@ namespace Chill\ActivityBundle\Export\Filter;
|
|||||||
|
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
use Doctrine\ORM\Query\Expr\Andx;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
@@ -36,7 +37,7 @@ class SentReceivedFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$where = $qb->getDQLPart('where');
|
$where = $qb->getDQLPart('where');
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ class SentReceivedFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_sentreceived', ChoiceType::class, [
|
$builder->add('accepted_sentreceived', ChoiceType::class, [
|
||||||
'choices' => self::CHOICES,
|
'choices' => self::CHOICES,
|
||||||
@@ -68,12 +69,27 @@ class SentReceivedFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_sentreceived' => $formData['accepted_sentreceived']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_sentreceived' => $formData['accepted_sentreceived']];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return ['accepted_sentreceived' => self::DEFAULT_CHOICE];
|
return ['accepted_sentreceived' => self::DEFAULT_CHOICE];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$sentreceived = array_flip(self::CHOICES)[$data['accepted_sentreceived']];
|
$sentreceived = array_flip(self::CHOICES)[$data['accepted_sentreceived']];
|
||||||
|
|
||||||
|
@@ -12,23 +12,27 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Export\Filter;
|
namespace Chill\ActivityBundle\Export\Filter;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
use Chill\MainBundle\Form\Type\PickUserOrMeDynamicType;
|
||||||
|
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||||
use Doctrine\ORM\Query\Expr\Andx;
|
use Doctrine\ORM\Query\Expr\Andx;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class UserFilter implements FilterInterface
|
final readonly class UserFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly UserRender $userRender) {}
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
|
|
||||||
|
public function __construct(private UserRender $userRender, private UserRepositoryInterface $userRepository) {}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$where = $qb->getDQLPart('where');
|
$where = $qb->getDQLPart('where');
|
||||||
|
|
||||||
@@ -41,7 +45,7 @@ class UserFilter implements FilterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$qb->add('where', $where);
|
$qb->add('where', $where);
|
||||||
$qb->setParameter('users', $data['accepted_users']);
|
$qb->setParameter('users', $this->userOrMe($data['accepted_users'], $exportGenerationContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn(): string
|
public function applyOn(): string
|
||||||
@@ -49,24 +53,39 @@ class UserFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder->add('accepted_users', PickUserDynamicType::class, [
|
$builder->add('accepted_users', PickUserOrMeDynamicType::class, [
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'label' => 'Creators',
|
'label' => 'Creators',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['accepted_users' => $this->normalizeUserOrMe($formData['accepted_users'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['accepted_users' => $this->denormalizeUserOrMe($formData['accepted_users'], $this->userRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
public function getFormDefaultData(): array
|
public function getFormDefaultData(): array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
$users = [];
|
$users = [];
|
||||||
|
|
||||||
foreach ($data['accepted_users'] as $u) {
|
foreach ($this->userOrMe($data['accepted_users'], $context) as $u) {
|
||||||
$users[] = $this->userRender->renderString($u, []);
|
$users[] = $this->userRender->renderString($u, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\Activity;
|
|||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\MainBundle\Entity\User\UserJobHistory;
|
use Chill\MainBundle\Entity\User\UserJobHistory;
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
|
use Chill\MainBundle\Repository\UserJobRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
@@ -25,6 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class UsersJobFilter implements FilterInterface
|
class UsersJobFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
private const PREFIX = 'act_filter_user_job';
|
private const PREFIX = 'act_filter_user_job';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -37,7 +39,7 @@ class UsersJobFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -60,12 +62,12 @@ class UsersJobFilter implements FilterInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function applyOn()
|
public function applyOn(): string
|
||||||
{
|
{
|
||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('jobs', EntityType::class, [
|
->add('jobs', EntityType::class, [
|
||||||
@@ -77,7 +79,22 @@ class UsersJobFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string')
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['jobs' => $this->normalizeDoctrineEntity($formData['jobs'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['jobs' => $this->denormalizeDoctrineEntity($formData['jobs'], $this->userJobRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function describeAction($data, ExportGenerationContext $context): string|\Symfony\Contracts\Translation\TranslatableInterface|array
|
||||||
{
|
{
|
||||||
return ['export.filter.activity.by_users_job.Filtered activity by users job: only %jobs%', [
|
return ['export.filter.activity.by_users_job.Filtered activity by users job: only %jobs%', [
|
||||||
'%jobs%' => implode(
|
'%jobs%' => implode(
|
||||||
@@ -97,7 +114,7 @@ class UsersJobFilter implements FilterInterface
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitle()
|
public function getTitle(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||||
{
|
{
|
||||||
return 'export.filter.activity.by_users_job.Filter by users job';
|
return 'export.filter.activity.by_users_job.Filter by users job';
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\Activity;
|
|||||||
use Chill\ActivityBundle\Export\Declarations;
|
use Chill\ActivityBundle\Export\Declarations;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User\UserScopeHistory;
|
use Chill\MainBundle\Entity\User\UserScopeHistory;
|
||||||
|
use Chill\MainBundle\Export\ExportGenerationContext;
|
||||||
use Chill\MainBundle\Export\FilterInterface;
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
@@ -25,6 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
class UsersScopeFilter implements FilterInterface
|
class UsersScopeFilter implements FilterInterface
|
||||||
{
|
{
|
||||||
|
use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
|
||||||
private const PREFIX = 'act_filter_user_scope';
|
private const PREFIX = 'act_filter_user_scope';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -37,7 +39,7 @@ class UsersScopeFilter implements FilterInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alterQuery(QueryBuilder $qb, $data)
|
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
|
||||||
{
|
{
|
||||||
$p = self::PREFIX;
|
$p = self::PREFIX;
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ class UsersScopeFilter implements FilterInterface
|
|||||||
return Declarations::ACTIVITY;
|
return Declarations::ACTIVITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('scopes', EntityType::class, [
|
->add('scopes', EntityType::class, [
|
||||||
@@ -77,7 +79,22 @@ class UsersScopeFilter implements FilterInterface
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function describeAction($data, $format = 'string'): array
|
public function getNormalizationVersion(): int
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function normalizeFormData(array $formData): array
|
||||||
|
{
|
||||||
|
return ['scopes' => $this->normalizeDoctrineEntity($formData['scopes'])];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function denormalizeFormData(array $formData, int $fromVersion): array
|
||||||
|
{
|
||||||
|
return ['scopes' => $this->denormalizeDoctrineEntity($formData['scopes'], $this->scopeRepository)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function describeAction($data, ExportGenerationContext $context): array
|
||||||
{
|
{
|
||||||
return ['export.filter.activity.by_users_scope.Filtered activity by users scope: only %scopes%', [
|
return ['export.filter.activity.by_users_scope.Filtered activity by users scope: only %scopes%', [
|
||||||
'%scopes%' => implode(
|
'%scopes%' => implode(
|
||||||
|
@@ -12,8 +12,9 @@ declare(strict_types=1);
|
|||||||
namespace Chill\ActivityBundle\Repository;
|
namespace Chill\ActivityBundle\Repository;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||||
|
use Doctrine\Persistence\ObjectRepository;
|
||||||
|
|
||||||
interface ActivityPresenceRepositoryInterface
|
interface ActivityPresenceRepositoryInterface extends ObjectRepository
|
||||||
{
|
{
|
||||||
public function find($id): ?ActivityPresence;
|
public function find($id): ?ActivityPresence;
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<concerned-groups v-if="hasPerson" />
|
<concerned-groups v-if="hasPerson" />
|
||||||
<social-issues-acc v-if="hasSocialIssues" />
|
<social-issues-acc v-if="hasSocialIssues" />
|
||||||
<location v-if="hasLocation" />
|
<location v-if="hasLocation" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -10,12 +10,12 @@ import SocialIssuesAcc from "./components/SocialIssuesAcc.vue";
|
|||||||
import Location from "./components/Location.vue";
|
import Location from "./components/Location.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
props: ["hasSocialIssues", "hasLocation", "hasPerson"],
|
props: ["hasSocialIssues", "hasLocation", "hasPerson"],
|
||||||
components: {
|
components: {
|
||||||
ConcernedGroups,
|
ConcernedGroups,
|
||||||
SocialIssuesAcc,
|
SocialIssuesAcc,
|
||||||
Location,
|
Location,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,46 +1,43 @@
|
|||||||
<template>
|
<template>
|
||||||
<teleport to="#add-persons" v-if="isComponentVisible">
|
<teleport to="#add-persons" v-if="isComponentVisible">
|
||||||
<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"
|
||||||
:key="bloc.key"
|
:key="bloc.key"
|
||||||
:bloc="bloc"
|
:bloc="bloc"
|
||||||
:bloc-width="getBlocWidth"
|
:bloc-width="getBlocWidth"
|
||||||
:set-persons-in-bloc="setPersonsInBloc"
|
:set-persons-in-bloc="setPersonsInBloc"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="
|
v-if="getContext === 'accompanyingCourse' && suggestedEntities.length > 0"
|
||||||
getContext === 'accompanyingCourse' &&
|
>
|
||||||
suggestedEntities.length > 0
|
<ul class="list-suggest add-items inline">
|
||||||
"
|
<li
|
||||||
|
v-for="(p, i) in suggestedEntities"
|
||||||
|
@click="addSuggestedEntity(p)"
|
||||||
|
:key="`suggestedEntities-${i}`"
|
||||||
>
|
>
|
||||||
<ul class="list-suggest add-items inline">
|
<person-text v-if="p.type === 'person'" :person="p" />
|
||||||
<li
|
<span v-else>{{ p.text }}</span>
|
||||||
v-for="(p, i) in suggestedEntities"
|
</li>
|
||||||
@click="addSuggestedEntity(p)"
|
</ul>
|
||||||
:key="`suggestedEntities-${i}`"
|
</div>
|
||||||
>
|
|
||||||
<person-text v-if="p.type === 'person'" :person="p" />
|
|
||||||
<span v-else>{{ p.text }}</span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li class="add-persons">
|
<li class="add-persons">
|
||||||
<add-persons
|
<add-persons
|
||||||
:buttonTitle="trans(ACTIVITY_ADD_PERSONS)"
|
:buttonTitle="trans(ACTIVITY_ADD_PERSONS)"
|
||||||
:modalTitle="trans(ACTIVITY_ADD_PERSONS)"
|
:modalTitle="trans(ACTIVITY_ADD_PERSONS)"
|
||||||
v-bind:key="addPersons.key"
|
v-bind:key="addPersons.key"
|
||||||
v-bind:options="addPersonsOptions"
|
v-bind:options="addPersonsOptions"
|
||||||
@addNewPersons="addNewPersons"
|
@addNewPersons="addNewPersons"
|
||||||
ref="addPersons"
|
ref="addPersons"
|
||||||
>
|
>
|
||||||
</add-persons>
|
</add-persons>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</teleport>
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -49,208 +46,208 @@ import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue";
|
|||||||
import PersonsBloc from "./ConcernedGroups/PersonsBloc.vue";
|
import PersonsBloc from "./ConcernedGroups/PersonsBloc.vue";
|
||||||
import PersonText from "ChillPersonAssets/vuejs/_components/Entity/PersonText.vue";
|
import PersonText from "ChillPersonAssets/vuejs/_components/Entity/PersonText.vue";
|
||||||
import {
|
import {
|
||||||
ACTIVITY_BLOC_PERSONS,
|
ACTIVITY_BLOC_PERSONS,
|
||||||
ACTIVITY_BLOC_PERSONS_ASSOCIATED,
|
ACTIVITY_BLOC_PERSONS_ASSOCIATED,
|
||||||
ACTIVITY_BLOC_THIRDPARTY,
|
ACTIVITY_BLOC_THIRDPARTY,
|
||||||
ACTIVITY_BLOC_USERS,
|
ACTIVITY_BLOC_USERS,
|
||||||
ACTIVITY_ADD_PERSONS,
|
ACTIVITY_ADD_PERSONS,
|
||||||
trans,
|
trans,
|
||||||
} from "translator";
|
} from "translator";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ConcernedGroups",
|
name: "ConcernedGroups",
|
||||||
components: {
|
components: {
|
||||||
AddPersons,
|
AddPersons,
|
||||||
PersonsBloc,
|
PersonsBloc,
|
||||||
PersonText,
|
PersonText,
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
return {
|
||||||
|
trans,
|
||||||
|
ACTIVITY_ADD_PERSONS,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
personsBlocs: [
|
||||||
|
{
|
||||||
|
key: "persons",
|
||||||
|
title: trans(ACTIVITY_BLOC_PERSONS),
|
||||||
|
persons: [],
|
||||||
|
included: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "personsAssociated",
|
||||||
|
title: trans(ACTIVITY_BLOC_PERSONS_ASSOCIATED),
|
||||||
|
persons: [],
|
||||||
|
included: window.activity
|
||||||
|
? window.activity.activityType.personsVisible !== 0
|
||||||
|
: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "personsNotAssociated",
|
||||||
|
title: "activity.bloc_persons_not_associated",
|
||||||
|
persons: [],
|
||||||
|
included: window.activity
|
||||||
|
? window.activity.activityType.personsVisible !== 0
|
||||||
|
: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "thirdparty",
|
||||||
|
title: trans(ACTIVITY_BLOC_THIRDPARTY),
|
||||||
|
persons: [],
|
||||||
|
included: window.activity
|
||||||
|
? window.activity.activityType.thirdPartiesVisible !== 0
|
||||||
|
: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "users",
|
||||||
|
title: trans(ACTIVITY_BLOC_USERS),
|
||||||
|
persons: [],
|
||||||
|
included: window.activity
|
||||||
|
? window.activity.activityType.usersVisible !== 0
|
||||||
|
: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
addPersons: {
|
||||||
|
key: "activity",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isComponentVisible() {
|
||||||
|
return window.activity
|
||||||
|
? window.activity.activityType.personsVisible !== 0 ||
|
||||||
|
window.activity.activityType.thirdPartiesVisible !== 0 ||
|
||||||
|
window.activity.activityType.usersVisible !== 0
|
||||||
|
: true;
|
||||||
},
|
},
|
||||||
setup() {
|
...mapState({
|
||||||
return {
|
persons: (state) => state.activity.persons,
|
||||||
trans,
|
thirdParties: (state) => state.activity.thirdParties,
|
||||||
ACTIVITY_ADD_PERSONS,
|
users: (state) => state.activity.users,
|
||||||
};
|
accompanyingCourse: (state) => state.activity.accompanyingPeriod,
|
||||||
|
}),
|
||||||
|
...mapGetters(["suggestedEntities"]),
|
||||||
|
getContext() {
|
||||||
|
return this.accompanyingCourse ? "accompanyingCourse" : "person";
|
||||||
},
|
},
|
||||||
data() {
|
contextPersonsBlocs() {
|
||||||
return {
|
return this.personsBlocs.filter((bloc) => bloc.included !== false);
|
||||||
personsBlocs: [
|
|
||||||
{
|
|
||||||
key: "persons",
|
|
||||||
title: trans(ACTIVITY_BLOC_PERSONS),
|
|
||||||
persons: [],
|
|
||||||
included: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "personsAssociated",
|
|
||||||
title: trans(ACTIVITY_BLOC_PERSONS_ASSOCIATED),
|
|
||||||
persons: [],
|
|
||||||
included: window.activity
|
|
||||||
? window.activity.activityType.personsVisible !== 0
|
|
||||||
: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "personsNotAssociated",
|
|
||||||
title: "activity.bloc_persons_not_associated",
|
|
||||||
persons: [],
|
|
||||||
included: window.activity
|
|
||||||
? window.activity.activityType.personsVisible !== 0
|
|
||||||
: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "thirdparty",
|
|
||||||
title: trans(ACTIVITY_BLOC_THIRDPARTY),
|
|
||||||
persons: [],
|
|
||||||
included: window.activity
|
|
||||||
? window.activity.activityType.thirdPartiesVisible !== 0
|
|
||||||
: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: "users",
|
|
||||||
title: trans(ACTIVITY_BLOC_USERS),
|
|
||||||
persons: [],
|
|
||||||
included: window.activity
|
|
||||||
? window.activity.activityType.usersVisible !== 0
|
|
||||||
: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
addPersons: {
|
|
||||||
key: "activity",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
computed: {
|
addPersonsOptions() {
|
||||||
isComponentVisible() {
|
let optionsType = [];
|
||||||
return window.activity
|
if (window.activity) {
|
||||||
? window.activity.activityType.personsVisible !== 0 ||
|
if (window.activity.activityType.personsVisible !== 0) {
|
||||||
window.activity.activityType.thirdPartiesVisible !== 0 ||
|
optionsType.push("person");
|
||||||
window.activity.activityType.usersVisible !== 0
|
}
|
||||||
: true;
|
if (window.activity.activityType.thirdPartiesVisible !== 0) {
|
||||||
},
|
optionsType.push("thirdparty");
|
||||||
...mapState({
|
}
|
||||||
persons: (state) => state.activity.persons,
|
if (window.activity.activityType.usersVisible !== 0) {
|
||||||
thirdParties: (state) => state.activity.thirdParties,
|
optionsType.push("user");
|
||||||
users: (state) => state.activity.users,
|
}
|
||||||
accompanyingCourse: (state) => state.activity.accompanyingPeriod,
|
} else {
|
||||||
}),
|
optionsType = ["person", "thirdparty", "user"];
|
||||||
...mapGetters(["suggestedEntities"]),
|
}
|
||||||
getContext() {
|
return {
|
||||||
return this.accompanyingCourse ? "accompanyingCourse" : "person";
|
type: optionsType,
|
||||||
},
|
priority: null,
|
||||||
contextPersonsBlocs() {
|
uniq: false,
|
||||||
return this.personsBlocs.filter((bloc) => bloc.included !== false);
|
button: {
|
||||||
},
|
size: "btn-sm",
|
||||||
addPersonsOptions() {
|
|
||||||
let optionsType = [];
|
|
||||||
if (window.activity) {
|
|
||||||
if (window.activity.activityType.personsVisible !== 0) {
|
|
||||||
optionsType.push("person");
|
|
||||||
}
|
|
||||||
if (window.activity.activityType.thirdPartiesVisible !== 0) {
|
|
||||||
optionsType.push("thirdparty");
|
|
||||||
}
|
|
||||||
if (window.activity.activityType.usersVisible !== 0) {
|
|
||||||
optionsType.push("user");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
optionsType = ["person", "thirdparty", "user"];
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
type: optionsType,
|
|
||||||
priority: null,
|
|
||||||
uniq: false,
|
|
||||||
button: {
|
|
||||||
size: "btn-sm",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
getBlocWidth() {
|
|
||||||
return Math.round(100 / this.contextPersonsBlocs.length) + "%";
|
|
||||||
},
|
},
|
||||||
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
getBlocWidth() {
|
||||||
this.setPersonsInBloc();
|
return Math.round(100 / this.contextPersonsBlocs.length) + "%";
|
||||||
},
|
},
|
||||||
methods: {
|
},
|
||||||
setPersonsInBloc() {
|
mounted() {
|
||||||
let groups;
|
this.setPersonsInBloc();
|
||||||
if (this.accompanyingCourse) {
|
},
|
||||||
groups = this.splitPersonsInGroups();
|
methods: {
|
||||||
}
|
setPersonsInBloc() {
|
||||||
this.personsBlocs.forEach((bloc) => {
|
let groups;
|
||||||
if (this.accompanyingCourse) {
|
if (this.accompanyingCourse) {
|
||||||
switch (bloc.key) {
|
groups = this.splitPersonsInGroups();
|
||||||
case "personsAssociated":
|
}
|
||||||
bloc.persons = groups.personsAssociated;
|
this.personsBlocs.forEach((bloc) => {
|
||||||
bloc.included = true;
|
if (this.accompanyingCourse) {
|
||||||
break;
|
switch (bloc.key) {
|
||||||
case "personsNotAssociated":
|
case "personsAssociated":
|
||||||
bloc.persons = groups.personsNotAssociated;
|
bloc.persons = groups.personsAssociated;
|
||||||
bloc.included = true;
|
bloc.included = true;
|
||||||
break;
|
break;
|
||||||
}
|
case "personsNotAssociated":
|
||||||
} else {
|
bloc.persons = groups.personsNotAssociated;
|
||||||
switch (bloc.key) {
|
bloc.included = true;
|
||||||
case "persons":
|
break;
|
||||||
bloc.persons = this.persons;
|
}
|
||||||
bloc.included = true;
|
} else {
|
||||||
break;
|
switch (bloc.key) {
|
||||||
}
|
case "persons":
|
||||||
}
|
bloc.persons = this.persons;
|
||||||
switch (bloc.key) {
|
bloc.included = true;
|
||||||
case "thirdparty":
|
break;
|
||||||
bloc.persons = this.thirdParties;
|
}
|
||||||
break;
|
}
|
||||||
case "users":
|
switch (bloc.key) {
|
||||||
bloc.persons = this.users;
|
case "thirdparty":
|
||||||
break;
|
bloc.persons = this.thirdParties;
|
||||||
}
|
break;
|
||||||
}, groups);
|
case "users":
|
||||||
},
|
bloc.persons = this.users;
|
||||||
splitPersonsInGroups() {
|
break;
|
||||||
let personsAssociated = [];
|
}
|
||||||
let personsNotAssociated = this.persons;
|
}, groups);
|
||||||
let participations = this.getCourseParticipations();
|
|
||||||
this.persons.forEach((person) => {
|
|
||||||
participations.forEach((participation) => {
|
|
||||||
if (person.id === participation.id) {
|
|
||||||
//console.log(person.id);
|
|
||||||
personsAssociated.push(person);
|
|
||||||
personsNotAssociated = personsNotAssociated.filter(
|
|
||||||
(p) => p !== person,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
personsAssociated: personsAssociated,
|
|
||||||
personsNotAssociated: personsNotAssociated,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
getCourseParticipations() {
|
|
||||||
let participations = [];
|
|
||||||
this.accompanyingCourse.participations.forEach((participation) => {
|
|
||||||
if (!participation.endDate) {
|
|
||||||
participations.push(participation.person);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return participations;
|
|
||||||
},
|
|
||||||
addNewPersons({ selected, modal }) {
|
|
||||||
console.log("@@@ CLICK button addNewPersons", selected);
|
|
||||||
selected.forEach((item) => {
|
|
||||||
this.$store.dispatch("addPersonsInvolved", item);
|
|
||||||
}, this);
|
|
||||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
|
||||||
modal.showModal = false;
|
|
||||||
this.setPersonsInBloc();
|
|
||||||
},
|
|
||||||
addSuggestedEntity(person) {
|
|
||||||
this.$store.dispatch("addPersonsInvolved", {
|
|
||||||
result: person,
|
|
||||||
type: "person",
|
|
||||||
});
|
|
||||||
this.setPersonsInBloc();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
splitPersonsInGroups() {
|
||||||
|
let personsAssociated = [];
|
||||||
|
let personsNotAssociated = this.persons;
|
||||||
|
let participations = this.getCourseParticipations();
|
||||||
|
this.persons.forEach((person) => {
|
||||||
|
participations.forEach((participation) => {
|
||||||
|
if (person.id === participation.id) {
|
||||||
|
//console.log(person.id);
|
||||||
|
personsAssociated.push(person);
|
||||||
|
personsNotAssociated = personsNotAssociated.filter(
|
||||||
|
(p) => p !== person,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
personsAssociated: personsAssociated,
|
||||||
|
personsNotAssociated: personsNotAssociated,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getCourseParticipations() {
|
||||||
|
let participations = [];
|
||||||
|
this.accompanyingCourse.participations.forEach((participation) => {
|
||||||
|
if (!participation.endDate) {
|
||||||
|
participations.push(participation.person);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return participations;
|
||||||
|
},
|
||||||
|
addNewPersons({ selected, modal }) {
|
||||||
|
console.log("@@@ CLICK button addNewPersons", selected);
|
||||||
|
selected.forEach((item) => {
|
||||||
|
this.$store.dispatch("addPersonsInvolved", item);
|
||||||
|
}, this);
|
||||||
|
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||||
|
modal.showModal = false;
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
},
|
||||||
|
addSuggestedEntity(person) {
|
||||||
|
this.$store.dispatch("addPersonsInvolved", {
|
||||||
|
result: person,
|
||||||
|
type: "person",
|
||||||
|
});
|
||||||
|
this.setPersonsInBloc();
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -1,29 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<li>
|
<li>
|
||||||
<span :title="person.text" @click.prevent="$emit('remove', person)">
|
<span :title="person.text" @click.prevent="$emit('remove', person)">
|
||||||
<span class="chill_denomination">
|
<span class="chill_denomination">
|
||||||
<person-text :person="person" :is-cut="true" />
|
<person-text :person="person" :is-cut="true" />
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PersonText from "ChillPersonAssets/vuejs/_components/Entity/PersonText.vue";
|
import PersonText from "ChillPersonAssets/vuejs/_components/Entity/PersonText.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PersonBadge",
|
name: "PersonBadge",
|
||||||
props: ["person"],
|
props: ["person"],
|
||||||
components: {
|
components: {
|
||||||
PersonText,
|
PersonText,
|
||||||
},
|
},
|
||||||
// computed: {
|
// computed: {
|
||||||
// textCutted() {
|
// textCutted() {
|
||||||
// let more = (this.person.text.length > 15) ?'…' : '';
|
// let more = (this.person.text.length > 15) ?'…' : '';
|
||||||
// return this.person.text.slice(0,15) + more;
|
// return this.person.text.slice(0,15) + more;
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
emits: ["remove"],
|
emits: ["remove"],
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -1,38 +1,38 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="item-bloc" :style="{ 'flex-basis': blocWidth }">
|
<div class="item-bloc" :style="{ 'flex-basis': blocWidth }">
|
||||||
<div class="item-row">
|
<div class="item-row">
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
<h4>{{ $t(bloc.title) }}</h4>
|
<h4>{{ $t(bloc.title) }}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
<ul class="list-suggest remove-items">
|
<ul class="list-suggest remove-items">
|
||||||
<person-badge
|
<person-badge
|
||||||
v-for="person in bloc.persons"
|
v-for="person in bloc.persons"
|
||||||
:key="person.id"
|
:key="person.id"
|
||||||
:person="person"
|
:person="person"
|
||||||
@remove="removePerson"
|
@remove="removePerson"
|
||||||
/>
|
/>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import PersonBadge from "./PersonBadge.vue";
|
import PersonBadge from "./PersonBadge.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "PersonsBloc",
|
name: "PersonsBloc",
|
||||||
components: {
|
components: {
|
||||||
PersonBadge,
|
PersonBadge,
|
||||||
},
|
},
|
||||||
props: ["bloc", "setPersonsInBloc", "blocWidth"],
|
props: ["bloc", "setPersonsInBloc", "blocWidth"],
|
||||||
methods: {
|
methods: {
|
||||||
removePerson(item) {
|
removePerson(item) {
|
||||||
console.log("@@ CLICK remove person: item", item);
|
console.log("@@ CLICK remove person: item", item);
|
||||||
this.$store.dispatch("removePersonInvolved", item);
|
this.$store.dispatch("removePersonInvolved", item);
|
||||||
this.setPersonsInBloc();
|
this.setPersonsInBloc();
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@@ -1,32 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<teleport to="#location">
|
<teleport to="#location">
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
<label :class="locationClassList">
|
<label :class="locationClassList">
|
||||||
{{ trans(ACTIVITY_LOCATION) }}
|
{{ trans(ACTIVITY_LOCATION) }}
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
name="selectLocation"
|
name="selectLocation"
|
||||||
id="selectLocation"
|
id="selectLocation"
|
||||||
label="name"
|
label="name"
|
||||||
track-by="id"
|
track-by="id"
|
||||||
open-direction="top"
|
open-direction="top"
|
||||||
:multiple="false"
|
:multiple="false"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
:placeholder="trans(ACTIVITY_CHOOSE_LOCATION)"
|
:placeholder="trans(ACTIVITY_CHOOSE_LOCATION)"
|
||||||
:custom-label="customLabel"
|
:custom-label="customLabel"
|
||||||
:select-label="trans(MULTISELECT_SELECT_LABEL)"
|
:select-label="trans(MULTISELECT_SELECT_LABEL)"
|
||||||
:deselect-label="trans(MULTISELECT_DESELECT_LABEL)"
|
:deselect-label="trans(MULTISELECT_DESELECT_LABEL)"
|
||||||
:selected-label="trans(MULTISELECT_SELECTED_LABEL)"
|
:selected-label="trans(MULTISELECT_SELECTED_LABEL)"
|
||||||
:options="availableLocations"
|
:options="availableLocations"
|
||||||
group-values="locations"
|
group-values="locations"
|
||||||
group-label="locationGroup"
|
group-label="locationGroup"
|
||||||
v-model="location"
|
v-model="location"
|
||||||
/>
|
/>
|
||||||
<new-location v-bind:available-locations="availableLocations" />
|
<new-location v-bind:available-locations="availableLocations" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</teleport>
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -35,60 +35,60 @@ import VueMultiselect from "vue-multiselect";
|
|||||||
import NewLocation from "./Location/NewLocation.vue";
|
import NewLocation from "./Location/NewLocation.vue";
|
||||||
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
||||||
import {
|
import {
|
||||||
trans,
|
trans,
|
||||||
ACTIVITY_LOCATION,
|
ACTIVITY_LOCATION,
|
||||||
ACTIVITY_CHOOSE_LOCATION,
|
ACTIVITY_CHOOSE_LOCATION,
|
||||||
MULTISELECT_SELECT_LABEL,
|
MULTISELECT_SELECT_LABEL,
|
||||||
MULTISELECT_DESELECT_LABEL,
|
MULTISELECT_DESELECT_LABEL,
|
||||||
MULTISELECT_SELECTED_LABEL,
|
MULTISELECT_SELECTED_LABEL,
|
||||||
} from "translator";
|
} from "translator";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Location",
|
name: "Location",
|
||||||
components: {
|
components: {
|
||||||
NewLocation,
|
NewLocation,
|
||||||
VueMultiselect,
|
VueMultiselect,
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
return {
|
||||||
|
trans,
|
||||||
|
ACTIVITY_LOCATION,
|
||||||
|
ACTIVITY_CHOOSE_LOCATION,
|
||||||
|
MULTISELECT_SELECT_LABEL,
|
||||||
|
MULTISELECT_DESELECT_LABEL,
|
||||||
|
MULTISELECT_SELECTED_LABEL,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
locationClassList: `col-form-label col-sm-4 ${document.querySelector("input#chill_activitybundle_activity_location").getAttribute("required") ? "required" : ""}`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["activity", "availableLocations"]),
|
||||||
|
...mapGetters(["suggestedEntities"]),
|
||||||
|
location: {
|
||||||
|
get() {
|
||||||
|
return this.activity.location;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$store.dispatch("updateLocation", value);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
},
|
||||||
return {
|
methods: {
|
||||||
trans,
|
labelAccompanyingCourseLocation(value) {
|
||||||
ACTIVITY_LOCATION,
|
return `${value.address.text} (${localizeString(value.locationType.title)})`;
|
||||||
ACTIVITY_CHOOSE_LOCATION,
|
|
||||||
MULTISELECT_SELECT_LABEL,
|
|
||||||
MULTISELECT_DESELECT_LABEL,
|
|
||||||
MULTISELECT_SELECTED_LABEL,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
data() {
|
customLabel(value) {
|
||||||
return {
|
return value.locationType
|
||||||
locationClassList: `col-form-label col-sm-4 ${document.querySelector("input#chill_activitybundle_activity_location").getAttribute("required") ? "required" : ""}`,
|
? value.name
|
||||||
};
|
? value.name === "__AccompanyingCourseLocation__"
|
||||||
},
|
? this.labelAccompanyingCourseLocation(value)
|
||||||
computed: {
|
: `${value.name} (${localizeString(value.locationType.title)})`
|
||||||
...mapState(["activity", "availableLocations"]),
|
: localizeString(value.locationType.title)
|
||||||
...mapGetters(["suggestedEntities"]),
|
: "";
|
||||||
location: {
|
|
||||||
get() {
|
|
||||||
return this.activity.location;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
this.$store.dispatch("updateLocation", value);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
labelAccompanyingCourseLocation(value) {
|
|
||||||
return `${value.address.text} (${localizeString(value.locationType.title)})`;
|
|
||||||
},
|
|
||||||
customLabel(value) {
|
|
||||||
return value.locationType
|
|
||||||
? value.name
|
|
||||||
? value.name === "__AccompanyingCourseLocation__"
|
|
||||||
? this.labelAccompanyingCourseLocation(value)
|
|
||||||
: `${value.name} (${localizeString(value.locationType.title)})`
|
|
||||||
: localizeString(value.locationType.title)
|
|
||||||
: "";
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,123 +1,114 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a class="btn btn-sm btn-create" @click="openModal">
|
<a class="btn btn-sm btn-create" @click="openModal">
|
||||||
{{ trans(ACTIVITY_CREATE_NEW_LOCATION) }}
|
{{ trans(ACTIVITY_CREATE_NEW_LOCATION) }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<teleport to="body">
|
<teleport to="body">
|
||||||
<modal
|
<modal
|
||||||
v-if="modal.showModal"
|
v-if="modal.showModal"
|
||||||
:modalDialogClass="modal.modalDialogClass"
|
:modalDialogClass="modal.modalDialogClass"
|
||||||
@close="modal.showModal = false"
|
@close="modal.showModal = false"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<h3 class="modal-title">
|
<h3 class="modal-title">
|
||||||
{{ trans(ACTIVITY_CREATE_NEW_LOCATION) }}
|
{{ trans(ACTIVITY_CREATE_NEW_LOCATION) }}
|
||||||
</h3>
|
</h3>
|
||||||
</template>
|
</template>
|
||||||
<template #body>
|
<template #body>
|
||||||
<form>
|
<form>
|
||||||
<div class="alert alert-warning" v-if="errors.length">
|
<div class="alert alert-warning" v-if="errors.length">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="(e, i) in errors" :key="i">
|
<li v-for="(e, i) in errors" :key="i">
|
||||||
{{ e }}
|
{{ e }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-floating mb-3">
|
<div class="form-floating mb-3">
|
||||||
<select
|
<select
|
||||||
class="form-select form-select-lg"
|
class="form-select form-select-lg"
|
||||||
id="type"
|
id="type"
|
||||||
required
|
required
|
||||||
v-model="selectType"
|
v-model="selectType"
|
||||||
>
|
>
|
||||||
<option selected disabled value="">
|
<option selected disabled value="">
|
||||||
{{ trans(ACTIVITY_CHOOSE_LOCATION_TYPE) }}
|
{{ trans(ACTIVITY_CHOOSE_LOCATION_TYPE) }}
|
||||||
</option>
|
</option>
|
||||||
<option
|
<option v-for="t in locationTypes" :value="t" :key="t.id">
|
||||||
v-for="t in locationTypes"
|
{{ localizeString(t.title) }}
|
||||||
:value="t"
|
</option>
|
||||||
:key="t.id"
|
</select>
|
||||||
>
|
<label>{{ trans(ACTIVITY_LOCATION_FIELDS_TYPE) }}</label>
|
||||||
{{ localizeString(t.title) }}
|
</div>
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<label>{{
|
|
||||||
trans(ACTIVITY_LOCATION_FIELDS_TYPE)
|
|
||||||
}}</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-floating mb-3">
|
<div class="form-floating mb-3">
|
||||||
<input
|
<input
|
||||||
class="form-control form-control-lg"
|
class="form-control form-control-lg"
|
||||||
id="name"
|
id="name"
|
||||||
v-model="inputName"
|
v-model="inputName"
|
||||||
placeholder
|
placeholder
|
||||||
/>
|
/>
|
||||||
<label for="name">{{
|
<label for="name">{{
|
||||||
trans(ACTIVITY_LOCATION_FIELDS_NAME)
|
trans(ACTIVITY_LOCATION_FIELDS_NAME)
|
||||||
}}</label>
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<add-address
|
<add-address
|
||||||
:context="addAddress.context"
|
:context="addAddress.context"
|
||||||
:options="addAddress.options"
|
:options="addAddress.options"
|
||||||
:addressChangedCallback="submitNewAddress"
|
:addressChangedCallback="submitNewAddress"
|
||||||
v-if="showAddAddress"
|
v-if="showAddAddress"
|
||||||
ref="addAddress"
|
ref="addAddress"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="form-floating mb-3" v-if="showContactData">
|
<div class="form-floating mb-3" v-if="showContactData">
|
||||||
<input
|
<input
|
||||||
class="form-control form-control-lg"
|
class="form-control form-control-lg"
|
||||||
id="phonenumber1"
|
id="phonenumber1"
|
||||||
v-model="inputPhonenumber1"
|
v-model="inputPhonenumber1"
|
||||||
placeholder
|
placeholder
|
||||||
/>
|
/>
|
||||||
<label for="phonenumber1">{{
|
<label for="phonenumber1">{{
|
||||||
trans(ACTIVITY_LOCATION_FIELDS_PHONENUMBER1)
|
trans(ACTIVITY_LOCATION_FIELDS_PHONENUMBER1)
|
||||||
}}</label>
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating mb-3" v-if="hasPhonenumber1">
|
<div class="form-floating mb-3" v-if="hasPhonenumber1">
|
||||||
<input
|
<input
|
||||||
class="form-control form-control-lg"
|
class="form-control form-control-lg"
|
||||||
id="phonenumber2"
|
id="phonenumber2"
|
||||||
v-model="inputPhonenumber2"
|
v-model="inputPhonenumber2"
|
||||||
placeholder
|
placeholder
|
||||||
/>
|
/>
|
||||||
<label for="phonenumber2">{{
|
<label for="phonenumber2">{{
|
||||||
trans(ACTIVITY_LOCATION_FIELDS_PHONENUMBER2)
|
trans(ACTIVITY_LOCATION_FIELDS_PHONENUMBER2)
|
||||||
}}</label>
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating mb-3" v-if="showContactData">
|
<div class="form-floating mb-3" v-if="showContactData">
|
||||||
<input
|
<input
|
||||||
class="form-control form-control-lg"
|
class="form-control form-control-lg"
|
||||||
id="email"
|
id="email"
|
||||||
v-model="inputEmail"
|
v-model="inputEmail"
|
||||||
placeholder
|
placeholder
|
||||||
/>
|
/>
|
||||||
<label for="email">{{
|
<label for="email">{{
|
||||||
trans(ACTIVITY_LOCATION_FIELDS_EMAIL)
|
trans(ACTIVITY_LOCATION_FIELDS_EMAIL)
|
||||||
}}</label>
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<button
|
<button class="btn btn-save" @click.prevent="saveNewLocation">
|
||||||
class="btn btn-save"
|
{{ trans(SAVE) }}
|
||||||
@click.prevent="saveNewLocation"
|
</button>
|
||||||
>
|
</template>
|
||||||
{{ trans(SAVE) }}
|
</modal>
|
||||||
</button>
|
</teleport>
|
||||||
</template>
|
</div>
|
||||||
</modal>
|
|
||||||
</teleport>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -128,237 +119,236 @@ import { getLocationTypes } from "../../api";
|
|||||||
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||||
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
||||||
import {
|
import {
|
||||||
SAVE,
|
SAVE,
|
||||||
ACTIVITY_LOCATION_FIELDS_EMAIL,
|
ACTIVITY_LOCATION_FIELDS_EMAIL,
|
||||||
ACTIVITY_LOCATION_FIELDS_PHONENUMBER1,
|
ACTIVITY_LOCATION_FIELDS_PHONENUMBER1,
|
||||||
ACTIVITY_LOCATION_FIELDS_PHONENUMBER2,
|
ACTIVITY_LOCATION_FIELDS_PHONENUMBER2,
|
||||||
ACTIVITY_LOCATION_FIELDS_NAME,
|
ACTIVITY_LOCATION_FIELDS_NAME,
|
||||||
ACTIVITY_LOCATION_FIELDS_TYPE,
|
ACTIVITY_LOCATION_FIELDS_TYPE,
|
||||||
ACTIVITY_CHOOSE_LOCATION_TYPE,
|
ACTIVITY_CHOOSE_LOCATION_TYPE,
|
||||||
ACTIVITY_CREATE_NEW_LOCATION,
|
ACTIVITY_CREATE_NEW_LOCATION,
|
||||||
trans,
|
trans,
|
||||||
} from "translator";
|
} from "translator";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "NewLocation",
|
name: "NewLocation",
|
||||||
components: {
|
components: {
|
||||||
Modal,
|
Modal,
|
||||||
AddAddress,
|
AddAddress,
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
return {
|
||||||
|
trans,
|
||||||
|
SAVE,
|
||||||
|
ACTIVITY_LOCATION_FIELDS_EMAIL,
|
||||||
|
ACTIVITY_LOCATION_FIELDS_PHONENUMBER1,
|
||||||
|
ACTIVITY_LOCATION_FIELDS_PHONENUMBER2,
|
||||||
|
ACTIVITY_LOCATION_FIELDS_NAME,
|
||||||
|
ACTIVITY_LOCATION_FIELDS_TYPE,
|
||||||
|
ACTIVITY_CHOOSE_LOCATION_TYPE,
|
||||||
|
ACTIVITY_CREATE_NEW_LOCATION,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: ["availableLocations"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
errors: [],
|
||||||
|
selected: {
|
||||||
|
type: null,
|
||||||
|
name: null,
|
||||||
|
addressId: null,
|
||||||
|
phonenumber1: null,
|
||||||
|
phonenumber2: null,
|
||||||
|
email: null,
|
||||||
|
},
|
||||||
|
locationTypes: [],
|
||||||
|
modal: {
|
||||||
|
showModal: false,
|
||||||
|
modalDialogClass: "modal-dialog-scrollable modal-xl",
|
||||||
|
},
|
||||||
|
addAddress: {
|
||||||
|
options: {
|
||||||
|
button: {
|
||||||
|
text: {
|
||||||
|
create: "activity.create_address",
|
||||||
|
edit: "activity.edit_address",
|
||||||
|
},
|
||||||
|
size: "btn-sm",
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
create: "activity.create_address",
|
||||||
|
edit: "activity.edit_address",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
context: {
|
||||||
|
target: {
|
||||||
|
//name, id
|
||||||
|
},
|
||||||
|
edit: false,
|
||||||
|
addressId: null,
|
||||||
|
defaults: window.addaddress,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(["activity"]),
|
||||||
|
selectType: {
|
||||||
|
get() {
|
||||||
|
return this.selected.type;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.selected.type = value;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
inputName: {
|
||||||
return {
|
get() {
|
||||||
trans,
|
return this.selected.name;
|
||||||
SAVE,
|
},
|
||||||
ACTIVITY_LOCATION_FIELDS_EMAIL,
|
set(value) {
|
||||||
ACTIVITY_LOCATION_FIELDS_PHONENUMBER1,
|
this.selected.name = value;
|
||||||
ACTIVITY_LOCATION_FIELDS_PHONENUMBER2,
|
},
|
||||||
ACTIVITY_LOCATION_FIELDS_NAME,
|
},
|
||||||
ACTIVITY_LOCATION_FIELDS_TYPE,
|
inputEmail: {
|
||||||
ACTIVITY_CHOOSE_LOCATION_TYPE,
|
get() {
|
||||||
ACTIVITY_CREATE_NEW_LOCATION,
|
return this.selected.email;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.selected.email = value;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inputPhonenumber1: {
|
||||||
|
get() {
|
||||||
|
return this.selected.phonenumber1;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.selected.phonenumber1 = value;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inputPhonenumber2: {
|
||||||
|
get() {
|
||||||
|
return this.selected.phonenumber2;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.selected.phonenumber2 = value;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
hasPhonenumber1() {
|
||||||
|
return (
|
||||||
|
this.selected.phonenumber1 !== null && this.selected.phonenumber1 !== ""
|
||||||
|
);
|
||||||
|
},
|
||||||
|
showAddAddress() {
|
||||||
|
let cond = false;
|
||||||
|
if (this.selected.type) {
|
||||||
|
if (this.selected.type.addressRequired !== "never") {
|
||||||
|
cond = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cond;
|
||||||
|
},
|
||||||
|
showContactData() {
|
||||||
|
let cond = false;
|
||||||
|
if (this.selected.type) {
|
||||||
|
if (this.selected.type.contactData !== "never") {
|
||||||
|
cond = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cond;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getLocationTypesList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
localizeString,
|
||||||
|
checkForm() {
|
||||||
|
let cond = true;
|
||||||
|
this.errors = [];
|
||||||
|
if (!this.selected.type) {
|
||||||
|
this.errors.push("Type de localisation requis");
|
||||||
|
cond = false;
|
||||||
|
} else {
|
||||||
|
if (
|
||||||
|
this.selected.type.addressRequired === "required" &&
|
||||||
|
!this.selected.addressId
|
||||||
|
) {
|
||||||
|
this.errors.push("Adresse requise");
|
||||||
|
cond = false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
this.selected.type.contactData === "required" &&
|
||||||
|
!this.selected.phonenumber1
|
||||||
|
) {
|
||||||
|
this.errors.push("Numéro de téléphone requis");
|
||||||
|
cond = false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
this.selected.type.contactData === "required" &&
|
||||||
|
!this.selected.email
|
||||||
|
) {
|
||||||
|
this.errors.push("Adresse email requise");
|
||||||
|
cond = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cond;
|
||||||
|
},
|
||||||
|
getLocationTypesList() {
|
||||||
|
getLocationTypes().then((results) => {
|
||||||
|
this.locationTypes = results.filter(
|
||||||
|
(t) => t.availableForUsers === true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
openModal() {
|
||||||
|
this.modal.showModal = true;
|
||||||
|
},
|
||||||
|
saveNewLocation() {
|
||||||
|
if (this.checkForm()) {
|
||||||
|
let body = {
|
||||||
|
type: "location",
|
||||||
|
name: this.selected.name,
|
||||||
|
locationType: {
|
||||||
|
id: this.selected.type.id,
|
||||||
|
type: "location-type",
|
||||||
|
},
|
||||||
|
phonenumber1: this.selected.phonenumber1,
|
||||||
|
phonenumber2: this.selected.phonenumber2,
|
||||||
|
email: this.selected.email,
|
||||||
};
|
};
|
||||||
},
|
if (this.selected.addressId) {
|
||||||
props: ["availableLocations"],
|
body = Object.assign(body, {
|
||||||
data() {
|
address: {
|
||||||
return {
|
id: this.selected.addressId,
|
||||||
errors: [],
|
|
||||||
selected: {
|
|
||||||
type: null,
|
|
||||||
name: null,
|
|
||||||
addressId: null,
|
|
||||||
phonenumber1: null,
|
|
||||||
phonenumber2: null,
|
|
||||||
email: null,
|
|
||||||
},
|
},
|
||||||
locationTypes: [],
|
});
|
||||||
modal: {
|
}
|
||||||
showModal: false,
|
|
||||||
modalDialogClass: "modal-dialog-scrollable modal-xl",
|
|
||||||
},
|
|
||||||
addAddress: {
|
|
||||||
options: {
|
|
||||||
button: {
|
|
||||||
text: {
|
|
||||||
create: "activity.create_address",
|
|
||||||
edit: "activity.edit_address",
|
|
||||||
},
|
|
||||||
size: "btn-sm",
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
create: "activity.create_address",
|
|
||||||
edit: "activity.edit_address",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
context: {
|
|
||||||
target: {
|
|
||||||
//name, id
|
|
||||||
},
|
|
||||||
edit: false,
|
|
||||||
addressId: null,
|
|
||||||
defaults: window.addaddress,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapState(["activity"]),
|
|
||||||
selectType: {
|
|
||||||
get() {
|
|
||||||
return this.selected.type;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
this.selected.type = value;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
inputName: {
|
|
||||||
get() {
|
|
||||||
return this.selected.name;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
this.selected.name = value;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
inputEmail: {
|
|
||||||
get() {
|
|
||||||
return this.selected.email;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
this.selected.email = value;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
inputPhonenumber1: {
|
|
||||||
get() {
|
|
||||||
return this.selected.phonenumber1;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
this.selected.phonenumber1 = value;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
inputPhonenumber2: {
|
|
||||||
get() {
|
|
||||||
return this.selected.phonenumber2;
|
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
this.selected.phonenumber2 = value;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
hasPhonenumber1() {
|
|
||||||
return (
|
|
||||||
this.selected.phonenumber1 !== null &&
|
|
||||||
this.selected.phonenumber1 !== ""
|
|
||||||
);
|
|
||||||
},
|
|
||||||
showAddAddress() {
|
|
||||||
let cond = false;
|
|
||||||
if (this.selected.type) {
|
|
||||||
if (this.selected.type.addressRequired !== "never") {
|
|
||||||
cond = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cond;
|
|
||||||
},
|
|
||||||
showContactData() {
|
|
||||||
let cond = false;
|
|
||||||
if (this.selected.type) {
|
|
||||||
if (this.selected.type.contactData !== "never") {
|
|
||||||
cond = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cond;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getLocationTypesList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
localizeString,
|
|
||||||
checkForm() {
|
|
||||||
let cond = true;
|
|
||||||
this.errors = [];
|
|
||||||
if (!this.selected.type) {
|
|
||||||
this.errors.push("Type de localisation requis");
|
|
||||||
cond = false;
|
|
||||||
} else {
|
|
||||||
if (
|
|
||||||
this.selected.type.addressRequired === "required" &&
|
|
||||||
!this.selected.addressId
|
|
||||||
) {
|
|
||||||
this.errors.push("Adresse requise");
|
|
||||||
cond = false;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
this.selected.type.contactData === "required" &&
|
|
||||||
!this.selected.phonenumber1
|
|
||||||
) {
|
|
||||||
this.errors.push("Numéro de téléphone requis");
|
|
||||||
cond = false;
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
this.selected.type.contactData === "required" &&
|
|
||||||
!this.selected.email
|
|
||||||
) {
|
|
||||||
this.errors.push("Adresse email requise");
|
|
||||||
cond = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cond;
|
|
||||||
},
|
|
||||||
getLocationTypesList() {
|
|
||||||
getLocationTypes().then((results) => {
|
|
||||||
this.locationTypes = results.filter(
|
|
||||||
(t) => t.availableForUsers === true,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
openModal() {
|
|
||||||
this.modal.showModal = true;
|
|
||||||
},
|
|
||||||
saveNewLocation() {
|
|
||||||
if (this.checkForm()) {
|
|
||||||
let body = {
|
|
||||||
type: "location",
|
|
||||||
name: this.selected.name,
|
|
||||||
locationType: {
|
|
||||||
id: this.selected.type.id,
|
|
||||||
type: "location-type",
|
|
||||||
},
|
|
||||||
phonenumber1: this.selected.phonenumber1,
|
|
||||||
phonenumber2: this.selected.phonenumber2,
|
|
||||||
email: this.selected.email,
|
|
||||||
};
|
|
||||||
if (this.selected.addressId) {
|
|
||||||
body = Object.assign(body, {
|
|
||||||
address: {
|
|
||||||
id: this.selected.addressId,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
makeFetch("POST", "/api/1.0/main/location.json", body)
|
makeFetch("POST", "/api/1.0/main/location.json", body)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.$store.dispatch("addAvailableLocationGroup", {
|
this.$store.dispatch("addAvailableLocationGroup", {
|
||||||
locationGroup: "Localisations nouvellement créées",
|
locationGroup: "Localisations nouvellement créées",
|
||||||
locations: [response],
|
locations: [response],
|
||||||
});
|
});
|
||||||
this.$store.dispatch("updateLocation", response);
|
this.$store.dispatch("updateLocation", response);
|
||||||
this.modal.showModal = false;
|
this.modal.showModal = false;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === "ValidationException") {
|
if (error.name === "ValidationException") {
|
||||||
for (let v of error.violations) {
|
for (let v of error.violations) {
|
||||||
this.errors.push(v);
|
this.errors.push(v);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.errors.push("An error occurred");
|
this.errors.push("An error occurred");
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
submitNewAddress(payload) {
|
}
|
||||||
this.selected.addressId = payload.addressId;
|
|
||||||
this.addAddress.context.addressId = payload.addressId;
|
|
||||||
this.addAddress.context.edit = true;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
submitNewAddress(payload) {
|
||||||
|
this.selected.addressId = payload.addressId;
|
||||||
|
this.addAddress.context.addressId = payload.addressId;
|
||||||
|
this.addAddress.context.edit = true;
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@@ -1,103 +1,98 @@
|
|||||||
<template>
|
<template>
|
||||||
<teleport to="#social-issues-acc">
|
<teleport to="#social-issues-acc">
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<label :class="socialIssuesClassList">{{
|
<label :class="socialIssuesClassList">{{
|
||||||
trans(ACTIVITY_SOCIAL_ISSUES)
|
trans(ACTIVITY_SOCIAL_ISSUES)
|
||||||
}}</label>
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<check-social-issue
|
<check-social-issue
|
||||||
v-for="issue in socialIssuesList"
|
v-for="issue in socialIssuesList"
|
||||||
:key="issue.id"
|
:key="issue.id"
|
||||||
:issue="issue"
|
:issue="issue"
|
||||||
:selection="socialIssuesSelected"
|
:selection="socialIssuesSelected"
|
||||||
@updateSelected="updateIssuesSelected"
|
@updateSelected="updateIssuesSelected"
|
||||||
>
|
>
|
||||||
</check-social-issue>
|
</check-social-issue>
|
||||||
|
|
||||||
<div class="my-3">
|
<div class="my-3">
|
||||||
<VueMultiselect
|
<VueMultiselect
|
||||||
name="otherIssues"
|
name="otherIssues"
|
||||||
label="text"
|
label="text"
|
||||||
track-by="id"
|
track-by="id"
|
||||||
open-direction="bottom"
|
open-direction="bottom"
|
||||||
:close-on-select="true"
|
:close-on-select="true"
|
||||||
:preserve-search="false"
|
:preserve-search="false"
|
||||||
:reset-after="true"
|
:reset-after="true"
|
||||||
:hide-selected="true"
|
:hide-selected="true"
|
||||||
:taggable="false"
|
:taggable="false"
|
||||||
:multiple="false"
|
:multiple="false"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
:allow-empty="true"
|
:allow-empty="true"
|
||||||
:show-labels="false"
|
:show-labels="false"
|
||||||
:loading="issueIsLoading"
|
:loading="issueIsLoading"
|
||||||
:placeholder="trans(ACTIVITY_CHOOSE_OTHER_SOCIAL_ISSUE)"
|
:placeholder="trans(ACTIVITY_CHOOSE_OTHER_SOCIAL_ISSUE)"
|
||||||
:options="socialIssuesOther"
|
:options="socialIssuesOther"
|
||||||
@select="addIssueInList"
|
@select="addIssueInList"
|
||||||
>
|
>
|
||||||
</VueMultiselect>
|
</VueMultiselect>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<div class="col-4">
|
||||||
|
<label :class="socialActionsClassList">{{
|
||||||
|
trans(ACTIVITY_SOCIAL_ACTIONS)
|
||||||
|
}}</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<div v-if="actionIsLoading === true">
|
||||||
|
<i class="chill-green fa fa-circle-o-notch fa-spin fa-lg"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3 row">
|
<span
|
||||||
<div class="col-4">
|
v-else-if="socialIssuesSelected.length === 0"
|
||||||
<label :class="socialActionsClassList">{{
|
class="inline-choice chill-no-data-statement mt-3"
|
||||||
trans(ACTIVITY_SOCIAL_ACTIONS)
|
>
|
||||||
}}</label>
|
{{ trans(ACTIVITY_SELECT_FIRST_A_SOCIAL_ISSUE) }}
|
||||||
</div>
|
</span>
|
||||||
<div class="col-8">
|
|
||||||
<div v-if="actionIsLoading === true">
|
|
||||||
<i
|
|
||||||
class="chill-green fa fa-circle-o-notch fa-spin fa-lg"
|
|
||||||
></i>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<span
|
<template
|
||||||
v-else-if="socialIssuesSelected.length === 0"
|
v-else-if="
|
||||||
class="inline-choice chill-no-data-statement mt-3"
|
socialActionsList.length > 0 &&
|
||||||
>
|
(socialIssuesSelected.length || socialActionsSelected.length)
|
||||||
{{ trans(ACTIVITY_SELECT_FIRST_A_SOCIAL_ISSUE) }}
|
"
|
||||||
</span>
|
>
|
||||||
|
<div
|
||||||
|
id="actionsList"
|
||||||
|
v-for="group in socialActionsList"
|
||||||
|
:key="group.issue"
|
||||||
|
>
|
||||||
|
<span class="badge bg-chill-l-gray text-dark">{{
|
||||||
|
group.issue
|
||||||
|
}}</span>
|
||||||
|
<check-social-action
|
||||||
|
v-for="action in group.actions"
|
||||||
|
:key="action.id"
|
||||||
|
:action="action"
|
||||||
|
:selection="socialActionsSelected"
|
||||||
|
@updateSelected="updateActionsSelected"
|
||||||
|
>
|
||||||
|
</check-social-action>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template
|
<span
|
||||||
v-else-if="
|
v-else-if="actionAreLoaded && socialActionsList.length === 0"
|
||||||
socialActionsList.length > 0 &&
|
class="inline-choice chill-no-data-statement mt-3"
|
||||||
(socialIssuesSelected.length ||
|
>
|
||||||
socialActionsSelected.length)
|
{{ trans(ACTIVITY_SOCIAL_ACTION_LIST_EMPTY) }}
|
||||||
"
|
</span>
|
||||||
>
|
</div>
|
||||||
<div
|
</div>
|
||||||
id="actionsList"
|
</teleport>
|
||||||
v-for="group in socialActionsList"
|
|
||||||
:key="group.issue"
|
|
||||||
>
|
|
||||||
<span class="badge bg-chill-l-gray text-dark">{{
|
|
||||||
group.issue
|
|
||||||
}}</span>
|
|
||||||
<check-social-action
|
|
||||||
v-for="action in group.actions"
|
|
||||||
:key="action.id"
|
|
||||||
:action="action"
|
|
||||||
:selection="socialActionsSelected"
|
|
||||||
@updateSelected="updateActionsSelected"
|
|
||||||
>
|
|
||||||
</check-social-action>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<span
|
|
||||||
v-else-if="
|
|
||||||
actionAreLoaded && socialActionsList.length === 0
|
|
||||||
"
|
|
||||||
class="inline-choice chill-no-data-statement mt-3"
|
|
||||||
>
|
|
||||||
{{ trans(ACTIVITY_SOCIAL_ACTION_LIST_EMPTY) }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</teleport>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -106,154 +101,153 @@ import CheckSocialIssue from "./SocialIssuesAcc/CheckSocialIssue.vue";
|
|||||||
import CheckSocialAction from "./SocialIssuesAcc/CheckSocialAction.vue";
|
import CheckSocialAction from "./SocialIssuesAcc/CheckSocialAction.vue";
|
||||||
import { getSocialIssues, getSocialActionByIssue } from "../api.js";
|
import { getSocialIssues, getSocialActionByIssue } from "../api.js";
|
||||||
import {
|
import {
|
||||||
ACTIVITY_SOCIAL_ACTION_LIST_EMPTY,
|
ACTIVITY_SOCIAL_ACTION_LIST_EMPTY,
|
||||||
ACTIVITY_SELECT_FIRST_A_SOCIAL_ISSUE,
|
ACTIVITY_SELECT_FIRST_A_SOCIAL_ISSUE,
|
||||||
ACTIVITY_SOCIAL_ACTIONS,
|
ACTIVITY_SOCIAL_ACTIONS,
|
||||||
ACTIVITY_SOCIAL_ISSUES,
|
ACTIVITY_SOCIAL_ISSUES,
|
||||||
ACTIVITY_CHOOSE_OTHER_SOCIAL_ISSUE,
|
ACTIVITY_CHOOSE_OTHER_SOCIAL_ISSUE,
|
||||||
trans,
|
trans,
|
||||||
} from "translator";
|
} from "translator";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SocialIssuesAcc",
|
name: "SocialIssuesAcc",
|
||||||
components: {
|
components: {
|
||||||
CheckSocialIssue,
|
CheckSocialIssue,
|
||||||
CheckSocialAction,
|
CheckSocialAction,
|
||||||
VueMultiselect,
|
VueMultiselect,
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
return {
|
||||||
|
trans,
|
||||||
|
ACTIVITY_SOCIAL_ACTION_LIST_EMPTY,
|
||||||
|
ACTIVITY_SELECT_FIRST_A_SOCIAL_ISSUE,
|
||||||
|
ACTIVITY_SOCIAL_ACTIONS,
|
||||||
|
ACTIVITY_SOCIAL_ISSUES,
|
||||||
|
ACTIVITY_CHOOSE_OTHER_SOCIAL_ISSUE,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
issueIsLoading: false,
|
||||||
|
actionIsLoading: false,
|
||||||
|
actionAreLoaded: false,
|
||||||
|
socialIssuesClassList: `col-form-label ${document.querySelector("input#chill_activitybundle_activity_socialIssues").getAttribute("required") ? "required" : ""}`,
|
||||||
|
socialActionsClassList: `col-form-label ${document.querySelector("input#chill_activitybundle_activity_socialActions").getAttribute("required") ? "required" : ""}`,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
socialIssuesList() {
|
||||||
|
return this.$store.state.activity.accompanyingPeriod.socialIssues;
|
||||||
},
|
},
|
||||||
setup() {
|
socialIssuesSelected() {
|
||||||
return {
|
return this.$store.state.activity.socialIssues;
|
||||||
trans,
|
|
||||||
ACTIVITY_SOCIAL_ACTION_LIST_EMPTY,
|
|
||||||
ACTIVITY_SELECT_FIRST_A_SOCIAL_ISSUE,
|
|
||||||
ACTIVITY_SOCIAL_ACTIONS,
|
|
||||||
ACTIVITY_SOCIAL_ISSUES,
|
|
||||||
ACTIVITY_CHOOSE_OTHER_SOCIAL_ISSUE,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
data() {
|
socialIssuesOther() {
|
||||||
return {
|
return this.$store.state.socialIssuesOther;
|
||||||
issueIsLoading: false,
|
|
||||||
actionIsLoading: false,
|
|
||||||
actionAreLoaded: false,
|
|
||||||
socialIssuesClassList: `col-form-label ${document.querySelector("input#chill_activitybundle_activity_socialIssues").getAttribute("required") ? "required" : ""}`,
|
|
||||||
socialActionsClassList: `col-form-label ${document.querySelector("input#chill_activitybundle_activity_socialActions").getAttribute("required") ? "required" : ""}`,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
computed: {
|
socialActionsList() {
|
||||||
socialIssuesList() {
|
return this.$store.getters.socialActionsListSorted;
|
||||||
return this.$store.state.activity.accompanyingPeriod.socialIssues;
|
|
||||||
},
|
|
||||||
socialIssuesSelected() {
|
|
||||||
return this.$store.state.activity.socialIssues;
|
|
||||||
},
|
|
||||||
socialIssuesOther() {
|
|
||||||
return this.$store.state.socialIssuesOther;
|
|
||||||
},
|
|
||||||
socialActionsList() {
|
|
||||||
return this.$store.getters.socialActionsListSorted;
|
|
||||||
},
|
|
||||||
socialActionsSelected() {
|
|
||||||
return this.$store.state.activity.socialActions;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mounted() {
|
socialActionsSelected() {
|
||||||
/* Load other issues in multiselect */
|
return this.$store.state.activity.socialActions;
|
||||||
this.issueIsLoading = true;
|
|
||||||
this.actionAreLoaded = false;
|
|
||||||
|
|
||||||
getSocialIssues().then((response) => {
|
|
||||||
/* Add issues to the store */
|
|
||||||
this.$store.commit("updateIssuesOther", response);
|
|
||||||
|
|
||||||
/* Add in list the issues already associated (if not yet listed) */
|
|
||||||
this.socialIssuesSelected.forEach((issue) => {
|
|
||||||
if (
|
|
||||||
this.socialIssuesList.filter((i) => i.id === issue.id)
|
|
||||||
.length !== 1
|
|
||||||
) {
|
|
||||||
this.$store.commit("addIssueInList", issue);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Remove from multiselect the issues that are not yet in the checkbox list */
|
|
||||||
this.socialIssuesList.forEach((issue) => {
|
|
||||||
this.$store.commit("removeIssueInOther", issue);
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Filter issues */
|
|
||||||
this.$store.commit("filterList", "issues");
|
|
||||||
|
|
||||||
/* Add in list the actions already associated (if not yet listed) */
|
|
||||||
this.socialActionsSelected.forEach((action) => {
|
|
||||||
this.$store.commit("addActionInList", action);
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Filter actions */
|
|
||||||
this.$store.commit("filterList", "actions");
|
|
||||||
|
|
||||||
this.issueIsLoading = false;
|
|
||||||
this.actionAreLoaded = true;
|
|
||||||
this.updateActionsList();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
},
|
||||||
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
|
mounted() {
|
||||||
|
/* Load other issues in multiselect */
|
||||||
|
this.issueIsLoading = true;
|
||||||
|
this.actionAreLoaded = false;
|
||||||
|
|
||||||
|
getSocialIssues().then((response) => {
|
||||||
|
/* Add issues to the store */
|
||||||
|
this.$store.commit("updateIssuesOther", response);
|
||||||
|
|
||||||
|
/* Add in list the issues already associated (if not yet listed) */
|
||||||
|
this.socialIssuesSelected.forEach((issue) => {
|
||||||
|
if (
|
||||||
|
this.socialIssuesList.filter((i) => i.id === issue.id).length !== 1
|
||||||
|
) {
|
||||||
|
this.$store.commit("addIssueInList", issue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Remove from multiselect the issues that are not yet in the checkbox list */
|
||||||
|
this.socialIssuesList.forEach((issue) => {
|
||||||
|
this.$store.commit("removeIssueInOther", issue);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Filter issues */
|
||||||
|
this.$store.commit("filterList", "issues");
|
||||||
|
|
||||||
|
/* Add in list the actions already associated (if not yet listed) */
|
||||||
|
this.socialActionsSelected.forEach((action) => {
|
||||||
|
this.$store.commit("addActionInList", action);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Filter actions */
|
||||||
|
this.$store.commit("filterList", "actions");
|
||||||
|
|
||||||
|
this.issueIsLoading = false;
|
||||||
|
this.actionAreLoaded = true;
|
||||||
|
this.updateActionsList();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/* When choosing an issue in multiselect, add it in checkboxes (as selected),
|
||||||
remove it from multiselect, and add socialActions concerned
|
remove it from multiselect, and add socialActions concerned
|
||||||
*/
|
*/
|
||||||
addIssueInList(value) {
|
addIssueInList(value) {
|
||||||
//console.log('addIssueInList', value);
|
//console.log('addIssueInList', value);
|
||||||
this.$store.commit("addIssueInList", value);
|
this.$store.commit("addIssueInList", value);
|
||||||
this.$store.commit("removeIssueInOther", value);
|
this.$store.commit("removeIssueInOther", value);
|
||||||
this.$store.dispatch("addIssueSelected", value);
|
this.$store.dispatch("addIssueSelected", value);
|
||||||
this.updateActionsList();
|
this.updateActionsList();
|
||||||
},
|
},
|
||||||
/* Update value for selected issues checkboxes
|
/* Update value for selected issues checkboxes
|
||||||
*/
|
*/
|
||||||
updateIssuesSelected(issues) {
|
updateIssuesSelected(issues) {
|
||||||
//console.log('updateIssuesSelected', issues);
|
//console.log('updateIssuesSelected', issues);
|
||||||
this.$store.dispatch("updateIssuesSelected", issues);
|
this.$store.dispatch("updateIssuesSelected", issues);
|
||||||
this.updateActionsList();
|
this.updateActionsList();
|
||||||
},
|
},
|
||||||
/* Update value for selected actions checkboxes
|
/* Update value for selected actions checkboxes
|
||||||
*/
|
*/
|
||||||
updateActionsSelected(actions) {
|
updateActionsSelected(actions) {
|
||||||
//console.log('updateActionsSelected', actions);
|
//console.log('updateActionsSelected', actions);
|
||||||
this.$store.dispatch("updateActionsSelected", actions);
|
this.$store.dispatch("updateActionsSelected", actions);
|
||||||
},
|
},
|
||||||
/* Add socialActions concerned: after reset, loop on each issue selected
|
/* Add socialActions concerned: after reset, loop on each issue selected
|
||||||
to get social actions concerned
|
to get social actions concerned
|
||||||
*/
|
*/
|
||||||
updateActionsList() {
|
updateActionsList() {
|
||||||
this.resetActionsList();
|
this.resetActionsList();
|
||||||
this.socialIssuesSelected.forEach((item) => {
|
this.socialIssuesSelected.forEach((item) => {
|
||||||
this.actionIsLoading = true;
|
this.actionIsLoading = true;
|
||||||
getSocialActionByIssue(item.id).then(
|
getSocialActionByIssue(item.id).then(
|
||||||
(actions) =>
|
(actions) =>
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
actions.results.forEach((action) => {
|
actions.results.forEach((action) => {
|
||||||
this.$store.commit("addActionInList", action);
|
this.$store.commit("addActionInList", action);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.$store.commit("filterList", "actions");
|
this.$store.commit("filterList", "actions");
|
||||||
|
|
||||||
this.actionIsLoading = false;
|
this.actionIsLoading = false;
|
||||||
this.actionAreLoaded = true;
|
this.actionAreLoaded = true;
|
||||||
resolve();
|
resolve();
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
|
||||||
/* Reset socialActions List: flush list and restore selected actions
|
|
||||||
*/
|
|
||||||
resetActionsList() {
|
|
||||||
this.$store.commit("resetActionsList");
|
|
||||||
this.actionAreLoaded = false;
|
|
||||||
this.socialActionsSelected.forEach((item) => {
|
|
||||||
this.$store.commit("addActionInList", item);
|
|
||||||
}, this);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
/* Reset socialActions List: flush list and restore selected actions
|
||||||
|
*/
|
||||||
|
resetActionsList() {
|
||||||
|
this.$store.commit("resetActionsList");
|
||||||
|
this.actionAreLoaded = false;
|
||||||
|
this.socialActionsSelected.forEach((item) => {
|
||||||
|
this.$store.commit("addActionInList", item);
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -263,18 +257,18 @@ export default {
|
|||||||
@import "ChillMainAssets/chill/scss/chill_variables";
|
@import "ChillMainAssets/chill/scss/chill_variables";
|
||||||
|
|
||||||
span.multiselect__single {
|
span.multiselect__single {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#actionsList {
|
#actionsList {
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
margin: 0.5rem;
|
margin: 0.5rem;
|
||||||
background-color: whitesmoke;
|
background-color: whitesmoke;
|
||||||
}
|
}
|
||||||
|
|
||||||
span.badge {
|
span.badge {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
@include badge_social($social-issue-color);
|
@include badge_social($social-issue-color);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user