working with UI library now
This commit is contained in:
@@ -301,6 +301,7 @@ pub async fn booking_new(
|
||||
"hour": q.hour.unwrap_or(FIRST_HOUR),
|
||||
"color": "#3b82f6",
|
||||
"name": "",
|
||||
"title": "",
|
||||
"contact": "",
|
||||
"note": "",
|
||||
"hours": hour_options(),
|
||||
@@ -316,6 +317,7 @@ pub struct BookingForm {
|
||||
pub hour: i32,
|
||||
pub color: String,
|
||||
pub name: String,
|
||||
pub title: Option<String>,
|
||||
pub contact: Option<String>,
|
||||
pub note: Option<String>,
|
||||
}
|
||||
@@ -338,6 +340,7 @@ pub async fn booking_create(
|
||||
hour: Set(form.hour),
|
||||
color: Set(form.color),
|
||||
name: Set(form.name),
|
||||
title: Set(form.title.filter(|s| !s.is_empty())),
|
||||
contact: Set(form.contact.filter(|s| !s.is_empty())),
|
||||
note: Set(form.note.filter(|s| !s.is_empty())),
|
||||
..Default::default()
|
||||
@@ -381,6 +384,7 @@ pub async fn booking_edit(
|
||||
"hour": booking.hour,
|
||||
"color": booking.color,
|
||||
"name": booking.name,
|
||||
"title": booking.title.unwrap_or_default(),
|
||||
"contact": booking.contact.unwrap_or_default(),
|
||||
"note": booking.note.unwrap_or_default(),
|
||||
"hours": hour_options(),
|
||||
@@ -407,6 +411,7 @@ pub async fn booking_update(
|
||||
active.hour = Set(form.hour);
|
||||
active.color = Set(form.color);
|
||||
active.name = Set(form.name);
|
||||
active.title = Set(form.title.filter(|s| !s.is_empty()));
|
||||
active.contact = Set(form.contact.filter(|s| !s.is_empty()));
|
||||
active.note = Set(form.note.filter(|s| !s.is_empty()));
|
||||
active.update(&ctx.db).await?;
|
||||
|
||||
@@ -50,7 +50,10 @@ pub struct Cell {
|
||||
pub booked: bool,
|
||||
pub color: String,
|
||||
pub booking_id: i32,
|
||||
/// Private — admin only. Never rendered on the public calendar.
|
||||
pub name: String,
|
||||
/// Public-facing label shown on the calendar when set.
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
@@ -173,6 +176,7 @@ pub async fn build_calendar(
|
||||
color: b.color.clone(),
|
||||
booking_id: b.id,
|
||||
name: b.name.clone(),
|
||||
title: b.title.clone().unwrap_or_default(),
|
||||
},
|
||||
None => Cell {
|
||||
date: iso,
|
||||
@@ -181,6 +185,7 @@ pub async fn build_calendar(
|
||||
color: String::new(),
|
||||
booking_id: 0,
|
||||
name: String::new(),
|
||||
title: String::new(),
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user