Added the hospital image

This commit is contained in:
Duradundi 2026-09-10 12:00:40 +05:30
parent 32ec18f7f2
commit b57ca559b2
5 changed files with 20 additions and 6 deletions

BIN
asm_app/public/hospital.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -243,8 +243,14 @@ const KpiMonthlyReportCard: React.FC<KpiMonthlyReportCardProps> = ({
const logoExtension: 'png' | 'jpeg' = 'png';
try {
const baseUrl = import.meta.env.BASE_URL || '/';
const logoUrl = `${baseUrl}${baseUrl.endsWith('/') ? '' : '/'}${DEFAULT_HOSPITAL_LOGO}`;
const logoRes = await fetch(logoUrl);
const logoUrl = DEFAULT_HOSPITAL_LOGO.startsWith('/') || DEFAULT_HOSPITAL_LOGO.startsWith('http')
? DEFAULT_HOSPITAL_LOGO
: `${baseUrl}${baseUrl.endsWith('/') ? '' : '/'}${DEFAULT_HOSPITAL_LOGO}`;
let logoRes = await fetch(logoUrl);
if (!logoRes.ok && DEFAULT_HOSPITAL_LOGO.startsWith('/files/')) {
const fallbackUrl = `${baseUrl}${baseUrl.endsWith('/') ? '' : '/'}${DEFAULT_HOSPITAL_LOGO.replace('/files/', '')}`;
logoRes = await fetch(fallbackUrl);
}
if (logoRes.ok) {
const arrayBuffer = await logoRes.arrayBuffer();
logoBase64 = btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));

View File

@ -154,8 +154,14 @@ const PpmKpiReportCard: React.FC<PpmKpiReportCardProps> = ({
const loadLogo = async (path: string): Promise<string | null> => {
try {
const baseUrl = import.meta.env.BASE_URL || '/';
const url = `${baseUrl}${baseUrl.endsWith('/') ? '' : '/'}${path}`;
const res = await fetch(url);
const url = path.startsWith('/') || path.startsWith('http')
? path
: `${baseUrl}${baseUrl.endsWith('/') ? '' : '/'}${path}`;
let res = await fetch(url);
if (!res.ok && path.startsWith('/files/')) {
const fallback = `${baseUrl}${baseUrl.endsWith('/') ? '' : '/'}${path.replace('/files/', '')}`;
res = await fetch(fallback);
}
if (!res.ok) return null;
const buf = await res.arrayBuffer();
return btoa(String.fromCharCode(...new Uint8Array(buf)));

View File

@ -11,8 +11,10 @@ export const DEFAULT_REPORT_HOSPITAL = 'King Fahad Specialist Hospital';
export const DEFAULT_CLUSTER_NAME = 'Eastern Health Cluster';
// Default logos
export const DEFAULT_HOSPITAL_LOGO = 'kfsh-logo.png';
export const DEFAULT_CLUSTER_LOGO = 'ehc-logo.png';
export const DEFAULT_HOSPITAL_LOGO = '/files/hospital.png';
export const DEFAULT_CLUSTER_LOGO = '/files/hospital.png';
// Fallback Frappe Backend Base URL
export const DEFAULT_FRAPPE_BASE_URL = 'https://kfsh-dammam-asm.seeraarabia.com';

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB