-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CM-729: added individual upload history dialog (#49)
* CM-729: added individual upload history dialog * CM-729: added adjustments to the frontend
- Loading branch information
1 parent
0bfffae
commit b7faace
Showing
9 changed files
with
423 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React, { useState } from 'react'; | ||
import { injectIntl } from 'react-intl'; | ||
import ExpandLess from '@material-ui/icons/ExpandLess'; | ||
import ExpandMore from '@material-ui/icons/ExpandMore'; | ||
import { | ||
formatMessage, | ||
} from '@openimis/fe-core'; | ||
import { | ||
ListItem, | ||
ListItemText, | ||
Collapse, | ||
} from '@material-ui/core'; | ||
import { withTheme, withStyles } from '@material-ui/core/styles'; | ||
|
||
const styles = (theme) => ({ | ||
item: theme.paper.item, | ||
}); | ||
|
||
function CollapsableErrorList({ | ||
intl, | ||
errors, | ||
}) { | ||
const [isExpanded, setIsExpanded] = useState(false); | ||
|
||
const handleOpen = () => { | ||
setIsExpanded(!isExpanded); | ||
}; | ||
|
||
if (!errors || !Object.keys(errors).length) { | ||
return ( | ||
<ListItem> | ||
<ListItemText primary={formatMessage( | ||
intl, | ||
'socialProtection', | ||
'benefitPlan.benefitPlanBeneficiaries.uploadHistoryTable.errorNone', | ||
)} | ||
/> | ||
</ListItem> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<ListItem button onClick={handleOpen}> | ||
<ListItemText primary={formatMessage( | ||
intl, | ||
'socialProtection', | ||
'benefitPlan.benefitPlanBeneficiaries.uploadHistoryTable.error', | ||
)} | ||
/> | ||
{isExpanded ? <ExpandLess /> : <ExpandMore />} | ||
</ListItem> | ||
<Collapse in={isExpanded} timeout="auto" unmountOnExit> | ||
{ JSON.stringify(errors) } | ||
</Collapse> | ||
</> | ||
); | ||
} | ||
|
||
export default injectIntl( | ||
withTheme( | ||
withStyles(styles)(CollapsableErrorList), | ||
), | ||
); |
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
Oops, something went wrong.