|
|
@ -1,5 +1,5 @@
|
|
|
|
export default{
|
|
|
|
export default{
|
|
|
|
emits: ['addTeams'],
|
|
|
|
emits: ['addTeam'],
|
|
|
|
data : function(){
|
|
|
|
data : function(){
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
Home: '',
|
|
|
|
Home: '',
|
|
|
@ -8,22 +8,48 @@ export default{
|
|
|
|
id:'',
|
|
|
|
id:'',
|
|
|
|
name:'',
|
|
|
|
name:'',
|
|
|
|
description:'',
|
|
|
|
description:'',
|
|
|
|
clicked: false
|
|
|
|
clicked: false,
|
|
|
|
|
|
|
|
errMessage:''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
pushTeam: function() {
|
|
|
|
myfun: function() {
|
|
|
|
let team = new Team(this.id, this.name);
|
|
|
|
this.clicked=!this.clicked;
|
|
|
|
this.$emit('addTeams',team);
|
|
|
|
},
|
|
|
|
|
|
|
|
checkFields: function() {
|
|
|
|
|
|
|
|
if(this.id===""){
|
|
|
|
|
|
|
|
this.errMessage+="The id field must be required "
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(this.name===""){
|
|
|
|
|
|
|
|
this.errMessage+="The name field must be required "
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(this.description===""){
|
|
|
|
|
|
|
|
this.errMessage+="The description field must be required "
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
if(this.name.lenght<5){
|
|
|
|
|
|
|
|
this.errMessage+="The name must have at least 5 caracters "
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.description.lenght<20){
|
|
|
|
|
|
|
|
this.description+="The description must have at least 20 caracters "
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(this.errMessage.length===0){
|
|
|
|
|
|
|
|
console.log("jappelle la fonction")
|
|
|
|
|
|
|
|
this.addTeam();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
addTeam: function() {
|
|
|
|
|
|
|
|
let team = new Team(this.id, this.name, this.description);
|
|
|
|
|
|
|
|
console.log(team);
|
|
|
|
|
|
|
|
this.$emit("addTeam",team);
|
|
|
|
this.id='';
|
|
|
|
this.id='';
|
|
|
|
this.name='';
|
|
|
|
this.name='';
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
myfun: function() {
|
|
|
|
myfun: function() {
|
|
|
|
console.log("gngn");
|
|
|
|
console.log("gngn");
|
|
|
|
this.clicked=!this.clicked;
|
|
|
|
this.clicked=!this.clicked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template:
|
|
|
|
template:
|
|
|
|
`
|
|
|
|
`
|
|
|
@ -34,6 +60,7 @@ export default{
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<form @submit.prevent v-if="clicked">
|
|
|
|
<form @submit.prevent v-if="clicked">
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<label>{{errMessage}}</label><br/>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<label>id</label><br/>
|
|
|
|
<label>id</label><br/>
|
|
|
|
<input type="number" v-model="id"/>
|
|
|
|
<input type="number" v-model="id"/>
|
|
|
@ -44,7 +71,12 @@ export default{
|
|
|
|
<input type="text" v-model="name"/>
|
|
|
|
<input type="text" v-model="name"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<input type="submit" value="Submit" @click="pushTeam"/>
|
|
|
|
<div>
|
|
|
|
|
|
|
|
<label>Description</label><br/>
|
|
|
|
|
|
|
|
<textarea v-model="description"></textarea>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<input type="submit" value="Submit" v-on:click="checkFields"/>
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
`
|
|
|
|
`
|
|
|
|
}
|
|
|
|
}
|
|
|
|