MOre web bs
This commit is contained in:
parent
1ecbdde2c0
commit
7d9d95fcd2
55
src/web/pages/clients/add.rs
Normal file
55
src/web/pages/clients/add.rs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::db::models::Client;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "clients/index.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
pub clients: Vec<Client>
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
use diesel::prelude::*;
|
||||
use crate::db::schema::clients::dsl::*;
|
||||
|
||||
let results = clients
|
||||
.order(id.asc())
|
||||
.limit(50)
|
||||
.load::<Client>(&mut pool.get()?)?;
|
||||
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
clients: results
|
||||
};
|
||||
|
||||
template.set_title("Clients");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
55
src/web/pages/clients/edit.rs
Normal file
55
src/web/pages/clients/edit.rs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::db::models::Client;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "clients/index.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
pub clients: Vec<Client>
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
use diesel::prelude::*;
|
||||
use crate::db::schema::clients::dsl::*;
|
||||
|
||||
let results = clients
|
||||
.order(id.asc())
|
||||
.limit(50)
|
||||
.load::<Client>(&mut pool.get()?)?;
|
||||
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
clients: results
|
||||
};
|
||||
|
||||
template.set_title("Clients");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,11 @@ use crate::db::DbPool;
|
|||
use crate::db::models::Client;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
pub mod add;
|
||||
pub mod edit;
|
||||
pub mod view;
|
||||
pub mod remove;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "clients/index.html")]
|
||||
pub struct PageTemplate {
|
||||
|
|
@ -32,7 +37,7 @@ pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
|||
|
||||
let results = clients
|
||||
.order(id.asc())
|
||||
.limit(50)
|
||||
.limit(100)
|
||||
.load::<Client>(&mut pool.get()?)?;
|
||||
|
||||
let mut template = PageTemplate {
|
||||
|
|
|
|||
55
src/web/pages/clients/remove.rs
Normal file
55
src/web/pages/clients/remove.rs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::db::models::Client;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "clients/index.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
pub clients: Vec<Client>
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
use diesel::prelude::*;
|
||||
use crate::db::schema::clients::dsl::*;
|
||||
|
||||
let results = clients
|
||||
.order(id.asc())
|
||||
.limit(50)
|
||||
.load::<Client>(&mut pool.get()?)?;
|
||||
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
clients: results
|
||||
};
|
||||
|
||||
template.set_title("Clients");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
55
src/web/pages/clients/view.rs
Normal file
55
src/web/pages/clients/view.rs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::db::models::Client;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "clients/index.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
pub clients: Vec<Client>
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
use diesel::prelude::*;
|
||||
use crate::db::schema::clients::dsl::*;
|
||||
|
||||
let results = clients
|
||||
.order(id.asc())
|
||||
.limit(50)
|
||||
.load::<Client>(&mut pool.get()?)?;
|
||||
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
clients: results
|
||||
};
|
||||
|
||||
template.set_title("Clients");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
|
||||
pub mod services;
|
||||
pub mod clients;
|
||||
pub mod inventory;
|
||||
pub mod tickets;
|
||||
|
|
|
|||
44
src/web/pages/services/add.rs
Normal file
44
src/web/pages/services/add.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "services/add.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(_pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
};
|
||||
|
||||
template.set_title("Assigning a service");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/web/pages/services/catalog/add.rs
Normal file
44
src/web/pages/services/catalog/add.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "services/catalog/add.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(_pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
};
|
||||
|
||||
template.set_title("Adding a service to the catalog");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/web/pages/services/catalog/edit.rs
Normal file
44
src/web/pages/services/catalog/edit.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "services/catalog/edit.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(_pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
};
|
||||
|
||||
template.set_title("Editing a service in the catalog");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
48
src/web/pages/services/catalog/mod.rs
Normal file
48
src/web/pages/services/catalog/mod.rs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
pub mod add;
|
||||
pub mod edit;
|
||||
pub mod view;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "services/catalog/index.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(_pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
};
|
||||
|
||||
template.set_title("Clients");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/web/pages/services/catalog/view.rs
Normal file
44
src/web/pages/services/catalog/view.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "services/catalog/view.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(_pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
};
|
||||
|
||||
template.set_title("Service from the catalog");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
49
src/web/pages/services/mod.rs
Normal file
49
src/web/pages/services/mod.rs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
pub mod catalog;
|
||||
pub mod view;
|
||||
pub mod add;
|
||||
pub mod remove;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "services/index.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(_pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
};
|
||||
|
||||
template.set_title("Services");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/web/pages/services/remove.rs
Normal file
44
src/web/pages/services/remove.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "services/remove.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(_pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
};
|
||||
|
||||
template.set_title("Removing a service");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/web/pages/services/view.rs
Normal file
44
src/web/pages/services/view.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use askama::Template;
|
||||
use axum::extract::State;
|
||||
use axum::response::{Html, IntoResponse, Response};
|
||||
use axum::http::StatusCode;
|
||||
|
||||
use crate::db::DbPool;
|
||||
use crate::web::pages::{BaseTemplate, BaseTemplateCtx};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "services/view.html")]
|
||||
pub struct PageTemplate {
|
||||
pub ctx: BaseTemplateCtx,
|
||||
}
|
||||
|
||||
impl BaseTemplate for PageTemplate {
|
||||
fn ctx(&self) -> &BaseTemplateCtx {
|
||||
&self.ctx
|
||||
}
|
||||
fn ctx_mut(&mut self) -> &mut BaseTemplateCtx {
|
||||
&mut self.ctx
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[axum::debug_handler]
|
||||
pub async fn get_page(State(pool): State<DbPool>) -> Response {
|
||||
async fn inner(_pool: &DbPool) -> anyhow::Result<(StatusCode, String)> {
|
||||
let mut template = PageTemplate {
|
||||
ctx: Default::default(),
|
||||
};
|
||||
|
||||
template.set_title("Service");
|
||||
|
||||
Ok((StatusCode::OK, template.render()?))
|
||||
}
|
||||
|
||||
match inner(&pool).await {
|
||||
Ok((status, s)) => (status, Html(s)).into_response(),
|
||||
Err(e) => {
|
||||
let s = crate::web::pages::error::get_error_page(e.to_string()).await;
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, Html(s)).into_response()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,14 +5,19 @@ body,html {
|
|||
}
|
||||
|
||||
.nav {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
top: 0;
|
||||
list-style: none;
|
||||
gap: 10px;
|
||||
background: gray;
|
||||
padding: 8px;
|
||||
margin: 0px;
|
||||
width: 99.5%;
|
||||
}
|
||||
main {
|
||||
padding-top: 50px
|
||||
}
|
||||
|
||||
.right {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
|
@ -40,8 +45,8 @@ body,html {
|
|||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
padding-left: 10px;
|
||||
41
static/css/clients/index.css
Normal file
41
static/css/clients/index.css
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
|
||||
.table {
|
||||
margin: 0 auto;
|
||||
width: 80%;
|
||||
font-size: 0.95rem;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
border-collapse: collapse;
|
||||
border: 5px double black;
|
||||
}
|
||||
|
||||
|
||||
.table-header {
|
||||
border: 5px double black;
|
||||
}
|
||||
|
||||
.table-header-item {
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
padding-left: 5px;
|
||||
padding-right: 1px;
|
||||
border: 1px solid black;
|
||||
border-left: 0.5px thin gray;
|
||||
border-right: 0.5px thin gray;
|
||||
}
|
||||
|
||||
|
||||
.table-body {
|
||||
border: 5px double black;
|
||||
}
|
||||
|
||||
.table-cell {
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
padding-left: 5px;
|
||||
padding-right: 1px;
|
||||
border: 1px solid black;
|
||||
border-left: 0.5px thin gray;
|
||||
border-right: 0.5px thin gray;
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ self.title() }}</title>
|
||||
<link rel="stylesheet" href="/static/base.css">
|
||||
<link rel="stylesheet" href="/static/css/base.css">
|
||||
{% block headers %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
0
templates/clients/add.html
Normal file
0
templates/clients/add.html
Normal file
0
templates/clients/edit.html
Normal file
0
templates/clients/edit.html
Normal file
|
|
@ -1,31 +1,38 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block headers %}
|
||||
<link rel="stylesheet" href="/static/css/clients/index.css">
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<table>
|
||||
<tr>
|
||||
<td>First Name</td>
|
||||
<td>Last Name</td>
|
||||
<td>Address</td>
|
||||
<td>Number</td>
|
||||
<td>Email</td>
|
||||
</tr>
|
||||
{% for client in clients %}
|
||||
<tr>
|
||||
<td>{{ client.first_name }}</td>
|
||||
<td>{{ client.last_name }}</td>
|
||||
<td>
|
||||
{{ client.country}}
|
||||
{{ client.city}}
|
||||
{{ client.state}}
|
||||
{{ client.address_line}}
|
||||
{{ client.house_number}}
|
||||
{{ client.postal_code}}
|
||||
</td>
|
||||
<td>{{ client.phone_number }}</td>
|
||||
<td>{{ client.email }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<table class="table">
|
||||
<thead class="table-header">
|
||||
<tr class="table-row">
|
||||
<td class="table-header-item">First Name</td>
|
||||
<td class="table-header-item">Last Name</td>
|
||||
<td class="table-header-item">Address</td>
|
||||
<td class="table-header-item">Number</td>
|
||||
<td class="table-header-item">Email</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-body">
|
||||
{% for client in clients %}
|
||||
<tr class="table-row">
|
||||
<td class="table-cell">{{ client.first_name }}</td>
|
||||
<td class="table-cell">{{ client.last_name }}</td>
|
||||
<td class="table-cell">
|
||||
{{ client.country}}
|
||||
{{ client.city}}
|
||||
{{ client.state}}
|
||||
{{ client.address_line}}
|
||||
{{ client.house_number}}
|
||||
{{ client.postal_code}}
|
||||
</td>
|
||||
<td class="table-cell">{{ client.phone_number }}</td>
|
||||
<td class="table-cell">{{ client.email }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
|
|
|||
0
templates/clients/remove.html
Normal file
0
templates/clients/remove.html
Normal file
0
templates/inventory/catalog/add.html
Normal file
0
templates/inventory/catalog/add.html
Normal file
0
templates/inventory/catalog/edit.html
Normal file
0
templates/inventory/catalog/edit.html
Normal file
0
templates/inventory/catalog/remove.html
Normal file
0
templates/inventory/catalog/remove.html
Normal file
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block headers %}
|
||||
<link rel="stylesheet" href="/static/login.css">
|
||||
<link rel="stylesheet" href="/static/css/login.css">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
|
|
|||
0
templates/services/add.html
Normal file
0
templates/services/add.html
Normal file
0
templates/services/catalog/add.html
Normal file
0
templates/services/catalog/add.html
Normal file
0
templates/services/catalog/edit.html
Normal file
0
templates/services/catalog/edit.html
Normal file
7
templates/services/catalog/index.html
Normal file
7
templates/services/catalog/index.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
{% block headers %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Hewwo wowld!!!!
|
||||
{% endblock %}
|
||||
0
templates/services/catalog/view.html
Normal file
0
templates/services/catalog/view.html
Normal file
7
templates/services/index.html
Normal file
7
templates/services/index.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
{% block headers %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
Hewwo wowld!!!!
|
||||
{% endblock %}
|
||||
0
templates/services/remove.html
Normal file
0
templates/services/remove.html
Normal file
0
templates/services/view.html
Normal file
0
templates/services/view.html
Normal file
0
templates/tickets/view.html
Normal file
0
templates/tickets/view.html
Normal file
Loading…
Reference in New Issue
Block a user