diff --git a/src/components/ServiceProject/JobComments.jsx b/src/components/ServiceProject/JobComments.jsx index ada85a11..42c64d63 100644 --- a/src/components/ServiceProject/JobComments.jsx +++ b/src/components/ServiceProject/JobComments.jsx @@ -22,7 +22,7 @@ const JobComments = ({ data }) => { formState: { errors }, } = useAppForm({ resolver: zodResolver(JobCommentSchema), - default: { comment: "", attachments: [] }, + defaultValues:{ comment: "", attachments: [] } }); const { @@ -94,6 +94,7 @@ const JobComments = ({ data }) => { const newFiles = files.filter((_, i) => i !== index); setValue("attachments", newFiles, { shouldValidate: true }); }; + console.log(watch("attachments")) return (
diff --git a/src/components/ServiceProject/JobStatusLog.jsx b/src/components/ServiceProject/JobStatusLog.jsx index 2f61c8ce..cb8300b4 100644 --- a/src/components/ServiceProject/JobStatusLog.jsx +++ b/src/components/ServiceProject/JobStatusLog.jsx @@ -1,15 +1,20 @@ import React from "react"; +import Avatar from "../common/Avatar"; const JobStatusLog = ({ data }) => { + console.log(data) return (
{data?.map((item) => ( -
- -
+ +
+
{item.nextStatus?.displayName ?? item.status?.displayName ?? "Status"} @@ -20,27 +25,30 @@ const JobStatusLog = ({ data }) => { Level {item.nextStatus?.level ?? item.status?.level}
- -

- {item.comment} -

- -
-
- -
-
-
- {item.updatedBy?.firstName} {item.updatedBy?.lastName} -
-
- {item.updatedBy?.jobRoleName} +
+ +
+
+ + {item.updatedBy?.firstName} {item.updatedBy?.lastName} + + + {/* {formatUTCToLocalTime(item?.createdAt, true)} */} + +
+
+ {item?.updatedBy?.jobRoleName} +
+
+

{item.comment}

+ +
- -
))}
diff --git a/src/components/ServiceProject/Jobs.jsx b/src/components/ServiceProject/Jobs.jsx index 8387f977..f7ad0dda 100644 --- a/src/components/ServiceProject/Jobs.jsx +++ b/src/components/ServiceProject/Jobs.jsx @@ -75,9 +75,6 @@ const Jobs = () => {
- - - ); diff --git a/src/components/ServiceProject/ManageJobTicket.jsx b/src/components/ServiceProject/ManageJobTicket.jsx index 92f1363b..3637931b 100644 --- a/src/components/ServiceProject/ManageJobTicket.jsx +++ b/src/components/ServiceProject/ManageJobTicket.jsx @@ -17,12 +17,14 @@ const ManageJobTicket = ({ Job }) => { { id: "comment", title: "Coments", + icon:"bx bx-comment me-2", active: true, content: , }, { id: "history", title: "History", + icon:"bx bx-time me-2", active: false, content: , }, @@ -50,17 +52,17 @@ const ManageJobTicket = ({ Job }) => {

{data?.description}

-
+
- Start Date : {formatUTCToLocalTime(data?.startDate)} + Start Date : {formatUTCToLocalTime(data?.startDate)} {" "} {" "} - Due To : {formatUTCToLocalTime(data?.startDate)} + Due To : {formatUTCToLocalTime(data?.startDate)}
-
-
+
+
Created By {" "} @@ -69,13 +71,26 @@ const ManageJobTicket = ({ Job }) => { firstName={data?.createdBy?.firstName} lastName={data?.createdBy?.lastName} />{" "} - {`${data?.createdBy?.firstName} ${data?.createdBy?.lastName}`} +
+

{`${data?.createdBy?.firstName} ${data?.createdBy?.lastName}`}

+ {data?.createdBy?.jobRoleName} +
Assigned - +
+ {data?.assignees?.map((emp)=>( +
+ +
+

{`${emp.firstName} ${emp.lastName}`}

+ {emp.jobRoleName} +
+
+ ))} +
@@ -91,7 +106,7 @@ const ManageJobTicket = ({ Job }) => { data-bs-target={`#tab-${tab.id}`} role="tab" > - {tab.title} + {tab.title} ))} diff --git a/src/components/ServiceProject/ServiceProjectSchema.jsx b/src/components/ServiceProject/ServiceProjectSchema.jsx index acaa779f..f2a865ad 100644 --- a/src/components/ServiceProject/ServiceProjectSchema.jsx +++ b/src/components/ServiceProject/ServiceProjectSchema.jsx @@ -59,21 +59,24 @@ const ALLOWED_TYPES = [ ]; export const JobCommentSchema = z.object({ comment: z.string().min(1, { message: "Please leave comment" }), - attachments: z.array( + attachments: z + .array( z.object({ - fileName: z.string().min(1, { message: "Filename is required" }), + fileName: z.string().min(1), base64Data: z.string().nullable(), contentType: z.string().refine((val) => ALLOWED_TYPES.includes(val), { message: "Only PDF, PNG, JPG, or JPEG files are allowed", }), documentId: z.string().optional(), - fileSize: z.number().max(MAX_FILE_SIZE, { - message: "File size must be less than or equal to 5MB", - }), + fileSize: z.number().max(MAX_FILE_SIZE), description: z.string().optional(), isActive: z.boolean().default(true), }) - ), + ) + .optional() + .default([]), + + }); export const defaultJobValue = { title: "", diff --git a/src/components/common/DatePicker.jsx b/src/components/common/DatePicker.jsx index 9a3890fa..d48b0258 100644 --- a/src/components/common/DatePicker.jsx +++ b/src/components/common/DatePicker.jsx @@ -51,7 +51,7 @@ const DatePicker = ({
{ diff --git a/src/hooks/useServiceProject.jsx b/src/hooks/useServiceProject.jsx index c0a809b3..6ce93b8c 100644 --- a/src/hooks/useServiceProject.jsx +++ b/src/hooks/useServiceProject.jsx @@ -159,7 +159,7 @@ export const useAddCommentJob = (onSuccessCallback) => { queryKey: ["jobComments", variables?.jobTicketId], }); if (onSuccessCallback) onSuccessCallback(); - showToast("Job Created successfully", "success"); + showToast("Comment added successfully", "success"); }, onError: (error) => { showToast(