[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"] ((\c ->
[tr [] [ th [scope "col"] [ b' [text ""] ] let DocumentsView r = c.row in
, th [scope "col"] [ b' [text "Date"]] [ div [className $ fa r.fav <> "fa-star"] []
, th [scope "col"] [ b' [text "Title"] ] -- TODO show date: Year-Month-Day only
, th [scope "col"] [ b' [text "Source"] ] , text r.date
, th [scope "col"] [ b' [text "Delete"] ] , a [ href (toUrl Front Url_Document r._id) ] [ text r.title ]
] , text r.source
] , input [ _type "checkbox"]
, tbody [] $ map showRow d.rows ]) <$> 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"]
where [tr [] ((\colName -> th [scope "col"] [ b' [text colName]]) <$> colNames)
fa = case c.fav of ]
true -> "fas " , tbody [] $ map (tr [] <<< map (\c -> td [] [c])) rows
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