| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -5,7 +5,7 @@ use leptos_router::*;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use rust_decimal::Decimal;
 | 
					 | 
					 | 
					 | 
					use rust_decimal::Decimal;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use crate::backend::appearance::get_appearance;
 | 
					 | 
					 | 
					 | 
					use crate::backend::appearance::get_appearance;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use crate::backend::customer::get_remembered;
 | 
					 | 
					 | 
					 | 
					use crate::backend::customer::get_remembered;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use crate::backend::data::{ApiResponse, Customer, DayHour, Reservation, ResProperty, SlotType, TmCheck};
 | 
					 | 
					 | 
					 | 
					use crate::backend::data::{ApiResponse, ClosingTime, Customer, DayHour, Reservation, ResProperty, SlotType, TmCheck};
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use crate::backend::reservation::{CreateReservation, get_public_form_data, is_reserved};
 | 
					 | 
					 | 
					 | 
					use crate::backend::reservation::{CreateReservation, get_public_form_data, is_reserved};
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use crate::backend::user::get_pow;
 | 
					 | 
					 | 
					 | 
					use crate::backend::user::get_pow;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					use crate::components::data_form::ForValidation;
 | 
					 | 
					 | 
					 | 
					use crate::components::data_form::ForValidation;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -20,51 +20,62 @@ fn time_selector(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    reservations: Vec<Reservation>,
 | 
					 | 
					 | 
					 | 
					    reservations: Vec<Reservation>,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    property: ResProperty,
 | 
					 | 
					 | 
					 | 
					    property: ResProperty,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    slots: RwSignal<Vec<String>>,
 | 
					 | 
					 | 
					 | 
					    slots: RwSignal<Vec<String>>,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    price: RwSignal<Decimal>) -> impl IntoView {
 | 
					 | 
					 | 
					 | 
					    price: RwSignal<Decimal>,
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    let checks = hours.into_iter().map(|h| {
 | 
					 | 
					 | 
					 | 
					    day: ReadSignal<NaiveDate>,
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        match property.slot {
 | 
					 | 
					 | 
					 | 
					    closing_days: Option<ClosingTime>) -> impl IntoView {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            SlotType::Quarter => {
 | 
					 | 
					 | 
					 | 
					    let closed = if let Some(c) = closing_days {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                let mut ret: Vec<TmCheck> = vec![];
 | 
					 | 
					 | 
					 | 
					        day.get() >= c.from_date && day.get() <= c.to_date
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                logging::log!("quarter");
 | 
					 | 
					 | 
					 | 
					    } else {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                for n in 0..(h.to() - h.from()).num_minutes() * 4 / 60 {
 | 
					 | 
					 | 
					 | 
					        false
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ret.push(TmCheck {
 | 
					 | 
					 | 
					 | 
					    };
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        from: h.from() + Duration::minutes(n * 15),
 | 
					 | 
					 | 
					 | 
					    let checks = if !closed {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        to: h.from() + Duration::minutes((n + 1) * 15)
 | 
					 | 
					 | 
					 | 
					        hours.into_iter().map(|h| {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    });
 | 
					 | 
					 | 
					 | 
					            match property.slot {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                SlotType::Quarter => {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    let mut ret: Vec<TmCheck> = vec![];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    logging::log!("quarter");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    for n in 0..(h.to() - h.from()).num_minutes() * 4 / 60 {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        ret.push(TmCheck {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            from: h.from() + Duration::minutes(n * 15),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            to: h.from() + Duration::minutes((n + 1) * 15)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    ret
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ret
 | 
					 | 
					 | 
					 | 
					                SlotType::Half => {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					                    let mut ret: Vec<TmCheck> = vec![];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            SlotType::Half => {
 | 
					 | 
					 | 
					 | 
					                    logging::log!("half");
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                let mut ret: Vec<TmCheck> = vec![];
 | 
					 | 
					 | 
					 | 
					                    for n in 0..(h.to() - h.from()).num_minutes() * 2 / 60 {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                logging::log!("half");
 | 
					 | 
					 | 
					 | 
					                        ret.push(TmCheck {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                for n in 0..(h.to() - h.from()).num_minutes() * 2 / 60 {
 | 
					 | 
					 | 
					 | 
					                            from: h.from() + Duration::minutes(n * 30),
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ret.push(TmCheck {
 | 
					 | 
					 | 
					 | 
					                            to: h.from() + Duration::minutes((n + 1) * 30)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        from: h.from() + Duration::minutes(n * 30),
 | 
					 | 
					 | 
					 | 
					                        });
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        to: h.from() + Duration::minutes((n + 1) * 30)
 | 
					 | 
					 | 
					 | 
					                    }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    });
 | 
					 | 
					 | 
					 | 
					                    ret
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ret
 | 
					 | 
					 | 
					 | 
					                SlotType::Hour => {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					                    let mut ret: Vec<TmCheck> = vec![];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            SlotType::Hour => {
 | 
					 | 
					 | 
					 | 
					                    for n in 0..(h.to() - h.from()).num_minutes() / 60 {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                let mut ret: Vec<TmCheck> = vec![];
 | 
					 | 
					 | 
					 | 
					                        ret.push(TmCheck {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                for n in 0..(h.to() - h.from()).num_minutes() / 60 {
 | 
					 | 
					 | 
					 | 
					                            from: h.from() + Duration::minutes(n * 60),
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                            to: h.from() + Duration::minutes((n + 1) * 60)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    ret
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                SlotType::Day => {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    let mut ret: Vec<TmCheck> = vec![];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    ret.push(TmCheck {
 | 
					 | 
					 | 
					 | 
					                    ret.push(TmCheck {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        from: h.from() + Duration::minutes(n * 60),
 | 
					 | 
					 | 
					 | 
					                        from: NaiveTime::from_hms_opt(0, 0, 0).unwrap(),
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        to: h.from() + Duration::minutes((n + 1) * 60)
 | 
					 | 
					 | 
					 | 
					                        to: NaiveTime::from_hms_opt(23, 59, 59).unwrap()
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    });
 | 
					 | 
					 | 
					 | 
					                    });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    ret
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ret
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            SlotType::Day => {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                let mut ret: Vec<TmCheck> = vec![];
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ret.push(TmCheck {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    from: NaiveTime::from_hms_opt(0,0,0).unwrap(),
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    to: NaiveTime::from_hms_opt(23, 59, 59).unwrap()
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                });
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                ret
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }).collect::<Vec<_>>().into_iter().flatten().collect::<Vec<_>>()
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }).collect::<Vec<_>>().into_iter().flatten().collect::<Vec<_>>();
 | 
					 | 
					 | 
					 | 
					    } else {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        vec![]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    };
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    let prop_id = property.id();
 | 
					 | 
					 | 
					 | 
					    let prop_id = property.id();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    let closed = checks.is_empty();
 | 
					 | 
					 | 
					 | 
					    let closed = checks.is_empty();
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -222,6 +233,8 @@ pub fn Public() -> impl IntoView {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                                    hours={data.hours.clone()}
 | 
					 | 
					 | 
					 | 
					                                                    hours={data.hours.clone()}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                                    reservations={data.reservations.clone()}
 | 
					 | 
					 | 
					 | 
					                                                    reservations={data.reservations.clone()}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                                    property={data.property.clone()}
 | 
					 | 
					 | 
					 | 
					                                                    property={data.property.clone()}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                                    day={day.read_only()}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                                    closing_days={data.closing_days.clone()}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                                    slots={slots}
 | 
					 | 
					 | 
					 | 
					                                                    slots={slots}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                                    price={price}/>
 | 
					 | 
					 | 
					 | 
					                                                    price={price}/>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                            </div>
 | 
					 | 
					 | 
					 | 
					                                            </div>
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |