mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-01-26 00:18:26 +00:00
21 lines
591 B
Elm
21 lines
591 B
Elm
|
module Util.Person exposing (mkPersonOption)
|
||
|
|
||
|
import Api.Model.IdName exposing (IdName)
|
||
|
import Api.Model.Person exposing (Person)
|
||
|
import Comp.Dropdown
|
||
|
import Dict exposing (Dict)
|
||
|
import Util.String
|
||
|
|
||
|
|
||
|
mkPersonOption : IdName -> Dict String Person -> Comp.Dropdown.Option
|
||
|
mkPersonOption idref personDict =
|
||
|
let
|
||
|
org =
|
||
|
Dict.get idref.id personDict
|
||
|
|> Maybe.andThen .organization
|
||
|
|> Maybe.map .name
|
||
|
|> Maybe.map (Util.String.ellipsis 15)
|
||
|
|> Maybe.withDefault ""
|
||
|
in
|
||
|
Comp.Dropdown.Option idref.name org
|