some stuff

This commit is contained in:
Zynh0722 2023-11-05 07:16:44 -08:00
parent 746250f876
commit 6cf595a65a
4 changed files with 52 additions and 37 deletions

View file

@ -5,8 +5,14 @@ use crate::{AppState, axum_ructe::render};
pub(crate) fn router() -> axum::Router<AppState> { pub(crate) fn router() -> axum::Router<AppState> {
axum::Router::new() axum::Router::new()
.route("/", get(home)) .route("/", get(home))
.route("/dancers", get(dancers))
} }
async fn home() -> impl IntoResponse { async fn home() -> impl IntoResponse {
render!(crate::templates::management_html) render!(crate::templates::management_html)
} }
async fn dancers() -> impl IntoResponse {
render!(crate::templates::dancers_html)
}

View file

@ -7,7 +7,7 @@
</a> </a>
</div> </div>
<div hx-boost="true"> <div hx-boost="true">
<a href="/dancers"> <a href="/management/dancers">
<button>Dancers</button> <button>Dancers</button>
</a> </a>
</div> </div>

View file

@ -2,6 +2,8 @@
<div hx-boost="true"> <div hx-boost="true">
<a href="/"> <a href="/">
<button type="button">Return to Main Page</button> <button type="button" class="focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2">
Return to Main Page
</button>
</a> </a>
</div> </div>

View file

@ -1,44 +1,51 @@
@use super::base_html; @use super::base_html;
@use super::components::return_to_main_html;
@(shift_id: u32) @(shift_id: u32)
@:base_html({ @:base_html({
<form hx-swap="outerHTML" hx-post="/api/drinks" class="h-full flex items-center justify-center gap-28"> <div hx-swap="outerHTML" hx-target="this" class="h-full">
<fieldset class="flex flex-col text-4xl text-center overflow-hidden border border-black rounded-2xl"> <div class="fixed right-0 top-0 pr-4 pt-4">
<input hidden required type="radio" id="two" name="price" value="2" class="peer/two" /> @:return_to_main_html()
<label class="p-4 hover:bg-blue-300 peer-checked/two:bg-blue-400" for="two">$2</label>
<input hidden type="radio" id="three" name="price" value="3" class="peer/three" />
<label class="p-4 hover:bg-blue-300 peer-checked/three:bg-blue-400" for="three">$3</label>
<input hidden type="radio" id="five" name="price" value="5" class="peer/five" />
<label class="p-4 hover:bg-blue-300 peer-checked/five:bg-blue-400" for="five">$5</label>
<input hidden type="radio" id="eight" name="price" value="8" class="peer/eight" />
<label class="p-4 hover:bg-blue-300 peer-checked/eight:bg-blue-400" for="eight">$8</label>
<input hidden type="radio" id="fifteen" name="price" value="15" class="peer/fifteen" />
<label class="p-4 hover:bg-blue-300 peer-checked/fifteen:bg-blue-400" for="fifteen">$15</label>
</fieldset>
<div class="flex flex-col items-center gap-24">
<div>
<div>
<label for="quantity" class="block mb-2 text-sm font-medium text-gray-900">Quantity: </label>
<div class="flex flex-col">
<button type="button" onclick="this.nextElementSibling.stepUp()" class="py-4 w-14 text-lg font-medium text-gray-900 focus:outline-none bg-white rounded-t-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-200">+1</button>
<input type="number" id="quantity" name="quantity" step="1" value="1" class="bg-gray-50 border border-gray-300 text-gray-900 w-14 text-center text-2xl focus:ring-blue-500 focus:border-blue-500 block p-2.5"/>
<button type="button" onclick="this.previousElementSibling.stepDown()" class="py-4 w-14 text-lg font-medium text-gray-900 focus:outline-none bg-white rounded-b-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-200">-1</button>
</div>
</div>
<input type="hidden" id="shift_id" name="shift_id" value="@shift_id" />
</div>
<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>
</div> </div>
</form>
<form hx-swap="outerHTML" hx-post="/api/drinks" class="h-full flex items-center justify-center gap-28">
<fieldset class="flex flex-col text-4xl text-center overflow-hidden border border-black rounded-2xl">
<input hidden required type="radio" id="two" name="price" value="2" class="peer/two" />
<label class="p-4 hover:bg-blue-300 peer-checked/two:bg-blue-400" for="two">$2</label>
<input hidden type="radio" id="three" name="price" value="3" class="peer/three" />
<label class="p-4 hover:bg-blue-300 peer-checked/three:bg-blue-400" for="three">$3</label>
<input hidden type="radio" id="five" name="price" value="5" class="peer/five" />
<label class="p-4 hover:bg-blue-300 peer-checked/five:bg-blue-400" for="five">$5</label>
<input hidden type="radio" id="eight" name="price" value="8" class="peer/eight" />
<label class="p-4 hover:bg-blue-300 peer-checked/eight:bg-blue-400" for="eight">$8</label>
<input hidden type="radio" id="fifteen" name="price" value="15" class="peer/fifteen" />
<label class="p-4 hover:bg-blue-300 peer-checked/fifteen:bg-blue-400" for="fifteen">$15</label>
</fieldset>
<div class="flex flex-col items-center gap-24">
<div>
<div>
<label for="quantity" class="block mb-2 text-sm font-medium text-gray-900">Quantity: </label>
<div class="flex flex-col">
<button type="button" onclick="this.nextElementSibling.stepUp()" class="py-4 w-14 text-lg font-medium text-gray-900 focus:outline-none bg-white rounded-t-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-200">+1</button>
<input type="number" id="quantity" name="quantity" step="1" value="1" class="bg-gray-50 border border-gray-300 text-gray-900 w-14 text-center text-2xl focus:ring-blue-500 focus:border-blue-500 block p-2.5"/>
<button type="button" onclick="this.previousElementSibling.stepDown()" class="py-4 w-14 text-lg font-medium text-gray-900 focus:outline-none bg-white rounded-b-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-200">-1</button>
</div>
</div>
<input type="hidden" id="shift_id" name="shift_id" value="@shift_id" />
</div>
<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>
</div>
</form>
</div>
}) })