|
|
|
@ -9,27 +9,42 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
addTeam: function() {
|
|
|
|
|
this.errorMessage = '';
|
|
|
|
|
if (!this.id ){
|
|
|
|
|
this.errorMessage = 'ID is required !';
|
|
|
|
|
return;
|
|
|
|
|
}else if (!this.name){
|
|
|
|
|
this.errorMessage = 'Name is required !';
|
|
|
|
|
return
|
|
|
|
|
}else if(!this.description) {
|
|
|
|
|
this.errorMessage = 'Description is required !';
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
addTeam: function () {
|
|
|
|
|
try {
|
|
|
|
|
this.errorMessage = '';
|
|
|
|
|
if (!this.id) {
|
|
|
|
|
this.name = '';
|
|
|
|
|
this.description= '';
|
|
|
|
|
throw new RequiredFieldError("ID");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!this.name) {
|
|
|
|
|
this.id = '';
|
|
|
|
|
this.description= '';
|
|
|
|
|
throw new RequiredFieldError("Name");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!this.description){
|
|
|
|
|
this.id = '';
|
|
|
|
|
this.name = '';
|
|
|
|
|
throw new RequiredFieldError("Description");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const team = { id: this.id, name: this.name, description: this.description};
|
|
|
|
|
console.log('form.addTeam', team);
|
|
|
|
|
|
|
|
|
|
const team = { id: this.id, name: this.name, description: this.description};
|
|
|
|
|
console.log('form.addTeam', team);
|
|
|
|
|
this.$emit('addTeam', team);
|
|
|
|
|
|
|
|
|
|
this.$emit('addTeam', team);
|
|
|
|
|
this.id = '';
|
|
|
|
|
this.name = '';
|
|
|
|
|
this.description = '';
|
|
|
|
|
|
|
|
|
|
this.id = '';
|
|
|
|
|
this.name = '';
|
|
|
|
|
this.description = '';
|
|
|
|
|
} catch (error) {
|
|
|
|
|
if (error instanceof RequiredFieldError) {
|
|
|
|
|
this.errorMessage=error
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
template: `<section>
|
|
|
|
|