add save/print button

This commit is contained in:
samerbam 2023-08-23 22:42:27 -04:00
parent a7717b04d6
commit 392bfae855
3 changed files with 39 additions and 4 deletions

View File

@ -12,7 +12,7 @@
<body> <body>
<div id="loginPanel" class="flex flex-row items-center justify-center fixed w-full h-full overflow-y-hidden overflow-x-hidden bg-white"> <div id="loginPanel" class="hidden flex flex-row items-center justify-center fixed w-full h-full overflow-y-hidden overflow-x-hidden bg-white">
<button id='loginButton' class="p-2 pl-8 pr-8 bg-purple-500 rounded-lg text-white text-xl font-semibold">Login</button> <button id='loginButton' class="p-2 pl-8 pr-8 bg-purple-500 rounded-lg text-white text-xl font-semibold">Login</button>
@ -98,7 +98,13 @@
</div> </div>
<ul class="p-2 bg-white shadow-md rounded-lg border m-2" id="table"> <ul class="p-2 bg-white shadow-md rounded-lg border m-2" id="table">
<!-- <input type="time"> --> <!-- <input type="time"> -->
<h2 class="font-semibold text-2xl ml-2">Tasks • <span id="date-view">Sat Aug 12, 2023</span></h2> <div class="flex flex-row">
<!-- <h2 class="font-semibold text-2xl ml-2">Tasks • <span id="date-view">Sat Aug 12, 2023</span></h2> -->
<h2 class="font-semibold text-2xl ml-2"><span id="date-view">Sat Aug 12, 2023</span></h2>
<button id="savePrintButton" class="h-fit border ml-auto mr-2 p-1 pl-4 pr-4 rounded-md bg-indigo-200 border-2 border-indigo-300">
<span id="savePrintButtonText">Print</span>
</button>
</div>
<!-- <h2 class="font-normal text-sm ml-3">Last Synced: <span id="date-view">Sat Aug 12, 2023</span></h2> --> <!-- <h2 class="font-normal text-sm ml-3">Last Synced: <span id="date-view">Sat Aug 12, 2023</span></h2> -->
<li class="task-row p-2 m-1 shadow-md border bg-white min-h-11 rounded-lg flex space-x-2 flex-col" data-editor-shown="false" data-recurring="false"> <li class="task-row p-2 m-1 shadow-md border bg-white min-h-11 rounded-lg flex space-x-2 flex-col" data-editor-shown="false" data-recurring="false">
<!-- <a class="handle pr-2 text-2xl justify-center items-center content-center">☰</a> --> <!-- <a class="handle pr-2 text-2xl justify-center items-center content-center">☰</a> -->

View File

@ -528,11 +528,38 @@ function recurringButtonListener(e) {
} }
function savePrintButtonListener(e) {
let spbt = document.getElementById("savePrintButtonText")
if (spbt.innerHTML === "Save") {
spbt.innerHTML = "Print"
this.classList.add("bg-indigo-200")
this.classList.add("border-indigo-300")
this.classList.remove("bg-green-200")
this.classList.remove("border-green-300")
//bg-indigo-200 border-indigo-300
} else if (spbt.innerHTML === "Print") {
spbt.innerHTML = "Save"
this.classList.remove("bg-indigo-200")
this.classList.remove("border-indigo-300")
this.classList.add("bg-green-200")
this.classList.add("border-green-300")
//bg-green-200 border-green-300
}
}
document.getElementById("savePrintButton").addEventListener("click", savePrintButtonListener)
for (let rb of document.getElementsByClassName("recurringButton")) { for (let rb of document.getElementsByClassName("recurringButton")) {
rb.addEventListener("click", recurringButtonListener) rb.addEventListener("click", recurringButtonListener)
} }
let rows = document.getElementsByClassName("task-row"); let rows = document.getElementsByClassName("task-row");
console.log('hmm'); console.log('hmm');
for (let row of rows) { for (let row of rows) {

View File

@ -146,7 +146,9 @@ class ThermalPrinter():
q = self.database.get_random_quote() q = self.database.get_random_quote()
self.p.text("\n\n") self.p.text("\n\n")
self.p.set(align="left") self.p.set(align="left")
self.p.text(q[0]) # self.p.text(q[0])
for l in textwrap.wrap(q[0], 32):
self.p.text(l)
self.p.text("\n") self.p.text("\n")
self.p.set(align="right") self.p.set(align="right")
self.p.text(q[1]) self.p.text(q[1])