From 22be72092ace27b7c4a9505dbd8ab8ebf55eadbe Mon Sep 17 00:00:00 2001 From: piet0024 Date: Tue, 3 Nov 2020 15:17:19 -0500 Subject: [PATCH 1/8] WIP GEDS Audit feature --- .../profile/profileCard/GEDSAudit.js | 460 ++++++++++++++++++ .../profile/profileCard/GQLProfileCard.js | 22 +- src/gql/profile.js | 6 + src/utils/isGovEmail.js | 73 +++ 4 files changed, 557 insertions(+), 4 deletions(-) create mode 100644 src/components/profile/profileCard/GEDSAudit.js create mode 100644 src/utils/isGovEmail.js diff --git a/src/components/profile/profileCard/GEDSAudit.js b/src/components/profile/profileCard/GEDSAudit.js new file mode 100644 index 0000000..5e0d848 --- /dev/null +++ b/src/components/profile/profileCard/GEDSAudit.js @@ -0,0 +1,460 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import LocalizedComponent + from '@gctools-components/react-i18n-translation-webpack'; + +import { ApolloConsumer } from 'react-apollo'; + +import { + Button, + Modal, + ModalBody, + ModalHeader, + Row, + Col, + Form, + FormGroup, + Label, + Alert +} from 'reactstrap'; + +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faCheck } from '@fortawesome/free-solid-svg-icons'; + +import { INTEGRATION } from '../../../gql/profile'; + +const AuditSelector = (props) => { + const { + field, + inputName, + gedsValue, + paasValue, + } = props; + + return ( +
+ +
+ {field} +
+ + Please select data + +
+ +
+
+ +
+
+ +
+
+ + +
+
+
+ ); +}; + +class GEDSAudit extends Component { + constructor(props) { + super(props); + this.state = { + modal: false, + gName: '', + gTitleEn: '', + gTitleFr: '', + gOfficePhone: '', + gMobilePhone: '', + gStreetAddress: '', + gCity: '', + gProvince: '', + gPostalCode: '', + gCountry: '', + gOrganization: '', + }; + this.toggle = this.toggle.bind(this); + } + + toggle() { + this.setState({ + modal: !this.state.modal, + }); + } + + render() { + const formatGAddress = ` + ${this.state.gStreetAddress} + ${this.state.gCity} + ${this.state.gProvince} + ${this.state.gCountry} + ${this.state.gPostalCode} + `; + const formatPAddress = (this.props.profile.address) && ` + ${this.props.profile.address.streetAddress} + ${this.props.profile.address.city} + ${this.props.profile.address.province} + ${this.props.profile.address.country} + ${this.props.profile.address.postalCode} + `; + const diffs = []; + if (this.state.gName !== this.props.profile.name) { + diffs.push('auditName'); + } + if (this.state.gTitleEn !== this.props.profile.titleEn) { + diffs.push('titleEn'); + } + if (this.state.gTitleFr !== this.props.profile.titleFr) { + diffs.push('titleFr'); + } + if (this.state.gOfficePhone !== this.props.profile.officePhone) { + diffs.push('auditPhone'); + } + if (this.state.gMobilePhone !== this.props.profile.mobilePhone) { + diffs.push('auditMobile'); + } + if (formatGAddress !== formatPAddress) { + diffs.push('auditAddress'); + } + // eslint-disable-next-line + if (this.state.gOrganization !== this.props.profile.team.organization.nameEn) { + diffs.push('auditOrg'); + } + const diffList = (diffs) ? + diffs.map(d => ( +
  • + + {d} + +
  • + )) : ( +
    + + Your data is the same +
    + ); + return ( + + {client => ( +
    + { + // Check for email pattern + } + + + + GEDS AUDIT + + + + + + { + (diffs.length > 1) && +
    There are diffs
    + } +
      + {diffList} +
    + { + // if no diffs + } +
    +
    +
    +
    + Directory Information +
    +
    + { + // eslint-disable-next-line + (this.state.gName === this.props.profile.name) ? +
    + + {this.props.profile.name} +
    : + + } +
    +
    + { + /* + same string ? Display string : + Display inputs + */ + // eslint-disable-next-line + (this.state.gTitleEn === this.props.profile.titleEn) ? + + + {this.props.profile.titleEn} + : + + } +
    +
    + { + // eslint-disable-next-line + (this.state.gTitleEn === this.props.profile.titleEn) ? +
    + + {this.props.profile.titleFr} +
    : + + } +
    +
    + { + /** + * Email should be correct + */ + } +
    + + {this.props.profile.email} +
    +
    +
    + { + // eslint-disable-next-line + (this.state.gOfficePhone === this.props.profile.officePhone) ? +
    + + {this.props.profile.officePhone} +
    : + + } +
    +
    + { + // eslint-disable-next-line + (this.state.gMobilePhone === this.props.profile.mobilePhone) ? +
    + + {this.props.profile.mobilePhone} +
    : + + } +
    +
    + { + // eslint-disable-next-line + (formatGAddress === formatPAddress) ? +
    + + {formatPAddress} +
    : + + } +
    +
    +
    +
    + Department +
    +
    + { + // eslint-disable-next-line + (this.state.gOrganization === this.props.profile.team.organization.nameEn) ? +
    + + {this.props.profile.team.organization.nameEn} +
    : + + } +
    +
    +
    + +
    +
    +
    +
    + )} +
    + ); + } +} + +AuditSelector.defaultProps = { + field: '', + inputName: '', + gedsValue: '', + paasValue: '', +}; + +AuditSelector.propTypes = { + field: PropTypes.string, + inputName: PropTypes.string, + gedsValue: PropTypes.string, + paasValue: PropTypes.string, +}; + +GEDSAudit.defaultProps = { + profile: undefined, +}; + +GEDSAudit.propTypes = { + profile: PropTypes.shape({ + name: PropTypes.string, + email: PropTypes.string, + titleEn: PropTypes.string, + titleFr: PropTypes.string, + officePhone: PropTypes.string, + mobilePhone: PropTypes.string, + address: PropTypes.shape({ + streetAddress: PropTypes.string, + city: PropTypes.string, + province: PropTypes.string, + postalCode: PropTypes.string, + country: PropTypes.string, + }), + team: PropTypes.shape({ + organization: PropTypes.shape({ + id: PropTypes.string, + nameEn: PropTypes.string, + nameFr: PropTypes.string, + }), + }), + supervisor: PropTypes.shape({ + gcID: PropTypes.string, + name: PropTypes.string, + titleEn: PropTypes.string, + titleFr: PropTypes.string, + }), + }), +}; + +export default LocalizedComponent(GEDSAudit); diff --git a/src/components/profile/profileCard/GQLProfileCard.js b/src/components/profile/profileCard/GQLProfileCard.js index 933bcf6..b1e5572 100644 --- a/src/components/profile/profileCard/GQLProfileCard.js +++ b/src/components/profile/profileCard/GQLProfileCard.js @@ -11,9 +11,11 @@ import { Card, CardBody, CardTitle } from 'reactstrap'; import LocalizedProfileCardDisplay from './ProfileCardDisplay'; import LocalizedEditProfile from './EditProfile'; +import LocalizedGEDSAudit from './GEDSAudit'; import Loading from './Loading'; import GQLYourInfoApprovalStatus from './GQLYourInfoApprovalStatus'; +import isGovEmail from '../../../utils/isGovEmail'; import { GET } from '../../../gql/profile'; const mapStateToProps = ({ user }) => { @@ -62,6 +64,8 @@ export const GQLProfileCard = (props) => { if (loading) return ; if (error) return `Error!: ${error}`; const userInfo = (!data) ? '' : data.profiles[0]; + // Check for a valid GC email + const canAudit = isGovEmail(userInfo.email); return ( {userInfo ? ( @@ -74,10 +78,20 @@ export const GQLProfileCard = (props) => {

    {__('Profile')}

    {canEdit ? - : ''} +
    + { + canAudit && + + } + +
    : ''}
    {canEdit && ( { + domains.map((value) => { + if (email.includes(value)) { + govEmail = true; + } + return null; + }); + + return govEmail; +}; + +export default isGovEmail; From 8ee1e84187a004b1387636b4e8d13e91e30dc3c2 Mon Sep 17 00:00:00 2001 From: piet0024 Date: Wed, 4 Nov 2020 14:40:33 -0500 Subject: [PATCH 2/8] adding language strings --- .../profile/profileCard/GEDSAudit.js.po | 85 +++++++++++++++++++ .../profile/profileCard/GEDSAudit.js.po | 85 +++++++++++++++++++ .../profile/profileCard/GEDSAudit.js | 56 ++++++++---- 3 files changed, 208 insertions(+), 18 deletions(-) create mode 100644 i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po create mode 100644 i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po diff --git a/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po b/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po new file mode 100644 index 0000000..883eda4 --- /dev/null +++ b/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po @@ -0,0 +1,85 @@ + +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2019-04-16 13:18-0400\n" +"PO-Revision-Date: 2019-02-13 10:51-0500\n" +"Last-Translator: FULL NAME \n" +"Language: en_CA\n" +"Language-Team: en_CA \n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.6.0\n" + +#: 28:67 src/components/profile/profileCard/ProfileCardDisplay.js +msgid "Please select data" +msgstr "" + +msgid "Other" +msgstr "" + +msgid "Other Value" +msgstr "" + +msgid "Your data is the same" +msgstr "" + +msgid "GEDS Audit" +msgstr "" + +msgid "GEDS Audit" +msgstr "" + +msgid "There are differences" +msgstr "" + +msgid "Directory Information" +msgstr "" + +msgid "Name" +msgstr "" + +msgid "Job Title - English" +msgstr "" + +msgid "Job Title - French" +msgstr "" + +msgid "Office Phone" +msgstr "" + +msgid "Mobile Phone" +msgstr "" + +msgid "Office Address" +msgstr "" + +msgid "Department" +msgstr "" + +msgid "Department" +msgstr "" + +msgid "auditName" +msgstr "Name" + +msgid "titleEn" +msgstr "Job Title - English" + +msgid "titleFr" +msgstr "Job Title - French" + +msgid "auditPhone" +msgstr "Office Phone" + +msgid "auditMobile" +msgstr "Mobile Phone" + +msgid "auditAddress" +msgstr "Office Address" + +msgid "auditOrg" +msgstr "Department" diff --git a/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po b/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po new file mode 100644 index 0000000..18760d8 --- /dev/null +++ b/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po @@ -0,0 +1,85 @@ + +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2019-04-16 13:18-0400\n" +"PO-Revision-Date: 2019-02-13 10:51-0500\n" +"Last-Translator: FULL NAME \n" +"Language: fr_CA\n" +"Language-Team: fr_CA \n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.6.0\n" + +#: 28:67 src/components/profile/profileCard/ProfileCardDisplay.js +msgid "Please select data" +msgstr "" + +msgid "Other" +msgstr "" + +msgid "Other Value" +msgstr "" + +msgid "Your data is the same" +msgstr "" + +msgid "GEDS Audit" +msgstr "" + +msgid "GEDS Audit" +msgstr "" + +msgid "There are differences" +msgstr "" + +msgid "Directory Information" +msgstr "" + +msgid "Name" +msgstr "" + +msgid "Job Title - English" +msgstr "" + +msgid "Job Title - French" +msgstr "" + +msgid "Office Phone" +msgstr "" + +msgid "Mobile Phone" +msgstr "" + +msgid "Office Address" +msgstr "" + +msgid "Department" +msgstr "" + +msgid "Department" +msgstr "" + +msgid "auditName" +msgstr "" + +msgid "titleEn" +msgstr "" + +msgid "titleFr" +msgstr "" + +msgid "auditPhone" +msgstr "" + +msgid "auditMobile" +msgstr "" + +msgid "auditAddress" +msgstr "" + +msgid "auditOrg" +msgstr "" diff --git a/src/components/profile/profileCard/GEDSAudit.js b/src/components/profile/profileCard/GEDSAudit.js index 5e0d848..064cd3f 100644 --- a/src/components/profile/profileCard/GEDSAudit.js +++ b/src/components/profile/profileCard/GEDSAudit.js @@ -38,7 +38,7 @@ const AuditSelector = (props) => { {field} - Please select data + {__('Please select data')}
    ); return ( @@ -189,7 +210,6 @@ class GEDSAudit extends Component { source: 'GEDS', }, }); - console.log(data); this.setState({ // eslint-disable-next-line gName: `${data.integration.en.gn} ${data.integration.en.sn}`, @@ -207,7 +227,7 @@ class GEDSAudit extends Component { this.toggle(); }} > - GEDS AUDIT + {__('GEDS Audit')} - GEDS AUDIT + {__('GEDS Audit')} @@ -223,7 +243,7 @@ class GEDSAudit extends Component { { (diffs.length > 1) && -
    There are diffs
    +
    {__('There are differences')}
    }
      {diffList} @@ -235,7 +255,7 @@ class GEDSAudit extends Component {
      - Directory Information + {__('Directory Information')}
      { @@ -249,7 +269,7 @@ class GEDSAudit extends Component { {this.props.profile.name}
      : : : : : :
      - Department + {__('Department')}
      { @@ -386,7 +406,7 @@ class GEDSAudit extends Component { {this.props.profile.team.organization.nameEn}
      : Date: Thu, 5 Nov 2020 10:38:43 -0500 Subject: [PATCH 3/8] loading state and cleanup --- .../profile/profileCard/GEDSAudit.js | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/profile/profileCard/GEDSAudit.js b/src/components/profile/profileCard/GEDSAudit.js index 064cd3f..72fcb29 100644 --- a/src/components/profile/profileCard/GEDSAudit.js +++ b/src/components/profile/profileCard/GEDSAudit.js @@ -19,7 +19,7 @@ import { } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faCheck } from '@fortawesome/free-solid-svg-icons'; +import { faCheck, faSpinner } from '@fortawesome/free-solid-svg-icons'; import { INTEGRATION } from '../../../gql/profile'; @@ -98,6 +98,7 @@ class GEDSAudit extends Component { super(props); this.state = { modal: false, + loading: false, gName: '', gTitleEn: '', gTitleFr: '', @@ -198,11 +199,11 @@ class GEDSAudit extends Component { {client => (
      - { - // Check for email pattern - } Date: Wed, 18 Nov 2020 14:44:04 -0500 Subject: [PATCH 4/8] WIP GEDS Audit mutation --- .../profile/profileCard/GEDSAudit.js | 431 +++++++++++------- 1 file changed, 265 insertions(+), 166 deletions(-) diff --git a/src/components/profile/profileCard/GEDSAudit.js b/src/components/profile/profileCard/GEDSAudit.js index 72fcb29..424a50c 100644 --- a/src/components/profile/profileCard/GEDSAudit.js +++ b/src/components/profile/profileCard/GEDSAudit.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import LocalizedComponent from '@gctools-components/react-i18n-translation-webpack'; -import { ApolloConsumer } from 'react-apollo'; +import { ApolloConsumer, Mutation } from 'react-apollo'; import { Button, @@ -21,7 +21,7 @@ import { import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCheck, faSpinner } from '@fortawesome/free-solid-svg-icons'; -import { INTEGRATION } from '../../../gql/profile'; +import { INTEGRATION, EDIT, prepareEditProfile } from '../../../gql/profile'; const AuditSelector = (props) => { const { @@ -29,6 +29,7 @@ const AuditSelector = (props) => { inputName, gedsValue, paasValue, + changeFunc, } = props; return ( @@ -47,7 +48,8 @@ const AuditSelector = (props) => { id={`${inputName}-1`} name={inputName} className="mr-1" - disabled + onChange={changeFunc} + value={gedsValue} /> {gedsValue} - GEDS @@ -59,7 +61,8 @@ const AuditSelector = (props) => { id={`${inputName}-2`} name={inputName} className="mr-1" - disabled + onChange={changeFunc} + value={paasValue} /> {paasValue} - Directory @@ -71,7 +74,8 @@ const AuditSelector = (props) => { id={`${inputName}-n`} name={inputName} className="mr-1" - disabled + onChange={changeFunc} + value="Other" /> {__('Other')} @@ -85,7 +89,6 @@ const AuditSelector = (props) => { id={`${inputName}-input`} name={`${inputName}-input`} className="ml-1" - disabled />
      @@ -112,6 +115,7 @@ class GEDSAudit extends Component { gOrganization: '', }; this.toggle = this.toggle.bind(this); + this.handleChange = this.handleChange.bind(this); } toggle() { @@ -120,6 +124,36 @@ class GEDSAudit extends Component { }); } + handleChange(e) { + const { name, value, id } = e.target; + + if (name === 'auditAddress') { + if (id === 'auditAddress-1') { + this.setState({ + streetAddress: this.state.gStreetAddress, + city: this.state.gCity, + province: this.state.gProvince, + country: this.state.gCountry, + postalCode: this.state.gPostalCode, + }); + } else if (id === 'auditAddress-2') { + this.setState({ + streetAddress: this.props.profile.address.streetAddress, + city: this.props.profile.address.city, + province: this.props.profile.address.province, + country: this.props.profile.address.country, + postalCode: this.props.profile.address.postalCode, + }); + } + } else { + this.setState({ + [name]: value, + }); + } + console.log(`${name} and ${value}`); + console.log(this.state); + } + render() { const formatGAddress = ` ${this.state.gStreetAddress} @@ -239,7 +273,7 @@ class GEDSAudit extends Component { spin /> : - {__('GEDS Audit')} + {__('GEDS Audit')} - (BETA) } @@ -266,171 +300,233 @@ class GEDSAudit extends Component { // if no diffs } - -
      -
      - {__('Directory Information')} -
      -
      - { - // eslint-disable-next-line - (this.state.gName === this.props.profile.name) ? -
      - - {this.props.profile.name} -
      : - - } -
      -
      - { - /* - same string ? Display string : - Display inputs - */ - // eslint-disable-next-line - (this.state.gTitleEn === this.props.profile.titleEn) ? - - - {this.props.profile.titleEn} - : - - } -
      -
      - { - // eslint-disable-next-line - (this.state.gTitleEn === this.props.profile.titleEn) ? + { + console.log(error); + }} + context={ + { + headers: { + integrationsource: 'GEDS', + }, + } + } + > + {(modifyProfile, { loading }) => ( + { + e.preventDefault(); + const { + auditName, titleEn, titleFr, + auditPhone, auditMobile, + streetAddress, city, province, + postalCode, country, + } = this.state; + modifyProfile(prepareEditProfile({ + gcID: this.props.profile.gcID, + auditName, + email: this.props.profile.email, + titleEn, + titleFr, + auditPhone, + auditMobile, + streetAddress, + city, + province, + postalCode, + country, + })); + }} + > +
      +
      + {__('Directory Information')} +
      +
      + { + // eslint-disable-next-line + (this.state.gName === this.props.profile.name) ? +
      + + {this.props.profile.name} +
      : + + } +
      +
      + { + /* + same string ? Display string : + Display inputs + */ + // eslint-disable-next-line + (this.state.gTitleEn === this.props.profile.titleEn) ? + + + {this.props.profile.titleEn} + : + + } +
      +
      + { + // eslint-disable-next-line + (this.state.gTitleEn === this.props.profile.titleEn) ? +
      + + {this.props.profile.titleFr} +
      : + + } +
      +
      + { + /** + * Email should be correct + */ + }
      - {this.props.profile.titleFr} -
      : - - } -
      -
      - { - /** - * Email should be correct - */ - } -
      - - {this.props.profile.email} + {this.props.profile.email} +
      +
      +
      + { + // eslint-disable-next-line + (this.state.gOfficePhone === this.props.profile.officePhone) ? +
      + + {this.props.profile.officePhone} +
      : + + } +
      +
      + { + // eslint-disable-next-line + (this.state.gMobilePhone === this.props.profile.mobilePhone) ? +
      + + {this.props.profile.mobilePhone} +
      : + + } +
      +
      + { + // eslint-disable-next-line + (formatGAddress === formatPAddress) ? +
      + + {formatPAddress} +
      : + + } +
      -
      -
      - { - // eslint-disable-next-line - (this.state.gOfficePhone === this.props.profile.officePhone) ? -
      - - {this.props.profile.officePhone} -
      : - - } -
      -
      - { - // eslint-disable-next-line - (this.state.gMobilePhone === this.props.profile.mobilePhone) ? -
      - - {this.props.profile.mobilePhone} -
      : - - } -
      -
      - { - // eslint-disable-next-line - (formatGAddress === formatPAddress) ? -
      - - {formatPAddress} -
      : - - } -
      -
      -
      -
      - {__('Department')} -
      -
      - { - // eslint-disable-next-line - (this.state.gOrganization === this.props.profile.team.organization.nameEn) ? -
      - - {this.props.profile.team.organization.nameEn} -
      : - - } -
      -
      - +
      +
      + {__('Department')} +
      +
      + { + // eslint-disable-next-line + (this.state.gOrganization === this.props.profile.team.organization.nameEn) ? +
      + + { + // eslint-disable-next-line + this.props.profile.team.organization.nameEn + } +
      : + + } +
      +
      +
      + +
      + + )} + @@ -447,6 +543,7 @@ AuditSelector.defaultProps = { inputName: '', gedsValue: '', paasValue: '', + changeFunc: () => {}, }; AuditSelector.propTypes = { @@ -454,6 +551,7 @@ AuditSelector.propTypes = { inputName: PropTypes.string, gedsValue: PropTypes.string, paasValue: PropTypes.string, + changeFunc: PropTypes.func, }; GEDSAudit.defaultProps = { @@ -462,6 +560,7 @@ GEDSAudit.defaultProps = { GEDSAudit.propTypes = { profile: PropTypes.shape({ + gcID: PropTypes.string, name: PropTypes.string, email: PropTypes.string, titleEn: PropTypes.string, From 9b2216ef686b8559d1d5d631947972272b3f4ee8 Mon Sep 17 00:00:00 2001 From: piet0024 Date: Tue, 24 Nov 2020 14:21:05 -0500 Subject: [PATCH 5/8] Adding translations --- .../profile/profileCard/GEDSAudit.js.po | 6 ++--- .../profile/profileCard/GEDSAudit.js.po | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po b/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po index 883eda4..645d61d 100644 --- a/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po +++ b/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po @@ -16,7 +16,7 @@ msgstr "" #: 28:67 src/components/profile/profileCard/ProfileCardDisplay.js msgid "Please select data" -msgstr "" +msgstr "Please select the correct information" msgid "Other" msgstr "" @@ -25,7 +25,7 @@ msgid "Other Value" msgstr "" msgid "Your data is the same" -msgstr "" +msgstr "You Directory and GEDS information are the same" msgid "GEDS Audit" msgstr "" @@ -34,7 +34,7 @@ msgid "GEDS Audit" msgstr "" msgid "There are differences" -msgstr "" +msgstr "We have found differences in the following information:" msgid "Directory Information" msgstr "" diff --git a/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po b/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po index 18760d8..7f7bf33 100644 --- a/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po +++ b/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po @@ -16,7 +16,7 @@ msgstr "" #: 28:67 src/components/profile/profileCard/ProfileCardDisplay.js msgid "Please select data" -msgstr "" +msgstr "Veuillez sélectionner les renseignements exacts" msgid "Other" msgstr "" @@ -25,37 +25,37 @@ msgid "Other Value" msgstr "" msgid "Your data is the same" -msgstr "" +msgstr "Votre répertoire et les renseignements du SAGE sont les mêmes" msgid "GEDS Audit" -msgstr "" +msgstr "Vérification du SAGE" msgid "GEDS Audit" -msgstr "" +msgstr "Vérification du SAGE" msgid "There are differences" -msgstr "" +msgstr "Nous avons constaté des différences dans les renseignements suivants :" msgid "Directory Information" -msgstr "" +msgstr "Renseignements du répertoire" msgid "Name" -msgstr "" +msgstr "Nom" msgid "Job Title - English" -msgstr "" +msgstr "Titre du poste - Anglais" msgid "Job Title - French" -msgstr "" +msgstr "Titre du poste - Français" msgid "Office Phone" -msgstr "" +msgstr "Téléphone" msgid "Mobile Phone" -msgstr "" +msgstr "Cellulaire" msgid "Office Address" -msgstr "" +msgstr "Adresse au travail" msgid "Department" msgstr "" From 1cbe982ae9ab7b05361f92bd08133b61eb2e75f0 Mon Sep 17 00:00:00 2001 From: piet0024 Date: Mon, 30 Nov 2020 13:52:41 -0500 Subject: [PATCH 6/8] update mutation state fix + small cleanup --- .../profile/profileCard/GEDSAudit.js | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/components/profile/profileCard/GEDSAudit.js b/src/components/profile/profileCard/GEDSAudit.js index 424a50c..d516468 100644 --- a/src/components/profile/profileCard/GEDSAudit.js +++ b/src/components/profile/profileCard/GEDSAudit.js @@ -150,8 +150,6 @@ class GEDSAudit extends Component { [name]: value, }); } - console.log(`${name} and ${value}`); - console.log(this.state); } render() { @@ -296,9 +294,6 @@ class GEDSAudit extends Component {
        {diffList}
      - { - // if no diffs - } { + this.setState({ + loading: false, + modal: false, + }); + }} > {(modifyProfile, { loading }) => (
      { e.preventDefault(); + // updating the state + this.handleChange({ + target: { + name: 'update', + val: 'update', + id: 'update', + }, + }); const { auditName, titleEn, titleFr, auditPhone, auditMobile, @@ -325,12 +334,12 @@ class GEDSAudit extends Component { } = this.state; modifyProfile(prepareEditProfile({ gcID: this.props.profile.gcID, - auditName, + name: auditName, email: this.props.profile.email, titleEn, titleFr, - auditPhone, - auditMobile, + officePhone: auditPhone, + mobilePhone: auditMobile, streetAddress, city, province, @@ -390,7 +399,7 @@ class GEDSAudit extends Component {
      { // eslint-disable-next-line - (this.state.gTitleEn === this.props.profile.titleEn) ? + (this.state.gTitleFr === this.props.profile.titleFr) ?
      Date: Tue, 8 Dec 2020 11:35:30 -0500 Subject: [PATCH 7/8] update other form + phone pattern --- .../profile/profileCard/GEDSAudit.js | 86 +++++++++++++------ 1 file changed, 59 insertions(+), 27 deletions(-) diff --git a/src/components/profile/profileCard/GEDSAudit.js b/src/components/profile/profileCard/GEDSAudit.js index d516468..6e80d2a 100644 --- a/src/components/profile/profileCard/GEDSAudit.js +++ b/src/components/profile/profileCard/GEDSAudit.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { Component, useState } from 'react'; import PropTypes from 'prop-types'; import LocalizedComponent from '@gctools-components/react-i18n-translation-webpack'; @@ -32,6 +32,7 @@ const AuditSelector = (props) => { changeFunc, } = props; + const [otherSel, setOtherSel] = useState(false); return (
      @@ -48,7 +49,10 @@ const AuditSelector = (props) => { id={`${inputName}-1`} name={inputName} className="mr-1" - onChange={changeFunc} + onChange={(e) => { + changeFunc(e); + setOtherSel(false); + }} value={gedsValue} /> {gedsValue} - GEDS @@ -61,36 +65,64 @@ const AuditSelector = (props) => { id={`${inputName}-2`} name={inputName} className="mr-1" - onChange={changeFunc} + onChange={(e) => { + changeFunc(e); + setOtherSel(false); + }} value={paasValue} /> {paasValue} - Directory
      -
      - -
      -
      - - -
      + { + // Don't show other option for address + } + {inputName !== 'auditAddress' && + +
      + +
      + {otherSel && +
      + + { + changeFunc({ + target: { + name: e.target.name, + value: e.target.value, + id: e.target.id, + }, + }); + }} + /> +
      + } +
      + }
      ); From d74336d57309f0faf3e965c2b143f749d4032ec2 Mon Sep 17 00:00:00 2001 From: piet0024 Date: Mon, 14 Dec 2020 14:18:28 -0500 Subject: [PATCH 8/8] updating language --- .../profile/profileCard/GEDSAudit.js.po | 9 ++++++++ .../profile/profileCard/GEDSAudit.js.po | 17 ++++++++++---- .../profile/profileCard/GEDSAudit.js | 23 +++++++++++++------ 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po b/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po index 645d61d..dd012b1 100644 --- a/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po +++ b/i18n/en_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po @@ -33,6 +33,12 @@ msgstr "" msgid "GEDS Audit" msgstr "" +msgid "GEDS" +msgstr "" + +msgid "Directory" +msgstr "" + msgid "There are differences" msgstr "We have found differences in the following information:" @@ -83,3 +89,6 @@ msgstr "Office Address" msgid "auditOrg" msgstr "Department" + +msgid "Save" +msgstr "" diff --git a/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po b/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po index 7f7bf33..7c6653f 100644 --- a/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po +++ b/i18n/fr_CA/LC_MESSAGES/src/components/profile/profileCard/GEDSAudit.js.po @@ -19,10 +19,10 @@ msgid "Please select data" msgstr "Veuillez sélectionner les renseignements exacts" msgid "Other" -msgstr "" +msgstr "Autre" msgid "Other Value" -msgstr "" +msgstr "Autre" msgid "Your data is the same" msgstr "Votre répertoire et les renseignements du SAGE sont les mêmes" @@ -33,6 +33,12 @@ msgstr "Vérification du SAGE" msgid "GEDS Audit" msgstr "Vérification du SAGE" +msgid "GEDS" +msgstr "SAGE" + +msgid "Directory" +msgstr "Annuiare" + msgid "There are differences" msgstr "Nous avons constaté des différences dans les renseignements suivants :" @@ -58,10 +64,10 @@ msgid "Office Address" msgstr "Adresse au travail" msgid "Department" -msgstr "" +msgstr "Ministère" msgid "Department" -msgstr "" +msgstr "Ministère" msgid "auditName" msgstr "" @@ -83,3 +89,6 @@ msgstr "" msgid "auditOrg" msgstr "" + +msgid "Save" +msgstr "Sauvegarder les changements" diff --git a/src/components/profile/profileCard/GEDSAudit.js b/src/components/profile/profileCard/GEDSAudit.js index 6e80d2a..875118b 100644 --- a/src/components/profile/profileCard/GEDSAudit.js +++ b/src/components/profile/profileCard/GEDSAudit.js @@ -55,7 +55,7 @@ const AuditSelector = (props) => { }} value={gedsValue} /> - {gedsValue} - GEDS + {gedsValue} - {__('GEDS')}
      @@ -71,7 +71,7 @@ const AuditSelector = (props) => { }} value={paasValue} /> - {paasValue} - Directory + {paasValue} - {__('Directory')}
      { @@ -417,7 +417,9 @@ class GEDSAudit extends Component { icon={faCheck} className="text-success mr-1" /> - {this.props.profile.titleEn} + + {this.props.profile.titleEn} + : - {this.props.profile.titleFr} + + {this.props.profile.titleFr} +
      : { - // eslint-disable-next-line - this.props.profile.team.organization.nameEn + (localizer.lang === 'en_CA') ? ( + // eslint-disable-next-line + this.props.profile.team.organization.nameEn + ) : ( + // eslint-disable-next-line + this.props.profile.team.organization.nameFr + ) }
      : - Save + {__('Save')}