ой да к чёрту ещё тесты напишу попозже

master
Алексей Алексей 2026-06-21 19:29:39 +10:00
parent 0c88a19a40
commit 409c882383
5 changed files with 3 additions and 65 deletions

View File

@ -1,14 +1,12 @@
# Система управления пивоварней
Система позволяет вести учёт:
- [ ] Оборудования
- [x] Оборудования
- [x] Сотрудников
- [x] Сырья
- [ ] Произведённой продукции
- [ ] Доходов от продажи продукции
- [x] Зарплат сотрудникам
Помимо этого, система позволяет:
- [ ] Составлять рецепты, используя доступное сырьё и оборудование
- [x] Составлять рецепты, используя доступное сырьё и оборудование
- [ ] Использовать рецепты при учёте произведённой продукции, позволяя отслеживать, сколько и какого сырья потребуется на производство определённого объёма продукции.

View File

@ -5,7 +5,6 @@ mod app;
mod database;
mod material_tab;
mod models;
mod payment_tab;
mod production_tab;
mod recipe_tab;
mod reports;

View File

@ -1,53 +0,0 @@
use crate::{
database::DBOperator,
tab::{TABS_CAN_BE_WINDOWS, Tab, TabTypes},
};
/*
* Я не придумал, зачем я сделал данный файл. Мой глупый разум решил, что он нужен.
*/
pub struct PaymentTabViewer {
db_oper: DBOperator,
is_admin: bool,
rt: tokio::runtime::Runtime,
}
impl PaymentTabViewer {
pub fn new(is_admin: bool) -> Self {
Self {
is_admin,
..Default::default()
}
}
}
impl egui_dock::TabViewer for PaymentTabViewer {
type Tab = Tab;
fn title(&mut self, tab: &mut Self::Tab) -> egui::WidgetText {
(&*tab.title).into()
}
fn ui(&mut self, ui: &mut egui::Ui, tab: &mut Self::Tab) {
match &tab.tab_type {
_ => {
ui.label("Nope");
}
}
}
fn id(&mut self, tab: &mut Self::Tab) -> egui::Id {
egui::Id::new(&tab.title)
}
fn allowed_in_windows(&self, _tab: &mut Self::Tab) -> bool {
TABS_CAN_BE_WINDOWS
}
fn is_closeable(&self, _tab: &Self::Tab) -> bool {
!self.is_admin
}
}
impl Default for PaymentTabViewer {
fn default() -> Self {
let rt = tokio::runtime::Runtime::new().unwrap();
let db_oper = rt.block_on(async { DBOperator::new().await });
Self {
db_oper,
rt,
is_admin: false,
}
}
}

View File

@ -1,3 +1 @@
pub struct ProductionTabViewer {
is_admin: bool,
}
struct ProductionTabViewer {}

View File

@ -23,7 +23,6 @@ pub struct RecipeTabViewer {
db_oper: DBOperator,
recipes: Arc<RwLock<Vec<Recipe>>>,
recipe_elements: Arc<RwLock<Vec<RecipeElement>>>,
materials: Arc<RwLock<Vec<Material>>>,
equipment: Arc<RwLock<Vec<Equipment>>>,
@ -299,9 +298,6 @@ impl Default for RecipeTabViewer {
recipes: Arc::new(RwLock::new(
rt.block_on(async { db_oper.get_recipes().await.unwrap_or(Vec::new()) }),
)),
recipe_elements: Arc::new(RwLock::new(
rt.block_on(async { db_oper.get_recipe_elements().await.unwrap_or(Vec::new()) }),
)),
materials: Arc::new(RwLock::new(
rt.block_on(async { db_oper.get_materials().await.unwrap_or(Vec::new()) }),
)),