Commit 1632583d authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/376-dev-annuaire-fields' into dev

parents d92b7bef 8992ecf2
...@@ -2,8 +2,21 @@ module Gargnatext.Components.GraphQL.Contact ...@@ -2,8 +2,21 @@ module Gargnatext.Components.GraphQL.Contact
( AnnuaireContact ( AnnuaireContact
, annuaireContactQuery , annuaireContactQuery
-- Lenses -- Lenses
, _ac_title
, _ac_source
, _ac_firstName , _ac_firstName
, _ac_lastName , _ac_lastName
, _ac_labTeamDepts
, _ac_labTeamDeptsFirst
, _ac_organization
, _ac_organizationFirst
, _ac_role
, _ac_office
, _ac_country
, _ac_city
, _ac_touchMail
, _ac_touchPhone
, _ac_touchUrl
) where ) where
import Gargantext.Prelude import Gargantext.Prelude
...@@ -13,32 +26,79 @@ import Data.Maybe (Maybe(..), fromMaybe) ...@@ -13,32 +26,79 @@ import Data.Maybe (Maybe(..), fromMaybe)
import GraphQL.Client.Args (Args, (=>>)) import GraphQL.Client.Args (Args, (=>>))
import GraphQL.Client.Variable (Var(..)) import GraphQL.Client.Variable (Var(..))
import Data.Array as A
type AnnuaireContact type AnnuaireContact
= { ac_id :: Int = { ac_title :: Maybe String
, ac_source :: Maybe String
, ac_id :: Int
, ac_firstName :: Maybe String , ac_firstName :: Maybe String
, ac_lastName :: Maybe String , ac_lastName :: Maybe String
, ac_labTeamDepts :: Array String
, ac_organization :: Array String
, ac_role :: Maybe String
, ac_office :: Maybe String
, ac_country :: Maybe String
, ac_city :: Maybe String
, ac_touchMail :: Maybe String
, ac_touchPhone :: Maybe String
, ac_touchUrl :: Maybe String
} }
type AnnuaireContactQuery type AnnuaireContactQuery
= { annuaire_contacts :: Args = { annuaire_contacts :: Args
{ contact_id :: Var "id" Int } { contact_id :: Var "id" Int }
{ ac_id :: Unit { ac_title :: Unit
, ac_source :: Unit
, ac_id :: Unit
, ac_firstName :: Unit , ac_firstName :: Unit
, ac_lastName :: Unit , ac_lastName :: Unit
, ac_labTeamDepts :: Unit
, ac_organization :: Unit
, ac_role :: Unit
, ac_office :: Unit
, ac_country :: Unit
, ac_city :: Unit
, ac_touchMail :: Unit
, ac_touchPhone :: Unit
, ac_touchUrl :: Unit
} }
} }
annuaireContactQuery :: AnnuaireContactQuery annuaireContactQuery :: AnnuaireContactQuery
annuaireContactQuery annuaireContactQuery
= { annuaire_contacts: = { annuaire_contacts:
{ contact_id: Var :: _ "id" Int } =>> { contact_id: Var :: _ "id" Int } =>>
{ ac_id: unit { ac_title: unit
, ac_source: unit
, ac_id: unit
, ac_firstName: unit , ac_firstName: unit
, ac_lastName: unit , ac_lastName: unit
, ac_labTeamDepts: unit
, ac_organization: unit
, ac_role: unit
, ac_office: unit
, ac_country: unit
, ac_city: unit
, ac_touchMail: unit
, ac_touchPhone: unit
, ac_touchUrl: unit
} }
} }
------------------------------------------------------------------------ ------------------------------------------------------------------------
_ac_title :: Lens' AnnuaireContact String
_ac_title = lens getter setter
where
getter ({ ac_title: val }) = fromMaybe "" val
setter rec val = rec { ac_title = Just val }
_ac_source :: Lens' AnnuaireContact String
_ac_source = lens getter setter
where
getter ({ ac_source: val }) = fromMaybe "" val
setter rec val = rec { ac_source = Just val }
_ac_firstName :: Lens' AnnuaireContact String _ac_firstName :: Lens' AnnuaireContact String
_ac_firstName = lens getter setter _ac_firstName = lens getter setter
where where
...@@ -50,3 +110,69 @@ _ac_lastName = lens getter setter ...@@ -50,3 +110,69 @@ _ac_lastName = lens getter setter
where where
getter ({ ac_lastName: val }) = fromMaybe "" val getter ({ ac_lastName: val }) = fromMaybe "" val
setter rec val = rec { ac_lastName = Just val } setter rec val = rec { ac_lastName = Just val }
_ac_labTeamDepts :: Lens' AnnuaireContact (Array String)
_ac_labTeamDepts = lens getter setter
where
getter ({ ac_labTeamDepts: val }) = val
setter ac val = ac { ac_labTeamDepts = val }
_ac_labTeamDeptsFirst :: Lens' AnnuaireContact String
_ac_labTeamDeptsFirst = lens getter setter
where
getter ({ ac_labTeamDepts: val }) = fromMaybe "" $ A.head val
setter ac val = ac { ac_labTeamDepts = fromMaybe [val] $ A.updateAt 0 val ac.ac_labTeamDepts }
_ac_organization :: Lens' AnnuaireContact (Array String)
_ac_organization = lens getter setter
where
getter ({ ac_organization: val }) = val
setter ac val = ac { ac_organization = val }
_ac_organizationFirst :: Lens' AnnuaireContact String
_ac_organizationFirst = lens getter setter
where
getter ({ ac_organization: val }) = fromMaybe "" $ A.head val
setter ac val = ac { ac_organization = fromMaybe [val] $ A.updateAt 0 val ac.ac_organization }
_ac_role :: Lens' AnnuaireContact String
_ac_role = lens getter setter
where
getter ({ ac_role: val }) = fromMaybe "" val
setter rec val = rec { ac_role = Just val }
_ac_office :: Lens' AnnuaireContact String
_ac_office = lens getter setter
where
getter ({ ac_office: val }) = fromMaybe "" val
setter rec val = rec { ac_office = Just val }
_ac_country :: Lens' AnnuaireContact String
_ac_country = lens getter setter
where
getter ({ ac_country: val }) = fromMaybe "" val
setter rec val = rec { ac_country = Just val }
_ac_city :: Lens' AnnuaireContact String
_ac_city = lens getter setter
where
getter ({ ac_city: val }) = fromMaybe "" val
setter rec val = rec { ac_city = Just val }
_ac_touchMail :: Lens' AnnuaireContact String
_ac_touchMail = lens getter setter
where
getter ({ ac_touchMail: val }) = fromMaybe "" val
setter rec val = rec { ac_touchMail = Just val }
_ac_touchPhone :: Lens' AnnuaireContact String
_ac_touchPhone = lens getter setter
where
getter ({ ac_touchPhone: val }) = fromMaybe "" val
setter rec val = rec { ac_touchPhone = Just val }
_ac_touchUrl :: Lens' AnnuaireContact String
_ac_touchUrl = lens getter setter
where
getter ({ ac_touchUrl: val }) = fromMaybe "" val
setter rec val = rec { ac_touchUrl = Just val }
...@@ -16,7 +16,7 @@ import Gargantext.Hooks.Session (useSession) ...@@ -16,7 +16,7 @@ import Gargantext.Hooks.Session (useSession)
import Gargantext.Types (NodeID) import Gargantext.Types (NodeID)
import Gargantext.Utils (nbsp) import Gargantext.Utils (nbsp)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargnatext.Components.GraphQL.Contact (AnnuaireContact, _ac_firstName, _ac_lastName) import Gargnatext.Components.GraphQL.Contact (AnnuaireContact, _ac_city, _ac_country, _ac_firstName, _ac_labTeamDeptsFirst, _ac_lastName, _ac_office, _ac_organizationFirst, _ac_role, _ac_touchMail, _ac_touchPhone, _ac_touchUrl)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
...@@ -137,6 +137,186 @@ contactFormCpt = here.component "form" cpt where ...@@ -137,6 +137,186 @@ contactFormCpt = here.component "form" cpt where
} }
] ]
] ]
,
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ "Organisation"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ status: Disabled
, callback: const R.nothing
, value: view _ac_organizationFirst fdata
}
]
]
,
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ "Lab/Team/Dept"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ status: Disabled
, callback: const R.nothing
, value: view _ac_labTeamDeptsFirst fdata
}
]
]
,
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ "Office"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ status: Disabled
, callback: const R.nothing
, value: view _ac_office fdata
}
]
]
,
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ "City"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ status: Disabled
, callback: const R.nothing
, value: view _ac_city fdata
}
]
]
,
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ "Country"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ status: Disabled
, callback: const R.nothing
, value: view _ac_country fdata
}
]
]
,
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ "Role"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ status: Disabled
, callback: const R.nothing
, value: view _ac_role fdata
}
]
]
,
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ "Phone"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ status: Disabled
, callback: const R.nothing
, value: view _ac_touchPhone fdata
}
]
]
,
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ "Mail"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ status: Disabled
, callback: const R.nothing
, value: view _ac_touchMail fdata
}
]
]
,
H.div
{ className: "form-group" }
[
H.div
{ className: "form-group__label" }
[
B.label_ "URL"
]
,
H.div
{ className: "form-group__field" }
[
B.formInput
{ status: Disabled
, callback: const R.nothing
, value: view _ac_touchUrl fdata
}
]
]
] ]
] ]
, ,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment