BuLi-Tipp Modals zu Tabelle und Paarungsergebnissen hinzugefügt

This commit is contained in:
R40fendt
2025-06-16 21:40:40 +02:00
parent ddcd4283e5
commit c2b4707cb0
5 changed files with 60 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ TODO:
- Addhit - Addhit
- Galerie - Galerie
- BuLi-Tipp - BuLi-Tipp (Rangliste, Tippen und Übersicht)
- Startseite - Startseite
- Footer, Texte? - Footer, Texte?
- Event Fotos - Event Fotos

View File

@@ -1,9 +1,10 @@
<script lang="js"> <script lang="js">
import RitzenbergenLib from "../../ritzenbergenlib.ts"; import RitzenbergenLib from "../../ritzenbergenlib.ts";
import Modal from "../Modal.vue";
export default { export default {
props: { props: {
ergebnisse: { ergebnisse: {
type: Object, type: Array,
required: true required: true
}, },
maxspieltag: { maxspieltag: {
@@ -13,7 +14,18 @@ import RitzenbergenLib from "../../ritzenbergenlib.ts";
}, },
data(){ data(){
return { return {
RitzenbergenLib RitzenbergenLib,
showmodal: false,
modalindex: 0
}
},
components: {
Modal
},
methods: {
getbulipunktesrc(spieltag,paarung){
return RitzenbergenLib.RitzenbergenLib.api("/bulitipp/buli-punkte.php?name=null&detail=spiel&spieltag="+spieltag+"&paarung="+paarung);
} }
} }
} }
@@ -22,17 +34,19 @@ import RitzenbergenLib from "../../ritzenbergenlib.ts";
<section class="buli-results scroll-x" id="buliresults-section"> <section class="buli-results scroll-x" id="buliresults-section">
<br /><br /> <br /><br />
<h2>Paarungsergebnisse {{ maxspieltag }}. Spieltag</h2> <h2>Paarungsergebnisse {{ maxspieltag }}. Spieltag</h2>
<Modal
v-if="showmodal" @closemodal="showmodal = false">
<iframe :src="getbulipunktesrc(maxspieltag,ergebnisse[modalindex].paarung.id)" frameborder="0"></iframe>
</Modal>
<table> <table>
<tbody> <tbody>
<tr> <tr>
<td>Paarung</td> <td>Paarung</td>
<td>Ergebnis</td> <td>Ergebnis</td>
</tr> </tr>
<tr v-for="ergebnis in ergebnisse"> <tr v-for="ergebnis,i in ergebnisse">
<td> <td @click="showmodal = true; modalindex = i">
<!-- Modal -->
<!--
<iframe frameborder="0"></iframe> -->
<span class="as-link"> <span class="as-link">
<span class="teams"> <span class="teams">
<span class="team"> <span class="team">
@@ -58,4 +72,10 @@ import RitzenbergenLib from "../../ritzenbergenlib.ts";
<style scoped> <style scoped>
@import "../../assets/css/bulitipp2.css"; @import "../../assets/css/bulitipp2.css";
iframe{
width: 100%;
height: 100%;
}
</style> </style>

View File

@@ -20,6 +20,18 @@ export default {
this.modalOpen=true; this.modalOpen=true;
this.spieltag=spieltag; this.spieltag=spieltag;
this.user=user; 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: { components: {
@@ -29,7 +41,8 @@ export default {
return { return {
modalOpen: false, modalOpen: false,
spieltag: null, spieltag: null,
user: null user: null,
RitzenbergenLib: ritzenbergenlib.RitzenbergenLib
} }
}, },
computed: { computed: {
@@ -38,11 +51,17 @@ export default {
asyncComputed: { asyncComputed: {
modalContent: { modalContent: {
get(){ get(){
if(spieltag==null || user==null) return []; if(this.spieltag==undefined) return [];
let params=new URLSearchParams({ 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: [] default: []
} }
@@ -63,10 +82,11 @@ export default {
<td>Punkte</td> <td>Punkte</td>
</tr> </tr>
<tr v-for="spiel in modalContent"> <tr v-for="spiel in modalContent">
<td>0 - 0</td> <td>{{ spiel.paarung.heim }} - {{ spiel.paarung.gast }}</td>
<td>0 - 0</td> <td>{{ spiel.result[0] }} - {{ spiel.result[1] }}</td>
<td>0 - 0</td> <td v-if="spiel.tipp!=null">{{ spiel.tipp[0] }} - {{ spiel.tipp[1] }}</td>
<td>3</td> <td v-else> - </td>
<td>{{ calcPoints(spiel) }}</td>
</tr> </tr>
</table> </table>
</Modal> </Modal>

View File

@@ -45,9 +45,11 @@ class RitzenbergenLib {
class Paarung { class Paarung {
public heim: string; public heim: string;
public gast: string; public gast: string;
constructor (heim: string, gast: string) { public id: number;
constructor (heim: string, gast: string, id: number) {
this.heim = heim; this.heim = heim;
this.gast = gast; this.gast = gast;
this.id=id;
} }
} }

View File

@@ -102,7 +102,7 @@ export default {
return result2.data; return result2.data;
}) })
.then((result) => { .then((result) => {
return result.map(el => new RitzenbergenLib.Paarung(el[0],el[1])); return result.map(el => new RitzenbergenLib.Paarung(el[0],el[1],el[2]));
}) })
.catch((error) => { .catch((error) => {
return null; return null;