Task complete is now attempting to save the data
This commit is contained in:
parent
032ac983eb
commit
cfa33f9465
@ -13,6 +13,7 @@ import TaskTypeAndNameDisplayPanel from "../../workflowTemplates/components/Task
|
|||||||
import Button, { ButtonType } from "../../../../components/common/Button";
|
import Button, { ButtonType } from "../../../../components/common/Button";
|
||||||
import TaskProcessor from "./components/TaskProcessor";
|
import TaskProcessor from "./components/TaskProcessor";
|
||||||
import "../../../../Sass/_assignmentComplete.scss";
|
import "../../../../Sass/_assignmentComplete.scss";
|
||||||
|
import { MakeGeneralIdRef } from "../../../../utils/GeneralIdRef";
|
||||||
|
|
||||||
const AssignmentComplete: React.FC = () => {
|
const AssignmentComplete: React.FC = () => {
|
||||||
const { assignmentId } = useParams<{ assignmentId: string }>();
|
const { assignmentId } = useParams<{ assignmentId: string }>();
|
||||||
@ -47,6 +48,19 @@ const AssignmentComplete: React.FC = () => {
|
|||||||
void loadAssignment();
|
void loadAssignment();
|
||||||
}, [loadAssignment]);
|
}, [loadAssignment]);
|
||||||
|
|
||||||
|
const handleComplete = useCallback(async () => {
|
||||||
|
const assignmentGeneralId = MakeGeneralIdRef(
|
||||||
|
assignmentDetails!.assignment.id,
|
||||||
|
assignmentDetails?.assignment.guid,
|
||||||
|
);
|
||||||
|
|
||||||
|
await assignmentCompleteService.completeAssignment(
|
||||||
|
assignmentGeneralId,
|
||||||
|
taskData,
|
||||||
|
);
|
||||||
|
toast.success(`${assignmentDetails?.task.taskName} has been completed.`);
|
||||||
|
}, [assignmentDetails, taskData]);
|
||||||
|
|
||||||
if (assignmentDetails === undefined) {
|
if (assignmentDetails === undefined) {
|
||||||
return <LoadingPanel />;
|
return <LoadingPanel />;
|
||||||
}
|
}
|
||||||
@ -72,12 +86,9 @@ const AssignmentComplete: React.FC = () => {
|
|||||||
<Button
|
<Button
|
||||||
buttonType={ButtonType.primary}
|
buttonType={ButtonType.primary}
|
||||||
disabled={!isTaskValid}
|
disabled={!isTaskValid}
|
||||||
onClick={() => {
|
onClick={handleComplete}
|
||||||
console.log("Task data to submit:", taskData);
|
|
||||||
toast.info("Complete action not implemented yet");
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
Complete
|
{t("Complete")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -111,11 +122,17 @@ const AssignmentComplete: React.FC = () => {
|
|||||||
<div className="assigneeDetailsLabel">Assigned to</div>
|
<div className="assigneeDetailsLabel">Assigned to</div>
|
||||||
<div>Contacts</div>
|
<div>Contacts</div>
|
||||||
<div>
|
<div>
|
||||||
|
{assignmentDetails.assignment.userId && (
|
||||||
<AssigneePanel user={assignmentDetails.assignment.userId} />
|
<AssigneePanel user={assignmentDetails.assignment.userId} />
|
||||||
|
)}
|
||||||
|
{!assignmentDetails.assignment.userId && <div> </div>}
|
||||||
</div>
|
</div>
|
||||||
<div>Roles</div>
|
<div>Roles</div>
|
||||||
<div>
|
<div>
|
||||||
|
{assignmentDetails.assignment.roleId && (
|
||||||
<AssigneePanel role={assignmentDetails.assignment.roleId} />
|
<AssigneePanel role={assignmentDetails.assignment.roleId} />
|
||||||
|
)}
|
||||||
|
{!assignmentDetails.assignment.roleId && <div> </div>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -41,6 +41,11 @@ export interface GetAssignmentForCompletion {
|
|||||||
workflowTemplateVersion: ReadWorkflowTemplateVersion;
|
workflowTemplateVersion: ReadWorkflowTemplateVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CompleteAssignmentRequest {
|
||||||
|
assignmenId: GeneralIdRef;
|
||||||
|
taskData: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
export async function getAssignmentForCompletion(
|
export async function getAssignmentForCompletion(
|
||||||
assignmentId: bigint,
|
assignmentId: bigint,
|
||||||
): Promise<GetAssignmentForCompletion> {
|
): Promise<GetAssignmentForCompletion> {
|
||||||
@ -52,8 +57,21 @@ export async function getAssignmentForCompletion(
|
|||||||
return response?.data;
|
return response?.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function completeAssignment(
|
||||||
|
assignmentGeneralId: GeneralIdRef,
|
||||||
|
taskData: Record<string, unknown>,
|
||||||
|
): Promise<any> {
|
||||||
|
const request: CompleteAssignmentRequest = {
|
||||||
|
assignmenId: assignmentGeneralId,
|
||||||
|
taskData,
|
||||||
|
};
|
||||||
|
|
||||||
|
return await httpService.post(apiEndpoint + "/CompleteAssignmost", request);
|
||||||
|
}
|
||||||
|
|
||||||
const assignmentCompleteService = {
|
const assignmentCompleteService = {
|
||||||
getAssignmentForCompletion,
|
getAssignmentForCompletion,
|
||||||
|
completeAssignment,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default assignmentCompleteService;
|
export default assignmentCompleteService;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user