pub struct TransactionFormState {
pub focused_field: TransactionField,
pub date_input: TextInput,
pub payee_input: TextInput,
pub category_input: TextInput,
pub selected_category: Option<CategoryId>,
pub category_list_index: usize,
pub show_category_dropdown: bool,
pub outflow_input: TextInput,
pub inflow_input: TextInput,
pub memo_input: TextInput,
pub is_edit: bool,
pub error_message: Option<String>,
}Expand description
State for the transaction form dialog
Fields§
§focused_field: TransactionFieldCurrently focused field
date_input: TextInputDate input
payee_input: TextInputPayee input
category_input: TextInputCategory search input
selected_category: Option<CategoryId>Currently selected category ID
category_list_index: usizeCategory selection index (for dropdown)
show_category_dropdown: boolShow category dropdown
outflow_input: TextInputOutflow input (money going out - expenses)
inflow_input: TextInputInflow input (money coming in - income)
memo_input: TextInputMemo input
is_edit: boolWhether this is an edit (vs new transaction)
error_message: Option<String>Error message to display
Implementations§
Source§impl TransactionFormState
impl TransactionFormState
Sourcepub fn from_transaction(
txn: &Transaction,
categories: &[(CategoryId, String)],
) -> Self
pub fn from_transaction( txn: &Transaction, categories: &[(CategoryId, String)], ) -> Self
Create form state pre-populated from an existing transaction
Sourcepub fn next_field(&mut self)
pub fn next_field(&mut self)
Move to the next field
Sourcepub fn prev_field(&mut self)
pub fn prev_field(&mut self)
Move to the previous field
Sourcepub fn set_focus(&mut self, field: TransactionField)
pub fn set_focus(&mut self, field: TransactionField)
Set focus to a specific field
Sourcepub fn focused_input(&mut self) -> &mut TextInput
pub fn focused_input(&mut self) -> &mut TextInput
Get the currently focused input
Sourcepub fn build_transaction(
&self,
account_id: AccountId,
) -> Result<Transaction, String>
pub fn build_transaction( &self, account_id: AccountId, ) -> Result<Transaction, String>
Build a transaction from the form state
Sourcepub fn clear_error(&mut self)
pub fn clear_error(&mut self)
Clear any error message
Trait Implementations§
Source§impl Clone for TransactionFormState
impl Clone for TransactionFormState
Source§fn clone(&self) -> TransactionFormState
fn clone(&self) -> TransactionFormState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TransactionFormState
impl Debug for TransactionFormState
Auto Trait Implementations§
impl Freeze for TransactionFormState
impl RefUnwindSafe for TransactionFormState
impl Send for TransactionFormState
impl Sync for TransactionFormState
impl Unpin for TransactionFormState
impl UnwindSafe for TransactionFormState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more