better ac list

This commit is contained in:
thatscringebro
2025-12-17 13:49:31 -05:00
parent 33fb39e732
commit dd6b6f7b2c
4 changed files with 55 additions and 5 deletions

View File

@@ -1,7 +1,10 @@
use ratatui::widgets::ListState;
use sqlite::Connection;
use crate::{data_layer, entities::Account};
use crate::{
data_layer,
entities::{Account, AccountType},
};
pub enum CurrentScreen {
Main,
@@ -60,6 +63,19 @@ impl App {
}
pub fn get_list_accounts(&self) -> Vec<Account> {
return self.acc_list.get_accounts(&self.connection);
let mut accounts = self.acc_list.get_accounts(&self.connection);
let all = Account::new(0, "All".to_string(), AccountType::Cash);
accounts.insert(0, all);
return accounts;
}
pub fn first_ac(&mut self) {
self.acc_list.state.select_first();
}
pub fn next_ac(&mut self) {
self.acc_list.state.select_next();
}
pub fn previous_ac(&mut self) {
self.acc_list.state.select_previous();
}
}