Skip to content

[ENG-613] Added expiry date to supply delivery table - #16579

Open
Jacobjeevan wants to merge 4 commits into
developfrom
supply-delivery-expiry-date
Open

[ENG-613] Added expiry date to supply delivery table#16579
Jacobjeevan wants to merge 4 commits into
developfrom
supply-delivery-expiry-date

Conversation

@Jacobjeevan

@Jacobjeevan Jacobjeevan commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Changes

Added expiry date to supply delivery table

Tests skipped — trivial change.

Summary by CodeRabbit

  • New Features
    • Added an Expiry column to the Supply Delivery table.
    • Each delivery row now shows the relevant expiry date formatted as dd/MM/yyyy.
    • When an expiry date isn’t available, the table displays “–” instead.

@Jacobjeevan
Jacobjeevan requested review from a team and Copilot July 17, 2026 05:58
@github-actions

Copy link
Copy Markdown

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

  • Change - [ ] to - [x] for completed items
  • Only check items that are relevant to your PR
  • Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e7001c13-7003-4d11-bf16-e592c0fde1cb

📥 Commits

Reviewing files that changed from the base of the PR and between f339559 and 703e087.

📒 Files selected for processing (1)
  • src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx

Walkthrough

Changes

Supply delivery expiry display

Layer / File(s) Summary
Expiry column rendering
src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx
Adds an expiry header and displays internal or non-internal delivery expiration dates as dd/MM/yyyy, falling back to "-" when absent.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description omits required template sections, including Proposed Changes details, issue reference, tagging, and the merge checklist. Fill in the Proposed Changes section with Fixes #issue_number and bullets, add the reviewer tagging, and complete the full Merge Checklist.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific, concise, and matches the main change: adding expiry dates to the supply delivery table.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch supply-delivery-expiry-date

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: fc52de5
Status: ✅  Deploy successful!
Preview URL: https://eabcbd3b.care-preview-a7w.pages.dev
Branch Preview URL: https://supply-delivery-expiry-date.care-preview-a7w.pages.dev

View logs

@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds an Expiry column to the SupplyDeliveryTable component, displaying the product's expiration date formatted as dd/MM/yyyy (or "-" when absent). The translation key "expiry" already exists in all locale files, and the column position is correctly aligned between the header and body rows.

  • Expiry is sourced from supplied_inventory_item.product.expiration_date first, falling back to supplied_item.expiration_date, which mirrors how other fields handle the internal vs. external delivery distinction.
  • parseISO from date-fns is used for date parsing, which is the safer approach compared to new Date() used for created_date elsewhere in the same file.

Confidence Score: 5/5

Safe to merge — the change is a straightforward column addition with no logic side-effects and no impact on existing columns or data mutations.

The change only adds a read-only display column. The translation key exists, date parsing uses the correct parseISO helper, column alignment between header and body is correct, and both data sources for the expiry value are properly guarded with optional chaining.

No files require special attention.

Important Files Changed

Filename Overview
src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx Adds an "Expiry" column to the supply delivery table, reading from supplied_inventory_item.product.expiration_date with a fallback to supplied_item.expiration_date, formatted via parseISO and date-fns — column placement is consistent between header and body rows.

Reviews (2): Last reviewed commit: "care-loop: address review feedback (roun..." | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an Expiry column to the facility inventory Supply Delivery table so users can see batch expiry dates alongside delivered items.

Changes:

  • Added an “Expiry” table header to the Supply Delivery table.
  • Rendered expiry date per row (preferring supplied_inventory_item.product.expiration_date, falling back to supplied_item.expiration_date) and formatted it as dd/MM/yyyy with - when missing.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx`:
- Around line 290-299: Update the expiry rendering in SupplyDeliveryTable to
parse the serialized date-only expiration_date with date-only-safe parsing such
as parseISO before formatDate, avoiding timezone-based day shifts. Add a
regression test covering a date-only expiry value and verify the displayed date
remains unchanged.
- Around line 290-299: Update the expiry selection in the TableCell rendering to
use the same internal-branch condition as the product-name logic, choosing the
inventory product expiration for internal deliveries and the supplied-item
expiration for external deliveries. Preserve the existing date formatting and
"-" fallback.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f43e77b2-63b8-4657-8505-be162c7e4c87

📥 Commits

Reviewing files that changed from the base of the PR and between 83d48a0 and f339559.

📒 Files selected for processing (1)
  • src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx

Comment thread src/pages/Facility/services/inventory/SupplyDeliveryTable.tsx
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

🎭 Playwright Test Results

Status: ❌ Failed
Test Shards: 3

Metric Count
Total Tests 337
✅ Passed 334
❌ Failed 2
⏭️ Skipped 1

📊 Detailed results are available in the playwright-final-report artifact.

Run: #10556

Copilot AI review requested due to automatic review settings July 17, 2026 06:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 31, 2026 14:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 31, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fine. 13 lines changed, one column added, parseISO correctly used for ISO string dates, fallback to "-" is appropriate. The logic is sound.

One gripe (see inline): ditch the IIFE, extract expiry to a plain const before the return. That's literally all I ask. Is that too much? Apparently.

Also — the PR description says "tests skipped — trivial change." It is trivial, so fine. At least someone is honest.

Generated by Grumpy PR Reviewer for issue #16579 · 20.8 AIC · ⌖ 6 AIC · ⊞ 6.3K

return expiry
? formatDate(parseISO(expiry), "dd/MM/yyyy")
: "-";
})()}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

An IIFE inside JSX? Really? In 2026? Just extract expiry to a const before the return statement — you know, like a normal human. The entire IIFE exists to derive one variable; that's what const is for.

const expiry =
  delivery.supplied_inventory_item?.product?.expiration_date ||
  delivery.supplied_item?.expiration_date;
// ...
<TableCell>
  {expiry ? formatDate(parseISO(expiry), "dd/MM/yyyy") : "-"}
</TableCell>

Cleaner, readable, no gymnastics required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants