-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
154 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 12 additions & 30 deletions
42
...Configuration/Provisioning/SubsidyDetailView/PolicyDetailView/AssociatedCatalogDetail.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,29 @@ | ||
import PropTypes from 'prop-types'; | ||
import CustomCatalogDetail from './CustomCatalogDetail'; | ||
import PROVISIONING_PAGE_TEXT from '../../data/constants'; | ||
import { indexOnlyPropType, selectProvisioningContext } from '../../data/utils'; | ||
|
||
const { FORM: { CATALOG } } = PROVISIONING_PAGE_TEXT; | ||
const { FORM } = PROVISIONING_PAGE_TEXT; | ||
|
||
// finds the catalog in associatedCatalog string, | ||
// e.g. "9c1fd12b-2365-4100-8e3e-01d2ff1414e0 - Executive Education budget" | ||
// returns "Executive Education" | ||
function getCatalogType(associatedCatalog) { | ||
let catalogType = null; | ||
if (associatedCatalog) { | ||
if (associatedCatalog.includes(CATALOG.OPTIONS.openCourses)) { | ||
catalogType = CATALOG.OPTIONS.openCourses; | ||
} else if (associatedCatalog.includes(CATALOG.OPTIONS.executiveEducation)) { | ||
catalogType = CATALOG.OPTIONS.executiveEducation; | ||
} else if (associatedCatalog.includes(CATALOG.OPTIONS.everything)) { | ||
catalogType = CATALOG.OPTIONS.everything; | ||
} else { | ||
catalogType = CATALOG.OPTIONS.custom; | ||
} | ||
} | ||
return catalogType; | ||
} | ||
|
||
const AssociatedCatalogDetail = ({ associatedCatalog }) => { | ||
const catalogType = getCatalogType(associatedCatalog); | ||
const AssociatedCatalogDetail = ({ index }) => { | ||
const [formData] = selectProvisioningContext('formData'); | ||
|
||
return ( | ||
<div className="mb-1 mt-3"> | ||
<h3>{CATALOG.TITLE}</h3> | ||
<h3>{FORM.CATALOG.TITLE}</h3> | ||
<div className="mb-1 ml-3 mt-3"> | ||
<h4>{CATALOG.SUB_TITLE}</h4> | ||
<h4>{FORM.CATALOG.SUB_TITLE}</h4> | ||
<p className="small"> | ||
{catalogType} | ||
{FORM.CATALOG.OPTIONS[formData.policies[index].predefinedQueryType]} | ||
</p> | ||
{(catalogType === CATALOG.OPTIONS.custom) && <CustomCatalogDetail catalogTitle={associatedCatalog} />} | ||
{ | ||
(formData.policies[index].predefinedQueryType === FORM.CATALOG.OPTIONS.custom) | ||
&& <CustomCatalogDetail catalogTitle={formData.policies[index].catalogTitle} /> | ||
} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
AssociatedCatalogDetail.propTypes = { | ||
associatedCatalog: PropTypes.string.isRequired, | ||
}; | ||
AssociatedCatalogDetail.propTypes = indexOnlyPropType; | ||
|
||
export default AssociatedCatalogDetail; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 9 additions & 11 deletions
20
src/Configuration/Provisioning/SubsidyDetailView/PolicyDetailView/PolicyDescription.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 16 additions & 13 deletions
29
src/Configuration/Provisioning/SubsidyDetailView/PolicyDetailView/PolicyDetail.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
import PropTypes from 'prop-types'; | ||
import PROVISIONING_PAGE_TEXT from '../../data/constants'; | ||
import { formatCurrency } from '../../data/utils'; | ||
import { | ||
formatCurrency, | ||
generatePolicyName, | ||
indexOnlyPropType, | ||
selectProvisioningContext, | ||
} from '../../data/utils'; | ||
|
||
const PolicyDetail = ({ displayName, spendLimit }) => { | ||
const { FORM: { ACCOUNT_TYPE, ACCOUNT_DETAIL } } = PROVISIONING_PAGE_TEXT; | ||
const { FORM } = PROVISIONING_PAGE_TEXT; | ||
|
||
const PolicyDetail = ({ index }) => { | ||
const [formData] = selectProvisioningContext('formData'); | ||
|
||
return ( | ||
<div className="mb-1 mt-3"> | ||
<h3>Default</h3> | ||
<h3>{ACCOUNT_DETAIL.TITLE}</h3> | ||
<h3>{FORM.ACCOUNT_DETAIL.TITLE}</h3> | ||
<div className="mb-1 ml-3 mt-3"> | ||
<h4>{ACCOUNT_DETAIL.OPTIONS.displayName}</h4> | ||
<h4>{FORM.ACCOUNT_DETAIL.OPTIONS.displayName}</h4> | ||
<p className="small"> | ||
{displayName} | ||
{generatePolicyName(formData, index)} | ||
</p> | ||
<h4>{ACCOUNT_DETAIL.OPTIONS.totalAccountValue.title}</h4> | ||
<h4>{FORM.ACCOUNT_DETAIL.OPTIONS.totalAccountValue.title}</h4> | ||
<p className="small"> | ||
{formatCurrency(spendLimit)} | ||
{formatCurrency(formData.policies[index].accountValue)} | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
PolicyDetail.propTypes = { | ||
displayName: PropTypes.string.isRequired, | ||
spendLimit: PropTypes.number.isRequired, | ||
}; | ||
PolicyDetail.propTypes = indexOnlyPropType; | ||
|
||
export default PolicyDetail; |
29 changes: 9 additions & 20 deletions
29
src/Configuration/Provisioning/SubsidyDetailView/PolicyDetailView/PolicyDetailHeader.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,22 @@ | ||
import PropTypes from 'prop-types'; | ||
import PROVISIONING_PAGE_TEXT, { PREDEFINED_QUERY_DISPLAY_NAMES } from '../../data/constants'; | ||
import { | ||
indexOnlyPropType, | ||
selectProvisioningContext, | ||
generateBudgetDisplayName, | ||
} from '../../data/utils'; | ||
|
||
const PolicyDetailHeader = ({ accountType, policiesLength }) => { | ||
const { FORM: { CATALOG } } = PROVISIONING_PAGE_TEXT; | ||
const renderAccountType = () => { | ||
let account; | ||
if (policiesLength > 1 && accountType.includes(CATALOG.OPTIONS.executiveEducation)) { | ||
account = `${PREDEFINED_QUERY_DISPLAY_NAMES.executiveEducation} budget`; | ||
} else if (policiesLength > 1 && accountType.includes(CATALOG.OPTIONS.openCourses)) { | ||
account = `${PREDEFINED_QUERY_DISPLAY_NAMES.openCourses} budget`; | ||
} else { | ||
account = 'Budget'; | ||
} | ||
return account; | ||
}; | ||
const PolicyDetailHeader = ({ index }) => { | ||
const [formData] = selectProvisioningContext('formData'); | ||
|
||
return ( | ||
<article className="mt-4.5"> | ||
<div className="mb-1"> | ||
<h2>{renderAccountType()}</h2> | ||
<h2>{generateBudgetDisplayName(formData.policies[index])}</h2> | ||
<hr /> | ||
</div> | ||
</article> | ||
); | ||
}; | ||
|
||
PolicyDetailHeader.propTypes = { | ||
accountType: PropTypes.string.isRequired, | ||
policiesLength: PropTypes.number.isRequired, | ||
}; | ||
PolicyDetailHeader.propTypes = indexOnlyPropType; | ||
|
||
export default PolicyDetailHeader; |
Oops, something went wrong.