File tree Expand file tree Collapse file tree 2 files changed +26
-7
lines changed
Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -99,10 +99,10 @@ export const TaskEditModal: React.FC<TaskEditModalProps> = ({
9999 } ;
100100
101101 const formatDateString = ( date : Date ) : string => {
102- const month = String ( date . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) ;
103102 const day = String ( date . getDate ( ) ) . padStart ( 2 , '0' ) ;
104- const year = date . getFullYear ( ) ;
105- return `${ month } /${ day } /${ year } ` ;
103+ const month = String ( date . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) ;
104+ const year = String ( date . getFullYear ( ) ) . slice ( - 2 ) ; // Get last 2 digits of year
105+ return `${ day } /${ month } /${ year } ` ;
106106 } ;
107107
108108 const handleStartDateChange = ( date : Date | null ) => {
@@ -743,8 +743,8 @@ export const TaskEditModal: React.FC<TaskEditModalProps> = ({
743743 index === 0
744744 ? '8px 8px 0 0'
745745 : index === admins . length - 1
746- ? '0 0 8px 8px'
747- : '0'
746+ ? '0 0 8px 8px'
747+ : '0'
748748 }
749749 >
750750 < Flex align = "center" gap = "12px" >
Original file line number Diff line number Diff line change @@ -332,6 +332,25 @@ export default function AdminTasks() {
332332 if ( ! taskToUpdate ) return ;
333333
334334 try {
335+ // Handle completed field separately using the dedicated endpoints
336+ if ( field === 'completed' ) {
337+ if ( value === true ) {
338+ // Mark as completed
339+ await taskAPIClient . completeTask ( taskId ) ;
340+ } else {
341+ // Update to pending
342+ await taskAPIClient . updateTask ( taskId , { status : 'pending' } ) ;
343+ }
344+
345+ // Update local state
346+ const updatedTask = { ...taskToUpdate , completed : value as boolean } ;
347+ if ( selectedTask ?. id === taskId ) {
348+ setSelectedTask ( updatedTask ) ;
349+ }
350+ setTasks ( tasks . map ( ( task ) => ( task . id === taskId ? updatedTask : task ) ) ) ;
351+ return ;
352+ }
353+
335354 const updates : Record < string , string | null > = { } ;
336355
337356 if ( field === 'priority' ) {
@@ -629,8 +648,8 @@ export default function AdminTasks() {
629648 overId === tab . name
630649 ? lightGray
631650 : activeTab === tab . name
632- ? borderActive
633- : lightBg
651+ ? borderActive
652+ : lightBg
634653 }
635654 borderRadius = "8px"
636655 fontFamily = "'Open Sans', sans-serif"
You can’t perform that action at this time.
0 commit comments