github.com/simpleiot/simpleiot@v0.18.3/frontend/src/Components/NodeUser.elm (about)

     1  module Components.NodeUser exposing (view)
     2  
     3  import Api.Point as Point
     4  import Components.NodeOptions exposing (NodeOptions, oToInputO)
     5  import Element exposing (..)
     6  import Element.Border as Border
     7  import UI.Icon as Icon
     8  import UI.NodeInputs as NodeInputs
     9  import UI.Style exposing (colors)
    10  
    11  
    12  view : NodeOptions msg -> Element msg
    13  view o =
    14      column
    15          [ width fill
    16          , Border.widthEach { top = 2, bottom = 0, left = 0, right = 0 }
    17          , Border.color colors.black
    18          , spacing 6
    19          ]
    20      <|
    21          wrappedRow [ spacing 10 ]
    22              [ Icon.user
    23              , text <|
    24                  Point.getText o.node.points Point.typeFirstName "0"
    25                      ++ " "
    26                      ++ Point.getText o.node.points Point.typeLastName "0"
    27              ]
    28              :: (if o.expDetail then
    29                      let
    30                          labelWidth =
    31                              100
    32  
    33                          textInputLowerCase =
    34                              NodeInputs.nodeTextInput
    35                                  { onEditNodePoint =
    36                                      \points ->
    37                                          o.onEditNodePoint <| List.map (\p -> { p | text = String.toLower p.text }) points
    38                                  , node = o.node
    39                                  , now = o.now
    40                                  , zone = o.zone
    41                                  , labelWidth = labelWidth
    42                                  , scratch = o.scratch
    43                                  , onEditScratch = o.onEditScratch
    44                                  }
    45                                  "0"
    46  
    47                          opts =
    48                              oToInputO o labelWidth
    49  
    50                          textInput =
    51                              NodeInputs.nodeTextInput opts "0"
    52                      in
    53                      [ textInput Point.typeFirstName "First Name" ""
    54                      , textInput Point.typeLastName "Last Name" ""
    55                      , textInputLowerCase Point.typeEmail "Email/User" ""
    56                      , textInput Point.typePhone "Phone" ""
    57                      , textInput Point.typePass "Pass" ""
    58                      , NodeInputs.nodeKeyValueInput opts Point.typeTag "Tags" "Add Tag"
    59                      ]
    60  
    61                  else
    62                      []
    63                 )