Skip to content

Commit

Permalink
Fix property details modal
Browse files Browse the repository at this point in the history
  • Loading branch information
theprash committed Feb 5, 2018
1 parent 07c5537 commit d10a746
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
53 changes: 27 additions & 26 deletions src/client/pages/Details.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open Fable.Helpers.React.Props
open PropertyMapper.Contracts
open Fable

let view txn =
let private content txn =
let field name value =
value
|> Option.map(fun v ->
Expand All @@ -15,31 +15,32 @@ let view txn =
])
|> Option.defaultValue (div [] [])

div [ ClassName "modal fade"; Id "exampleModal"; Role "dialog"; unbox ("aria-labelledby", "exampleModalLabel"); unbox ("aria-hidden", "true") ] [
div [ ClassName "modal-dialog"; Role "document" ] [
div [ ClassName "modal-content" ] [
div [ ClassName "modal-header" ] [
h5 [ ClassName "modal-title"; Id "exampleModalLabel" ] [ str txn.Address.FirstLine ]
button [ Type "button"; ClassName "close"; unbox ("data-dismiss", "modal"); unbox ("aria-label", "Close") ] [
span [ unbox ("aria-hidden", true) ] [ str "x" ]
]
]
div [ ClassName "modal-body" ] [
field "Building / Street" (Some txn.Address.FirstLine)
field "Town" (Some txn.Address.TownCity)
field "District" (Some txn.Address.District)
field "County" (Some txn.Address.County)
field "Locality" txn.Address.Locality
field "Post Code" txn.Address.PostCode
field "Price" (Some(sprintf "£%s" (txn.Price |> commaSeparate)))
field "Date of Transfer" (Some (txn.DateOfTransfer.ToShortDateString()))
field "Property Type" (txn.BuildDetails.PropertyType |> Option.map(fun pt -> pt.Description))
field "Build Type" (Some (string txn.BuildDetails.Build.Description))
field "Contract" (Some (string txn.BuildDetails.Contract.Description))
]
div [ ClassName "modal-footer" ] [
button [ Type "button"; ClassName "btn btn-primary"; unbox ("data-dismiss", "modal") ] [ str "Close" ]
]
div [ ClassName "modal-content" ] [
div [ ClassName "modal-header" ] [
h5 [ ClassName "modal-title"; Id "exampleModalLabel" ] [ str txn.Address.FirstLine ]
button [ Type "button"; ClassName "close"; unbox ("data-dismiss", "modal"); unbox ("aria-label", "Close") ] [
span [ unbox ("aria-hidden", true) ] [ str "x" ]
]
]
div [ ClassName "modal-body" ] [
field "Building / Street" (Some txn.Address.FirstLine)
field "Town" (Some txn.Address.TownCity)
field "District" (Some txn.Address.District)
field "County" (Some txn.Address.County)
field "Locality" txn.Address.Locality
field "Post Code" txn.Address.PostCode
field "Price" (Some(sprintf "£%s" (txn.Price |> commaSeparate)))
field "Date of Transfer" (Some (txn.DateOfTransfer.ToShortDateString()))
field "Property Type" (txn.BuildDetails.PropertyType |> Option.map(fun pt -> pt.Description))
field "Build Type" (Some (string txn.BuildDetails.Build.Description))
field "Contract" (Some (string txn.BuildDetails.Contract.Description))
]
div [ ClassName "modal-footer" ] [
button [ Type "button"; ClassName "btn btn-primary"; unbox ("data-dismiss", "modal") ] [ str "Close" ]
]
]

let view txn =
div [ ClassName "modal fade"; Id "exampleModal"; Role "dialog"; unbox ("aria-labelledby", "exampleModalLabel"); unbox ("aria-hidden", "true") ] [
div [ ClassName "modal-dialog"; Role "document" ] (match txn with Some txn -> [ content txn ] | None -> [])
]
2 changes: 1 addition & 1 deletion src/client/pages/Search.fs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ let viewResults searchResults dispatch =
let view model dispatch =
let progressBarVisibility = match model.Status with | Searching -> "visible" | Displaying -> "invisible"
div [ ClassName "col" ] [
yield! model.Selected |> function Some property -> [ Details.view property ] | None -> []
yield Details.view model.Selected
yield div [ ClassName "border rounded m-3 p-3 bg-light" ] [
div [ ClassName "form-group" ] [
label [ HtmlFor "searchValue" ] [ str "Search for" ]
Expand Down

0 comments on commit d10a746

Please sign in to comment.