mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
person: add altnames in the onthefly component
This commit is contained in:
parent
047083812e
commit
8affeb08d9
@ -31,9 +31,8 @@
|
||||
<label for="firstname">{{ $t('person.firstname') }}</label>
|
||||
</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" @change="enterAltName(value, a)" /> -->
|
||||
<input class="form-control form-control-lg" :id="a.key" v-model="person.altNames[i]" />
|
||||
<div v-for="(a) in config.altNames" :key="a.key" class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" :id="a.key" @input="onAltNameInput" />
|
||||
<label :for="a.key">{{ a.labels.fr }}</label>
|
||||
</div>
|
||||
|
||||
@ -109,16 +108,12 @@ export default {
|
||||
config: {
|
||||
altNames: []
|
||||
},
|
||||
dataAltNames: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
firstName: {
|
||||
set(value) {
|
||||
console.log(value)
|
||||
console.log(this.dataAltNames)
|
||||
this.person.firstName = value;
|
||||
//this.person.altNames = ['CACA'];
|
||||
},
|
||||
get() { return this.person.firstName; }
|
||||
},
|
||||
@ -126,19 +121,6 @@ export default {
|
||||
set(value) { this.person.lastName = value; },
|
||||
get() { return this.person.lastName; }
|
||||
},
|
||||
// altNames: {
|
||||
// set(value) {
|
||||
// console.log(value)
|
||||
// this.person.altNames=
|
||||
// {
|
||||
// key: value.key, //TODO! // person.altNames is filled by some magic
|
||||
// label: {
|
||||
// fr: value
|
||||
// }
|
||||
// };
|
||||
// },
|
||||
// get() { return this.person.altNames; }
|
||||
// },
|
||||
gender: {
|
||||
set(value) { this.person.gender = value; },
|
||||
get() { return this.person.gender; }
|
||||
@ -167,10 +149,6 @@ export default {
|
||||
set(value) { this.person.email = value; },
|
||||
get() { return this.person.email; }
|
||||
},
|
||||
enterAltName(value, a) {
|
||||
console.log('altname value entered', value)
|
||||
console.log(a)
|
||||
},
|
||||
genderClass() {
|
||||
switch (this.person.gender) {
|
||||
case 'woman':
|
||||
@ -212,7 +190,16 @@ export default {
|
||||
console.log('get person', this.person);
|
||||
resolve();
|
||||
}));
|
||||
}
|
||||
},
|
||||
onAltNameInput(event) {
|
||||
const key = event.target.id;
|
||||
const label = event.target.value;
|
||||
let updateAltNames = this.person.altNames.filter((a) => a.key !== key);
|
||||
updateAltNames.push(
|
||||
{'key': key, 'label': label}
|
||||
)
|
||||
this.person.altNames = updateAltNames;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user