# vuoanh291104/shotokuzei architecture

> Architecture diagram of the GitHub repository vuoanh291104/shotokuzei, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vuoanh291104/shotokuzei
- Repository: https://github.com/vuoanh291104/shotokuzei

## Overview

##### Main Components
- Application Entry Point: The Main.java file initializes the application.
- View Layer: This consists of the FXML files and related CSS/images under the "src/view" directory. There are subdirectories dedicated to different user roles (accountant, departmentHead, staff), each with its own view definitions.
- Controller Layer: The controllers in "src/controller" (such as LoginController, AlertController, QueryController, etc.) handle user interactions, navigation, and connecting the view with the model.
- Model Layer: The models in "src/model" contain the business logic and data representations (e.g., Person, NhanVien, SalaryData, TaxCalculator, etc.). The TaxCalculator is central to the core function of calculating personal income tax.
- Database Connectivity: The "ConnectDB.java" controller suggests that the application interacts with a database, so include a component representing the database for persistent storage.
- External Dependencies: Although not explicitly detailed in the file tree, note any libraries or JavaFX frameworks used for building the UI and handling business logic.

##### Relationships and Interactions
- The Main Application (Main.java) initializes the application context and likely sets up the connection between the view and controllers.
- Controllers act as intermediaries between the view and model. For example, the loginController handles authentication, while the QueryController, MessageController, and others trigger operations on the TaxCalculator and other model classes.
- The view components (FXML files) are bound to specific controllers which manage user input events and represent data from model objects.
- The ConnectDB component indicates interactions with an external database for operations like retrieving employee data or recording tax computations.

##### Architectural Patterns and Technologies
- MVC Pattern: Clearly divide the system into models (data and business logic), views (UI defined in FXML and styled with CSS), and controllers (handling logic and interactions).
- JavaFX Framework: The use of FXML and CSS in the "view" directory points to a JavaFX-based UI.
- Layered Architecture: The separation between responsible packages (controllers, models, views) ensures maintainability and clear responsibility division.
- Database Integration: The presence of a ConnectDB controller highlights that database connectivity is a key component of the system.

##### Final Recommendations
- Validate that all major components from the file structure (controllers, models, views, database connectivity) are represented.
- The focus should be on clearly showing how personal income tax is calculated step-by-step (from user input in the view, through the controllers handling the logic, to the model processing the business logic with TaxCalculator) and then any subsequent database operations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Entry Point
    Main["Application Entry Point: Main.java"]:::entry

    %% View Layer
    subgraph "View Layer"
        LoginView["Login View (FXML)"]:::view
        AccountantView["Accountant Views (FXML)"]:::view
        DeptHeadView["Department Head Views (FXML)"]:::view
        StaffView["Staff Views (FXML)"]:::view
        GlobalStyles["Global Styles & Images"]:::view
    end

    %% Controller Layer
    subgraph "Controller Layer"
        Controllers["All Controllers"]:::controller
        ConnectDB["Database Connectivity: ConnectDB"]:::controller
    end

    %% Model Layer
    subgraph "Model Layer"
        Models["Business Logic & Data Models"]:::model
    end

    %% External Database
    DB["Database"]:::database

    %% Relationships
    Main -->|"initializes"| LoginView
    Main -->|"initializes"| AccountantView
    Main -->|"initializes"| DeptHeadView
    Main -->|"initializes"| StaffView
    Main -->|"sets-up"| Controllers

    %% User interactions from views to controllers
    LoginView -->|"triggers authentication"| Controllers
    AccountantView -->|"triggers operations"| Controllers
    DeptHeadView -->|"triggers operations"| Controllers
    StaffView -->|"triggers operations"| Controllers
    GlobalStyles -->|"styles UI"| LoginView

    %% Controllers interactions with Models and Views
    Controllers -->|"processes data"| Models
    Controllers -->|"updates UI"| LoginView
    Controllers -->|"updates UI"| AccountantView
    Controllers -->|"updates UI"| DeptHeadView
    Controllers -->|"updates UI"| StaffView

    %% Specific tax calculation flow example
    Controllers -- "triggers tax calculation" --> Models

    %% Database connectivity
    ConnectDB -->|"retrieves/saves data"| DB
    Models -->|"persists data via"| ConnectDB

    %% Styling classes
    classDef entry fill:#d1d1e0,stroke:#333,stroke-width:2px;
    classDef view fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef controller fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef model fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef database fill:#f8d7da,stroke:#333,stroke-width:2px;

    %% Click Events
    click Main "https://github.com/vuoanh291104/shotokuzei/blob/main/Shotokuzei/src/Main.java"
    click LoginView "https://github.com/vuoanh291104/shotokuzei/blob/main/Shotokuzei/src/view/login.fxml"
    click AccountantView "https://github.com/vuoanh291104/shotokuzei/tree/main/Shotokuzei/src/view/accountant"
    click DeptHeadView "https://github.com/vuoanh291104/shotokuzei/tree/main/Shotokuzei/src/view/departmentHead"
    click StaffView "https://github.com/vuoanh291104/shotokuzei/tree/main/Shotokuzei/src/view/staff"
    click GlobalStyles "https://github.com/vuoanh291104/shotokuzei/blob/main/Shotokuzei/src/view/css/style.css"
    click Controllers "https://github.com/vuoanh291104/shotokuzei/tree/main/Shotokuzei/src/controller"
    click ConnectDB "https://github.com/vuoanh291104/shotokuzei/blob/main/Shotokuzei/src/controller/ConnectDB.java"
    click Models "https://github.com/vuoanh291104/shotokuzei/tree/main/Shotokuzei/src/model"
```
