add dancer select
parent
5f6e05371c
commit
9e721cacfe
14
src/main.rs
14
src/main.rs
|
@ -5,7 +5,7 @@ mod tracing_handler;
|
||||||
|
|
||||||
use cm_lib::{
|
use cm_lib::{
|
||||||
hx_request::HxRequest,
|
hx_request::HxRequest,
|
||||||
models::{Drink, Shift},
|
models::{Drink, Shift, Dancer},
|
||||||
render,
|
render,
|
||||||
report::GenerateDrinkReport,
|
report::GenerateDrinkReport,
|
||||||
schema::shifts,
|
schema::shifts,
|
||||||
|
@ -162,6 +162,14 @@ async fn ada() -> impl IntoResponse {
|
||||||
render!(ada_html)
|
render!(ada_html)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn shows(Path(id): Path<u32>) -> impl IntoResponse {
|
async fn shows(State(state): State<AppState>, Path(id): Path<u32>) -> impl IntoResponse {
|
||||||
render!(shows_html, id)
|
let dancers: Vec<Dancer> = {
|
||||||
|
use cm_lib::schema::dancers::dsl::*;
|
||||||
|
|
||||||
|
let mut conn = state.connection.get().await.unwrap();
|
||||||
|
|
||||||
|
dancers.load(&mut conn).await.unwrap()
|
||||||
|
};
|
||||||
|
|
||||||
|
render!(shows_html, id, dancers)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
@use super::base_html;
|
@use super::base_html;
|
||||||
@use super::components::return_to_main_html;
|
@use super::components::return_to_main_html;
|
||||||
|
@use cm_lib::models::Dancer;
|
||||||
|
|
||||||
@(shift_id: u32)
|
@(shift_id: u32, dancers: Vec<Dancer>)
|
||||||
|
|
||||||
@:base_html({
|
@:base_html({
|
||||||
|
|
||||||
|
@ -11,6 +12,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form hx-post="/api/drinks" class="h-full flex items-center justify-center gap-28">
|
<form hx-post="/api/drinks" class="h-full flex items-center justify-center gap-28">
|
||||||
|
<select>
|
||||||
|
@for dancer in dancers {
|
||||||
|
<option value="@dancer.id">@dancer.stage_name</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
|
||||||
<input type="hidden" id="shift" name="shift" value="@shift_id" />
|
<input type="hidden" id="shift" name="shift" value="@shift_id" />
|
||||||
<button type="submit"
|
<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">
|
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">
|
||||||
|
|
Loading…
Reference in New Issue