Changed bathrooms to a float

This commit is contained in:
Franklin 2023-05-03 09:44:11 -04:00
parent 8e2059c942
commit e63f2eb515

View File

@ -78,7 +78,7 @@ pub fn unit_fields(props: &UnitFieldsProps) -> Html {
let price_usd = use_state_eq(|| 0.0);
let unit_type_handle: UseStateHandle<Option<UnitType>> = use_state_eq(|| None);
let rooms_handle: UseStateHandle<i16> = use_state_eq(|| 0);
let bathrooms_handle: UseStateHandle<i16> = use_state_eq(|| 0);
let bathrooms_handle: UseStateHandle<f32> = use_state_eq(|| 0.0);
let area_handle: UseStateHandle<f32> = use_state_eq(|| 0.0);
let media_handle: UseStateHandle<MediaList> = use_state_eq(|| MediaList {
media_list: Vec::new(),
@ -107,7 +107,7 @@ pub fn unit_fields(props: &UnitFieldsProps) -> Html {
});
bathrooms_handle.set(match (*unit_opt).clone() {
Some(unit) => unit.bathrooms,
None => 0
None => 0.0
});
area_handle.set(match (*unit_opt).clone() {
Some(unit) => unit.area,
@ -133,7 +133,7 @@ pub fn unit_fields(props: &UnitFieldsProps) -> Html {
let price_usd = price_usd.clone();
let unit_type_handle: UseStateHandle<Option<UnitType>> = unit_type_handle.clone();
let rooms_handle: UseStateHandle<i16> = rooms_handle.clone();
let bathrooms_handle: UseStateHandle<i16> = bathrooms_handle.clone();
let bathrooms_handle: UseStateHandle<f32> = bathrooms_handle.clone();
let area_handle: UseStateHandle<f32> = area_handle.clone();
let media_handle: UseStateHandle<MediaList> = media_handle.clone();
let unit_admin_tag_handle: UseStateHandle<String> = unit_admin_tag_handle.clone();
@ -146,7 +146,7 @@ pub fn unit_fields(props: &UnitFieldsProps) -> Html {
let price_usd = price_usd.clone();
let unit_type_handle: UseStateHandle<Option<UnitType>> = unit_type_handle.clone();
let rooms_handle: UseStateHandle<i16> = rooms_handle.clone();
let bathrooms_handle: UseStateHandle<i16> = bathrooms_handle.clone();
let bathrooms_handle: UseStateHandle<f32> = bathrooms_handle.clone();
let area_handle: UseStateHandle<f32> = area_handle.clone();
let media_handle: UseStateHandle<MediaList> = media_handle.clone();
let unit_admin_tag_handle: UseStateHandle<String> = unit_admin_tag_handle.clone();
@ -210,9 +210,9 @@ pub fn unit_fields(props: &UnitFieldsProps) -> Html {
html! {
<>
<NumberTextField<f64> label={String::from("Precio en USD")} required={true} value={price_usd.clone()} onchange={onchange_number_cb}/>
<NumberTextField<f32> label={String::from("Area en m^2")} required={true} value={area_handle.clone()} onchange={onchange_number_cb_2}/>
<NumberTextField<f32> label={String::from("Area en m^2")} required={true} value={area_handle.clone()} onchange={onchange_number_cb_2.clone()}/>
<NumberTextField<i16> label={String::from("Cant. de habitaciones")} required={true} value={rooms_handle.clone()} onchange={onchange_number_cb_3.clone()}/>
<NumberTextField<i16> label={String::from("Cant. de baños")} required={true} value={bathrooms_handle.clone()} onchange={onchange_number_cb_3}/>
<NumberTextField<f32> label={String::from("Cant. de baños")} required={true} value={bathrooms_handle.clone()} onchange={onchange_number_cb_2}/>
<MediaPicker value={media_handle} onchange={ontype_cb.clone()} item={jl_types::dto::item::Item::Unit}/>
// Unit type dropdown