mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
allow to edit civility in onTheFly
This commit is contained in:
parent
6abbf9bf21
commit
6c246a0d38
@ -213,6 +213,7 @@ export default {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case 'person':
|
case 'person':
|
||||||
data = this.$refs.castPerson.$data.person;
|
data = this.$refs.castPerson.$data.person;
|
||||||
|
console.log('person data are', data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'thirdparty':
|
case 'thirdparty':
|
||||||
|
@ -123,6 +123,7 @@ export default {
|
|||||||
body.email = payload.data.email;
|
body.email = payload.data.email;
|
||||||
body.altNames = payload.data.altNames;
|
body.altNames = payload.data.altNames;
|
||||||
body.gender = payload.data.gender;
|
body.gender = payload.data.gender;
|
||||||
|
body.civility = payload.data.civility;
|
||||||
|
|
||||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
@ -150,6 +150,7 @@ export default {
|
|||||||
body.email = payload.data.email;
|
body.email = payload.data.email;
|
||||||
body.altNames = payload.data.altNames;
|
body.altNames = payload.data.altNames;
|
||||||
body.gender = payload.data.gender;
|
body.gender = payload.data.gender;
|
||||||
|
body.civility = payload.data.civility;
|
||||||
|
|
||||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
@ -303,6 +303,7 @@ export default {
|
|||||||
'id': responsePerson.id
|
'id': responsePerson.id
|
||||||
},
|
},
|
||||||
'start_date': {
|
'start_date': {
|
||||||
|
// TODO: use date.js methods (low priority)
|
||||||
'datetime': `${new Date().toISOString().split('T')[0]}T00:00:00+02:00`
|
'datetime': `${new Date().toISOString().split('T')[0]}T00:00:00+02:00`
|
||||||
},
|
},
|
||||||
'holder': false,
|
'holder': false,
|
||||||
@ -315,7 +316,7 @@ export default {
|
|||||||
},
|
},
|
||||||
'composition': null
|
'composition': null
|
||||||
};
|
};
|
||||||
makeFetch('POST', '/api/1.0/person/household/members/move.json', member)
|
return makeFetch('POST', '/api/1.0/person/household/members/move.json', member)
|
||||||
.then(_response => {
|
.then(_response => {
|
||||||
makeFetch('POST', `/api/1.0/person/household/${responseHousehold.id}/address.json`, address)
|
makeFetch('POST', `/api/1.0/person/household/${responseHousehold.id}/address.json`, address)
|
||||||
.then(_response => {})
|
.then(_response => {})
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
<label>{{ $t('person.gender.title') }}</label>
|
<label>{{ $t('person.gender.title') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="action === 'create'" 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="civility"
|
id="civility"
|
||||||
@ -223,8 +223,8 @@ export default {
|
|||||||
get() { return this.person.gender; }
|
get() { return this.person.gender; }
|
||||||
},
|
},
|
||||||
civility: {
|
civility: {
|
||||||
set(value) { this.person.civility = {id: value}; },
|
set(value) { this.person.civility = {id: value, type: 'chill_main_civility'}; },
|
||||||
get() { return this.person.civility ? this.person.civility.id : undefined; }
|
get() { return this.person.civility ? this.person.civility.id : null; }
|
||||||
},
|
},
|
||||||
birthDate: {
|
birthDate: {
|
||||||
set(value) {
|
set(value) {
|
||||||
|
@ -14,7 +14,6 @@ namespace Chill\PersonBundle\Serializer\Normalizer;
|
|||||||
use Chill\MainBundle\Entity\Center;
|
use Chill\MainBundle\Entity\Center;
|
||||||
use Chill\MainBundle\Entity\Civility;
|
use Chill\MainBundle\Entity\Civility;
|
||||||
use Chill\MainBundle\Phonenumber\PhoneNumberHelperInterface;
|
use Chill\MainBundle\Phonenumber\PhoneNumberHelperInterface;
|
||||||
use Chill\MainBundle\Repository\CivilityRepository;
|
|
||||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension;
|
use Chill\MainBundle\Templating\Entity\ChillEntityRenderExtension;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
@ -50,8 +49,6 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
|
|||||||
|
|
||||||
private CenterResolverManagerInterface $centerResolverManager;
|
private CenterResolverManagerInterface $centerResolverManager;
|
||||||
|
|
||||||
private CivilityRepository $civilityRepository;
|
|
||||||
|
|
||||||
private PhoneNumberHelperInterface $phoneNumberHelper;
|
private PhoneNumberHelperInterface $phoneNumberHelper;
|
||||||
|
|
||||||
private ChillEntityRenderExtension $render;
|
private ChillEntityRenderExtension $render;
|
||||||
@ -65,14 +62,12 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
|
|||||||
PersonRepository $repository,
|
PersonRepository $repository,
|
||||||
CenterResolverManagerInterface $centerResolverManager,
|
CenterResolverManagerInterface $centerResolverManager,
|
||||||
ResidentialAddressRepository $residentialAddressRepository,
|
ResidentialAddressRepository $residentialAddressRepository,
|
||||||
CivilityRepository $civilityRepository,
|
|
||||||
PhoneNumberHelperInterface $phoneNumberHelper /* TODO maybe not necessayr any more */
|
PhoneNumberHelperInterface $phoneNumberHelper /* TODO maybe not necessayr any more */
|
||||||
) {
|
) {
|
||||||
$this->render = $render;
|
$this->render = $render;
|
||||||
$this->repository = $repository;
|
$this->repository = $repository;
|
||||||
$this->centerResolverManager = $centerResolverManager;
|
$this->centerResolverManager = $centerResolverManager;
|
||||||
$this->residentialAddressRepository = $residentialAddressRepository;
|
$this->residentialAddressRepository = $residentialAddressRepository;
|
||||||
$this->civilityRepository = $civilityRepository;
|
|
||||||
$this->phoneNumberHelper = $phoneNumberHelper;
|
$this->phoneNumberHelper = $phoneNumberHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,8 +181,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'civility':
|
case 'civility':
|
||||||
//$civility = $this->denormalizer->denormalize($data[$item], Civility::class, $format, $context); // this seems the right way to do it, but this does not render a Civility object.
|
$civility = $this->denormalizer->denormalize($data[$item], Civility::class, $format, []);
|
||||||
$civility = $this->civilityRepository->findOneBy(['id' => $data[$item]['id']]);
|
|
||||||
|
|
||||||
$person->setCivility($civility);
|
$person->setCivility($civility);
|
||||||
|
|
||||||
@ -227,6 +221,7 @@ class PersonJsonNormalizer implements DenormalizerAwareInterface, NormalizerAwar
|
|||||||
'mobilenumber' => $this->normalizer->normalize($person->getMobilenumber(), $format, $context),
|
'mobilenumber' => $this->normalizer->normalize($person->getMobilenumber(), $format, $context),
|
||||||
'email' => $person->getEmail(),
|
'email' => $person->getEmail(),
|
||||||
'gender' => $person->getGender(),
|
'gender' => $person->getGender(),
|
||||||
|
'civility' => $this->normalizer->normalize($person->getCivility(), $format, $context),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (in_array('minimal', $groups, true) && 1 === count($groups)) {
|
if (in_array('minimal', $groups, true) && 1 === count($groups)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user