mirror of
https://github.com/Garmelon/Arbeitszeitdokumentationsgenerator.git
synced 2026-04-12 00:35:04 +02:00
Add field for carry
This commit is contained in:
parent
24649725bb
commit
0795dbf903
3 changed files with 29 additions and 3 deletions
|
|
@ -42,12 +42,18 @@ label {
|
|||
#i-monthlyhours {
|
||||
width: 6ch;
|
||||
}
|
||||
#l-hourlyrate {
|
||||
#l-hourlywage {
|
||||
padding-left: 4ch;
|
||||
}
|
||||
#i-hourlyrate {
|
||||
#i-hourlywage {
|
||||
width: 8ch;
|
||||
}
|
||||
#carry {
|
||||
grid-column: 2 / 4;
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
align-items: baseline;
|
||||
}
|
||||
#table {
|
||||
display: grid;
|
||||
grid: auto-flow / 3fr 1fr 1fr 1fr 1fr 1fr;
|
||||
|
|
|
|||
|
|
@ -55,12 +55,19 @@ pub async fn get() -> Markup {
|
|||
input #i-monthlyhours name="monthly_hours" type="number" value="40" {}
|
||||
" Std."
|
||||
}
|
||||
label #l-hourlywage for="i-hourlywage" { "Stundensatz:" }
|
||||
span {
|
||||
label #l-hourlywage for="i-hourlywage" { "Stundensatz: " }
|
||||
input #i-hourlywage name="hourly_wage" type="number" step="0.01" placeholder="14.09" {}
|
||||
" €"
|
||||
}
|
||||
}
|
||||
|
||||
div #carry {
|
||||
span {
|
||||
label #l-carry for="i-carry" { "Übertrag vom Vormonat: " }
|
||||
input #i-carry .i-dur name="carry_prev_month" type="text" placeholder="00:00" {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
div #table {
|
||||
|
|
@ -109,6 +116,7 @@ pub struct PostForm {
|
|||
department: String,
|
||||
monthly_hours: u32,
|
||||
hourly_wage: String,
|
||||
carry_prev_month: String,
|
||||
task: Vec<String>,
|
||||
day: Vec<u32>,
|
||||
start: Vec<String>,
|
||||
|
|
@ -170,6 +178,13 @@ pub async fn post(form: Form<PostForm>) -> Response {
|
|||
notes.push(note)
|
||||
}
|
||||
|
||||
// Parse carry
|
||||
let carry_prev_month = if form.carry_prev_month.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(form.carry_prev_month)
|
||||
};
|
||||
|
||||
let entries = (form.task.into_iter())
|
||||
.zip(form.day.into_iter())
|
||||
.zip(form.start.into_iter())
|
||||
|
|
@ -199,6 +214,7 @@ pub async fn post(form: Form<PostForm>) -> Response {
|
|||
monthly_hours: form.monthly_hours,
|
||||
hourly_wage: form.hourly_wage,
|
||||
validate: true,
|
||||
carry_prev_month,
|
||||
year,
|
||||
month,
|
||||
entries,
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ pub struct Timesheet {
|
|||
pub monthly_hours: u32,
|
||||
pub hourly_wage: String,
|
||||
pub validate: bool,
|
||||
pub carry_prev_month: Option<String>,
|
||||
pub year: u32,
|
||||
pub month: u32,
|
||||
pub entries: Vec<Entry>,
|
||||
|
|
@ -137,6 +138,9 @@ 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)));
|
||||
if let Some(carry) = ts.carry_prev_month {
|
||||
lines.push(format!(" carry_prev_month: {},", fmt_str(&carry)));
|
||||
}
|
||||
lines.push(format!(" year: {},", fmt_int(ts.year)));
|
||||
lines.push(format!(" month: {},", fmt_int(ts.month)));
|
||||
for entry in ts.entries {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue