mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Integrate gender entity into vue components upon creation of persons
This commit is contained in:
parent
726cdb385f
commit
3eeb105913
@ -128,7 +128,7 @@ export default {
|
||||
body.mobilenumber = payload.data.mobilenumber;
|
||||
body.email = payload.data.email;
|
||||
body.altNames = payload.data.altNames;
|
||||
body.gender = payload.data.gender;
|
||||
body.gender = {id: payload.data.gender.id, type: payload.data.gender.type };
|
||||
if (payload.data.civility !== null) { body.civility = {id: payload.data.civility.id, type: payload.data.civility.type }; }
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||
|
@ -153,7 +153,7 @@ export default {
|
||||
body.mobilenumber = payload.data.mobilenumber;
|
||||
body.email = payload.data.email;
|
||||
body.altNames = payload.data.altNames;
|
||||
body.gender = payload.data.gender;
|
||||
body.gender = {id: payload.data.gender.id, type: payload.data.gender.type };
|
||||
if (payload.data.civility !== null) { body.civility = {id: payload.data.civility.id, type: payload.data.civility.type}; }
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||
|
@ -77,12 +77,11 @@
|
||||
class="form-select form-select-lg"
|
||||
id="gender"
|
||||
v-model="gender"
|
||||
@change="checkErrors"
|
||||
>
|
||||
<option selected disabled >{{ $t('person.gender.placeholder') }}</option>
|
||||
<option value="woman">{{ $t('person.gender.woman') }}</option>
|
||||
<option value="man">{{ $t('person.gender.man') }}</option>
|
||||
<option value="both">{{ $t('person.gender.both') }}</option>
|
||||
<option v-for="g in config.genders" :value="g.id" :key="g.id">
|
||||
{{ g.label.fr }}
|
||||
</option>
|
||||
</select>
|
||||
<label>{{ $t('person.gender.title') }}</label>
|
||||
</div>
|
||||
@ -178,7 +177,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCentersForPersonCreation, getCivilities, getPerson, getPersonAltNames } from '../../_api/OnTheFly';
|
||||
import { getCentersForPersonCreation, getCivilities, getGenders, getPerson, getPersonAltNames } from '../../_api/OnTheFly';
|
||||
import PersonRenderBox from '../Entity/PersonRenderBox.vue';
|
||||
import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue";
|
||||
|
||||
@ -204,6 +203,7 @@ export default {
|
||||
altNames: [],
|
||||
civilities: [],
|
||||
centers: [],
|
||||
genders: []
|
||||
},
|
||||
showCenters: false, // NOTE: must remains false if the form is not in create mode
|
||||
showAddressFormValue: false,
|
||||
@ -237,8 +237,8 @@ export default {
|
||||
get() { return this.person.lastName; }
|
||||
},
|
||||
gender: {
|
||||
set(value) { this.person.gender = value; },
|
||||
get() { return this.person.gender; }
|
||||
set(value) { this.person.gender = {id: value, type: 'chill_main_gender'}; },
|
||||
get() { return this.person.gender ? this.person.gender.id : null; }
|
||||
},
|
||||
civility: {
|
||||
set(value) { this.person.civility = {id: value, type: 'chill_main_civility'}; },
|
||||
@ -334,6 +334,12 @@ export default {
|
||||
this.config.civilities = civilities.results;
|
||||
}
|
||||
});
|
||||
getGenders()
|
||||
.then(genders => {
|
||||
if ('results' in genders) {
|
||||
this.config.genders = genders.results;
|
||||
}
|
||||
});
|
||||
if (this.action !== 'create') {
|
||||
this.loadData();
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user