advotracker: callback: update
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -12,9 +12,9 @@ use serde::Deserialize;
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::{error::Error, process};
|
use std::{error::Error, process};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use tracing::{debug, trace, span, Level};
|
use tracing::{debug, trace, Level};
|
||||||
|
|
||||||
use advotracker::data::{PolicyCode, PolicyList, PolicyDataList, PolicyData};
|
use advotracker::data::structures::{PolicyCode, PolicyList, PolicyDataList, PolicyData};
|
||||||
|
|
||||||
// include modules
|
// include modules
|
||||||
mod parse_args;
|
mod parse_args;
|
||||||
|
|||||||
@@ -7,10 +7,11 @@
|
|||||||
|
|
||||||
use orbtk::prelude::*;
|
use orbtk::prelude::*;
|
||||||
|
|
||||||
use crate::{
|
//use crate::data::keys;
|
||||||
//data::structures::PolicyList,
|
// use crate::{
|
||||||
data::keys::*
|
// //data::structures::PolicyList,
|
||||||
};
|
// data::keys::*
|
||||||
|
// };
|
||||||
|
|
||||||
/// Provides generic methods to handle states of datatypes (e.g. used in `PolicyList`).
|
/// Provides generic methods to handle states of datatypes (e.g. used in `PolicyList`).
|
||||||
pub trait GlobalState {
|
pub trait GlobalState {
|
||||||
|
|||||||
@@ -7,17 +7,17 @@
|
|||||||
|
|
||||||
use chrono::{Local, DateTime};
|
use chrono::{Local, DateTime};
|
||||||
use locales::t;
|
use locales::t;
|
||||||
use serde::Deserialize;
|
//use serde::Deserialize;
|
||||||
use std::env;
|
//use std::env;
|
||||||
use std::{error::Error, process};
|
//use std::{error::Error, process};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use tracing::{debug, trace, Level};
|
use tracing::{info, trace};
|
||||||
|
|
||||||
use crate::data::structures::{PolicyCode, PolicyDataList, PolicyData, PolicyList};
|
use crate::data::structures::{PolicyCode, PolicyDataList};
|
||||||
|
|
||||||
/// validate a given policy number
|
/// validate a given policy number
|
||||||
/// result will return true or false
|
/// result will return true or false
|
||||||
fn is_valid(policy_number: &usize, policy_list: &PolicyDataList,
|
pub fn is_valid(policy_number: &usize, policy_list: &PolicyDataList,
|
||||||
policy_numbers: &mut HashMap<usize, PolicyCode>, lang: &String)
|
policy_numbers: &mut HashMap<usize, PolicyCode>, lang: &String)
|
||||||
-> Result<bool, Box<dyn std::error::Error>> {
|
-> Result<bool, Box<dyn std::error::Error>> {
|
||||||
|
|
||||||
@@ -39,6 +39,7 @@ fn is_valid(policy_number: &usize, policy_list: &PolicyDataList,
|
|||||||
let res = t!("policy.validation.success", lang);
|
let res = t!("policy.validation.success", lang);
|
||||||
println!("policy_number: {} ({:?})",
|
println!("policy_number: {} ({:?})",
|
||||||
policy_number, policy_code);
|
policy_number, policy_code);
|
||||||
|
info!("{} => {} ({:?})", res, policy_number, policy_code);
|
||||||
result = true;
|
result = true;
|
||||||
trace!(target: "csv-test",
|
trace!(target: "csv-test",
|
||||||
policy_number = ?policy_number,
|
policy_number = ?policy_number,
|
||||||
@@ -48,6 +49,7 @@ fn is_valid(policy_number: &usize, policy_list: &PolicyDataList,
|
|||||||
_ => {
|
_ => {
|
||||||
let res = t!("policy.validation.failed", lang);
|
let res = t!("policy.validation.failed", lang);
|
||||||
println!("Noop! Number isn't valid!");
|
println!("Noop! Number isn't valid!");
|
||||||
|
info!("{} => {}", res, policy_number);
|
||||||
trace!(target: "csv-test",
|
trace!(target: "csv-test",
|
||||||
policy_number = ?policy_number,
|
policy_number = ?policy_number,
|
||||||
validation = ?res);
|
validation = ?res);
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
* SPDX-License-Identifier: (0BSD or MIT)
|
* SPDX-License-Identifier: (0BSD or MIT)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use chrono::{Local, DateTime};
|
//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::{env, process};
|
||||||
use std::{error::Error, process};
|
//use std::{error::Error, process};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use tracing::{debug, trace, span, Level};
|
use tracing::{debug, trace, Level};
|
||||||
|
|
||||||
use orbtk::prelude::*;
|
use orbtk::prelude::*;
|
||||||
use orbtk::theme::DEFAULT_THEME_CSS;
|
use orbtk::theme::DEFAULT_THEME_CSS;
|
||||||
@@ -21,30 +21,6 @@ use orbtk::theme::DEFAULT_THEME_CSS;
|
|||||||
// The Main view
|
// The Main view
|
||||||
use advotracker::widgets::main_view;
|
use advotracker::widgets::main_view;
|
||||||
|
|
||||||
//use advotracker::services;
|
|
||||||
//use advotracker::sercices::policy_check::{import};
|
|
||||||
|
|
||||||
// helper modules
|
|
||||||
//pub mod base_state;
|
|
||||||
//pub mod keys;
|
|
||||||
|
|
||||||
// the frontend
|
|
||||||
//pub mod main_view;
|
|
||||||
|
|
||||||
// validation check of a policy data element given by its poliy code
|
|
||||||
//pub mod policycheck_view;
|
|
||||||
//ub mod policycheck_state;
|
|
||||||
//pub mod policycheck_menu;
|
|
||||||
|
|
||||||
// // manage list of policy data structures
|
|
||||||
// pub mod policylist_view;
|
|
||||||
// pub mod policylist_state;
|
|
||||||
|
|
||||||
// // manage policy data elements
|
|
||||||
// pub mod policydata_view;
|
|
||||||
// pub mod policydata_state;
|
|
||||||
// include modules
|
|
||||||
|
|
||||||
mod parse_args;
|
mod parse_args;
|
||||||
|
|
||||||
/// respect environment variables set in .env files
|
/// respect environment variables set in .env files
|
||||||
@@ -74,10 +50,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
use tracing_subscriber::fmt;
|
use tracing_subscriber::fmt;
|
||||||
use viperus::Viperus;
|
use viperus::Viperus;
|
||||||
|
|
||||||
use advotracker::services::policy_check::*;
|
//use advotracker::callbacks::policy_check::is_valid;
|
||||||
use advotracker::services::imports::allianzdirectcall::*;
|
use advotracker::services::imports::allianzdirectcall::*;
|
||||||
//use advotracker::data;
|
use advotracker::data::structures::{PolicyCode, PolicyDataList, PolicyList};
|
||||||
use advotracker::data::structures::{PolicyCode, PolicyDataList, PolicyData, PolicyList};
|
|
||||||
|
|
||||||
//static DEFAULT_FILTER: &str = concat!(module_path!(), "=", "trace");
|
//static DEFAULT_FILTER: &str = concat!(module_path!(), "=", "trace");
|
||||||
|
|
||||||
|
|||||||
@@ -8,22 +8,7 @@
|
|||||||
use orbtk::prelude::*;
|
use orbtk::prelude::*;
|
||||||
|
|
||||||
use crate::data::structures::PolicyCheck;
|
use crate::data::structures::PolicyCheck;
|
||||||
use crate::widgets::policycheck_view;
|
use crate::widgets::policycheck_view::PolicyCheckView;
|
||||||
//use policycheck_view::PolicyCheckView::*;
|
|
||||||
//data::{PolicyCheck, PolicyList, PolicyDataList},
|
|
||||||
// policylist_view::PolicyListView,
|
|
||||||
// policydata_view::PolicyDataView
|
|
||||||
|
|
||||||
//use advotracker::data::PolicyCheckView;
|
|
||||||
|
|
||||||
// use advotracker::{
|
|
||||||
// //data::{PolicyList, PolicyData},
|
|
||||||
// policycheck_view::*,
|
|
||||||
// //policylist_view::*,
|
|
||||||
// //PolicyListView,
|
|
||||||
// //policydata_view::*,
|
|
||||||
// //PolicyDataList
|
|
||||||
//};
|
|
||||||
|
|
||||||
widget!(MainView {
|
widget!(MainView {
|
||||||
// policy_list_count: usize,
|
// policy_list_count: usize,
|
||||||
@@ -55,7 +40,7 @@ impl Template for MainView {
|
|||||||
|
|
||||||
self.name("MainView")
|
self.name("MainView")
|
||||||
//.policy_list_count(0)
|
//.policy_list_count(0)
|
||||||
// //.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())
|
||||||
|
|||||||
Reference in New Issue
Block a user