58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
export const getProjectStatusName = (statusId) => {
|
|
switch (statusId) {
|
|
case "b74da4c2-d07e-46f2-9919-e75e49b12731":
|
|
return "Active";
|
|
case "603e994b-a27f-4e5d-a251-f3d69b0498ba":
|
|
return "On Hold";
|
|
case "cdad86aa-8a56-4ff4-b633-9c629057dfef":
|
|
return "In Progress";
|
|
case "ef1c356e-0fe0-42df-a5d3-8daee355492d":
|
|
return "Inactive";
|
|
case "33deaef9-9af1-4f2a-b443-681ea0d04f81":
|
|
return "Completed";
|
|
}
|
|
};
|
|
|
|
export const getProjectStatusColor = (statusId) => {
|
|
switch (statusId) {
|
|
case "b74da4c2-d07e-46f2-9919-e75e49b12731":
|
|
return "bg-label-success";
|
|
case "603e994b-a27f-4e5d-a251-f3d69b0498ba":
|
|
return "bg-label-warning";
|
|
case "ef1c356e-0fe0-42df-a5d3-8daee355492d":
|
|
return "bg-label-info";
|
|
case "33deaef9-9af1-4f2a-b443-681ea0d04f81":
|
|
return "bg-label-secondary";
|
|
case "cdad86aa-8a56-4ff4-b633-9c629057dfef":
|
|
return "bg-label-primary";
|
|
}
|
|
};
|
|
|
|
// for different color for each user
|
|
export 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;
|
|
}
|
|
|
|
// Map a hash value to a Bootstrap background class
|
|
export function getBgClassFromHash(str) {
|
|
const bgClasses = [
|
|
"primary",
|
|
"secondary",
|
|
"success",
|
|
"danger",
|
|
"warning",
|
|
"info",
|
|
"dark",
|
|
"light",
|
|
];
|
|
|
|
const hash = hashString(str);
|
|
const index = Math.abs(hash % bgClasses.length);
|
|
return bgClasses[index];
|
|
}
|
|
|