Fixed dropdown in project. PERFECT
This commit is contained in:
parent
5240ec953b
commit
c174123dc2
@ -89,14 +89,7 @@ pub fn generate_fields_for_project(props: &ProjectFieldsProps) -> Html {
|
|||||||
location_district.set(listing_opt.clone().unwrap_or_default().location.district);
|
location_district.set(listing_opt.clone().unwrap_or_default().location.district);
|
||||||
agent.set(match listing_opt.clone() {
|
agent.set(match listing_opt.clone() {
|
||||||
Some(listing) => Some(listing.agent),
|
Some(listing) => Some(listing.agent),
|
||||||
None => {
|
None => None,
|
||||||
let agents = (*all_agents).clone();
|
|
||||||
if let Some(default_agent) = agents.last() {
|
|
||||||
Some(default_agent.clone())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
project_state.set(match listing_opt.clone() {
|
project_state.set(match listing_opt.clone() {
|
||||||
Some(listing) => Some(listing.project.project_state),
|
Some(listing) => Some(listing.project.project_state),
|
||||||
@ -106,15 +99,11 @@ pub fn generate_fields_for_project(props: &ProjectFieldsProps) -> Html {
|
|||||||
});
|
});
|
||||||
project_condition.set(match listing_opt.clone() {
|
project_condition.set(match listing_opt.clone() {
|
||||||
Some(listing) => Some(listing.project.project_condition),
|
Some(listing) => Some(listing.project.project_condition),
|
||||||
None => {
|
None => None,
|
||||||
Some(ProjectCondition::New)
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
project_type.set(match listing_opt.clone() {
|
project_type.set(match listing_opt.clone() {
|
||||||
Some(listing) => Some(listing.project.project_type),
|
Some(listing) => Some(listing.project.project_type),
|
||||||
None => {
|
None => None,
|
||||||
Some(ProjectType::Solar)
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
project_description.set(match listing_opt.clone() {
|
project_description.set(match listing_opt.clone() {
|
||||||
Some(listing) => listing.project.description,
|
Some(listing) => listing.project.description,
|
||||||
@ -315,11 +304,23 @@ pub fn generate_fields_for_project(props: &ProjectFieldsProps) -> Html {
|
|||||||
<TextField label={"Distrito"} value={location_district} required={true} onchange={ontype_cb.clone()} />
|
<TextField label={"Distrito"} value={location_district} required={true} onchange={ontype_cb.clone()} />
|
||||||
<MediaPicker value={media} onchange={ontype_cb.clone()} item={jl_types::dto::item::Item::Project}/>
|
<MediaPicker value={media} onchange={ontype_cb.clone()} item={jl_types::dto::item::Item::Project}/>
|
||||||
{if (*agent).clone().is_none() {
|
{if (*agent).clone().is_none() {
|
||||||
html! {
|
match props.edittype.clone() {
|
||||||
<div class={"textfield-container"}>
|
EditType::New => html! {
|
||||||
<div class={"textfield-label-required"}>{"Agente asignado"}</div>
|
<div class={"textfield-container"}>
|
||||||
<DropDown<Agent> options={(*all_agents).clone()} selected={agent} onchange={onselect_cb.clone()} />
|
<div class={"textfield-label-required"}>{"Agente asignado"}</div>
|
||||||
</div>
|
<DropDown<Agent> options={(*all_agents).clone()} selected={agent} onchange={onselect_cb.clone()} />
|
||||||
|
</div>
|
||||||
|
},
|
||||||
|
EditType::Existing(_) => if *user_typed {
|
||||||
|
html! {
|
||||||
|
<div class={"textfield-container"}>
|
||||||
|
<div class={"textfield-label-required"}>{"Agente asignado"}</div>
|
||||||
|
<DropDown<Agent> options={(*all_agents).clone()} selected={agent} onchange={onselect_cb.clone()} />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
html! {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html! {
|
html! {
|
||||||
@ -331,11 +332,23 @@ pub fn generate_fields_for_project(props: &ProjectFieldsProps) -> Html {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{if (*project_state).clone().is_none() {
|
{if (*project_state).clone().is_none() {
|
||||||
html! {
|
match props.edittype.clone() {
|
||||||
<div class={"textfield-container"}>
|
EditType::New => html! {
|
||||||
<div class={"textfield-label-required"}>{"Estado del Proyecto"}</div>
|
<div class={"textfield-container"}>
|
||||||
<DropDown<ProjectState> options={vec![ProjectState::Finished, ProjectState::InConstruction]} selected={project_state} onchange={onselect_cb2} />
|
<div class={"textfield-label-required"}>{"Estado del Proyecto"}</div>
|
||||||
</div>
|
<DropDown<ProjectState> options={vec![ProjectState::Finished, ProjectState::InConstruction]} selected={project_state} onchange={onselect_cb2} />
|
||||||
|
</div>
|
||||||
|
},
|
||||||
|
EditType::Existing(_) => if *user_typed {
|
||||||
|
html! {
|
||||||
|
<div class={"textfield-container"}>
|
||||||
|
<div class={"textfield-label-required"}>{"Estado del Proyecto"}</div>
|
||||||
|
<DropDown<ProjectState> options={vec![ProjectState::Finished, ProjectState::InConstruction]} selected={project_state} onchange={onselect_cb2} />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
html! {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html! {
|
html! {
|
||||||
@ -348,11 +361,23 @@ pub fn generate_fields_for_project(props: &ProjectFieldsProps) -> Html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{if (*project_condition).clone().is_none() {
|
{if (*project_condition).clone().is_none() {
|
||||||
html! {
|
match props.edittype.clone() {
|
||||||
<div class={"textfield-container"}>
|
EditType::New => html! {
|
||||||
<div class={"textfield-label-required"}>{"Condición del Proyecto"}</div>
|
<div class={"textfield-container"}>
|
||||||
<DropDown<ProjectCondition> options={vec![ProjectCondition::Resale, ProjectCondition::New]} selected={project_condition} onchange={onselect_cb3} />
|
<div class={"textfield-label-required"}>{"Condición del Proyecto"}</div>
|
||||||
</div>
|
<DropDown<ProjectCondition> options={vec![ProjectCondition::Resale, ProjectCondition::New]} selected={project_condition} onchange={onselect_cb3} />
|
||||||
|
</div>
|
||||||
|
},
|
||||||
|
EditType::Existing(_) => if *user_typed {
|
||||||
|
html! {
|
||||||
|
<div class={"textfield-container"}>
|
||||||
|
<div class={"textfield-label-required"}>{"Condición del Proyecto"}</div>
|
||||||
|
<DropDown<ProjectCondition> options={vec![ProjectCondition::Resale, ProjectCondition::New]} selected={project_condition} onchange={onselect_cb3} />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
html! {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html! {
|
html! {
|
||||||
@ -364,11 +389,23 @@ pub fn generate_fields_for_project(props: &ProjectFieldsProps) -> Html {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{if (*project_type).clone().is_none() {
|
{if (*project_type).clone().is_none() {
|
||||||
html! {
|
match props.edittype.clone() {
|
||||||
<div class={"textfield-container"}>
|
EditType::New => html! {
|
||||||
<div class={"textfield-label-required"}>{"Tipo de Proyecto"}</div>
|
<div class={"textfield-container"}>
|
||||||
<DropDown<ProjectType> options={vec![ProjectType::Apartamento, ProjectType::Casa, ProjectType::Oficina, ProjectType::Local, ProjectType::Solar]} selected={project_type} onchange={onselect_cb4} />
|
<div class={"textfield-label-required"}>{"Tipo de Proyecto"}</div>
|
||||||
</div>
|
<DropDown<ProjectType> options={vec![ProjectType::Apartamento, ProjectType::Casa, ProjectType::Oficina, ProjectType::Local, ProjectType::Solar]} selected={project_type} onchange={onselect_cb4} />
|
||||||
|
</div>
|
||||||
|
},
|
||||||
|
EditType::Existing(_) => if *user_typed {
|
||||||
|
html! {
|
||||||
|
<div class={"textfield-container"}>
|
||||||
|
<div class={"textfield-label-required"}>{"Tipo de Proyecto"}</div>
|
||||||
|
<DropDown<ProjectType> options={vec![ProjectType::Apartamento, ProjectType::Casa, ProjectType::Oficina, ProjectType::Local, ProjectType::Solar]} selected={project_type} onchange={onselect_cb4} />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
html! {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html! {
|
html! {
|
||||||
|
Loading…
Reference in New Issue
Block a user