Merge branch 'Service_Project_Managment' of https://git.marcoaiot.com/admin/marco.pms.web into Service_Project_Managment

This commit is contained in:
pramod.mahajan 2025-11-17 12:45:01 +05:30
commit c311324bad
3 changed files with 115 additions and 72 deletions

View File

@ -22,7 +22,7 @@ const JobComments = ({ data }) => {
formState: { errors }, formState: { errors },
} = useAppForm({ } = useAppForm({
resolver: zodResolver(JobCommentSchema), resolver: zodResolver(JobCommentSchema),
defaultValues:{ comment: "", attachments: [] } defaultValues: { comment: "", attachments: [] }
}); });
const { const {
@ -119,10 +119,20 @@ const JobComments = ({ data }) => {
</div> </div>
</div> </div>
<div className="d-flex justify-content-end gap-3 align-items-center text-end mt-3"> <div className="d-flex flex-column flex-md-row justify-content-between align-items-start">
{/* LEFT SIDE → Uploaded Files */}
<div className="flex-grow-1 ms-10 mt-2">
{files?.length > 0 && (
<Filelist files={files} removeFile={removeFile} />
)}
</div>
{/* RIGHT SIDE → Add Attachment + Submit */}
<div className="d-flex gap-3 align-items-center text-end mt-3 ms-10 ms-md-0">
<div <div
onClick={() => document.getElementById("attachments").click()} onClick={() => document.getElementById("attachments").click()}
className="cursor-pointer" className="cursor-pointer"
style={{ whiteSpace: 'nowrap' }}
> >
<input <input
type="file" type="file"
@ -136,21 +146,22 @@ const JobComments = ({ data }) => {
e.target.value = ""; e.target.value = "";
}} }}
/> />
<i className="bx bx-paperclip"></i> <i className="bx bx-sm bx-paperclip mb-1 me-1"></i>
Add Attachment Add Attachment
</div> </div>
<button <button
className="btn btn-primary btn-sm px-3" className="btn btn-primary btn-sm px-1 py-1" // smaller padding + slightly smaller font
type="submit" type="submit"
disabled={!watch("comment")?.trim() || isPending} disabled={!watch("comment")?.trim() || isPending}
> >
<i className="bx bx-send me-1"></i> <i className="bx bx-xs bx-send me-1"></i>
Submit Submit
</button> </button>
</div> </div>
{files?.length > 0 && ( </div>
<Filelist files={files} removeFile={removeFile} />
)}
</form> </form>
</div> </div>
<div className="card-body p-0"> <div className="card-body p-0">

View File

@ -7,6 +7,7 @@ import Avatar from "../common/Avatar";
import EmployeeAvatarGroup from "../common/EmployeeAvatarGroup"; import EmployeeAvatarGroup from "../common/EmployeeAvatarGroup";
import JobStatusLog from "./JobStatusLog"; import JobStatusLog from "./JobStatusLog";
import JobComments from "./JobComments"; import JobComments from "./JobComments";
import { daysLeft } from "../../utils/appUtils";
const ManageJobTicket = ({ Job }) => { const ManageJobTicket = ({ Job }) => {
const { data, isLoading, isError, error } = useServiceProjectJobDetails( const { data, isLoading, isError, error } = useServiceProjectJobDetails(
@ -17,14 +18,14 @@ const ManageJobTicket = ({ Job }) => {
{ {
id: "comment", id: "comment",
title: "Comments", title: "Comments",
icon:"bx bx-comment me-2", icon: "bx bx-comment me-2",
active: true, active: true,
content: <JobComments data={data} />, content: <JobComments data={data} />,
}, },
{ {
id: "history", id: "history",
title: "History", title: "History",
icon:"bx bx-time me-2", icon: "bx bx-time me-2",
active: false, active: false,
content: <JobStatusLog data={data?.updateLogs} />, content: <JobStatusLog data={data?.updateLogs} />,
}, },
@ -41,17 +42,39 @@ const ManageJobTicket = ({ Job }) => {
return ( return (
<div className="row text-start"> <div className="row text-start">
<div className="col-12"> <div className="col-12">
<h6 className="fs-5 fw-semibold">{data?.title}</h6> <div className="d-flex justify-content-between align-items-center mb-3">
<div className="d-flex justify-content-between">
<div className="d-flex flex-row gap-2">
<i className="bx bx-calendar"></i>{" "}
<span>{formatUTCToLocalTime(data?.createdAt, true)}</span>
</div>
<span className="badge bg-label-primary">{data?.status?.name}</span> <span className="badge bg-label-primary">{data?.status?.name}</span>
{data?.dueDate && (() => {
const { days, color } = daysLeft(data?.startDate, data?.dueDate);
return (
<span style={{ fontSize: "12px" }}>
<span className="fw-medium me-1">Days Left :</span>
<span className={`badge bg-${color}`}>
{days !== null ? `${days} days` : "N/A"}
</span>
</span>
);
})()}
</div> </div>
<div className="d-flex flex-wrap my-3"> <h6 className="fs-5 fw-semibold">{data?.title}</h6>
<p>{data?.description}</p>
<div className="d-flex flex-wrap">
<p>
<span className="fw-medium me-1">Description :</span>
{data?.description || "N/A"}
</p>
</div> </div>
<div className="d-flex justify-content-between mb-4">
<div className="d-flex flex-row gap-1 fw-medium">
<i className="bx bx-calendar"></i>{" "}
<span>Created Date : {formatUTCToLocalTime(data?.createdAt, true)}</span>
</div>
</div>
<div>
<div className="d-flex flex-row gap-5"> <div className="d-flex flex-row gap-5">
<span className="fw-medium"> <span className="fw-medium">
<i className="bx bx-calendar"></i> Start Date : {formatUTCToLocalTime(data?.startDate)} <i className="bx bx-calendar"></i> Start Date : {formatUTCToLocalTime(data?.startDate)}
@ -61,11 +84,12 @@ const ManageJobTicket = ({ Job }) => {
<i className="bx bx-calendar"></i> Due on : {formatUTCToLocalTime(data?.startDate)} <i className="bx bx-calendar"></i> Due on : {formatUTCToLocalTime(data?.startDate)}
</span> </span>
</div> </div>
<div className="d-block mt-2"> </div>
<div className="d-block mt-4 mb-3">
<div className="d-flex align-items-center mb-2"> <div className="d-flex align-items-center mb-2">
<small className="fs-6 text-secondary fs-italic me-3 mt-2"> <span className="fs-6 fw-medium me-5">
<em>Created By</em> Created By
</small>{" "} </span>{" "}
<Avatar <Avatar
size="xs" size="xs"
firstName={data?.createdBy?.firstName} firstName={data?.createdBy?.firstName}
@ -77,16 +101,16 @@ const ManageJobTicket = ({ Job }) => {
</div> </div>
</div> </div>
<div className="d-flex align-items-center"> <div className="d-flex align-items-center">
<small className="fs-6 text-secondary fs-italic me-3 mt-2"> <small className="fs-6 fw-medium me-3">
<em>Assigned</em> Assigned By
</small> </small>
<div className="d-flex flex-row gap-3"> <div className="d-flex flex-row gap-3">
{data?.assignees?.map((emp)=>( {data?.assignees?.map((emp) => (
<div className="d-flex flex-row "> <div className="d-flex flex-row ">
<Avatar size="xs" firstName={emp.firstName} lastName={emp.lastName}/> <Avatar size="xs" firstName={emp.firstName} lastName={emp.lastName} />
<div className="d-flex flex-row align-items-center"> <div className="d-flex flex-row align-items-center">
<p className="m-0">{`${emp.firstName} ${emp.lastName}`}</p> <p className="m-0">{`${emp.firstName} ${emp.lastName}`}</p>
<small className="text-secondary ms-1">( {emp.jobRoleName} )</small> <small className="text-secondary ms-1">({emp.jobRoleName})</small>
</div> </div>
</div> </div>
))} ))}

View File

@ -6,7 +6,7 @@ const OffcanvasComponent = ({
placement = "start", // start | end | top | bottom placement = "start", // start | end | top | bottom
children, children,
show = false, show = false,
onClose = () => {}, onClose = () => { },
}) => { }) => {
const offcanvasRef = useRef(null); const offcanvasRef = useRef(null);
const bsInstance = useRef(null); const bsInstance = useRef(null);
@ -45,11 +45,19 @@ const OffcanvasComponent = ({
aria-labelledby={`${id}-label`} aria-labelledby={`${id}-label`}
> >
<div className="offcanvas-header"> <div className="offcanvas-header">
<div className='d-flex flex-row gap-3'> <div className="d-flex align-items-center gap-3">
<i className='bx bx-lg bx-left-arrow-alt cursor-pointer' data-bs-dismiss="offcanvas" <i
aria-label="Close"></i> <i className='bx bx-briefcase text-primary'></i> <h5 className="offcanvas-title" id={`${id}-label`}>{title}</h5> className="bx bx-lg bx-left-arrow-alt cursor-pointer"
data-bs-dismiss="offcanvas"
aria-label="Close"
></i>
<i className="bx bx-briefcase text-primary"></i>
<h5 className="offcanvas-title mb-0" id={`${id}-label`}>
{title}
</h5>
</div> </div>
<button <button
type="button" type="button"
className="btn-close" className="btn-close"