Skip to content

Commit

Permalink
Merge pull request #2038 from bcgov/add-selection-deck-data-into-portal
Browse files Browse the repository at this point in the history
Add selection deck data into portal
  • Loading branch information
rafasdc authored Aug 3, 2023
2 parents 9201b85 + 0a7bba4 commit 245bb42
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ const StyledFlex = styled.div<FlexProps>`
width: 100%;
}
input[inputmode='decimal'] {
margin-top: 0;
min-width: 284px;
}
${(props) => props.theme.breakpoint.smallUp} {
.pg-select-wrapper {
min-width: 330px;
Expand All @@ -46,6 +51,10 @@ const StyledFlex = styled.div<FlexProps>`
.datepicker-widget {
min-width: 330px;
}
input[inputmode='decimal'] {
min-width: 330px;
}
}
${(props) => props.theme.breakpoint.mediumUp} {
Expand All @@ -69,6 +78,10 @@ const StyledFlex = styled.div<FlexProps>`
min-width: 340px;
}
input[inputmode='decimal'] {
min-width: 212px;
}
padding-bottom: 0px;
flex-wrap: nowrap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ReadOnlyResponseWidget,
ReadOnlyStatusWidget,
ReadOnlyWidget,
ReadOnlyRequestedMoneyWidget,
} from './widgets';
import ProjectTheme from '../ProjectTheme';
import ConditionalApprovalObjectFieldTemplate from './ConditionalApprovalObjectFieldTemplate';
Expand All @@ -22,6 +23,7 @@ const ConditionalApprovalReadOnlyTheme: ThemeProps = {
ReadOnlyDecisionWidget,
ReadOnlyResponseWidget,
ReadOnlyStatusWidget,
ReadOnlyRequestedMoneyWidget,
},
ObjectFieldTemplate: ConditionalApprovalObjectFieldTemplate,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { WidgetProps } from '@rjsf/core';
import formatMoney from 'utils/formatMoney';
import { StyledValue } from './ReadOnlyWidget';

const ReadOnlyRequestedMoneyWidget: React.FC<WidgetProps> = ({ value }) => (
<StyledValue data-testid="read-only-requested-money-widget">
{value ? `${formatMoney(value)} requested` : null}
</StyledValue>
);

export default ReadOnlyRequestedMoneyWidget;
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export { default as ReadOnlyStatusWidget } from './ReadOnlyStatusWidget';
export { default as ReadOnlyWidget } from './ReadOnlyWidget';
export { default as StatusSelectWidget } from './StatusSelectWidget';
export { default as HiddenWidget } from './HiddenWidget';
export { default as ReadOnlyRequestedMoneyWidget } from './ReadOnlyRequestedMoneyWidget';
6 changes: 6 additions & 0 deletions app/formSchema/analyst/conditionalApproval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const conditionalApproval: JSONSchema7 = {
type: 'string',
enum: ['Announce immediately', 'Hold announcement'],
},
provincialRequested: {
type: 'number',
},
},
},
isedDecisionObj: {
Expand All @@ -39,6 +42,9 @@ const conditionalApproval: JSONSchema7 = {
type: 'string',
enum: ['Announce immediately', 'Hold announcement'],
},
federalRequested: {
type: 'number',
},
},
},
letterOfApproval: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ const conditionalApprovalReadOnlyUiSchema = {
ministerDecision: {
'ui:widget': 'ReadOnlyDecisionWidget',
},
provincialRequested: {
'ui:widget': 'ReadOnlyRequestedMoneyWidget',
},
},
isedDecisionObj: {
...conditionalApprovalUiSchema.isedDecisionObj,
isedDecision: {
'ui:widget': 'ReadOnlyDecisionWidget',
},
federalRequested: {
'ui:widget': 'ReadOnlyRequestedMoneyWidget',
},
},
letterOfApproval: {
...conditionalApprovalUiSchema.letterOfApproval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const conditionalApprovalUiSchema = {
'ui:widget': 'SelectWidget',
'ui:placeholder': 'No recommendation',
},
provincialRequested: {
'ui:widget': 'MoneyWidget',
'ui:placeholder': '$ requested',
},
},
isedDecisionObj: {
'ui:title': '‎',
Expand All @@ -55,6 +59,9 @@ const conditionalApprovalUiSchema = {
'ui:widget': 'SelectWidget',
'ui:placeholder': 'No recommendation',
},
federalRequested: {
'ui:placeholder': '$ requested',
},
},

letterOfApproval: {
Expand Down
4 changes: 2 additions & 2 deletions app/tests/components/Review/ReviewTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ const sharedReviewThemeTests = (renderTest) => {
.getByText(/Total project cost/i)
.closest('tr')
.getElementsByTagName('td')[0]
).toHaveTextContent('$1 230');
).toHaveTextContent('$1,230');

expect(
section
.getByText(/Total eligible cost/i)
.closest('tr')
.getElementsByTagName('td')[0]
).toHaveTextContent('$1 000');
).toHaveTextContent('$1,000');
});

it('should display headings in the estimated employment', () => {
Expand Down
3 changes: 2 additions & 1 deletion app/utils/formatMoney.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const formatMoney = (number: number) => {
if (!number) return;
return '$' + number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
// eslint-disable-next-line consistent-return
return `$${number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;
};

export default formatMoney;

0 comments on commit 245bb42

Please sign in to comment.