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

This commit is contained in:
pramod.mahajan 2025-12-10 10:32:00 +05:30
commit 363a9c5feb
10 changed files with 654 additions and 323 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ const formatDate = (dateStr) => {
const date = new Date(dateStr);
return date.toLocaleDateString("en-GB", {
day: "2-digit",
month: "long",
month: "short",
});
};

View File

@ -37,7 +37,7 @@ const Dashboard = () => {
const canTeamAttendance = useHasUserPermission(TEAM_ATTENDANCE);
const canSelfAttendance = useHasUserPermission(SELF_ATTENDANCE);
const { data,isLoading,isError } = useGetCollectionOverview();
const { data, isLoading, isError } = useGetCollectionOverview();
return (
<div className="container-fluid mt-5">
<div className="row gy-4">
@ -48,17 +48,15 @@ const Dashboard = () => {
)}
<div
className={`${
!isAllProjectsSelected ? "col-sm-6 col-lg-6" : "col-sm-6 col-lg-4"
}`}
className={`${!isAllProjectsSelected ? "col-sm-6 col-lg-6" : "col-sm-6 col-lg-4"
}`}
>
<Teams />
</div>
<div
className={`${
!isAllProjectsSelected ? "col-sm-6 col-lg-6" : "col-sm-6 col-lg-4"
}`}
className={`${!isAllProjectsSelected ? "col-sm-6 col-lg-6" : "col-sm-6 col-lg-4"
}`}
>
<TasksCard />
</div>
@ -87,7 +85,7 @@ const Dashboard = () => {
</div>
{!isAllProjectsSelected &&
(canRegularize || canTeamAttendance || canSelfAttendance) && (
<div className="col-12 col-md-6 mb-sm-0 mb-4">
<div className="col-12 col-md-8 mb-sm-0 mb-4">
<AttendanceOverview />
</div>
)}
@ -102,6 +100,11 @@ const Dashboard = () => {
</div>
</div>
)}
{isAllProjectsSelected && (
<div className="col-12 col-md-6 mb-sm-0 mb-4">
<ServiceJobs />
</div>
)}
<div className="col-md-8">
{isLoading ? (
<CollectionOverviewSkeleton />

View File

@ -1,234 +1,156 @@
import React from "react";
import { useParams } from "react-router-dom";
import { useJobsProgression } from "../../hooks/useDashboard_Data";
import { SpinnerLoader } from "../common/Loader";
import { formatUTCToLocalTime } from "../../utils/dateUtils";
import { useServiceProject } from "../../hooks/useServiceProject";
const ServiceJobs = () => {
const { projectId } = useParams();
const { data, isLoading, isError } = useJobsProgression(projectId);
const jobs = data || {};
const { data: projectData, isLoading: projectLoading } = useServiceProject(projectId);
const tabMapping = [
{ id: "tab-new", label: "My Jobs", key: "allJobs" },
{ id: "tab-preparing", label: "Assigned", key: "assignedJobs" },
{ id: "tab-shipping", label: "In Progress", key: "inProgressJobs" },
];
return (
<div className="col-xxl-4 col-lg-6">
<div className="card h-100">
<div className="">
<div className="card page-min-h">
<div className="card-header d-flex justify-content-between">
<div className="card-title mb-0 text-start">
<h5 className="mb-1">Service Jobs</h5>
<p className="card-subtitle">All Projects</p>
<h5 className="mb-1 fw-bold">Service Jobs</h5>
<p className="card-subtitle">
{projectLoading ? "Loading..." : projectData?.name || "All Projects"}
</p>
</div>
</div>
<div className="card-body p-0">
<div className="nav-align-top">
{/* Tabs */}
{/* ---------------- Tabs ---------------- */}
<ul className="nav nav-tabs nav-fill rounded-0 timeline-indicator-advanced" role="tablist">
<li className="nav-item">
<button className="nav-link active" data-bs-toggle="tab" data-bs-target="#tab-new">
My Jobs
</button>
</li>
<li className="nav-item">
<button className="nav-link" data-bs-toggle="tab" data-bs-target="#tab-preparing">
Assigned
</button>
</li>
<li className="nav-item">
<button className="nav-link" data-bs-toggle="tab" data-bs-target="#tab-shipping">
In Progress
</button>
</li>
{tabMapping.map((t, index) => (
<li className="nav-item" key={t.id}>
<button
className={`nav-link ${index === 0 ? "active" : ""}`}
data-bs-toggle="tab"
data-bs-target={`#${t.id}`}
>
{t.label}
</button>
</li>
))}
</ul>
{/* Tab Content */}
{/* ---------------- Tab Content ---------------- */}
<div className="tab-content border-0 mx-1 text-start">
{/* ---------------------- NEW TAB ---------------------- */}
<div className="tab-pane fade show active" id="tab-new">
{/* Entry 1 */}
<ul className="timeline mb-0">
<li className="timeline-item ps-6 border-left-dashed">
<span className="timeline-indicator-advanced timeline-indicator-success border-0 shadow-none">
<i className="bx bx-check-circle"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-success text-uppercase">Sender</small>
</div>
<h6 className="my-50">Myrtle Ullrich</h6>
<p className="text-body mb-0">101 Boulder, California(CA), 95959</p>
{isLoading && (
<div className="text-center" style={{ height: "250px", display: "flex", justifyContent: "center", alignItems: "center" }}>
<SpinnerLoader />
</div>
)}
{isError && (
<p
className="text-center"
style={{
height: "250px",
display: "flex",
justifyContent: "center",
alignItems: "center",
margin: 0,
}}
>
No data found
</p>
)}
{!isLoading &&
!isError &&
tabMapping.map((t, index) => {
const list = jobs[t.key] || [];
return (
<div
key={t.id}
className={`tab-pane fade ${index === 0 ? "show active" : ""}`}
id={t.id}
>
{list.length === 0 ? (
<p
className="text-center"
style={{
height: "250px",
display: "flex",
justifyContent: "center",
alignItems: "center",
margin: 0,
}}
>
No jobs found
</p>
) : (
<div className="job-scroll-wrapper">
{list.map((job, i) => (
<React.Fragment key={i}>
<ul className="timeline mb-0">
{/* Assigned By */}
<li className="timeline-item ps-6 border-left-dashed">
<span className="timeline-indicator-advanced timeline-indicator-success border-0 shadow-none">
<i className="bx bx-check-circle"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-success text-uppercase">
Assigned By
</small>
</div>
<h6 className="my-50">{job.assignedBy}</h6>
<p className="text-body mb-0">
{formatUTCToLocalTime(job.assignedAt)}
</p>
</div>
</li>
{/* Project */}
<li className="timeline-item ps-6 border-transparent">
<span className="timeline-indicator-advanced timeline-indicator-primary border-0 shadow-none">
<i className="bx bx-map"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-primary text-uppercase">Project</small>
</div>
<h6 className="my-50">{job.project}</h6>
<p className="text-body mb-0">{job.title}</p>
</div>
</li>
</ul>
{/* Divider */}
{i < list.length - 1 && (
<div className="border-1 border-light border-top border-dashed my-4"></div>
)}
</React.Fragment>
))}
</div>
)}
</div>
</li>
<li className="timeline-item ps-6 border-transparent">
<span className="timeline-indicator-advanced timeline-indicator-primary border-0 shadow-none">
<i className="bx bx-map"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-primary text-uppercase">Receiver</small>
</div>
<h6 className="my-50">Barry Schowalter</h6>
<p className="text-body mb-0">939 Orange, California(CA), 92118</p>
</div>
</li>
</ul>
<div className="border-1 border-light border-top border-dashed my-4"></div>
{/* Entry 2 */}
<ul className="timeline mb-0">
<li className="timeline-item ps-6 border-left-dashed">
<span className="timeline-indicator-advanced timeline-indicator-success border-0 shadow-none">
<i className="bx bx-check-circle"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-success text-uppercase">Sender</small>
</div>
<h6 className="my-50">Veronica Herman</h6>
<p className="text-body mb-0">162 Windsor, California(CA), 95492</p>
</div>
</li>
<li className="timeline-item ps-6 border-transparent">
<span className="timeline-indicator-advanced timeline-indicator-primary border-0 shadow-none">
<i className="bx bx-map"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-primary text-uppercase">Receiver</small>
</div>
<h6 className="my-50">Helen Jacobs</h6>
<p className="text-body mb-0">487 Sunset, California(CA), 94043</p>
</div>
</li>
</ul>
</div>
{/* ---------------------- PREPARING TAB ---------------------- */}
<div className="tab-pane fade" id="tab-preparing">
{/* Entry 1 */}
<ul className="timeline mb-0">
<li className="timeline-item ps-6 border-left-dashed">
<span className="timeline-indicator-advanced timeline-indicator-warning border-0 shadow-none">
<i className="bx bx-time-five"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-warning text-uppercase">Sender</small>
</div>
<h6 className="my-50">Oliver Grant</h6>
<p className="text-body mb-0">220 Pine St, California(CA), 95765</p>
</div>
</li>
<li className="timeline-item ps-6 border-transparent">
<span className="timeline-indicator-advanced timeline-indicator-primary border-0 shadow-none">
<i className="bx bx-map"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-primary text-uppercase">Receiver</small>
</div>
<h6 className="my-50">Samantha Lee</h6>
<p className="text-body mb-0">744 Bay Area, California(CA), 94016</p>
</div>
</li>
</ul>
<div className="border-1 border-light border-top border-dashed my-4"></div>
{/* Entry 2 */}
<ul className="timeline mb-0">
<li className="timeline-item ps-6 border-left-dashed">
<span className="timeline-indicator-advanced timeline-indicator-warning border-0 shadow-none">
<i className="bx bx-time-five"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-warning text-uppercase">Sender</small>
</div>
<h6 className="my-50">Marcus Howard</h6>
<p className="text-body mb-0">58 Avenue, California(CA), 95376</p>
</div>
</li>
<li className="timeline-item ps-6 border-transparent">
<span className="timeline-indicator-advanced timeline-indicator-primary border-0 shadow-none">
<i className="bx bx-map"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-primary text-uppercase">Receiver</small>
</div>
<h6 className="my-50">Daniel Foster</h6>
<p className="text-body mb-0">312 Marina, California(CA), 94109</p>
</div>
</li>
</ul>
</div>
{/* ---------------------- SHIPPING TAB ---------------------- */}
<div className="tab-pane fade" id="tab-shipping">
{/* Entry 1 */}
<ul className="timeline mb-0">
<li className="timeline-item ps-6 border-left-dashed">
<span className="timeline-indicator-advanced timeline-indicator-info border-0 shadow-none">
<i className="bx bx-package"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-info text-uppercase">Sender</small>
</div>
<h6 className="my-50">James Carter</h6>
<p className="text-body mb-0">441 Market St, California(CA), 94111</p>
</div>
</li>
<li className="timeline-item ps-6 border-transparent">
<span className="timeline-indicator-advanced timeline-indicator-primary border-0 shadow-none">
<i className="bx bx-map"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-primary text-uppercase">Receiver</small>
</div>
<h6 className="my-50">Linda Moore</h6>
<p className="text-body mb-0">990 Willow Road, California(CA), 94025</p>
</div>
</li>
</ul>
<div className="border-1 border-light border-top border-dashed my-4"></div>
{/* Entry 2 */}
<ul className="timeline mb-0">
<li className="timeline-item ps-6 border-left-dashed">
<span className="timeline-indicator-advanced timeline-indicator-info border-0 shadow-none">
<i className="bx bx-package"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-info text-uppercase">Sender</small>
</div>
<h6 className="my-50">Sarah Bennett</h6>
<p className="text-body mb-0">882 Canyon Rd, California(CA), 94704</p>
</div>
</li>
<li className="timeline-item ps-6 border-transparent">
<span className="timeline-indicator-advanced timeline-indicator-primary border-0 shadow-none">
<i className="bx bx-map"></i>
</span>
<div className="timeline-event ps-1">
<div className="timeline-header">
<small className="text-primary text-uppercase">Receiver</small>
</div>
<h6 className="my-50">George Simmons</h6>
<p className="text-body mb-0">19 Palm St, California(CA), 93001</p>
</div>
</li>
</ul>
</div>
);
})}
</div>
</div>
</div>
</div>
</div>
);

View File

@ -21,6 +21,7 @@ import InputSuggestions from "../common/InputSuggestion";
import Label from "../common/Label";
import { AppFormController } from "../../hooks/appHooks/useAppForm";
import SelectField from "../common/Forms/SelectField";
import { BUCKET_BG_CLASSES } from "../../utils/constants";
const ManageContact = ({ contactId, closeModal }) => {
// fetch master data
@ -456,15 +457,25 @@ const ManageContact = ({ contactId, closeModal }) => {
{/* Buckets */}
<div className="row">
<div className="col-md-12 mt-3 text-start">
<label className="form-label mb-2">Select Bucket</label>
<ul className="d-flex flex-wrap px-1 list-unstyled mb-0">
<Label className="form-label mb-2" required>Select Bucket</Label>
<div
className="d-flex flex-wrap gap-3 p-1"
style={{
maxHeight: "200px",
overflowY: "auto",
}}
>
{bucketsLoaging && <p>Loading...</p>}
{buckets?.map((item) => (
<li
{buckets?.map((item, index) => (
<div
key={item.id}
className="list-inline-item flex-shrink-0 me-6 mb-1"
className={`card p-2 shadow-sm flex-shrink-0 ${BUCKET_BG_CLASSES[index % BUCKET_BG_CLASSES.length]}`}
onClick={() => handleCheckboxChange(item.id)}
>
<div className="form-check">
<div className="form-check m-0">
<input
type="checkbox"
className="form-check-input"
@ -472,16 +483,17 @@ const ManageContact = ({ contactId, closeModal }) => {
checked={watchBucketIds.includes(item.id)}
onChange={() => handleCheckboxChange(item.id)}
/>
<label
className="form-check-label"
htmlFor={`item-${item.id}`}
>
<label className="form-check-label ms-0" htmlFor={`item-${item.id}`}>
{item.name}
</label>
</div>
</li>
</div>
))}
</ul>
</div>
</div>
<div className="text-start mt-3 mb-3">
{errors.bucketIds && (
<small className="danger-text">{errors.bucketIds.message}</small>
)}

View File

@ -113,7 +113,7 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
<input
type="text"
id="branchName"
className="form-control form-control-sm"
className="form-control form-control-md"
{...register("branchName")}
placeholder="Enter Branch"
/>
@ -147,7 +147,7 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
<input
type="text"
id="googleMapUrl"
className="form-control form-control-sm"
className="form-control form-control-md"
{...register("googleMapUrl")}
/>
{errors.googleMapUrl && (
@ -183,7 +183,7 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
<input
type="text"
placeholder="Contact Name"
className="form-control form-control-sm"
className="form-control form-control-md"
value={item.contactPerson}
onChange={(e) => {
const list = [...contacts];
@ -198,7 +198,7 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
<input
type="text"
placeholder="Designation"
className="form-control form-control-sm"
className="form-control form-control-md"
value={item.designation}
onChange={(e) => {
const list = [...contacts];
@ -220,7 +220,7 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
<input
type="text"
placeholder="Number"
className="form-control form-control-sm"
className="form-control form-control-md"
maxLength={10}
value={num}
onChange={(e) => {
@ -267,7 +267,7 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
<input
type="email"
placeholder="Email"
className="form-control form-control-sm"
className="form-control form-control-md"
value={email}
onChange={(e) => {
const list = [...contacts];
@ -328,7 +328,7 @@ const ManageBranch = ({ closeModal, BranchToEdit = null }) => {
</Label>
<textarea
id="address"
className="form-control form-control-sm"
className="form-control "
{...register("address")}
/>
{errors.address && (

View File

@ -7,6 +7,7 @@ import GlobalModel from "../common/GlobalModel";
import { SpinnerLoader } from "../common/Loader";
import ServiceBranch from "./ServiceProjectBranch/ServiceBranch";
import ServiceProfile from "./ServiceProfile";
import ServiceJobs from "../Dashboard/ServiceJobs";
const ServiceProjectProfile = () => {
const { projectId } = useParams();
@ -40,6 +41,9 @@ const ServiceProjectProfile = () => {
<div className="col-md-6 col-lg-7 order-2 mb-6">
<ServiceBranch />
</div>
<div className="col-md-6 col-lg-5 order-2 mb-6">
<ServiceJobs/>
</div>
</div>
</>
);

View File

@ -202,3 +202,13 @@ export const useGetCollectionOverview = (projectId) => {
},
});
};
export const useJobsProgression = (projectId) => {
return useQuery({
queryKey: ["serviceProjectJobs", projectId],
queryFn: async () => {
const resp = await GlobalRepository.getJobsProgression(projectId);
return resp.data;
},
});
};

View File

@ -84,7 +84,9 @@ const GlobalRepository = {
getAttendanceOverview: (projectId, days) => api.get(`/api/dashboard/attendance-overview/${projectId}?days=${days}`),
getCollectionOverview:(projectId) =>api.get(`/api/Dashboard/collection-overview`)
getCollectionOverview:(projectId) =>api.get(`/api/Dashboard/collection-overview`),
getJobsProgression: (projectId) => api.get(`/api/Dashboard/job/progression${projectId ? `?projectId=${projectId}` : ""}`),
};

View File

@ -258,3 +258,16 @@ export const JOBS_STATUS_IDS = [
label: "On Hold",
},
];
export const BUCKET_BG_CLASSES = [
"bg-label-primary bg-opacity-10",
"bg-label-secondary bg-opacity-10",
"bg-label-success bg-opacity-10",
"bg-label-info bg-opacity-10",
"bg-label-warning bg-opacity-10",
"bg-label-danger bg-opacity-10",
"bg-label-dark bg-opacity-10",
"bg-label-primary bg-opacity-25",
"bg-label-success bg-opacity-25",
"bg-label-info bg-opacity-25",
];