7 Commits

Author SHA1 Message Date
9fc4c6c01d widget:global_state: remove usage of navigate
* this needs to be adopted to use event handler code

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-06 15:20:30 +01:00
9ef2e3816e examples: initial version of messages_test
* destinct sender and receiver  widgets
* update PopupBox in receiver view, if send button on sender view
  is pressed
* sending of inserted message text of sender view is initiated, if
  you hit 'Ctrl+S' inside the text box. Text block in receiver view
  is updated with sending Text

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-06 00:37:32 +01:00
3162233c85 widget:ticketdata: prepare mail_cc or mail_to change handling
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-05 20:58:06 +01:00
30131ecdb1 ticketdata: code cleanup 2021-03-04 20:24:21 +01:00
6d9d82bb8e advotracker: updated localization strings and constants
* update due to customer request
* constants
* translation strings
* disable WIP menu widget
* labels used in Email submission

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-04 17:13:28 +01:00
5e390a8cfa main_view: disable wip menu widget
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-04 08:09:51 +01:00
8630ee1c12 Cargo.toml: bump version to 0.1.5
* include dependency to crate lettre
* include depenency to crate maud
* this version initially supports ticketdata dialo
* data can be send via Email

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-04 07:07:01 +01:00
172 changed files with 1558 additions and 4883 deletions

9
.gitmodules vendored
View File

@@ -1,9 +1,6 @@
[submodule "advotrackerdb"] [submodule "advotracker-db"]
path = advotrackerdb path = advotracker-db
url = https://gitea.networkx.de:50443/rzerres/advotrackerdb url = https://gitea.networkx.de:50443/rzerres/advotracker-db
[submodule "advotrackerd"] [submodule "advotrackerd"]
path = advotrackerd path = advotrackerd
url = https://gitea.networkx.de:50443/rzerres/advotrackerd url = https://gitea.networkx.de:50443/rzerres/advotrackerd
[submodule "advotracker_db"]
path = advotracker_db
url = https://gitea.networkx.de:50443/rzerres/advotracker_db

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "advotracker" name = "advotracker-framework"
version = "0.1.0" version = "0.1.0"
authors = ["Ralf Zerres <ralf.zerres@networkx.de>"] authors = ["Ralf Zerres <ralf.zerres@networkx.de>"]
description = "Supports lawyers to capture relevant data encountered during an online legal advice\n" description = "Supports lawyers to capture relevant data encountered during an online legal advice\n"
@@ -8,39 +8,10 @@ homepage = "https://gitea.networkx.de:50443/rzerres/advotracker"
documentation = "https://docs.rs/advotracker" documentation = "https://docs.rs/advotracker"
readme = "README.md" readme = "README.md"
license = "0BSD OR MIT" license = "0BSD OR MIT"
keywords = [
"advotracker",
"lawyer",
]
edition = "2018" edition = "2018"
publish = false publish = false
#default-run = "advotracker_client"
[dependencies]
advotracker_db = { version = "0.1.0-alpha1", path = "advotracker_db" }
advotrackerd = { version = "0.1.0-alpha1", path = "advotrackerd", default-features = false }
advotracker_client = { version = "0.1.8", path = "advotracker_client", default-features = false }
[features]
default = ["sqlite"]
# enable optional db backends
sqlite = []
#sqlite = ["advotracker_db_sqlite"]
#postgresql = ["advotracker_db_pstgresql"]
[profile.dev]
#opt-level = 0
opt-level = 1
incremental = true
debug = true
lto = false
codegen-units = 5
panic = 'unwind'
overflow-checks = true
[profile.release] [profile.release]
incremental = true
panic = "abort" panic = "abort"
lto = true lto = true
codegen-units=1 codegen-units=1
@@ -50,6 +21,15 @@ opt-level="s"
# optimize to smallest size # optimize to smallest size
#opt-level = "z" #opt-level = "z"
[profile.dev]
opt-level = 0
debug = true
lto = false
codegen-units = 5
panic = 'unwind'
incremental = true
overflow-checks = true
[profile.test] [profile.test]
opt-level = 0 opt-level = 0
debug = 2 debug = 2
@@ -64,6 +44,7 @@ overflow-checks = true
[workspace] [workspace]
members = [ members = [
"advotrackerd", "advotrackerd",
"advotracker_db", "advotracker-db",
"advotracker_client", "advotracker",
"advotracker_qml",
] ]

View File

@@ -6,14 +6,14 @@
## About ## About
`advotracker` supports lawyers to capture relevant data encountered during an online `AdvoTracker` supports lawyers to capture relevant data encountered during an online
legal advice. legal advice.
The application components are implemented using the programming language *Rust*. The application components are implemented using the programming language *Rust*.
The graphical user interface (GUI) uses the class-lib *OrbTk*, which is natively The graphical user interface (GUI) uses the class-lib *OrbTk*, which is natively
encoded in *Rust* as well. encoded in *Rust* as well.
`advotracker` can be deployed on every target operating system that is officialy `AdvoTracker` can be deployed on every target operating system that is officialy
supported by the `OrbTK` toolkit. Currently included are: supported by the `OrbTK` toolkit. Currently included are:
* macOS * macOS
@@ -36,24 +36,24 @@ as documentation sources.
Dialogs and messages generated inside the application will respect the system language Dialogs and messages generated inside the application will respect the system language
of the active user. This is adaptable via the environment variable of the active user. This is adaptable via the environment variable
(default: LANG = en_US.UTF8 or LANG = C). (default: LANG = en_US.UTF8 ).
Within the source code you can find translated constants in the subdirectory 'locales' Within the source code you can find translated constants in the subdirectory 'locales'
(<crate-root>/src/locales/advotracker.json). (<src-root>/advotracker/src/locales/advotracker.json).
For every supported language-string, you will find a block starting with the For every supported language-string, you will find a block starting with the
generic message code, followed by the target language translation. Translation lines generic message code, followed by the target language translation. Translation lines
are identified by its ISO Code (e.g. de_DE.UTF8, es_ES.UTF8). are identified by its ISO Code (e.g. de_DE.UTF8, es_ES.UTF8).
## Installation from source code ## Installation from source code
You can either download the `advotracker` source code as a Zip-File or using `git` You can either download the `Advotracker` source code as a Zip-File or using `git`
from projects repositoy URL. from projects repositoy URL.
The source code is subdiveded in three crates: The source code is subdiveded in three submodules:
* advotracker * advotracker
* advotrackerd * advotrackerd
* advotrackerdb * advotracker-db
Currently the given WEB-URL certificate is signed by a Microsoft CA. Currently the given WEB-URL certificate is signed by a Microsoft CA.
Since this CA can't be verified from offical CA-lists you have to proceed as follows: Since this CA can't be verified from offical CA-lists you have to proceed as follows:
@@ -149,7 +149,7 @@ This work is licensed under a [Creative Common License 4.0][License-CC_BY]
![Creative Common Logo][Logo-CC_BY] ![Creative Common Logo][Logo-CC_BY]
<EFBFBD> 2020-2021 Ralf Zerres, Networkx GmbH <EFBFBD> 2020 Ralf Zerres, Networkx GmbH
--- ---

1
advotracker-db Submodule

Submodule advotracker-db added at 51e747ef6d

68
advotracker/Cargo.toml Normal file
View File

@@ -0,0 +1,68 @@
[package]
name = "advotracker"
version = "0.1.5"
authors = ["Ralf Zerres <ralf.zerres@networkx.de>"]
description = "Frontend component that supports lawyers to capture relevant data encountered during an online legal advice."
readme = "README.md"
license = "(0BSD OR MIT)"
edition = "2018"
default-run = "advotracker"
[target.x86_64-pc-windows-gnu]
linker = "/usr/bin/x86_64-w64-mingw32-gcc"
ar = "/usr/x86_64-w64-mingw32i/bin/ar"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["winuser"] }
#diesel = { version = "1.4", features = [ "postgres", "sqlite" ] }
[dependencies]
async-stream = "~0.2"
chrono = { version = "~0.4.0", features = ["serde"] }
cfg-if = { version = "~1.0" }
clap = { version = "~2.33", features = ["suggestions", "color"] }
csv = { version = "~1.1" }
dotenv = { version = "~0.15.0" }
envy = { version = "~0.4" }
lettre = "0.10.0-beta.1"
lazy_static = { version = "~1.4.0" }
log = { version = "~0.4.8" }
locales = { version = "~0.1" }
maud = { version = "~0.22.1" }
#orbtk = { version = "~0.3.1-alpha4" }
#orbtk = { git = "https://github.com/redox-os/orbtk.git", branch = "develop" }
orbtk = { path = "../../orbtk" }
serde = { version = "~1.0", features = ["derive"] }
substring = { version = "~1" }
#tokio = { version = "~0.2", features = ["macros", "rt-threaded", "stream", "time"] }
tracing = { version = "~0.1" }
tracing-subscriber = { version = "~0.2.0", features = ["tracing-log"] }
viperus = { git = "https://github.com/maurocordioli/viperus", features = ["cache", "fmt-clap", "fmt-env", "global", "watch"] }
[dev-dependencies]
[features]
default = []
debug = ["orbtk/debug"]
light = []
[package.metadata.bundle]
name = "advotracker"
identifier = "nwx.advotracker"
short_description = "Online legal advice helper."
description = "Supports lawyers to capture relevant data encountered during an online legal advice.\n"
[profile.dev]
opt-level = 1
incremental = true
[profile.release]
incremental = true
#[[bin]]
#//name = "policycheck"
#path = "src/bin/policycheck.rs"
[[bin]]
name = "advotracker"
path = "src/main.rs"

View File

@@ -11,26 +11,24 @@ Dictionary (
// like a struct, but keys are also values instead of just beenig identifiers // like a struct, but keys are also values instead of just beenig identifiers
words: { words: {
// policycheck_view // policycheck_view
"Check result": "Prüfungsergebnis", "Validation policy number": "Prüfung Versicherungsnummer",
"Checklist elements: ": "Prüflistenelemente: ", "Policy number": "Versicherungsnummer",
"Clear": "Zurücksetzen",
"Create ticket": "Ticket erstellen",
"Importing data": "Importiere Datensätze",
"Only numbers are valid": "Nur Nummern sind zulässig",
"Error:": "Fehler:",
"Quit": "Beenden",
"Policy code": "Vers.-Schein/Schadennummer", "Policy code": "Vers.-Schein/Schadennummer",
"Policy holder": "Versicherungsnehmer", "Policy holder": "Versicherungsnehmer",
"Checklist elements: ": "Prüflistenelemente: ",
"Check result": "Prüfungsergebnis",
"Importing data": "Importiere Datensätze",
"Processing time": "Bearbeitungszeit",
"Error:": "Fehler:",
"Reason": "Grund",
"Policy number is to long": "Die Nummer ist zu lang", "Policy number is to long": "Die Nummer ist zu lang",
"Policy number is to short": "Die Nummer ist zu kurz", "Policy number is to short": "Die Nummer ist zu kurz",
"Policy number": "Versicherungsnummer",
"Processing time": "Bearbeitungszeit",
"Reason": "Grund",
"The given policy number is invalid": "Die Versicherungsnummer ist ungültig", "The given policy number is invalid": "Die Versicherungsnummer ist ungültig",
"The given policy number is valid": "Die Versicherungsnummer ist gültig", "The given policy number is valid": "Die Versicherungsnummer ist gültig",
"Only numbers are valid": "Nur Nummern sind zulässig",
"Account": "Benutzer", "Account": "Benutzer",
"Toggle theme": "Thema wechseln", "Toggle theme": "Thema wechseln",
"Validation policy number": "Prüfung Versicherungsnummer", "Quit": "Beenden",
// ticketdata_view // ticketdata_view
"Callback number": "Rückrufnummer", "Callback number": "Rückrufnummer",
@@ -45,16 +43,16 @@ Dictionary (
"Send": "Senden", "Send": "Senden",
// localization view // localization view
"English": "Englisch",
"German": "Deutsch",
"Language ID": "Sprache ID", "Language ID": "Sprache ID",
"Localization dialog": "Lokalisierungs-Dialog", "Localization dialog": "Lokalisierungs-Dialog",
"German": "Deutsch",
"English": "Englisch",
// configuration view // configuration view
"Configuration settings": "Konfigurationseinstellungen", "Configuration settings": "Konfigurationseinstellungen",
"Configuration file": "Konfigurationsdatei", "Configuration file": "Konfigurationsdatei",
"Default theme": "Standard-Thema",
"Language Id": "Sprach-Id", "Language Id": "Sprach-Id",
"Default theme": "Standard-Thema",
"Load": "Laden", "Load": "Laden",
"Save": "Speichern", "Save": "Speichern",
} }

View File

@@ -20,16 +20,7 @@ Theme (
base: "combo_box", base: "combo_box",
properties: { properties: {
"width": 200, "width": 200,
//"height": 28, "height": 28,
},
),
"combo_box_popup": (
base: "popup_box_popup",
properties: {
"height": 80,
"min_height": 80,
"width": 160,
"min_width": 80,
}, },
), ),
"mail_label": ( "mail_label": (
@@ -51,6 +42,13 @@ Theme (
"h_align": "end", "h_align": "end",
}, },
), ),
"combo_box_popup": (
//base: "popup",
properties: {
//"height": 120,
"width": 240,
},
),
"configuration_form": ( "configuration_form": (
base: "container", base: "container",
properties: { properties: {
@@ -117,6 +115,16 @@ Theme (
"v_align": "center", "v_align": "center",
} }
), ),
"popup_form": (
//base: "popup",
properties: {
"background": "#FFFFFF",
"border_brush": "#0000FF",
"border_radius": 3,
"border_width": 2,
"padding": 4,
},
),
"popup_menu": ( "popup_menu": (
//base: "popup", //base: "popup",
properties: { properties: {

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

View File

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View File

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View File

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

View File

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 126 B

View File

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 158 B

View File

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 351 B

View File

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 130 B

View File

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 193 B

View File

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 452 B

View File

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 768 B

After

Width:  |  Height:  |  Size: 768 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 455 KiB

After

Width:  |  Height:  |  Size: 455 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 237 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -1,11 +1,11 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use chrono::{DateTime, Local}; use chrono::{Local, DateTime};
use locales::t; use locales::t;
//use serde::{Deserialize, Serialize}; //use serde::{Deserialize, Serialize};
use serde::Deserialize; use serde::Deserialize;
@@ -17,7 +17,7 @@ use std::{
}; };
use tracing::{debug, trace, Level}; use tracing::{debug, trace, Level};
use advotracker::data::structures::{PolicyCode, PolicyData, PolicyDataList, PolicyList}; use advotracker::data::structures::{PolicyCode, PolicyList, PolicyDataList, PolicyData};
// include modules // include modules
mod parse_args; mod parse_args;
@@ -77,15 +77,12 @@ fn export(p: &mut String, lang: &String) -> Result<u64, Box<dyn Error>> {
/// import from csv format /// import from csv format
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html /// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
/// https://blog.burntsushi.net/csv/ /// https://blog.burntsushi.net/csv/
fn import( fn import(p: &mut String, data_list: &mut PolicyDataList,
p: &mut String, policy_numbers: &mut HashMap<u64, PolicyCode>, lang: &String)
data_list: &mut PolicyDataList, -> Result<u64, Box<dyn Error>> {
policy_numbers: &mut HashMap<u64, PolicyCode>,
lang: &String,
) -> Result<u64, Box<dyn Error>> {
use std::ffi::OsStr;
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;
use std::ffi::OsStr;
let mut res = t!("csv.import.started", lang); let mut res = t!("csv.import.started", lang);
let mut state = t!("state.started", lang); let mut state = t!("state.started", lang);
@@ -145,7 +142,7 @@ fn import(
// push record as new vector elements // push record as new vector elements
data_list.push(record); data_list.push(record);
count += 1; count +=1;
} }
let dt_end: DateTime<Local> = Local::now(); let dt_end: DateTime<Local> = Local::now();
@@ -166,12 +163,10 @@ fn import(
#[allow(dead_code)] #[allow(dead_code)]
/// validate a given policy number /// validate a given policy number
/// result will return true or false /// result will return true or false
fn is_valid( fn is_valid(policy_number: &u64, policy_list: &PolicyDataList,
policy_number: &u64, policy_numbers: &mut HashMap<u64, PolicyCode>, lang: &String)
policy_list: &PolicyDataList, -> Result<bool, Box<dyn std::error::Error>> {
policy_numbers: &mut HashMap<u64, PolicyCode>,
lang: &String,
) -> Result<bool, Box<dyn std::error::Error>> {
let mut res = t!("policy.validation.started", lang); let mut res = t!("policy.validation.started", lang);
let mut state = t!("state.started", lang); let mut state = t!("state.started", lang);
let dt_start: DateTime<Local> = Local::now(); let dt_start: DateTime<Local> = Local::now();
@@ -191,6 +186,7 @@ fn is_valid(
// println!("policy_list: {:?} (with {:?} elements)", // println!("policy_list: {:?} (with {:?} elements)",
// policy_list.name, policy_list.policy_data.len()); // policy_list.name, policy_list.policy_data.len());
// policy_list.into_iter() // policy_list.into_iter()
// .filter(|num| matches(w, w1)) // .filter(|num| matches(w, w1))
// .clone // .clone
@@ -234,13 +230,14 @@ fn is_valid(
match policy_numbers.get(&policy_number) { match policy_numbers.get(&policy_number) {
Some(&policy_code) => { Some(&policy_code) => {
let res = t!("policy.validation.success", lang); let res = t!("policy.validation.success", lang);
println!("policy_number: {} ({:?})", policy_number, policy_code); println!("policy_number: {} ({:?})",
policy_number, policy_code);
result = true; result = true;
trace!(target: "csv-test", trace!(target: "csv-test",
policy_number = ?policy_number, policy_number = ?policy_number,
validation = ?res, validation = ?res,
policy_code = ?policy_code); policy_code = ?policy_code);
} },
_ => { _ => {
let res = t!("policy.validation.failed", lang); let res = t!("policy.validation.failed", lang);
//println!("Noop! Number isn't valid!"); //println!("Noop! Number isn't valid!");
@@ -248,8 +245,9 @@ fn is_valid(
trace!(target: "csv-test", trace!(target: "csv-test",
policy_number = ?policy_number, policy_number = ?policy_number,
validation = ?res); validation = ?res);
},
} }
}
let dt_end: DateTime<Local> = Local::now(); let dt_end: DateTime<Local> = Local::now();
let duration = dt_end.signed_duration_since(dt_start); let duration = dt_end.signed_duration_since(dt_start);
@@ -298,13 +296,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenv().ok(); dotenv().ok();
match envy::from_env::<Environment>() { match envy::from_env::<Environment>() {
Ok(environment) => { Ok(environment) => {
if environment.test_lang != lang { if environment.test_lang != lang { lang = environment.test_lang; }
lang = environment.test_lang; },
} Err(e) => { debug!(target: "csv-test", "{}", e); }
}
Err(e) => {
debug!(target: "csv-test", "{}", e);
}
} }
// how to handle unumplemented lang resources?? // how to handle unumplemented lang resources??
res = t!("parse.environment", lang); res = t!("parse.environment", lang);
@@ -337,15 +331,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut policy_data = PolicyDataList::new("Allianz-Import 20200628"); let mut policy_data = PolicyDataList::new("Allianz-Import 20200628");
println!("Policy Data List {:?} ", policy_data.name); println!("Policy Data List {:?} ", policy_data.name);
let mut policy_numbers: HashMap<u64, PolicyCode> = HashMap::new(); let mut policy_numbers : HashMap<u64, PolicyCode> = HashMap::new();
let mut csv_import_path = v.get::<String>("import_file").unwrap(); let mut csv_import_path = v.get::<String>("import_file").unwrap();
match import( match import(&mut csv_import_path, &mut policy_data,
&mut csv_import_path, &mut policy_numbers, &lang) {
&mut policy_data,
&mut policy_numbers,
&lang,
) {
Ok(count) => { Ok(count) => {
println!("Imported {:?} records", count); println!("Imported {:?} records", count);
} }
@@ -357,11 +347,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// test if policy_number is_valid // test if policy_number is_valid
// type conversion (viperus String -> u64) // type conversion (viperus String -> u64)
let test_policy_number = v let test_policy_number = v.get::<String>("test_policy_number").unwrap().parse::<u64>().unwrap();
.get::<String>("test_policy_number")
.unwrap()
.parse::<u64>()
.unwrap();
trace!(target: "csv-test", test_policy_number = ?test_policy_number); trace!(target: "csv-test", test_policy_number = ?test_policy_number);
//match is_valid(&policy_number, &policy_data, &mut policy_numbers, &lang) { //match is_valid(&policy_number, &policy_data, &mut policy_numbers, &lang) {
// Ok(true) => { // Ok(true) => {
@@ -370,13 +356,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Some(&policy_code) => { Some(&policy_code) => {
let res = t!("policy.validation.success", lang); let res = t!("policy.validation.success", lang);
println!("{:?}", res); println!("{:?}", res);
println!("policy_number: {} ({:?})", test_policy_number, policy_code); println!("policy_number: {} ({:?})",
test_policy_number, policy_code);
} }
_ => { _ => {
let res = t!("policy.validation.failed", lang); let res = t!("policy.validation.failed", lang);
println!("{:?}", res); println!("{:?}", res);
//println!("Nuup! Number isn't valid!"); //println!("Nuup! Number isn't valid!");
} },
} }
// export policy code elements to csv-file // export policy code elements to csv-file
@@ -402,26 +389,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
#[test] #[test]
fn test_policy_number() { fn test_policy_number() {
// Takes a reference and returns Option<&V> // Takes a reference and returns Option<&V>
let my_policy_numbers: [u64; 2] = [1511111111, 9999999993]; let my_policy_numbers : [u64; 2] = [1511111111, 9999999993];
assert_eq!(my_policy_numbers, [1511111111, 9999999993]); assert_eq!(my_policy_numbers, [1511111111, 9999999993]);
//let mut csv_import_path = v.get::<String>("import_file").unwrap(); //let mut csv_import_path = v.get::<String>("import_file").unwrap();
let mut csv_import_path = String::from("data/POLLFNR_TEST.txt"); let mut csv_import_path = String::from("data/POLLFNR_TEST.txt");
let mut policy_data = PolicyDataList::new("PolicyDataList"); let mut policy_data = PolicyDataList::new("PolicyDataList");
let mut policy_numbers: HashMap<u64, PolicyCode> = HashMap::new(); let mut policy_numbers : HashMap<u64, PolicyCode> = HashMap::new();
let lang = "en".to_string(); let lang = "en".to_string();
println!( println!("import with Path: {:?} PolicyData: {:?} PolicyNumbers: {:?}, Lang: {:?}",
"import with Path: {:?} PolicyData: {:?} PolicyNumbers: {:?}, Lang: {:?}", csv_import_path, policy_data, policy_numbers, lang);
csv_import_path, policy_data, policy_numbers, lang let count = import(&mut csv_import_path, &mut policy_data,
); &mut policy_numbers, &lang);
let count = import(
&mut csv_import_path,
&mut policy_data,
&mut policy_numbers,
&lang,
);
assert_eq!(count.unwrap(), 15498); assert_eq!(count.unwrap(), 15498);
} }

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
// parse CLI commandline arguments with clap // parse CLI commandline arguments with clap
@@ -26,31 +26,24 @@ pub fn parse_args(v: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> {
v.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt")); v.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt"));
v.add_default("export_file", String::from("")); v.add_default("export_file", String::from(""));
v.add_default("test_policy_number", String::from("9999999992")); v.add_default("test_policy_number", String::from("9999999992"));
v.add_default( v.add_default("to_email_address_file", String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>"));
"to_email_address_file", v.add_default("from_email_address_file", String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"));
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("username", String::from("nctalkbot"));
//v.add_default("password", String::from("botpassword")); //v.add_default("password", String::from("botpassword"));
v.add_default("verbose", 0); v.add_default("verbose", 0);
// CLI arguments are defined inline // CLI arguments are defined inline
let matches = App::new("csv-test") let matches = App::new("csv-test")
.name(crate_name!()) .name(crate_name!())
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .author(crate_authors!())
.about(crate_description!()) .about(crate_description!())
.after_help( .after_help("
"
Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten
Direct-Call via IVR-System (Interactive Voice Response) Direct-Call via IVR-System (Interactive Voice Response)
SMR Deckungssummen-Prüfung: 089 92529 60211 SMR Deckungssummen-Prüfung: 089 92529 60211
SMR Unerledigt: 089 92529 60222", SMR Unerledigt: 089 92529 60222")
)
.template( .template(
"\ "\
{bin} v{version} {bin} v{version}

View File

@@ -8,7 +8,7 @@ static ID_CHECK_POLICY_NUMBER: &'static str = "ID_CHECK_POLICY_NUMBER";
static ID_PROGRESS_BAR: &'static str = "ID_PROGRESS_BAR"; static ID_PROGRESS_BAR: &'static str = "ID_PROGRESS_BAR";
enum Action { enum Action {
ParsePolicyNumber, ParsePolicyNumber
} }
#[derive(Default, AsAny)] #[derive(Default, AsAny)]
@@ -16,18 +16,15 @@ struct MainViewState {
action: Option<Action>, action: Option<Action>,
progress_bar: Entity, progress_bar: Entity,
text_box: Entity, text_box: Entity,
progress_counter: f64, //records: HashMap::<String, String>, progress_counter: f64
//records: HashMap::<String, String>,
//record_counter: u64 //record_counter: u64
} }
impl State for MainViewState { impl State for MainViewState {
fn init(&mut self, _: &mut Registry, ctx: &mut Context) { fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
self.text_box = ctx self.text_box = ctx.entity_of_child(ID_CHECK_POLICY_NUMBER).expect("Cannot get TextBox!");
.entity_of_child(ID_CHECK_POLICY_NUMBER) self.progress_bar = ctx.entity_of_child(ID_PROGRESS_BAR).expect("Cannot get progress bar !");
.expect("Cannot get TextBox!");
self.progress_bar = ctx
.entity_of_child(ID_PROGRESS_BAR)
.expect("Cannot get progress bar !");
} }
fn update(&mut self, _: &mut Registry, ctx: &mut Context) { fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
@@ -35,10 +32,7 @@ impl State for MainViewState {
if let Some(action) = &self.action { if let Some(action) = &self.action {
match action { match action {
Action::ParsePolicyNumber => { Action::ParsePolicyNumber => {
let value_to_parse = ctx let value_to_parse = ctx.get_widget(self.text_box).get::<String16>("text").clone();
.get_widget(self.text_box)
.get::<String16>("text")
.clone();
self.parse_policy_number(value_to_parse, ctx); self.parse_policy_number(value_to_parse, ctx);
} }
} }
@@ -87,7 +81,9 @@ widget!(MainView<MainViewState>);
impl Template for MainView { impl Template for MainView {
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self { fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
self.margin(32.0).child( self
.margin(32.0)
.child(
Stack::new() Stack::new()
.orientation("vertical") .orientation("vertical")
.h_align("center") .h_align("center")
@@ -99,14 +95,16 @@ impl Template for MainView {
.water_mark("Mut value and type <Return>") .water_mark("Mut value and type <Return>")
.on_activate(move |states, _entity| { .on_activate(move |states, _entity| {
// you have to fire a new event to be able to get in the update() with access to Context // you have to fire a new event to be able to get in the update() with access to Context
states states.get_mut::<MainViewState>(id).action(Action::ParsePolicyNumber);
.get_mut::<MainViewState>(id)
.action(Action::ParsePolicyNumber);
}) })
.build(ctx), .build(ctx)
) )
.child(ProgressBar::new().id(ID_PROGRESS_BAR).build(ctx)) .child(
.build(ctx), ProgressBar::new()
.id(ID_PROGRESS_BAR)
.build(ctx)
)
.build(ctx)
) )
} }
} }

View File

@@ -1,12 +1,13 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* OrbTK - The Orbital Widget Toolkit * OrbTK - The Orbital Widget Toolkit
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
mod data;
mod main_view; mod main_view;
mod receiver; mod receiver;
mod sender; mod sender;

View File

@@ -0,0 +1,38 @@
/*
* OrbTK - The Orbital Widget Toolkit
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::{
receiver::receiver_view::ReceiverView,
sender::sender_view::SenderView,
};
widget!(MainView {
//sender_view: ,
//receiver_view:
});
impl Template for MainView {
fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let receiver_view = ReceiverView::new()
.build(ctx);
let sender_view = SenderView::new()
.target(receiver_view.0) // entity of the target
.build(ctx);
self.name("MainView")
.child(
Stack::new()
.orientation("vertical")
.child(sender_view)
.child(receiver_view)
.build(ctx)
)
}
}

View File

@@ -0,0 +1,8 @@
// The starting point (Main View).
pub mod main_view;
/// Receiver widget
pub mod receiver;
/// Sender widget.
pub mod sender;

View File

@@ -0,0 +1,5 @@
/// The reciever state
pub mod receiver_state;
/// The receiver view
pub mod receiver_view;

View File

@@ -1,46 +1,52 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* OrbTK - The Orbital Widget Toolkit * OrbTK - The Orbital Widget Toolkit
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
use crate::sender::sender_state::{SenderAction, SenderState}; use crate::{
data::constants::*,
sender::sender_state::SenderAction,
};
/// Enumeration of valid `action variants` that need to be handled as // /// Enumeration of valid `action variants` that need to be handled as
/// state changes for the `SenderView` widget. /// state changes for the `SenderView` widget.
pub enum TestMessageAction { pub enum TestMessageAction {
// Toggle visibility of a message TextBox. // Toggle visibility of a message TextBlock.
ToggleMessageBox, ToggleMessageBlock
} }
/// Valid `structure members` of the `ReceiverState` used to react on /// Valid `structure members` of the `ReceiverState` used to react on
/// state changes inside the `ReceiverView` widget. /// state changes inside the `ReceiverView` widget.
#[derive(Default, AsAny)] #[derive(Default, AsAny)]
pub struct ReceiverState { pub struct ReceiverState {
message_box: Option<Entity>, message_block: Option<Entity>,
progress_bar: Entity, progress_bar: Entity
} }
/// Method definitions, we provide inside the `ReceiverState`. /// Method definitions, we provide inside the `ReceiverState`.
impl ReceiverState { impl ReceiverState {
fn toggle_message_box(&self, ctx: &mut Context) { fn toggle_message_block(&self, ctx: &mut Context) {
if let Some(message_box) = self.message_box { if let Some(message_block) = self.message_block {
ctx.get_widget(message_box) ctx.get_widget(message_block)
.set("visibility", Visibility::Visible); .set("visibility", Visibility::Visible);
} }
} }
} }
/// Trait methods provided for the `SenderState` /// Trait methods provided for the `ReceiverState`
impl State for ReceiverState { impl State for ReceiverState {
// initialize the view entities // initialize the view entities
fn init(&mut self, _: &mut Registry, ctx: &mut Context) { fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
self.progress_bar = ctx self.progress_bar = ctx
.entity_of_child("progress_bar") .entity_of_child(ID_RECEIVER_PROGRESS_BAR)
.expect("Cannot find ProgressBar!"); .expect("Cannot find ProgressBar!");
//self.message_box = ctx
// .entity_of_child(ID_RECEIVER_MESSAGE)
// .expect("Cannot find 'ID_RECEIVER_MESSAGE'!");
} }
// handle messages targeting the view // handle messages targeting the view
@@ -48,22 +54,31 @@ impl State for ReceiverState {
&mut self, &mut self,
mut messages: MessageReader, mut messages: MessageReader,
_registry: &mut Registry, _registry: &mut Registry,
ctx: &mut Context, ctx: &mut Context
) { ) {
for message in messages.read::<SenderAction>() { for message in messages.read::<SenderAction>() {
match message { match message {
SenderAction::UpdateProgress(amount) => { SenderAction::UpdateProgress(amount) => {
println!("Message received"); println!("UpdateProgress message received");
let mut progress_bar = ctx.get_widget(self.progress_bar); let mut progress_bar = ctx.get_widget(self.progress_bar);
let current_progress = progress_bar.clone::<f64>("val"); let current_progress = progress_bar.clone::<f64>("val");
progress_bar.set::<f64>("val", current_progress + amount); progress_bar.set::<f64>("val", current_progress + amount);
}
SenderAction::UpdateMessage(message) => {
println!("UpdateMessage message received");
//Reciever::text_set(&mut ctx.widget(), self.message.to_string());
//Reciever::text_set(&mut ctx.widget(), self.message.to_string());
TextBlock::text_set(&mut ctx.child(ID_RECEIVER_MESSAGE_BLOCK), String::from(message));
} }
} }
} }
for action in messages.read::<TestMessageAction>() { for action in messages.read::<TestMessageAction>() {
match action { match action {
TestMessageAction::ToggleMessageBox => { TestMessageAction::ToggleMessageBlock => {
self.toggle_message_box(ctx); self.toggle_message_block(ctx);
} }
} }
} }

View File

@@ -0,0 +1,56 @@
/*
* OrbTK - The Orbital Widget Toolkit
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::{
data::constants::*,
//receiver::receiver_state::{TestMessageAction, ReceiverState},
receiver::receiver_state::ReceiverState,
};
widget!(ReceiverView<ReceiverState>);
impl Template for ReceiverView {
fn template(self, _id: Entity, build_context: &mut BuildContext) -> Self {
self.id(ID_RECEIVER)
.name(ID_RECEIVER)
.child(
Container::new()
.id(ID_RECEIVER_CONTAINER)
.border_brush(COLOR_BOMBAY)
.border_width(2)
.name(ID_RECEIVER_CONTAINER)
.padding(16)
.child(
Stack::new()
.orientation("vertical")
.spacing(8)
.child(
TextBlock::new()
.id(ID_RECEIVER_TEXT_BLOCK)
.text(ID_RECEIVER)
.build(build_context)
)
.child(
ProgressBar::new()
.id(ID_RECEIVER_PROGRESS_BAR)
.build(build_context)
)
.child(
TextBlock::new()
.id(ID_RECEIVER_MESSAGE_BLOCK)
.text("")
.water_mark("here we expect the message updates.")
.build(build_context)
)
.build(build_context)
)
.build(build_context)
)
}
}

View File

@@ -0,0 +1,5 @@
/// The sender state
pub mod sender_state;
/// The sender view
pub mod sender_view;

View File

@@ -1,17 +1,20 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* OrbTK - The Orbital Widget Toolkit * OrbTK - The Orbital Widget Toolkit
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
//use crate::data::constants::*;
/// Enumeration of valid `action variants` that need to be handled as /// Enumeration of valid `action variants` that need to be handled as
/// state changes for the `SenderView` widget. /// state changes for the `SenderView` widget.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum SenderAction { pub enum SenderAction {
UpdateProgress(f64), UpdateProgress(f64),
UpdateMessage(String),
} }
/// Valid `structure members` of the `SenderState` used to react on /// Valid `structure members` of the `SenderState` used to react on
@@ -21,16 +24,22 @@ pub struct SenderState {
// actions // actions
actions: Vec<SenderAction>, actions: Vec<SenderAction>,
// entity that will receive the message // entity that will receive the message
target: Entity, target: Entity
} }
/// Method definitions, we provide inside the `SenderState`. /// Method definitions, we provide inside the `SenderState`.
impl SenderState { impl SenderState {
/// Sending message 'UpdateProgress' /// Sending message with type 'UpdateProgress'
pub fn send_message(&mut self) { pub fn send_update_progress(&mut self) {
println!("Sender: push 'UpdateProgress' action"); println!("Sender: push 'UpdateProgress' action");
self.actions.push(SenderAction::UpdateProgress(0.1)); self.actions.push(SenderAction::UpdateProgress(0.1));
} }
/// Sending message with type 'UpdateMessage'
pub fn send_update_message(&mut self) {
println!("Sender: push 'UpdateMessage' action");
self.actions.push(SenderAction::UpdateMessage(String::from("Hey sender. I got your message. All fine.")));
}
} }
/// Trait methods provided for the `SenderState` /// Trait methods provided for the `SenderState`
@@ -38,23 +47,31 @@ impl State for SenderState {
// initialize the view entities // initialize the view entities
fn init(&mut self, _registry: &mut Registry, ctx: &mut Context) { fn init(&mut self, _registry: &mut Registry, ctx: &mut Context) {
// create the target entity, that receives the Sender messages // create the target entity, that receives the Sender messages
self.target = Entity::from( self.target = Entity::from(ctx.widget().try_clone::<u32>("target")
ctx.widget() .expect("ERROR: SenderState::init(): target entity not found!"));
.try_clone::<u32>("target")
.expect("ERROR: SenderState::init(): target entity not found!"),
);
} }
// update entities, before we render the view // update entities, before we render the view
fn update(&mut self, _: &mut Registry, ctx: &mut Context) { fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
let actions: Vec<SenderAction> = self.actions.drain(..).collect(); let actions: Vec<SenderAction> = self.actions.drain(..).collect();
//let message = ctx.child(ID_SENDER_TEXT_BOX).get::<String>("text").to_string();
//println!("Child text: {:?}", message);
// create an explicit message_adapter context
let message_adapter = ctx.message_adapter();
for action in actions { for action in actions {
match action { match action {
SenderAction::UpdateProgress(amount) => { SenderAction::UpdateProgress(amount) => {
ctx.send_message(SenderAction::UpdateProgress(amount), self.target); message_adapter.send_message(SenderAction::UpdateProgress(amount), self.target);
println!("Sender: send message 'SenderAction::UpdateProgress'"); println!("Sender: send message 'SenderAction::UpdateProgress'");
} }
SenderAction::UpdateMessage(message) => {
//let message = ctx.child(ID_SENDER_TEXT_BOX).get::<String>("text").to_string();
message_adapter.send_message(SenderAction::UpdateMessage(message), self.target);
println!("Sender: send message 'SenderAction::UpdateMessage'");
}
} }
} }
} }

View File

@@ -0,0 +1,100 @@
/*
* OrbTK - The Orbital Widget Toolkit
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::{
prelude::*,
shell::event::Key,
};
use crate::{
data::constants::*,
sender::sender_state::SenderState,
//sender::sender_state::{SenderAction, SenderState},
};
widget!(SenderView<SenderState> {
// the Entity of the widget that will receive the messages
target: u32
});
impl Template for SenderView {
fn template(self, id: Entity, build_context: &mut BuildContext) -> Self {
let sender_header = TextBlock::new()
.attach(Grid::row(0))
.text(ID_SENDER)
.build(build_context);
let sender_message = TextBox::new()
.attach(Grid::row(2))
.attach(Grid::column(0))
.name(ID_SENDER_TEXT_BOX)
.text("")
.water_mark("Message text to be send via MessageHandler.")
.on_key_down(move | states, key_event | {
match key_event.key {
Key::Tab | Key::S(..) => {
println!("KeyHandler: got Tab");
states.get_mut::<SenderState>(id).send_update_progress();
states.get_mut::<SenderState>(id).send_update_message();
},
_ => {
println!("KeyHandler: got {:?}", key_event.key);
},
};
true
})
.build(build_context);
let sender_button = Button::new()
.attach(Grid::row(2))
.attach(Grid::column(2))
.name(ID_SENDER_BUTTON)
.text("send")
.icon(material_icons_font::MD_SEND)
.on_click(move |states, _entity| {
states.get_mut::<SenderState>(id).send_update_progress();
false
})
.build(build_context);
//let sender_content =
self.id(ID_SENDER)
.name(ID_SENDER)
.child(
Container::new()
.id(ID_SENDER_CONTAINER)
.border_brush(COLOR_BOMBAY)
.border_width(2)
.padding(16)
.child(
Grid::new()
.id(ID_SENDER_GRID)
.columns(
Columns::create()
.push("stretch") // Message
.push(16) // Delimiter
.push("auto") // Button
)
.rows(
Rows::create()
.push("auto") // Header
.push(6) // Delimiter
.push("auto") // Message
.push(6) // Delimiter
)
.child(sender_header) // row 0
.child(sender_message) // row 2
.child(sender_button) // row 3
.build(build_context)
)
.build(build_context)
)
}
}

View File

@@ -10,7 +10,7 @@ use orbtk::prelude::*;
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
enum Action { enum Action {
EntryActivated(Entity), EntryActivated(Entity),
EntryChanged(Entity), EntryChanged(Entity)
} }
#[derive(AsAny)] #[derive(AsAny)]
@@ -66,7 +66,10 @@ impl State for MainViewState {
} }
fn create_header(ctx: &mut BuildContext, text: &str) -> Entity { fn create_header(ctx: &mut BuildContext, text: &str) -> Entity {
TextBlock::new().text(text).style("header").build(ctx) TextBlock::new()
.text(text)
.style("header")
.build(ctx)
} }
widget!( widget!(
@@ -82,8 +85,19 @@ impl Template for MainView {
self.name("MainView").child( self.name("MainView").child(
Grid::new() Grid::new()
.background("#fafafa") .background("#fafafa")
.columns(Columns::create().push(150.0).push("*").push(150.0).build()) .columns(
.rows(Rows::create().push("*").push("*").build()) Columns::create()
.push(150.0)
.push("*")
.push(150.0)
.build(),
)
.rows(
Rows::create()
.push("*")
.push("*")
.build(),
)
.child( .child(
Grid::new() Grid::new()
//.element("policyholder_check") //.element("policyholder_check")
@@ -132,7 +146,7 @@ impl Template for MainView {
) )
.build(ctx), .build(ctx),
) )
.build(ctx), .build(ctx)
) )
.child( .child(
Grid::new() Grid::new()

View File

@@ -1,321 +1,164 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
// Component Values (Properties) // Component Values (Properties)
/// Apps property name
pub static PROP_ADVOTRACKER: &str = "advotracker"; pub static PROP_ADVOTRACKER: &str = "advotracker";
/// Mail header property first 'CC' pub static PROP_MAIL_CC_1: &str = "info@hiedemann.de";
pub static PROP_MAIL_CC_1: &str = "service@hiedemann.de"; pub static PROP_MAIL_CC_2: &str = "service@hiedemann.de";
/// Mail header property second 'CC'
pub static PROP_MAIL_CC_2: &str = "info@hiedemann.de";
/// Mail header property first 'BCC'
pub static PROP_MAIL_BCC_1: &str = "Networkx Support <support@networkx.de>"; pub static PROP_MAIL_BCC_1: &str = "Networkx Support <support@networkx.de>";
/// Mail header property second 'BCC'
pub static PROP_MAIL_BCC_2: &str = "knoche@hiedemann.de"; pub static PROP_MAIL_BCC_2: &str = "knoche@hiedemann.de";
/// Mail header property 'From': sender name pub static PROP_MAIL_FROM: &str = "Kanzlei Hiedemann <info@heidemann.de>";
pub static PROP_MAIL_FROM: &str = "Kanzlei Hiedemann <service@hiedemann.de>"; pub static PROP_MAIL_REPLY: &str = "Kanzlei Hiedemann <info@heidemann.de>";
/// Mail header property 'Reply-To': return mails to sender name
pub static PROP_MAIL_REPLY: &str = "Kanzlei Hiedemann <service@hiedemann.de>";
/// Mail header property 'Subject': mail subject
pub static PROP_MAIL_SUBJECT: &str = "ZMB Allianz - neues Mandat"; pub static PROP_MAIL_SUBJECT: &str = "ZMB Allianz - neues Mandat";
/// Mail header first List-Entry 'Recpt-To': recipient name
pub static PROP_MAIL_TO_1: &str = "allianz@ponschab-partner.com"; pub static PROP_MAIL_TO_1: &str = "allianz@ponschab-partner.com";
/// Mail header second List-Entry 'Recpt-To': recipient name
pub static PROP_MAIL_TO_2: &str = "kontakt@chevalier.law"; pub static PROP_MAIL_TO_2: &str = "kontakt@chevalier.law";
/// Mail header third List-Entry 'Recpt-To': recipient name
pub static PROP_MAIL_TO_3: &str = "kontakt@metamedlaw.de"; pub static PROP_MAIL_TO_3: &str = "kontakt@metamedlaw.de";
/// Mail header 4th List-Entry 'Recpt-To': recipient name
pub static PROP_MAIL_TO_4: &str = "sekretariat@m2-mediation.de"; pub static PROP_MAIL_TO_4: &str = "sekretariat@m2-mediation.de";
/// Mail header 5th List-Entry 'Recpt-To': recipient name
pub static PROP_MAIL_TO_5: &str = "kooperation@rightmart.de";
/// Mail header 6th List-Entry 'Recpt-To': recipient name
pub static PROP_MAIL_TO_6: &str = "allianz@legalhero.de";
/// Mail header 7th List-Entry 'Recpt-To': recipient name
pub static PROP_MAIL_TO_7: &str = "ralf.zerres@networkx.de";
/// Property: policy_check
pub static PROP_POLICY_CHECK: &str = "policy_check"; pub static PROP_POLICY_CHECK: &str = "policy_check";
/// Property: policy_progress_count
pub static PROP_POLICY_PROGRESS_COUNT: &str = "policy_progress_count"; pub static PROP_POLICY_PROGRESS_COUNT: &str = "policy_progress_count";
/// Property: policy_data_list
pub static PROP_POLICY_DATA_LIST: &str = "policy_data_list"; pub static PROP_POLICY_DATA_LIST: &str = "policy_data_list";
/// Property: policy_data_count
pub static PROP_POLICY_DATA_COUNT: &str = "policy_data_count"; pub static PROP_POLICY_DATA_COUNT: &str = "policy_data_count";
/// Property: policy_list
pub static PROP_POLICY_LIST: &str = "policy_list"; pub static PROP_POLICY_LIST: &str = "policy_list";
/// Property: policy_list_count
pub static PROP_POLICY_LIST_COUNT: &str = "policy_list_count"; pub static PROP_POLICY_LIST_COUNT: &str = "policy_list_count";
// Styles (RON based theme system) // Styles (RON based theme system)
/// Style: bottom_bar
pub static STYLE_BOTTOM_BAR: &str = "bottom_bar"; pub static STYLE_BOTTOM_BAR: &str = "bottom_bar";
/// Style: button_menu
pub static STYLE_BUTTON_MENU: &str = "button_menu"; pub static STYLE_BUTTON_MENU: &str = "button_menu";
/// Style: button_action
pub static STYLE_BUTTON_ACTION: &str = "button_action"; pub static STYLE_BUTTON_ACTION: &str = "button_action";
/// Style: container_action
pub static STYLE_CONTAINER_ACTION: &str = "container_action"; pub static STYLE_CONTAINER_ACTION: &str = "container_action";
/// Style: container_mail
pub static STYLE_CONTAINER_MAIL: &str = "container_mail"; pub static STYLE_CONTAINER_MAIL: &str = "container_mail";
/// Style: header_bar
pub static STYLE_HEADER_BAR: &str = "header_bar"; pub static STYLE_HEADER_BAR: &str = "header_bar";
/// Style: header_text
pub static STYLE_HEADER_TEXT: &str = "header_text"; pub static STYLE_HEADER_TEXT: &str = "header_text";
/// Style: seperator
pub static STYLE_SEPARATOR: &str = "separator"; pub static STYLE_SEPARATOR: &str = "separator";
/// Style: mail_label
pub static STYLE_MAIL_LABEL: &str = "mail_label"; pub static STYLE_MAIL_LABEL: &str = "mail_label";
/// Style: mail_cc
pub static STYLE_MAIL_TO: &str = "mail_to"; pub static STYLE_MAIL_TO: &str = "mail_to";
/// Style: mail_cc
pub static STYLE_MAIL_CC: &str = "mail_cc"; pub static STYLE_MAIL_CC: &str = "mail_cc";
/// Style: menu
pub static STYLE_MENU: &str = "menu"; pub static STYLE_MENU: &str = "menu";
/// Style: stack_action
pub static STYLE_STACK_ACTION: &str = "stack_action"; pub static STYLE_STACK_ACTION: &str = "stack_action";
/// Style: stack_menu
pub static STYLE_STACK_MENU: &str = "stack_menu"; pub static STYLE_STACK_MENU: &str = "stack_menu";
// Widget IDs (DCES: Entity[id] => [Component1, .. , Component<n>] -> data or state) // Widget IDs (DCES: Entity[id] => [Component1, .. , Component<n>] -> data or state)
/// Entity-ID: Configuration
pub static ID_CONFIGURATION_VIEW: &str = "Configuration"; pub static ID_CONFIGURATION_VIEW: &str = "Configuration";
/// Entity-ID: configuration_form
pub static ID_CONFIGURATION_FORM: &str = "configuration_form"; pub static ID_CONFIGURATION_FORM: &str = "configuration_form";
/// Entity-ID: configuration_header
pub static ID_CONFIGURATION_HEADER: &str = "configuration_header"; pub static ID_CONFIGURATION_HEADER: &str = "configuration_header";
/// Entity-ID: configuration_label_config_file
pub static ID_CONFIGURATION_LABEL_CONFIG_FILE: &str = "configuration_label_config_file"; pub static ID_CONFIGURATION_LABEL_CONFIG_FILE: &str = "configuration_label_config_file";
/// Entity-ID: configuration_config_file
pub static ID_CONFIGURATION_CONFIG_FILE: &str = "configuration_config_file"; pub static ID_CONFIGURATION_CONFIG_FILE: &str = "configuration_config_file";
/// Entity-ID: configuration_lable_language
pub static ID_CONFIGURATION_LABEL_LANGUAGE_ID: &str = "configuration_label_language_id"; pub static ID_CONFIGURATION_LABEL_LANGUAGE_ID: &str = "configuration_label_language_id";
/// Entity-ID: configuration_language_id
pub static ID_CONFIGURATION_LANGUAGE_ID: &str = "configuration_language_id"; pub static ID_CONFIGURATION_LANGUAGE_ID: &str = "configuration_language_id";
/// Entity-ID: Localization
pub static ID_LOCALIZATION_VIEW: &str = "Localization"; pub static ID_LOCALIZATION_VIEW: &str = "Localization";
/// Entity-ID: localization_form
pub static ID_LOCALIZATION_FORM: &str = "localization_form"; pub static ID_LOCALIZATION_FORM: &str = "localization_form";
/// Entity-ID: localization_header
pub static ID_LOCALIZATION_HEADER: &str = "localization_header"; pub static ID_LOCALIZATION_HEADER: &str = "localization_header";
/// Entity-ID: localization_languages
pub static ID_LOCALIZATION_LANGUAGES: &str = "localization_languages"; pub static ID_LOCALIZATION_LANGUAGES: &str = "localization_languages";
/// Entity-ID: localization_label_language_name
pub static ID_LOCALIZATION_LABEL_LANGUAGE_NAME: &str = "localization_label_language_name"; pub static ID_LOCALIZATION_LABEL_LANGUAGE_NAME: &str = "localization_label_language_name";
/// Entity-ID: localization_language_name
pub static ID_LOCALIZATION_LANGUAGE_NAME: &str = "localization_language_name"; pub static ID_LOCALIZATION_LANGUAGE_NAME: &str = "localization_language_name";
/// Entity-ID: main_grid
pub static ID_MAIN_GRID: &str = "main_grid"; pub static ID_MAIN_GRID: &str = "main_grid";
/// Entity-ID: main_tabwidget
pub static ID_MAIN_TABWIDGET: &str = "main_tabwidget"; pub static ID_MAIN_TABWIDGET: &str = "main_tabwidget";
/// Entity-ID: main_button_menu
pub static ID_MAIN_BUTTON_MENU: &str = "main_button_menu"; pub static ID_MAIN_BUTTON_MENU: &str = "main_button_menu";
/// Entity-ID: menu_view
pub static ID_MENU_VIEW: &str = "menu_view"; pub static ID_MENU_VIEW: &str = "menu_view";
/// Entity-ID: menu_popup
pub static ID_MENU_POPUP: &str = "menu_popup"; pub static ID_MENU_POPUP: &str = "menu_popup";
/// Entity-ID: menu_stack
pub static ID_MENU_STACK: &str = "menu_stack"; pub static ID_MENU_STACK: &str = "menu_stack";
/// Entity-ID: menu_bottom_bar
pub static ID_MENU_BOTTOM_BAR: &str = "menu_bottom_bar"; pub static ID_MENU_BOTTOM_BAR: &str = "menu_bottom_bar";
/// Entity-ID: menu_button
pub static ID_MENU_BUTTON: &str = "menu_button"; pub static ID_MENU_BUTTON: &str = "menu_button";
/// Entity-ID: menu_button_menu
pub static ID_MENU_BUTTON_MENU: &str = "menu_button_menu"; pub static ID_MENU_BUTTON_MENU: &str = "menu_button_menu";
/// Entity-ID: menu_grid
pub static ID_MENU_GRID: &str = "menu_grid"; pub static ID_MENU_GRID: &str = "menu_grid";
/// Entity-ID: menu_header
pub static ID_MENU_HEADER: &str = "menu_header"; pub static ID_MENU_HEADER: &str = "menu_header";
/// Entity-ID: menu_header_bar
pub static ID_MENU_HEADER_BAR: &str = "menu_header_bar"; pub static ID_MENU_HEADER_BAR: &str = "menu_header_bar";
/// Entity-ID: menu_label_account
pub static ID_MENU_LABEL_ACCOUNT: &str = "menu_label_account"; pub static ID_MENU_LABEL_ACCOUNT: &str = "menu_label_account";
/// Entity-ID: menu_label_quit
pub static ID_MENU_LABEL_QUIT: &str = "menu_label_quit"; pub static ID_MENU_LABEL_QUIT: &str = "menu_label_quit";
/// Entity-ID: menu_labeltoggle_theme
pub static ID_MENU_LABEL_TOGGLE_THEME: &str = "menu_label_toggle_theme"; pub static ID_MENU_LABEL_TOGGLE_THEME: &str = "menu_label_toggle_theme";
/// Entity-ID: menu_shortcut_quit
pub static ID_MENU_SHORTCUT_QUIT: &str = "menu_shortcut_quit"; pub static ID_MENU_SHORTCUT_QUIT: &str = "menu_shortcut_quit";
/// Entity-ID: menu_toggle_theme
pub static ID_MENU_TOGGLE_THEME: &str = "menu_toggle_theme"; pub static ID_MENU_TOGGLE_THEME: &str = "menu_toggle_theme";
/// Entity-ID: policy_ckeck_view
pub static ID_POLICY_CHECK_VIEW: &str = "policy_check_view"; pub static ID_POLICY_CHECK_VIEW: &str = "policy_check_view";
/// Entity-ID: policy_ckeck_action_button_clear
pub static ID_POLICY_CHECK_ACTION_BUTTON_CLEAR: &str = "policy_check_action_button_clear";
/// Entity-ID: policy_ckeck_action_button_create
pub static ID_POLICY_CHECK_ACTION_BUTTON_CREATE: &str = "policy_check_action_button_create"; pub static ID_POLICY_CHECK_ACTION_BUTTON_CREATE: &str = "policy_check_action_button_create";
/// Entity-ID: policy_ckeck_action_grid
pub static ID_POLICY_CHECK_ACTION_GRID: &str = "policy_check_action_grid"; pub static ID_POLICY_CHECK_ACTION_GRID: &str = "policy_check_action_grid";
/// Entity-ID: policy_ckeck_action_stack
pub static ID_POLICY_CHECK_ACTION_STACK: &str = "policy_check_action_stack";
/// Entity-ID: policy_ckeck_bottom_bar
pub static ID_POLICY_CHECK_BOTTOM_BAR: &str = "policy_check_bottom_bar"; pub static ID_POLICY_CHECK_BOTTOM_BAR: &str = "policy_check_bottom_bar";
/// Entity-ID: policy_ckeck_button_result
pub static ID_POLICY_CHECK_BUTTON_RESULT: &str = "policy_check_button_result"; pub static ID_POLICY_CHECK_BUTTON_RESULT: &str = "policy_check_button_result";
/// Entity-ID: policy_ckeck_button_menu
pub static ID_POLICY_CHECK_BUTTON_MENU: &str = "policy_check_button_menu"; pub static ID_POLICY_CHECK_BUTTON_MENU: &str = "policy_check_button_menu";
/// Entity-ID: policy_ckeck_data_count_block
pub static ID_POLICY_CHECK_DATA_COUNT_BLOCK: &str = "policy_check_data_count_block"; pub static ID_POLICY_CHECK_DATA_COUNT_BLOCK: &str = "policy_check_data_count_block";
/// Entity-ID: policy_ckeck_form_container
pub static ID_POLICY_CHECK_FORM_CONTAINER: &str = "policy_check_form_container";
/// Entity-ID: policy_ckeck_form
pub static ID_POLICY_CHECK_FORM: &str = "policy_check_form"; pub static ID_POLICY_CHECK_FORM: &str = "policy_check_form";
/// Entity-ID: policy_ckeck_header
pub static ID_POLICY_CHECK_HEADER: &str = "policy_check_header"; pub static ID_POLICY_CHECK_HEADER: &str = "policy_check_header";
/// Entity-ID: policy_ckeck_header_bar
pub static ID_POLICY_CHECK_HEADER_BAR: &str = "policy_check_header_bar"; pub static ID_POLICY_CHECK_HEADER_BAR: &str = "policy_check_header_bar";
/// Entity-ID: policy_ckeck_hint
pub static ID_POLICY_CHECK_HINT: &str = "policy_check_hint"; pub static ID_POLICY_CHECK_HINT: &str = "policy_check_hint";
/// Entity-ID: policy_ckeck_items_widget
pub static ID_POLICY_CHECK_ITEMS_WIDGET: &str = "policy_check_items_widget"; pub static ID_POLICY_CHECK_ITEMS_WIDGET: &str = "policy_check_items_widget";
/// Entity-ID: policy_ckeck_label_hint
pub static ID_POLICY_CHECK_LABEL_HINT: &str = "policy_check_label_hint"; pub static ID_POLICY_CHECK_LABEL_HINT: &str = "policy_check_label_hint";
/// Entity-ID: policy_ckeck_label_menu
pub static ID_POLICY_CHECK_LABEL_MENU: &str = "policy_check_label_menu"; pub static ID_POLICY_CHECK_LABEL_MENU: &str = "policy_check_label_menu";
/// Entity-ID: policy_ckeck_label_policy_number
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";
/// Entity-ID: policy_ckeck_label_result
pub static ID_POLICY_CHECK_LABEL_RESULT: &str = "policy_check_label_result"; pub static ID_POLICY_CHECK_LABEL_RESULT: &str = "policy_check_label_result";
/// Entity-ID: policy_ckeck_policy_code
pub static ID_POLICY_CHECK_POLICY_CODE: &str = "policy_check_policy_code"; pub static ID_POLICY_CHECK_POLICY_CODE: &str = "policy_check_policy_code";
/// Entity-ID: policy_ckeck_policy_number
pub static ID_POLICY_CHECK_POLICY_NUMBER: &str = "policy_number"; pub static ID_POLICY_CHECK_POLICY_NUMBER: &str = "policy_number";
/// Entity-ID: policy_ckeck_policy_progress
pub static ID_POLICY_CHECK_POPUP_PROGRESS: &str = "policy_check_popup_progress"; pub static ID_POLICY_CHECK_POPUP_PROGRESS: &str = "policy_check_popup_progress";
/// Entity-ID: policy_ckeck_policy_progress_bar
pub static ID_POLICY_CHECK_PROGRESS_BAR: &str = "policy_check_progress_bar"; pub static ID_POLICY_CHECK_PROGRESS_BAR: &str = "policy_check_progress_bar";
/// Entity-ID: policy_ckeck_policy_progress_time
pub static ID_POLICY_CHECK_PROGRESS_TIME: &str = "policy_check_progress_time"; pub static ID_POLICY_CHECK_PROGRESS_TIME: &str = "policy_check_progress_time";
/// Entity-ID: policy_ckeck_policy_progress_text
pub static ID_POLICY_CHECK_PROGRESS_TEXT: &str = "policy_check_progress_text"; pub static ID_POLICY_CHECK_PROGRESS_TEXT: &str = "policy_check_progress_text";
/// Entity-ID: policy_ckeck_result
pub static ID_POLICY_CHECK_RESULT: &str = "policy_check_result"; pub static ID_POLICY_CHECK_RESULT: &str = "policy_check_result";
/// Entity-ID: policy_ckeck_widget
pub static ID_POLICY_CHECK_WIDGET: &str = "policy_check_widget"; pub static ID_POLICY_CHECK_WIDGET: &str = "policy_check_widget";
/// Entity-ID: policy_data_add_button
pub static ID_POLICY_DATA_ADD_BUTTON: &str = "policy_data_add_button"; pub static ID_POLICY_DATA_ADD_BUTTON: &str = "policy_data_add_button";
/// Entity-ID: policy_data_count
pub static ID_POLICY_DATA_COUNT: &str = "policy_data_count"; pub static ID_POLICY_DATA_COUNT: &str = "policy_data_count";
/// Entity-ID: policy_data_label
pub static ID_POLICY_DATA_LABEL: &str = "policy_data_label"; pub static ID_POLICY_DATA_LABEL: &str = "policy_data_label";
/// Entity-ID: policy_data_items_widget
pub static ID_POLICY_DATA_ITEMS_WIDGET: &str = "policy_data_items_widget"; pub static ID_POLICY_DATA_ITEMS_WIDGET: &str = "policy_data_items_widget";
/// Entity-ID: policy_data_date_inserted
pub static ID_POLICY_DATA_DATE_INSERTED: &str = "policy_data_date_inserted"; pub static ID_POLICY_DATA_DATE_INSERTED: &str = "policy_data_date_inserted";
/// Entity-ID: policy_data_dion
pub static ID_POLICY_DATA_DION: &str = "policy_data_dion"; pub static ID_POLICY_DATA_DION: &str = "policy_data_dion";
/// Entity-ID: policy_data_policy_code
pub static ID_POLICY_DATA_POLICY_CODE: &str = "policy_data_policy_code"; pub static ID_POLICY_DATA_POLICY_CODE: &str = "policy_data_policy_code";
/// Entity-ID: policy_data_policy_number
pub static ID_POLICY_DATA_POLICY_NUMBER: &str = "policy_data_policy_number"; pub static ID_POLICY_DATA_POLICY_NUMBER: &str = "policy_data_policy_number";
/// Entity-ID: policy_data_stacl
pub static ID_POLICY_DATA_STACK: &str = "policy_data_stack"; pub static ID_POLICY_DATA_STACK: &str = "policy_data_stack";
/// Entity-ID: policy_data_status
pub static ID_POLICY_DATA_STATUS: &str = "policy_data_status"; pub static ID_POLICY_DATA_STATUS: &str = "policy_data_status";
/// Entity-ID: policy_data_list_name
pub static ID_POLICY_DATA_LIST_NAME: &str = "policy_data_list_name"; pub static ID_POLICY_DATA_LIST_NAME: &str = "policy_data_list_name";
/// Entity-ID: policy_list_add_button
pub static ID_POLICY_LIST_ADD_BUTTON: &str = "policy_list_add_button"; pub static ID_POLICY_LIST_ADD_BUTTON: &str = "policy_list_add_button";
/// Entity-ID: policy_list_items_widget
pub static ID_POLICY_LIST_ITEMS_WIDGET: &str = "policy_list_items_widget"; pub static ID_POLICY_LIST_ITEMS_WIDGET: &str = "policy_list_items_widget";
/// Entity-ID: policy_list_text_box
pub static ID_POLICY_LIST_TEXT_BOX: &str = "policy_list_text_box"; pub static ID_POLICY_LIST_TEXT_BOX: &str = "policy_list_text_box";
/// Entity-ID: ticket_data_action_button_clear
pub static ID_TICKET_DATA_ACTION_BUTTON_CLEAR: &str = "ticket_data_action_button_clear"; pub static ID_TICKET_DATA_ACTION_BUTTON_CLEAR: &str = "ticket_data_action_button_clear";
/// Entity-ID: ticket_data_action_button_send
pub static ID_TICKET_DATA_ACTION_BUTTON_SEND: &str = "ticket_data_action_button_send"; pub static ID_TICKET_DATA_ACTION_BUTTON_SEND: &str = "ticket_data_action_button_send";
/// Entity-ID: ticket_data_action_grid
pub static ID_TICKET_DATA_ACTION_GRID: &str = "ticket_data_action_grid"; pub static ID_TICKET_DATA_ACTION_GRID: &str = "ticket_data_action_grid";
/// Entity-ID: ticket_data_action_stack
pub static ID_TICKET_DATA_ACTION_STACK: &str = "ticket_data_action_stack";
/// Entity-ID: ticket_data_bottom_bar
pub static ID_TICKET_DATA_BOTTOM_BAR: &str = "ticket_data_bottom_bar"; pub static ID_TICKET_DATA_BOTTOM_BAR: &str = "ticket_data_bottom_bar";
/// Entity-ID: ticket_data_button_menu
pub static ID_TICKET_DATA_BUTTON_MENU: &str = "ticket_data_button_menu"; pub static ID_TICKET_DATA_BUTTON_MENU: &str = "ticket_data_button_menu";
/// Entity-ID: ticket_data_button_result
pub static ID_TICKET_DATA_BUTTON_RESULT: &str = "ticket_data_button_result"; pub static ID_TICKET_DATA_BUTTON_RESULT: &str = "ticket_data_button_result";
/// Entity-ID: ticket_data_callback_date
pub static ID_TICKET_DATA_CALLBACK_DATE: &str = "ticket_data_label_callback_date"; pub static ID_TICKET_DATA_CALLBACK_DATE: &str = "ticket_data_label_callback_date";
/// Entity-ID: ticket_data_callback_number pub static ID_TICKET_DATA_CALLBACK_NUMBER: &str = "ticket_data_label_callback_number";
pub static ID_TICKET_DATA_CALLBACK_NUMBER: &str = "ticket_data_callback_number";
/// Entity-ID: ticket_data_combo_box_mail_cc
pub static ID_TICKET_DATA_COMBO_BOX_MAIL_CC: &str = "ticket_data_combo_box_mail_cc"; pub static ID_TICKET_DATA_COMBO_BOX_MAIL_CC: &str = "ticket_data_combo_box_mail_cc";
/// Entity-ID: ticket_data_combo_box_mail_to
pub static ID_TICKET_DATA_COMBO_BOX_MAIL_TO: &str = "ticket_data_combo_box_mail_to"; pub static ID_TICKET_DATA_COMBO_BOX_MAIL_TO: &str = "ticket_data_combo_box_mail_to";
/// Entity-ID: ticket_data_container_mail
pub static ID_TICKET_DATA_CONTAINER_MAIL: &str = "ticket_data_container_mail"; pub static ID_TICKET_DATA_CONTAINER_MAIL: &str = "ticket_data_container_mail";
/// Entity-ID: ticket_data_count_block
pub static ID_TICKET_DATA_COUNT_BLOCK: &str = "ticket_data_count_block"; pub static ID_TICKET_DATA_COUNT_BLOCK: &str = "ticket_data_count_block";
/// Entity-ID: ticket_data_deductible
pub static ID_TICKET_DATA_DEDUCTIBLE: &str = "ticket_data_deductible"; pub static ID_TICKET_DATA_DEDUCTIBLE: &str = "ticket_data_deductible";
/// Entity-ID: ticket_data_from
pub static ID_TICKET_DATA_FORM: &str = "ticket_data_form"; pub static ID_TICKET_DATA_FORM: &str = "ticket_data_form";
/// Entity-ID: ticket_data_from_grid
pub static ID_TICKET_DATA_FORM_GRID: &str = "ticket_data_form_grid";
/// Entity-ID: ticket_data_grid
pub static ID_TICKET_DATA_GRID: &str = "ticket_data_grid"; pub static ID_TICKET_DATA_GRID: &str = "ticket_data_grid";
/// Entity-ID: ticket_data_grid_mail
pub static ID_TICKET_DATA_GRID_MAIL: &str = "ticket_data_grid_mail"; pub static ID_TICKET_DATA_GRID_MAIL: &str = "ticket_data_grid_mail";
/// Entity-ID: ticket_data_from_grid
pub static ID_TICKET_DATA_HARM_TYPE: &str = "ticket_data_harm_type"; pub static ID_TICKET_DATA_HARM_TYPE: &str = "ticket_data_harm_type";
/// Entity-ID: ticket_data_header_bar
pub static ID_TICKET_DATA_HEADER_BAR: &str = "ticket_data_header_bar"; pub static ID_TICKET_DATA_HEADER_BAR: &str = "ticket_data_header_bar";
/// Entity-ID: ticket_data_header
pub static ID_TICKET_DATA_HEADER: &str = "ticket_data_header"; pub static ID_TICKET_DATA_HEADER: &str = "ticket_data_header";
/// Entity-ID: ticket_data_hint
pub static ID_TICKET_DATA_HINT: &str = "ticket_data_hint"; pub static ID_TICKET_DATA_HINT: &str = "ticket_data_hint";
/// Entity-ID: ticket_data_items_widget
pub static ID_TICKET_DATA_ITEMS_WIDGET: &str = "ticket_data_items_widget"; pub static ID_TICKET_DATA_ITEMS_WIDGET: &str = "ticket_data_items_widget";
/// Entity-ID: ticket_data_ivr_comment
pub static ID_TICKET_DATA_IVR_COMMENT: &str = "ticket_data_ivr_comment"; pub static ID_TICKET_DATA_IVR_COMMENT: &str = "ticket_data_ivr_comment";
/// Entity-ID: ticket_data_label_callback_date
pub static ID_TICKET_DATA_LABEL_CALLBACK_DATE: &str = "ticket_data_label_callback_data"; pub static ID_TICKET_DATA_LABEL_CALLBACK_DATE: &str = "ticket_data_label_callback_data";
/// Entity-ID: ticket_data_label_callback_number
pub static ID_TICKET_DATA_LABEL_CALLBACK_NUMBER: &str = "ticket_data_label_callback_number"; pub static ID_TICKET_DATA_LABEL_CALLBACK_NUMBER: &str = "ticket_data_label_callback_number";
/// Entity-ID: ticket_data_label_deductible
pub static ID_TICKET_DATA_LABEL_DEDUCTIBLE: &str = "ticket_data_label_deductible"; pub static ID_TICKET_DATA_LABEL_DEDUCTIBLE: &str = "ticket_data_label_deductible";
/// Entity-ID: ticket_data_label_harm_type
pub static ID_TICKET_DATA_LABEL_HARM_TYPE: &str = "ticket_data_label_harm_type"; pub static ID_TICKET_DATA_LABEL_HARM_TYPE: &str = "ticket_data_label_harm_type";
/// Entity-ID: ticket_data_label_hint
pub static ID_TICKET_DATA_LABEL_HINT: &str = "ticket_data_label_hint"; pub static ID_TICKET_DATA_LABEL_HINT: &str = "ticket_data_label_hint";
/// Entity-ID: ticket_data_label_ivr_comment
pub static ID_TICKET_DATA_LABEL_IVR_COMMENT: &str = "ticket_data_label_ivr_comment"; pub static ID_TICKET_DATA_LABEL_IVR_COMMENT: &str = "ticket_data_label_ivr_comment";
/// Entity-ID: ticket_data_label_mail_cc
pub static ID_TICKET_DATA_LABEL_MAIL_CC: &str = "ticket_data_label_mail_cc"; pub static ID_TICKET_DATA_LABEL_MAIL_CC: &str = "ticket_data_label_mail_cc";
/// Entity-ID: ticket_data_label_mail_to
pub static ID_TICKET_DATA_LABEL_MAIL_TO: &str = "ticket_data_label_mail_to"; pub static ID_TICKET_DATA_LABEL_MAIL_TO: &str = "ticket_data_label_mail_to";
/// Entity-ID: ticket_data_label_menu
pub static ID_TICKET_DATA_LABEL_MENU: &str = "ticket_data_label_menu"; pub static ID_TICKET_DATA_LABEL_MENU: &str = "ticket_data_label_menu";
/// Entity-ID: ticket_data_label_policy_code
pub static ID_TICKET_DATA_LABEL_POLICY_CODE: &str = "ticket_data_label_policy_code"; pub static ID_TICKET_DATA_LABEL_POLICY_CODE: &str = "ticket_data_label_policy_code";
/// Entity-ID: ticket_data_label_policy_holder
pub static ID_TICKET_DATA_LABEL_POLICY_HOLDER: &str = "ticket_data_label_policy_holder"; pub static ID_TICKET_DATA_LABEL_POLICY_HOLDER: &str = "ticket_data_label_policy_holder";
/// Entity-ID: ticket_data_logo_bar
pub static ID_TICKET_DATA_LOGO_BAR: &str = "ticket_data_logo_bar"; pub static ID_TICKET_DATA_LOGO_BAR: &str = "ticket_data_logo_bar";
/// Entity-ID: ticket_data_mail_cc
pub static ID_TICKET_DATA_MAIL_CC: &str = "ticket_data_mail_cc"; pub static ID_TICKET_DATA_MAIL_CC: &str = "ticket_data_mail_cc";
/// Entity-ID: ticket_data_mail_to
pub static ID_TICKET_DATA_MAIL_TO: &str = "ticket_data_mail_to"; pub static ID_TICKET_DATA_MAIL_TO: &str = "ticket_data_mail_to";
/// Entity-ID: ticket_data_policy_code
pub static ID_TICKET_DATA_POLICY_CODE: &str = "ticket_data_policy_code"; pub static ID_TICKET_DATA_POLICY_CODE: &str = "ticket_data_policy_code";
/// Entity-ID: ticket_data_policy_holder
pub static ID_TICKET_DATA_POLICY_HOLDER: &str = "ticket_data_policy_holder"; pub static ID_TICKET_DATA_POLICY_HOLDER: &str = "ticket_data_policy_holder";
/// Entity-ID: ticket_data_result
pub static ID_TICKET_DATA_RESULT: &str = "ticket_data_result"; pub static ID_TICKET_DATA_RESULT: &str = "ticket_data_result";
/// Entity-ID: ticket_data_view
pub static ID_TICKET_DATA_VIEW: &str = "ticket_data_view"; pub static ID_TICKET_DATA_VIEW: &str = "ticket_data_view";
/// Entity-ID: ticket_data_policy_widget
pub static ID_TICKET_DATA_WIDGET: &str = "ticket_data_widget"; pub static ID_TICKET_DATA_WIDGET: &str = "ticket_data_widget";

View File

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

View File

@@ -1,8 +1,7 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT) * SPDX-License-Identifier: (0BSD or MIT)
*/ */
@@ -15,13 +14,11 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Serialize)] #[derive(Debug, Clone, Copy, Deserialize, PartialEq, Serialize)]
pub enum PolicyCode { pub enum PolicyCode {
/// Allianz Sachversicherung /// Allianz Sachversicherung
AS, AS
} }
impl Default for PolicyCode { impl Default for PolicyCode {
fn default() -> Self { fn default() -> Self { PolicyCode::AS }
PolicyCode::AS
}
} }
/// Classifier of the Allinaz DirectCall communication type. /// Classifier of the Allinaz DirectCall communication type.
@@ -61,13 +58,11 @@ pub enum CommunicationType {
/// Zeugins /// Zeugins
ZE, ZE,
/// Typ is unspecified /// Typ is unspecified
XX, XX
} }
impl Default for CommunicationType { impl Default for CommunicationType {
fn default() -> Self { fn default() -> Self { CommunicationType::XX }
CommunicationType::XX
}
} }
/// Status of a given policy data element. /// Status of a given policy data element.
@@ -76,13 +71,11 @@ pub enum Status {
/// Active -> the policy is active an supported /// Active -> the policy is active an supported
Active, Active,
/// Inactive -> the policy is inactive or resigned /// Inactive -> the policy is inactive or resigned
Inactive, Inactive
} }
impl Default for Status { impl Default for Status {
fn default() -> Self { fn default() -> Self { Status::Active }
Status::Active
}
} }
/// A communication type describes possible classifications of customer calls. /// A communication type describes possible classifications of customer calls.
@@ -92,7 +85,7 @@ pub struct CommunicationData {
/// pub communication_type: CommunicationType, /// pub communication_type: CommunicationType,
pub communication_type: String, pub communication_type: String,
/// A literal name describing the selected communication type /// A literal name describing the selected communication type
pub communication_name: String, pub communication_name: String
} }
/// CSV Export /// CSV Export
@@ -145,7 +138,7 @@ pub struct Email {
/// Body type harm type /// Body type harm type
pub harm_type: String, pub harm_type: String,
/// Body type ivr comment /// Body type ivr comment
pub ivr_comment: String, pub ivr_comment: String
} }
impl Email {} impl Email {}
@@ -157,7 +150,7 @@ pub struct HarmData {
pub harm_data: Vec<HarmType>, pub harm_data: Vec<HarmType>,
/// Status der Schadenliste /// Status der Schadenliste
//pub name: String, //pub name: String,
pub selected: bool, pub selected: bool
} }
/// Harm types are destincted by a type code. /// Harm types are destincted by a type code.
@@ -192,7 +185,7 @@ pub struct PolicyCheck {
/// Referenz zur Versicherungsschein-Nummer /// Referenz zur Versicherungsschein-Nummer
pub policy_number: u64, pub policy_number: u64,
/// Validitätsergebnis /// Validitätsergebnis
pub policy_number_status: Status, pub policy_number_status: Status
} }
impl PolicyCheck {} impl PolicyCheck {}
@@ -262,7 +255,7 @@ pub struct PolicyDataList {
/// Name der Versicherungsliste /// Name der Versicherungsliste
pub name: String, pub name: String,
/// Status der Versicherungsliste /// Status der Versicherungsliste
pub selected: bool, pub selected: bool
} }
/// implements the helper methods, to manage policy data collections. /// implements the helper methods, to manage policy data collections.
@@ -341,7 +334,7 @@ pub struct PolicyData {
#[serde(rename = "POLLFNR")] #[serde(rename = "POLLFNR")]
pub policy_number: u64, pub policy_number: u64,
/// Status des Versicherungsscheins /// Status des Versicherungsscheins
pub status: Option<Status>, pub status: Option<Status>
} }
/// Policy Number Set /// Policy Number Set
@@ -356,7 +349,7 @@ pub struct AllianzPolicyNumber {
pub policy_code: String, pub policy_code: String,
/// 10-stellige Versicherungsscheinnummer (numerisch) /// 10-stellige Versicherungsscheinnummer (numerisch)
#[serde(rename = "POLLFNR")] #[serde(rename = "POLLFNR")]
pub policy_number: usize, pub policy_number: usize
} }
// /// List of Allianz Policy Number records // /// List of Allianz Policy Number records

View File

@@ -1,13 +1,12 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: 0BSD, MIT
*/ */
#![crate_name = "advotracker_client"] //#![warn(missing_docs, rust_2018_idioms, rust_2018_compatibility)]
#![crate_type = "lib"] #![warn(rust_2018_idioms, rust_2018_compatibility)]
#![warn(missing_docs, 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
@@ -24,9 +23,6 @@
//! WIP: provide a workflow image //! WIP: provide a workflow image
//! //!
// i18n: get twine generated translation strings for macro (t!)
include!(concat!(env!("OUT_DIR"), "/i18n.rs"));
// /// The client specific services // /// The client specific services
// pub mod clients; // pub mod clients;

View File

@@ -0,0 +1,248 @@
{
"err.lang.not_found": {
"de_DE.UTF-8": "Konnte Sprachkode nicht auslesen",
"de_DE": "Konnte Sprachkode nicht auslesen",
"C": "Couldn't read LANG"
},
"err.user.not_found": {
"fr": "Utilisateur introuvable: $email, $id",
"de_DE.UTF-8": "Anwender nicht gefunden: $email, $id",
"de_DE": "Anwender nicht gefunden: $email, $id",
"C": "User not found: $email, $id"
},
"main.started": {
"de_DE.UTF-8": "Programmlogik starten",
"de_DE": "Programmlogik starten",
"C": "Program logic started"
},
"main.finished": {
"de_DE.UTF-8": "Programmlogik beendet",
"de_DE": "Programmlogik beendet",
"C": "Program logic finished"
},
"parse.arguments": {
"de_DE.UTF-8": "Programmargumente prüfen",
"de_DE": "Programmargumente prüfen",
"C": "Parsing arguments"
},
"parse.environment": {
"de_DE.UTF-8": "Umgebungsvariablen prüfen",
"de_DE": "Umgebungsvariablen prüfen",
"C": "Parsing environment"
},
"parse.results": {
"de_DE.UTF-8": "Ergebnisse der Konfigurations-Parameterprüfung",
"de_DE": "Ergebnisse der Konfigurationsparameterprüfung",
"C": "Config parsing results"
},
"config.name": {
"de_DE.UTF-8": "Konfigurationswert für",
"de_DE": "Konfigurationswert für",
"C": "Config Value for"
},
"config.name.lang": {
"de_DE.UTF-8": "Sprach-Code_DE",
"de_DE": "Sprach-Code_DE",
"C": "Language code_DE"
},
"config.name.verbositylevel": {
"de_DE.UTF-8": "Ausgabe-Ebene",
"de_DE": "Ausgabe-Ebene",
"C": "verbosity level"
},
"config.name.environment": {
"de_DE.UTF-8": "Umgebungsvariablen",
"de_DE": "Umgebungsvariablen",
"C": "environment"
},
"config.name.configfile": {
"de_DE.UTF-8": "Konfigurations-Datei",
"de_DE": "Konfigurations-Datei",
"C": "config file"
},
"config.name.dbdriver": {
"de_DE.UTF-8": "Datenbank-Treiber",
"de_DE": "Datenbank-Treiber",
"C": "database driver"
},
"config.name.redis": {
"de_DE.UTF-8": "Redis Datenbank",
"de_DE": "Redis Datenbank",
"C": "Redis database"
},
"csv.export.started": {
"de_DE.UTF-8": "Export in eine CSV Datei starten",
"de_DE": "Export in eine CSV Datei starten",
"C": "Export to csv file started"
},
"csv.export.finished": {
"de_DE.UTF-8": "Export in eine CSV Datei beendet",
"de_DE": "Export in eine CSV Datei beendet",
"C": "Export to csv file finished"
},
"csv.import.started": {
"de_DE.UTF-8": "Import aus einer CSV Datei",
"de_DE": "Import aus einer CSV Datei",
"C": "Import from a csv file"
},
"csv.import.finished": {
"de_DE.UTF-8": "Import aus einer CSV Datei beendet",
"de_DE": "Import aus einer CSV Datei beendet",
"C": "Import from a csv file finished"
},
"redis.connection.error": {
"de_DE.UTF-8": "Es konnte keine Redis Verbindung aufgebaut werden",
"de_DE": "Es konnte keine Redis Verbindung aufgebaut werden",
"C": "Could not establish a redis connection"
},
"policy.hashmap.success": {
"de_DE.UTF-8": "Hashmap wurde erfolgreich erstellt",
"de_DE": "Hashmap wurde erfolgreich erstellt",
"C": "Hashmap creation was successfull"
},
"policy.hashmap.failed": {
"de_DE.UTF-8": "Hashmap konnte nicht erstellt werden",
"de_DE": "Hashmap konnte nicht erstellt werden",
"C": "Hashmap creation failed"
},
"policy.menu.label": {
"de_DE.UTF-8": "Menü",
"de_DE": "Menü",
"C": "Menu"
},
"policy.menu.label_account": {
"de_DE.UTF-8": "Aktueller Benutzer",
"de_DE": "Aktueller Benutzer",
"C": "Active user"
},
"policy.menu.label_quit": {
"de_DE.UTF-8": "Beenden",
"de_DE": "Beenden",
"C": "Quit"
},
"policy.menu.label_toggle_theme": {
"de_DE.UTF-8": "Thema wechseln",
"de_DE": "Thema wechseln",
"C": "Toggle theme"
},
"policy.string.header": {
"de_DE.UTF-8": "Validierung Versicherungsnummer",
"de_DE": "Validierung Versicherungsnummer",
"C": "Policy number validation"
},
"policy.string.label_policy_data": {
"de_DE.UTF-8": "Importierte Daten",
"de_DE": "Importierte Daten",
"C": "imported data"
},
"policy.string.label_policy_list": {
"de_DE.UTF-8": "Versicherungsnummern-Liste",
"de_DE": "Versicherungsnummern-Liste",
"C": "policy list"
},
"policy.string.label_policy_number": {
"de_DE.UTF-8": "Versicherungsnummer",
"de_DE": "Versicherungsnummer",
"C": "policy number"
},
"policy.string.label_result": {
"de_DE.UTF-8": "Prüfungsergebnis",
"de_DE": "Prüfungsergebnis",
"C": "check result"
},
"policy.string.data_count": {
"de_DE.UTF-8": "Anzahl Prüflistenelemente",
"de_DE": "Anzahl Prüflistenelemente",
"C": "Number of checklist elements"
},
"policy.string.import_data": {
"de_DE.UTF-8": "Importieren der Prüflisten-Elemente",
"de_DE": "Importieren der Prüflisten-Elemente",
"C": "Import checklist elements"
},
"policy.string.progress_time": {
"de_DE.UTF-8": "Bearbeitungszeit",
"de_DE": "Bearbeitungszeit",
"C": "processing time"
},
"policy.string.progress_text": {
"de_DE.UTF-8": "Importiere Daten",
"de_DE": "Importiere Daten",
"C": "Importing data"
},
"policy.validation.button_failed": {
"de_DE.UTF-8": "ungültig",
"de_DE": "ungültig",
"C": "invalid"
},
"policy.validation.button_success": {
"de_DE.UTF-8": "gültig",
"de_DE": "gültig",
"C": "valid"
},
"policy.validation.failed": {
"de_DE.UTF-8": "Die Versicherungsscheinnummber ist ungültig",
"de_DE": "Die Versicherungsscheinnummber ist ungültig",
"C": "The given policy number is invalid"
},
"policy.validation.new": {
"de_DE.UTF-8": "Neue Prüfung",
"de_DE": "Neue Prüfung",
"C": "New validation"
},
"policy.validation.success": {
"de_DE.UTF-8": "Die Versicherungsscheinnummber ist gültig",
"de_DE": "Die Versicherungsscheinnummber ist gültig",
"C": "The given policy number is valid"
},
"policy.validation.started": {
"de_DE.UTF-8": "Die Prüfung der Versicherungsscheinnummber wurde gestartet",
"de_DE": "Die Prüfung der Versicherungsscheinnummber wurde gestartet",
"C": "Validation of the policy number started"
},
"policy.validation.finished": {
"de_DE.UTF-8": "Die Prüfung der Versicherungsscheinnummber wurde beendet",
"de_DE": "Die Prüfung der Versicherungsscheinnummber wurde beendet",
"C": "Validation of the policy number finished"
},
"policy.validation.invalid_input": {
"de_DE.UTF-8": "Nur Nummer sind zulässig",
"de_DE": "Nur Nummer sind zulässig",
"C": "Only numbers are valid"
},
"policy.validation.not_found": {
"de_DE.UTF-8": "Nummer ist nicht aktiviert",
"de_DE": "Nummer ist nicht aktiviert",
"C": "number isn't marked active"
},
"policy.validation.to_long": {
"de_DE.UTF-8": "Die Nummer ist zu lang",
"de_DE": "Die Nummer ist zu lang",
"C": "Policy number is to long"
},
"policy.validation.to_short": {
"de_DE.UTF-8": "Die Nummer ist zu kurz",
"de_DE": "Die Nummer ist zu kurz",
"C": "Policy number is to short"
},
"sendticketdata.export.started":{
"de_DE.UTF-8": "Versenden von ticket daten via eMail gestartet",
"de_DE": "Versenden von ticket daten via eMail gestartet",
"C": "Send ticket data via eMail started"
},
"sendticketdata.export.finished":{
"de_DE.UTF-8": "Versenden von ticket daten via eMail beendet",
"de_DE": "Versenden von ticket daten via eMail beendet",
"C": "Send ticket data via eMail finished"
},
"state.started": {
"de_DE.UTF-8": "gestartet",
"de_DE": "gestartet",
"C": "started"
},
"state.finished": {
"de_DE.UTF-8": "beendet",
"de_DE": "beended",
"C": "finished"
}
}

View File

@@ -1,16 +1,20 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
// suppress creation of a new console window on window // suppress creation of a new console window on window
#![windows_subsystem = "windows"] #![windows_subsystem = "windows"]
//#[macro_use]
//extern crate lazy_static;
//use chrono::{Local, DateTime}; //use chrono::{Local, DateTime};
use cfg_if::cfg_if;
use dotenv::dotenv; use dotenv::dotenv;
use locales::t;
use cfg_if::cfg_if;
use serde::Deserialize; use serde::Deserialize;
use std::env; use std::env;
//use std::process; //use std::process;
@@ -19,15 +23,15 @@ use tracing::{info, trace, Level};
use orbtk::{ use orbtk::{
prelude::*, prelude::*,
//widgets::themes::theme_orbtk::{THEME_DEFAULT, THEME_DEFAULT_COLORS_DARK, THEME_DEFAULT_FONTS}, theme_default::{THEME_DEFAULT, THEME_DEFAULT_COLORS_DARK, THEME_DEFAULT_FONTS},
widgets::themes::*, theming::config::ThemeConfig,
}; };
// The Main view #[cfg(target_os = "windows")]
use advotracker_client::widgets::main_view; use orbtk::theme_fluent::{THEME_FLUENT, THEME_FLUENT_COLORS_DARK, THEME_FLUENT_FONTS};
// get the macro (t!) accessing the internationalization strings // The Main view
include!(concat!(env!("OUT_DIR"), "/i18n.rs")); use advotracker::widgets::main_view;
mod parse_args; mod parse_args;
@@ -36,19 +40,17 @@ mod parse_args;
/// this is primarily used in testing scenarios (eg. debugging) /// this is primarily used in testing scenarios (eg. debugging)
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct Environment { struct Environment {
//lang: Lang, lang: String,
test_lang: String, test_lang: String,
rust_log: String, rust_log: String,
} }
// Style extension // Style extension
static DEFAULT_DARK_EXT: &str = include_str!("../assets/advotracker/default_dark.ron");
cfg_if! { cfg_if! {
if #[cfg(windows)] { if #[cfg(windows)] {
static DEFAULT_DARK_EXT: &str = include_str!("../assets/advotracker/default_dark.ron"); static FLUENT_DARK_EXT: &str = include_str!("../assets/advotracker/fluent_dark.ron");
//static FLUENT_DARK_EXT: &str = include_str!("../assets/advotracker/fluent_dark.ron"); static FLUENT_LIGHT_EXT: &str = include_str!("../assets/advotracker/fluent_light.ron");
//static FLUENT_LIGHT_EXT: &str = include_str!("../assets/advotracker/fluent_light.ron");
} else {
static DEFAULT_DARK_EXT: &str = include_str!("../assets/advotracker/default_dark.ron");
} }
} }
@@ -58,32 +60,19 @@ static ADVOTRACKER_DE_DE: &str = include_str!("../assets/advotracker/advotracker
/// Get the active language environment. /// Get the active language environment.
fn get_lang() -> String { fn get_lang() -> String {
// get system environment // get system environment
let mut lang_id = env::var("LANG").unwrap_or_else(|_| "En".to_string()); let mut lang = env::var("LANG").unwrap_or_else(|_| "C".to_string());
let lang_variant = ""; lang = lang.substring(0,5).to_string(); // "de_DE.UTF-8" -> "de_DE"
info!("GUI-Language: preset to {:?}", lang);
// prepare lang_id to represent twine language prefix // testing environment: read from .env file
// env: "de_DE.UTF-8" -> "De"
lang_id = lang_id.substring(0, 2).to_string();
lang_id.replace_range(..1, &lang_id.substring(0, 1).to_string().to_uppercase());
// handle testing environment variables (.env file) with precedence
dotenv().ok(); dotenv().ok();
match envy::from_env::<Environment>() { match envy::from_env::<Environment>() {
Ok(environment) => { Ok(environment) => {
if environment.test_lang != lang_id { if environment.test_lang != lang { lang = environment.test_lang; }
info!("GUI-Language: preset from .env to {:?}", lang_id); },
lang_id = environment.test_lang; Err(e) => { info!(target: "advotracker", "{}", e) }
lang_id = lang_id.substring(0, 2).to_string();
lang_id.replace_range(..1, &lang_id.substring(0, 1).to_string().to_uppercase());
}
}
Err(e) => {
info!(target: "advotracker", "{}", e)
}
} }
trace!(target: "advotracker", lang = ?lang);
let lang = format!("Lang::{}(\"{}\")", lang_id, lang_variant);
trace!(target: "advotracker", lang_id = ?lang_id, lang = ?lang);
// return the active language // return the active language
lang lang
@@ -93,33 +82,30 @@ cfg_if! {
if #[cfg(windows)] { if #[cfg(windows)] {
/// Extend and register theme assets. /// Extend and register theme assets.
fn theme() -> Theme { fn theme() -> Theme {
orbtk::widgets::themes::theme_orbtk::register_default_fonts(Theme::from_config( register_default_fonts(Theme::from_config(
ThemeConfig::from(DEFAULT_DARK_EXT) ThemeConfig::from(DEFAULT_DARK_EXT)
.extend(ThemeConfig::from(THEME_DEFAULT)) .extend(ThemeConfig::from(THEME_DEFAULT))
.extend(ThemeConfig::from(THEME_DEFAULT_COLORS_DARK)) .extend(ThemeConfig::from(THEME_DEFAULT_COLORS_DARK))
.extend(ThemeConfig::from(THEME_DEFAULT_FONTS)), .extend(ThemeConfig::from(THEME_DEFAULT_FONTS)),
)) ))
} }
// fn theme_fluent_dark() -> Theme { fn theme_fluent() -> Theme {
// orbtk::widgets::themes::theme_fluent::register_fluent_fonts(Theme::from_config( register_fluent_fonts(Theme::from_config(
// ThemeConfig::from(FLUENT_DARK_EXT) ThemeConfig::from(FLUENT_DARK_EXT)
.extend(ThemeConfig::from(THEME_FLUENT))
.extend(ThemeConfig::from(THEME_FLUENT_COLORS_DARK))
.extend(ThemeConfig::from(THEME_FLUENT_FONTS)),
))
// register_fluent_fonts(Theme::from_config(
// ThemeConfig::from(FLUENT_LIGHT_EXT)
// .extend(ThemeConfig::from(THEME_FLUENT)) // .extend(ThemeConfig::from(THEME_FLUENT))
// .extend(ThemeConfig::from(THEME_FLUENT_COLORS_DARK)) // .extend(ThemeConfig::from(THEME_FLUENT_COLORS_DARK))
// .extend(ThemeConfig::from(THEME_FLUENT_FONTS)), // .extend(ThemeConfig::from(THEME_FLUENT_FONTS)),
// )) }
// }
// fn theme_fluent_light() -> Theme {
// orbtk::widgets::themes::theme_fluent::register_fluent_fonts(Theme::from_config(
// ThemeConfig::from(FLUENT_LIGHT_EXT)
// .extend(ThemeConfig::from(THEME_FLUENT))
// .extend(ThemeConfig::from(THEME_FLUENT_COLORS_LIGHT))
// .extend(ThemeConfig::from(THEME_FLUENT_FONTS)),
// ))
// }
} else { } else {
/// Extend and register theme assets. /// Extend and register theme assets.
fn theme() -> Theme { fn theme() -> Theme {
orbtk::widgets::themes::theme_orbtk::register_default_fonts(Theme::from_config( register_default_fonts(Theme::from_config(
ThemeConfig::from(DEFAULT_DARK_EXT) ThemeConfig::from(DEFAULT_DARK_EXT)
.extend(ThemeConfig::from(THEME_DEFAULT)) .extend(ThemeConfig::from(THEME_DEFAULT))
.extend(ThemeConfig::from(THEME_DEFAULT_COLORS_DARK)) .extend(ThemeConfig::from(THEME_DEFAULT_COLORS_DARK))
@@ -151,78 +137,69 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// reference: https://tokio.rs/blog/2019-08-tracing/ // reference: https://tokio.rs/blog/2019-08-tracing/
let span = tracing::span!(Level::TRACE, "advotracker"); let span = tracing::span!(Level::TRACE, "advotracker");
let _enter = span.enter(); let _enter = span.enter();
let collector = fmt::Subscriber::builder() let subscriber = fmt::Subscriber::builder()
.with_env_filter(&rust_log) .with_env_filter(&rust_log)
//.with_max_level(tracing::Level::DEBUG) //.with_max_level(tracing::Level::DEBUG)
.finish(); .finish();
tracing::subscriber::with_default(collector, || { tracing::subscriber::with_default(subscriber, || {
// get system environment // get system environment
let get_lang = get_lang(); let lang = get_lang();
println!("get_lang returns: {:?}", get_lang);
let lang = Lang::De("");
println!("lang returns: {:?}", lang);
let mut state = t!(state_started => lang); let mut state = t!("state.started", lang);
let mut res = t!(parse_environment => lang); let mut res = t!("parse.environment", lang);
trace!(target: "advotracker", process = ?res, state = ?state); trace!(target: "advotracker", process = ?res, state = ?state);
trace!(target: "advotracker", environment = "system", lang = ?lang); trace!(target: "advotracker", environment = "system", lang = ?lang);
trace!(target: "advotracker", machine = ?&machine_kind); trace!(target: "advotracker", machine = ?&machine_kind);
// how to handle unimplemented lang resources?? // how to handle unimplemented lang resources??
res = t!(parse_environment => lang); res = t!("parse.environment", lang);
trace!(target: "advotracker", environment = "envy", lang = ?lang); trace!(target: "advotracker", environment = "envy", lang = ?lang);
state = t!(state_finished => lang); state = t!("state.finished", lang);
trace!(target: "advotracker", process = ?res, state = ?state); trace!(target: "advotracker", process = ?res, state = ?state);
// initialize viperus structure // initialize viperus structure
let mut viperus = Viperus::new(); let mut viperus = Viperus::new();
// parse commandline arguments // parse commandline arguments
res = t!(parse_arguments => lang); res = t!("parse.arguments", lang);
state = t!(state_started => lang); state = t!("state.started", lang);
trace!(target: "advotracker", process = ?res, state = ?state); trace!(target: "advotracker", process = ?res, state = ?state);
let _ = parse_args(&mut viperus); let _ = parse_args(&mut viperus);
state = t!(state_finished => lang); state = t!("state.finished", lang);
trace!(target: "advotracker", process = ?res, state = ?state); trace!(target: "advotracker", process = ?res, state = ?state);
// type conversion (viperus String -> u64) // type conversion (viperus String -> u64)
let test_policy_number = viperus let test_policy_number = viperus.get::<String>("test_policy_number").unwrap().parse::<u64>().unwrap();
.get::<String>("test_policy_number")
.unwrap()
.parse::<u64>()
.unwrap();
trace!(target: "advotracker", test_policy_number = ?test_policy_number); trace!(target: "advotracker", test_policy_number = ?test_policy_number);
// main tasks // main tasks
res = t!(main_started => lang); res = t!("main.started", lang);
state = t!(state_started => lang); state = t!("state.started", lang);
trace!(target: "advotracker", process = ?res, state = ?state); trace!(target: "advotracker", process = ?res, state = ?state);
// use this only if you want to run it as web application. // use this only if you want to run it as web application.
orbtk::initialize(); orbtk::initialize();
// Preset localization and language to "de_DE". // Preset localization and language from given environment.
// If the choosen language is not associated with a corresponding // if no dictionary is set for the chosen default language
// dictionary, the contents of the default text property will be // the content of the text property will be drawn.
// rendered. //let language = lang.substring(0,5); // "de_DE.UTF-8" -> "de_DE"
//info!("GUI-Language: preset to {:?}", language);
let localization = RonLocalization::create() let localization = RonLocalization::create()
.language("de_DE") .language(&lang)
.dictionary("de_DE", ADVOTRACKER_DE_DE) .dictionary("de_DE", ADVOTRACKER_DE_DE)
.build(); .build();
cfg_if! {
if #[cfg(windows)] {
Application::from_name("nwx.advotracker") Application::from_name("nwx.advotracker")
.localization(localization) .localization(localization)
.theme(theme()) .theme(theme())
//.theme(theme_fluent_light())
.window(|ctx| { .window(|ctx| {
Window::new() Window::new()
.title("AdvoTracker - DirectCall") .title("AdvoTracker - DirectCall")
.position((500.0, 100.0)) .position((500.0, 100.0))
.size(800.0, 620.0) .size(800.0, 600.0)
//.min_width(460.0) //.min_width(460.0)
//.min_height(380.0) //.min_height(380.0)
.resizeable(true) .resizeable(true)
@@ -230,27 +207,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.build(ctx) .build(ctx)
}) })
.run(); .run();
} else{
Application::from_name("nwx.advotracker")
.localization(localization)
.theme(theme())
.window(|ctx| {
Window::new()
.title("AdvoTracker - DirectCall")
.position((500.0, 100.0))
.size(800.0, 620.0)
//.min_width(460.0)
//.min_height(380.0)
.resizeable(true)
.child(main_view::MainView::new().build(ctx))
.build(ctx)
})
.run();
}
}
state = t!(state_finished => lang); state = t!("state.finished", lang);
res = t!(main_finished => lang); res = t!("main.finished", lang);
trace!(target: "advotracker", process = ?res, state = ?state); trace!(target: "advotracker", process = ?res, state = ?state);
}); });

View File

@@ -1,12 +1,14 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * 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 clap::{crate_authors, crate_description, crate_name, crate_version, App, Arg};
use directories::ProjectDirs;
//use log::{debug, info, trace, warn};
use std::env; use std::env;
use tracing::trace; use tracing::trace;
use viperus::Viperus; use viperus::Viperus;
@@ -14,24 +16,14 @@ use viperus::Viperus;
/// Parse the commandline arguments and preset default values /// Parse the commandline arguments and preset default values
/// Precedence: defaults -> config-file -> environment -> commandline /// Precedence: defaults -> config-file -> environment -> commandline
pub fn parse_args(viperus: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> { pub fn parse_args(viperus: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> {
if cfg!(feature = "parse_cli") { if cfg!(feature = "global") {
trace!(target: "Viperus", "Enabled parsing features."); trace!(target: "Viperus", "Viperus feature 'global' enabled.");
println!("Lasy static: 'VIPERUS' is accessible globaly");
} }
if let Some(proj_dirs) = ProjectDirs::from("de", "Networkx GmbH", "advotracker") { if cfg!(feature = "fmt-clap") {
proj_dirs.config_dir(); trace!(target: "Viperus", "Viperus feature 'fmt-clap' enabled.");
// Lin: $HOME/.config/advotracker println!("Using feature fmt-clap");
// Win: C:\Users\%USERNAME%\AppData\Roaming\Networkx GmbH\advotracker\config
// Mac: /Users/$USER/Library/Application Support/de.Networkx-GmbH.advotracker
trace!(target: "ProjectDirs", "Read from target-os defaults direcories.");
}
if let Some(proj_dirs) = ProjectDirs::from("de", "Networkx GmbH", "advotracker") {
proj_dirs.config_dir();
// Lin: $HOME/.config/advotracker
// Win: C:\Users\%USERNAME%\AppData\Roaming\Networkx GmbH\advotracker\config
// Mac: /Users/$USER/Library/Application Support/de.Networkx-GmbH.advotracker
trace!(target: "directories", config_dir = ?proj_dirs.config_dir().display());
} }
// preset default key/value pairs (lowest priority) // preset default key/value pairs (lowest priority)
@@ -39,14 +31,8 @@ pub fn parse_args(viperus: &mut Viperus) -> Result<(), Box<dyn std::error::Error
viperus.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt")); viperus.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt"));
viperus.add_default("export_file", String::from("")); viperus.add_default("export_file", String::from(""));
viperus.add_default("test_policy_number", String::from("9999999992")); viperus.add_default("test_policy_number", String::from("9999999992"));
viperus.add_default( viperus.add_default("to_email_address_file", String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>"));
"to_email_address_file", viperus.add_default("from_email_address_file", String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"));
String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>"),
);
viperus.add_default(
"from_email_address_file",
String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"),
);
//viperus.add_default("username", String::from("nctalkbot")); //viperus.add_default("username", String::from("nctalkbot"));
//viperus.add_default("password", String::from("botpassword")); //viperus.add_default("password", String::from("botpassword"));
viperus.add_default("verbose", 0); viperus.add_default("verbose", 0);
@@ -57,13 +43,11 @@ pub fn parse_args(viperus: &mut Viperus) -> Result<(), Box<dyn std::error::Error
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .author(crate_authors!())
.about(crate_description!()) .about(crate_description!())
.after_help( .after_help("
"
Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten
Direct-Call via IVR-System (Interactive Voice Response) Direct-Call via IVR-System (Interactive Voice Response)
SMR Deckungssummen-Prüfung: 089 92529 60211 SMR Deckungssummen-Prüfung: 089 92529 60211
SMR Unerledigt: 089 92529 60222", SMR Unerledigt: 089 92529 60222")
)
.template( .template(
"\ "\
{bin} v{version} {bin} v{version}
@@ -193,15 +177,11 @@ SMR Unerledigt: 089 92529 60222",
); );
println!( println!(
"to_email_address: {:?}", "to_email_address: {:?}",
viperus viperus.get::<String>("to_email_address").unwrap_or_default()
.get::<String>("to_email_address")
.unwrap_or_default()
); );
println!( println!(
"from_email_address: {:?}", "from_email_address: {:?}",
viperus viperus.get::<String>("from_email_address").unwrap_or_default()
.get::<String>("from_email_address")
.unwrap_or_default()
); );
println!( println!(
"test_policy_number: {:?}", "test_policy_number: {:?}",

View File

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

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// Send ticketdata via email /// Send ticketdata via email

View File

@@ -1,26 +1,27 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use lettre::{ use lettre::{
message::{header, MultiPart, SinglePart}, message::{header, MultiPart, SinglePart},
transport::smtp::authentication::Credentials,
Message, SmtpTransport, Transport, Message, SmtpTransport, Transport,
transport::smtp::authentication::Credentials,
}; };
use locales::t;
use maud::html; use maud::html;
use std::error::Error; use std::error::Error;
//use std::process; //use std::process;
use tracing::{info, trace}; use tracing::{info, error, trace};
use crate::{data::structures::Email, Lang}; use crate::data::structures::Email;
/// send ticket data via eMail /// send ticket data via eMail
pub fn sendticketdata(email: &Email, lang: &Lang) -> Result<(), Box<dyn Error>> { pub fn sendticketdata(email: &Email, lang: &str) -> Result<(), Box<dyn Error>> {
let mut res = t!(sendticketdata_export_started => lang); let mut res = t!("sendticketdata.export.started", lang);
let mut state = t!(state_started =>lang); let mut state = t!("state.started", lang);
trace!(target: "sendticketdata", process = ?res, state = ?state); trace!(target: "sendticketdata", process = ?res, state = ?state);
// The html we want to send. // The html we want to send.
@@ -32,102 +33,89 @@ pub fn sendticketdata(email: &Email, lang: &Lang) -> Result<(), Box<dyn Error>>
"h2, h4 { font-family: Arial, Helvetica, sans-serif; }" "h2, h4 { font-family: Arial, Helvetica, sans-serif; }"
} }
} }
div style="display: flex; flex-direction: column; align-items: left;" { div style="display: flex; flex-direction: column; align-items: center;" {
// compose with variables and strings // compose with variables and strings
h2 { (email.subject) " (" (email.policy_code) ")" } h2 { (email.subject) " (" (email.policy_code) ")" }
p { "Vers.-Schein/Schadennummer: " (email.policy_code) } p { "Vers.-Schein/Schadennummer: " (email.policy_code) }
p { "Versicherungsnehmer: " (email.policy_holder) } p { "Versicherungsnehmer: " (email.policy_holder) }
p { "Selbstbehalt: " (email.deductible) } p { "Selbstbehalt: "(email.deductible) }
p { "Rückrufnummer: " (email.callback_number) } p { "Rückrufnummer: " (email.callback_number) }
p { "Erreichbarkeit: " (email.callback_date) } p { "Erreichbarkeit: " (email.callback_date) }
p { "Rechtsproblem: " (email.harm_type) } p { "Rechtsproblem: "(email.harm_type) }
p { "Rechtsrat: " (email.ivr_comment) } p { "Rechtsrat: "(email.ivr_comment) }
} }
}; };
let ascii_body = String::new() let ascii_body = String::new()
+ &"Vers.-Schein/Schadennummer".to_string() + &"Vers.-Schein/Schadennummer".to_string() + &(email.policy_code) + &"\n"
+ &(email.policy_code) + &"Versicherungsnehmer: ".to_string() + &(email.policy_holder) + &"\n"
+ &"\n" + &"Selbstbehalt: ".to_string() + &(email.deductible) + &"\n"
+ &"Versicherungsnehmer: ".to_string() + &"Rückrufnummer: ".to_string()+ &(email.callback_number) + &"\n"
+ &(email.policy_holder) + &"Erreichbarkeit: ".to_string() + &(email.callback_date) + &"\n"
+ &"\n" + &"Rechtsproblem: ".to_string() + &(email.harm_type) + &"\n"
+ &"Selbstbehalt: ".to_string() + &"Rechtsrat: ".to_string() + &(email.ivr_comment) + &"\n";
+ &(email.deductible)
+ &"\n"
+ &"Rückrufnummer: ".to_string()
+ &(email.callback_number)
+ &"\n"
+ &"Erreichbarkeit: ".to_string()
+ &(email.callback_date)
+ &"\n"
+ &"Rechtsproblem: ".to_string()
+ &(email.harm_type)
+ &"\n"
+ &"Rechtsrat: ".to_string()
+ &(email.ivr_comment)
+ &"\n";
info!("email body: {:?}", ascii_body); info!("email body: {:?}", ascii_body);
let message = Message::builder() let message = Message::builder()
.from((email.mail_from).parse().unwrap()) //.reply_to("Kanzlei Hiedemann <info@hiedemann.de>".parse().unwrap())
.to("Kanzlei Hiedemann <info@hiedemann.de>".parse().unwrap())
.cc(" <ralf.zerres@networkx.de>".parse().unwrap())
.reply_to((email.mail_reply).parse().unwrap()) .reply_to((email.mail_reply).parse().unwrap())
.to((email.mail_to).parse().unwrap()) //.to((email.mail_to).parse().unwrap())
.cc((email.mail_cc).parse().unwrap()) //.cc((email.mail_cc).parse().unwrap())
// we do not use bcc yet
//.bcc((email.mail_bcc).parse().unwrap()) //.bcc((email.mail_bcc).parse().unwrap())
.subject( .from((email.mail_from).parse().unwrap())
String::new() .subject(String::new()
+ &email.subject.to_string() + &email.subject.to_string()
+ &" (".to_string() + &" (".to_string()
+ &email.policy_code.to_string() + &email.policy_code.to_string()
+ &")".to_string(), + &")".to_string()
) )
.multipart( .multipart(
MultiPart::alternative() // This is composed of two parts. MultiPart::alternative() // This is composed of two parts.
.singlepart( .singlepart(
SinglePart::builder() SinglePart::builder()
.header(header::ContentType::TEXT_PLAIN) .header(header::ContentType(
"text/plain; charset=utf8".parse().unwrap(),
))
.body(String::from(ascii_body)), .body(String::from(ascii_body)),
) )
.singlepart( .singlepart(
SinglePart::builder() SinglePart::builder()
.header(header::ContentType::TEXT_PLAIN) .header(header::ContentType(
"text/html; charset=utf8".parse().unwrap(),
))
.body(html.into_string()), .body(html.into_string()),
), ),
) )
.expect("failed to build email"); .expect("failed to build email");
info!("message: {:?}", message); info!("message: {:?}", message);
// Create credential for remote authentication (username, password) // Create credential for remote authentication (username, password)
// WIP: get credentials from config file / cli // WIP: get credentials from config file / cli
let credentials = Credentials::new( let creds = Credentials::new("info@kanzlei.hiedemann.de".to_string(), "17info67$".to_string());
"service@hiedemann.de".to_string(),
"88service99$".to_string(),
);
// standard smtp client connection
//let mailer = SmtpTransport::starttls_relay("hiedemannsbs.kanzlei.hiedemann.de")
// Open a remote connection to relay server (port 2525) // Open a remote connection to relay server (port 2525)
// WIP: get relay address from config file / cli // WIP: get relay address from config file / cli
//let relay = "hiedemannsbs.kanzlei.hiedemann.de" let mailer = SmtpTransport::relay("hiedemannsbs.kanzlei.hiedemann.de")
let relay = "smtp.strato.de";
let mailer = SmtpTransport::relay(relay)
.unwrap() .unwrap()
.credentials(credentials) .credentials(creds)
.build(); .build();
// Send the email
match mailer.send(&message) {
Ok(_) => info!("Email sent successfully!"),
Err(e) => error!("Could not send email: {:?}", e),
}
trace!(target: "sendticketdata", email = ?email); trace!(target: "sendticketdata", email = ?email);
state = t!("state.finished", lang);
// Send the email and catch the error if it isn't successfully res = t!("sendticketdata.export.finished", lang);
let _result = mailer.send(&message)?;
state = t!(state_finished => lang);
res = t!(sendticketdata_export_finished => lang);
trace!(target: "sendticketdata", process = ?res, state = ?state); trace!(target: "sendticketdata", process = ?res, state = ?state);
Ok(()) Ok(())

View File

@@ -1,46 +1,43 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use chrono::{DateTime, Local}; use chrono::{Local, DateTime};
use std::collections::HashMap; use locales::t;
use std::error::Error; use std::error::Error;
use std::collections::HashMap;
use std::time::{Duration, SystemTime}; use std::time::{Duration, SystemTime};
use tracing::trace; use tracing::trace;
//use crate::db::redis; //use crate::db::redis;
use crate::{ use crate::data::structures::{PolicyCode, PolicyDataList, PolicyData};
data::structures::{PolicyCode, PolicyData, PolicyDataList}, //use crate::data::structures::PolicyDataList;
Lang,
};
/// 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
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html /// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
/// https://blog.burntsushi.net/csv/ /// https://blog.burntsushi.net/csv/
pub fn import( pub fn import(p: &mut String, data_list: &mut PolicyDataList,
path: &mut String,
data_list: &mut PolicyDataList,
policy_numbers: &mut HashMap<u64, PolicyCode>, policy_numbers: &mut HashMap<u64, PolicyCode>,
policy_data_count: &mut u64, policy_data_count: &mut u64,
) -> Result<(u64, Duration), Box<dyn Error>> { lang: &str)
use std::ffi::OsStr; -> Result<(u64, Duration), Box<dyn Error>> {
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;
use std::ffi::OsStr;
let lang = Lang::De(""); let mut res = t!("csv.import.started", lang);
let mut res = t!(csv_import_started => lang); let mut state = t!("state.started", lang);
let mut state = t!(state_started => lang);
let time_start = SystemTime::now(); let time_start = SystemTime::now();
let datetime: DateTime<Local> = time_start.into(); let datetime: DateTime<Local> = time_start.into();
trace!(target: "csv-import", process = ?res, state = ?state, date_start = ?datetime.to_string()); trace!(target: "csv-import", process = ?res, state = ?state, date_start = ?datetime.to_string());
// Note: slash syntax also works on Windows! // Note: slash syntax also works on Windows!
let path = Path::new(path); let path = Path::new(p);
// must be a readable file // must be a readable file
trace!(target: "csv-import", path = ?path); trace!(target: "csv-import", path = ?path);
@@ -68,7 +65,7 @@ pub fn import(
} }
// Iterate over each record, deserialize und write to our structures // Iterate over each record, deserialize und write to our structures
let mut count: u64 = 0; let mut count : u64 = 0;
for result in csv_reader.deserialize() { for result in csv_reader.deserialize() {
// The iterator yields Result<StringRecord, Error>, so we check the // The iterator yields Result<StringRecord, Error>, so we check the
// error here. // error here.
@@ -84,18 +81,17 @@ pub fn import(
// push record as new vector elements // push record as new vector elements
data_list.push(record); data_list.push(record);
count += 1; count +=1;
*policy_data_count = count; *policy_data_count = count;
} };
let time_end = SystemTime::now(); let time_end = SystemTime::now();
let duration = time_end let duration = time_end.duration_since(time_start)
.duration_since(time_start)
.expect("Clock may have gone backwards"); .expect("Clock may have gone backwards");
trace!(target: "csv-import", record_count = ?count, duration = ?duration); trace!(target: "csv-import", record_count = ?count, duration = ?duration);
state = t!(state_finished => lang); state = t!("state.finished", lang);
res = t!(csv_import_finished => lang); res = t!("csv.import.finished", lang);
let datetime: DateTime<Local> = time_end.into(); let datetime: DateTime<Local> = time_end.into();
trace!(target: "csv-import", process = ?res, state = ?state, date_stop = ?datetime.to_string()); trace!(target: "csv-import", process = ?res, state = ?state, date_stop = ?datetime.to_string());
@@ -105,22 +101,18 @@ pub fn import(
#[test] #[test]
fn test_import() { fn test_import() {
// Takes a reference and returns Option<&V> // Takes a reference and returns Option<&V>
let my_policy_numbers: [u64; 2] = [1511111111, 9999999993]; let my_policy_numbers : [u64; 2] = [1511111111, 9999999993];
assert_eq!(my_policy_numbers, [1511111111, 9999999993]); assert_eq!(my_policy_numbers, [1511111111, 9999999993]);
let mut csv_import_path = String::from("data/POLLFNR_TEST.txt"); let mut csv_import_path = String::from("data/POLLFNR_TEST.txt");
let mut policy_data = PolicyDataList::new("PolicyDataList"); let mut policy_data = PolicyDataList::new("PolicyDataList");
let mut policy_numbers: HashMap<u64, PolicyCode> = HashMap::new(); let mut policy_numbers : HashMap<u64, PolicyCode> = HashMap::new();
let mut policy_data_count: u64 = 0; let mut policy_data_count: u64 = 0;
let lang = "en".to_string(); let lang = "en".to_string();
match import( match import(&mut csv_import_path, &mut policy_data,
&mut csv_import_path, &mut policy_numbers, &mut policy_data_count,
&mut policy_data, &lang) {
&mut policy_numbers,
&mut policy_data_count,
&lang,
) {
Ok((count, duration)) => { Ok((count, duration)) => {
println!("import {:?} records. Duration: {:?}", count, duration); println!("import {:?} records. Duration: {:?}", count, duration);
} }

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use std::error::Error; use std::error::Error;

View File

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

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// advotracker import modules /// advotracker import modules

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
@@ -14,16 +14,17 @@ use crate::widgets::configuration::configuration_view::ConfigurationView;
/// Valid `actions` that are handled as state changes in the `Configuration` widget. /// Valid `actions` that are handled as state changes in the `Configuration` widget.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum ConfigurationAction { pub enum ConfigurationAction {
/// Save configuration data
SaveConfiguration, SaveConfiguration,
/// Load configuration data
LoadConfiguration, LoadConfiguration,
} }
/// Define valid configuration data. /// Define valid configuration data.
/// This structure is serialized and saved inside the OS dependent settings file. /// This structure is serialized and saved inside the OS dependent settings file.
#[derive(Default, Debug, Clone, Serialize, Deserialize)] #[derive(Default, Debug, Clone, Serialize, Deserialize)]
struct ConfigurationData(pub String, pub String); struct ConfigurationData(
pub String,
pub String
);
/// Valid `structures` that are handled inside the state of the `Configuration` widget. /// Valid `structures` that are handled inside the state of the `Configuration` widget.
#[derive(Debug, Default, AsAny)] #[derive(Debug, Default, AsAny)]
@@ -42,17 +43,20 @@ impl State for ConfigurationState {
registry registry
.get::<Settings>("settings") .get::<Settings>("settings")
.load_async::<ConfigurationData>( .load_async::<ConfigurationData>(
"configuration_data".to_string(), "configuration_data".to_string(), ctx.entity()
ctx.entity(),
); );
} }
ConfigurationAction::SaveConfiguration => { ConfigurationAction::SaveConfiguration => {
let configuration_file: String = let configuration_file: String = ConfigurationView::configuration_file_clone(&ctx.widget());
ConfigurationView::configuration_file_clone(&ctx.widget());
let language_id: String = ConfigurationView::language_id_clone(&ctx.widget()); let language_id: String = ConfigurationView::language_id_clone(&ctx.widget());
registry.get::<Settings>("settings").save_async( registry
.get::<Settings>("settings")
.save_async(
"configuration_data".to_string(), "configuration_data".to_string(),
ConfigurationData(configuration_file, language_id), ConfigurationData(
configuration_file,
language_id
),
ctx.entity(), ctx.entity(),
); );
} }

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
@@ -14,11 +14,8 @@ use crate::{
// Macro that initializes the widget structures/variables for our view // Macro that initializes the widget structures/variables for our view
widget!( widget!(
/// Configuration View
ConfigurationView<ConfigurationState> { ConfigurationView<ConfigurationState> {
/// Configuration file
configuration_file: String, configuration_file: String,
/// Language identifier
language_id: String language_id: String
} }
); );
@@ -31,9 +28,13 @@ impl Template for ConfigurationView {
Grid::new() Grid::new()
.id(ID_CONFIGURATION_FORM) .id(ID_CONFIGURATION_FORM)
.style("configuration_form") .style("configuration_form")
.columns(Columns::create().push(120).push(12).push("auto")) .columns(
.rows( Columns::create()
Rows::create() .push(120)
.push(12)
.push("auto")
)
.rows(Rows::create()
.push("auto") // Header_Bar .push("auto") // Header_Bar
.push(4) // Seperator .push(4) // Seperator
.push("auto") // Configuartion_File .push("auto") // Configuartion_File
@@ -97,8 +98,15 @@ impl Template for ConfigurationView {
.attach(Grid::column(0)) .attach(Grid::column(0))
.attach(Grid::row(6)) .attach(Grid::row(6))
.attach(Grid::column_span(3)) .attach(Grid::column_span(3))
.columns(Columns::create().push("auto").push(8).push("auto")) .columns(
.rows(Rows::create().push("auto")) Columns::create()
.push("auto")
.push(8)
.push("auto")
)
.rows(Rows::create()
.push("auto")
)
.child( .child(
Button::new() Button::new()
.style("button_single_content") .style("button_single_content")

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// The configuration state /// The configuration state

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use dotenv::dotenv; use dotenv::dotenv;
@@ -13,7 +13,10 @@ use tracing::{info, trace};
use orbtk::prelude::*; use orbtk::prelude::*;
use crate::{data::constants::*, data::structures::PolicyList}; use crate::{
data::constants::*,
data::structures::PolicyList
};
/// define valid environment variables provided via .env files /// define valid environment variables provided via .env files
/// located in the current call directory /// located in the current call directory
@@ -26,24 +29,19 @@ struct Environment {
/// Provides generic methods to handle states of datatypes. /// Provides generic methods to handle states of datatypes.
pub trait GlobalState { pub trait GlobalState {
/// Get the lanuage identifier
fn get_lang() -> String { fn get_lang() -> String {
// get system environment // get system environment
let mut lang = env::var("LANG").unwrap_or_else(|_| "C".to_string()); let mut lang = env::var("LANG").unwrap_or_else(|_| "C".to_string());
lang = lang.substring(0, 5).to_string(); // "de_DE.UTF-8" -> "de_DE" lang = lang.substring(0,5).to_string(); // "de_DE.UTF-8" -> "de_DE"
info!("GUI-Language: preset to {:?}", lang); info!("GUI-Language: preset to {:?}", lang);
// testing environment: read from .env file // testing environment: read from .env file
dotenv().ok(); dotenv().ok();
match envy::from_env::<Environment>() { match envy::from_env::<Environment>() {
Ok(environment) => { Ok(environment) => {
if environment.test_lang != lang { if environment.test_lang != lang { lang = environment.test_lang; }
lang = environment.test_lang; },
} Err(e) => { info!(target: "advotracker", "{}", e) }
}
Err(e) => {
info!(target: "advotracker", "{}", e)
}
} }
trace!(target: "advotracker", lang = ?lang); trace!(target: "advotracker", lang = ?lang);

View File

@@ -1,24 +1,20 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
use tracing::info;
use crate::widgets::localization::localization_view::LocalizationView; use crate::widgets::localization::localization_view::LocalizationView;
/// Structure handling the localization status
#[derive(AsAny, Debug, Default)] #[derive(AsAny, Debug, Default)]
pub struct LocalizationState { pub struct LocalizationState {
/// Change the language boolean
change_language: bool, change_language: bool,
} }
impl LocalizationState { impl LocalizationState {
/// Change the active/selected language
pub fn change_language(&mut self) { pub fn change_language(&mut self) {
self.change_language = true; self.change_language = true;
} }
@@ -30,10 +26,8 @@ impl State for LocalizationState {
return; return;
} }
// get value of activ selected combo_box item
let index = *LocalizationView::selected_index_ref(&ctx.widget()) as usize; let index = *LocalizationView::selected_index_ref(&ctx.widget()) as usize;
let selected_language = LocalizationView::languages_ref(&ctx.widget())[index].clone(); let selected_language = LocalizationView::languages_ref(&ctx.widget())[index].clone();
info!("New selected language item: {:?}", selected_language);
match selected_language.as_str() { match selected_language.as_str() {
"English" => ctx.set_language("en_US"), "English" => ctx.set_language("en_US"),

View File

@@ -1,23 +1,22 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
use crate::{data::constants::*, widgets::localization::localization_state::LocalizationState}; use crate::{
data::constants::*,
widgets::localization::localization_state::LocalizationState,
};
type List = Vec<String>; type List = Vec<String>;
// Macro that initializes the widget structures/variables for our view // Macro that initializes the widget structures/variables for our view
widget!( widget!(LocalizationView<LocalizationState> {
/// Dialog to change active localization settings
LocalizationView<LocalizationState> {
/// The language list
languages: List, languages: List,
/// The selected language index
selected_index: i32 } selected_index: i32 }
); );
@@ -28,13 +27,19 @@ impl Template for LocalizationView {
let languages = vec!["English".to_string(), "German".to_string()]; let languages = vec!["English".to_string(), "German".to_string()];
let count = languages.len(); let count = languages.len();
self.languages(languages).selected_index(1).child( self.languages(languages)
.selected_index(1)
.child(
Grid::new() Grid::new()
.id(ID_LOCALIZATION_FORM) .id(ID_LOCALIZATION_FORM)
.margin(4) .margin(4)
.columns(Columns::create().push(120).push(12).push(150)) .columns(
.rows( Columns::create()
Rows::create() .push(120)
.push(12)
.push(150)
)
.rows(Rows::create()
.push("auto") .push("auto")
.push(4) .push(4)
.push("auto") .push("auto")
@@ -71,8 +76,9 @@ impl Template for LocalizationView {
.attach(Grid::column(2)) .attach(Grid::column(2))
.attach(Grid::row(2)) .attach(Grid::row(2))
.items_builder(move |bc, index| { .items_builder(move |bc, index| {
let text = let text = bc.get_widget(id)
bc.get_widget(id).get::<Vec<String>>("languages")[index].clone(); .get::<Vec<String>>("languages")[index]
.clone();
TextBlock::new() TextBlock::new()
.id(ID_LOCALIZATION_LANGUAGE_NAME) .id(ID_LOCALIZATION_LANGUAGE_NAME)
.v_align("center") .v_align("center")

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// The localization state /// The localization state

View File

@@ -1,38 +1,39 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::prelude::*; use orbtk::prelude::*;
use crate::{ use crate::{
data::{constants::*, structures::PolicyCheck}, data::{
constants::*,
structures::PolicyCheck,
},
widgets::configuration::configuration_view::ConfigurationView, widgets::configuration::configuration_view::ConfigurationView,
widgets::localization::localization_view::LocalizationView,
widgets::policycheck::policycheck_view::PolicycheckView, widgets::policycheck::policycheck_view::PolicycheckView,
widgets::localization::localization_view::LocalizationView,
//widgets::menu::menu_view::MenuView, //widgets::menu::menu_view::MenuView,
widgets::ticketdata::ticketdata_view::TicketdataView, widgets::ticketdata::ticketdata_view::TicketdataView,
}; };
// [START] view // [START] views
widget!( widget!(MainView {
/// The main view offering accessible forms
MainView {
// policy_list: PolicyList, // policy_list: PolicyList,
// policy_data_list: PolicyDataList, // policy_data_list: PolicyDataList,
// policylist_view: u32, // policylist_view: u32,
// policydata_view: u32, // policydata_view: u32,
/// The policycheck view policycheck_view: PolicyCheck
policycheck_view: PolicyCheck //ticketdata_view: TicketData //ticketdata_view: TicketData
} });
);
impl Template for MainView { impl Template for MainView {
fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self { fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let ticketdata_view = TicketdataView::new().build(ctx); let ticketdata_view = TicketdataView::new()
.build(ctx);
let policycheck_view = PolicycheckView::new() let policycheck_view = PolicycheckView::new()
.target(ticketdata_view.0) .target(ticketdata_view.0)

View File

@@ -1,12 +1,13 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use cfg_if::cfg_if; use cfg_if::cfg_if;
use orbtk::{prelude::*, shell::*, widgets::themes::*}; use orbtk::prelude::*;
use orbtk::shell::event::Key;
use tracing::{info, trace}; use tracing::{info, trace};
use std::process; use std::process;
@@ -20,30 +21,21 @@ use crate::{
/// Valid `actions` that are handled as state changes in the `Menu` widget. /// Valid `actions` that are handled as state changes in the `Menu` widget.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy)]
pub enum MenuAction { pub enum MenuAction {
/// Create a new menu
CreateMenu, CreateMenu,
/// Toggle between available menu themes
CreateMenuToggleTheme, CreateMenuToggleTheme,
/// Remove a menu entry
RemoveMenu, RemoveMenu,
/// Remove a menu toggle theme
RemoveMenuToggleTheme, RemoveMenuToggleTheme,
/// Set the active theme
SetTheme, SetTheme,
/// Update the relative position inside the menu UpdateMenuRelativePosition
UpdateMenuRelativePosition,
} }
/// Valid `structures` that are handled inside the state of the `Menu` widget. /// Valid `structures` that are handled inside the state of the `Menu` widget.
#[derive(AsAny, Default)] #[derive(AsAny, Default)]
pub struct MenuState { pub struct MenuState {
/// Define the menu action
action: Option<MenuAction>, action: Option<MenuAction>,
/// Define the menu entity
menu: Option<Entity>, menu: Option<Entity>,
//menu_toggle_theme: Option<Entity> //menu_toggle_theme: Option<Entity>
/// Entity-id of the toggled theme menu_toggle_theme: Entity
menu_toggle_theme: Entity,
} }
/// Method definitions, that react on any given state change inside the `Menu` widget. /// Method definitions, that react on any given state change inside the `Menu` widget.
@@ -116,9 +108,7 @@ impl State for MenuState {
// append the child to target (overlay stays on top of the main tree) // append the child to target (overlay stays on top of the main tree)
ctx.build_context() ctx.build_context()
.append_child_to_overlay(menu_popup) .append_child_to_overlay(menu_popup)
.expect( .expect("Failed create an overlay that consumes popup `menu` as its child.");
"Failed create an overlay that consumes popup `menu` as its child.",
);
self.menu = Some(menu_popup); self.menu = Some(menu_popup);
trace!(menu = ?self.menu); trace!(menu = ?self.menu);
@@ -126,10 +116,7 @@ impl State for MenuState {
// open: is the default // open: is the default
//ctx.get_widget(menu).set("open", true); //ctx.get_widget(menu).set("open", true);
info!( info!("CreateMenu: parent {:?}, target: {:?}, popup: {:?}", parent, target, self.menu);
"CreateMenu: parent {:?}, target: {:?}, popup: {:?}",
parent, target, self.menu
);
} }
MenuAction::SetTheme => { MenuAction::SetTheme => {
@@ -138,18 +125,18 @@ impl State for MenuState {
cfg_if! { cfg_if! {
if #[cfg(windows)] { if #[cfg(windows)] {
match theme_index { match theme_index {
0 => ctx.switch_theme(Rc::new(theme_default_dark())), 0 => ctx.switch_theme(theme_default_dark()),
1 => ctx.switch_theme(Rc::new(theme_default_light())), 1 => ctx.switch_theme(theme_default_light()),
2 => ctx.switch_theme(Rc::new(theme_redox())), 2 => ctx.switch_theme(theme_redox()),
3 => ctx.switch_theme(Rc::new(theme_fluent_dark())), 3 => ctx.switch_theme(theme_fluent_dark()),
4 => ctx.switch_theme(Rc::new(theme_fluent_light())), 4 => ctx.switch_theme(theme_fluent_light()),
_ => {} _ => {}
} }
} else { } else {
match theme_index { match theme_index {
0 => ctx.switch_theme(Rc::new(theme_default_dark())), 0 => ctx.switch_theme(theme_default_dark()),
1 => ctx.switch_theme(Rc::new(theme_default_light())), 1 => ctx.switch_theme(theme_default_light()),
2 => ctx.switch_theme(Rc::new(theme_redox())), 2 => ctx.switch_theme(theme_redox()),
_ => {} _ => {}
} }
} }
@@ -165,26 +152,21 @@ impl State for MenuState {
if let Some(action) = self.action { if let Some(action) = self.action {
match action { match action {
MenuAction::CreateMenuToggleTheme => { MenuAction::CreateMenuToggleTheme => {
let menu_target = ctx.entity_of_child(ID_MENU_LABEL_TOGGLE_THEME).expect( let menu_target = ctx
"MenuState: Can't find entity of resource 'ID_MENU_LABEL_TOGGLE_THEME'.", .entity_of_child(ID_MENU_LABEL_TOGGLE_THEME)
); .expect("MenuState: Can't find entity of resource 'ID_MENU_LABEL_TOGGLE_THEME'.");
let current_entity = ctx.entity(); let current_entity = ctx.entity();
let build_context = &mut ctx.build_context(); let build_context = &mut ctx.build_context();
// create a new menu popup // create a new menu popup
self.menu_toggle_theme = self.menu_toggle_theme = create_menu_toggle_theme_popup(current_entity, build_context);
create_menu_toggle_theme_popup(current_entity, build_context);
// create a menu_popup widget as a child of entity "ID_POPUP_MENU" // create a menu_popup widget as a child of entity "ID_POPUP_MENU"
build_context.append_child(menu_target, self.menu_toggle_theme); build_context.append_child(menu_target, self.menu_toggle_theme);
ctx.get_widget(self.menu_toggle_theme) ctx.get_widget(self.menu_toggle_theme).clone::<Visibility>("visibility");
.clone::<Visibility>("visibility");
println!( println!("Popup Menu Toggle Theme created: {:?}", self.menu_toggle_theme);
"Popup Menu Toggle Theme created: {:?}",
self.menu_toggle_theme
);
} }
MenuAction::RemoveMenu => { MenuAction::RemoveMenu => {
self.remove_menu(ctx); self.remove_menu(ctx);
@@ -236,22 +218,23 @@ fn create_menu_popup(target: Entity, ctx: &mut BuildContext<'_>) -> Entity {
//.style("popup_menu") //.style("popup_menu")
.width(300.0) .width(300.0)
.height(100.0) .height(100.0)
.on_key_down(move |ctx, key_event| {
.on_key_down(move | ctx, key_event | {
match key_event.key { match key_event.key {
Key::Q(..) => { Key::Q(..) => {
//if is_ctrl_home_down(ctx) //if is_ctrl_home_down(ctx)
println!("KeyHandler: got Ctrl+Q"); println!("KeyHandler: got Ctrl+Q");
process::exit(0); process::exit(0);
//} //}
} },
Key::Escape => { Key::Escape => {
println!("KeyHandler: got Escape"); println!("KeyHandler: got Escape");
ctx.get_mut::<MenuState>(target) ctx.get_mut::<MenuState>(target)
.set_action(MenuAction::RemoveMenu); .set_action(MenuAction::RemoveMenu);
} },
_ => { _ => {
println!("KeyHandler: got {:?}", key_event.key); println!("KeyHandler: got {:?}", key_event.key);
} },
}; };
true true
}) })
@@ -275,9 +258,14 @@ fn create_menu_popup(target: Entity, ctx: &mut BuildContext<'_>) -> Entity {
Columns::create() Columns::create()
.push("180") // Menu Button .push("180") // Menu Button
.push("1") // Seperator .push("1") // Seperator
.push("auto"), // Keyboard Shortcut .push("auto") // Keyboard Shortcut
)
.rows(
Rows::create()
.push("auto")
.push("auto")
.push("auto")
) )
.rows(Rows::create().push("auto").push("auto").push("auto"))
.child( .child(
Button::new() Button::new()
.id(ID_MENU_LABEL_ACCOUNT) .id(ID_MENU_LABEL_ACCOUNT)
@@ -343,6 +331,7 @@ fn create_menu_popup(target: Entity, ctx: &mut BuildContext<'_>) -> Entity {
.build(ctx) .build(ctx)
} }
fn _create_popup(target: Entity, text: &str, ctx: &mut BuildContext<'_>) -> Entity { fn _create_popup(target: Entity, text: &str, ctx: &mut BuildContext<'_>) -> Entity {
Popup::new() Popup::new()
.id("test_popup") .id("test_popup")
@@ -371,6 +360,8 @@ fn _create_popup(target: Entity, text: &str, ctx: &mut BuildContext<'_>) -> Enti
.build(ctx) .build(ctx)
} }
/// Create a new popup submenu to toogle the active theme /// Create a new popup submenu to toogle the active theme
fn create_menu_toggle_theme_popup(id: Entity, ctx: &mut BuildContext<'_>) -> Entity { fn create_menu_toggle_theme_popup(id: Entity, ctx: &mut BuildContext<'_>) -> Entity {
cfg_if! { cfg_if! {
@@ -401,16 +392,16 @@ fn create_menu_toggle_theme_popup(id: Entity, ctx: &mut BuildContext<'_>) -> Ent
.style("container_menu") .style("container_menu")
.width(280) .width(280)
.height(140) .height(140)
.on_key_down(move |_ctx, key_event| { .on_key_down(move | _ctx, key_event | {
match key_event.key { match key_event.key {
Key::Escape => { Key::Escape => {
println!("KeyHandler: got Escape"); println!("KeyHandler: got Escape");
//ctx.get_mut::<MenuState>(id) //ctx.get_mut::<MenuState>(id)
// .set_action(MenuAction::RemoveMenuToggleTheme); // .set_action(MenuAction::RemoveMenuToggleTheme);
} },
_ => { _ => {
println!("KeyHandler: got {:?}", key_event.key); println!("KeyHandler: got {:?}", key_event.key);
} },
}; };
true true
}) })
@@ -421,11 +412,9 @@ fn create_menu_toggle_theme_popup(id: Entity, ctx: &mut BuildContext<'_>) -> Ent
.count(themes_count) .count(themes_count)
.style("combo_box_form") .style("combo_box_form")
.items_builder(move |ctx, index| { .items_builder(move |ctx, index| {
let theme_name = MenuView::themes_ref(&ctx.get_widget(id))[index].clone(); let theme_name =
TextBlock::new() MenuView::themes_ref(&ctx.get_widget(id))[index].clone();
.v_align("center") TextBlock::new().v_align("center").text(theme_name).build(ctx)
.text(theme_name)
.build(ctx)
}) })
.on_changed("selected_index", move |states, _entity| { .on_changed("selected_index", move |states, _entity| {
states.send_message(MenuAction::SetTheme, id); states.send_message(MenuAction::SetTheme, id);

View File

@@ -1,11 +1,11 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::{prelude::*, widgets::themes::*}; use orbtk::prelude::*;
use crate::data::constants::*; use crate::data::constants::*;
use crate::widgets::menu::menu_state::{MenuAction, MenuState}; use crate::widgets::menu::menu_state::{MenuAction, MenuState};
@@ -14,13 +14,10 @@ type List = Vec<String>;
// Macro that initializes the widget structures/variables for the menu view // Macro that initializes the widget structures/variables for the menu view
widget!( widget!(
/// Present and handle the menu items
MenuView<MenuState> { MenuView<MenuState> {
//menu_stack: Entity, //menu_stack: Entity,
//button_menu: Entity, //button_menu: Entity,
/// The selected menu index
selected_index: i32, selected_index: i32,
/// The supported themes list
themes: List themes: List
} }
); );
@@ -38,8 +35,7 @@ impl Template for MenuView {
.v_align("end") .v_align("end")
.child( .child(
Container::new() Container::new()
.child( .child( Container::new()
Container::new()
.margin((0, 16, 16, 0)) .margin((0, 16, 16, 0))
.v_align("center") .v_align("center")
.child( .child(
@@ -61,7 +57,7 @@ impl Template for MenuView {
TextBlock::new() TextBlock::new()
.margin((0, 9, 48, 0)) .margin((0, 9, 48, 0))
.text("©Networkx GmbH") .text("©Networkx GmbH")
.build(ctx), .build(ctx)
) )
.build(ctx), .build(ctx),
) )
@@ -105,22 +101,24 @@ impl Template for MenuView {
.build(ctx); .build(ctx);
//self.themes(themes).child(MenuState::create_menu(ID_MENU_POPUP, ctx)) //self.themes(themes).child(MenuState::create_menu(ID_MENU_POPUP, ctx))
self.name("MenuView").child( self.name("MenuView")
.child(
Grid::new() Grid::new()
.id(ID_MENU_VIEW) .id(ID_MENU_VIEW)
.columns( .columns(
Columns::create() Columns::create()
.push(50) // Left margin .push(50) // Left margin
.push("*") // Content .push("*") // Content
.push(50), // Right margin .push(50) // Right margin
) )
.rows( .rows(
Rows::create() Rows::create()
.push("auto") // Header_Bar .push("auto") // Header_Bar
.push(28) // Seperator .push(28) // Seperator
.push("*") // InputForm .push("*") // InputForm
.push("auto"), // Bottom_Bar .push("auto") // Bottom_Bar
) )
.child(menu_header_bar) // Row 0 .child(menu_header_bar) // Row 0
.child(menu_bottom_bar) // Row 3 .child(menu_bottom_bar) // Row 3
.build(ctx), .build(ctx),

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// The menu view /// The menu view

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// Configuration widget. /// Configuration widget.

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// The policy check state /// The policy check state

View File

@@ -1,22 +1,23 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::{prelude::*, widgets::themes::*}; use locales::t;
use orbtk::prelude::*;
use serde::Deserialize; use serde::Deserialize;
use std::collections::HashMap;
use std::process; use std::process;
use std::collections::HashMap;
use std::time::{Duration, SystemTime}; use std::time::{Duration, SystemTime};
use tracing::{error, info, trace}; use tracing::{error, info, trace};
use crate::{ use crate::{
data::{ data::{
constants::*,
structures::{PolicyCode, PolicyDataList, PolicyList}, structures::{PolicyCode, PolicyDataList, PolicyList},
constants::*,
}, },
//services::imports::allianzdirectcall::import, //services::imports::allianzdirectcall::import,
services::imports::allianzdirectcall, services::imports::allianzdirectcall,
@@ -24,51 +25,31 @@ use crate::{
//widgets::menu::menu_view::MenuView, //widgets::menu::menu_view::MenuView,
//widgets::policycheck::policycheck_view::PolicycheckView, //widgets::policycheck::policycheck_view::PolicycheckView,
//widgets::ticketdata::ticketdata_state::TicketdataAction, //widgets::ticketdata::ticketdata_state::TicketdataAction,
Lang,
}; };
/// Enumeration of valid `action variants` that need to be handled as /// Enumeration of valid `action variants` that need to be handled as
/// state changes for the `PolicycheckView` widget. /// state changes for the `PolicycheckView` widget.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum PolicycheckAction { pub enum PolicycheckAction {
/// Clear the policy number ClearEntry(Entity),
ClearPolicyNumber,
/// Change the active theme
ChangeTheme(), ChangeTheme(),
/// Send the policy number
SendPolicynumber(), SendPolicynumber(),
/// Entity of the changed input text
InputTextChanged(Entity), InputTextChanged(Entity),
/// Import data to the form
ImportData, ImportData,
/// Create a new ticket
NewTicket, NewTicket,
/// Entity-id of the policy number to parse
ParsePolicyNumber(Entity), ParsePolicyNumber(Entity),
/// Remove the focus of current entity
RemoveFocus(Entity), RemoveFocus(Entity),
/// Entity-id of popup to bo removed
RemovePopup(Entity), RemovePopup(Entity),
/// Reset the progress status
ResetProgress, ResetProgress,
/// Get progress status
GetProgress, GetProgress,
/// Set the progress status to given value
SetProgress(f64), SetProgress(f64),
/// Set the progress popup to given entity-id
SetProgressPopup(Entity), SetProgressPopup(Entity),
/// Set the entitiy-id for theme to be toggled to
SetToggleTheme(Entity), SetToggleTheme(Entity),
/// Set the given entity-id
SetEntry(Entity), SetEntry(Entity),
/// Set visibility status of given entity-id
SetVisibility(Entity), SetVisibility(Entity),
/// Set changed status of given text entity-id
TextChanged(Entity, usize), TextChanged(Entity, usize),
/// Update the given policy code
UpdatePolicyCode, UpdatePolicyCode,
/// Update the process status to given value UpdateProgress(f64)
UpdateProgress(f64),
} }
/// Define valid environment variables provided via .env files /// Define valid environment variables provided via .env files
@@ -87,7 +68,7 @@ pub struct PolicycheckState {
button_menu: Entity, button_menu: Entity,
duration: Duration, duration: Duration,
label_result: Entity, label_result: Entity,
lang: Lang, lang: String,
policy_data_count: u64, policy_data_count: u64,
//policy_number: Entity, //policy_number: Entity,
policy_numbers: HashMap<u64, PolicyCode>, policy_numbers: HashMap<u64, PolicyCode>,
@@ -96,7 +77,7 @@ pub struct PolicycheckState {
progress_popup: Entity, progress_popup: Entity,
// target that recieves messages // target that recieves messages
target: Entity, target: Entity,
ticketdata_view: Entity, ticketdata: Entity
} }
impl GlobalState for PolicycheckState {} impl GlobalState for PolicycheckState {}
@@ -104,31 +85,26 @@ impl GlobalState for PolicycheckState {}
/// Method definitions, that react on any given state change inside the `Policycheck` widget. /// Method definitions, that react on any given state change inside the `Policycheck` widget.
impl PolicycheckState { impl PolicycheckState {
/// Create a hashmap (key: policy number, value: policy type). /// Create a hashmap (key: policy number, value: policy type).
pub fn create_hashmap( pub fn create_hashmap(&mut self, _ctx: &mut Context<'_>)
&mut self, -> Result<(), Box<dyn std::error::Error>> {
_ctx: &mut Context<'_>,
) -> Result<(), Box<dyn std::error::Error>> {
trace!(target: "advotracker", create_hashmap = "started"); trace!(target: "advotracker", create_hashmap = "started");
let policy_list = PolicyList::new("policy list"); let policy_list = PolicyList::new("policy list");
trace!(target: "advotracker", policy_list = ?policy_list); trace!(target: "advotracker", policy_list = ?policy_list);
// create vector to hold imported data // create vector to hold imported data
let res = t!(policy_string_label_policy_data => self.lang); let res = t!("policy.string.label_policy_data", self.lang);
let mut policy_data = PolicyDataList::new(res); let mut policy_data = PolicyDataList::new(res);
trace!(target: "advotracker", policy_data = ?policy_data); trace!(target: "advotracker", policy_data = ?policy_data);
let mut policy_numbers: HashMap<u64, PolicyCode> = HashMap::new(); let mut policy_numbers : HashMap<u64, PolicyCode> = HashMap::new();
// Wip: use cli parameter stored in viperus ... // Wip: use cli parameter stored in viperus ...
//let mut csv_import_path = v.get::<String>("import_file").unwrap(); //let mut csv_import_path = v.get::<String>("import_file").unwrap();
let mut csv_import_path = String::from("POLLFNR_WOECHENTLICH.txt"); let mut csv_import_path = String::from("POLLFNR_WOECHENTLICH.txt");
match allianzdirectcall::import( match allianzdirectcall::import(&mut csv_import_path, &mut policy_data,
&mut csv_import_path, &mut policy_numbers, &mut self.policy_data_count,
&mut policy_data, &self.lang) {
&mut policy_numbers,
&mut self.policy_data_count,
) {
Ok((count, duration)) => { Ok((count, duration)) => {
self.policy_data_count = count; self.policy_data_count = count;
self.duration = duration; self.duration = duration;
@@ -150,27 +126,13 @@ impl PolicycheckState {
} }
/// Clear text in text box. /// Clear text in text box.
pub fn clear_policy_number(&mut self, ctx: &mut Context<'_>) { pub fn clear_entry(&mut self, _text_box: Entity, ctx: &mut Context<'_>) {
TextBox::text_set( TextBox::text_set(&mut ctx.widget(), String::from(""));
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), }
String::from(""),
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
Visibility::Collapsed,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
Visibility::Collapsed,
);
Stack::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_ACTION_STACK),
Visibility::Collapsed,
);
}
/// Import policy numbers into hashmap /// Import policy numbers into hashmap
fn import_data(&mut self, ctx: &mut Context<'_>) -> Result<(), Box<dyn std::error::Error>> { fn import_data(&mut self, ctx: &mut Context<'_>)
-> Result<(), Box<dyn std::error::Error>> {
// WIP: for now, only import once per session // WIP: for now, only import once per session
if self.policy_data_count == 0 { if self.policy_data_count == 0 {
TextBlock::enabled_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), true); TextBlock::enabled_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), true);
@@ -184,16 +146,13 @@ impl PolicycheckState {
for _ in 1..4 { for _ in 1..4 {
self.progress_count += 0.33; self.progress_count += 0.33;
self.update_progress_bar(ctx); self.update_progress_bar(ctx);
ctx.send_message( ctx.send_message(PolicycheckAction::UpdateProgress(self.progress_count), self.progress_popup);
PolicycheckAction::UpdateProgress(self.progress_count),
self.progress_popup,
);
} }
// importing policy code elements from csv-file // importing policy code elements from csv-file
match self.create_hashmap(ctx) { match self.create_hashmap(ctx) {
Ok(()) => { Ok(()) => {
let res = t!(policy_hashmap_success => self.lang); let res = t!("policy.hashmap.success", self.lang);
info!("hashmap has: {:?} entries", self.policy_data_count); info!("hashmap has: {:?} entries", self.policy_data_count);
trace!(target: "advotracker", trace!(target: "advotracker",
hashmap_status = ?res, hashmap_status = ?res,
@@ -201,9 +160,10 @@ impl PolicycheckState {
self.progress_count = 1.; self.progress_count = 1.;
self.update_progress_bar(ctx); self.update_progress_bar(ctx);
} }
_ => { _ => {
let res = t!(policy_hashmap_failed => self.lang); let res = t!("policy.hashmap.failed", self.lang);
error!("{:?}", res); error!("{:?}", res);
trace!(target: "advotracker", hashmap_status = ?res); trace!(target: "advotracker", hashmap_status = ?res);
} }
@@ -219,15 +179,16 @@ impl PolicycheckState {
} }
/// Create new ticket /// Create new ticket
pub fn new_ticket(&mut self, _ctx: &mut Context<'_>) { pub fn new_ticket(&mut self, ctx: &mut Context<'_>) {
println!("WIP: new ticket."); println!("WIP: new ticket.");
self.ticketdata_view.0; self(ticketdata_view.0);
//ctx.widget().get_mut::<TicketdataView>(0). //ctx.widget().get_mut::<TicketdataView>(0).
//ctx.get_widget(self.ticketdata_view); //ctx.get_widget(self.ticketdata_view);
} }
/// Parse validity of the given policy number. /// Parse validity of the given policy number.
pub fn parse_entry(&mut self, policy_check_policy_number: Entity, ctx: &mut Context<'_>) { pub fn parse_entry(&mut self, policy_check_policy_number: Entity,
ctx: &mut Context<'_>) {
trace!(target: "advotracker", parse_entry = "started"); trace!(target: "advotracker", parse_entry = "started");
let policy_number_string = TextBox::text_clone(&ctx.get_widget(policy_check_policy_number)); let policy_number_string = TextBox::text_clone(&ctx.get_widget(policy_check_policy_number));
@@ -238,20 +199,12 @@ impl PolicycheckState {
match self.import_data(ctx) { match self.import_data(ctx) {
Ok(()) => { Ok(()) => {
trace!(target: "advotracker", policycheck_state = "init", import_data = "success"); trace!(target: "advotracker", policycheck_state = "init", import_data = "success");
Stack::visibility_set( Stack::visibility_set(&mut ctx.child(ID_POLICY_DATA_STACK), Visibility::Visible);
&mut ctx.child(ID_POLICY_DATA_STACK),
Visibility::Visible,
);
let policy_data_count_string = format!("{:?}", &self.policy_data_count); let policy_data_count_string = format!("{:?}", &self.policy_data_count);
TextBlock::text_set( TextBlock::text_set(&mut ctx.child(ID_POLICY_DATA_COUNT), String::from(&policy_data_count_string));
&mut ctx.child(ID_POLICY_DATA_COUNT), },
String::from(&policy_data_count_string),
);
}
Err(e) => { Err(e) => trace!(target: "advotracker", policycheck_state = "init", import_data = ?e),
trace!(target: "advotracker", policycheck_state = "init", import_data = ?e)
}
} }
} }
@@ -260,23 +213,13 @@ impl PolicycheckState {
// Parse policy code: "AS-123456789" // Parse policy code: "AS-123456789"
// DION VERS POLLFNR // DION VERS POLLFNR
// 1 AS 1515735810 // 1 AS 1515735810
Stack::visibility_set( Button::background_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("transparent"));
&mut ctx.child(ID_POLICY_CHECK_ACTION_STACK),
Visibility::Collapsed,
);
Button::background_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
String::from("transparent"),
);
if policy_number_length == 10 { if policy_number_length == 10 {
// cast policy_number_sting to <u64> // cast policy_number_sting to <u64>
match policy_number_string.parse::<u64>() { match policy_number_string.parse::<u64>() {
Ok(p) => { Ok(p) => {
TextBlock::text_set( TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), String::from(""));
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
String::from(""),
);
// match hashmap's key // match hashmap's key
match self.policy_numbers.get(&p) { match self.policy_numbers.get(&p) {
@@ -285,259 +228,99 @@ impl PolicycheckState {
trace!(target: "advotracker", state = "success", trace!(target: "advotracker", state = "success",
policy_number = ?p, policy_code = ?policy_code); policy_number = ?p, policy_code = ?policy_code);
let string_result = format!("1-{:?}-{}", policy_code, p); let string_result = format!("1-{:?}-{}",
policy_code, p);
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), string_result);
TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#008000"));
// adapt the view properties Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#008000"));
TextBlock::text_set( Button::foreground_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#008000"));
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CHECK);
string_result, Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
);
TextBox::foreground_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER),
String::from("#008000"),
);
Button::icon_brush_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Visible);
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Visible);
String::from("#008000"), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Collapsed);
); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Collapsed);
Button::foreground_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
String::from("#008000"),
);
Button::icon_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
material_icons_font::MD_CHECK,
);
Button::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
Visibility::Visible,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
Visibility::Visible,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
Visibility::Visible,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_HINT),
Visibility::Collapsed,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT),
Visibility::Collapsed,
);
Stack::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_ACTION_STACK),
Visibility::Visible,
);
Button::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_ACTION_BUTTON_CLEAR),
Visibility::Visible,
);
} }
_ => { _ => {
// no matching key // no matching key
let res = t!(policy_validation_failed => self.lang); let res = t!("policy.validation.failed", self.lang);
trace!(target: "advotracker", state = ?res, policy_number = ?p); trace!(target: "advotracker", state = ?res, policy_number = ?p);
TextBox::foreground_set( TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#FF0000"));
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_HINT), String::from("The given policy number is invalid"));
String::from("#FF0000"),
);
TextBlock::text_set(
&mut ctx.child(ID_POLICY_CHECK_HINT),
String::from("The given policy number is invalid"),
);
Button::icon_brush_set( Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Button::foreground_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
String::from("#FF0000"), Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR);
); Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Button::foreground_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
String::from("#FF0000"),
);
Button::icon_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
material_icons_font::MD_CLEAR,
);
Button::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
Visibility::Visible,
);
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
Visibility::Collapsed, TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
Visibility::Collapsed,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_HINT),
Visibility::Visible,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT),
Visibility::Visible,
);
}
} }
} }
},
Err(e) => { Err(e) => {
trace!(target: "advotracker", state = "error", error_type = "invalid type", error = ?e); trace!(target: "advotracker", state = "error", error_type = "invalid type", error = ?e);
TextBox::foreground_set( TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#FF0000"));
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER),
String::from("#FF0000"),
);
TextBlock::text_set( TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_HINT), String::from("Only numbers are valid"));
&mut ctx.child(ID_POLICY_CHECK_HINT),
String::from("Only numbers are valid"),
);
Button::icon_brush_set( Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Button::foreground_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
String::from("#FF0000"), Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR);
); Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Button::foreground_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
String::from("#FF0000"),
);
Button::icon_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
material_icons_font::MD_CLEAR,
);
Button::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
Visibility::Visible,
);
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
Visibility::Collapsed, TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
Visibility::Collapsed,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_HINT),
Visibility::Visible,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT),
Visibility::Visible,
);
} }
} }
} }
if policy_number_length < 10 { if policy_number_length < 10 {
let res = t!(policy_validation_failed => self.lang); let res = t!("policy.validation.failed", self.lang);
trace!(target: "advotracker", state = ?res, reason = "number to short"); trace!(target: "advotracker", state = ?res, reason = "number to short");
TextBox::foreground_set( TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#FF0000"));
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER),
String::from("#FF0000"),
);
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT),
Visibility::Visible,
);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
TextBlock::text_set( TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_HINT), String::from("Policy number is to short"));
&mut ctx.child(ID_POLICY_CHECK_HINT),
String::from("Policy number is to short"),
);
Button::icon_brush_set( Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Button::foreground_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
String::from("#FF0000"), Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR);
); Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Button::foreground_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
String::from("#FF0000"),
);
Button::icon_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
material_icons_font::MD_CLEAR,
);
Button::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
Visibility::Visible,
);
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
Visibility::Collapsed,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
Visibility::Collapsed,
);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT),
Visibility::Visible,
);
} }
if policy_number_length > 10 { if policy_number_length > 10 {
let res = t!(policy_validation_failed => self.lang); let res = t!("policy.validation.failed", self.lang);
trace!(target: "advotracker", state = ?res, reason = "number to long"); trace!(target: "advotracker", state = ?res, reason = "number to long");
TextBox::foreground_set( TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#FF0000"));
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER),
String::from("#FF0000"),
);
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_HINT), String::from("Policy number is to long"));
Visibility::Visible,
);
TextBlock::text_set(
&mut ctx.child(ID_POLICY_CHECK_HINT),
String::from("Policy number is to long"),
);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
Button::icon_brush_set( Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Button::foreground_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
String::from("#FF0000"), Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR);
); Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Button::foreground_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
String::from("#FF0000"),
);
Button::icon_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
material_icons_font::MD_CLEAR,
);
Button::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
Visibility::Visible,
);
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
Visibility::Collapsed,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
Visibility::Collapsed,
);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT),
Visibility::Visible,
);
} }
trace!(target: "advotracker", parse_entry = "finished"); trace!(target: "advotracker", parse_entry = "finished");
@@ -545,8 +328,7 @@ impl PolicycheckState {
/// parse message 'ParseEntry' /// parse message 'ParseEntry'
pub fn parse_policy_number(&mut self, entity: Entity) { pub fn parse_policy_number(&mut self, entity: Entity) {
self.actions self.actions.push(PolicycheckAction::ParsePolicyNumber(entity));
.push(PolicycheckAction::ParsePolicyNumber(entity));
} }
/// Remove the popup box /// Remove the popup box
@@ -580,95 +362,59 @@ impl PolicycheckState {
/// Change status of given text box to edit mode. /// Change status of given text box to edit mode.
fn set_entry(&mut self, text_box: Entity, ctx: &mut Context<'_>) { fn set_entry(&mut self, text_box: Entity, ctx: &mut Context<'_>) {
if ctx.get_widget(text_box).get::<String16>("text").is_empty() { if ctx.get_widget(text_box).get::<String16>("text").is_empty() {
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
Visibility::Collapsed,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
Visibility::Collapsed,
);
} else { } else {
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Visible);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Visible);
Visibility::Visible,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
Visibility::Visible,
);
} }
} }
/// Set a progress popup that updates the import status in a progress bar /// Set a progress popup that updates the import status in a progress bar
fn set_popup_progress(&mut self, ctx: &mut Context<'_>) { fn set_popup_progress(&mut self, ctx: &mut Context<'_>) {
// create a stack as a child of entity "ID_POLICY_CHECK_POLICY_NUMBER" // create a stack as a child of entity "ID_POLICY_CHECK_POLICY_NUMBER"
let stack = ctx.entity_of_child(ID_POLICY_CHECK_POLICY_NUMBER).expect( let stack = ctx
"PolicycheckState: Can't find entity of resource 'ID_POLICY_CHECK_POLICY_NUMBER'.", .entity_of_child(ID_POLICY_CHECK_POLICY_NUMBER)
); .expect("PolicycheckState: Can't find entity of resource 'ID_POLICY_CHECK_POLICY_NUMBER'.");
let current_entity = ctx.entity(); let current_entity = ctx.entity();
let build_context = &mut ctx.build_context(); let build_context = &mut ctx.build_context();
// create the progress_popup widget // create the progress_popup widget
self.progress_popup = create_popup_progress(current_entity, build_context); self.progress_popup = create_popup_progress(current_entity, build_context);
info!( info!("set_popup_progress: New entity 'popup_progress' {:?} created", self.progress_popup);
"set_popup_progress: New entity 'popup_progress' {:?} created",
self.progress_popup
);
// append the stack inside the progress_popup // append the stack inside the progress_popup
build_context.append_child(stack, self.progress_popup); build_context.append_child(stack, self.progress_popup);
// make sure we have a progress bar // make sure we have a progress bar
self.progress_bar = ctx.entity_of_child(ID_POLICY_CHECK_PROGRESS_BAR).expect( self.progress_bar = ctx
"PolicycheckState.init: Can't find entity of resource 'ID_POLICY_CHECK_PROGRESS_BAR'.", .entity_of_child(ID_POLICY_CHECK_PROGRESS_BAR)
); .expect("PolicycheckState.init: Can't find entity of resource 'ID_POLICY_CHECK_PROGRESS_BAR'.");
info!( info!("set_popup_progress: New entity 'progress_bar' created: {:?}", self.progress_bar);
"set_popup_progress: New entity 'progress_bar' created: {:?}",
self.progress_bar
);
} }
/// Change visibility of the result label. /// Change visibility of the result label.
fn _set_visibility(&self, entity: Entity, ctx: &mut Context<'_>) { fn _set_visibility(&self, entity: Entity, ctx: &mut Context<'_>) {
if ctx.get_widget(entity).get::<String16>("text").is_empty() { if ctx.get_widget(entity).get::<String16>("text").is_empty() {
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Collapsed);
Visibility::Collapsed,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
Visibility::Collapsed,
);
} else { } else {
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Visible);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Visibility::Visible,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
Visibility::Visible,
);
} }
} }
/// Update count of elements in the policy data list. /// Update count of elements in the policy data list.
fn _update_data_count(&self, ctx: &mut Context<'_>) { fn _update_data_count(&self, ctx: &mut Context<'_>) {
let data_list_count = ctx let data_list_count = ctx.widget().get::<PolicyDataList>(PROP_POLICY_DATA_LIST).len();
.widget()
.get::<PolicyDataList>(PROP_POLICY_DATA_LIST)
.len();
ctx.widget().set(PROP_POLICY_DATA_COUNT, data_list_count); ctx.widget().set(PROP_POLICY_DATA_COUNT, data_list_count);
} }
fn update_progress_bar(&self, ctx: &mut Context<'_>) { fn update_progress_bar(&self, ctx: &mut Context<'_>) {
let res = t!(policy_string_progress_time => self.lang); let res = t!("policy.string.progress_time", self.lang);
let string_duration = format!("{}: {:?}", res, self.duration); let string_duration = format!("{}: {:?}", res, self.duration);
TextBlock::text_set( TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_TIME), string_duration);
&mut ctx.child(ID_POLICY_CHECK_PROGRESS_TIME),
string_duration,
);
let mut progress_bar = ctx.child(ID_POLICY_CHECK_PROGRESS_BAR); let mut progress_bar = ctx.child(ID_POLICY_CHECK_PROGRESS_BAR);
progress_bar.set::<f64>("val", self.progress_count); progress_bar.set::<f64>("val", self.progress_count);
@@ -680,56 +426,39 @@ impl PolicycheckState {
//let policy_code = ctx.widget().get::<PolicycheckState>(ID_POLICY_CHECK_POLICY_CODE); //let policy_code = ctx.widget().get::<PolicycheckState>(ID_POLICY_CHECK_POLICY_CODE);
//ctx.widget().set(PROP_POLICY_DATA_COUNT, policy_code); //ctx.widget().set(PROP_POLICY_DATA_COUNT, policy_code);
} }
} }
/// Supported methods handled inside the `PolicycheckState` /// Supported methods handled inside the `PolicycheckState`
impl State for PolicycheckState { impl State for PolicycheckState {
/// Initialize the state of widgets inside `PolicycheckState` /// Initialize the state of widgets inside `PolicycheckState`
fn init(&mut self, _: &mut Registry, ctx: &mut Context<'_>) { fn init(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
let time_start = SystemTime::now(); let time_start= SystemTime::now();
trace!(target: "advotracker", policycheck_state = "init", status = "started"); trace!(target: "advotracker", policycheck_state = "init", status = "started");
// Get language from environment // Get language from environment
// self.lang = PolicycheckState::get_lang(); self.lang = PolicycheckState::get_lang();
self.lang = Lang::De("");
// Initialize required entities // Initialize required entities
self.button_menu = ctx.entity_of_child(ID_POLICY_CHECK_BUTTON_MENU).expect( self.button_menu = ctx
"PolicycheckState::init: Can't find resource entity 'ID_POLICY_CHECK_BUTTON_MENU'.", .entity_of_child(ID_POLICY_CHECK_BUTTON_MENU)
); .expect("PolicycheckState::init: Can't find resource entity 'ID_POLICY_CHECK_BUTTON_MENU'.");
self.label_result = ctx.entity_of_child(ID_POLICY_CHECK_LABEL_RESULT).expect( self.label_result = ctx
"PolicycheckState::init: Can't find resource entity 'ID_POLICY_CHECK_LABEL_RESULT'.", .entity_of_child(ID_POLICY_CHECK_LABEL_RESULT)
); .expect("PolicycheckState::init: Can't find resource entity 'ID_POLICY_CHECK_LABEL_RESULT'.");
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
Visibility::Collapsed, TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Collapsed);
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
Visibility::Collapsed,
);
TextBlock::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT),
Visibility::Collapsed,
);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Collapsed);
Stack::visibility_set(
&mut ctx.child(ID_POLICY_CHECK_ACTION_STACK),
Visibility::Collapsed,
);
//self.policy_number = Entity::from(ctx.widget().try_clone::<u32>(ID_POLICY_CHECK_POLICY_NUMBER) //self.policy_number = Entity::from(ctx.widget().try_clone::<u32>(ID_POLICY_CHECK_POLICY_NUMBER)
// .expect("PolicycheckState::init(): Can't find resource entity 'ID_POLICY_CHECK_POLICY_NUMBER'.")); // .expect("PolicycheckState::init(): Can't find resource entity 'ID_POLICY_CHECK_POLICY_NUMBER'."));
self.target = Entity::from( self.target = Entity::from(ctx.widget().try_clone::<u32>("target")
ctx.widget() .expect("PolicycheckState::init(): Can't find resource entity 'target'."));
.try_clone::<u32>("target")
.expect("PolicycheckState::init(): Can't find resource entity 'target'."),
);
//self.ticketdata_view = (*ctx.widget().get::<u32>("ticketdata_view")).into(); //self.ticketdata_view = (*ctx.widget().get::<u32>("ticketdata_view")).into();
//self.ticketdata = Entity::from(ctx.widget().try_clone::<u32>(ID_TICKET_DATA_VIEW) //self.ticketdata = Entity::from(ctx.widget().try_clone::<u32>(ID_TICKET_DATA_VIEW)
@@ -762,34 +491,25 @@ impl State for PolicycheckState {
) { ) {
for message in messages.read::<PolicycheckAction>() { for message in messages.read::<PolicycheckAction>() {
match message { match message {
PolicycheckAction::ClearPolicyNumber => {
self.clear_policy_number(ctx);
}
PolicycheckAction::NewTicket => {
self.new_ticket(ctx);
}
PolicycheckAction::UpdatePolicyCode => {
self.update_policy_code(ctx);
}
PolicycheckAction::UpdateProgress(increment) => { PolicycheckAction::UpdateProgress(increment) => {
let old_width = let old_width = ProgressBar::val_clone(&ctx.child(ID_POLICY_CHECK_PROGRESS_BAR));
ProgressBar::val_clone(&ctx.child(ID_POLICY_CHECK_PROGRESS_BAR));
let new_width = old_width + increment; let new_width = old_width + increment;
// Set the ProgressBar's val property to the calculated percentage // Set the ProgressBar's val property to the calculated percentage
// (whereas 0.0 means 0%, and 1.0 means 100%) // (whereas 0.0 means 0%, and 1.0 means 100%)
if new_width <= 1. { if new_width <= 1. {
ProgressBar::val_set( ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), new_width);
&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR),
new_width,
);
} else { } else {
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 1.); ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 1.);
} }
} }
_ => { PolicycheckAction::UpdatePolicyCode => {
println!("PolicycheckAction: action not implemented!"); self.update_policy_code(ctx);
} }
PolicycheckAction::NewTicket => {
self.new_ticket(ctx);
}
_ => { println!("PolicycheckAction: action not implemented!"); }
} }
} }
} }
@@ -811,17 +531,14 @@ impl State for PolicycheckState {
for action in actions { for action in actions {
match action { match action {
PolicycheckAction::ClearPolicyNumber => { PolicycheckAction::ClearEntry(policy_check_policy_number) => {
println!("clear entry"); ctx.get_widget(policy_check_policy_number).set("enabled", false);
self.clear_policy_number(ctx);
} }
PolicycheckAction::InputTextChanged(entity) => { PolicycheckAction::InputTextChanged(entity) => {
println!( println!("entry changed: {}", TextBox::text_clone(&ctx.get_widget(entity)));
"entry changed: {}",
TextBox::text_clone(&ctx.get_widget(entity))
);
} }
PolicycheckAction::ImportData => match self.import_data(ctx) { PolicycheckAction::ImportData => {
match self.import_data(ctx) {
Ok(()) => { Ok(()) => {
trace!(target: "advotracker", import_data = "success"); trace!(target: "advotracker", import_data = "success");
} }
@@ -829,7 +546,8 @@ impl State for PolicycheckState {
error!("Importing data failed!"); error!("Importing data failed!");
trace!(target: "advotracker", import_data = "failed"); trace!(target: "advotracker", import_data = "failed");
} }
}, }
}
PolicycheckAction::NewTicket => { PolicycheckAction::NewTicket => {
self.new_ticket(ctx); self.new_ticket(ctx);
} }
@@ -837,8 +555,7 @@ impl State for PolicycheckState {
self.parse_entry(text_box, ctx); self.parse_entry(text_box, ctx);
} }
PolicycheckAction::RemoveFocus(policy_check_policy_number) => { PolicycheckAction::RemoveFocus(policy_check_policy_number) => {
ctx.get_widget(policy_check_policy_number) ctx.get_widget(policy_check_policy_number).set("enabled", false);
.set("enabled", false);
//ctx.EventAdapter(FocusEvent::RemoveFocus(policy_check_policy_number)); //ctx.EventAdapter(FocusEvent::RemoveFocus(policy_check_policy_number));
} }
PolicycheckAction::RemovePopup(entity) => { PolicycheckAction::RemovePopup(entity) => {
@@ -856,16 +573,12 @@ impl State for PolicycheckState {
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), value); ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), value);
} else { } else {
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 0.); ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 0.);
} } }
}
PolicycheckAction::SetProgressPopup(_entity) => { PolicycheckAction::SetProgressPopup(_entity) => {
self.set_popup_progress(ctx); self.set_popup_progress(ctx);
} }
PolicycheckAction::SetVisibility(_entity) => { PolicycheckAction::SetVisibility(_entity) => {
TextBlock::visibility_set( TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
Visibility::Collapsed,
);
} }
PolicycheckAction::TextChanged(entity, _index) => { PolicycheckAction::TextChanged(entity, _index) => {
self.set_entry(entity, ctx); self.set_entry(entity, ctx);
@@ -929,7 +642,7 @@ fn create_popup_progress(id: Entity, ctx: &mut BuildContext<'_>) -> Entity {
.id(ID_POLICY_CHECK_PROGRESS_TEXT) .id(ID_POLICY_CHECK_PROGRESS_TEXT)
.style("textblock_progress") .style("textblock_progress")
.text("Importing data") .text("Importing data")
.build(ctx), .build(ctx)
) )
.child( .child(
ProgressBar::new() ProgressBar::new()
@@ -937,7 +650,7 @@ fn create_popup_progress(id: Entity, ctx: &mut BuildContext<'_>) -> Entity {
.style("progress_bar") .style("progress_bar")
.val(0) .val(0)
//.width(250) //.width(250)
.build(ctx), .build(ctx)
) )
.child( .child(
TextBlock::new() TextBlock::new()
@@ -945,11 +658,11 @@ fn create_popup_progress(id: Entity, ctx: &mut BuildContext<'_>) -> Entity {
.style("textblock_progress") .style("textblock_progress")
.h_align("end") .h_align("end")
.text("Processing time") .text("Processing time")
.build(ctx), .build(ctx)
) )
.build(ctx), .build(ctx)
) )
.build(ctx), .build(ctx)
) )
.build(ctx) .build(ctx)
} }

View File

@@ -1,14 +1,18 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
use orbtk::{prelude::*, shell::*, widgets::themes::*}; use orbtk::prelude::*;
use orbtk::shell::event::Key;
use crate::{ use crate::{
data::{constants::*, structures::PolicyCheck}, data::{
constants::*,
structures::PolicyCheck,
},
//widgets::menu::menu_state::{MenuAction, MenuState}, //widgets::menu::menu_state::{MenuAction, MenuState},
widgets::policycheck::policycheck_state::{PolicycheckAction, PolicycheckState}, widgets::policycheck::policycheck_state::{PolicycheckAction, PolicycheckState},
}; };
@@ -19,15 +23,15 @@ widget!(
/// This identifier is checked agains a map of valid policy codes. /// This identifier is checked agains a map of valid policy codes.
// PolicycheckView<PolicycheckState>: KeyDownHandler { // PolicycheckView<PolicycheckState>: KeyDownHandler {
PolicycheckView<PolicycheckState> { PolicycheckView<PolicycheckState> {
/// Holds the language code // holds the language code
lang: String, lang: String,
/// Provides a struct with `PolicyCheck` members // provides a struct with `PolicyCheck` members
policy_check: PolicyCheck, policy_check: PolicyCheck,
/// Holds number of imported data // holds number of imported data
policy_data_count: u32, policy_data_count: u32,
/// Holds the title string // holds the title string
policy_check_title: String, policy_check_title: String,
/// Widget entity that will receive the message // widget entity that will receive the message
target: u32 target: u32
} }
); );
@@ -66,7 +70,7 @@ impl Template for PolicycheckView {
TextBlock::new() TextBlock::new()
.margin((0, 9, 48, 0)) .margin((0, 9, 48, 0))
.text("©Networkx GmbH") .text("©Networkx GmbH")
.build(ctx), .build(ctx)
) )
.build(ctx), .build(ctx),
) )
@@ -131,27 +135,17 @@ impl Template for PolicycheckView {
.h_align("center") .h_align("center")
.child( .child(
Stack::new() Stack::new()
.id(ID_POLICY_CHECK_ACTION_STACK)
//.style(STYLE_STACK_ACTION) //.style(STYLE_STACK_ACTION)
.orientation("horizontal") .orientation("horizontal")
.spacing(50) .spacing(50)
.child(
Button::new()
.id(ID_POLICY_CHECK_ACTION_BUTTON_CLEAR)
.style(STYLE_BUTTON_ACTION)
.text("Clear")
.on_click(move |states, _entity| {
states.send_message(PolicycheckAction::ClearPolicyNumber, id);
false
})
.build(ctx),
)
.child( .child(
Button::new() Button::new()
.id(ID_POLICY_CHECK_ACTION_BUTTON_CREATE) .id(ID_POLICY_CHECK_ACTION_BUTTON_CREATE)
.style(STYLE_BUTTON_ACTION) .style(STYLE_BUTTON_ACTION)
.text("Create ticket") .text("Create ticket")
.on_click(move |states, _entity| { .on_click(move |states, _entity| {
//states.get_mut::<PolicycheckState>(id).send_message_update_policynumber(id);
//states.send_message(PolicycheckAction::UpdatePolicyCode, policy_check_policy_code);
states.send_message(PolicycheckAction::UpdatePolicyCode, id); states.send_message(PolicycheckAction::UpdatePolicyCode, id);
states.send_message(PolicycheckAction::NewTicket, id); states.send_message(PolicycheckAction::NewTicket, id);
false false
@@ -163,8 +157,8 @@ impl Template for PolicycheckView {
.build(ctx); .build(ctx);
let policy_check_form = Container::new() let policy_check_form = Container::new()
.id(ID_POLICY_CHECK_FORM_CONTAINER) .id(ID_POLICY_CHECK_FORM)
.name(ID_POLICY_CHECK_FORM_CONTAINER) .name(ID_POLICY_CHECK_FORM)
.attach(Grid::row(2)) .attach(Grid::row(2))
.attach(Grid::column(1)) .attach(Grid::column(1))
.style("container_form") .style("container_form")
@@ -178,7 +172,7 @@ impl Template for PolicycheckView {
.push("200") // Data .push("200") // Data
.push("16") // Delimiter .push("16") // Delimiter
.push("32") // Result-Button .push("32") // Result-Button
.push("4"), // Delimeter .push("4") // Delimeter
) )
.rows( .rows(
Rows::create() Rows::create()
@@ -186,8 +180,9 @@ impl Template for PolicycheckView {
.push("14") // Seperator .push("14") // Seperator
.push("auto") // Row 2 .push("auto") // Row 2
.push("14") // Seperator .push("14") // Seperator
.push("auto"), // Row 3 .push("auto") // Row 3
) )
//.child(policy_check_form_row_0) //.child(policy_check_form_row_0)
.child( .child(
TextBlock::new() TextBlock::new()
@@ -211,9 +206,7 @@ impl Template for PolicycheckView {
.water_mark("10-stellig") .water_mark("10-stellig")
.on_activate(move |states, entity| { .on_activate(move |states, entity| {
// Entity is entered/activated via Mouse/Keyboard // Entity is entered/activated via Mouse/Keyboard
states states.get_mut::<PolicycheckState>(id).parse_policy_number(entity);
.get_mut::<PolicycheckState>(id)
.parse_policy_number(entity);
}) })
.on_key_down(move |_, key_event| { .on_key_down(move |_, key_event| {
if key_event.key == Key::A(true) { if key_event.key == Key::A(true) {
@@ -223,9 +216,10 @@ impl Template for PolicycheckView {
// .set_action(Action::ImportData); // .set_action(Action::ImportData);
true true
}) })
.build(ctx), .build(ctx)
) )
.child(policy_check_button_result) .child(policy_check_button_result)
//.child(policy_check_form_row_2) //.child(policy_check_form_row_2)
.child( .child(
TextBlock::new() TextBlock::new()
@@ -238,6 +232,14 @@ impl Template for PolicycheckView {
.text("Policy code") .text("Policy code")
.build(ctx), .build(ctx),
) )
// .child(
// TextBlock::new()
// .id(ID_POLICY_CHECK_RESULT)
// .style("body")
// .attach(Grid::row(2))
// .attach(Grid::column(2))
// .build(ctx)
//)
.child(policy_check_policy_code) .child(policy_check_policy_code)
//.child(policy_check_form_row_2) //.child(policy_check_form_row_2)
.child( .child(
@@ -264,6 +266,7 @@ impl Template for PolicycheckView {
) )
.build(ctx); .build(ctx);
// row3: only shown, if we read in `policy numbers` in // row3: only shown, if we read in `policy numbers` in
// a hashmap as values // a hashmap as values
let policy_data_stack = Stack::new() let policy_data_stack = Stack::new()
@@ -280,7 +283,7 @@ impl Template for PolicycheckView {
.margin((0, 4, 0, 0)) .margin((0, 4, 0, 0))
.enabled(true) .enabled(true)
.text("Checklist elements: ") .text("Checklist elements: ")
.build(ctx), .build(ctx)
) )
.child( .child(
TextBlock::new() TextBlock::new()
@@ -288,7 +291,7 @@ impl Template for PolicycheckView {
.margin((0, 4, 0, 0)) .margin((0, 4, 0, 0))
.enabled(true) .enabled(true)
.text("0") .text("0")
.build(ctx), .build(ctx)
) )
.build(ctx); .build(ctx);
@@ -303,7 +306,7 @@ impl Template for PolicycheckView {
Columns::create() Columns::create()
.push(50) // Left margin .push(50) // Left margin
.push("*") // Content .push("*") // Content
.push(50), // Right margin .push(50) // Right margin
) )
.rows( .rows(
Rows::create() Rows::create()
@@ -311,8 +314,9 @@ impl Template for PolicycheckView {
.push(28) // Seperator .push(28) // Seperator
.push("*") // InputForm .push("*") // InputForm
.push("auto") // Data_Result .push("auto") // Data_Result
.push("auto"), // Bottom_Bar .push("auto") // Bottom_Bar
) )
.child(policy_check_header_bar) // row 0 .child(policy_check_header_bar) // row 0
.child(policy_check_form) // row 2 .child(policy_check_form) // row 2
.child(policy_data_stack) // row 3 .child(policy_data_stack) // row 3

View File

@@ -1,8 +1,8 @@
// SPDX-License-Identifier: (0BSD or MIT)
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020-2021 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// The policy check state /// The policy check state

Some files were not shown because too many files have changed in this diff Show More