Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Add total price to label and location pages #722

Open
wants to merge 107 commits into
base: main
Choose a base branch
from

Conversation

JackBailey
Copy link

@JackBailey JackBailey commented Jan 25, 2024

What type of PR is this?

  • feature

What this PR does / why we need it:

It adds an indicator to the /label and /location pages to show the overall purchase price.

This is a modified version of #638, where calculation is performed on the backend, instead of the frontend, as requested by @hay-kot.

For locations it includes child locations.

Location

image

Label

image

Changed files:

  • backend/app/api/handlers/v1/v1_ctrl_items.go
    • Add totalPrice field which sums the purchasePrice of all items returned
  • backend/app/api/handlers/v1/v1_ctrl_locations.go
    • Add totalPrice field which sums the purchasePrice of the current location's items, as well as any child locations.
  • frontend/pages/label/[id].vue
    • Add totalPrice indicator
  • frontend/pages/location/[id].vue
    • Add totalPrice indicator
  • backend/internal/data/repo/pagination.go
    • Add type (float64) for totalPrice
  • backend/internal/data/repo/repo_locations.go
    • Add type (float64) for totalPrice

Special notes for your reviewer:

I haven't used golang before, there's no errors and it works but it might not be done to the best way.

Testing

Labels

  • Tested with lots, some and no items

Locations

  • Location with/without items
  • With/without child locations
  • With child locations, and without own items

Release Notes

Added a chip-style indicator to show the total price for labels and locations.

hay-kot and others added 30 commits July 22, 2023 19:57
* bump all deps

* run code-gen
…t#506)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…t#508)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ay-kot#451)

* Fixed 3 places where API URLs were not constructed by function route(path, params).

* autofix

---------

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
* formatting

* slimdown locations page

* update location/labels

* fix dependency issues

* fix type generator

* cleanup unused variables
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* add multiple new currencies

* add multiple new currencies

* remove duplicate yen
…port k… (hay-kot#526)

* add support for create + add more for all create modals and support keyboard bindings

* listen for esc to close modals
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…busting (hay-kot#527)

* rough implementation of WS based event system for server side notifications of mutation

* fix test construction

* fix deadlock on event bus

* disable linter error

* add item mutation events

* remove old event bus code

* refactor event system to use composables

* refresh items table when new item is added

* fix create form errors

* cleanup unnecessary calls

* fix importer erorrs + limit fn calls on import
* Added currencies XAG and XAU to currency.ts

I added XAG and XAU for myself and others who prefer to measure value with something of substance.

Review the ISO 4217 standard to view a full list of official currency codes including the ones I have added.

https://www.iso.org/iso-4217-currency-codes.html
https://en.wikipedia.org/wiki/ISO_4217

Example:
https://www.xe.com/currencyconverter/convert/?Amount=100&From=XAG&To=USD

API for exchange rates:
https://openexchangerates.org/

* Added field values xag and xau to group.go

* Update group.go
* fix https connection

* explicity dependency
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot and others added 16 commits January 4, 2024 12:09
…ay-kot#676)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…kot#673)

* feat: show quantity in card view if quantity == 0 (hay-kot#672)

* Update frontend/components/Item/Card.vue

---------

Co-authored-by: bee-eater <bee-eater@users.noreply.github.com>
Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Quoing <pavel.cadersky@mavenir.com>
* basic currency service for loading at runtime

* api endpoint for currencies

* sort slice before return

* remove currency validation

* validate using currency service

* implement selecting dynamic currency options

* bump go version

* fix type definition

* specify explicit type

* change go versions

* proper types for assetId

* log/return currency error

* make case insensative

* use ToUpper instead

* feat: adding new currencies (hay-kot#715)

* fix: task swag (hay-kot#710)

Co-authored-by: Quoing <pavel.cadersky@mavenir.com>

* [feat] Adding new currencies

---------

Co-authored-by: quoing <quoing@users.noreply.github.com>
Co-authored-by: Quoing <pavel.cadersky@mavenir.com>
Co-authored-by: Bradley <41597815+userbradley@users.noreply.github.com>

* remove ts file and consoldate new values into json

* move flag to options namespace

* add env config for currencies

* basic documentaion

* remove in sync test

---------

Co-authored-by: quoing <quoing@users.noreply.github.com>
Co-authored-by: Quoing <pavel.cadersky@mavenir.com>
Co-authored-by: Bradley <41597815+userbradley@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…-kot#668)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…0.17.0 (hay-kot#717)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@JackBailey
Copy link
Author

JackBailey commented Jan 25, 2024

A way to build onto this could be adding the price directly on the item cards, and taking into consideration if the item is sold or not. However, especially for having the price on the cards, some people might not want these additions. So it might be a good idea to add them, but as an option - although this would probably be a fair bit larger of a change so more than I could personally cobble together in a language I've hardly touched.

@JackBailey JackBailey changed the title Add label and location total price Add total price to label and location pages Jan 31, 2024
@JackBailey
Copy link
Author

Any thoughts @hay-kot?

@hay-kot
Copy link
Owner

hay-kot commented Feb 29, 2024

Hey! I do want to merge this. I still need to work through your approach, I think there may be some better ways to do this. I will try to get through the PR this week or next.

@hay-kot hay-kot self-assigned this Apr 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.