Compare commits
7 Commits
wip_twine
...
wip_messag
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fc4c6c01d | |||
| 9ef2e3816e | |||
| 3162233c85 | |||
| 30131ecdb1 | |||
| 6d9d82bb8e | |||
| 5e390a8cfa | |||
| 8630ee1c12 |
8
.gitmodules
vendored
@@ -1,6 +1,6 @@
|
||||
[submodule "advotrackerdb"]
|
||||
path = crates/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 = crates/advotrackerd
|
||||
path = advotrackerd
|
||||
url = https://gitea.networkx.de:50443/rzerres/advotrackerd
|
||||
|
||||
47
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 = "crates/advotracker_client"
|
||||
|
||||
[dependencies]
|
||||
advotrackerdb = { version = "0.1.0-alpha1", path = "crates/advotrackerdb" }
|
||||
advotrackerd = { version = "0.1.0-alpha1", path = "crates/advotrackerd", default-features = false }
|
||||
advotracker_client = { version = "0.1.5-alpha2", path = "crates/advotracker_client", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["sqlite"]
|
||||
|
||||
# enable optional db backends
|
||||
sqlite = []
|
||||
#sqlite = ["advotrackerdb_sqlite"]
|
||||
#postgresql = ["advotrackerdb_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
|
||||
@@ -63,7 +43,8 @@ overflow-checks = true
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/advotrackerd",
|
||||
"crates/advotrackerdb",
|
||||
"crates/advotracker_client",
|
||||
"advotrackerd",
|
||||
"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
@@ -1,20 +1,20 @@
|
||||
[package]
|
||||
name = "advotracker_client"
|
||||
version = "0.1.5-alpha2"
|
||||
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"
|
||||
build = "build.rs"
|
||||
|
||||
[target.x86_64-pc-windows-gnu]
|
||||
linker = "lld-link"
|
||||
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" ] }
|
||||
windres = { git = "https://github.com/FaultyRAM/windres-rs", branch = "master" }
|
||||
winapi = { version = "0.3", features = ["winuser"] }
|
||||
#diesel = { version = "1.4", features = [ "postgres", "sqlite" ] }
|
||||
|
||||
[dependencies]
|
||||
async-stream = "~0.2"
|
||||
@@ -24,23 +24,22 @@ clap = { version = "~2.33", features = ["suggestions", "color"] }
|
||||
csv = { version = "~1.1" }
|
||||
dotenv = { version = "~0.15.0" }
|
||||
envy = { version = "~0.4" }
|
||||
lettre ={ version = "0.10.0-beta.1" }
|
||||
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 = { git = "https://github.com/redox-os/orbtk.git", branch = "develop" }
|
||||
#orbtk = { path = "../../../orbtk" }
|
||||
serde = { version = "~1", features = ["derive"] }
|
||||
sdl2 = { version = "~0.34", features = ["bundled"] }
|
||||
#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"] }
|
||||
|
||||
[build-dependencies]
|
||||
winres = { version = "0.1.11" }
|
||||
#twine = { version = "0.3.8" }
|
||||
twine = { path = "../../../twine", features = ["serde"] }
|
||||
[dev-dependencies]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
@@ -53,8 +52,16 @@ identifier = "nwx.advotracker"
|
||||
short_description = "Online legal advice helper."
|
||||
description = "Supports lawyers to capture relevant data encountered during an online legal advice.\n"
|
||||
|
||||
[package.metadata.winres]
|
||||
LegalCopyright = "Copyright © 2020-2021"
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
incremental = true
|
||||
|
||||
[profile.release]
|
||||
incremental = true
|
||||
|
||||
#[[bin]]
|
||||
#//name = "policycheck"
|
||||
#path = "src/bin/policycheck.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "advotracker"
|
||||
@@ -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: {
|
||||
|
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 |
@@ -7,6 +7,7 @@
|
||||
|
||||
use orbtk::prelude::*;
|
||||
|
||||
mod data;
|
||||
mod main_view;
|
||||
mod receiver;
|
||||
mod sender;
|
||||
@@ -12,10 +12,6 @@ use crate::{
|
||||
sender::sender_view::SenderView,
|
||||
};
|
||||
|
||||
// constants
|
||||
pub static ID_SENDER_VIEW: &str = "sender_view";
|
||||
pub static ID_RECEIVER_VIEW: &str = "receiver_view";
|
||||
|
||||
widget!(MainView {
|
||||
//sender_view: ,
|
||||
//receiver_view:
|
||||
@@ -38,11 +34,5 @@ impl Template for MainView {
|
||||
.child(receiver_view)
|
||||
.build(ctx)
|
||||
)
|
||||
// .child(
|
||||
// TabWidget::new()
|
||||
// .tab(ID_SENDER_VIEW, SenderView::new().build(ctx))
|
||||
// .tab(ID_RECEIVER_VIEW, ReceiverView::new().build(ctx))
|
||||
// .build(ctx),
|
||||
// )
|
||||
}
|
||||
}
|
||||
@@ -7,39 +7,46 @@
|
||||
|
||||
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>,
|
||||
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")
|
||||
self.progress_bar = ctx
|
||||
.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
|
||||
@@ -52,17 +59,26 @@ impl State for ReceiverState {
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,14 @@
|
||||
|
||||
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
|
||||
@@ -26,11 +29,17 @@ pub struct SenderState {
|
||||
|
||||
/// 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`
|
||||
@@ -46,12 +55,23 @@ impl State for SenderState {
|
||||
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)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,18 +8,17 @@
|
||||
// Component Values (Properties)
|
||||
pub static PROP_ADVOTRACKER: &str = "advotracker";
|
||||
|
||||
pub static PROP_MAIL_CC_1: &str = "service@hiedemann.de";
|
||||
pub static PROP_MAIL_CC_2: &str = "info@hiedemann.de";
|
||||
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>";
|
||||
pub static PROP_MAIL_BCC_2: &str = "knoche@hiedemann.de";
|
||||
pub static PROP_MAIL_FROM: &str = "Kanzlei Hiedemann <service@hiedemann.de>";
|
||||
pub static PROP_MAIL_REPLY: &str = "Kanzlei Hiedemann <service@hiedemann.de>";
|
||||
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";
|
||||
pub static PROP_MAIL_TO_1: &str = "allianz@ponschab-partner.com";
|
||||
pub static PROP_MAIL_TO_2: &str = "kontakt@chevalier.law";
|
||||
pub static PROP_MAIL_TO_3: &str = "kontakt@metamedlaw.de";
|
||||
pub static PROP_MAIL_TO_4: &str = "sekretariat@m2-mediation.de";
|
||||
pub static PROP_MAIL_TO_5: &str = "ralf.zerres@networkx.de";
|
||||
|
||||
pub static PROP_POLICY_CHECK: &str = "policy_check";
|
||||
pub static PROP_POLICY_PROGRESS_COUNT: &str = "policy_progress_count";
|
||||
@@ -82,10 +81,8 @@ pub static ID_MENU_SHORTCUT_QUIT: &str = "menu_shortcut_quit";
|
||||
pub static ID_MENU_TOGGLE_THEME: &str = "menu_toggle_theme";
|
||||
|
||||
pub static ID_POLICY_CHECK_VIEW: &str = "policy_check_view";
|
||||
pub static ID_POLICY_CHECK_ACTION_BUTTON_CLEAR: &str = "policy_check_action_button_clear";
|
||||
pub static ID_POLICY_CHECK_ACTION_BUTTON_CREATE: &str = "policy_check_action_button_create";
|
||||
pub static ID_POLICY_CHECK_ACTION_GRID: &str = "policy_check_action_grid";
|
||||
pub static ID_POLICY_CHECK_ACTION_STACK: &str = "policy_check_action_stack";
|
||||
pub static ID_POLICY_CHECK_BOTTOM_BAR: &str = "policy_check_bottom_bar";
|
||||
pub static ID_POLICY_CHECK_BUTTON_RESULT: &str = "policy_check_button_result";
|
||||
pub static ID_POLICY_CHECK_BUTTON_MENU: &str = "policy_check_button_menu";
|
||||
@@ -127,19 +124,17 @@ pub static ID_POLICY_LIST_TEXT_BOX: &str = "policy_list_text_box";
|
||||
pub static ID_TICKET_DATA_ACTION_BUTTON_CLEAR: &str = "ticket_data_action_button_clear";
|
||||
pub static ID_TICKET_DATA_ACTION_BUTTON_SEND: &str = "ticket_data_action_button_send";
|
||||
pub static ID_TICKET_DATA_ACTION_GRID: &str = "ticket_data_action_grid";
|
||||
pub static ID_TICKET_DATA_ACTION_STACK: &str = "ticket_data_action_stack";
|
||||
pub static ID_TICKET_DATA_BOTTOM_BAR: &str = "ticket_data_bottom_bar";
|
||||
pub static ID_TICKET_DATA_BUTTON_MENU: &str = "ticket_data_button_menu";
|
||||
pub static ID_TICKET_DATA_BUTTON_RESULT: &str = "ticket_data_button_result";
|
||||
pub static ID_TICKET_DATA_CALLBACK_DATE: &str = "ticket_data_label_callback_date";
|
||||
pub static ID_TICKET_DATA_CALLBACK_NUMBER: &str = "ticket_data_callback_number";
|
||||
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";
|
||||
pub static ID_TICKET_DATA_COMBO_BOX_MAIL_TO: &str = "ticket_data_combo_box_mail_to";
|
||||
pub static ID_TICKET_DATA_CONTAINER_MAIL: &str = "ticket_data_container_mail";
|
||||
pub static ID_TICKET_DATA_COUNT_BLOCK: &str = "ticket_data_count_block";
|
||||
pub static ID_TICKET_DATA_DEDUCTIBLE: &str = "ticket_data_deductible";
|
||||
pub static ID_TICKET_DATA_FORM: &str = "ticket_data_form";
|
||||
pub static ID_TICKET_DATA_FORM_GRID: &str = "ticket_data_form_grid";
|
||||
pub static ID_TICKET_DATA_GRID: &str = "ticket_data_grid";
|
||||
pub static ID_TICKET_DATA_GRID_MAIL: &str = "ticket_data_grid_mail";
|
||||
pub static ID_TICKET_DATA_HARM_TYPE: &str = "ticket_data_harm_type";
|
||||
@@ -5,9 +5,6 @@
|
||||
* SPDX-License-Identifier: 0BSD, MIT
|
||||
*/
|
||||
|
||||
#![crate_name = "advotracker_client"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
//#![warn(missing_docs, rust_2018_idioms, rust_2018_compatibility)]
|
||||
#![warn(rust_2018_idioms, rust_2018_compatibility)]
|
||||
|
||||
@@ -26,9 +23,6 @@
|
||||
//! WIP: provide a workflow image
|
||||
//!
|
||||
|
||||
// i18n: get the macro (t!) accessing translated strings
|
||||
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"
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,12 @@
|
||||
// suppress creation of a new console window on window
|
||||
#![windows_subsystem = "windows"]
|
||||
|
||||
//#[macro_use]
|
||||
//extern crate lazy_static;
|
||||
|
||||
//use chrono::{Local, DateTime};
|
||||
use dotenv::dotenv;
|
||||
use locales::t;
|
||||
use cfg_if::cfg_if;
|
||||
use serde::Deserialize;
|
||||
use std::env;
|
||||
@@ -27,10 +31,7 @@ use orbtk::{
|
||||
use orbtk::theme_fluent::{THEME_FLUENT, THEME_FLUENT_COLORS_DARK, THEME_FLUENT_FONTS};
|
||||
|
||||
// The Main view
|
||||
use advotracker_client::widgets::main_view;
|
||||
|
||||
// get the macro (t!) accessing the internationalization strings
|
||||
include!(concat!(env!("OUT_DIR"), "/i18n.rs"));
|
||||
use advotracker::widgets::main_view;
|
||||
|
||||
mod parse_args;
|
||||
|
||||
@@ -39,7 +40,7 @@ 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,
|
||||
}
|
||||
@@ -59,8 +60,8 @@ 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 = env::var("LANG").unwrap_or_else(|_| "en".to_string());
|
||||
lang = lang.substring(0,2).to_string(); // "de_DE.UTF-8" -> "de"
|
||||
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);
|
||||
|
||||
// testing environment: read from .env file
|
||||
@@ -136,38 +137,37 @@ 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 lang = get_lang();
|
||||
let lang = Lang::De("de");
|
||||
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)
|
||||
@@ -175,8 +175,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
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.
|
||||
@@ -185,8 +185,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// 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")
|
||||
.language(&lang)
|
||||
.dictionary("de_DE", ADVOTRACKER_DE_DE)
|
||||
.build();
|
||||
|
||||
@@ -197,7 +199,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
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)
|
||||
@@ -206,8 +208,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
})
|
||||
.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);
|
||||
});
|
||||
|
||||
@@ -6,21 +6,20 @@
|
||||
*/
|
||||
|
||||
//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(())
|
||||
@@ -10,20 +10,18 @@ use lettre::{
|
||||
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.
|
||||
@@ -35,16 +33,16 @@ 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) }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -60,12 +58,14 @@ pub fn sendticketdata(email: &Email, lang: &Lang) -> Result<(), Box<dyn Error>>
|
||||
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())
|
||||
.from((email.mail_from).parse().unwrap())
|
||||
.subject(String::new()
|
||||
+ &email.subject.to_string()
|
||||
+ &" (".to_string()
|
||||
@@ -96,28 +96,26 @@ pub fn sendticketdata(email: &Email, lang: &Lang) -> Result<(), Box<dyn Error>>
|
||||
|
||||
// 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(())
|
||||
@@ -6,16 +6,15 @@
|
||||
*/
|
||||
|
||||
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, PolicyDataList, PolicyData},
|
||||
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
|
||||
@@ -23,15 +22,15 @@ use crate::{
|
||||
/// https://blog.burntsushi.net/csv/
|
||||
pub fn import(p: &mut String, data_list: &mut PolicyDataList,
|
||||
policy_numbers: &mut HashMap<u64, PolicyCode>,
|
||||
policy_data_count: &mut u64)
|
||||
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();
|
||||
|
||||
@@ -91,8 +90,8 @@ pub fn import(p: &mut String, data_list: &mut PolicyDataList,
|
||||
.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());
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
use orbtk::prelude::*;
|
||||
use tracing::info;
|
||||
|
||||
use crate::widgets::localization::localization_view::LocalizationView;
|
||||
|
||||
@@ -27,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"),
|
||||
@@ -5,6 +5,7 @@
|
||||
* SPDX-License-Identifier: (0BSD or MIT)
|
||||
*/
|
||||
|
||||
use locales::t;
|
||||
use orbtk::prelude::*;
|
||||
|
||||
use serde::Deserialize;
|
||||
@@ -18,7 +19,6 @@ use crate::{
|
||||
structures::{PolicyCode, PolicyDataList, PolicyList},
|
||||
constants::*,
|
||||
},
|
||||
Lang,
|
||||
//services::imports::allianzdirectcall::import,
|
||||
services::imports::allianzdirectcall,
|
||||
widgets::global_state::GlobalState,
|
||||
@@ -31,7 +31,7 @@ use crate::{
|
||||
/// state changes for the `PolicycheckView` widget.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum PolicycheckAction {
|
||||
ClearPolicyNumber,
|
||||
ClearEntry(Entity),
|
||||
ChangeTheme(),
|
||||
SendPolicynumber(),
|
||||
InputTextChanged(Entity),
|
||||
@@ -68,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>,
|
||||
@@ -77,7 +77,7 @@ pub struct PolicycheckState {
|
||||
progress_popup: Entity,
|
||||
// target that recieves messages
|
||||
target: Entity,
|
||||
ticketdata_view: Entity
|
||||
ticketdata: Entity
|
||||
}
|
||||
|
||||
impl GlobalState for PolicycheckState {}
|
||||
@@ -93,7 +93,7 @@ impl PolicycheckState {
|
||||
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);
|
||||
|
||||
@@ -103,7 +103,8 @@ impl PolicycheckState {
|
||||
//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) {
|
||||
&mut policy_numbers, &mut self.policy_data_count,
|
||||
&self.lang) {
|
||||
Ok((count, duration)) => {
|
||||
self.policy_data_count = count;
|
||||
self.duration = duration;
|
||||
@@ -125,12 +126,9 @@ 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<'_>)
|
||||
@@ -154,7 +152,7 @@ impl PolicycheckState {
|
||||
// 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,
|
||||
@@ -165,7 +163,7 @@ impl PolicycheckState {
|
||||
|
||||
}
|
||||
_ => {
|
||||
let res = t!(policy_hashmap_failed => self.lang);
|
||||
let res = t!("policy.hashmap.failed", self.lang);
|
||||
error!("{:?}", res);
|
||||
trace!(target: "advotracker", hashmap_status = ?res);
|
||||
}
|
||||
@@ -181,9 +179,9 @@ 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);
|
||||
}
|
||||
@@ -215,7 +213,6 @@ 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"));
|
||||
|
||||
if policy_number_length == 10 {
|
||||
@@ -233,8 +230,6 @@ impl PolicycheckState {
|
||||
|
||||
let string_result = format!("1-{:?}-{}",
|
||||
policy_code, p);
|
||||
|
||||
// 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"));
|
||||
|
||||
@@ -247,13 +242,10 @@ impl PolicycheckState {
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Visible);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Collapsed);
|
||||
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Collapsed);
|
||||
|
||||
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_ACTION_STACK), Visibility::Visible);
|
||||
Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_ACTION_BUTTON_CLEAR), Visibility::Visible);
|
||||
}
|
||||
_ => {
|
||||
// no matching key
|
||||
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"));
|
||||
@@ -291,7 +283,7 @@ impl PolicycheckState {
|
||||
}
|
||||
}
|
||||
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"));
|
||||
@@ -311,7 +303,7 @@ impl PolicycheckState {
|
||||
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"));
|
||||
@@ -419,7 +411,7 @@ impl PolicycheckState {
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -446,8 +438,7 @@ impl State for PolicycheckState {
|
||||
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
|
||||
@@ -463,9 +454,6 @@ impl State for PolicycheckState {
|
||||
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'."));
|
||||
|
||||
@@ -503,15 +491,6 @@ 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));
|
||||
|
||||
@@ -524,6 +503,12 @@ impl State for PolicycheckState {
|
||||
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 1.);
|
||||
}
|
||||
}
|
||||
PolicycheckAction::UpdatePolicyCode => {
|
||||
self.update_policy_code(ctx);
|
||||
}
|
||||
PolicycheckAction::NewTicket => {
|
||||
self.new_ticket(ctx);
|
||||
}
|
||||
_ => { println!("PolicycheckAction: action not implemented!"); }
|
||||
}
|
||||
}
|
||||
@@ -546,9 +531,8 @@ 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)));
|
||||
@@ -135,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
|
||||
@@ -242,8 +232,15 @@ 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(
|
||||
TextBlock::new()
|
||||