diff --git a/src/utils/Fetcher.jsx b/src/utils/Fetcher.jsx index 149ba7e..dfc58ce 100644 --- a/src/utils/Fetcher.jsx +++ b/src/utils/Fetcher.jsx @@ -156,6 +156,22 @@ const SkipChore = id => { }) } +const ApproveChore = id => { + return Fetch(`/chores/${id}/approve`, { + method: 'POST', + headers: HEADERS(), + body: JSON.stringify({}), + }) +} + +const RejectChore = id => { + return Fetch(`/chores/${id}/reject`, { + method: 'POST', + headers: HEADERS(), + body: JSON.stringify({}), + }) +} + const UpdateChoreAssignee = (id, assignee) => { return Fetch(`/chores/${id}/assignee`, { method: 'PUT', @@ -596,7 +612,7 @@ const ClearChoreTimer = choreId => { }) } -const CheckUserDeletion = (password) => { +const CheckUserDeletion = password => { return Fetch(`/users/delete/check`, { method: 'POST', headers: HEADERS(), @@ -643,6 +659,7 @@ const RestoreBackup = (encryptionKey, backupData) => { export { AcceptCircleMemberRequest, + ApproveChore, ArchiveChore, CancelSubscription, ChangePassword, @@ -694,6 +711,7 @@ export { RedeemPoints, RefreshToken, RegenerateBackupCodes, + RejectChore, ResetChoreTimer, ResetPassword, RestoreBackup, diff --git a/src/views/Chores/ActivitesCard.jsx b/src/views/Chores/ActivitesCard.jsx index 3dfc107..156f5b7 100644 --- a/src/views/Chores/ActivitesCard.jsx +++ b/src/views/Chores/ActivitesCard.jsx @@ -1,10 +1,12 @@ import { CheckCircle, EventNote, + HourglassEmpty, Notes, Person, Redo, Refresh, + ThumbDown, Timelapse, Toll, WatchLater, @@ -57,38 +59,49 @@ const ActivityItem = ({ activity, members }) => { text: 'Started', icon: , } - } - if (!activity.status === 1) { - return { - color: 'neutral', - text: 'Completed', - icon: , + } else if (activity.status === 1) { + const wasOnTime = moment(activity.performedAt).isSameOrBefore( + moment(activity.dueDate), + ) + + if (wasOnTime) { + return { + color: 'success', + text: 'Done', + icon: , + } + } else { + return { + color: 'primary', + text: 'Late', + icon: , + } } } else if (activity.status === 2) { - // skipped return { color: 'warning', text: 'Skipped', icon: , } + } else if (activity.status === 3) { + return { + color: 'neutral', + text: 'Pending Approval', + icon: , + } + } else if (activity.status === 4) { + return { + color: 'danger', + text: 'Rejected', + icon: , + } } - const wasOnTime = moment(activity.performedAt).isSameOrBefore( - moment(activity.dueDate), - ) - - if (wasOnTime) { - return { - color: 'success', - text: 'Done', - icon: , - } - } else { - return { - color: 'primary', - text: 'Late', - icon: , - } + // Fallback for completed status + return { + color: 'success', + text: 'Completed', + icon: , } }