This commit is contained in:
omkieit 2024-09-22 19:30:31 +05:30
parent 7be342c671
commit 8b3aa8c793
8 changed files with 229 additions and 106 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-BbUOB2Bi.js"></script> <script type="module" crossorigin src="/assets/index-CcowhcXT.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BtU0nZSp.css"> <link rel="stylesheet" crossorigin href="/assets/index-CAj3mSy-.css">
</head> </head>

View File

@ -18,8 +18,6 @@ import Services from "./components/Services";
import PropertyMysqlView from "./components/PropertyMysqlView"; import PropertyMysqlView from "./components/PropertyMysqlView";
import EditProperty from "./components/EditProperty"; import EditProperty from "./components/EditProperty";
const App = () => { const App = () => {
return ( return (
<BrowserRouter> <BrowserRouter>
@ -64,17 +62,7 @@ const App = () => {
<Route path="/properties/:house_id" element={<PropertyMysqlView />} /> <Route path="/properties/:house_id" element={<PropertyMysqlView />} />
<Route path="/searchmyproperties" element={<SearchMysql />} /> <Route path="/searchmyproperties" element={<SearchMysql />} />
<Route path="/editproperty/:id" element={<EditProperty />} />
<Route
path="/editproperty/:id"
element={
<EditProperty />
}
/>
</Routes> </Routes>
</BrowserRouter> </BrowserRouter>
); );

View File

@ -156,20 +156,20 @@ const Dashboard = () => {
{/* Main content area */} {/* Main content area */}
<div className="col-md-9"> <div className="col-md-9">
<div className="card card2 p-0"> <div className="card card2 p-1">
{/* Static Dashboard greeting */} {/* Static Dashboard greeting */}
<div className="hello d-flex justify-content-end align-items-center mt-3"> <br />
<span> <span>
Welcome to{" "} Welcome to{" "}
<span style={{ color: "#067ADC" }}> <span style={{ color: "#067ADC" }}>
{user.result.title}. {user.result.firstName} {user.result.middleName} {user.result.lastName} {user.result.title}. {user.result.firstName} {user.result.middleName} {user.result.lastName}
</span> </span>
</span> </span>
<br /> <br /> <br /> <br />
</div>
{/* Dynamic content based on the selected tab */} {/* Dynamic content based on the selected tab */}
<div className="tab-content p-3"> <div className="tab-content p-2">
{renderTabContent()} {renderTabContent()}
</div> </div>
</div> </div>

View File

@ -36,6 +36,7 @@ const PropertyMysqlView = () => {
<> <>
<Navbar /> <Navbar />
<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
<div className="container col-12"> <div className="container col-12">
{loading ? ( {loading ? (
<div className="loader">Loading...</div> // Loader <div className="loader">Loading...</div> // Loader

View File

@ -2,13 +2,12 @@ import { useEffect, useState } from "react";
import { useSelector, useDispatch } from "react-redux"; import { useSelector, useDispatch } from "react-redux";
import { fetchUserProperties } from "../redux/features/propertySlice"; import { fetchUserProperties } from "../redux/features/propertySlice";
import { NavLink } from "react-router-dom"; import { NavLink } from "react-router-dom";
import propertydummy from "../img/propertydummy.jpg";
const UserProperties = () => { const UserProperties = () => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const { user } = useSelector((state) => ({ ...state.auth })); const { user } = useSelector((state) => ({ ...state.auth }));
const { userProperties, totalPages } = useSelector( const { userProperties, totalPages } = useSelector((state) => state.property);
(state) => state.property
);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const limit = 5; // Number of properties per page const limit = 5; // Number of properties per page
@ -16,56 +15,146 @@ const UserProperties = () => {
// Fetch user properties when "Active Properties" tab is selected // Fetch user properties when "Active Properties" tab is selected
useEffect(() => { useEffect(() => {
dispatch(fetchUserProperties({ userId: user.result.userId, page, limit })); dispatch(fetchUserProperties({ userId: user.result.userId, page, limit }));
},[dispatch, user?.result?.userId, page]); }, [dispatch, user?.result?.userId, page]);
// Pagination handler // Pagination handler
const handlePageChange = (newPage) => { const handlePageChange = (newPage) => {
setPage(newPage); setPage(newPage);
}; };
return ( return (
<> <>
{userProperties.length > 0 ? ( {userProperties.length > 0 ? (
<> <>
<ul> <ul>
{userProperties.map((property) => ( {userProperties.map((property) => (
<li key={property._id}> <li key={property._id}>
<NavLink <div className="container">
to={`/property/${property.propertyId}`} <div className="col-md-12">
target="_blank" <div className="row p-2 bg-white border rounded mt-2">
> <div className="col-md-3 mt-1">
{property.title} <img
{"....."} src={propertydummy}
</NavLink> className="w-70"
alt="Img"
style={{
marginTop: "0px",
maxWidth: "200px",
maxHeight: "200px",
}}
/>
</div>
<div className="col-md-6 mt-1">
<h5>
{" "}
<NavLink
to={`/property/${property.propertyId}`}
target="_blank"
>
{property.title}
{"....."}
</NavLink>
</h5>
<div className="d-flex flex-row"></div>
<div className="mt-1 mb-1 spec-1">
<span>100% cotton</span>
<span className="dot" />
<span>Light weight</span>
<span className="dot" />
<span>
Best finish
<br />
</span>
</div>
<div className="mt-1 mb-1 spec-1">
<span>Unique design</span>
<span className="dot" />
<span>For men</span>
<span className="dot" />
<span>
Casual
<br />
</span>
</div>
<p className="text-justify text-truncate para mb-0">
There are many variations of passages of
<br />
<br />
</p>
</div>
<div className="align-items-center align-content-center col-md-3 border-left mt-1">
{/* <div className="d-flex flex-row align-items-center">
<h4 className="mr-1">$14.99</h4>
<span className="strike-text">$20.99</span>
</div>
<h6 className="text-success">Free shipping</h6> */}
<div className="d-flex flex-column mt-4">
<NavLink
to={`/property/${property.propertyId}`}
target="_blank"
>
<button
className="btn btn-outline-primary btn-sm mt-2"
type="button"
style={{
backgroundColor: "#fda417",
border: "#fda417",
}}
>
<span
className="fa fa-eye"
style={{ color: "#F74B02" }}
/>{" "}
{" "}
View Details
</button>
</NavLink>
<NavLink <NavLink
to={`/editproperty/${property.propertyId}`} to={`/editproperty/${property.propertyId}`}
target="_blank" target="_blank"
> >
Edit <button
{"....."} className="btn btn-outline-primary btn-sm mt-2"
</NavLink> type="button"
</li> style={{
))} backgroundColor: "#fda417",
</ul> border: "#fda417",
}}
>
<span
className="fa fa-edit"
style={{ color: "#F74B02" }}
/>{" "}
{" "}
Edit Details ..
</button>
</NavLink>
</div>
</div>
</div>
</div>
</div>
</li>
))}
</ul>
{/* Pagination Controls */} {/* Pagination Controls */}
<div className="pagination"> <div className="pagination">
<button <button
onClick={() => handlePageChange(page - 1)} onClick={() => handlePageChange(page - 1)}
disabled={page === 1} disabled={page === 1}
> >
Previous Previous
</button> </button>
{/* Show page numbers */} {/* Show page numbers */}
{Array.from({ length: totalPages }, (_, index) => index + 1).map( {Array.from({ length: totalPages }, (_, index) => index + 1).map(
(pageNumber) => (pageNumber) =>
pageNumber === page || // Current page pageNumber === page || // Current page
pageNumber === 1 || // First page pageNumber === 1 || // First page
pageNumber === totalPages || // Last page pageNumber === totalPages || // Last page
(pageNumber >= page - 1 && pageNumber <= page + 1) // Pages near current page (pageNumber >= page - 1 && pageNumber <= page + 1) ? ( // Pages near current page
? (
<button <button
key={pageNumber} key={pageNumber}
onClick={() => handlePageChange(pageNumber)} onClick={() => handlePageChange(pageNumber)}
@ -73,24 +162,23 @@ const UserProperties = () => {
> >
{pageNumber} {pageNumber}
</button> </button>
) ) : pageNumber === 2 || pageNumber === totalPages - 1 ? ( // Add "..." between non-adjacent pages
: pageNumber === 2 || pageNumber === totalPages - 1 // Add "..." between non-adjacent pages <span key={pageNumber}>...</span>
? <span key={pageNumber}>...</span> ) : null
: null )}
)}
<button <button
onClick={() => handlePageChange(page + 1)} onClick={() => handlePageChange(page + 1)}
disabled={page === totalPages} disabled={page === totalPages}
> >
Next Next
</button> </button>
</div> </div>
</> </>
) : ( ) : (
<p>No active properties found.</p> <p>No active properties found.</p>
)} )}
</> </>
); );
}; };

View File

@ -1,11 +1,57 @@
.btn.active { .btn.active {
background-color: #fda417; /* Highlight color for the active tab */ background-color: #fda417;
color: #fff; /* Text color for the active tab */ /* Highlight color for the active tab */
color: #fff;
/* Text color for the active tab */
border: 1px solid #fda417; border: 1px solid #fda417;
} }
body {
background: #eee
}
.ratings i {
font-size: 16px;
color: red
}
.strike-text {
color: red;
text-decoration: line-through
}
.product-image {
width: 100%
}
.dot {
height: 7px;
width: 7px;
margin-left: 6px;
margin-right: 6px;
margin-top: 3px;
background-color: #fda417;
border-radius: 50%;
display: inline-block
}
.spec-1 {
color: #938787;
font-size: 15px
}
h5 {
font-weight: 400
}
.para {
font-size: 16px
}
/* /*