66 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
791b451d39 main: handle test_policy_number
* provide cli-flag `testPolicyNumber` as String
  since viperus doesnt support u64
* handle stringconversion (String -> u64) inside main

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-04 07:07:01 +01:00
aeaafd8c57 widget:ticketdata: function extention to handle Email sending
* remap to use `policy code`
* adapt the constants
* start with clear_form()
* use service 'send_ticketdata' which crate lettre
* enable smtp authorization via credentilas
* support html using crate 'maud'
* provide the needed structures
* update the constants for property and entity assigns
* include send Email service (sendticketdata)
* send_ticketdata: include html  maud modules

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-04 07:06:03 +01:00
1af299dc01 widget:policycheck: map to ID_POLICY_CHECK_POLICY_CODE
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 22:35:20 +01:00
bd6971d4d0 .gitmodules: update dead module path
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 16:32:33 +01:00
85fb4ceb16 advotracker-db: update to head
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 16:32:21 +01:00
a451b58ab4 widget:menu: deactivate requirement for new popup_code
* since new popup code is just in PR #304, do not rely on its availibility

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 11:53:17 +01:00
b96c3c510f widgets:main_view: update widget activation handling
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 11:51:50 +01:00
2c903c67dd data:constants: update widget id's identifier
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 11:50:33 +01:00
a40f6e94dd widget:global_state: activate navigate() method
* allow widgets to nagivate to other widget context

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 11:48:16 +01:00
8af49deb34 widget:ticketdata: introduce message passing
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 11:47:26 +01:00
202ba81b4f widget:policycheck: introduce message passing
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 11:46:39 +01:00
43db004179 examples: move csv-test
* test validity of a given policy number
* cli program will match via  hashmap
* hashmap is constructed from a csv file

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 00:38:10 +01:00
3b65dafbec examples: introduce messages_test
* showcase demenstrating messages passing from a sender (widget1)
  to a receiver (widget 2)
* use modular source tree structure

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-03-03 00:33:26 +01:00
23732350ca policycheck: refine header bar
* place tenent logo at upper right
* adapt header text placement

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 20:15:31 +01:00
3c40055e2e theming: update default_dark
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:25 +01:00
6a61d2f878 policycheck: functionality cleanup
* sorting
* string usage

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:25 +01:00
044ad84598 services: allianzdireectcall update
* rust update using &str instead of &String

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:25 +01:00
b2a9d9aa52 widget/configuration: typo and documentation update
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:24 +01:00
157da4228a include substring handling
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:24 +01:00
26cf43bfae ticketdata: introduce new widget
* Cargo.toml: introduce carte `lettre` used in send_ticketdata.rs
* locales: extend translations
* theme: extend translations
* send_ticketdata: send harm data via email
* ticket_data: aquisition of harm data
* update constant usage

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:24 +01:00
a2314d4909 envy: update .env
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:24 +01:00
0dab2dddb3 csv-test: typo update
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>

csv-test: update

* move to subdir `examples`
* typo update

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:24 +01:00
bb40033554 parse_args: typo update
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:24 +01:00
a4a09bc37c data/structures: typo update
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:24 +01:00
9fba66d8a6 widget/configuration: styling update
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:24 +01:00
7d6476205f Cargo.toml: include crate if_cfg
* use macro to compile os-dependent features

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:24 +01:00
41ebf4168a widgets/configuration: reference styling to theme handling
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:23 +01:00
c4caf12706 widget/policycheck: update logic
* remove handling of the menu logic (isolated in dedicated widget)
* reference styling via theme
* update documentation strings

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:23 +01:00
075505eec9 widgets/menu: introduce dedicated module menu
* new menu_view
* new menu_state
* update constants
* update main_view referencing a tab_view

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:23 +01:00
59e7e71143 assets: update theme definitions for default_dark.ron
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:23 +01:00
7440f7a6dd widgets/menu: introduce dedicated menu module
* new menu_view
* new menu_state
* adapt constant values for the menu structure

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:23 +01:00
a401379f9e theme update dark
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:23 +01:00
be9b8b1a1c widget/configuration: correcting label constant
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:23 +01:00
70bd6b8b8d language: update
* update constants
* adopt width of languages combo box

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:23 +01:00
1f3c6a7fff widget/policycheck: intoduce os dependent theme handling
* theme_fluent: only makes sense in windows environment

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:23 +01:00
ef26a3bf65 widgets/localization: update label constant
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:22 +01:00
fa4914839e assets: adapt default_dark theme definitions
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:46:18 +01:00
571243731d assets: adapt fluent_dark theme definitions
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:45:57 +01:00
b38a677b7b policycheck: function update
* insert copyright hint
* more descriptive import of allianzdirectcall function
* documentation update
* introduce KeyHandler in menu popup
* rename action function to `set_action`

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2021-02-28 19:45:33 +01:00
26cea8e844 widgets/configuration: break out configuration functionality
* handle widget `configuration` in dedicated subdir
* adopt constants to handle widget id's

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-05 17:43:23 +01:00
48545d2879 widgets/localization: break out as localization functionality
* handle widget `localization` in dedicated subdir
* adopt constants to handle widget id's

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-05 17:38:11 +01:00
b352f2a581 widget/policycheck: introduce key_event
* handle Escape in menu

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-03 10:27:07 +01:00
89a6842106 policycheck: introduce toggle theme
* new functions:
  - popup_menu_toggle_theme
  - set_menu_toggle_theme
  - create_menu_toggle_theme
  - messages
* rename function: menu  -> popup_menu
* reorder enum: PolicycheckAction
* new actions: SetMenuPopup, SetToggleTheme

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-02 14:00:06 +01:00
76e6e7503f Merge branch 'next' of https://gitea.networkx.de:50443/rzerres/advotracker into wip_toggle_theme_menu
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-02 09:43:32 +01:00
520b959302 structure update
* rename PolicyCheckView to PolicycheckView
* rename PolicyCheckState to PolicycheckState
* rename menu to popup_menu

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-01 20:45:27 +01:00
7d459516d9 module structure update 2
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-01 20:19:55 +01:00
c511bdd62f main: reflect new module structure
* include from assets
* get widgets into place
* introduce style extensions (theme_fluent)

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-01 20:19:55 +01:00
40f715a79a update project structure
* assets: all resources are bundled in this subdirectory
* widgets: use subdirs to group them by function
  the subdir hold their callbacks (state handling) and views
* theming: update to new theming syntax
* fonts: remove fonts that are provovided by default in OrbTK

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-01 20:19:55 +01:00
6ea1f95ef0 main_view: introduce configuration view
* allow to load and save config parameters to ron file

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-01 20:19:54 +01:00
8986812038 policycheck_view: update to 0.3.1-alpha4 changes
* lose_focus_on_activate()

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-01 20:19:54 +01:00
e0eb0c5c90 policycheck_state: update localization of menu entries
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-01 20:19:54 +01:00
a1541ae307 implement a toggle theme menu
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-01 20:15:57 +01:00
c66335951f structure update
* rename PolicyCheckView to PolicycheckView
* rename PolicyCheckState to PolicycheckState
* rename menu to popup_menu

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-11-01 20:09:45 +01:00
d0e661d5d0 module structure update 2
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-10-31 16:42:04 +01:00
2253c2892b main: reflect new module structure
* include from assets
* get widgets into place
* introduce style extensions (theme_fluent)

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-10-31 14:39:41 +01:00
8cc9ba5782 update project structure
* assets: all resources are bundled in this subdirectory
* widgets: use subdirs to group them by function
  the subdir hold their callbacks (state handling) and views
* theming: update to new theming syntax
* fonts: remove fonts that are provovided by default in OrbTK

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-10-31 14:23:03 +01:00
ef8b884efa main_view: introduce configuration view
* allow to load and save config parameters to ron file

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-10-07 03:22:51 +02:00
6b7ae9d17d policycheck_view: update to 0.3.1-alpha4 changes
* lose_focus_on_activate()

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-10-07 03:20:56 +02:00
f0e9014fb7 policycheck_state: update localization of menu entries
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-10-02 17:34:15 +02:00
106 changed files with 3435 additions and 2634 deletions

View File

@@ -3,13 +3,14 @@
# will overwrite standard environment viariables # will overwrite standard environment viariables
### ###
# set the language variable used in test-runs # set the language variable used in test-runs
#test LANG=de-DE
#test LANG=es-ES #test LANG=es-ES
#test LANG=it-IT
#test LANG=C #test LANG=C
# set the language variable (overwriting standard Enviroment) # set the language variable (overwriting standard Enviroment)
#TEST_LANG=de_DE #TEST_LANG=de_DE
#TEST_LANG=C #TEST_LANG=C
#RUST_LOG=advotracker=trace #RUST_LOG=advotracker=trace
#LANG=de_DE
RUST_LOG=trace RUST_LOG=trace
#RUST_LOG=none #RUST_LOG=none
USERNAME=hiedemann USERNAME=hiedemann

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "advotracker" name = "advotracker"
version = "0.1.4" version = "0.1.5"
authors = ["Ralf Zerres <ralf.zerres@networkx.de>"] authors = ["Ralf Zerres <ralf.zerres@networkx.de>"]
description = "Frontend component that supports lawyers to capture relevant data encountered during an online legal advice." description = "Frontend component that supports lawyers to capture relevant data encountered during an online legal advice."
readme = "README.md" readme = "README.md"
@@ -19,24 +19,29 @@ winapi = { version = "0.3", features = ["winuser"] }
[dependencies] [dependencies]
async-stream = "~0.2" async-stream = "~0.2"
chrono = { version = "~0.4.0", features = ["serde"] } chrono = { version = "~0.4.0", features = ["serde"] }
cfg-if = { version = "~1.0" }
clap = { version = "~2.33", features = ["suggestions", "color"] } clap = { version = "~2.33", features = ["suggestions", "color"] }
csv = { version = "~1.1" } csv = { version = "~1.1" }
dotenv = { version = "~0.15.0" } dotenv = { version = "~0.15.0" }
envy = { version = "~0.4" } envy = { version = "~0.4" }
lettre = "0.10.0-beta.1"
lazy_static = { version = "~1.4.0" } lazy_static = { version = "~1.4.0" }
log = { version = "~0.4.8" } log = { version = "~0.4.8" }
locales = { version = "~0.1" } locales = { version = "~0.1" }
maud = { version = "~0.22.1" }
#orbtk = { version = "~0.3.1-alpha4" } #orbtk = { version = "~0.3.1-alpha4" }
orbtk = { git = "https://github.com/redox-os/orbtk.git", branch = "develop" } #orbtk = { git = "https://github.com/redox-os/orbtk.git", branch = "develop" }
#orbtk = { path = "../../orbtk" } orbtk = { path = "../../orbtk" }
serde = { version = "~1.0", features = ["derive"] } serde = { version = "~1.0", features = ["derive"] }
substring = { version = "~1" }
#tokio = { version = "~0.2", features = ["macros", "rt-threaded", "stream", "time"] } #tokio = { version = "~0.2", features = ["macros", "rt-threaded", "stream", "time"] }
tracing = { version = "~0.1" } tracing = { version = "~0.1" }
tracing-subscriber = { version = "~0.2.0", features = ["tracing-log"] } tracing-subscriber = { version = "~0.2.0", features = ["tracing-log"] }
viperus = { git = "https://github.com/maurocordioli/viperus", features = ["cache", "fmt-clap", "fmt-env", "global", "watch"] } viperus = { git = "https://github.com/maurocordioli/viperus", features = ["cache", "fmt-clap", "fmt-env", "global", "watch"] }
[dev-dependencies]
[features] [features]
# no features by default
default = [] default = []
debug = ["orbtk/debug"] debug = ["orbtk/debug"]
light = [] light = []
@@ -46,3 +51,18 @@ name = "advotracker"
identifier = "nwx.advotracker" identifier = "nwx.advotracker"
short_description = "Online legal advice helper." short_description = "Online legal advice helper."
description = "Supports lawyers to capture relevant data encountered during an online legal advice.\n" description = "Supports lawyers to capture relevant data encountered during an online legal advice.\n"
[profile.dev]
opt-level = 1
incremental = true
[profile.release]
incremental = true
#[[bin]]
#//name = "policycheck"
#path = "src/bin/policycheck.rs"
[[bin]]
name = "advotracker"
path = "src/main.rs"

View File

@@ -0,0 +1,59 @@
// *
// * advotracker - Hotline tackingtool for Advocats
// *
// * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
// * SPDX-License-Identifier: (0BSD or MIT)
// */
// the language class
Dictionary (
// the map of active identifiers
// like a struct, but keys are also values instead of just beenig identifiers
words: {
// policycheck_view
"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",
"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",
"Quit": "Beenden",
// ticketdata_view
"Callback number": "Rückrufnummer",
"Callback date": "Erreichbarkeit",
"Clear": "Zurücksetzen",
"Deductible": "Selbstbehalt",
"Harm type": "Rechtsproblem",
"IVR comment": "Rechtsrat",
"Policy holder": "Versicherungsnehmer",
"Recipient (To)": "Empfänger (To)",
"Copie (CC)": "Kopie (CC)",
"Send": "Senden",
// localization view
"Language ID": "Sprache ID",
"Localization dialog": "Lokalisierungs-Dialog",
"German": "Deutsch",
"English": "Englisch",
// configuration view
"Configuration settings": "Konfigurationseinstellungen",
"Configuration file": "Konfigurationsdatei",
"Language Id": "Sprach-Id",
"Default theme": "Standard-Thema",
"Load": "Laden",
"Save": "Speichern",
}
)

View File

@@ -0,0 +1,187 @@
Theme (
styles: {
"button_action": (
base: "button",
properties: {
//"background": "transparent",
"border_radius": 3,
"h_align": "center",
"v_align": "center",
},
),
"button_menu": (
base: "button_single_content",
properties: {
"h_align": "end",
//"icon": "material_icons_font::MD_MENU",
},
),
"combo_box_form": (
base: "combo_box",
properties: {
"width": 200,
"height": 28,
},
),
"mail_label": (
base: "base",
properties: {
"h_align": "end",
"v_align": "center",
},
),
"mail_to": (
base: "combo_box_form",
properties: {
"h_align": "end",
},
),
"mail_cc": (
base: "combo_box_form",
properties: {
"h_align": "end",
},
),
"combo_box_popup": (
//base: "popup",
properties: {
//"height": 120,
"width": 240,
},
),
"configuration_form": (
base: "container",
properties: {
"margin": 4,
},
),
"container_action": (
base: "container_form",
properties: {
"border_width": 1,
"padding": {
"left": 14,
"top": 0,
"right": 14,
"bottom": 0,
},
"h_align": "center",
},
),
"container_form": (
base: "container",
properties: {
"padding": 14,
"border_brush": "$CONTAINER_BORDER",
"border_radius": 0,
"border_width": 1,
"min_height": 330,
},
),
"container_mail": (
base: "container_form",
properties: {
"border_width": 0,
"padding": {
"left": 14,
"top": 0,
"right": 14,
"bottom": 14,
}
},
),
"container_progress": (
base: "container",
properties: {
"border_brush": "$CONTAINER_BORDER",
"h_align": "center",
"padding": 14,
"v_align": "center",
},
),
"header_bar": (
base: "header",
properties: {
//"h_align": "center",
//"v_align": "center",
"min_height": 32,
//"padding": 14,
}
),
"header_text": (
base: "header",
properties: {
"h_align": "center",
"v_align": "center",
}
),
"popup_form": (
//base: "popup",
properties: {
"background": "#FFFFFF",
"border_brush": "#0000FF",
"border_radius": 3,
"border_width": 2,
"padding": 4,
},
),
"popup_menu": (
//base: "popup",
properties: {
"width": 300,
"hight": 200,
"border_radius": 0,
"border_width": 1,
"h_align": "center",
},
),
"popup_progress": (
base: "popup",
properties: {
"padding": 4,
},
),
"stack_action": (
//base: "stack",
properties: {
//"min_height": 50,
"orientation": "Horizontal",
"spacing": 50,
},
),
"stack_progress": (
base: "container",
properties: {
"spacing": 10,
},
),
"ticket_data_form_label": (
base: "container_form",
properties: {
"padding": 1,
"h_align": "end",
"v_align": "center",
"margin": {
"left": 0,
"top": 0,
"right": 0,
"bottom": 0,
},
"min_size": 300,
"max_size": 400,
},
),
"ticket_data_form_input": (
base: "ticket_data_form_label",
properties: {
"h_align": "start",
},
),
"text_block_progress": (
base: "small_text",
properties: {
"background": "$PROGRESS_BAR_BACKGROUND",
},
),
}
)

View File

@@ -0,0 +1,10 @@
Theme (
styles: {
"container_form": (
base: "container",
properties: {
"border": 1,
},
),
}
)

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

@@ -0,0 +1 @@
../../../data/POLLFNR_WOECHENTLICH.txt

View File

@@ -9,9 +9,12 @@ use chrono::{Local, DateTime};
use locales::t; use locales::t;
//use serde::{Deserialize, Serialize}; //use serde::{Deserialize, Serialize};
use serde::Deserialize; use serde::Deserialize;
use std::env; use std::{
use std::{error::Error, process}; collections::HashMap,
use std::collections::HashMap; env,
{error::Error, process},
//path::{Path, PathBuf},
};
use tracing::{debug, trace, Level}; use tracing::{debug, trace, Level};
use advotracker::data::structures::{PolicyCode, PolicyList, PolicyDataList, PolicyData}; use advotracker::data::structures::{PolicyCode, PolicyList, PolicyDataList, PolicyData};
@@ -49,14 +52,6 @@ fn export(p: &mut String, lang: &String) -> Result<u64, Box<dyn Error>> {
// Note: slash syntax also works on Windows! // Note: slash syntax also works on Windows!
let path = Path::new(p); let path = Path::new(p);
// only create files with a '.txt' extensions
//let extension = path.extension();
// match extension {
// //Some(String) => println!("file extension ok!"),
// //_ => extension = OsStr::new("txt")
// _ => println!("got file extension {:?}", extension)
// };
// open the file descriptor // open the file descriptor
let mut file = File::create(path)?; let mut file = File::create(path)?;
trace!(target: "csv-export", extension = ?path.extension(), file = ?file); trace!(target: "csv-export", extension = ?path.extension(), file = ?file);
@@ -103,10 +98,6 @@ fn import(p: &mut String, data_list: &mut PolicyDataList,
// must be a readable file // must be a readable file
trace!(target: "csv-test", path = ?path); trace!(target: "csv-test", path = ?path);
let valid = path.is_file();
println!("is_file: {}", valid);
//if let Some(res) = valid
assert_eq!(path.is_file(), true); assert_eq!(path.is_file(), true);
// only accept files with '.txt' extensions // only accept files with '.txt' extensions
@@ -333,8 +324,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
state = t!("state.started", lang); state = t!("state.started", lang);
trace!(target: "csv-test", process = ?res, state = ?state); trace!(target: "csv-test", process = ?res, state = ?state);
// importing policy code elements from csv-file // create policy structures
let policy_list = PolicyList::new("Allianz Versicherungsnummen-List"); let policy_list = PolicyList::new("Allianz Versicherungsnummen-Liste");
println!("Policy List {:?} ", policy_list.name); println!("Policy List {:?} ", policy_list.name);
let mut policy_data = PolicyDataList::new("Allianz-Import 20200628"); let mut policy_data = PolicyDataList::new("Allianz-Import 20200628");
@@ -355,9 +346,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
// test if policy_number is_valid // test if policy_number is_valid
let test_policy_number = v.get::<i32>("test_policy_number").unwrap() as u64; // type conversion (viperus String -> u64)
let test_policy_number = v.get::<String>("test_policy_number").unwrap().parse::<u64>().unwrap();
trace!(target: "csv-test", test_policy_number = ?test_policy_number); trace!(target: "csv-test", test_policy_number = ?test_policy_number);
//let policy_number : u64 = 1999999999;
//match is_valid(&policy_number, &policy_data, &mut policy_numbers, &lang) { //match is_valid(&policy_number, &policy_data, &mut policy_numbers, &lang) {
// Ok(true) => { // Ok(true) => {
// use Hashmap method 'get' to check if we have the given key // use Hashmap method 'get' to check if we have the given key
@@ -394,3 +385,25 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(()) Ok(())
} }
#[test]
fn test_policy_number() {
// Takes a reference and returns Option<&V>
let my_policy_numbers : [u64; 2] = [1511111111, 9999999993];
assert_eq!(my_policy_numbers, [1511111111, 9999999993]);
//let mut csv_import_path = v.get::<String>("import_file").unwrap();
let mut csv_import_path = String::from("data/POLLFNR_TEST.txt");
let mut policy_data = PolicyDataList::new("PolicyDataList");
let mut policy_numbers : HashMap<u64, PolicyCode> = HashMap::new();
let lang = "en".to_string();
println!("import with Path: {:?} PolicyData: {:?} PolicyNumbers: {:?}, Lang: {:?}",
csv_import_path, policy_data, policy_numbers, lang);
let count = import(&mut csv_import_path, &mut policy_data,
&mut policy_numbers, &lang);
assert_eq!(count.unwrap(), 15498);
}

View File

@@ -25,7 +25,7 @@ pub fn parse_args(v: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> {
v.add_default("config_file", String::from("csv_import.ron")); v.add_default("config_file", String::from("csv_import.ron"));
v.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt")); v.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt"));
v.add_default("export_file", String::from("")); v.add_default("export_file", String::from(""));
v.add_default("test_policy_number", 123456789); v.add_default("test_policy_number", String::from("9999999992"));
v.add_default("to_email_address_file", String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>")); v.add_default("to_email_address_file", String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>"));
v.add_default("from_email_address_file", String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>")); v.add_default("from_email_address_file", String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"));
//v.add_default("username", String::from("nctalkbot")); //v.add_default("username", String::from("nctalkbot"));
@@ -188,7 +188,7 @@ SMR Unerledigt: 089 92529 60222")
); );
println!( println!(
"test_policy_number: {:?}", "test_policy_number: {:?}",
v.get::<i32>("test_policy_number").unwrap_or_default() v.get::<String>("test_policy_number").unwrap_or_default()
); );
// println!( // println!(
// "username: {:?}", // "username: {:?}",

View File

@@ -0,0 +1,33 @@
/*
* OrbTK - The Orbital Widget Toolkit
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
mod data;
mod main_view;
mod receiver;
mod sender;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// use this only if you want to run it as web application.
orbtk::initialize();
Application::new()
.window(|ctx| {
Window::new()
.name("Main")
.title("OrbTK: example send/receive messages")
.position((100.0, 100.0))
.resizeable(true)
.size(450.0, 500.0)
.child(main_view::MainView::new().build(ctx))
.build(ctx)
})
.run();
Ok(())
}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,86 @@
/*
* 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::*,
sender::sender_state::SenderAction,
};
// /// 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 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_block: Option<Entity>,
progress_bar: Entity
}
/// Method definitions, we provide inside the `ReceiverState`.
impl ReceiverState {
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 `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(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
fn messages(
&mut self,
mut messages: MessageReader,
_registry: &mut Registry,
ctx: &mut Context
) {
for message in messages.read::<SenderAction>() {
match message {
SenderAction::UpdateProgress(amount) => {
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::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

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

View File

@@ -0,0 +1,78 @@
/*
* OrbTK - The Orbital Widget Toolkit
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
//use crate::data::constants::*;
/// Enumeration of valid `action variants` that need to be handled as
/// state changes for the `SenderView` widget.
#[derive(Clone, Debug)]
pub enum SenderAction {
UpdateProgress(f64),
UpdateMessage(String),
}
/// Valid `structure members` of the `SenderState` used to react on
/// state changes inside the `SenderView` widget.
#[derive(AsAny, Default)]
pub struct SenderState {
// actions
actions: Vec<SenderAction>,
// entity that will receive the message
target: Entity
}
/// Method definitions, we provide inside the `SenderState`.
impl SenderState {
/// 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`
impl State for SenderState {
// initialize the view entities
fn init(&mut self, _registry: &mut Registry, ctx: &mut Context) {
// create the target entity, that receives the Sender messages
self.target = Entity::from(ctx.widget().try_clone::<u32>("target")
.expect("ERROR: SenderState::init(): target entity not found!"));
}
// update entities, before we render the view
fn update(&mut self, _: &mut Registry, ctx: &mut Context) {
let actions: Vec<SenderAction> = self.actions.drain(..).collect();
//let message = ctx.child(ID_SENDER_TEXT_BOX).get::<String>("text").to_string();
//println!("Child text: {:?}", message);
// create an explicit message_adapter context
let message_adapter = ctx.message_adapter();
for action in actions {
match action {
SenderAction::UpdateProgress(amount) => {
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

@@ -1,35 +0,0 @@
// *
// * advotracker - Hotline tackingtool for Advocats
// *
// * Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
// * SPDX-License-Identifier: (0BSD or MIT)
// */
// the language class
Dictionary (
// the map of active identifiers
// like a struct, but keys are also values instead of just beenig identifiers
words: {
// policycheck_view
"Validation policy number": "Prüfung Versicherungsnummer",
"Policy number": "Versicherungsnummer",
"Policy code": "ID der Vers.-Nummer",
"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",
"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",
// localization
"Hello": "Hallo",
"User": "Anwender",
"Localization dialog": "Lokalisierungs-Dialog",
"German": "Deutsch",
"English": "Englisch"
}
)

View File

@@ -1,581 +0,0 @@
<!DOCTYPE html>
<html lang="de-DE">
<head data-suburl="">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>flovanco/doit: Task app based on OrbTk https://gitlab.redox-os.org/redox-os/orbtk. - static/fonts/Roboto-Medium.ttf at master - doit - Codeberg.org</title>
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials">
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js').then(function(registration) {
console.info('ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) {
console.info('ServiceWorker registration failed: ', err);
});
}
</script>
<meta name="theme-color" content="#6cc644">
<meta name="author" content="flovanco" />
<meta name="description" content="doit - Task app based on OrbTk https://gitlab.redox-os.org/redox-os/orbtk." />
<meta name="keywords" content="git,non-profit,foss,oss,free,software,open,source,code,hosting">
<meta name="referrer" content="no-referrer" />
<meta name="_csrf" content="PG49nQsNVNDzL7j830GxV6baicY6MTU5MjMzNDMwNzQ5ODk4MzkwMw" />
<meta name="_suburl" content="" />
<script>
/*
@licstart The following is the entire license notice for the
JavaScript code in this page.
Copyright (c) 2016 The Gitea Authors
Copyright (c) 2015 The Gogs Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
---
Licensing information for additional javascript libraries can be found at:
{{StaticUrlPrefix}}/vendor/librejs.html
@licend The above is the entire license notice
for the JavaScript code in this page.
*/
</script>
<script>
window.config = {
StaticUrlPrefix: ''
}
</script>
<link rel="shortcut icon" href="/img/favicon.png" />
<link rel="mask-icon" href="/img/gitea-safari.svg" color="#609926">
<link rel="preload" href="/vendor/assets/font-awesome/css/font-awesome.min.css" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/vendor/assets/font-awesome/css/font-awesome.min.css"></noscript>
<link rel="stylesheet" href="/vendor/assets/octicons/octicons.min.css">
<link rel="stylesheet" href="/vendor/plugins/fomantic/semantic.min.css?v=6b0a0a50c7fb0aaef957cb0ab4f596e7">
<link rel="stylesheet" href="/css/index.css?v=6b0a0a50c7fb0aaef957cb0ab4f596e7">
<noscript>
<style>
.dropdown:hover > .menu { display: block; }
.ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
</style>
</noscript>
<link rel="stylesheet" href="/vendor/plugins/highlight/github.css">
<style class="list-search-style"></style>
<script src="/vendor/plugins/promise-polyfill/polyfill.min.js"></script>
<script src="/vendor/plugins/cssrelpreload/loadCSS.min.js"></script>
<script src="/vendor/plugins/cssrelpreload/cssrelpreload.min.js"></script>
<meta property="og:title" content="doit" />
<meta property="og:url" content="https://codeberg.org/flovanco/doit" />
<meta property="og:description" content="Task app based on OrbTk https://gitlab.redox-os.org/redox-os/orbtk." />
<meta property="og:type" content="object" />
<meta property="og:image" content="https://codeberg.org/user/avatar/flovanco/-1" />
<meta property="og:site_name" content="Codeberg.org" />
<link rel="stylesheet" href="/codeberg.css">
</head>
<body>
<div class="full height">
<noscript>Diese Webseite funktioniert besser mit JavaScript.</noscript>
<div class="ui top secondary stackable main menu following bar light">
<div class="ui container" id="navbar">
<div class="item brand" style="justify-content: space-between;">
<a href="/">
<img class="ui mini image" src="/img/gitea-sm.png">
</a>
<div class="ui basic icon button mobile-only" id="navbar-expand-toggle">
<i class="sidebar icon"></i>
</div>
</div>
<a class="item " href="/">Startseite</a>
<a class="item " href="/explore/repos">Erkunden</a>
<a class="item" href="/Codeberg/Community/issues">Codeberg Issues</a>
<a class="item" href="https://blog.codeberg.org">Blog</a>
<a class="item" href="https://join.codeberg.org/">Join Codeberg e.V.</a>
<a class="item" href="https://liberapay.com/codeberg/donate">Donate</a>
<a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io">Hilfe</a>
<div class="right stackable menu">
<a class="item" href="/user/sing_up">
<i class="octicon octicon-person"></i> Registrieren
</a>
<a class="item" rel="nofollow" href="/user/login?redirect_to=%2fflovanco%2fdoit%2fsrc%2fbranch%2fmaster%2fstatic%2ffonts%2fRoboto-Medium.ttf">
<i class="octicon octicon-sign-in"></i> Anmelden
</a>
</div>
</div>
</div>
<div class="repository file list">
<div class="header-wrapper">
<div class="ui container">
<div class="repo-header">
<div class="ui huge breadcrumb repo-title">
<i class="mega-octicon octicon-repo"></i>
<a href="/flovanco">flovanco</a>
<div class="divider"> / </div>
<a href="/flovanco/doit">doit</a>
</div>
<div class="repo-buttons">
<form method="post" action="/flovanco/doit/action/watch?redirect_to=%2fflovanco%2fdoit%2fsrc%2fbranch%2fmaster%2fstatic%2ffonts%2fRoboto-Medium.ttf">
<input type="hidden" name="_csrf" value="PG49nQsNVNDzL7j830GxV6baicY6MTU5MjMzNDMwNzQ5ODk4MzkwMw">
<div class="ui labeled button" tabindex="0">
<button type="submit" class="ui compact basic button">
<i class="icon fa-eye-slash"></i>Beobachten
</button>
<a class="ui basic label" href="/flovanco/doit/watchers">
1
</a>
</div>
</form>
<form method="post" action="/flovanco/doit/action/star?redirect_to=%2fflovanco%2fdoit%2fsrc%2fbranch%2fmaster%2fstatic%2ffonts%2fRoboto-Medium.ttf">
<input type="hidden" name="_csrf" value="PG49nQsNVNDzL7j830GxV6baicY6MTU5MjMzNDMwNzQ5ODk4MzkwMw">
<div class="ui labeled button" tabindex="0">
<button type="submit" class="ui compact basic button">
<i class="icon star outline"></i>Favorisieren
</button>
<a class="ui basic label" href="/flovanco/doit/stars">
1
</a>
</div>
</form>
<div class="ui labeled button " tabindex="0">
<a class="ui compact basic button poping up" data-content="Bitte melde dich an, um dieses Repository zu forken." rel="nofollow" href="/user/login?redirect_to=/repo/fork/3183" data-position="top center" data-variation="tiny">
<i class="octicon octicon-repo-forked"></i>Fork
</a>
<a class="ui basic label" href="/flovanco/doit/forks">
0
</a>
</div>
</div>
</div>
</div>
<div class="ui tabs container">
<div class="ui tabular stackable menu navbar">
<a class="active item" href="/flovanco/doit">
<i class="octicon octicon-code"></i> Code
</a>
<a class=" item" href="/flovanco/doit/issues">
<i class="octicon octicon-issue-opened"></i> Issues <span class="ui blue small label">4</span>
</a>
<a class=" item" href="/flovanco/doit/pulls">
<i class="octicon octicon-git-pull-request"></i> Pull-Requests <span class="ui gray small label">0</span>
</a>
<a class=" item" href="/flovanco/doit/releases">
<i class="octicon octicon-tag"></i> Releases <span class="ui gray small label">0</span>
</a>
<a class=" item" href="/flovanco/doit/wiki" >
<i class="octicon octicon-book"></i> Wiki
</a>
<a class=" item" href="/flovanco/doit/activity">
<i class="octicon octicon-pulse"></i> Aktivität
</a>
</div>
</div>
<div class="ui tabs divider"></div>
</div>
<div class="ui container">
<div class="ui repo-description">
<div id="repo-desc">
<span class="description has-emoji">Task app based on OrbTk <a href="https://gitlab.redox-os.org/redox-os/orbtk" rel="nofollow">https://gitlab.redox-os.org/redox-os/orbtk</a>.</span>
<a class="link" href=""></a>
</div>
</div>
<div class="ui" id="repo-topics">
</div>
<div class="hide" id="validate_prompt">
<span id="count_prompt">Du kannst nicht mehr als 25 Themen auswählen</span>
<span id="format_prompt">Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.</span>
</div>
<div class="ui segment sub-menu">
<div class="ui two horizontal center link list">
<div class="item">
<a class="ui" href="/flovanco/doit/commits/branch/master"><i class="octicon octicon-history"></i> <b>57</b> Commits</a>
</div>
<div class="item">
<a class="ui" href="/flovanco/doit/branches/"><i class="octicon octicon-git-branch"></i> <b>2</b> Branches</a>
</div>
<div class="item">
<a class="ui" href="#"><i class="octicon octicon-database"></i> <b>922KB</b></a>
</div>
</div>
</div>
<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
<div class="fitted item choose reference">
<div class="ui floating filter dropdown custom" data-can-create-branch="false" data-no-results="Keine Ergebnisse verfügbar.">
<div class="ui basic small compact button" @click="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible">
<span class="text">
<i class="octicon octicon-git-branch"></i>
Branch:
<strong>master</strong>
</span>
<i class="dropdown icon"></i>
</div>
<div class="data" style="display: none" data-mode="branches">
<div class="item branch selected" data-url="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf">master</div>
<div class="item branch " data-url="/flovanco/doit/src/branch/overview/static/fonts/Roboto-Medium.ttf">overview</div>
</div>
<div class="menu transition" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak>
<div class="ui icon search input">
<i class="filter icon"></i>
<input name="search" ref="searchField" v-model="searchTerm" @keydown="keydown($event)" placeholder="Branch oder Tag filtern...">
</div>
<div class="header branch-tag-choice">
<div class="ui grid">
<div class="two column row">
<a class="reference column" href="#" @click="mode = 'branches'; focusSearchField()">
<span class="text" :class="{black: mode == 'branches'}">
<i class="octicon octicon-git-branch"></i> Branches
</span>
</a>
<a class="reference column" href="#" @click="mode = 'tags'; focusSearchField()">
<span class="text" :class="{black: mode == 'tags'}">
<i class="reference tags icon"></i> Tags
</span>
</a>
</div>
</div>
</div>
<div class="scrolling menu" ref="scrollContainer">
<div v-for="(item, index) in filteredItems" :key="item.name" class="item" :class="{selected: item.selected, active: active == index}" @click="selectItem(item)" :ref="'listItem' + index">${ item.name }</div>
<div class="item" v-if="showCreateNewBranch" :class="{active: active == filteredItems.length}" :ref="'listItem' + filteredItems.length">
<a href="#" @click="createNewBranch()">
<div>
<i class="octicon octicon-git-branch"></i>
Erstelle Branch <strong>${ searchTerm }</strong>
</div>
<div class="text small">
von „master“
</div>
</a>
<form ref="newBranchForm" action="/flovanco/doit/branches/_new/branch/master" method="post">
<input type="hidden" name="_csrf" value="PG49nQsNVNDzL7j830GxV6baicY6MTU5MjMzNDMwNzQ5ODk4MzkwMw">
<input type="hidden" name="new_branch_name" v-model="searchTerm">
</form>
</div>
</div>
<div class="message" v-if="showNoResults">${ noResults }</div>
</div>
</div>
</div>
<div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="/flovanco/doit/src/branch/master" title="doit">doit</a><span class="divider">/</span><span class="section"><a href="/flovanco/doit/src/branch/master/static" title="static">static</a></span><span class="divider">/</span><span class="section"><a href="/flovanco/doit/src/branch/master/static/fonts" title="fonts">fonts</a></span><span class="divider">/</span><span class="active section" title="Roboto-Medium.ttf">Roboto-Medium.ttf</span></span></div>
<div class="right fitted item" id="file-buttons">
<div class="ui tiny blue buttons">
</div>
</div>
<div class="fitted item">
</div>
<div class="fitted item">
</div>
</div>
<div class="tab-size-8 non-diff-file-content">
<h4 class="file-header ui top attached header">
<div class="file-header-left">
<div class="file-info text grey normal mono">
<div class="file-info-entry">
134KB
</div>
</div>
</div>
<div class="file-header-right">
<div class="ui right file-actions">
<div class="ui buttons">
<a class="ui button" href="/flovanco/doit/raw/branch/master/static/fonts/Roboto-Medium.ttf">Originalformat</a>
<a class="ui button" href="/flovanco/doit/src/commit/417acaf7ac867ed47ab73e7e66f07f15f1f124cc/static/fonts/Roboto-Medium.ttf">Permalink</a>
<a class="ui button" href="/flovanco/doit/commits/branch/master/static/fonts/Roboto-Medium.ttf">Verlauf</a>
</div>
<i class="octicon octicon-pencil btn-octicon poping up disabled" data-content="Binärdateien können nicht im Webinterface bearbeitet werden." data-position="bottom center" data-variation="tiny inverted"></i>
<i class="octicon octicon-trashcan btn-octicon poping up disabled" data-content="Du benötigst Schreibzugriff, um Änderungen an dieser Datei vorzuschlagen oder vorzunehmen." data-position="bottom center" data-variation="tiny inverted"></i>
</div>
</div>
</h4>
<div class="ui attached table unstackable segment">
<div class="file-view has-emoji">
<div class="view-raw ui center">
<a href="/flovanco/doit/raw/branch/master/static/fonts/Roboto-Medium.ttf" rel="nofollow" class="btn btn-gray btn-radius">Originalformat anzeigen</a>
</div>
</div>
</div>
</div>
<script>
function submitDeleteForm() {
var message = prompt("delete_confirm_message\n\ndelete_commit_summary", "Delete ''");
if (message != null) {
$("#delete-message").val(message);
$("#delete-file-form").submit()
}
}
</script>
</div>
</div>
</div>
<footer>
<div class="ui container">
<div class="ui left">
</div>
<div class="ui right links">
<div class="ui language bottom floating slide up dropdown link item">
<i class="world icon"></i>
<div class="text">Deutsch</div>
<div class="menu">
<a lang="de-DE" class="item active selected" href="#">Deutsch</a>
<a lang="en-US" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=en-US">English</a>
<a lang="zh-CN" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=zh-CN">简体中文</a>
<a lang="zh-HK" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=zh-HK">繁體中文(香港)</a>
<a lang="zh-TW" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=zh-TW">繁體中文(台灣)</a>
<a lang="fr-FR" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=fr-FR">français</a>
<a lang="nl-NL" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=nl-NL">Nederlands</a>
<a lang="lv-LV" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=lv-LV">latviešu</a>
<a lang="ru-RU" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=ru-RU">русский</a>
<a lang="uk-UA" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=uk-UA">Українська</a>
<a lang="ja-JP" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=ja-JP">日本語</a>
<a lang="es-ES" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=es-ES">español</a>
<a lang="pt-BR" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=pt-BR">português do Brasil</a>
<a lang="pl-PL" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=pl-PL">polski</a>
<a lang="bg-BG" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=bg-BG">български</a>
<a lang="it-IT" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=it-IT">italiano</a>
<a lang="fi-FI" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=fi-FI">suomi</a>
<a lang="tr-TR" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=tr-TR">Türkçe</a>
<a lang="cs-CZ" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=cs-CZ">čeština</a>
<a lang="sr-SP" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=sr-SP">српски</a>
<a lang="sv-SE" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=sv-SE">svenska</a>
<a lang="ko-KR" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Medium.ttf?lang=ko-KR">한국어</a>
</div>
</div>
<a href="/vendor/librejs.html" data-jslicense="1">JavaScript licenses</a>
<a target="_blank" rel="noopener" href="/codeberg/org/src/branch/master/PrivacyPolicy.md">Privacy Policy</a>
<a target="_blank" rel="noopener" href="/codeberg/org/src/branch/master/Satzung.md">Bylaws/Satzung</a>
<a target="_blank" rel="noopener" href="/codeberg/org/src/branch/master/Imprint.md">Imprint/Impressum</a>
<a target="_blank" rel="noopener" href="/codeberg/org/src/branch/master/TermsOfUse.md">Terms of Use</a>
</div>
</div>
</footer>
<script src="/vendor/plugins/jquery/jquery.min.js?v=3.4.1"></script>
<script src="/vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1"></script>
<script src="/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js"></script>
<script src="/vendor/plugins/highlight/highlight.pack.js"></script>
<script src="/vendor/plugins/emojify/emojify.custom.js"></script>
<script src="/vendor/plugins/clipboard/clipboard.min.js"></script>
<script src="/vendor/plugins/vue/vue.min.js"></script>
<script src="/vendor/plugins/fomantic/semantic.min.js?v=6b0a0a50c7fb0aaef957cb0ab4f596e7"></script>
<script src="/js/index.js?v=6b0a0a50c7fb0aaef957cb0ab4f596e7"></script>
</body>
</html>

View File

@@ -1,581 +0,0 @@
<!DOCTYPE html>
<html lang="de-DE">
<head data-suburl="">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>flovanco/doit: Task app based on OrbTk https://gitlab.redox-os.org/redox-os/orbtk. - static/fonts/Roboto-Regular.ttf at master - doit - Codeberg.org</title>
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials">
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/serviceworker.js').then(function(registration) {
console.info('ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) {
console.info('ServiceWorker registration failed: ', err);
});
}
</script>
<meta name="theme-color" content="#6cc644">
<meta name="author" content="flovanco" />
<meta name="description" content="doit - Task app based on OrbTk https://gitlab.redox-os.org/redox-os/orbtk." />
<meta name="keywords" content="git,non-profit,foss,oss,free,software,open,source,code,hosting">
<meta name="referrer" content="no-referrer" />
<meta name="_csrf" content="PG49nQsNVNDzL7j830GxV6baicY6MTU5MjMzNDMwNzQ5ODk4MzkwMw" />
<meta name="_suburl" content="" />
<script>
/*
@licstart The following is the entire license notice for the
JavaScript code in this page.
Copyright (c) 2016 The Gitea Authors
Copyright (c) 2015 The Gogs Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
---
Licensing information for additional javascript libraries can be found at:
{{StaticUrlPrefix}}/vendor/librejs.html
@licend The above is the entire license notice
for the JavaScript code in this page.
*/
</script>
<script>
window.config = {
StaticUrlPrefix: ''
}
</script>
<link rel="shortcut icon" href="/img/favicon.png" />
<link rel="mask-icon" href="/img/gitea-safari.svg" color="#609926">
<link rel="preload" href="/vendor/assets/font-awesome/css/font-awesome.min.css" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/vendor/assets/font-awesome/css/font-awesome.min.css"></noscript>
<link rel="stylesheet" href="/vendor/assets/octicons/octicons.min.css">
<link rel="stylesheet" href="/vendor/plugins/fomantic/semantic.min.css?v=6b0a0a50c7fb0aaef957cb0ab4f596e7">
<link rel="stylesheet" href="/css/index.css?v=6b0a0a50c7fb0aaef957cb0ab4f596e7">
<noscript>
<style>
.dropdown:hover > .menu { display: block; }
.ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
</style>
</noscript>
<link rel="stylesheet" href="/vendor/plugins/highlight/github.css">
<style class="list-search-style"></style>
<script src="/vendor/plugins/promise-polyfill/polyfill.min.js"></script>
<script src="/vendor/plugins/cssrelpreload/loadCSS.min.js"></script>
<script src="/vendor/plugins/cssrelpreload/cssrelpreload.min.js"></script>
<meta property="og:title" content="doit" />
<meta property="og:url" content="https://codeberg.org/flovanco/doit" />
<meta property="og:description" content="Task app based on OrbTk https://gitlab.redox-os.org/redox-os/orbtk." />
<meta property="og:type" content="object" />
<meta property="og:image" content="https://codeberg.org/user/avatar/flovanco/-1" />
<meta property="og:site_name" content="Codeberg.org" />
<link rel="stylesheet" href="/codeberg.css">
</head>
<body>
<div class="full height">
<noscript>Diese Webseite funktioniert besser mit JavaScript.</noscript>
<div class="ui top secondary stackable main menu following bar light">
<div class="ui container" id="navbar">
<div class="item brand" style="justify-content: space-between;">
<a href="/">
<img class="ui mini image" src="/img/gitea-sm.png">
</a>
<div class="ui basic icon button mobile-only" id="navbar-expand-toggle">
<i class="sidebar icon"></i>
</div>
</div>
<a class="item " href="/">Startseite</a>
<a class="item " href="/explore/repos">Erkunden</a>
<a class="item" href="/Codeberg/Community/issues">Codeberg Issues</a>
<a class="item" href="https://blog.codeberg.org">Blog</a>
<a class="item" href="https://join.codeberg.org/">Join Codeberg e.V.</a>
<a class="item" href="https://liberapay.com/codeberg/donate">Donate</a>
<a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io">Hilfe</a>
<div class="right stackable menu">
<a class="item" href="/user/sing_up">
<i class="octicon octicon-person"></i> Registrieren
</a>
<a class="item" rel="nofollow" href="/user/login?redirect_to=%2fflovanco%2fdoit%2fsrc%2fbranch%2fmaster%2fstatic%2ffonts%2fRoboto-Regular.ttf">
<i class="octicon octicon-sign-in"></i> Anmelden
</a>
</div>
</div>
</div>
<div class="repository file list">
<div class="header-wrapper">
<div class="ui container">
<div class="repo-header">
<div class="ui huge breadcrumb repo-title">
<i class="mega-octicon octicon-repo"></i>
<a href="/flovanco">flovanco</a>
<div class="divider"> / </div>
<a href="/flovanco/doit">doit</a>
</div>
<div class="repo-buttons">
<form method="post" action="/flovanco/doit/action/watch?redirect_to=%2fflovanco%2fdoit%2fsrc%2fbranch%2fmaster%2fstatic%2ffonts%2fRoboto-Regular.ttf">
<input type="hidden" name="_csrf" value="PG49nQsNVNDzL7j830GxV6baicY6MTU5MjMzNDMwNzQ5ODk4MzkwMw">
<div class="ui labeled button" tabindex="0">
<button type="submit" class="ui compact basic button">
<i class="icon fa-eye-slash"></i>Beobachten
</button>
<a class="ui basic label" href="/flovanco/doit/watchers">
1
</a>
</div>
</form>
<form method="post" action="/flovanco/doit/action/star?redirect_to=%2fflovanco%2fdoit%2fsrc%2fbranch%2fmaster%2fstatic%2ffonts%2fRoboto-Regular.ttf">
<input type="hidden" name="_csrf" value="PG49nQsNVNDzL7j830GxV6baicY6MTU5MjMzNDMwNzQ5ODk4MzkwMw">
<div class="ui labeled button" tabindex="0">
<button type="submit" class="ui compact basic button">
<i class="icon star outline"></i>Favorisieren
</button>
<a class="ui basic label" href="/flovanco/doit/stars">
1
</a>
</div>
</form>
<div class="ui labeled button " tabindex="0">
<a class="ui compact basic button poping up" data-content="Bitte melde dich an, um dieses Repository zu forken." rel="nofollow" href="/user/login?redirect_to=/repo/fork/3183" data-position="top center" data-variation="tiny">
<i class="octicon octicon-repo-forked"></i>Fork
</a>
<a class="ui basic label" href="/flovanco/doit/forks">
0
</a>
</div>
</div>
</div>
</div>
<div class="ui tabs container">
<div class="ui tabular stackable menu navbar">
<a class="active item" href="/flovanco/doit">
<i class="octicon octicon-code"></i> Code
</a>
<a class=" item" href="/flovanco/doit/issues">
<i class="octicon octicon-issue-opened"></i> Issues <span class="ui blue small label">4</span>
</a>
<a class=" item" href="/flovanco/doit/pulls">
<i class="octicon octicon-git-pull-request"></i> Pull-Requests <span class="ui gray small label">0</span>
</a>
<a class=" item" href="/flovanco/doit/releases">
<i class="octicon octicon-tag"></i> Releases <span class="ui gray small label">0</span>
</a>
<a class=" item" href="/flovanco/doit/wiki" >
<i class="octicon octicon-book"></i> Wiki
</a>
<a class=" item" href="/flovanco/doit/activity">
<i class="octicon octicon-pulse"></i> Aktivität
</a>
</div>
</div>
<div class="ui tabs divider"></div>
</div>
<div class="ui container">
<div class="ui repo-description">
<div id="repo-desc">
<span class="description has-emoji">Task app based on OrbTk <a href="https://gitlab.redox-os.org/redox-os/orbtk" rel="nofollow">https://gitlab.redox-os.org/redox-os/orbtk</a>.</span>
<a class="link" href=""></a>
</div>
</div>
<div class="ui" id="repo-topics">
</div>
<div class="hide" id="validate_prompt">
<span id="count_prompt">Du kannst nicht mehr als 25 Themen auswählen</span>
<span id="format_prompt">Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.</span>
</div>
<div class="ui segment sub-menu">
<div class="ui two horizontal center link list">
<div class="item">
<a class="ui" href="/flovanco/doit/commits/branch/master"><i class="octicon octicon-history"></i> <b>57</b> Commits</a>
</div>
<div class="item">
<a class="ui" href="/flovanco/doit/branches/"><i class="octicon octicon-git-branch"></i> <b>2</b> Branches</a>
</div>
<div class="item">
<a class="ui" href="#"><i class="octicon octicon-database"></i> <b>922KB</b></a>
</div>
</div>
</div>
<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
<div class="fitted item choose reference">
<div class="ui floating filter dropdown custom" data-can-create-branch="false" data-no-results="Keine Ergebnisse verfügbar.">
<div class="ui basic small compact button" @click="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible">
<span class="text">
<i class="octicon octicon-git-branch"></i>
Branch:
<strong>master</strong>
</span>
<i class="dropdown icon"></i>
</div>
<div class="data" style="display: none" data-mode="branches">
<div class="item branch selected" data-url="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf">master</div>
<div class="item branch " data-url="/flovanco/doit/src/branch/overview/static/fonts/Roboto-Regular.ttf">overview</div>
</div>
<div class="menu transition" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak>
<div class="ui icon search input">
<i class="filter icon"></i>
<input name="search" ref="searchField" v-model="searchTerm" @keydown="keydown($event)" placeholder="Branch oder Tag filtern...">
</div>
<div class="header branch-tag-choice">
<div class="ui grid">
<div class="two column row">
<a class="reference column" href="#" @click="mode = 'branches'; focusSearchField()">
<span class="text" :class="{black: mode == 'branches'}">
<i class="octicon octicon-git-branch"></i> Branches
</span>
</a>
<a class="reference column" href="#" @click="mode = 'tags'; focusSearchField()">
<span class="text" :class="{black: mode == 'tags'}">
<i class="reference tags icon"></i> Tags
</span>
</a>
</div>
</div>
</div>
<div class="scrolling menu" ref="scrollContainer">
<div v-for="(item, index) in filteredItems" :key="item.name" class="item" :class="{selected: item.selected, active: active == index}" @click="selectItem(item)" :ref="'listItem' + index">${ item.name }</div>
<div class="item" v-if="showCreateNewBranch" :class="{active: active == filteredItems.length}" :ref="'listItem' + filteredItems.length">
<a href="#" @click="createNewBranch()">
<div>
<i class="octicon octicon-git-branch"></i>
Erstelle Branch <strong>${ searchTerm }</strong>
</div>
<div class="text small">
von „master“
</div>
</a>
<form ref="newBranchForm" action="/flovanco/doit/branches/_new/branch/master" method="post">
<input type="hidden" name="_csrf" value="PG49nQsNVNDzL7j830GxV6baicY6MTU5MjMzNDMwNzQ5ODk4MzkwMw">
<input type="hidden" name="new_branch_name" v-model="searchTerm">
</form>
</div>
</div>
<div class="message" v-if="showNoResults">${ noResults }</div>
</div>
</div>
</div>
<div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="/flovanco/doit/src/branch/master" title="doit">doit</a><span class="divider">/</span><span class="section"><a href="/flovanco/doit/src/branch/master/static" title="static">static</a></span><span class="divider">/</span><span class="section"><a href="/flovanco/doit/src/branch/master/static/fonts" title="fonts">fonts</a></span><span class="divider">/</span><span class="active section" title="Roboto-Regular.ttf">Roboto-Regular.ttf</span></span></div>
<div class="right fitted item" id="file-buttons">
<div class="ui tiny blue buttons">
</div>
</div>
<div class="fitted item">
</div>
<div class="fitted item">
</div>
</div>
<div class="tab-size-8 non-diff-file-content">
<h4 class="file-header ui top attached header">
<div class="file-header-left">
<div class="file-info text grey normal mono">
<div class="file-info-entry">
142KB
</div>
</div>
</div>
<div class="file-header-right">
<div class="ui right file-actions">
<div class="ui buttons">
<a class="ui button" href="/flovanco/doit/raw/branch/master/static/fonts/Roboto-Regular.ttf">Originalformat</a>
<a class="ui button" href="/flovanco/doit/src/commit/417acaf7ac867ed47ab73e7e66f07f15f1f124cc/static/fonts/Roboto-Regular.ttf">Permalink</a>
<a class="ui button" href="/flovanco/doit/commits/branch/master/static/fonts/Roboto-Regular.ttf">Verlauf</a>
</div>
<i class="octicon octicon-pencil btn-octicon poping up disabled" data-content="Binärdateien können nicht im Webinterface bearbeitet werden." data-position="bottom center" data-variation="tiny inverted"></i>
<i class="octicon octicon-trashcan btn-octicon poping up disabled" data-content="Du benötigst Schreibzugriff, um Änderungen an dieser Datei vorzuschlagen oder vorzunehmen." data-position="bottom center" data-variation="tiny inverted"></i>
</div>
</div>
</h4>
<div class="ui attached table unstackable segment">
<div class="file-view has-emoji">
<div class="view-raw ui center">
<a href="/flovanco/doit/raw/branch/master/static/fonts/Roboto-Regular.ttf" rel="nofollow" class="btn btn-gray btn-radius">Originalformat anzeigen</a>
</div>
</div>
</div>
</div>
<script>
function submitDeleteForm() {
var message = prompt("delete_confirm_message\n\ndelete_commit_summary", "Delete ''");
if (message != null) {
$("#delete-message").val(message);
$("#delete-file-form").submit()
}
}
</script>
</div>
</div>
</div>
<footer>
<div class="ui container">
<div class="ui left">
</div>
<div class="ui right links">
<div class="ui language bottom floating slide up dropdown link item">
<i class="world icon"></i>
<div class="text">Deutsch</div>
<div class="menu">
<a lang="de-DE" class="item active selected" href="#">Deutsch</a>
<a lang="en-US" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=en-US">English</a>
<a lang="zh-CN" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=zh-CN">简体中文</a>
<a lang="zh-HK" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=zh-HK">繁體中文(香港)</a>
<a lang="zh-TW" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=zh-TW">繁體中文(台灣)</a>
<a lang="fr-FR" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=fr-FR">français</a>
<a lang="nl-NL" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=nl-NL">Nederlands</a>
<a lang="lv-LV" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=lv-LV">latviešu</a>
<a lang="ru-RU" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=ru-RU">русский</a>
<a lang="uk-UA" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=uk-UA">Українська</a>
<a lang="ja-JP" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=ja-JP">日本語</a>
<a lang="es-ES" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=es-ES">español</a>
<a lang="pt-BR" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=pt-BR">português do Brasil</a>
<a lang="pl-PL" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=pl-PL">polski</a>
<a lang="bg-BG" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=bg-BG">български</a>
<a lang="it-IT" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=it-IT">italiano</a>
<a lang="fi-FI" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=fi-FI">suomi</a>
<a lang="tr-TR" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=tr-TR">Türkçe</a>
<a lang="cs-CZ" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=cs-CZ">čeština</a>
<a lang="sr-SP" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=sr-SP">српски</a>
<a lang="sv-SE" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=sv-SE">svenska</a>
<a lang="ko-KR" class="item " href="/flovanco/doit/src/branch/master/static/fonts/Roboto-Regular.ttf?lang=ko-KR">한국어</a>
</div>
</div>
<a href="/vendor/librejs.html" data-jslicense="1">JavaScript licenses</a>
<a target="_blank" rel="noopener" href="/codeberg/org/src/branch/master/PrivacyPolicy.md">Privacy Policy</a>
<a target="_blank" rel="noopener" href="/codeberg/org/src/branch/master/Satzung.md">Bylaws/Satzung</a>
<a target="_blank" rel="noopener" href="/codeberg/org/src/branch/master/Imprint.md">Imprint/Impressum</a>
<a target="_blank" rel="noopener" href="/codeberg/org/src/branch/master/TermsOfUse.md">Terms of Use</a>
</div>
</div>
</footer>
<script src="/vendor/plugins/jquery/jquery.min.js?v=3.4.1"></script>
<script src="/vendor/plugins/jquery-migrate/jquery-migrate.min.js?v=3.0.1"></script>
<script src="/vendor/plugins/jquery.areyousure/jquery.are-you-sure.js"></script>
<script src="/vendor/plugins/highlight/highlight.pack.js"></script>
<script src="/vendor/plugins/emojify/emojify.custom.js"></script>
<script src="/vendor/plugins/clipboard/clipboard.min.js"></script>
<script src="/vendor/plugins/vue/vue.min.js"></script>
<script src="/vendor/plugins/fomantic/semantic.min.js?v=6b0a0a50c7fb0aaef957cb0ab4f596e7"></script>
<script src="/js/index.js?v=6b0a0a50c7fb0aaef957cb0ab4f596e7"></script>
</body>
</html>

View File

@@ -1,122 +0,0 @@
Theme (
styles: {
"button_menu": (
base: "menu",
properties: {
"background": "transparent",
//"background": "$GOLDEN_DREAM",
//"background": "$LINK_WATER",
//"border_brush": "$LINK_WATER",
//"border_brush": "$GOLDEN_DREAM",
"border_radius": 0,
"border_width": 0,
//"foreground": "$BRIGHT_GRAY",
//"icon_brush": "$BRIGHT_GRAY",
"font_size": "$ICON_SIZE_16",
"h_align": "left",
//"height": 14,
"margin": (0, 4, 0, 0),
//"padding": (8, 0, 8, 0),
},
),
"container_menu": (
properties: {
"border_radius": 0,
"border_width": 1,
"background": "$BRIGHT_GRAY",
"border_brush": "$LINK_WATER",
//"border_brush": "$GOLDEN_DREAM",
"padding": 4,
},
),
"container_progress": (
properties: {
"border_radius": 3,
"border_width": 1,
"background": "$BRIGHT_GRAY",
"border_brush": "$LINK_WATER",
//"border_brush": "$GOLDEN_DREAM",
"padding": 14,
"h_align": "end"
},
),
"container_form": (
base: "container",
properties: {
"background": "$BRIGHT_GRAY",
"border_brush": "$LINK_WATER",
"border_radius": 3,
"border_width": 1,
"padding": 14,
"v_align": "top",
},
),
"header_bar": (
base: "header",
properties: {
"foreground": "$LINK_WATER",
},
),
"hint": (
base: "body",
properties: {
"font_size": 11,
"font_family": "$MEDIUM_FONT",
"width": "250",
"min_width": "250"
},
),
"menu": (
//base: "base",
properties: {
"font_size": 16,
"font_family": "$MEDIUM_FONT",
"background": "$BLACK",
"opacity": 1,
},
states: {
"pressed": {
"background": "$WHITE",
},
},
),
"popup_progress": (
base: "popup",
properties: {
//"h_align": "center",
"width": 300,
"heigth": 120,
},
),
"stack_menu": (
properties: {
//"background": "transparent",
"spacing": 2,
"orientation": "vertical",
"h_align": "left",
},
),
"stack_progress": (
properties: {
//"background": "transparent",
"spacing": 8,
"margin": (16, 16, 16, 16),
},
),
"textblock": (
//base: "base",
properties: {
"font_size": "$ICON_SIZE_12",
},
),
"textblock_progress": (
base: "textblock",
properties: {
//"background": "transparent",
//"font_size": 12,
"h_align": "center",
"v_align": "center",
},
),
}
)

View File

@@ -1,100 +0,0 @@
Theme (
styles: {
"button_menu": (
base: "menu",
properties: {
"background": "transparent",
"border_radius": 0,
"border_width": 0,
"font_size": "$ICON_SIZE_16",
"h_align": "left",
"margin": (0, 4, 0, 0),
},
),
"container_menu": (
properties: {
"border_radius": 0,
"border_width": 1,
"background": "$BRIGHT_GRAY",
"border_brush": "$LINK_WATER",
"padding": 4,
},
),
"container_progress": (
properties: {
"border_radius": 3,
"border_width": 1,
"background": "$BRIGHT_GRAY",
"border_brush": "$LINK_WATER",
"padding": 14,
"h_align": "end",
},
),
"container_form": (
base: "container",
properties: {
"background": "$GRAY_NURSE",
"border_brush": "$LINK_WATER",
"border_radius": 3,
"border_width": 1,
"padding": 14,
"v_align": "top",
},
),
"header_bar": (
base: "header",
properties: {
"background": "$GRAY_NURSE",
"foreground": "$BRIGHT_GRAY",
},
),
"menu": (
//base: "base",
properties: {
"font_size": 16,
"font_family": "$MEDIUM_FONT",
"background": "$GRAY_NURSE",
"opacity": 1,
"foreground": "$BRIGHT_GRAY",
},
states: {
"pressed": {
"background": "$WHITE",
},
},
),
"popup_progress": (
base: "popup",
properties: {
"width": 300,
"heigth": 120,
},
),
"stack_menu": (
properties: {
"spacing": 2,
"orientation": "vertical",
"h_align": "left",
},
),
"stack_progress": (
properties: {
"spacing": 8,
"margin": (16, 16, 16, 16),
},
),
"textblock": (
//base: "base",
properties: {
"font_size": "$ICON_SIZE_12",
},
),
"textblock_progress": (
base: "textblock",
properties: {
"h_align": "center",
"v_align": "center",
},
),
}
)

View File

@@ -1 +0,0 @@
../../../advotrackerd/data/POLLFNR_WOECHENTLICH.txt

View File

@@ -1,98 +0,0 @@
{
"err.lang.not_found": {
"de_DE.UTF-8": "Konnte die Umgebungsvarialbe LANG nicht auslesen",
"de": "Konnte die Umgebungsvarialbe LANG nicht auslesen",
"en": "Couldn't read LANG"
},
"err.user.not_found": {
"fr": "Utilisateur introuvable: $email, $id",
"de-DE.UTF-8": "Anwender nicht gefunden: $email, $id",
"de": "Anwender nicht gefunden: $email, $id",
"en": "User not found: $email, $id"
},
"main.started": {
"de_DE.UTF-8": "Programmlogik starten",
"de": "Programmlogik starten",
"en": "Program logic started"
},
"main.finished": {
"de_DE.UTF-8": "Programmlogik beendet",
"de": "Programmlogik beendet",
"en": "Program logic finished"
},
"parse.arguments": {
"de_DE.UTF-8": "Programmargumente prüfen",
"de": "Programmargumente prüfen",
"en": "Parsing arguments"
},
"parse.environment": {
"de_DE.UTF-8": "Umgebungsvariablen prüfen",
"de": "Umgebungsvariablen prüfen",
"en": "Parsing environment"
},
"parse.results": {
"de_DE.UTF-8": "Ergebnisse der Konfigurations-Parameterprüfung",
"de": "Ergebnisse der Konfigurationsparameterprüfung",
"en": "Config parsing results"
},
"config.name": {
"de_DE.UTF-8": "Konfigurationswert für",
"de": "Konfigurationswert für",
"en": "Config Value for"
},
"config.name.lang": {
"de_DE.UTF-8": "Sprach-Code",
"de": "Sprach-Code",
"en": "Language code"
},
"config.name.verbositylevel": {
"de_DE.UTF-8": "Ausgabe-Ebene",
"de": "Ausgabe-Ebene",
"en": "verbosity level"
},
"config.name.environment": {
"de_DE.UTF-8": "Umgebungsvariablen",
"de": "Umgebungsvariablen",
"en": "environment"
},
"config.name.configfile": {
"de_DE.UTF-8": "Konfigurations-Datei",
"de": "Konfigurations-Datei",
"en": "config file"
},
"config.name.dbdriver": {
"de_DE.UTF-8": "Datenbank-Treiber",
"de": "Datenbank-Treiber",
"en": "database driver"
},
"csv_import.started": {
"de_DE.UTF-8": "importieren von einer csv-datei gestartet",
"de": "importieren von einer csv-datei gestartet",
"en": "import from a csv-file started"
},
"csv_import.finished": {
"de_DE.UTF-8": "importieren von einer csv-datei beendet",
"de": "importieren von einer csv-datei beendet",
"en": "import from a csv-file finished"
},
"csv_export.started": {
"de_DE.UTF-8": "exportieren in eine csv-datei gestartet",
"de": "exportieren in eine csv-datei gestartet",
"en": "export to csv-file started"
},
"csv_export.finished": {
"de_DE.UTF-8": "exportieren in eine csv-datei beendet",
"de": "exportieren in eine csv-datei beendet",
"en": "export to csv-file finished"
},
"state.started": {
"de_DE.UTF-8": "gestartet",
"de": "gestartet",
"en": "started"
},
"state.finished": {
"de_DE.UTF-8": "beendet",
"de": "beended",
"en": "finished"
}
}

View File

@@ -1,11 +1,5 @@
use orbtk::prelude::*; use orbtk::prelude::*;
// use orbtk::theme::DEFAULT_THEME_CSS;
// use orbtk::theme::LIGHT_THEME_EXTENSION_CSS;
// //#[cfg(feature = "light-theme")]
// static WIDGET_EXT: &'static str = include_str!("../../resources/stylesheets/policyholder_check.css");
// fn get_theme() -> ThemeValue { // fn get_theme() -> ThemeValue {
// //ThemeValue::create_from_css(LIGHT_THEME_EXTENSION_CSS) // //ThemeValue::create_from_css(LIGHT_THEME_EXTENSION_CSS)
// ThemeValue::create_from_css(DEFAULT_THEME_CSS) // ThemeValue::create_from_css(DEFAULT_THEME_CSS)
@@ -15,12 +9,8 @@ use orbtk::prelude::*;
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
enum Action { enum Action {
//ClearText,
EntryActivated(Entity), EntryActivated(Entity),
EntryChanged(Entity), EntryChanged(Entity)
//ValueChanged(Entity),
//ValueOk,
//ValueNone,
} }
#[derive(AsAny)] #[derive(AsAny)]
@@ -58,23 +48,16 @@ impl State for MainViewState {
// //ctx.widget().set("policynumber", background("#5b0f22")); // //ctx.widget().set("policynumber", background("#5b0f22"));
//} //}
Action::EntryActivated(entity) => { Action::EntryActivated(entity) => {
let mut text_box = TextBox::get(ctx.get_widget(entity)); //let text = ctx.get_widget(entity).clone::<String>("text");
let text = text_box.text_mut(); let widget = ctx.get_widget(entity);
//let mut widget = ctx.get_widget(entity); let text = widget.get::<String>("text");
//let text = widget.get_mut::<String16>("text");
println!("got value policynumber: {}", text); println!("got value policynumber: {}", text);
//text.clear();
} }
Action::EntryChanged(entity) => { Action::EntryChanged(entity) => {
let widget = ctx.get_widget(entity); let widget = ctx.get_widget(entity);
let text = widget.get::<String16>("text"); let text = widget.get::<String>("text");
println!("entry changed: {}", text); println!("entry changed: {}", text);
} }
// Action::ValueChanged(entity) => {
// let val =
// ((*ctx.get_widget(entity).get::<f64>("val")).floor() as i32).to_string();
// ctx.child("value_text").set("text", String16::from(val));
//}
} }
self.action = None; self.action = None;
@@ -85,7 +68,6 @@ impl State for MainViewState {
fn create_header(ctx: &mut BuildContext, text: &str) -> Entity { fn create_header(ctx: &mut BuildContext, text: &str) -> Entity {
TextBlock::new() TextBlock::new()
.text(text) .text(text)
//.element("text-block")
.style("header") .style("header")
.build(ctx) .build(ctx)
} }
@@ -101,26 +83,19 @@ widget!(
impl Template for MainView { impl Template for MainView {
fn template(self, id: Entity, ctx: &mut BuildContext) -> Self { fn template(self, id: Entity, ctx: &mut BuildContext) -> Self {
self.name("MainView").child( self.name("MainView").child(
//.result("Anzahl Versicherungsnummern: 0")
//.result("Policyholders count: 0").sum_policynumbers(0)
//.sum_policynumbers(0)
Grid::new() Grid::new()
.background("#fafafa") .background("#fafafa")
//.width(200.0)
//.height(360.0)
.columns( .columns(
Columns::new() Columns::create()
.add(150.0) .push(150.0)
.add("*") .push("*")
//.add(120.0) .push(150.0)
//.add("auto")
.add(150.0)
.build(), .build(),
) )
.rows( .rows(
Rows::new() Rows::create()
.add("*") .push("*")
.add("*") .push("*")
.build(), .build(),
) )
.child( .child(
@@ -140,27 +115,22 @@ impl Template for MainView {
.child(create_header(ctx, "Validierung Versicherungsnummer")) .child(create_header(ctx, "Validierung Versicherungsnummer"))
.child( .child(
TextBox::new() TextBox::new()
//.class("text_box")
// overwriting the class defaults
/* .background("transparent")
.foreground("#9dafbf") .foreground("#9dafbf")
.background("#fafafa") .background("#fafafa")
/* .foreground(colors::LINK_WATER_COLOR) */
.border_brush("#5b0f22") .border_brush("#5b0f22")
.border_width(5) .border_width(5)
.border_radius(15) */ .border_radius(15)
//.name("policynumber") //.name("policynumber")
.focused(true) .focused(true)
.water_mark("Versicherungs-Nr...") .water_mark("Versicherungs-Nr...")
//.text("Number policyholder", id)
.text(("policynumber", id)) .text(("policynumber", id))
.font_size(24.0) .font_size(24.0)
.h_align("stretch") .h_align("stretch")
.on_activate(move |states, entity| { .on_activate(move |ctx, entity| {
state(id, states).action(Action::EntryActivated(entity)); state(id, ctx).action(Action::EntryActivated(entity));
}) })
.on_changed(move |states, entity| { .on_changed("text", move |ctx, entity| {
state(id, states).action(Action::EntryChanged(entity)); state(id, ctx).action(Action::EntryChanged(entity));
}) })
.build(ctx), .build(ctx),
) )
@@ -180,28 +150,28 @@ impl Template for MainView {
) )
.child( .child(
Grid::new() Grid::new()
//.element("logo_customer") //.class("logo_customer")
.margin((9.0, 16.0, 16.0, 9.0)) .margin((9.0, 16.0, 16.0, 9.0))
.attach(Grid::column(0)) .attach(Grid::column(0))
.attach(Grid::row(1)) .attach(Grid::row(1))
.v_align("end") .v_align("end")
.child( .child(
ImageWidget::new() ImageWidget::new()
.image("./resources/images/hiedemann_logo.png") .image("assets/images/customer_logo.png")
.build(ctx), .build(ctx),
) )
.build(ctx), .build(ctx),
) )
.child( .child(
Grid::new() Grid::new()
//.element("logo_vendor") //.class("logo_vendor")
.margin((9.0, 16.0, 16.0, 9.0)) .margin((9.0, 16.0, 16.0, 9.0))
.attach(Grid::column(2)) .attach(Grid::column(2))
.attach(Grid::row(1)) .attach(Grid::row(1))
.v_align("end") .v_align("end")
.child( .child(
ImageWidget::new() ImageWidget::new()
.image("./resources/images/networkx_logo.png") .image("assets/images/networkx_logo.png")
.build(ctx), .build(ctx),
) )
.build(ctx), .build(ctx),

View File

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

View File

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

View File

@@ -1,71 +1,164 @@
/* /*
* advotracker - Hotline tackingtool for Advocats * advotracker - Hotline tackingtool for Advocats
* *
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de> * Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT) * SPDX-License-Identifier: (0BSD or MIT)
*/ */
// Component Values (Properties)
pub static PROP_ADVOTRACKER: &str = "advotracker";
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 <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_POLICY_CHECK: &str = "policy_check";
pub static PROP_POLICY_PROGRESS_COUNT: &str = "policy_progress_count";
pub static PROP_POLICY_DATA_LIST: &str = "policy_data_list";
pub static PROP_POLICY_DATA_COUNT: &str = "policy_data_count";
pub static PROP_POLICY_LIST: &str = "policy_list";
pub static PROP_POLICY_LIST_COUNT: &str = "policy_list_count";
// Styles (RON based theme system) // Styles (RON based theme system)
pub static STYLE_BOTTOM_BAR: &'static str = "bottom_bar"; pub static STYLE_BOTTOM_BAR: &str = "bottom_bar";
pub static STYLE_HEADER_BAR: &'static str = "header_bar"; pub static STYLE_BUTTON_MENU: &str = "button_menu";
pub static STYLE_SEPERATOR: &'static str = "seperator"; pub static STYLE_BUTTON_ACTION: &str = "button_action";
//pub static STYLE_ITEM_BUTTON: &'static str = "item_button"; pub static STYLE_CONTAINER_ACTION: &str = "container_action";
pub static STYLE_MENU: &'static str = "menu"; pub static STYLE_CONTAINER_MAIL: &str = "container_mail";
pub static STYLE_BUTTON_MENU: &'static str = "button_menu"; pub static STYLE_HEADER_BAR: &str = "header_bar";
pub static STYLE_STACK_MENU: &'static str = "stack_menu"; pub static STYLE_HEADER_TEXT: &str = "header_text";
pub static STYLE_SEPARATOR: &str = "separator";
pub static STYLE_MAIL_LABEL: &str = "mail_label";
pub static STYLE_MAIL_TO: &str = "mail_to";
pub static STYLE_MAIL_CC: &str = "mail_cc";
pub static STYLE_MENU: &str = "menu";
pub static STYLE_STACK_ACTION: &str = "stack_action";
pub static STYLE_STACK_MENU: &str = "stack_menu";
// Widget IDs (DCES: Entity[id] => [Component1, .. , Component<n>] -> data or state) // Widget IDs (DCES: Entity[id] => [Component1, .. , Component<n>] -> data or state)
pub static ID_POLICY_CHECK_FORM: &'static str = "policy_check_form"; pub static ID_CONFIGURATION_VIEW: &str = "Configuration";
pub static ID_POLICY_CHECK_FORM_ROW_0: &'static str = "policy_check_form_row_0"; pub static ID_CONFIGURATION_FORM: &str = "configuration_form";
pub static ID_POLICY_CHECK_FORM_ROW_1: &'static str = "policy_check_form_row_1"; pub static ID_CONFIGURATION_HEADER: &str = "configuration_header";
pub static ID_POLICY_CHECK_FORM_ROW_2: &'static str = "policy_check_form_row_2"; pub static ID_CONFIGURATION_LABEL_CONFIG_FILE: &str = "configuration_label_config_file";
pub static ID_POLICY_CHECK_HEADER: &'static str = "policy_check_header"; pub static ID_CONFIGURATION_CONFIG_FILE: &str = "configuration_config_file";
pub static ID_POLICY_CHECK_ITEMS_WIDGET: &'static str = "policy_check_items_widget"; pub static ID_CONFIGURATION_LABEL_LANGUAGE_ID: &str = "configuration_label_language_id";
pub static ID_POLICY_CHECK_BUTTON_RESULT: &'static str = "policy_check_button_result"; pub static ID_CONFIGURATION_LANGUAGE_ID: &str = "configuration_language_id";
pub static ID_POLICY_CHECK_BUTTON_MENU: &'static str = "policy_check_button_menu";
pub static ID_POLICY_CHECK_DATA_COUNT_BLOCK: &'static str = "policy_check_data_count_block";
pub static ID_POLICY_CHECK_HINT: &'static str = "policy_check_hint";
pub static ID_POLICY_CHECK_LABEL_HINT: &'static str = "policy_check_label_hint";
pub static ID_POLICY_CHECK_LABEL_MENU: &'static str = "policy_check_label_menu";
pub static ID_POLICY_CHECK_LABEL_POLICY_NUMBER: &'static str = "policy_check_label_policy_number";
pub static ID_POLICY_CHECK_LABEL_RESULT: &'static str = "policy_check_label_result";
pub static ID_POLICY_CHECK_MENU: &'static str = "policy_check_menu";
pub static ID_POLICY_CHECK_MENU_LABEL_ACCOUNT: &'static str = "policy_check_menu_label_account";
pub static ID_POLICY_CHECK_MENU_LABEL_QUIT: &'static str = "policy_check_menu_label_quit";
pub static ID_POLICY_CHECK_MENU_SHORTCUT_QUIT: &'static str = "policy_check_menu_shortcut_quit";
pub static ID_POLICY_CHECK_MENU_LABEL_TOGGLE_THEME: &'static str = "policy_check_menu_label_toggle_theme";
pub static ID_POLICY_CHECK_POLICY_NUMBER: &'static str = "policy_check_policy_number";
pub static ID_POLICY_CHECK_POPUP_MENU: &'static str = "policy_check_popup_menu";
pub static ID_POLICY_CHECK_POPUP_PROGRESS: &'static str = "policy_check_popup_progress";
pub static ID_POLICY_CHECK_PROGRESS_BAR: &'static str = "policy_check_progress_bar";
pub static ID_POLICY_CHECK_PROGRESS_TIME: &'static str = "policy_check_progress_time";
pub static ID_POLICY_CHECK_PROGRESS_TEXT: &'static str = "policy_check_progress_text";
pub static ID_POLICY_CHECK_RESULT: &'static str = "policy_check_result";
pub static ID_POLICY_CHECK_WIDGET: &'static str = "policy_check_widget";
pub static ID_POLICY_DATA_ADD_BUTTON: &'static str = "policy_data_add_button"; pub static ID_LOCALIZATION_VIEW: &str = "Localization";
pub static ID_POLICY_DATA_COUNT: &'static str = "policy_data_count"; pub static ID_LOCALIZATION_FORM: &str = "localization_form";
pub static ID_POLICY_DATA_LABEL: &'static str = "policy_data_label"; pub static ID_LOCALIZATION_HEADER: &str = "localization_header";
pub static ID_POLICY_DATA_ITEMS_WIDGET: &'static str = "policy_data_items_widget"; pub static ID_LOCALIZATION_LANGUAGES: &str = "localization_languages";
pub static ID_POLICY_DATA_DATE_INSERTED: &'static str = "policy_data_date_inserted"; pub static ID_LOCALIZATION_LABEL_LANGUAGE_NAME: &str = "localization_label_language_name";
pub static ID_POLICY_DATA_DION: &'static str = "policy_data_dion"; pub static ID_LOCALIZATION_LANGUAGE_NAME: &str = "localization_language_name";
pub static ID_POLICY_DATA_POLICY_CODE: &'static str = "policy_data_policy_code";
pub static ID_POLICY_DATA_POLICY_NUMBER: &'static str = "policy_data_policy_number";
pub static ID_POLICY_DATA_STACK: &'static str = "policy_data_stack";
pub static ID_POLICY_DATA_STATUS: &'static str = "policy_data_status";
pub static ID_POLICY_DATA_LIST_NAME: &'static str = "policy_data_list_name";
pub static ID_POLICY_LIST_ADD_BUTTON: &'static str = "policy_list_add_button"; pub static ID_MAIN_GRID: &str = "main_grid";
pub static ID_POLICY_LIST_ITEMS_WIDGET: &'static str = "policy_list_items_widget"; pub static ID_MAIN_TABWIDGET: &str = "main_tabwidget";
pub static ID_POLICY_LIST_TEXT_BOX: &'static str = "policy_list_text_box"; pub static ID_MAIN_BUTTON_MENU: &str = "main_button_menu";
// Component Values (Properties) pub static ID_MENU_VIEW: &str = "menu_view";
pub static PROP_ADVOTRACKER: &'static str = "advotracker"; pub static ID_MENU_POPUP: &str = "menu_popup";
pub static PROP_POLICY_CHECK: &'static str = "policy_check"; pub static ID_MENU_STACK: &str = "menu_stack";
pub static PROP_POLICY_PROGRESS_COUNT: &'static str = "policy_progress_count"; pub static ID_MENU_BOTTOM_BAR: &str = "menu_bottom_bar";
pub static ID_MENU_BUTTON: &str = "menu_button";
pub static ID_MENU_BUTTON_MENU: &str = "menu_button_menu";
pub static ID_MENU_GRID: &str = "menu_grid";
pub static ID_MENU_HEADER: &str = "menu_header";
pub static ID_MENU_HEADER_BAR: &str = "menu_header_bar";
pub static ID_MENU_LABEL_ACCOUNT: &str = "menu_label_account";
pub static ID_MENU_LABEL_QUIT: &str = "menu_label_quit";
pub static ID_MENU_LABEL_TOGGLE_THEME: &str = "menu_label_toggle_theme";
pub static ID_MENU_SHORTCUT_QUIT: &str = "menu_shortcut_quit";
pub static ID_MENU_TOGGLE_THEME: &str = "menu_toggle_theme";
pub static PROP_POLICY_DATA_LIST: &'static str = "policy_data_list"; pub static ID_POLICY_CHECK_VIEW: &str = "policy_check_view";
pub static PROP_POLICY_DATA_COUNT: &'static str = "policy_data_count"; 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_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";
pub static ID_POLICY_CHECK_DATA_COUNT_BLOCK: &str = "policy_check_data_count_block";
pub static ID_POLICY_CHECK_FORM: &str = "policy_check_form";
pub static ID_POLICY_CHECK_HEADER: &str = "policy_check_header";
pub static ID_POLICY_CHECK_HEADER_BAR: &str = "policy_check_header_bar";
pub static ID_POLICY_CHECK_HINT: &str = "policy_check_hint";
pub static ID_POLICY_CHECK_ITEMS_WIDGET: &str = "policy_check_items_widget";
pub static ID_POLICY_CHECK_LABEL_HINT: &str = "policy_check_label_hint";
pub static ID_POLICY_CHECK_LABEL_MENU: &str = "policy_check_label_menu";
pub static ID_POLICY_CHECK_LABEL_POLICY_NUMBER: &str = "policy_check_label_policy_number";
pub static ID_POLICY_CHECK_LABEL_RESULT: &str = "policy_check_label_result";
pub static ID_POLICY_CHECK_POLICY_CODE: &str = "policy_check_policy_code";
pub static ID_POLICY_CHECK_POLICY_NUMBER: &str = "policy_number";
pub static ID_POLICY_CHECK_POPUP_PROGRESS: &str = "policy_check_popup_progress";
pub static ID_POLICY_CHECK_PROGRESS_BAR: &str = "policy_check_progress_bar";
pub static ID_POLICY_CHECK_PROGRESS_TIME: &str = "policy_check_progress_time";
pub static ID_POLICY_CHECK_PROGRESS_TEXT: &str = "policy_check_progress_text";
pub static ID_POLICY_CHECK_RESULT: &str = "policy_check_result";
pub static ID_POLICY_CHECK_WIDGET: &str = "policy_check_widget";
pub static PROP_POLICY_LIST: &'static str = "policy_list"; pub static ID_POLICY_DATA_ADD_BUTTON: &str = "policy_data_add_button";
pub static PROP_POLICY_LIST_COUNT: &'static str = "policy_list_count"; pub static ID_POLICY_DATA_COUNT: &str = "policy_data_count";
pub static ID_POLICY_DATA_LABEL: &str = "policy_data_label";
pub static ID_POLICY_DATA_ITEMS_WIDGET: &str = "policy_data_items_widget";
pub static ID_POLICY_DATA_DATE_INSERTED: &str = "policy_data_date_inserted";
pub static ID_POLICY_DATA_DION: &str = "policy_data_dion";
pub static ID_POLICY_DATA_POLICY_CODE: &str = "policy_data_policy_code";
pub static ID_POLICY_DATA_POLICY_NUMBER: &str = "policy_data_policy_number";
pub static ID_POLICY_DATA_STACK: &str = "policy_data_stack";
pub static ID_POLICY_DATA_STATUS: &str = "policy_data_status";
pub static ID_POLICY_DATA_LIST_NAME: &str = "policy_data_list_name";
pub static ID_POLICY_LIST_ADD_BUTTON: &str = "policy_list_add_button";
pub static ID_POLICY_LIST_ITEMS_WIDGET: &str = "policy_list_items_widget";
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_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_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_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";
pub static ID_TICKET_DATA_HEADER_BAR: &str = "ticket_data_header_bar";
pub static ID_TICKET_DATA_HEADER: &str = "ticket_data_header";
pub static ID_TICKET_DATA_HINT: &str = "ticket_data_hint";
pub static ID_TICKET_DATA_ITEMS_WIDGET: &str = "ticket_data_items_widget";
pub static ID_TICKET_DATA_IVR_COMMENT: &str = "ticket_data_ivr_comment";
pub static ID_TICKET_DATA_LABEL_CALLBACK_DATE: &str = "ticket_data_label_callback_data";
pub static ID_TICKET_DATA_LABEL_CALLBACK_NUMBER: &str = "ticket_data_label_callback_number";
pub static ID_TICKET_DATA_LABEL_DEDUCTIBLE: &str = "ticket_data_label_deductible";
pub static ID_TICKET_DATA_LABEL_HARM_TYPE: &str = "ticket_data_label_harm_type";
pub static ID_TICKET_DATA_LABEL_HINT: &str = "ticket_data_label_hint";
pub static ID_TICKET_DATA_LABEL_IVR_COMMENT: &str = "ticket_data_label_ivr_comment";
pub static ID_TICKET_DATA_LABEL_MAIL_CC: &str = "ticket_data_label_mail_cc";
pub static ID_TICKET_DATA_LABEL_MAIL_TO: &str = "ticket_data_label_mail_to";
pub static ID_TICKET_DATA_LABEL_MENU: &str = "ticket_data_label_menu";
pub static ID_TICKET_DATA_LABEL_POLICY_CODE: &str = "ticket_data_label_policy_code";
pub static ID_TICKET_DATA_LABEL_POLICY_HOLDER: &str = "ticket_data_label_policy_holder";
pub static ID_TICKET_DATA_LOGO_BAR: &str = "ticket_data_logo_bar";
pub static ID_TICKET_DATA_MAIL_CC: &str = "ticket_data_mail_cc";
pub static ID_TICKET_DATA_MAIL_TO: &str = "ticket_data_mail_to";
pub static ID_TICKET_DATA_POLICY_CODE: &str = "ticket_data_policy_code";
pub static ID_TICKET_DATA_POLICY_HOLDER: &str = "ticket_data_policy_holder";
pub static ID_TICKET_DATA_RESULT: &str = "ticket_data_result";
pub static ID_TICKET_DATA_VIEW: &str = "ticket_data_view";
pub static ID_TICKET_DATA_WIDGET: &str = "ticket_data_widget";

View File

@@ -110,6 +110,39 @@ pub struct CsvExportRecord {
pub ivr_comment: String, pub ivr_comment: String,
} }
/// Handel fields of an Email (header, body)
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
pub struct Email {
/// Recipient address
pub mail_to: String,
/// Carbon Copy recipient address
pub mail_cc: String,
/// Blind Carbon Copy recipient address
pub mail_bcc: String,
/// Sender address
pub mail_from: String,
/// Replay to given address
pub mail_reply: String,
/// Mail subject
pub subject: String,
/// Body policy code
pub policy_code: String,
/// Body type policy holder
pub policy_holder: String,
/// Body type deductible
pub deductible: String,
/// Body callback number
pub callback_number: String,
/// Body type callback date
pub callback_date: String,
/// Body type harm type
pub harm_type: String,
/// Body type ivr comment
pub ivr_comment: String
}
impl Email {}
/// Harm data are list/collections of harm types. You may toggle them to an unselected state. /// Harm data are list/collections of harm types. You may toggle them to an unselected state.
#[derive(Default, Debug, Clone, Deserialize, Serialize)] #[derive(Default, Debug, Clone, Deserialize, Serialize)]
pub struct HarmData { pub struct HarmData {
@@ -157,20 +190,6 @@ pub struct PolicyCheck {
impl PolicyCheck {} impl PolicyCheck {}
// #[derive(Default, Clone, Debug, Serialize, Deserialize)]
// pub struct PolicyCheckList {
// pub title: String,
// pub list: Vec<PolicyCheck>
// }
// impl PolicyCheckList {
// pub fn new(title: impl Into<String>) -> Self {
// PolicyCheckList {
// title: title.into(),
// ..Default::default()
// }
// }
/// Structure collecting policy data elements /// Structure collecting policy data elements
#[derive(Default, Clone, Debug, Serialize, Deserialize)] #[derive(Default, Clone, Debug, Serialize, Deserialize)]
pub struct PolicyList { pub struct PolicyList {
@@ -241,7 +260,7 @@ pub struct PolicyDataList {
/// implements the helper methods, to manage policy data collections. /// implements the helper methods, to manage policy data collections.
impl PolicyDataList { impl PolicyDataList {
/// Prüfung ob Versicherungselemente . /// Prüfung auf Versicherungselemente
pub fn is_empty(&self) -> bool { pub fn is_empty(&self) -> bool {
self.policy_data.is_empty() self.policy_data.is_empty()
} }

View File

@@ -26,13 +26,10 @@
// /// The client specific services // /// The client specific services
// pub mod clients; // pub mod clients;
/// provides helper functions to manage orbtk callbacks
pub mod callbacks;
/// provides data definitions /// provides data definitions
pub mod data; pub mod data;
/// provides orbtk widget structures /// provides orbtk widgets (handling views and states)
pub mod widgets; pub mod widgets;
/// provides services /// provides services

View File

@@ -225,6 +225,16 @@
"de_DE": "Die Nummer ist zu kurz", "de_DE": "Die Nummer ist zu kurz",
"C": "Policy number is to short" "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": { "state.started": {
"de_DE.UTF-8": "gestartet", "de_DE.UTF-8": "gestartet",
"de_DE": "gestartet", "de_DE": "gestartet",

View File

@@ -14,18 +14,24 @@
//use chrono::{Local, DateTime}; //use chrono::{Local, DateTime};
use dotenv::dotenv; use dotenv::dotenv;
use locales::t; use locales::t;
use cfg_if::cfg_if;
use serde::Deserialize; use serde::Deserialize;
use std::env; use std::env;
//use std::process; //use std::process;
use substring::Substring;
use tracing::{info, trace, Level}; use tracing::{info, trace, Level};
use orbtk::prelude::*; use orbtk::{
prelude::*,
theme_default::{THEME_DEFAULT, THEME_DEFAULT_COLORS_DARK, THEME_DEFAULT_FONTS},
theming::config::ThemeConfig,
};
#[cfg(target_os = "windows")]
use orbtk::theme_fluent::{THEME_FLUENT, THEME_FLUENT_COLORS_DARK, THEME_FLUENT_FONTS};
// The Main view // The Main view
use advotracker::{ use advotracker::widgets::main_view;
callbacks::policycheck_state::PolicyCheckState,
widgets::main_view,
};
mod parse_args; mod parse_args;
@@ -39,13 +45,24 @@ struct Environment {
rust_log: String, rust_log: String,
} }
// Style extension
static DEFAULT_DARK_EXT: &str = include_str!("../assets/advotracker/default_dark.ron");
cfg_if! {
if #[cfg(windows)] {
static FLUENT_DARK_EXT: &str = include_str!("../assets/advotracker/fluent_dark.ron");
static FLUENT_LIGHT_EXT: &str = include_str!("../assets/advotracker/fluent_light.ron");
}
}
// German localization file. // German localization file.
static ADVOTRACKER_DE_DE: &str = include_str!("../resources/advotracker/advotracker_de_DE.ron"); static ADVOTRACKER_DE_DE: &str = include_str!("../assets/advotracker/advotracker_de_DE.ron");
/// Get the active language environment. /// Get the active language environment.
fn get_lang() -> String { fn get_lang() -> String {
// get system environment // get system environment
let mut lang = env::var("LANG").unwrap_or("C".to_string()); let mut lang = env::var("LANG").unwrap_or_else(|_| "C".to_string());
lang = lang.substring(0,5).to_string(); // "de_DE.UTF-8" -> "de_DE"
info!("GUI-Language: preset to {:?}", lang);
// testing environment: read from .env file // testing environment: read from .env file
dotenv().ok(); dotenv().ok();
@@ -56,9 +73,48 @@ fn get_lang() -> String {
Err(e) => { info!(target: "advotracker", "{}", e) } Err(e) => { info!(target: "advotracker", "{}", e) }
} }
trace!(target: "advotracker", lang = ?lang); trace!(target: "advotracker", lang = ?lang);
// return the active language
lang lang
} }
cfg_if! {
if #[cfg(windows)] {
/// Extend and register theme assets.
fn theme() -> Theme {
register_default_fonts(Theme::from_config(
ThemeConfig::from(DEFAULT_DARK_EXT)
.extend(ThemeConfig::from(THEME_DEFAULT))
.extend(ThemeConfig::from(THEME_DEFAULT_COLORS_DARK))
.extend(ThemeConfig::from(THEME_DEFAULT_FONTS)),
))
}
fn theme_fluent() -> Theme {
register_fluent_fonts(Theme::from_config(
ThemeConfig::from(FLUENT_DARK_EXT)
.extend(ThemeConfig::from(THEME_FLUENT))
.extend(ThemeConfig::from(THEME_FLUENT_COLORS_DARK))
.extend(ThemeConfig::from(THEME_FLUENT_FONTS)),
))
// register_fluent_fonts(Theme::from_config(
// ThemeConfig::from(FLUENT_LIGHT_EXT)
// .extend(ThemeConfig::from(THEME_FLUENT))
// .extend(ThemeConfig::from(THEME_FLUENT_COLORS_DARK))
// .extend(ThemeConfig::from(THEME_FLUENT_FONTS)),
}
} else {
/// Extend and register theme assets.
fn theme() -> Theme {
register_default_fonts(Theme::from_config(
ThemeConfig::from(DEFAULT_DARK_EXT)
.extend(ThemeConfig::from(THEME_DEFAULT))
.extend(ThemeConfig::from(THEME_DEFAULT_COLORS_DARK))
.extend(ThemeConfig::from(THEME_DEFAULT_FONTS)),
))
}
}
}
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
use parse_args::parse_args; use parse_args::parse_args;
use tracing_subscriber::fmt; use tracing_subscriber::fmt;
@@ -92,7 +148,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut state = t!("state.started", lang); let mut state = t!("state.started", lang);
let mut res = t!("parse.environment", lang); let mut res = t!("parse.environment", lang);
trace!(target: "advotracker", message = ?res, state = ?state); trace!(target: "advotracker", process = ?res, state = ?state);
trace!(target: "advotracker", environment = "system", lang = ?lang); trace!(target: "advotracker", environment = "system", lang = ?lang);
trace!(target: "advotracker", machine = ?&machine_kind); trace!(target: "advotracker", machine = ?&machine_kind);
@@ -100,7 +156,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
res = t!("parse.environment", lang); res = t!("parse.environment", lang);
trace!(target: "advotracker", environment = "envy", lang = ?lang); trace!(target: "advotracker", environment = "envy", lang = ?lang);
state = t!("state.finished", lang); state = t!("state.finished", lang);
trace!(target: "advotracker", message = ?res, state = ?state); trace!(target: "advotracker", process = ?res, state = ?state);
// initialize viperus structure // initialize viperus structure
let mut viperus = Viperus::new(); let mut viperus = Viperus::new();
@@ -114,6 +170,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
state = t!("state.finished", lang); state = t!("state.finished", lang);
trace!(target: "advotracker", process = ?res, state = ?state); trace!(target: "advotracker", process = ?res, state = ?state);
// type conversion (viperus String -> u64)
let test_policy_number = viperus.get::<String>("test_policy_number").unwrap().parse::<u64>().unwrap();
trace!(target: "advotracker", test_policy_number = ?test_policy_number);
// main tasks // main tasks
res = t!("main.started", lang); res = t!("main.started", lang);
state = t!("state.started", lang); state = t!("state.started", lang);
@@ -122,22 +182,26 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// use this only if you want to run it as web application. // use this only if you want to run it as web application.
orbtk::initialize(); orbtk::initialize();
// if no dictionary is set for the default language e.g. english the content of the text property will drawn. // 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() let localization = RonLocalization::create()
.language("en_US") .language(&lang)
.dictionary("de_DE", ADVOTRACKER_DE_DE) .dictionary("de_DE", ADVOTRACKER_DE_DE)
.build(); .build();
Application::from_name("nwx.advotracker") Application::from_name("nwx.advotracker")
.theme(PolicyCheckState::theme())
.localization(localization) .localization(localization)
.theme(theme())
.window(|ctx| { .window(|ctx| {
Window::new() Window::new()
.title("AdvoTracker - DirectCall") .title("AdvoTracker - DirectCall")
.position((500.0, 100.0)) .position((500.0, 100.0))
.size(580.0, 320.0) .size(800.0, 600.0)
//.min_width(460.0) //.min_width(460.0)
//.min_height(180.0) //.min_height(380.0)
.resizeable(true) .resizeable(true)
.child(main_view::MainView::new().build(ctx)) .child(main_view::MainView::new().build(ctx))
.build(ctx) .build(ctx)

View File

@@ -30,7 +30,7 @@ pub fn parse_args(viperus: &mut Viperus) -> Result<(), Box<dyn std::error::Error
viperus.add_default("config_file", String::from("csv_import.ron")); viperus.add_default("config_file", String::from("csv_import.ron"));
viperus.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt")); viperus.add_default("import_file", String::from("POLLFNR_WOECHENTLICH.txt"));
viperus.add_default("export_file", String::from("")); viperus.add_default("export_file", String::from(""));
viperus.add_default("test_policy_number", 123456789); viperus.add_default("test_policy_number", String::from("9999999992"));
viperus.add_default("to_email_address_file", String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>")); viperus.add_default("to_email_address_file", String::from("Allianz RA-Hotline <smr-rahotline@allianz.de>"));
viperus.add_default("from_email_address_file", String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>")); viperus.add_default("from_email_address_file", String::from("Allianz-Hotline RA-Hiedemann <azhotline@hiedemann.de>"));
//viperus.add_default("username", String::from("nctalkbot")); //viperus.add_default("username", String::from("nctalkbot"));
@@ -139,7 +139,7 @@ SMR Unerledigt: 089 92529 60222")
// preset the prefix for relevant environment variables ("ADVOTRACKER_") // preset the prefix for relevant environment variables ("ADVOTRACKER_")
let mut env_prefix: String = crate_name!().to_uppercase(); let mut env_prefix: String = crate_name!().to_uppercase();
env_prefix.push_str("_"); env_prefix.push('_');
viperus.set_env_prefix(&env_prefix); viperus.set_env_prefix(&env_prefix);
// enable caching and automatic update of environment values // enable caching and automatic update of environment values

View File

@@ -8,16 +8,12 @@
//use chrono::{Local, DateTime}; //use chrono::{Local, DateTime};
use locales::t; use locales::t;
use std::error::Error; use std::error::Error;
//use std::collections::HashMap;
use tracing::trace; use tracing::trace;
//use crate::db::redis;
//use crate::data::structures::{PolicyCode, PolicyDataList, PolicyData};
/// export as csv format /// export as csv format
/// https://docs.rs/csv/1.1.3/csv/cookbook/index.html /// https://docs.rs/csv/1.1.3/csv/cookbook/index.html
/// https://blog.burntsushi.net/csv/ /// https://blog.burntsushi.net/csv/
pub fn export(p: &mut String, lang: &String) -> Result<(), Box<dyn Error>> { pub fn export(p: &mut String, lang: &str) -> Result<(), Box<dyn Error>> {
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;
//use std::ffi::OsStr; //use std::ffi::OsStr;

View File

@@ -5,5 +5,8 @@
* SPDX-License-Identifier: (0BSD or MIT) * SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// Send ticketdata via email
pub mod send_ticketdata;
/// Exporting Allianz DirecCall data /// Exporting Allianz DirecCall data
pub mod allianzdirectcall; pub mod allianzdirectcall;

View File

@@ -0,0 +1,122 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use lettre::{
message::{header, MultiPart, SinglePart},
Message, SmtpTransport, Transport,
transport::smtp::authentication::Credentials,
};
use locales::t;
use maud::html;
use std::error::Error;
//use std::process;
use tracing::{info, error, trace};
use crate::data::structures::Email;
/// send ticket data via eMail
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.
// It uses https://crates.io/crates/maud
let html = html! {
head {
title { (email.subject) " (" (email.policy_code) ")" }
style type="text/css" {
"h2, h4 { font-family: Arial, Helvetica, sans-serif; }"
}
}
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 { "Rückrufnummer: " (email.callback_number) }
p { "Erreichbarkeit: " (email.callback_date) }
p { "Rechtsproblem: "(email.harm_type) }
p { "Rechtsrat: "(email.ivr_comment) }
}
};
let ascii_body = String::new()
+ &"Vers.-Schein/Schadennummer".to_string() + &(email.policy_code) + &"\n"
+ &"Versicherungsnehmer: ".to_string() + &(email.policy_holder) + &"\n"
+ &"Selbstbehalt: ".to_string() + &(email.deductible) + &"\n"
+ &"Rückrufnummer: ".to_string()+ &(email.callback_number) + &"\n"
+ &"Erreichbarkeit: ".to_string() + &(email.callback_date) + &"\n"
+ &"Rechtsproblem: ".to_string() + &(email.harm_type) + &"\n"
+ &"Rechtsrat: ".to_string() + &(email.ivr_comment) + &"\n";
info!("email body: {:?}", ascii_body);
let message = Message::builder()
//.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())
//.bcc((email.mail_bcc).parse().unwrap())
.from((email.mail_from).parse().unwrap())
.subject(String::new()
+ &email.subject.to_string()
+ &" (".to_string()
+ &email.policy_code.to_string()
+ &")".to_string()
)
.multipart(
MultiPart::alternative() // This is composed of two parts.
.singlepart(
SinglePart::builder()
.header(header::ContentType(
"text/plain; charset=utf8".parse().unwrap(),
))
.body(String::from(ascii_body)),
)
.singlepart(
SinglePart::builder()
.header(header::ContentType(
"text/html; charset=utf8".parse().unwrap(),
))
.body(html.into_string()),
),
)
.expect("failed to build email");
info!("message: {:?}", message);
// Create credential for remote authentication (username, password)
// WIP: get credentials from config file / cli
let creds = Credentials::new("info@kanzlei.hiedemann.de".to_string(), "17info67$".to_string());
// Open a remote connection to relay server (port 2525)
// WIP: get relay address from config file / cli
let mailer = SmtpTransport::relay("hiedemannsbs.kanzlei.hiedemann.de")
.unwrap()
.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);
state = t!("state.finished", lang);
res = t!("sendticketdata.export.finished", lang);
trace!(target: "sendticketdata", process = ?res, state = ?state);
Ok(())
}

View File

@@ -23,7 +23,7 @@ use crate::data::structures::{PolicyCode, PolicyDataList, PolicyData};
pub fn import(p: &mut String, data_list: &mut PolicyDataList, pub fn import(p: &mut String, data_list: &mut PolicyDataList,
policy_numbers: &mut HashMap<u64, PolicyCode>, policy_numbers: &mut HashMap<u64, PolicyCode>,
policy_data_count: &mut u64, policy_data_count: &mut u64,
lang: &String) lang: &str)
-> Result<(u64, Duration), Box<dyn Error>> { -> Result<(u64, Duration), Box<dyn Error>> {
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;

View File

@@ -24,7 +24,7 @@ fn import() -> Result<(), Box<dyn Error>> {
fn main() { fn main() {
if let Err(err) = import() { if let Err(err) = import() {
println!("error running example: {}", err); println!("import error: {}", err);
process::exit(1); process::exit(1);
} }
} }

View File

@@ -0,0 +1,79 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use serde::{Deserialize, Serialize};
use crate::widgets::configuration::configuration_view::ConfigurationView;
/// Valid `actions` that are handled as state changes in the `Configuration` widget.
#[derive(Clone, Debug)]
pub enum ConfigurationAction {
SaveConfiguration,
LoadConfiguration,
}
/// Define valid configuration data.
/// This structure is serialized and saved inside the OS dependent settings file.
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
struct ConfigurationData(
pub String,
pub String
);
/// Valid `structures` that are handled inside the state of the `Configuration` widget.
#[derive(Debug, Default, AsAny)]
pub struct ConfigurationState {}
impl State for ConfigurationState {
fn messages(
&mut self,
mut messages: MessageReader,
registry: &mut Registry,
ctx: &mut Context<'_>,
) {
for message in messages.read::<ConfigurationAction>() {
match message {
ConfigurationAction::LoadConfiguration => {
registry
.get::<Settings>("settings")
.load_async::<ConfigurationData>(
"configuration_data".to_string(), ctx.entity()
);
}
ConfigurationAction::SaveConfiguration => {
let configuration_file: String = ConfigurationView::configuration_file_clone(&ctx.widget());
let language_id: String = ConfigurationView::language_id_clone(&ctx.widget());
registry
.get::<Settings>("settings")
.save_async(
"configuration_data".to_string(),
ConfigurationData(
configuration_file,
language_id
),
ctx.entity(),
);
}
}
}
// save the result
for message in messages.read::<SettingsResult<()>>() {
println!("Result {:?}", message);
}
// load result
for message in messages.read::<SettingsResult<ConfigurationData>>() {
if let Ok(data) = message {
ConfigurationView::configuration_file_set(&mut ctx.widget(), data.0);
ConfigurationView::language_id_set(&mut ctx.widget(), data.1);
}
}
}
}

View File

@@ -0,0 +1,139 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::{
data::constants::*,
widgets::configuration::configuration_state::{ConfigurationAction, ConfigurationState},
};
// Macro that initializes the widget structures/variables for our view
widget!(
ConfigurationView<ConfigurationState> {
configuration_file: String,
language_id: String
}
);
/// The template implementation of the configuration view
/// All GUI elements are styled using the "style" attribute referencing to a ron based css
impl Template for ConfigurationView {
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
self.child(
Grid::new()
.id(ID_CONFIGURATION_FORM)
.style("configuration_form")
.columns(
Columns::create()
.push(120)
.push(12)
.push("auto")
)
.rows(Rows::create()
.push("auto") // Header_Bar
.push(4) // Seperator
.push("auto") // Configuartion_File
.push(4) // Seperator
.push("auto") // Language_ID
.push(12) // Seperator
.push("auto"), // Action
)
.child(
TextBlock::new()
.id(ID_CONFIGURATION_HEADER)
.h_align("start")
.attach(Grid::column(0))
.attach(Grid::row(0))
.attach(Grid::column_span(3))
.text("Configuration settings")
.style("header")
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_CONFIGURATION_LABEL_CONFIG_FILE)
.attach(Grid::column(0))
.attach(Grid::row(2))
.v_align("center")
.h_align("end")
.text("Configuration file")
.build(ctx),
)
.child(
TextBox::new()
.id(ID_CONFIGURATION_CONFIG_FILE)
.attach(Grid::column(2))
.attach(Grid::row(2))
.text(("configuration_file", id))
.water_mark("Filename...")
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_CONFIGURATION_LABEL_LANGUAGE_ID)
.attach(Grid::column(0))
.attach(Grid::row(4))
.v_align("center")
.h_align("end")
.text("Language Id")
.build(ctx),
)
.child(
TextBox::new()
.id(ID_CONFIGURATION_LANGUAGE_ID)
.attach(Grid::column(2))
.attach(Grid::row(4))
.text(("language_id", id))
.water_mark("Locale Identifier...")
.build(ctx),
)
.child(
Grid::new()
.h_align("center")
.attach(Grid::column(0))
.attach(Grid::row(6))
.attach(Grid::column_span(3))
.columns(
Columns::create()
.push("auto")
.push(8)
.push("auto")
)
.rows(Rows::create()
.push("auto")
)
.child(
Button::new()
.style("button_single_content")
.attach(Grid::column(0))
.attach(Grid::row(0))
.text("Load")
.on_click(move |ctx, _| {
ctx.send_message(ConfigurationAction::LoadConfiguration, id);
true
})
.build(ctx),
)
.child(
Button::new()
.text("Save")
.style("button_single_content")
.attach(Grid::column(2))
.attach(Grid::row(0))
.on_click(move |ctx, _| {
ctx.send_message(ConfigurationAction::SaveConfiguration, id);
true
})
.build(ctx),
)
.build(ctx),
)
.build(ctx),
)
}
}

View File

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

View File

@@ -8,6 +8,7 @@
use dotenv::dotenv; use dotenv::dotenv;
use serde::Deserialize; use serde::Deserialize;
use std::env; use std::env;
use substring::Substring;
use tracing::{info, trace}; use tracing::{info, trace};
use orbtk::prelude::*; use orbtk::prelude::*;
@@ -28,10 +29,11 @@ struct Environment {
/// Provides generic methods to handle states of datatypes. /// Provides generic methods to handle states of datatypes.
pub trait GlobalState { pub trait GlobalState {
/// Get the active language environment.
fn get_lang() -> String { fn get_lang() -> String {
// get system environment // get system environment
let mut lang = env::var("LANG").unwrap_or("C".to_string()); let mut lang = env::var("LANG").unwrap_or_else(|_| "C".to_string());
lang = lang.substring(0,5).to_string(); // "de_DE.UTF-8" -> "de_DE"
info!("GUI-Language: preset to {:?}", lang);
// testing environment: read from .env file // testing environment: read from .env file
dotenv().ok(); dotenv().ok();
@@ -42,17 +44,28 @@ pub trait GlobalState {
Err(e) => { info!(target: "advotracker", "{}", e) } Err(e) => { info!(target: "advotracker", "{}", e) }
} }
trace!(target: "advotracker", lang = ?lang); trace!(target: "advotracker", lang = ?lang);
// return the active language
lang lang
} }
/// Get the text of a widget.
fn get_text(&self, ctx: &mut Context<'_>, entity: Entity) -> Option<String> {
let text = TextBox::text_clone(&ctx.get_widget(entity));
if text.is_empty() {
return None;
}
TextBox::text_set(&mut ctx.get_widget(entity), String::default());
Some(text)
}
// /// Navigates to the given entity. // /// Navigates to the given entity.
// fn navigate(&self, to: Entity, ctx: &mut Context<'_>) { // fn navigate(&self, to: Entity, ctx: &mut Context<'_>) {
// if let Some(old_focused_element) = ctx.window().get::<Global>("global").focused_widget { // if let Some(old_focused_element) = *Window::focus_state_ref(&ctx.window()).focused_entity() {
// let mut old_focused_element = ctx.get_widget(old_focused_element); // ctx.push_event_by_window(FocusEvent::RemoveFocus(old_focused_element));
// old_focused_element.set("focused", false);
// //old_focused_element.update_theme_by_state(false);
// } // }
// ctx.window().get_mut::<Global>("global").focused_widget = None;
// ctx.widget().set("visibility", Visibility::Collapsed); // ctx.widget().set("visibility", Visibility::Collapsed);
// ctx.get_widget(to).set("visibility", Visibility::Visible); // ctx.get_widget(to).set("visibility", Visibility::Visible);
// } // }
@@ -62,7 +75,6 @@ pub trait GlobalState {
/// in users 'settings directory'. The directory location is OS dependant /// in users 'settings directory'. The directory location is OS dependant
/// (Windows: AppData, Unix: XDG_CONFIG_HOME, MacOS: $HOME/Library/Preferences). /// (Windows: AppData, Unix: XDG_CONFIG_HOME, MacOS: $HOME/Library/Preferences).
/// The data is stored in filename PROP_ADVOTRACKER (here: `advotracker.ron`) /// The data is stored in filename PROP_ADVOTRACKER (here: `advotracker.ron`)
fn save(&self, registry: &mut Registry, ctx: &mut Context<'_>) { fn save(&self, registry: &mut Registry, ctx: &mut Context<'_>) {
registry registry
.get::<Settings>("settings") .get::<Settings>("settings")

View File

@@ -0,0 +1,40 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::widgets::localization::localization_view::LocalizationView;
#[derive(AsAny, Debug, Default)]
pub struct LocalizationState {
change_language: bool,
}
impl LocalizationState {
pub fn change_language(&mut self) {
self.change_language = true;
}
}
impl State for LocalizationState {
fn update(&mut self, _registry: &mut Registry, ctx: &mut Context<'_>) {
if !self.change_language {
return;
}
let index = *LocalizationView::selected_index_ref(&ctx.widget()) as usize;
let selected_language = LocalizationView::languages_ref(&ctx.widget())[index].clone();
match selected_language.as_str() {
"English" => ctx.set_language("en_US"),
"German" => ctx.set_language("de_DE"),
_ => {}
}
self.change_language = false;
}
}

View File

@@ -0,0 +1,97 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::{
data::constants::*,
widgets::localization::localization_state::LocalizationState,
};
type List = Vec<String>;
// Macro that initializes the widget structures/variables for our view
widget!(LocalizationView<LocalizationState> {
languages: List,
selected_index: i32 }
);
/// The template implementation of the localization view
/// All GUI elements are styled using the "style" attribute referencing to a ron based css
impl Template for LocalizationView {
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let languages = vec!["English".to_string(), "German".to_string()];
let count = languages.len();
self.languages(languages)
.selected_index(1)
.child(
Grid::new()
.id(ID_LOCALIZATION_FORM)
.margin(4)
.columns(
Columns::create()
.push(120)
.push(12)
.push(150)
)
.rows(Rows::create()
.push("auto")
.push(4)
.push("auto")
.push(4)
.push("auto")
.push(12)
.push("auto"),
)
.child(
TextBlock::new()
.id(ID_LOCALIZATION_HEADER)
.h_align("start")
.attach(Grid::column(0))
.attach(Grid::row(0))
.attach(Grid::column_span(3))
.text("Localization dialog")
.style("header")
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_LOCALIZATION_LABEL_LANGUAGE_NAME)
.attach(Grid::column(0))
.attach(Grid::row(2))
.v_align("center")
.h_align("end")
.text("Language ID")
.build(ctx),
)
.child(
ComboBox::new()
.id(ID_LOCALIZATION_LANGUAGES)
.count(count)
.attach(Grid::column(2))
.attach(Grid::row(2))
.items_builder(move |bc, index| {
let text = bc.get_widget(id)
.get::<Vec<String>>("languages")[index]
.clone();
TextBlock::new()
.id(ID_LOCALIZATION_LANGUAGE_NAME)
.v_align("center")
.text(text)
.build(bc)
})
.on_changed("selected_index", move |states, _| {
states.get_mut::<LocalizationState>(id).change_language();
})
.selected_index(id)
.build(ctx),
)
.build(ctx),
)
}
}

View File

@@ -0,0 +1,12 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
/// The localization state
pub mod localization_state;
/// The localizatin view
pub mod localization_view;

View File

@@ -8,12 +8,17 @@
use orbtk::prelude::*; use orbtk::prelude::*;
use crate::{ use crate::{
data::structures::PolicyCheck, data::{
widgets::policycheck_view::PolicyCheckView, constants::*,
structures::PolicyCheck,
},
widgets::configuration::configuration_view::ConfigurationView,
widgets::policycheck::policycheck_view::PolicycheckView,
widgets::localization::localization_view::LocalizationView,
//widgets::menu::menu_view::MenuView,
widgets::ticketdata::ticketdata_view::TicketdataView,
}; };
type List = Vec<String>;
// [START] views // [START] views
widget!(MainView { widget!(MainView {
@@ -22,13 +27,18 @@ widget!(MainView {
// policylist_view: u32, // policylist_view: u32,
// policydata_view: u32, // policydata_view: u32,
policycheck_view: PolicyCheck policycheck_view: PolicyCheck
//ticketdata_view: TicketData
}); });
impl Template for MainView { impl Template for MainView {
fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self { fn template(self, _id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let policycheck_view = PolicyCheckView::new() let ticketdata_view = TicketdataView::new()
//.policy_number_count(0) .build(ctx);
//.policylist_view(id)
let policycheck_view = PolicycheckView::new()
.target(ticketdata_view.0)
//.policy_number_count(0)
//.policylist_view(id)
.build(ctx); .build(ctx);
// let policylist_view = PolicyListView::new() // let policylist_view = PolicyListView::new()
@@ -45,7 +55,7 @@ impl Template for MainView {
// .build(ctx); // .build(ctx);
self.name("MainView") self.name("MainView")
.policycheck_view(PolicyCheck::default()) //.policycheck_view(PolicyCheck::default())
// //.policycheck_view(0) // //.policycheck_view(0)
// .policydata_view(policydata_view.0) // .policydata_view(policydata_view.0)
// //.policylist_view(PolicyList::default()) // //.policylist_view(PolicyList::default())
@@ -54,81 +64,13 @@ impl Template for MainView {
// .child(policylist_view) // .child(policylist_view)
.child( .child(
TabWidget::new() TabWidget::new()
.tab("Policynumber check", policycheck_view) .tab(ID_POLICY_CHECK_VIEW, policycheck_view)
.tab("Localization", LocalizationView::new().build(ctx)) .tab(ID_TICKET_DATA_VIEW, ticketdata_view)
.tab(ID_LOCALIZATION_VIEW, LocalizationView::new().build(ctx))
.tab(ID_CONFIGURATION_VIEW, ConfigurationView::new().build(ctx))
//.tab(ID_MENU_VIEW, MenuView::new().build(ctx))
.build(ctx), .build(ctx),
) )
//.child(policycheck_view) //.child(policycheck_view)
} }
} }
widget!(LocalizationView<LocalizationState> { languages: List, selected_index: i32 });
impl Template for LocalizationView {
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let languages = vec!["English".to_string(), "German".to_string()];
let count = languages.len();
self.languages(languages).selected_index(1).child(
Stack::new()
.width(120)
.margin(16)
.spacing(8)
.child(TextBlock::new().text("Hello").build(ctx))
.child(TextBlock::new().text("User").build(ctx))
.child(TextBlock::new().text("Localization dialog").build(ctx))
.child(
ComboBox::new()
.count(count)
.items_builder(move |bc, index| {
let text = bc.get_widget(id)
.get::<Vec<String>>("languages")[index]
.clone();
TextBlock::new().v_align("center").text(text).build(bc)
})
.on_changed("selected_index", move |states, _| {
states.get_mut::<LocalizationState>(id).change_language();
})
.selected_index(id)
.build(ctx),
)
.build(ctx),
)
}
}
// [END] views
// [START] states
#[derive(AsAny, Debug, Default)]
struct LocalizationState {
change_language: bool,
}
impl LocalizationState {
fn change_language(&mut self) {
self.change_language = true;
}
}
impl State for LocalizationState {
fn update(&mut self, _registry: &mut Registry, ctx: &mut Context<'_>) {
if !self.change_language {
return;
}
let index = *LocalizationView::selected_index_ref(&ctx.widget()) as usize;
let selected_language = LocalizationView::languages_ref(&ctx.widget())[index].clone();
match selected_language.as_str() {
"English" => ctx.set_language("en_US"),
"German" => ctx.set_language("de_DE"),
_ => {}
}
self.change_language = false;
}
}
// [END] states

View File

@@ -0,0 +1,427 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2021 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use cfg_if::cfg_if;
use orbtk::prelude::*;
use orbtk::shell::event::Key;
use tracing::{info, trace};
use std::process;
use crate::{
data::constants::*,
widgets::menu::menu_view::MenuView,
//widgets::policycheck::policycheck_view::PolicycheckView,
};
/// Valid `actions` that are handled as state changes in the `Menu` widget.
#[derive(Debug, Clone, Copy)]
pub enum MenuAction {
CreateMenu,
CreateMenuToggleTheme,
RemoveMenu,
RemoveMenuToggleTheme,
SetTheme,
UpdateMenuRelativePosition
}
/// Valid `structures` that are handled inside the state of the `Menu` widget.
#[derive(AsAny, Default)]
pub struct MenuState {
action: Option<MenuAction>,
menu: Option<Entity>,
//menu_toggle_theme: Option<Entity>
menu_toggle_theme: Entity
}
/// Method definitions, that react on any given state change inside the `Menu` widget.
impl MenuState {
/// Create a toggle_theme menu as a child of the given parent
/// Select the active theme from a `ComboBox` offering a list of valid `themes`
fn _create_menu_toggle_theme(&mut self, _ctx: &mut Context<'_>) {
self.action = Some(MenuAction::CreateMenuToggleTheme);
}
/// Remove the menu popup box
fn remove_menu(&mut self, ctx: &mut Context<'_>) {
self.action = Some(MenuAction::RemoveMenu);
ctx.remove_child(ctx.entity());
println!("Popup {:?} removed.", ctx.entity());
}
/// Remove the menu popup box
fn _remove_menu_toggle_theme(&mut self, _ctx: &mut Context<'_>) {
self.action = Some(MenuAction::RemoveMenuToggleTheme);
}
/// Sets a new action.
pub fn set_action(&mut self, action: MenuAction) {
self.action = action.into();
}
/// Update the relative position of the menu overlay
fn _update_menu_relative_position(&mut self) {
println!("TODO: Update relative position of menu {}.", ID_MENU_POPUP);
//self.action = Some(MenuAction::UpdateRelativePosition);
}
}
/// Supported methods handled inside the `MenuState`
impl State for MenuState {
// /// Initialize the state of widgets inside `MenuState`
// fn init(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
// }
/// Handle messages for the `MenuState`
fn messages(
&mut self,
mut messages: MessageReader,
_registry: &mut Registry,
ctx: &mut Context<'_>,
) {
for message in messages.read::<MenuAction>() {
match message {
MenuAction::CreateMenu => {
info!("WIP: create a menu popup in MenuState");
// assign parent entity
let parent = ctx.entity();
trace!(parent = ?parent);
//let parent_name = ctx.get_widget().get::<String16>("text");
//trace!(parent = ?parent, parent_name = ?parent_name);
// assign target -> search for a child of parent with given id
let target = ctx
.entity_of_child(ID_MENU_BUTTON_MENU)
.expect("MenuState: Can't find entity of resource 'ID_MENU_BUTTON_MENU'.");
trace!(target = ?target.0, entity_of_child = ?ID_MENU_BUTTON_MENU);
// create the target entity as child of parent
let menu_popup = create_menu_popup(parent, &mut ctx.build_context());
//let menu_popup = create_popup(target, "Testmenu Popup", &mut ctx.build_context());
// append the child to target (overlay stays on top of the main tree)
ctx.build_context()
.append_child_to_overlay(menu_popup)
.expect("Failed create an overlay that consumes popup `menu` as its child.");
self.menu = Some(menu_popup);
trace!(menu = ?self.menu);
// open: is the default
//ctx.get_widget(menu).set("open", true);
info!("CreateMenu: parent {:?}, target: {:?}, popup: {:?}", parent, target, self.menu);
}
MenuAction::SetTheme => {
let theme_index = *MenuView::selected_index_ref(&ctx.widget());
cfg_if! {
if #[cfg(windows)] {
match theme_index {
0 => ctx.switch_theme(theme_default_dark()),
1 => ctx.switch_theme(theme_default_light()),
2 => ctx.switch_theme(theme_redox()),
3 => ctx.switch_theme(theme_fluent_dark()),
4 => ctx.switch_theme(theme_fluent_light()),
_ => {}
}
} else {
match theme_index {
0 => ctx.switch_theme(theme_default_dark()),
1 => ctx.switch_theme(theme_default_light()),
2 => ctx.switch_theme(theme_redox()),
_ => {}
}
}
}
}
_ => {}
}
}
}
/// Update the state of widgets inside the `Menu` view.
fn update(&mut self, _registry: &mut Registry, ctx: &mut Context<'_>) {
if let Some(action) = self.action {
match action {
MenuAction::CreateMenuToggleTheme => {
let menu_target = ctx
.entity_of_child(ID_MENU_LABEL_TOGGLE_THEME)
.expect("MenuState: Can't find entity of resource 'ID_MENU_LABEL_TOGGLE_THEME'.");
let current_entity = ctx.entity();
let build_context = &mut ctx.build_context();
// create a new menu popup
self.menu_toggle_theme = create_menu_toggle_theme_popup(current_entity, build_context);
// create a menu_popup widget as a child of entity "ID_POPUP_MENU"
build_context.append_child(menu_target, self.menu_toggle_theme);
ctx.get_widget(self.menu_toggle_theme).clone::<Visibility>("visibility");
println!("Popup Menu Toggle Theme created: {:?}", self.menu_toggle_theme);
}
MenuAction::RemoveMenu => {
self.remove_menu(ctx);
}
MenuAction::RemoveMenuToggleTheme => {
ctx.remove_child(self.menu_toggle_theme);
println!("Popup {:?} removed.", ctx.entity());
}
MenuAction::UpdateMenuRelativePosition => {
if let Some(menu) = self.menu {
// let theme_combo_box = ctx.entity_of_child(ID_MENU_TOGGLE_THEME).unwrap();
// let selected_index: i32 = ctx.get_widget(theme_combo_box).clone("selected_index");
// // let relative_position: RelativePosition =
// // ctx.get_widget(ID_MENU_POPUP).clone_or_default("relative_position");
// match selected_index {
// 0 => {
// RelativePosition::relative_position_mut(&mut ctx.widget()).into_bottom();
// //RelativePosition::get_mut::<MenuState>("relative_position").into_bottom();
// // ctx
// // .get_widget(self.ID_MENU_POPUP.unwrap())
// // .set("relative_position", relative_position.into_bottom());
// },
// 1 => RelativePosition::relative_position_mut(&mut ctx.widget()).into_top(),
// 2 => RelativePosition::relative_position_mut(&mut ctx.widget()).into_left(),
// 3 => RelativePosition::relative_position_mut(&mut ctx.widget()).into_right(),
// _ => panic!(),
// }
println!("Relative position of menu {:?} updated.", menu);
}
}
_ => (),
}
}
}
}
/// Create a new popup presenting the menu components
fn create_menu_popup(target: Entity, ctx: &mut BuildContext<'_>) -> Entity {
Popup::new()
.id(ID_MENU_POPUP)
.name(ID_MENU_POPUP)
.target(target.0)
.open(true)
// WIP: this requires orbtk-develop with PR #304 (new_popup)
// Specify the popup position relative to the target
//.relative_position(RelativePosition::Bottom(5.0))
// Reference target from given Point
//.target(Point::new(100.0,100.0))
//.style("popup_menu")
.width(300.0)
.height(100.0)
.on_key_down(move | ctx, key_event | {
match key_event.key {
Key::Q(..) => {
//if is_ctrl_home_down(ctx)
println!("KeyHandler: got Ctrl+Q");
process::exit(0);
//}
},
Key::Escape => {
println!("KeyHandler: got Escape");
ctx.get_mut::<MenuState>(target)
.set_action(MenuAction::RemoveMenu);
},
_ => {
println!("KeyHandler: got {:?}", key_event.key);
},
};
true
})
.child(
Container::new()
.child(
TextBlock::new()
//.style("popup_text_block")
.h_align("center")
.v_align("enter")
.text(ID_MENU_POPUP)
.build(ctx),
)
.build(ctx),
)
.child(
Grid::new()
.id(ID_MENU_GRID)
.name(ID_MENU_GRID)
.columns(
Columns::create()
.push("180") // Menu Button
.push("1") // Seperator
.push("auto") // Keyboard Shortcut
)
.rows(
Rows::create()
.push("auto")
.push("auto")
.push("auto")
)
.child(
Button::new()
.id(ID_MENU_LABEL_ACCOUNT)
.name(ID_MENU_LABEL_ACCOUNT)
.style("button_menu")
//.h_align("start")
.attach(Grid::row(0))
.attach(Grid::column(0))
//.attach(Grid::column_span(2))
.icon(material_icons_font::MD_PERSON)
.text("Account")
.build(ctx),
)
.child(
Button::new()
.id(ID_MENU_LABEL_TOGGLE_THEME)
.name(ID_MENU_LABEL_TOGGLE_THEME)
.style("button_menu")
//.h_align("start")
.attach(Grid::row(1))
.attach(Grid::column(0))
//.attach(Grid::column_span(2))
.icon(material_icons_font::MD_EDIT)
.text("Toggle theme")
.on_click(move |ctx, _| {
ctx.get_mut::<MenuState>(target)
.set_action(MenuAction::CreateMenuToggleTheme);
true
})
.build(ctx),
)
.child(
Button::new()
.id(ID_MENU_LABEL_QUIT)
.name(ID_MENU_LABEL_QUIT)
.style("button_menu")
//.h_align("start")
.attach(Grid::row(2))
.attach(Grid::column(0))
//.attach(Grid::column_span(2))
.icon(material_icons_font::MD_SETTINGS_POWER)
.text("Quit")
.on_mouse_down(move |_states, _| {
process::exit(0);
})
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_MENU_SHORTCUT_QUIT)
.name(ID_MENU_SHORTCUT_QUIT)
//.style("button_menu")
.attach(Grid::row(2))
.attach(Grid::column(2))
.margin((0, 0, 16, 0))
.h_align("end")
.v_align("center")
.text("CTRL+Q")
.build(ctx),
)
.build(ctx),
)
.build(ctx)
}
fn _create_popup(target: Entity, text: &str, ctx: &mut BuildContext<'_>) -> Entity {
Popup::new()
.id("test_popup")
.name("Test Popup")
// Reference target from given Entity
.target(target.0)
// Reference target from given Point
//.target(Point::new(0.0, 5.0))
// Specify the popup position relative to the target (the button in this case)
//.relative_position(RelativePosition::Bottom(5.0))
.open(true)
.style("popup_form")
.width(350.0)
.height(100.0)
.child(
Container::new()
.child(
TextBlock::new()
//.style("popup_text_block")
.h_align("center")
.text(text)
.build(ctx),
)
.build(ctx),
)
.build(ctx)
}
/// Create a new popup submenu to toogle the active theme
fn create_menu_toggle_theme_popup(id: Entity, ctx: &mut BuildContext<'_>) -> Entity {
cfg_if! {
if #[cfg(windows)] {
// define the list of supported themes
let themes = vec![
"default_dark".to_string(),
"default_light".to_string(),
"redox".to_string(),
"fluent_dark".to_string(),
"fluent_light".to_string()
];
} else {
// define the list of supported themes
let themes = vec![
"default_dark".to_string(),
"default_light".to_string(),
"redox".to_string(),
];
}
}
let themes_count = themes.len();
Popup::new()
.id(ID_MENU_TOGGLE_THEME)
.target(id.0)
.style("container_menu")
.width(280)
.height(140)
.on_key_down(move | _ctx, key_event | {
match key_event.key {
Key::Escape => {
println!("KeyHandler: got Escape");
//ctx.get_mut::<MenuState>(id)
// .set_action(MenuAction::RemoveMenuToggleTheme);
},
_ => {
println!("KeyHandler: got {:?}", key_event.key);
},
};
true
})
.child(
ComboBox::new()
.attach(Grid::column(2))
.attach(Grid::row(6))
.count(themes_count)
.style("combo_box_form")
.items_builder(move |ctx, index| {
let theme_name =
MenuView::themes_ref(&ctx.get_widget(id))[index].clone();
TextBlock::new().v_align("center").text(theme_name).build(ctx)
})
.on_changed("selected_index", move |states, _entity| {
states.send_message(MenuAction::SetTheme, id);
println!("changed theme.");
})
.selected_index(id)
.build(ctx),
)
.build(ctx)
}

View File

@@ -0,0 +1,127 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::data::constants::*;
use crate::widgets::menu::menu_state::{MenuAction, MenuState};
type List = Vec<String>;
// Macro that initializes the widget structures/variables for the menu view
widget!(
MenuView<MenuState> {
//menu_stack: Entity,
//button_menu: Entity,
selected_index: i32,
themes: List
}
);
/// The template implementation of the menu view
/// All GUI elements are styled using the "style" attribute referencing to a ron based css
impl Template for MenuView {
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let menu_bottom_bar = Container::new()
.id(ID_MENU_BOTTOM_BAR)
.style(STYLE_BOTTOM_BAR)
.attach(Grid::row(3))
.attach(Grid::column(1))
.attach(Grid::column_span(2))
.v_align("end")
.child(
Container::new()
.child( Container::new()
.margin((0, 16, 16, 0))
.v_align("center")
.child(
ImageWidget::new()
.image("assets/advotracker/hiedemann_logo.png")
.v_align("center")
.build(ctx),
)
.build(ctx),
)
.build(ctx),
)
.child(
Container::new()
.attach(Grid::column(1))
.h_align("end")
.v_align("end")
.child(
TextBlock::new()
.margin((0, 9, 48, 0))
.text("©Networkx GmbH")
.build(ctx)
)
.build(ctx),
)
.build(ctx);
let menu_button_menu = Button::new()
.id(ID_MENU_BUTTON_MENU)
.name(ID_MENU_BUTTON_MENU)
.style("button_single_content")
.icon(material_icons_font::MD_MENU)
.attach(Grid::column(2))
//.min_size(16, 16)
//.h_align("end")
.h_align("start")
.on_click(move |ctx, _| {
ctx.send_message(MenuAction::CreateMenu, id);
true
})
.build(ctx);
let menu_header_bar = Container::new()
.id(ID_MENU_HEADER_BAR)
.style(STYLE_HEADER_BAR)
.attach(Grid::row(0))
.attach(Grid::column(1))
.attach(Grid::column_span(2))
.child(
Grid::new()
.child(
TextBlock::new()
.style("header")
.id(ID_MENU_HEADER)
.v_align("center")
.h_align("left")
.text("Ticket Data")
.build(ctx),
)
.build(ctx),
)
.child(menu_button_menu)
.build(ctx);
//self.themes(themes).child(MenuState::create_menu(ID_MENU_POPUP, ctx))
self.name("MenuView")
.child(
Grid::new()
.id(ID_MENU_VIEW)
.columns(
Columns::create()
.push(50) // Left margin
.push("*") // Content
.push(50) // Right margin
)
.rows(
Rows::create()
.push("auto") // Header_Bar
.push(28) // Seperator
.push("*") // InputForm
.push("auto") // Bottom_Bar
)
.child(menu_header_bar) // Row 0
.child(menu_bottom_bar) // Row 3
.build(ctx),
)
}
}

View File

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

View File

@@ -5,11 +5,29 @@
* SPDX-License-Identifier: (0BSD or MIT) * SPDX-License-Identifier: (0BSD or MIT)
*/ */
/// The starting point (Main View) /// Configuration widget.
pub mod configuration;
/// Global helper functions.
pub mod global_state;
/// Localization widget.
pub mod localization;
/// The starting point (Main View).
pub mod main_view; pub mod main_view;
/// The policy check wigdet /// Menu widget.
pub mod policycheck_view; pub mod menu;
// /// The policy lists widget /// Policycheck wigdet.
// pub mod policylist_view; pub mod policycheck;
// /// Policydata widget.
// pub mod policydata;
// /// Policylists widget.
// pub mod policylist;
/// Ticketdata wigdet.
pub mod ticketdata;

View File

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

View File

@@ -1,16 +1,12 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use locales::t; use locales::t;
use orbtk::{ use orbtk::prelude::*;
prelude::*,
shell::WindowRequest,
theme::{COLORS_RON, FONTS_RON},
theming::config::ThemeConfig,
};
#[cfg(not(feature = "light"))]
use orbtk::theme::DARK_THEME_RON;
#[cfg(feature = "light")]
use orbtk::theme::LIGHT_THEME_RON;
use serde::Deserialize; use serde::Deserialize;
use std::process; use std::process;
@@ -19,77 +15,78 @@ use std::time::{Duration, SystemTime};
use tracing::{error, info, trace}; use tracing::{error, info, trace};
use crate::{ use crate::{
callbacks::global_state::GlobalState, data::{
data::structures::{PolicyCode, PolicyDataList, PolicyList}, structures::{PolicyCode, PolicyDataList, PolicyList},
data::constants::*, constants::*,
services::imports::allianzdirectcall::import, },
//services::imports::allianzdirectcall::import,
services::imports::allianzdirectcall,
widgets::global_state::GlobalState,
//widgets::menu::menu_view::MenuView,
//widgets::policycheck::policycheck_view::PolicycheckView,
//widgets::ticketdata::ticketdata_state::TicketdataAction,
}; };
/// Actions that can execute on the task view. /// Enumeration of valid `action variants` that need to be handled as
#[derive(Debug, Clone, Copy)] /// state changes for the `PolicycheckView` widget.
pub enum Action { #[derive(Debug, Clone)]
pub enum PolicycheckAction {
ClearEntry(Entity), ClearEntry(Entity),
ChangeTheme(),
SendPolicynumber(),
InputTextChanged(Entity), InputTextChanged(Entity),
ImportData, ImportData,
OpenMenu(Entity), NewTicket,
ParseEntry(Entity), ParsePolicyNumber(Entity),
AddProgress(f64),
ResetProgress,
SetMenu(Entity),
SetProgress(f64),
SetProgressPopup(Entity),
RemoveFocus(Entity), RemoveFocus(Entity),
RemovePopup(Entity), RemovePopup(Entity),
ResetProgress,
GetProgress,
SetProgress(f64),
SetProgressPopup(Entity),
SetToggleTheme(Entity),
SetEntry(Entity), SetEntry(Entity),
SetVisibility(Entity), SetVisibility(Entity),
TextChanged(Entity, usize), TextChanged(Entity, usize),
ToggleTheme(Entity), UpdatePolicyCode,
UpdateProgress(f64)
} }
/// define valid environment variables provided via .env files /// Define valid environment variables provided via .env files
/// located in the current call directory /// located in the current call directory.
/// this is primarily used in testing scenarios (eg. debugging) /// This is primarily used in testing scenarios (eg. debugging).
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct Environment { struct Environment {
test_lang: String, test_lang: String,
rust_log: String, rust_log: String,
} }
/// Handles the requests from `PolicyCheckView`. /// Valid `structures` that are handled inside the state of the `Policycheck` widget.
#[derive(AsAny, Default)] #[derive(AsAny, Default)]
pub struct PolicyCheckState { pub struct PolicycheckState {
action: Option<Action>, actions: Vec<PolicycheckAction>,
button_menu: Entity,
duration: Duration, duration: Duration,
label_result: Entity, label_result: Entity,
lang: String, lang: String,
//last_focused: Option<Entity>,
button_menu: Entity,
menu: Entity,
policy_data_count: u64, policy_data_count: u64,
//policy_number: Entity,
policy_numbers: HashMap<u64, PolicyCode>, policy_numbers: HashMap<u64, PolicyCode>,
progress_bar: Entity, progress_bar: Entity,
progress_count: f64, progress_count: f64,
progress_popup: Entity, progress_popup: Entity,
theme_name: String // target that recieves messages
target: Entity,
ticketdata: Entity
} }
#[cfg(not(feature = "light"))] impl GlobalState for PolicycheckState {}
static DARK_EXT: &'static str = include_str!("../../resources/stylesheets/advotracker_dark.ron");
#[cfg(feature = "light")]
static LIGHT_EXT: &'static str = include_str!("../../resources/stylesheets/advotracker_light.ron");
impl GlobalState for PolicyCheckState {}
/// method definitions, that react on any given state change inside the view
impl PolicyCheckState {
/// Sets a new action.
pub fn action(&mut self, action: Action) {
self.action = action.into();
}
/// Method definitions, that react on any given state change inside the `Policycheck` widget.
impl PolicycheckState {
/// Create a hashmap (key: policy number, value: policy type). /// Create a hashmap (key: policy number, value: policy type).
pub fn create_hashmap(&mut self, _ctx: &mut Context<'_>) -> Result<(), Box<dyn std::error::Error>> { pub fn create_hashmap(&mut self, _ctx: &mut Context<'_>)
-> Result<(), Box<dyn std::error::Error>> {
trace!(target: "advotracker", create_hashmap = "started"); trace!(target: "advotracker", create_hashmap = "started");
let policy_list = PolicyList::new("policy list"); let policy_list = PolicyList::new("policy list");
@@ -105,7 +102,7 @@ impl PolicyCheckState {
// Wip: use cli parameter stored in viperus ... // Wip: use cli parameter stored in viperus ...
//let mut csv_import_path = v.get::<String>("import_file").unwrap(); //let mut csv_import_path = v.get::<String>("import_file").unwrap();
let mut csv_import_path = String::from("POLLFNR_WOECHENTLICH.txt"); let mut csv_import_path = String::from("POLLFNR_WOECHENTLICH.txt");
match import(&mut csv_import_path, &mut policy_data, 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) { &self.lang) {
Ok((count, duration)) => { Ok((count, duration)) => {
@@ -138,21 +135,19 @@ impl PolicyCheckState {
-> Result<(), Box<dyn std::error::Error>> { -> Result<(), Box<dyn std::error::Error>> {
// WIP: for now, only import once per session // WIP: for now, only import once per session
if self.policy_data_count == 0 { if self.policy_data_count == 0 {
TextBlock::enabled_set(&mut ctx.child(ID_POLICY_CHECK_RESULT), true); TextBlock::enabled_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), true);
if self.policy_numbers.len() == 0 { if self.policy_numbers.is_empty() {
// initialize popup widget // initialize popup widget
let sender = ctx.window_sender();
self.set_popup_progress(ctx); self.set_popup_progress(ctx);
self.progress_count += 0.33; self.progress_count += 0.33;
self.update_progress_bar(ctx); self.update_progress_bar(ctx);
sender.send(WindowRequest::Redraw).unwrap();
// for _ in 1..4 { for _ in 1..4 {
// self.progress_count += 0.33; self.progress_count += 0.33;
// self.update_progress_bar(ctx); self.update_progress_bar(ctx);
// sender.send(WindowRequest::Redraw).unwrap(); ctx.send_message(PolicycheckAction::UpdateProgress(self.progress_count), self.progress_popup);
//} }
// importing policy code elements from csv-file // importing policy code elements from csv-file
match self.create_hashmap(ctx) { match self.create_hashmap(ctx) {
@@ -166,7 +161,6 @@ impl PolicyCheckState {
self.progress_count = 1.; self.progress_count = 1.;
self.update_progress_bar(ctx); self.update_progress_bar(ctx);
sender.send(WindowRequest::Redraw).unwrap();
} }
_ => { _ => {
let res = t!("policy.hashmap.failed", self.lang); let res = t!("policy.hashmap.failed", self.lang);
@@ -184,20 +178,20 @@ impl PolicyCheckState {
Ok(()) Ok(())
} }
/// Open menu. /// Create new ticket
pub fn open_menu(&mut self, _entity: Entity, ctx: &mut Context<'_>) { pub fn new_ticket(&mut self, ctx: &mut Context<'_>) {
//let menu_string = ctx.get_widget(entity).get::<String16>("text"); println!("WIP: new ticket.");
//.child(policycheck_menu); self(ticketdata_view.0);
//self.set_popup_menu(ctx); //ctx.widget().get_mut::<TicketdataView>(0).
self.set_menu(ctx); //ctx.get_widget(self.ticketdata_view);
} }
/// Parse validity of the given policy number. /// Parse validity of the given policy number.
fn parse_entry(&mut self, policy_check_policy_number: Entity, pub fn parse_entry(&mut self, policy_check_policy_number: Entity,
ctx: &mut Context<'_>) { ctx: &mut Context<'_>) {
trace!(target: "advotracker", parse_entry = "started"); trace!(target: "advotracker", parse_entry = "started");
let policy_number_string = TextBox::text_clone(&mut ctx.get_widget(policy_check_policy_number)); let policy_number_string = TextBox::text_clone(&ctx.get_widget(policy_check_policy_number));
let policy_number_length = policy_number_string.len(); let policy_number_length = policy_number_string.len();
if self.policy_data_count == 0 { if self.policy_data_count == 0 {
@@ -219,20 +213,13 @@ impl PolicyCheckState {
// Parse policy code: "AS-123456789" // Parse policy code: "AS-123456789"
// DION VERS POLLFNR // DION VERS POLLFNR
// 1 AS 1515735810 // 1 AS 1515735810
//Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_1), Visibility::Collapsed);
//Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_2), Visibility::Collapsed);
//TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
//TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_RESULT), Visibility::Collapsed);
//TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Collapsed);
//TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Collapsed);
Button::background_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("transparent")); Button::background_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("transparent"));
//Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Collapsed);
if policy_number_length == 10 { if policy_number_length == 10 {
// cast policy_number_sting to <u64> // cast policy_number_sting to <u64>
match policy_number_string.parse::<u64>() { match policy_number_string.parse::<u64>() {
Ok(p) => { Ok(p) => {
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_RESULT), String::from("")); TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), String::from(""));
// match hashmap's key // match hashmap's key
match self.policy_numbers.get(&p) { match self.policy_numbers.get(&p) {
@@ -243,7 +230,7 @@ impl PolicyCheckState {
let string_result = format!("1-{:?}-{}", let string_result = format!("1-{:?}-{}",
policy_code, p); policy_code, p);
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_RESULT), String::from(string_result)); 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")); TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#008000"));
Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#008000")); Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#008000"));
@@ -251,8 +238,10 @@ impl PolicyCheckState {
Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CHECK); Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CHECK);
Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible); Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_1), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Visible);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_2), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Visible);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Collapsed);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Collapsed);
} }
_ => { _ => {
// no matching key // no matching key
@@ -267,8 +256,10 @@ impl PolicyCheckState {
Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR); Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR);
Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible); Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_1), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_2), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
} }
} }
}, },
@@ -277,17 +268,17 @@ impl PolicyCheckState {
TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#FF0000")); TextBox::foreground_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER), String::from("#FF0000"));
//TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_HINT), String::from("Only numbers are valid")); TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_HINT), String::from("Only numbers are valid"));
//TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000")); Button::icon_brush_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
Button::foreground_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000")); Button::foreground_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), String::from("#FF0000"));
Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR); Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR);
Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible); Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_1), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_2), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
} }
} }
} }
@@ -306,8 +297,10 @@ impl PolicyCheckState {
Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR); Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR);
Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible); Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_1), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_2), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
} }
if policy_number_length > 10 { if policy_number_length > 10 {
let res = t!("policy.validation.failed", self.lang); let res = t!("policy.validation.failed", self.lang);
@@ -324,16 +317,22 @@ impl PolicyCheckState {
Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR); Button::icon_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), material_icons_font::MD_CLEAR);
Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible); Button::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_1), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_2), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Visible);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Visible);
} }
trace!(target: "advotracker", parse_entry = "finished"); trace!(target: "advotracker", parse_entry = "finished");
} }
/// Remove the menu popup box /// parse message 'ParseEntry'
pub fn parse_policy_number(&mut self, entity: Entity) {
self.actions.push(PolicycheckAction::ParsePolicyNumber(entity));
}
/// Remove the popup box
fn remove_popup(&mut self, id: Entity, ctx: &mut Context<'_>) { fn remove_popup(&mut self, id: Entity, ctx: &mut Context<'_>) {
ctx.remove_child(self.menu);
ctx.remove_child(self.progress_popup); ctx.remove_child(self.progress_popup);
println!("Popup {:?} removed !", id); println!("Popup {:?} removed !", id);
} }
@@ -351,47 +350,47 @@ impl PolicyCheckState {
// ctx.get_widget(self.policy_check_policy_number).update_theme_by_state(true); // ctx.get_widget(self.policy_check_policy_number).update_theme_by_state(true);
// } // }
/// Sending message 'UpdatePolicyCode'
pub fn send_message_update_policy_code(&mut self, entity: Entity) {
println!("WIP: send_message_update_policy_code = {:?}", entity);
//self.actions.push(PolicycheckAction::UpdatePolicyNumber("4711".to_string()));
//let policy_number = (ctx.get_child(entity).get::<String>("text"));
//println!("WIP: poliy_number = {:?}", policy_number);
//self.actions.push(PolicycheckAction::UpdatePolicyNumber(self.policy_number));
}
/// Change status of given text box to edit mode. /// Change status of given text box to edit mode.
fn set_entry(&mut self, text_box: Entity, ctx: &mut Context<'_>) { fn set_entry(&mut self, text_box: Entity, ctx: &mut Context<'_>) {
if ctx.get_widget(text_box).get::<String16>("text").is_empty() { if ctx.get_widget(text_box).get::<String16>("text").is_empty() {
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
} else { } else {
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Visible);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Visible);
} }
} }
/// Set a menu
fn set_menu(&mut self, ctx: &mut Context<'_>) {
let current_entity = ctx.entity;
let build_context = &mut ctx.build_context();
// create a menu overlay
self.menu = create_menu(current_entity, build_context);
let _menu = build_context.append_child_to_overlay(self.menu)
.expect("PolicyCheckState: Can't create overlay as child of entity");
}
/// Set a progress popup that updates the import status in a progress bar /// Set a progress popup that updates the import status in a progress bar
fn set_popup_progress(&mut self, ctx: &mut Context<'_>) { fn set_popup_progress(&mut self, ctx: &mut Context<'_>) {
//println!("Set up Progress popup: {:?}", text_box); // create a stack as a child of entity "ID_POLICY_CHECK_POLICY_NUMBER"
let stack = ctx let stack = ctx
.entity_of_child(ID_POLICY_CHECK_RESULT) .entity_of_child(ID_POLICY_CHECK_POLICY_NUMBER)
.expect("PolicyCheckState: Can't find entity of resource 'ID_POLICY_CHECK_RESULT'."); .expect("PolicycheckState: Can't find entity of resource 'ID_POLICY_CHECK_POLICY_NUMBER'.");
let current_entity = ctx.entity; let current_entity = ctx.entity();
let build_context = &mut ctx.build_context(); let build_context = &mut ctx.build_context();
// create the progress_popup widget
self.progress_popup = create_popup_progress(current_entity, build_context); self.progress_popup = create_popup_progress(current_entity, build_context);
info!("set_popup_progress: New entity 'popup_progress' {:?} created", self.progress_popup);
// create a progress_popup widget as a child of entity "ID_POLICY_CHECK_POLICY_NUMBER" // append the stack inside the progress_popup
build_context.append_child(stack, self.progress_popup); build_context.append_child(stack, self.progress_popup);
// make sure we have a progress bar
self.progress_bar = ctx self.progress_bar = ctx
.entity_of_child(ID_POLICY_CHECK_PROGRESS_BAR) .entity_of_child(ID_POLICY_CHECK_PROGRESS_BAR)
.expect("PolicyCheckState.init: Can't find entity of resource 'ID_POLICY_CHECK_PROGRESS_BAR'."); .expect("PolicycheckState.init: Can't find entity of resource 'ID_POLICY_CHECK_PROGRESS_BAR'.");
info!("set_popup_progress: New entity 'progress_bar' created: {:?}", self.progress_bar);
println!("PopupProgress created: {:?}", self.progress_popup);
} }
/// Change visibility of the result label. /// Change visibility of the result label.
@@ -403,31 +402,6 @@ impl PolicyCheckState {
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Visible);
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_BUTTON_RESULT), Visibility::Visible);
} }
//ctx.get_widget(self.label_result).update_theme_by_state(true);
}
/// Set and activate the theme attributes.
#[cfg(not(feature = "light"))]
pub fn theme() -> Theme {
Theme::from_config(
// sourcing: crates/theme/assets/dark/dark.ron
ThemeConfig::from(DARK_THEME_RON)
.extend(ThemeConfig::from(DARK_EXT))
.extend(ThemeConfig::from(COLORS_RON))
.extend(ThemeConfig::from(FONTS_RON)),
)
}
#[cfg(feature = "light")]
pub fn theme() -> Theme {
Theme::from_config(
ThemeConfig::from(LIGHT_THEME_RON)
.extend(ThemeConfig::from(LIGHT_EXT))
.extend(ThemeConfig::from(COLORS_RON))
.extend(ThemeConfig::from(FONTS_RON)),
)
} }
/// Update count of elements in the policy data list. /// Update count of elements in the policy data list.
@@ -440,39 +414,55 @@ impl PolicyCheckState {
let res = t!("policy.string.progress_time", self.lang); let res = t!("policy.string.progress_time", self.lang);
let string_duration = format!("{}: {:?}", res, self.duration); let string_duration = format!("{}: {:?}", res, self.duration);
TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_TIME), String::from(string_duration)); TextBlock::text_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_TIME), string_duration);
let mut progress_bar = ctx.child(ID_POLICY_CHECK_PROGRESS_BAR); let mut progress_bar = ctx.child(ID_POLICY_CHECK_PROGRESS_BAR);
progress_bar.set::<f64>("val", self.progress_count); progress_bar.set::<f64>("val", self.progress_count);
} }
/// Update the policy code policy data list.
fn update_policy_code(&self, _ctx: &mut Context<'_>) {
println!("update internal: policy_code");
//let policy_code = ctx.widget().get::<PolicycheckState>(ID_POLICY_CHECK_POLICY_CODE);
//ctx.widget().set(PROP_POLICY_DATA_COUNT, policy_code);
}
} }
/// upported states for our view /// Supported methods handled inside the `PolicycheckState`
impl State for PolicyCheckState { impl State for PolicycheckState {
/// Initialize the widget state /// Initialize the state of widgets inside `PolicycheckState`
fn init(&mut self, _: &mut Registry, ctx: &mut Context<'_>) { fn init(&mut self, _: &mut Registry, ctx: &mut Context<'_>) {
let time_start= SystemTime::now(); let time_start= SystemTime::now();
trace!(target: "advotracker", policycheck_state = "init", status = "started"); trace!(target: "advotracker", policycheck_state = "init", status = "started");
// Entities // Get language from environment
self.lang = PolicycheckState::get_lang();
// Initialize required entities
self.button_menu = ctx self.button_menu = ctx
.entity_of_child(ID_POLICY_CHECK_BUTTON_MENU) .entity_of_child(ID_POLICY_CHECK_BUTTON_MENU)
.expect("PolicyCheckState.init: Can't find resource entity 'ID_POLICY_CHECK_BUTTON_MENU'."); .expect("PolicycheckState::init: Can't find resource entity 'ID_POLICY_CHECK_BUTTON_MENU'.");
self.label_result = ctx self.label_result = ctx
.entity_of_child(ID_POLICY_CHECK_LABEL_RESULT) .entity_of_child(ID_POLICY_CHECK_LABEL_RESULT)
.expect("PolicyCheckState.init: Can't find resource entity 'ID_POLICY_CHECK_LABEL_RESULT'."); .expect("PolicycheckState::init: Can't find resource entity 'ID_POLICY_CHECK_LABEL_RESULT'.");
//TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
//TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_POLICY_CODE), Visibility::Collapsed);
//Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_0), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_HINT), Visibility::Collapsed);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_1), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_HINT), Visibility::Collapsed);
Stack::visibility_set(&mut ctx.child(ID_POLICY_CHECK_FORM_ROW_2), Visibility::Collapsed);
// Preset localization with given environment lang //self.policy_number = Entity::from(ctx.widget().try_clone::<u32>(ID_POLICY_CHECK_POLICY_NUMBER)
self.lang = PolicyCheckState::get_lang(); // .expect("PolicycheckState::init(): Can't find resource entity 'ID_POLICY_CHECK_POLICY_NUMBER'."));
ctx.set_language(&self.lang);
self.target = Entity::from(ctx.widget().try_clone::<u32>("target")
.expect("PolicycheckState::init(): Can't find resource entity 'target'."));
//self.ticketdata_view = (*ctx.widget().get::<u32>("ticketdata_view")).into();
//self.ticketdata = Entity::from(ctx.widget().try_clone::<u32>(ID_TICKET_DATA_VIEW)
// .expect("PolicycheckState::init(): Can't find resource entity 'ticketdata'."));
// // Load the saved data from a file in 'ron' format into our data structure. // // Load the saved data from a file in 'ron' format into our data structure.
// // The cargo package identifier (default: 'nwx.advotracker') is used as the // // The cargo package identifier (default: 'nwx.advotracker') is used as the
@@ -492,7 +482,39 @@ impl State for PolicyCheckState {
trace!(target: "advotracker", policycheck_state = "init", status = "finished", duration = ?duration); trace!(target: "advotracker", policycheck_state = "init", status = "finished", duration = ?duration);
} }
/// Update the widget state. /// Handle messages for `PolicycheckState`.
fn messages(
&mut self,
mut messages: MessageReader,
_registry: &mut Registry,
ctx: &mut Context<'_>,
) {
for message in messages.read::<PolicycheckAction>() {
match message {
PolicycheckAction::UpdateProgress(increment) => {
let old_width = ProgressBar::val_clone(&ctx.child(ID_POLICY_CHECK_PROGRESS_BAR));
let new_width = old_width + increment;
// Set the ProgressBar's val property to the calculated percentage
// (whereas 0.0 means 0%, and 1.0 means 100%)
if new_width <= 1. {
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), new_width);
} else {
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!"); }
}
}
}
/// Update the state of widgets inside the `Policycheck` view.
fn update(&mut self, _registry: &mut Registry, ctx: &mut Context<'_>) { fn update(&mut self, _registry: &mut Registry, ctx: &mut Context<'_>) {
// // clear focus on focus moved // // clear focus on focus moved
// if self.last_focused != ctx.window().get::<Global>("global").focused_widget { // if self.last_focused != ctx.window().get::<Global>("global").focused_widget {
@@ -504,27 +526,18 @@ impl State for PolicyCheckState {
// } // }
//} //}
if let Some(action) = self.action { // Create `actions`, a drained iterator (".." => full range that clears the vector)
match action { let actions: Vec<PolicycheckAction> = self.actions.drain(..).collect();
Action::AddProgress(increment) => {
let old_width = ProgressBar::val_clone(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR));
let new_width = old_width + increment; for action in actions {
// Set the ProgressBar's val property to the calculated percentage match action {
// (whereas 0.0 means 0 %, and 1.0 means 100 %) to increment the progress PolicycheckAction::ClearEntry(policy_check_policy_number) => {
if new_width <= 1. {
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), new_width);
} else {
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 1.);
}
}
Action::ClearEntry(policy_check_policy_number) => {
ctx.get_widget(policy_check_policy_number).set("enabled", false); ctx.get_widget(policy_check_policy_number).set("enabled", false);
} }
Action::InputTextChanged(entity) => { PolicycheckAction::InputTextChanged(entity) => {
println!("entry changed: {}", TextBox::text_clone(&ctx.get_widget(entity))); println!("entry changed: {}", TextBox::text_clone(&ctx.get_widget(entity)));
} }
Action::ImportData => { PolicycheckAction::ImportData => {
match self.import_data(ctx) { match self.import_data(ctx) {
Ok(()) => { Ok(()) => {
trace!(target: "advotracker", import_data = "success"); trace!(target: "advotracker", import_data = "success");
@@ -535,167 +548,87 @@ impl State for PolicyCheckState {
} }
} }
} }
Action::OpenMenu(entity) => { PolicycheckAction::NewTicket => {
self.open_menu(entity, ctx); self.new_ticket(ctx);
} }
Action::ParseEntry(text_box) => { PolicycheckAction::ParsePolicyNumber(text_box) => {
self.parse_entry(text_box, ctx); self.parse_entry(text_box, ctx);
} }
Action::RemoveFocus(policy_check_policy_number) => { PolicycheckAction::RemoveFocus(policy_check_policy_number) => {
ctx.get_widget(policy_check_policy_number).set("enabled", false); ctx.get_widget(policy_check_policy_number).set("enabled", false);
ctx.push_event_by_window(FocusEvent::RemoveFocus(policy_check_policy_number)); //ctx.EventAdapter(FocusEvent::RemoveFocus(policy_check_policy_number));
} }
Action::RemovePopup(entity) => { PolicycheckAction::RemovePopup(entity) => {
self.remove_popup(entity, ctx); self.remove_popup(entity, ctx);
} }
Action::ResetProgress => { PolicycheckAction::ResetProgress => {
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 0.); ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 0.);
} }
Action::SetEntry(policy_check_policy_number) => { PolicycheckAction::SetEntry(policy_check_policy_number) => {
//self.last_focused = Some(); //self.last_focused = Some();
self.set_entry(policy_check_policy_number, ctx); self.set_entry(policy_check_policy_number, ctx);
} }
Action::SetMenu(_entity) => { PolicycheckAction::SetProgress(value) => {
self.set_menu(ctx);
}
Action::SetProgress(value) => {
if value >= 0. || value <= 1. { if value >= 0. || value <= 1. {
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), value); ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), value);
} else { } else {
ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 0.); ProgressBar::val_set(&mut ctx.child(ID_POLICY_CHECK_PROGRESS_BAR), 0.);
} } } }
Action::SetProgressPopup(_entity) => { PolicycheckAction::SetProgressPopup(_entity) => {
self.set_popup_progress(ctx); self.set_popup_progress(ctx);
} }
Action::SetVisibility(_entity) => { PolicycheckAction::SetVisibility(_entity) => {
TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed); TextBlock::visibility_set(&mut ctx.child(ID_POLICY_CHECK_LABEL_RESULT), Visibility::Collapsed);
} }
Action::TextChanged(entity, _index) => { PolicycheckAction::TextChanged(entity, _index) => {
self.set_entry(entity, ctx); self.set_entry(entity, ctx);
} }
Action::ToggleTheme(_entity) => { PolicycheckAction::UpdatePolicyCode => {
if self.theme_name == "light" { self.update_policy_code(ctx);
let theme = dark_theme();
self.theme_name = "dark".to_string();
ctx.switch_theme(theme);
}
if self.theme_name == "dark" { //info!("Message send: 'PolicycheckAction::UpdatePolicyNumber({:?}) -> {:?}'", policy_number, self.target);
let theme = light_theme(); //let policy_number = (&mut ctx.get_widget(entity).get::<String>("text"));
self.theme_name = "light".to_string(); //let policy_number = ctx.get_widget(ID_POLICY_CHECK_POLICY_NUMBER).get::<text>("text");
ctx.switch_theme(theme); //ctx.send_message(PolicycheckAction::UpdatePolicyCode("AS-1-4711".to_string()), self.target);
}; //ctx.send_message(PolicycheckAction::UpdatePolicyCode, self.target);
println!{"Switch theme to {:?}", self.theme_name}; //let mut widget_container : WidgetContainer = ctx.widget();
//widget_container.get::<String16>("text");
//let polnum: TextBox = TextBox::get(ctx.child(ID_POLICY_CHECK_POLICY_NUMBER));
//println!("Policy number: {:?}", polnum);
//let policy_number = ctx.get_widget(self.policy_check_policy_number);
//let policy_number2 = TextBox::text_clone(&ctx.get_widget(ID_POLICY_CHECK_POLICY_NUMBER));
//let policy_number_string = ctx.get_widget(entity).get::<String16>("text").is_empty();
//let policy_number = TextBox::text_clone(&mut ctx.child(ID_POLICY_CHECK_POLICY_NUMBER));
//ctx.send_message(PolicycheckAction::UpdatePolicyNumber(policy_check_policy_number), self.target);
//info!("Message send: 'PolicycheckAction::UpdatePolicyNumber({:?}) -> {:?}'", policy_check_policy_number, self.target);
} }
_ => (),
} }
} }
// Reset action
self.action = None;
} }
// /// Update the view after the layout is rendered. // /// Update the view after the layout is rendered.
// fn update_post_layout(&mut self, _: &mut Registry, _ctx: &mut Context<'_>) { // fn update_post_layout(&mut self, _: &mut Registry, _ctx: &mut Context<'_>) {
// } // }
}
/// Create a menu popup
fn create_menu(menu: Entity, ctx: &mut BuildContext<'_>) -> Entity {
Container::new()
.style("container_menu")
.width(280.0)
.height(140.0)
.position((100.0, 100.0))
.child(
Grid::new()
.id(ID_POLICY_CHECK_MENU)
.columns(
Columns::create()
// Menu Button
.push("80")
// Seperator
.push("1")
// Keyboard Shortcut
.push("*")
.build(),
)
.rows(
Rows::create()
.push("auto")
.push("auto")
.push("auto")
.build(),
)
.child(
Button::new()
.id(ID_POLICY_CHECK_MENU_LABEL_ACCOUNT)
.style("button_menu")
.attach(Grid::row(0))
.attach(Grid::column(0))
.attach(Grid::column_span(2))
.icon(material_icons_font::MD_PERSON)
.build(ctx),
)
.child(
Button::new()
.id(ID_POLICY_CHECK_MENU_LABEL_TOGGLE_THEME)
//.style("body")
.style("button_menu")
.attach(Grid::row(1))
.attach(Grid::column(0))
.attach(Grid::column_span(2))
.icon(material_icons_font::MD_EDIT)
.on_click(move |states, _| {
states.get_mut::<PolicyCheckState>(menu)
.action(Action::ToggleTheme(menu));
true
})
.build(ctx),
)
.child(
Button::new()
.id(ID_POLICY_CHECK_MENU_LABEL_QUIT)
.style("button_menu")
.attach(Grid::row(2))
.attach(Grid::column(0))
.attach(Grid::column_span(2))
.icon(material_icons_font::MD_SETTINGS_POWER)
.on_mouse_down(move |_states, _| {
process::exit(0);
})
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_MENU_SHORTCUT_QUIT)
.style("button_menu")
.attach(Grid::row(2))
.attach(Grid::column(2))
.margin((0, 0, 16, 0))
.h_align("end")
.v_align("center")
.text("CTRL+Q")
.build(ctx),
)
.build(ctx),
)
.build(ctx)
} }
/// Create a progress popup with update status of an onging data import /// Create a progress popup with update status of an onging data import
fn create_popup_progress(target: Entity, ctx: &mut BuildContext<'_>) -> Entity { fn create_popup_progress(id: Entity, ctx: &mut BuildContext<'_>) -> Entity {
Popup::new() Popup::new()
.id(ID_POLICY_CHECK_POPUP_PROGRESS) .id(ID_POLICY_CHECK_POPUP_PROGRESS)
.target(target) .target(id.0)
.open(true) .open(true)
//.style("popup_progress") .style("popup_progress")
.width(280) .width(280)
.height(100) .height(100)
.on_mouse_down(move |ctx, _| { .visibility(Visibility::Visible)
println!("on_click -> remove_popup_progress()"); .on_click(move |_ctx, _| {
ctx.get_mut::<PolicyCheckState>(target) println!("create_popup_progress: on_click -> remove_popup(popup_progress)");
.action(Action::RemovePopup(target)); //ctx.get_mut::<PolicycheckState>(id)
// .set_action(PolicycheckAction::RemovePopup(id));
true true
}) })
.child( .child(
@@ -707,14 +640,14 @@ fn create_popup_progress(target: Entity, ctx: &mut BuildContext<'_>) -> Entity {
.child( .child(
TextBlock::new() TextBlock::new()
.id(ID_POLICY_CHECK_PROGRESS_TEXT) .id(ID_POLICY_CHECK_PROGRESS_TEXT)
//.style("textblock_progress") .style("textblock_progress")
.font_size(12)
.text("Importing data") .text("Importing data")
.build(ctx) .build(ctx)
) )
.child( .child(
ProgressBar::new() ProgressBar::new()
.id(ID_POLICY_CHECK_PROGRESS_BAR) .id(ID_POLICY_CHECK_PROGRESS_BAR)
.style("progress_bar")
.val(0) .val(0)
//.width(250) //.width(250)
.build(ctx) .build(ctx)
@@ -722,9 +655,8 @@ fn create_popup_progress(target: Entity, ctx: &mut BuildContext<'_>) -> Entity {
.child( .child(
TextBlock::new() TextBlock::new()
.id(ID_POLICY_CHECK_PROGRESS_TIME) .id(ID_POLICY_CHECK_PROGRESS_TIME)
//.style("textblock_progress") .style("textblock_progress")
.h_align("end") .h_align("end")
.font_size(12)
.text("Processing time") .text("Processing time")
.build(ctx) .build(ctx)
) )

View File

@@ -0,0 +1,328 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use orbtk::shell::event::Key;
use crate::{
data::{
constants::*,
structures::PolicyCheck,
},
//widgets::menu::menu_state::{MenuAction, MenuState},
widgets::policycheck::policycheck_state::{PolicycheckAction, PolicycheckState},
};
// Macro that initializes the widget structures/variables for the policy check view
widget!(
/// Dialog to enter a policy identifier/number.
/// This identifier is checked agains a map of valid policy codes.
// PolicycheckView<PolicycheckState>: KeyDownHandler {
PolicycheckView<PolicycheckState> {
// holds the language code
lang: String,
// provides a struct with `PolicyCheck` members
policy_check: PolicyCheck,
// holds number of imported data
policy_data_count: u32,
// holds the title string
policy_check_title: String,
// widget entity that will receive the message
target: u32
}
);
/// The template implementation of the policy check view
/// All GUI elements are styled using the "style" attribute referencing to a ron based css
impl Template for PolicycheckView {
//fn template(self, policycheck_view: Entity, ctx: &mut BuildContext<'_>) -> Self {
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let tenent_logo = Container::new()
.margin((16, 16, 0, 0))
.attach(Grid::column(0))
.v_align("center")
.child(
ImageWidget::new()
.image("assets/advotracker/hiedemann_logo.png")
.v_align("center")
.build(ctx),
)
.build(ctx);
let policy_check_bottom_bar = Container::new()
.id(ID_POLICY_CHECK_BOTTOM_BAR)
//.style(STYLE_BOTTOM_BAR)
.padding(14)
.attach(Grid::row(4))
.attach(Grid::column(1))
.attach(Grid::column_span(2))
.v_align("end")
.child(
Container::new()
.attach(Grid::column(1))
.h_align("end")
.v_align("end")
.child(
TextBlock::new()
.margin((0, 9, 48, 0))
.text("©Networkx GmbH")
.build(ctx)
)
.build(ctx),
)
.build(ctx);
let policy_check_button_menu = Button::new()
.id(ID_POLICY_CHECK_BUTTON_MENU)
.style("button_single_content")
.icon(material_icons_font::MD_MENU)
.attach(Grid::column(2))
//.min_size(16, 16)
.h_align("end")
.on_click(move |_ctx, _| {
println!("WIP: open menu popup from MenuView");
// ctx.get_mut::<MenuState>(id)
// .set_action(MenuAction::CreateMenu(ID_MENU_STACK));
true
})
.build(ctx);
let policy_check_button_result = Button::new()
.id(ID_POLICY_CHECK_BUTTON_RESULT)
.style("button_single_content")
.attach(Grid::row(0))
.attach(Grid::column(3))
.h_align("start")
.v_align("center")
.visibility(Visibility::Collapsed)
.enabled(false)
.build(ctx);
let policy_check_header_text = TextBlock::new()
.id(ID_POLICY_CHECK_HEADER)
.attach(Grid::column(0))
.style(STYLE_HEADER_TEXT)
.text("Validation policy number")
.build(ctx);
let policy_check_header_bar = Container::new()
.id(ID_POLICY_CHECK_HEADER_BAR)
.attach(Grid::row(0))
.attach(Grid::column_span(3))
.style(STYLE_HEADER_BAR)
.child(tenent_logo)
.child(policy_check_header_text)
.child(policy_check_button_menu)
.build(ctx);
let policy_check_policy_code = TextBlock::new()
.id(ID_POLICY_CHECK_POLICY_CODE)
.style("body")
.attach(Grid::row(2))
.attach(Grid::column(2))
.build(ctx);
let policy_check_form_action = Container::new()
.id(ID_POLICY_CHECK_ACTION_GRID)
.attach(Grid::row(3))
.attach(Grid::column(1))
//.style(STYLE_CONTAINER_ACTION)
.padding(14)
.h_align("center")
.child(
Stack::new()
//.style(STYLE_STACK_ACTION)
.orientation("horizontal")
.spacing(50)
.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
})
.build(ctx),
)
.build(ctx),
)
.build(ctx);
let policy_check_form = Container::new()
.id(ID_POLICY_CHECK_FORM)
.name(ID_POLICY_CHECK_FORM)
.attach(Grid::row(2))
.attach(Grid::column(1))
.style("container_form")
.child(
Grid::new()
.id(ID_POLICY_CHECK_FORM)
.columns(
Columns::create()
.push("auto") // Label
.push("16") // Delimiter
.push("200") // Data
.push("16") // Delimiter
.push("32") // Result-Button
.push("4") // Delimeter
)
.rows(
Rows::create()
.push("auto") // Row 0
.push("14") // Seperator
.push("auto") // Row 2
.push("14") // Seperator
.push("auto") // Row 3
)
//.child(policy_check_form_row_0)
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER)
.style("body")
.attach(Grid::row(0))
.attach(Grid::column(0))
.h_align("end")
.v_align("center")
.text("Policy number")
.build(ctx),
)
.child(
TextBox::new()
.id(ID_POLICY_CHECK_POLICY_NUMBER)
//.style("body")
.attach(Grid::row(0))
.attach(Grid::column(2))
//.lose_focus_on_activation(false)
//WIP: localization for water_mark
.water_mark("10-stellig")
.on_activate(move |states, entity| {
// Entity is entered/activated via Mouse/Keyboard
states.get_mut::<PolicycheckState>(id).parse_policy_number(entity);
})
.on_key_down(move |_, key_event| {
if key_event.key == Key::A(true) {
println!("A key down");
}
// ctx.get_mut::<PolicycheckState>(id)
// .set_action(Action::ImportData);
true
})
.build(ctx)
)
.child(policy_check_button_result)
//.child(policy_check_form_row_2)
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_LABEL_RESULT)
.style("body")
.attach(Grid::row(2))
.attach(Grid::column(0))
.h_align("end")
.v_align("center")
.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()
.id(ID_POLICY_CHECK_LABEL_HINT)
.style("hint")
.attach(Grid::row(4))
.attach(Grid::column(0))
//.margin((0, 0, 16, 0))
.h_align("end")
.v_align("center")
.text("Error:")
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_HINT)
.style("hint")
.attach(Grid::row(4))
.attach(Grid::column(2))
.build(ctx),
)
.build(ctx),
)
.build(ctx);
// row3: only shown, if we read in `policy numbers` in
// a hashmap as values
let policy_data_stack = Stack::new()
.id(ID_POLICY_DATA_STACK)
.attach(Grid::row(3))
.attach(Grid::column(1))
.h_align("end")
.v_align("top")
.orientation("horizontal")
.visibility(Visibility::Collapsed)
.child(
TextBlock::new()
.id(ID_POLICY_DATA_LABEL)
.margin((0, 4, 0, 0))
.enabled(true)
.text("Checklist elements: ")
.build(ctx)
)
.child(
TextBlock::new()
.id(ID_POLICY_DATA_COUNT)
.margin((0, 4, 0, 0))
.enabled(true)
.text("0")
.build(ctx)
)
.build(ctx);
// Starter page: check policy numbers
self.name("PolicycheckView")
// initialize struct (derived default macro)
.policy_check(PolicyCheck::default())
.child(
Grid::new()
.id(ID_POLICY_CHECK_WIDGET)
.columns(
Columns::create()
.push(50) // Left margin
.push("*") // Content
.push(50) // Right margin
)
.rows(
Rows::create()
.push("auto") // Header_Bar
.push(28) // Seperator
.push("*") // InputForm
.push("auto") // Data_Result
.push("auto") // Bottom_Bar
)
.child(policy_check_header_bar) // row 0
.child(policy_check_form) // row 2
.child(policy_data_stack) // row 3
.child(policy_check_form_action) // row 4
.child(policy_check_bottom_bar) // row 5
.build(ctx),
)
}
}

View File

@@ -1,70 +0,0 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::data::constants::*;
widget!(
PolicyCheckMenu {
is_active: Bool
}
);
impl Template for PolicyCheckMenu {
fn template(self, _id: Entity, ctx: &mut BuildContext) -> Self {
// let policy_check_menu_container = Container::new()
// .id(ID_POLICY_CHECK_MENU_CONTAINER)
// .class(CLASS_MENU)
// .attach(Grid::row(3))
// .attach(Grid::column(8))
// .margin((0.0, 0.0, 4.0, 0.0))
// .enabled(false)
// .min_size(120.0, 180.0)
// .v_align("center")
// .on_click(move |ctx, _| {
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::NewEntry(quit));
// true
// })
// .build(ctx);
// let policycheck_menu_container = Container::new()
// .id(ID_POLICY_CHECK_MENU_CONTAINER)
// .background("#dfebf5")
// .width(200.0)
// .height(200.0)
// .child(
// The menu implemented as an overlay
//ctx.append_child_to_overlay(policy_check_menu_button).unwrap();
self.name("PolicyCheckMenu").child(
Stack::new()
.id(ID_POLICY_CHECK_MENU)
.orientation("vertical")
.spacing(8)
.h_align("center")
.child(
Button::new()
.icon(material_icons_font::MD_VERIFIED_USER)
.text("angemeldeter Benutzer")
.margin((0, 8, 0, 0))
.build(ctx),
)
.child(
Button::new()
.icon(material_icons_font::MD_EXIT_TO_APP)
.text("Quit")
.margin((0, 8, 0, 0))
.build(ctx),
)
.build(ctx),
)
}
}

View File

@@ -1,393 +0,0 @@
/*
* advotracker - Hotline tackingtool for Advocats
*
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
* SPDX-License-Identifier: (0BSD or MIT)
*/
use orbtk::prelude::*;
use crate::{
data::constants::*,
data::structures::PolicyCheck,
callbacks::policycheck_state::*,
};
// Macro that initializes the widget structures/variables for our view
widget!(
/// Dialog to enter a policy identifier/number.
/// This identifier is checked agains a map of valid policy codes.
PolicyCheckView<PolicyCheckState> {
lang: String,
policy_check: PolicyCheck,
policy_check_title: String16,
policy_data_count: u32
}
);
/// The template implementation of the policy check view
/// All GUI elements are styled using the "style" attribute referencing to a ron based css
impl Template for PolicyCheckView {
//fn template(self, policycheck_view: Entity, ctx: &mut BuildContext<'_>) -> Self {
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
let policy_check_bottom_bar = Container::new()
//.style(STYLE_BOTTOM_BAR)
.attach(Grid::row(4))
.attach(Grid::column(1))
.attach(Grid::column_span(2))
.v_align("end")
.child(
Container::new()
.child( Container::new()
.margin((0, 16, 16, 0))
.v_align("center")
.child(
ImageWidget::new()
.image("resources/advotracker/hiedemann_logo.png")
.v_align("center")
.build(ctx),
)
.build(ctx),
)
.build(ctx),
)
.child(
Container::new()
.attach(Grid::column(1))
.h_align("end")
.v_align("end")
.child(
TextBlock::new()
.margin((0, 9, 48, 0))
.text("©Networkx GmbH")
.build(ctx)
)
.build(ctx),
)
.build(ctx);
let policy_check_label_menu = TextBlock::new()
.id(ID_POLICY_CHECK_LABEL_MENU)
.style("menu")
.text("Help Menu")
.v_align("center")
.h_align("center")
.build(ctx);
let policy_check_button_menu = Button::new()
.id(ID_POLICY_CHECK_BUTTON_MENU)
.style("button_single_content")
.icon(material_icons_font::MD_MENU)
.attach(Grid::column(2))
//.min_size(16, 16)
.h_align("end")
.on_click(move |ctx, _| {
//ctx.get_mut::<PolicyCheckState>(policycheck_state)
ctx.get_mut::<PolicyCheckState>(id)
.action(Action::OpenMenu(policy_check_label_menu));
true
})
.build(ctx);
let policy_check_button_result = Button::new()
.id(ID_POLICY_CHECK_BUTTON_RESULT)
.style("button_single_content")
.h_align("start")
.v_align("center")
.visibility(Visibility::Collapsed)
.enabled(false)
.build(ctx);
let policy_check_header_bar = Container::new()
.style(STYLE_HEADER_BAR)
.attach(Grid::row(0))
.attach(Grid::column(1))
.attach(Grid::column_span(2))
.child(
Grid::new()
.child(
TextBlock::new()
.style("header")
.id(ID_POLICY_CHECK_HEADER)
.v_align("center")
.h_align("left")
.text("Validation policy number")
.build(ctx),
)
.build(ctx),
)
.child(policy_check_button_menu)
.build(ctx);
let policy_check_form_row_0 = Stack::new()
// 1st row
.id(ID_POLICY_CHECK_FORM_ROW_0)
.attach(Grid::row(0))
.attach(Grid::column(0))
.attach(Grid::column_span(5))
.orientation("horizontal")
.v_align("center")
//.h_align("center")
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_LABEL_POLICY_NUMBER)
.style("body")
.attach(Grid::row(0))
.attach(Grid::column(0))
.margin((0, 0, 16, 0))
.h_align("end")
.v_align("center")
.width(300)
.min_width(300)
.text("Policy number")
.build(ctx),
)
.child(
TextBox::new()
.attach(Grid::row(0))
.attach(Grid::column(2))
.id(ID_POLICY_CHECK_POLICY_NUMBER)
.h_align("start")
.lost_focus_on_activation(false)
//WIP: localization for water_mark
.water_mark("10-stellig")
.on_activate(move |ctx, entity| {
// Entity is entered/activated via Mouse/Keyboard
//ctx.get_mut::<PolicyCheckState>(policy_check_view)
println!("ParseEntry: {:?}", entity);
ctx.get_mut::<PolicyCheckState>(id)
.action(Action::ParseEntry(entity));
})
//.on_changed(|_, entity, _, _| println!("Selection changed: {:?}", entity))
// .on_changed(move |ctx, entity, _| {
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::SetProgressBox(entity));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::AddProgress(0.5));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::InputTextChanged(entity));
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::SetVisibility(entity));
// ctx.get_widget(policy_check_label_policy_number).set("visible");
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::SetVisility(entity));
// })
// .on_mouse_down | .on_mouse_move | .on_mouse_up (move |ctx, entity| {
// state(id, states).action(Action::AddItem);
// })
//.on_key_down(move |ctx, _| {
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::ImportData);
// true
//})
.build(ctx),
)
.child(policy_check_button_result)
.build(ctx);
let policy_check_form_row_1 = Stack::new()
// 2nd row
.id(ID_POLICY_CHECK_FORM_ROW_1)
.attach(Grid::row(1))
.attach(Grid::column(0))
.attach(Grid::column_span(5))
.orientation("horizontal")
.v_align("center")
//.h_align("center")
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_LABEL_RESULT)
.style("body")
.attach(Grid::row(1))
.attach(Grid::column(0))
.margin((0, 0, 16, 0))
.h_align("end")
.v_align("center")
.width(300)
.min_width(300)
.text("Policy code")
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_RESULT)
.style("body")
.attach(Grid::row(1))
.attach(Grid::column(2))
.h_align("start")
.v_align("center")
.build(ctx)
)
.build(ctx);
let policy_check_form_row_2 = Stack::new()
// 3nd row
.id(ID_POLICY_CHECK_FORM_ROW_2)
.attach(Grid::row(2))
.attach(Grid::column(0))
.attach(Grid::column_span(5))
.orientation("horizontal")
.v_align("center")
.h_align("center")
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_LABEL_HINT)
//.style("hint")
.attach(Grid::row(2))
.attach(Grid::column(0))
.margin((0, 0, 16, 0))
.h_align("end")
.v_align("center")
.width(300)
.min_width(300)
.font_size(11.)
.text("Error:")
.build(ctx),
)
.child(
TextBlock::new()
.id(ID_POLICY_CHECK_HINT)
//.style("hint")
.attach(Grid::row(2))
.attach(Grid::column(2))
.h_align("start")
.v_align("center")
.font_size(11)
.build(ctx)
)
.build(ctx);
let policy_check_form = Container::new()
.id(ID_POLICY_CHECK_FORM)
.min_width(420)
.attach(Grid::row(2))
.attach(Grid::column(1))
.style("container_form")
.child(
Grid::new()
.id(ID_POLICY_CHECK_FORM)
.width(450)
.min_width(400)
.columns(
Columns::create()
// Label
.push("300")
// Seperator
.push("16")
// Values
.push("auto")
// Seperator
.push("16")
// Result-Button
.push("32")
//.build(),
)
.rows(
Rows::create()
.push("auto")
.push("auto")
.push("*")
//.build(),
)
.child(policy_check_form_row_0)
.child(policy_check_form_row_1)
.child(policy_check_form_row_2)
.build(ctx),
)
.build(ctx);
// WIP: this widget type should handle our target natively
// but it isn't able to get textinput ... yet
let _policy_check_numeric_box = NumericBox::new()
.id(ID_POLICY_CHECK_POLICY_NUMBER)
.h_align("start")
.width(100)
//.min(<usize>1000000000)
//.max(<usize>9999999999)
.val(0)
.min_width(95)
.margin((0, 0, 0, 16))
// WIP code @kivimango
// .on_activate(move |ctx, entity| {
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::ParseEntry(entity));
// })
// .on_changed(move |ctx, entity| {
// ctx.get_mut::<PolicyCheckState>(id)
// .action(Action::InputTextChanged(entity));
//})
.build(ctx);
let policy_data_stack = Stack::new()
.id(ID_POLICY_DATA_STACK)
.attach(Grid::row(3))
.attach(Grid::column(1))
.h_align("end")
.v_align("top")
.orientation("horizontal")
.visibility(Visibility::Collapsed)
//.spacing("4")
.child(
TextBlock::new()
.id(ID_POLICY_DATA_LABEL)
.margin((0, 4, 0, 0))
.enabled(true)
.text("Checklist elements: ")
.build(ctx)
)
.child(
TextBlock::new()
.id(ID_POLICY_DATA_COUNT)
.margin((0, 4, 0, 0))
.enabled(true)
.text("0")
.build(ctx)
)
.build(ctx);
// Starter page: check policy numbers
self.name("PolicyCheckView")
// initialize struct (derived default macro)
.policy_check(PolicyCheck::default())
.child(
Grid::new()
.id(ID_POLICY_CHECK_WIDGET)
.columns(
Columns::create()
.push(50)
.push("*")
.push(50)
//.build(),
)
.rows(
Rows::create()
.push("auto")
.push(28)
.push("*")
.push("auto")
.push("auto")
//.build(),
)
// row 0: Policy Check Header
.child(policy_check_header_bar)
// row 1: Seperator
// row 2: Policy Check Form
.child(policy_check_form)
// row 3: Sum HashMap elements
.child(policy_data_stack)
// row 4: Policy Check Bottom
.child(policy_check_bottom_bar)
.build(ctx),
)
}
}
// helper to request PolicyCheckState
//fn state<'a>(id: Entity, states: &'a mut StatesContext) -> &'a mut PolicyCheckState {
// states.get_mut(id)
//}

View File

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

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