feat: bootstrap ordering templates
This commit is contained in:
parent
5c6e8dec86
commit
58edaf8cdb
41 changed files with 1105 additions and 53 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
@ -13,15 +12,11 @@ use url::Url;
|
||||||
pub use super::*;
|
pub use super::*;
|
||||||
use crate::utils::*;
|
use crate::utils::*;
|
||||||
|
|
||||||
pub const ADD_BILL_PAGE: TemplateFile = TemplateFile::new(
|
pub const ADD_BILL_PAGE: TemplateFile =
|
||||||
"billing.add_bill",
|
TemplateFile::new("billing.add_bill", "billing/add_bill.html");
|
||||||
"billing/add_bill.html",
|
|
||||||
);
|
|
||||||
|
|
||||||
pub fn register_templates(t: &mut tera::Tera) {
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
ADD_BILL_PAGE
|
ADD_BILL_PAGE.register(t).expect(ADD_BILL_PAGE.name);
|
||||||
.register(t)
|
|
||||||
.expect(ADD_BILL_PAGE.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct AddBillPage {
|
pub struct AddBillPage {
|
||||||
|
@ -65,5 +60,4 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
tw.write();
|
tw.write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
@ -13,10 +12,8 @@ use url::Url;
|
||||||
pub use super::*;
|
pub use super::*;
|
||||||
use crate::utils::*;
|
use crate::utils::*;
|
||||||
|
|
||||||
pub const ADD_LINE_ITEM_PAGE: TemplateFile = TemplateFile::new(
|
pub const ADD_LINE_ITEM_PAGE: TemplateFile =
|
||||||
"billing.add_line_item",
|
TemplateFile::new("billing.add_line_item", "billing/add_line_item.html");
|
||||||
"billing/add_line_item.html",
|
|
||||||
);
|
|
||||||
|
|
||||||
pub fn register_templates(t: &mut tera::Tera) {
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
ADD_LINE_ITEM_PAGE
|
ADD_LINE_ITEM_PAGE
|
||||||
|
@ -65,5 +62,4 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
tw.write();
|
tw.write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
@ -13,15 +12,11 @@ use url::Url;
|
||||||
pub use super::*;
|
pub use super::*;
|
||||||
use crate::utils::*;
|
use crate::utils::*;
|
||||||
|
|
||||||
pub const DELETE_BILL_PAGE: TemplateFile = TemplateFile::new(
|
pub const DELETE_BILL_PAGE: TemplateFile =
|
||||||
"billing.delete_bill",
|
TemplateFile::new("billing.delete_bill", "billing/delete_bill.html");
|
||||||
"billing/delete_bill.html",
|
|
||||||
);
|
|
||||||
|
|
||||||
pub fn register_templates(t: &mut tera::Tera) {
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
DELETE_BILL_PAGE
|
DELETE_BILL_PAGE.register(t).expect(DELETE_BILL_PAGE.name);
|
||||||
.register(t)
|
|
||||||
.expect(DELETE_BILL_PAGE.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct DeleteBillPage {
|
pub struct DeleteBillPage {
|
||||||
|
@ -65,4 +60,4 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
tw.write();
|
tw.write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,8 @@ use url::Url;
|
||||||
pub use super::*;
|
pub use super::*;
|
||||||
use crate::utils::*;
|
use crate::utils::*;
|
||||||
|
|
||||||
pub const DELETE_LINE_ITEM_PAGE: TemplateFile = TemplateFile::new(
|
pub const DELETE_LINE_ITEM_PAGE: TemplateFile =
|
||||||
"billing.delete_line_item",
|
TemplateFile::new("billing.delete_line_item", "billing/delete_line_item.html");
|
||||||
"billing/delete_line_item.html",
|
|
||||||
);
|
|
||||||
|
|
||||||
pub fn register_templates(t: &mut tera::Tera) {
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
DELETE_LINE_ITEM_PAGE
|
DELETE_LINE_ITEM_PAGE
|
||||||
|
@ -64,4 +62,4 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
tw.write();
|
tw.write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
pub mod add_bill;
|
pub mod add_bill;
|
||||||
pub mod update_bill;
|
|
||||||
pub mod delete_bill;
|
|
||||||
pub mod add_line_item;
|
pub mod add_line_item;
|
||||||
pub mod update_line_item;
|
pub mod delete_bill;
|
||||||
pub mod delete_line_item;
|
pub mod delete_line_item;
|
||||||
|
pub mod update_bill;
|
||||||
|
pub mod update_line_item;
|
||||||
|
|
||||||
pub fn register_templates(t: &mut tera::Tera) {
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
for template in [
|
for template in [
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
@ -13,15 +12,11 @@ use url::Url;
|
||||||
pub use super::*;
|
pub use super::*;
|
||||||
use crate::utils::*;
|
use crate::utils::*;
|
||||||
|
|
||||||
pub const UPDATE_BILL_PAGE: TemplateFile = TemplateFile::new(
|
pub const UPDATE_BILL_PAGE: TemplateFile =
|
||||||
"billing.update_bill",
|
TemplateFile::new("billing.update_bill", "billing/update_bill.html");
|
||||||
"billing/update_bill.html",
|
|
||||||
);
|
|
||||||
|
|
||||||
pub fn register_templates(t: &mut tera::Tera) {
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
UPDATE_BILL_PAGE
|
UPDATE_BILL_PAGE.register(t).expect(UPDATE_BILL_PAGE.name);
|
||||||
.register(t)
|
|
||||||
.expect(UPDATE_BILL_PAGE.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct UpdateBillPage {
|
pub struct UpdateBillPage {
|
||||||
|
@ -65,5 +60,4 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
tw.write();
|
tw.write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
@ -13,10 +12,8 @@ use url::Url;
|
||||||
pub use super::*;
|
pub use super::*;
|
||||||
use crate::utils::*;
|
use crate::utils::*;
|
||||||
|
|
||||||
pub const UPDATE_LINE_ITEM_PAGE: TemplateFile = TemplateFile::new(
|
pub const UPDATE_LINE_ITEM_PAGE: TemplateFile =
|
||||||
"billing.update_line_item",
|
TemplateFile::new("billing.update_line_item", "billing/update_line_item.html");
|
||||||
"billing/update_line_item.html",
|
|
||||||
);
|
|
||||||
|
|
||||||
pub fn register_templates(t: &mut tera::Tera) {
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
UPDATE_LINE_ITEM_PAGE
|
UPDATE_LINE_ITEM_PAGE
|
||||||
|
@ -65,5 +62,4 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
tw.write();
|
tw.write();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
pub mod billing;
|
||||||
pub mod identity;
|
pub mod identity;
|
||||||
pub mod inventory;
|
pub mod inventory;
|
||||||
mod log;
|
mod log;
|
||||||
|
pub mod ordering;
|
||||||
mod utils;
|
mod utils;
|
||||||
pub mod billing;
|
|
||||||
|
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
lazy_static::initialize(&utils::TEMPLATES);
|
lazy_static::initialize(&utils::TEMPLATES);
|
||||||
|
|
69
web_ui/src/ordering/add_category.rs
Normal file
69
web_ui/src/ordering/add_category.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const ADD_CATEGORY_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.add_category",
|
||||||
|
"ordering/add_category.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
ADD_CATEGORY_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(ADD_CATEGORY_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AddCategoryPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AddCategoryPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(ADD_CATEGORY_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-add_category.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(AddCategoryPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/add_customization.rs
Normal file
69
web_ui/src/ordering/add_customization.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const ADD_CUSTOMIZATION_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.add_customization",
|
||||||
|
"ordering/add_customization.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
ADD_CUSTOMIZATION_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(ADD_CUSTOMIZATION_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AddCustomizationPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AddCustomizationPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(ADD_CUSTOMIZATION_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-add_customization.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(AddCustomizationPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/add_kot.rs
Normal file
69
web_ui/src/ordering/add_kot.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const ADD_KOT_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.add_kot",
|
||||||
|
"ordering/add_kot.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
ADD_KOT_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(ADD_KOT_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AddKotPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AddKotPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(ADD_KOT_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-add_kot.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(AddKotPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/add_line_item.rs
Normal file
69
web_ui/src/ordering/add_line_item.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const ADD_LINE_ITEM_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.add_line_item",
|
||||||
|
"ordering/add_line_item.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
ADD_LINE_ITEM_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(ADD_LINE_ITEM_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AddLineItemPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AddLineItemPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(ADD_LINE_ITEM_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-add_line_item.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(AddLineItemPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/add_order.rs
Normal file
69
web_ui/src/ordering/add_order.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const ADD_ORDER_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.add_order",
|
||||||
|
"ordering/add_order.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
ADD_ORDER_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(ADD_ORDER_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AddOrderPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AddOrderPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(ADD_ORDER_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-add_order.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(AddOrderPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/add_product.rs
Normal file
69
web_ui/src/ordering/add_product.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const ADD_PRODUCT_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.add_product",
|
||||||
|
"ordering/add_product.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
ADD_PRODUCT_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(ADD_PRODUCT_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct AddProductPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AddProductPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(ADD_PRODUCT_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-add_product.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(AddProductPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/delete_kot.rs
Normal file
69
web_ui/src/ordering/delete_kot.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const DELETE_KOT_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.delete_kot",
|
||||||
|
"ordering/delete_kot.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
DELETE_KOT_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(DELETE_KOT_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct DeleteKotPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DeleteKotPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(DELETE_KOT_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-delete_kot.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(DeleteKotPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/delete_line_item.rs
Normal file
69
web_ui/src/ordering/delete_line_item.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const DELETE_LINE_ITEM_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.delete_line_item",
|
||||||
|
"ordering/delete_line_item.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
DELETE_LINE_ITEM_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(DELETE_LINE_ITEM_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct DeleteLineItemPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DeleteLineItemPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(DELETE_LINE_ITEM_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-delete_line_item.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(DeleteLineItemPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/delete_order.rs
Normal file
69
web_ui/src/ordering/delete_order.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const DELETE_ORDER_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.delete_order",
|
||||||
|
"ordering/delete_order.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
DELETE_ORDER_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(DELETE_ORDER_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct DeleteOrderPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DeleteOrderPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(DELETE_ORDER_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-delete_order.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(DeleteOrderPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
43
web_ui/src/ordering/mod.rs
Normal file
43
web_ui/src/ordering/mod.rs
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
pub mod add_category;
|
||||||
|
pub mod add_customization;
|
||||||
|
pub mod add_kot;
|
||||||
|
pub mod add_line_item;
|
||||||
|
pub mod add_order;
|
||||||
|
pub mod add_product;
|
||||||
|
pub mod delete_kot;
|
||||||
|
pub mod delete_line_item;
|
||||||
|
pub mod delete_order;
|
||||||
|
pub mod update_category;
|
||||||
|
pub mod update_customization;
|
||||||
|
pub mod update_kot;
|
||||||
|
pub mod update_line_item;
|
||||||
|
pub mod update_order;
|
||||||
|
pub mod update_product;
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
for template in [
|
||||||
|
add_category::ADD_CATEGORY_PAGE,
|
||||||
|
add_customization::ADD_CUSTOMIZATION_PAGE,
|
||||||
|
add_kot::ADD_KOT_PAGE,
|
||||||
|
add_line_item::ADD_LINE_ITEM_PAGE,
|
||||||
|
add_order::ADD_ORDER_PAGE,
|
||||||
|
add_product::ADD_PRODUCT_PAGE,
|
||||||
|
delete_kot::DELETE_KOT_PAGE,
|
||||||
|
delete_order::DELETE_ORDER_PAGE,
|
||||||
|
delete_line_item::DELETE_LINE_ITEM_PAGE,
|
||||||
|
update_category::UPDATE_CATEGORY_PAGE,
|
||||||
|
update_customization::UPDATE_CUSTOMIZATION_PAGE,
|
||||||
|
update_kot::UPDATE_KOT_PAGE,
|
||||||
|
update_line_item::UPDATE_LINE_ITEM_PAGE,
|
||||||
|
update_order::UPDATE_ORDER_PAGE,
|
||||||
|
update_product::UPDATE_PRODUCT_PAGE,
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
{
|
||||||
|
template.register(t).expect(template.name);
|
||||||
|
}
|
||||||
|
}
|
69
web_ui/src/ordering/update_category.rs
Normal file
69
web_ui/src/ordering/update_category.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const UPDATE_CATEGORY_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.update_category",
|
||||||
|
"ordering/update_category.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
UPDATE_CATEGORY_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(UPDATE_CATEGORY_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct UpdateCategoryPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UpdateCategoryPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(UPDATE_CATEGORY_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-update_category.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(UpdateCategoryPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/update_customization.rs
Normal file
69
web_ui/src/ordering/update_customization.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const UPDATE_CUSTOMIZATION_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.update_customization",
|
||||||
|
"ordering/update_customization.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
UPDATE_CUSTOMIZATION_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(UPDATE_CUSTOMIZATION_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct UpdateCustomizationPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UpdateCustomizationPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(UPDATE_CUSTOMIZATION_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-update_customization.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(UpdateCustomizationPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/update_kot.rs
Normal file
69
web_ui/src/ordering/update_kot.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const UPDATE_KOT_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.update_kot",
|
||||||
|
"ordering/update_kot.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
UPDATE_KOT_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(UPDATE_KOT_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct UpdateKotPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UpdateKotPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(UPDATE_KOT_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-update_kot.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(UpdateKotPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/update_line_item.rs
Normal file
69
web_ui/src/ordering/update_line_item.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const UPDATE_LINE_ITEM_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.update_line_item",
|
||||||
|
"ordering/update_line_item.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
UPDATE_LINE_ITEM_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(UPDATE_LINE_ITEM_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct UpdateLineItemPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UpdateLineItemPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(UPDATE_LINE_ITEM_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-update_line_item.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(UpdateLineItemPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/update_order.rs
Normal file
69
web_ui/src/ordering/update_order.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const UPDATE_ORDER_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.update_order",
|
||||||
|
"ordering/update_order.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
UPDATE_ORDER_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(UPDATE_ORDER_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct UpdateOrderPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UpdateOrderPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(UPDATE_ORDER_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-update_order.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(UpdateOrderPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
web_ui/src/ordering/update_product.rs
Normal file
69
web_ui/src/ordering/update_product.rs
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use derive_builder::*;
|
||||||
|
use derive_more::*;
|
||||||
|
use serde::*;
|
||||||
|
use tera::Context;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
|
pub use super::*;
|
||||||
|
use crate::utils::*;
|
||||||
|
|
||||||
|
pub const UPDATE_PRODUCT_PAGE: TemplateFile = TemplateFile::new(
|
||||||
|
"ordering.update_product",
|
||||||
|
"ordering/update_product.html",
|
||||||
|
);
|
||||||
|
|
||||||
|
pub fn register_templates(t: &mut tera::Tera) {
|
||||||
|
UPDATE_PRODUCT_PAGE
|
||||||
|
.register(t)
|
||||||
|
.expect(UPDATE_PRODUCT_PAGE.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct UpdateProductPage {
|
||||||
|
ctx: RefCell<Context>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UpdateProductPage {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let mut ctx = context();
|
||||||
|
|
||||||
|
//ctx.insert(PAYLOAD_KEY, p);
|
||||||
|
|
||||||
|
let ctx = RefCell::new(ctx);
|
||||||
|
Self { ctx }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn render(&self) -> String {
|
||||||
|
TEMPLATES
|
||||||
|
.render(UPDATE_PRODUCT_PAGE.name, &self.ctx.borrow())
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn page() -> String {
|
||||||
|
let p = Self::new();
|
||||||
|
p.render()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn render_page_and_write() {
|
||||||
|
const FILE: &str = "./tmp/ordering-update_product.html";
|
||||||
|
|
||||||
|
let tw = TestWriterBuilder::default()
|
||||||
|
.file(FILE.into())
|
||||||
|
.contents(UpdateProductPage::page())
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
tw.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ lazy_static! {
|
||||||
crate::identity::register_templates(&mut tera);
|
crate::identity::register_templates(&mut tera);
|
||||||
crate::inventory::register_templates(&mut tera);
|
crate::inventory::register_templates(&mut tera);
|
||||||
crate::billing::register_templates(&mut tera);
|
crate::billing::register_templates(&mut tera);
|
||||||
|
crate::ordering::register_templates(&mut tera);
|
||||||
tera
|
tera
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
<title>Delete Bill | Vanikam</title>
|
<title>Delete Bill | Vanikam</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Token Refreshed
|
|
||||||
<form action="/billing/bill/delete" method="post">
|
<form action="/billing/bill/delete" method="post">
|
||||||
<button type="submit">Delete Bill</button>
|
<button type="submit">Delete Bill</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
0
web_ui/templates/ordering/add_category.html
Normal file
0
web_ui/templates/ordering/add_category.html
Normal file
0
web_ui/templates/ordering/add_customization.html
Normal file
0
web_ui/templates/ordering/add_customization.html
Normal file
0
web_ui/templates/ordering/add_kot.html
Normal file
0
web_ui/templates/ordering/add_kot.html
Normal file
0
web_ui/templates/ordering/add_line_item.html
Normal file
0
web_ui/templates/ordering/add_line_item.html
Normal file
0
web_ui/templates/ordering/add_order.html
Normal file
0
web_ui/templates/ordering/add_order.html
Normal file
0
web_ui/templates/ordering/add_product.html
Normal file
0
web_ui/templates/ordering/add_product.html
Normal file
0
web_ui/templates/ordering/delete_kot.html
Normal file
0
web_ui/templates/ordering/delete_kot.html
Normal file
0
web_ui/templates/ordering/delete_line_item.html
Normal file
0
web_ui/templates/ordering/delete_line_item.html
Normal file
0
web_ui/templates/ordering/delete_order.html
Normal file
0
web_ui/templates/ordering/delete_order.html
Normal file
0
web_ui/templates/ordering/update_category.html
Normal file
0
web_ui/templates/ordering/update_category.html
Normal file
0
web_ui/templates/ordering/update_customization.html
Normal file
0
web_ui/templates/ordering/update_customization.html
Normal file
0
web_ui/templates/ordering/update_kot.html
Normal file
0
web_ui/templates/ordering/update_kot.html
Normal file
0
web_ui/templates/ordering/update_line_item.html
Normal file
0
web_ui/templates/ordering/update_line_item.html
Normal file
0
web_ui/templates/ordering/update_order.html
Normal file
0
web_ui/templates/ordering/update_order.html
Normal file
0
web_ui/templates/ordering/update_product.html
Normal file
0
web_ui/templates/ordering/update_product.html
Normal file
Loading…
Reference in a new issue