Fix loading error. Hide existing content and then show loading

This commit is contained in:
Vikas Nale 2025-04-17 17:52:09 +05:30
parent 1418f84976
commit b963f6bad9

View File

@ -34,45 +34,49 @@ const Regularization = ({ handleRequest }) => {
</thead> </thead>
<tbody> <tbody>
{loading && <td colSpan={5}>Loading...</td>} {loading && <td colSpan={5}>Loading...</td>}
{regularizes?.length > 0 ? (
regularizes?.map((att, index) => ( {!loading &&
<tr key={index}> (regularizes?.length > 0 ? (
<td colSpan={2}> regularizes?.map((att, index) => (
<div className="d-flex justify-content-start align-items-center"> <tr key={index}>
<Avatar <td colSpan={2}>
firstName={att.firstName} <div className="d-flex justify-content-start align-items-center">
lastName={att.lastName} <Avatar
></Avatar> firstName={att.firstName}
<div className="d-flex flex-column"> lastName={att.lastName}
<a href="#" className="text-heading text-truncate"> ></Avatar>
<span className="fw-medium"> <div className="d-flex flex-column">
{att.firstName} {att.lastName} <a href="#" className="text-heading text-truncate">
</span> <span className="fw-medium">
</a> {att.firstName} {att.lastName}
</span>
</a>
</div>
</div> </div>
</div> </td>
</td> <td>{moment(att.checkOutTime).format("DD-MMM-YYYY")}</td>
<td>{moment(att.checkOutTime).format("DD-MMM-YYYY")}</td> <td>{convertShortTime(att.checkInTime)}</td>
<td>{convertShortTime(att.checkInTime)}</td> <td>
<td> {att.checkOutTime
{att.checkOutTime ? convertShortTime(att.checkOutTime) : "--"} ? convertShortTime(att.checkOutTime)
</td> : "--"}
<td className="text-center "> </td>
{/* <div className='d-flex justify-content-center align-items-center gap-3'> */} <td className="text-center ">
<RegularizationActions {/* <div className='d-flex justify-content-center align-items-center gap-3'> */}
attendanceData={att} <RegularizationActions
handleRequest={handleRequest} attendanceData={att}
refresh={refetch} handleRequest={handleRequest}
/> refresh={refetch}
{/* </div> */} />
</td> {/* </div> */}
</td>
</tr>
))
) : (
<tr>
<td colSpan={5}>No Record Found</td>
</tr> </tr>
)) ))}
) : (
<tr>
<td colSpan={5}>No Record Found</td>
</tr>
)}
</tbody> </tbody>
</table> </table>
</div> </div>