41 lines
988 B
Rust

use askama::Template;
use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
use serde::Deserialize;
use crate::{
filters,
utils::DateTimeFormat::{DayMonthHourMinute, HourMinute, WeekdayDayMonth, WeekdayDayMonthYear},
};
use brass_db::models::{Role, User};
pub mod delete;
pub mod get_calendar;
pub mod get_new;
pub mod get_overview;
pub mod get_update;
pub mod post_new;
pub mod post_update;
#[derive(Template)]
#[template(path = "availability/new_or_edit.html")]
struct NewOrEditAvailabilityTemplate<'a> {
user: User,
date: NaiveDate,
enddate: Option<NaiveDate>,
id: Option<i32>,
start: Option<NaiveTime>,
end: Option<NaiveTime>,
comment: Option<&'a str>,
slot_suggestions: Vec<(NaiveDateTime, NaiveDateTime)>,
datetomorrow: NaiveDate,
}
#[derive(Deserialize)]
pub struct AvailabilityForm {
pub startdate: NaiveDate,
pub enddate: NaiveDate,
pub starttime: NaiveTime,
pub endtime: NaiveTime,
pub comment: Option<String>,
}