widgets: policycheck_view update

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2020-07-12 20:09:03 +02:00
parent 19ad9198d0
commit aa26e6634d
3 changed files with 293 additions and 519 deletions

View File

@@ -53,7 +53,7 @@ pub struct PolicyCheckState {
policy_data_count: usize, policy_data_count: usize,
//policy_number_text_box: Entity, //policy_number_text_box: Entity,
policy_numbers: HashMap<usize, PolicyCode>, policy_numbers: HashMap<usize, PolicyCode>,
popup_box: Option<Entity> progress_box: Option<Entity>
} }
impl GlobalState for PolicyCheckState {} impl GlobalState for PolicyCheckState {}
@@ -126,9 +126,9 @@ impl PolicyCheckState {
//text_block_wrapper.set_enabled(true); //text_block_wrapper.set_enabled(true);
//text_block_wrapper.set_text("Importieren der Prüflisten-Elemnte ..."); //text_block_wrapper.set_text("Importieren der Prüflisten-Elemnte ...");
self.set_popup_box(ctx); // self.set_progress_box(ctx);
progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(0.25); // progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(0.25);
// for i in 1..4 { // for _ in 1..4 {
// let old_width = *progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).val(); // let old_width = *progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).val();
// let new_width = old_width + 0.33; // let new_width = old_width + 0.33;
// progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(new_width); // 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 // remove popup widget now, that we are done
self.remove_popup_box(ctx); //self.remove_progress_box(ctx);
} else { } else {
trace!(target: "advotracker", trace!(target: "advotracker",
@@ -190,7 +190,7 @@ impl PolicyCheckState {
} }
// let sender = ctx.window_sender(); // let sender = ctx.window_sender();
// self.set_popup_box(ctx); // self.set_progress_box(ctx);
// let one_seconds = time::Duration::from_secs(1); // let one_seconds = time::Duration::from_secs(1);
// for i in 1..4 { // for i in 1..4 {
// let old_width = *progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).val(); // 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); // progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(new_width);
// thread::sleep(one_seconds); // thread::sleep(one_seconds);
// } // }
//self.remove_popup_box(ctx); //self.remove_progress_box(ctx);
// Load data into hashmap // Load data into hashmap
trace!(target: "advotracker", state = "importing"); trace!(target: "advotracker", state = "importing");
// match self.import_data(ctx) { match self.import_data(ctx) {
// Ok(()) => { Ok(()) => {
// trace!(target: "advotracker", import_data = "success"); trace!(target: "advotracker", import_data = "success");
// } }
// _ => { _ => {
// error!("Importing data failed!"); error!("Importing data failed!");
// trace!(target: "advotracker", import_data = "failed"); trace!(target: "advotracker", import_data = "failed");
// } }
// } }
trace!(target: "advotracker", state = "parsing", policy_number = ?policy_string); 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 /// Remove a popup box showing the data import status in a progress bar
fn remove_popup_box(&mut self, ctx: &mut Context<'_>) { fn remove_progress_box(&mut self, ctx: &mut Context<'_>) {
if let Some(popup_box) = self.popup_box { if let Some(progress_box) = self.progress_box {
ctx.remove_child(popup_box); ctx.remove_child(progress_box);
println!("PopupBox removed !"); println!("PopupBox removed !");
} }
} }
@@ -343,7 +343,7 @@ impl PolicyCheckState {
} }
/// Set a popup box that updates the import status in a progress bar /// 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); //println!("Set up Popup box: {:?}", text_box);
let stack = ctx let stack = ctx
.entity_of_child(ID_POLICY_CHECK_RESULT) .entity_of_child(ID_POLICY_CHECK_RESULT)
@@ -351,11 +351,11 @@ impl PolicyCheckState {
let current_entity = ctx.entity; let current_entity = ctx.entity;
let build_context = &mut ctx.build_context(); let build_context = &mut ctx.build_context();
let popup_box = new_popup_box(current_entity, "Importing data ...", build_context); let progress_box = new_progress_box(current_entity, "Importing data ...", build_context);
// create a popup_box widget as a child of entity "ID_POLICY_CHECK_POLICY_NUMBER" // create a progress_box widget as a child of entity "ID_POLICY_CHECK_POLICY_NUMBER"
build_context.append_child(stack, popup_box); build_context.append_child(stack, progress_box);
self.popup_box = Some(popup_box); self.progress_box = Some(progress_box);
println!("PopupBox created: {:?}", Some(popup_box)); println!("PopupBox created: {:?}", Some(progress_box));
} }
/// Update count of elements in the policy data list. /// 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) .entity_of_child(ID_POLICY_CHECK_BUTTON_MENU)
.expect("PolicyCheckState.init: Can't find entity of resource 'ID_POLICY_CHECK_POLICY_MENU_BUTTON'."); .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. // // 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 // // The cargo package identifier (default: 'nwx.advotracker') is used as the
// // app directory name. The directory location is OS dependant // // app directory name. The directory location is OS dependant
@@ -433,7 +437,7 @@ impl State for PolicyCheckState {
} }
Action::InputTextChanged(entity) => { Action::InputTextChanged(entity) => {
println!("entry changed: {}", text_box(ctx.get_widget(entity)).text()); 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_check_button(policy_check_label_policy_number, ctx);
//self.set_visibility(entity, ctx); //self.set_visibility(entity, ctx);
} }
@@ -441,8 +445,8 @@ impl State for PolicyCheckState {
self.open_menu(text_block, ctx); self.open_menu(text_block, ctx);
} }
Action::ParseEntry(text_box) => { Action::ParseEntry(text_box) => {
println!("set_popup_box: {:#?}", text_box); //println!("set_progress_box: {:#?}", text_box);
self.set_popup_box(ctx); //self.set_progress_box(ctx);
self.parse_entry(text_box, ctx); self.parse_entry(text_box, ctx);
//ctx.get_widget(text_box).get::<String16>("text").as_string(); //ctx.get_widget(text_box).get::<String16>("text").as_string();
//self.parse_entry(text_box, &mut policy_numbers, //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.get_widget(policy_check_policy_number).set("enabled", false);
ctx.push_event_by_window(FocusEvent::RemoveFocus(policy_check_policy_number)); ctx.push_event_by_window(FocusEvent::RemoveFocus(policy_check_policy_number));
} }
Action::RemovePopupBox(text_box) => { Action::RemovePopupBox(_entity) => {
self.remove_popup_box(ctx); self.remove_popup_box(ctx);
} }
Action::ResetProgress => { Action::ResetProgress => {
@@ -465,7 +469,7 @@ impl State for PolicyCheckState {
progress_bar(ctx.child(ID_POLICY_CHECK_PROGRESS_BAR)).set_val(0.); 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::<String16>("water_mark")); //println!("set_popup_box: {:#?}", ctx.widget().get::<String16>("water_mark"));
//println!("set_popup_box: {:#?}", entity); //println!("set_popup_box: {:#?}", entity);
self.set_popup_box(ctx); 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() Popup::new()
.id(ID_POLICY_CHECK_PROGRESS_POPUP) .id(ID_POLICY_CHECK_PROGRESS_BOX)
.target(target) .target(target)
.open(true) .open(true)
.width(280.0) .width(280.0)

View File

@@ -20,8 +20,35 @@ widget!(
} }
); );
impl Template for PolicyCheckMenu { impl Template for PolicyCheckMenu {
fn template(self, _id: Entity, ctx: &mut BuildContext) -> Self { 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::<PolicyCheckState>(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( self.name("PolicyCheckMenu").child(
Stack::new() Stack::new()
.orientation("vertical") .orientation("vertical")

View File

@@ -11,10 +11,8 @@ use crate::{
data::structures::PolicyCheck, data::structures::PolicyCheck,
data::keys::*, data::keys::*,
callbacks::policycheck_state::*, callbacks::policycheck_state::*,
//policycheck_state::{Action, PolicyCheckState},
}; };
// Macro that initializes the widget structures/variables for our view (essential!) // Macro that initializes the widget structures/variables for our view (essential!)
widget!( widget!(
/// Dialog to enter a policy identifier/number. /// Dialog to enter a policy identifier/number.
@@ -29,20 +27,62 @@ widget!(
// The template implementation for our View // The template implementation for our View
impl Template for PolicyCheckView { impl Template for PolicyCheckView {
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self { fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let policy_check_menu_text_block = TextBlock::new() let policy_check_bottom_bar = Container::new()
.id(ID_POLICY_CHECK_TEXT_BLOCK_MENU) .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") .foreground("#3b434a")
.text("Help Menu") .text("Help Menu")
.v_align("center") .v_align("center")
.h_align("center") .h_align("center")
.build(ctx); .build(ctx);
let policy_check_menu_button = Button::new() let policy_check_button_menu = Button::new()
.id(ID_POLICY_CHECK_MENU_BUTTON) .id(ID_POLICY_CHECK_BUTTON_MENU)
.icon(material_icons_font::MD_MENU) .icon(material_icons_font::MD_MENU)
.class("menu_button") .class("menu_button")
.attach(Grid::column(2)) .attach(Grid::column(2))
.margin((0., 0., 0., 0.)) //.margin((0., 0., 0., 0.))
//.text("Menu Button") //.text("Menu Button")
//.min_size(8.0, 8.0) //.min_size(8.0, 8.0)
.min_size(16.0, 16.0) .min_size(16.0, 16.0)
@@ -52,12 +92,12 @@ impl Template for PolicyCheckView {
.on_mouse_down(|_, _| true) .on_mouse_down(|_, _| true)
.on_click(move |ctx, _| { .on_click(move |ctx, _| {
ctx.get_mut::<PolicyCheckState>(id) ctx.get_mut::<PolicyCheckState>(id)
.action(Action::OpenMenu(policy_check_menu_text_block)); .action(Action::OpenMenu(policy_check_label_menu));
true true
}) })
.build(ctx); .build(ctx);
let policy_check_result_button = Button::new() let policy_check_button_result = Button::new()
.id(ID_POLICY_CHECK_BUTTON_RESULT) .id(ID_POLICY_CHECK_BUTTON_RESULT)
.class("single_content") .class("single_content")
.h_align("start") .h_align("start")
@@ -66,18 +106,167 @@ impl Template for PolicyCheckView {
.enabled(false) .enabled(false)
.build(ctx); .build(ctx);
let policy_data_count_block = TextBlock::new() let policy_check_header_bar = Container::new()
.id(ID_POLICY_DATA_COUNT_BLOCK) //.border_color("transparent")
//.class(CLASS_TEXT_BLOCK) .class(CLASS_HEADER_BAR)
.attach(Grid::row(3)) .attach(Grid::row(0))
.attach(Grid::column(1)) .attach(Grid::column(1))
.margin((0., 4., 0., 0.)) .attach(Grid::column_span(2))
.h_align("end") .child(
.v_align("top") Grid::new()
.enabled(true) .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); .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::<PolicyCheckState>(id)
.action(Action::ParseEntry(entity));
})
//.on_changed(move |ctx, entity| {
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::SetProgressBox(entity));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::AddProgress(0.5));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::InputTextChanged(entity));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::SetVisibility(entity));
// //ctx.get_widget(policy_check_label_policy_number).set("visible");
// // ctx.get_mut::<PolicyCheckState>(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) .id(ID_POLICY_CHECK_POLICY_NUMBER)
.h_align("start") .h_align("start")
.width(100.0) .width(100.0)
@@ -97,239 +286,18 @@ impl Template for PolicyCheckView {
//}) //})
.build(ctx); .build(ctx);
// let policy_check_menu_container = Container::new() let policy_data_count_block = TextBlock::new()
// .id(ID_POLICY_CHECK_MENU_CONTAINER) .id(ID_POLICY_DATA_COUNT_BLOCK)
// .class(CLASS_MENU) //.class(CLASS_TEXT_BLOCK)
// .attach(Grid::row(3)) .attach(Grid::row(3))
// .attach(Grid::column(8)) .attach(Grid::column(1))
// .margin((0.0, 0.0, 4.0, 0.0)) .margin((0., 4., 0., 0.))
// .enabled(false) .h_align("end")
// .min_size(120.0, 180.0) .v_align("top")
// .v_align("center") .enabled(true)
// .on_click(move |ctx, _| {
// ctx.get_mut::<PolicyCheckState>(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)
.build(ctx); .build(ctx);
let policy_check_form_row_0 = Stack::new() // Starter page: check policy numbers
// 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::<PolicyCheckState>(id)
.action(Action::ParseEntry(entity));
})
//.on_changed(move |ctx, entity| {
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::SetPopupBox(entity));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::AddProgress(0.5));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::InputTextChanged(entity));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::SetVisibility(entity));
// //ctx.get_widget(policy_check_label_policy_number).set("visible");
// // ctx.get_mut::<PolicyCheckState>(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::<PolicyCheckState>(id)
// .action(Action::ParseEntry(entity));
// })
// .on_changed(move |ctx, entity| {
// ctx.get_mut::<PolicyCheckState>(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
self.name("PolicyCheckView") self.name("PolicyCheckView")
// initialize struct (derived default macro) // initialize struct (derived default macro)
.policy_check(PolicyCheck::default()) .policy_check(PolicyCheck::default())
@@ -339,10 +307,9 @@ impl Template for PolicyCheckView {
//.background("#fafafa") //.background("#fafafa")
.columns( .columns(
Columns::new() Columns::new()
.add(150.) .add(50.)
.add("*")
//.add(50.)
.add("*") .add("*")
.add(50.)
.build(), .build(),
) )
.rows( .rows(
@@ -355,244 +322,20 @@ impl Template for PolicyCheckView {
.build(), .build(),
) )
// Header Bar // row 0: Policy Check Header
.child( .child(policy_check_header_bar)
//.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),
)
.child( // row 1: Seperator
Container::new()
.class("separator")
.attach(Grid::row(1))
.attach(Grid::column_span(3))
.build(ctx),
)
// Policy Check Form // row 2: Policy Check Form
.child( .child(policy_check_form)
Container::new()
//.class(CLASS_POLICY_CHECK_FORM) // row 3: Sum HashMap elements
.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::<PolicyCheckState>(id)
.action(Action::ParseEntry(entity));
})
.on_changed(move |ctx, entity| {
// Element value has changed
ctx.get_mut::<PolicyCheckState>(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::<PolicyCheckState>(id)
// // .action(Action::ParseEntry(entity));
// //})
// // .on_changed(move |ctx, entity| {
// // ctx.get_mut::<PolicyCheckState>(id)
// // .action(Action::InputTextChanged(entity));
// // })
// // .on_update(move |ctx, entity| {
// // ctx.get_mut::<PolicyCheckState>(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::<PolicyCheckState>(id)
// .action(Action::ParseEntry(entity));
// })
// .on_changed(move |ctx, entity| {
// ctx.get_mut::<PolicyCheckState>(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),
)
.child(policy_data_count_block) .child(policy_data_count_block)
// Bottom bar // row 4: Policy Check BOttom
.child( .child(policy_check_bottom_bar)
Container::new() .build(ctx),
.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),
)
} }
} }