BuLi-Tipp Modals zu Tabelle und Paarungsergebnissen hinzugefügt
This commit is contained in:
@@ -20,6 +20,18 @@ export default {
|
||||
this.modalOpen=true;
|
||||
this.spieltag=spieltag;
|
||||
this.user=user;
|
||||
},
|
||||
calcPoints(spiel){
|
||||
if(spiel.tipp==null) return 0;
|
||||
if(spiel.result==spiel.tipp) return 3;
|
||||
let differenztipp=spiel.tipp[0]-spiel.tipp[1];
|
||||
let differenz=spiel.result[0]-spiel.result[1];
|
||||
if(differenztipp==differenz) return 2;
|
||||
if(
|
||||
(spiel.tipp[0]>spiel.tipp[1] && spiel.result[0]>spiel.result[1]) ||
|
||||
(spiel.tipp[0]<spiel.tipp[1] && spiel.result[0]<spiel.result[1])
|
||||
) return 1;
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -29,7 +41,8 @@ export default {
|
||||
return {
|
||||
modalOpen: false,
|
||||
spieltag: null,
|
||||
user: null
|
||||
user: null,
|
||||
RitzenbergenLib: ritzenbergenlib.RitzenbergenLib
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -38,11 +51,17 @@ export default {
|
||||
asyncComputed: {
|
||||
modalContent: {
|
||||
get(){
|
||||
if(spieltag==null || user==null) return [];
|
||||
if(this.spieltag==undefined) return [];
|
||||
let params=new URLSearchParams({
|
||||
|
||||
spieltag: this.spieltag+1,
|
||||
user: this.ts[this.spieltag][this.user].user.id
|
||||
});
|
||||
return fetch(RitzenbergenLib.api("")+params.toString());
|
||||
return fetch(this.RitzenbergenLib.api("/bulitipp/spieltag-user.php?")+params.toString()).then((response)=>{
|
||||
return response.json();
|
||||
}).then((data)=>{
|
||||
return data.data;
|
||||
})
|
||||
;
|
||||
},
|
||||
default: []
|
||||
}
|
||||
@@ -63,10 +82,11 @@ export default {
|
||||
<td>Punkte</td>
|
||||
</tr>
|
||||
<tr v-for="spiel in modalContent">
|
||||
<td>0 - 0</td>
|
||||
<td>0 - 0</td>
|
||||
<td>0 - 0</td>
|
||||
<td>3</td>
|
||||
<td>{{ spiel.paarung.heim }} - {{ spiel.paarung.gast }}</td>
|
||||
<td>{{ spiel.result[0] }} - {{ spiel.result[1] }}</td>
|
||||
<td v-if="spiel.tipp!=null">{{ spiel.tipp[0] }} - {{ spiel.tipp[1] }}</td>
|
||||
<td v-else> - </td>
|
||||
<td>{{ calcPoints(spiel) }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user