Skip to content

Commit

Permalink
Always show supportind documents and edit based on conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
areyeslo committed Dec 16, 2024
1 parent b20a84b commit 912048e
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ReportDetails = ({ currentStatus = 'Draft', isAnalystRole }) => {
const navigate = useNavigate()

const [isFileDialogOpen, setFileDialogOpen] = useState(false)
const showSupportingDocs = useMemo(() => {
const editSupportingDocs = useMemo(() => {
return isAnalystRole && (
currentStatus === COMPLIANCE_REPORT_STATUSES.SUBMITTED ||
currentStatus === COMPLIANCE_REPORT_STATUSES.ASSESSED
Expand Down Expand Up @@ -86,7 +86,7 @@ const ReportDetails = ({ currentStatus = 'Draft', isAnalystRole }) => {
/>
</>
),
condition: showSupportingDocs
condition: true
},
{
name: t('report:activityLists.supplyOfFuel'),
Expand Down Expand Up @@ -230,7 +230,7 @@ const ReportDetails = ({ currentStatus = 'Draft', isAnalystRole }) => {
{activityList.map((activity, index) => {
const { data, error, isLoading } = activity.useFetch(complianceReportId)
return (
((activity.name === t('report:supportingDocs') ? showSupportingDocs : (data && !isArrayEmpty(data)))) && (
(data && !isArrayEmpty(data) || activity.name === t('report:supportingDocs')) && (
<Accordion
key={index}
expanded={activity.name === t('report:supportingDocs') ? expanded.includes(`panel${index}`) && !isArrayEmpty(data) : expanded.includes(`panel${index}`)}
Expand All @@ -251,7 +251,9 @@ const ReportDetails = ({ currentStatus = 'Draft', isAnalystRole }) => {
component="div"
>
{activity.name}&nbsp;&nbsp;
<Role
{editSupportingDocs && (
<>
<Role
roles={[
roles.supplier,
roles.compliance_reporting,
Expand All @@ -271,6 +273,8 @@ const ReportDetails = ({ currentStatus = 'Draft', isAnalystRole }) => {
/>
</IconButton>
</Role>
</>
)}
</BCTypography>
</AccordionSummary>
<AccordionDetails>
Expand Down

0 comments on commit 912048e

Please sign in to comment.