ctb_io_webui/controllers/calculator.rs
1// SPDX-License-Identifier: AGPL-3.0-or-later
2/*
3This file is part of Collective Toolbox, a database and document workspace and utilities.
4Copyright (C) 2026 Collective Toolbox Developers
5Contact: info@collectivetoolbox.com
6
7This program is free software: you can redistribute it and/or modify it under
8the terms of the GNU Affero General Public License as published by the Free
9Software Foundation, either version 3 of the License, or (at your option) any
10later version.
11
12This program is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
15
16You should have received a copy of the GNU Affero General Public License along
17with this program. If not, see <https://www.gnu.org/licenses/>.
18*/
19
20//! View controllers for Calculator and Center of Gravity tools.
21
22#[allow(
23 unused_imports,
24 clippy::wildcard_imports,
25 reason = "Standard workspace module prelude"
26)]
27use crate::utilities::*;
28
29use axum::{extract::State, response::Response};
30
31use crate::json_value;
32use crate::session_auth::AuthenticatedUser;
33use crate::{AppState, RequestState, respond_page};
34
35/// Renders the classic Calculator tool page.
36pub async fn get_calculator(
37 State(state): State<AppState>,
38 req: RequestState,
39 _user: AuthenticatedUser,
40) -> Response {
41 respond_page(&state, req, "tools.calculator.index", &json_value!({}))
42}
43
44/// Renders the aircraft Center of Gravity calculator page.
45pub async fn get_center_of_gravity(
46 State(state): State<AppState>,
47 req: RequestState,
48 _user: AuthenticatedUser,
49) -> Response {
50 respond_page(
51 &state,
52 req,
53 "tools.calculator.center-of-gravity",
54 &json_value!({}),
55 )
56}