This commit is contained in:
omkieit 2024-10-25 21:10:40 +05:30
parent 7235883646
commit 9ab07ddfc0
8 changed files with 126 additions and 92 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -45,8 +45,8 @@
<script type="module" crossorigin src="/assets/index-CkItAeVW.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
<script type="module" crossorigin src="/assets/index-E_rWKug7.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DUngj0jf.css">
</head>

View File

@ -37,8 +37,8 @@
/* Active tab styling */
.nav-tabs .active {
background-color: #fda417;
border-color: #fda417
background-color: #f5f5f5;
border-color: #f5f5f5
}
.nav-tabs .active a {

View File

@ -12,14 +12,13 @@ import { NavLink } from "react-router-dom";
const Dashboard = () => {
const [activeTab, setActiveTab] = useState("dashboard");
const { user } = useSelector((state) => state.auth);
const renderTabContent = () => {
switch (activeTab) {
case "Userdetails":
return <UserProfile />;
case "addProperty":
return <Addproperty />;
case "activeProperties":
return (
<div>
@ -29,7 +28,6 @@ const Dashboard = () => {
);
case "closedProperties":
return <p>These are your closed properties.</p>;
default:
return <></>;
}
@ -38,31 +36,24 @@ const Dashboard = () => {
return (
<>
<Navbar />
<br />
<br />
<br />
<br />
<br />
<br />
<div className="d-flex flex-row">
<br /> <br /> <br /> <br /> <br />
<div className="d-flex" style={{ margin: "0", padding: "0" }}>
{/* Left sidebar */}
<div className="col-md-3">
<div className="col-md-3 p-1" style={{ paddingRight: "2px", margin: "0" }}>
<div className="card card1 p-5">
<img
className="img-fluid"
src={user.result.profileImage || profilepic}
alt="ProfileImage"
style={{
marginTop: "0px",
maxWidth: "200px",
maxHeight: "200px",
maxWidth: "250px",
maxHeight: "250px",
}}
/>
<hr className="hline" />
<div className="d-flex flex-column align-items-center">
<button
className={`btn ${activeTab === "dashboard" ? "active" : ""}`}
// style={{ backgroundColor: "#fda417", border: "#fda417" }}
onClick={() => setActiveTab("dashboard")}
>
<i className="fa fa-dashboard" style={{ color: "#F74B02" }} />
@ -106,35 +97,29 @@ const Dashboard = () => {
<span className="fa fa-home" style={{ color: "#F74B02" }} />
<span>Closed Properties</span>
</button>
{/* <span className="other mt-4">Other Information</span>
<button className="btn mt-3">
<i className="fa fa-book" />
<span>Knowledge</span>
</button> */}
</div>
</div>
</div>
{/* Main content area */}
<div className="col-md-9">
<div className="card card2 p-1">
{/* Static Dashboard greeting */}
<br />
<div className="col-md-9 p-1" style={{ paddingLeft: "2px", margin: "0" }}>
<div className="card card2 p-2">
<span>
<br />
Welcome to{" "}
<span style={{ color: "#067ADC" }}>
<NavLink
to={`/profile/${user.result.userId}`}
className="link-primary text-decoration-none"
target="_blank"
>
{user.result.title}. {user.result.firstName}{" "}
{user.result.middleName} {user.result.lastName}
</NavLink>
</span>
</span>
<br /> <br /> <br /> <br />
{activeTab === "dashboard" && (
<>
<br />
<div className="banner_taital">
<h1 style={{ color: "#fda417", fontSize: "30px",
padding: "10px",
@ -156,14 +141,11 @@ const Dashboard = () => {
workflows{" "}</h1>
</h1>
<br /> <br /> <br /> <br /> <br />
<br /> <br /> <br /> <br /> <br /><br />
</div>
</>
)}
<br />
{/* Dynamic content based on the selected tab */}
{renderTabContent()}
</div>
</div>

View File

@ -9,6 +9,7 @@ import { Modal, Button, Form } from "react-bootstrap"; // Importing Modal compon
import { addFundDetails } from "../redux/features/propertySlice";
import { toast } from "react-toastify";
import { deleteFundDetail } from "../redux/features/propertySlice";
import "../propertyview.css";
const PropertyView = () => {
const { id } = useParams(); // Extract the property ID from the route
@ -72,8 +73,26 @@ const PropertyView = () => {
const handleSubmit = (e) => {
e.preventDefault();
if (formData.fundValue <= 0 || formData.fundPercentage <= 0) {
return toast.error("Please enter valid funding details");
// if (
// formData.fundValue <= 0 ||
// formData.fundPercentage <= 0 ||
// formData.fundPercentage > 100
// ) {
// return toast.error("Please enter a valid funding amount and percentage (0-100)");
// }
if (formData.fundValue <= 0) {
return toast.error("Please enter a valid funding amount greater than 0");
}
if (
formData.fundValue > (selectedProperty?.totalCoststoBuyAtoB || 0)
) {
return toast.error(`Funding amount cannot exceed ${selectedProperty?.totalCoststoBuyAtoB || "N/A"}`);
}
if (formData.fundPercentage <= 0 || formData.fundPercentage > 100) {
return toast.error("Please enter a valid interest percentage (0-100)");
}
const fundDetails = {
@ -90,21 +109,29 @@ const PropertyView = () => {
// dispatch(deleteFundDetail({ id, fundDetailId }));
// };
const handleDelete = (fundDetailId) => {
const token = JSON.parse(localStorage.getItem("profile")).token;
dispatch(deleteFundDetail({ id, fundDetailId, token }));
};
const handleDeleteWithConfirmation = (id) => {
const confirmed = window.confirm("Are you sure you want to delete this?");
if (confirmed) {
handleDelete(id);
}
};
return (
<>
<Navbar />
<br /> <br /> <br /> <br />
<br /> <br />
<div className="container tabs-wrap col-12">
<Navbar />
<br /> <br /> <br /> <br /><br />
<ul className="nav nav-tabs" role="tablist">
{/* <div className="container tabs-wrap col-12"> */}
<div>
<ul className="nav nav-tabs" role="tablist" style={{borderRadius: "12px 12px 0 0"}}>
<li
role="presentation"
className={activeTab === "propertydetails" ? "active tab" : "tab"}
@ -132,7 +159,8 @@ const PropertyView = () => {
</li>
</ul>
<div className="tab-content">
{/* <div className="tab-content"> */}
<div>
{activeTab === "propertydetails" && (
<div
role="tabpanel"
@ -392,29 +420,33 @@ const PropertyView = () => {
{selectedProperty.fundDetails.length === 0 ? (
<p>No fund details available.</p>
) : (
<ul>
<ul style={{ listStyleType: "none", padding: 0 }}>
{selectedProperty.fundDetails.map((detail, index) => (
<li key={index}>
Fund Value: {detail.fundValue}, Fund Percentage:{" "}
{detail.fundPercentage}%
{user?.result?.userId ? (
<div>
{user?.result?._id === detail.userId && (
<li key={index} className="d-flex align-items-center">
<div className="d-flex align-items-center">
<span>
Total Fund Value: {detail.fundValue}, Interest Percentage: {detail.fundPercentage}%
</span>
<br /> <br />
{user?.result?.userId && user?.result?._id === detail.userId && (
<button
onClick={() => handleDelete(detail._id)}
className="btn btn-danger ms-2"
// onClick={() => handleDelete(detail._id)}
onClick={() => handleDeleteWithConfirmation(detail._id)}
style={{ padding: "2px 10px", marginLeft: "8px" }}
>
Delete
x
</button>
)}
</div>
) : (
<div></div>
)}
</li>
))}
</ul>
)}
</div>
</div>
</div>
)}
</div>
@ -432,7 +464,7 @@ const PropertyView = () => {
<Modal.Body>
<Form onSubmit={handleSubmit}>
<Form.Group>
<Form.Label>Fund Value</Form.Label>
<Form.Label>Total Fund Value</Form.Label>
<Form.Control
type="number"
id="fundValue"
@ -441,8 +473,9 @@ const PropertyView = () => {
onChange={handleChange}
/>
</Form.Group>
<br />
<Form.Group>
<Form.Label>Fund Percentage</Form.Label>
<Form.Label>Interest Percentage</Form.Label>
<Form.Control
type="number"
id="fundPercentage"

View File

@ -51,3 +51,4 @@ body{
.shadow-none {
box-shadow: none!important;
}

View File

@ -0,0 +1,18 @@
/* Base tab styling */
.nav-tabs .tab a {
display: inline-block;
padding: 10px 20px;
text-decoration: none;
color: #333;
border: 1px solid #ddd;
border-radius: 20px 20px 0 0; /* Rounded top, square bottom */
margin-right: 5px;
}
/* Active tab styling */
.nav-tabs .tab.active a {
background-color: #fd8b2c;
color: #fff;
border-bottom-color: transparent; /* Hide bottom border for active tab */
}