-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2749 from ever-co/develop
Release
- Loading branch information
Showing
55 changed files
with
1,702 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { INextParams, IRemoveTaskFromManyPlans } from "@app/interfaces"; | ||
import { authenticatedGuard } from "@app/services/server/guards/authenticated-guard-app"; | ||
import { deleteDailyPlansManyRequest } from "@app/services/server/requests"; | ||
import { NextResponse } from "next/server"; | ||
|
||
export async function PUT(req: Request, { params }: INextParams) { | ||
const res = new NextResponse(); | ||
const { id } = params; | ||
if (!id) { | ||
return; | ||
} | ||
const { $res, user, access_token } = await authenticatedGuard(req, res); | ||
|
||
if (!user) return $res('Unauthorized'); | ||
|
||
const body = (await req.json()) as unknown as IRemoveTaskFromManyPlans; | ||
const response = await deleteDailyPlansManyRequest({ | ||
data: body, | ||
taskId: id, | ||
bearer_token: access_token, | ||
}); | ||
return $res(response.data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { IDailyPlan, ITeamTask } from "@app/interfaces"; | ||
import { DropResult } from "react-beautiful-dnd"; | ||
|
||
export const handleDragAndDrop = (results: DropResult, plans: IDailyPlan[], setPlans: React.Dispatch<React.SetStateAction<IDailyPlan[]>>) => { | ||
const { source, destination } = results; | ||
|
||
if (!destination || (source.droppableId === destination.droppableId && source.index === destination.index)) return; | ||
|
||
const newPlans = [...plans]; | ||
|
||
const planSourceIndex = newPlans.findIndex(plan => plan.id === source.droppableId); | ||
const planDestinationIndex = newPlans.findIndex(plan => plan.id === destination.droppableId); | ||
|
||
const newSourceTasks = [...newPlans[planSourceIndex].tasks!]; | ||
const newDestinationTasks = source.droppableId !== destination.droppableId | ||
? [...newPlans[planDestinationIndex].tasks!] | ||
: newSourceTasks; | ||
|
||
const [deletedTask] = newSourceTasks.splice(source.index, 1); | ||
newDestinationTasks.splice(destination.index, 0, deletedTask); | ||
|
||
newPlans[planSourceIndex] = { | ||
...newPlans[planSourceIndex], | ||
tasks: newSourceTasks, | ||
}; | ||
newPlans[planDestinationIndex] = { | ||
...newPlans[planDestinationIndex], | ||
tasks: newDestinationTasks, | ||
}; | ||
setPlans(newPlans); | ||
}; | ||
|
||
|
||
export const handleDragAndDropDailyOutstandingAll = ( | ||
results: DropResult, | ||
tasks: ITeamTask[], | ||
setTasks: React.Dispatch<React.SetStateAction<ITeamTask[]>> | ||
) => { | ||
const { source, destination } = results; | ||
|
||
if (!destination || (source.droppableId === destination.droppableId && source.index === destination.index)) return; | ||
|
||
const newTasks = [...tasks]; | ||
const [movedTask] = newTasks.splice(source.index, 1); | ||
newTasks.splice(destination.index, 0, movedTask); | ||
|
||
setTasks(newTasks); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.