diff --git a/advotracker/src/callbacks/policycheck_state.rs b/advotracker/src/callbacks/policycheck_state.rs index c38d747..f0c424d 100644 --- a/advotracker/src/callbacks/policycheck_state.rs +++ b/advotracker/src/callbacks/policycheck_state.rs @@ -53,7 +53,7 @@ pub struct PolicyCheckState { policy_data_count: usize, //policy_number_text_box: Entity, policy_numbers: HashMap, - popup_box: Option + progress_box: Option } impl GlobalState for PolicyCheckState {} @@ -126,9 +126,9 @@ impl PolicyCheckState { //text_block_wrapper.set_enabled(true); //text_block_wrapper.set_text("Importieren der Prüflisten-Elemnte ..."); - self.set_popup_box(ctx); - progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(0.25); - // for i in 1..4 { + // self.set_progress_box(ctx); + // progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(0.25); + // for _ in 1..4 { // let old_width = *progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).val(); // let new_width = old_width + 0.33; // progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(new_width); @@ -156,7 +156,7 @@ impl PolicyCheckState { } // remove popup widget now, that we are done - self.remove_popup_box(ctx); + //self.remove_progress_box(ctx); } else { trace!(target: "advotracker", @@ -190,7 +190,7 @@ impl PolicyCheckState { } // let sender = ctx.window_sender(); - // self.set_popup_box(ctx); + // self.set_progress_box(ctx); // let one_seconds = time::Duration::from_secs(1); // for i in 1..4 { // let old_width = *progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).val(); @@ -201,19 +201,19 @@ impl PolicyCheckState { // progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(new_width); // thread::sleep(one_seconds); // } - //self.remove_popup_box(ctx); + //self.remove_progress_box(ctx); // Load data into hashmap trace!(target: "advotracker", state = "importing"); - // match self.import_data(ctx) { - // Ok(()) => { - // trace!(target: "advotracker", import_data = "success"); - // } - // _ => { - // error!("Importing data failed!"); - // trace!(target: "advotracker", import_data = "failed"); - // } - // } + match self.import_data(ctx) { + Ok(()) => { + trace!(target: "advotracker", import_data = "success"); + } + _ => { + error!("Importing data failed!"); + trace!(target: "advotracker", import_data = "failed"); + } + } trace!(target: "advotracker", state = "parsing", policy_number = ?policy_string); @@ -289,9 +289,9 @@ impl PolicyCheckState { } /// Remove a popup box showing the data import status in a progress bar - fn remove_popup_box(&mut self, ctx: &mut Context<'_>) { - if let Some(popup_box) = self.popup_box { - ctx.remove_child(popup_box); + fn remove_progress_box(&mut self, ctx: &mut Context<'_>) { + if let Some(progress_box) = self.progress_box { + ctx.remove_child(progress_box); println!("PopupBox removed !"); } } @@ -343,7 +343,7 @@ impl PolicyCheckState { } /// Set a popup box that updates the import status in a progress bar - fn set_popup_box(&mut self, ctx: &mut Context<'_>) { + fn set_progress_box(&mut self, ctx: &mut Context<'_>) { //println!("Set up Popup box: {:?}", text_box); let stack = ctx .entity_of_child(ID_POLICY_CHECK_RESULT) @@ -351,11 +351,11 @@ impl PolicyCheckState { let current_entity = ctx.entity; let build_context = &mut ctx.build_context(); - let popup_box = new_popup_box(current_entity, "Importing data ...", build_context); - // create a popup_box widget as a child of entity "ID_POLICY_CHECK_POLICY_NUMBER" - build_context.append_child(stack, popup_box); - self.popup_box = Some(popup_box); - println!("PopupBox created: {:?}", Some(popup_box)); + let progress_box = new_progress_box(current_entity, "Importing data ...", build_context); + // create a progress_box widget as a child of entity "ID_POLICY_CHECK_POLICY_NUMBER" + build_context.append_child(stack, progress_box); + self.progress_box = Some(progress_box); + println!("PopupBox created: {:?}", Some(progress_box)); } /// Update count of elements in the policy data list. @@ -377,6 +377,10 @@ impl State for PolicyCheckState { .entity_of_child(ID_POLICY_CHECK_BUTTON_MENU) .expect("PolicyCheckState.init: Can't find entity of resource 'ID_POLICY_CHECK_POLICY_MENU_BUTTON'."); + self.progress_box = ctx + .entity_of_child(ID_POLICY_CHECK_PROGRESS_BOX) + .expect("PolicyCheckState.init: Can't find entity of resource 'ID_POLICY_PROGRESS_BOX'."); + // // Load the saved data from a file in 'ron' format into our data structure. // // The cargo package identifier (default: 'nwx.advotracker') is used as the // // app directory name. The directory location is OS dependant @@ -433,7 +437,7 @@ impl State for PolicyCheckState { } Action::InputTextChanged(entity) => { println!("entry changed: {}", text_box(ctx.get_widget(entity)).text()); - //self.set_popup_box(ctx); + //self.set_progress_box(ctx); //self.set_check_button(policy_check_label_policy_number, ctx); //self.set_visibility(entity, ctx); } @@ -441,8 +445,8 @@ impl State for PolicyCheckState { self.open_menu(text_block, ctx); } Action::ParseEntry(text_box) => { - println!("set_popup_box: {:#?}", text_box); - self.set_popup_box(ctx); + //println!("set_progress_box: {:#?}", text_box); + //self.set_progress_box(ctx); self.parse_entry(text_box, ctx); //ctx.get_widget(text_box).get::("text").as_string(); //self.parse_entry(text_box, &mut policy_numbers, @@ -452,7 +456,7 @@ impl State for PolicyCheckState { ctx.get_widget(policy_check_policy_number).set("enabled", false); ctx.push_event_by_window(FocusEvent::RemoveFocus(policy_check_policy_number)); } - Action::RemovePopupBox(text_box) => { + Action::RemovePopupBox(_entity) => { self.remove_popup_box(ctx); } Action::ResetProgress => { @@ -465,7 +469,7 @@ impl State for PolicyCheckState { progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(0.); } } - Action::SetPopupBox(entity) => { + Action::SetPopupBox(_entity) => { //println!("set_popup_box: {:#?}", ctx.widget().get::("water_mark")); //println!("set_popup_box: {:#?}", entity); self.set_popup_box(ctx); @@ -503,9 +507,9 @@ impl State for PolicyCheckState { } } -fn new_popup_box(target: Entity, text: &str, ctx: &mut BuildContext<'_>) -> Entity { +fn new_progress_box(target: Entity, text: &str, ctx: &mut BuildContext<'_>) -> Entity { Popup::new() - .id(ID_POLICY_CHECK_PROGRESS_POPUP) + .id(ID_POLICY_CHECK_PROGRESS_BOX) .target(target) .open(true) .width(280.0) diff --git a/advotracker/src/widgets/policycheck_menu.rs b/advotracker/src/widgets/policycheck_menu.rs index 177d295..8fe52c9 100644 --- a/advotracker/src/widgets/policycheck_menu.rs +++ b/advotracker/src/widgets/policycheck_menu.rs @@ -20,8 +20,35 @@ widget!( } ); + impl Template for PolicyCheckMenu { fn template(self, _id: Entity, ctx: &mut BuildContext) -> Self { + // let policy_check_menu_container = Container::new() + // .id(ID_POLICY_CHECK_MENU_CONTAINER) + // .class(CLASS_MENU) + // .attach(Grid::row(3)) + // .attach(Grid::column(8)) + // .margin((0.0, 0.0, 4.0, 0.0)) + // .enabled(false) + // .min_size(120.0, 180.0) + // .v_align("center") + // .on_click(move |ctx, _| { + // ctx.get_mut::(id) + // .action(Action::NewEntry(quit)); + // true + // }) + // .build(ctx); + + // let policycheck_menu_container = Container::new() + // .id(ID_POLICY_CHECK_MENU_CONTAINER) + // .background("#dfebf5") + // .width(200.0) + // .height(200.0) + // .child( + + // The menu implemented as an overlay + //ctx.append_child_to_overlay(policy_check_menu_button).unwrap(); + self.name("PolicyCheckMenu").child( Stack::new() .orientation("vertical") diff --git a/advotracker/src/widgets/policycheck_view.rs b/advotracker/src/widgets/policycheck_view.rs index 9eb6e84..759b692 100644 --- a/advotracker/src/widgets/policycheck_view.rs +++ b/advotracker/src/widgets/policycheck_view.rs @@ -11,10 +11,8 @@ use crate::{ data::structures::PolicyCheck, data::keys::*, callbacks::policycheck_state::*, - //policycheck_state::{Action, PolicyCheckState}, }; - // Macro that initializes the widget structures/variables for our view (essential!) widget!( /// Dialog to enter a policy identifier/number. @@ -29,20 +27,62 @@ widget!( // The template implementation for our View impl Template for PolicyCheckView { fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self { - let policy_check_menu_text_block = TextBlock::new() - .id(ID_POLICY_CHECK_TEXT_BLOCK_MENU) + let policy_check_bottom_bar = Container::new() + .class(CLASS_BOTTOM_BAR) + .attach(Grid::row(4)) + .attach(Grid::column(1)) + .attach(Grid::column_span(2)) + .v_align("end") + .child( + Container::new() + //.padding(18.) + .child( Container::new() + //.size(220., 64.) + .element("logo_customer") + .margin((0., 16., 16., 0.)) + .v_align("center") + .child( + ImageWidget::new() + .image("resources/images/hiedemann_logo.png") + .v_align("center") + .build(ctx), + ) + .build(ctx), + ) + .build(ctx), + ) + .child( + Container::new() + //Grid::new() + .element("copyright_vendor") + .attach(Grid::column(1)) + .background("#1f1f1f") + .h_align("end") + .v_align("end") + .child( + TextBlock::new() + .margin((0., 9., 16., 0.)) + .text("©Networkx GmbH") + .build(ctx) + ) + .build(ctx), + ) + .build(ctx); + + let policy_check_label_menu = TextBlock::new() + .id(ID_POLICY_CHECK_LABEL_MENU) .foreground("#3b434a") .text("Help Menu") .v_align("center") .h_align("center") .build(ctx); - let policy_check_menu_button = Button::new() - .id(ID_POLICY_CHECK_MENU_BUTTON) + let policy_check_button_menu = Button::new() + .id(ID_POLICY_CHECK_BUTTON_MENU) .icon(material_icons_font::MD_MENU) .class("menu_button") .attach(Grid::column(2)) - .margin((0., 0., 0., 0.)) + //.margin((0., 0., 0., 0.)) //.text("Menu Button") //.min_size(8.0, 8.0) .min_size(16.0, 16.0) @@ -52,12 +92,12 @@ impl Template for PolicyCheckView { .on_mouse_down(|_, _| true) .on_click(move |ctx, _| { ctx.get_mut::(id) - .action(Action::OpenMenu(policy_check_menu_text_block)); + .action(Action::OpenMenu(policy_check_label_menu)); true }) .build(ctx); - let policy_check_result_button = Button::new() + let policy_check_button_result = Button::new() .id(ID_POLICY_CHECK_BUTTON_RESULT) .class("single_content") .h_align("start") @@ -66,18 +106,167 @@ impl Template for PolicyCheckView { .enabled(false) .build(ctx); - let policy_data_count_block = TextBlock::new() - .id(ID_POLICY_DATA_COUNT_BLOCK) - //.class(CLASS_TEXT_BLOCK) - .attach(Grid::row(3)) + let policy_check_header_bar = Container::new() + //.border_color("transparent") + .class(CLASS_HEADER_BAR) + .attach(Grid::row(0)) .attach(Grid::column(1)) - .margin((0., 4., 0., 0.)) - .h_align("end") - .v_align("top") - .enabled(true) + .attach(Grid::column_span(2)) + .child( + Grid::new() + .child( + TextBlock::new() + //.class(CLASS_HEADER) + .class("h1") + //.class(".myheader") + .id(ID_POLICY_CHECK_HEADER) + //.font_size(24) + //.font("Roboto Medium") + .v_align("center") + .h_align("left") + //.margin((32.0, 32.0, 32.0, 32.0)) + .text("Validierung Versicherungsnummer") + .build(ctx), + ) + .build(ctx), + ) + .child(policy_check_button_menu) .build(ctx); - let _policy_check_numeric_box = NumericBox::new() + let policy_check_form_row_0 = Stack::new() + .attach(Grid::row(0)) + .attach(Grid::column(0)) + .attach(Grid::column_span(5)) + .orientation("horizontal") + .v_align("center") + .child( + TextBlock::new() + .id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER) + //.class(CLASS_TEXT_BLOCK) + .attach(Grid::row(0)) + .attach(Grid::column(0)) + .margin((0., 0., 16., 0.)) + .h_align("end") + .v_align("center") + //.min_width(250.) + //.min_height(45.) + //.size(250., 45.) + .text("Versicherungsnummer:") + .build(ctx), + ) + .child( + TextBox::new() + .attach(Grid::row(0)) + .attach(Grid::column(2)) + .id(ID_POLICY_CHECK_POLICY_NUMBER) + .h_align("start") + //.width(105.0) + //.min_width(100.0) + .lost_focus_on_activation(false) + .water_mark("10-stellig") + .on_activate(move |ctx, entity| { + // Entity is entered/activated via Mouse/Keyboard + ctx.get_mut::(id) + .action(Action::ParseEntry(entity)); + }) + //.on_changed(move |ctx, entity| { + // ctx.get_mut::(id) + // .action(Action::SetProgressBox(entity)); + // ctx.get_mut::(id) + // .action(Action::AddProgress(0.5)); + // ctx.get_mut::(id) + // .action(Action::InputTextChanged(entity)); + // ctx.get_mut::(id) + // .action(Action::SetVisibility(entity)); + // //ctx.get_widget(policy_check_label_policy_number).set("visible"); + // // ctx.get_mut::(id) + // // .action(Action::SetVisility(entity)); + //}) + // .on_mouse_down | .on_mouse_move | .on_mouse_up (move |ctx, entity| { + // state(id, states).action(Action::AddItem); + // }) + // .on_click(move |states, _| { + // state(id, states).action(Action::AddItem); + // true + // }) + .build(ctx), + ) + .child(policy_check_button_result) + .build(ctx); + + let policy_check_form_row_1 = Stack::new() + // 2nd row + .attach(Grid::row(1)) + .attach(Grid::column(0)) + .attach(Grid::column_span(5)) + .orientation("horizontal") + .v_align("center") + .child( + TextBlock::new() + .id(ID_POLICY_CHECK_LABEL_RESULT) + .class(CLASS_TEXT_BLOCK) + .attach(Grid::row(1)) + .attach(Grid::column(0)) + .margin((0., 0., 16., 0.)) + .h_align("end") + .v_align("center") + .width(250.0) + .min_width(250.0) + .text("Ergebnis:") + .visibility(Visibility::Visible) + .build(ctx), + ) + .child( + TextBlock::new() + .id(ID_POLICY_CHECK_RESULT) + .attach(Grid::row(1)) + .attach(Grid::column(2)) + .h_align("start") + .v_align("center") + .build(ctx) + ) + .build(ctx); + + let policy_check_form = Container::new() + //.class(CLASS_POLICY_CHECK_FORM) + .attach(Grid::row(2)) + .attach(Grid::column(1)) + .v_align("top") + .padding(14.0) + .background("transparent") + .border_radius(3.) + .border_width(1.) + .border_brush("#fafafa") + .child( + Grid::new() + .id(ID_POLICY_CHECK_FORM) + .columns( + Columns::new() + // Labels + .add("250.") + // Seperator + .add("16.") + // Values + .add("100.") + // Seperator + .add("16.") + // Result-Button + .add("32.") + .build(), + ) + .rows( + Rows::new() + .add("auto") + .add("auto") + .build(), + ) + .child(policy_check_form_row_0) + .child(policy_check_form_row_1) + .build(ctx), + ) + .build(ctx); + + let _policy_check_numeric_box = NumericBox::new() .id(ID_POLICY_CHECK_POLICY_NUMBER) .h_align("start") .width(100.0) @@ -97,239 +286,18 @@ impl Template for PolicyCheckView { //}) .build(ctx); - // let policy_check_menu_container = Container::new() - // .id(ID_POLICY_CHECK_MENU_CONTAINER) - // .class(CLASS_MENU) - // .attach(Grid::row(3)) - // .attach(Grid::column(8)) - // .margin((0.0, 0.0, 4.0, 0.0)) - // .enabled(false) - // .min_size(120.0, 180.0) - // .v_align("center") - // .on_click(move |ctx, _| { - // ctx.get_mut::(id) - // .action(Action::NewEntry(quit)); - // true - // }) - // .build(ctx); - - // let policycheck_menu_container = Container::new() - // .id(ID_POLICY_CHECK_MENU_CONTAINER) - // .background("#dfebf5") - // .width(200.0) - // .height(200.0) - // .child( - - // The menu implemented as an overlay - //ctx.append_child_to_overlay(policy_check_menu_button).unwrap(); - - let policy_check_header = Container::new() - // Header Bar - //.border_color("transparent") - .class(CLASS_TOP_BAR) - .attach(Grid::row(0)) - .attach(Grid::column(0)) - .attach(Grid::column_span(3)) - .child( - Grid::new() - .child( - TextBlock::new() - //.class(CLASS_HEADER) - .class("h1") - //.class(".myheader") - .id(ID_POLICY_CHECK_HEADER) - //.font_size(24) - //.font("Roboto Medium") - .v_align("center") - .h_align("left") - .margin((32.0, 32.0, 32.0, 32.0)) - .text("Validierung Versicherungsnummer") - .build(ctx), - ) - .build(ctx), - ) - .child(policy_check_menu_button) + let policy_data_count_block = TextBlock::new() + .id(ID_POLICY_DATA_COUNT_BLOCK) + //.class(CLASS_TEXT_BLOCK) + .attach(Grid::row(3)) + .attach(Grid::column(1)) + .margin((0., 4., 0., 0.)) + .h_align("end") + .v_align("top") + .enabled(true) .build(ctx); - let policy_check_form_row_0 = Stack::new() - // 1st row - .attach(Grid::row(0)) - .attach(Grid::column(0)) - .orientation("horizontal") - //.v_align("center") - .child( - TextBlock::new() - .id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER) - //.class(CLASS_TEXT_BLOCK) - .attach(Grid::row(0)) - .attach(Grid::column(0)) - .margin((0., 0., 16., 0.)) - .h_align("end") - .v_align("center") - .min_width(250.) - .min_height(45.) - //.size(250., 45.) - .text("Versicherungsnummer:") - .build(ctx), - ) - .child( - TextBox::new() - .attach(Grid::row(0)) - .attach(Grid::column(2)) - .id(ID_POLICY_CHECK_POLICY_NUMBER) - .h_align("start") - .width(100.0) - .min_width(95.0) - .margin((0., 0., 0., 0.)) - .lost_focus_on_activation(false) - .water_mark("10-stellig") - .text("") - .on_activate(move |ctx, entity| { - // Entity is entered/activated via Mouse/Keyboard - ctx.get_mut::(id) - .action(Action::ParseEntry(entity)); - }) - //.on_changed(move |ctx, entity| { - // ctx.get_mut::(id) - // .action(Action::SetPopupBox(entity)); - // ctx.get_mut::(id) - // .action(Action::AddProgress(0.5)); - // ctx.get_mut::(id) - // .action(Action::InputTextChanged(entity)); - // ctx.get_mut::(id) - // .action(Action::SetVisibility(entity)); - // //ctx.get_widget(policy_check_label_policy_number).set("visible"); - // // ctx.get_mut::(id) - // // .action(Action::SetVisility(entity)); - //}) - // .on_mouse_down | .on_mouse_move | .on_mouse_up (move |ctx, entity| { - // state(id, states).action(Action::AddItem); - // }) - // .on_click(move |states, _| { - // state(id, states).action(Action::AddItem); - // true - // }) - .build(ctx) - ) - .build(ctx); - - let policy_check_form_row_1 = Stack::new() - // 2nd row - .attach(Grid::row(1)) - .attach(Grid::column(0)) - .orientation("horizontal") - //.v_align("center") - .child( - TextBlock::new() - .id(ID_POLICY_CHECK_LABEL_RESULT) - .class(CLASS_TEXT_BLOCK) - .attach(Grid::column(0)) - .attach(Grid::row(1)) - .margin((0., 0., 16., 0.)) - .h_align("end") - .v_align("center") - .min_width(250.0) - .text("Ergebnis:") - .visibility(Visibility::Visible) - .build(ctx), - ) - .child( - TextBlock::new() - .id(ID_POLICY_CHECK_RESULT) - .h_align("start") - .attach(Grid::row(1)) - .attach(Grid::column(2)) - .text("") - .width(250.) - //.margin((4., 0., 0., 0.)) - //.lost_focus_on_activation(false) - // .on_activate(move |ctx, entity| { - // ctx.get_mut::(id) - // .action(Action::ParseEntry(entity)); - // }) - // .on_changed(move |ctx, entity| { - // ctx.get_mut::(id) - // .action(Action::InputTextChanged(entity)); - // }) - .build(ctx) - ) - .build(ctx); - - //let policy_check_policy_number = Stack::new() - // build(ctx); - - let policy_check_form = Container::new() - //.class(CLASS_POLICY_CHECK_FORM) - .attach(Grid::row(2)) - .attach(Grid::column(0)) - .attach(Grid::column_span(3)) - .margin((16., 26., 26., 16.)) - .child( - Grid::new() - .id(ID_POLICY_CHECK_FORM) - .columns( - Columns::new() - // Labels - .add("220.") - // Seperator - .add("16.") - // Values - .add("100.") - .build(), - ) - .rows( - Rows::new() - .add("96.") - .add("96.") - .build(), - ) - .child(policy_check_form_row_0) - .child(policy_check_form_row_1) - .build(ctx), - ) - .build(ctx); - - let policy_check_footer = Container::new() - // Bottom bar - .class(CLASS_BOTTOM_BAR) - .attach(Grid::row(4)) - .attach(Grid::column(0)) - .attach(Grid::column_span(3)) - .v_align("end") - .child( - Grid::new() - .element("logo_customer") - .margin((9., 16., 16., 9.)) - .attach(Grid::column(0)) - .attach(Grid::row(1)) - .h_align("start") - .v_align("center") - .child( - ImageWidget::new() - .image("resources/images/hiedemann_logo.png") - .build(ctx), - ) - .build(ctx), - ) - .child( - Grid::new() - .element("logo_vendor") - .margin((9.0, 16.0, 16.0, 9.0)) - .attach(Grid::column(0)) - .attach(Grid::row(5)) - .h_align("end") - .v_align("center") - .child( - ImageWidget::new() - .image("resources/images/networkx_logo.png") - .build(ctx), - ) - .build(ctx), - //ctx.append_child_to_overlay(policycheck_menu_text_block).unwrap() - ) - .build(ctx); - - // Starter page: check for valid policy number + // Starter page: check policy numbers self.name("PolicyCheckView") // initialize struct (derived default macro) .policy_check(PolicyCheck::default()) @@ -339,10 +307,9 @@ impl Template for PolicyCheckView { //.background("#fafafa") .columns( Columns::new() - .add(150.) - .add("*") - //.add(50.) + .add(50.) .add("*") + .add(50.) .build(), ) .rows( @@ -355,244 +322,20 @@ impl Template for PolicyCheckView { .build(), ) - // Header Bar - .child( - //.border_color("transparent") - Container::new() - //.class(CLASS_TOP_BAR) - .attach(Grid::row(0)) - .attach(Grid::column(0)) - .attach(Grid::column_span(3)) - .child( - Grid::new() - .child( - TextBlock::new() - //.class(CLASS_HEADER) - .class("h1") - //.class(".myheader") - .id(ID_POLICY_CHECK_HEADER) - //.font_size(24) - //.font("Roboto Medium") - .v_align("center") - .h_align("center") - .margin((32.0, 32.0, 32.0, 32.0)) - .text("Validierung Versicherungsnummer") - .build(ctx), - ) - .build(ctx), - ) - .child(policy_check_menu_button) - .build(ctx), - ) + // row 0: Policy Check Header + .child(policy_check_header_bar) - .child( - Container::new() - .class("separator") - .attach(Grid::row(1)) - .attach(Grid::column_span(3)) - .build(ctx), - ) + // row 1: Seperator - // Policy Check Form - .child( - Container::new() - //.class(CLASS_POLICY_CHECK_FORM) - .attach(Grid::row(2)) - .attach(Grid::column(0)) - .attach(Grid::column_span(3)) - .margin((16.0, 26.0, 26.0, 16.0)) - .child( - Grid::new() - .id(ID_POLICY_CHECK_FORM) - .columns( - Columns::new() - // Labels - .add("220.0") - // Seperator - .add("16.0") - // Values - .add("100.0") - .build(), - ) - .rows( - Rows::new() - .add("64.0") - .add("64.0") - .build(), - ) - .child( - // Labels - Stack::new() - .attach(Grid::column(0)) - .attach(Grid::row(0)) - .orientation("vertical") - //.v_align("center") - .child( - TextBlock::new() - .id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER) - //.class(CLASS_TEXT_BLOCK) - .margin((0.0, 0.0, 16.0, 16.0)) - .h_align("end") - .v_align("center") - .min_width(250.0) - .min_height(45.0) - //.size(250.0, 45.0) - .text("Versicherungsnummer:") - .build(ctx), - ) - .child( - TextBlock::new() - .id(ID_POLICY_CHECK_LABEL_RESULT) - //.class(CLASS_TEXT_BLOCK) - .attach(Grid::column(0)) - .attach(Grid::row(1)) - .margin((0.0, 0.0, 16.0, 0.0)) - .h_align("end") - .v_align("center") - .min_width(250.0) - //.min_size(120.0, 180.0) - //.text("Ergebnis:") - //.text("Result:") - .build(ctx), - ) - .build(ctx) - ) - .child( - // Values - Stack::new() - .attach(Grid::column(1)) - .attach(Grid::row(0)) - //.attach(Grid::column_span(3)) - .orientation("vertical") - //.margin((16.0, 16.0, 16.0, 16.0)) - //.child(policy_check_text_box) - .child( - TextBox::new() - .id(ID_POLICY_CHECK_POLICY_NUMBER) - .h_align("start") - .width(280.0) - .min_width(200.0) - .margin((0.0, 0.0, 0.0, 16.0)) - .lost_focus_on_activation(false) - .water_mark("10-stellige Nummer (ohne 'AS')") - .text("") - .on_activate(move |ctx, entity| { - // Entity is entered/activated via Mouse/Keyboard - ctx.get_mut::(id) - .action(Action::ParseEntry(entity)); - }) - .on_changed(move |ctx, entity| { - // Element value has changed - ctx.get_mut::(id) - .action(Action::InputTextChanged(entity)); - }) - .build(ctx), - ) - //.icon(material_icons_font_ttf::MD_ADD_CIRCLE) - // .child() - // NumericBox::new() - // .id(ID_POLICY_CHECK_POLICY_NUMBER) - // .h_align("start") - // .width(250.0) - // .min(1000000000) - // .max(9999999999) - // .val(0) - // .min_width(200.0) - // .margin((0.0, 0.0, 0.0, 16.0)) - // //.lost_focus_on_activation(false) - // //.water_mark("10-stellige Nummer (ohne 'AS')") - // //.text("") - // //.on_activate(move |ctx, entity| { - // // ctx.get_mut::(id) - // // .action(Action::ParseEntry(entity)); - // //}) - // // .on_changed(move |ctx, entity| { - // // ctx.get_mut::(id) - // // .action(Action::InputTextChanged(entity)); - // // }) - // // .on_update(move |ctx, entity| { - // // ctx.get_mut::(id) - // // .action(Action::InputTextChanged(entity)); - // // }) - // .build(ctx), - //) - .child( - TextBlock::new() - //.id(ID_POLICY_CHECK_RESULT) - .id("policy_check_result") - .h_align("start") - .attach(Grid::column(1)) - .attach(Grid::row(1)) - .text(("")) - //.margin((4.0, 0.0, 0.0, 0.0)) - //.lost_focus_on_activation(false) - // .on_activate(move |ctx, entity| { - // ctx.get_mut::(id) - // .action(Action::ParseEntry(entity)); - // }) - // .on_changed(move |ctx, entity| { - // ctx.get_mut::(id) - // .action(Action::InputTextChanged(entity)); - // }) - .build(ctx), - ) - .build(ctx) - ) - .build(ctx) - ) - .build(ctx) - ) - .child( - Container::new() - .class("") - .attach(Grid::row(3)) - .attach(Grid::column_span(3)) - .build(ctx), - ) + // row 2: Policy Check Form + .child(policy_check_form) + + // row 3: Sum HashMap elements .child(policy_data_count_block) - // Bottom bar - .child( - Container::new() - .class(CLASS_BOTTOM_BAR) - .attach(Grid::row(4)) - .attach(Grid::column(0)) - .attach(Grid::column_span(3)) - .v_align("end") - .child( - Grid::new() - .element("logo_customer") - .margin((9.0, 16.0, 16.0, 9.0)) - .attach(Grid::column(0)) - .attach(Grid::row(1)) - .h_align("start") - .v_align("center") - .child( - ImageWidget::new() - .image("resources/images/hiedemann_logo.png") - .build(ctx), - ) - .build(ctx), - ) - .child( - Grid::new() - .element("logo_vendor") - .margin((9.0, 16.0, 16.0, 9.0)) - .attach(Grid::column(0)) - .attach(Grid::row(5)) - .h_align("end") - .v_align("center") - .child( - ImageWidget::new() - .image("resources/images/networkx_logo.png") - .build(ctx), - ) - .build(ctx), - //ctx.append_child_to_overlay(policycheck_menu_text_block).unwrap() - ) - .build(ctx), - ) - .build(ctx), - ) + // row 4: Policy Check BOttom + .child(policy_check_bottom_bar) + .build(ctx), + ) } }