mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 02:48:26 +00:00
Externalize strings in manage-data page
This commit is contained in:
@ -14,6 +14,7 @@ import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onInput)
|
||||
import Messages.AddressFormComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.List
|
||||
|
||||
@ -110,12 +111,12 @@ update msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : UiSettings -> Model -> Html Msg
|
||||
view2 settings model =
|
||||
view2 : Texts -> UiSettings -> Model -> Html Msg
|
||||
view2 texts settings model =
|
||||
let
|
||||
countryCfg =
|
||||
{ makeOption = \c -> { text = c.label, additional = "" }
|
||||
, placeholder = "Select Country"
|
||||
, placeholder = texts.selectCountry
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, style = DS.mainStyle
|
||||
}
|
||||
@ -128,12 +129,12 @@ view2 settings model =
|
||||
[ for "street"
|
||||
, class S.inputLabel
|
||||
]
|
||||
[ text "Street"
|
||||
[ text texts.street
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetStreet
|
||||
, placeholder "Street"
|
||||
, placeholder texts.street
|
||||
, value model.street
|
||||
, name "street"
|
||||
, class S.textInput
|
||||
@ -147,12 +148,12 @@ view2 settings model =
|
||||
[ for "zip"
|
||||
, class S.inputLabel
|
||||
]
|
||||
[ text "Zip Code"
|
||||
[ text texts.zipCode
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetZip
|
||||
, placeholder "Zip"
|
||||
, placeholder texts.zipCode
|
||||
, value model.zip
|
||||
, name "zip"
|
||||
, class S.textInput
|
||||
@ -166,12 +167,12 @@ view2 settings model =
|
||||
[ for "city"
|
||||
, class S.inputLabel
|
||||
]
|
||||
[ text "City"
|
||||
[ text texts.city
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetCity
|
||||
, placeholder "City"
|
||||
, placeholder texts.city
|
||||
, value model.city
|
||||
, name "city"
|
||||
, class S.textInput
|
||||
@ -180,7 +181,7 @@ view2 settings model =
|
||||
]
|
||||
, div [ class "" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "Country"
|
||||
[ text texts.country
|
||||
]
|
||||
, Html.map CountryMsg
|
||||
(Comp.Dropdown.view2
|
||||
|
@ -1,6 +1,7 @@
|
||||
module Comp.ContactField exposing
|
||||
( Model
|
||||
, Msg(..)
|
||||
, ViewSettings
|
||||
, emptyModel
|
||||
, getContacts
|
||||
, update
|
||||
@ -115,11 +116,17 @@ update msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Bool -> UiSettings -> Model -> Html Msg
|
||||
view2 mobile _ model =
|
||||
type alias ViewSettings =
|
||||
{ contactTypeLabel : ContactType -> String
|
||||
, mobile : Bool
|
||||
}
|
||||
|
||||
|
||||
view2 : ViewSettings -> UiSettings -> Model -> Html Msg
|
||||
view2 cfg _ model =
|
||||
let
|
||||
kindCfg =
|
||||
{ display = Data.ContactType.toString
|
||||
{ display = cfg.contactTypeLabel
|
||||
, icon = \_ -> Nothing
|
||||
, style = DS.mainStyle
|
||||
}
|
||||
@ -127,10 +134,10 @@ view2 mobile _ model =
|
||||
div [ class "flex flex-col" ]
|
||||
[ div
|
||||
[ class "flex flex-col space-y-2"
|
||||
, classList [ ( " md:flex-row md:space-y-0 md:space-x-2", not mobile ) ]
|
||||
, classList [ ( " md:flex-row md:space-y-0 md:space-x-2", not cfg.mobile ) ]
|
||||
]
|
||||
[ div
|
||||
[ classList [ ( "flex-none md:w-1/6", not mobile ) ]
|
||||
[ classList [ ( "flex-none md:w-1/6", not cfg.mobile ) ]
|
||||
]
|
||||
[ Html.map TypeMsg
|
||||
(Comp.FixedDropdown.viewStyled2
|
||||
@ -163,7 +170,7 @@ view2 mobile _ model =
|
||||
]
|
||||
, class "flex flex-col space-y-2 mt-2 px-2 border-0 border-l dark:border-bluegray-600 "
|
||||
]
|
||||
(List.map (renderItem2 mobile) model.items)
|
||||
(List.map (renderItem2 cfg.mobile) model.items)
|
||||
]
|
||||
|
||||
|
||||
|
@ -23,8 +23,9 @@ import Data.Flags exposing (Flags)
|
||||
import Data.Validated exposing (Validated)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Html.Events exposing (onInput)
|
||||
import Http
|
||||
import Messages.CustomFieldFormComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
import Util.Maybe
|
||||
@ -196,20 +197,20 @@ type alias ViewSettings =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : ViewSettings -> Model -> List (Html Msg)
|
||||
view2 viewSettings model =
|
||||
view2 : Texts -> ViewSettings -> Model -> List (Html Msg)
|
||||
view2 texts viewSettings model =
|
||||
let
|
||||
dimmerSettings =
|
||||
Comp.YesNoDimmer.defaultSettings2 "Really delete this custom field?"
|
||||
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteField
|
||||
|
||||
ftypeCfg =
|
||||
{ display = Data.CustomFieldType.label
|
||||
{ display = texts.fieldTypeLabel
|
||||
, icon = \_ -> Nothing
|
||||
, style = DS.mainStyle
|
||||
}
|
||||
in
|
||||
(if viewSettings.showControls then
|
||||
[ viewButtons2 model ]
|
||||
[ viewButtons2 texts model ]
|
||||
|
||||
else
|
||||
[]
|
||||
@ -238,20 +239,19 @@ view2 viewSettings model =
|
||||
]
|
||||
, if model.field.id == "" then
|
||||
div [ class "py-2 text-lg opacity-75" ]
|
||||
[ text "Create a new custom field."
|
||||
[ text texts.createCustomField
|
||||
]
|
||||
|
||||
else
|
||||
div [ class "py-2 text-lg opacity-75" ]
|
||||
[ text "Note that changing the format may "
|
||||
, text "result in invisible values in the ui, if they don't comply to the new format!"
|
||||
[ text texts.modifyTypeWarning
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ label
|
||||
[ class S.inputLabel
|
||||
, for "fieldname"
|
||||
]
|
||||
[ text "Name"
|
||||
[ text texts.name
|
||||
, B.inputRequired
|
||||
]
|
||||
, input
|
||||
@ -268,15 +268,14 @@ view2 viewSettings model =
|
||||
]
|
||||
[]
|
||||
, div [ class "opacity-75 text-sm" ]
|
||||
[ text "The name uniquely identifies this field. It must be a valid "
|
||||
, text "identifier, not contain spaces or weird characters."
|
||||
[ text texts.nameInfo
|
||||
]
|
||||
]
|
||||
, div
|
||||
[ class "mb-4"
|
||||
]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "Field Format"
|
||||
[ text texts.fieldFormat
|
||||
, B.inputRequired
|
||||
]
|
||||
, Html.map FTypeMsg
|
||||
@ -287,8 +286,7 @@ view2 viewSettings model =
|
||||
model.ftypeModel
|
||||
)
|
||||
, div [ class "opacity-75 text-sm" ]
|
||||
[ text "A field must have a format. Values are validated "
|
||||
, text "according to this format."
|
||||
[ text texts.fieldFormatInfo
|
||||
]
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
@ -296,7 +294,7 @@ view2 viewSettings model =
|
||||
[ class S.inputLabel
|
||||
, for "fieldlabel"
|
||||
]
|
||||
[ text "Label" ]
|
||||
[ text texts.label ]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetLabel
|
||||
@ -308,38 +306,37 @@ view2 viewSettings model =
|
||||
]
|
||||
[]
|
||||
, div [ class "opacity-75 text-sm" ]
|
||||
[ text "The user defined label for this field. This is used to represent "
|
||||
, text "this field in the ui. If not present, the name is used."
|
||||
[ text texts.labelInfo
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewButtons2 : Model -> Html Msg
|
||||
viewButtons2 model =
|
||||
viewButtons2 : Texts -> Model -> Html Msg
|
||||
viewButtons2 texts model =
|
||||
MB.view
|
||||
{ start =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = SubmitForm
|
||||
, title = "Submit this form"
|
||||
, title = texts.basics.submitThisForm
|
||||
, icon = Just "fa fa-save"
|
||||
, label = "Submit"
|
||||
, label = texts.basics.submit
|
||||
}
|
||||
, MB.SecondaryButton
|
||||
{ tagger = GoBack
|
||||
, title = "Back to list"
|
||||
, title = texts.basics.backToList
|
||||
, icon = Just "fa fa-arrow-left"
|
||||
, label = "Cancel"
|
||||
, label = texts.basics.cancel
|
||||
}
|
||||
]
|
||||
, end =
|
||||
if model.field.id /= "" then
|
||||
[ MB.DeleteButton
|
||||
{ tagger = RequestDelete
|
||||
, title = "Delete this field"
|
||||
, title = texts.deleteThisField
|
||||
, icon = Just "fa fa-trash"
|
||||
, label = "Delete"
|
||||
, label = texts.basics.delete
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -17,8 +17,8 @@ import Comp.MenuBar as MB
|
||||
import Data.Flags exposing (Flags)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Http
|
||||
import Messages.CustomFieldManageComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.CustomField
|
||||
|
||||
@ -135,18 +135,18 @@ update flags msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Flags -> Model -> Html Msg
|
||||
view2 flags model =
|
||||
view2 : Texts -> Flags -> Model -> Html Msg
|
||||
view2 texts flags model =
|
||||
case model.detailModel of
|
||||
Just dm ->
|
||||
viewDetail2 flags dm
|
||||
viewDetail2 texts flags dm
|
||||
|
||||
Nothing ->
|
||||
viewTable2 model
|
||||
viewTable2 texts model
|
||||
|
||||
|
||||
viewDetail2 : Flags -> Comp.CustomFieldForm.Model -> Html Msg
|
||||
viewDetail2 _ detailModel =
|
||||
viewDetail2 : Texts -> Flags -> Comp.CustomFieldForm.Model -> Html Msg
|
||||
viewDetail2 texts _ detailModel =
|
||||
let
|
||||
viewSettings =
|
||||
{ showControls = True
|
||||
@ -156,44 +156,52 @@ viewDetail2 _ detailModel =
|
||||
div []
|
||||
((if detailModel.field.id == "" then
|
||||
h3 [ class S.header2 ]
|
||||
[ text "Create new custom field"
|
||||
[ text texts.newCustomField
|
||||
]
|
||||
|
||||
else
|
||||
h3 [ class S.header2 ]
|
||||
[ Util.CustomField.nameOrLabel detailModel.field |> text
|
||||
, div [ class "opacity-50 text-sm" ]
|
||||
[ text "Id: "
|
||||
[ text (texts.basics.id ++ ": ")
|
||||
, text detailModel.field.id
|
||||
]
|
||||
]
|
||||
)
|
||||
:: List.map (Html.map DetailMsg) (Comp.CustomFieldForm.view2 viewSettings detailModel)
|
||||
:: List.map (Html.map DetailMsg)
|
||||
(Comp.CustomFieldForm.view2 texts.fieldForm
|
||||
viewSettings
|
||||
detailModel
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
viewTable2 : Model -> Html Msg
|
||||
viewTable2 model =
|
||||
viewTable2 : Texts -> Model -> Html Msg
|
||||
viewTable2 texts model =
|
||||
div [ class "flex flex-col md:relative" ]
|
||||
[ MB.view
|
||||
{ start =
|
||||
[ MB.TextInput
|
||||
{ tagger = SetQuery
|
||||
, value = model.query
|
||||
, placeholder = "Search…"
|
||||
, placeholder = texts.basics.searchPlaceholder
|
||||
, icon = Just "fa fa-search"
|
||||
}
|
||||
]
|
||||
, end =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = InitNewCustomField
|
||||
, title = "Add a new custom field"
|
||||
, title = texts.addCustomField
|
||||
, icon = Just "fa fa-plus"
|
||||
, label = "New custom field"
|
||||
, label = texts.newCustomField
|
||||
}
|
||||
]
|
||||
, rootClasses = "mb-4"
|
||||
}
|
||||
, Html.map TableMsg (Comp.CustomFieldTable.view2 model.tableModel model.fields)
|
||||
, Html.map TableMsg
|
||||
(Comp.CustomFieldTable.view2 texts.fieldTable
|
||||
model.tableModel
|
||||
model.fields
|
||||
)
|
||||
, B.loadingDimmer model.loading
|
||||
]
|
||||
|
@ -11,7 +11,7 @@ import Api.Model.CustomField exposing (CustomField)
|
||||
import Comp.Basic as B
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Messages.CustomFieldTableComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Time
|
||||
|
||||
@ -45,17 +45,17 @@ update msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> List CustomField -> Html Msg
|
||||
view2 _ items =
|
||||
view2 : Texts -> Model -> List CustomField -> Html Msg
|
||||
view2 texts _ items =
|
||||
div []
|
||||
[ table [ class S.tableMain ]
|
||||
[ thead []
|
||||
[ tr []
|
||||
[ th [] []
|
||||
, th [ class "text-left" ] [ text "Name/Label" ]
|
||||
, th [ class "text-left" ] [ text "Format" ]
|
||||
, th [ class "text-center hidden sm:table-cell" ] [ text "#Usage" ]
|
||||
, th [ class "text-center hidden sm:table-cell" ] [ text "Created" ]
|
||||
, th [ class "text-left" ] [ text texts.nameLabel ]
|
||||
, th [ class "text-left" ] [ text texts.format ]
|
||||
, th [ class "text-center hidden sm:table-cell" ] [ text texts.usageCount ]
|
||||
, th [ class "text-center hidden sm:table-cell" ] [ text texts.basics.created ]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
|
@ -47,6 +47,11 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Http
|
||||
import Messages.CustomFieldFormComp
|
||||
import Messages.EquipmentFormComp
|
||||
import Messages.OrgFormComp
|
||||
import Messages.PersonFormComp
|
||||
import Messages.TagFormComp
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
|
||||
@ -766,24 +771,25 @@ viewIntern2 settings withButtons model =
|
||||
]
|
||||
, case model.form of
|
||||
TM tm ->
|
||||
Html.map TagMsg (Comp.TagForm.view2 tm)
|
||||
Html.map TagMsg (Comp.TagForm.view2 Messages.TagFormComp.gb tm)
|
||||
|
||||
PMR pm ->
|
||||
Html.map PersonMsg (Comp.PersonForm.view2 True settings pm)
|
||||
Html.map PersonMsg (Comp.PersonForm.view2 Messages.PersonFormComp.gb True settings pm)
|
||||
|
||||
PMC pm ->
|
||||
Html.map PersonMsg (Comp.PersonForm.view2 True settings pm)
|
||||
Html.map PersonMsg (Comp.PersonForm.view2 Messages.PersonFormComp.gb True settings pm)
|
||||
|
||||
OM om ->
|
||||
Html.map OrgMsg (Comp.OrgForm.view2 True settings om)
|
||||
Html.map OrgMsg (Comp.OrgForm.view2 Messages.OrgFormComp.gb True settings om)
|
||||
|
||||
EM em ->
|
||||
Html.map EquipMsg (Comp.EquipmentForm.view2 em)
|
||||
Html.map EquipMsg (Comp.EquipmentForm.view2 Messages.EquipmentFormComp.gb em)
|
||||
|
||||
CFM fm ->
|
||||
div []
|
||||
(List.map (Html.map CustomFieldMsg)
|
||||
(Comp.CustomFieldForm.view2
|
||||
Messages.CustomFieldFormComp.gb
|
||||
{ classes = ""
|
||||
, showControls = False
|
||||
}
|
||||
|
@ -410,11 +410,11 @@ type alias ViewSettings a =
|
||||
}
|
||||
|
||||
|
||||
orgFormViewSettings : DS.DropdownStyle -> ViewSettings IdName
|
||||
orgFormViewSettings ds =
|
||||
orgFormViewSettings : String -> DS.DropdownStyle -> ViewSettings IdName
|
||||
orgFormViewSettings placeholder ds =
|
||||
{ makeOption = \e -> { text = e.name, additional = "" }
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, placeholder = "Choose an organization"
|
||||
, placeholder = placeholder
|
||||
, style = ds
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ import Data.Flags exposing (Flags)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onInput)
|
||||
import Messages.EquipmentFormComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Maybe
|
||||
|
||||
@ -99,11 +100,11 @@ update _ msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> Html Msg
|
||||
view2 model =
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
let
|
||||
equipUseCfg =
|
||||
{ display = Data.EquipmentUse.label
|
||||
{ display = texts.equipmentUseLabel
|
||||
, icon = \_ -> Nothing
|
||||
, style = DS.mainStyle
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onSubmit)
|
||||
import Http
|
||||
import Messages.EquipmentManageComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
import Util.Maybe
|
||||
@ -204,38 +205,41 @@ update flags msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> Html Msg
|
||||
view2 model =
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
if model.viewMode == Table then
|
||||
viewTable2 model
|
||||
viewTable2 texts model
|
||||
|
||||
else
|
||||
viewForm2 model
|
||||
viewForm2 texts model
|
||||
|
||||
|
||||
viewTable2 : Model -> Html Msg
|
||||
viewTable2 model =
|
||||
viewTable2 : Texts -> Model -> Html Msg
|
||||
viewTable2 texts model =
|
||||
div [ class "flex flex-col" ]
|
||||
[ MB.view
|
||||
{ start =
|
||||
[ MB.TextInput
|
||||
{ tagger = SetQuery
|
||||
, value = model.query
|
||||
, placeholder = "Search…"
|
||||
, placeholder = texts.basics.searchPlaceholder
|
||||
, icon = Just "fa fa-search"
|
||||
}
|
||||
]
|
||||
, end =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = InitNewEquipment
|
||||
, title = "Create a new equipment"
|
||||
, title = texts.createNewEquipment
|
||||
, icon = Just "fa fa-plus"
|
||||
, label = "New Equipment"
|
||||
, label = texts.newEquipment
|
||||
}
|
||||
]
|
||||
, rootClasses = "mb-4"
|
||||
}
|
||||
, Html.map TableMsg (Comp.EquipmentTable.view2 model.tableModel)
|
||||
, Html.map TableMsg
|
||||
(Comp.EquipmentTable.view2 texts.equipmentTable
|
||||
model.tableModel
|
||||
)
|
||||
, div
|
||||
[ classList
|
||||
[ ( "ui dimmer", True )
|
||||
@ -247,14 +251,14 @@ viewTable2 model =
|
||||
]
|
||||
|
||||
|
||||
viewForm2 : Model -> Html Msg
|
||||
viewForm2 model =
|
||||
viewForm2 : Texts -> Model -> Html Msg
|
||||
viewForm2 texts model =
|
||||
let
|
||||
newEquipment =
|
||||
model.formModel.equipment.id == ""
|
||||
|
||||
dimmerSettings2 =
|
||||
Comp.YesNoDimmer.defaultSettings2 "Really delete this equipment?"
|
||||
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteEquipment
|
||||
in
|
||||
Html.form
|
||||
[ class "relative flex flex-col"
|
||||
@ -268,14 +272,14 @@ viewForm2 model =
|
||||
)
|
||||
, if newEquipment then
|
||||
h1 [ class S.header2 ]
|
||||
[ text "Create new equipment"
|
||||
[ text texts.createNewEquipment
|
||||
]
|
||||
|
||||
else
|
||||
h1 [ class S.header2 ]
|
||||
[ text model.formModel.equipment.name
|
||||
, div [ class "opacity-50 text-sm" ]
|
||||
[ text "Id: "
|
||||
[ text (texts.basics.id ++ ": ")
|
||||
, text model.formModel.equipment.id
|
||||
]
|
||||
]
|
||||
@ -283,24 +287,24 @@ viewForm2 model =
|
||||
{ start =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = Submit
|
||||
, title = "Submit this form"
|
||||
, title = texts.basics.submitThisForm
|
||||
, icon = Just "fa fa-save"
|
||||
, label = "Submit"
|
||||
, label = texts.basics.submit
|
||||
}
|
||||
, MB.SecondaryButton
|
||||
{ tagger = SetViewMode Table
|
||||
, title = "Back to list"
|
||||
, title = texts.basics.backToList
|
||||
, icon = Just "fa fa-arrow-left"
|
||||
, label = "Cancel"
|
||||
, label = texts.basics.cancel
|
||||
}
|
||||
]
|
||||
, end =
|
||||
if not newEquipment then
|
||||
[ MB.DeleteButton
|
||||
{ tagger = RequestDelete
|
||||
, title = "Delete this equipment"
|
||||
, title = texts.deleteThisEquipment
|
||||
, icon = Just "fa fa-trash"
|
||||
, label = "Delete"
|
||||
, label = texts.basics.delete
|
||||
}
|
||||
]
|
||||
|
||||
@ -317,6 +321,6 @@ viewForm2 model =
|
||||
]
|
||||
[ Maybe.withDefault "" model.formError |> text
|
||||
]
|
||||
, Html.map FormMsg (Comp.EquipmentForm.view2 model.formModel)
|
||||
, Html.map FormMsg (Comp.EquipmentForm.view2 texts.equipmentForm model.formModel)
|
||||
, B.loadingDimmer model.loading
|
||||
]
|
||||
|
@ -12,7 +12,7 @@ import Data.EquipmentUse
|
||||
import Data.Flags exposing (Flags)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
import Messages.EquipmentTableComp exposing (Texts)
|
||||
import Styles as S
|
||||
|
||||
|
||||
@ -52,25 +52,25 @@ update _ msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> Html Msg
|
||||
view2 model =
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
table [ class S.tableMain ]
|
||||
[ thead []
|
||||
[ tr []
|
||||
[ th [ class "" ] []
|
||||
, th [ class "text-left pr-1 md:px-2 w-20" ]
|
||||
[ text "Use"
|
||||
[ text texts.use
|
||||
]
|
||||
, th [ class "text-left" ] [ text "Name" ]
|
||||
, th [ class "text-left" ] [ text texts.name ]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map (renderEquipmentLine2 model) model.equips)
|
||||
(List.map (renderEquipmentLine2 texts model) model.equips)
|
||||
]
|
||||
|
||||
|
||||
renderEquipmentLine2 : Model -> Equipment -> Html Msg
|
||||
renderEquipmentLine2 model equip =
|
||||
renderEquipmentLine2 : Texts -> Model -> Equipment -> Html Msg
|
||||
renderEquipmentLine2 texts model equip =
|
||||
tr
|
||||
[ classList [ ( "active", model.selected == Just equip ) ]
|
||||
, class S.tableRow
|
||||
@ -80,7 +80,7 @@ renderEquipmentLine2 model equip =
|
||||
[ div [ class "label inline-flex text-sm" ]
|
||||
[ Data.EquipmentUse.fromString equip.use
|
||||
|> Maybe.withDefault Data.EquipmentUse.Concerning
|
||||
|> Data.EquipmentUse.label
|
||||
|> texts.equipmentUseLabel
|
||||
|> text
|
||||
]
|
||||
]
|
||||
|
@ -24,6 +24,7 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Http
|
||||
import Messages.FolderDetailComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
import Util.Maybe
|
||||
@ -275,8 +276,8 @@ update flags msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Flags -> Model -> Html Msg
|
||||
view2 flags model =
|
||||
view2 : Texts -> Flags -> Model -> Html Msg
|
||||
view2 texts flags model =
|
||||
let
|
||||
isOwner =
|
||||
Maybe.map .user flags.account
|
||||
@ -285,10 +286,10 @@ view2 flags model =
|
||||
|
||||
dimmerSettings : Comp.YesNoDimmer.Settings
|
||||
dimmerSettings =
|
||||
Comp.YesNoDimmer.defaultSettings2 "Really delete this folder?"
|
||||
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteThisFolder
|
||||
in
|
||||
div [ class "flex flex-col md:relative" ]
|
||||
(viewButtons2 model
|
||||
(viewButtons2 texts model
|
||||
:: [ Html.map DeleteMsg
|
||||
(Comp.YesNoDimmer.viewN
|
||||
True
|
||||
@ -299,26 +300,26 @@ view2 flags model =
|
||||
[ class "py-2 text-lg opacity-75"
|
||||
, classList [ ( "hidden", model.folder.id /= "" ) ]
|
||||
]
|
||||
[ text "You are automatically set as owner of this new folder."
|
||||
[ text texts.autoOwnerInfo
|
||||
]
|
||||
, div
|
||||
[ class "py-2 text-lg opacity-75"
|
||||
, classList [ ( "hidden", model.folder.id == "" ) ]
|
||||
]
|
||||
[ text "Modify this folder by changing the name or add/remove members."
|
||||
[ text texts.modifyInfo
|
||||
]
|
||||
, div
|
||||
[ class S.message
|
||||
, classList [ ( "hidden", model.folder.id == "" || isOwner ) ]
|
||||
]
|
||||
[ text "You are not the owner of this folder and therefore are not allowed to edit it."
|
||||
[ text texts.notOwnerInfo
|
||||
]
|
||||
, div [ class "mb-4 flex flex-col" ]
|
||||
[ label
|
||||
[ class S.inputLabel
|
||||
, for "folder-name"
|
||||
]
|
||||
[ text "Name"
|
||||
[ text texts.name
|
||||
, B.inputRequired
|
||||
]
|
||||
, div [ class "flex flex-row space-x-2" ]
|
||||
@ -340,7 +341,7 @@ view2 flags model =
|
||||
]
|
||||
[ i [ class "fa fa-save" ] []
|
||||
, span [ class "ml-2 hidden sm:inline" ]
|
||||
[ text "Save"
|
||||
[ text texts.basics.submit
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -358,12 +359,12 @@ view2 flags model =
|
||||
|> text
|
||||
]
|
||||
]
|
||||
++ viewMembers2 model
|
||||
++ viewMembers2 texts model
|
||||
)
|
||||
|
||||
|
||||
viewMembers2 : Model -> List (Html Msg)
|
||||
viewMembers2 model =
|
||||
viewMembers2 : Texts -> Model -> List (Html Msg)
|
||||
viewMembers2 texts model =
|
||||
let
|
||||
folderCfg =
|
||||
{ display = .name
|
||||
@ -379,7 +380,7 @@ viewMembers2 model =
|
||||
[ class S.header3
|
||||
, class "mt-4"
|
||||
]
|
||||
[ text "Members"
|
||||
[ text texts.members
|
||||
]
|
||||
, div [ class "flex flex-col space-y-2" ]
|
||||
[ div [ class "flex flex-row space-x-2" ]
|
||||
@ -393,7 +394,7 @@ viewMembers2 model =
|
||||
)
|
||||
]
|
||||
, a
|
||||
[ title "Add a new member"
|
||||
[ title texts.addMember
|
||||
, onClick AddMember
|
||||
, class S.primaryButton
|
||||
, href "#"
|
||||
@ -401,7 +402,7 @@ viewMembers2 model =
|
||||
]
|
||||
[ i [ class "fa fa-plus" ] []
|
||||
, span [ class "ml-2 hidden sm:inline" ]
|
||||
[ text "Add"
|
||||
[ text texts.add
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -410,19 +411,19 @@ viewMembers2 model =
|
||||
[ class "flex flex-col space-y-4 md:space-y-2 mt-2"
|
||||
, class "px-2 border-0 border-l dark:border-bluegray-600"
|
||||
]
|
||||
(List.map viewMember2 model.members)
|
||||
(List.map (viewMember2 texts) model.members)
|
||||
]
|
||||
|
||||
|
||||
viewMember2 : IdName -> Html Msg
|
||||
viewMember2 member =
|
||||
viewMember2 : Texts -> IdName -> Html Msg
|
||||
viewMember2 texts member =
|
||||
div
|
||||
[ class "flex flex-row space-x-2 items-center"
|
||||
]
|
||||
[ a
|
||||
[ class S.deleteLabel
|
||||
, href "#"
|
||||
, title "Remove this member"
|
||||
, title texts.removeMember
|
||||
, onClick (RemoveMember member)
|
||||
]
|
||||
[ i [ class "fa fa-trash " ] []
|
||||
@ -433,23 +434,23 @@ viewMember2 member =
|
||||
]
|
||||
|
||||
|
||||
viewButtons2 : Model -> Html Msg
|
||||
viewButtons2 model =
|
||||
viewButtons2 : Texts -> Model -> Html Msg
|
||||
viewButtons2 texts model =
|
||||
MB.view
|
||||
{ start =
|
||||
[ MB.SecondaryButton
|
||||
{ tagger = GoBack
|
||||
, label = "Back"
|
||||
, label = texts.basics.cancel
|
||||
, icon = Just "fa fa-arrow-left"
|
||||
, title = "Back to list"
|
||||
, title = texts.basics.backToList
|
||||
}
|
||||
]
|
||||
, end =
|
||||
[ MB.CustomButton
|
||||
{ tagger = RequestDelete
|
||||
, label = "Delete"
|
||||
, label = texts.basics.delete
|
||||
, icon = Just "fa fa-trash"
|
||||
, title = "Delete this folder"
|
||||
, title = texts.deleteThisFolder
|
||||
, inputClass =
|
||||
[ ( S.deleteButton, True )
|
||||
, ( "hidden", model.folder.id == "" )
|
||||
|
@ -20,6 +20,7 @@ import Data.Flags exposing (Flags)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Http
|
||||
import Messages.FolderManageComp exposing (Texts)
|
||||
import Styles as S
|
||||
|
||||
|
||||
@ -168,50 +169,54 @@ update flags msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Flags -> Model -> Html Msg
|
||||
view2 flags model =
|
||||
view2 : Texts -> Flags -> Model -> Html Msg
|
||||
view2 texts flags model =
|
||||
case model.detailModel of
|
||||
Just dm ->
|
||||
viewDetail2 flags dm
|
||||
viewDetail2 texts flags dm
|
||||
|
||||
Nothing ->
|
||||
viewTable2 model
|
||||
viewTable2 texts model
|
||||
|
||||
|
||||
viewDetail2 : Flags -> Comp.FolderDetail.Model -> Html Msg
|
||||
viewDetail2 flags model =
|
||||
viewDetail2 : Texts -> Flags -> Comp.FolderDetail.Model -> Html Msg
|
||||
viewDetail2 texts flags model =
|
||||
div []
|
||||
[ if model.folder.id == "" then
|
||||
h3 [ class S.header2 ]
|
||||
[ text "Create new Folder"
|
||||
[ text texts.createNewFolder
|
||||
]
|
||||
|
||||
else
|
||||
h3 [ class S.header2 ]
|
||||
[ text model.folder.name
|
||||
, div [ class "opacity-50 text-sm" ]
|
||||
[ text "Id: "
|
||||
[ text (texts.basics.id ++ ": ")
|
||||
, text model.folder.id
|
||||
]
|
||||
]
|
||||
, Html.map DetailMsg (Comp.FolderDetail.view2 flags model)
|
||||
, Html.map DetailMsg
|
||||
(Comp.FolderDetail.view2 texts.folderDetail
|
||||
flags
|
||||
model
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
viewTable2 : Model -> Html Msg
|
||||
viewTable2 model =
|
||||
viewTable2 : Texts -> Model -> Html Msg
|
||||
viewTable2 texts model =
|
||||
div [ class "flex flex-col" ]
|
||||
[ MB.view
|
||||
{ start =
|
||||
[ MB.TextInput
|
||||
{ tagger = SetQuery
|
||||
, value = model.query
|
||||
, placeholder = "Search…"
|
||||
, placeholder = texts.basics.searchPlaceholder
|
||||
, icon = Just "fa fa-search"
|
||||
}
|
||||
, MB.Checkbox
|
||||
{ tagger = \_ -> ToggleOwningOnly
|
||||
, label = "Show owning folders only"
|
||||
, label = texts.showOwningFoldersOnly
|
||||
, value = model.owningOnly
|
||||
, id = "folder-toggle-owner"
|
||||
}
|
||||
@ -219,14 +224,19 @@ viewTable2 model =
|
||||
, end =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = InitNewFolder
|
||||
, title = "Create a new folder"
|
||||
, title = texts.createNewFolder
|
||||
, icon = Just "fa fa-plus"
|
||||
, label = "New Folder"
|
||||
, label = texts.newFolder
|
||||
}
|
||||
]
|
||||
, rootClasses = "mb-4"
|
||||
}
|
||||
, Html.map TableMsg (Comp.FolderTable.view2 model.tableModel model.folders)
|
||||
, Html.map TableMsg
|
||||
(Comp.FolderTable.view2
|
||||
texts.folderTable
|
||||
model.tableModel
|
||||
model.folders
|
||||
)
|
||||
, div
|
||||
[ classList
|
||||
[ ( "ui dimmer", True )
|
||||
|
@ -11,6 +11,7 @@ import Api.Model.FolderItem exposing (FolderItem)
|
||||
import Comp.Basic as B
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.FolderTableComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Time
|
||||
|
||||
@ -44,23 +45,27 @@ update msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> List FolderItem -> Html Msg
|
||||
view2 _ items =
|
||||
view2 : Texts -> Model -> List FolderItem -> Html Msg
|
||||
view2 texts _ items =
|
||||
table [ class S.tableMain ]
|
||||
[ thead []
|
||||
[ tr []
|
||||
[ th [ class "w-px whitespace-nowrap pr-1 md:pr-3" ] []
|
||||
, th [ class "text-left" ] [ text "Name" ]
|
||||
, th [ class "text-left" ]
|
||||
[ text texts.name
|
||||
]
|
||||
, th [ class "text-left hidden sm:table-cell" ] [ text "Owner" ]
|
||||
, th [ class "text-center" ]
|
||||
[ span [ class "hidden sm:inline" ]
|
||||
[ text "#Member"
|
||||
[ text texts.memberCount
|
||||
]
|
||||
, span [ class "sm:hidden" ]
|
||||
[ text "#"
|
||||
]
|
||||
]
|
||||
, th [ class "text-center" ] [ text "Created" ]
|
||||
, th [ class "text-center" ]
|
||||
[ text texts.basics.created
|
||||
]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
|
@ -296,7 +296,7 @@ item visible. This message will disappear then.
|
||||
]
|
||||
, Html.map OrgDropdownMsg
|
||||
(Comp.Dropdown.view2
|
||||
(Comp.Dropdown.orgFormViewSettings dds)
|
||||
(Comp.Dropdown.orgFormViewSettings "Choose an organization" dds)
|
||||
settings
|
||||
model.corrOrgModel
|
||||
)
|
||||
|
@ -20,6 +20,7 @@ import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onInput)
|
||||
import Messages.OrgFormComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Maybe
|
||||
|
||||
@ -146,14 +147,19 @@ update flags msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Bool -> UiSettings -> Model -> Html Msg
|
||||
view2 mobile settings model =
|
||||
view2 : Texts -> Bool -> UiSettings -> Model -> Html Msg
|
||||
view2 texts mobile settings model =
|
||||
let
|
||||
orgUseCfg =
|
||||
{ display = Data.OrgUse.label
|
||||
{ display = texts.orgUseLabel
|
||||
, icon = \_ -> Nothing
|
||||
, style = DS.mainStyle
|
||||
}
|
||||
|
||||
contactTypeCfg =
|
||||
{ mobile = mobile
|
||||
, contactTypeLabel = texts.contactTypeLabel
|
||||
}
|
||||
in
|
||||
div [ class "flex flex-col" ]
|
||||
[ div
|
||||
@ -162,13 +168,13 @@ view2 mobile settings model =
|
||||
[ for "orgname"
|
||||
, class S.inputLabel
|
||||
]
|
||||
[ text "Name"
|
||||
[ text texts.name
|
||||
, B.inputRequired
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetName
|
||||
, placeholder "Name"
|
||||
, placeholder texts.name
|
||||
, value model.name
|
||||
, name "orgname"
|
||||
, class S.textInput
|
||||
@ -184,12 +190,12 @@ view2 mobile settings model =
|
||||
[ for "org-short-name"
|
||||
, class S.inputLabel
|
||||
]
|
||||
[ text "Short Name"
|
||||
[ text texts.shortName
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetShortName
|
||||
, placeholder "Abbreviation"
|
||||
, placeholder texts.shortName
|
||||
, Maybe.withDefault "" model.shortName
|
||||
|> value
|
||||
, name "org-short-name"
|
||||
@ -201,7 +207,8 @@ view2 mobile settings model =
|
||||
[ label
|
||||
[ class S.inputLabel
|
||||
]
|
||||
[ text "Use" ]
|
||||
[ text texts.use
|
||||
]
|
||||
, Html.map UseDropdownMsg
|
||||
(Comp.FixedDropdown.viewStyled2 orgUseCfg
|
||||
False
|
||||
@ -211,29 +218,29 @@ view2 mobile settings model =
|
||||
, span [ class "opacity-50 text-sm" ]
|
||||
[ case model.use of
|
||||
Data.OrgUse.Correspondent ->
|
||||
text "Use as correspondent"
|
||||
text texts.useAsCorrespondent
|
||||
|
||||
Data.OrgUse.Disabled ->
|
||||
text "Do not use for suggestions."
|
||||
text texts.dontUseForSuggestions
|
||||
]
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ h3 [ class S.header3 ]
|
||||
[ text "Address"
|
||||
[ text texts.address
|
||||
]
|
||||
, Html.map AddressMsg
|
||||
(Comp.AddressForm.view2 settings model.addressModel)
|
||||
(Comp.AddressForm.view2 texts.addressForm settings model.addressModel)
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ h3 [ class S.header3 ]
|
||||
[ text "Contacts"
|
||||
[ text texts.contacts
|
||||
]
|
||||
, Html.map ContactMsg
|
||||
(Comp.ContactField.view2 mobile settings model.contactModel)
|
||||
(Comp.ContactField.view2 contactTypeCfg settings model.contactModel)
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ h3 [ class S.header3 ]
|
||||
[ text "Notes"
|
||||
[ text texts.notes
|
||||
]
|
||||
, div [ class "" ]
|
||||
[ textarea
|
||||
|
@ -21,6 +21,7 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onSubmit)
|
||||
import Http
|
||||
import Messages.OrgManageComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
import Util.Maybe
|
||||
@ -205,50 +206,50 @@ update flags msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : UiSettings -> Model -> Html Msg
|
||||
view2 settings model =
|
||||
view2 : Texts -> UiSettings -> Model -> Html Msg
|
||||
view2 texts settings model =
|
||||
if model.viewMode == Table then
|
||||
viewTable2 model
|
||||
viewTable2 texts model
|
||||
|
||||
else
|
||||
viewForm2 settings model
|
||||
viewForm2 texts settings model
|
||||
|
||||
|
||||
viewTable2 : Model -> Html Msg
|
||||
viewTable2 model =
|
||||
viewTable2 : Texts -> Model -> Html Msg
|
||||
viewTable2 texts model =
|
||||
div [ class "flex flex-col relative" ]
|
||||
[ MB.view
|
||||
{ start =
|
||||
[ MB.TextInput
|
||||
{ tagger = SetQuery
|
||||
, value = model.query
|
||||
, placeholder = "Search…"
|
||||
, placeholder = texts.basics.searchPlaceholder
|
||||
, icon = Just "fa fa-search"
|
||||
}
|
||||
]
|
||||
, end =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = InitNewOrg
|
||||
, title = "Create a new organization"
|
||||
, title = texts.createNewOrganization
|
||||
, icon = Just "fa fa-plus"
|
||||
, label = "New Organization"
|
||||
, label = texts.newOrganization
|
||||
}
|
||||
]
|
||||
, rootClasses = "mb-4"
|
||||
}
|
||||
, Html.map TableMsg (Comp.OrgTable.view2 model.tableModel)
|
||||
, Html.map TableMsg (Comp.OrgTable.view2 texts.orgTable model.tableModel)
|
||||
, B.loadingDimmer model.loading
|
||||
]
|
||||
|
||||
|
||||
viewForm2 : UiSettings -> Model -> Html Msg
|
||||
viewForm2 settings model =
|
||||
viewForm2 : Texts -> UiSettings -> Model -> Html Msg
|
||||
viewForm2 texts settings model =
|
||||
let
|
||||
newOrg =
|
||||
model.formModel.org.id == ""
|
||||
|
||||
dimmerSettings2 =
|
||||
Comp.YesNoDimmer.defaultSettings2 "Really delete this organization?"
|
||||
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteOrg
|
||||
in
|
||||
Html.form
|
||||
[ class "md:relative flex flex-col"
|
||||
@ -262,14 +263,14 @@ viewForm2 settings model =
|
||||
)
|
||||
, if newOrg then
|
||||
h3 [ class S.header2 ]
|
||||
[ text "Create new organization"
|
||||
[ text texts.createNewOrganization
|
||||
]
|
||||
|
||||
else
|
||||
h3 [ class S.header2 ]
|
||||
[ text model.formModel.org.name
|
||||
, div [ class "opacity-50 text-sm" ]
|
||||
[ text "Id: "
|
||||
[ text (texts.basics.id ++ ": ")
|
||||
, text model.formModel.org.id
|
||||
]
|
||||
]
|
||||
@ -277,24 +278,24 @@ viewForm2 settings model =
|
||||
{ start =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = Submit
|
||||
, title = "Submit this form"
|
||||
, title = texts.basics.submitThisForm
|
||||
, icon = Just "fa fa-save"
|
||||
, label = "Submit"
|
||||
, label = texts.basics.submit
|
||||
}
|
||||
, MB.SecondaryButton
|
||||
{ tagger = SetViewMode Table
|
||||
, title = "Back to list"
|
||||
, title = texts.basics.backToList
|
||||
, icon = Just "fa fa-arrow-left"
|
||||
, label = "Cancel"
|
||||
, label = texts.basics.cancel
|
||||
}
|
||||
]
|
||||
, end =
|
||||
if not newOrg then
|
||||
[ MB.DeleteButton
|
||||
{ tagger = RequestDelete
|
||||
, title = "Delete this organization"
|
||||
, title = texts.deleteThisOrg
|
||||
, icon = Just "fa fa-trash"
|
||||
, label = "Delete"
|
||||
, label = texts.basics.delete
|
||||
}
|
||||
]
|
||||
|
||||
@ -311,6 +312,12 @@ viewForm2 settings model =
|
||||
]
|
||||
[ Maybe.withDefault "" model.formError |> text
|
||||
]
|
||||
, Html.map FormMsg (Comp.OrgForm.view2 False settings model.formModel)
|
||||
, Html.map FormMsg
|
||||
(Comp.OrgForm.view2
|
||||
texts.orgForm
|
||||
False
|
||||
settings
|
||||
model.formModel
|
||||
)
|
||||
, B.loadingDimmer model.loading
|
||||
]
|
||||
|
@ -12,6 +12,7 @@ import Data.Flags exposing (Flags)
|
||||
import Data.OrgUse
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.OrgTableComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Address
|
||||
import Util.Contact
|
||||
@ -53,8 +54,8 @@ update _ msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> Html Msg
|
||||
view2 model =
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
table [ class S.tableMain ]
|
||||
[ thead []
|
||||
[ tr []
|
||||
@ -62,18 +63,24 @@ view2 model =
|
||||
, th [ class "text-left pr-1 md:px-2" ]
|
||||
[ text "Use"
|
||||
]
|
||||
, th [ class "text-left" ] [ text "Name" ]
|
||||
, th [ class "text-left hidden md:table-cell" ] [ text "Address" ]
|
||||
, th [ class "text-left hidden sm:table-cell" ] [ text "Contact" ]
|
||||
, th [ class "text-left" ]
|
||||
[ text texts.name
|
||||
]
|
||||
, th [ class "text-left hidden md:table-cell" ]
|
||||
[ text texts.address
|
||||
]
|
||||
, th [ class "text-left hidden sm:table-cell" ]
|
||||
[ text texts.contact
|
||||
]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map (renderOrgLine2 model) model.orgs)
|
||||
(List.map (renderOrgLine2 texts model) model.orgs)
|
||||
]
|
||||
|
||||
|
||||
renderOrgLine2 : Model -> Organization -> Html Msg
|
||||
renderOrgLine2 model org =
|
||||
renderOrgLine2 : Texts -> Model -> Organization -> Html Msg
|
||||
renderOrgLine2 texts model org =
|
||||
tr
|
||||
[ classList [ ( "active", model.selected == Just org ) ]
|
||||
, class S.tableRow
|
||||
@ -83,7 +90,7 @@ renderOrgLine2 model org =
|
||||
[ div [ class "label inline-flex text-sm" ]
|
||||
[ Data.OrgUse.fromString org.use
|
||||
|> Maybe.withDefault Data.OrgUse.Correspondent
|
||||
|> Data.OrgUse.label
|
||||
|> texts.orgUseLabel
|
||||
|> text
|
||||
]
|
||||
]
|
||||
|
@ -22,6 +22,7 @@ import Data.UiSettings exposing (UiSettings)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onInput)
|
||||
import Messages.PersonFormComp exposing (Texts)
|
||||
import Styles as S
|
||||
|
||||
|
||||
@ -178,14 +179,19 @@ update flags msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Bool -> UiSettings -> Model -> Html Msg
|
||||
view2 mobile settings model =
|
||||
view2 : Texts -> Bool -> UiSettings -> Model -> Html Msg
|
||||
view2 texts mobile settings model =
|
||||
let
|
||||
personUseCfg =
|
||||
{ display = Data.PersonUse.label
|
||||
{ display = texts.personUseLabel
|
||||
, icon = \_ -> Nothing
|
||||
, style = DS.mainStyle
|
||||
}
|
||||
|
||||
contactCfg =
|
||||
{ mobile = mobile
|
||||
, contactTypeLabel = texts.contactTypeLabel
|
||||
}
|
||||
in
|
||||
div [ class "flex flex-col" ]
|
||||
[ div
|
||||
@ -195,13 +201,13 @@ view2 mobile settings model =
|
||||
[ class S.inputLabel
|
||||
, for "personname"
|
||||
]
|
||||
[ text "Name"
|
||||
[ text texts.name
|
||||
, B.inputRequired
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetName
|
||||
, placeholder "Name"
|
||||
, placeholder texts.name
|
||||
, value model.name
|
||||
, class S.textInput
|
||||
, classList
|
||||
@ -215,53 +221,58 @@ view2 mobile settings model =
|
||||
[ label
|
||||
[ class S.inputLabel
|
||||
]
|
||||
[ text "Use of this person" ]
|
||||
[ text texts.useOfPerson
|
||||
]
|
||||
, Html.map UseDropdownMsg
|
||||
(Comp.FixedDropdown.viewStyled2 personUseCfg False (Just model.use) model.useModel)
|
||||
, span [ class "opacity-50 text-sm" ]
|
||||
[ case model.use of
|
||||
Data.PersonUse.Concerning ->
|
||||
text "Use as concerning person only"
|
||||
text texts.useAsConcerningOnly
|
||||
|
||||
Data.PersonUse.Correspondent ->
|
||||
text "Use as correspondent person only"
|
||||
text texts.useAsCorrespondentOnly
|
||||
|
||||
Data.PersonUse.Both ->
|
||||
text "Use as both concerning or correspondent person"
|
||||
text texts.useAsBoth
|
||||
|
||||
Data.PersonUse.Disabled ->
|
||||
text "Do not use for suggestions."
|
||||
text texts.dontUseForSuggestions
|
||||
]
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ label
|
||||
[ class S.inputLabel
|
||||
]
|
||||
[ text "Organization"
|
||||
[ text texts.organization
|
||||
]
|
||||
, Html.map OrgDropdownMsg
|
||||
(Comp.Dropdown.view2
|
||||
(Comp.Dropdown.orgFormViewSettings DS.mainStyle)
|
||||
(Comp.Dropdown.orgFormViewSettings texts.chooseAnOrg DS.mainStyle)
|
||||
settings
|
||||
model.orgModel
|
||||
)
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ h3 [ class "ui dividing header" ]
|
||||
[ text "Address"
|
||||
[ text texts.address
|
||||
]
|
||||
, Html.map AddressMsg (Comp.AddressForm.view2 settings model.addressModel)
|
||||
, Html.map AddressMsg
|
||||
(Comp.AddressForm.view2 texts.addressForm
|
||||
settings
|
||||
model.addressModel
|
||||
)
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ h3 [ class S.header3 ]
|
||||
[ text "Contacts"
|
||||
[ text texts.contacts
|
||||
]
|
||||
, Html.map ContactMsg
|
||||
(Comp.ContactField.view2 mobile settings model.contactModel)
|
||||
(Comp.ContactField.view2 contactCfg settings model.contactModel)
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ h3 [ class S.header3 ]
|
||||
[ text "Notes"
|
||||
[ text texts.notes
|
||||
]
|
||||
, div [ class "" ]
|
||||
[ textarea
|
||||
|
@ -22,6 +22,7 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onSubmit)
|
||||
import Http
|
||||
import Messages.PersonManageComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
import Util.Maybe
|
||||
@ -242,50 +243,50 @@ isLoading model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : UiSettings -> Model -> Html Msg
|
||||
view2 settings model =
|
||||
view2 : Texts -> UiSettings -> Model -> Html Msg
|
||||
view2 texts settings model =
|
||||
if model.viewMode == Table then
|
||||
viewTable2 model
|
||||
viewTable2 texts model
|
||||
|
||||
else
|
||||
viewForm2 settings model
|
||||
viewForm2 texts settings model
|
||||
|
||||
|
||||
viewTable2 : Model -> Html Msg
|
||||
viewTable2 model =
|
||||
viewTable2 : Texts -> Model -> Html Msg
|
||||
viewTable2 texts model =
|
||||
div [ class "flex flex-col" ]
|
||||
[ MB.view
|
||||
{ start =
|
||||
[ MB.TextInput
|
||||
{ tagger = SetQuery
|
||||
, value = model.query
|
||||
, placeholder = "Search…"
|
||||
, placeholder = texts.basics.searchPlaceholder
|
||||
, icon = Just "fa fa-search"
|
||||
}
|
||||
]
|
||||
, end =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = InitNewPerson
|
||||
, title = "Create a new person"
|
||||
, title = texts.createNewPerson
|
||||
, icon = Just "fa fa-plus"
|
||||
, label = "New Person"
|
||||
, label = texts.newPerson
|
||||
}
|
||||
]
|
||||
, rootClasses = "mb-4"
|
||||
}
|
||||
, Html.map TableMsg (Comp.PersonTable.view2 model.tableModel)
|
||||
, Html.map TableMsg (Comp.PersonTable.view2 texts.personTable model.tableModel)
|
||||
, B.loadingDimmer (isLoading model)
|
||||
]
|
||||
|
||||
|
||||
viewForm2 : UiSettings -> Model -> Html Msg
|
||||
viewForm2 settings model =
|
||||
viewForm2 : Texts -> UiSettings -> Model -> Html Msg
|
||||
viewForm2 texts settings model =
|
||||
let
|
||||
newPerson =
|
||||
model.formModel.person.id == ""
|
||||
|
||||
dimmerSettings2 =
|
||||
Comp.YesNoDimmer.defaultSettings2 "Really delete this person?"
|
||||
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeletePerson
|
||||
in
|
||||
Html.form
|
||||
[ class "md:relative flex flex-col"
|
||||
@ -299,14 +300,14 @@ viewForm2 settings model =
|
||||
)
|
||||
, if newPerson then
|
||||
h3 [ class S.header2 ]
|
||||
[ text "Create new person"
|
||||
[ text texts.createNewPerson
|
||||
]
|
||||
|
||||
else
|
||||
h3 [ class S.header2 ]
|
||||
[ text model.formModel.person.name
|
||||
, div [ class "opacity-50 text-sm" ]
|
||||
[ text "Id: "
|
||||
[ text (texts.basics.id ++ ": ")
|
||||
, text model.formModel.person.id
|
||||
]
|
||||
]
|
||||
@ -314,24 +315,24 @@ viewForm2 settings model =
|
||||
{ start =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = Submit
|
||||
, title = "Submit this form"
|
||||
, title = texts.basics.submitThisForm
|
||||
, icon = Just "fa fa-save"
|
||||
, label = "Submit"
|
||||
, label = texts.basics.submit
|
||||
}
|
||||
, MB.SecondaryButton
|
||||
{ tagger = SetViewMode Table
|
||||
, title = "Back to list"
|
||||
, title = texts.basics.backToList
|
||||
, icon = Just "fa fa-arrow-left"
|
||||
, label = "Cancel"
|
||||
, label = texts.basics.cancel
|
||||
}
|
||||
]
|
||||
, end =
|
||||
if not newPerson then
|
||||
[ MB.DeleteButton
|
||||
{ tagger = RequestDelete
|
||||
, title = "Delete this person"
|
||||
, title = texts.deleteThisPerson
|
||||
, icon = Just "fa fa-trash"
|
||||
, label = "Delete"
|
||||
, label = texts.basics.delete
|
||||
}
|
||||
]
|
||||
|
||||
@ -348,6 +349,11 @@ viewForm2 settings model =
|
||||
]
|
||||
[ Maybe.withDefault "" model.formError |> text
|
||||
]
|
||||
, Html.map FormMsg (Comp.PersonForm.view2 False settings model.formModel)
|
||||
, Html.map FormMsg
|
||||
(Comp.PersonForm.view2 texts.personForm
|
||||
False
|
||||
settings
|
||||
model.formModel
|
||||
)
|
||||
, B.loadingDimmer (isLoading model)
|
||||
]
|
||||
|
@ -12,6 +12,7 @@ import Data.Flags exposing (Flags)
|
||||
import Data.PersonUse
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.PersonTableComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Contact
|
||||
|
||||
@ -52,8 +53,8 @@ update _ msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> Html Msg
|
||||
view2 model =
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
table [ class S.tableMain ]
|
||||
[ thead []
|
||||
[ tr []
|
||||
@ -67,12 +68,12 @@ view2 model =
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
(List.map (renderPersonLine2 model) model.equips)
|
||||
(List.map (renderPersonLine2 texts model) model.equips)
|
||||
]
|
||||
|
||||
|
||||
renderPersonLine2 : Model -> Person -> Html Msg
|
||||
renderPersonLine2 model person =
|
||||
renderPersonLine2 : Texts -> Model -> Person -> Html Msg
|
||||
renderPersonLine2 texts model person =
|
||||
tr
|
||||
[ classList [ ( "active", model.selected == Just person ) ]
|
||||
, class S.tableRow
|
||||
@ -82,7 +83,7 @@ renderPersonLine2 model person =
|
||||
[ div [ class "label inline-flex text-sm" ]
|
||||
[ Data.PersonUse.fromString person.use
|
||||
|> Maybe.withDefault Data.PersonUse.Both
|
||||
|> Data.PersonUse.label
|
||||
|> texts.personUseLabel
|
||||
|> text
|
||||
]
|
||||
]
|
||||
|
@ -1138,7 +1138,7 @@ searchTabs ddd flags settings model =
|
||||
[ text "Organization" ]
|
||||
, Html.map OrgMsg
|
||||
(Comp.Dropdown.view2
|
||||
(Comp.Dropdown.orgFormViewSettings DS.sidebarStyle)
|
||||
(Comp.Dropdown.orgFormViewSettings "Choose an organization" DS.sidebarStyle)
|
||||
settings
|
||||
model.orgModel
|
||||
)
|
||||
|
@ -16,6 +16,7 @@ import Data.Flags exposing (Flags)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onInput)
|
||||
import Messages.TagFormComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Maybe
|
||||
|
||||
@ -118,12 +119,12 @@ update _ msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> Html Msg
|
||||
view2 model =
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
let
|
||||
categoryCfg =
|
||||
{ makeOption = \s -> Comp.Dropdown.mkOption s
|
||||
, placeholder = "Select or define category..."
|
||||
, placeholder = texts.selectDefineCategory
|
||||
, labelColor = \_ -> \_ -> ""
|
||||
, style = DS.mainStyle
|
||||
}
|
||||
@ -135,13 +136,13 @@ view2 model =
|
||||
[ for "tagname"
|
||||
, class S.inputLabel
|
||||
]
|
||||
[ text "Name"
|
||||
[ text texts.name
|
||||
, B.inputRequired
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetName
|
||||
, placeholder "Name"
|
||||
, placeholder texts.name
|
||||
, value model.name
|
||||
, id "tagname"
|
||||
, class S.textInput
|
||||
@ -157,7 +158,7 @@ view2 model =
|
||||
[ label
|
||||
[ class S.inputLabel
|
||||
]
|
||||
[ text "Category"
|
||||
[ text texts.category
|
||||
]
|
||||
, Html.map CatMsg
|
||||
(Comp.Dropdown.viewSingle2
|
||||
|
@ -20,6 +20,7 @@ import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onSubmit)
|
||||
import Http
|
||||
import Messages.TagManageComp exposing (Texts)
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
import Util.Maybe
|
||||
@ -213,38 +214,38 @@ update flags msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> Html Msg
|
||||
view2 model =
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
if model.viewMode == Table then
|
||||
viewTable2 model
|
||||
viewTable2 texts model
|
||||
|
||||
else
|
||||
viewForm2 model
|
||||
viewForm2 texts model
|
||||
|
||||
|
||||
viewTable2 : Model -> Html Msg
|
||||
viewTable2 model =
|
||||
viewTable2 : Texts -> Model -> Html Msg
|
||||
viewTable2 texts model =
|
||||
div [ class "flex flex-col" ]
|
||||
[ MB.view
|
||||
{ start =
|
||||
[ MB.TextInput
|
||||
{ tagger = SetQuery
|
||||
, value = model.query
|
||||
, placeholder = "Search…"
|
||||
, placeholder = texts.basics.searchPlaceholder
|
||||
, icon = Just "fa fa-search"
|
||||
}
|
||||
]
|
||||
, end =
|
||||
[ MB.PrimaryButton
|
||||
{ tagger = InitNewTag
|
||||
, title = "Create a new tag"
|
||||
, title = texts.createNewTag
|
||||
, icon = Just "fa fa-plus"
|
||||
, label = "New Tag"
|
||||
, label = texts.newTag
|
||||
}
|
||||
]
|
||||
, rootClasses = "mb-4"
|
||||
}
|
||||
, Html.map TableMsg (Comp.TagTable.view2 model.tagTableModel)
|
||||
, Html.map TableMsg (Comp.TagTable.view2 texts.tagTable model.tagTableModel)
|
||||
, div
|
||||
[ classList
|
||||
[ ( "ui dimmer", True )
|
||||
@ -256,14 +257,14 @@ viewTable2 model =
|
||||
]
|
||||
|
||||
|
||||
viewForm2 : Model -> Html Msg
|
||||
viewForm2 model =
|
||||
viewForm2 : Texts -> Model -> Html Msg
|
||||
viewForm2 texts model =
|
||||
let
|
||||
newTag =
|
||||
model.tagFormModel.tag.id == ""
|
||||
|
||||
dimmerSettings2 =
|
||||
Comp.YesNoDimmer.defaultSettings2 "Really delete this tag?"
|
||||
Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteTag
|
||||
in
|
||||
Html.form
|
||||
[ class "relative flex flex-col"
|
||||
@ -277,7 +278,7 @@ viewForm2 model =
|
||||
)
|
||||
, if newTag then
|
||||
h1 [ class S.header2 ]
|
||||
[ text "Create new tag"
|
||||
[ text texts.createNewTag
|
||||
]
|
||||
|
||||
else
|
||||
@ -294,22 +295,22 @@ viewForm2 model =
|
||||
{ tagger = Submit
|
||||
, title = "Submit this form"
|
||||
, icon = Just "fa fa-save"
|
||||
, label = "Submit"
|
||||
, label = texts.basics.submit
|
||||
}
|
||||
, MB.SecondaryButton
|
||||
{ tagger = SetViewMode Table
|
||||
, title = "Back to list"
|
||||
, title = texts.basics.backToList
|
||||
, icon = Just "fa fa-arrow-left"
|
||||
, label = "Cancel"
|
||||
, label = texts.basics.cancel
|
||||
}
|
||||
]
|
||||
, end =
|
||||
if not newTag then
|
||||
[ MB.DeleteButton
|
||||
{ tagger = RequestDelete
|
||||
, title = "Delete this tag"
|
||||
, title = texts.deleteThisTag
|
||||
, icon = Just "fa fa-trash"
|
||||
, label = "Delete"
|
||||
, label = texts.basics.delete
|
||||
}
|
||||
]
|
||||
|
||||
@ -326,6 +327,6 @@ viewForm2 model =
|
||||
]
|
||||
[ Maybe.withDefault "" model.formError |> text
|
||||
]
|
||||
, Html.map FormMsg (Comp.TagForm.view2 model.tagFormModel)
|
||||
, Html.map FormMsg (Comp.TagForm.view2 texts.tagForm model.tagFormModel)
|
||||
, B.loadingDimmer model.loading
|
||||
]
|
||||
|
@ -11,6 +11,7 @@ import Comp.Basic as B
|
||||
import Data.Flags exposing (Flags)
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Messages.TagTableComp exposing (Texts)
|
||||
import Styles as S
|
||||
|
||||
|
||||
@ -50,14 +51,14 @@ update _ msg model =
|
||||
--- View2
|
||||
|
||||
|
||||
view2 : Model -> Html Msg
|
||||
view2 model =
|
||||
view2 : Texts -> Model -> Html Msg
|
||||
view2 texts model =
|
||||
table [ class S.tableMain ]
|
||||
[ thead []
|
||||
[ tr []
|
||||
[ th [ class "" ] []
|
||||
, th [ class "text-left" ] [ text "Name" ]
|
||||
, th [ class "text-left" ] [ text "Category" ]
|
||||
, th [ class "text-left" ] [ text texts.name ]
|
||||
, th [ class "text-left" ] [ text texts.category ]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
|
Reference in New Issue
Block a user