Commit cd52def6 authored by Jean Rabreau's avatar Jean Rabreau
Browse files

馃拕don't show labs fields if internal has none.

parent a5926646
<template>
<v-form ref="personalInfoForm">
<fieldset :disabled="!isExternal">
<legend>{{ $t('profile.personalInfo') }}</legend>
<legend id="personal__infos">{{ $t('profile.personalInfo') }}</legend>
<v-col>
<v-text-field
v-model="newPersonalInfo.firstName"
......@@ -23,15 +23,14 @@
:rules="requiredField"
/>
</v-col>
<fieldset>
<v-col>
<v-textarea
v-model="newPersonalInfo.info.bio"
:label="$t('profile.bio')"
/>
</v-col>
</fieldset>
</fieldset>
<v-col>
<v-textarea
v-model="newPersonalInfo.info.bio"
:label="$t('profile.bio')"
/>
</v-col>
<fieldset>
<legend>Affiliations</legend>
<fieldset :disabled="!isExternal">
......@@ -45,7 +44,7 @@
</v-col>
</fieldset>
<fieldset :disabled="!isExternal">
<fieldset :disabled="!isExternal" v-if="labDisplay">
<legend>
{{ $t('profile.researchLab.field') }}
<div v-if="isExternal">
......@@ -132,9 +131,14 @@ export default {
default: false,
},
},
data: () => ({
newPersonalInfo: {},
}),
data() {
return {
labDisplay: this.isExternal || !!this.personalInfo.info.researchLabs.length,
newPersonalInfo: {
...this.personalInfo
},
}
},
methods: {
onSubmit() {
if (this.$refs.personalInfoForm.validate()) {
......@@ -150,20 +154,9 @@ export default {
})
},
removeLab() {
const labs = this.newPersonalInfo.info.researchLabs
if (labs.length < 2) {
const lastLab = labs[0]
for (const key in lastLab) {
lastLab[key] =''
}
} else {
labs.pop()
}
this.newPersonalInfo.info.researchLabs.pop()
}
},
created() {
this.newPersonalInfo = this.personalInfo
},
};
</script>
......
......@@ -12,9 +12,7 @@
<profile-form
ref="profileForm"
:personalInfo.sync="personalInfo"
:email.sync="email"
:is-external="isExternal"
@change-password="onChangePassword"
/>
<v-dialog v-if="isExternal" v-model="passModal">
<template v-slot:activator="{ attrs }">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment