Skip to content

OBPIH-7555 Create UI for Expiration History report table (fixes)#5602

Merged
alannadolny merged 7 commits intodevelopfrom
fix/OBPIH-7555
Nov 6, 2025
Merged

OBPIH-7555 Create UI for Expiration History report table (fixes)#5602
alannadolny merged 7 commits intodevelopfrom
fix/OBPIH-7555

Conversation

@SebastianLib
Copy link
Collaborator

✨ Description of Change

Link to GitHub issue or Jira ticket:
https://pihemr.atlassian.net/browse/OBPIH-7555

Description:


📷 Screenshots & Recordings (optional)

image

@github-actions github-actions bot added domain: frontend Changes or discussions relating to the frontend UI domain: backend Changes or discussions relating to the backend server domain: l10n Changes or discussions relating to localization & Internationalization labels Nov 5, 2025
Comment on lines -229 to -237
background-color: var(--page-background);
display: flex;
padding: 0.5rem;
background-color: var(--blue-100);

div {
background-color: var(--blue-100);
}
}

.table-pagination-bottom {
background-color: var(--blue-100) !important;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before my changes the footer with total amount looked like this
image

now it looks like in the old tables:
image

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.52%. Comparing base (1bb7314) to head (8da9c4d).
⚠️ Report is 179 commits behind head on develop.

Files with missing lines Patch % Lines
...rg/pih/warehouse/inventory/InventoryService.groovy 0.00% 6 Missing ⚠️
...rg/pih/warehouse/api/InventoryApiController.groovy 0.00% 3 Missing ⚠️
...e/inventory/product/ExpirationHistoryReport.groovy 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             develop   #5602      +/-   ##
============================================
- Coverage       9.12%   8.52%   -0.61%     
+ Complexity      1170    1118      -52     
============================================
  Files            701     712      +11     
  Lines          45281   45598     +317     
  Branches       10851   10913      +62     
============================================
- Hits            4131    3885     -246     
- Misses         40497   41135     +638     
+ Partials         653     578      -75     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines 3511 to 3519
Map<String, Number> getExpirationHistoryReportTotals(List<ExpirationHistoryReportRow> entries) {
Integer totalQuantityLostToExpiry = entries.sum { it?.quantityLostToExpiry ?: 0 } as Integer ?: 0
BigDecimal totalValueLostToExpiry = entries.sum { it?.valueLostToExpiry ?: 0 } as BigDecimal ?: 0

return [
totalQuantityLostToExpiry: totalQuantityLostToExpiry,
totalValueLostToExpiry : totalValueLostToExpiry
] as Map<String, Number>
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kchelstowski I hope this is done as you wanted 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is somewhat of a nitpick but since this logic is quite tied to the getExpirationHistoryReport logic it might make more sense to put them together in a single object:

class ExpirationHistoryReport {
    List<ExpirationHistoryReportRow> rows
    Integer totalQuantityLostToExpiry
    BigDecimal totalValueLostToExpiry
}

and return that in getExpirationHistoryReport. As a bonus it saves you from needing to work with a map (with non-concrete keys) for the totals

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry but I didn’t see your comment. I think that sounds good, so I can try to do something like this tomorrow. @kchelstowski what do you think about this idea?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had that in mind when thinking about this for the first time, but I wanted to keep it as simple as I could for Sebastian. If you feel confident @SebastianLib you can go with that. Remember though that the rows that Evan mentioned are supposed to be PaginatedList, not List.

filtersInitialized,
});

const totalAmount = () => `${translate('react.report.expirationHistory.totalAmount.label', 'Total amount')}: ${tableData?.totalValueLostToExpiry?.toLocaleString([LocaleConverter[locale] || Locale.EN]) ?? 0} ${currencyCode}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't it be just a const, not a method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I didn’t even notice this because I copied the totalAmount function from the Purchase Order List, because we have similar logic there

// Update the reference to the current location for future checks
previousLocation.current = currentLocation?.id;
}
}, [currentLocation?.id]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can potentially become a reusable hook that would accept a callback argument - in this case the setTableData(...) and in the other file, it would accept the setFilterParams(..).
@alannadolny thoughts?

@SebastianLib SebastianLib added the type: bug Addresses unintended behaviours of the app label Nov 6, 2025
return new PaginatedList<ExpirationHistoryReportRow>(entries.collect { ExpirationHistoryReportRow.fromTransactionEntry(it) }, entries.totalCount)

List<ExpirationHistoryReportRow> rows = entries.collect { ExpirationHistoryReportRow.fromTransactionEntry(it) }
PaginatedList<ExpirationHistoryReportRow> paginatedRows = new PaginatedList<ExpirationHistoryReportRow>(rows, entries.totalCount)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicky: I don't see a point in separating those two. I think you can just copy the 3476th line and just have rows, and then, in the calculations above just refer to rows.list

import useSpinner from 'hooks/useSpinner';
import { transformFilterParams } from 'utils/list-utils';

import useOnLocationChange from '../useOnLocationChange';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use absolute path

@alannadolny alannadolny merged commit 4190fd2 into develop Nov 6, 2025
7 checks passed
@alannadolny alannadolny deleted the fix/OBPIH-7555 branch November 6, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: backend Changes or discussions relating to the backend server domain: frontend Changes or discussions relating to the frontend UI domain: l10n Changes or discussions relating to localization & Internationalization type: bug Addresses unintended behaviours of the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants