2017-07-17 10:53:38 +00:00
|
|
|
module Views.ScheduleOverview exposing (scheduleOverviewView)
|
|
|
|
|
|
|
|
-- Local modules
|
|
|
|
|
|
|
|
import Messages exposing (Msg(..))
|
|
|
|
import Models exposing (Model, Day, EventInstance)
|
2017-07-19 14:12:12 +00:00
|
|
|
import Views.FilterView exposing (filterSidebar, applyFilters)
|
2017-07-17 10:53:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
-- External modules
|
|
|
|
|
|
|
|
import Html exposing (Html, text, div, ul, li, span, i, h4, p, small, a)
|
2017-07-17 15:59:38 +00:00
|
|
|
import Html.Lazy exposing (lazy, lazy2)
|
2017-07-17 10:53:38 +00:00
|
|
|
import Html.Attributes exposing (class, classList, href, style)
|
2017-07-19 14:12:12 +00:00
|
|
|
import Date.Extra
|
2017-07-17 10:53:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
scheduleOverviewView : Model -> Html Msg
|
|
|
|
scheduleOverviewView model =
|
|
|
|
div [ class "row" ]
|
|
|
|
[ filterSidebar model
|
|
|
|
, div
|
|
|
|
[ classList
|
|
|
|
[ ( "col-sm-9", True )
|
|
|
|
, ( "col-sm-pull-3", True )
|
|
|
|
]
|
|
|
|
]
|
2017-07-17 15:59:38 +00:00
|
|
|
(List.map (\day -> lazy2 dayRowView day model) model.days)
|
2017-07-17 10:53:38 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
dayRowView : Day -> Model -> Html Msg
|
|
|
|
dayRowView day model =
|
|
|
|
let
|
|
|
|
filteredEventInstances =
|
2017-07-19 14:12:12 +00:00
|
|
|
applyFilters day model
|
2017-07-17 10:53:38 +00:00
|
|
|
in
|
|
|
|
div []
|
|
|
|
[ h4 []
|
|
|
|
[ text day.repr ]
|
|
|
|
, div [ class "schedule-day-row" ]
|
2017-07-17 15:59:38 +00:00
|
|
|
(List.map (lazy dayEventInstanceView) filteredEventInstances)
|
2017-07-17 10:53:38 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
dayEventInstanceView : EventInstance -> Html Msg
|
|
|
|
dayEventInstanceView eventInstance =
|
|
|
|
a
|
2017-07-19 14:12:12 +00:00
|
|
|
[ classList
|
|
|
|
[ ( "event", True )
|
|
|
|
, ( "event-in-overview", True )
|
|
|
|
]
|
2017-07-17 14:05:38 +00:00
|
|
|
, href ("#event/" ++ eventInstance.eventSlug)
|
2017-07-17 10:53:38 +00:00
|
|
|
, style
|
|
|
|
[ ( "background-color", eventInstance.backgroundColor )
|
|
|
|
, ( "color", eventInstance.forgroundColor )
|
|
|
|
]
|
|
|
|
]
|
2017-07-18 11:35:17 +00:00
|
|
|
([ small []
|
2017-07-17 19:48:56 +00:00
|
|
|
[ text
|
2017-07-19 14:12:12 +00:00
|
|
|
((Date.Extra.toFormattedString "HH:mm" eventInstance.from)
|
2017-07-17 19:48:56 +00:00
|
|
|
++ " - "
|
2017-07-19 14:12:12 +00:00
|
|
|
++ (Date.Extra.toFormattedString "HH:mm" eventInstance.to)
|
2017-07-17 19:48:56 +00:00
|
|
|
)
|
|
|
|
]
|
2017-07-18 11:35:17 +00:00
|
|
|
]
|
|
|
|
++ (dayEventInstanceIcons eventInstance)
|
|
|
|
++ [ p
|
|
|
|
[]
|
|
|
|
[ text eventInstance.title ]
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
dayEventInstanceIcons : EventInstance -> List (Html Msg)
|
|
|
|
dayEventInstanceIcons eventInstance =
|
|
|
|
let
|
|
|
|
videoIcon =
|
|
|
|
if eventInstance.videoUrl /= "" then
|
|
|
|
[ i [ classList [ ( "fa", True ), ( "fa-film", True ), ( "pull-right", True ) ] ] [] ]
|
|
|
|
else if eventInstance.videoRecording then
|
|
|
|
[ i [ classList [ ( "fa", True ), ( "fa-video-camera", True ), ( "pull-right", True ) ] ] [] ]
|
|
|
|
else
|
|
|
|
[]
|
|
|
|
in
|
|
|
|
[ i [ classList [ ( "fa", True ), ( "fa-" ++ eventInstance.locationIcon, True ), ( "pull-right", True ) ] ] []
|
2017-07-17 10:53:38 +00:00
|
|
|
]
|
2017-07-18 11:35:17 +00:00
|
|
|
++ videoIcon
|