# Feature COSTS-174 - Migrate the Hourly Rates Section to primer and give it proper Services and Contracts

Project: Stream Time & Costs
Status: tested
URL: https://community.openproject.org/work_packages/COSTS-174

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 18.0.0 |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module | Modules and project features / Costs and budgets |
| Feature Flag |  |
| Requires doc change | Yes |
| Enterprise plan | Community (COM) |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Klaus Zanders |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

The hourly rate management has not been touched in very long. Every time we work on something adjacent, it comes up that this section should be reworked. This ticket attempts to finally do that:

<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Index Page of hourly rates in the user settings</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Edit Page of Hourly rates</strong></p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/924731/content"></div></figure></td><td class="op-uc-table--cell"><figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/924732/content"></div></figure></td></tr></tbody></table></figure>

What we want to achieve:

*   Use Collapsible Headers and Border Box Tables from Primer to display the hourly rates
    
*   Indicate in the header if the current value is coming from the rate itself or the default rate is used. This is currently not obvious why a project without an hourly rate has a value
    
*   Replace the bulk edit page with proper create and update forms in a modal
    
*   Deletion should be guarded by a Danger Dialog as this will cause recalculations in Budgets and Work Package costs, so it should be an informed action
    

<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Project member section lists the current rate for each user ...</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><strong>... clicking it leads directly to an edit page.</strong></p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/924734/content"></div></figure></td><td class="op-uc-table--cell"><figure class="image op-uc-figure"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/924733/content"></div></figure><p class="op-uc-p"><br data-cke-filler="true"></p></td></tr></tbody></table></figure>

Here we want to:

*   Have proper show page listing the user&#x27;s rate history with the same add, update, delete actions as on the user profile
    
*   Indicator if the current rate comes from the default or from a project specific rate
    

## User Account Page

We do have a **View own hourly rates** and **Edit own hourly rates** permission, but we never had an area that allowed the user to use those permissions. For this, let&#x27;s add a **Hourly Rates** menu item to the my account menu, that shows the user all projects they have **View own hourly rates** or **View hourly rates** in and show their rate history. If they also have the **Edit own hourly Rate** permission, allow them to add, update delete them for the project where they have that permission.

This should not show the entire history of default hourly rates (as those are only manageable by admins), but when there is no rate set up for the project it should show the current default rate like the other pages.

## Backend work

*   Currently editing and managing the rates is handled with methods and hooks that are injected into the user model, we have since moved to Services and Contracts. We also want to introduce all of those for `HourlyRate` and `DefaultHourlyRate` models.
