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

This commit is contained in:
Pramod Mahajan 2025-04-16 00:19:30 +05:30
commit bcb273d663
7 changed files with 83 additions and 80 deletions

View File

@ -46,19 +46,23 @@ const HorizontalBarChart = ({
// Replace 0 with 1 for visual purposes, but display "0%" in labels
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 = {
chart: {
type: "bar",
height: 380,
height: chartHeight,
toolbar: { show: false },
},
grid: { show: false },
plotOptions: {
bar: {
barHeight: "60%",
barHeight: seriesData.length === 1 ? "30%" : "60%",
distributed: true,
horizontal: true,
borderRadius: 10,
borderRadius: 3,
borderRadiusApplication: "end",
dataLabels: {
position: "top",
},
@ -70,6 +74,7 @@ const HorizontalBarChart = ({
textAnchor: "center",
style: {
colors: ["#000"], // Black labels
fontSize: "8px",
},
formatter: function (_, opt) {
const originalVal = sortedSeriesData[opt.dataPointIndex]; // Show real value
@ -93,6 +98,9 @@ const HorizontalBarChart = ({
axisBorder: { show: false },
axisTicks: { show: false },
},
legend: {
show: true,
},
tooltip: {
theme: "dark",
x: { show: true },
@ -110,7 +118,7 @@ const HorizontalBarChart = ({
options={chartOptions}
series={[{ data: adjustedSeriesData }]}
type="bar"
height={380}
height={chartHeight}
/>
</div>
);

View File

@ -3,10 +3,11 @@ import ReactApexChart from "react-apexcharts";
import PropTypes from "prop-types";
const LineChart = ({
seriesData = [],
categories = [],
colors = ["#1E90FF", "#FF6347"],
loading = false
seriesData = [],
categories = [],
colors = ["#1E90FF", "#FF6347"],
loading = false,
lineChartCategoriesDates = [],
}) => {
const hasValidData =
Array.isArray(seriesData) &&
@ -100,11 +101,21 @@ const LineChart = ({
tooltip: {
enabled: true,
x: {
formatter: (val, opts) => val
formatter: (value, { dataPointIndex }) => {
if (
lineChartCategoriesDates &&
lineChartCategoriesDates.length > dataPointIndex
) {
return lineChartCategoriesDates[dataPointIndex];
}
return value;
}
}
}
};
return (
<div className="w-full overflow-x-auto">
<ReactApexChart

View File

@ -82,7 +82,13 @@ const Dashboard = () => {
day: "numeric",
})
);
const lineChartCategoriesDates = sortedDashboardData.map((d) =>
new Date(d.date).toLocaleDateString("en-US", {
month: "short",
day: "numeric",
year: "numeric",
})
);
return (
<div className="container-xxl flex-grow-1 container-p-y">
<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-title mb-0 text-start">
<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 className="card-body">
@ -230,13 +236,13 @@ const Dashboard = () => {
</div>
{/* 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) => (
<button
key={key}
className={`border-0 bg-transparent px-2 py-1 text-sm rounded ${
range === key
? "fw-bold border-bottom border-primary text-primary"
? " border-bottom border-primary text-primary"
: "text-muted"
}`}
style={{ cursor: "pointer", transition: "all 0.2s ease" }}
@ -252,6 +258,7 @@ const Dashboard = () => {
seriesData={lineChartSeries}
categories={lineChartCategories}
loading={isLineChartLoading}
lineChartCategoriesDates={lineChartCategoriesDates}
/>
</div>
</div>

View File

@ -36,29 +36,30 @@ const AboutProject = ({ data }) => {
<span className="fw-medium mx-2">Status:</span>{" "}
<span>{ProjectStatus(data.projectStatusId)}</span>
</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-user"></i>
<span className="fw-medium mx-2">Contact:</span>{" "}
<span>{data.contactPerson}</span>
</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">
<i className="bx bx-flag"></i>
<span className="fw-medium mx-2">Address:</span>{" "}
</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">
<span>{data.projectAddress}</span>
</li>

View File

@ -76,59 +76,33 @@ const ProjectBanner = ( {project_data} ) =>
onClose={handleClose}
></ManageProjectInfo>
</div>
{/* -------------------- */}
{/* Project Banner */}
<div className="col-12">
<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="flex-shrink-0 mt-1 mx-sm-0 px-2 mx-auto">
<div className="d-flex align-items-center justify-content-between p-4 flex-wrap">
{/* Left: Icon + Name */}
<div className="d-flex align-items-center gap-3">
<img
src="../../assets/icons/civil-engineering.svg"
alt="user image"
className="d-block h-auto ms-0 ms-sm-6 rounded-3 user-profile-img project-banner-icon"
></img>
className="rounded-3"
style={{ width: "60px", height: "60px" }}
/>
<h4 className="mb-0">
{CurrentProject.name ? CurrentProject.name : "N/A"}
</h4>
</div>
<div className="flex-grow-1 mt-1 mt-lg-1">
<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"}
</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>
<button
{manageProject && (
<button
type="button"
className={`btn btn-sm btn-primary ${!manageProject && 'd-none'}`}
data-bs-toggle="modal"
data-bs-target="#edit-project-modal"
onClick={handleShow}
>
Modify
</button>
</div>
</div>
Modify
</button>
)}
</div>
</div>
</div>

View File

@ -47,7 +47,7 @@ const ProjectNav = ( {onPillClick, activePill} ) =>
<i className="bx bx-grid-alt bx-sm me-1_5"></i> Infrastructure
</a>
</li>
<li className="nav-item">
{/* <li className="nav-item">
<a
className={`nav-link ${
activePill === "workplan" ? "active" : ""
@ -60,7 +60,7 @@ const ProjectNav = ( {onPillClick, activePill} ) =>
>
<i className="bx bx-link bx-sm me-1_5"></i> Work Plan
</a>
</li>
</li> */}
<li className="nav-item">
<a
className={`nav-link ${
@ -78,15 +78,15 @@ const ProjectNav = ( {onPillClick, activePill} ) =>
<li className="nav-item">
<a
className={`nav-link ${
activePill === "activities" ? "active" : ""
activePill === "directory" ? "active" : ""
}`}
href="#"
onClick={(e) => {
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>
</li>
</ul>

View File

@ -28,17 +28,13 @@
"text": "Project Status",
"available": true,
"link": "#"
},
{
"text": "Inventory",
"available": true,
"link": "/inventory"
}
]
},
{
"text": "Activities",
"icon": "bx bx-store",
"icon": "bx bx-list-ul",
"available": true,
"link": "",
"submenu": [
@ -75,7 +71,7 @@
]
},
{
"text": "User Management",
"text": "Administration",
"icon": "bx bx-box",
"available": true,
"link": "",
@ -91,6 +87,12 @@
"link": "/masters"
}
]
},
{
"text": "Inventory",
"icon": "bx bx-store",
"available": true,
"link": "/inventory"
}
]
},