pramod_Bug-#433 :Show "No Contact Found" Message When Directory Is Empty #177

Merged
vikas.nale merged 2 commits from pramod_Bug-#433 into Feature_Directory 2025-06-03 11:50:29 +00:00
Showing only changes of commit f92ef4e52a - Show all commits

View File

@ -338,10 +338,19 @@ const handleDeleteContact = async (overrideId = null) => {
IsActive={IsActive} IsActive={IsActive}
setOpenBucketModal={setOpenBucketModal} setOpenBucketModal={setOpenBucketModal}
/> />
{!listView && loading && <p>Loading...</p>}
{!listView && !loading && currentItems.length == 0 && ( {/* Messages when listView is false */}
<p>No Matching Contact Found</p> {!listView && (
<div className="d-flex flex-column justify-content-center align-items-center text-center card-minHeight">
{loading && <p>Loading...</p>}
{!loading && contacts?.length === 0 && <p>No contact found</p>}
{!loading && contacts?.length > 0 && currentItems.length === 0 && (
<p>No matching contact found</p>
)} )}
</div>
)}
{/* Table view (listView === true) */}
{listView ? ( {listView ? (
<DirectoryListTableHeader> <DirectoryListTableHeader>
{loading && ( {loading && (
@ -349,11 +358,19 @@ const handleDeleteContact = async (overrideId = null) => {
<td colSpan={10}>Loading...</td> <td colSpan={10}>Loading...</td>
</tr> </tr>
)} )}
{!loading && currentItems.length === 0 && (
<tr> {!loading && contacts?.length === 0 && (
<td colSpan={10}>No Matching Contact Found</td> <tr >
<td colSpan={10}>No contact found</td>
</tr> </tr>
)} )}
{!loading && currentItems.length === 0 && contacts?.length > 0 && (
<tr>
<td colSpan={10}>No matching contact found</td>
</tr>
)}
{!loading && {!loading &&
currentItems.map((contact) => ( currentItems.map((contact) => (
<ListViewDirectory <ListViewDirectory
@ -371,7 +388,8 @@ const handleDeleteContact = async (overrideId = null) => {
</DirectoryListTableHeader> </DirectoryListTableHeader>
) : ( ) : (
<div className="row"> <div className="row">
{!loading && currentItems.map((contact, index) => ( {!loading &&
currentItems.map((contact) => (
<div <div
key={contact.id} key={contact.id}
className="col-12 col-sm-6 col-md-4 col-lg-4 mb-4" className="col-12 col-sm-6 col-md-4 col-lg-4 mb-4"
@ -391,14 +409,13 @@ const handleDeleteContact = async (overrideId = null) => {
</div> </div>
)} )}
{/* Pagination */}
{!loading &&
{!loading && currentItems < ITEMS_PER_PAGE && ( contacts?.length > 0 &&
<nav aria-label="Page "> currentItems.length < ITEMS_PER_PAGE && (
<nav aria-label="Page navigation">
<ul className="pagination pagination-sm justify-content-end py-1"> <ul className="pagination pagination-sm justify-content-end py-1">
<li <li className={`page-item ${currentPage === 1 ? "disabled" : ""}`}>
className={`page-item ${currentPage === 1 ? "disabled" : ""}`}
>
<button <button
className="page-link btn-xs" className="page-link btn-xs"
onClick={() => paginate(currentPage - 1)} onClick={() => paginate(currentPage - 1)}
@ -406,6 +423,7 @@ const handleDeleteContact = async (overrideId = null) => {
&laquo; &laquo;
</button> </button>
</li> </li>
{[...Array(totalPages)].map((_, index) => ( {[...Array(totalPages)].map((_, index) => (
<li <li
key={index} key={index}
@ -414,20 +432,21 @@ const handleDeleteContact = async (overrideId = null) => {
}`} }`}
> >
<button <button
className="page-link " className="page-link"
onClick={() => paginate(index + 1)} onClick={() => paginate(index + 1)}
> >
{index + 1} {index + 1}
</button> </button>
</li> </li>
))} ))}
<li <li
className={`page-item ${ className={`page-item ${
currentPage === totalPages ? "disabled" : "" currentPage === totalPages ? "disabled" : ""
}`} }`}
> >
<button <button
className="page-link " className="page-link"
onClick={() => paginate(currentPage + 1)} onClick={() => paginate(currentPage + 1)}
> >
&raquo; &raquo;
@ -436,7 +455,9 @@ const handleDeleteContact = async (overrideId = null) => {
</ul> </ul>
</nav> </nav>
)} )}
</div> </div>
</div> </div>
); );
}; };