7 Commits

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

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

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

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

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

8
.gitmodules vendored
View File

@@ -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

View File

@@ -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",
]

View File

@@ -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

Submodule advotracker-db added at 51e747ef6d

View File

@@ -1,23 +1,21 @@
[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 = "/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" ] }
winapi = { version = "0.3", features = ["winuser"] }
#diesel = { version = "1.4", features = [ "postgres", "sqlite" ] }
[target.'cfg(target_os = "windows")'.build-dependencies]
winres = { version = "0.1" }
# for language constants
winapi = { version = "0.3", features = [ "winnt" ] }
[dependencies]
async-stream = "~0.2"
chrono = { version = "~0.4.0", features = ["serde"] }
@@ -26,27 +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", features = ["smtp-transport", "native-tls", "hostname", "r2d2", "builder"] }
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 = { version = "~0.3.1-alpha4" }
#orbtk = { git = "https://github.com/redox-os/orbtk.git", branch = "develop" }
orbtk = { path = "../../../orbtk" }
orbtk = { path = "../../orbtk" }
serde = { version = "~1.0", features = ["derive"] }
sdl2 = { version = "~0.34" }
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" }
#[dev-dependencies]
[dev-dependencies]
[features]
default = []
@@ -59,8 +52,12 @@ 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"

View File

@@ -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",
}

View File

@@ -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: {

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

View File

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View File

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View File

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

View File

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 126 B

View File

Before

Width:  |  Height:  |  Size: 158 B

After

Width:  |  Height:  |  Size: 158 B

View File

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 351 B

View File

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 130 B

View File

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 193 B

View File

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 452 B

View File

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 131 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 768 B

After

Width:  |  Height:  |  Size: 768 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 455 KiB

After

Width:  |  Height:  |  Size: 455 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 237 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -7,6 +7,7 @@
use orbtk::prelude::*;
mod data;
mod main_view;
mod receiver;
mod sender;

View File

@@ -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),
// )
}
}

View File

@@ -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);
}
}
}

View File

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

View File

@@ -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'");
}
}
}
}

View File

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

View File

@@ -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";

View File

@@ -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)]

View File

@@ -31,7 +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;
use advotracker::widgets::main_view;
mod parse_args;
@@ -199,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)

View File

@@ -14,7 +14,7 @@ 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;
@@ -33,16 +33,16 @@ pub fn sendticketdata(email: &Email, lang: &str) -> 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) }
}
};
@@ -58,12 +58,14 @@ pub fn sendticketdata(email: &Email, lang: &str) -> 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()
@@ -94,26 +96,24 @@ pub fn sendticketdata(email: &Email, lang: &str) -> 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);
trace!(target: "sendticketdata", process = ?res, state = ?state);

View File

@@ -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"),

View File

@@ -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),
@@ -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 {}
@@ -126,11 +126,8 @@ 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
@@ -182,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);
}
@@ -216,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 {
@@ -234,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"));
@@ -248,9 +242,6 @@ 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
@@ -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)));

View File

@@ -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()

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