Compare commits
7 Commits
main
...
wip_messag
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fc4c6c01d | |||
| 9ef2e3816e | |||
| 3162233c85 | |||
| 30131ecdb1 | |||
| 6d9d82bb8e | |||
| 5e390a8cfa | |||
| 8630ee1c12 |
9
.gitmodules
vendored
@@ -1,9 +1,6 @@
|
||||
[submodule "advotrackerdb"]
|
||||
path = advotrackerdb
|
||||
url = https://gitea.networkx.de:50443/rzerres/advotrackerdb
|
||||
[submodule "advotracker-db"]
|
||||
path = advotracker-db
|
||||
url = https://gitea.networkx.de:50443/rzerres/advotracker-db
|
||||
[submodule "advotrackerd"]
|
||||
path = advotrackerd
|
||||
url = https://gitea.networkx.de:50443/rzerres/advotrackerd
|
||||
[submodule "advotracker_db"]
|
||||
path = advotracker_db
|
||||
url = https://gitea.networkx.de:50443/rzerres/advotracker_db
|
||||
|
||||
45
Cargo.toml
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "advotracker"
|
||||
name = "advotracker-framework"
|
||||
version = "0.1.0"
|
||||
authors = ["Ralf Zerres <ralf.zerres@networkx.de>"]
|
||||
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"
|
||||
readme = "README.md"
|
||||
license = "0BSD OR MIT"
|
||||
keywords = [
|
||||
"advotracker",
|
||||
"lawyer",
|
||||
]
|
||||
edition = "2018"
|
||||
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]
|
||||
incremental = true
|
||||
panic = "abort"
|
||||
lto = true
|
||||
codegen-units=1
|
||||
@@ -50,6 +21,15 @@ opt-level="s"
|
||||
# optimize to smallest size
|
||||
#opt-level = "z"
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 0
|
||||
debug = true
|
||||
lto = false
|
||||
codegen-units = 5
|
||||
panic = 'unwind'
|
||||
incremental = true
|
||||
overflow-checks = true
|
||||
|
||||
[profile.test]
|
||||
opt-level = 0
|
||||
debug = 2
|
||||
@@ -64,6 +44,7 @@ overflow-checks = true
|
||||
[workspace]
|
||||
members = [
|
||||
"advotrackerd",
|
||||
"advotracker_db",
|
||||
"advotracker_client",
|
||||
"advotracker-db",
|
||||
"advotracker",
|
||||
"advotracker_qml",
|
||||
]
|
||||
|
||||
16
README.md
@@ -6,14 +6,14 @@
|
||||
|
||||
## 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.
|
||||
|
||||
The application components are implemented using the programming language *Rust*.
|
||||
The graphical user interface (GUI) uses the class-lib *OrbTk*, which is natively
|
||||
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:
|
||||
|
||||
* macOS
|
||||
@@ -36,24 +36,24 @@ as documentation sources.
|
||||
|
||||
Dialogs and messages generated inside the application will respect the system language
|
||||
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'
|
||||
(<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
|
||||
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).
|
||||
|
||||
## 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.
|
||||
|
||||
The source code is subdiveded in three crates:
|
||||
The source code is subdiveded in three submodules:
|
||||
|
||||
* advotracker
|
||||
* advotrackerd
|
||||
* advotrackerdb
|
||||
* advotracker-db
|
||||
|
||||
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:
|
||||
@@ -149,7 +149,7 @@ This work is licensed under a [Creative Common License 4.0][License-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
68
advotracker/Cargo.toml
Normal 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"
|
||||
@@ -11,26 +11,24 @@ Dictionary (
|
||||
// like a struct, but keys are also values instead of just beenig identifiers
|
||||
words: {
|
||||
// policycheck_view
|
||||
"Check result": "Prüfungsergebnis",
|
||||
"Checklist elements: ": "Prüflistenelemente: ",
|
||||
"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",
|
||||
"Validation policy number": "Prüfung Versicherungsnummer",
|
||||
"Policy number": "Versicherungsnummer",
|
||||
"Policy code": "Vers.-Schein/Schadennummer",
|
||||
"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 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 valid": "Die Versicherungsnummer ist gültig",
|
||||
"Only numbers are valid": "Nur Nummern sind zulässig",
|
||||
"Account": "Benutzer",
|
||||
"Toggle theme": "Thema wechseln",
|
||||
"Validation policy number": "Prüfung Versicherungsnummer",
|
||||
"Quit": "Beenden",
|
||||
|
||||
// ticketdata_view
|
||||
"Callback number": "Rückrufnummer",
|
||||
@@ -45,16 +43,16 @@ Dictionary (
|
||||
"Send": "Senden",
|
||||
|
||||
// localization view
|
||||
"English": "Englisch",
|
||||
"German": "Deutsch",
|
||||
"Language ID": "Sprache ID",
|
||||
"Localization dialog": "Lokalisierungs-Dialog",
|
||||
"German": "Deutsch",
|
||||
"English": "Englisch",
|
||||
|
||||
// configuration view
|
||||
"Configuration settings": "Konfigurationseinstellungen",
|
||||
"Configuration file": "Konfigurationsdatei",
|
||||
"Default theme": "Standard-Thema",
|
||||
"Language Id": "Sprach-Id",
|
||||
"Default theme": "Standard-Thema",
|
||||
"Load": "Laden",
|
||||
"Save": "Speichern",
|
||||
}
|
||||
@@ -20,16 +20,7 @@ Theme (
|
||||
base: "combo_box",
|
||||
properties: {
|
||||
"width": 200,
|
||||
//"height": 28,
|
||||
},
|
||||
),
|
||||
"combo_box_popup": (
|
||||
base: "popup_box_popup",
|
||||
properties: {
|
||||
"height": 80,
|
||||
"min_height": 80,
|
||||
"width": 160,
|
||||
"min_width": 80,
|
||||
"height": 28,
|
||||
},
|
||||
),
|
||||
"mail_label": (
|
||||
@@ -51,6 +42,13 @@ Theme (
|
||||
"h_align": "end",
|
||||
},
|
||||
),
|
||||
"combo_box_popup": (
|
||||
//base: "popup",
|
||||
properties: {
|
||||
//"height": 120,
|
||||
"width": 240,
|
||||
},
|
||||
),
|
||||
"configuration_form": (
|
||||
base: "container",
|
||||
properties: {
|
||||
@@ -117,6 +115,16 @@ Theme (
|
||||
"v_align": "center",
|
||||
}
|
||||
),
|
||||
"popup_form": (
|
||||
//base: "popup",
|
||||
properties: {
|
||||
"background": "#FFFFFF",
|
||||
"border_brush": "#0000FF",
|
||||
"border_radius": 3,
|
||||
"border_width": 2,
|
||||
"padding": 4,
|
||||
},
|
||||
),
|
||||
"popup_menu": (
|
||||
//base: "popup",
|
||||
properties: {
|
||||
0
advotracker/assets/advotracker/fluent_light.ron
Normal file
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 289 B |
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
|
Before Width: | Height: | Size: 158 B After Width: | Height: | Size: 158 B |
|
Before Width: | Height: | Size: 351 B After Width: | Height: | Size: 351 B |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 130 B |
|
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 452 B After Width: | Height: | Size: 452 B |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
|
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 223 B |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 768 B After Width: | Height: | Size: 768 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 455 KiB After Width: | Height: | Size: 455 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 237 KiB After Width: | Height: | Size: 237 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
@@ -1,11 +1,11 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* advotracker - Hotline tackingtool for Advocats
|
||||
*
|
||||
* 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 serde::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
@@ -17,7 +17,7 @@ use std::{
|
||||
};
|
||||
use tracing::{debug, trace, Level};
|
||||
|
||||
use advotracker::data::structures::{PolicyCode, PolicyData, PolicyDataList, PolicyList};
|
||||
use advotracker::data::structures::{PolicyCode, PolicyList, PolicyDataList, PolicyData};
|
||||
|
||||
// include modules
|
||||
mod parse_args;
|
||||
@@ -77,15 +77,12 @@ fn export(p: &mut String, lang: &String) -> Result<u64, Box<dyn Error>> {
|
||||
/// import from csv format
|
||||
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
|
||||
/// https://blog.burntsushi.net/csv/
|
||||
fn import(
|
||||
p: &mut String,
|
||||
data_list: &mut PolicyDataList,
|
||||
policy_numbers: &mut HashMap<u64, PolicyCode>,
|
||||
lang: &String,
|
||||
) -> Result<u64, Box<dyn Error>> {
|
||||
use std::ffi::OsStr;
|
||||
fn import(p: &mut String, data_list: &mut PolicyDataList,
|
||||
policy_numbers: &mut HashMap<u64, PolicyCode>, lang: &String)
|
||||
-> Result<u64, Box<dyn Error>> {
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use std::ffi::OsStr;
|
||||
|
||||
let mut res = t!("csv.import.started", lang);
|
||||
let mut state = t!("state.started", lang);
|
||||
@@ -145,7 +142,7 @@ fn import(
|
||||
// push record as new vector elements
|
||||
data_list.push(record);
|
||||
|
||||
count += 1;
|
||||
count +=1;
|
||||
}
|
||||
|
||||
let dt_end: DateTime<Local> = Local::now();
|
||||
@@ -166,12 +163,10 @@ fn import(
|
||||
#[allow(dead_code)]
|
||||
/// validate a given policy number
|
||||
/// result will return true or false
|
||||
fn is_valid(
|
||||
policy_number: &u64,
|
||||
policy_list: &PolicyDataList,
|
||||
policy_numbers: &mut HashMap<u64, PolicyCode>,
|
||||
lang: &String,
|
||||
) -> Result<bool, Box<dyn std::error::Error>> {
|
||||
fn is_valid(policy_number: &u64, policy_list: &PolicyDataList,
|
||||
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 state = t!("state.started", lang);
|
||||
let dt_start: DateTime<Local> = Local::now();
|
||||
@@ -191,6 +186,7 @@ fn is_valid(
|
||||
// println!("policy_list: {:?} (with {:?} elements)",
|
||||
// policy_list.name, policy_list.policy_data.len());
|
||||
|
||||
|
||||
// policy_list.into_iter()
|
||||
// .filter(|num| matches(w, w1))
|
||||
// .clone
|
||||
@@ -234,13 +230,14 @@ fn is_valid(
|
||||
match policy_numbers.get(&policy_number) {
|
||||
Some(&policy_code) => {
|
||||
let res = t!("policy.validation.success", lang);
|
||||
println!("policy_number: {} ({:?})", policy_number, policy_code);
|
||||
println!("policy_number: {} ({:?})",
|
||||
policy_number, policy_code);
|
||||
result = true;
|
||||
trace!(target: "csv-test",
|
||||
policy_number = ?policy_number,
|
||||
validation = ?res,
|
||||
policy_code = ?policy_code);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
let res = t!("policy.validation.failed", lang);
|
||||
//println!("Noop! Number isn't valid!");
|
||||
@@ -248,8 +245,9 @@ fn is_valid(
|
||||
trace!(target: "csv-test",
|
||||
policy_number = ?policy_number,
|
||||
validation = ?res);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let dt_end: DateTime<Local> = Local::now();
|
||||
let duration = dt_end.signed_duration_since(dt_start);
|
||||
@@ -298,13 +296,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
dotenv().ok();
|
||||
match envy::from_env::<Environment>() {
|
||||
Ok(environment) => {
|
||||
if environment.test_lang != lang {
|
||||
lang = environment.test_lang;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
debug!(target: "csv-test", "{}", e);
|
||||
}
|
||||
if environment.test_lang != lang { lang = environment.test_lang; }
|
||||
},
|
||||
Err(e) => { debug!(target: "csv-test", "{}", e); }
|
||||
}
|
||||
// how to handle unumplemented lang resources??
|
||||
res = t!("parse.environment", lang);
|
||||
@@ -337,15 +331,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut policy_data = PolicyDataList::new("Allianz-Import 20200628");
|
||||
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();
|
||||
match import(
|
||||
&mut csv_import_path,
|
||||
&mut policy_data,
|
||||
&mut policy_numbers,
|
||||
&lang,
|
||||
) {
|
||||
match import(&mut csv_import_path, &mut policy_data,
|
||||
&mut policy_numbers, &lang) {
|
||||
Ok(count) => {
|
||||
println!("Imported {:?} records", count);
|
||||
}
|
||||
@@ -357,11 +347,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// test if policy_number is_valid
|
||||
// type conversion (viperus String -> u64)
|
||||
let test_policy_number = v
|
||||
.get::<String>("test_policy_number")
|
||||
.unwrap()
|
||||
.parse::<u64>()
|
||||
.unwrap();
|
||||
let test_policy_number = v.get::<String>("test_policy_number").unwrap().parse::<u64>().unwrap();
|
||||
trace!(target: "csv-test", test_policy_number = ?test_policy_number);
|
||||
//match is_valid(&policy_number, &policy_data, &mut policy_numbers, &lang) {
|
||||
// Ok(true) => {
|
||||
@@ -370,13 +356,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Some(&policy_code) => {
|
||||
let res = t!("policy.validation.success", lang);
|
||||
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);
|
||||
println!("{:?}", res);
|
||||
//println!("Nuup! Number isn't valid!");
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// export policy code elements to csv-file
|
||||
@@ -402,26 +389,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
#[test]
|
||||
fn test_policy_number() {
|
||||
// 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]);
|
||||
|
||||
//let mut csv_import_path = v.get::<String>("import_file").unwrap();
|
||||
let mut csv_import_path = String::from("data/POLLFNR_TEST.txt");
|
||||
|
||||
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();
|
||||
|
||||
println!(
|
||||
"import with Path: {:?} PolicyData: {:?} PolicyNumbers: {:?}, Lang: {:?}",
|
||||
csv_import_path, policy_data, policy_numbers, lang
|
||||
);
|
||||
let count = import(
|
||||
&mut csv_import_path,
|
||||
&mut policy_data,
|
||||
&mut policy_numbers,
|
||||
&lang,
|
||||
);
|
||||
println!("import with Path: {:?} PolicyData: {:?} PolicyNumbers: {:?}, Lang: {:?}",
|
||||
csv_import_path, policy_data, policy_numbers, lang);
|
||||
let count = import(&mut csv_import_path, &mut policy_data,
|
||||
&mut policy_numbers, &lang);
|
||||
|
||||
assert_eq!(count.unwrap(), 15498);
|
||||
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* advotracker - Hotline tackingtool for Advocats
|
||||
*
|
||||
|
||||
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* SPDX-License-Identifier: (0BSD or MIT)
|
||||
*/
|
||||
|
||||
// parse CLI commandline arguments with clap
|
||||
@@ -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("export_file", String::from(""));
|
||||
v.add_default("test_policy_number", String::from("9999999992"));
|
||||
v.add_default(
|
||||
"to_email_address_file",
|
||||
String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>"),
|
||||
);
|
||||
v.add_default(
|
||||
"from_email_address_file",
|
||||
String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"),
|
||||
);
|
||||
v.add_default("to_email_address_file", String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>"));
|
||||
v.add_default("from_email_address_file", String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"));
|
||||
//v.add_default("username", String::from("nctalkbot"));
|
||||
//v.add_default("password", String::from("botpassword"));
|
||||
v.add_default("verbose", 0);
|
||||
|
||||
|
||||
// CLI arguments are defined inline
|
||||
let matches = App::new("csv-test")
|
||||
.name(crate_name!())
|
||||
.version(crate_version!())
|
||||
.author(crate_authors!())
|
||||
.about(crate_description!())
|
||||
.after_help(
|
||||
"
|
||||
.after_help("
|
||||
Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten
|
||||
Direct-Call via IVR-System (Interactive Voice Response)
|
||||
SMR Deckungssummen-Prüfung: 089 92529 60211
|
||||
SMR Unerledigt: 089 92529 60222",
|
||||
)
|
||||
SMR Unerledigt: 089 92529 60222")
|
||||
.template(
|
||||
"\
|
||||
{bin} v{version}
|
||||
@@ -8,7 +8,7 @@ static ID_CHECK_POLICY_NUMBER: &'static str = "ID_CHECK_POLICY_NUMBER";
|
||||
static ID_PROGRESS_BAR: &'static str = "ID_PROGRESS_BAR";
|
||||
|
||||
enum Action {
|
||||
ParsePolicyNumber,
|
||||
ParsePolicyNumber
|
||||
}
|
||||
|
||||
#[derive(Default, AsAny)]
|
||||
@@ -16,18 +16,15 @@ struct MainViewState {
|
||||
action: Option<Action>,
|
||||
progress_bar: Entity,
|
||||
text_box: Entity,
|
||||
progress_counter: f64, //records: HashMap::<String, String>,
|
||||
progress_counter: f64
|
||||
//records: HashMap::<String, String>,
|
||||
//record_counter: u64
|
||||
}
|
||||
|
||||
impl State for MainViewState {
|
||||
fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
self.text_box = ctx
|
||||
.entity_of_child(ID_CHECK_POLICY_NUMBER)
|
||||
.expect("Cannot get TextBox!");
|
||||
self.progress_bar = ctx
|
||||
.entity_of_child(ID_PROGRESS_BAR)
|
||||
.expect("Cannot get progress bar !");
|
||||
self.text_box = ctx.entity_of_child(ID_CHECK_POLICY_NUMBER).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) {
|
||||
@@ -35,10 +32,7 @@ impl State for MainViewState {
|
||||
if let Some(action) = &self.action {
|
||||
match action {
|
||||
Action::ParsePolicyNumber => {
|
||||
let value_to_parse = ctx
|
||||
.get_widget(self.text_box)
|
||||
.get::<String16>("text")
|
||||
.clone();
|
||||
let value_to_parse = ctx.get_widget(self.text_box).get::<String16>("text").clone();
|
||||
self.parse_policy_number(value_to_parse, ctx);
|
||||
}
|
||||
}
|
||||
@@ -87,7 +81,9 @@ widget!(MainView<MainViewState>);
|
||||
|
||||
impl Template for MainView {
|
||||
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
|
||||
self.margin(32.0).child(
|
||||
self
|
||||
.margin(32.0)
|
||||
.child(
|
||||
Stack::new()
|
||||
.orientation("vertical")
|
||||
.h_align("center")
|
||||
@@ -99,14 +95,16 @@ impl Template for MainView {
|
||||
.water_mark("Mut value and type <Return>")
|
||||
.on_activate(move |states, _entity| {
|
||||
// you have to fire a new event to be able to get in the update() with access to Context
|
||||
states
|
||||
.get_mut::<MainViewState>(id)
|
||||
.action(Action::ParsePolicyNumber);
|
||||
states.get_mut::<MainViewState>(id).action(Action::ParsePolicyNumber);
|
||||
})
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.child(ProgressBar::new().id(ID_PROGRESS_BAR).build(ctx))
|
||||
.build(ctx),
|
||||
.child(
|
||||
ProgressBar::new()
|
||||
.id(ID_PROGRESS_BAR)
|
||||
.build(ctx)
|
||||
)
|
||||
.build(ctx)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* SPDX-License-Identifier: (0BSD or MIT)
|
||||
*/
|
||||
|
||||
use orbtk::prelude::*;
|
||||
|
||||
mod data;
|
||||
mod main_view;
|
||||
mod receiver;
|
||||
mod sender;
|
||||
38
advotracker/examples/messages_test/main_view.rs
Normal 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)
|
||||
)
|
||||
}
|
||||
}
|
||||
8
advotracker/examples/messages_test/mod.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
// The starting point (Main View).
|
||||
pub mod main_view;
|
||||
|
||||
/// Receiver widget
|
||||
pub mod receiver;
|
||||
|
||||
/// Sender widget.
|
||||
pub mod sender;
|
||||
5
advotracker/examples/messages_test/receiver/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
/// The reciever state
|
||||
pub mod receiver_state;
|
||||
|
||||
/// The receiver view
|
||||
pub mod receiver_view;
|
||||
@@ -1,46 +1,52 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* OrbTK - The Orbital Widget Toolkit
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* SPDX-License-Identifier: (0BSD or MIT)
|
||||
*/
|
||||
|
||||
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.
|
||||
pub enum TestMessageAction {
|
||||
// Toggle visibility of a message TextBox.
|
||||
ToggleMessageBox,
|
||||
// Toggle visibility of a message TextBlock.
|
||||
ToggleMessageBlock
|
||||
}
|
||||
|
||||
/// Valid `structure members` of the `ReceiverState` used to react on
|
||||
/// state changes inside the `ReceiverView` widget.
|
||||
#[derive(Default, AsAny)]
|
||||
pub struct ReceiverState {
|
||||
message_box: Option<Entity>,
|
||||
progress_bar: Entity,
|
||||
message_block: Option<Entity>,
|
||||
progress_bar: Entity
|
||||
}
|
||||
|
||||
/// Method definitions, we provide inside the `ReceiverState`.
|
||||
impl ReceiverState {
|
||||
fn toggle_message_box(&self, ctx: &mut Context) {
|
||||
if let Some(message_box) = self.message_box {
|
||||
ctx.get_widget(message_box)
|
||||
fn toggle_message_block(&self, ctx: &mut Context) {
|
||||
if let Some(message_block) = self.message_block {
|
||||
ctx.get_widget(message_block)
|
||||
.set("visibility", Visibility::Visible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait methods provided for the `SenderState`
|
||||
/// Trait methods provided for the `ReceiverState`
|
||||
impl State for ReceiverState {
|
||||
// initialize the view entities
|
||||
fn init(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
self.progress_bar = ctx
|
||||
.entity_of_child("progress_bar")
|
||||
.entity_of_child(ID_RECEIVER_PROGRESS_BAR)
|
||||
.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
|
||||
@@ -48,22 +54,31 @@ impl State for ReceiverState {
|
||||
&mut self,
|
||||
mut messages: MessageReader,
|
||||
_registry: &mut Registry,
|
||||
ctx: &mut Context,
|
||||
ctx: &mut Context
|
||||
) {
|
||||
for message in messages.read::<SenderAction>() {
|
||||
match message {
|
||||
SenderAction::UpdateProgress(amount) => {
|
||||
println!("Message received");
|
||||
println!("UpdateProgress message received");
|
||||
let mut progress_bar = ctx.get_widget(self.progress_bar);
|
||||
let current_progress = progress_bar.clone::<f64>("val");
|
||||
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>() {
|
||||
match action {
|
||||
TestMessageAction::ToggleMessageBox => {
|
||||
self.toggle_message_box(ctx);
|
||||
TestMessageAction::ToggleMessageBlock => {
|
||||
self.toggle_message_block(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
56
advotracker/examples/messages_test/receiver/receiver_view.rs
Normal 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)
|
||||
)
|
||||
}
|
||||
}
|
||||
5
advotracker/examples/messages_test/sender/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
/// The sender state
|
||||
pub mod sender_state;
|
||||
|
||||
/// The sender view
|
||||
pub mod sender_view;
|
||||
@@ -1,17 +1,20 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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::*;
|
||||
|
||||
/// Enumeration of valid `action variants` that need to be handled as
|
||||
/// state changes for the `SenderView` widget.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum SenderAction {
|
||||
UpdateProgress(f64),
|
||||
UpdateMessage(String),
|
||||
}
|
||||
|
||||
/// Valid `structure members` of the `SenderState` used to react on
|
||||
@@ -21,16 +24,22 @@ pub struct SenderState {
|
||||
// actions
|
||||
actions: Vec<SenderAction>,
|
||||
// entity that will receive the message
|
||||
target: Entity,
|
||||
target: Entity
|
||||
}
|
||||
|
||||
/// Method definitions, we provide inside the `SenderState`.
|
||||
impl SenderState {
|
||||
/// Sending message 'UpdateProgress'
|
||||
pub fn send_message(&mut self) {
|
||||
/// Sending message with type 'UpdateProgress'
|
||||
pub fn send_update_progress(&mut self) {
|
||||
println!("Sender: push 'UpdateProgress' action");
|
||||
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`
|
||||
@@ -38,23 +47,31 @@ impl State for SenderState {
|
||||
// initialize the view entities
|
||||
fn init(&mut self, _registry: &mut Registry, ctx: &mut Context) {
|
||||
// create the target entity, that receives the Sender messages
|
||||
self.target = Entity::from(
|
||||
ctx.widget()
|
||||
.try_clone::<u32>("target")
|
||||
.expect("ERROR: SenderState::init(): target entity not found!"),
|
||||
);
|
||||
self.target = Entity::from(ctx.widget().try_clone::<u32>("target")
|
||||
.expect("ERROR: SenderState::init(): target entity not found!"));
|
||||
}
|
||||
|
||||
// update entities, before we render the view
|
||||
fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
|
||||
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 {
|
||||
match action {
|
||||
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'");
|
||||
}
|
||||
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'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
100
advotracker/examples/messages_test/sender/sender_view.rs
Normal 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)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ use orbtk::prelude::*;
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
enum Action {
|
||||
EntryActivated(Entity),
|
||||
EntryChanged(Entity),
|
||||
EntryChanged(Entity)
|
||||
}
|
||||
|
||||
#[derive(AsAny)]
|
||||
@@ -66,7 +66,10 @@ impl State for MainViewState {
|
||||
}
|
||||
|
||||
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!(
|
||||
@@ -82,8 +85,19 @@ impl Template for MainView {
|
||||
self.name("MainView").child(
|
||||
Grid::new()
|
||||
.background("#fafafa")
|
||||
.columns(Columns::create().push(150.0).push("*").push(150.0).build())
|
||||
.rows(Rows::create().push("*").push("*").build())
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push(150.0)
|
||||
.push("*")
|
||||
.push(150.0)
|
||||
.build(),
|
||||
)
|
||||
.rows(
|
||||
Rows::create()
|
||||
.push("*")
|
||||
.push("*")
|
||||
.build(),
|
||||
)
|
||||
.child(
|
||||
Grid::new()
|
||||
//.element("policyholder_check")
|
||||
@@ -132,7 +146,7 @@ impl Template for MainView {
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.child(
|
||||
Grid::new()
|
||||
@@ -1,321 +1,164 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* advotracker - Hotline tackingtool for Advocats
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* SPDX-License-Identifier: (0BSD or MIT)
|
||||
*/
|
||||
|
||||
// Component Values (Properties)
|
||||
/// Apps property name
|
||||
pub static PROP_ADVOTRACKER: &str = "advotracker";
|
||||
|
||||
/// Mail header property first 'CC'
|
||||
pub static PROP_MAIL_CC_1: &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_CC_1: &str = "info@hiedemann.de";
|
||||
pub static PROP_MAIL_CC_2: &str = "service@hiedemann.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";
|
||||
/// Mail header property 'From': sender name
|
||||
pub static PROP_MAIL_FROM: &str = "Kanzlei Hiedemann <service@hiedemann.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_FROM: &str = "Kanzlei Hiedemann <info@heidemann.de>";
|
||||
pub static PROP_MAIL_REPLY: &str = "Kanzlei Hiedemann <info@heidemann.de>";
|
||||
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";
|
||||
/// Mail header second List-Entry 'Recpt-To': recipient name
|
||||
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";
|
||||
/// Mail header 4th List-Entry 'Recpt-To': recipient name
|
||||
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";
|
||||
/// Property: 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";
|
||||
/// Property: policy_data_count
|
||||
pub static PROP_POLICY_DATA_COUNT: &str = "policy_data_count";
|
||||
|
||||
/// Property: policy_list
|
||||
pub static PROP_POLICY_LIST: &str = "policy_list";
|
||||
/// Property: policy_list_count
|
||||
pub static PROP_POLICY_LIST_COUNT: &str = "policy_list_count";
|
||||
|
||||
// Styles (RON based theme system)
|
||||
/// Style: bottom_bar
|
||||
pub static STYLE_BOTTOM_BAR: &str = "bottom_bar";
|
||||
/// Style: button_menu
|
||||
pub static STYLE_BUTTON_MENU: &str = "button_menu";
|
||||
/// Style: button_action
|
||||
pub static STYLE_BUTTON_ACTION: &str = "button_action";
|
||||
/// Style: container_action
|
||||
pub static STYLE_CONTAINER_ACTION: &str = "container_action";
|
||||
/// Style: container_mail
|
||||
pub static STYLE_CONTAINER_MAIL: &str = "container_mail";
|
||||
/// Style: header_bar
|
||||
pub static STYLE_HEADER_BAR: &str = "header_bar";
|
||||
/// Style: header_text
|
||||
pub static STYLE_HEADER_TEXT: &str = "header_text";
|
||||
/// Style: seperator
|
||||
pub static STYLE_SEPARATOR: &str = "separator";
|
||||
/// Style: mail_label
|
||||
pub static STYLE_MAIL_LABEL: &str = "mail_label";
|
||||
/// Style: mail_cc
|
||||
pub static STYLE_MAIL_TO: &str = "mail_to";
|
||||
/// Style: mail_cc
|
||||
pub static STYLE_MAIL_CC: &str = "mail_cc";
|
||||
/// Style: menu
|
||||
pub static STYLE_MENU: &str = "menu";
|
||||
/// Style: stack_action
|
||||
pub static STYLE_STACK_ACTION: &str = "stack_action";
|
||||
/// Style: stack_menu
|
||||
pub static STYLE_STACK_MENU: &str = "stack_menu";
|
||||
|
||||
// Widget IDs (DCES: Entity[id] => [Component1, .. , Component<n>] -> data or state)
|
||||
/// Entity-ID: Configuration
|
||||
pub static ID_CONFIGURATION_VIEW: &str = "Configuration";
|
||||
/// Entity-ID: configuration_form
|
||||
pub static ID_CONFIGURATION_FORM: &str = "configuration_form";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: configuration_language_id
|
||||
pub static ID_CONFIGURATION_LANGUAGE_ID: &str = "configuration_language_id";
|
||||
|
||||
/// Entity-ID: Localization
|
||||
pub static ID_LOCALIZATION_VIEW: &str = "Localization";
|
||||
/// Entity-ID: localization_form
|
||||
pub static ID_LOCALIZATION_FORM: &str = "localization_form";
|
||||
/// Entity-ID: localization_header
|
||||
pub static ID_LOCALIZATION_HEADER: &str = "localization_header";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
|
||||
/// Entity-ID: menu_view
|
||||
pub static ID_MENU_VIEW: &str = "menu_view";
|
||||
/// Entity-ID: menu_popup
|
||||
pub static ID_MENU_POPUP: &str = "menu_popup";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: menu_grid
|
||||
pub static ID_MENU_GRID: &str = "menu_grid";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: menu_labeltoggle_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";
|
||||
/// Entity-ID: 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";
|
||||
/// 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";
|
||||
/// Entity-ID: policy_ckeck_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";
|
||||
/// Entity-ID: policy_ckeck_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";
|
||||
/// Entity-ID: policy_ckeck_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";
|
||||
/// Entity-ID: policy_ckeck_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";
|
||||
/// Entity-ID: policy_ckeck_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";
|
||||
/// Entity-ID: policy_ckeck_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";
|
||||
/// Entity-ID: policy_ckeck_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";
|
||||
/// Entity-ID: policy_ckeck_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";
|
||||
/// Entity-ID: policy_ckeck_policy_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";
|
||||
/// Entity-ID: policy_ckeck_policy_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";
|
||||
/// Entity-ID: policy_ckeck_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";
|
||||
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: policy_data_stacl
|
||||
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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: ticket_data_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_callback_number";
|
||||
/// Entity-ID: ticket_data_combo_box_mail_cc
|
||||
pub static ID_TICKET_DATA_CALLBACK_NUMBER: &str = "ticket_data_label_callback_number";
|
||||
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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
/// Entity-ID: 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";
|
||||
@@ -1,10 +1,11 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||
pub mod constants;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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)
|
||||
*/
|
||||
|
||||
@@ -15,13 +14,11 @@ use serde::{Deserialize, Serialize};
|
||||
#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Serialize)]
|
||||
pub enum PolicyCode {
|
||||
/// Allianz Sachversicherung
|
||||
AS,
|
||||
AS
|
||||
}
|
||||
|
||||
impl Default for PolicyCode {
|
||||
fn default() -> Self {
|
||||
PolicyCode::AS
|
||||
}
|
||||
fn default() -> Self { PolicyCode::AS }
|
||||
}
|
||||
|
||||
/// Classifier of the Allinaz DirectCall communication type.
|
||||
@@ -61,13 +58,11 @@ pub enum CommunicationType {
|
||||
/// Zeugins
|
||||
ZE,
|
||||
/// Typ is unspecified
|
||||
XX,
|
||||
XX
|
||||
}
|
||||
|
||||
impl Default for CommunicationType {
|
||||
fn default() -> Self {
|
||||
CommunicationType::XX
|
||||
}
|
||||
fn default() -> Self { CommunicationType::XX }
|
||||
}
|
||||
|
||||
/// Status of a given policy data element.
|
||||
@@ -76,13 +71,11 @@ pub enum Status {
|
||||
/// Active -> the policy is active an supported
|
||||
Active,
|
||||
/// Inactive -> the policy is inactive or resigned
|
||||
Inactive,
|
||||
Inactive
|
||||
}
|
||||
|
||||
impl Default for Status {
|
||||
fn default() -> Self {
|
||||
Status::Active
|
||||
}
|
||||
fn default() -> Self { Status::Active }
|
||||
}
|
||||
|
||||
/// A communication type describes possible classifications of customer calls.
|
||||
@@ -92,7 +85,7 @@ pub struct CommunicationData {
|
||||
/// pub communication_type: CommunicationType,
|
||||
pub communication_type: String,
|
||||
/// A literal name describing the selected communication type
|
||||
pub communication_name: String,
|
||||
pub communication_name: String
|
||||
}
|
||||
|
||||
/// CSV Export
|
||||
@@ -145,7 +138,7 @@ pub struct Email {
|
||||
/// Body type harm type
|
||||
pub harm_type: String,
|
||||
/// Body type ivr comment
|
||||
pub ivr_comment: String,
|
||||
pub ivr_comment: String
|
||||
}
|
||||
|
||||
impl Email {}
|
||||
@@ -157,7 +150,7 @@ pub struct HarmData {
|
||||
pub harm_data: Vec<HarmType>,
|
||||
/// Status der Schadenliste
|
||||
//pub name: String,
|
||||
pub selected: bool,
|
||||
pub selected: bool
|
||||
}
|
||||
|
||||
/// Harm types are destincted by a type code.
|
||||
@@ -192,7 +185,7 @@ pub struct PolicyCheck {
|
||||
/// Referenz zur Versicherungsschein-Nummer
|
||||
pub policy_number: u64,
|
||||
/// Validitätsergebnis
|
||||
pub policy_number_status: Status,
|
||||
pub policy_number_status: Status
|
||||
}
|
||||
|
||||
impl PolicyCheck {}
|
||||
@@ -262,7 +255,7 @@ pub struct PolicyDataList {
|
||||
/// Name der Versicherungsliste
|
||||
pub name: String,
|
||||
/// Status der Versicherungsliste
|
||||
pub selected: bool,
|
||||
pub selected: bool
|
||||
}
|
||||
|
||||
/// implements the helper methods, to manage policy data collections.
|
||||
@@ -341,7 +334,7 @@ pub struct PolicyData {
|
||||
#[serde(rename = "POLLFNR")]
|
||||
pub policy_number: u64,
|
||||
/// Status des Versicherungsscheins
|
||||
pub status: Option<Status>,
|
||||
pub status: Option<Status>
|
||||
}
|
||||
|
||||
/// Policy Number Set
|
||||
@@ -356,7 +349,7 @@ pub struct AllianzPolicyNumber {
|
||||
pub policy_code: String,
|
||||
/// 10-stellige Versicherungsscheinnummer (numerisch)
|
||||
#[serde(rename = "POLLFNR")]
|
||||
pub policy_number: usize,
|
||||
pub policy_number: usize
|
||||
}
|
||||
|
||||
// /// List of Allianz Policy Number records
|
||||
@@ -1,13 +1,12 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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"]
|
||||
#![crate_type = "lib"]
|
||||
#![warn(missing_docs, rust_2018_idioms, rust_2018_compatibility)]
|
||||
//#![warn(missing_docs, rust_2018_idioms, rust_2018_compatibility)]
|
||||
#![warn(rust_2018_idioms, rust_2018_compatibility)]
|
||||
|
||||
//! advotracker
|
||||
//! Supports lawyers to capture relevant data encountered during an
|
||||
@@ -24,9 +23,6 @@
|
||||
//! 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
|
||||
// pub mod clients;
|
||||
|
||||
248
advotracker/src/locales/advotracker.json
Normal 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"
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,20 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||
#![windows_subsystem = "windows"]
|
||||
|
||||
//#[macro_use]
|
||||
//extern crate lazy_static;
|
||||
|
||||
//use chrono::{Local, DateTime};
|
||||
use cfg_if::cfg_if;
|
||||
use dotenv::dotenv;
|
||||
use locales::t;
|
||||
use cfg_if::cfg_if;
|
||||
use serde::Deserialize;
|
||||
use std::env;
|
||||
//use std::process;
|
||||
@@ -19,15 +23,15 @@ use tracing::{info, trace, Level};
|
||||
|
||||
use orbtk::{
|
||||
prelude::*,
|
||||
//widgets::themes::theme_orbtk::{THEME_DEFAULT, THEME_DEFAULT_COLORS_DARK, THEME_DEFAULT_FONTS},
|
||||
widgets::themes::*,
|
||||
theme_default::{THEME_DEFAULT, THEME_DEFAULT_COLORS_DARK, THEME_DEFAULT_FONTS},
|
||||
theming::config::ThemeConfig,
|
||||
};
|
||||
|
||||
// The Main view
|
||||
use advotracker_client::widgets::main_view;
|
||||
#[cfg(target_os = "windows")]
|
||||
use orbtk::theme_fluent::{THEME_FLUENT, THEME_FLUENT_COLORS_DARK, THEME_FLUENT_FONTS};
|
||||
|
||||
// get the macro (t!) accessing the internationalization strings
|
||||
include!(concat!(env!("OUT_DIR"), "/i18n.rs"));
|
||||
// The Main view
|
||||
use advotracker::widgets::main_view;
|
||||
|
||||
mod parse_args;
|
||||
|
||||
@@ -36,19 +40,17 @@ mod parse_args;
|
||||
/// this is primarily used in testing scenarios (eg. debugging)
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Environment {
|
||||
//lang: Lang,
|
||||
lang: String,
|
||||
test_lang: String,
|
||||
rust_log: String,
|
||||
}
|
||||
|
||||
// Style extension
|
||||
static DEFAULT_DARK_EXT: &str = include_str!("../assets/advotracker/default_dark.ron");
|
||||
cfg_if! {
|
||||
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_LIGHT_EXT: &str = include_str!("../assets/advotracker/fluent_light.ron");
|
||||
} else {
|
||||
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_LIGHT_EXT: &str = include_str!("../assets/advotracker/fluent_light.ron");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,32 +60,19 @@ static ADVOTRACKER_DE_DE: &str = include_str!("../assets/advotracker/advotracker
|
||||
/// Get the active language environment.
|
||||
fn get_lang() -> String {
|
||||
// get system environment
|
||||
let mut lang_id = env::var("LANG").unwrap_or_else(|_| "En".to_string());
|
||||
let lang_variant = "";
|
||||
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"
|
||||
info!("GUI-Language: preset to {:?}", lang);
|
||||
|
||||
// prepare lang_id to represent twine language prefix
|
||||
// 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
|
||||
// testing environment: read from .env file
|
||||
dotenv().ok();
|
||||
match envy::from_env::<Environment>() {
|
||||
Ok(environment) => {
|
||||
if environment.test_lang != lang_id {
|
||||
info!("GUI-Language: preset from .env to {:?}", lang_id);
|
||||
lang_id = environment.test_lang;
|
||||
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)
|
||||
}
|
||||
if environment.test_lang != lang { lang = environment.test_lang; }
|
||||
},
|
||||
Err(e) => { info!(target: "advotracker", "{}", e) }
|
||||
}
|
||||
|
||||
let lang = format!("Lang::{}(\"{}\")", lang_id, lang_variant);
|
||||
trace!(target: "advotracker", lang_id = ?lang_id, lang = ?lang);
|
||||
trace!(target: "advotracker", lang = ?lang);
|
||||
|
||||
// return the active language
|
||||
lang
|
||||
@@ -93,33 +82,30 @@ cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
/// Extend and register theme assets.
|
||||
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)
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT))
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT_COLORS_DARK))
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT_FONTS)),
|
||||
))
|
||||
}
|
||||
// fn theme_fluent_dark() -> Theme {
|
||||
// orbtk::widgets::themes::theme_fluent::register_fluent_fonts(Theme::from_config(
|
||||
// ThemeConfig::from(FLUENT_DARK_EXT)
|
||||
fn theme_fluent() -> Theme {
|
||||
register_fluent_fonts(Theme::from_config(
|
||||
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_COLORS_DARK))
|
||||
// .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 {
|
||||
/// Extend and register theme assets.
|
||||
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)
|
||||
.extend(ThemeConfig::from(THEME_DEFAULT))
|
||||
.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/
|
||||
let span = tracing::span!(Level::TRACE, "advotracker");
|
||||
let _enter = span.enter();
|
||||
let collector = fmt::Subscriber::builder()
|
||||
let subscriber = fmt::Subscriber::builder()
|
||||
.with_env_filter(&rust_log)
|
||||
//.with_max_level(tracing::Level::DEBUG)
|
||||
.finish();
|
||||
|
||||
tracing::subscriber::with_default(collector, || {
|
||||
tracing::subscriber::with_default(subscriber, || {
|
||||
// get system environment
|
||||
let get_lang = get_lang();
|
||||
println!("get_lang returns: {:?}", get_lang);
|
||||
let lang = Lang::De("");
|
||||
println!("lang returns: {:?}", lang);
|
||||
let lang = get_lang();
|
||||
|
||||
let mut state = t!(state_started => lang);
|
||||
let mut res = t!(parse_environment => lang);
|
||||
let mut state = t!("state.started", lang);
|
||||
let mut res = t!("parse.environment", lang);
|
||||
trace!(target: "advotracker", process = ?res, state = ?state);
|
||||
trace!(target: "advotracker", environment = "system", lang = ?lang);
|
||||
trace!(target: "advotracker", machine = ?&machine_kind);
|
||||
|
||||
// how to handle unimplemented lang resources??
|
||||
res = t!(parse_environment => lang);
|
||||
res = t!("parse.environment", 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);
|
||||
|
||||
// initialize viperus structure
|
||||
let mut viperus = Viperus::new();
|
||||
|
||||
// parse commandline arguments
|
||||
res = t!(parse_arguments => lang);
|
||||
state = t!(state_started => lang);
|
||||
res = t!("parse.arguments", lang);
|
||||
state = t!("state.started", lang);
|
||||
trace!(target: "advotracker", process = ?res, state = ?state);
|
||||
|
||||
let _ = parse_args(&mut viperus);
|
||||
state = t!(state_finished => lang);
|
||||
state = t!("state.finished", lang);
|
||||
trace!(target: "advotracker", process = ?res, state = ?state);
|
||||
|
||||
// type conversion (viperus String -> u64)
|
||||
let test_policy_number = viperus
|
||||
.get::<String>("test_policy_number")
|
||||
.unwrap()
|
||||
.parse::<u64>()
|
||||
.unwrap();
|
||||
let test_policy_number = viperus.get::<String>("test_policy_number").unwrap().parse::<u64>().unwrap();
|
||||
trace!(target: "advotracker", test_policy_number = ?test_policy_number);
|
||||
|
||||
// main tasks
|
||||
res = t!(main_started => lang);
|
||||
state = t!(state_started => lang);
|
||||
res = t!("main.started", lang);
|
||||
state = t!("state.started", lang);
|
||||
trace!(target: "advotracker", process = ?res, state = ?state);
|
||||
|
||||
// use this only if you want to run it as web application.
|
||||
orbtk::initialize();
|
||||
|
||||
// Preset localization and language to "de_DE".
|
||||
// If the choosen language is not associated with a corresponding
|
||||
// dictionary, the contents of the default text property will be
|
||||
// rendered.
|
||||
// Preset localization and language from given environment.
|
||||
// if no dictionary is set for the chosen default language
|
||||
// the content of the text property will be drawn.
|
||||
//let language = lang.substring(0,5); // "de_DE.UTF-8" -> "de_DE"
|
||||
//info!("GUI-Language: preset to {:?}", language);
|
||||
let localization = RonLocalization::create()
|
||||
.language("de_DE")
|
||||
.language(&lang)
|
||||
.dictionary("de_DE", ADVOTRACKER_DE_DE)
|
||||
.build();
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
Application::from_name("nwx.advotracker")
|
||||
.localization(localization)
|
||||
.theme(theme())
|
||||
//.theme(theme_fluent_light())
|
||||
.window(|ctx| {
|
||||
Window::new()
|
||||
.title("AdvoTracker - DirectCall")
|
||||
.position((500.0, 100.0))
|
||||
.size(800.0, 620.0)
|
||||
.size(800.0, 600.0)
|
||||
//.min_width(460.0)
|
||||
//.min_height(380.0)
|
||||
.resizeable(true)
|
||||
@@ -230,27 +207,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.build(ctx)
|
||||
})
|
||||
.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);
|
||||
res = t!(main_finished => lang);
|
||||
state = t!("state.finished", lang);
|
||||
res = t!("main.finished", lang);
|
||||
trace!(target: "advotracker", process = ?res, state = ?state);
|
||||
});
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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 directories::ProjectDirs;
|
||||
|
||||
//use log::{debug, info, trace, warn};
|
||||
use std::env;
|
||||
use tracing::trace;
|
||||
use viperus::Viperus;
|
||||
@@ -14,24 +16,14 @@ use viperus::Viperus;
|
||||
/// Parse the commandline arguments and preset default values
|
||||
/// Precedence: defaults -> config-file -> environment -> commandline
|
||||
pub fn parse_args(viperus: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> {
|
||||
if cfg!(feature = "parse_cli") {
|
||||
trace!(target: "Viperus", "Enabled parsing features.");
|
||||
if cfg!(feature = "global") {
|
||||
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") {
|
||||
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: "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());
|
||||
if cfg!(feature = "fmt-clap") {
|
||||
trace!(target: "Viperus", "Viperus feature 'fmt-clap' enabled.");
|
||||
println!("Using feature fmt-clap");
|
||||
}
|
||||
|
||||
// preset default key/value pairs (lowest priority)
|
||||
@@ -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("export_file", String::from(""));
|
||||
viperus.add_default("test_policy_number", String::from("9999999992"));
|
||||
viperus.add_default(
|
||||
"to_email_address_file",
|
||||
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("to_email_address_file", 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("password", String::from("botpassword"));
|
||||
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!())
|
||||
.author(crate_authors!())
|
||||
.about(crate_description!())
|
||||
.after_help(
|
||||
"
|
||||
.after_help("
|
||||
Testprogramm: Allianz Online-Beratung Im/Export CSV-Daten
|
||||
Direct-Call via IVR-System (Interactive Voice Response)
|
||||
SMR Deckungssummen-Prüfung: 089 92529 60211
|
||||
SMR Unerledigt: 089 92529 60222",
|
||||
)
|
||||
SMR Unerledigt: 089 92529 60222")
|
||||
.template(
|
||||
"\
|
||||
{bin} v{version}
|
||||
@@ -193,15 +177,11 @@ SMR Unerledigt: 089 92529 60222",
|
||||
);
|
||||
println!(
|
||||
"to_email_address: {:?}",
|
||||
viperus
|
||||
.get::<String>("to_email_address")
|
||||
.unwrap_or_default()
|
||||
viperus.get::<String>("to_email_address").unwrap_or_default()
|
||||
);
|
||||
println!(
|
||||
"from_email_address: {:?}",
|
||||
viperus
|
||||
.get::<String>("from_email_address")
|
||||
.unwrap_or_default()
|
||||
viperus.get::<String>("from_email_address").unwrap_or_default()
|
||||
);
|
||||
println!(
|
||||
"test_policy_number: {:?}",
|
||||
@@ -1,26 +1,25 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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 locales::t;
|
||||
use std::error::Error;
|
||||
use tracing::trace;
|
||||
|
||||
use crate::Lang;
|
||||
|
||||
/// export as csv format
|
||||
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
|
||||
/// https://blog.burntsushi.net/csv/
|
||||
pub fn export(p: &mut String, lang: &Lang) -> Result<(), Box<dyn Error>> {
|
||||
pub fn export(p: &mut String, lang: &str) -> Result<(), Box<dyn Error>> {
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
//use std::ffi::OsStr;
|
||||
|
||||
let mut res = t!(csv_export_started => lang);
|
||||
let mut state = t!(state_started => lang);
|
||||
let mut res = t!("csv.export.started", lang);
|
||||
let mut state = t!("state.started", lang);
|
||||
trace!(target: "csv-export", process = ?res, state = ?state);
|
||||
|
||||
// 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)?;
|
||||
|
||||
trace!(target: "csv.export", extension = ?path.extension(), file = ?file);
|
||||
state = t!(state_finished => lang);
|
||||
res = t!(csv_export_finished => lang);
|
||||
state = t!("state.finished", lang);
|
||||
res = t!("csv.export.finished", lang);
|
||||
trace!(target: "csv-export", process = ?res, state = ?state);
|
||||
|
||||
Ok(())
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||
@@ -1,26 +1,27 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* advotracker - Hotline tackingtool for Advocats
|
||||
*
|
||||
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
|
||||
* SPDX-License-Identifier: (0BSD or MIT)
|
||||
*/
|
||||
|
||||
use lettre::{
|
||||
message::{header, MultiPart, SinglePart},
|
||||
transport::smtp::authentication::Credentials,
|
||||
Message, SmtpTransport, Transport,
|
||||
transport::smtp::authentication::Credentials,
|
||||
};
|
||||
use locales::t;
|
||||
use maud::html;
|
||||
use std::error::Error;
|
||||
//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
|
||||
pub fn sendticketdata(email: &Email, lang: &Lang) -> Result<(), Box<dyn Error>> {
|
||||
let mut res = t!(sendticketdata_export_started => lang);
|
||||
let mut state = t!(state_started =>lang);
|
||||
pub fn sendticketdata(email: &Email, lang: &str) -> Result<(), Box<dyn Error>> {
|
||||
let mut res = t!("sendticketdata.export.started", lang);
|
||||
let mut state = t!("state.started", lang);
|
||||
trace!(target: "sendticketdata", process = ?res, state = ?state);
|
||||
|
||||
// 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; }"
|
||||
}
|
||||
}
|
||||
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
|
||||
h2 { (email.subject) " (" (email.policy_code) ")" }
|
||||
p { "Vers.-Schein/Schadennummer: " (email.policy_code) }
|
||||
p { "Versicherungsnehmer: " (email.policy_holder) }
|
||||
p { "Selbstbehalt: " (email.deductible) }
|
||||
p { "Selbstbehalt: "(email.deductible) }
|
||||
p { "Rückrufnummer: " (email.callback_number) }
|
||||
p { "Erreichbarkeit: " (email.callback_date) }
|
||||
p { "Rechtsproblem: " (email.harm_type) }
|
||||
p { "Rechtsrat: " (email.ivr_comment) }
|
||||
p { "Rechtsproblem: "(email.harm_type) }
|
||||
p { "Rechtsrat: "(email.ivr_comment) }
|
||||
}
|
||||
};
|
||||
|
||||
let ascii_body = String::new()
|
||||
+ &"Vers.-Schein/Schadennummer".to_string()
|
||||
+ &(email.policy_code)
|
||||
+ &"\n"
|
||||
+ &"Versicherungsnehmer: ".to_string()
|
||||
+ &(email.policy_holder)
|
||||
+ &"\n"
|
||||
+ &"Selbstbehalt: ".to_string()
|
||||
+ &(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";
|
||||
+ &"Vers.-Schein/Schadennummer".to_string() + &(email.policy_code) + &"\n"
|
||||
+ &"Versicherungsnehmer: ".to_string() + &(email.policy_holder) + &"\n"
|
||||
+ &"Selbstbehalt: ".to_string() + &(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);
|
||||
|
||||
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())
|
||||
.to((email.mail_to).parse().unwrap())
|
||||
.cc((email.mail_cc).parse().unwrap())
|
||||
// we do not use bcc yet
|
||||
//.to((email.mail_to).parse().unwrap())
|
||||
//.cc((email.mail_cc).parse().unwrap())
|
||||
//.bcc((email.mail_bcc).parse().unwrap())
|
||||
.subject(
|
||||
String::new()
|
||||
.from((email.mail_from).parse().unwrap())
|
||||
.subject(String::new()
|
||||
+ &email.subject.to_string()
|
||||
+ &" (".to_string()
|
||||
+ &email.policy_code.to_string()
|
||||
+ &")".to_string(),
|
||||
+ &")".to_string()
|
||||
)
|
||||
.multipart(
|
||||
MultiPart::alternative() // This is composed of two parts.
|
||||
.singlepart(
|
||||
SinglePart::builder()
|
||||
.header(header::ContentType::TEXT_PLAIN)
|
||||
.header(header::ContentType(
|
||||
"text/plain; charset=utf8".parse().unwrap(),
|
||||
))
|
||||
.body(String::from(ascii_body)),
|
||||
)
|
||||
.singlepart(
|
||||
SinglePart::builder()
|
||||
.header(header::ContentType::TEXT_PLAIN)
|
||||
.header(header::ContentType(
|
||||
"text/html; charset=utf8".parse().unwrap(),
|
||||
))
|
||||
.body(html.into_string()),
|
||||
),
|
||||
)
|
||||
.expect("failed to build email");
|
||||
|
||||
|
||||
info!("message: {:?}", message);
|
||||
|
||||
// Create credential for remote authentication (username, password)
|
||||
// WIP: get credentials from config file / cli
|
||||
let credentials = Credentials::new(
|
||||
"service@hiedemann.de".to_string(),
|
||||
"88service99$".to_string(),
|
||||
);
|
||||
let creds = Credentials::new("info@kanzlei.hiedemann.de".to_string(), "17info67$".to_string());
|
||||
|
||||
|
||||
// standard smtp client connection
|
||||
//let mailer = SmtpTransport::starttls_relay("hiedemannsbs.kanzlei.hiedemann.de")
|
||||
|
||||
// Open a remote connection to relay server (port 2525)
|
||||
// WIP: get relay address from config file / cli
|
||||
//let relay = "hiedemannsbs.kanzlei.hiedemann.de"
|
||||
let relay = "smtp.strato.de";
|
||||
|
||||
let mailer = SmtpTransport::relay(relay)
|
||||
let mailer = SmtpTransport::relay("hiedemannsbs.kanzlei.hiedemann.de")
|
||||
.unwrap()
|
||||
.credentials(credentials)
|
||||
.credentials(creds)
|
||||
.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);
|
||||
|
||||
// Send the email and catch the error if it isn't successfully
|
||||
let _result = mailer.send(&message)?;
|
||||
|
||||
state = t!(state_finished => lang);
|
||||
res = t!(sendticketdata_export_finished => lang);
|
||||
state = t!("state.finished", lang);
|
||||
res = t!("sendticketdata.export.finished", lang);
|
||||
trace!(target: "sendticketdata", process = ?res, state = ?state);
|
||||
|
||||
Ok(())
|
||||
@@ -1,46 +1,43 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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 std::collections::HashMap;
|
||||
use chrono::{Local, DateTime};
|
||||
use locales::t;
|
||||
use std::error::Error;
|
||||
use std::collections::HashMap;
|
||||
use std::time::{Duration, SystemTime};
|
||||
use tracing::trace;
|
||||
|
||||
//use crate::db::redis;
|
||||
use crate::{
|
||||
data::structures::{PolicyCode, PolicyData, PolicyDataList},
|
||||
Lang,
|
||||
};
|
||||
use crate::data::structures::{PolicyCode, PolicyDataList, PolicyData};
|
||||
//use crate::data::structures::PolicyDataList;
|
||||
|
||||
/// import AllianzDirectCall data from a csv delimeted file
|
||||
/// save records to redis backend
|
||||
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
|
||||
/// https://blog.burntsushi.net/csv/
|
||||
pub fn import(
|
||||
path: &mut String,
|
||||
data_list: &mut PolicyDataList,
|
||||
pub fn import(p: &mut String, data_list: &mut PolicyDataList,
|
||||
policy_numbers: &mut HashMap<u64, PolicyCode>,
|
||||
policy_data_count: &mut u64,
|
||||
) -> Result<(u64, Duration), Box<dyn Error>> {
|
||||
use std::ffi::OsStr;
|
||||
policy_data_count: &mut u64,
|
||||
lang: &str)
|
||||
-> Result<(u64, Duration), Box<dyn Error>> {
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use std::ffi::OsStr;
|
||||
|
||||
let lang = Lang::De("");
|
||||
let mut res = t!(csv_import_started => lang);
|
||||
let mut state = t!(state_started => lang);
|
||||
let mut res = t!("csv.import.started", lang);
|
||||
let mut state = t!("state.started", lang);
|
||||
let time_start = SystemTime::now();
|
||||
let datetime: DateTime<Local> = time_start.into();
|
||||
|
||||
trace!(target: "csv-import", process = ?res, state = ?state, date_start = ?datetime.to_string());
|
||||
|
||||
// Note: slash syntax also works on Windows!
|
||||
let path = Path::new(path);
|
||||
let path = Path::new(p);
|
||||
|
||||
// must be a readable file
|
||||
trace!(target: "csv-import", path = ?path);
|
||||
@@ -68,7 +65,7 @@ pub fn import(
|
||||
}
|
||||
|
||||
// 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() {
|
||||
// The iterator yields Result<StringRecord, Error>, so we check the
|
||||
// error here.
|
||||
@@ -84,18 +81,17 @@ pub fn import(
|
||||
// push record as new vector elements
|
||||
data_list.push(record);
|
||||
|
||||
count += 1;
|
||||
count +=1;
|
||||
*policy_data_count = count;
|
||||
}
|
||||
};
|
||||
|
||||
let time_end = SystemTime::now();
|
||||
let duration = time_end
|
||||
.duration_since(time_start)
|
||||
let duration = time_end.duration_since(time_start)
|
||||
.expect("Clock may have gone backwards");
|
||||
trace!(target: "csv-import", record_count = ?count, duration = ?duration);
|
||||
|
||||
state = t!(state_finished => lang);
|
||||
res = t!(csv_import_finished => lang);
|
||||
state = t!("state.finished", lang);
|
||||
res = t!("csv.import.finished", lang);
|
||||
let datetime: DateTime<Local> = time_end.into();
|
||||
trace!(target: "csv-import", process = ?res, state = ?state, date_stop = ?datetime.to_string());
|
||||
|
||||
@@ -105,22 +101,18 @@ pub fn import(
|
||||
#[test]
|
||||
fn test_import() {
|
||||
// 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]);
|
||||
|
||||
let mut csv_import_path = String::from("data/POLLFNR_TEST.txt");
|
||||
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 lang = "en".to_string();
|
||||
|
||||
match import(
|
||||
&mut csv_import_path,
|
||||
&mut policy_data,
|
||||
&mut policy_numbers,
|
||||
&mut policy_data_count,
|
||||
&lang,
|
||||
) {
|
||||
match import(&mut csv_import_path, &mut policy_data,
|
||||
&mut policy_numbers, &mut policy_data_count,
|
||||
&lang) {
|
||||
Ok((count, duration)) => {
|
||||
println!("import {:?} records. Duration: {:?}", count, duration);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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;
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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::*;
|
||||
@@ -14,16 +14,17 @@ use crate::widgets::configuration::configuration_view::ConfigurationView;
|
||||
/// Valid `actions` that are handled as state changes in the `Configuration` widget.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum ConfigurationAction {
|
||||
/// Save configuration data
|
||||
SaveConfiguration,
|
||||
/// Load configuration data
|
||||
LoadConfiguration,
|
||||
}
|
||||
|
||||
/// Define valid configuration data.
|
||||
/// This structure is serialized and saved inside the OS dependent settings file.
|
||||
#[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.
|
||||
#[derive(Debug, Default, AsAny)]
|
||||
@@ -42,17 +43,20 @@ impl State for ConfigurationState {
|
||||
registry
|
||||
.get::<Settings>("settings")
|
||||
.load_async::<ConfigurationData>(
|
||||
"configuration_data".to_string(),
|
||||
ctx.entity(),
|
||||
"configuration_data".to_string(), ctx.entity()
|
||||
);
|
||||
}
|
||||
ConfigurationAction::SaveConfiguration => {
|
||||
let configuration_file: String =
|
||||
ConfigurationView::configuration_file_clone(&ctx.widget());
|
||||
let configuration_file: String = ConfigurationView::configuration_file_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(),
|
||||
ConfigurationData(configuration_file, language_id),
|
||||
ConfigurationData(
|
||||
configuration_file,
|
||||
language_id
|
||||
),
|
||||
ctx.entity(),
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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::*;
|
||||
@@ -14,11 +14,8 @@ use crate::{
|
||||
|
||||
// Macro that initializes the widget structures/variables for our view
|
||||
widget!(
|
||||
/// Configuration View
|
||||
ConfigurationView<ConfigurationState> {
|
||||
/// Configuration file
|
||||
configuration_file: String,
|
||||
/// Language identifier
|
||||
language_id: String
|
||||
}
|
||||
);
|
||||
@@ -31,9 +28,13 @@ impl Template for ConfigurationView {
|
||||
Grid::new()
|
||||
.id(ID_CONFIGURATION_FORM)
|
||||
.style("configuration_form")
|
||||
.columns(Columns::create().push(120).push(12).push("auto"))
|
||||
.rows(
|
||||
Rows::create()
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push(120)
|
||||
.push(12)
|
||||
.push("auto")
|
||||
)
|
||||
.rows(Rows::create()
|
||||
.push("auto") // Header_Bar
|
||||
.push(4) // Seperator
|
||||
.push("auto") // Configuartion_File
|
||||
@@ -97,8 +98,15 @@ impl Template for ConfigurationView {
|
||||
.attach(Grid::column(0))
|
||||
.attach(Grid::row(6))
|
||||
.attach(Grid::column_span(3))
|
||||
.columns(Columns::create().push("auto").push(8).push("auto"))
|
||||
.rows(Rows::create().push("auto"))
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push("auto")
|
||||
.push(8)
|
||||
.push("auto")
|
||||
)
|
||||
.rows(Rows::create()
|
||||
.push("auto")
|
||||
)
|
||||
.child(
|
||||
Button::new()
|
||||
.style("button_single_content")
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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;
|
||||
@@ -13,7 +13,10 @@ use tracing::{info, trace};
|
||||
|
||||
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
|
||||
/// located in the current call directory
|
||||
@@ -26,24 +29,19 @@ struct Environment {
|
||||
|
||||
/// Provides generic methods to handle states of datatypes.
|
||||
pub trait GlobalState {
|
||||
/// Get the lanuage identifier
|
||||
fn get_lang() -> String {
|
||||
// get system environment
|
||||
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);
|
||||
|
||||
// testing environment: read from .env file
|
||||
dotenv().ok();
|
||||
match envy::from_env::<Environment>() {
|
||||
Ok(environment) => {
|
||||
if environment.test_lang != lang {
|
||||
lang = environment.test_lang;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
info!(target: "advotracker", "{}", e)
|
||||
}
|
||||
if environment.test_lang != lang { lang = environment.test_lang; }
|
||||
},
|
||||
Err(e) => { info!(target: "advotracker", "{}", e) }
|
||||
}
|
||||
trace!(target: "advotracker", lang = ?lang);
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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 tracing::info;
|
||||
|
||||
use crate::widgets::localization::localization_view::LocalizationView;
|
||||
|
||||
/// Structure handling the localization status
|
||||
#[derive(AsAny, Debug, Default)]
|
||||
pub struct LocalizationState {
|
||||
/// Change the language boolean
|
||||
change_language: bool,
|
||||
}
|
||||
|
||||
impl LocalizationState {
|
||||
/// Change the active/selected language
|
||||
pub fn change_language(&mut self) {
|
||||
self.change_language = true;
|
||||
}
|
||||
@@ -30,10 +26,8 @@ impl State for LocalizationState {
|
||||
return;
|
||||
}
|
||||
|
||||
// get value of activ selected combo_box item
|
||||
let index = *LocalizationView::selected_index_ref(&ctx.widget()) as usize;
|
||||
let selected_language = LocalizationView::languages_ref(&ctx.widget())[index].clone();
|
||||
info!("New selected language item: {:?}", selected_language);
|
||||
|
||||
match selected_language.as_str() {
|
||||
"English" => ctx.set_language("en_US"),
|
||||
@@ -1,23 +1,22 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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 crate::{data::constants::*, widgets::localization::localization_state::LocalizationState};
|
||||
use crate::{
|
||||
data::constants::*,
|
||||
widgets::localization::localization_state::LocalizationState,
|
||||
};
|
||||
|
||||
type List = Vec<String>;
|
||||
|
||||
// Macro that initializes the widget structures/variables for our view
|
||||
widget!(
|
||||
/// Dialog to change active localization settings
|
||||
LocalizationView<LocalizationState> {
|
||||
/// The language list
|
||||
widget!(LocalizationView<LocalizationState> {
|
||||
languages: List,
|
||||
/// The selected language index
|
||||
selected_index: i32 }
|
||||
);
|
||||
|
||||
@@ -28,13 +27,19 @@ impl Template for LocalizationView {
|
||||
let languages = vec!["English".to_string(), "German".to_string()];
|
||||
let count = languages.len();
|
||||
|
||||
self.languages(languages).selected_index(1).child(
|
||||
self.languages(languages)
|
||||
.selected_index(1)
|
||||
.child(
|
||||
Grid::new()
|
||||
.id(ID_LOCALIZATION_FORM)
|
||||
.margin(4)
|
||||
.columns(Columns::create().push(120).push(12).push(150))
|
||||
.rows(
|
||||
Rows::create()
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push(120)
|
||||
.push(12)
|
||||
.push(150)
|
||||
)
|
||||
.rows(Rows::create()
|
||||
.push("auto")
|
||||
.push(4)
|
||||
.push("auto")
|
||||
@@ -71,8 +76,9 @@ impl Template for LocalizationView {
|
||||
.attach(Grid::column(2))
|
||||
.attach(Grid::row(2))
|
||||
.items_builder(move |bc, index| {
|
||||
let text =
|
||||
bc.get_widget(id).get::<Vec<String>>("languages")[index].clone();
|
||||
let text = bc.get_widget(id)
|
||||
.get::<Vec<String>>("languages")[index]
|
||||
.clone();
|
||||
TextBlock::new()
|
||||
.id(ID_LOCALIZATION_LANGUAGE_NAME)
|
||||
.v_align("center")
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||
@@ -1,38 +1,39 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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 crate::{
|
||||
data::{constants::*, structures::PolicyCheck},
|
||||
data::{
|
||||
constants::*,
|
||||
structures::PolicyCheck,
|
||||
},
|
||||
widgets::configuration::configuration_view::ConfigurationView,
|
||||
widgets::localization::localization_view::LocalizationView,
|
||||
widgets::policycheck::policycheck_view::PolicycheckView,
|
||||
widgets::localization::localization_view::LocalizationView,
|
||||
//widgets::menu::menu_view::MenuView,
|
||||
widgets::ticketdata::ticketdata_view::TicketdataView,
|
||||
};
|
||||
|
||||
// [START] view
|
||||
// [START] views
|
||||
|
||||
widget!(
|
||||
/// The main view offering accessible forms
|
||||
MainView {
|
||||
widget!(MainView {
|
||||
// policy_list: PolicyList,
|
||||
// policy_data_list: PolicyDataList,
|
||||
// policylist_view: u32,
|
||||
// policydata_view: u32,
|
||||
/// The policycheck view
|
||||
policycheck_view: PolicyCheck //ticketdata_view: TicketData
|
||||
}
|
||||
);
|
||||
policycheck_view: PolicyCheck
|
||||
//ticketdata_view: TicketData
|
||||
});
|
||||
|
||||
impl Template for MainView {
|
||||
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()
|
||||
.target(ticketdata_view.0)
|
||||
@@ -1,12 +1,13 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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 orbtk::{prelude::*, shell::*, widgets::themes::*};
|
||||
use orbtk::prelude::*;
|
||||
use orbtk::shell::event::Key;
|
||||
use tracing::{info, trace};
|
||||
|
||||
use std::process;
|
||||
@@ -20,30 +21,21 @@ use crate::{
|
||||
/// Valid `actions` that are handled as state changes in the `Menu` widget.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum MenuAction {
|
||||
/// Create a new menu
|
||||
CreateMenu,
|
||||
/// Toggle between available menu themes
|
||||
CreateMenuToggleTheme,
|
||||
/// Remove a menu entry
|
||||
RemoveMenu,
|
||||
/// Remove a menu toggle theme
|
||||
RemoveMenuToggleTheme,
|
||||
/// Set the active theme
|
||||
SetTheme,
|
||||
/// Update the relative position inside the menu
|
||||
UpdateMenuRelativePosition,
|
||||
UpdateMenuRelativePosition
|
||||
}
|
||||
|
||||
/// Valid `structures` that are handled inside the state of the `Menu` widget.
|
||||
#[derive(AsAny, Default)]
|
||||
pub struct MenuState {
|
||||
/// Define the menu action
|
||||
action: Option<MenuAction>,
|
||||
/// Define the menu entity
|
||||
menu: 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.
|
||||
@@ -116,9 +108,7 @@ impl State for MenuState {
|
||||
// append the child to target (overlay stays on top of the main tree)
|
||||
ctx.build_context()
|
||||
.append_child_to_overlay(menu_popup)
|
||||
.expect(
|
||||
"Failed create an overlay that consumes popup `menu` as its child.",
|
||||
);
|
||||
.expect("Failed create an overlay that consumes popup `menu` as its child.");
|
||||
self.menu = Some(menu_popup);
|
||||
|
||||
trace!(menu = ?self.menu);
|
||||
@@ -126,10 +116,7 @@ impl State for MenuState {
|
||||
// open: is the default
|
||||
//ctx.get_widget(menu).set("open", true);
|
||||
|
||||
info!(
|
||||
"CreateMenu: parent {:?}, target: {:?}, popup: {:?}",
|
||||
parent, target, self.menu
|
||||
);
|
||||
info!("CreateMenu: parent {:?}, target: {:?}, popup: {:?}", parent, target, self.menu);
|
||||
}
|
||||
|
||||
MenuAction::SetTheme => {
|
||||
@@ -138,18 +125,18 @@ impl State for MenuState {
|
||||
cfg_if! {
|
||||
if #[cfg(windows)] {
|
||||
match theme_index {
|
||||
0 => ctx.switch_theme(Rc::new(theme_default_dark())),
|
||||
1 => ctx.switch_theme(Rc::new(theme_default_light())),
|
||||
2 => ctx.switch_theme(Rc::new(theme_redox())),
|
||||
3 => ctx.switch_theme(Rc::new(theme_fluent_dark())),
|
||||
4 => ctx.switch_theme(Rc::new(theme_fluent_light())),
|
||||
0 => ctx.switch_theme(theme_default_dark()),
|
||||
1 => ctx.switch_theme(theme_default_light()),
|
||||
2 => ctx.switch_theme(theme_redox()),
|
||||
3 => ctx.switch_theme(theme_fluent_dark()),
|
||||
4 => ctx.switch_theme(theme_fluent_light()),
|
||||
_ => {}
|
||||
}
|
||||
} else {
|
||||
match theme_index {
|
||||
0 => ctx.switch_theme(Rc::new(theme_default_dark())),
|
||||
1 => ctx.switch_theme(Rc::new(theme_default_light())),
|
||||
2 => ctx.switch_theme(Rc::new(theme_redox())),
|
||||
0 => ctx.switch_theme(theme_default_dark()),
|
||||
1 => ctx.switch_theme(theme_default_light()),
|
||||
2 => ctx.switch_theme(theme_redox()),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -165,26 +152,21 @@ impl State for MenuState {
|
||||
if let Some(action) = self.action {
|
||||
match action {
|
||||
MenuAction::CreateMenuToggleTheme => {
|
||||
let menu_target = ctx.entity_of_child(ID_MENU_LABEL_TOGGLE_THEME).expect(
|
||||
"MenuState: Can't find entity of resource 'ID_MENU_LABEL_TOGGLE_THEME'.",
|
||||
);
|
||||
let menu_target = ctx
|
||||
.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 build_context = &mut ctx.build_context();
|
||||
|
||||
// create a new menu popup
|
||||
self.menu_toggle_theme =
|
||||
create_menu_toggle_theme_popup(current_entity, build_context);
|
||||
self.menu_toggle_theme = create_menu_toggle_theme_popup(current_entity, build_context);
|
||||
|
||||
// create a menu_popup widget as a child of entity "ID_POPUP_MENU"
|
||||
build_context.append_child(menu_target, self.menu_toggle_theme);
|
||||
|
||||
ctx.get_widget(self.menu_toggle_theme)
|
||||
.clone::<Visibility>("visibility");
|
||||
ctx.get_widget(self.menu_toggle_theme).clone::<Visibility>("visibility");
|
||||
|
||||
println!(
|
||||
"Popup Menu Toggle Theme created: {:?}",
|
||||
self.menu_toggle_theme
|
||||
);
|
||||
println!("Popup Menu Toggle Theme created: {:?}", self.menu_toggle_theme);
|
||||
}
|
||||
MenuAction::RemoveMenu => {
|
||||
self.remove_menu(ctx);
|
||||
@@ -236,22 +218,23 @@ fn create_menu_popup(target: Entity, ctx: &mut BuildContext<'_>) -> Entity {
|
||||
//.style("popup_menu")
|
||||
.width(300.0)
|
||||
.height(100.0)
|
||||
.on_key_down(move |ctx, key_event| {
|
||||
|
||||
.on_key_down(move | ctx, key_event | {
|
||||
match key_event.key {
|
||||
Key::Q(..) => {
|
||||
//if is_ctrl_home_down(ctx)
|
||||
println!("KeyHandler: got Ctrl+Q");
|
||||
process::exit(0);
|
||||
//}
|
||||
}
|
||||
},
|
||||
Key::Escape => {
|
||||
println!("KeyHandler: got Escape");
|
||||
ctx.get_mut::<MenuState>(target)
|
||||
.set_action(MenuAction::RemoveMenu);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
println!("KeyHandler: got {:?}", key_event.key);
|
||||
}
|
||||
},
|
||||
};
|
||||
true
|
||||
})
|
||||
@@ -275,9 +258,14 @@ fn create_menu_popup(target: Entity, ctx: &mut BuildContext<'_>) -> Entity {
|
||||
Columns::create()
|
||||
.push("180") // Menu Button
|
||||
.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(
|
||||
Button::new()
|
||||
.id(ID_MENU_LABEL_ACCOUNT)
|
||||
@@ -343,6 +331,7 @@ fn create_menu_popup(target: Entity, ctx: &mut BuildContext<'_>) -> Entity {
|
||||
.build(ctx)
|
||||
}
|
||||
|
||||
|
||||
fn _create_popup(target: Entity, text: &str, ctx: &mut BuildContext<'_>) -> Entity {
|
||||
Popup::new()
|
||||
.id("test_popup")
|
||||
@@ -371,6 +360,8 @@ fn _create_popup(target: Entity, text: &str, ctx: &mut BuildContext<'_>) -> Enti
|
||||
.build(ctx)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Create a new popup submenu to toogle the active theme
|
||||
fn create_menu_toggle_theme_popup(id: Entity, ctx: &mut BuildContext<'_>) -> Entity {
|
||||
cfg_if! {
|
||||
@@ -401,16 +392,16 @@ fn create_menu_toggle_theme_popup(id: Entity, ctx: &mut BuildContext<'_>) -> Ent
|
||||
.style("container_menu")
|
||||
.width(280)
|
||||
.height(140)
|
||||
.on_key_down(move |_ctx, key_event| {
|
||||
.on_key_down(move | _ctx, key_event | {
|
||||
match key_event.key {
|
||||
Key::Escape => {
|
||||
println!("KeyHandler: got Escape");
|
||||
//ctx.get_mut::<MenuState>(id)
|
||||
// .set_action(MenuAction::RemoveMenuToggleTheme);
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
println!("KeyHandler: got {:?}", key_event.key);
|
||||
}
|
||||
},
|
||||
};
|
||||
true
|
||||
})
|
||||
@@ -421,11 +412,9 @@ fn create_menu_toggle_theme_popup(id: Entity, ctx: &mut BuildContext<'_>) -> Ent
|
||||
.count(themes_count)
|
||||
.style("combo_box_form")
|
||||
.items_builder(move |ctx, index| {
|
||||
let theme_name = MenuView::themes_ref(&ctx.get_widget(id))[index].clone();
|
||||
TextBlock::new()
|
||||
.v_align("center")
|
||||
.text(theme_name)
|
||||
.build(ctx)
|
||||
let theme_name =
|
||||
MenuView::themes_ref(&ctx.get_widget(id))[index].clone();
|
||||
TextBlock::new().v_align("center").text(theme_name).build(ctx)
|
||||
})
|
||||
.on_changed("selected_index", move |states, _entity| {
|
||||
states.send_message(MenuAction::SetTheme, id);
|
||||
@@ -1,11 +1,11 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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::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
|
||||
widget!(
|
||||
/// Present and handle the menu items
|
||||
MenuView<MenuState> {
|
||||
//menu_stack: Entity,
|
||||
//button_menu: Entity,
|
||||
/// The selected menu index
|
||||
selected_index: i32,
|
||||
/// The supported themes list
|
||||
themes: List
|
||||
}
|
||||
);
|
||||
@@ -38,8 +35,7 @@ impl Template for MenuView {
|
||||
.v_align("end")
|
||||
.child(
|
||||
Container::new()
|
||||
.child(
|
||||
Container::new()
|
||||
.child( Container::new()
|
||||
.margin((0, 16, 16, 0))
|
||||
.v_align("center")
|
||||
.child(
|
||||
@@ -61,7 +57,7 @@ impl Template for MenuView {
|
||||
TextBlock::new()
|
||||
.margin((0, 9, 48, 0))
|
||||
.text("©Networkx GmbH")
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
@@ -105,22 +101,24 @@ impl Template for MenuView {
|
||||
.build(ctx);
|
||||
|
||||
//self.themes(themes).child(MenuState::create_menu(ID_MENU_POPUP, ctx))
|
||||
self.name("MenuView").child(
|
||||
self.name("MenuView")
|
||||
.child(
|
||||
Grid::new()
|
||||
.id(ID_MENU_VIEW)
|
||||
.columns(
|
||||
Columns::create()
|
||||
.push(50) // Left margin
|
||||
.push("*") // Content
|
||||
.push(50), // Right margin
|
||||
.push(50) // Right margin
|
||||
)
|
||||
.rows(
|
||||
Rows::create()
|
||||
.push("auto") // Header_Bar
|
||||
.push(28) // Seperator
|
||||
.push("*") // InputForm
|
||||
.push("auto"), // Bottom_Bar
|
||||
.push("auto") // Bottom_Bar
|
||||
)
|
||||
|
||||
.child(menu_header_bar) // Row 0
|
||||
.child(menu_bottom_bar) // Row 3
|
||||
.build(ctx),
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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.
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||
@@ -1,22 +1,23 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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 std::collections::HashMap;
|
||||
use std::process;
|
||||
use std::collections::HashMap;
|
||||
use std::time::{Duration, SystemTime};
|
||||
use tracing::{error, info, trace};
|
||||
|
||||
use crate::{
|
||||
data::{
|
||||
constants::*,
|
||||
structures::{PolicyCode, PolicyDataList, PolicyList},
|
||||
constants::*,
|
||||
},
|
||||
//services::imports::allianzdirectcall::import,
|
||||
services::imports::allianzdirectcall,
|
||||
@@ -24,51 +25,31 @@ use crate::{
|
||||
//widgets::menu::menu_view::MenuView,
|
||||
//widgets::policycheck::policycheck_view::PolicycheckView,
|
||||
//widgets::ticketdata::ticketdata_state::TicketdataAction,
|
||||
Lang,
|
||||
};
|
||||
|
||||
/// Enumeration of valid `action variants` that need to be handled as
|
||||
/// state changes for the `PolicycheckView` widget.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum PolicycheckAction {
|
||||
/// Clear the policy number
|
||||
ClearPolicyNumber,
|
||||
/// Change the active theme
|
||||
ClearEntry(Entity),
|
||||
ChangeTheme(),
|
||||
/// Send the policy number
|
||||
SendPolicynumber(),
|
||||
/// Entity of the changed input text
|
||||
InputTextChanged(Entity),
|
||||
/// Import data to the form
|
||||
ImportData,
|
||||
/// Create a new ticket
|
||||
NewTicket,
|
||||
/// Entity-id of the policy number to parse
|
||||
ParsePolicyNumber(Entity),
|
||||
/// Remove the focus of current entity
|
||||
RemoveFocus(Entity),
|
||||
/// Entity-id of popup to bo removed
|
||||
RemovePopup(Entity),
|
||||
/// Reset the progress status
|
||||
ResetProgress,
|
||||
/// Get progress status
|
||||
GetProgress,
|
||||
/// Set the progress status to given value
|
||||
SetProgress(f64),
|
||||
/// Set the progress popup to given entity-id
|
||||
SetProgressPopup(Entity),
|
||||
/// Set the entitiy-id for theme to be toggled to
|
||||
SetToggleTheme(Entity),
|
||||
/// Set the given entity-id
|
||||
SetEntry(Entity),
|
||||
/// Set visibility status of given entity-id
|
||||
SetVisibility(Entity),
|
||||
/// Set changed status of given text entity-id
|
||||
TextChanged(Entity, usize),
|
||||
/// Update the given policy code
|
||||
UpdatePolicyCode,
|
||||
/// Update the process status to given value
|
||||
UpdateProgress(f64),
|
||||
UpdateProgress(f64)
|
||||
}
|
||||
|
||||
/// Define valid environment variables provided via .env files
|
||||
@@ -87,7 +68,7 @@ pub struct PolicycheckState {
|
||||
button_menu: Entity,
|
||||
duration: Duration,
|
||||
label_result: Entity,
|
||||
lang: Lang,
|
||||
lang: String,
|
||||
policy_data_count: u64,
|
||||
//policy_number: Entity,
|
||||
policy_numbers: HashMap<u64, PolicyCode>,
|
||||
@@ -96,7 +77,7 @@ pub struct PolicycheckState {
|
||||
progress_popup: Entity,
|
||||
// target that recieves messages
|
||||
target: Entity,
|
||||
ticketdata_view: Entity,
|
||||
ticketdata: Entity
|
||||
}
|
||||
|
||||
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.
|
||||
impl PolicycheckState {
|
||||
/// Create a hashmap (key: policy number, value: policy type).
|
||||
pub fn create_hashmap(
|
||||
&mut self,
|
||||
_ctx: &mut Context<'_>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
pub fn create_hashmap(&mut self, _ctx: &mut Context<'_>)
|
||||
-> Result<(), Box<dyn std::error::Error>> {
|
||||
trace!(target: "advotracker", create_hashmap = "started");
|
||||
|
||||
let policy_list = PolicyList::new("policy list");
|
||||
trace!(target: "advotracker", policy_list = ?policy_list);
|
||||
|
||||
// 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);
|
||||
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 ...
|
||||
//let mut csv_import_path = v.get::<String>("import_file").unwrap();
|
||||
let mut csv_import_path = String::from("POLLFNR_WOECHENTLICH.txt");
|
||||
match allianzdirectcall::import(
|
||||
&mut csv_import_path,
|
||||
&mut policy_data,
|
||||
&mut policy_numbers,
|
||||
&mut self.policy_data_count,
|
||||
) {
|
||||
match allianzdirectcall::import(&mut csv_import_path, &mut policy_data,
|
||||
&mut policy_numbers, &mut self.policy_data_count,
|
||||
&self.lang) {
|
||||
Ok((count, duration)) => {
|
||||
self.policy_data_count = count;
|
||||
self.duration = duration;
|
||||
@@ -150,27 +126,13 @@ impl PolicycheckState {
|
||||
}
|
||||
|
||||
/// Clear text in text box.
|
||||
pub fn clear_policy_number(&mut self, ctx: &mut Context<'_>) {
|
||||
TextBox::text_set(
|
||||
&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,
|
||||
);
|
||||
}
|
||||
pub fn clear_entry(&mut self, _text_box: Entity, ctx: &mut Context<'_>) {
|
||||
TextBox::text_set(&mut ctx.widget(), String::from(""));
|
||||
}
|
||||
|
||||
/// 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
|
||||
if self.policy_data_count == 0 {
|
||||
TextBlock::enabled_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), true);
|
||||
@@ -184,16 +146,13 @@ impl PolicycheckState {
|
||||
for _ in 1..4 {
|
||||
self.progress_count += 0.33;
|
||||
self.update_progress_bar(ctx);
|
||||
ctx.send_message(
|
||||
PolicycheckAction::UpdateProgress(self.progress_count),
|
||||
self.progress_popup,
|
||||
);
|
||||
ctx.send_message(PolicycheckAction::UpdateProgress(self.progress_count), self.progress_popup);
|
||||
}
|
||||
|
||||
// importing policy code elements from csv-file
|
||||
match self.create_hashmap(ctx) {
|
||||
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);
|
||||
trace!(target: "advotracker",
|
||||
hashmap_status = ?res,
|
||||
@@ -201,9 +160,10 @@ impl PolicycheckState {
|
||||
|
||||
self.progress_count = 1.;
|
||||
self.update_progress_bar(ctx);
|
||||
|
||||
}
|
||||
_ => {
|
||||
let res = t!(policy_hashmap_failed => self.lang);
|
||||
let res = t!("policy.hashmap.failed", self.lang);
|
||||
error!("{:?}", res);
|
||||
trace!(target: "advotracker", hashmap_status = ?res);
|
||||
}
|
||||
@@ -219,15 +179,16 @@ impl PolicycheckState {
|
||||
}
|
||||
|
||||
/// 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.");
|
||||
self.ticketdata_view.0;
|
||||
self(ticketdata_view.0);
|
||||
//ctx.widget().get_mut::<TicketdataView>(0).
|
||||
//ctx.get_widget(self.ticketdata_view);
|
||||
}
|
||||
|
||||
/// 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");
|
||||
|
||||
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) {
|
||||
Ok(()) => {
|
||||
trace!(target: "advotracker", policycheck_state = "init", import_data = "success");
|
||||
Stack::visibility_set(
|
||||
&mut ctx.child(ID_POLICY_DATA_STACK),
|
||||
Visibility::Visible,
|
||||
);
|
||||
Stack::visibility_set(&mut ctx.child(ID_POLICY_DATA_STACK), Visibility::Visible);
|
||||
let policy_data_count_string = format!("{:?}", &self.policy_data_count);
|
||||
TextBlock::text_set(
|
||||
&mut ctx.child(ID_POLICY_DATA_COUNT),
|
||||
String::from(&policy_data_count_string),
|
||||
);
|
||||
}
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_DATA_COUNT), String::from(&policy_data_count_string));
|
||||
},
|
||||
|
||||
Err(e) => {
|
||||
trace!(target: "advotracker", policycheck_state = "init", import_data = ?e)
|
||||
}
|
||||
Err(e) => trace!(target: "advotracker", policycheck_state = "init", import_data = ?e),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,23 +213,13 @@ impl PolicycheckState {
|
||||
// Parse policy code: "AS-123456789"
|
||||
// DION VERS POLLFNR
|
||||
// 1 AS 1515735810
|
||||
Stack::visibility_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_ACTION_STACK),
|
||||
Visibility::Collapsed,
|
||||
);
|
||||
Button::background_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
|
||||
String::from("transparent"),
|
||||
);
|
||||
Button::background_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("transparent"));
|
||||
|
||||
if policy_number_length == 10 {
|
||||
// cast policy_number_sting to <u64>
|
||||
match policy_number_string.parse::<u64>() {
|
||||
Ok(p) => {
|
||||
TextBlock::text_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE),
|
||||
String::from(""),
|
||||
);
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), String::from(""));
|
||||
|
||||
// match hashmap's key
|
||||
match self.policy_numbers.get(&p) {
|
||||
@@ -285,259 +228,99 @@ impl PolicycheckState {
|
||||
trace!(target: "advotracker", state = "success",
|
||||
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
|
||||
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"),
|
||||
);
|
||||
Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#008000"));
|
||||
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);
|
||||
|
||||
Button::icon_brush_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
|
||||
String::from("#008000"),
|
||||
);
|
||||
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,
|
||||
);
|
||||
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);
|
||||
}
|
||||
_ => {
|
||||
// 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);
|
||||
|
||||
TextBox::foreground_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER),
|
||||
String::from("#FF0000"),
|
||||
);
|
||||
TextBlock::text_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_HINT),
|
||||
String::from("The given policy number is invalid"),
|
||||
);
|
||||
TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), 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(
|
||||
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
|
||||
String::from("#FF0000"),
|
||||
);
|
||||
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,
|
||||
);
|
||||
Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
|
||||
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(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
|
||||
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_LABEL_HINT),
|
||||
Visibility::Visible,
|
||||
);
|
||||
}
|
||||
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);
|
||||
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) => {
|
||||
trace!(target: "advotracker", state = "error", error_type = "invalid type", error = ?e);
|
||||
|
||||
TextBox::foreground_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER),
|
||||
String::from("#FF0000"),
|
||||
);
|
||||
TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#FF0000"));
|
||||
|
||||
TextBlock::text_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_HINT),
|
||||
String::from("Only numbers are valid"),
|
||||
);
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_HINT), String::from("Only numbers are valid"));
|
||||
|
||||
Button::icon_brush_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
|
||||
String::from("#FF0000"),
|
||||
);
|
||||
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,
|
||||
);
|
||||
Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
|
||||
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(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
|
||||
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_LABEL_HINT),
|
||||
Visibility::Visible,
|
||||
);
|
||||
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);
|
||||
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 {
|
||||
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");
|
||||
|
||||
TextBox::foreground_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER),
|
||||
String::from("#FF0000"),
|
||||
);
|
||||
TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#FF0000"));
|
||||
|
||||
TextBlock::visibility_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_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_HINT), Visibility::Visible);
|
||||
TextBlock::text_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_HINT),
|
||||
String::from("Policy number is to short"),
|
||||
);
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_HINT), String::from("Policy number is to short"));
|
||||
|
||||
Button::icon_brush_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
|
||||
String::from("#FF0000"),
|
||||
);
|
||||
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,
|
||||
);
|
||||
Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
|
||||
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(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
|
||||
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_RESULT), 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_LABEL_HINT),
|
||||
Visibility::Visible,
|
||||
);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
|
||||
}
|
||||
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");
|
||||
|
||||
TextBox::foreground_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER),
|
||||
String::from("#FF0000"),
|
||||
);
|
||||
TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#FF0000"));
|
||||
|
||||
TextBlock::visibility_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT),
|
||||
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_LABEL_HINT), 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);
|
||||
|
||||
Button::icon_brush_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
|
||||
String::from("#FF0000"),
|
||||
);
|
||||
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,
|
||||
);
|
||||
Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
|
||||
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(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
|
||||
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_RESULT), 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_LABEL_HINT),
|
||||
Visibility::Visible,
|
||||
);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
|
||||
}
|
||||
|
||||
trace!(target: "advotracker", parse_entry = "finished");
|
||||
@@ -545,8 +328,7 @@ impl PolicycheckState {
|
||||
|
||||
/// parse message 'ParseEntry'
|
||||
pub fn parse_policy_number(&mut self, entity: Entity) {
|
||||
self.actions
|
||||
.push(PolicycheckAction::ParsePolicyNumber(entity));
|
||||
self.actions.push(PolicycheckAction::ParsePolicyNumber(entity));
|
||||
}
|
||||
|
||||
/// Remove the popup box
|
||||
@@ -580,95 +362,59 @@ impl PolicycheckState {
|
||||
/// Change status of given text box to edit mode.
|
||||
fn set_entry(&mut self, text_box: Entity, ctx: &mut Context<'_>) {
|
||||
if ctx.get_widget(text_box).get::<String16>("text").is_empty() {
|
||||
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,
|
||||
);
|
||||
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);
|
||||
} else {
|
||||
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_LABEL_RESULT), 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
|
||||
fn set_popup_progress(&mut self, ctx: &mut Context<'_>) {
|
||||
// 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(
|
||||
"PolicycheckState: Can't find entity of resource 'ID_POLICY_CHECK_POLICY_NUMBER'.",
|
||||
);
|
||||
let stack = ctx
|
||||
.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 build_context = &mut ctx.build_context();
|
||||
|
||||
// create the progress_popup widget
|
||||
self.progress_popup = create_popup_progress(current_entity, build_context);
|
||||
info!(
|
||||
"set_popup_progress: New entity 'popup_progress' {:?} created",
|
||||
self.progress_popup
|
||||
);
|
||||
info!("set_popup_progress: New entity 'popup_progress' {:?} created", self.progress_popup);
|
||||
|
||||
// append the stack inside the progress_popup
|
||||
build_context.append_child(stack, self.progress_popup);
|
||||
|
||||
// make sure we have a progress bar
|
||||
self.progress_bar = ctx.entity_of_child(ID_POLICY_CHECK_PROGRESS_BAR).expect(
|
||||
"PolicycheckState.init: Can't find entity of resource 'ID_POLICY_CHECK_PROGRESS_BAR'.",
|
||||
);
|
||||
info!(
|
||||
"set_popup_progress: New entity 'progress_bar' created: {:?}",
|
||||
self.progress_bar
|
||||
);
|
||||
self.progress_bar = ctx
|
||||
.entity_of_child(ID_POLICY_CHECK_PROGRESS_BAR)
|
||||
.expect("PolicycheckState.init: Can't find entity of resource 'ID_POLICY_CHECK_PROGRESS_BAR'.");
|
||||
info!("set_popup_progress: New entity 'progress_bar' created: {:?}", self.progress_bar);
|
||||
}
|
||||
|
||||
/// Change visibility of the result label.
|
||||
fn _set_visibility(&self, entity: Entity, ctx: &mut Context<'_>) {
|
||||
if ctx.get_widget(entity).get::<String16>("text").is_empty() {
|
||||
TextBlock::visibility_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
|
||||
Visibility::Collapsed,
|
||||
);
|
||||
TextBlock::visibility_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT),
|
||||
Visibility::Collapsed,
|
||||
);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Collapsed);
|
||||
} else {
|
||||
TextBlock::visibility_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
|
||||
Visibility::Visible,
|
||||
);
|
||||
TextBlock::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_BUTTON_RESULT), Visibility::Visible);
|
||||
}
|
||||
}
|
||||
|
||||
/// Update count of elements in the policy data list.
|
||||
fn _update_data_count(&self, ctx: &mut Context<'_>) {
|
||||
let data_list_count = ctx
|
||||
.widget()
|
||||
.get::<PolicyDataList>(PROP_POLICY_DATA_LIST)
|
||||
.len();
|
||||
let data_list_count = ctx.widget().get::<PolicyDataList>(PROP_POLICY_DATA_LIST).len();
|
||||
ctx.widget().set(PROP_POLICY_DATA_COUNT, data_list_count);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
TextBlock::text_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_PROGRESS_TIME),
|
||||
string_duration,
|
||||
);
|
||||
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_TIME), string_duration);
|
||||
|
||||
let mut progress_bar = ctx.child(ID_POLICY_CHECK_PROGRESS_BAR);
|
||||
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);
|
||||
//ctx.widget().set(PROP_POLICY_DATA_COUNT, policy_code);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// Supported methods handled inside the `PolicycheckState`
|
||||
impl State for PolicycheckState {
|
||||
/// Initialize the state of widgets inside `PolicycheckState`
|
||||
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");
|
||||
|
||||
// Get language from environment
|
||||
// self.lang = PolicycheckState::get_lang();
|
||||
self.lang = Lang::De("");
|
||||
self.lang = PolicycheckState::get_lang();
|
||||
|
||||
// Initialize required entities
|
||||
self.button_menu = ctx.entity_of_child(ID_POLICY_CHECK_BUTTON_MENU).expect(
|
||||
"PolicycheckState::init: Can't find resource entity 'ID_POLICY_CHECK_BUTTON_MENU'.",
|
||||
);
|
||||
self.button_menu = ctx
|
||||
.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(
|
||||
"PolicycheckState::init: Can't find resource entity 'ID_POLICY_CHECK_LABEL_RESULT'.",
|
||||
);
|
||||
self.label_result = ctx
|
||||
.entity_of_child(ID_POLICY_CHECK_LABEL_RESULT)
|
||||
.expect("PolicycheckState::init: Can't find resource entity 'ID_POLICY_CHECK_LABEL_RESULT'.");
|
||||
|
||||
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,
|
||||
);
|
||||
TextBlock::visibility_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT),
|
||||
Visibility::Collapsed,
|
||||
);
|
||||
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);
|
||||
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);
|
||||
|
||||
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)
|
||||
// .expect("PolicycheckState::init(): Can't find resource entity 'ID_POLICY_CHECK_POLICY_NUMBER'."));
|
||||
|
||||
self.target = Entity::from(
|
||||
ctx.widget()
|
||||
.try_clone::<u32>("target")
|
||||
.expect("PolicycheckState::init(): Can't find resource entity 'target'."),
|
||||
);
|
||||
self.target = Entity::from(ctx.widget().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 = 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>() {
|
||||
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) => {
|
||||
let old_width =
|
||||
ProgressBar::val_clone(&ctx.child(ID_POLICY_CHECK_PROGRESS_BAR));
|
||||
let old_width = ProgressBar::val_clone(&ctx.child(ID_POLICY_CHECK_PROGRESS_BAR));
|
||||
|
||||
let new_width = old_width + increment;
|
||||
// Set the ProgressBar's val property to the calculated percentage
|
||||
// (whereas 0.0 means 0%, and 1.0 means 100%)
|
||||
if new_width <= 1. {
|
||||
ProgressBar::val_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR),
|
||||
new_width,
|
||||
);
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), new_width);
|
||||
} else {
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 1.);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
println!("PolicycheckAction: action not implemented!");
|
||||
PolicycheckAction::UpdatePolicyCode => {
|
||||
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 {
|
||||
match action {
|
||||
PolicycheckAction::ClearPolicyNumber => {
|
||||
println!("clear entry");
|
||||
self.clear_policy_number(ctx);
|
||||
PolicycheckAction::ClearEntry(policy_check_policy_number) => {
|
||||
ctx.get_widget(policy_check_policy_number).set("enabled", false);
|
||||
}
|
||||
PolicycheckAction::InputTextChanged(entity) => {
|
||||
println!(
|
||||
"entry changed: {}",
|
||||
TextBox::text_clone(&ctx.get_widget(entity))
|
||||
);
|
||||
println!("entry changed: {}", TextBox::text_clone(&ctx.get_widget(entity)));
|
||||
}
|
||||
PolicycheckAction::ImportData => match self.import_data(ctx) {
|
||||
PolicycheckAction::ImportData => {
|
||||
match self.import_data(ctx) {
|
||||
Ok(()) => {
|
||||
trace!(target: "advotracker", import_data = "success");
|
||||
}
|
||||
@@ -829,7 +546,8 @@ impl State for PolicycheckState {
|
||||
error!("Importing data failed!");
|
||||
trace!(target: "advotracker", import_data = "failed");
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
PolicycheckAction::NewTicket => {
|
||||
self.new_ticket(ctx);
|
||||
}
|
||||
@@ -837,8 +555,7 @@ impl State for PolicycheckState {
|
||||
self.parse_entry(text_box, ctx);
|
||||
}
|
||||
PolicycheckAction::RemoveFocus(policy_check_policy_number) => {
|
||||
ctx.get_widget(policy_check_policy_number)
|
||||
.set("enabled", false);
|
||||
ctx.get_widget(policy_check_policy_number).set("enabled", false);
|
||||
//ctx.EventAdapter(FocusEvent::RemoveFocus(policy_check_policy_number));
|
||||
}
|
||||
PolicycheckAction::RemovePopup(entity) => {
|
||||
@@ -856,16 +573,12 @@ impl State for PolicycheckState {
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), value);
|
||||
} else {
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 0.);
|
||||
}
|
||||
}
|
||||
} }
|
||||
PolicycheckAction::SetProgressPopup(_entity) => {
|
||||
self.set_popup_progress(ctx);
|
||||
}
|
||||
PolicycheckAction::SetVisibility(_entity) => {
|
||||
TextBlock::visibility_set(
|
||||
&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT),
|
||||
Visibility::Collapsed,
|
||||
);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
|
||||
}
|
||||
PolicycheckAction::TextChanged(entity, _index) => {
|
||||
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)
|
||||
.style("textblock_progress")
|
||||
.text("Importing data")
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.child(
|
||||
ProgressBar::new()
|
||||
@@ -937,7 +650,7 @@ fn create_popup_progress(id: Entity, ctx: &mut BuildContext<'_>) -> Entity {
|
||||
.style("progress_bar")
|
||||
.val(0)
|
||||
//.width(250)
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
@@ -945,11 +658,11 @@ fn create_popup_progress(id: Entity, ctx: &mut BuildContext<'_>) -> Entity {
|
||||
.style("textblock_progress")
|
||||
.h_align("end")
|
||||
.text("Processing time")
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.build(ctx)
|
||||
}
|
||||
@@ -1,14 +1,18 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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::{
|
||||
data::{constants::*, structures::PolicyCheck},
|
||||
data::{
|
||||
constants::*,
|
||||
structures::PolicyCheck,
|
||||
},
|
||||
//widgets::menu::menu_state::{MenuAction, MenuState},
|
||||
widgets::policycheck::policycheck_state::{PolicycheckAction, PolicycheckState},
|
||||
};
|
||||
@@ -19,15 +23,15 @@ widget!(
|
||||
/// This identifier is checked agains a map of valid policy codes.
|
||||
// PolicycheckView<PolicycheckState>: KeyDownHandler {
|
||||
PolicycheckView<PolicycheckState> {
|
||||
/// Holds the language code
|
||||
// holds the language code
|
||||
lang: String,
|
||||
/// Provides a struct with `PolicyCheck` members
|
||||
// provides a struct with `PolicyCheck` members
|
||||
policy_check: PolicyCheck,
|
||||
/// Holds number of imported data
|
||||
// holds number of imported data
|
||||
policy_data_count: u32,
|
||||
/// Holds the title string
|
||||
// holds the title string
|
||||
policy_check_title: String,
|
||||
/// Widget entity that will receive the message
|
||||
// widget entity that will receive the message
|
||||
target: u32
|
||||
}
|
||||
);
|
||||
@@ -66,7 +70,7 @@ impl Template for PolicycheckView {
|
||||
TextBlock::new()
|
||||
.margin((0, 9, 48, 0))
|
||||
.text("©Networkx GmbH")
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.build(ctx),
|
||||
)
|
||||
@@ -131,27 +135,17 @@ impl Template for PolicycheckView {
|
||||
.h_align("center")
|
||||
.child(
|
||||
Stack::new()
|
||||
.id(ID_POLICY_CHECK_ACTION_STACK)
|
||||
//.style(STYLE_STACK_ACTION)
|
||||
.orientation("horizontal")
|
||||
.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(
|
||||
Button::new()
|
||||
.id(ID_POLICY_CHECK_ACTION_BUTTON_CREATE)
|
||||
.style(STYLE_BUTTON_ACTION)
|
||||
.text("Create ticket")
|
||||
.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::NewTicket, id);
|
||||
false
|
||||
@@ -163,8 +157,8 @@ impl Template for PolicycheckView {
|
||||
.build(ctx);
|
||||
|
||||
let policy_check_form = Container::new()
|
||||
.id(ID_POLICY_CHECK_FORM_CONTAINER)
|
||||
.name(ID_POLICY_CHECK_FORM_CONTAINER)
|
||||
.id(ID_POLICY_CHECK_FORM)
|
||||
.name(ID_POLICY_CHECK_FORM)
|
||||
.attach(Grid::row(2))
|
||||
.attach(Grid::column(1))
|
||||
.style("container_form")
|
||||
@@ -178,7 +172,7 @@ impl Template for PolicycheckView {
|
||||
.push("200") // Data
|
||||
.push("16") // Delimiter
|
||||
.push("32") // Result-Button
|
||||
.push("4"), // Delimeter
|
||||
.push("4") // Delimeter
|
||||
)
|
||||
.rows(
|
||||
Rows::create()
|
||||
@@ -186,8 +180,9 @@ impl Template for PolicycheckView {
|
||||
.push("14") // Seperator
|
||||
.push("auto") // Row 2
|
||||
.push("14") // Seperator
|
||||
.push("auto"), // Row 3
|
||||
.push("auto") // Row 3
|
||||
)
|
||||
|
||||
//.child(policy_check_form_row_0)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
@@ -211,9 +206,7 @@ impl Template for PolicycheckView {
|
||||
.water_mark("10-stellig")
|
||||
.on_activate(move |states, entity| {
|
||||
// Entity is entered/activated via Mouse/Keyboard
|
||||
states
|
||||
.get_mut::<PolicycheckState>(id)
|
||||
.parse_policy_number(entity);
|
||||
states.get_mut::<PolicycheckState>(id).parse_policy_number(entity);
|
||||
})
|
||||
.on_key_down(move |_, key_event| {
|
||||
if key_event.key == Key::A(true) {
|
||||
@@ -223,9 +216,10 @@ impl Template for PolicycheckView {
|
||||
// .set_action(Action::ImportData);
|
||||
true
|
||||
})
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.child(policy_check_button_result)
|
||||
|
||||
//.child(policy_check_form_row_2)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
@@ -238,6 +232,14 @@ impl Template for PolicycheckView {
|
||||
.text("Policy code")
|
||||
.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_form_row_2)
|
||||
.child(
|
||||
@@ -264,6 +266,7 @@ impl Template for PolicycheckView {
|
||||
)
|
||||
.build(ctx);
|
||||
|
||||
|
||||
// row3: only shown, if we read in `policy numbers` in
|
||||
// a hashmap as values
|
||||
let policy_data_stack = Stack::new()
|
||||
@@ -280,7 +283,7 @@ impl Template for PolicycheckView {
|
||||
.margin((0, 4, 0, 0))
|
||||
.enabled(true)
|
||||
.text("Checklist elements: ")
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.child(
|
||||
TextBlock::new()
|
||||
@@ -288,7 +291,7 @@ impl Template for PolicycheckView {
|
||||
.margin((0, 4, 0, 0))
|
||||
.enabled(true)
|
||||
.text("0")
|
||||
.build(ctx),
|
||||
.build(ctx)
|
||||
)
|
||||
.build(ctx);
|
||||
|
||||
@@ -303,7 +306,7 @@ impl Template for PolicycheckView {
|
||||
Columns::create()
|
||||
.push(50) // Left margin
|
||||
.push("*") // Content
|
||||
.push(50), // Right margin
|
||||
.push(50) // Right margin
|
||||
)
|
||||
.rows(
|
||||
Rows::create()
|
||||
@@ -311,8 +314,9 @@ impl Template for PolicycheckView {
|
||||
.push(28) // Seperator
|
||||
.push("*") // InputForm
|
||||
.push("auto") // Data_Result
|
||||
.push("auto"), // Bottom_Bar
|
||||
.push("auto") // Bottom_Bar
|
||||
)
|
||||
|
||||
.child(policy_check_header_bar) // row 0
|
||||
.child(policy_check_form) // row 2
|
||||
.child(policy_data_stack) // row 3
|
||||
@@ -1,8 +1,8 @@
|
||||
// SPDX-License-Identifier: (0BSD or MIT)
|
||||
/*
|
||||
* 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
|
||||