advotracker-framework: restructure source tree

* remove subdirectory backend
  new handling as new submodule advotrackerd
* remove subdirectory frontend
  new hanling as advotracker
* examples: example binaries
* locales: i18n definitions
* src/callbacks: rust state handling for widgets
* src/services: provide service methods (e.g import/export)
* src/widgets: handle frontend definitions
* src/data: provide test-data

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2020-06-29 13:45:19 +02:00
parent 8f7be15ef3
commit 5f4d01d919
45 changed files with 2515295 additions and 935 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@
Target: debug
[ralf@jacara-x1 frontend]$ time ../target/debug/examples/csv-import --importFile /home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt -v
Jun 27 02:43:48.886 TRACE csv-import: "Umgebungsvariablen prüfen" state="gestartet"
Jun 27 02:43:48.886 TRACE csv-import: environment="system" lang="de_DE.UTF-8"
Jun 27 02:43:48.887 DEBUG csv-import: missing value for field test_lang
Jun 27 02:43:48.887 TRACE csv-import: environment="envy" lang="de_DE.UTF-8"
Jun 27 02:43:48.887 TRACE csv-import: "Umgebungsvariablen prüfen" state="beendet"
Jun 27 02:43:48.887 TRACE csv-import: process="Programmargumente prüfen" state="gestartet"
RUST_LOG=None
Jun 27 02:43:48.887 TRACE csv_import::parse_args: verbose 1
config_file: "csv_import.ron"
import_file: "/home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt"
verbosity level: 1
Jun 27 02:43:48.887 TRACE csv-import: process="Programmargumente prüfen" state="beendet"
Jun 27 02:43:48.887 TRACE csv-import: process="Programmlogik starten" state="gestartet"
Jun 27 02:43:48.887 TRACE csv-import: extension=Some("txt") file=File { fd: 3, path: "/home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt", read: true, write: false }
Jun 27 02:43:48.888 TRACE csv-import: header=StringRecord(["DION", "VERS", "POLLFNR"])
Jun 27 02:43:57.513 TRACE csv-import: record_count=2498330
Imported 2498330 records
Jun 27 02:43:57.513 TRACE csv-import: process="Programmlogik beendet" state="beendet"
real 0m8,700s
user 0m8,675s
sys 0m0,017s
Target: release
[ralf@jacara-x1 frontend]$ time ../target/release/examples/csv-import --importFile /home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt -v
Jun 27 02:48:13.753 TRACE csv-import: "Umgebungsvariablen prüfen" state="gestartet"
Jun 27 02:48:13.753 TRACE csv-import: environment="system" lang="de_DE.UTF-8"
Jun 27 02:48:13.753 DEBUG csv-import: missing value for field test_lang
Jun 27 02:48:13.753 TRACE csv-import: environment="envy" lang="de_DE.UTF-8"
Jun 27 02:48:13.753 TRACE csv-import: "Umgebungsvariablen prüfen" state="beendet"
Jun 27 02:48:13.753 TRACE csv-import: process="Programmargumente prüfen" state="gestartet"
RUST_LOG=None
Jun 27 02:48:13.753 TRACE csv_import::parse_args: verbose 1
config_file: "csv_import.ron"
import_file: "/home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt"
verbosity level: 1
Jun 27 02:48:13.753 TRACE csv-import: process="Programmargumente prüfen" state="beendet"
Jun 27 02:48:13.753 TRACE csv-import: process="Programmlogik starten" state="gestartet"
Jun 27 02:48:13.754 TRACE csv-import: extension=Some("txt") file=File { fd: 3, path: "/home/ralf/projekte/Hiedemann/Allianz_Vorgaben_Policycheck/ERG.txt", read: true, write: false }
Jun 27 02:48:13.754 TRACE csv-import: header=StringRecord(["DION", "VERS", "POLLFNR"])
Jun 27 02:48:14.098 TRACE csv-import: record_count=2498330
Imported 2498330 records
Jun 27 02:48:14.098 TRACE csv-import: process="Programmlogik beendet" state="beendet"
real 0m0,355s
user 0m0,338s
sys 0m0,017s

View File

@@ -1,217 +0,0 @@
.myheader {
font-size: 36;
}
/* defaults: dark.css
* {
background: #ffffff;
font-size: 16;
font-family: "Roboto Medium";
icon-size: 16;
icon-family: "Material Icons";
}
window {
background: #ffffff;
}
.h1 {
font-size: 36;
}
*/
/*
.top_bar {
padding-left: 4;
padding-right: 4;
min-height: 150;
background: #ffffff;
border-color: #5b0f22;
}
.bottom_bar {
height: 40;
background: #ffffff;
}
*/
/*
font-family: "Roboto Medium";
background: transparent;
border-width: 2;
border-color: #5b0f22;
border-radius: 2;
padding: 6;
}
.text_form {
background: #ffffff;
}
.text_block {
background: #ffffff;
border-color: #5b0f22;
border-width: 0;
color: #5b0f22;
}
text_box:empty {
color: #9E9E9E
}
text_box:focus {
border-color: #f8de4c;
}
/*
text_box.inplace {
color: #dfebf5;
background: transparent;
border-color: transparent;
border-width: 1;
border-radius: 2;
padding: 6;
font-size: 48;
}
text_box.inplace:focus {
background: #ffffff;
border-color: #5b0f22;
}
text_box.inplace:empty {
color: #9E9E9E
}
.icon_only {
icon-color: transparent;
background: transparent;
}
.icon_only:active {
icon-color: #5b0f22;
background: #5b0f22;
}
.icon_only:disabled {
icon-color: transparent;
background: transparent;
}
items-widget {
padding: 0;
border-color: transparent;
font-size: 48;
}
list-view-item {
padding-left: 0;
padding-right: 0;
height: 62;
}
list-view-item:active {
background: #ffffff;
}
policy_check.text_box {
font-size: 48;
}
policy_list.text_box {
font-size: 48;
}
policy_list.text_box {
font-size: 48;
}
.transparent {
icon-color: transparent;
background: transparent;
}
.transparent:active {
icon-color: transparent;
background: transparent;
}
.item_button {
background: transparent;
border-radius: 0;
font-size: 48;
}
.separator {
background: #f8de4c;
color: #f8de4c;
border-width: 2;
border-color: #5b0f22;
}
*/
/*
const LINK_WATER_COLOR
color: #dfebf5;
const LYNCH_COLOR
color: #647b91;
const BOMBAY_COLOR
color: #adb3B8;
const SLATE_GRAY_COLOR
color: #6c7a90;
const BRIGHT_GRAY_COLOR
color: #3b434a;
const MATERIAL_RED_COLOR
color: #5b0f22;
.header {
background: #ffffff;
}
.content {
background: #fafafa;
}
text-box {
color: #5b0f22;
}
text-block {
color: #5b0f22;
}
top-bar {
color: #5b0f22;
background: #fafafa;
}
*/
/*
light-text {
color: #dfebf5;
}
*/
/* // Hiedemann blue */
/* color: #a5b3bf; */
/* // Hiedemann red */
/* color: #5b0f22; */
/* // Hiedemann darkgrey */
/* color: #879488; */
/* // Hiedemann grey */
/* color: ##b6c3b7; */
/* // Qt Green */
/* color: #41cd52; */
/* // lightgrey */
/* color: #f0f0f0; */
/* Accent=#5b0f22 */
/* Foreground=#000000 */
/* Background=#f0f0f0 */

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,19 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*; use orbtk::prelude::*;
use crate::{data::PolicyList, keys::*}; use crate::{
//data::structures::PolicyList,
data::keys::*
};
/// Provides generic methods to handle states of datatypes (e.g. used in `PolicyList`). /// Provides generic methods to handle states of datatypes (e.g. used in `PolicyList`).
pub trait BaseState { pub trait GlobalState {
/// Navigates to the given entity. /// Navigates to the given entity.
fn navigate(&self, to: Entity, ctx: &mut Context) { fn navigate(&self, to: Entity, ctx: &mut Context) {
if let Some(old_focused_element) = ctx.window().get::<Global>("global").focused_widget { if let Some(old_focused_element) = ctx.window().get::<Global>("global").focused_widget {
@@ -31,13 +41,13 @@ pub trait BaseState {
} }
// Save the data. // Save the data.
fn save(&self, registry: &mut Registry, ctx: &mut Context) { // fn save(&self, registry: &mut Registry, ctx: &mut Context) {
registry // registry
.get::<Settings>("settings") // .get::<Settings>("settings")
.save( // .save(
PROP_POLICY_LIST, // PROP_POLICY_LIST,
ctx.widget().get::<PolicyList>(PROP_POLICY_LIST), // ctx.widget().get::<PolicyList>(PROP_POLICY_LIST),
) // )
.unwrap(); // .unwrap();
} // }
} }

View File

@@ -0,0 +1,21 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
/// global helper functions
pub mod global_state;
/// policycheck helper functions
pub mod policycheck_state;
// /// policylist helper functions
// pub mod policylist_state;
// /// policydata helper functions
// pub mod policydata_state;
/// policy verification methods
pub mod policy_check;

View File

@@ -0,0 +1,69 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use chrono::{Local, DateTime};
use locales::t;
use serde::Deserialize;
use std::env;
use std::{error::Error, process};
use std::collections::HashMap;
use tracing::{debug, trace, Level};
use crate::data::structures::{PolicyCode, PolicyDataList, PolicyData, PolicyList};
/// validate a given policy number
/// result will return true or false
fn is_valid(policy_number: &usize, policy_list: &PolicyDataList,
policy_numbers: &mut HashMap<usize, PolicyCode>, lang: &String)
-> Result<bool, Box<dyn std::error::Error>> {
let mut res = t!("policy.validation.started", lang);
let mut state = t!("state.started", lang);
let dt_start: DateTime<Local> = Local::now();
trace!(target: "csv-test",
process = ?res,
state = ?state,
policy_number = ?policy_number,
policy_list = ?policy_list.name,
elements = ?policy_list.policy_data.len(),
date_start = ?dt_start.to_string());
let mut result = false;
match policy_numbers.get(&policy_number) {
Some(&policy_code) => {
let res = t!("policy.validation.success", lang);
println!("policy_number: {} ({:?})",
policy_number, policy_code);
result = true;
trace!(target: "csv-test",
policy_number = ?policy_number,
validation = ?res,
policy_code = ?policy_code);
},
_ => {
let res = t!("policy.validation.failed", lang);
println!("Noop! Number isn't valid!");
trace!(target: "csv-test",
policy_number = ?policy_number,
validation = ?res);
},
}
let dt_end: DateTime<Local> = Local::now();
let duration = dt_end.signed_duration_since(dt_start);
res = t!("policy.validation.finished", lang);
state = t!("state.finished", lang);
trace!(target: "csv-test",
process = ?res,
state = ?state,
date_stop = ?dt_end.to_string(),
duration = ?duration);
Ok(result)
}

View File

@@ -0,0 +1,176 @@
use orbtk::prelude::*;
use crate::{
callbacks::global_state::GlobalState,
//data::structures::{PolicyData, PolicyDataList},
data::keys::*,
};
/// Actions that can execute on the task view.
#[derive(Debug, Clone, Copy)]
pub enum Action {
ClearEntry(Entity),
InputTextChanged(Entity),
OpenMenu(Entity),
ParseEntry(Entity),
RemoveFocus(Entity),
SetEntry(Entity),
TextChanged(Entity, usize),
}
/// Handles the requests of the `PolicyCheckView`.
#[derive(Default, AsAny)]
pub struct PolicyCheckState {
action:Option<Action>,
last_focused: Option<Entity>,
pub text_box: Entity,
menu_button: Entity,
policy_number_valid: bool,
}
impl GlobalState for PolicyCheckState {}
impl PolicyCheckState {
/// Sets a new action.
pub fn action(&mut self, action: Action) {
self.action = action.into();
}
/// Clear text in text box.
pub fn clear_entry(&mut self, text_box: Entity, ctx: &mut Context) {
let mut text_box = TextBox::get(ctx.get_widget(text_box));
let text = text_box.text_mut();
println!("reset {}", text);
}
/// Open menu.
pub fn open_menu(&mut self, text_block: Entity, ctx: &mut Context) {
let mut text_block = TextBlock::get(ctx.get_widget(text_block));
let text = text_block.text_mut();
println!("Menu text: {}", text);
}
fn parse_entry(&self, policy_check_policy_number: Entity, ctx: &mut Context) {
let mut policy_check_policy_number = TextBox::get(ctx.get_widget(policy_check_policy_number));
let policy_number = policy_check_policy_number.text_mut();
println!("parsing policy Number: {}", policy_number);
// Parse policy code: "AS-123456789"
// DION VERS POLLFNR
// 1 AS 1515735810
let policy_number_length = policy_number.len();
if policy_number_length == 10 {
println!("Verify {} ...", policy_number);
// check against hash-table
//ctx.get_widget(text_box).set("policy_number_valid", true);
//ctx.get_widget(policy_check_policy_number).set("policy_check_result", true);
//TextBox::get(ctx.child("policy_check_result")).set_foreground(colors::LINK_WATER_COLOR);
}
if policy_number_length < 10 {
println!("Policy number is to short!");
//TextBox::get(ctx.child("text_box")).set_foreground("#ffffff");
//TextBox::get(ctx.child("text_box")).set_background("#5b0f22");
}
if policy_number_length > 10 {
println!("Policy number is to big!");
//TextBox::get(ctx.child("text_box")).set_foreground("#ffffff");
//TextBox::get(ctx.child("text_box")).set_background("#5b0f22");
}
// if let policy_number = text_box.text() {
// match policy_number {
// _ => {
// println!("policynumber: {} is valid!", policy_number);
// }
// }
// }
}
/// If TextBox 'policy_check_policy_number' is empty, disable button "check"
/// otherwise enabled it.
fn set_check_button(&self, text_box: Entity, ctx: &mut Context) {
// if ctx.get_widget(text_box).get::<String>("policy_check_policy_number").is_empty() {
// ctx.get_widget(self.policy_check_result).set("enabled", false);
// } else {
// ctx.get_widget(self.policy_check_result).set("enabled", true);
// }
ctx.get_widget(self.text_box).update_theme_by_state(true);
}
/// Change status of given text box to edit mode.
fn set_entry(&self, text_box: Entity, ctx: &mut Context) {
if *ctx.get_widget(text_box).get::<bool>("focused") {
ctx.get_widget(text_box).set("enabled", false);
ctx.push_event_by_window(FocusEvent::RemoveFocus(text_box));
return;
}
if let Some(old_focused_element) = ctx.window().get::<Global>("global").focused_widget {
ctx.push_event_by_window(FocusEvent::RemoveFocus(old_focused_element));
}
ctx.get_widget(text_box).set("enabled", true);
// select all
ctx.get_widget(text_box)
.get_mut::<TextSelection>("text_selection")
.start_index = 0;
ctx.get_widget(text_box)
.get_mut::<TextSelection>("text_selection")
.length = ctx.get_widget(text_box).get::<String>("policy_number").len();
ctx.push_event_by_window(FocusEvent::RequestFocus(text_box));
}
}
impl State for PolicyCheckState {
fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
//self.menu_button = ctx
// .entity_of_child(ID_POLICY_CHECK_MENU_BUTTON)
// .expect("PolicyCheckState.init: Can't find child 'Menu button'.");
self.text_box = ctx
.entity_of_child(ID_POLICY_CHECK_POLICY_NUMBER)
.expect("PolicyCheckState.init: Can't find child 'Text Box'.");
}
fn update(&mut self, _registry: &mut Registry, ctx: &mut Context) {
// clear focus on focus moved
if self.last_focused != ctx.window().get::<Global>("global").focused_widget {
if let Some(last_focused) = self.last_focused {
ctx.get_widget(last_focused).set("focused", false);
ctx.get_widget(last_focused)
.set("visibility", Visibility::Collapsed);
}
}
if let Some(action) = self.action {
match action {
Action::ClearEntry(text_box) => {
self.clear_entry(text_box, ctx);
}
Action::InputTextChanged(text_box) => {
self.set_check_button(text_box, ctx);
}
Action::OpenMenu(text_block) => {
self.open_menu(text_block, ctx);
}
Action::ParseEntry(text_box) => {
self.parse_entry(text_box, ctx);
}
Action::RemoveFocus(text_box) => {
ctx.get_widget(text_box).set("enabled", false);
ctx.push_event_by_window(FocusEvent::RemoveFocus(text_box));
}
Action::SetEntry(text_box) => {
self.last_focused = Some(text_box);
self.set_entry(text_box, ctx);
}
Action::TextChanged(entity, _index) => {
self.set_entry(entity, ctx);
}
}
}
self.action = None;
}
}

View File

@@ -1,9 +1,9 @@
use orbtk::prelude::*; use orbtk::prelude::*;
use crate::{ use crate::{
base_state::BaseState, callbacks::global_state::GlobalState,
data::{PolicyCode, PolicyData, PolicyList, Status}, data::{PolicyCode, PolicyData, PolicyList, Status},
keys::*, data::keys::*,
}; };
use chrono::{Utc, NaiveDateTime}; use chrono::{Utc, NaiveDateTime};
@@ -38,7 +38,7 @@ pub struct PolicyDataState {
} }
/// implement of the BaseState trait for our PolicyDataState type /// implement of the BaseState trait for our PolicyDataState type
impl BaseState for PolicyDataState {} impl GlobalState for PolicyDataState {}
/// implement the PolicyDateState type itself /// implement the PolicyDateState type itself
impl PolicyDataState { impl PolicyDataState {

View File

@@ -18,9 +18,9 @@ pub static CLASS_SEPERATOR: &str = "seperator";
pub static ID_POLICY_CHECK_FORM: &str = "policy_check_form"; pub static ID_POLICY_CHECK_FORM: &str = "policy_check_form";
pub static ID_POLICY_CHECK_HEADER: &str = "policy_check_header"; pub static ID_POLICY_CHECK_HEADER: &str = "policy_check_header";
//pub static ID_POLICY_CHECK_ITEMS_WIDGET: &str = "policy_check_items_widget"; //pub static ID_POLICY_CHECK_ITEMS_WIDGET: &str = "policy_check_items_widget";
pub static ID_POLICY_CHECK_MENU_BUTTON: &str = "policy_check_menu_button";
pub static ID_POLICY_CHECK_LABEL_POLICY_NUMBER: &str = "policy_check_label_policy_number"; pub static ID_POLICY_CHECK_LABEL_POLICY_NUMBER: &str = "policy_check_label_policy_number";
pub static ID_POLICY_CHECK_LABEL_RESULT: &str = "policy_check_label_result"; pub static ID_POLICY_CHECK_LABEL_RESULT: &str = "policy_check_label_result";
pub static ID_POLICY_CHECK_MENU_BUTTON: &str = "policy_check_menu_button";
pub static ID_POLICY_CHECK_MENU_TEXT_BLOCK: &str = "policy_check_menu_text_block"; pub static ID_POLICY_CHECK_MENU_TEXT_BLOCK: &str = "policy_check_menu_text_block";
pub static ID_POLICY_CHECK_RESULT: &str = "policy_check_result"; pub static ID_POLICY_CHECK_RESULT: &str = "policy_check_result";
pub static ID_POLICY_CHECK_POLICY_NUMBER: &str = "policy_check_policy_number"; pub static ID_POLICY_CHECK_POLICY_NUMBER: &str = "policy_check_policy_number";

View File

@@ -0,0 +1,12 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
/// structures with implementations
pub mod structures;
/// provides orbtk widgets constants
pub mod keys;

View File

@@ -150,6 +150,9 @@ pub struct PolicyCheck {
pub policy_number_valid: bool pub policy_number_valid: bool
} }
impl PolicyCheck {
}
// #[derive(Default, Clone, Debug, Serialize, Deserialize)] // #[derive(Default, Clone, Debug, Serialize, Deserialize)]
// pub struct PolicyCheckList { // pub struct PolicyCheckList {
// pub title: String, // pub title: String,

View File

@@ -5,7 +5,8 @@
* SPDX-License-Identifier: 0BSD, MIT * SPDX-License-Identifier: 0BSD, MIT
*/ */
#![warn(missing_docs, rust_2018_idioms, rust_2018_compatibility)] //#![warn(missing_docs, rust_2018_idioms, rust_2018_compatibility)]
#![warn(rust_2018_idioms, rust_2018_compatibility)]
//! advotracker //! advotracker
//! Supports lawyers to capture relevant data encountered during an //! Supports lawyers to capture relevant data encountered during an
@@ -25,9 +26,15 @@
// /// The client specific services // /// The client specific services
// pub mod clients; // pub mod clients;
/// provides data structures and their traits /// provides helper functions to manage orbtk callbacks
pub mod callbacks;
/// provides data definitions
pub mod data; pub mod data;
/// provides orbtk widget structures
pub mod widgets;
/// provides services /// provides services
pub mod services; pub mod services;

View File

@@ -0,0 +1,128 @@
{
"err.lang.not_found": {
"de_DE.UTF-8": "Konnte Sprachkode nicht auslesen",
"de": "Konnte Sprachkode nicht auslesen",
"en": "Couldn't read LANG"
},
"err.user.not_found": {
"fr": "Utilisateur introuvable: $email, $id",
"de-DE.UTF-8": "Anwender nicht gefunden: $email, $id",
"de": "Anwender nicht gefunden: $email, $id",
"en": "User not found: $email, $id"
},
"main.started": {
"de_DE.UTF-8": "Programmlogik starten",
"de": "Programmlogik starten",
"en": "Program logic started"
},
"main.finished": {
"de_DE.UTF-8": "Programmlogik beendet",
"de": "Programmlogik beendet",
"en": "Program logic finished"
},
"parse.arguments": {
"de_DE.UTF-8": "Programmargumente prüfen",
"de": "Programmargumente prüfen",
"en": "Parsing arguments"
},
"parse.environment": {
"de_DE.UTF-8": "Umgebungsvariablen prüfen",
"de": "Umgebungsvariablen prüfen",
"en": "Parsing environment"
},
"parse.results": {
"de_DE.UTF-8": "Ergebnisse der Konfigurations-Parameterprüfung",
"de": "Ergebnisse der Konfigurationsparameterprüfung",
"en": "Config parsing results"
},
"config.name": {
"de_DE.UTF-8": "Konfigurationswert für",
"de": "Konfigurationswert für",
"en": "Config Value for"
},
"config.name.lang": {
"de_DE.UTF-8": "Sprach-Code",
"de": "Sprach-Code",
"en": "Language code"
},
"config.name.verbositylevel": {
"de_DE.UTF-8": "Ausgabe-Ebene",
"de": "Ausgabe-Ebene",
"en": "verbosity level"
},
"config.name.environment": {
"de_DE.UTF-8": "Umgebungsvariablen",
"de": "Umgebungsvariablen",
"en": "environment"
},
"config.name.configfile": {
"de_DE.UTF-8": "Konfigurations-Datei",
"de": "Konfigurations-Datei",
"en": "config file"
},
"config.name.dbdriver": {
"de_DE.UTF-8": "Datenbank-Treiber",
"de": "Datenbank-Treiber",
"en": "database driver"
},
"config.name.redis": {
"de_DE.UTF-8": "Redis Datenbank",
"de": "Redis Datenbank",
"en": "Redis database"
},
"csv.export.started": {
"de_DE.UTF-8": "Export in eine CSV Datei starten",
"de": "Export in eine CSV Datei starten",
"en": "Export to csv file started"
},
"csv.export.finished": {
"de_DE.UTF-8": "Export in eine CSV Datei beendet",
"de": "Export in eine CSV Datei beendet",
"en": "Export to csv file finished"
},
"csv.import.started": {
"de_DE.UTF-8": "Import von einer CSV Datei starten",
"de": "Import von einer CSV Datei starten",
"en": "Import from a csv file started"
},
"csv.import.finished": {
"de_DE.UTF-8": "Import von einer CSV Datei beendet",
"de": "Import von einer CSV Datei beendet",
"en": "Import from a csv file finished"
},
"redis.connection.error": {
"de_DE.UTF-8": "Es konnte keine Redis Verbindung aufgebaut werden",
"de": "Es konnte keine Redis Verbindung aufgebaut werden",
"en": "Could not establish a redis connection"
},
"policy.validation.failed": {
"de_DE.UTF-8": "Die Versicherungsscheinnummber ist ungültig",
"de": "Die Versicherungsscheinnummber ist ungültig",
"en": "The given policy number is invalid"
},
"policy.validation.success": {
"de_DE.UTF-8": "Die Versicherungsscheinnummber ist gültig",
"de": "Die Versicherungsscheinnummber ist gültig",
"en": "The given policy number is valid"
},
"policy.validation.started": {
"de_DE.UTF-8": "Die Prüfung der Versicherungsscheinnummber wurde gestartet",
"de": "Die Prüfung der Versicherungsscheinnummber wurde gestartet",
"en": "Validation of the policy number started"
},
"policy.validation.finished": {
"de_DE.UTF-8": "Die Prüfung der Versicherungsscheinnummber wurde beendet",
"de": "Die Prüfung der Versicherungsscheinnummber wurde beendet",
"en": "Validation of the policy number finished"
},
"state.started": {
"de_DE.UTF-8": "gestartet",
"de": "gestartet",
"en": "started"
},
"state.finished": {
"de_DE.UTF-8": "beendet",
"de": "beended",
"en": "finished"
}
}

View File

@@ -0,0 +1,32 @@
{
"policy.validation.failed": {
"de_DE.UTF-8": "Die Versicherungsscheinnummber ist ungültig",
"de": "Die Versicherungsscheinnummber ist ungültig",
"en": "The given policy number is invalid"
},
"policy.validation.success": {
"de_DE.UTF-8": "Die Versicherungsscheinnummber ist gültig",
"de": "Die Versicherungsscheinnummber ist gültig",
"en": "The given policy number is valid"
},
"policy.validation.started": {
"de_DE.UTF-8": "Die Prüfung der Versicherungsscheinnummber wurde gestartet",
"de": "Die Prüfung der Versicherungsscheinnummber wurde gestartet",
"en": "Validation of the policy number started"
},
"policy.validation.finished": {
"de_DE.UTF-8": "Die Prüfung der Versicherungsscheinnummber wurde beendet",
"de": "Die Prüfung der Versicherungsscheinnummber wurde beendet",
"en": "Validation of the policy number finished"
},
"state.started": {
"de_DE.UTF-8": "gestartet",
"de": "gestartet",
"en": "started"
},
"state.finished": {
"de_DE.UTF-8": "beendet",
"de": "beended",
"en": "finished"
}
}

View File

@@ -1,29 +1,60 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use chrono::{Local, DateTime};
use locales::t;
//use serde::{Deserialize, Serialize};
use serde::Deserialize;
use std::env;
use std::{error::Error, process};
use std::collections::HashMap;
use tracing::{debug, trace, span, Level};
use orbtk::prelude::*; use orbtk::prelude::*;
use orbtk::theme::DEFAULT_THEME_CSS; use orbtk::theme::DEFAULT_THEME_CSS;
//use orbtk::theme::LIGHT_THEME_EXTENSION_CSS; //use orbtk::theme::LIGHT_THEME_EXTENSION_CSS;
// The Main view
use advotracker::widgets::main_view;
//use advotracker::services; //use advotracker::services;
use advotracker::data; //use advotracker::sercices::policy_check::{import};
// helper modules // helper modules
pub mod base_state; //pub mod base_state;
pub mod keys; //pub mod keys;
// the frontend // the frontend
pub mod main_view; //pub mod main_view;
// validation check of a policy data element given by its poliy code // validation check of a policy data element given by its poliy code
pub mod policycheck_view; //pub mod policycheck_view;
pub mod policycheck_state; //ub mod policycheck_state;
pub mod policycheck_menu; //pub mod policycheck_menu;
// manage list of policy data structures // // manage list of policy data structures
pub mod policylist_view; // pub mod policylist_view;
pub mod policylist_state; // pub mod policylist_state;
// manage policy data elements // // manage policy data elements
pub mod policydata_view; // pub mod policydata_view;
pub mod policydata_state; // pub mod policydata_state;
// include modules
mod parse_args;
/// respect environment variables set in .env files
/// located in the current call directory
/// this is primarily used in testing scenarios (eg. debugging)
#[derive(Debug, Deserialize)]
struct Environment {
test_lang: String,
log: String,
}
//#[cfg(feature = "light-theme")] //#[cfg(feature = "light-theme")]
static STYLESHEET: &'static str = include_str!("../resources/stylesheets/advotracker.css"); static STYLESHEET: &'static str = include_str!("../resources/stylesheets/advotracker.css");
@@ -35,7 +66,116 @@ fn get_theme() -> ThemeValue {
.build() .build()
} }
fn main() { fn main() -> Result<(), Box<dyn std::error::Error>> {
use dotenv::dotenv;
use parse_args::parse_args;
//use std::process;
//use std::sync::Arc;
use tracing_subscriber::fmt;
use viperus::Viperus;
use advotracker::services::policy_check::*;
use advotracker::services::imports::allianzdirectcall::*;
//use advotracker::data;
use advotracker::data::structures::{PolicyCode, PolicyDataList, PolicyData, PolicyList};
//static DEFAULT_FILTER: &str = concat!(module_path!(), "=", "trace");
// initialize the tracing subsystem
// a drop in replacement for classical logging
// reference: https://tokio.rs/blog/2019-08-tracing/
let span = tracing::span!(Level::TRACE, "csv-test");
let _enter = span.enter();
let subscriber = fmt::Subscriber::builder()
.with_env_filter("trace")
//.with_max_level(tracing::Level::DEBUG)
.finish();
tracing::subscriber::with_default(subscriber, || {
// get system environment
let mut lang = env::var("LANG").unwrap_or("en".to_string());
let mut res = t!("parse.environment", lang);
let mut state = t!("state.started", lang);
trace!(target: "csv-test", message = ?res, state = ?state);
//debug!(message = ?res, state = ?state);
trace!(target: "csv-test", environment = "system", lang = ?lang);
// testing environment: read from .env file
dotenv().ok();
match envy::from_env::<Environment>() {
Ok(environment) => {
if environment.test_lang != lang { lang = environment.test_lang; }
},
Err(e) => { debug!(target: "csv-test", "{}", e); }
}
// how to handle unumplemented lang resources??
res = t!("parse.environment", lang);
trace!(target: "csv-test", environment = "envy", lang = ?lang);
state = t!("state.finished", lang);
trace!(target: "csv-test", message = ?res, state = ?state);
// initialize viperus structure
let mut v = Viperus::new();
// parse commandline arguments
res = t!("parse.arguments", lang);
state = t!("state.started", lang);
trace!(target: "csv-test", process = ?res, state = ?state);
let _ = parse_args(&mut v);
state = t!("state.finished", lang);
trace!(target: "csv-test", process = ?res, state = ?state);
//trace!(target: "Viperus", "Config results: {:?}", v);
// main tasks
res = t!("main.started", lang);
state = t!("state.started", lang);
trace!(target: "csv-test", process = ?res, state = ?state);
// importing policy code elements from csv-file
let policy_list = PolicyList::new("Allianz Versicherungsnummen-List");
println!("Policy List {:?} ", policy_list.name);
let mut policy_data = PolicyDataList::new("Allianz-Import 20200628");
println!("Policy Data List {:?} ", policy_data.name);
let mut policy_numbers : HashMap<usize, PolicyCode> = HashMap::new();
let mut csv_import_path = v.get::<String>("import_file").unwrap();
match import(&mut csv_import_path, &mut policy_data,
&mut policy_numbers, &lang) {
Ok(count) => {
println!("Imported {:?} records", count);
}
Err(err) => {
println!("error running Csv-Test: {}", err);
process::exit(1);
}
}
// // test if policy_number is_valid
// let test_policy_number = v.get::<i32>("test_policy_number").unwrap() as usize;
// trace!(target: "csv-test", test_policy_number = ?test_policy_number);
// match policy_numbers.get(&test_policy_number) {
// Some(&policy_code) => {
// let res = t!("policy.validation.success", lang);
// println!("{:?}", res);
// println!("policy_number: {} ({:?})",
// test_policy_number, policy_code);
// }
// _ => {
// let res = t!("policy.validation.failed", lang);
// println!("{:?}", res);
// //println!("Nuup! Number isn't valid!");
// },
//}
state = t!("state.finished", lang);
res = t!("main.finished", lang);
trace!(target: "csv-test", process = ?res, state = ?state);
});
Application::from_name("rzerres.advotracker") Application::from_name("rzerres.advotracker")
.window(move |ctx| { .window(move |ctx| {
Window::new() Window::new()
@@ -51,6 +191,8 @@ fn main() {
.build(ctx) .build(ctx)
}) })
.run(); .run();
Ok(())
} }
#[cfg(test)] #[cfg(test)]

View File

@@ -1,59 +0,0 @@
use orbtk::prelude::*;
use crate::{
data::{PolicyCheck, PolicyList, PolicyDataList},
policycheck_view::PolicyCheckView,
policylist_view::PolicyListView,
policydata_view::PolicyDataView
};
// use crate::{
// data::{PolicyList, PolicyData},
// //policycheck_view::*,
// //PolicyCheckView,
// //policylist_view::*,
// //PolicyListView,
// //policydata_view::*,
// //PolicyDataList
// };
widget!(MainView {
policy_list_count: usize,
policy_list: PolicyList,
policy_data_list: PolicyDataList,
policycheck_view: u32,
policylist_view: u32,
policydata_view: u32
});
impl Template for MainView {
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
let policycheck_view = PolicyCheckView::new()
.policylist_view(id)
.build(ctx);
let policylist_view = PolicyListView::new()
.back_entity(policycheck_view.0)
.policydata_view(id)
.policylist_view(id)
.policy_list_count(id)
.build(ctx);
let policydata_view = PolicyDataView::new()
.back_entity(policylist_view.0)
.policylist_view(id)
.visibility("collapsed")
.build(ctx);
self.name("MainView")
.policy_list_count(0)
.policycheck_view(PolicyCheck::default())
//.policycheck_view(0)
.policydata_view(policydata_view.0)
//.policylist_view(PolicyList::default())
.policylist_view(policylist_view.0)
.child(policydata_view)
.child(policylist_view)
.child(policycheck_view)
}
}

View File

@@ -0,0 +1,220 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
// parse CLI commandline arguments with clap
use clap::{crate_authors, crate_description, crate_name, crate_version, App, Arg};
//use log::{debug, info, trace, warn};
use std::env;
use tracing::trace;
use viperus::Viperus;
/// Parse the commandline arguments and preset default values
/// Precedence: defaults -> config-file -> environment -> commandline
pub fn parse_args(v: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> {
if cfg!(feature = "fmt-clap") {
trace!(target: "Viperus", "Viperus feature 'fmt-clap' enabled.");
println!("Using feature fmt-clap");
}
// preset default key/value pairs (lowest priority)
v.add_default("config_file", String::from("csv_import.ron"));
v.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt"));
v.add_default("export_file", String::from(""));
v.add_default("test_policy_number", 123456789);
v.add_default("to_email_address_file", String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>"));
v.add_default("from_email_address_file", String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"));
//v.add_default("username", String::from("nctalkbot"));
//v.add_default("password", String::from("botpassword"));
v.add_default("verbose", 0);
// CLI arguments are defined inline
let matches = App::new("advotracker")
.name(crate_name!())
.version(crate_version!())
.author(crate_authors!())
.about(crate_description!())
.after_help("
Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten
Direct-Call via IVR-System (Interactive Voice Response)
SMR Deckungssummen-Prüfung: 089 92529 60211
SMR Unerledigt: 089 92529 60222")
.template(
"\
{bin} v{version}
{about}
{all-args}
(C) 2020 {author}
{after-help}",
)
.arg(
Arg::with_name("configFile")
.short("c")
.long("configFile")
.value_name("FILE")
.help("Select a config file")
.default_value("csv_import.ron")
.takes_value(true),
)
.arg(
Arg::with_name("importFile")
.short("i")
.long("importFile")
.help("Select source file for the csv-import")
.default_value("POLLFNR_WOECHENTLICH.txt")
//.default_value("POLLFNR_MINI.txt")
.takes_value(true),
)
.arg(
Arg::with_name("exportFile")
.short("e")
.long("exportFile")
.help("Select target file for the csv-export")
.default_value("RA-Hiedemann_DirectCall.txt")
.takes_value(true),
)
.arg(
Arg::with_name("fromEmailAddress")
.short("f")
.long("fromEmailAddress")
.help("Select the sender email-address (From:)")
.default_value("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>")
.takes_value(true),
)
.arg(
Arg::with_name("toEmailAddress")
.short("t")
.long("toEmailAddress")
.help("Select the target email-address (To:)")
.default_value("Allianz RA-Hotline <smr-rahotline@allianz.de>")
.takes_value(true),
)
.arg(
Arg::with_name("testPolicyNumber")
.short("p")
.long("testPolicyNumber")
.help("Test validity of given policy number")
//.default_value("")
.takes_value(true),
)
// .arg(
// Arg::with_name("username")
// .short("u")
// .long("username")
// .help("Sets username")
// .takes_value(true),
// )
// .arg(
// Arg::with_name("password")
// .short("P")
// .long("password")
// .help("Sets password")
// .takes_value(true),
// )
.arg(
Arg::with_name("verbose")
.short("v")
.long("verbose")
.help("Sets verbosity level")
.multiple(true),
)
.get_matches();
if matches.occurrences_of("verbose") > 0 {
// clap is using i64, viperus i32
let n = matches.occurrences_of("verbose") as i32;
v.add("verbose", n);
}
// preset the prefix for relevant environment variables ("ADVOTRACKER_")
let mut env_prefix: String = crate_name!().to_uppercase();
env_prefix.push_str("_");
v.set_env_prefix(&env_prefix);
// respect dotenv environment (e.g for testing)
// -> overwrites the preset default values
println!(
"RUST_LOG={}",
dotenv::var("RUST_LOG").unwrap_or_else(|_| String::from("None"))
);
// enable caching and automatic update of environment values
if cfg!(feature = "fmt-cache") {
v.cache(true);
}
if cfg!(feature = "fmt-env") {
v.automatic_env(true);
}
// load user selected call arguments
// -> overwrites values given via environment variables
v.load_clap(matches)?;
// bond the clap names to camel_case rust variable names
v.bond_clap("configFile", "config_file");
v.bond_clap("importFile", "import_file");
v.bond_clap("exportFile", "export_file");
v.bond_clap("toEmailAddress", "to_email_address");
v.bond_clap("fromEmailAddress", "from_email_address");
v.bond_clap("testPolicyNumber", "test_policy_number");
//v.bond_clap("username", "username");
//v.bond_clap("password", "password");
v.bond_clap("verbose", "verbose");
trace!("verbose {:?}", v.get::<i32>("verbose").unwrap());
if v.get::<i32>("verbose").unwrap() > 0 {
println!(
"config_file: {:?}",
v.get::<String>("config_file").unwrap_or_default()
);
println!(
"import_file: {:?}",
v.get::<String>("import_file").unwrap_or_default()
);
println!(
"export_file: {:?}",
v.get::<String>("export_file").unwrap_or_default()
);
println!(
"to_email_address: {:?}",
v.get::<String>("to_email_address").unwrap_or_default()
);
println!(
"from_email_address: {:?}",
v.get::<String>("from_email_address").unwrap_or_default()
);
println!(
"test_policy_number: {:?}",
v.get::<i32>("test_policy_number").unwrap_or_default()
);
// println!(
// "username: {:?}",
// v.get::<String>("username").unwrap_or_default()
// );
// println!(
// "password: {:?}",
// v.get::<String>("password").unwrap_or_default()
// ); // only for testing now
println!(
"verbosity level: {:?}",
v.get::<i32>("verbose").unwrap_or_default()
);
}
if v.get::<i32>("verbose").unwrap() > 1 {
println!("\nEnvironment:");
for (key, value) in env::vars() {
println!("{}={}", key, value);
}
}
Ok(())
}

View File

@@ -1,72 +0,0 @@
use orbtk::prelude::*;
//use orbtk::theme::vector_graphics::material_icons_font;
//use crate::keys::*;
//pub struct PolicyMenu {
// pub isvalid: bool
//}
widget!(
PolicyCheckMenu {
isvalid: String
}
);
impl Template for PolicyCheckMenu {
fn template(self, _id: Entity, ctx: &mut BuildContext) -> Self {
self.name("PolicyCheckMenu").child(
Stack::new()
.orientation("vertical")
.spacing(8.0)
.h_align("center")
.child(
Stack::new()
.orientation("horizontal")
.spacing(4.0)
.h_align("start")
.child(
Button::new()
.element("button-user")
.icon("")
.min_width(32.0)
.max_width(32.0)
.build(ctx),
)
.child(
TextBlock::new()
.element("menu-user")
.min_width(80.0)
.max_width(180.0)
.text("angemeldeter Benutzer")
.build(ctx),
)
.build(ctx),
)
.child(
Stack::new()
.orientation("horizontal")
.spacing(4.0)
.h_align("start")
.child(
Button::new()
.element("button-user")
.icon("")
.min_width(32.0)
.max_width(32.0)
.build(ctx),
)
.child(
TextBlock::new()
.element("menu-quit")
.min_width(80.0)
.max_width(180.0)
.text("Quit")
.build(ctx),
)
.build(ctx),
)
.build(ctx)
)
}
}

View File

@@ -1,178 +0,0 @@
use orbtk::prelude::*;
use crate::{
base_state::BaseState,
data::{PolicyData, PolicyDataList},
keys::*,
};
/// Actions that can execute on the task view.
#[derive(Debug, Clone, Copy)]
pub enum Action {
ClearEntry(Entity),
InputTextChanged(Entity),
OpenMenu(Entity),
ParseEntry(Entity),
RemoveFocus(Entity),
SetEntry(Entity),
TextChanged(Entity, usize),
}
/// Handles the requests of the `PolicyCheckView`.
#[derive(Default, AsAny)]
pub struct PolicyCheckState {
action:Option<Action>,
last_focused: Option<Entity>,
pub text_box: Entity,
menu_button: Entity,
policy_number_valid: bool,
}
impl BaseState for PolicyCheckState {}
impl PolicyCheckState {
/// Sets a new action.
pub fn action(&mut self, action: Action) {
self.action = action.into();
}
/// Clear text in text box.
pub fn clear_entry(&mut self, text_box: Entity, ctx: &mut Context) {
let mut text_box = TextBox::get(ctx.get_widget(text_box));
let text = text_box.text_mut();
println!("reset {}", text);
}
/// Open menu.
pub fn open_menu(&mut self, text_block: Entity, ctx: &mut Context) {
let mut text_block = TextBlock::get(ctx.get_widget(text_block));
let text = text_block.text_mut();
println!("Menu text: {}", text);
}
fn parse_entry(&self, text_box: Entity, ctx: &mut Context) {
// Old style
//let length = ctx.get_widget(text_box).get::<String>("policy_number").len();
// New style
let mut text_box = TextBox::get(ctx.get_widget(text_box));
let policy_number = text_box.text_mut();
println!("parsing policy Number: {}", policy_number);
// Parse policy code: "AS-123456789"
// DION VERS POLLFNR
// 1 AS 1515735810
let policy_number_length = policy_number.len();
if policy_number_length == 10 {
println!("Verify {} ...", policy_number);
// check against hash-table
//ctx.get_widget(text_box).set("policy_number_valid", true);
//TextBox::get(ctx.child("text_box")).set_foreground(colors::LINK_WATER_COLOR);
}
if policy_number_length < 10 {
println!("Policy number is to short!");
//TextBox::get(ctx.child("text_box")).set_foreground("#ffffff");
//TextBox::get(ctx.child("text_box")).set_background("#5b0f22");
}
if policy_number_length > 10 {
println!("Policy number is to big!");
//TextBox::get(ctx.child("text_box")).set_foreground("#ffffff");
//TextBox::get(ctx.child("text_box")).set_background("#5b0f22");
}
// if let policy_number = text_box.text() {
// match policy_number {
// _ => {
// println!("policynumber: {} is valid!", policy_number);
// }
// }
// }
}
/// If TextBox 'policy_number' is empty, disable button "check"
/// otherwise enabled it.
fn set_check_button(&self, text_box: Entity, ctx: &mut Context) {
if ctx.get_widget(text_box).get::<String>("policy_number_check").is_empty() {
ctx.get_widget(self.text_box).set("enabled", false);
} else {
ctx.get_widget(self.text_box).set("enabled", true);
}
ctx.get_widget(self.text_box).update_theme_by_state(true);
}
/// Change status of given text box to edit mode.
fn set_entry(&self, text_box: Entity, ctx: &mut Context) {
if *ctx.get_widget(text_box).get::<bool>("focused") {
ctx.get_widget(text_box).set("enabled", false);
ctx.push_event_by_window(FocusEvent::RemoveFocus(text_box));
return;
}
if let Some(old_focused_element) = ctx.window().get::<Global>("global").focused_widget {
ctx.push_event_by_window(FocusEvent::RemoveFocus(old_focused_element));
}
ctx.get_widget(text_box).set("enabled", true);
// select all
ctx.get_widget(text_box)
.get_mut::<TextSelection>("text_selection")
.start_index = 0;
ctx.get_widget(text_box)
.get_mut::<TextSelection>("text_selection")
.length = ctx.get_widget(text_box).get::<String>("policy_number").len();
ctx.push_event_by_window(FocusEvent::RequestFocus(text_box));
}
}
impl State for PolicyCheckState {
fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
self.menu_button = ctx
.entity_of_child(ID_POLICY_CHECK_MENU_BUTTON)
.expect("PolicyCheckState.init: Can't find child 'Menu button'.");
self.text_box = ctx
.entity_of_child(ID_POLICY_CHECK_POLICY_NUMBER)
.expect("PolicyCheckState.init: Can't find child 'Text Box'.");
}
fn update(&mut self, _registry: &mut Registry, ctx: &mut Context) {
// clear focus on focus moved
if self.last_focused != ctx.window().get::<Global>("global").focused_widget {
if let Some(last_focused) = self.last_focused {
ctx.get_widget(last_focused).set("focused", false);
ctx.get_widget(last_focused)
.set("visibility", Visibility::Collapsed);
}
}
if let Some(action) = self.action {
match action {
Action::ClearEntry(text_box) => {
self.clear_entry(text_box, ctx);
}
Action::InputTextChanged(text_box) => {
self.set_check_button(text_box, ctx);
}
Action::OpenMenu(text_block) => {
self.open_menu(text_block, ctx);
}
Action::ParseEntry(text_box) => {
self.parse_entry(text_box, ctx);
}
Action::RemoveFocus(text_box) => {
ctx.get_widget(text_box).set("enabled", false);
ctx.push_event_by_window(FocusEvent::RemoveFocus(text_box));
}
Action::SetEntry(text_box) => {
self.last_focused = Some(text_box);
self.set_entry(text_box, ctx);
}
Action::TextChanged(entity, _index) => {
self.set_entry(entity, ctx);
}
}
}
self.action = None;
}
}

View File

@@ -1,347 +0,0 @@
use orbtk::prelude::*;
//use orbtk::theme::vector_graphics::material_icons_font_ttf;
use crate::{
data::PolicyCheck,
keys::*,
policycheck_state::*,
//policycheck_state::{Action, PolicyCheckState},
};
widget!(
/// Dialog to enter a policy identifier/number.
/// This identifier is checked agains a map of valid policy codes.
PolicyCheckView<PolicyCheckState> {
policy_check: PolicyCheck,
//policy_check_list: PolicyCheckList,
policy_check_title: String,
policy_check_number: String,
policy_check_number_valid: bool,
policy_check_text_box: String,
policy_data_count: u32,
policylist_view: u32,
title: String
}
);
impl Template for PolicyCheckView {
fn template(self, id: Entity, ctx: &mut BuildContext)-> Self {
// collect the DCES elements of our 'policy check' view
// let items_widget = ItemsWidget::new()
// .id(ID_POLICY_CHECK_ITEMS_WIDGET)
// .v_align("start")
// .items_builder(move |ctx, index| {
// let mut title = "".to_string();
// if let Some(policy_check) = ctx
// .get_widget(id)
// .get::<PolicyCheckList>(PROP_POLICY_CHECK_LIST)
// .get(index)
// {
// title = policy_check.title.clone();
// }
// })
// .count((PROP_POLICY_DATA_COUNT, id))
// .build(ctx);
let policycheck_menu_text_block = TextBlock::new()
.foreground("#3b434a")
.text("Help Menu")
.v_align("center")
.h_align("center")
.build(ctx);
let policy_check_menu_button = Button::new()
.margin((0.0, 0.0, 12.0, 12.0))
.icon(material_icons_font_ttf::MD_MENU)
//.class(CLASS_ICON_ONLY)
//.attach(Grid::row(0))
.attach(Grid::column(2))
.margin((8.0, 0.0, 2.0, 0.0))
.text("Menu Button")
//.min_size(8.0, 8.0)
//.min_size(16.0, 16.0)
//.h_align("end")
//.v_align("center")
//.enabled(true)
//.on_mouse_down(|_, _| true)
//.child(policycheck_menu_container)
//.on_click(move |ctx, _| {
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::OpenMenu(policy_check_menu_text_block));
// true
//})
.build(ctx);
// let policy_check_text_box = TextBox::new()
// .id(ID_POLICY_CHECK_TEXT_BOX)
// .attach(Grid::row(4))
// .attach(Grid::row(0))
// .attach(Grid::column(0))
// .v_align("top")
// .margin((4.0, 0.0, 0.0, 0.0))
// .lost_focus_on_activation(false)
// //.text(("policy_number", id))
// // .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);
// 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();
// Starter page: check for valid policy number
self.name("PolicyCheckView")
.policy_check(PolicyCheck::default())
.child(
Grid::new()
.id(ID_POLICY_CHECK_WIDGET)
//.v_align("start")
//.h_align("center")
.background("#fafafa")
.columns(
Columns::new()
.add(64.0)
.add("*")
.add(50.0)
.build(),
)
.rows(
Rows::new()
.add("auto")
.add(1.0)
.add("*")
.add(1.0)
.add(52.0)
/* .add("auto") */
.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),
)
.child(
Container::new()
.class("separator")
.attach(Grid::row(1))
.attach(Grid::column_span(3))
.build(ctx),
)
// Policy Check Form
.child(
Container::new()
//.class(CLASS_POLICY_CHECK_FORM)
.attach(Grid::row(2))
.attach(Grid::column(0))
.attach(Grid::column_span(3))
.child(
Grid::new()
.id(ID_POLICY_CHECK_FORM)
.columns(
Columns::new()
.add("5.0")
.add("220.0")
.add("5.0")
.add("100.0")
.build(),
)
.rows(
Rows::new()
.add("45.0")
.add("45.0")
.build(),
)
.child(
Stack::new()
.attach(Grid::column(1))
.attach(Grid::row(0))
.margin((16.0, 16.0, 16.0, 16.0))
.orientation("vertical")
//.v_align("center")
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER)
//.class(CLASS_TEXT_BLOCK)
.h_align("end")
//.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(1))
.attach(Grid::row(1))
.h_align("end")
//.min_width(250.0)
//.min_size(120.0, 180.0)
.text("Ergebnis:")
.text("Result:")
.build(ctx),
)
.build(ctx)
)
.child(
Stack::new()
.attach(Grid::column(2))
.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")
.margin((4.0, 0.0, 0.0, 0.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));
// })
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_RESULT)
.h_align("start")
.attach(Grid::column(3))
.attach(Grid::row(1))
//.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("separator")
.attach(Grid::row(3))
.attach(Grid::column_span(3))
.build(ctx),
)
// 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(4))
.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),
)
}
}

View File

@@ -0,0 +1,41 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use chrono::{Local, DateTime};
use locales::t;
use std::error::Error;
use std::collections::HashMap;
use tracing::trace;
//use crate::db::redis;
use crate::data::structures::{PolicyCode, PolicyDataList, PolicyData};
/// export as csv format
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
/// https://blog.burntsushi.net/csv/
pub fn export(p: &mut String, lang: &String) -> Result<(), Box<dyn Error>> {
use std::fs::File;
use std::path::Path;
//use std::ffi::OsStr;
let mut res = t!("csv.export.started", lang);
let mut state = t!("state.started", lang);
trace!(target: "advotrackerd", process = ?res, state = ?state);
// Note: slash syntax also works on Windows!
let path = Path::new(p);
// open the file
let file = File::open(path)?;
trace!(target: "csv.export", extension = ?path.extension(), file = ?file);
state = t!("state.finished", lang);
res = t!("csv.export.finished", lang);
trace!(target: "csv-export", process = ?res, state = ?state);
Ok(())
}

View File

@@ -5,5 +5,5 @@
* SPDX-License-Identifier: (0BSD or MIT) * SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// Alliand DirecCall module /// Exporting Allianz DirecCall data
pub mod allianzdirectcall; pub mod allianzdirectcall;

View File

@@ -12,33 +12,7 @@ use std::collections::HashMap;
use tracing::trace; use tracing::trace;
//use crate::db::redis; //use crate::db::redis;
use crate::data::{PolicyCode, PolicyDataList, PolicyData}; use crate::data::structures::{PolicyCode, PolicyDataList, PolicyData};
/// export as csv format
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
/// https://blog.burntsushi.net/csv/
pub fn export(p: &mut String, lang: &String) -> Result<(), Box<dyn Error>> {
use std::fs::File;
use std::path::Path;
//use std::ffi::OsStr;
let mut res = t!("csv.export.started", lang);
let mut state = t!("state.started", lang);
trace!(target: "advotrackerd", process = ?res, state = ?state);
// Note: slash syntax also works on Windows!
let path = Path::new(p);
// open the file
let file = File::open(path)?;
trace!(target: "csv.export", extension = ?path.extension(), file = ?file);
state = t!("state.finished", lang);
res = t!("csv.export.finished", lang);
trace!(target: "csv-export", process = ?res, state = ?state);
Ok(())
}
/// import AllianzDirectCall data from a csv delimeted file /// import AllianzDirectCall data from a csv delimeted file
/// save records to redis backend /// save records to redis backend

View File

@@ -0,0 +1,9 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
/// Importing Allianz DirecCall data
pub mod allianzdirectcall;

View File

@@ -6,4 +6,7 @@
*/ */
/// advotracker import modules /// advotracker import modules
pub mod import; pub mod imports;
/// advotracker import modules
pub mod exports;

View File

@@ -0,0 +1,67 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::data::structures::PolicyCheck;
use crate::widgets::policycheck_view;
//use policycheck_view::PolicyCheckView::*;
//data::{PolicyCheck, PolicyList, PolicyDataList},
// policylist_view::PolicyListView,
// policydata_view::PolicyDataView
//use advotracker::data::PolicyCheckView;
// use advotracker::{
// //data::{PolicyList, PolicyData},
// policycheck_view::*,
// //policylist_view::*,
// //PolicyListView,
// //policydata_view::*,
// //PolicyDataList
//};
widget!(MainView {
// policy_list_count: usize,
// policy_list: PolicyList,
// policy_data_list: PolicyDataList,
// policylist_view: u32,
// policydata_view: u32,
policycheck_view: u32
});
impl Template for MainView {
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
let policycheck_view = PolicyCheckView::new()
//.policylist_view(id)
.build(ctx);
// let policylist_view = PolicyListView::new()
// .back_entity(policycheck_view.0)
// .policydata_view(id)
// .policylist_view(id)
// .policy_list_count(id)
// .build(ctx);
// let policydata_view = PolicyDataView::new()
// .back_entity(policylist_view.0)
// .policylist_view(id)
// .visibility("collapsed")
// .build(ctx);
self.name("MainView")
//.policy_list_count(0)
// //.policycheck_view(PolicyCheck::default())
// //.policycheck_view(0)
// .policydata_view(policydata_view.0)
// //.policylist_view(PolicyList::default())
// .policylist_view(policylist_view.0)
// .child(policydata_view)
// .child(policylist_view)
.child(policycheck_view)
}
}

View File

@@ -0,0 +1,15 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
/// The starting point (Main View)
pub mod main_view;
/// The policy check wigdet
pub mod policycheck_view;
// /// The policy lists widget
// pub mod policylist_view;

View File

@@ -0,0 +1,72 @@
use orbtk::prelude::*;
//use orbtk::theme::vector_graphics::material_icons_font;
use crate::data::keys::*;
//pub struct PolicyMenu {
// pub isvalid: bool
//}
widget!(
PolicyCheckMenu {
isvalid: String
}
);
impl Template for PolicyCheckMenu {
fn template(self, _id: Entity, ctx: &mut BuildContext) -> Self {
self.name("PolicyCheckMenu").child(
Stack::new()
.orientation("vertical")
.spacing(8.0)
.h_align("center")
.child(
Stack::new()
.orientation("horizontal")
.spacing(4.0)
.h_align("start")
.child(
Button::new()
.element("button-user")
.icon("")
.min_width(32.0)
.max_width(32.0)
.build(ctx),
)
.child(
TextBlock::new()
.element("menu-user")
.min_width(80.0)
.max_width(180.0)
.text("angemeldeter Benutzer")
.build(ctx),
)
.build(ctx),
)
.child(
Stack::new()
.orientation("horizontal")
.spacing(4.0)
.h_align("start")
.child(
Button::new()
.element("button-user")
.icon("")
.min_width(32.0)
.max_width(32.0)
.build(ctx),
)
.child(
TextBlock::new()
.element("menu-quit")
.min_width(80.0)
.max_width(180.0)
.text("Quit")
.build(ctx),
)
.build(ctx),
)
.build(ctx)
)
}
}

View File

@@ -0,0 +1,356 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::{
data::structures::PolicyCheck,
data::keys::*,
callbacks::policycheck_state::*,
//policycheck_state::{Action, PolicyCheckState},
};
widget!(
/// Dialog to enter a policy identifier/number.
/// This identifier is checked agains a map of valid policy codes.
PolicyCheckView<PolicyCheckState> {
policy_check: PolicyCheck,
//policy_check_list: PolicyCheckList,
policy_check_title: String,
policy_check_number: String,
policy_check_number_valid: bool,
policy_check_text_box: String,
policy_data_count: u32,
//policylist_view: u32,
title: String
}
);
impl Template for PolicyCheckView {
fn template(self, id: Entity, ctx: &mut BuildContext)-> Self {
// collect the DCES elements of our 'policy check' view
// let items_widget = ItemsWidget::new()
// .id(ID_POLICY_CHECK_ITEMS_WIDGET)
// .v_align("start")
// .items_builder(move |ctx, index| {
// let mut title = "".to_string();
// if let Some(policy_check) = ctx
// .get_widget(id)
// .get::<PolicyCheckList>(PROP_POLICY_CHECK_LIST)
// .get(index)
// {
// title = policy_check.title.clone();
// }
// })
// .count((PROP_POLICY_DATA_COUNT, id))
// .build(ctx);
let policy_check_menu_text_block = TextBlock::new()
.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)
.margin((0.0, 0.0, 12.0, 12.0))
.icon(material_icons_font_ttf::MD_MENU)
.class(CLASS_ICON_ONLY)
//.attach(Grid::row(0))
.attach(Grid::column(2))
.margin((8.0, 0.0, 2.0, 0.0))
//.text("Menu Button")
//.min_size(8.0, 8.0)
.min_size(16.0, 16.0)
.h_align("end")
//.v_align("center")
//.enabled(true)
.on_mouse_down(|_, _| true)
//.child(policycheck_menu_container)
.on_click(move |ctx, _| {
ctx.get_mut::<PolicyCheckState>(id)
.action(Action::OpenMenu(policy_check_menu_text_block));
true
})
.build(ctx);
// let policy_check_text_box = TextBox::new()
// .id(ID_POLICY_CHECK_TEXT_BOX)
// .attach(Grid::row(4))
// .attach(Grid::row(0))
// .attach(Grid::column(0))
// .v_align("top")
// .margin((4.0, 0.0, 0.0, 0.0))
// .lost_focus_on_activation(false)
// //.text(("policy_number", id))
// // .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);
// 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();
// Starter page: check for valid policy number
self.name("PolicyCheckView")
//.policy_check(PolicyCheck::default())
.child(
Grid::new()
.id(ID_POLICY_CHECK_WIDGET)
//.v_align("start")
//.h_align("center")
.background("#fafafa")
.columns(
Columns::new()
.add(64.0)
.add("*")
.add(50.0)
.build(),
)
.rows(
Rows::new()
.add("auto")
.add(1.0)
.add("*")
.add(1.0)
.add(52.0)
/* .add("auto") */
.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),
)
.child(
Container::new()
.class("separator")
.attach(Grid::row(1))
.attach(Grid::column_span(3))
.build(ctx),
)
// Policy Check Form
.child(
Container::new()
//.class(CLASS_POLICY_CHECK_FORM)
.attach(Grid::row(2))
.attach(Grid::column(0))
.attach(Grid::column_span(3))
.child(
Grid::new()
.id(ID_POLICY_CHECK_FORM)
.columns(
Columns::new()
.add("5.0")
.add("220.0")
.add("5.0")
.add("100.0")
.build(),
)
.rows(
Rows::new()
.add("45.0")
.add("45.0")
.build(),
)
.child(
Stack::new()
.attach(Grid::column(1))
.attach(Grid::row(0))
.margin((16.0, 16.0, 16.0, 16.0))
.orientation("vertical")
//.v_align("center")
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER)
//.class(CLASS_TEXT_BLOCK)
.h_align("end")
.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(1))
.attach(Grid::row(1))
.h_align("end")
.min_width(250.0)
//.min_size(120.0, 180.0)
.text("Ergebnis:")
.text("Result:")
.build(ctx),
)
.build(ctx)
)
.child(
Stack::new()
.attach(Grid::column(2))
.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(250.0)
.min_width(200.0)
.margin((4.0, 0.0, 0.0, 0.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));
})
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_RESULT)
.h_align("start")
.attach(Grid::column(3))
.attach(Grid::row(1))
//.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("separator")
.attach(Grid::row(3))
.attach(Grid::column_span(3))
.build(ctx),
)
// 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(4))
.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),
)
}
}

Submodule backend deleted from 2dbea55fba