further adaptations to display deathdate. deathdate added to what API returns

This commit is contained in:
Julie Lenaerts 2021-08-26 16:42:33 +02:00
parent 5194cad354
commit c5f40c53ea
4 changed files with 72 additions and 79 deletions

View File

@ -6,7 +6,7 @@
addEntity: false, addEntity: false,
addLink: false, addLink: false,
addAltNames: true, addAltNames: true,
addAge : false, addAge : true,
hLevel : 3, hLevel : 3,
}" }"
:person="participation.person"> :person="participation.person">

View File

@ -28,7 +28,6 @@
</div> </div>
<p v-if="options.addInfo == true" class="moreinfo"> <p v-if="options.addInfo == true" class="moreinfo">
{{ person.deathdate }}
<i :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i> <i :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
<time v-if="person.birthdate && !person.deathdate" datetime="{{ person.birthdate }}" title="{{ birthdate }}"> <time v-if="person.birthdate && !person.deathdate" datetime="{{ person.birthdate }}" title="{{ birthdate }}">
{{ $t(getGenderTranslation) + ' ' + $d(birthdate, 'text') }} {{ $t(getGenderTranslation) + ' ' + $d(birthdate, 'text') }}
@ -39,7 +38,7 @@
<time v-else-if="person.deathdate" datetime="{{ person.deathdate }}" title="{{ person.deathdate }}"> <time v-else-if="person.deathdate" datetime="{{ person.deathdate }}" title="{{ person.deathdate }}">
{{ $t('renderbox.deathdate') + ' ' + deathdate }} {{ $t('renderbox.deathdate') + ' ' + deathdate }}
</time> </time>
<span v-if="options.addAge" class="age">{{ getAge }} {{ $t('renderbox.years_old')}}</span> <span v-if="options.addAge && person.birthdate" class="age">{{ getAge }} {{ $t('renderbox.years_old')}}</span>
</p> </p>
</div> </div>
</div> </div>
@ -118,13 +117,15 @@ export default {
return this.person.gender == 'woman' ? 'fa-venus' : this.person.gender == 'man' ? 'fa-mars' : 'fa-neuter'; return this.person.gender == 'woman' ? 'fa-venus' : this.person.gender == 'man' ? 'fa-mars' : 'fa-neuter';
}, },
birthdate: function(){ birthdate: function(){
if(this.person.birthdate){
const date = new Date(this.person.birthdate.datetime); const date = new Date(this.person.birthdate.datetime);
return dateToISO(date); return dateToISO(date)
}
}, },
deathdate: function(){ deathdate: function(){
if(this.person.deathdate){ if(this.person.deathdate){
const date = new Date(this.person.deathdate.datetime); const date = new Date(this.person.deathdate.datetime);
return dateToISO(date); return date.toLocaleDateString("fr-FR");
} }
}, },
altNameLabel: function(){ altNameLabel: function(){

View File

@ -69,6 +69,7 @@ class PersonNormalizer implements
'firstName' => $person->getFirstName(), 'firstName' => $person->getFirstName(),
'lastName' => $person->getLastName(), 'lastName' => $person->getLastName(),
'birthdate' => $this->normalizer->normalize($person->getBirthdate()), 'birthdate' => $this->normalizer->normalize($person->getBirthdate()),
'deathdate' => $this->normalizer->normalize($person->getDeathdate()),
'center' => $this->normalizer->normalize($person->getCenter()), 'center' => $this->normalizer->normalize($person->getCenter()),
'phonenumber' => $person->getPhonenumber(), 'phonenumber' => $person->getPhonenumber(),
'mobilenumber' => $person->getMobilenumber(), 'mobilenumber' => $person->getMobilenumber(),
@ -125,6 +126,7 @@ class PersonNormalizer implements
foreach ([ foreach ([
'birthdate' => \DateTime::class, 'birthdate' => \DateTime::class,
'deathdate' => \DateTime::class,
'center' => Center::class 'center' => Center::class
] as $item => $class) { ] as $item => $class) {
if (\array_key_exists($item, $data)) { if (\array_key_exists($item, $data)) {

View File

@ -45,7 +45,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'person' - "person"
firstName: firstName:
type: string type: string
lastName: lastName:
@ -55,7 +55,9 @@ components:
description: a canonical representation for the person name description: a canonical representation for the person name
readOnly: true readOnly: true
birthdate: birthdate:
$ref: '#/components/schemas/Date' $ref: "#/components/schemas/Date"
deathdate:
$ref: "#/components/schemas/Date"
phonenumber: phonenumber:
type: string type: string
mobilenumber: mobilenumber:
@ -78,7 +80,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'person' - "person"
required: required:
- id - id
- type - type
@ -96,7 +98,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'thirdparty' - "thirdparty"
required: required:
- id - id
- type - type
@ -119,15 +121,15 @@ components:
type: type:
type: string type: string
enum: enum:
- 'accompanying_period_resource' - "accompanying_period_resource"
readOnly: true readOnly: true
id: id:
type: integer type: integer
readOnly: true readOnly: true
resource: resource:
anyOf: anyOf:
- $ref: '#/components/schemas/PersonById' - $ref: "#/components/schemas/PersonById"
- $ref: '#/components/schemas/ThirdPartyById' - $ref: "#/components/schemas/ThirdPartyById"
ResourceById: ResourceById:
type: object type: object
properties: properties:
@ -136,7 +138,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'accompanying_period_resource' - "accompanying_period_resource"
required: required:
- id - id
- type - type
@ -146,7 +148,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'accompanying_period_comment' - "accompanying_period_comment"
readOnly: true readOnly: true
id: id:
type: integer type: integer
@ -161,7 +163,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'accompanying_period_comment' - "accompanying_period_comment"
required: required:
- id - id
- type - type
@ -173,7 +175,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'social_issue' - "social_issue"
parent_id: parent_id:
type: integer type: integer
readOnly: true readOnly: true
@ -200,7 +202,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'household' - "household"
HouseholdPosition: HouseholdPosition:
type: object type: object
properties: properties:
@ -209,7 +211,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'household_position' - "household_position"
AccompanyingCourseWork: AccompanyingCourseWork:
type: object type: object
properties: properties:
@ -218,7 +220,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'accompanying_period_work' - "accompanying_period_work"
note: note:
type: string type: string
startDate: startDate:
@ -243,15 +245,15 @@ components:
type: type:
type: string type: string
enum: enum:
- 'accompanying_period_work_goal' - "accompanying_period_work_goal"
note: note:
type: string type: string
goal: goal:
$ref: '#/components/schemas/SocialWorkGoalById' $ref: "#/components/schemas/SocialWorkGoalById"
results: results:
type: array type: array
items: items:
$ref: '#/components/schemas/SocialWorkGoalById' $ref: "#/components/schemas/SocialWorkGoalById"
SocialWorkResultById: SocialWorkResultById:
type: object type: object
@ -261,7 +263,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'social_work_result' - "social_work_result"
SocialWorkGoalById: SocialWorkGoalById:
type: object type: object
properties: properties:
@ -270,7 +272,7 @@ components:
type: type:
type: string type: string
enum: enum:
- 'social_work_goal' - "social_work_goal"
paths: paths:
/1.0/person/person/{id}.json: /1.0/person/person/{id}.json:
@ -308,7 +310,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Person' $ref: "#/components/schemas/Person"
responses: responses:
200: 200:
description: "OK" description: "OK"
@ -355,7 +357,6 @@ paths:
422: 422:
description: "Unprocessable entity (validation errors)" description: "Unprocessable entity (validation errors)"
/1.0/person/address/suggest/by-person/{id}.json: /1.0/person/address/suggest/by-person/{id}.json:
get: get:
tags: tags:
@ -452,7 +453,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/AccompanyingPeriod' $ref: "#/components/schemas/AccompanyingPeriod"
examples: examples:
Set the requestor as anonymous: Set the requestor as anonymous:
value: value:
@ -520,8 +521,8 @@ paths:
application/json: application/json:
schema: schema:
oneOf: oneOf:
- $ref: '#/components/schemas/PersonById' - $ref: "#/components/schemas/PersonById"
- $ref: '#/components/schemas/ThirdPartyById' - $ref: "#/components/schemas/ThirdPartyById"
examples: examples:
add person with id 50: add person with id 50:
summary: "a person with id 50" summary: "a person with id 50"
@ -585,7 +586,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/PersonById' $ref: "#/components/schemas/PersonById"
responses: responses:
401: 401:
description: "Unauthorized" description: "Unauthorized"
@ -614,7 +615,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/PersonById' $ref: "#/components/schemas/PersonById"
responses: responses:
401: 401:
description: "Unauthorized" description: "Unauthorized"
@ -645,7 +646,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Resource' $ref: "#/components/schemas/Resource"
examples: examples:
add person with id 50: add person with id 50:
summary: "a person with id 50" summary: "a person with id 50"
@ -690,7 +691,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/ResourceById' $ref: "#/components/schemas/ResourceById"
responses: responses:
401: 401:
description: "Unauthorized" description: "Unauthorized"
@ -721,7 +722,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Comment' $ref: "#/components/schemas/Comment"
examples: examples:
a single comment: a single comment:
summary: "a simple comment" summary: "a simple comment"
@ -759,7 +760,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/CommentById' $ref: "#/components/schemas/CommentById"
responses: responses:
401: 401:
description: "Unauthorized" description: "Unauthorized"
@ -790,7 +791,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Scope' $ref: "#/components/schemas/Scope"
examples: examples:
add a scope: add a scope:
value: value:
@ -824,7 +825,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/ScopeById' $ref: "#/components/schemas/ScopeById"
responses: responses:
401: 401:
description: "Unauthorized" description: "Unauthorized"
@ -855,7 +856,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/SocialIssue' $ref: "#/components/schemas/SocialIssue"
examples: examples:
add a social issue: add a social issue:
value: value:
@ -889,7 +890,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/SocialIssue' $ref: "#/components/schemas/SocialIssue"
responses: responses:
401: 401:
description: "Unauthorized" description: "Unauthorized"
@ -926,11 +927,11 @@ paths:
type: type:
type: string type: string
enum: enum:
- 'accompanying_period_work' - "accompanying_period_work"
startDate: startDate:
$ref: '#/components/schemas/Date' $ref: "#/components/schemas/Date"
endDate: endDate:
$ref: '#/components/schemas/Date' $ref: "#/components/schemas/Date"
examples: examples:
create a work: create a work:
value: value:
@ -992,7 +993,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/AccompanyingCourseWork' $ref: "#/components/schemas/AccompanyingCourseWork"
responses: responses:
401: 401:
description: "Unauthorized" description: "Unauthorized"
@ -1029,8 +1030,6 @@ paths:
400: 400:
description: "transition cannot be applyed" description: "transition cannot be applyed"
/1.0/person/accompanying-period/origin.json: /1.0/person/accompanying-period/origin.json:
get: get:
tags: tags:
@ -1064,8 +1063,6 @@ paths:
404: 404:
description: "Not found" description: "Not found"
/1.0/person/household.json: /1.0/person/household.json:
get: get:
tags: tags:
@ -1095,7 +1092,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Household' $ref: "#/components/schemas/Household"
404: 404:
description: "not found" description: "not found"
401: 401:
@ -1125,7 +1122,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/Household' $ref: "#/components/schemas/Household"
404: 404:
description: "not found" description: "not found"
401: 401:
@ -1149,23 +1146,22 @@ paths:
type: object type: object
properties: properties:
person: person:
$ref: '#/components/schemas/PersonById' $ref: "#/components/schemas/PersonById"
start_date: start_date:
$ref: '#/components/schemas/Date' $ref: "#/components/schemas/Date"
position: position:
$ref: '#/components/schemas/HouseholdPosition' $ref: "#/components/schemas/HouseholdPosition"
holder: holder:
type: boolean type: boolean
comment: comment:
type: string type: string
destination: destination:
$ref: '#/components/schemas/Household' $ref: "#/components/schemas/Household"
examples: examples:
Moving person to a new household: Moving person to a new household:
value: value:
concerned: concerned:
- - person:
person:
id: 0 id: 0
type: person type: person
position: position:
@ -1180,8 +1176,7 @@ paths:
Moving person to a new household and set an address to this household: Moving person to a new household and set an address to this household:
value: value:
concerned: concerned:
- - person:
person:
id: 0 id: 0
type: person type: person
position: position:
@ -1198,8 +1193,7 @@ paths:
Moving person to an existing household: Moving person to an existing household:
value: value:
concerned: concerned:
- - person:
person:
id: 0 id: 0
type: person type: person
position: position:
@ -1215,8 +1209,7 @@ paths:
Removing a person from any household: Removing a person from any household:
value: value:
concerned: concerned:
- - person:
person:
id: 0 id: 0
type: person type: person
start_date: start_date:
@ -1270,8 +1263,6 @@ paths:
400: 400:
description: "transition cannot be applyed" description: "transition cannot be applyed"
/1.0/person/social/social-action.json: /1.0/person/social/social-action.json:
get: get:
tags: tags:
@ -1349,7 +1340,6 @@ paths:
404: 404:
description: not found description: not found
/1.0/person/social-work/social-issue.json: /1.0/person/social-work/social-issue.json:
get: get:
tags: tags:
@ -1379,7 +1369,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/SocialIssue' $ref: "#/components/schemas/SocialIssue"
404: 404:
description: "not found" description: "not found"
401: 401: