Ёкарный бабай я ничего не понимаю мне больно и страшно помогите
modified: code/Cargo.lock modified: code/Cargo.toml modified: code/src/app.rs deleted: code/src/lib.rs modified: code/src/main.rs modified: code/src/models.rs new file: code/src/repository.rsmaster
parent
15b9c76b30
commit
9479b2fe27
File diff suppressed because it is too large
Load Diff
|
|
@ -4,6 +4,10 @@ version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
chrono = { version = "0.4.44", features = ["serde"] }
|
||||||
|
diesel = { version = "2.3.9", features = ["mysql", "chrono"] }
|
||||||
eframe = "0.34.2"
|
eframe = "0.34.2"
|
||||||
egui = "0.34.2"
|
egui = "0.34.2"
|
||||||
egui_dock = "0.19.1"
|
egui_dock = "0.19.1"
|
||||||
|
egui_table = "0.8.0"
|
||||||
|
rust_decimal = "1.42.0"
|
||||||
|
|
|
||||||
|
|
@ -38,17 +38,6 @@ impl Default for App{
|
||||||
title: "Сотрудники".to_owned(),
|
title: "Сотрудники".to_owned(),
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// let [a,b] =
|
|
||||||
// tree.main_surface_mut()
|
|
||||||
// .split_left(egui_dock::NodeIndex::root(), 0.3, vec!["tab3".to_owned()]);
|
|
||||||
|
|
||||||
// let [_,_] = tree
|
|
||||||
// .main_surface_mut()
|
|
||||||
// .split_below(a, 0.7, vec!["tab4".to_owned()]);
|
|
||||||
// let [_,_] = tree
|
|
||||||
// .main_surface_mut()
|
|
||||||
// .split_below(b, 0.5, vec!["tab5".to_owned()]);
|
|
||||||
Self{tree}
|
Self{tree}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -64,18 +53,27 @@ impl eframe::App for App{
|
||||||
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame){
|
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame){
|
||||||
DockArea::new(&mut self.tree)
|
DockArea::new(&mut self.tree)
|
||||||
.style(Style::from_egui(ui.style().as_ref()))
|
.style(Style::from_egui(ui.style().as_ref()))
|
||||||
.show_inside(ui, &mut TabViewer {});
|
.show_inside(ui, &mut MainTabViewer {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TabViewer {}
|
struct MainTabViewer {}
|
||||||
impl TabViewer{
|
impl MainTabViewer{
|
||||||
fn show_equipment(&mut self, ui: &mut egui::Ui){
|
fn show_equipment(&mut self, ui: &mut egui::Ui){
|
||||||
ui.label("Equipment");
|
ui.label("Equipment");
|
||||||
}
|
}
|
||||||
|
fn show_worker(&mut self, ui: &mut egui::Ui){
|
||||||
|
ui.label("Worker");
|
||||||
|
}
|
||||||
|
fn show_salary(&mut self, ui: &mut egui::Ui){
|
||||||
|
ui.label("Salary");
|
||||||
|
}
|
||||||
|
fn show_material(&mut self, ui: &mut egui::Ui){
|
||||||
|
ui.label("Сырьё короче да");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl egui_dock::TabViewer for TabViewer{
|
impl egui_dock::TabViewer for MainTabViewer{
|
||||||
type Tab = Tab;
|
type Tab = Tab;
|
||||||
|
|
||||||
fn title(&mut self, tab: &mut Self::Tab) -> egui::WidgetText{
|
fn title(&mut self, tab: &mut Self::Tab) -> egui::WidgetText{
|
||||||
|
|
@ -86,6 +84,15 @@ impl egui_dock::TabViewer for TabViewer{
|
||||||
TabTypes::Equipment => {
|
TabTypes::Equipment => {
|
||||||
&self.show_equipment(ui);
|
&self.show_equipment(ui);
|
||||||
},
|
},
|
||||||
|
TabTypes::Worker => {
|
||||||
|
&self.show_worker(ui);
|
||||||
|
},
|
||||||
|
TabTypes::Salary => {
|
||||||
|
&self.show_salary(ui);
|
||||||
|
},
|
||||||
|
TabTypes::Material => {
|
||||||
|
&self.show_material(ui);
|
||||||
|
}
|
||||||
_ =>{
|
_ =>{
|
||||||
ui.label("This is not");
|
ui.label("This is not");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
mod app;
|
|
||||||
pub use app::App;
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
mod app;
|
||||||
|
mod models;
|
||||||
fn main() -> eframe::Result{
|
fn main() -> eframe::Result{
|
||||||
|
|
||||||
let native_opts = eframe::NativeOptions {
|
let native_opts = eframe::NativeOptions {
|
||||||
|
|
@ -7,6 +9,6 @@ fn main() -> eframe::Result{
|
||||||
.with_min_inner_size([300.0,200.0]),
|
.with_min_inner_size([300.0,200.0]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
eframe::run_native("BCS", native_opts, Box::new(|cc| Ok(Box::new(code::App::new(cc)))),)
|
eframe::run_native("BCS", native_opts, Box::new(|cc| Ok(Box::new(app::App::new(cc)))),)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
struct Position{
|
||||||
|
id: i32,
|
||||||
|
name: String,
|
||||||
|
wage: rust_decimal::Decimal,
|
||||||
|
}
|
||||||
|
struct Worker{
|
||||||
|
id: i32,
|
||||||
|
full_name: String,
|
||||||
|
hire_date: chrono::NaiveDateTime,
|
||||||
|
position: Position,
|
||||||
|
is_fired: bool,
|
||||||
|
}
|
||||||
|
struct Salary{
|
||||||
|
id: i32,
|
||||||
|
worker: Worker,
|
||||||
|
salary_size: rust_decimal::Decimal,
|
||||||
|
salary_date: chrono::NaiveDateTime,
|
||||||
|
}
|
||||||
|
struct Equipment{
|
||||||
|
id: i32,
|
||||||
|
inv_number: String,
|
||||||
|
maintenance_date: chrono::NaiveDateTime,
|
||||||
|
worker: Worker,
|
||||||
|
}
|
||||||
|
struct Material{
|
||||||
|
id: i32,
|
||||||
|
name: String,
|
||||||
|
quantity: i32,
|
||||||
|
category: String
|
||||||
|
}
|
||||||
|
struct RecipeElement{
|
||||||
|
id:i32,
|
||||||
|
material: Material,
|
||||||
|
equipment: Equipment,
|
||||||
|
quantity: i32
|
||||||
|
}
|
||||||
|
struct Recipe{
|
||||||
|
id: i32,
|
||||||
|
name: String,
|
||||||
|
elements: std::vec::Vec<RecipeElement>,
|
||||||
|
}
|
||||||
|
struct Client{
|
||||||
|
id: i32,
|
||||||
|
name: String,
|
||||||
|
address: String
|
||||||
|
}
|
||||||
|
struct Order<'a>{
|
||||||
|
id: i32,
|
||||||
|
client: Client,
|
||||||
|
order_date: chrono::NaiveDateTime,
|
||||||
|
total_amount: rust_decimal::Decimal,
|
||||||
|
elements: std::vec::Vec<OrderElement<'a>>
|
||||||
|
}
|
||||||
|
struct OrderElement<'a>{
|
||||||
|
id: i32,
|
||||||
|
product: Product<'a>,
|
||||||
|
quantity: i32,
|
||||||
|
total_amount: rust_decimal::Decimal
|
||||||
|
}
|
||||||
|
struct Product<'a>{
|
||||||
|
id: i32,
|
||||||
|
recipe: &'a Recipe,
|
||||||
|
volume: f64,
|
||||||
|
price_per_unit: rust_decimal::Decimal,
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue