Réparation du bug de la q8

master
Raphael LACOTE 2 years ago
parent babf248744
commit 10e2b58138

@ -18,6 +18,12 @@ export default {
addTeam: function () { addTeam: function () {
try { try {
if (this.teamAEdit != null) {
this.id = this.teamAEdit.id
this.name = this.teamAEdit.name
this.description = this.teamAEdit.description
}
this.errorMessage = ''; this.errorMessage = '';
if (!this.id) { if (!this.id) {
throw new RequiredFieldError("ID"); throw new RequiredFieldError("ID");
@ -38,12 +44,13 @@ export default {
throw new StringSize("Name", NAME_MINIMAL_SIZE) throw new StringSize("Name", NAME_MINIMAL_SIZE)
} }
const team = { id: this.id, name: this.name, description: this.description}; const team = { id: this.id, name: this.name, description: this.description };
console.log('form.addTeam', team);
if (this.teamAEdit != null) { if (this.teamAEdit != null) {
this.$emit('teamModifie', team); this.$emit('teamModifie', team);
} else { } else {
this.$emit('teamAjoute', team); this.$emit('teamAjoute', team);
} }
@ -67,15 +74,18 @@ export default {
<div v-bind:style="{ color: errorColor}">{{ errorMessage }}</div> <div v-bind:style="{ color: errorColor}">{{ errorMessage }}</div>
<div> <div>
<label>ID</label><br/> <label>ID</label><br/>
<input type="text" v-model="this.id" /> <p v-if=this.teamAEdit><input type="text" v-model="this.teamAEdit.id" /></p>
<p v-else><input type="text" v-model="this.id" /></p>
</div> </div>
<div> <div>
<label>Name</label><br/> <label>Name</label><br/>
<input type="text" v-model="name"/> <p v-if=this.teamAEdit><input type="text" v-model="this.teamAEdit.name" /></p>
<p v-else><input type="text" v-model="this.name" /></p>
</div> </div>
<div> <div>
<label>Description</label><br/> <label>Description</label><br/>
<textarea v-model="description"></textarea> <p v-if=this.teamAEdit><textarea v-model="this.teamAEdit.description"/></p>
<p v-else><textarea v-model="this.description" /></p>
</div> </div>
<input type="submit" value="Create Team" @click="addTeam"/> <input type="submit" value="Create Team" @click="addTeam"/>
</form> </form>

Loading…
Cancel
Save