A bit of CSS styling
parent
f91dfe331f
commit
8f6821ee88
|
@ -103,7 +103,7 @@ init _ = (
|
|||
} , Task.perform AdjustTimeZone Time.here
|
||||
)
|
||||
|
||||
{- not for actual solution requested -}
|
||||
|
||||
addMonths : Int -> Date -> Date
|
||||
addMonths count date =
|
||||
if count > 0
|
||||
|
@ -115,7 +115,6 @@ addDays count date =
|
|||
if count > 0
|
||||
then addDays (count - 1) (Date.next date)
|
||||
else date
|
||||
{- end -}
|
||||
|
||||
getWeekday : Date -> Weekday
|
||||
getWeekday date =
|
||||
|
@ -220,7 +219,7 @@ validateModel model =
|
|||
Sat -> Err "Datum darf kein Samstag sein"
|
||||
Sun -> Err "Datum darf kein Sonntag sein"
|
||||
_ -> case model.beginndatum of
|
||||
(day, month, year) -> if day > getMonthLength (day, month, year) || day < 0 then
|
||||
(day, month, year) -> if day > getMonthLength (day, month, year) || day <= 0 then
|
||||
Err "Tag ist außerhalb des Monats"
|
||||
else if month < 1 || month > 12 then
|
||||
Err "Monat muss zwischen 1 und 12 liegen"
|
||||
|
@ -232,23 +231,23 @@ findNextDateOfWeekday : Date -> Weekday -> Date
|
|||
findNextDateOfWeekday date weekday =
|
||||
if getWeekday date == weekday then date else findNextDateOfWeekday (Date.next date) weekday
|
||||
|
||||
berechneDaten : Model -> List String
|
||||
berechneDaten : Model -> List (String, String)
|
||||
berechneDaten model =
|
||||
let beginndatum = model.beginndatum
|
||||
enddatum = calculateAbgabeEndDate model.arbeit beginndatum
|
||||
besprechungsWochentag = model.besprechungsWochentag
|
||||
anzahlWochenZwischenBesprechung = model.anzahlWochenZwischenBesprechung
|
||||
in List.concat [
|
||||
((formatDateOutput beginndatum) ++ " (Beginn)") :: (berechneZwischentermine (findNextDateOfWeekday (Date.next beginndatum) besprechungsWochentag) enddatum anzahlWochenZwischenBesprechung besprechungsWochentag)
|
||||
, [(formatDateOutput enddatum) ++ " (Ende)"]
|
||||
((formatDateOutput beginndatum), "Beginn") :: (berechneZwischentermine (findNextDateOfWeekday (Date.next beginndatum) besprechungsWochentag) enddatum anzahlWochenZwischenBesprechung besprechungsWochentag)
|
||||
, [((formatDateOutput enddatum), "Ende")]
|
||||
]
|
||||
|
||||
berechneZwischentermine : Date -> Date -> Int -> Weekday -> List String
|
||||
berechneZwischentermine : Date -> Date -> Int -> Weekday -> List (String, String)
|
||||
berechneZwischentermine datum enddatum wochenAbstand wochentag =
|
||||
let nextBesprechung = addDays (wochenAbstand * 7) datum
|
||||
isOver = Date.gt datum enddatum || Date.eq datum enddatum
|
||||
in if isOver then [] else
|
||||
((formatDateOutput datum) ++ " (Besprechung)") :: (berechneZwischentermine nextBesprechung enddatum wochenAbstand wochentag)
|
||||
((formatDateOutput datum), "Besprechung") :: (berechneZwischentermine nextBesprechung enddatum wochenAbstand wochentag)
|
||||
|
||||
monthToIndex : Time.Month -> Int
|
||||
monthToIndex month =
|
||||
|
@ -318,33 +317,48 @@ view : Model -> Html Msg
|
|||
view model =
|
||||
div []
|
||||
[
|
||||
select [onInput SetDegree]
|
||||
[
|
||||
option [value "Bachelor"] [text "Bachelor"]
|
||||
, option [value "Master"] [text "Master"]
|
||||
]
|
||||
, input [onInput SetStartDate, placeholder "21 12 2022"] []
|
||||
, select [onInput SetBesprechundsWochentag]
|
||||
[
|
||||
option [value "Montag"] [text "Montag"]
|
||||
, option [value "Dienstag"] [text "Dienstag"]
|
||||
, option [value "Mittwoch"] [text "Mittwoch"]
|
||||
, option [value "Donnerstag"] [text "Donnerstag"]
|
||||
, option [value "Freitag"] [text "Freitag"]
|
||||
]
|
||||
, select [onInput SetInterval]
|
||||
[
|
||||
option [value "1"] [text "1 Woche"]
|
||||
, option [value "2"] [text "2 Wochen"]
|
||||
, option [value "3"] [text "3 Wochen"]
|
||||
, option [value "4"] [text "4 Wochen"]
|
||||
div [style "display" "flex", style "justify-content" "center", style "margin-top" "20px", style "gap" "5px"]
|
||||
[
|
||||
input [onInput SetStartDate, placeholder "21 12 2022"] []
|
||||
, select [onInput SetDegree, style "" ""]
|
||||
[
|
||||
option [value "Bachelor"] [text "Bachelor"]
|
||||
, option [value "Master"] [text "Master"]
|
||||
]
|
||||
, select [onInput SetBesprechundsWochentag]
|
||||
[
|
||||
option [value "Montag"] [text "Montag"]
|
||||
, option [value "Dienstag"] [text "Dienstag"]
|
||||
, option [value "Mittwoch"] [text "Mittwoch"]
|
||||
, option [value "Donnerstag"] [text "Donnerstag"]
|
||||
, option [value "Freitag"] [text "Freitag"]
|
||||
]
|
||||
, select [onInput SetInterval]
|
||||
[
|
||||
option [value "1"] [text "1 Woche"]
|
||||
, option [value "2"] [text "2 Wochen"]
|
||||
, option [value "3"] [text "3 Wochen"]
|
||||
, option [value "4"] [text "4 Wochen"]
|
||||
|
||||
]
|
||||
]
|
||||
]
|
||||
, br [] []
|
||||
, ul []
|
||||
(model
|
||||
|> berechneDaten
|
||||
|> List.map (\datum -> li [] [text datum]))
|
||||
, text model.status
|
||||
, div [style "display" "flex", style "justify-content" "center", style "margin-top" "20px", style "gap" "5px"] [
|
||||
table [style "border-collapse" "collapse"]
|
||||
[
|
||||
thead [] [
|
||||
tr [] [
|
||||
th [] [text "Datum"]
|
||||
, th [] [text "Typ"]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(model
|
||||
|> berechneDaten
|
||||
|> List.map (\(datum, typ) -> tr [] [td [] [text datum], td [] [text typ]]))
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
subscriptions : Model -> Sub Msg
|
||||
|
|
Loading…
Reference in New Issue