mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
person: add altnames in the person creation modal
This commit is contained in:
parent
d71d1beb42
commit
780b7db8cb
@ -91,7 +91,10 @@ class PersonApiController extends ApiController
|
|||||||
{
|
{
|
||||||
|
|
||||||
//TODO get alt_name config from chill person
|
//TODO get alt_name config from chill person
|
||||||
$configAltNames = ["key" => "jeune_fille", "labels" => ["fr" => "Nom de naisssance" ]]; //TODO fake data
|
$configAltNames = [
|
||||||
|
["key" => "jeune_fille", "labels" => ["fr" => "Nom de naissance" ]],
|
||||||
|
["key" => "surnom", "labels" => ["fr" => "Surnom" ]]
|
||||||
|
]; //TODO fake data
|
||||||
|
|
||||||
return $this->json($configAltNames, Response::HTTP_OK, [], ['groups' => ['read']]);
|
return $this->json($configAltNames, Response::HTTP_OK, [], ['groups' => ['read']]);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,13 @@ const getPerson = (id) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getPersonAltNames = () =>
|
||||||
|
fetch('/api/1.0/person/config/alt_names.json').then(response => {
|
||||||
|
if (response.ok) { return response.json(); }
|
||||||
|
throw Error('Error with request resource response');
|
||||||
|
});;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* POST a new person
|
* POST a new person
|
||||||
*/
|
*/
|
||||||
@ -48,6 +55,7 @@ const patchPerson = (id, body) => {
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
getPerson,
|
getPerson,
|
||||||
|
getPersonAltNames,
|
||||||
postPerson,
|
postPerson,
|
||||||
patchPerson
|
patchPerson
|
||||||
};
|
};
|
||||||
|
@ -43,6 +43,11 @@
|
|||||||
<label>{{ $t('person.gender.title') }}</label>
|
<label>{{ $t('person.gender.title') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-for="(a, i) in config.altNames" :key="a.key" class="form-floating mb-3">
|
||||||
|
<input class="form-control form-control-lg" :id="a.key" v-model="altNames[i]" />
|
||||||
|
<label :for="a.key">{{ a.labels.fr }}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<span class="input-group-text" id="birthdate"><i class="fa fa-fw fa-birthday-cake"></i></span>
|
<span class="input-group-text" id="birthdate"><i class="fa fa-fw fa-birthday-cake"></i></span>
|
||||||
<input type="date"
|
<input type="date"
|
||||||
@ -75,7 +80,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getPerson } from '../../_api/OnTheFly';
|
import { getPerson, getPersonAltNames } from '../../_api/OnTheFly';
|
||||||
import PersonRenderBox from '../Entity/PersonRenderBox.vue';
|
import PersonRenderBox from '../Entity/PersonRenderBox.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -88,7 +93,11 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
person: {
|
person: {
|
||||||
type: 'person'
|
type: 'person',
|
||||||
|
altNames: []
|
||||||
|
},
|
||||||
|
config: {
|
||||||
|
altNames: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -101,6 +110,17 @@ export default {
|
|||||||
set(value) { this.person.lastName = value; },
|
set(value) { this.person.lastName = value; },
|
||||||
get() { return this.person.lastName; }
|
get() { return this.person.lastName; }
|
||||||
},
|
},
|
||||||
|
altNames: {
|
||||||
|
set(value) { this.person.altNames.push(
|
||||||
|
{
|
||||||
|
key: 'jeune_fille',
|
||||||
|
label: {
|
||||||
|
fr: value
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
get() { return this.person.altNames; }
|
||||||
|
},
|
||||||
gender: {
|
gender: {
|
||||||
set(value) { this.person.gender = value; },
|
set(value) { this.person.gender = value; },
|
||||||
get() { return this.person.gender; }
|
get() { return this.person.gender; }
|
||||||
@ -150,6 +170,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
getPersonAltNames()
|
||||||
|
.then(altNames => {
|
||||||
|
this.config.altNames = altNames;
|
||||||
|
});
|
||||||
if (this.action !== 'create') {
|
if (this.action !== 'create') {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user