added user input to paycheck-quick entry

This commit is contained in:
Nickiel12 2023-09-25 19:53:30 -07:00
parent 43046ede95
commit d8b7473576

View file

@ -60,7 +60,7 @@ impl QuickPaycheckState {
f,
split_body[4],
"Gross:",
&state.net_amount,
&state.gross_amount,
state.selected == SelectedEntry::Gross,
);
}
@ -68,7 +68,7 @@ impl QuickPaycheckState {
pub fn handle_event(event: KeyEvent, app: &mut App) {
if event.kind == KeyEventKind::Press {
match event.code {
KeyCode::Up => {
KeyCode::Up | KeyCode::BackTab => {
match app.states.quick_transactions.paycheck_state.selected {
SelectedEntry::Net => {
app.states.quick_transactions.paycheck_state.selected = SelectedEntry::Execute;
@ -81,7 +81,7 @@ impl QuickPaycheckState {
}
}
}
KeyCode::Down => {
KeyCode::Down | KeyCode::Tab => {
match app.states.quick_transactions.paycheck_state.selected {
SelectedEntry::Net => {
app.states.quick_transactions.paycheck_state.selected = SelectedEntry::Gross;
@ -94,6 +94,28 @@ impl QuickPaycheckState {
}
}
}
KeyCode::Char(value) => {
match app.states.quick_transactions.paycheck_state.selected {
SelectedEntry::Net => {
app.states.quick_transactions.paycheck_state.net_amount.push(value);
}
SelectedEntry::Gross => {
app.states.quick_transactions.paycheck_state.gross_amount.push(value);
}
_ => {}
}
}
KeyCode::Backspace => {
match app.states.quick_transactions.paycheck_state.selected {
SelectedEntry::Net => {
app.states.quick_transactions.paycheck_state.net_amount.pop();
}
SelectedEntry::Gross => {
app.states.quick_transactions.paycheck_state.gross_amount.pop();
}
_ => {}
}
}
_ => {}
}
}