2023-11-11 16:27:40 +01:00
|
|
|
use leptos::*;
|
|
|
|
|
use crate::backend::data::WeekHours;
|
|
|
|
|
use crate::backend::opening_hours::UpdateHours;
|
|
|
|
|
use crate::components::data_form::DataForm;
|
|
|
|
|
use crate::components::modal_box::DialogOpener;
|
2024-02-16 09:40:44 +01:00
|
|
|
use crate::locales::trl;
|
2023-11-11 16:27:40 +01:00
|
|
|
|
|
|
|
|
#[component]
|
|
|
|
|
pub fn EditHours(opener: DialogOpener, hours: ReadSignal<WeekHours>) -> impl IntoView {
|
|
|
|
|
let update_hours = create_server_action::<UpdateHours>();
|
|
|
|
|
|
|
|
|
|
view! {
|
|
|
|
|
<DataForm opener=opener action=update_hours title="Edit hours">
|
|
|
|
|
<input type="hidden" value={move || hours.get().day().to_string()} name="hours[day]"/>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col mb-3">
|
2024-02-16 09:40:44 +01:00
|
|
|
<label for="hours" class="form-label">{trl("Hours")}</label>
|
2023-11-11 16:27:40 +01:00
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
id="hours"
|
|
|
|
|
class="form-control"
|
|
|
|
|
placeholder="12:00 - 15:00, 17:00 - 21:00"
|
|
|
|
|
prop:value={move || hours.get().hours().to_string()}
|
|
|
|
|
name="hours[hours]"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</DataForm>
|
|
|
|
|
}
|
|
|
|
|
}
|