Fixed company edit form.

main
Josef Rokos 2 years ago
parent bbad2bb183
commit a2a4c551b4

@ -41,7 +41,7 @@ pub fn CompanyEdit(
id="nameWithTitle" id="nameWithTitle"
class="form-control" class="form-control"
placeholder="Enter Name" placeholder="Enter Name"
value={move || company.get().name} prop:value={move || company.get().name}
name="company[name]" name="company[name]"
/> />
</div> </div>
@ -54,7 +54,7 @@ pub fn CompanyEdit(
id="street" id="street"
class="form-control" class="form-control"
placeholder="Enter Street" placeholder="Enter Street"
value={move || company.get().street} prop:value={move || company.get().street}
name="company[street]" name="company[street]"
/> />
</div> </div>
@ -65,7 +65,7 @@ pub fn CompanyEdit(
id="houseNumber" id="houseNumber"
class="form-control" class="form-control"
placeholder="Enter House number" placeholder="Enter House number"
value={move || company.get().house_number} prop:value={move || company.get().house_number}
name="company[house_number]" name="company[house_number]"
/> />
</div> </div>
@ -78,7 +78,7 @@ pub fn CompanyEdit(
id="zip" id="zip"
class="form-control" class="form-control"
placeholder="Enter ZIP code" placeholder="Enter ZIP code"
value={move || company.get().zip_code} prop:value={move || company.get().zip_code}
name="company[zip_code]" name="company[zip_code]"
/> />
</div> </div>
@ -89,14 +89,15 @@ pub fn CompanyEdit(
id="city" id="city"
class="form-control" class="form-control"
placeholder="Enter City" placeholder="Enter City"
value={move || company.get().city} prop:value={move || company.get().city}
name="company[city]" name="company[city]"
/> />
</div> </div>
</div> </div>
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal" on:click=move |_| opener.hide()> <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal"
on:click=move |_| {validator.reset(); opener.hide()}>
{trl("Close")} {trl("Close")}
</button> </button>
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">

@ -58,4 +58,8 @@ impl Validator {
pub fn messages(&self) -> Option<Vec<String>> { pub fn messages(&self) -> Option<Vec<String>> {
self.messages.get() self.messages.get()
} }
pub fn reset(&self) {
self.set_valid.update(|v| *v = true);
}
} }
Loading…
Cancel
Save