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">
|
<ul className="nav nav-tabs">
|
||||||
<li className="nav-item">
|
<li className="nav-item">
|
||||||
<a
|
<a
|
||||||
className={`nav-link ${activePill === "account" ? "active" : ""}`}
|
className={`nav-link py-1 px-2 small ${
|
||||||
|
activePill === "account" ? "active" : ""
|
||||||
|
}`}
|
||||||
href="#"
|
href="#"
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault(); // Prevent page reload
|
e.preventDefault(); // Prevent page reload
|
||||||
|
|||||||
@ -95,7 +95,6 @@ const ManageRole = ({ employeeId, onClosed }) => {
|
|||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`modal fade `}
|
className={`modal fade `}
|
||||||
|
|||||||
@ -1,21 +1,22 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
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" }) => {
|
const Avatar = ({ firstName, lastName, size = "sm" }) => {
|
||||||
// Combine firstName and lastName to create a unique string for hashing
|
// Combine firstName and lastName to create a unique string for hashing
|
||||||
const fullName = `${firstName} ${lastName}`;
|
const fullName = `${firstName} ${lastName}`;
|
||||||
|
|
||||||
const [bgClass, setBgClass] = useState("");
|
const [bgClass, setBgClass] = useState("");
|
||||||
|
|
||||||
// A simple hash function to generate a deterministic value from the name
|
// Function to generate the avatar text
|
||||||
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 generateAvatarText(firstName, lastName) {
|
function generateAvatarText(firstName, lastName) {
|
||||||
if (!firstName) return "";
|
if (!firstName) return "";
|
||||||
if (!lastName || lastName.trim() === "") {
|
if (!lastName || lastName.trim() === "") {
|
||||||
@ -49,15 +50,13 @@ const Avatar = ({ firstName, lastName, size = "sm" }) => {
|
|||||||
}, [fullName]); // Re-run if the fullName changes
|
}, [fullName]); // Re-run if the fullName changes
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="avatar-wrapper p-1">
|
||||||
<div className="avatar-wrapper p-1">
|
<div className={`avatar avatar-${size} me-2`}>
|
||||||
<div className={`avatar avatar-${size} me-2`}>
|
<span className={`avatar-initial rounded-circle ${bgClass}`}>
|
||||||
<span className={`avatar-initial rounded-circle ${bgClass}`}>
|
{generateAvatarText(firstName, lastName)}
|
||||||
{generateAvatarText(firstName, lastName)}
|
</span>
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user