aboutsummaryrefslogtreecommitdiffstats
path: root/src/views/Chores
diff options
context:
space:
mode:
authorLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-08-10 02:08:49 -0400
committerLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-08-10 02:08:49 -0400
commite9745683748ac5ecfdf704607441a3204d8c5516 (patch)
tree34004796c608c7c287402582fc23e2a0c8ba1e86 /src/views/Chores
parentb5f17dc7a6f706a302d01fc129f5bf7edf6d8471 (diff)
downloaddonetick-frontend-e9745683748ac5ecfdf704607441a3204d8c5516.tar.gz
donetick-frontend-e9745683748ac5ecfdf704607441a3204d8c5516.tar.bz2
donetick-frontend-e9745683748ac5ecfdf704607441a3204d8c5516.zip
Update Fetcher.jsx to include UpdateChoreAssignee function and ChoreCard.jsx to handle assignee change
Diffstat (limited to '')
-rw-r--r--src/views/Chores/ChoreCard.jsx23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/views/Chores/ChoreCard.jsx b/src/views/Chores/ChoreCard.jsx
index 97e407a..fdf025e 100644
--- a/src/views/Chores/ChoreCard.jsx
+++ b/src/views/Chores/ChoreCard.jsx
@@ -39,7 +39,7 @@ import moment from 'moment'
import React, { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
import { API_URL } from '../../Config'
-import { MarkChoreComplete, SkipChore } from '../../utils/Fetcher'
+import { MarkChoreComplete, SkipChore, UpdateChoreAssignee } from '../../utils/Fetcher'
import { Fetch } from '../../utils/TokenManager'
import ConfirmationModal from '../Modals/Inputs/ConfirmationModal'
import DateModal from '../Modals/Inputs/DateModal'
@@ -219,7 +219,16 @@ const ChoreCard = ({
})
}
const handleAssigneChange = assigneeId => {
- // TODO: Implement assignee change
+ UpdateChoreAssignee(chore.id, assigneeId).then(response => {
+ if (response.ok) {
+ response.json().then(data => {
+ const newChore = data.res
+ onChoreUpdate(newChore, 'assigned')
+ })
+ }
+ }
+ )
+
}
const handleCompleteWithNote = note => {
Fetch(`${API_URL}/chores/${chore.id}/do`, {
@@ -547,10 +556,6 @@ const ChoreCard = ({
<RecordVoiceOver />
Delegate to someone else
</MenuItem>
- <MenuItem>
- <HowToReg />
- Complete as someone else
- </MenuItem>
<Divider />
<MenuItem
onClick={() => {
@@ -620,10 +625,14 @@ const ChoreCard = ({
options={performers}
displayKey='displayName'
title={`Delegate to someone else`}
+ placeholder={'Select a performer'}
onClose={() => {
setIsChangeAssigneeModalOpen(false)
}}
- onSave={handleAssigneChange}
+ onSave={(selected)=>{
+ handleAssigneChange(selected.id)
+ }
+ }
/>
<ConfirmationModal config={confirmModelConfig} />
<TextModal