-
Notifications
You must be signed in to change notification settings - Fork 4
[$45] Edit payments #80
Description
Background
At the moment we can only create new payments and cancel whole payments if we need to. But sometimes managers would like to change the amount of payment.
Task
-
We already can show the list of all the payments:
-
Replace
Cancelbutton in this list withActionsdropdown menu with 2 options:Cancel Payment- which would do the same asCancelbutton does now (option should be disabled forcancelledorin-progresspayments)Edit Payment- which would open a modal window to edit payment details (option should be disabledin-progresspayments, payment in other statuses can be edited)- The actions dropdown is already implemented in https://github.com/topcoder-platform/taas-app see demo page https://platform.topcoder-dev.com/taas/myteams/18102. Please, port it from there. Or reuse it if it was already ported during another task [$80] Additional Payments #82.
-
For modal, use the same design as for adding payment: [$80] Additional Payments #82
-
We have 2 kind of payments:
- payment for days which user worked (we pay per day as per member rate)
- all the payments for days have
daysgreater than0
- all the payments for days have
- additional payment - any amount which is additional to the payment for days, and is not counted for days
- all the additional payments have
days === 0
- all the additional payments have
- payment for days which user worked (we pay per day as per member rate)
-
Edit Payment for days
Inside payment for days we should NOT allow editing
Amountwe can only editDays
- reuse the same field which we use for Working Days
- the minimal value of days is1(disable-button if the value is1and show tooltip saying:The payment cannot be done for less than 1 day)- the maximum value of days: we cannot pay for more days than user worked this week. So
WorkPeriod.daysPaidcannot be more thanWorkPeriod.daysWorked.WorkPeriod.daysPaidis calculated as a sum of thedaysof all the payments of this WorkPeriod not includingcancelledorfailedpayments. Disable the+button if increasing one days would causeWorkPeriod.daysPaidto be more thanWorkPeriod.daysWorked, see how we calculate it server-side https://github.com/topcoder-platform/taas-apis/blob/dev/src/services/WorkPeriodPaymentService.js#L285-L291
- the maximum value of days: we cannot pay for more days than user worked this week. So
-
Edit Additional Payment
For additional payment
days === 0and we cannot edit that. We can only edit the amount. It shouldfloatnumber greater than0. And less than100 000. If we enter wrong amount show a red validation error under the field like saying:Amount should be greater than 0 and less than 100 000. It should look like this https://monosnap.com/file/J4f0foiyUi7FvQPCIZEdFFcfIS4hHi try removing job title here https://platform.topcoder-dev.com/taas/myteams/16873/positions/ecaf2c7f-2b43-4397-bcf5-0ddf38c7f6a6/edit -
If we click
CancelorXjust close the modal. -
if we click
Updateshow a loading indicator inside the modal OR just disable the fields and all the buttons while sending request to the server.
API
- API has been updated to support editing payments [$100] Edit payments fields topcoder-platform/taas-apis#431
- Use
PATCH /work-period-payments/:idendpoint https://topcoder-platform.github.io/taas-apis/#/WorkPeriodPayments/patch_work_period_payments__id_




