52 lines
2.0 KiB
JavaScript
52 lines
2.0 KiB
JavaScript
document.addEventListener('DOMContentLoaded', function() {
|
|
const iconMap = {
|
|
'General Info': 'fas fa-info-circle',
|
|
'Financial Configuration': 'fas fa-money-bill-wave',
|
|
'Maintenance / Availability': 'fas fa-tools',
|
|
'Driver Warning & Rejection / Auto-Ban': 'fas fa-user-slash',
|
|
'Testing / Development': 'fas fa-flask',
|
|
'Integrations': 'fas fa-plug',
|
|
'Policies': 'fas fa-file-contract',
|
|
'WhatsApp Configuration (Wablas Gateway)': 'fab fa-whatsapp',
|
|
'Tools': 'fas fa-wrench'
|
|
};
|
|
|
|
const iconMapAr = {
|
|
'معلومات عامة': 'fas fa-info-circle',
|
|
'التكوين المالي': 'fas fa-money-bill-wave',
|
|
'الصيانة / التوفر': 'fas fa-tools',
|
|
'تحذير السائق ورفضه / الحظر التلقائي': 'fas fa-user-slash',
|
|
'الاختبار / التطوير': 'fas fa-flask',
|
|
'التكاملات': 'fas fa-plug',
|
|
'السياسات': 'fas fa-file-contract',
|
|
'تكوين واتساب (بوابة وابلأس)': 'fab fa-whatsapp',
|
|
'أدوات': 'fas fa-wrench'
|
|
};
|
|
|
|
const fullIconMap = {...iconMap, ...iconMapAr};
|
|
|
|
function applyIcons() {
|
|
const tabs = document.querySelectorAll('.nav-link');
|
|
tabs.forEach(tab => {
|
|
// Check if icon already exists
|
|
if (tab.querySelector('i.fas, i.fab')) return;
|
|
|
|
const text = tab.textContent.trim();
|
|
for (const [key, icon] of Object.entries(fullIconMap)) {
|
|
if (text.includes(key)) {
|
|
const i = document.createElement('i');
|
|
i.className = icon + ' mr-2';
|
|
i.style.width = '20px';
|
|
i.style.textAlign = 'center';
|
|
tab.prepend(i);
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
applyIcons();
|
|
// Sometimes jazzmin loads tabs dynamically or with a delay
|
|
setTimeout(applyIcons, 500);
|
|
});
|