icefoganalytics / travel-authorization

0 stars 0 forks source link

Ytgov-82: Create a Admin Tables UI for Travel Rates #210

Closed klondikemarlen closed 4 months ago

klondikemarlen commented 4 months ago

Fixes https://github.com/ytgov/travel-authorization/issues/82

Relates to:

Context

Is your feature request related to a problem? Please describe. Every year the travel rates for Meals and Incidentals, distance allowance, and private accommodations are updated. Create admin tables that allow system admin to update these. Allow the ability to audit who updated the field and when the update occured.

Describe the solution you'd like Create admin tables in the admin section of the application (access thru top right) for each of the stored amounts. https://yukon.ca/travel-rates

Update the code to hit the newly entered values.

Implementation

  1. Take over "Administration -> YG Rates" page stub and turn it into Travel Rates view that matches, more or less, the pdf downloadable from https://yukon.ca/travel-rates.
  2. Clean up Administration dashboard page.
  3. Implement SimpleBreadcrumbs component, and LayoutWithBreadcrumbs to fix the broken breadcrumbs on the Admin dashboard. Note that I've only fixed the pages I'm using here. Fixing all of the pages will be done in https://github.com/ytgov/travel-authorization/issues/106.
  4. Add useBreadcrumbs to explicitly set breadcrumbs for a given page via the LayoutWithBreadcrumbs. This is much more flexible and easier to debug that the current generated breadcrumbs.
  5. Clean up useCurrentUser code.
  6. Backport useRouteQuery from https://vueuse.org/router/useRouteQuery/ for ease mapping table query params to url state. This make it easy have a query like http://localhost:8080/administration/travel-rates/edit?perDiemsClaimType=private_accommodations map to a specific view of a table.
  7. Implement back-end ordering of per-diems so that they are ordered and grouped in a consistent way based on time and distance. Also make default page size match with number of claim types (6).

Caveats

  1. While the front-end shows USD values and allows you to edit them, the back-end has not been wired up to make any USD calculations, see https://github.com/icefoganalytics/travel-authorization/issues/128
  2. Given that per-diem and travel allowances are hard-coded by name/type in the back-end, it is not possible for the admin to add/remove per-diems or travel allowances, or change there type/currency. Only the amount is editable.

Notes

  1. All currency values are shown using standard Intl.NumberFormat("en-CA", { style: "currency", }) currency format. Given that this is an international standard, we should stick to it, rather than rolling our own local standard. The effect of this is that values in CAD are shown without a currency type, while USD values are shown prefixed with US. e.g. $165.75 vs. US$165.75

Screenshots

Travel Rates page http://localhost:8080/administration/travel-rates image

Edit Travel Rates page. http://localhost:8080/administration/travel-rates/edit image

Edit Travel Rates page with Private Accommodations filter pre-applied. http://localhost:8080/administration/travel-rates/edit?perDiemsClaimType=private_accommodations image

Testing Instructions

  1. Run the test suite via dev test (or dev test_api)
  2. Boot the app via dev up
  3. Log in to the app at http://localhost:8080
  4. Click on the kebab menu in the top right and select "Administration".
  5. Click on User Management and select your user.
  6. Add the "Admin" role to your user.
  7. Click on the kebab menu in the top right and select "Administration". (breadcrumbs are broken).
  8. Click on Travel Rates in the center column at the bottom.
  9. Scroll through the travel rates "read" view and check that it matches visually (as much as possible) the PDF downloadable from https://yukon.ca/travel-rates. Note that this link is also at the bottom of the /administration/travel-rates page. The values may differ, though should be logically consistent.
  10. "Full days on travel status" value should be the sum of all "Partial days on travel status" values, plus "Incidental expenses" value.
  11. Scroll to the top of the page, and click on the "Edit" call-to-action button in the top right of the page.
  12. Check that the breadcrumbs updated, and that you can go back to any of the previous pages by clicking the appropriate breadcrumb.
  13. Look at the Per-Diems edit table, check that you can change the number of rows on the page and change the page number.
  14. Check that changing the page number of rows on the the page updates the URL, and will load the appropriate page if the page is refreshed.
  15. Check that the "Claim Type" filter update the returned data and page URL.
  16. Check that going to http://localhost:8080/administration/travel-rates/edit?perDiemsClaimType=private_accommodations will load the appropriate data in the Per-Diems table.
  17. Check that you can edit the "amount" type for per-diems values. See Caveat#2.
  18. Check that you can edit the values in the Travel Allowances table.
  19. Check that when you edit the "Distance Allowance Per Kilometer", the step values is 0.001 rather than 0.01 as it is for all other amount editors.
  20. From the top nav, select "My Travel Requests".
  21. Create a new travel authorization.
  22. Fill in the form, and then click "Generate Estimate".
  23. Check that the estimate generates correctly.