début new account

This commit is contained in:
thatscringebro
2026-02-09 14:30:51 -05:00
parent df4fd0202d
commit b267360b2e
7 changed files with 155 additions and 92 deletions

31
src/entities/trxlist.rs Normal file
View File

@@ -0,0 +1,31 @@
use ratatui::widgets::ListState;
use sqlite::Connection;
use crate::{data_layer, entities::*};
pub struct TrxList {
trx: Vec<Transaction>,
ac_id: i64,
pub state: ListState,
}
impl TrxList {
pub fn new() -> TrxList {
let mut list_state = ListState::default();
list_state.select_first();
return TrxList {
trx: Vec::new(),
state: list_state,
ac_id: 0,
};
}
pub fn get_trx(&mut self, ac_id: i64, con: &Connection) -> Vec<Transaction> {
if ac_id == -1 {
return Vec::new();
}
if self.trx.iter().count() == 0 || self.ac_id != ac_id {
self.trx = data_layer::get_account_transactions(con, ac_id);
}
return self.trx.clone();
}
}