Skip to content

OBPIH-6989 ability to sort delivery note by product on stock movement details page#5166

Merged
awalkowiak merged 5 commits intodevelopfrom
ft/OBPIH-6989-sort-delivery-note-by-product
Mar 27, 2025
Merged

OBPIH-6989 ability to sort delivery note by product on stock movement details page#5166
awalkowiak merged 5 commits intodevelopfrom
ft/OBPIH-6989-sort-delivery-note-by-product

Conversation

@ewaterman
Copy link
Member

@ewaterman ewaterman commented Mar 25, 2025

✨ Description of Change

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

Description: Change the delivery note download dropdown on the documents tab of the stock movement details page to support sorting by order index and by product name.


📷 Screenshots & Recordings (optional)

A recording I made for Kelsey that demos the behaviour: https://jam.dev/c/780f9f32-57af-4aa6-be16-63e5bb81147d

image

image

@ewaterman ewaterman self-assigned this Mar 25, 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 domain: l10n Changes or discussions relating to localization & Internationalization labels Mar 25, 2025
@codecov
Copy link

codecov bot commented Mar 25, 2025

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Project coverage is 8.12%. Comparing base (a55f348) to head (b19af78).
Report is 138 commits behind head on develop.

Files with missing lines Patch % Lines
...ih/warehouse/inventory/StockMovementService.groovy 0.00% 8 Missing ⚠️
...arehouse/requisition/DeliveryNoteController.groovy 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             develop   #5166      +/-   ##
============================================
- Coverage       8.15%   8.12%   -0.04%     
+ Complexity       946     939       -7     
============================================
  Files            638     638              
  Lines          43205   43212       +7     
  Branches       10502   10502              
============================================
- Hits            3525    3511      -14     
- Misses         39140   39164      +24     
+ Partials         540     537       -3     

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

link={downloadOption.uri}
buttonTitle={downloadOption.name}
{...document}
key={idx}
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'm not sure if we even need this line. It works fine with it, but I'm not certain what it's actually doing (I just copied it from the below button). Maybe someone with more frontend experience can answer

Copy link
Collaborator

Choose a reason for hiding this comment

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

<g:if test="${document.downloadOptions}">
<span class="action-menu">
<button class="action-btn button">
<warehouse:message code="default.button.download.label"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know that you are not the person who added this line, but we are using g:message

Suggested change
<warehouse:message code="default.button.download.label"/>
<g:message code="default.button.download.label"/>

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'm going to leave it as is since warehouse:message is used everywhere in the file and I want to refactor as little as possible right now, but that's good to know

link={downloadOption.uri}
buttonTitle={downloadOption.name}
{...document}
key={idx}
Copy link
Collaborator

Choose a reason for hiding this comment

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

index shouldn't be a key. Moreover - this map is nested, hence you will have the same key for those elements.

Copy link
Member Author

@ewaterman ewaterman Mar 26, 2025

Choose a reason for hiding this comment

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

why is it bad to make it the index? I don't think this array is mutable (and so indexes don't change). It just uses data returned from the backend. (But yes I'll fix it to better handle the nested map.)

I suppose I could change the key to be the document/download name

Copy link
Collaborator

Choose a reason for hiding this comment

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

https://www.youtube.com/watch?v=xlPxnc5uUPQ

  • the key should be unique. since you have nested .map, the idx will be the same for each download option (you use idx from the nested map)

Copy link
Member Author

@ewaterman ewaterman Mar 26, 2025

Choose a reason for hiding this comment

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

yes I understand that part and I'll fix that to make the index actually unique.

I watched the video and it makes sense (thanks for sharing). I was wondering if it's fine to use index in this case since the array shouldn't be changing, but actually I'm not certain about it anymore since there's the ability to add/remove documents from this page. I don't know what the behaviour is in that situation.

But that's a pre-existing concern since this was already using index as the id. And there isn't a better option right now in the payload IMO. The only other possible field to use is name (which is translated and not guaranteed to be unique). I think I'm going to make it work with index as it was before and add a TODO to fix it to provide a proper unique id.

@awalkowiak awalkowiak merged commit 8d40f20 into develop Mar 27, 2025
9 checks passed
@awalkowiak awalkowiak deleted the ft/OBPIH-6989-sort-delivery-note-by-product branch March 27, 2025 17:50
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: feature A new piece of functionality for the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants