diff --git a/package.json b/package.json index 1ad058b40a21df32c9be86573b100ed9f1f86ce1..da449c0921199f702ef1cfa4e39c0a9e6aeed808 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Gargantext", - "version": "0.0.5.8.9.9", + "version": "0.0.5.9", "scripts": { "generate-purs-packages-nix": "./nix/generate-purs-packages.nix", "generate-psc-packages-nix": "./nix/generate-packages-json.bash", diff --git a/src/Gargantext/Components/GraphQL/Contact.purs b/src/Gargantext/Components/GraphQL/Contact.purs index e9c9a9e3f6806f6de728a1503617c19ab52d101f..650b69c3cd2518300c933df746dcc168d7b130c5 100644 --- a/src/Gargantext/Components/GraphQL/Contact.purs +++ b/src/Gargantext/Components/GraphQL/Contact.purs @@ -2,8 +2,21 @@ module Gargnatext.Components.GraphQL.Contact ( AnnuaireContact , annuaireContactQuery -- Lenses + , _ac_title + , _ac_source , _ac_firstName , _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 import Gargantext.Prelude @@ -13,32 +26,79 @@ import Data.Maybe (Maybe(..), fromMaybe) import GraphQL.Client.Args (Args, (=>>)) import GraphQL.Client.Variable (Var(..)) +import Data.Array as A + type AnnuaireContact - = { ac_id :: Int + = { ac_title :: Maybe String + , ac_source :: Maybe String + , ac_id :: Int , ac_firstName :: 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 = { annuaire_contacts :: Args { contact_id :: Var "id" Int } - { ac_id :: Unit + { ac_title :: Unit + , ac_source :: Unit + , ac_id :: Unit , ac_firstName :: 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 = { annuaire_contacts: { contact_id: Var :: _ "id" Int } =>> - { ac_id: unit + { ac_title: unit + , ac_source: unit + , ac_id: unit , ac_firstName: 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 getter setter where @@ -50,3 +110,69 @@ _ac_lastName = lens getter setter where getter ({ ac_lastName: val }) = fromMaybe "" 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 } diff --git a/src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs b/src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs index 04db85f9f105ca20990e183942343eabc8cdef31..8a14c0c601e8f7354940b23e62ed703ffb7a2997 100644 --- a/src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs +++ b/src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs @@ -16,7 +16,7 @@ import Gargantext.Hooks.Session (useSession) import Gargantext.Types (NodeID) import Gargantext.Utils (nbsp) 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.DOM.HTML as H @@ -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 + } + ] + ] ] ] ,