summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/gui/components
diff options
context:
space:
mode:
Diffstat (limited to 'schist_desktop_gui/src/gui/components')
-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()
}
}