summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-08-29 10:23:00 +0100
committerJoe Carstairs <me@joeac.net>2026-08-29 10:23:00 +0100
commite0a7de1ef54e11682ee60c4bc17a4b1659ecdcfb (patch)
tree3a275f9bd6c3270432a87e8f3cb43dc6edb9e840 /schist_desktop_gui/src
parentec995248afb73fc314a9ac525f52f9ff0c6366ae (diff)
task-001: new transaction form is viewable (not interactive yet)
Diffstat (limited to 'schist_desktop_gui/src')
-rw-r--r--schist_desktop_gui/src/gui/components/new_transaction_form.rs45
1 files changed, 39 insertions, 6 deletions
diff --git a/schist_desktop_gui/src/gui/components/new_transaction_form.rs b/schist_desktop_gui/src/gui/components/new_transaction_form.rs
index 3625dcb..58509b1 100644
--- a/schist_desktop_gui/src/gui/components/new_transaction_form.rs
+++ b/schist_desktop_gui/src/gui/components/new_transaction_form.rs
@@ -1,24 +1,57 @@
-use iced::Element;
+use iced::{Element, widget::row};
-use crate::{gui::components::Text, traits::{Component, Viewable}};
+use crate::{gui::components::{Text, button, input::input}, style::SPACING_SM, traits::{Component, Viewable}};
#[derive(Clone, Debug)]
-pub struct NewTransactionForm {}
+pub struct NewTransactionForm {
+ day: String,
+ month: String,
+ year: String,
+ bucket: String,
+ payee: String,
+ quantity: String,
+ submit_text: Text,
+}
#[derive(Clone, Debug)]
-pub enum Message {}
+pub enum Message {
+ DayInputChanged(String),
+ MonthInputChanged(String),
+ YearInputChanged(String),
+ BucketInputChanged(String),
+ PayeeInputChanged(String),
+ QuantityInputChanged(String),
+ Submit,
+}
pub enum Action { None }
impl NewTransactionForm {
pub fn new() -> Self {
- Self {}
+ Self {
+ day: String::new(),
+ month: String::new(),
+ year: String::new(),
+ bucket: String::new(),
+ payee: String::new(),
+ quantity: String::new(),
+ submit_text: Text::new("+ Add"),
+ }
}
}
impl<'a> Viewable<'a, Message> for NewTransactionForm {
fn view(&'a self) -> Element<'a, Message> {
- Text::new("TODO: implement new transaction form").as_element()
+ row![
+ input("25").on_input(Message::DayInputChanged).width(32.0),
+ input("12").on_input(Message::MonthInputChanged).width(32.0),
+ input("2026").on_input(Message::YearInputChanged).width(48.0),
+ input("").on_input(Message::BucketInputChanged).width(138.0),
+ input("").on_input(Message::PayeeInputChanged).width(266.0),
+ input("").on_input(Message::QuantityInputChanged).width(104.0),
+ button(&self.submit_text, Message::Submit, false).width(64.0),
+ ].spacing(u32::from(SPACING_SM))
+ .into()
}
}