Merge branch 'master' of github.com:Luker666/Kurswerkstatt-Pan

This commit is contained in:
2020-03-13 15:52:11 +01:00
10 changed files with 132 additions and 86 deletions

View File

@@ -9,42 +9,24 @@ import json
import logging import logging
import os import os
import datetime import datetime
import base64
class S(BaseHTTPRequestHandler): class S(BaseHTTPRequestHandler):
def do_OPTIONS(self): def do_OPTIONS(self):
self.send_response(200, "ok") self.send_response(200, "ok")
# TODO remove in production
self.send_header('Access-Control-Allow-Origin', '*')
# TODO remove in production
self.send_header('Access-Control-Allow-Methods', 'GET, OPTIONS')
# TODO remove in production
self.send_header("Access-Control-Allow-Headers", "X-Requested-With")
# TODO remove in production
self.send_header("Access-Control-Allow-Headers", "Content-Type")
self.end_headers()
def do_GET(self): def do_GET(self):
self.send_response(200) self.send_response(200)
self.send_header('Content-Type', 'application/json') self.send_header('Content-Type', 'application/json')
self.end_headers() self.end_headers()
with open('schedule.json', 'r') as file: with open('data/schedule.json', 'r') as file:
schedule_string = json.load(file) schedule_string = json.load(file)
self.wfile.write(json.dumps(schedule_string).encode('utf-8')) self.wfile.write(json.dumps(schedule_string).encode('utf-8'))
def do_POST(self): def do_POST(self):
self.send_response(200, "ok")
# TODO remove in production
self.send_header('Access-Control-Allow-Origin', '*')
# TODO remove in production
self.send_header('Access-Control-Allow-Methods', 'GET, OPTIONS')
# TODO remove in production
self.send_header("Access-Control-Allow-Headers", "X-Requested-With")
# TODO remove in production
self.send_header("Access-Control-Allow-Headers", "Content-Type")
self.end_headers()
content_length = int(self.headers['Content-Length']) content_length = int(self.headers['Content-Length'])
request_raw = self.rfile.read(content_length) request_raw = self.rfile.read(content_length)
request_content = json.loads(request_raw) request_content = json.loads(request_raw)
@@ -52,8 +34,9 @@ class S(BaseHTTPRequestHandler):
pw = request_content['pw'] pw = request_content['pw']
caption = request_content['caption'] caption = request_content['caption']
heading = request_content['heading'] heading = request_content['heading']
image = request_content['image']
if pw != '123': if pw != 'kurswerk':
self.send_response(401) self.send_response(401)
self.send_header('Content-Type', 'text/html') self.send_header('Content-Type', 'text/html')
self.end_headers() self.end_headers()
@@ -65,13 +48,16 @@ class S(BaseHTTPRequestHandler):
schedule_and_caption['heading'] = heading schedule_and_caption['heading'] = heading
now = datetime.datetime.now() now = datetime.datetime.now()
try: try:
os.rename('schedule.json', 'schedule_{}.json'.format(now.strftime("%Y%m%d"))) os.rename('data/schedule.json', 'data/schedule_{}.json'.format(now.strftime("%Y%m%d")))
except Exception: except Exception:
logging.info('Backup exists, did not backup..') logging.info('Backup exists, did not backup..')
pass pass
with open('schedule.json', 'w') as file: with open('data/schedule.json', 'w') as file:
json.dump(schedule_and_caption, file) json.dump(schedule_and_caption, file)
with open('data/schedule.jpg', 'wb') as f:
f.write(base64.b64decode(image))
self.send_response(200) self.send_response(200)
self.send_header('Content-Type', 'text/html') self.send_header('Content-Type', 'text/html')
self.end_headers() self.end_headers()
@@ -96,4 +82,4 @@ if __name__ == '__main__':
if len(argv) == 2: if len(argv) == 2:
run(port=int(argv[1])) run(port=int(argv[1]))
else: else:
run() run()

58
backend/nginx.conf Normal file
View File

@@ -0,0 +1,58 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
disable_symlinks off;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
upstream backend {
server kurswerkstatt-pan_backend:8080;
}
server {
root /usr/share/nginx/html;
location /api/ {
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
proxy_redirect off;
proxy_http_version 1.1;
proxy_pass http://backend;
proxy_set_header Host $host ;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
try_files $uri $uri/ /index.html;
}
}
include /etc/nginx/conf.d/*.conf;
}

BIN
data/schedule.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

1
data/schedule.json Normal file
View File

@@ -0,0 +1 @@
{"schedule": {"Montag": [{"from": "09:00", "to": "10:00", "title": "Pilates #"}, {}, {}, {"title": ""}, {"from": "", "to": "", "title": ""}, {}], "Dienstag": [{"from": "09:00", "to": "10:00", "title": "Fit f\u00fcr Dich\n(mit Julia)"}, {"from": "10:15", "to": "11:30", "title": "R\u00fcckbildung\n(mit Julia)"}, {}, {}, {}, {}], "Mittwoch": [{"from": "09:00", "to": "10:00", "title": "Babymassage\n(mit Julia)"}, {}, {}, {}, {"from": "17:30", "to": "18:30", "title": "Fit f\u00fcr Dich\n(mit Julia)"}, {}], "Donnerstag": [{"from": "09:00", "to": "10:15", "title": "R\u00fcckbildung \n(mit Julia)"}, {}, {}, {}, {"from": "18:15", "to": "19:45", "title": "Progressive \nMuskelentspannung \n(n. Jacobsen) \""}, {}], "Freitag": [{"from": "09:00", "to": "10:30", "title": "Still-\n und Elterntreff *\n(1x im Monat)"}, {}, {}, {}, {}, {}], "Samstag": [{}, {}, {}, {}, {}, {}]}, "caption": "# mit Physiotherapeutin Timea Sobotta\n\" mit Physiotherapeutin Felicitas Sch\u00f6nberger\n* mit Stillberaterin und Kinderkrankenschwester Rhianon Grill\n", "heading": "Stundenplan 2020"}

View File

@@ -0,0 +1 @@
{"schedule": {"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\u00fcr mehr Angebote rund um Mama/Baby www.stillberatungimrottal.de", "heading": "Stundenplan 2019"}

View File

@@ -0,0 +1 @@
{"schedule": {"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\u00fcr mehr Angebote rund um Mama/Baby www.stillberatungimrottal.de", "heading": "Stundenplan 2019"}

View File

@@ -0,0 +1 @@
{"schedule": {"Montag": [{"from": "09:00", "to": "10:15", "title": "Hatha Yoga"}, {"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\u00fcr mehr Angebote rund um Mama/Baby www.stillberatungimrottal.de", "heading": "Stundenplan 2019"}

View File

@@ -0,0 +1 @@
{"schedule": {"Montag": [{"from": "09:00", "to": "10:00", "title": "Pilates #"}, {}, {}, {"title": ""}, {"from": "", "to": "", "title": ""}, {}], "Dienstag": [{"from": "09:00", "to": "10:00", "title": "Fit f\u00fcr Dich\n(mit Julia)"}, {"from": "10:15", "to": "11:30", "title": "R\u00fcckbildung\n(mit Julia)"}, {}, {}, {}, {}], "Mittwoch": [{"from": "09:00", "to": "10:00", "title": "Babymassage\n(mit Julia)"}, {}, {}, {}, {"from": "17:30", "to": "18:30", "title": "Fit f\u00fcr Dich\n(mit Julia)"}, {}], "Donnerstag": [{"from": "09:00", "to": "10:15", "title": "R\u00fcckbildung \n(mit Julia)"}, {}, {}, {}, {"from": "18:15", "to": "19:45", "title": "Progressive \nMuskelentspannung \n(n. Jacobsen) \""}, {}], "Freitag": [{"from": "09:00", "to": "10:30", "title": "Still-\n und Elterntreff *\n(1x im Monat)"}, {}, {}, {}, {}, {}], "Samstag": [{}, {}, {}, {}, {}, {}]}, "caption": "# mit Physiotherapeutin Timea Sobotta\n\" mit Physiotherapeutin Felicitas Sch\u00f6nberger\n* mit Stillberaterin und Kinderkrankenschwester Rhianon Grill\n", "heading": "Stundenplan 2020"}

View File

@@ -63,9 +63,6 @@
<li class="nav-item mx-0 mx-lg-1"> <li class="nav-item mx-0 mx-lg-1">
<a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="#aktuelles">Aktuelles</a> <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="#aktuelles">Aktuelles</a>
</li> </li>
<li class="nav-item mx-0 mx-lg-1">
<a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="#yoga">Yoga</a>
</li>
<li class="nav-item mx-0 mx-lg-1"> <li class="nav-item mx-0 mx-lg-1">
<a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="#mama">Mama/Baby</a> <a class="nav-link py-3 px-0 px-lg-3 rounded js-scroll-trigger" href="#mama">Mama/Baby</a>
</li> </li>
@@ -153,17 +150,6 @@
<br> <br>
<br> <br>
<h4 class="text-center text-uppercase text-secondary mb-3"> <h4 class="text-center text-uppercase text-secondary mb-3">
<a class="text-center text-uppercase text-secondary mb-3">Sofia Fenner<br></a><br>
<a class="text-center text-secondary mb-3" href="mailto:Sofia.Fenner@Kurswerkstatt-pan.de">Sofia.Fenner@<br>Kurswerkstatt-pan.de</a>
<br>
<a class="text-center text-uppercase text-secondary mb-3" href="tel: +49/176/30328110">Tel: 0176/30328110</a>
<br>
<h4> Angebot: </h4>
<p class = "lead">Yoga, Schwangerenyoga, Schwangerenmassage, Thai-Yoga-Massage, Ganzkörpermassage, Fussreflexzonenbehandlung</p>
</h4>
<br>
<br>
<h4 class="text-center text-uppercase text-secondary mb-3">
<a class="text-center text-uppercase text-secondary mb-3">Evi Eberl</a><br> <a class="text-center text-uppercase text-secondary mb-3">Evi Eberl</a><br>
<br> <br>
<a class="text-center text-uppercase text-secondary mb-3" href="tel: +49 170 2342143">Tel: 0170/2342143</a> <a class="text-center text-uppercase text-secondary mb-3" href="tel: +49 170 2342143">Tel: 0170/2342143</a>
@@ -193,31 +179,15 @@
<div class="container"> <div class="container">
<h2 class="text-center text-uppercase text-secondary mb-3">Aktuelles</h2> <h2 class="text-center text-uppercase text-secondary mb-3">Aktuelles</h2>
<br> <br>
<h4 class="text-center text-uppercase text-secondary mb-3">Stundenplan 2019</h4> <h4 class="text-center text-uppercase text-secondary mb-3">Stundenplan</h4>
<br> <br>
<div class="Image"> <div class="Image">
<img class="img-responsive100" src="img/portfolio/Stundenplan.jpg" alt=""> <!-- <img class="img-responsive100" src="img/portfolio/Stundenplan.jpg" alt="Stundenplan 2019"> -->
<img class="img-responsive100" src="data/schedule.jpg" alt="Stundenplan">
</div> </div>
</section> </section>
<!-- Yoga Grid Section -->
<section class="yoga" id="yoga">
<div class="container">
<div class="Image">
<img class="img-responsive" src="img/portfolio/yoga.jpg" alt="">
</div>
<br>
<p class= "lead">
Wir bieten in unseren Stunden kräftigende, fließende Asanas kombiniert mit entspannenden
ruhigen Haltungen an. Der Atem steht immer im Zentrum der Bewegung.
Ziel der Übungsstunde ist, dir als Schüler, mit Genauigkeit, ausführliche Hilfestellung zu bieten
um sowohl Entspannungsabfolgen als auch fließende Bewegungssequenzen zu üben. Komm
vorbei und probier Yoga für dich aus. <br>
Yoga ist ein Geschenk, dir selbst näher zu kommen.
</p>
</section>
<!-- Mama/Baby Grid Section --> <!-- Mama/Baby Grid Section -->
<section class="mama" id="mama"> <section class="mama" id="mama">
<div class="container"> <div class="container">
@@ -352,17 +322,6 @@
</a> </a>
<p class="mb-5">Julia Schoske</p> <p class="mb-5">Julia Schoske</p>
</div> </div>
<div class="col-md-6 col-lg-4">
<a class="portfolio-item d-block mx-auto" href="#portfolio-modal-2">
<div class="portfolio-item-caption d-flex position-absolute h-100 w-100">
<div class="portfolio-item-caption-content my-auto w-100 text-center text-white">
<i class="fas fa-search-plus fa-3x"></i>
</div>
</div>
<img class="img-fluid" src="img/portfolio/Sofia_400.jpg" alt="">
</a>
<p class="mb-5">Sofia Fenner</p>
</div>
</section> </section>
@@ -379,7 +338,7 @@
<div class="col-md-4 mb-5 mb-lg-0"> <div class="col-md-4 mb-5 mb-lg-0">
<ul class="list-inline mb-0"> <ul class="list-inline mb-0">
<li class="list-inline-item"> <li class="list-inline-item">
<a class="btn btn-outline-light btn-social text-center rounded-circle" href=""> <a class="btn btn-outline-light btn-social text-center rounded-circle" href="https://www.facebook.com/KurswerkstattPfarrkirchen/"target="_blank">
<i class="fab fa-fw fa-facebook-f"></i> <i class="fab fa-fw fa-facebook-f"></i>
</a> </a>
</li> </li>
@@ -496,6 +455,12 @@
<!-- Custom scripts for this template --> <!-- Custom scripts for this template -->
<script src="js/freelancer.min.js"></script> <script src="js/freelancer.min.js"></script>
<script>
$(function(){
$("#schedule-placeholder").load("view-schedule.html");
});
</script>
</body> </body>
</html> </html>

View File

@@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <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 --> <!-- development version, includes helpful console warnings -->
<!-- <script src="https://cdn.jsdelivr.net/npm/vue"></script>--> <!-- <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> <script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.js"></script>
<title>Stundenplan Pflege</title> <title>Stundenplan Pflege</title>
@@ -12,6 +15,11 @@
#editmode table, th, td { #editmode table, th, td {
border: 1px solid black; border: 1px solid black;
} }
#edit-heading {
font-size: x-large;
padding-left: 30px;
}
#editmode input { #editmode input {
border: 0; border: 0;
@@ -34,8 +42,9 @@
} }
#readonly-heading { #readonly-heading {
font-size: x-large; font-size: xx-large;
padding-left: 30px; padding-left: 30px;
margin-top: 0;
} }
#readonly-table { #readonly-table {
@@ -97,7 +106,7 @@
<p style="text-align: center"><span style="white-space: pre-line;">{{caption}}</span></p> <p style="text-align: center"><span style="white-space: pre-line;">{{caption}}</span></p>
</div> </div>
<div id="editmode"> <div id="editmode">
<input type="text" <input id="edit-heading" type="text"
v-model="heading"> v-model="heading">
<table id="table" <table id="table"
ref="table" ref="table"
@@ -121,7 +130,7 @@
v-model="getSchuduleItem(day, slot).to"></p> v-model="getSchuduleItem(day, slot).to"></p>
<p id="item-title"> <p id="item-title">
<textarea v-model="getSchuduleItem(day, slot).title"></textarea></p> <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> </td>
</tr> </tr>
</table><input style="border: 1px solid black" </table><input style="border: 1px solid black"
@@ -145,11 +154,30 @@
amountSlots: 6, amountSlots: 6,
pw: "Passwort", pw: "Passwort",
heading: "Stundenplan 2019", heading: "Stundenplan 2019",
caption: "* mit Stillberaterin und Kinderkrankenschwester Rhianon Grill\nf\u00fcr mehr Angebote rund um Mama/Baby www.stillberatungimrottal.de", 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\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"}, {}, {}, {}, {}, {}]} 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://kurswerkstatt-pan.de/api/schedule", true);
xhr.send();
},
methods: { methods: {
restoreSettings: function(data) {
this.scheduleData = data.schedule;
this.heading = data.heading;
this.caption = data.caption;
},
getSchuduleItem: function(day, slot) { getSchuduleItem: function(day, slot) {
return this.scheduleData[day][slot-1]; return this.scheduleData[day][slot-1];
}, },
@@ -161,21 +189,25 @@
saveSchedule: function() { saveSchedule: function() {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
// xhr.open("POST", "https://kurswerkstatt-pan.de/api/schedule", true); xhr.open("POST", "https://kurswerkstatt-pan.de/api/schedule", true);
xhr.open("POST", "http://localhost:8080", true);
xhr.setRequestHeader('Content-Type', 'application/html'); xhr.setRequestHeader('Content-Type', 'application/html');
xhr.onload = function(e) { xhr.onload = function(e) {
alert("Gespeichert") e.target.status === 200 ? alert("Gespeichert") : alert("Fehler: Falsches Passwort?")
} }
xhr.onerror = function(e) { xhr.onerror = function(e) {
alert("Fehler: \"Datei exportieren\"-Button klicken und Datei Felix schicken") alert("Fehler: \"Datei exportieren\"-Button klicken und Datei Felix schicken")
} }
xhr.send(JSON.stringify({
pw: this.pw, domtoimage.toJpeg(document.getElementById('readonlydiv'), { quality: 0.95 })
schedule: this.scheduleData, .then((scheduleImage) => {
caption: this.caption, xhr.send(JSON.stringify({
heading: this.heading pw: this.pw,
})); schedule: this.scheduleData,
caption: this.caption,
heading: this.heading,
image: scheduleImage.split(',')[1]
}));
})
}, },
scheduleToImage: function () { scheduleToImage: function () {
domtoimage.toJpeg(document.getElementById('readonlydiv'), { quality: 0.95 }) domtoimage.toJpeg(document.getElementById('readonlydiv'), { quality: 0.95 })