Compare commits

..

1 Commits

Author SHA1 Message Date
Samuel Zielke d67a82cb19 Bild und Button einfügen
11 months ago

2
.gitignore vendored

@ -1,5 +1,3 @@
venv/ venv/
*/__pycache__* */__pycache__*
*/migrations* */migrations*
*/.DS_Store

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

@ -240,15 +240,9 @@ function filterEntriesByMonthYear(month, year) {
// Filter nach Monat und Jahr // Filter nach Monat und Jahr
const filteredEntries = allEntries.filter(entry => { const filteredEntries = allEntries.filter(entry => {
const entryDate = new Date(entry.date); // Konvertiere das date-Feld in ein Date-Objekt const entryDate = new Date(entry.date); // Konvertiere das date-Feld in ein Date-Objekt
var actualYear = year;
const matchesMonth = month ? entryDate.getMonth() + 1 === month : true; // +1 da getMonth() 0-basiert ist const matchesMonth = month ? entryDate.getMonth() + 1 === month : true; // +1 da getMonth() 0-basiert ist
if (entryDate.getMonth() + 1 >= 9){ const matchesYear = year ? entryDate.getFullYear() === year : true;
actualYear = actualYear - 1;
} else {
actualYear = actualYear;
};
const matchesYear = actualYear ? entryDate.getFullYear() === actualYear : true;
return matchesMonth && matchesYear; return matchesMonth && matchesYear;
}); });

@ -1,59 +0,0 @@
function getAllDataFromIndexedDB(dbName, storeName) {
return new Promise((resolve, reject) => {
const request = indexedDB.open(dbName);
request.onsuccess = function () {
const db = request.result;
const transaction = db.transaction(storeName, "readonly");
const store = transaction.objectStore(storeName);
const data = [];
const cursorRequest = store.openCursor();
cursorRequest.onsuccess = function (event) {
const cursor = event.target.result;
if (cursor) {
data.push(cursor.value);
cursor.continue();
} else {
resolve(data);
}
};
cursorRequest.onerror = function (event) {
reject(event.target.error);
};
};
request.onerror = function (event) {
reject(event.target.error);
};
});
}
function convertToJSON(data) {
return JSON.stringify(data, null, 2); // Formatiertes JSON
}
function downloadData(filename, content) {
const blob = new Blob([content], { type: "application/json" }); // JSON als Beispiel
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
async function exportIndexedDBData() {
const dbName = "myDB";
const storeName = "hours";
try {
const data = await getAllDataFromIndexedDB(dbName, storeName);
const jsonData = convertToJSON(data);
downloadData("piomint_backup.json", jsonData);
} catch (error) {
console.error("Fehler beim Exportieren der Daten:", error);
}
}

@ -6,6 +6,8 @@ const SETStudySaveButton = document.getElementById('SETStudySaveButton')
const SETMonthGoalSaveButton = document.getElementById('SETMonthGoalSaveButton') const SETMonthGoalSaveButton = document.getElementById('SETMonthGoalSaveButton')
var allowToSend = false; var allowToSend = false;
const monate = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]; const monate = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"];
const aktuellerMonat = monate[new Date().getMonth()];
// Aktuelles Datum
const currentDate = new Date(); const currentDate = new Date();
@ -155,13 +157,11 @@ SETMonthGoalSaveButton.addEventListener('click', () => {
}) })
async function getActualDataAndFillView(monat = currentDate.getMonth(), jahr = currentDate.getFullYear()) { async function getActualDataAndFillView(monat = currentDate.getMonth() + 1, jahr = currentDate.getFullYear()) {
try { try {
// Einfüfen des aktuellen Monats // Einfüfen des aktuellen Monats
document.getElementById('actualMonthName').innerHTML = monate[monat !== 12 ? monat : 0]; document.getElementById('actualMonthName').innerHTML = monate[monat - 1];
console.log("AKTUELLER MONAT SYSTEM: ", monat)
console.log("AKTUELLER MONAT REAL: ", currentDate.getMonth())
// Settings vor ausfüllen // Settings vor ausfüllen
@ -177,9 +177,7 @@ async function getActualDataAndFillView(monat = currentDate.getMonth(), jahr = c
}); });
// Filter funktion aufrufen und entsprechend mit dem aktuellen Datum füllen // Filter funktion aufrufen und entsprechend mit dem aktuellen Datum füllen
const filteredEntries = await filterEntriesByMonthYear(monat === 12 ? 1 : monat + 1, monat + 1 >= 9 ? jahr + 1 : jahr); const filteredEntries = await filterEntriesByMonthYear(monat, jahr);
console.log("update-complete")
// Tabelle mit den aktuellen informationen füllen (funktion triggern und Daten übergeben) // Tabelle mit den aktuellen informationen füllen (funktion triggern und Daten übergeben)
fillTableWithEntries(filteredEntries) fillTableWithEntries(filteredEntries)
@ -209,11 +207,7 @@ async function getActualDataAndFillView(monat = currentDate.getMonth(), jahr = c
document.getElementById('monthHourOther').innerText = formatDuration(sumDurations(filteredEntries,3,true), true) document.getElementById('monthHourOther').innerText = formatDuration(sumDurations(filteredEntries,3,true), true)
// Jahres Ansicht füllen // Jahres Ansicht füllen
var requestYear = currentDate.getFullYear() var yearData = await filterEntriesByMonthYear(null, currentDate.getFullYear());
if (currentDate.getMonth() +1 >= 9) {
requestYear += 1;
}
var yearData = await filterEntriesByMonthYear(null, requestYear)
yearData = formatDuration(sumDurations(yearData, null, true), true) yearData = formatDuration(sumDurations(yearData, null, true), true)
document.getElementById('yearHours').innerText = yearData document.getElementById('yearHours').innerText = yearData
document.getElementById('yearRest').innerText = 600 - parseInt(yearData) document.getElementById('yearRest').innerText = 600 - parseInt(yearData)
@ -383,36 +377,20 @@ document.getElementById('dashbord_month_area').addEventListener('click', () =>{
document.getElementById('MonthNameOfActual').innerHTML = "Monat:" document.getElementById('MonthNameOfActual').innerHTML = "Monat:"
// document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth()]; // document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth()];
diffMonth = 0; diffMonth = 0;
getActualDataAndFillView(new Date().getMonth() + diffMonth) getActualDataAndFillView(new Date().getMonth() + diffMonth + 1)
} }
}) })
document.getElementById('btn-month-before').addEventListener('click', () =>{ document.getElementById('btn-month-before').addEventListener('click', () =>{
console.log("CLICK-BEFORE: ", diffMonth)
if (new Date().getMonth() + diffMonth == 0) {
diffMonth = 11 - new Date().getMonth();
getActualDataAndFillView(new Date().getMonth() + diffMonth)
console.log("CLICK-BEFRORE-0TO11: ", diffMonth)
} else {
diffMonth = ((monate[new Date().getMonth() + diffMonth]) != 'September') ? diffMonth - 1 : diffMonth; diffMonth = ((monate[new Date().getMonth() + diffMonth]) != 'September') ? diffMonth - 1 : diffMonth;
// document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth() + diffMonth]; // document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth() + diffMonth];
getActualDataAndFillView(new Date().getMonth() + diffMonth) getActualDataAndFillView(new Date().getMonth() + diffMonth + 1)
};
console.log("CLICK-BEFORE-AFTER: ", diffMonth)
}); });
document.getElementById('btn-month-next').addEventListener('click', () =>{ document.getElementById('btn-month-next').addEventListener('click', () =>{
console.log("CLICK-NEXT: ", diffMonth)
if (new Date().getMonth() + diffMonth == 11) {
diffMonth = 0 - new Date().getMonth();
getActualDataAndFillView(new Date().getMonth() + diffMonth)
console.log("CLICK-NEXT-11TO0: ", diffMonth)
} else {
diffMonth = ((monate[new Date().getMonth() + diffMonth]) != 'August') ? diffMonth + 1 : diffMonth; diffMonth = ((monate[new Date().getMonth() + diffMonth]) != 'August') ? diffMonth + 1 : diffMonth;
// document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth() + diffMonth]; // document.getElementById('actualMonthName').innerHTML = monate[new Date().getMonth() + diffMonth];
getActualDataAndFillView(new Date().getMonth() + diffMonth) getActualDataAndFillView(new Date().getMonth() + diffMonth + 1)
};
console.log("CLICK-NEXT-AFTER: ", diffMonth)
}) })
function setNewCalsOfMonth(TheMonth) { function setNewCalsOfMonth(TheMonth) {

@ -1,64 +0,0 @@
function triggerFileInput() {
document.getElementById("fileInput").click();
}
document.getElementById("fileInput").addEventListener("change", handleFileUpload);
function handleFileUpload(event) {
const file = event.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = function (e) {
try {
const data = JSON.parse(e.target.result);
importDataToIndexedDB(data);
} catch (error) {
console.error("Fehler beim Lesen der Datei:", error);
alert("Ungültiges JSON-Format.");
}
};
reader.onerror = function () {
console.error("Fehler beim Lesen der Datei.");
};
reader.readAsText(file);
}
function importDataToIndexedDB(data) {
const dbName = "myDB";
const storeName = "hours";
const request = indexedDB.open(dbName);
request.onsuccess = function () {
const db = request.result;
const transaction = db.transaction(storeName, "readwrite");
const store = transaction.objectStore(storeName);
if (Array.isArray(data)) {
data.forEach(item => {
store.put(item);
});
} else {
console.error("Die importierten Daten müssen ein Array sein.");
alert("Ungültige Datenstruktur. Erwartet wird ein Array.");
}
transaction.oncomplete = function () {
if (alert("Daten erfolgreich importiert! \nBitte Seite aktualisieren...")) {
location.reload(); // Seite neu laden
}
};
transaction.onerror = function () {
console.error("Fehler beim Importieren der Daten:", transaction.error);
alert("Fehler beim Importieren der Daten.");
};
};
request.onerror = function (event) {
console.error("Fehler beim Öffnen der IndexedDB:", event.target.error);
};
}

@ -4,13 +4,14 @@ self.addEventListener("install", event => {
this.skipWaiting(); this.skipWaiting();
const urlsToCache = [ const urlsToCache = [
'/app/login/',
'/app/home/',
'/static/app/css/bootstrap.css', '/static/app/css/bootstrap.css',
'/static/app/css/custom.css', '/static/app/css/custom.css',
'/static/app/js/dbcontrol.js', '/static/app/js/dbcontrol.js',
'/static/app/js/home.js',
'/static/app/js/timer.js', '/static/app/js/timer.js',
'/static/app/js/welcomeControl.js', '/static/app/js/welcomeControl.js',
'/static/app/js/exportDB.js',
'/static/app/js/importDB.js',
'/static/app/js/UpdateInfoControl.js', '/static/app/js/UpdateInfoControl.js',
'/static/app/images/refresh.png', '/static/app/images/refresh.png',
'/static/app/images/play.png', '/static/app/images/play.png',
@ -55,15 +56,15 @@ self.addEventListener('activate', event => {
); );
}); });
// // Serve from Cache // Serve from Cache
// self.addEventListener("fetch", event => { self.addEventListener("fetch", event => {
// event.respondWith( event.respondWith(
// caches.match(event.request) caches.match(event.request)
// .then(response => { .then(response => {
// return response || fetch(event.request); return response || fetch(event.request);
// }) })
// .catch(() => { .catch(() => {
// return caches.match('/app/home'); return caches.match('/app/home');
// }) })
// ) )
// }); });

@ -9,7 +9,6 @@
<link rel="stylesheet" href="{% static 'app/css/bootstrap.css' %}"> <link rel="stylesheet" href="{% static 'app/css/bootstrap.css' %}">
<link rel="stylesheet" href="{% static 'app/css/custom.css' %}"> <link rel="stylesheet" href="{% static 'app/css/custom.css' %}">
<script src="{% static 'app/js/dbcontrol.js' %}"></script> <script src="{% static 'app/js/dbcontrol.js' %}"></script>
<script src="{% static 'app/js/exportDB.js' %}"></script>
{% progressive_web_app_meta %} {% progressive_web_app_meta %}
@ -32,7 +31,7 @@
<div class="settings text-left"> <div class="settings text-left">
<div class="settings-card container"> <div class="settings-card container">
<h5 class="pt-3 text-center" style="">Einstellungen</h5> <h4 class="pt-3 text-center" style="margin-top: -1rem;">Einstellungen</h4>
<ul class="list-group" style="color: black;"> <ul class="list-group" style="color: black;">
<li class="list-group-item d-flex justify-content-between align-items-center"> <li class="list-group-item d-flex justify-content-between align-items-center">
Bibelstudien: Bibelstudien:
@ -44,17 +43,6 @@
<input type="number" class="w-25 btn btn-secondary" name="MonthGoalInput" id="MonthGoalInput" value="50" onfocus="document.getElementById('SETMonthGoalSaveButton').classList.remove('d-none')"> <input type="number" class="w-25 btn btn-secondary" name="MonthGoalInput" id="MonthGoalInput" value="50" onfocus="document.getElementById('SETMonthGoalSaveButton').classList.remove('d-none')">
<button class="btn d-none" id="SETMonthGoalSaveButton">Sichern</button> <button class="btn d-none" id="SETMonthGoalSaveButton">Sichern</button>
</li> </li>
<h5 class="mt-5 text-white text-center">Kontakt</h5>
<li class="list-group-item d-flex justify-content-between align-items-center">
WhatsApp Community
<a class="btn btn-success" href="https://chat.whatsapp.com/Cy4laGaEdLP1DZbhN04zRQ" target="_blank" rel="noopener noreferrer">Beitreten</a>
</li>
<h5 class="mt-5 text-white text-center">Daten Verwaltung</h5>
<li class="list-group-item d-flex justify-content-between align-items-center">
<button class="btn btn-info" onclick="exportIndexedDBData()">Exportieren</button>
<input type="file" id="fileInput" style="display: none;" accept=".json" />
<button class="btn btn-danger" onclick="triggerFileInput()">Wiederherstellen</button>
</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -66,7 +54,5 @@
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>
<script src="{% static 'app/js/importDB.js' %}"></script>
</body> </body>
</html> </html>

@ -97,7 +97,7 @@
<p class="col-5" style="font-size: 1.2rem; margin: 0 1rem 0 -1rem;" ><b>Aktivitäten</b></p> <p class="col-5" style="font-size: 1.2rem; margin: 0 1rem 0 -1rem;" ><b>Aktivitäten</b></p>
<!-- <span class="col-2" style="margin-left: 32%; padding: 0;"><img id="resetTimer" src="{% static 'app/images/addcircle.png' %}" alt="add" class="img-fluid" style="height: 35px"></span> --> <!-- <span class="col-2" style="margin-left: 32%; padding: 0;"><img id="resetTimer" src="{% static 'app/images/addcircle.png' %}" alt="add" class="img-fluid" style="height: 35px"></span> -->
<button type="button" id="openNewEntryForm" class="offset-2 col-2 btn btn-light" data-bs-toggle="modal" data-bs-target="#newEntryModal"><img id="openNewEntryFormIcon" src="{% static 'app/images/addcircle.png' %}" alt="add" class="img-fluid"></button> <button type="button" id="openNewEntryForm" class="offset-2 col-2 btn btn-light" data-bs-toggle="modal" data-bs-target="#newEntryModal"><img id="openNewEntryFormIcon" src="{% static 'app/images/addcircle.png' %}" alt="add" class="img-fluid"></button>
<button type="button" id="openViewOfEntry" class="offset-1 col-2 btn btn-light d-none"><img id="openViewOfEntryIcon" src="{% static 'app/images/open.png' %}" alt="open" class="img-fluid"></button> <button type="button" id="sortmenubutton" class="offset-1 col-2 btn btn-light"><img id="openViewOfEntryIcon" src="{% static 'app/images/sorting.png' %}" alt="open" class="img-fluid"></button>
</div> </div>
<table class="table table-striped" style="z-index: 1;"> <table class="table table-striped" style="z-index: 1;">
<tbody id="entriesTableBody" style="overflow-y: auto; max-height: 70%;"></tbody> <tbody id="entriesTableBody" style="overflow-y: auto; max-height: 70%;"></tbody>
@ -291,7 +291,7 @@
}) })
</script> </script>
<script src="{% static 'app/js/home01.js' %}"></script> <script src="{% static 'app/js/home.js' %}"></script>
<script src="{% static 'app/js/timer.js' %}"></script> <script src="{% static 'app/js/timer.js' %}"></script>
<script src="{% static 'app/js/welcomeControl.js' %}"></script> <script src="{% static 'app/js/welcomeControl.js' %}"></script>
<script src="{% static 'app/js/UpdateInfoControl.js' %}"></script> <script src="{% static 'app/js/UpdateInfoControl.js' %}"></script>

@ -1,22 +1,21 @@
<br> <br>
<h1>Update Time!</h1> <h1>Update Time!</h1>
<br> <br>
<h5>v1.3.3</h5> <h5>v1.2.0</h5>
<p> <p>
<b style="color: red">Fehler Behebung! 🔥</b> <b style="color: red">WICHTIGE NEUIGKEIT!</b>
<br>Anicht vom falschen Jahr! <br>Wieder ein kleiner Schritt 😀
<br> <br>
<br><b>Was ist neu?</b> <br><b>Was ist neu?</b>
<br> Aufrund des Dienstjahres was nicht mit Kalender <br> Du kannst jetzt die Monate wechseln.
<br> übereinstimmt, geht es gegen die Natur.
<br> <br>
<!-- <br><b>Hinweise:</b> <br><b>Wie?</b>
<br> 1. Backup muss Manuell gemacht werden (aktuell)! <br> Tippe dazu einfach auf die "Monats"-Kachel
<br> 2. Backup muss Gespeichert werden! */}} <br> mit dem übersichtsbalken.
<br> --> <br>
<br>Danke für die Geduld und das du Piomint nutzt! <br>Viel Freude beim Testen und Gruß,
<br><b>Gruß Samuel</b> <br><b>Samuel</b>
</p> </p>
<br> <br>
<input type="text" name="versionnumber" id="versionnumber" class="d-none" value="1.3.3-5"> <input type="text" name="versionnumber" id="versionnumber" class="d-none" value="1.2.0">

@ -9,12 +9,5 @@ urlpatterns = [
path("login", views.login), path("login", views.login),
path("home/", views.home), path("home/", views.home),
path('offline/', TemplateView.as_view(template_name="offline.html")), path('offline/', TemplateView.as_view(template_name="offline.html")),
path("install/", views.install), path("install/", views.install)
path("v1321/", views.v1322),
path("v1322/", views.v1322),
path("v133/", views.v133),
path("v1332/", views.v1332),
path("v1333/", views.v1333),
path("v1334/", views.v1334),
path("v1335/", views.v1335),
] ]

@ -8,28 +8,7 @@ def install(request):
return render(request, "app/install.html") return render(request, "app/install.html")
def home(request): def home(request):
return redirect("/app/v1335") return render(request, "app/home.html")
def login(request): def login(request):
return render(request, "app/login.html") return render(request, "app/login.html")
def v1321(request):
return redirect("/app/v1335")
def v1322(request):
return redirect("/app/v1335")
def v133(request):
return redirect("/app/v1335")
def v1332(request):
return redirect("/app/v1335")
def v1333(request):
return redirect("/app/v1335")
def v1334(request):
return redirect("/app/v1335")
def v1335(request):
return render(request, "app/home.html")

@ -9,7 +9,7 @@ PWA_APP_BACKGROUND_COLOR = '#9FEDD7'
PWA_APP_DISPLAY = 'standalone' PWA_APP_DISPLAY = 'standalone'
PWA_APP_SCOPE = '/' PWA_APP_SCOPE = '/'
PWA_APP_ORIENTATION = 'portrait' PWA_APP_ORIENTATION = 'portrait'
PWA_APP_START_URL = '/app/v1335/' PWA_APP_START_URL = '/app/home/'
PWA_APP_STATUS_BAR_COLOR = 'black-translucent' PWA_APP_STATUS_BAR_COLOR = 'black-translucent'
PWA_SERVICE_WORKER_PATH = os.path.join(BASE_DIR, 'app/static/app/js', 'serviceworker.js') PWA_SERVICE_WORKER_PATH = os.path.join(BASE_DIR, 'app/static/app/js', 'serviceworker.js')
PWA_APP_ICONS = [ PWA_APP_ICONS = [

@ -27,7 +27,7 @@ SECRET_KEY = 'django-insecure-h^$jdg0n_yarg*l#r3fd_7=7_)-!0bspac70f$1#b7w8gmkc-*
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
ALLOWED_HOSTS = ['*'] if DEBUG else ['localhost', 'app.piomint.de'] ALLOWED_HOSTS = ['*'] if DEBUG else ['localhost']
# Application definition # Application definition
@ -138,7 +138,6 @@ USE_TZ = True
# https://docs.djangoproject.com/en/5.1/howto/static-files/ # https://docs.djangoproject.com/en/5.1/howto/static-files/
STATIC_URL = 'static/' STATIC_URL = 'static/'
STATIC_ROOT = '/var/www/piomint/static/' # Directory to collect static files.
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

@ -1,7 +0,0 @@
asgiref==3.8.1
Django==5.1.1
django-pwa==2.0.0
gunicorn==23.0.0
mysqlclient==2.2.4
packaging==24.1
sqlparse==0.5.1
Loading…
Cancel
Save

Powered by TurnKey Linux.