mirror of
https://codeberg.org/metamuffin/abrechenbarkeit.git
synced 2024-12-29 16:14:36 +00:00
add printing design for lists; add some currency
This commit is contained in:
parent
20c3a25e43
commit
2482b3bb97
2 changed files with 69 additions and 14 deletions
|
@ -248,7 +248,7 @@ local function r_user(username)
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<input type="number" name="amount" id="amount" value="%d" hidden />
|
<input type="number" name="amount" id="amount" value="%d" hidden />
|
||||||
<input type="text" name="comment" id="comment" value="" hidden />
|
<input type="text" name="comment" id="comment" value="" hidden />
|
||||||
<input type="submit" value="%s%.02f€" class="amount-%s" />
|
<input type="submit" value="%s%.02f€" class="amount-%s button" />
|
||||||
</form>
|
</form>
|
||||||
]], amount * type, ({ [-1] = "-", [1] = "+" })[type], amount / 100,
|
]], amount * type, ({ [-1] = "-", [1] = "+" })[type], amount / 100,
|
||||||
({ [-1] = "neg", [1] = "pos" })[type]))
|
({ [-1] = "neg", [1] = "pos" })[type]))
|
||||||
|
@ -257,18 +257,18 @@ local function r_user(username)
|
||||||
print("</div>")
|
print("</div>")
|
||||||
print([[
|
print([[
|
||||||
<form class="transaction box backgroundbox" action="" method="POST">
|
<form class="transaction box backgroundbox" action="" method="POST">
|
||||||
<h3>Create Transaction</h3>
|
<h3>Create 🏳️⚧️✊</h3>
|
||||||
<label for="amount">Amount: </label>
|
<label for="amount">Amount (ct): </label>
|
||||||
<input type="number" name="amount" id="amount" />
|
<input type="number" name="amount" id="amount" />
|
||||||
<label for="comment">Comment: </label>
|
<label for="comment">Comment: </label>
|
||||||
<input type="text" name="comment" id="comment" />
|
<input type="text" name="comment" id="comment" />
|
||||||
<input type="submit" value="Update" />
|
<input type="submit" value="Update" class="amount-ntr button" />
|
||||||
</form>
|
</form>
|
||||||
<form class="transaction box backgroundbox" action="" method="POST" id="buy_product">
|
<form class="transaction box backgroundbox" action="" method="POST" id="buy_product">
|
||||||
<h3>Buy Product</h3>
|
<h3>Buy Product</h3>
|
||||||
<label for="product">Product: </label>
|
<label for="product">Product: </label>
|
||||||
<input type="text" name="product" id="product" />
|
<input type="text" name="product" id="product" />
|
||||||
<input type="submit" value="Buy" />
|
<input class="amount-neg button" type="submit" value="Buy" />
|
||||||
</form>
|
</form>
|
||||||
]])
|
]])
|
||||||
print("</div>")
|
print("</div>")
|
||||||
|
@ -277,7 +277,7 @@ end
|
||||||
|
|
||||||
local function r_log(filter)
|
local function r_log(filter)
|
||||||
return respond(200, "Abrechnungen", function()
|
return respond(200, "Abrechnungen", function()
|
||||||
print("<table>")
|
print([[<table class="log">]])
|
||||||
print("<tr><th>Time</th><th>Username</th><th>Amount</th><th>P.-Barcode</th><th>P.-Count</th><th>Comment</th></tr>")
|
print("<tr><th>Time</th><th>Username</th><th>Amount</th><th>P.-Barcode</th><th>P.-Count</th><th>Comment</th></tr>")
|
||||||
for time, username, amount, pcode, pcount, comment in read_log() do
|
for time, username, amount, pcode, pcount, comment in read_log() do
|
||||||
if filter == nil or filter == username then
|
if filter == nil or filter == username then
|
||||||
|
@ -293,7 +293,7 @@ local function r_log(filter)
|
||||||
<form action="/%s" method="POST">
|
<form action="/%s" method="POST">
|
||||||
<input type="number" name="amount" id="amount" value="%d" hidden />
|
<input type="number" name="amount" id="amount" value="%d" hidden />
|
||||||
<input type="text" name="comment" id="comment" value="Revert %s" hidden />
|
<input type="text" name="comment" id="comment" value="Revert %s" hidden />
|
||||||
<input type="submit" value="Revert" />
|
<input type="submit" class="amount-ntr button" value="Revert" />
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -403,8 +403,8 @@ local function r_products()
|
||||||
<input type="text" name="barcode" id="barcode" />
|
<input type="text" name="barcode" id="barcode" />
|
||||||
<label for="name">Name: </label>
|
<label for="name">Name: </label>
|
||||||
<input type="text" name="name" id="name" />
|
<input type="text" name="name" id="name" />
|
||||||
<label for="price">Price: </label>
|
<label for="price">Price (ct): </label>
|
||||||
<input type="number" name="price" id="price" />
|
<input type="number" name="price" id="price" unit="cent"/>
|
||||||
<input type="submit" value="Add" />
|
<input type="submit" value="Add" />
|
||||||
</form>
|
</form>
|
||||||
<form action="/?products" method="POST" class="box backgroundbox">
|
<form action="/?products" method="POST" class="box backgroundbox">
|
||||||
|
@ -416,7 +416,7 @@ local function r_products()
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
]])
|
]])
|
||||||
print("<table><tr><th>Name</th><th>Price</th><th>Barcode</th><th>Count</th></tr>")
|
print([[<table class="productlist"><tr><th>Name</th><th>Price</th><th>Barcode</th><th>Count</th></tr>]])
|
||||||
local pbals = product_balances()
|
local pbals = product_balances()
|
||||||
for barcode, price, name in read_products() do
|
for barcode, price, name in read_products() do
|
||||||
print(string.format([[
|
print(string.format([[
|
||||||
|
|
59
style.css
59
style.css
|
@ -151,12 +151,14 @@ li {
|
||||||
grid-template-columns: repeat(6, 6em);
|
grid-template-columns: repeat(6, 6em);
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
|
input.button {
|
||||||
.amount-presets > form > input {
|
|
||||||
place-content: center;
|
place-content: center;
|
||||||
padding: 0.8em 0.5em;
|
padding: 0.8em 0.5em;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.amount-presets > form > input {
|
||||||
width: 6em;
|
width: 6em;
|
||||||
margin: 1em;
|
margin: 1em;
|
||||||
}
|
}
|
||||||
|
@ -181,6 +183,15 @@ input.amount-neg {
|
||||||
background-color: rgb(84, 64, 82);
|
background-color: rgb(84, 64, 82);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* amount neutral */
|
||||||
|
.amount-ntr {
|
||||||
|
color: #04d8f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.amount-ntr {
|
||||||
|
background-color: #5285a8;
|
||||||
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
|
@ -230,3 +241,47 @@ tr:nth-child(2n) {
|
||||||
background-color: #1d2832;
|
background-color: #1d2832;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
background-color: inherit;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:not([type=submit]) {
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid #e2e2e2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
nav, .container, h1 {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.log:before {
|
||||||
|
content: "Abrechenbarkeit Log";
|
||||||
|
font-size: 2em;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.productlist:before {
|
||||||
|
content: "Produkt Liste";
|
||||||
|
font-size: 2em;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr :last-child {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-bottom: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
*, body {
|
||||||
|
background-color: white;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue