Avancement du projet

This commit is contained in:
thatscringebro
2026-03-10 10:36:11 -04:00
parent b267360b2e
commit 7b8312af12
6 changed files with 48 additions and 27 deletions

View File

@@ -23,6 +23,9 @@ impl App {
panic!("stopping");
}
};
data_layer::setup(&con);
return App {
current_screen: CurrentScreen::Main,
current_widget: CurrentWidget::AccountList,
@@ -36,15 +39,9 @@ impl App {
}
pub fn get_list_accounts(&mut self) -> Vec<Account> {
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;
return self.acc_list.get_accounts(&self.connection);
}
pub fn first_ac(&mut self) {
self.acc_list.state.select_first();
}
pub fn next_ac(&mut self) {
self.acc_list.state.select_next();
}
@@ -59,9 +56,6 @@ impl App {
return accounts.to_vec();
}
pub fn first_tr(&mut self) {
self.trx_list.state.select_first();
}
pub fn next_tr(&mut self) {
self.trx_list.state.select_next();
}
@@ -74,4 +68,10 @@ impl App {
self.acc_list.add_account(ac);
self.new_account = Account::new(0, String::new(), AccountType::Cash);
}
pub fn save_new_tr(&mut self) {
let tr = data_layer::upsert_transaction(&self.connection, self.new_transaction.clone());
self.trx_list.add_tr(tr);
self.new_transaction = Transaction::new_empty();
}
}