Merge branch 'pramod_Enhancement#86_plannedDisplayInReport' of https://git.marcoaiot.com/admin/marco.pms.web into pramod_Enhancement#86_plannedDisplayInReport
This commit is contained in:
commit
83b6c2a307
@ -7,7 +7,9 @@ const EmployeeNav = ({ onPillClick, activePill }) => {
|
||||
<ul className="nav nav-tabs">
|
||||
<li className="nav-item">
|
||||
<a
|
||||
className={`nav-link ${activePill === "account" ? "active" : ""}`}
|
||||
className={`nav-link py-1 px-2 small ${
|
||||
activePill === "account" ? "active" : ""
|
||||
}`}
|
||||
href="#"
|
||||
onClick={(e) => {
|
||||
e.preventDefault(); // Prevent page reload
|
||||
|
@ -95,7 +95,6 @@ const ManageRole = ({ employeeId, onClosed }) => {
|
||||
setIsLoading(false);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`modal fade `}
|
||||
|
@ -1,21 +1,22 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
// A simple hash function to generate a deterministic value from the name
|
||||
function hashString(str) {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const char = str.charCodeAt(i);
|
||||
hash = (hash << 5) - hash + char;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
const Avatar = ({ firstName, lastName, size = "sm" }) => {
|
||||
// Combine firstName and lastName to create a unique string for hashing
|
||||
const fullName = `${firstName} ${lastName}`;
|
||||
|
||||
const [bgClass, setBgClass] = useState("");
|
||||
|
||||
// A simple hash function to generate a deterministic value from the name
|
||||
function hashString(str) {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const char = str.charCodeAt(i);
|
||||
hash = (hash << 5) - hash + char;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
// Function to generate the avatar text
|
||||
function generateAvatarText(firstName, lastName) {
|
||||
if (!firstName) return "";
|
||||
if (!lastName || lastName.trim() === "") {
|
||||
@ -49,15 +50,13 @@ const Avatar = ({ firstName, lastName, size = "sm" }) => {
|
||||
}, [fullName]); // Re-run if the fullName changes
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="avatar-wrapper p-1">
|
||||
<div className={`avatar avatar-${size} me-2`}>
|
||||
<span className={`avatar-initial rounded-circle ${bgClass}`}>
|
||||
{generateAvatarText(firstName, lastName)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="avatar-wrapper p-1">
|
||||
<div className={`avatar avatar-${size} me-2`}>
|
||||
<span className={`avatar-initial rounded-circle ${bgClass}`}>
|
||||
{generateAvatarText(firstName, lastName)}
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user