[TABLE] step 1

parent aa0c76ea
...@@ -145,27 +145,28 @@ layoutDocview = simpleSpec performAction render ...@@ -145,27 +145,28 @@ layoutDocview = simpleSpec performAction render
[ p [] [] [ p [] []
, div [] [ text " Filter ", input []] , div [] [ text " Filter ", input []]
, br' , br'
, div [className "row"] , showTable d dispatch
[ div [className "col-md-1"] [b [] [text d.title]] [ ""
, div [className "col-md-2"] [sizeDD d.pageSize dispatch] , "Date"
, div [className "col-md-3"] [textDescription d.currentPage d.pageSize d.totalRecords] , "Title"
, div [className "col-md-3"] [pagination dispatch d.totalPages d.currentPage] , "Source"
] , "Delete"
, table [ className "table"]
[thead [ className "thead-dark"]
[tr [] [ th [scope "col"] [ b' [text ""] ]
, th [scope "col"] [ b' [text "Date"]]
, th [scope "col"] [ b' [text "Title"] ]
, th [scope "col"] [ b' [text "Source"] ]
, th [scope "col"] [ b' [text "Delete"] ]
]
]
, tbody [] $ map showRow d.rows
] ]
((\c ->
let DocumentsView r = c.row in
[ div [className $ fa r.fav <> "fa-star"] []
-- TODO show date: Year-Month-Day only
, text r.date
, a [ href (toUrl Front Url_Document r._id) ] [ text r.title ]
, text r.source
, input [ _type "checkbox"]
]) <$> d.rows)
] ]
] ]
] ]
] ]
fa true = "fas "
fa false = "far "
performAction :: PerformAction State {} Action performAction :: PerformAction State {} Action
...@@ -260,21 +261,21 @@ initialState = TableData ...@@ -260,21 +261,21 @@ initialState = TableData
} }
showRow :: {row :: DocumentsView, delete :: Boolean} -> ReactElement showTable {title, pageSize, currentPage, totalRecords, totalPages} dispatch colNames rows =
showRow {row : (DocumentsView c), delete} = div []
tr [] [ div [className "row"]
[ td [] [div [className $ fa <> "fa-star"][]] [ div [className "col-md-1"] [b [] [text title]]
-- TODO show date: Year-Month-Day only , div [className "col-md-2"] [sizeDD pageSize dispatch]
, td [] [text c.date] , div [className "col-md-3"] [textDescription currentPage pageSize totalRecords]
, td [] [ a [ href (toUrl Front Url_Document c._id) ] [ text c.title ] ] , div [className "col-md-3"] [pagination dispatch totalPages currentPage]
, td [] [text c.source] ]
, td [] [input [ _type "checkbox"]] , table [ className "table"]
[thead [ className "thead-dark"]
[tr [] ((\colName -> th [scope "col"] [ b' [text colName]]) <$> colNames)
]
, tbody [] $ map (tr [] <<< map (\c -> td [] [c])) rows
]
] ]
where
fa = case c.fav of
true -> "fas "
false -> "far "
-------------------------------------------------------------- --------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment