forked from izu/student-web-if-development-kit
merge(c4a): resolve merge conflicts with origin/main
This commit is contained in:
@@ -48,7 +48,7 @@ async function initApp() {
|
||||
initAnimations();
|
||||
}, 100);
|
||||
} catch (error) {
|
||||
console.error('Terjadi kesalahan saat menginisialisasi aplikasi C4A:', error);
|
||||
console.error('Terjadi kesalahan saat menginisialisasi halaman:', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+26
-14
@@ -13,14 +13,23 @@ function t(key, fallback) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper untuk melokalisasi teks dari objek bilingual {id, en} atau string biasa.
|
||||
* @param {string|Object} field - Data teks (bisa string biasa atau objek {id, en})
|
||||
* @returns {string} Teks terlokalisasi
|
||||
* Mendapatkan bahasa aktif dari localStorage atau default 'id'.
|
||||
* @returns {'id'|'en'} Kode bahasa aktif
|
||||
*/
|
||||
function getLang() {
|
||||
return localStorage.getItem('if_untan_lang') || 'id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Mengambil teks dari field bilingual JSON { id: '...', en: '...' }.
|
||||
* Jika field bukan objek (string lama / belum diupdate), kembalikan apa adanya.
|
||||
* @param {string|Object} field - Field data dari JSON
|
||||
* @returns {string} Teks sesuai bahasa aktif
|
||||
*/
|
||||
function loc(field) {
|
||||
if (!field) return '';
|
||||
if (typeof field === 'object') {
|
||||
const lang = (window.getLang && typeof window.getLang === 'function') ? window.getLang() : 'id';
|
||||
if (typeof field === 'object' && field !== null) {
|
||||
const lang = getLang();
|
||||
return field[lang] || field['id'] || '';
|
||||
}
|
||||
return String(field);
|
||||
@@ -112,10 +121,13 @@ export function renderStaffCards(staffs) {
|
||||
tasks
|
||||
} = staff;
|
||||
|
||||
const roleText = loc(role);
|
||||
const locationText = loc(location);
|
||||
|
||||
const scheduleHTML = schedule.map(sched =>
|
||||
`<div class="schedule-item">` +
|
||||
`<span class="s-day">${loc(sched.day)}</span>` +
|
||||
`<span class="s-time">${loc(sched.time)} <span class="s-break">| ${loc(sched.break)}</span></span>` +
|
||||
`<span class="s-day">${loc(sched.day)}</span>` +
|
||||
`<span class="s-time">${loc(sched.time)} <span class="s-break">| ${loc(sched.break)}</span></span>` +
|
||||
`</div>`
|
||||
).join('');
|
||||
|
||||
@@ -138,12 +150,12 @@ export function renderStaffCards(staffs) {
|
||||
</div>
|
||||
<div>
|
||||
<div class="staff-name">${loc(name)}</div>
|
||||
<div class="staff-role">${loc(role)}</div>
|
||||
<div class="staff-role">${roleText}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="staff-card-body">
|
||||
<div class="staff-info-grid">
|
||||
<div class="staff-info-item"><span class="icon">📍</span><div><span class="label">${t('grp_c4a_label_location', 'Lokasi')}</span><span class="val">${loc(location)}</span></div></div>
|
||||
<div class="staff-info-item"><span class="icon">📍</span><div><span class="label">${t('grp_c4a_label_location', 'Lokasi')}</span><span class="val">${locationText}</span></div></div>
|
||||
<div class="staff-info-item">
|
||||
<span class="icon">🕒</span>
|
||||
<div style="flex:1">
|
||||
@@ -214,11 +226,12 @@ function buildSopCard(sop) {
|
||||
procedures
|
||||
} = sop;
|
||||
|
||||
const catLabel = getCatLabel(category);
|
||||
const catClass = CATEGORY_COLORS[category] || '';
|
||||
const titleText = loc(title);
|
||||
const descText = loc(description);
|
||||
|
||||
const catLabel = getCatLabel(category);
|
||||
const catClass = CATEGORY_COLORS[category] || '';
|
||||
|
||||
return `
|
||||
<article class="sop-grid-card reveal" data-tab-id="${tabId}" data-category="${category}" data-title="${titleText.toLowerCase()}">
|
||||
<div class="sgc-header">
|
||||
@@ -263,14 +276,13 @@ function buildSopModalContent(sop) {
|
||||
additional_info: additionalInfo
|
||||
} = sop;
|
||||
|
||||
const catLabel = getCatLabel(category);
|
||||
const catClass = CATEGORY_COLORS[category] || '';
|
||||
|
||||
const titleText = loc(title);
|
||||
const descText = loc(description);
|
||||
const purposeText = loc(purpose);
|
||||
const additionalInfoText = loc(additionalInfo);
|
||||
|
||||
const catLabel = getCatLabel(category);
|
||||
const catClass = CATEGORY_COLORS[category] || '';
|
||||
const reqsHTML = requirements.map(req => `<li>${loc(req)}</li>`).join('');
|
||||
const procsHTML = procedures.map(proc => `<li>${loc(proc)}</li>`).join('');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user