Fixed partnerui hashing and over all theming
This commit is contained in:
@@ -462,14 +462,36 @@ export const getOrganisationTypeLabel = (type: OrganisationType | number): strin
|
||||
return opt ? opt.label : 'Organisation';
|
||||
};
|
||||
|
||||
export const getIndustrySectorLabel = (sector: IndustrySector | number): string => {
|
||||
const opt = INDUSTRY_SECTOR_OPTIONS.find((o) => o.value === Number(sector));
|
||||
return opt ? opt.label : 'Industry Sector';
|
||||
export const getIndustrySectorLabel = (sector?: IndustrySector | number | string | null): string => {
|
||||
if (sector === undefined || sector === null || sector === '') return '';
|
||||
const num = Number(sector);
|
||||
if (!isNaN(num)) {
|
||||
const opt = INDUSTRY_SECTOR_OPTIONS.find((o) => o.value === num);
|
||||
if (opt) return opt.label;
|
||||
}
|
||||
const str = String(sector).trim().toLowerCase();
|
||||
for (const opt of INDUSTRY_SECTOR_OPTIONS) {
|
||||
if (opt.label.toLowerCase() === str) return opt.label;
|
||||
const enumKey = (IndustrySector as any)[opt.value];
|
||||
if (enumKey && String(enumKey).toLowerCase() === str) return opt.label;
|
||||
}
|
||||
return String(sector).replace(/([a-z])([A-Z])/g, '$1 $2');
|
||||
};
|
||||
|
||||
export const getProjectTypeLabel = (type: ProjectType | number): string => {
|
||||
const opt = PROJECT_TYPE_OPTIONS.find((o) => o.value === Number(type));
|
||||
return opt ? opt.label : 'Project Type';
|
||||
export const getProjectTypeLabel = (type?: ProjectType | number | string | null): string => {
|
||||
if (type === undefined || type === null || type === '') return '';
|
||||
const num = Number(type);
|
||||
if (!isNaN(num)) {
|
||||
const opt = PROJECT_TYPE_OPTIONS.find((o) => o.value === num);
|
||||
if (opt) return opt.label;
|
||||
}
|
||||
const str = String(type).trim().toLowerCase();
|
||||
for (const opt of PROJECT_TYPE_OPTIONS) {
|
||||
if (opt.label.toLowerCase() === str) return opt.label;
|
||||
const enumKey = (ProjectType as any)[opt.value];
|
||||
if (enumKey && String(enumKey).toLowerCase() === str) return opt.label;
|
||||
}
|
||||
return String(type).replace(/([a-z])([A-Z])/g, '$1 $2');
|
||||
};
|
||||
|
||||
export const getEvidenceTypeLabel = (type: EvidenceType | number): string => {
|
||||
|
||||
Reference in New Issue
Block a user