Skip to content

OBPIH-7500 add createdby and updatedby fields to product supplier#5553

Merged
ewaterman merged 7 commits intodevelopfrom
ft/OBPIH-7500-product-supplier-audit-fields
Oct 16, 2025
Merged

OBPIH-7500 add createdby and updatedby fields to product supplier#5553
ewaterman merged 7 commits intodevelopfrom
ft/OBPIH-7500-product-supplier-audit-fields

Conversation

@ewaterman
Copy link
Member

@ewaterman ewaterman commented Oct 14, 2025

✨ Description of Change

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

Description: Add "createdBy" and "updatedBy" fields to product source/supplier and display them in the create/edit product source page.


📷 Screenshots & Recordings (optional)

Screenshot from 2025-10-15 11-53-40

@ewaterman ewaterman self-assigned this Oct 14, 2025
@ewaterman ewaterman added the status: work in progress For issues or pull requests that are in progress but not yet completed label Oct 14, 2025
@github-actions github-actions bot added type: feature A new piece of functionality for the app domain: frontend Changes or discussions relating to the frontend UI domain: backend Changes or discussions relating to the backend server flag: schema change Hilights a pull request that contains a change to the database schema labels Oct 14, 2025
Copy link
Member Author

@ewaterman ewaterman left a comment

Choose a reason for hiding this comment

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

Don't merge yet since I still need to confirm with Manon what the desired look is.

I also need to add the new localization labels once we agree on a look.

Also we likely want to filter out the fields when first creating the supplier. Or have it auto-populate with the name of the current user but idk how to do that on the frontend

--gray-200: #D6D8DC;
--gray-250: #D0DAED;
--gray-300: #CED4DA;
--gray-350: #9299A6;
Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed we have two --gray-350 so I removed one


&:disabled {
background-color: var(--blue-100);
background-color: var(--gray-200);
Copy link
Member Author

Choose a reason for hiding this comment

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

idk if it's just my monitor but I couldn't see blue-100 at all so it was very unclear when a field was disabled. We can revert this if we want but IMO it's much clearer this way:

image

Disabled field is the right one.

Copy link
Member Author

Choose a reason for hiding this comment

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

also, side note: DateField components don't dim the background when disabled so something must be going wrong there

Copy link
Collaborator

@SebastianLib SebastianLib Oct 14, 2025

Choose a reason for hiding this comment

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

The background probably doesn’t work because inside DatePicker we use customInput={<DateFieldInput onClear={onClear} clearable={clearable} />}, which has the .date-field-input className that overrides the .form-element-input className. If you also change it there to background-color: var(--gray-200), you should see the background

image image

Copy link
Collaborator

Choose a reason for hiding this comment

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

I personally don't mind the "grayer" version, so probably up to Manon

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ewaterman we wanted to merge that but we weren't sure whether you confirmed the color with Manon so I decided to ask her - she prefers not to get creative and change colors, so probably you need to change your monitor 🙈

Copy link
Member Author

Choose a reason for hiding this comment

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

RIP to my monitor 💀 (thanks for checking with Manon)

dateCreated: dateCreated,
lastUpdated: lastUpdated,
createdBy: createdBy?.name,
updatedBy: updatedBy?.name,
Copy link
Member Author

Choose a reason for hiding this comment

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

Another option for this would be:

updatedBy: updatedBy ? [
    id: updatedBy?.id,
    name: updatedBy?.name,
] : null,

Alternatively, we can create a separate method for jsonifying the supplier for use in the product source list view. That one will have fewer fields (we don't fetch the associations because they're not used). Then this large toJson method can be used when fetching the supplier details.

I wanted to make as little changes as possible here so I just adding the single field, but we could to some minor optimizations here if we wanted. Idk if it's worth it though. Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would opt for adding the id, so to use this version:

updatedBy: updatedBy ? [
    id: updatedBy?.id,
    name: updatedBy?.name,
] : null,

this would be easier to use if frontend ever needed to reference that

dateCreated: dateCreated,
lastUpdated: lastUpdated,
createdBy: createdBy?.name,
updatedBy: updatedBy?.name,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would opt for adding the id, so to use this version:

updatedBy: updatedBy ? [
    id: updatedBy?.id,
    name: updatedBy?.name,
] : null,

this would be easier to use if frontend ever needed to reference that


&:disabled {
background-color: var(--blue-100);
background-color: var(--gray-200);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I personally don't mind the "grayer" version, so probably up to Manon

active: productSupplier?.active,
dateCreated: productSupplier?.dateCreated ?? undefined,
lastUpdated: productSupplier?.lastUpdated ?? undefined,
createdBy: productSupplier?.createdBy ?? undefined,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm surprised if it's displayed correctly without having id, value, label properties

@github-actions github-actions bot added the domain: l10n Changes or discussions relating to localization & Internationalization label Oct 15, 2025
/>
)}
<TextInput
name="basicDetails.created"
Copy link
Collaborator

@SebastianLib SebastianLib Oct 15, 2025

Choose a reason for hiding this comment

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

Is the name prop needed here? We usually use name inside <Controller> for controlled fields, but this one is just a display (disabled) field, so it’s probably not necessary

/>
)}
<TextInput
name="basicDetails.updated"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

@ewaterman ewaterman removed the status: work in progress For issues or pull requests that are in progress but not yet completed label Oct 15, 2025
@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.49%. Comparing base (1bb7314) to head (e3edd6d).
⚠️ Report is 145 commits behind head on develop.

Files with missing lines Patch % Lines
...n/org/pih/warehouse/product/ProductSupplier.groovy 22.22% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             develop   #5553      +/-   ##
============================================
- Coverage       9.12%   8.49%   -0.64%     
+ Complexity      1170    1106      -64     
============================================
  Files            701     701              
  Lines          45281   45274       -7     
  Branches       10851   10850       -1     
============================================
- Hits            4131    3845     -286     
- Misses         40497   40857     +360     
+ Partials         653     572      -81     

☔ 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.

@ewaterman ewaterman merged commit 6c17061 into develop Oct 16, 2025
7 checks passed
@ewaterman ewaterman deleted the ft/OBPIH-7500-product-supplier-audit-fields branch October 16, 2025 17:40
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 flag: schema change Hilights a pull request that contains a change to the database schema type: feature A new piece of functionality for the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants