A bit of CSS styling
parent
f91dfe331f
commit
8f6821ee88
|
@ -103,7 +103,7 @@ init _ = (
|
||||||
} , Task.perform AdjustTimeZone Time.here
|
} , Task.perform AdjustTimeZone Time.here
|
||||||
)
|
)
|
||||||
|
|
||||||
{- not for actual solution requested -}
|
|
||||||
addMonths : Int -> Date -> Date
|
addMonths : Int -> Date -> Date
|
||||||
addMonths count date =
|
addMonths count date =
|
||||||
if count > 0
|
if count > 0
|
||||||
|
@ -115,7 +115,6 @@ addDays count date =
|
||||||
if count > 0
|
if count > 0
|
||||||
then addDays (count - 1) (Date.next date)
|
then addDays (count - 1) (Date.next date)
|
||||||
else date
|
else date
|
||||||
{- end -}
|
|
||||||
|
|
||||||
getWeekday : Date -> Weekday
|
getWeekday : Date -> Weekday
|
||||||
getWeekday date =
|
getWeekday date =
|
||||||
|
@ -220,7 +219,7 @@ validateModel model =
|
||||||
Sat -> Err "Datum darf kein Samstag sein"
|
Sat -> Err "Datum darf kein Samstag sein"
|
||||||
Sun -> Err "Datum darf kein Sonntag sein"
|
Sun -> Err "Datum darf kein Sonntag sein"
|
||||||
_ -> case model.beginndatum of
|
_ -> 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"
|
Err "Tag ist außerhalb des Monats"
|
||||||
else if month < 1 || month > 12 then
|
else if month < 1 || month > 12 then
|
||||||
Err "Monat muss zwischen 1 und 12 liegen"
|
Err "Monat muss zwischen 1 und 12 liegen"
|
||||||
|
@ -232,23 +231,23 @@ findNextDateOfWeekday : Date -> Weekday -> Date
|
||||||
findNextDateOfWeekday date weekday =
|
findNextDateOfWeekday date weekday =
|
||||||
if getWeekday date == weekday then date else findNextDateOfWeekday (Date.next 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 =
|
berechneDaten model =
|
||||||
let beginndatum = model.beginndatum
|
let beginndatum = model.beginndatum
|
||||||
enddatum = calculateAbgabeEndDate model.arbeit beginndatum
|
enddatum = calculateAbgabeEndDate model.arbeit beginndatum
|
||||||
besprechungsWochentag = model.besprechungsWochentag
|
besprechungsWochentag = model.besprechungsWochentag
|
||||||
anzahlWochenZwischenBesprechung = model.anzahlWochenZwischenBesprechung
|
anzahlWochenZwischenBesprechung = model.anzahlWochenZwischenBesprechung
|
||||||
in List.concat [
|
in List.concat [
|
||||||
((formatDateOutput beginndatum) ++ " (Beginn)") :: (berechneZwischentermine (findNextDateOfWeekday (Date.next beginndatum) besprechungsWochentag) enddatum anzahlWochenZwischenBesprechung besprechungsWochentag)
|
((formatDateOutput beginndatum), "Beginn") :: (berechneZwischentermine (findNextDateOfWeekday (Date.next beginndatum) besprechungsWochentag) enddatum anzahlWochenZwischenBesprechung besprechungsWochentag)
|
||||||
, [(formatDateOutput enddatum) ++ " (Ende)"]
|
, [((formatDateOutput enddatum), "Ende")]
|
||||||
]
|
]
|
||||||
|
|
||||||
berechneZwischentermine : Date -> Date -> Int -> Weekday -> List String
|
berechneZwischentermine : Date -> Date -> Int -> Weekday -> List (String, String)
|
||||||
berechneZwischentermine datum enddatum wochenAbstand wochentag =
|
berechneZwischentermine datum enddatum wochenAbstand wochentag =
|
||||||
let nextBesprechung = addDays (wochenAbstand * 7) datum
|
let nextBesprechung = addDays (wochenAbstand * 7) datum
|
||||||
isOver = Date.gt datum enddatum || Date.eq datum enddatum
|
isOver = Date.gt datum enddatum || Date.eq datum enddatum
|
||||||
in if isOver then [] else
|
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 : Time.Month -> Int
|
||||||
monthToIndex month =
|
monthToIndex month =
|
||||||
|
@ -318,12 +317,14 @@ view : Model -> Html Msg
|
||||||
view model =
|
view model =
|
||||||
div []
|
div []
|
||||||
[
|
[
|
||||||
select [onInput SetDegree]
|
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 "Bachelor"] [text "Bachelor"]
|
||||||
, option [value "Master"] [text "Master"]
|
, option [value "Master"] [text "Master"]
|
||||||
]
|
]
|
||||||
, input [onInput SetStartDate, placeholder "21 12 2022"] []
|
|
||||||
, select [onInput SetBesprechundsWochentag]
|
, select [onInput SetBesprechundsWochentag]
|
||||||
[
|
[
|
||||||
option [value "Montag"] [text "Montag"]
|
option [value "Montag"] [text "Montag"]
|
||||||
|
@ -340,11 +341,24 @@ view model =
|
||||||
, option [value "4"] [text "4 Wochen"]
|
, option [value "4"] [text "4 Wochen"]
|
||||||
|
|
||||||
]
|
]
|
||||||
|
]
|
||||||
, br [] []
|
, br [] []
|
||||||
, ul []
|
, 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
|
(model
|
||||||
|> berechneDaten
|
|> berechneDaten
|
||||||
|> List.map (\datum -> li [] [text datum]))
|
|> List.map (\(datum, typ) -> tr [] [td [] [text datum], td [] [text typ]]))
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
subscriptions : Model -> Sub Msg
|
subscriptions : Model -> Sub Msg
|
||||||
|
|
Loading…
Reference in New Issue