Repository navigation
Tiffany/308 parse unfinalized donor offer - #315
tifpham021 wants to merge 4 commits into
Conversation
✅ Deploy Preview for hope-for-haiti ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Greptile SummaryThis PR adds two features: (1) a "Convert to CSV" action for unfinalized donor offers that exports item-level partner request data, and (2) a dual-signature flow for sign-offs requiring both a staff member and a partner representative to sign (with name input). It also refactors Key changes:
Issues found:
Confidence Score: 4/5Two P1 bugs should be fixed before merging: legacy sign-offs will render an erroneous partner row, and CSV per-partner columns won't sum to the stated Request Total. Both P1 issues cause visible, present defects — incorrect UI for all pre-existing sign-offs and a misleading CSV that will confuse admins. Neither is a production crash, but both affect data integrity of the key features introduced in this PR. src/components/SignOffsTable.tsx, src/components/chips/ShipmentsLineItemChipGroup.tsx (partner-row guard), and src/services/donorOfferService.ts (CSV quantity fallback). Important Files Changed
|
| const partnerDisplayName = | ||
| signOff.partnerSignerName || signOff.partnerName; | ||
|
|
||
| return ( | ||
| <> | ||
| <span className="mx-2">•</span> | ||
| <span | ||
| data-tooltip-id={`signature-tooltip-${signOff.id}`} | ||
| className="underline decoration-dotted cursor-pointer text-gray-500" | ||
| > | ||
| View signature | ||
| </span> | ||
| <SignatureImageTooltip | ||
| signOffId={signOff.id} | ||
| signatureUrl={signOff.signatureUrl} | ||
| /> | ||
| <div className="text-sm text-gray-500 font-light"> | ||
| <span>{signOff.staffMemberName || "Unknown"}</span> | ||
| <span className="mx-2">•</span> | ||
| <span> | ||
| {signOff.date | ||
| ? format(new Date(signOff.date), "M/d/yyyy 'at' h:mm a") | ||
| : "N/A"} | ||
| </span> | ||
| {signOff.signatureUrl && ( | ||
| <> | ||
| <span className="mx-2">•</span> | ||
| <span | ||
| data-tooltip-id={staffTooltipId} | ||
| className="underline decoration-dotted cursor-pointer text-gray-500" | ||
| > | ||
| View staff signature | ||
| </span> | ||
| <SignatureImageTooltip | ||
| tooltipId={staffTooltipId} | ||
| signatureUrl={signOff.signatureUrl} | ||
| /> | ||
| </> | ||
| )} | ||
| </div> | ||
| {(partnerDisplayName || signOff.partnerSignatureUrl) && ( |
There was a problem hiding this comment.
Partner row always visible on pre-existing signoffs
partnerDisplayName falls back to signOff.partnerName, which is a required non-nullable field on every SignOff record. This makes the condition on line 63 always evaluate to true, causing a spurious "partner" row to appear for every signoff — including all historically created sign-offs that were completed before this feature was added (i.e. with no partnerSignerName or partnerSignatureUrl).
The guard should only show the partner row when there is explicit partner data (name OR signature URL).
The condition at line 63 should be:
{(signOff.partnerSignerName || signOff.partnerSignatureUrl) && (
The same issue exists in src/components/chips/ShipmentsLineItemChipGroup.tsx at line 172 — both files need the same fix.
| onClick={() => | ||
| window.location.href = `/api/donorOffers/${offer.donorOfferId}/csv` | ||
| } |
There was a problem hiding this comment.
Arrow function body should use braces for an assignment
An assignment expression used as a concise arrow body is valid JS/TS, but most linters flag it as a potential mistake (easily confused with ===). Wrap the body in braces to be explicit:
| onClick={() => | |
| window.location.href = `/api/donorOffers/${offer.donorOfferId}/csv` | |
| } | |
| onClick={() => { | |
| window.location.href = `/api/donorOffers/${offer.donorOfferId}/csv`; | |
| }} |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Description
Resolves ticket number: #308
Explain what your code changes: Admin is now able to turn unfinalized donor offers into csv files. Also when the partner's request in quantity amount is different from the initial quantity, the UI reflects the new quantity and crosses out the old one.
List the steps you took to test your code:
Before

csv-test-offer-requests.csv
After

csv-test-offer-requests (1).csv
Checklist