added user input to paycheck-quick entry
This commit is contained in:
parent
43046ede95
commit
d8b7473576
1 changed files with 25 additions and 3 deletions
|
@ -60,7 +60,7 @@ impl QuickPaycheckState {
|
||||||
f,
|
f,
|
||||||
split_body[4],
|
split_body[4],
|
||||||
"Gross:",
|
"Gross:",
|
||||||
&state.net_amount,
|
&state.gross_amount,
|
||||||
state.selected == SelectedEntry::Gross,
|
state.selected == SelectedEntry::Gross,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ impl QuickPaycheckState {
|
||||||
pub fn handle_event(event: KeyEvent, app: &mut App) {
|
pub fn handle_event(event: KeyEvent, app: &mut App) {
|
||||||
if event.kind == KeyEventKind::Press {
|
if event.kind == KeyEventKind::Press {
|
||||||
match event.code {
|
match event.code {
|
||||||
KeyCode::Up => {
|
KeyCode::Up | KeyCode::BackTab => {
|
||||||
match app.states.quick_transactions.paycheck_state.selected {
|
match app.states.quick_transactions.paycheck_state.selected {
|
||||||
SelectedEntry::Net => {
|
SelectedEntry::Net => {
|
||||||
app.states.quick_transactions.paycheck_state.selected = SelectedEntry::Execute;
|
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 {
|
match app.states.quick_transactions.paycheck_state.selected {
|
||||||
SelectedEntry::Net => {
|
SelectedEntry::Net => {
|
||||||
app.states.quick_transactions.paycheck_state.selected = SelectedEntry::Gross;
|
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();
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue