Merge branch 'Feature_Task_Management' of https://git.marcoaiot.com/admin/marco.pms.web into Feature_Task_Management
This commit is contained in:
commit
bcb273d663
@ -46,19 +46,23 @@ const HorizontalBarChart = ({
|
|||||||
// Replace 0 with 1 for visual purposes, but display "0%" in labels
|
// Replace 0 with 1 for visual purposes, but display "0%" in labels
|
||||||
const adjustedSeriesData = sortedSeriesData.map(val => (val === 0 ? 1 : val));
|
const adjustedSeriesData = sortedSeriesData.map(val => (val === 0 ? 1 : val));
|
||||||
|
|
||||||
|
// Dynamically adjust chart height if only one data point
|
||||||
|
const chartHeight = seriesData.length === 1 ? 80 : 380;
|
||||||
|
|
||||||
const chartOptions = {
|
const chartOptions = {
|
||||||
chart: {
|
chart: {
|
||||||
type: "bar",
|
type: "bar",
|
||||||
height: 380,
|
height: chartHeight,
|
||||||
toolbar: { show: false },
|
toolbar: { show: false },
|
||||||
},
|
},
|
||||||
grid: { show: false },
|
grid: { show: false },
|
||||||
plotOptions: {
|
plotOptions: {
|
||||||
bar: {
|
bar: {
|
||||||
barHeight: "60%",
|
barHeight: seriesData.length === 1 ? "30%" : "60%",
|
||||||
distributed: true,
|
distributed: true,
|
||||||
horizontal: true,
|
horizontal: true,
|
||||||
borderRadius: 10,
|
borderRadius: 3,
|
||||||
|
borderRadiusApplication: "end",
|
||||||
dataLabels: {
|
dataLabels: {
|
||||||
position: "top",
|
position: "top",
|
||||||
},
|
},
|
||||||
@ -70,6 +74,7 @@ const HorizontalBarChart = ({
|
|||||||
textAnchor: "center",
|
textAnchor: "center",
|
||||||
style: {
|
style: {
|
||||||
colors: ["#000"], // Black labels
|
colors: ["#000"], // Black labels
|
||||||
|
fontSize: "8px",
|
||||||
},
|
},
|
||||||
formatter: function (_, opt) {
|
formatter: function (_, opt) {
|
||||||
const originalVal = sortedSeriesData[opt.dataPointIndex]; // Show real value
|
const originalVal = sortedSeriesData[opt.dataPointIndex]; // Show real value
|
||||||
@ -93,6 +98,9 @@ const HorizontalBarChart = ({
|
|||||||
axisBorder: { show: false },
|
axisBorder: { show: false },
|
||||||
axisTicks: { show: false },
|
axisTicks: { show: false },
|
||||||
},
|
},
|
||||||
|
legend: {
|
||||||
|
show: true,
|
||||||
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
x: { show: true },
|
x: { show: true },
|
||||||
@ -110,7 +118,7 @@ const HorizontalBarChart = ({
|
|||||||
options={chartOptions}
|
options={chartOptions}
|
||||||
series={[{ data: adjustedSeriesData }]}
|
series={[{ data: adjustedSeriesData }]}
|
||||||
type="bar"
|
type="bar"
|
||||||
height={380}
|
height={chartHeight}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,7 +6,8 @@ const LineChart = ({
|
|||||||
seriesData = [],
|
seriesData = [],
|
||||||
categories = [],
|
categories = [],
|
||||||
colors = ["#1E90FF", "#FF6347"],
|
colors = ["#1E90FF", "#FF6347"],
|
||||||
loading = false
|
loading = false,
|
||||||
|
lineChartCategoriesDates = [],
|
||||||
}) => {
|
}) => {
|
||||||
const hasValidData =
|
const hasValidData =
|
||||||
Array.isArray(seriesData) &&
|
Array.isArray(seriesData) &&
|
||||||
@ -100,11 +101,21 @@ const LineChart = ({
|
|||||||
tooltip: {
|
tooltip: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
x: {
|
x: {
|
||||||
formatter: (val, opts) => val
|
formatter: (value, { dataPointIndex }) => {
|
||||||
|
if (
|
||||||
|
lineChartCategoriesDates &&
|
||||||
|
lineChartCategoriesDates.length > dataPointIndex
|
||||||
|
) {
|
||||||
|
return lineChartCategoriesDates[dataPointIndex];
|
||||||
|
}
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full overflow-x-auto">
|
<div className="w-full overflow-x-auto">
|
||||||
<ReactApexChart
|
<ReactApexChart
|
||||||
|
|||||||
@ -82,7 +82,13 @@ const Dashboard = () => {
|
|||||||
day: "numeric",
|
day: "numeric",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
const lineChartCategoriesDates = sortedDashboardData.map((d) =>
|
||||||
|
new Date(d.date).toLocaleDateString("en-US", {
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
year: "numeric",
|
||||||
|
})
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<div className="container-xxl flex-grow-1 container-p-y">
|
<div className="container-xxl flex-grow-1 container-p-y">
|
||||||
<div className="row gy-4">
|
<div className="row gy-4">
|
||||||
@ -168,7 +174,7 @@ const Dashboard = () => {
|
|||||||
<div className="card-header d-flex align-items-start justify-content-between">
|
<div className="card-header d-flex align-items-start justify-content-between">
|
||||||
<div className="card-title mb-0 text-start">
|
<div className="card-title mb-0 text-start">
|
||||||
<h5 className="mb-1">Projects</h5>
|
<h5 className="mb-1">Projects</h5>
|
||||||
<p className="card-subtitle">Total Projects Overview</p>
|
<p className="card-subtitle">Projects Completion Status</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
@ -230,13 +236,13 @@ const Dashboard = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Row 2: Time Range Buttons */}
|
{/* Row 2: Time Range Buttons */}
|
||||||
<div className="d-flex flex-wrap gap-2 mt-2">
|
<div className="d-flex flex-wrap mt-2">
|
||||||
{["1D", "1W", "15D", "1M", "3M", "1Y", "5Y"].map((key) => (
|
{["1D", "1W", "15D", "1M", "3M", "1Y", "5Y"].map((key) => (
|
||||||
<button
|
<button
|
||||||
key={key}
|
key={key}
|
||||||
className={`border-0 bg-transparent px-2 py-1 text-sm rounded ${
|
className={`border-0 bg-transparent px-2 py-1 text-sm rounded ${
|
||||||
range === key
|
range === key
|
||||||
? "fw-bold border-bottom border-primary text-primary"
|
? " border-bottom border-primary text-primary"
|
||||||
: "text-muted"
|
: "text-muted"
|
||||||
}`}
|
}`}
|
||||||
style={{ cursor: "pointer", transition: "all 0.2s ease" }}
|
style={{ cursor: "pointer", transition: "all 0.2s ease" }}
|
||||||
@ -252,6 +258,7 @@ const Dashboard = () => {
|
|||||||
seriesData={lineChartSeries}
|
seriesData={lineChartSeries}
|
||||||
categories={lineChartCategories}
|
categories={lineChartCategories}
|
||||||
loading={isLineChartLoading}
|
loading={isLineChartLoading}
|
||||||
|
lineChartCategoriesDates={lineChartCategoriesDates}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -36,29 +36,30 @@ const AboutProject = ({ data }) => {
|
|||||||
<span className="fw-medium mx-2">Status:</span>{" "}
|
<span className="fw-medium mx-2">Status:</span>{" "}
|
||||||
<span>{ProjectStatus(data.projectStatusId)}</span>
|
<span>{ProjectStatus(data.projectStatusId)}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
|
||||||
<small className="card-text text-uppercase text-muted small">
|
|
||||||
Contacts
|
|
||||||
</small>
|
|
||||||
<ul className="list-unstyled my-3 py-1">
|
|
||||||
<li className="d-flex align-items-center mb-4">
|
<li className="d-flex align-items-center mb-4">
|
||||||
<i className="bx bx-user"></i>
|
<i className="bx bx-user"></i>
|
||||||
<span className="fw-medium mx-2">Contact:</span>{" "}
|
<span className="fw-medium mx-2">Contact:</span>{" "}
|
||||||
<span>{data.contactPerson}</span>
|
<span>{data.contactPerson}</span>
|
||||||
</li>
|
</li>
|
||||||
<li className="d-flex align-items-center mb-4">
|
|
||||||
<i className="bx bx-phone"></i>
|
|
||||||
<span className="fw-medium mx-2">Contact Number:</span>{" "}
|
|
||||||
<span>NA</span>
|
|
||||||
</li>
|
|
||||||
<li className="d-flex align-items-center mb-4">
|
|
||||||
<i className="bx bx-envelope"></i>
|
|
||||||
<span className="fw-medium mx-2">Email:</span> <span>NA</span>
|
|
||||||
</li>
|
|
||||||
<li className="d-flex align-items-center mb-4">
|
<li className="d-flex align-items-center mb-4">
|
||||||
<i className="bx bx-flag"></i>
|
<i className="bx bx-flag"></i>
|
||||||
<span className="fw-medium mx-2">Address:</span>{" "}
|
<span className="fw-medium mx-2">Address:</span>{" "}
|
||||||
</li>
|
</li>
|
||||||
|
</ul>
|
||||||
|
{/* <small className="card-text text-uppercase text-muted small">
|
||||||
|
Contacts
|
||||||
|
</small> */}
|
||||||
|
<ul className="list-unstyled my-3 py-1">
|
||||||
|
|
||||||
|
{/* <li className="d-flex align-items-center mb-4">
|
||||||
|
<i className="bx bx-phone"></i>
|
||||||
|
<span className="fw-medium mx-2">Contact Number:</span>{" "}
|
||||||
|
<span>NA</span>
|
||||||
|
</li> */}
|
||||||
|
{/* <li className="d-flex align-items-center mb-4">
|
||||||
|
<i className="bx bx-envelope"></i>
|
||||||
|
<span className="fw-medium mx-2">Email:</span> <span>NA</span>
|
||||||
|
</li> */}
|
||||||
<li className="d-flex align-items-start test-start mb-4">
|
<li className="d-flex align-items-start test-start mb-4">
|
||||||
<span>{data.projectAddress}</span>
|
<span>{data.projectAddress}</span>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -76,48 +76,23 @@ const ProjectBanner = ( {project_data} ) =>
|
|||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
></ManageProjectInfo>
|
></ManageProjectInfo>
|
||||||
</div>
|
</div>
|
||||||
{/* -------------------- */}
|
{/* Project Banner */}
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<div className="card mb-6 pb-0">
|
<div className="card mb-6 pb-0">
|
||||||
<div className="user-profile-header d-flex flex-column flex-lg-row text-sm-start text-center mb-2 ">
|
<div className="d-flex align-items-center justify-content-between p-4 flex-wrap">
|
||||||
<div className="flex-shrink-0 mt-1 mx-sm-0 px-2 mx-auto">
|
{/* Left: Icon + Name */}
|
||||||
|
<div className="d-flex align-items-center gap-3">
|
||||||
<img
|
<img
|
||||||
src="../../assets/icons/civil-engineering.svg"
|
src="../../assets/icons/civil-engineering.svg"
|
||||||
alt="user image"
|
alt="user image"
|
||||||
className="d-block h-auto ms-0 ms-sm-6 rounded-3 user-profile-img project-banner-icon"
|
className="rounded-3"
|
||||||
></img>
|
style={{ width: "60px", height: "60px" }}
|
||||||
</div>
|
/>
|
||||||
<div className="flex-grow-1 mt-1 mt-lg-1">
|
<h4 className="mb-0">
|
||||||
<div className="d-flex align-items-md-end align-items-sm-start align-items-center justify-content-md-between justify-content-start mx-5 flex-md-row flex-column gap-4">
|
|
||||||
<div className="user-profile-info">
|
|
||||||
<h4 className="mb-2 mt-lg-1">
|
|
||||||
{CurrentProject.name ? CurrentProject.name : "N/A"}
|
{CurrentProject.name ? CurrentProject.name : "N/A"}
|
||||||
</h4>
|
</h4>
|
||||||
<h6 className="mb-1 mt-lg-1">
|
|
||||||
Address:{" "}
|
|
||||||
{CurrentProject.projectAddress ? CurrentProject.projectAddress : "N/A"}
|
|
||||||
</h6>
|
|
||||||
<h6 className="mb-1 mt-lg-1">
|
|
||||||
Contact:{" "}
|
|
||||||
{CurrentProject.contactPerson ? CurrentProject.contactPerson : "N/A"}
|
|
||||||
</h6>
|
|
||||||
<h6 className="mb-1 mt-lg-1">
|
|
||||||
<span>
|
|
||||||
{" "}
|
|
||||||
Start Date:{" "}
|
|
||||||
{CurrentProject.startDate
|
|
||||||
? moment(CurrentProject.startDate).format("DD-MMM-YYYY")
|
|
||||||
: "N/A"}
|
|
||||||
</span>
|
|
||||||
<span className="ms-5">
|
|
||||||
End Date:{" "}
|
|
||||||
{CurrentProject.endDate
|
|
||||||
? moment(CurrentProject.endDate).format("DD-MMM-YYYY")
|
|
||||||
: "N/A"}
|
|
||||||
</span>
|
|
||||||
</h6>
|
|
||||||
</div>
|
</div>
|
||||||
|
{manageProject && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`btn btn-sm btn-primary ${!manageProject && 'd-none'}`}
|
className={`btn btn-sm btn-primary ${!manageProject && 'd-none'}`}
|
||||||
@ -127,8 +102,7 @@ const ProjectBanner = ( {project_data} ) =>
|
|||||||
>
|
>
|
||||||
Modify
|
Modify
|
||||||
</button>
|
</button>
|
||||||
</div>
|
)}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -47,7 +47,7 @@ const ProjectNav = ( {onPillClick, activePill} ) =>
|
|||||||
<i className="bx bx-grid-alt bx-sm me-1_5"></i> Infrastructure
|
<i className="bx bx-grid-alt bx-sm me-1_5"></i> Infrastructure
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item">
|
{/* <li className="nav-item">
|
||||||
<a
|
<a
|
||||||
className={`nav-link ${
|
className={`nav-link ${
|
||||||
activePill === "workplan" ? "active" : ""
|
activePill === "workplan" ? "active" : ""
|
||||||
@ -60,7 +60,7 @@ const ProjectNav = ( {onPillClick, activePill} ) =>
|
|||||||
>
|
>
|
||||||
<i className="bx bx-link bx-sm me-1_5"></i> Work Plan
|
<i className="bx bx-link bx-sm me-1_5"></i> Work Plan
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li> */}
|
||||||
<li className="nav-item">
|
<li className="nav-item">
|
||||||
<a
|
<a
|
||||||
className={`nav-link ${
|
className={`nav-link ${
|
||||||
@ -78,15 +78,15 @@ const ProjectNav = ( {onPillClick, activePill} ) =>
|
|||||||
<li className="nav-item">
|
<li className="nav-item">
|
||||||
<a
|
<a
|
||||||
className={`nav-link ${
|
className={`nav-link ${
|
||||||
activePill === "activities" ? "active" : ""
|
activePill === "directory" ? "active" : ""
|
||||||
}`}
|
}`}
|
||||||
href="#"
|
href="#"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault(); // Prevent page reload
|
e.preventDefault(); // Prevent page reload
|
||||||
onPillClick("activities");
|
onPillClick("directory");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<i className="bx bx-link bx-sm me-1_5"></i> Activities
|
<i className="bx bx-link bx-sm me-1_5"></i> Directory
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@ -28,17 +28,13 @@
|
|||||||
"text": "Project Status",
|
"text": "Project Status",
|
||||||
"available": true,
|
"available": true,
|
||||||
"link": "#"
|
"link": "#"
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Inventory",
|
|
||||||
"available": true,
|
|
||||||
"link": "/inventory"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "Activities",
|
"text": "Activities",
|
||||||
"icon": "bx bx-store",
|
"icon": "bx bx-list-ul",
|
||||||
"available": true,
|
"available": true,
|
||||||
"link": "",
|
"link": "",
|
||||||
"submenu": [
|
"submenu": [
|
||||||
@ -75,7 +71,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "User Management",
|
"text": "Administration",
|
||||||
"icon": "bx bx-box",
|
"icon": "bx bx-box",
|
||||||
"available": true,
|
"available": true,
|
||||||
"link": "",
|
"link": "",
|
||||||
@ -91,6 +87,12 @@
|
|||||||
"link": "/masters"
|
"link": "/masters"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "Inventory",
|
||||||
|
"icon": "bx bx-store",
|
||||||
|
"available": true,
|
||||||
|
"link": "/inventory"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user