mirror of
https://github.com/Garmelon/Arbeitszeitdokumentationsgenerator.git
synced 2026-04-12 16:55:04 +02:00
Add checkboxes to turn off sorting and validation
This commit is contained in:
parent
d30cd79229
commit
14622a1fb2
6 changed files with 61 additions and 15 deletions
|
|
@ -27,9 +27,7 @@ label {
|
|||
grid-column: 2;
|
||||
text-align: center;
|
||||
}
|
||||
#i-name,
|
||||
#i-department,
|
||||
#mhhr {
|
||||
.twocol {
|
||||
grid-column: 2 / 4;
|
||||
}
|
||||
#gfub {
|
||||
|
|
@ -57,6 +55,12 @@ label {
|
|||
justify-content: end;
|
||||
align-items: baseline;
|
||||
}
|
||||
#check {
|
||||
grid-column: 2;
|
||||
}
|
||||
#validate {
|
||||
text-align: right;
|
||||
}
|
||||
#table {
|
||||
display: grid;
|
||||
grid: auto-flow / 3fr 1fr 1fr 1fr 1fr 1fr;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ pub async fn get() -> Markup {
|
|||
input #i-month name="month" type="month" placeholder=(month) value=(month) {}
|
||||
|
||||
label #l-name for="i-name" { "Name, Vorname des/r Beschäftigten:" }
|
||||
input #i-name name="name" type="text" placeholder="McStudentface, Student" {}
|
||||
input #i-name .twocol name="name" type="text" placeholder="McStudentface, Student" {}
|
||||
|
||||
label #l-staffid for="i-staffid" { "Personalnummer:" }
|
||||
input #i-staffid name="staff_id" type="text" placeholder="1337420" {}
|
||||
|
|
@ -63,10 +63,10 @@ pub async fn get() -> Markup {
|
|||
}
|
||||
|
||||
label #l-department for="i-department" title="Organisationseinheit" { "OE:" }
|
||||
input #i-department name="department" type="text" placeholder="Institut für Informatik" value="Institut für Informatik" {}
|
||||
input #i-department .twocol name="department" type="text" placeholder="Institut für Informatik" value="Institut für Informatik" {}
|
||||
|
||||
label #l-monthlyhours for="i-monthlyhours" { "Vertraglich vereinbarte Arbeitszeit:" }
|
||||
div #mhhr {
|
||||
div #mhhr .twocol {
|
||||
span {
|
||||
input #i-monthlyhours name="monthly_hours" type="number" value="40" min="0" {}
|
||||
" Std."
|
||||
|
|
@ -78,12 +78,22 @@ pub async fn get() -> Markup {
|
|||
}
|
||||
}
|
||||
|
||||
div #carry {
|
||||
div #carry .twocol {
|
||||
span {
|
||||
label #l-carry for="i-carry" { "Übertrag vom Vormonat: " }
|
||||
input #i-carry .i-dur name="carry_prev_month" type="text" placeholder="00:00" {}
|
||||
}
|
||||
}
|
||||
|
||||
label #check title="Die Tabelleneinträge werden chronologisch sortiert, anstatt dass ihre Reihenfolge beibehalten wird." {
|
||||
"Einträge sortieren "
|
||||
input name="sort" type="checkbox" value="true" checked {}
|
||||
}
|
||||
|
||||
label #validate title="Die Tabelleneinträge werden auf Konsistenz und Korrektheit überprüft, bevor das Dokument generiert wird." {
|
||||
"Einträge validieren "
|
||||
input name="validate" type="checkbox" value="true" checked {}
|
||||
}
|
||||
}
|
||||
|
||||
div #table {
|
||||
|
|
@ -133,6 +143,10 @@ pub struct PostForm {
|
|||
monthly_hours: u32,
|
||||
hourly_wage: String,
|
||||
carry_prev_month: String,
|
||||
#[serde(default)]
|
||||
sort: bool,
|
||||
#[serde(default)]
|
||||
validate: bool,
|
||||
task: Vec<String>,
|
||||
day: Vec<Option<u32>>,
|
||||
start: Vec<String>,
|
||||
|
|
@ -229,7 +243,8 @@ pub async fn post(form: Form<PostForm>) -> Response {
|
|||
working_area,
|
||||
monthly_hours: form.monthly_hours,
|
||||
hourly_wage: form.hourly_wage,
|
||||
validate: true,
|
||||
validate: form.validate,
|
||||
sort: form.sort,
|
||||
carry_prev_month,
|
||||
year,
|
||||
month,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ h1 {
|
|||
label {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
margin-top: 4mm;
|
||||
}
|
||||
textarea {
|
||||
display: block;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,14 @@ submit.addEventListener("click", async () => {
|
|||
return;
|
||||
}
|
||||
|
||||
const dataJson = JSON.stringify({ global, month });
|
||||
let sort = data.get("sort") !== null;
|
||||
let validate = data.get("validate") !== null;
|
||||
|
||||
console.log("data", data)
|
||||
console.log("sort", sort)
|
||||
console.log("validate", validate)
|
||||
|
||||
const dataJson = JSON.stringify({ global, month, sort, validate });
|
||||
|
||||
try {
|
||||
const response = await fetch(".", {
|
||||
|
|
|
|||
|
|
@ -30,11 +30,27 @@ pub async fn get() -> Markup {
|
|||
" eingeben."
|
||||
}
|
||||
|
||||
label for="i-global" { "Global.json" }
|
||||
textarea #i-global name="global" placeholder="{}" {}
|
||||
p {
|
||||
label for="i-global" { "Global.json" }
|
||||
textarea #i-global name="global" placeholder="{}" {}
|
||||
}
|
||||
|
||||
label for="i-month" { "Month.json" }
|
||||
textarea #i-month name="month" placeholder="{}" {}
|
||||
p {
|
||||
label for="i-month" { "Month.json" }
|
||||
textarea #i-month name="month" placeholder="{}" {}
|
||||
}
|
||||
|
||||
p {
|
||||
label title="Die Einträge werden chronologisch sortiert, anstatt dass ihre Reihenfolge beibehalten wird." {
|
||||
input name="sort" type="checkbox" checked {}
|
||||
" Einträge sortieren"
|
||||
}
|
||||
|
||||
label title="Die Einträge werden auf Konsistenz und Korrektheit überprüft, bevor das Dokument generiert wird." {
|
||||
input name="validate" type="checkbox" checked {}
|
||||
" Einträge validieren"
|
||||
}
|
||||
}
|
||||
|
||||
button #submit type="button" { "Arbeitszeitdokumentation generieren" }
|
||||
|
||||
|
|
@ -82,6 +98,8 @@ pub struct MonthJson {
|
|||
pub struct PostJson {
|
||||
global: GlobalJson,
|
||||
month: MonthJson,
|
||||
sort: bool,
|
||||
validate: bool,
|
||||
}
|
||||
|
||||
fn error_response<S: ToString>(msg: S) -> Response {
|
||||
|
|
@ -149,7 +167,8 @@ pub async fn post(json: Json<PostJson>) -> Response {
|
|||
working_area,
|
||||
monthly_hours,
|
||||
hourly_wage: json.global.wage.to_string(),
|
||||
validate: true,
|
||||
validate: json.validate,
|
||||
sort: json.sort,
|
||||
carry_prev_month: json.month.pred_transfer,
|
||||
year: json.month.year,
|
||||
month: json.month.month,
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ pub struct Timesheet {
|
|||
pub monthly_hours: u32,
|
||||
pub hourly_wage: String,
|
||||
pub validate: bool,
|
||||
pub sort: bool,
|
||||
pub carry_prev_month: Option<String>,
|
||||
pub year: u32,
|
||||
pub month: u32,
|
||||
|
|
@ -137,6 +138,7 @@ fn fmt_timesheet(ts: Timesheet) -> String {
|
|||
lines.push(format!(" monthly_hours: {},", fmt_int(ts.monthly_hours)));
|
||||
lines.push(format!(" hourly_wage: {},", fmt_str(&ts.hourly_wage)));
|
||||
lines.push(format!(" validate: {},", fmt_bool(ts.validate)));
|
||||
lines.push(format!(" sort: {},", fmt_bool(ts.sort)));
|
||||
if let Some(carry) = ts.carry_prev_month {
|
||||
lines.push(format!(" carry_prev_month: {},", fmt_str(&carry)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue