Better looking form

Still need to apply these to the other pages
This commit is contained in:
2025-07-28 02:23:34 +01:00
parent 97726971d2
commit 9c76b93fcd
4 changed files with 242 additions and 294 deletions
+19 -38
View File
@@ -27,16 +27,16 @@
@keyframes flicker {
0% {
opacity: 0.9;
opacity: 1.1;
}
20% {
opacity: 0.9;
opacity: 1.1;
}
40% {
opacity: 1.1;
}
60% {
opacity: 1;
opacity: 1.1;
}
80% {
opacity: 1;
@@ -140,22 +140,7 @@ th {
height: 100%;
}
.form-container {
display: block;
text-align: center;
}
.form-container.form-left {
text-align: left;
}
.fullwidth-label {
display: block;
}
.tui-input {
width: 50%;
max-width: 15ch;
font-family: dejavu_monospace;
font-size: var(--html_font_size);
border: solid 2px;
@@ -166,10 +151,12 @@ th {
color: var(--text-color);
}
.tui-input.fullwidth {
width: 100%;
max-width: 100%;
text-align: left;
.tui-dropdown {
font-family: dejavu_monospace;
font-size: var(--html_font_size);
border: solid 2px;
background-color: var(--background-color);
color: var(--text-color);
}
.tui-input.underline {
@@ -185,30 +172,24 @@ th {
content: "<";
}
.form-container.form-inline {
text-align: left;
display: table;
.form-inline {
display: grid;
grid-template-columns: auto 1fr; /* adjust 12ch based on your longest label */
gap: 0.5em 1em;
align-items: center;
width: 100%;
}
.form-inline p {
display: table-row;
max-width: 40rem;
}
.form-inline label {
display: table-cell;
padding-right: 1em;
text-align: left;
white-space: nowrap;
width: 10%;
}
.form-inline .input.tui-input {
display: table-cell;
.form-inline input,
.form-inline select {
width: 100%;
}
.form-inline .subbutton {
display: block;
box-sizing: border-box;
}
:root {
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["crt.scss","expensesTable.scss","forms.scss","main.scss"],"names":[],"mappings":";AAMA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EAIA;EACA;EACA;EACA;EAEA;;;AAGF;EAII;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;;AAKN;EACE;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;;ACtJJ;EACE;EACA;EACA;;;AAGF;EACE;;;ACPF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAIF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;ACrEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EAEA;EAEA;EACA;AAEA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EAEA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;AAEA;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;EACA,aACE;;;AAGJ;EACE;EACA;EAEA;EACA;;;AAGF;AACE;EACA;EACA;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EAEA;;;AAGF;EACE;EAEA;AAEA;EACA;AACA;EACA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;AACA;AACA;AACA;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;IACE","file":"aesthetic.css"}
{"version":3,"sourceRoot":"","sources":["crt.scss","expensesTable.scss","forms.scss","main.scss"],"names":[],"mappings":";AAMA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EAIA;EACA;EACA;EACA;EAEA;;;AAGF;EAII;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;EADF;IACE;;;AAKN;EACE;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;;ACtJJ;EACE;EACA;EACA;;;AAGF;EACE;;;ACPF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAAA;EAEE;EACA;;;ACjDF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EAEA;EAEA;EACA;AAEA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EAEA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;AACA;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;AAEA;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;EACA,aACE;;;AAGJ;EACE;EACA;EAEA;EACA;;;AAGF;AACE;EACA;EACA;EACA;EACA;EACA;AAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EAEA;;;AAGF;EACE;EAEA;AAEA;EACA;AACA;EACA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;AACA;AACA;AACA;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;IACE","file":"aesthetic.css"}
+16 -36
View File
@@ -2,22 +2,7 @@
height: 100%;
}
.form-container {
display: block;
text-align: center;
}
.form-container.form-left {
text-align: left;
}
.fullwidth-label {
display: block;
}
.tui-input {
width: 50%;
max-width: 15ch;
font-family: dejavu_monospace;
font-size: var(--html_font_size);
border: solid 2px;
@@ -28,10 +13,12 @@
color: var(--text-color);
}
.tui-input.fullwidth {
width: 100%;
max-width: 100%;
text-align: left;
.tui-dropdown {
font-family: dejavu_monospace;
font-size: var(--html_font_size);
border: solid 2px;
background-color: var(--background-color);
color: var(--text-color);
}
.tui-input.underline {
@@ -39,7 +26,6 @@
border-bottom: 2px solid;
}
.subbutton:focus::before {
content: ">";
}
@@ -48,28 +34,22 @@
content: "<";
}
.form-container.form-inline {
text-align: left;
display: table;
.form-inline {
display: grid;
grid-template-columns: auto 1fr; /* adjust 12ch based on your longest label */
gap: 0.5em 1em;
align-items: center;
width: 100%;
}
.form-inline p {
display: table-row;
max-width: 40rem;
}
.form-inline label {
display: table-cell;
padding-right: 1em;
text-align: left;
white-space: nowrap;
width: 10%;
}
.form-inline .input.tui-input {
display: table-cell;
.form-inline input,
.form-inline select {
width: 100%;
}
.form-inline .subbutton {
display: block;
box-sizing: border-box;
}
+206 -219
View File
@@ -1,237 +1,224 @@
<div>
<form id="expense-form" action="submit">
<div id="form-state" class="warning"></div>
<fieldset id="form-box-boundaries">
<legend>EXPENSE FORM</legend>
<div class="form-container form-inline">
<div id="form-state" class="warning"></div><br>
{{ if eq .method "put" }}
<p>
<label for="expense-desc">ID:</label>
<input
readonly
class="tui-input underline fullwidth" type="text" name="expense-id"
value="{{ .expense.ExpID }}" id="expense-id"><br>
</p>
<label for="expense-desc">ID:</label>
<input
readonly
class="tui-input underline" type="text" name="expense-id"
value="{{ .expense.ExpID }}" id="expense-id">
{{ end }}
<p>
<label for="expense-desc">Description:</label>
<input
class="tui-input underline fullwidth" type="text" name="expense-desc"
value="{{ .expense.Description }}" id="expense-desc"><br>
</p>
<label for="expense-desc">Description:</label>
<input
class="tui-input underline" type="text" name="expense-desc"
value="{{ .expense.Description }}" id="expense-desc">
<p>
<label for="expense-date">Date:</label>
<input
class="tui-input underline fullwidth" type="text" name="expense-date"
value="{{ formatDate .expense.ExpDate }}" id="expense-date"><br>
</p>
<label for="expense-date">Date:</label>
<input
class="tui-input underline" type="text" name="expense-date"
value="{{ formatDate .expense.ExpDate }}" id="expense-date">
<p>
<label for="expense-value">Value:</label>
<input
class="tui-input underline fullwidth" type="text" name="expense-value"
value="{{ .expense.Value }}" id="expense-value"><br>
</p>
<br>
<label for="expense-value">Value:</label>
<input
class="tui-input underline" type="text" name="expense-value"
value="{{ .expense.Value }}" id="expense-value">
<p>
<label for="newexp-type-dropdown">Type:</label>
<select name="newexp-type-dropdown" id="newexp-type-dropdown">
{{ range .types }}
<option
{{ if eq .TypeID $.expense.ExpType.TypeID }}selected{{ end }}
value="{{ .TypeID }}">{{ .TypeName }}</option>
{{ end}}
</select>
</p>
<label for="newexp-type-dropdown">Type:</label>
<select name="newexp-type-dropdown" id="newexp-type-dropdown" class="tui-dropdown">
{{ range .types }}
<option
{{ if eq .TypeID $.expense.ExpType.TypeID }}selected{{ end }}
value="{{ .TypeID }}">{{ .TypeName }}</option>
{{ end}}
</select>
<p>
<label for="newexp-cat-dropdown">Category:</label>
<select name="newexp-cat-dropdown" id="newexp-cat-dropdown">
{{ range .categories }}
<option
{{ if eq .CategoryID $.expense.ExpCategory.CategoryID }}selected{{ end }}
value="{{ .CategoryID }}">{{ .CategoryName }}</option>
{{ end}}
</select>
</p>
<label for="newexp-cat-dropdown">Category:</label>
<select name="newexp-cat-dropdown" id="newexp-cat-dropdown" class="tui-dropdown">
{{ range .categories }}
<option
{{ if eq .CategoryID $.expense.ExpCategory.CategoryID }}selected{{ end }}
value="{{ .CategoryID }}">{{ .CategoryName }}</option>
{{ end}}
</select>
<p>
<label for="newexp-store-dropdown">Store:</label>
<select name="newexp-store-dropdown" id="newexp-store-dropdown">
{{ range .stores }}
<option
{{ if eq .StoreID $.expense.ExpStore.StoreID }}selected{{ end }}
value="{{ .StoreID }}">{{ .StoreName }}</option>
{{ end}}
</select>
</p>
<br>
<button
type="button"
onclick="addShareRow()"
>+ Share</button>
<table id="shares-table">
<tr>
<th>ID</th>
<th>USER</th>
<th>SHARE</th>
</tr>
<!-- Data row to be copied -->
<tr
id="template-share-row"
style="display: none;"
>
<td>
<input type="number" name="shares-ids[]" disabled readonly
value="">
</td>
<td>
<select name="shares-user-ids[]" disabled>
{{ range .users }}
<option
{{ if eq .UserID $.expense.OwnerUser.UserID }}selected{{ end }}
value="{{ .UserID }}">{{ .UserName }}</option>
{{ end }}
</select>
</td>
<td>
<input type="number" name="shares-percent[]" value="1" disabled>
</td>
<td class="row-delete-button">
<button type="button" onclick="deleteShareRow(this)">X</button>
</td>
</tr>
{{ range .expense.Shares }}
{{ $share := . }}
<tr>
<td>
<input
type="number" name="shares-ids[]" readonly
value="{{ $share.ExpShareID }}">
</td>
<td>
<select name="shares-user-ids[]">
{{ range $.users }}
<option
value="{{ .UserID }}"
{{ if eq .UserID $share.User.UserID }}selected{{ end }}>
{{ .UserName }}
</option>
{{ end }}
</select>
</td>
<td>
<input type="number" name="shares-percent[]" value="{{ $share.Share }}">
</td>
<td class="row-delete-button">
<button type="button" onclick="deleteShareRow(this)">X</button>
</td>
</tr>
{{ end }}
</table>
<br>
<button
type="button"
onclick="addPaymentRow()"
>+ Payment</button>
<div id="operation-state" class="warning">&nbsp;</div><br>
<table id="payments-table">
<tr>
<th>ID</th>
<th>USER</th>
<th>PAYED</th>
</tr>
<!-- Data row to be copied -->
<tr
id="template-payment-row"
style="display: none;"
>
<td >
<input type="number" name="payments-ids[]" disabled readonly
value="">
</td>
<td>
<select name="payments-user-ids[]" disabled>
{{ range .users }}
<option
{{ if eq .UserID $.expense.OwnerUser.UserID }}selected{{ end }}
value="{{ .UserID }}">{{ .UserName }}</option>
{{ end }}
</select>
</td>
<td>
<input type="number" name="payments-payment[]" value="0" disabled>
</td>
<td class="row-delete-button">
<button type="button" onclick="deleteShareRow(this)">X</button>
</td>
</tr>
{{ range .expense.Payments }}
{{ $payment := . }}
<tr data-id="{{ $payment.ExpPaymID }}">
<td>
<input type="number" name="payments-ids[]" readonly
value="{{ $payment.ExpPaymID }}">
</td>
<td>
<select name="payments-user-ids[]">
{{ range $.users }}
<option
value="{{ .UserID }}"
{{ if eq .UserID $payment.User.UserID }}selected{{ end }}>
{{ .UserName }}
</option>
{{ end }}
</select>
</td>
<td>
<input type="number" name="payments-payment[]" value="{{ $payment.PayedAmount }}">
</td>
<td class="row-delete-button">
<!-- <button type="button" onclick="deleteShareRow(this)">X</button> -->
<button
type="button"
class="delete-button"
hx-delete="/payments/{{ $payment.ExpPaymID }}"
hx-target="closest tr">X</button>
</td>
</tr>
{{ end }}
</table>
<br><br>
<button
class="subbutton"
{{ if eq .method "put" }}
hx-put="/expenses/{{ .expense.ExpID }}"
{{ end }}
{{ if eq .method "post" }}
hx-post="/expenses/new"
{{ end }}
hx-swap="none"
type="submit"
id="expense-submit-button">
{{- if eq .method "put" }}UPDATE{{- end }}
{{- if eq .method "post" }}CREATE{{- end }}</button>
{{ if eq .method "put" }}
<button
hx-delete="/expenses/{{ .expense.ExpID }}"
hx-swap="none"
type="button"
id="expense-delete-button">DELETE</button>
{{ end }}
<label for="newexp-store-dropdown">Store:</label>
<select name="newexp-store-dropdown" id="newexp-store-dropdown" class="tui-dropdown">
{{ range .stores }}
<option
{{ if eq .StoreID $.expense.ExpStore.StoreID }}selected{{ end }}
value="{{ .StoreID }}">{{ .StoreName }}</option>
{{ end}}
</select>
</div>
</fieldset>
<fieldset id="shares-table-fields">
<legend>SHARES</legend>
<button
type="button"
onclick="addShareRow()"
>+ Share</button>
<table id="shares-table">
<tr>
<th>ID</th>
<th>USER</th>
<th>SHARE</th>
</tr>
<!-- Data row to be copied -->
<tr id="template-share-row" style="display: none;">
<td>
<input name="shares-ids[]" disabled readonly
value="" class="tui-dropdown">
</td>
<td>
<select name="shares-user-ids[]" disabled class="tui-dropdown">
{{ range .users }}
<option
{{ if eq .UserID $.expense.OwnerUser.UserID }}selected{{ end }}
value="{{ .UserID }}">{{ .UserName }}</option>
{{ end }}
</select>
</td>
<td>
<input type="number" name="shares-percent[]"
value="1" disabled class="tui-dropdown">
</td>
<td class="row-delete-button">
<button type="button" onclick="deleteShareRow(this)">X</button>
</td>
</tr>
{{ range .expense.Shares }}
{{ $share := . }}
<tr>
<td>
<input
name="shares-ids[]" readonly
value="{{ $share.ExpShareID }}" class="tui-dropdown">
</td>
<td>
<select name="shares-user-ids[]" class="tui-dropdown">
{{ range $.users }}
<option
value="{{ .UserID }}"
{{ if eq .UserID $share.User.UserID }}selected{{ end }}>
{{ .UserName }}
</option>
{{ end }}
</select>
</td>
<td>
<input type="number" name="shares-percent[]"
value="{{ $share.Share }}" class="tui-dropdown">
</td>
<td class="row-delete-button">
<button type="button" onclick="deleteShareRow(this)">X</button>
</td>
</tr>
{{ end }}
</table>
</fieldset>
<fieldset>
<legend>PAYMENTS</legend>
<button
type="button"
onclick="addPaymentRow()"
>+ Payment</button>
<div id="operation-state" class="warning">&nbsp;</div><br>
<table id="payments-table">
<tr>
<th>ID</th>
<th>USER</th>
<th>PAYED</th>
</tr>
<!-- Data row to be copied -->
<tr id="template-payment-row" style="display: none;">
<td >
<input name="payments-ids[]" disabled readonly
value="" class="tui-dropdown">
</td>
<td>
<select name="payments-user-ids[]" disabled class="tui-dropdown">
{{ range .users }}
<option
{{ if eq .UserID $.expense.OwnerUser.UserID }}selected{{ end }}
value="{{ .UserID }}">{{ .UserName }}</option>
{{ end }}
</select>
</td>
<td>
<input type="number" name="payments-payment[]" value="0" disabled class="tui-dropdown">
</td>
<td class="row-delete-button">
<button type="button" onclick="deleteShareRow(this)">X</button>
</td>
</tr>
{{ range .expense.Payments }}
{{ $payment := . }}
<tr data-id="{{ $payment.ExpPaymID }}">
<td>
<input name="payments-ids[]" readonly
value="{{ $payment.ExpPaymID }}" class="tui-dropdown">
</td>
<td>
<select name="payments-user-ids[]" class="tui-dropdown">
{{ range $.users }}
<option
value="{{ .UserID }}"
{{ if eq .UserID $payment.User.UserID }}selected{{ end }}>
{{ .UserName }}
</option>
{{ end }}
</select>
</td>
<td>
<input type="number" name="payments-payment[]"
value="{{ $payment.PayedAmount }}" class="tui-dropdown">
</td>
<td class="row-delete-button">
<!-- <button type="button" onclick="deleteShareRow(this)">X</button> -->
<button
type="button"
class="delete-button"
hx-delete="/payments/{{ $payment.ExpPaymID }}"
hx-target="closest tr">X</button>
</td>
</tr>
{{ end }}
</table>
</fieldset>
<br>
<button
class="subbutton"
{{ if eq .method "put" }}
hx-put="/expenses/{{ .expense.ExpID }}"
{{ end }}
{{ if eq .method "post" }}
hx-post="/expenses/new"
{{ end }}
hx-swap="none"
type="submit"
id="expense-submit-button">
{{- if eq .method "put" }}UPDATE{{- end }}
{{- if eq .method "post" }}CREATE{{- end }}</button>
{{ if eq .method "put" }}
<button
hx-delete="/expenses/{{ .expense.ExpID }}"
hx-swap="none"
type="button"
id="expense-delete-button">DELETE</button>
{{ end }}
</form>
</div>