<?php
//config is loaded
require_once dirname(__DIR__, 2) . '/dripend/config/config.php';
// Dynamic versioning variable to bust cache
$v = time();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>System Setup | RiMax</title>

    <link rel="stylesheet" href="<?php echo BASE_URL; ?>application/assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="<?php echo BASE_URL; ?>application/assets/css/all.min.css">
    <link rel="stylesheet" href="<?php echo BASE_URL; ?>application/assets/css/fonts-awesome.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
    <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />

<style>
  @font-face {
            font-family: 'Inter';
            src: url('<?php echo BASE_URL; ?>application/assets/fonts/Inter-Regular.woff2') format('woff2');
            font-weight: 400;
            font-style: normal;
        }
    :root {
        --sidebar-bg: #0f172a;
        --sidebar-hover: rgba(255, 255, 255, 0.05);
        --sidebar-text: #94a3b8;
        --sidebar-active: #ffffff;
        --primary: #3b82f6;
        --primary-glow: rgba(59, 130, 246, 0.15);
        --bg-color: #f8fafc;
        --card-bg: #ffffff;
        --border-color: #e2e8f0;
        --text-main: #334155;
        --text-muted: #64748b;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }
    body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg-color); color: var(--text-main); display: flex; height: 100vh; overflow: hidden; }

    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
    ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

    .sidebar { width: 280px; background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%); display: flex; flex-direction: column; transition: 0.3s ease; z-index: 100; box-shadow: 4px 0 15px rgba(0,0,0,0.05); }
    .brand { height: 75px; display: flex; align-items: center; padding: 0 24px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 22px; font-weight: 700; color: white; letter-spacing: 0.5px; }
    .brand span { color: var(--primary); }
    .brand svg { margin-right: 12px; width: 24px; height: 24px; fill: var(--primary); }

    .nav-container { flex: 1; overflow-y: auto; padding: 24px 0; }
    .nav-group { margin-bottom: 24px; }
    .nav-title { display: flex; align-items: center; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: #64748b; padding: 0 24px 12px; font-weight: 600; }
    .nav-title svg { width: 14px; height: 14px; margin-right: 8px; stroke: currentColor; fill: none; stroke-width: 2; }
    
    .nav-item { display: flex; align-items: center; padding: 10px 24px 10px 42px; color: var(--sidebar-text); text-decoration: none; cursor: pointer; font-size: 14px; font-weight: 400; transition: all 0.2s ease; border-right: 3px solid transparent; }
    .nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-active); }
    .nav-item.active { background: var(--primary-glow); color: var(--primary); border-right-color: var(--primary); font-weight: 500; }

    .main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
    .top-header { background: var(--card-bg); height: 75px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--border-color); z-index: 10;}
    .breadcrumb { font-size: 14px; color: var(--text-muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
    .breadcrumb span.current { color: var(--text-main); font-weight: 600; font-size: 18px; }
    
    .user-profile { display: flex; align-items: center; gap: 12px; }
    .avatar { width: 36px; height: 36px; border-radius: 50%; background: #e2e8f0; display: flex; align-items: center; justify-content: center; font-weight: 600; color: #475569; }
    
    .mobile-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-main); padding-right: 15px; }

    .content-scroll { flex: 1; overflow-y: auto; padding: 32px; scroll-behavior: smooth; }
    .content-card { background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border-color); padding: 32px; min-height: calc(100vh - 140px); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -1px rgba(0,0,0,0.02); animation: fadeIn 0.4s ease-out; }
    
    @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

    .loader { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 200px; gap: 16px; color: var(--text-muted); }
    .spinner { width: 32px; height: 32px; border: 3px solid #e2e8f0; border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
    @keyframes spin { to { transform: rotate(360deg); } }

    @media (max-width: 768px) {
        .sidebar { position: fixed; transform: translateX(-100%); height: 100%; box-shadow: none; }
        .sidebar.open { transform: translateX(0); box-shadow: 4px 0 25px rgba(0,0,0,0.5); }
        .mobile-toggle { display: block; }
        .top-header { padding: 0 20px; }
        .content-scroll { padding: 16px; }
    }
</style>
</head>
<body>

<aside class="sidebar" id="sidebar">
    <div class="brand">
        <svg viewBox="0 0 24 24"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 9h-2V9H8v3H6v2h2v3h2v-3h2v-2z"/></svg>
        e<span>RHAMS</span>
    </div>
    <div class="nav-container" id="navContainer"></div>
</aside>

<div class="main-wrapper">
    <header class="top-header">
        <div style="display:flex; align-items:center;">
            <button class="mobile-toggle" id="mobileToggle">☰</button>
            <div class="breadcrumb" id="breadcrumb">
                <span id="bc-category">Setup</span> 
                <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>
                <span class="current" id="bc-page">Dashboard</span>
            </div>
        </div>
        <div class="user-profile">
            <div style="text-align: right; line-height: 1.2;">
                <div style="font-size: 13px; font-weight: 600;">System Admin</div>
                <div style="font-size: 11px; color: var(--text-muted);">IT Department</div>
            </div>
            <div class="avatar">SA</div>
        </div>
    </header>

    <div class="content-scroll">
        <div class="content-card" id="contentArea">
            <h2 style="margin-bottom: 12px; color: var(--text-main);">Welcome to System Configuration</h2>
            <p style="color: var(--text-muted); line-height: 1.6;">Select an operational module from the sidebar to modify your tertiary facility settings.</p>
        </div>
    </div>
</div>

<script>
const icons = {
    facility: '<path d="M3 21h18v-2H3v2zm7-4h4V5h-4v12zm-6 0h4V9H4v8zm12 0h4v-6h-4v6z"/>',
    general: '<path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94L14.4 2.81c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41L9.25 5.35C8.66 5.59 8.12 5.92 7.63 6.29L5.24 5.33c-.22-.08-.47 0-.59.22L2.73 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.08.62-.08.94s.03.64.08.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .43-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.49-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>',
    lab: '<path d="M7 14c-1.66 0-3 1.34-3 3 0 1.31-1.16 2-2 2 .92 1.22 2.49 2 4 2 2.21 0 4-1.79 4-4 0-1.66-1.34-3-3-3zm13.71-9.37l-1.34-1.34c-.39-.39-1.02-.39-1.41 0L9 12.25 11.75 15l8.96-8.96c.39-.39.39-1.02 0-1.41z"/>',
    pharmacy: '<path d="M21 5h-2.64l1.14-3.14L17.15 1l-1.46 4H3v2l2 6-2 6v2h18v-2l-2-6 2-6V5zm-5 9h-4v4h-2v-4H6v-2h4V8h2v4h4v2z"/>',
    billing: '<path d="M11.8 10.9c-2.27-.59-3-1.2-3-2.15 0-1.09 1.01-1.85 2.7-1.85 1.78 0 2.44.85 2.5 2.1h2.21c-.07-1.72-1.12-3.3-3.21-3.81V3h-3v2.16c-1.94.42-3.5 1.68-3.5 3.61 0 2.31 1.91 3.46 4.7 4.13 2.5.6 3 1.48 3 2.41 0 .69-.49 1.79-2.7 1.79-2.06 0-2.87-.92-2.98-2.1h-2.2c.12 2.19 1.76 3.42 3.68 3.83V21h3v-2.15c1.95-.37 3.5-1.5 3.5-3.55 0-2.84-2.43-3.81-4.7-4.4z"/>',
    ipd: '<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 9h-2V9H8v3H6v2h2v3h2v-3h2v-2z"/>'
};

const menuConfig = [
    {
        title: "Facility Setup",
        categoryKey: "facility",
        icon: icons.facility,
        items: [
            { name: "Profile & Branding", file: "facility/profile_branding.php" },
            { name: "NHIS Regulatory Setup", file: "facility/nhis_config.php" },
            { name: "Corporate/Private Insurance", file: "insurance/corporateInsurance.php" },
            { name: "Workflow & Financial Rules", file: "facility/workflow_rules.php" },
            { name: "Hardware & Gateways", file: "facility/integrations.php" }
        ]
    },
    {
        title: "Global Parameters",
        categoryKey: "general",
        icon: icons.general,
        items: [
            { name: "Registration Defaults", file: "general/patient_defaults.php" },
            { name: "System Dictionaries", file: "general/dictionaries.php" }
        ]
    },
    {
        title: "Laboratory",
        categoryKey: "lab",
        icon: icons.lab,
        items: [
            { name: "Sub-Departments", file: "laboratory/mapLabDepartments.php" },
            { name: "Test Parameters", file: "laboratory/manageLabParameters.php" },
            { name: "Reference Ranges", file: "laboratory/manageReferenceRanges.php" },
            { name: "Sample Types", file: "laboratory/manageSamples.php" }
        ]
    },
    {
        title: "Products",
        categoryKey: "products",
        icon: icons.billing,
        items: [
            { name: "Add Products", file: "product/addNewProduct.php" },
            { name: "List Products", file: "product/listProducts.php" },
            { name: "Service to NHIS Mapping", file: "gdrg/service_nhis_mapping.php" },
            { name: "Corporate Insurers", file: "insurance/providers.php" },
            { name: "Corporate Tariffs", file: "insurance/corporate_tariffs.php" }
        ]
    },
    {
        title: "Stores & Dispenaries",
        categoryKey: "stores",
        icon: icons.stores,
        items: [
            { name: "Stores", file: "inventory/listStores.php" },
            { name: "Stock Movement", file: "inventory/stockMovement.php" },
            { name: "Suppliers", file: "inventory/listSuppliers.php" },
            { name: "Opening Stock", file: "inventory/listOpeningAllocations.php" }
        ]
    },  
    {
        title: "Procurement",
        categoryKey: "procurement",
        icon: icons.procurement,
        items: [
            { name: "Procurement", file: "procurement/listPurchaseRequisition.php" },
            { name: "New Requisition", file: "procurement/addPurchaseRequisition.php" }
        ]
    },  
    {
        title: "Pharmacy",
        categoryKey: "pharmacy",
        icon: icons.pharmacy,
        items: [
            { name: "Master Medicine List", file: "pharmacy/listMedicine.php" },
            { name: "Drug Formulations", file: "pharmacy/drugFormulation.php" },
            { name: "Units of Measure", file: "pharmacy/UnitOfMeasure.php" },
            { name: "Add Medicine", file: "pharmacy/addMedicine.php" },
            { name: "Prescribing Levels", file: "pharmacy/drugPrescribeLevel.php" },
            { name: "Calculation Engine", file: "product/medicationCalculation.php" },
            { name: "Attribute Management", file: "product/manageProductAttributes.php" }
        ]
    },
    {
        title: "IPD",
        categoryKey: "ipd",
        icon: icons.ipd,
        items: [
            { name: "IPD Dashboard", file: "ipd/ipdDashboard.php" },
            { name: "Room / Ward Management", file: "ipd/roomWardManagement.php" },
            { name: "Clinical Care Params", file: "ipd/clinicalCareConfig.php" },
            { name: "Clinical Workflow Engine", file: "ipd/workflowEngineConfig.php" },
            { name: "Theatre & Surgery Config", file: "ipd/theatreManagerConfig.php" },
            { name: "Theatre Forms Builder", file: "ipd/theatreManagerForms.php" }
        ]
    },
    {
        title: "Consultation",
        categoryKey: "consultation",
        icon: icons.pharmacy,
        items: [
            { name: "Manage", file: "consultation/manage_consultation_fields.php" }
        ]
    },
    {
        title: "Billing & NHIS",
        categoryKey: "billing",
        icon: icons.billing,
        items: [
            { name: "NHIS Tariffs Master", file: "gdrg/nhis_tariffs.php" },
            { name: "ICD-10 Dictionary", file: "gdrg/icd10_dict.php" },
            { name: "Service to NHIS Mapping", file: "gdrg/service_nhis_mapping.php" },
            { name: "Corporate Insurers", file: "insurance/providers.php" },
            { name: "Corporate Tariffs", file: "insurance/corporate_tariffs.php" }
        ]
    }
];

const navContainer = document.getElementById('navContainer');
const contentArea = document.getElementById('contentArea');
const bcCategory = document.getElementById('bc-category');
const bcPage = document.getElementById('bc-page');
const sidebar = document.getElementById('sidebar');

function buildSidebar() {
    menuConfig.forEach(group => {
        const groupEl = document.createElement('div');
        groupEl.className = 'nav-group';
        
        groupEl.innerHTML = `
            <div class="nav-title">
                <svg viewBox="0 0 24 24">${group.icon}</svg>
                ${group.title}
            </div>`;

        group.items.forEach(item => {
            const link = document.createElement('a');
            link.className = 'nav-item';
            link.textContent = item.name;
            link.dataset.file = item.file;
            link.dataset.category = group.title;
            link.dataset.categoryKey = group.categoryKey;
            
            link.addEventListener('click', (e) => {
                e.preventDefault();
                window.loadContent(item.name, item.file, group.title, group.categoryKey, link);
                if(window.innerWidth <= 768) sidebar.classList.remove('open');
            });

            groupEl.appendChild(link);
        });

        navContainer.appendChild(groupEl);
    });
}

// EXPOSED GLOBALLY FOR SECURE SPA NAVIGATION (BUTTONS/CLICKS)
window.loadContent = async function(pageName, file, catTitle, categoryKey, activeLinkEl = null, updateURL = true) {
    if(activeLinkEl) {
        document.querySelectorAll('.nav-item').forEach(el => el.classList.remove('active'));
        activeLinkEl.classList.add('active');
    }
    
    bcCategory.textContent = catTitle;
    bcPage.textContent = pageName;

    contentArea.style.animation = 'none';
    contentArea.innerHTML = `
        <div class="loader">
            <div class="spinner"></div>
            <span style="font-weight: 500;">Loading data...</span>
        </div>`;

    try {
        const fetchURL = file + (file.includes('?') ? '&' : '?') + 't=' + new Date().getTime();
        const response = await fetch(fetchURL);
        
        if (!response.ok) throw new Error("HTTP Status " + response.status);
        const html = await response.text();
        
        void contentArea.offsetWidth; 
        contentArea.style.animation = 'fadeIn 0.4s ease-out';
        contentArea.innerHTML = html;

        executeModuleInitialization(file);

        if (updateURL) {
            let urlParams = new URLSearchParams();
            urlParams.set('cat', categoryKey);
            
            // Safely parse ?id=xxx into the URL structure without breaking PHP $_GET arrays
            if (file.includes('?')) {
                let parts = file.split('?');
                urlParams.set('page', parts[0]);
                let subParams = new URLSearchParams(parts[1]);
                for (let [key, value] of subParams.entries()) {
                    urlParams.set(key, value);
                }
            } else {
                urlParams.set('page', file);
            }
            
            const newURL = `${window.location.pathname}?${urlParams.toString()}`;
            window.history.pushState({cat: categoryKey, page: file}, "", newURL);
        }
    } catch (error) {
        void contentArea.offsetWidth;
        contentArea.style.animation = 'fadeIn 0.4s ease-out';
        contentArea.innerHTML = `
            <div style="background: #fff1f2; border: 1px solid #ffe4e6; padding: 24px; border-radius: 8px;">
                <h3 style="color: #e11d48; margin-bottom: 8px; font-weight: 600;">Module Error Detected</h3>
                <p style="color: #9f1239; font-size: 14px; line-height: 1.5;">The file <strong>${file}</strong> could not be loaded.</p>
                <code style="display:block; margin-top:10px; color:#ef4444; background: #fee2e2; padding:8px; border-radius:4px;">Error Details: ${error.message}</code>
            </div>`;
    }
};

function executeModuleInitialization(file) {
    if (file.includes('stockMovement.php') && typeof window.initStockMovement === 'function') window.initStockMovement();
    if ((file.includes('listOpeningAllocations.php') || file.includes('addOpeningAllocation.php')) && typeof window.initOpeningAllocation === 'function') window.initOpeningAllocation();
    if (file.includes('listPurchaseRequisition.php') && typeof window.initListPurchaseRequisition === 'function') window.initListPurchaseRequisition();
    if (file.includes('addPurchaseRequisition.php') && typeof window.initPurchaseRequisition === 'function') window.initPurchaseRequisition();
    if (file.includes('manage_consultation_fields.php') && typeof window.initManageConsultationFields === 'function') window.initManageConsultationFields();
    if (file.includes('roomWardManagement.php') && typeof window.initRoomWardManagement === 'function') window.initRoomWardManagement();
    if (file.includes('clinicalCareConfig.php') && typeof window.initClinicalCareConfig === 'function') window.initClinicalCareConfig();
    if (file.includes('workflowEngineConfig.php') && typeof window.initWorkflowEngineConfig === 'function') window.initWorkflowEngineConfig();
    if (file.includes('dynamicFormBuilder.php') && typeof window.initDynamicFormBuilder === 'function') window.initDynamicFormBuilder();
    if (file.includes('theatreManagerConfig.php') && typeof window.initTheatreManagerConfig === 'function') window.initTheatreManagerConfig();
    if (file.includes('theatreManagerForms.php') && typeof window.initTheatreManagerForms === 'function') window.initTheatreManagerForms();
    if (file.includes('medicationCalculation.php') && typeof window.initMedicationCalculation === 'function') window.initMedicationCalculation();
    if (file.includes('manageProductAttributes.php') && typeof window.initProductAttributes === 'function') window.initProductAttributes();
    if (file.includes('listProducts.php') && typeof window.initListProducts === 'function') window.initListProducts();
    
    // Explicit extraction of ID for Update Product
    if (file.includes('updateProduct.php') && typeof window.initUpdateProduct === 'function') {
        const match = file.match(/[?&]id=(\d+)/);
        if(match) window.initUpdateProduct(match[1]);
    }
}

// Fixed link delegation to ignore action buttons in dynamic content
contentArea.addEventListener('click', function(e) {
    const link = e.target.closest('a');
    if (!link) return; 
    if (link.hasAttribute('onclick')) return; // Allow JS onclicks to fire normally

    const targetFile = link.getAttribute('href');
    if (!targetFile || targetFile === '#' || targetFile.startsWith('http') || targetFile.startsWith('mailto:') || link.target === '_blank') return; 

    e.preventDefault();

    const pageName = link.getAttribute('data-title') || link.textContent.trim() || "Sub Module";
    
    // Attempt to keep sidebar sync, but fallback if navigating from deep links
    let activeNav = document.querySelector(`.nav-item[data-file="${targetFile.split('?')[0]}"]`);
    if (!activeNav) activeNav = document.querySelector('.nav-item.active');

    const catTitle = link.getAttribute('data-category') || (activeNav ? activeNav.dataset.category : "Setup");
    const categoryKey = activeNav ? activeNav.dataset.categoryKey : "general";

    window.loadContent(pageName, targetFile, catTitle, categoryKey, activeNav, true);
});

window.addEventListener("DOMContentLoaded", () => {
    buildSidebar();

    const params = new URLSearchParams(window.location.search);
    const targetPage = params.get('page');
    const targetId = params.get('id');

    if (targetPage) {
        // Reconstruct the file path for fetch if an ID is present
        let fetchFile = targetPage;
        if (targetId) fetchFile += `?id=${targetId}`;

        const baseFile = targetPage.split('?')[0];
        const targetLink = document.querySelector(`.nav-item[data-file="${baseFile}"]`);
        
        if (targetLink) {
            window.loadContent(targetLink.textContent, fetchFile, targetLink.dataset.category, targetLink.dataset.categoryKey, targetLink, false);
        } else {
            const catKey = params.get('cat') || "general";
            window.loadContent("Configuration", fetchFile, "System Setup", catKey, null, false);
        }
    } else {
        const firstLink = document.querySelector('.nav-item');
        if (firstLink) {
            window.loadContent(firstLink.textContent, firstLink.dataset.file, firstLink.dataset.category, firstLink.dataset.categoryKey, firstLink, false);
        }
    }
});

document.getElementById('mobileToggle').addEventListener('click', () => { sidebar.classList.toggle('open'); });
</script>

<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>

<!-- Added Dynamic Cache Busting to ensure scripts always execute the latest version -->
<script src="<?php echo BASE_URL; ?>application/assets/js/fac-profile.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/nhis-config.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/nhis-tariffs.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/icd10-dict.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/drg-icd-mapping.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/integrations.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/corporate_insurance.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/map_corporate.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/addCorporateInsuranceProvider.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/AddLabParameters.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/AddLabSample.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/referenceRanges.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/mapLabDepartments.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/addProduct.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/listProduct.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/storeManagement.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/supplierManagement.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/openingAllocation.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/stockMovement.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/procurementRequisition.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/manageConsultationFields.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/ipdManagement.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/roomWardManagement.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/clinicalCareConfig.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/workflowEngineConfig.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/dynamicFormBuilder.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/theatreManagerConfig.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/theatreManagerForms.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/medicationCalculation.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/productAttributes.js?v=<?= $v ?>"></script>
<script src="<?php echo BASE_URL; ?>application/assets/js/updateProduct.js?v=<?= $v ?>"></script>

</body>
</html>