Files
rezervovator/src/pages/hours_edit.rs
T

41 lines
1.5 KiB
Rust
Raw Normal View History

use leptos::*;
use crate::backend::data::WeekHours;
use crate::backend::opening_hours::{DeleteClosingTime, UpdateHours};
2024-05-26 21:07:09 +02:00
use crate::components::data_form::{DataForm, QuestionDialog};
use crate::components::modal_box::DialogOpener;
use crate::locales::trl;
#[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">
<label for="hours" class="form-label">{trl("Hours")}</label>
<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>
}
2024-05-26 21:07:09 +02:00
}
#[component]
pub fn del_closing_days(opener: DialogOpener) -> impl IntoView {
let delete = create_server_action::<DeleteClosingTime>();
view! {
<QuestionDialog opener=opener action=delete title="Delete closing days">
<div>{trl("Are you sure you want to delete closing days?")}</div>
</QuestionDialog>
}
}