diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue index cf97f6502..05b7dd218 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue @@ -65,7 +65,7 @@ export default { addPersons: { key: 'activity', options: { - type: ['person', 'thirdparty'], // TODO add 'user' + type: ['person', 'thirdparty', 'user'], // TODO add 'user' priority: null, uniq: false, } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php index 3175e3156..aaf2bec94 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Origin.php @@ -24,10 +24,17 @@ namespace Chill\PersonBundle\Entity\AccompanyingPeriod; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Annotation as Serializer; +use Symfony\Component\Serializer\Annotation\DiscriminatorMap; /** * @ORM\Entity * @ORM\Table(name="chill_person_accompanying_period_origin") + * @Serializer\DiscriminatorMap( + * typeProperty="type", + * mapping={ + * "origin"=Origin::class + * }) */ class Origin { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue index d06a4c001..dcb541ac8 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue @@ -5,8 +5,8 @@

{{ $t('course.title.draft') }}

{{ $t('course.title.active') }}

- + @@ -68,11 +68,11 @@ export default { } a[name^="section"] { position: absolute; - top: -3.5em; // reference for stickNav + top: -2.5em; // reference for stickNav } } - padding: 0.8em 0em; - margin: 2em 0; + padding: 0em 0em; + margin: 1em 0; border: 1px dotted #718596ab; border-radius: 5px; border-left: 1px dotted #718596ab; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js index ada63846e..d315a3db7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/api.js @@ -192,15 +192,6 @@ const getListOrigins = () => { }); } -const getOrigin = (id) => { - const url = `/api/1.0/person/accompanying-period/origin/${id}.json`; - return fetch(url) - .then(response => { - if (response.ok) { return response.json(); } - throw Error('Error with request resource response'); - }); -} - export { getAccompanyingCourse, patchAccompanyingCourse, @@ -212,6 +203,5 @@ export { getUsers, whoami, getListOrigins, - getOrigin, postSocialIssue }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue index 8706601e2..f55eb39d7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/OriginDemand.vue @@ -1,17 +1,37 @@ - + diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue index c566d2281..aa10b76a2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue @@ -3,7 +3,7 @@

{{ $t('referrer.title') }}

-
-<<<<<<< HEAD {% endif %} {% if r.thirdParty %} diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php new file mode 100644 index 000000000..7c9174217 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodOriginNormalizer.php @@ -0,0 +1,46 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace Chill\PersonBundle\Serializer\Normalizer; + +use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin; +use Symfony\Component\Serializer\Normalizer\NormalizerInterface; + +/** + * + * @internal we keep this normalizer, because the property 'text' may be replace by a rendering in the future + */ +class AccompanyingPeriodOriginNormalizer implements NormalizerInterface +{ + public function normalize($origin, string $format = null, array $context = array()) + { + /** @var Origin $origin */ + return [ + 'type' => 'origin', + 'id' => $origin->getId(), + 'label' => $origin->getLabel(), + 'text' => $origin->getLabel() + ]; + } + + public function supportsNormalization($data, string $format = null): bool + { + return $data instanceof Origin; + } +} diff --git a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml index 3bfd1fb57..9fba308c5 100644 --- a/src/Bundle/ChillPersonBundle/chill.api.specs.yaml +++ b/src/Bundle/ChillPersonBundle/chill.api.specs.yaml @@ -296,6 +296,7 @@ paths: $ref: "#/components/schemas/Person" 403: description: "Unauthorized" + /1.0/person/person.json: post: tags: @@ -358,39 +359,6 @@ paths: - /1.0/person/social-work/social-issue.json: - get: - tags: - - social-issue - summary: Return a list of social work - responses: - 200: - description: "ok" - /1.0/person/social-work/social-issue/{id}.json: - get: - tags: - - social-issue - summary: Return a social issue by id - parameters: - - name: id - in: path - required: true - description: The social issue's id - schema: - type: integer - format: integer - minimum: 1 - responses: - 200: - description: "ok" - content: - application/json: - schema: - $ref: '#/components/schemas/SocialIssue' - 404: - description: "not found" - 401: - description: "Unauthorized" /1.0/person/accompanying-course/{id}.json: get: tags: @@ -457,6 +425,7 @@ paths: description: "OK" 422: description: "object with validation errors" + /1.0/person/accompanying-course/{id}/requestor.json: post: tags: @@ -908,6 +877,61 @@ paths: 422: description: "object with validation errors" + /1.0/person/accompanying-course/work/{id}.json: + get: + tags: + - accompanying-course-work + summary: edit an existing accompanying course work + parameters: + - name: id + in: path + required: true + description: The accompanying course social work's id + schema: + type: integer + format: integer + minimum: 1 + responses: + 401: + description: "Unauthorized" + 404: + description: "Not found" + 200: + description: "OK" + 400: + description: "Bad Request" + + put: + tags: + - accompanying-course-work + summary: edit an existing accompanying course work + parameters: + - name: id + in: path + required: true + description: The accompanying course social work's id + schema: + type: integer + format: integer + minimum: 1 + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AccompanyingCourseWork' + responses: + 401: + description: "Unauthorized" + 404: + description: "Not found" + 200: + description: "OK" + 422: + description: "Unprocessable entity (validation errors)" + 400: + description: "Bad Request" + /1.0/person/accompanying-course/{id}/confirm.json: post: tags: @@ -932,6 +956,43 @@ paths: 400: description: "transition cannot be applyed" + + + /1.0/person/accompanying-period/origin.json: + get: + tags: + - person + summary: Return a list of all origins + responses: + 200: + description: "ok" + + /1.0/person/accompanying-period/origin/{id}.json: + get: + tags: + - person + summary: Return an origin by id + parameters: + - name: id + in: path + required: true + description: The origin id + schema: + type: integer + format: integer + minimum: 1 + responses: + 200: + description: "ok" + 400: + description: "Bad Request" + 401: + description: "Unauthorized" + 404: + description: "Not found" + + + /1.0/person/household.json: get: tags: @@ -1120,61 +1181,6 @@ paths: - /1.0/person/accompanying-course/work/{id}.json: - get: - tags: - - accompanying-course-work - summary: edit an existing accompanying course work - parameters: - - name: id - in: path - required: true - description: The accompanying course social work's id - schema: - type: integer - format: integer - minimum: 1 - responses: - 401: - description: "Unauthorized" - 404: - description: "Not found" - 200: - description: "OK" - 400: - description: "Bad Request" - - put: - tags: - - accompanying-course-work - summary: edit an existing accompanying course work - parameters: - - name: id - in: path - required: true - description: The accompanying course social work's id - schema: - type: integer - format: integer - minimum: 1 - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AccompanyingCourseWork' - responses: - 401: - description: "Unauthorized" - 404: - description: "Not found" - 200: - description: "OK" - 422: - description: "Unprocessable entity (validation errors)" - 400: - description: "Bad Request" - /1.0/person/social/social-action.json: get: tags: @@ -1209,7 +1215,6 @@ paths: 400: description: "Bad Request" - /1.0/person/social/social-action/by-social-issue/{id}.json: get: tags: @@ -1234,6 +1239,42 @@ paths: description: "Bad Request" + + /1.0/person/social-work/social-issue.json: + get: + tags: + - social-issue + summary: Return a list of social work + responses: + 200: + description: "ok" + + /1.0/person/social-work/social-issue/{id}.json: + get: + tags: + - social-issue + summary: Return a social issue by id + parameters: + - name: id + in: path + required: true + description: The social issue's id + schema: + type: integer + format: integer + minimum: 1 + responses: + 200: + description: "ok" + content: + application/json: + schema: + $ref: '#/components/schemas/SocialIssue' + 404: + description: "not found" + 401: + description: "Unauthorized" + /1.0/person/social-work/result.json: get: tags: @@ -1268,7 +1309,6 @@ paths: 400: description: "Bad Request" - /1.0/person/social-work/result/by-goal/{id}.json: get: tags: @@ -1349,7 +1389,6 @@ paths: 400: description: "Bad Request" - /1.0/person/social-work/goal/by-social-action/{id}.json: get: tags: