hook up shows page and get skeleton page built

main
Zynh0722 2023-11-17 14:29:44 -08:00
parent f1f3031316
commit 5f6e05371c
3 changed files with 30 additions and 3 deletions

View File

@ -92,6 +92,7 @@ async fn main() {
.route("/shift_reports", get(shift_reports)) .route("/shift_reports", get(shift_reports))
.route("/shifts/:id/drinks", get(drinks)) .route("/shifts/:id/drinks", get(drinks))
.route("/shifts/:id/report", get(shift_report)) .route("/shifts/:id/report", get(shift_report))
.route("/shifts/:id/shows", get(shows))
.fallback_service(fallback_handler) .fallback_service(fallback_handler)
.with_state(state); .with_state(state);
@ -160,3 +161,7 @@ async fn shift_reports(State(state): State<AppState>) -> impl IntoResponse {
async fn ada() -> impl IntoResponse { async fn ada() -> impl IntoResponse {
render!(ada_html) render!(ada_html)
} }
async fn shows(Path(id): Path<u32>) -> impl IntoResponse {
render!(shows_html, id)
}

View File

@ -7,16 +7,16 @@
<div class="flex justify-center items-center"> <div class="flex justify-center items-center">
@:shift_button_html(open_shift.as_ref()) @:shift_button_html(open_shift.as_ref())
</div> </div>
@if open_shift.is_some() { @if let Some(open_shift) = open_shift {
<div hx-boost="true" class="flex justify-center items-center"> <div hx-boost="true" class="flex justify-center items-center">
<a href="/shifts/@open_shift.unwrap().id/drinks" <a href="/shifts/@open_shift.id/drinks"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 "> class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 ">
<button type="button">Sell Drinks</button> <button type="button">Sell Drinks</button>
</a> </a>
</div> </div>
<div hx-boost="true" class="flex justify-center items-center"> <div hx-boost="true" class="flex justify-center items-center">
<a href="/shows" <a href="/shifts/@open_shift.id/shows"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 "> class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 ">
<button type="button">Sell Shows</button> <button type="button">Sell Shows</button>
</a> </a>

22
templates/shows.rs.html Normal file
View File

@ -0,0 +1,22 @@
@use super::base_html;
@use super::components::return_to_main_html;
@(shift_id: u32)
@:base_html({
<div hx-swap="outerHTML" hx-target="this" class="h-full">
<div class="fixed right-0 top-0 pr-4 pt-4">
@:return_to_main_html()
</div>
<form hx-post="/api/drinks" class="h-full flex items-center justify-center gap-28">
<input type="hidden" id="shift" name="shift" value="@shift_id" />
<button type="submit"
class="focus:outline-none text-white bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-green-600 dark:hover:bg-green-700 dark:focus:ring-green-800">
Submit
</button>
</form>
</div>
})