minor fixes

This commit is contained in:
Felix
2020-03-12 20:03:52 +01:00
parent 77379f5520
commit d3f71692a0
10 changed files with 130 additions and 42 deletions

View File

@@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html>
<head>
<!-- development version, includes helpful console warnings -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script><!-- production version, optimized for size and speed -->
<!-- <script src="https://cdn.jsdelivr.net/npm/vue"></script>-->
<!-- development version, includes helpful console warnings -->
<!-- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> -->
<!-- production version, optimized for size and speed -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.js"></script>
<title>Stundenplan Pflege</title>
@@ -12,6 +15,11 @@
#editmode table, th, td {
border: 1px solid black;
}
#edit-heading {
font-size: x-large;
padding-left: 30px;
}
#editmode input {
border: 0;
@@ -34,8 +42,9 @@
}
#readonly-heading {
font-size: x-large;
font-size: xx-large;
padding-left: 30px;
margin-top: 0;
}
#readonly-table {
@@ -97,7 +106,7 @@
<p style="text-align: center"><span style="white-space: pre-line;">{{caption}}</span></p>
</div>
<div id="editmode">
<input type="text"
<input id="edit-heading" type="text"
v-model="heading">
<table id="table"
ref="table"
@@ -121,7 +130,7 @@
v-model="getSchuduleItem(day, slot).to"></p>
<p id="item-title">
<textarea v-model="getSchuduleItem(day, slot).title"></textarea></p>
</div>Eingaben löschen
</div><input type="button" v-on:click="resetScheduleItem(day, slot)" value="Zurücksetzen">
</td>
</tr>
</table><input style="border: 1px solid black"
@@ -145,11 +154,30 @@
amountSlots: 6,
pw: "Passwort",
heading: "Stundenplan 2019",
caption: "* mit Stillberaterin und Kinderkrankenschwester Rhianon Grill\nf\u00fcr mehr Angebote rund um Mama/Baby www.stillberatungimrottal.de",
scheduleData:{"Montag": [{"from": "09:00", "to": "10:15", "title": "Hatha Joga"}, {"from": "10:30", "to": "11:45", "title": "Joga f\u00fcr Schwangere"}, {}, {"title": ""}, {"from": "", "to": "", "title": ""}, {}], "Dienstag": [{}, {}, {"from": "15:30", "to": "16:30", "title": "Musikgarten"}, {"from": "18:00", "to": "19:30", "title": "Hatha/Vinjasa Yoga"}, {}, {}], "Mittwoch": [{"from": "09:00", "to": "10:15", "title": "R\u00fcckbildung"}, {"from": "10:30", "to": "11:30", "title": "Fit f\u00fcr Dich"}, {}, {}, {}, {}], "Donnerstag": [{"from": "09:00", "to": "10:00", "title": "Babymassage"}, {"from": "10:00", "to": "11:15", "title": "R\u00fcckbildung"}, {}, {}, {}, {}], "Freitag": [{"from": "09:00", "to": "10:30", "title": "Stilltreff * 2 w\u00f6chentlich"}, {}, {"from": "16:00", "to": "19:00", "title": "Geburtsvorbereitung"}, {}, {}, {}], "Samstag": [{"from": "09:00", "to": "12:00", "title": "Geburtsvorbereitung"}, {}, {}, {}, {}, {}]}
caption: "* mit Stillberaterin und Kinderkrankenschwester Rhianon Grill\nfür mehr Angebote rund um Mama/Baby www.stillberatungimrottal.de",
scheduleData:{"Montag": [{"from": "09:00", "to": "10:15", "title": "Hatha Joga"}, {"from": "10:30", "to": "11:45", "title": "Joga für Schwangere"}, {}, {"title": ""}, {"from": "", "to": "", "title": ""}, {}], "Dienstag": [{}, {}, {"from": "15:30", "to": "16:30", "title": "Musikgarten"}, {"from": "18:00", "to": "19:30", "title": "Hatha/Vinjasa Yoga"}, {}, {}], "Mittwoch": [{"from": "09:00", "to": "10:15", "title": "Rückbildung"}, {"from": "10:30", "to": "11:30", "title": "Fit für Dich"}, {}, {}, {}, {}], "Donnerstag": [{"from": "09:00", "to": "10:00", "title": "Babymassage"}, {"from": "10:00", "to": "11:15", "title": "Rückbildung"}, {}, {}, {}, {}], "Freitag": [{"from": "09:00", "to": "10:30", "title": "Stilltreff * 2 wöchentlich"}, {}, {"from": "16:00", "to": "19:00", "title": "Geburtsvorbereitung"}, {}, {}, {}], "Samstag": [{"from": "09:00", "to": "12:00", "title": "Geburtsvorbereitung"}, {}, {}, {}, {}, {}]}
}
},
created() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (this.readyState != 4) return;
if (this.status == 200) {
var data = JSON.parse(this.response);
window.app.restoreSettings(data);
}
};
xhr.open("GET", "https://beta.kurswerkstatt-pan.de/api/schedule", true);
xhr.send();
},
methods: {
restoreSettings: function(data) {
this.scheduleData = data.schedule;
this.heading = data.heading;
this.caption = data.caption;
},
getSchuduleItem: function(day, slot) {
return this.scheduleData[day][slot-1];
},
@@ -161,21 +189,25 @@
saveSchedule: function() {
var xhr = new XMLHttpRequest();
// xhr.open("POST", "https://kurswerkstatt-pan.de/api/schedule", true);
xhr.open("POST", "http://localhost:8080", true);
xhr.open("POST", "https://beta.kurswerkstatt-pan.de/api/schedule", true);
xhr.setRequestHeader('Content-Type', 'application/html');
xhr.onload = function(e) {
alert("Gespeichert")
e.target.status === 200 ? alert("Gespeichert") : alert("Fehler: Falsches Passwort?")
}
xhr.onerror = function(e) {
alert("Fehler: \"Datei exportieren\"-Button klicken und Datei Felix schicken")
}
xhr.send(JSON.stringify({
pw: this.pw,
schedule: this.scheduleData,
caption: this.caption,
heading: this.heading
}));
domtoimage.toJpeg(document.getElementById('readonlydiv'), { quality: 0.95 })
.then((scheduleImage) => {
xhr.send(JSON.stringify({
pw: this.pw,
schedule: this.scheduleData,
caption: this.caption,
heading: this.heading,
image: scheduleImage.split(',')[1]
}));
})
},
scheduleToImage: function () {
domtoimage.toJpeg(document.getElementById('readonlydiv'), { quality: 0.95 })