Externalize strings in manage-data page

This commit is contained in:
Eike Kettner 2021-04-04 15:55:49 +02:00
parent 8f1380fcf5
commit 594818499e
57 changed files with 1078 additions and 379 deletions

View File

@ -127,7 +127,7 @@ mainContent model =
viewLogin texts model viewLogin texts model
ManageDataPage -> ManageDataPage ->
viewManageData model viewManageData texts model
UserSettingPage -> UserSettingPage ->
viewUserSettings texts model viewUserSettings texts model
@ -431,12 +431,21 @@ viewLogin texts model =
] ]
viewManageData : Model -> List (Html Msg) viewManageData : Messages -> Model -> List (Html Msg)
viewManageData model = viewManageData texts model =
[ Html.map ManageDataMsg [ Html.map ManageDataMsg
(ManageData.viewSidebar model.sidebarVisible model.flags model.uiSettings model.manageDataModel) (ManageData.viewSidebar texts.manageData
model.sidebarVisible
model.flags
model.uiSettings
model.manageDataModel
)
, Html.map ManageDataMsg , Html.map ManageDataMsg
(ManageData.viewContent model.flags model.uiSettings model.manageDataModel) (ManageData.viewContent texts.manageData
model.flags
model.uiSettings
model.manageDataModel
)
] ]

View File

@ -14,6 +14,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onInput) import Html.Events exposing (onInput)
import Messages.AddressFormComp exposing (Texts)
import Styles as S import Styles as S
import Util.List import Util.List
@ -110,12 +111,12 @@ update msg model =
--- View2 --- View2
view2 : UiSettings -> Model -> Html Msg view2 : Texts -> UiSettings -> Model -> Html Msg
view2 settings model = view2 texts settings model =
let let
countryCfg = countryCfg =
{ makeOption = \c -> { text = c.label, additional = "" } { makeOption = \c -> { text = c.label, additional = "" }
, placeholder = "Select Country" , placeholder = texts.selectCountry
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, style = DS.mainStyle , style = DS.mainStyle
} }
@ -128,12 +129,12 @@ view2 settings model =
[ for "street" [ for "street"
, class S.inputLabel , class S.inputLabel
] ]
[ text "Street" [ text texts.street
] ]
, input , input
[ type_ "text" [ type_ "text"
, onInput SetStreet , onInput SetStreet
, placeholder "Street" , placeholder texts.street
, value model.street , value model.street
, name "street" , name "street"
, class S.textInput , class S.textInput
@ -147,12 +148,12 @@ view2 settings model =
[ for "zip" [ for "zip"
, class S.inputLabel , class S.inputLabel
] ]
[ text "Zip Code" [ text texts.zipCode
] ]
, input , input
[ type_ "text" [ type_ "text"
, onInput SetZip , onInput SetZip
, placeholder "Zip" , placeholder texts.zipCode
, value model.zip , value model.zip
, name "zip" , name "zip"
, class S.textInput , class S.textInput
@ -166,12 +167,12 @@ view2 settings model =
[ for "city" [ for "city"
, class S.inputLabel , class S.inputLabel
] ]
[ text "City" [ text texts.city
] ]
, input , input
[ type_ "text" [ type_ "text"
, onInput SetCity , onInput SetCity
, placeholder "City" , placeholder texts.city
, value model.city , value model.city
, name "city" , name "city"
, class S.textInput , class S.textInput
@ -180,7 +181,7 @@ view2 settings model =
] ]
, div [ class "" ] , div [ class "" ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Country" [ text texts.country
] ]
, Html.map CountryMsg , Html.map CountryMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2

View File

@ -1,6 +1,7 @@
module Comp.ContactField exposing module Comp.ContactField exposing
( Model ( Model
, Msg(..) , Msg(..)
, ViewSettings
, emptyModel , emptyModel
, getContacts , getContacts
, update , update
@ -115,11 +116,17 @@ update msg model =
--- View2 --- View2
view2 : Bool -> UiSettings -> Model -> Html Msg type alias ViewSettings =
view2 mobile _ model = { contactTypeLabel : ContactType -> String
, mobile : Bool
}
view2 : ViewSettings -> UiSettings -> Model -> Html Msg
view2 cfg _ model =
let let
kindCfg = kindCfg =
{ display = Data.ContactType.toString { display = cfg.contactTypeLabel
, icon = \_ -> Nothing , icon = \_ -> Nothing
, style = DS.mainStyle , style = DS.mainStyle
} }
@ -127,10 +134,10 @@ view2 mobile _ model =
div [ class "flex flex-col" ] div [ class "flex flex-col" ]
[ div [ div
[ class "flex flex-col space-y-2" [ 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 [ div
[ classList [ ( "flex-none md:w-1/6", not mobile ) ] [ classList [ ( "flex-none md:w-1/6", not cfg.mobile ) ]
] ]
[ Html.map TypeMsg [ Html.map TypeMsg
(Comp.FixedDropdown.viewStyled2 (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 " , 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)
] ]

View File

@ -23,8 +23,9 @@ import Data.Flags exposing (Flags)
import Data.Validated exposing (Validated) import Data.Validated exposing (Validated)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput) import Html.Events exposing (onInput)
import Http import Http
import Messages.CustomFieldFormComp exposing (Texts)
import Styles as S import Styles as S
import Util.Http import Util.Http
import Util.Maybe import Util.Maybe
@ -196,20 +197,20 @@ type alias ViewSettings =
--- View2 --- View2
view2 : ViewSettings -> Model -> List (Html Msg) view2 : Texts -> ViewSettings -> Model -> List (Html Msg)
view2 viewSettings model = view2 texts viewSettings model =
let let
dimmerSettings = dimmerSettings =
Comp.YesNoDimmer.defaultSettings2 "Really delete this custom field?" Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteField
ftypeCfg = ftypeCfg =
{ display = Data.CustomFieldType.label { display = texts.fieldTypeLabel
, icon = \_ -> Nothing , icon = \_ -> Nothing
, style = DS.mainStyle , style = DS.mainStyle
} }
in in
(if viewSettings.showControls then (if viewSettings.showControls then
[ viewButtons2 model ] [ viewButtons2 texts model ]
else else
[] []
@ -238,20 +239,19 @@ view2 viewSettings model =
] ]
, if model.field.id == "" then , if model.field.id == "" then
div [ class "py-2 text-lg opacity-75" ] div [ class "py-2 text-lg opacity-75" ]
[ text "Create a new custom field." [ text texts.createCustomField
] ]
else else
div [ class "py-2 text-lg opacity-75" ] div [ class "py-2 text-lg opacity-75" ]
[ text "Note that changing the format may " [ text texts.modifyTypeWarning
, text "result in invisible values in the ui, if they don't comply to the new format!"
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ label [ label
[ class S.inputLabel [ class S.inputLabel
, for "fieldname" , for "fieldname"
] ]
[ text "Name" [ text texts.name
, B.inputRequired , B.inputRequired
] ]
, input , input
@ -268,15 +268,14 @@ view2 viewSettings model =
] ]
[] []
, div [ class "opacity-75 text-sm" ] , div [ class "opacity-75 text-sm" ]
[ text "The name uniquely identifies this field. It must be a valid " [ text texts.nameInfo
, text "identifier, not contain spaces or weird characters."
] ]
] ]
, div , div
[ class "mb-4" [ class "mb-4"
] ]
[ label [ class S.inputLabel ] [ label [ class S.inputLabel ]
[ text "Field Format" [ text texts.fieldFormat
, B.inputRequired , B.inputRequired
] ]
, Html.map FTypeMsg , Html.map FTypeMsg
@ -287,8 +286,7 @@ view2 viewSettings model =
model.ftypeModel model.ftypeModel
) )
, div [ class "opacity-75 text-sm" ] , div [ class "opacity-75 text-sm" ]
[ text "A field must have a format. Values are validated " [ text texts.fieldFormatInfo
, text "according to this format."
] ]
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
@ -296,7 +294,7 @@ view2 viewSettings model =
[ class S.inputLabel [ class S.inputLabel
, for "fieldlabel" , for "fieldlabel"
] ]
[ text "Label" ] [ text texts.label ]
, input , input
[ type_ "text" [ type_ "text"
, onInput SetLabel , onInput SetLabel
@ -308,38 +306,37 @@ view2 viewSettings model =
] ]
[] []
, div [ class "opacity-75 text-sm" ] , div [ class "opacity-75 text-sm" ]
[ text "The user defined label for this field. This is used to represent " [ text texts.labelInfo
, text "this field in the ui. If not present, the name is used."
] ]
] ]
] ]
] ]
viewButtons2 : Model -> Html Msg viewButtons2 : Texts -> Model -> Html Msg
viewButtons2 model = viewButtons2 texts model =
MB.view MB.view
{ start = { start =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = SubmitForm { tagger = SubmitForm
, title = "Submit this form" , title = texts.basics.submitThisForm
, icon = Just "fa fa-save" , icon = Just "fa fa-save"
, label = "Submit" , label = texts.basics.submit
} }
, MB.SecondaryButton , MB.SecondaryButton
{ tagger = GoBack { tagger = GoBack
, title = "Back to list" , title = texts.basics.backToList
, icon = Just "fa fa-arrow-left" , icon = Just "fa fa-arrow-left"
, label = "Cancel" , label = texts.basics.cancel
} }
] ]
, end = , end =
if model.field.id /= "" then if model.field.id /= "" then
[ MB.DeleteButton [ MB.DeleteButton
{ tagger = RequestDelete { tagger = RequestDelete
, title = "Delete this field" , title = texts.deleteThisField
, icon = Just "fa fa-trash" , icon = Just "fa fa-trash"
, label = "Delete" , label = texts.basics.delete
} }
] ]

View File

@ -17,8 +17,8 @@ import Comp.MenuBar as MB
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput)
import Http import Http
import Messages.CustomFieldManageComp exposing (Texts)
import Styles as S import Styles as S
import Util.CustomField import Util.CustomField
@ -135,18 +135,18 @@ update flags msg model =
--- View2 --- View2
view2 : Flags -> Model -> Html Msg view2 : Texts -> Flags -> Model -> Html Msg
view2 flags model = view2 texts flags model =
case model.detailModel of case model.detailModel of
Just dm -> Just dm ->
viewDetail2 flags dm viewDetail2 texts flags dm
Nothing -> Nothing ->
viewTable2 model viewTable2 texts model
viewDetail2 : Flags -> Comp.CustomFieldForm.Model -> Html Msg viewDetail2 : Texts -> Flags -> Comp.CustomFieldForm.Model -> Html Msg
viewDetail2 _ detailModel = viewDetail2 texts _ detailModel =
let let
viewSettings = viewSettings =
{ showControls = True { showControls = True
@ -156,44 +156,52 @@ viewDetail2 _ detailModel =
div [] div []
((if detailModel.field.id == "" then ((if detailModel.field.id == "" then
h3 [ class S.header2 ] h3 [ class S.header2 ]
[ text "Create new custom field" [ text texts.newCustomField
] ]
else else
h3 [ class S.header2 ] h3 [ class S.header2 ]
[ Util.CustomField.nameOrLabel detailModel.field |> text [ Util.CustomField.nameOrLabel detailModel.field |> text
, div [ class "opacity-50 text-sm" ] , div [ class "opacity-50 text-sm" ]
[ text "Id: " [ text (texts.basics.id ++ ": ")
, text detailModel.field.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 : Texts -> Model -> Html Msg
viewTable2 model = viewTable2 texts model =
div [ class "flex flex-col md:relative" ] div [ class "flex flex-col md:relative" ]
[ MB.view [ MB.view
{ start = { start =
[ MB.TextInput [ MB.TextInput
{ tagger = SetQuery { tagger = SetQuery
, value = model.query , value = model.query
, placeholder = "Search" , placeholder = texts.basics.searchPlaceholder
, icon = Just "fa fa-search" , icon = Just "fa fa-search"
} }
] ]
, end = , end =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = InitNewCustomField { tagger = InitNewCustomField
, title = "Add a new custom field" , title = texts.addCustomField
, icon = Just "fa fa-plus" , icon = Just "fa fa-plus"
, label = "New custom field" , label = texts.newCustomField
} }
] ]
, rootClasses = "mb-4" , 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 , B.loadingDimmer model.loading
] ]

View File

@ -11,7 +11,7 @@ import Api.Model.CustomField exposing (CustomField)
import Comp.Basic as B import Comp.Basic as B
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Messages.CustomFieldTableComp exposing (Texts)
import Styles as S import Styles as S
import Util.Time import Util.Time
@ -45,17 +45,17 @@ update msg model =
--- View2 --- View2
view2 : Model -> List CustomField -> Html Msg view2 : Texts -> Model -> List CustomField -> Html Msg
view2 _ items = view2 texts _ items =
div [] div []
[ table [ class S.tableMain ] [ table [ class S.tableMain ]
[ thead [] [ thead []
[ tr [] [ tr []
[ th [] [] [ th [] []
, th [ class "text-left" ] [ text "Name/Label" ] , th [ class "text-left" ] [ text texts.nameLabel ]
, th [ class "text-left" ] [ text "Format" ] , th [ class "text-left" ] [ text texts.format ]
, th [ class "text-center hidden sm:table-cell" ] [ text "#Usage" ] , th [ class "text-center hidden sm:table-cell" ] [ text texts.usageCount ]
, th [ class "text-center hidden sm:table-cell" ] [ text "Created" ] , th [ class "text-center hidden sm:table-cell" ] [ text texts.basics.created ]
] ]
] ]
, tbody [] , tbody []

View File

@ -47,6 +47,11 @@ import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Html.Events exposing (onClick)
import Http import Http
import Messages.CustomFieldFormComp
import Messages.EquipmentFormComp
import Messages.OrgFormComp
import Messages.PersonFormComp
import Messages.TagFormComp
import Styles as S import Styles as S
import Util.Http import Util.Http
@ -766,24 +771,25 @@ viewIntern2 settings withButtons model =
] ]
, case model.form of , case model.form of
TM tm -> TM tm ->
Html.map TagMsg (Comp.TagForm.view2 tm) Html.map TagMsg (Comp.TagForm.view2 Messages.TagFormComp.gb tm)
PMR pm -> 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 -> 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 -> 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 -> EM em ->
Html.map EquipMsg (Comp.EquipmentForm.view2 em) Html.map EquipMsg (Comp.EquipmentForm.view2 Messages.EquipmentFormComp.gb em)
CFM fm -> CFM fm ->
div [] div []
(List.map (Html.map CustomFieldMsg) (List.map (Html.map CustomFieldMsg)
(Comp.CustomFieldForm.view2 (Comp.CustomFieldForm.view2
Messages.CustomFieldFormComp.gb
{ classes = "" { classes = ""
, showControls = False , showControls = False
} }

View File

@ -410,11 +410,11 @@ type alias ViewSettings a =
} }
orgFormViewSettings : DS.DropdownStyle -> ViewSettings IdName orgFormViewSettings : String -> DS.DropdownStyle -> ViewSettings IdName
orgFormViewSettings ds = orgFormViewSettings placeholder ds =
{ makeOption = \e -> { text = e.name, additional = "" } { makeOption = \e -> { text = e.name, additional = "" }
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, placeholder = "Choose an organization" , placeholder = placeholder
, style = ds , style = ds
} }

View File

@ -17,6 +17,7 @@ import Data.Flags exposing (Flags)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onInput) import Html.Events exposing (onInput)
import Messages.EquipmentFormComp exposing (Texts)
import Styles as S import Styles as S
import Util.Maybe import Util.Maybe
@ -99,11 +100,11 @@ update _ msg model =
--- View2 --- View2
view2 : Model -> Html Msg view2 : Texts -> Model -> Html Msg
view2 model = view2 texts model =
let let
equipUseCfg = equipUseCfg =
{ display = Data.EquipmentUse.label { display = texts.equipmentUseLabel
, icon = \_ -> Nothing , icon = \_ -> Nothing
, style = DS.mainStyle , style = DS.mainStyle
} }

View File

@ -20,6 +20,7 @@ import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onSubmit) import Html.Events exposing (onSubmit)
import Http import Http
import Messages.EquipmentManageComp exposing (Texts)
import Styles as S import Styles as S
import Util.Http import Util.Http
import Util.Maybe import Util.Maybe
@ -204,38 +205,41 @@ update flags msg model =
--- View2 --- View2
view2 : Model -> Html Msg view2 : Texts -> Model -> Html Msg
view2 model = view2 texts model =
if model.viewMode == Table then if model.viewMode == Table then
viewTable2 model viewTable2 texts model
else else
viewForm2 model viewForm2 texts model
viewTable2 : Model -> Html Msg viewTable2 : Texts -> Model -> Html Msg
viewTable2 model = viewTable2 texts model =
div [ class "flex flex-col" ] div [ class "flex flex-col" ]
[ MB.view [ MB.view
{ start = { start =
[ MB.TextInput [ MB.TextInput
{ tagger = SetQuery { tagger = SetQuery
, value = model.query , value = model.query
, placeholder = "Search" , placeholder = texts.basics.searchPlaceholder
, icon = Just "fa fa-search" , icon = Just "fa fa-search"
} }
] ]
, end = , end =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = InitNewEquipment { tagger = InitNewEquipment
, title = "Create a new equipment" , title = texts.createNewEquipment
, icon = Just "fa fa-plus" , icon = Just "fa fa-plus"
, label = "New Equipment" , label = texts.newEquipment
} }
] ]
, rootClasses = "mb-4" , rootClasses = "mb-4"
} }
, Html.map TableMsg (Comp.EquipmentTable.view2 model.tableModel) , Html.map TableMsg
(Comp.EquipmentTable.view2 texts.equipmentTable
model.tableModel
)
, div , div
[ classList [ classList
[ ( "ui dimmer", True ) [ ( "ui dimmer", True )
@ -247,14 +251,14 @@ viewTable2 model =
] ]
viewForm2 : Model -> Html Msg viewForm2 : Texts -> Model -> Html Msg
viewForm2 model = viewForm2 texts model =
let let
newEquipment = newEquipment =
model.formModel.equipment.id == "" model.formModel.equipment.id == ""
dimmerSettings2 = dimmerSettings2 =
Comp.YesNoDimmer.defaultSettings2 "Really delete this equipment?" Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteEquipment
in in
Html.form Html.form
[ class "relative flex flex-col" [ class "relative flex flex-col"
@ -268,14 +272,14 @@ viewForm2 model =
) )
, if newEquipment then , if newEquipment then
h1 [ class S.header2 ] h1 [ class S.header2 ]
[ text "Create new equipment" [ text texts.createNewEquipment
] ]
else else
h1 [ class S.header2 ] h1 [ class S.header2 ]
[ text model.formModel.equipment.name [ text model.formModel.equipment.name
, div [ class "opacity-50 text-sm" ] , div [ class "opacity-50 text-sm" ]
[ text "Id: " [ text (texts.basics.id ++ ": ")
, text model.formModel.equipment.id , text model.formModel.equipment.id
] ]
] ]
@ -283,24 +287,24 @@ viewForm2 model =
{ start = { start =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = Submit { tagger = Submit
, title = "Submit this form" , title = texts.basics.submitThisForm
, icon = Just "fa fa-save" , icon = Just "fa fa-save"
, label = "Submit" , label = texts.basics.submit
} }
, MB.SecondaryButton , MB.SecondaryButton
{ tagger = SetViewMode Table { tagger = SetViewMode Table
, title = "Back to list" , title = texts.basics.backToList
, icon = Just "fa fa-arrow-left" , icon = Just "fa fa-arrow-left"
, label = "Cancel" , label = texts.basics.cancel
} }
] ]
, end = , end =
if not newEquipment then if not newEquipment then
[ MB.DeleteButton [ MB.DeleteButton
{ tagger = RequestDelete { tagger = RequestDelete
, title = "Delete this equipment" , title = texts.deleteThisEquipment
, icon = Just "fa fa-trash" , icon = Just "fa fa-trash"
, label = "Delete" , label = texts.basics.delete
} }
] ]
@ -317,6 +321,6 @@ viewForm2 model =
] ]
[ Maybe.withDefault "" model.formError |> text [ 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 , B.loadingDimmer model.loading
] ]

View File

@ -12,7 +12,7 @@ import Data.EquipmentUse
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Messages.EquipmentTableComp exposing (Texts)
import Styles as S import Styles as S
@ -52,25 +52,25 @@ update _ msg model =
--- View2 --- View2
view2 : Model -> Html Msg view2 : Texts -> Model -> Html Msg
view2 model = view2 texts model =
table [ class S.tableMain ] table [ class S.tableMain ]
[ thead [] [ thead []
[ tr [] [ tr []
[ th [ class "" ] [] [ th [ class "" ] []
, th [ class "text-left pr-1 md:px-2 w-20" ] , 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 [] , tbody []
(List.map (renderEquipmentLine2 model) model.equips) (List.map (renderEquipmentLine2 texts model) model.equips)
] ]
renderEquipmentLine2 : Model -> Equipment -> Html Msg renderEquipmentLine2 : Texts -> Model -> Equipment -> Html Msg
renderEquipmentLine2 model equip = renderEquipmentLine2 texts model equip =
tr tr
[ classList [ ( "active", model.selected == Just equip ) ] [ classList [ ( "active", model.selected == Just equip ) ]
, class S.tableRow , class S.tableRow
@ -80,7 +80,7 @@ renderEquipmentLine2 model equip =
[ div [ class "label inline-flex text-sm" ] [ div [ class "label inline-flex text-sm" ]
[ Data.EquipmentUse.fromString equip.use [ Data.EquipmentUse.fromString equip.use
|> Maybe.withDefault Data.EquipmentUse.Concerning |> Maybe.withDefault Data.EquipmentUse.Concerning
|> Data.EquipmentUse.label |> texts.equipmentUseLabel
|> text |> text
] ]
] ]

View File

@ -24,6 +24,7 @@ import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput) import Html.Events exposing (onClick, onInput)
import Http import Http
import Messages.FolderDetailComp exposing (Texts)
import Styles as S import Styles as S
import Util.Http import Util.Http
import Util.Maybe import Util.Maybe
@ -275,8 +276,8 @@ update flags msg model =
--- View2 --- View2
view2 : Flags -> Model -> Html Msg view2 : Texts -> Flags -> Model -> Html Msg
view2 flags model = view2 texts flags model =
let let
isOwner = isOwner =
Maybe.map .user flags.account Maybe.map .user flags.account
@ -285,10 +286,10 @@ view2 flags model =
dimmerSettings : Comp.YesNoDimmer.Settings dimmerSettings : Comp.YesNoDimmer.Settings
dimmerSettings = dimmerSettings =
Comp.YesNoDimmer.defaultSettings2 "Really delete this folder?" Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteThisFolder
in in
div [ class "flex flex-col md:relative" ] div [ class "flex flex-col md:relative" ]
(viewButtons2 model (viewButtons2 texts model
:: [ Html.map DeleteMsg :: [ Html.map DeleteMsg
(Comp.YesNoDimmer.viewN (Comp.YesNoDimmer.viewN
True True
@ -299,26 +300,26 @@ view2 flags model =
[ class "py-2 text-lg opacity-75" [ class "py-2 text-lg opacity-75"
, classList [ ( "hidden", model.folder.id /= "" ) ] , classList [ ( "hidden", model.folder.id /= "" ) ]
] ]
[ text "You are automatically set as owner of this new folder." [ text texts.autoOwnerInfo
] ]
, div , div
[ class "py-2 text-lg opacity-75" [ class "py-2 text-lg opacity-75"
, classList [ ( "hidden", model.folder.id == "" ) ] , classList [ ( "hidden", model.folder.id == "" ) ]
] ]
[ text "Modify this folder by changing the name or add/remove members." [ text texts.modifyInfo
] ]
, div , div
[ class S.message [ class S.message
, classList [ ( "hidden", model.folder.id == "" || isOwner ) ] , 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" ] , div [ class "mb-4 flex flex-col" ]
[ label [ label
[ class S.inputLabel [ class S.inputLabel
, for "folder-name" , for "folder-name"
] ]
[ text "Name" [ text texts.name
, B.inputRequired , B.inputRequired
] ]
, div [ class "flex flex-row space-x-2" ] , div [ class "flex flex-row space-x-2" ]
@ -340,7 +341,7 @@ view2 flags model =
] ]
[ i [ class "fa fa-save" ] [] [ i [ class "fa fa-save" ] []
, span [ class "ml-2 hidden sm:inline" ] , span [ class "ml-2 hidden sm:inline" ]
[ text "Save" [ text texts.basics.submit
] ]
] ]
] ]
@ -358,12 +359,12 @@ view2 flags model =
|> text |> text
] ]
] ]
++ viewMembers2 model ++ viewMembers2 texts model
) )
viewMembers2 : Model -> List (Html Msg) viewMembers2 : Texts -> Model -> List (Html Msg)
viewMembers2 model = viewMembers2 texts model =
let let
folderCfg = folderCfg =
{ display = .name { display = .name
@ -379,7 +380,7 @@ viewMembers2 model =
[ class S.header3 [ class S.header3
, class "mt-4" , class "mt-4"
] ]
[ text "Members" [ text texts.members
] ]
, div [ class "flex flex-col space-y-2" ] , div [ class "flex flex-col space-y-2" ]
[ div [ class "flex flex-row space-x-2" ] [ div [ class "flex flex-row space-x-2" ]
@ -393,7 +394,7 @@ viewMembers2 model =
) )
] ]
, a , a
[ title "Add a new member" [ title texts.addMember
, onClick AddMember , onClick AddMember
, class S.primaryButton , class S.primaryButton
, href "#" , href "#"
@ -401,7 +402,7 @@ viewMembers2 model =
] ]
[ i [ class "fa fa-plus" ] [] [ i [ class "fa fa-plus" ] []
, span [ class "ml-2 hidden sm:inline" ] , 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 "flex flex-col space-y-4 md:space-y-2 mt-2"
, class "px-2 border-0 border-l dark:border-bluegray-600" , 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 : Texts -> IdName -> Html Msg
viewMember2 member = viewMember2 texts member =
div div
[ class "flex flex-row space-x-2 items-center" [ class "flex flex-row space-x-2 items-center"
] ]
[ a [ a
[ class S.deleteLabel [ class S.deleteLabel
, href "#" , href "#"
, title "Remove this member" , title texts.removeMember
, onClick (RemoveMember member) , onClick (RemoveMember member)
] ]
[ i [ class "fa fa-trash " ] [] [ i [ class "fa fa-trash " ] []
@ -433,23 +434,23 @@ viewMember2 member =
] ]
viewButtons2 : Model -> Html Msg viewButtons2 : Texts -> Model -> Html Msg
viewButtons2 model = viewButtons2 texts model =
MB.view MB.view
{ start = { start =
[ MB.SecondaryButton [ MB.SecondaryButton
{ tagger = GoBack { tagger = GoBack
, label = "Back" , label = texts.basics.cancel
, icon = Just "fa fa-arrow-left" , icon = Just "fa fa-arrow-left"
, title = "Back to list" , title = texts.basics.backToList
} }
] ]
, end = , end =
[ MB.CustomButton [ MB.CustomButton
{ tagger = RequestDelete { tagger = RequestDelete
, label = "Delete" , label = texts.basics.delete
, icon = Just "fa fa-trash" , icon = Just "fa fa-trash"
, title = "Delete this folder" , title = texts.deleteThisFolder
, inputClass = , inputClass =
[ ( S.deleteButton, True ) [ ( S.deleteButton, True )
, ( "hidden", model.folder.id == "" ) , ( "hidden", model.folder.id == "" )

View File

@ -20,6 +20,7 @@ import Data.Flags exposing (Flags)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Http import Http
import Messages.FolderManageComp exposing (Texts)
import Styles as S import Styles as S
@ -168,50 +169,54 @@ update flags msg model =
--- View2 --- View2
view2 : Flags -> Model -> Html Msg view2 : Texts -> Flags -> Model -> Html Msg
view2 flags model = view2 texts flags model =
case model.detailModel of case model.detailModel of
Just dm -> Just dm ->
viewDetail2 flags dm viewDetail2 texts flags dm
Nothing -> Nothing ->
viewTable2 model viewTable2 texts model
viewDetail2 : Flags -> Comp.FolderDetail.Model -> Html Msg viewDetail2 : Texts -> Flags -> Comp.FolderDetail.Model -> Html Msg
viewDetail2 flags model = viewDetail2 texts flags model =
div [] div []
[ if model.folder.id == "" then [ if model.folder.id == "" then
h3 [ class S.header2 ] h3 [ class S.header2 ]
[ text "Create new Folder" [ text texts.createNewFolder
] ]
else else
h3 [ class S.header2 ] h3 [ class S.header2 ]
[ text model.folder.name [ text model.folder.name
, div [ class "opacity-50 text-sm" ] , div [ class "opacity-50 text-sm" ]
[ text "Id: " [ text (texts.basics.id ++ ": ")
, text model.folder.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 : Texts -> Model -> Html Msg
viewTable2 model = viewTable2 texts model =
div [ class "flex flex-col" ] div [ class "flex flex-col" ]
[ MB.view [ MB.view
{ start = { start =
[ MB.TextInput [ MB.TextInput
{ tagger = SetQuery { tagger = SetQuery
, value = model.query , value = model.query
, placeholder = "Search" , placeholder = texts.basics.searchPlaceholder
, icon = Just "fa fa-search" , icon = Just "fa fa-search"
} }
, MB.Checkbox , MB.Checkbox
{ tagger = \_ -> ToggleOwningOnly { tagger = \_ -> ToggleOwningOnly
, label = "Show owning folders only" , label = texts.showOwningFoldersOnly
, value = model.owningOnly , value = model.owningOnly
, id = "folder-toggle-owner" , id = "folder-toggle-owner"
} }
@ -219,14 +224,19 @@ viewTable2 model =
, end = , end =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = InitNewFolder { tagger = InitNewFolder
, title = "Create a new folder" , title = texts.createNewFolder
, icon = Just "fa fa-plus" , icon = Just "fa fa-plus"
, label = "New Folder" , label = texts.newFolder
} }
] ]
, rootClasses = "mb-4" , 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 , div
[ classList [ classList
[ ( "ui dimmer", True ) [ ( "ui dimmer", True )

View File

@ -11,6 +11,7 @@ import Api.Model.FolderItem exposing (FolderItem)
import Comp.Basic as B import Comp.Basic as B
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Messages.FolderTableComp exposing (Texts)
import Styles as S import Styles as S
import Util.Time import Util.Time
@ -44,23 +45,27 @@ update msg model =
--- View2 --- View2
view2 : Model -> List FolderItem -> Html Msg view2 : Texts -> Model -> List FolderItem -> Html Msg
view2 _ items = view2 texts _ items =
table [ class S.tableMain ] table [ class S.tableMain ]
[ thead [] [ thead []
[ tr [] [ tr []
[ th [ class "w-px whitespace-nowrap pr-1 md:pr-3" ] [] [ 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-left hidden sm:table-cell" ] [ text "Owner" ]
, th [ class "text-center" ] , th [ class "text-center" ]
[ span [ class "hidden sm:inline" ] [ span [ class "hidden sm:inline" ]
[ text "#Member" [ text texts.memberCount
] ]
, span [ class "sm:hidden" ] , span [ class "sm:hidden" ]
[ text "#" [ text "#"
] ]
] ]
, th [ class "text-center" ] [ text "Created" ] , th [ class "text-center" ]
[ text texts.basics.created
]
] ]
] ]
, tbody [] , tbody []

View File

@ -296,7 +296,7 @@ item visible. This message will disappear then.
] ]
, Html.map OrgDropdownMsg , Html.map OrgDropdownMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
(Comp.Dropdown.orgFormViewSettings dds) (Comp.Dropdown.orgFormViewSettings "Choose an organization" dds)
settings settings
model.corrOrgModel model.corrOrgModel
) )

View File

@ -20,6 +20,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onInput) import Html.Events exposing (onInput)
import Messages.OrgFormComp exposing (Texts)
import Styles as S import Styles as S
import Util.Maybe import Util.Maybe
@ -146,14 +147,19 @@ update flags msg model =
--- View2 --- View2
view2 : Bool -> UiSettings -> Model -> Html Msg view2 : Texts -> Bool -> UiSettings -> Model -> Html Msg
view2 mobile settings model = view2 texts mobile settings model =
let let
orgUseCfg = orgUseCfg =
{ display = Data.OrgUse.label { display = texts.orgUseLabel
, icon = \_ -> Nothing , icon = \_ -> Nothing
, style = DS.mainStyle , style = DS.mainStyle
} }
contactTypeCfg =
{ mobile = mobile
, contactTypeLabel = texts.contactTypeLabel
}
in in
div [ class "flex flex-col" ] div [ class "flex flex-col" ]
[ div [ div
@ -162,13 +168,13 @@ view2 mobile settings model =
[ for "orgname" [ for "orgname"
, class S.inputLabel , class S.inputLabel
] ]
[ text "Name" [ text texts.name
, B.inputRequired , B.inputRequired
] ]
, input , input
[ type_ "text" [ type_ "text"
, onInput SetName , onInput SetName
, placeholder "Name" , placeholder texts.name
, value model.name , value model.name
, name "orgname" , name "orgname"
, class S.textInput , class S.textInput
@ -184,12 +190,12 @@ view2 mobile settings model =
[ for "org-short-name" [ for "org-short-name"
, class S.inputLabel , class S.inputLabel
] ]
[ text "Short Name" [ text texts.shortName
] ]
, input , input
[ type_ "text" [ type_ "text"
, onInput SetShortName , onInput SetShortName
, placeholder "Abbreviation" , placeholder texts.shortName
, Maybe.withDefault "" model.shortName , Maybe.withDefault "" model.shortName
|> value |> value
, name "org-short-name" , name "org-short-name"
@ -201,7 +207,8 @@ view2 mobile settings model =
[ label [ label
[ class S.inputLabel [ class S.inputLabel
] ]
[ text "Use" ] [ text texts.use
]
, Html.map UseDropdownMsg , Html.map UseDropdownMsg
(Comp.FixedDropdown.viewStyled2 orgUseCfg (Comp.FixedDropdown.viewStyled2 orgUseCfg
False False
@ -211,29 +218,29 @@ view2 mobile settings model =
, span [ class "opacity-50 text-sm" ] , span [ class "opacity-50 text-sm" ]
[ case model.use of [ case model.use of
Data.OrgUse.Correspondent -> Data.OrgUse.Correspondent ->
text "Use as correspondent" text texts.useAsCorrespondent
Data.OrgUse.Disabled -> Data.OrgUse.Disabled ->
text "Do not use for suggestions." text texts.dontUseForSuggestions
] ]
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ h3 [ class S.header3 ] [ h3 [ class S.header3 ]
[ text "Address" [ text texts.address
] ]
, Html.map AddressMsg , Html.map AddressMsg
(Comp.AddressForm.view2 settings model.addressModel) (Comp.AddressForm.view2 texts.addressForm settings model.addressModel)
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ h3 [ class S.header3 ] [ h3 [ class S.header3 ]
[ text "Contacts" [ text texts.contacts
] ]
, Html.map ContactMsg , Html.map ContactMsg
(Comp.ContactField.view2 mobile settings model.contactModel) (Comp.ContactField.view2 contactTypeCfg settings model.contactModel)
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ h3 [ class S.header3 ] [ h3 [ class S.header3 ]
[ text "Notes" [ text texts.notes
] ]
, div [ class "" ] , div [ class "" ]
[ textarea [ textarea

View File

@ -21,6 +21,7 @@ import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onSubmit) import Html.Events exposing (onSubmit)
import Http import Http
import Messages.OrgManageComp exposing (Texts)
import Styles as S import Styles as S
import Util.Http import Util.Http
import Util.Maybe import Util.Maybe
@ -205,50 +206,50 @@ update flags msg model =
--- View2 --- View2
view2 : UiSettings -> Model -> Html Msg view2 : Texts -> UiSettings -> Model -> Html Msg
view2 settings model = view2 texts settings model =
if model.viewMode == Table then if model.viewMode == Table then
viewTable2 model viewTable2 texts model
else else
viewForm2 settings model viewForm2 texts settings model
viewTable2 : Model -> Html Msg viewTable2 : Texts -> Model -> Html Msg
viewTable2 model = viewTable2 texts model =
div [ class "flex flex-col relative" ] div [ class "flex flex-col relative" ]
[ MB.view [ MB.view
{ start = { start =
[ MB.TextInput [ MB.TextInput
{ tagger = SetQuery { tagger = SetQuery
, value = model.query , value = model.query
, placeholder = "Search" , placeholder = texts.basics.searchPlaceholder
, icon = Just "fa fa-search" , icon = Just "fa fa-search"
} }
] ]
, end = , end =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = InitNewOrg { tagger = InitNewOrg
, title = "Create a new organization" , title = texts.createNewOrganization
, icon = Just "fa fa-plus" , icon = Just "fa fa-plus"
, label = "New Organization" , label = texts.newOrganization
} }
] ]
, rootClasses = "mb-4" , 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 , B.loadingDimmer model.loading
] ]
viewForm2 : UiSettings -> Model -> Html Msg viewForm2 : Texts -> UiSettings -> Model -> Html Msg
viewForm2 settings model = viewForm2 texts settings model =
let let
newOrg = newOrg =
model.formModel.org.id == "" model.formModel.org.id == ""
dimmerSettings2 = dimmerSettings2 =
Comp.YesNoDimmer.defaultSettings2 "Really delete this organization?" Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteOrg
in in
Html.form Html.form
[ class "md:relative flex flex-col" [ class "md:relative flex flex-col"
@ -262,14 +263,14 @@ viewForm2 settings model =
) )
, if newOrg then , if newOrg then
h3 [ class S.header2 ] h3 [ class S.header2 ]
[ text "Create new organization" [ text texts.createNewOrganization
] ]
else else
h3 [ class S.header2 ] h3 [ class S.header2 ]
[ text model.formModel.org.name [ text model.formModel.org.name
, div [ class "opacity-50 text-sm" ] , div [ class "opacity-50 text-sm" ]
[ text "Id: " [ text (texts.basics.id ++ ": ")
, text model.formModel.org.id , text model.formModel.org.id
] ]
] ]
@ -277,24 +278,24 @@ viewForm2 settings model =
{ start = { start =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = Submit { tagger = Submit
, title = "Submit this form" , title = texts.basics.submitThisForm
, icon = Just "fa fa-save" , icon = Just "fa fa-save"
, label = "Submit" , label = texts.basics.submit
} }
, MB.SecondaryButton , MB.SecondaryButton
{ tagger = SetViewMode Table { tagger = SetViewMode Table
, title = "Back to list" , title = texts.basics.backToList
, icon = Just "fa fa-arrow-left" , icon = Just "fa fa-arrow-left"
, label = "Cancel" , label = texts.basics.cancel
} }
] ]
, end = , end =
if not newOrg then if not newOrg then
[ MB.DeleteButton [ MB.DeleteButton
{ tagger = RequestDelete { tagger = RequestDelete
, title = "Delete this organization" , title = texts.deleteThisOrg
, icon = Just "fa fa-trash" , icon = Just "fa fa-trash"
, label = "Delete" , label = texts.basics.delete
} }
] ]
@ -311,6 +312,12 @@ viewForm2 settings model =
] ]
[ Maybe.withDefault "" model.formError |> text [ 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 , B.loadingDimmer model.loading
] ]

View File

@ -12,6 +12,7 @@ import Data.Flags exposing (Flags)
import Data.OrgUse import Data.OrgUse
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Messages.OrgTableComp exposing (Texts)
import Styles as S import Styles as S
import Util.Address import Util.Address
import Util.Contact import Util.Contact
@ -53,8 +54,8 @@ update _ msg model =
--- View2 --- View2
view2 : Model -> Html Msg view2 : Texts -> Model -> Html Msg
view2 model = view2 texts model =
table [ class S.tableMain ] table [ class S.tableMain ]
[ thead [] [ thead []
[ tr [] [ tr []
@ -62,18 +63,24 @@ view2 model =
, th [ class "text-left pr-1 md:px-2" ] , th [ class "text-left pr-1 md:px-2" ]
[ text "Use" [ text "Use"
] ]
, th [ class "text-left" ] [ text "Name" ] , th [ class "text-left" ]
, th [ class "text-left hidden md:table-cell" ] [ text "Address" ] [ text texts.name
, th [ class "text-left hidden sm:table-cell" ] [ text "Contact" ] ]
, th [ class "text-left hidden md:table-cell" ]
[ text texts.address
]
, th [ class "text-left hidden sm:table-cell" ]
[ text texts.contact
]
] ]
] ]
, tbody [] , tbody []
(List.map (renderOrgLine2 model) model.orgs) (List.map (renderOrgLine2 texts model) model.orgs)
] ]
renderOrgLine2 : Model -> Organization -> Html Msg renderOrgLine2 : Texts -> Model -> Organization -> Html Msg
renderOrgLine2 model org = renderOrgLine2 texts model org =
tr tr
[ classList [ ( "active", model.selected == Just org ) ] [ classList [ ( "active", model.selected == Just org ) ]
, class S.tableRow , class S.tableRow
@ -83,7 +90,7 @@ renderOrgLine2 model org =
[ div [ class "label inline-flex text-sm" ] [ div [ class "label inline-flex text-sm" ]
[ Data.OrgUse.fromString org.use [ Data.OrgUse.fromString org.use
|> Maybe.withDefault Data.OrgUse.Correspondent |> Maybe.withDefault Data.OrgUse.Correspondent
|> Data.OrgUse.label |> texts.orgUseLabel
|> text |> text
] ]
] ]

View File

@ -22,6 +22,7 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onInput) import Html.Events exposing (onInput)
import Messages.PersonFormComp exposing (Texts)
import Styles as S import Styles as S
@ -178,14 +179,19 @@ update flags msg model =
--- View2 --- View2
view2 : Bool -> UiSettings -> Model -> Html Msg view2 : Texts -> Bool -> UiSettings -> Model -> Html Msg
view2 mobile settings model = view2 texts mobile settings model =
let let
personUseCfg = personUseCfg =
{ display = Data.PersonUse.label { display = texts.personUseLabel
, icon = \_ -> Nothing , icon = \_ -> Nothing
, style = DS.mainStyle , style = DS.mainStyle
} }
contactCfg =
{ mobile = mobile
, contactTypeLabel = texts.contactTypeLabel
}
in in
div [ class "flex flex-col" ] div [ class "flex flex-col" ]
[ div [ div
@ -195,13 +201,13 @@ view2 mobile settings model =
[ class S.inputLabel [ class S.inputLabel
, for "personname" , for "personname"
] ]
[ text "Name" [ text texts.name
, B.inputRequired , B.inputRequired
] ]
, input , input
[ type_ "text" [ type_ "text"
, onInput SetName , onInput SetName
, placeholder "Name" , placeholder texts.name
, value model.name , value model.name
, class S.textInput , class S.textInput
, classList , classList
@ -215,53 +221,58 @@ view2 mobile settings model =
[ label [ label
[ class S.inputLabel [ class S.inputLabel
] ]
[ text "Use of this person" ] [ text texts.useOfPerson
]
, Html.map UseDropdownMsg , Html.map UseDropdownMsg
(Comp.FixedDropdown.viewStyled2 personUseCfg False (Just model.use) model.useModel) (Comp.FixedDropdown.viewStyled2 personUseCfg False (Just model.use) model.useModel)
, span [ class "opacity-50 text-sm" ] , span [ class "opacity-50 text-sm" ]
[ case model.use of [ case model.use of
Data.PersonUse.Concerning -> Data.PersonUse.Concerning ->
text "Use as concerning person only" text texts.useAsConcerningOnly
Data.PersonUse.Correspondent -> Data.PersonUse.Correspondent ->
text "Use as correspondent person only" text texts.useAsCorrespondentOnly
Data.PersonUse.Both -> Data.PersonUse.Both ->
text "Use as both concerning or correspondent person" text texts.useAsBoth
Data.PersonUse.Disabled -> Data.PersonUse.Disabled ->
text "Do not use for suggestions." text texts.dontUseForSuggestions
] ]
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ label [ label
[ class S.inputLabel [ class S.inputLabel
] ]
[ text "Organization" [ text texts.organization
] ]
, Html.map OrgDropdownMsg , Html.map OrgDropdownMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
(Comp.Dropdown.orgFormViewSettings DS.mainStyle) (Comp.Dropdown.orgFormViewSettings texts.chooseAnOrg DS.mainStyle)
settings settings
model.orgModel model.orgModel
) )
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ h3 [ class "ui dividing header" ] [ 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" ] , div [ class "mb-4" ]
[ h3 [ class S.header3 ] [ h3 [ class S.header3 ]
[ text "Contacts" [ text texts.contacts
] ]
, Html.map ContactMsg , Html.map ContactMsg
(Comp.ContactField.view2 mobile settings model.contactModel) (Comp.ContactField.view2 contactCfg settings model.contactModel)
] ]
, div [ class "mb-4" ] , div [ class "mb-4" ]
[ h3 [ class S.header3 ] [ h3 [ class S.header3 ]
[ text "Notes" [ text texts.notes
] ]
, div [ class "" ] , div [ class "" ]
[ textarea [ textarea

View File

@ -22,6 +22,7 @@ import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onSubmit) import Html.Events exposing (onSubmit)
import Http import Http
import Messages.PersonManageComp exposing (Texts)
import Styles as S import Styles as S
import Util.Http import Util.Http
import Util.Maybe import Util.Maybe
@ -242,50 +243,50 @@ isLoading model =
--- View2 --- View2
view2 : UiSettings -> Model -> Html Msg view2 : Texts -> UiSettings -> Model -> Html Msg
view2 settings model = view2 texts settings model =
if model.viewMode == Table then if model.viewMode == Table then
viewTable2 model viewTable2 texts model
else else
viewForm2 settings model viewForm2 texts settings model
viewTable2 : Model -> Html Msg viewTable2 : Texts -> Model -> Html Msg
viewTable2 model = viewTable2 texts model =
div [ class "flex flex-col" ] div [ class "flex flex-col" ]
[ MB.view [ MB.view
{ start = { start =
[ MB.TextInput [ MB.TextInput
{ tagger = SetQuery { tagger = SetQuery
, value = model.query , value = model.query
, placeholder = "Search" , placeholder = texts.basics.searchPlaceholder
, icon = Just "fa fa-search" , icon = Just "fa fa-search"
} }
] ]
, end = , end =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = InitNewPerson { tagger = InitNewPerson
, title = "Create a new person" , title = texts.createNewPerson
, icon = Just "fa fa-plus" , icon = Just "fa fa-plus"
, label = "New Person" , label = texts.newPerson
} }
] ]
, rootClasses = "mb-4" , 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) , B.loadingDimmer (isLoading model)
] ]
viewForm2 : UiSettings -> Model -> Html Msg viewForm2 : Texts -> UiSettings -> Model -> Html Msg
viewForm2 settings model = viewForm2 texts settings model =
let let
newPerson = newPerson =
model.formModel.person.id == "" model.formModel.person.id == ""
dimmerSettings2 = dimmerSettings2 =
Comp.YesNoDimmer.defaultSettings2 "Really delete this person?" Comp.YesNoDimmer.defaultSettings2 texts.reallyDeletePerson
in in
Html.form Html.form
[ class "md:relative flex flex-col" [ class "md:relative flex flex-col"
@ -299,14 +300,14 @@ viewForm2 settings model =
) )
, if newPerson then , if newPerson then
h3 [ class S.header2 ] h3 [ class S.header2 ]
[ text "Create new person" [ text texts.createNewPerson
] ]
else else
h3 [ class S.header2 ] h3 [ class S.header2 ]
[ text model.formModel.person.name [ text model.formModel.person.name
, div [ class "opacity-50 text-sm" ] , div [ class "opacity-50 text-sm" ]
[ text "Id: " [ text (texts.basics.id ++ ": ")
, text model.formModel.person.id , text model.formModel.person.id
] ]
] ]
@ -314,24 +315,24 @@ viewForm2 settings model =
{ start = { start =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = Submit { tagger = Submit
, title = "Submit this form" , title = texts.basics.submitThisForm
, icon = Just "fa fa-save" , icon = Just "fa fa-save"
, label = "Submit" , label = texts.basics.submit
} }
, MB.SecondaryButton , MB.SecondaryButton
{ tagger = SetViewMode Table { tagger = SetViewMode Table
, title = "Back to list" , title = texts.basics.backToList
, icon = Just "fa fa-arrow-left" , icon = Just "fa fa-arrow-left"
, label = "Cancel" , label = texts.basics.cancel
} }
] ]
, end = , end =
if not newPerson then if not newPerson then
[ MB.DeleteButton [ MB.DeleteButton
{ tagger = RequestDelete { tagger = RequestDelete
, title = "Delete this person" , title = texts.deleteThisPerson
, icon = Just "fa fa-trash" , icon = Just "fa fa-trash"
, label = "Delete" , label = texts.basics.delete
} }
] ]
@ -348,6 +349,11 @@ viewForm2 settings model =
] ]
[ Maybe.withDefault "" model.formError |> text [ 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) , B.loadingDimmer (isLoading model)
] ]

View File

@ -12,6 +12,7 @@ import Data.Flags exposing (Flags)
import Data.PersonUse import Data.PersonUse
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Messages.PersonTableComp exposing (Texts)
import Styles as S import Styles as S
import Util.Contact import Util.Contact
@ -52,8 +53,8 @@ update _ msg model =
--- View2 --- View2
view2 : Model -> Html Msg view2 : Texts -> Model -> Html Msg
view2 model = view2 texts model =
table [ class S.tableMain ] table [ class S.tableMain ]
[ thead [] [ thead []
[ tr [] [ tr []
@ -67,12 +68,12 @@ view2 model =
] ]
] ]
, tbody [] , tbody []
(List.map (renderPersonLine2 model) model.equips) (List.map (renderPersonLine2 texts model) model.equips)
] ]
renderPersonLine2 : Model -> Person -> Html Msg renderPersonLine2 : Texts -> Model -> Person -> Html Msg
renderPersonLine2 model person = renderPersonLine2 texts model person =
tr tr
[ classList [ ( "active", model.selected == Just person ) ] [ classList [ ( "active", model.selected == Just person ) ]
, class S.tableRow , class S.tableRow
@ -82,7 +83,7 @@ renderPersonLine2 model person =
[ div [ class "label inline-flex text-sm" ] [ div [ class "label inline-flex text-sm" ]
[ Data.PersonUse.fromString person.use [ Data.PersonUse.fromString person.use
|> Maybe.withDefault Data.PersonUse.Both |> Maybe.withDefault Data.PersonUse.Both
|> Data.PersonUse.label |> texts.personUseLabel
|> text |> text
] ]
] ]

View File

@ -1138,7 +1138,7 @@ searchTabs ddd flags settings model =
[ text "Organization" ] [ text "Organization" ]
, Html.map OrgMsg , Html.map OrgMsg
(Comp.Dropdown.view2 (Comp.Dropdown.view2
(Comp.Dropdown.orgFormViewSettings DS.sidebarStyle) (Comp.Dropdown.orgFormViewSettings "Choose an organization" DS.sidebarStyle)
settings settings
model.orgModel model.orgModel
) )

View File

@ -16,6 +16,7 @@ import Data.Flags exposing (Flags)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onInput) import Html.Events exposing (onInput)
import Messages.TagFormComp exposing (Texts)
import Styles as S import Styles as S
import Util.Maybe import Util.Maybe
@ -118,12 +119,12 @@ update _ msg model =
--- View2 --- View2
view2 : Model -> Html Msg view2 : Texts -> Model -> Html Msg
view2 model = view2 texts model =
let let
categoryCfg = categoryCfg =
{ makeOption = \s -> Comp.Dropdown.mkOption s { makeOption = \s -> Comp.Dropdown.mkOption s
, placeholder = "Select or define category..." , placeholder = texts.selectDefineCategory
, labelColor = \_ -> \_ -> "" , labelColor = \_ -> \_ -> ""
, style = DS.mainStyle , style = DS.mainStyle
} }
@ -135,13 +136,13 @@ view2 model =
[ for "tagname" [ for "tagname"
, class S.inputLabel , class S.inputLabel
] ]
[ text "Name" [ text texts.name
, B.inputRequired , B.inputRequired
] ]
, input , input
[ type_ "text" [ type_ "text"
, onInput SetName , onInput SetName
, placeholder "Name" , placeholder texts.name
, value model.name , value model.name
, id "tagname" , id "tagname"
, class S.textInput , class S.textInput
@ -157,7 +158,7 @@ view2 model =
[ label [ label
[ class S.inputLabel [ class S.inputLabel
] ]
[ text "Category" [ text texts.category
] ]
, Html.map CatMsg , Html.map CatMsg
(Comp.Dropdown.viewSingle2 (Comp.Dropdown.viewSingle2

View File

@ -20,6 +20,7 @@ import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onSubmit) import Html.Events exposing (onSubmit)
import Http import Http
import Messages.TagManageComp exposing (Texts)
import Styles as S import Styles as S
import Util.Http import Util.Http
import Util.Maybe import Util.Maybe
@ -213,38 +214,38 @@ update flags msg model =
--- View2 --- View2
view2 : Model -> Html Msg view2 : Texts -> Model -> Html Msg
view2 model = view2 texts model =
if model.viewMode == Table then if model.viewMode == Table then
viewTable2 model viewTable2 texts model
else else
viewForm2 model viewForm2 texts model
viewTable2 : Model -> Html Msg viewTable2 : Texts -> Model -> Html Msg
viewTable2 model = viewTable2 texts model =
div [ class "flex flex-col" ] div [ class "flex flex-col" ]
[ MB.view [ MB.view
{ start = { start =
[ MB.TextInput [ MB.TextInput
{ tagger = SetQuery { tagger = SetQuery
, value = model.query , value = model.query
, placeholder = "Search" , placeholder = texts.basics.searchPlaceholder
, icon = Just "fa fa-search" , icon = Just "fa fa-search"
} }
] ]
, end = , end =
[ MB.PrimaryButton [ MB.PrimaryButton
{ tagger = InitNewTag { tagger = InitNewTag
, title = "Create a new tag" , title = texts.createNewTag
, icon = Just "fa fa-plus" , icon = Just "fa fa-plus"
, label = "New Tag" , label = texts.newTag
} }
] ]
, rootClasses = "mb-4" , rootClasses = "mb-4"
} }
, Html.map TableMsg (Comp.TagTable.view2 model.tagTableModel) , Html.map TableMsg (Comp.TagTable.view2 texts.tagTable model.tagTableModel)
, div , div
[ classList [ classList
[ ( "ui dimmer", True ) [ ( "ui dimmer", True )
@ -256,14 +257,14 @@ viewTable2 model =
] ]
viewForm2 : Model -> Html Msg viewForm2 : Texts -> Model -> Html Msg
viewForm2 model = viewForm2 texts model =
let let
newTag = newTag =
model.tagFormModel.tag.id == "" model.tagFormModel.tag.id == ""
dimmerSettings2 = dimmerSettings2 =
Comp.YesNoDimmer.defaultSettings2 "Really delete this tag?" Comp.YesNoDimmer.defaultSettings2 texts.reallyDeleteTag
in in
Html.form Html.form
[ class "relative flex flex-col" [ class "relative flex flex-col"
@ -277,7 +278,7 @@ viewForm2 model =
) )
, if newTag then , if newTag then
h1 [ class S.header2 ] h1 [ class S.header2 ]
[ text "Create new tag" [ text texts.createNewTag
] ]
else else
@ -294,22 +295,22 @@ viewForm2 model =
{ tagger = Submit { tagger = Submit
, title = "Submit this form" , title = "Submit this form"
, icon = Just "fa fa-save" , icon = Just "fa fa-save"
, label = "Submit" , label = texts.basics.submit
} }
, MB.SecondaryButton , MB.SecondaryButton
{ tagger = SetViewMode Table { tagger = SetViewMode Table
, title = "Back to list" , title = texts.basics.backToList
, icon = Just "fa fa-arrow-left" , icon = Just "fa fa-arrow-left"
, label = "Cancel" , label = texts.basics.cancel
} }
] ]
, end = , end =
if not newTag then if not newTag then
[ MB.DeleteButton [ MB.DeleteButton
{ tagger = RequestDelete { tagger = RequestDelete
, title = "Delete this tag" , title = texts.deleteThisTag
, icon = Just "fa fa-trash" , icon = Just "fa fa-trash"
, label = "Delete" , label = texts.basics.delete
} }
] ]
@ -326,6 +327,6 @@ viewForm2 model =
] ]
[ Maybe.withDefault "" model.formError |> text [ 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 , B.loadingDimmer model.loading
] ]

View File

@ -11,6 +11,7 @@ import Comp.Basic as B
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Messages.TagTableComp exposing (Texts)
import Styles as S import Styles as S
@ -50,14 +51,14 @@ update _ msg model =
--- View2 --- View2
view2 : Model -> Html Msg view2 : Texts -> Model -> Html Msg
view2 model = view2 texts model =
table [ class S.tableMain ] table [ class S.tableMain ]
[ thead [] [ thead []
[ tr [] [ tr []
[ th [ class "" ] [] [ th [ class "" ] []
, th [ class "text-left" ] [ text "Name" ] , th [ class "text-left" ] [ text texts.name ]
, th [ class "text-left" ] [ text "Category" ] , th [ class "text-left" ] [ text texts.category ]
] ]
] ]
, tbody [] , tbody []

View File

@ -3,7 +3,6 @@ module Data.CustomFieldType exposing
, all , all
, asString , asString
, fromString , fromString
, label
) )
@ -39,25 +38,6 @@ asString ft =
"money" "money"
label : CustomFieldType -> String
label ft =
case ft of
Text ->
"Text"
Numeric ->
"Numeric"
Date ->
"Date"
Boolean ->
"Boolean"
Money ->
"Money"
fromString : String -> Maybe CustomFieldType fromString : String -> Maybe CustomFieldType
fromString str = fromString str =
case String.toLower str of case String.toLower str of

View File

@ -3,7 +3,6 @@ module Data.EquipmentUse exposing
, all , all
, asString , asString
, fromString , fromString
, label
) )
import Api.Model.Equipment exposing (Equipment) import Api.Model.Equipment exposing (Equipment)
@ -37,16 +36,6 @@ asString pu =
"disabled" "disabled"
label : EquipmentUse -> String
label pu =
case pu of
Concerning ->
"Concerning"
Disabled ->
"Disabled"
all : List EquipmentUse all : List EquipmentUse
all = all =
[ Concerning, Disabled ] [ Concerning, Disabled ]

View File

@ -3,7 +3,6 @@ module Data.OrgUse exposing
, all , all
, asString , asString
, fromString , fromString
, label
) )
@ -35,16 +34,6 @@ asString pu =
"disabled" "disabled"
label : OrgUse -> String
label pu =
case pu of
Correspondent ->
"Correspondent"
Disabled ->
"Disabled"
all : List OrgUse all : List OrgUse
all = all =
[ Correspondent, Disabled ] [ Correspondent, Disabled ]

View File

@ -3,7 +3,6 @@ module Data.PersonUse exposing
, all , all
, asString , asString
, fromString , fromString
, label
, spanPersonList , spanPersonList
) )
@ -52,22 +51,6 @@ asString pu =
"disabled" "disabled"
label : PersonUse -> String
label pu =
case pu of
Correspondent ->
"Correspondent"
Concerning ->
"Concerning"
Both ->
"Both"
Disabled ->
"Disabled"
all : List PersonUse all : List PersonUse
all = all =
[ Correspondent, Concerning, Both, Disabled ] [ Correspondent, Concerning, Both, Disabled ]

View File

@ -9,6 +9,7 @@ import Messages.App
import Messages.CollectiveSettingsPage import Messages.CollectiveSettingsPage
import Messages.ItemDetailPage import Messages.ItemDetailPage
import Messages.LoginPage import Messages.LoginPage
import Messages.ManageDataPage
import Messages.NewInvitePage import Messages.NewInvitePage
import Messages.QueuePage import Messages.QueuePage
import Messages.RegisterPage import Messages.RegisterPage
@ -33,6 +34,7 @@ type alias Messages =
, itemDetail : Messages.ItemDetailPage.Texts , itemDetail : Messages.ItemDetailPage.Texts
, queue : Messages.QueuePage.Texts , queue : Messages.QueuePage.Texts
, userSettings : Messages.UserSettingsPage.Texts , userSettings : Messages.UserSettingsPage.Texts
, manageData : Messages.ManageDataPage.Texts
} }
@ -94,6 +96,7 @@ gb =
, itemDetail = Messages.ItemDetailPage.gb , itemDetail = Messages.ItemDetailPage.gb
, queue = Messages.QueuePage.gb , queue = Messages.QueuePage.gb
, userSettings = Messages.UserSettingsPage.gb , userSettings = Messages.UserSettingsPage.gb
, manageData = Messages.ManageDataPage.gb
} }
@ -112,4 +115,5 @@ de =
, itemDetail = Messages.ItemDetailPage.de , itemDetail = Messages.ItemDetailPage.de
, queue = Messages.QueuePage.de , queue = Messages.QueuePage.de
, userSettings = Messages.UserSettingsPage.de , userSettings = Messages.UserSettingsPage.de
, manageData = Messages.ManageDataPage.de
} }

View File

@ -0,0 +1,20 @@
module Messages.AddressFormComp exposing (..)
type alias Texts =
{ selectCountry : String
, street : String
, zipCode : String
, city : String
, country : String
}
gb : Texts
gb =
{ selectCountry = "Select Country"
, street = "Street"
, zipCode = "Zip Code"
, city = "City"
, country = "Country"
}

View File

@ -14,6 +14,8 @@ type alias Texts =
, edit : String , edit : String
, back : String , back : String
, backToList : String , backToList : String
, searchPlaceholder : String
, id : String
} }
@ -31,6 +33,8 @@ gb =
, edit = "Edit" , edit = "Edit"
, back = "Back" , back = "Back"
, backToList = "Back to list" , backToList = "Back to list"
, searchPlaceholder = "Search"
, id = "Id"
} }

View File

@ -0,0 +1,25 @@
module Messages.ContactTypeData exposing (..)
import Data.ContactType exposing (ContactType(..))
gb : ContactType -> String
gb ct =
case ct of
Phone ->
"Phone"
Mobile ->
"Mobile"
Fax ->
"Fax"
Email ->
"Email"
Docspell ->
"Docspell"
Website ->
"Website"

View File

@ -0,0 +1,46 @@
module Messages.CustomFieldFormComp exposing (..)
import Data.CustomFieldType exposing (CustomFieldType)
import Messages.Basics
import Messages.CustomFieldTypeData
type alias Texts =
{ basics : Messages.Basics.Texts
, reallyDeleteField : String
, fieldTypeLabel : CustomFieldType -> String
, createCustomField : String
, modifyTypeWarning : String
, name : String
, nameInfo : String
, fieldFormat : String
, fieldFormatInfo : String
, label : String
, labelInfo : String
, deleteThisField : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, reallyDeleteField = "Really delete this custom field?"
, fieldTypeLabel = Messages.CustomFieldTypeData.gb
, createCustomField = "Create a new custom field."
, modifyTypeWarning =
"Note that changing the format may "
++ "result in invisible values in the ui, if they don't comply to the new format!"
, name = "Name"
, nameInfo =
"The name uniquely identifies this field. It must be a valid "
++ "identifier, not contain spaces or weird characters."
, fieldFormat = "Field Format"
, fieldFormatInfo =
"A field must have a format. Values are validated "
++ "according to this format."
, label = "Label"
, labelInfo =
"The user defined label for this field. This is used to represent "
++ "this field in the ui. If not present, the name is used."
, deleteThisField = "Delete this field"
}

View File

@ -0,0 +1,24 @@
module Messages.CustomFieldManageComp exposing (..)
import Messages.Basics
import Messages.CustomFieldFormComp
import Messages.CustomFieldTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, fieldForm : Messages.CustomFieldFormComp.Texts
, fieldTable : Messages.CustomFieldTableComp.Texts
, addCustomField : String
, newCustomField : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, fieldForm = Messages.CustomFieldFormComp.gb
, fieldTable = Messages.CustomFieldTableComp.gb
, addCustomField = "Add a new custom field"
, newCustomField = "New custom field"
}

View File

@ -0,0 +1,20 @@
module Messages.CustomFieldTableComp exposing (..)
import Messages.Basics
type alias Texts =
{ basics : Messages.Basics.Texts
, nameLabel : String
, format : String
, usageCount : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, nameLabel = "Name/Label"
, format = "Format"
, usageCount = "#Usage"
}

View File

@ -0,0 +1,22 @@
module Messages.CustomFieldTypeData exposing (..)
import Data.CustomFieldType exposing (CustomFieldType(..))
gb : CustomFieldType -> String
gb ft =
case ft of
Text ->
"Text"
Numeric ->
"Numeric"
Date ->
"Date"
Boolean ->
"Boolean"
Money ->
"Money"

View File

@ -0,0 +1,15 @@
module Messages.EquipmentFormComp exposing (..)
import Data.EquipmentUse exposing (EquipmentUse)
import Messages.EquipmentUseData
type alias Texts =
{ equipmentUseLabel : EquipmentUse -> String
}
gb : Texts
gb =
{ equipmentUseLabel = Messages.EquipmentUseData.gb
}

View File

@ -0,0 +1,28 @@
module Messages.EquipmentManageComp exposing (..)
import Messages.Basics
import Messages.EquipmentFormComp
import Messages.EquipmentTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, equipmentTable : Messages.EquipmentTableComp.Texts
, equipmentForm : Messages.EquipmentFormComp.Texts
, createNewEquipment : String
, newEquipment : String
, reallyDeleteEquipment : String
, deleteThisEquipment : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, equipmentTable = Messages.EquipmentTableComp.gb
, equipmentForm = Messages.EquipmentFormComp.gb
, createNewEquipment = "Create a new equipment"
, newEquipment = "New Equipment"
, reallyDeleteEquipment = "Really delete this equipment?"
, deleteThisEquipment = "Delete this equipment"
}

View File

@ -0,0 +1,19 @@
module Messages.EquipmentTableComp exposing (..)
import Data.EquipmentUse exposing (EquipmentUse)
import Messages.EquipmentUseData
type alias Texts =
{ name : String
, use : String
, equipmentUseLabel : EquipmentUse -> String
}
gb : Texts
gb =
{ name = "Name"
, use = "Use"
, equipmentUseLabel = Messages.EquipmentUseData.gb
}

View File

@ -0,0 +1,13 @@
module Messages.EquipmentUseData exposing (..)
import Data.EquipmentUse exposing (EquipmentUse(..))
gb : EquipmentUse -> String
gb pu =
case pu of
Concerning ->
"Concerning"
Disabled ->
"Disabled"

View File

@ -0,0 +1,34 @@
module Messages.FolderDetailComp exposing (..)
import Messages.Basics
type alias Texts =
{ basics : Messages.Basics.Texts
, reallyDeleteThisFolder : String
, autoOwnerInfo : String
, modifyInfo : String
, notOwnerInfo : String
, name : String
, members : String
, addMember : String
, add : String
, removeMember : String
, deleteThisFolder : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, reallyDeleteThisFolder = "Really delete this folder?"
, autoOwnerInfo = "You are automatically set as owner of this new folder."
, modifyInfo = "Modify this folder by changing the name or add/remove members."
, notOwnerInfo = "You are not the owner of this folder and therefore are not allowed to edit it."
, name = "Name"
, members = "Members"
, addMember = "Add a new member"
, add = "Add"
, removeMember = "Remove this member"
, deleteThisFolder = "Delete this folder"
}

View File

@ -0,0 +1,26 @@
module Messages.FolderManageComp exposing (..)
import Messages.Basics
import Messages.FolderDetailComp
import Messages.FolderTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, folderDetail : Messages.FolderDetailComp.Texts
, folderTable : Messages.FolderTableComp.Texts
, showOwningFoldersOnly : String
, createNewFolder : String
, newFolder : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, folderDetail = Messages.FolderDetailComp.gb
, folderTable = Messages.FolderTableComp.gb
, showOwningFoldersOnly = "Show owning folders only"
, createNewFolder = "Create a new folder"
, newFolder = "New Folder"
}

View File

@ -0,0 +1,18 @@
module Messages.FolderTableComp exposing (..)
import Messages.Basics
type alias Texts =
{ basics : Messages.Basics.Texts
, name : String
, memberCount : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, name = "Name"
, memberCount = "#Member"
}

View File

@ -0,0 +1,49 @@
module Messages.ManageDataPage exposing (..)
import Messages.Basics
import Messages.CustomFieldManageComp
import Messages.EquipmentManageComp
import Messages.FolderManageComp
import Messages.OrgManageComp
import Messages.PersonManageComp
import Messages.TagManageComp
type alias Texts =
{ basics : Messages.Basics.Texts
, tagManage : Messages.TagManageComp.Texts
, equipmentManage : Messages.EquipmentManageComp.Texts
, orgManage : Messages.OrgManageComp.Texts
, personManage : Messages.PersonManageComp.Texts
, folderManage : Messages.FolderManageComp.Texts
, customFieldManage : Messages.CustomFieldManageComp.Texts
, manageData : String
, equipment : String
, organization : String
, person : String
, folder : String
, customFields : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, tagManage = Messages.TagManageComp.gb
, equipmentManage = Messages.EquipmentManageComp.gb
, orgManage = Messages.OrgManageComp.gb
, personManage = Messages.PersonManageComp.gb
, folderManage = Messages.FolderManageComp.gb
, customFieldManage = Messages.CustomFieldManageComp.gb
, manageData = "Manage Data"
, equipment = "Equipment"
, organization = "Organization"
, person = "Person"
, folder = "Folder"
, customFields = "Custom Fields"
}
de : Texts
de =
gb

View File

@ -0,0 +1,38 @@
module Messages.OrgFormComp exposing (..)
import Data.ContactType exposing (ContactType)
import Data.OrgUse exposing (OrgUse)
import Messages.AddressFormComp
import Messages.ContactTypeData
import Messages.OrgUseData
type alias Texts =
{ addressForm : Messages.AddressFormComp.Texts
, orgUseLabel : OrgUse -> String
, name : String
, shortName : String
, use : String
, useAsCorrespondent : String
, dontUseForSuggestions : String
, address : String
, contacts : String
, contactTypeLabel : ContactType -> String
, notes : String
}
gb : Texts
gb =
{ addressForm = Messages.AddressFormComp.gb
, orgUseLabel = Messages.OrgUseData.gb
, name = "Name"
, shortName = "Short Name"
, use = "Use"
, useAsCorrespondent = "Use as correspondent"
, dontUseForSuggestions = "Do not use for suggestions."
, address = "Address"
, contacts = "Contacts"
, contactTypeLabel = Messages.ContactTypeData.gb
, notes = "Notes"
}

View File

@ -0,0 +1,28 @@
module Messages.OrgManageComp exposing (..)
import Messages.Basics
import Messages.OrgFormComp
import Messages.OrgTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, orgForm : Messages.OrgFormComp.Texts
, orgTable : Messages.OrgTableComp.Texts
, newOrganization : String
, createNewOrganization : String
, reallyDeleteOrg : String
, deleteThisOrg : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, orgForm = Messages.OrgFormComp.gb
, orgTable = Messages.OrgTableComp.gb
, newOrganization = "New Organization"
, createNewOrganization = "Create a new organization"
, reallyDeleteOrg = "Really delete this organization?"
, deleteThisOrg = "Delete this organization"
}

View File

@ -0,0 +1,24 @@
module Messages.OrgTableComp exposing (..)
import Data.OrgUse exposing (OrgUse)
import Messages.Basics
import Messages.OrgUseData
type alias Texts =
{ basics : Messages.Basics.Texts
, name : String
, address : String
, contact : String
, orgUseLabel : OrgUse -> String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, name = "Name"
, address = "Address"
, contact = "Contact"
, orgUseLabel = Messages.OrgUseData.gb
}

View File

@ -0,0 +1,13 @@
module Messages.OrgUseData exposing (..)
import Data.OrgUse exposing (OrgUse(..))
gb : OrgUse -> String
gb pu =
case pu of
Correspondent ->
"Correspondent"
Disabled ->
"Disabled"

View File

@ -0,0 +1,44 @@
module Messages.PersonFormComp exposing (..)
import Data.ContactType exposing (ContactType)
import Data.PersonUse exposing (PersonUse)
import Messages.AddressFormComp
import Messages.ContactTypeData
import Messages.PersonUseData
type alias Texts =
{ addressForm : Messages.AddressFormComp.Texts
, personUseLabel : PersonUse -> String
, name : String
, useOfPerson : String
, useAsConcerningOnly : String
, useAsCorrespondentOnly : String
, useAsBoth : String
, dontUseForSuggestions : String
, organization : String
, chooseAnOrg : String
, address : String
, contacts : String
, contactTypeLabel : ContactType -> String
, notes : String
}
gb : Texts
gb =
{ addressForm = Messages.AddressFormComp.gb
, personUseLabel = Messages.PersonUseData.gb
, name = "Name"
, useOfPerson = "Use of this person"
, useAsConcerningOnly = "Use as concerning person only"
, useAsCorrespondentOnly = "Use as correspondent person only"
, useAsBoth = "Use as both concerning or correspondent person"
, dontUseForSuggestions = "Do not use for suggestions."
, organization = "Organization"
, chooseAnOrg = "Choose an organization"
, address = "Address"
, contacts = "Contacts"
, contactTypeLabel = Messages.ContactTypeData.gb
, notes = "Notes"
}

View File

@ -0,0 +1,28 @@
module Messages.PersonManageComp exposing (..)
import Messages.Basics
import Messages.PersonFormComp
import Messages.PersonTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, personForm : Messages.PersonFormComp.Texts
, personTable : Messages.PersonTableComp.Texts
, newPerson : String
, createNewPerson : String
, reallyDeletePerson : String
, deleteThisPerson : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, personForm = Messages.PersonFormComp.gb
, personTable = Messages.PersonTableComp.gb
, newPerson = "New Person"
, createNewPerson = "Create a new person"
, reallyDeletePerson = "Really delete this person?"
, deleteThisPerson = "Delete this person"
}

View File

@ -0,0 +1,24 @@
module Messages.PersonTableComp exposing (..)
import Data.PersonUse exposing (PersonUse)
import Messages.Basics
import Messages.PersonUseData
type alias Texts =
{ basics : Messages.Basics.Texts
, name : String
, address : String
, contact : String
, personUseLabel : PersonUse -> String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, name = "Name"
, address = "Address"
, contact = "Contact"
, personUseLabel = Messages.PersonUseData.gb
}

View File

@ -0,0 +1,19 @@
module Messages.PersonUseData exposing (..)
import Data.PersonUse exposing (PersonUse(..))
gb : PersonUse -> String
gb pu =
case pu of
Correspondent ->
"Correspondent"
Concerning ->
"Concerning"
Both ->
"Both"
Disabled ->
"Disabled"

View File

@ -0,0 +1,16 @@
module Messages.TagFormComp exposing (..)
type alias Texts =
{ selectDefineCategory : String
, name : String
, category : String
}
gb : Texts
gb =
{ selectDefineCategory = "Select or define category..."
, name = "Name"
, category = "Category"
}

View File

@ -0,0 +1,28 @@
module Messages.TagManageComp exposing (..)
import Messages.Basics
import Messages.TagFormComp
import Messages.TagTableComp
type alias Texts =
{ basics : Messages.Basics.Texts
, tagTable : Messages.TagTableComp.Texts
, tagForm : Messages.TagFormComp.Texts
, createNewTag : String
, newTag : String
, reallyDeleteTag : String
, deleteThisTag : String
}
gb : Texts
gb =
{ basics = Messages.Basics.gb
, tagTable = Messages.TagTableComp.gb
, tagForm = Messages.TagFormComp.gb
, createNewTag = "Create a new tag"
, newTag = "New Tag"
, reallyDeleteTag = "Really delete this tag?"
, deleteThisTag = "Delete this tag"
}

View File

@ -0,0 +1,14 @@
module Messages.TagTableComp exposing (..)
type alias Texts =
{ name : String
, category : String
}
gb : Texts
gb =
{ name = "Name"
, category = "Category"
}

View File

@ -13,12 +13,13 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (onClick) import Html.Events exposing (onClick)
import Messages.ManageDataPage exposing (Texts)
import Page.ManageData.Data exposing (..) import Page.ManageData.Data exposing (..)
import Styles as S import Styles as S
viewSidebar : Bool -> Flags -> UiSettings -> Model -> Html Msg viewSidebar : Texts -> Bool -> Flags -> UiSettings -> Model -> Html Msg
viewSidebar visible _ settings model = viewSidebar texts visible _ settings model =
div div
[ id "sidebar" [ id "sidebar"
, class S.sidebar , class S.sidebar
@ -27,7 +28,7 @@ viewSidebar visible _ settings model =
] ]
[ div [ class "" ] [ div [ class "" ]
[ h1 [ class S.header1 ] [ h1 [ class S.header1 ]
[ text "Manage Data" [ text texts.manageData
] ]
] ]
, div [ class "flex flex-col my-2" ] , div [ class "flex flex-col my-2" ]
@ -40,7 +41,8 @@ viewSidebar visible _ settings model =
[ Icons.tagIcon2 "" [ Icons.tagIcon2 ""
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text "Tags" ] [ text texts.basics.tags
]
] ]
, a , a
[ href "#" [ href "#"
@ -51,7 +53,8 @@ viewSidebar visible _ settings model =
[ Icons.equipmentIcon2 "" [ Icons.equipmentIcon2 ""
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text "Equipment" ] [ text texts.equipment
]
] ]
, a , a
[ href "#" [ href "#"
@ -62,7 +65,8 @@ viewSidebar visible _ settings model =
[ Icons.organizationIcon2 "" [ Icons.organizationIcon2 ""
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text "Organization" ] [ text texts.organization
]
] ]
, a , a
[ href "#" [ href "#"
@ -73,7 +77,8 @@ viewSidebar visible _ settings model =
[ Icons.personIcon2 "" [ Icons.personIcon2 ""
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text "Person" ] [ text texts.person
]
] ]
, a , a
[ href "#" [ href "#"
@ -89,7 +94,8 @@ viewSidebar visible _ settings model =
[ Icons.folderIcon2 "" [ Icons.folderIcon2 ""
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text "Folder" ] [ text texts.folder
]
] ]
, a , a
[ href "#" [ href "#"
@ -105,36 +111,37 @@ viewSidebar visible _ settings model =
[ Icons.customFieldIcon2 "" [ Icons.customFieldIcon2 ""
, span , span
[ class "ml-3" ] [ class "ml-3" ]
[ text "Custom Fields" ] [ text texts.customFields
]
] ]
] ]
] ]
viewContent : Flags -> UiSettings -> Model -> Html Msg viewContent : Texts -> Flags -> UiSettings -> Model -> Html Msg
viewContent flags settings model = viewContent texts flags settings model =
div div
[ id "content" [ id "content"
, class S.content , class S.content
] ]
(case model.currentTab of (case model.currentTab of
Just TagTab -> Just TagTab ->
viewTags model viewTags texts model
Just EquipTab -> Just EquipTab ->
viewEquip model viewEquip texts model
Just OrgTab -> Just OrgTab ->
viewOrg settings model viewOrg texts settings model
Just PersonTab -> Just PersonTab ->
viewPerson settings model viewPerson texts settings model
Just FolderTab -> Just FolderTab ->
viewFolder flags settings model viewFolder texts flags settings model
Just CustomFieldTab -> Just CustomFieldTab ->
viewCustomFields flags settings model viewCustomFields texts flags settings model
Nothing -> Nothing ->
[] []
@ -150,38 +157,45 @@ menuEntryActive model tab =
class "" class ""
viewTags : Model -> List (Html Msg) viewTags : Texts -> Model -> List (Html Msg)
viewTags model = viewTags texts model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
] ]
[ Icons.tagIcon2 "" [ Icons.tagIcon2 ""
, div [ class "ml-2" ] , div [ class "ml-2" ]
[ text "Tags" [ text texts.basics.tags
] ]
] ]
, Html.map TagManageMsg (Comp.TagManage.view2 model.tagManageModel) , Html.map TagManageMsg
(Comp.TagManage.view2
texts.tagManage
model.tagManageModel
)
] ]
viewEquip : Model -> List (Html Msg) viewEquip : Texts -> Model -> List (Html Msg)
viewEquip model = viewEquip texts model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
] ]
[ Icons.equipmentIcon2 "" [ Icons.equipmentIcon2 ""
, div [ class "ml-2" ] , div [ class "ml-2" ]
[ text "Equipment" [ text texts.equipment
] ]
] ]
, Html.map EquipManageMsg (Comp.EquipmentManage.view2 model.equipManageModel) , Html.map EquipManageMsg
(Comp.EquipmentManage.view2 texts.equipmentManage
model.equipManageModel
)
] ]
viewOrg : UiSettings -> Model -> List (Html Msg) viewOrg : Texts -> UiSettings -> Model -> List (Html Msg)
viewOrg settings model = viewOrg texts settings model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
@ -191,12 +205,16 @@ viewOrg settings model =
[ text "Organizations" [ text "Organizations"
] ]
] ]
, Html.map OrgManageMsg (Comp.OrgManage.view2 settings model.orgManageModel) , Html.map OrgManageMsg
(Comp.OrgManage.view2 texts.orgManage
settings
model.orgManageModel
)
] ]
viewPerson : UiSettings -> Model -> List (Html Msg) viewPerson : Texts -> UiSettings -> Model -> List (Html Msg)
viewPerson settings model = viewPerson texts settings model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
@ -207,12 +225,15 @@ viewPerson settings model =
] ]
] ]
, Html.map PersonManageMsg , Html.map PersonManageMsg
(Comp.PersonManage.view2 settings model.personManageModel) (Comp.PersonManage.view2 texts.personManage
settings
model.personManageModel
)
] ]
viewFolder : Flags -> UiSettings -> Model -> List (Html Msg) viewFolder : Texts -> Flags -> UiSettings -> Model -> List (Html Msg)
viewFolder flags _ model = viewFolder texts flags _ model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
@ -221,25 +242,28 @@ viewFolder flags _ model =
, div , div
[ class "ml-2" [ class "ml-2"
] ]
[ text "Folder" [ text texts.folder
] ]
] ]
, Html.map FolderMsg , Html.map FolderMsg
(Comp.FolderManage.view2 flags model.folderManageModel) (Comp.FolderManage.view2 texts.folderManage flags model.folderManageModel)
] ]
viewCustomFields : Flags -> UiSettings -> Model -> List (Html Msg) viewCustomFields : Texts -> Flags -> UiSettings -> Model -> List (Html Msg)
viewCustomFields flags _ model = viewCustomFields texts flags _ model =
[ h2 [ h2
[ class S.header1 [ class S.header1
, class "inline-flex items-center" , class "inline-flex items-center"
] ]
[ Icons.customFieldIcon2 "" [ Icons.customFieldIcon2 ""
, div [ class "ml-2" ] , div [ class "ml-2" ]
[ text "Custom Fields" [ text texts.customFields
] ]
] ]
, Html.map CustomFieldMsg , Html.map CustomFieldMsg
(Comp.CustomFieldManage.view2 flags model.fieldManageModel) (Comp.CustomFieldManage.view2 texts.customFieldManage
flags
model.fieldManageModel
)
] ]