diff --git a/AMS_TestCases_AddNewAsset.xlsx b/AMS_TestCases_AddNewAsset.xlsx new file mode 100644 index 00000000..f658c271 Binary files /dev/null and b/AMS_TestCases_AddNewAsset.xlsx differ diff --git a/asset-create.html b/asset-create.html index f64b191f..d6a42cb7 100644 --- a/asset-create.html +++ b/asset-create.html @@ -9,26 +9,7 @@
- +
@@ -39,7 +20,7 @@
- 🚪 +
@@ -64,10 +45,20 @@
📋 Step 1: Basic Information
+
+ + +
+
+
+
+ + +
-
+ + +
@@ -89,22 +88,37 @@
+ + + +
-
+
- - + +
-
- - -
-
+
+
- +
@@ -284,7 +304,9 @@
+ + + diff --git a/assets.html b/assets.html index a0a6f3df..f283ad21 100644 --- a/assets.html +++ b/assets.html @@ -10,36 +10,17 @@
- +
All Assets
- +
+ Add Asset - 🚪 +
@@ -49,10 +30,22 @@
-
+
🔍
+ + -
Showing 20 of 1,247 assets
+
Showing 0 assets
@@ -221,7 +215,9 @@
+ + + - - -
- - -
-
-
Inventory Management
-
- - - 🚪 -
-
- -
- -
- - -
- - -
-
- - - - -
- - -
-
-
-
📊 Stock by Category
-
-
-
-
⚠️ Low Stock Alerts5 items
-
-
-
-
- - - -
CategoryTotal AssetsActiveIdleMaintenanceMin ThresholdStatusActions
-
-
- - -
-
-
-
📍 Location Tree
-
-
    -
    -
    -
    -
    Select a location
    -
    -
    📍
    No location selected
    Click on a location from the tree to view its assets
    -
    -
    -
    -
    - - -
    -
    -
    🔍
    - - -
    -
    - - - -
    DateMovement TypeAsset / ItemFromToQtyReferenceBy
    -
    -
    - - -
    -
    -
    -
    -
    Assets Found
    -
    1,198
    -
    96.1% of total
    -
    -
    -
    -
    Not Found
    -
    49
    -
    3.9% – Under investigation
    -
    -
    -
    ⚠️
    -
    Discrepancies
    -
    7
    -
    Location mismatches
    -
    -
    -
    -
    ℹ️
    -
    Last Physical Audit: Q4 FY 2024-25 (March 2025)
    -
    Next scheduled audit: Q2 FY 2025-26 (September 2025). Audited by: Kavya Nair, Deepak Joshi
    -
    - -
    -
    - - - -
    Asset IDAsset NameSystem LocationPhysical LocationStatusAction
    -
    -
    -
    -
    -
    -
    - - - - - - - -
    - - - - - diff --git a/js/app.js b/js/app.js index 718d62d0..98f57fde 100644 --- a/js/app.js +++ b/js/app.js @@ -2,13 +2,29 @@ // AMS — Core Application Logic | app.js // ================================================================ +/* ── HTML escaping (XSS-safe output) ───────────────────────────── */ +function escapeHtml(value) { + if (value === null || value === undefined) return ''; + return String(value) + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); +} +// Escape for use inside a single-quoted JS string in an inline handler. +function escapeJs(value) { + if (value === null || value === undefined) return ''; + return String(value).replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/"/g, '"').replace(/ { const href = el.getAttribute('href') || ''; - if (href && page === href) el.classList.add('active'); - else el.classList.remove('active'); + el.classList.toggle('active', !!href && href === active); }); } @@ -156,6 +172,42 @@ function initTrees() { }); } +/* ── Theme Toggle (light / dark) ─────────────────────────────── */ +function getTheme() { + return document.documentElement.getAttribute('data-theme') || 'light'; +} +function setTheme(theme) { + document.documentElement.setAttribute('data-theme', theme); + localStorage.setItem('AMS_THEME', theme); + updateThemeUI(); + if (window.lucide) lucide.createIcons(); +} +function toggleTheme() { + setTheme(getTheme() === 'dark' ? 'light' : 'dark'); +} +function updateThemeUI() { + const dark = getTheme() === 'dark'; + const btn = document.getElementById('themeToggle'); + if (btn) { + btn.innerHTML = ``; + btn.title = dark ? 'Switch to light theme' : 'Switch to dark theme'; + } + // Keep Settings → Appearance theme cards in sync if present + document.querySelectorAll('[data-theme-opt]').forEach(opt => { + opt.classList.toggle('selected', opt.getAttribute('data-theme-opt') === getTheme()); + }); +} +function injectThemeToggle() { + const actions = document.querySelector('.topbar-actions'); + if (!actions || document.getElementById('themeToggle')) return; + const btn = document.createElement('button'); + btn.className = 'icon-btn'; + btn.id = 'themeToggle'; + btn.setAttribute('onclick', 'toggleTheme()'); + actions.insertBefore(btn, actions.firstChild); + updateThemeUI(); +} + /* ── Notif Panel ─────────────────────────────────────────────── */ function initNotifPanel() { const bell = document.getElementById('notifBell'); @@ -167,15 +219,210 @@ function initNotifPanel() { } /* ── Sidebar User Info ─────────────────────────────────────── */ +/* ── Sidebar User Info ─────────────────────────────────────── */ +const Permissions = { + 'Super Admin': { + viewAllAssets: true, createEditAssets: true, deleteDispose: true, + assignAssets: true, transferAssets: true, viewFinancials: true, + approvePR: true, raiseTickets: true, manageUsers: true, systemSettings: true + }, + 'Asset Manager': { + viewAllAssets: true, createEditAssets: true, deleteDispose: true, + assignAssets: true, transferAssets: true, viewFinancials: true, + approvePR: true, raiseTickets: true, manageUsers: false, systemSettings: false + }, + 'IT Head': { + viewAllAssets: true, createEditAssets: true, deleteDispose: false, + assignAssets: true, transferAssets: true, viewFinancials: false, + approvePR: false, raiseTickets: true, manageUsers: true, systemSettings: false + }, + 'Asset Coordinator': { + viewAllAssets: true, createEditAssets: true, deleteDispose: false, + assignAssets: true, transferAssets: true, viewFinancials: false, + approvePR: false, raiseTickets: true, manageUsers: false, systemSettings: false + }, + 'Department Head': { + viewAllAssets: true, createEditAssets: false, deleteDispose: false, + assignAssets: true, transferAssets: true, viewFinancials: false, + approvePR: true, raiseTickets: true, manageUsers: false, systemSettings: false + }, + 'Finance Head': { + viewAllAssets: true, createEditAssets: false, deleteDispose: false, + assignAssets: false, transferAssets: false, viewFinancials: true, + approvePR: true, raiseTickets: true, manageUsers: false, systemSettings: false + }, + 'Employee': { + viewAllAssets: false, createEditAssets: false, deleteDispose: false, + assignAssets: false, transferAssets: false, viewFinancials: false, + approvePR: false, raiseTickets: true, manageUsers: false, systemSettings: false + } +}; + +function checkPermission(perm) { + if (!window.AMS || !window.AMS.currentUser) return false; + const role = window.AMS.currentUser.role; + const rolePerms = Permissions[role] || Permissions['Employee']; + return !!rolePerms[perm]; +} + function populateSidebarUser() { if (!window.AMS) return; const u = AMS.currentUser; - const nameEl = document.getElementById('sidebarUserName'); - const roleEl = document.getElementById('sidebarUserRole'); - const avEl = document.getElementById('sidebarUserAv'); - if (nameEl) nameEl.textContent = u.name; - if (roleEl) roleEl.textContent = u.role; - if (avEl) avEl.textContent = u.avatar; + + // Hook the click listener on sidebar footer or user card to open switcher + const card = document.querySelector('.user-card, .sidebar-footer'); + if (card) { + card.style.cursor = 'pointer'; + card.title = 'Click to switch simulated role'; + card.addEventListener('click', (e) => { + e.preventDefault(); + openRoleSwitcherModal(); + }); + } + + const nameEls = document.querySelectorAll('.user-name, #sidebarUserName'); + const roleEls = document.querySelectorAll('.user-role, #sidebarUserRole'); + const avEls = document.querySelectorAll('.user-av, #sidebarUserAv'); + + nameEls.forEach(el => el.textContent = u.name); + roleEls.forEach(el => el.textContent = u.role); + avEls.forEach(el => el.textContent = u.avatar); +} + +function openRoleSwitcherModal() { + let modal = document.getElementById('dynRoleModal'); + if (!modal) { + modal = document.createElement('div'); + modal.id = 'dynRoleModal'; + modal.className = 'modal-overlay'; + modal.style.zIndex = '9999'; + modal.innerHTML = ` + + `; + document.body.appendChild(modal); + modal.addEventListener('click', e => { if (e.target === modal) closeModal('dynRoleModal'); }); + } + + const list = document.getElementById('dynRoleList'); + list.innerHTML = AMS.users.map(u => ` + + `).join(''); + + openModal('dynRoleModal'); +} + +function switchSimUser(userId) { + const u = AMS.users.find(x => x.id === userId); + if (u) { + AMS.currentUser = u; + AMS.save(); + closeModal('dynRoleModal'); + showToast('Role Switched', `Logged in as ${u.name} (${u.role})`, 'success'); + setTimeout(() => { + const page = window.location.pathname.split('/').pop() || 'dashboard.html'; + if (u.role === 'Employee' && ['settings.html', 'users.html', 'asset-create.html'].some(p => page.includes(p))) { + window.location.href = 'dashboard.html'; + } else { + window.location.reload(); + } + }, 800); + } +} + +function applyRolePermissions() { + if (!window.AMS || !window.AMS.currentUser) return; + const u = AMS.currentUser; + const page = window.location.pathname.split('/').pop() || 'dashboard.html'; + + // Page access control + if (page.includes('settings.html') && !checkPermission('systemSettings')) { + showAccessDenied(); + return; + } + if (page.includes('users.html') && !checkPermission('manageUsers')) { + showAccessDenied(); + return; + } + if (page.includes('asset-create.html') && !checkPermission('createEditAssets')) { + showAccessDenied(); + return; + } + + // Hide sidebar sections/links + document.querySelectorAll('.sidebar-nav .nav-item').forEach(item => { + const href = item.getAttribute('href') || ''; + if (href.includes('settings.html') && !checkPermission('systemSettings')) { + item.style.display = 'none'; + } + if (href.includes('users.html') && !checkPermission('manageUsers')) { + item.style.display = 'none'; + } + if (href.includes('asset-create.html') && !checkPermission('createEditAssets')) { + item.style.display = 'none'; + } + if (u.role === 'Employee') { + if (href.includes('reports.html')) { + item.style.display = 'none'; + } + } + }); + + // Disable / Hide edit operations + if (!checkPermission('createEditAssets')) { + document.querySelectorAll('.btn-primary[href="asset-create.html"], a[href="asset-create.html"], button[onclick*="openModal(\'editModal\')"], button[onclick*="saveEdit"]').forEach(el => { + el.style.display = 'none'; + }); + } + if (!checkPermission('assignAssets')) { + document.querySelectorAll('button[onclick*="openAssignModal"], button[onclick*="openModal(\'assignModal\')"], button[title="Assign"]').forEach(el => { + el.style.display = 'none'; + }); + } + if (!checkPermission('transferAssets')) { + document.querySelectorAll('button[onclick*="openTransferModal"], button[onclick*="openModal(\'transferModal\')"], button[title="Transfer"]').forEach(el => { + el.style.display = 'none'; + }); + } + if (!checkPermission('deleteDispose')) { + document.querySelectorAll('button[onclick*="confirmDispose"], button[onclick*="bulkAction(\'dispose\')"], button[title="Dispose"]').forEach(el => { + el.style.display = 'none'; + }); + } +} + +function showAccessDenied() { + document.body.innerHTML = ` +
    +
    🚫
    +

    Access Denied

    +

    You do not have the required permissions to access this module. Current Role: ${AMS.currentUser.role}

    + +
    + `; } /* ── Topbar Notifications Badge ─────────────────────────────── */ @@ -237,13 +484,11 @@ function downloadCSV(data, filename='export.csv') { /* ── Generate QR SVG Pattern ───────────────────────────────── */ function generateQRPattern(seed) { - // Deterministic pseudo-QR pattern based on seed string let hash = 0; for (let i=0; i { hash = (hash * 1103515245 + 12345) | 0; return Math.abs(hash) % n; }; const cells = []; for (let i=0;i<49;i++) cells.push(rand(2)); - // Force finder pattern corners const corners = [0,1,2,3,4,5,6,7,14,21,28,35,42,43,44,45,46,47,48]; corners.forEach(i => cells[i] = i%7<1 || i%7>5 || Math.floor(i/7)<1 || Math.floor(i/7)>5 ? 1 : 0); return cells; @@ -256,9 +501,15 @@ document.addEventListener('DOMContentLoaded', () => { initDropdowns(); initTrees(); initNotifPanel(); + injectThemeToggle(); populateSidebarUser(); populateNotifBadge(); renderNotifPanel(); + applyRolePermissions(); + + if (window.lucide) { + lucide.createIcons(); + } // Auto close modal on overlay click document.querySelectorAll('.modal-overlay').forEach(ov => { diff --git a/js/data.js b/js/data.js index 1ed1b7ff..230713ab 100644 --- a/js/data.js +++ b/js/data.js @@ -1,9 +1,8 @@ // ================================================================ -// AMS — Sample Data Store | Version 1.0 +// AMS — Sample Data Store | Version 1.0 (Persistent V1) // ================================================================ -const AMS = { - +const defaultData = { currentUser: { id: 'u001', name: 'Arjun Sharma', email: 'arjun.sharma@acmecorp.com', role: 'Asset Manager', dept: 'IT', avatar: 'AS', location: 'HQ – Bengaluru' @@ -16,67 +15,81 @@ const AMS = { }, stats: { - total: 1247, active: 1089, maintenance: 47, idle: 63, disposed: 48, - totalValue: 42850000, netValue: 30100000, depreciated: 12750000, + total: 1251, active: 1093, maintenance: 47, idle: 63, disposed: 48, + totalValue: 43360000, netValue: 30610000, depreciated: 12750000, pendingTickets: 12, lowStock: 5, expiringAMC: 3, pendingPRs: 8 }, + projects: [ + { id: 'PRJ-001', name: 'Project Apollo', manager: 'Priya Kumar', dept: 'IT' }, + { id: 'PRJ-002', name: 'Cloud Migration', manager: 'Vikram Reddy', dept: 'IT' }, + { id: 'PRJ-003', name: 'Acme Website Redesign', manager: 'Sneha Patel', dept: 'Marketing' }, + { id: 'PRJ-004', name: 'Finance Audit V2', manager: 'Rahul Mehta', dept: 'Finance' } + ], + assets: [ - { id:'AST-2025-001', name:'Dell Latitude 5540', cat:'Laptops', serial:'DL5540-8K2J9', status:'Active', dept:'IT', loc:'IT Dept – Floor 2', assignee:'Priya Kumar', purchase:'2024-01-15', cost:85000, value:68000, vendor:'Dell India', warranty:'2027-01-15', depM:'SLM', depR:20, icon:'💻' }, - { id:'AST-2025-002', name:'HP LaserJet Pro M404', cat:'Printers', serial:'HP-LJ404-3F7K1', status:'Active', dept:'Finance', loc:'Finance – Floor 1', assignee:'Shared', purchase:'2023-08-20', cost:24000, value:17600, vendor:'HP India', warranty:'2025-08-20', depM:'SLM', depR:25, icon:'🖨️' }, - { id:'AST-2025-003', name:'Apple MacBook Pro 14"', cat:'Laptops', serial:'MPB14-C7R5X', status:'Active', dept:'Marketing', loc:'Marketing – Floor 3', assignee:'Sneha Patel', purchase:'2024-03-10', cost:195000, value:175500, vendor:'Apple India', warranty:'2026-03-10', depM:'SLM', depR:20, icon:'💻' }, - { id:'AST-2025-004', name:'Dell PowerEdge R740', cat:'Servers', serial:'PE-R740-9M4L2', status:'Active', dept:'IT', loc:'Server Room – B1', assignee:'IT Team', purchase:'2023-05-01', cost:380000, value:266000, vendor:'Dell India', warranty:'2026-05-01', depM:'WDV', depR:30, icon:'🖥️' }, - { id:'AST-2025-005', name:'Daikin 1.5T Split AC', cat:'HVAC', serial:'DK-FTKG-2024-05', status:'Under Maintenance', dept:'HR', loc:'HR – Floor 2', assignee:'Shared', purchase:'2022-04-15', cost:45000, value:25650, vendor:'Daikin India', warranty:'2024-04-15', depM:'SLM', depR:15, icon:'❄️' }, - { id:'AST-2025-006', name:'Lenovo ThinkPad X1 Carbon',cat:'Laptops', serial:'LN-X1C-7P3Q8', status:'Active', dept:'Operations',loc:'Operations – Floor 1', assignee:'Vikram Reddy', purchase:'2024-02-01', cost:125000, value:112500, vendor:'Lenovo India', warranty:'2027-02-01', depM:'SLM', depR:20, icon:'💻' }, - { id:'AST-2025-007', name:'Epson EB-2250U Projector', cat:'AV Equipment', serial:'EP-EB2250-6N9R', status:'Idle', dept:'Admin', loc:'Conference Room A', assignee:'Unassigned', purchase:'2023-11-10', cost:78000, value:62400, vendor:'Epson India', warranty:'2025-11-10', depM:'SLM', depR:20, icon:'📽️' }, - { id:'AST-2025-008', name:'Cisco Catalyst 9300', cat:'Networking', serial:'CS-C9300-4K7J', status:'Active', dept:'IT', loc:'Server Room – B1', assignee:'Network Team', purchase:'2023-07-20', cost:145000, value:101500, vendor:'Cisco Systems', warranty:'2026-07-20', depM:'WDV', depR:30, icon:'🔌' }, - { id:'AST-2025-009', name:'iPhone 15 Pro', cat:'Mobile Devices', serial:'IP15P-A2M8K', status:'Active', dept:'Marketing', loc:'Sales Floor', assignee:'Raj Patel', purchase:'2024-01-05', cost:134900, value:121410, vendor:'Apple India', warranty:'2026-01-05', depM:'SLM', depR:20, icon:'📱' }, - { id:'AST-2025-010', name:'Canon EOS R5 Camera', cat:'AV Equipment', serial:'CN-EOSR5-2B7K', status:'Active', dept:'Marketing', loc:'Marketing – Floor 3', assignee:'Content Team', purchase:'2023-09-15', cost:285000, value:228000, vendor:'Canon India', warranty:'2025-09-15', depM:'SLM', depR:20, icon:'📷' }, - { id:'AST-2025-011', name:'Steelcase Leap V2 Chair', cat:'Furniture', serial:'SC-LV2-9P3X2', status:'Active', dept:'IT', loc:'IT Dept – Floor 2', assignee:'Priya Kumar', purchase:'2022-06-01', cost:35000, value:21000, vendor:'Steelcase India', warranty:'2027-06-01', depM:'SLM', depR:10, icon:'🪑' }, - { id:'AST-2025-012', name:'APC Smart UPS 3KVA', cat:'Power Equipment',serial:'APC-SM3K-7Y4L', status:'Active', dept:'IT', loc:'Server Room – B1', assignee:'IT Team', purchase:'2023-03-10', cost:28000, value:21000, vendor:'Schneider Elec.', warranty:'2025-03-10', depM:'SLM', depR:25, icon:'🔋' }, - { id:'AST-2025-013', name:'Samsung 43" Display', cat:'Displays', serial:'SM-43D-5R2M9', status:'Active', dept:'Admin', loc:'Reception – Floor 1', assignee:'Shared', purchase:'2024-01-20', cost:42000, value:39900, vendor:'Samsung India', warranty:'2025-01-20', depM:'SLM', depR:25, icon:'🖥️' }, - { id:'AST-2025-014', name:'Honda City (Company Car)', cat:'Vehicles', serial:'MH12CC4567', status:'Active', dept:'Admin', loc:'Parking – B1', assignee:'Driver Pool', purchase:'2022-12-01', cost:1350000, value:945000, vendor:'Honda Dealers', warranty:'2025-12-01', depM:'WDV', depR:15, icon:'🚗' }, - { id:'AST-2025-015', name:'HP ProDesk 600 Desktop', cat:'Desktops', serial:'HP-PD600-8K3X', status:'Idle', dept:'Finance', loc:'Finance – Floor 1', assignee:'Unassigned', purchase:'2021-08-15', cost:55000, value:11000, vendor:'HP India', warranty:'2023-08-15', depM:'SLM', depR:20, icon:'🖥️' }, - { id:'AST-2025-016', name:'Ricoh Aficio Photocopier', cat:'Printers', serial:'RC-AF-5502-7P', status:'Under Maintenance',dept:'Admin', loc:'Admin – Floor 1', assignee:'Shared', purchase:'2022-03-20', cost:175000, value:87500, vendor:'Ricoh India', warranty:'2024-03-20', depM:'SLM', depR:25, icon:'🖨️' }, - { id:'AST-2025-017', name:'Cisco IP Phone 8841', cat:'Networking', serial:'CS-8841-3P7K', status:'Active', dept:'HR', loc:'HR – Floor 2', assignee:'Anita Singh', purchase:'2023-06-10', cost:18500, value:12950, vendor:'Cisco Systems', warranty:'2025-06-10', depM:'SLM', depR:25, icon:'☎️' }, - { id:'AST-2025-018', name:'Tata Nexon EV', cat:'Vehicles', serial:'MH12EV1234', status:'Active', dept:'Admin', loc:'Parking – B1', assignee:'Exec Pool', purchase:'2024-02-15', cost:1650000, value:1567500, vendor:'Tata Motors', warranty:'2027-02-15', depM:'WDV', depR:15, icon:'🚗' }, - { id:'AST-2025-019', name:'Synology NAS DS920+', cat:'Storage', serial:'SY-DS920-4M7K', status:'Active', dept:'IT', loc:'Server Room – B1', assignee:'IT Team', purchase:'2023-10-05', cost:62000, value:49600, vendor:'Synology', warranty:'2026-10-05', depM:'SLM', depR:20, icon:'💾' }, - { id:'AST-2025-020', name:'Godrej Steel Almirah', cat:'Furniture', serial:'GJ-SS-2023-012', status:'Active', dept:'Finance', loc:'Finance – Floor 1', assignee:'Shared', purchase:'2021-05-20', cost:22000, value:13200, vendor:'Godrej Interio', warranty:'N/A', depM:'SLM', depR:10, icon:'🗄️' } + // Physical Assets (Original) + { id:'AST-2025-001', name:'Dell Latitude 5540', cat:'Laptops', serial:'DL5540-8K2J9', status:'Active', dept:'IT', loc:'IT Dept – Floor 2', assignee:'Priya Kumar', purchase:'2024-01-15', cost:85000, value:68000, vendor:'Dell India', warranty:'2027-01-15', depM:'SLM', depR:20, icon:'💻', type:'physical' }, + { id:'AST-2025-002', name:'HP LaserJet Pro M404', cat:'Printers', serial:'HP-LJ404-3F7K1', status:'Active', dept:'Finance', loc:'Finance – Floor 1', assignee:'Shared', purchase:'2023-08-20', cost:24000, value:17600, vendor:'HP India', warranty:'2025-08-20', depM:'SLM', depR:25, icon:'🖨️', type:'physical' }, + { id:'AST-2025-003', name:'Apple MacBook Pro 14"', cat:'Laptops', serial:'MPB14-C7R5X', status:'Active', dept:'Marketing', loc:'Marketing – Floor 3', assignee:'Sneha Patel', purchase:'2024-03-10', cost:195000, value:175500, vendor:'Apple India', warranty:'2026-03-10', depM:'SLM', depR:20, icon:'💻', type:'physical' }, + { id:'AST-2025-004', name:'Dell PowerEdge R740', cat:'Servers', serial:'PE-R740-9M4L2', status:'Active', dept:'IT', loc:'Server Room – B1', assignee:'IT Team', purchase:'2023-05-01', cost:380000, value:266000, vendor:'Dell India', warranty:'2026-05-01', depM:'WDV', depR:30, icon:'🖥️', type:'physical' }, + { id:'AST-2025-005', name:'Daikin 1.5T Split AC', cat:'HVAC', serial:'DK-FTKG-2024-05', status:'Under Maintenance', dept:'HR', loc:'HR – Floor 2', assignee:'Shared', purchase:'2022-04-15', cost:45000, value:25650, vendor:'Daikin India', warranty:'2024-04-15', depM:'SLM', depR:15, icon:'❄️', type:'physical' }, + { id:'AST-2025-006', name:'Lenovo ThinkPad X1 Carbon',cat:'Laptops', serial:'LN-X1C-7P3Q8', status:'Active', dept:'Operations',loc:'Operations – Floor 1', assignee:'Vikram Reddy', purchase:'2024-02-01', cost:125000, value:112500, vendor:'Lenovo India', warranty:'2027-02-01', depM:'SLM', depR:20, icon:'💻', type:'physical' }, + { id:'AST-2025-007', name:'Epson EB-2250U Projector', cat:'AV Equipment', serial:'EP-EB2250-6N9R', status:'Idle', dept:'Admin', loc:'Conference Room A', assignee:'Unassigned', purchase:'2023-11-10', cost:78000, value:62400, vendor:'Epson India', warranty:'2025-11-10', depM:'SLM', depR:20, icon:'📽️', type:'physical' }, + { id:'AST-2025-008', name:'Cisco Catalyst 9300', cat:'Networking', serial:'CS-C9300-4K7J', status:'Active', dept:'IT', loc:'Server Room – B1', assignee:'Network Team', purchase:'2023-07-20', cost:145000, value:101500, vendor:'Cisco Systems', warranty:'2026-07-20', depM:'WDV', depR:30, icon:'🔌', type:'physical' }, + { id:'AST-2025-009', name:'iPhone 15 Pro', cat:'Mobile Devices', serial:'IP15P-A2M8K', status:'Active', dept:'Marketing', loc:'Sales Floor', assignee:'Raj Patel', purchase:'2024-01-05', cost:134900, value:121410, vendor:'Apple India', warranty:'2026-01-05', depM:'SLM', depR:20, icon:'📱', type:'physical' }, + { id:'AST-2025-010', name:'Canon EOS R5 Camera', cat:'AV Equipment', serial:'CN-EOSR5-2B7K', status:'Active', dept:'Marketing', loc:'Marketing – Floor 3', assignee:'Content Team', purchase:'2023-09-15', cost:285000, value:228000, vendor:'Canon India', warranty:'2025-09-15', depM:'SLM', depR:20, icon:'📷', type:'physical' }, + { id:'AST-2025-011', name:'Steelcase Leap V2 Chair', cat:'Furniture', serial:'SC-LV2-9P3X2', status:'Active', dept:'IT', loc:'IT Dept – Floor 2', assignee:'Priya Kumar', purchase:'2022-06-01', cost:35000, value:21000, vendor:'Steelcase India', warranty:'2027-06-01', depM:'SLM', depR:10, icon:'🪑', type:'physical' }, + { id:'AST-2025-012', name:'APC Smart UPS 3KVA', cat:'Power Equipment',serial:'APC-SM3K-7Y4L', status:'Active', dept:'IT', loc:'Server Room – B1', assignee:'IT Team', purchase:'2023-03-10', cost:28000, value:21000, vendor:'Schneider Elec.', warranty:'2025-03-10', depM:'SLM', depR:25, icon:'🔋', type:'physical' }, + { id:'AST-2025-013', name:'Samsung 43" Display', cat:'Displays', serial:'SM-43D-5R2M9', status:'Active', dept:'Admin', loc:'Reception – Floor 1', assignee:'Shared', purchase:'2024-01-20', cost:42000, value:39900, vendor:'Samsung India', warranty:'2025-01-20', depM:'SLM', depR:25, icon:'🖥️', type:'physical' }, + { id:'AST-2025-014', name:'Honda City (Company Car)', cat:'Vehicles', serial:'MH12CC4567', status:'Active', dept:'Admin', loc:'Parking – B1', assignee:'Driver Pool', purchase:'2022-12-01', cost:1350000, value:945000, vendor:'Honda Dealers', warranty:'2025-12-01', depM:'WDV', depR:15, icon:'🚗', type:'physical' }, + { id:'AST-2025-015', name:'HP ProDesk 600 Desktop', cat:'Desktops', serial:'HP-PD600-8K3X', status:'Idle', dept:'Finance', loc:'Finance – Floor 1', assignee:'Unassigned', purchase:'2021-08-15', cost:55000, value:11000, vendor:'HP India', warranty:'2023-08-15', depM:'SLM', depR:20, icon:'🖥️', type:'physical' }, + { id:'AST-2025-016', name:'Ricoh Aficio Photocopier', cat:'Printers', serial:'RC-AF-5502-7P', status:'Under Maintenance',dept:'Admin', loc:'Admin – Floor 1', assignee:'Shared', purchase:'2022-03-20', cost:175000, value:87500, vendor:'Ricoh India', warranty:'2024-03-20', depM:'SLM', depR:25, icon:'🖨️', type:'physical' }, + { id:'AST-2025-017', name:'Cisco IP Phone 8841', cat:'Networking', serial:'CS-8841-3P7K', status:'Active', dept:'HR', loc:'HR – Floor 2', assignee:'Anita Singh', purchase:'2023-06-10', cost:18500, value:12950, vendor:'Cisco Systems', warranty:'2025-06-10', depM:'SLM', depR:25, icon:'☎️', type:'physical' }, + { id:'AST-2025-018', name:'Tata Nexon EV', cat:'Vehicles', serial:'MH12EV1234', status:'Active', dept:'Admin', loc:'Parking – B1', assignee:'Exec Pool', purchase:'2024-02-15', cost:1650000, value:1567500, vendor:'Tata Motors', warranty:'2027-02-15', depM:'WDV', depR:15, icon:'🚗', type:'physical' }, + { id:'AST-2025-019', name:'Synology NAS DS920+', cat:'Storage', serial:'SY-DS920-4M7K', status:'Active', dept:'IT', loc:'Server Room – B1', assignee:'IT Team', purchase:'2023-10-05', cost:62000, value:49600, vendor:'Synology', warranty:'2026-10-05', depM:'SLM', depR:20, icon:'💾', type:'physical' }, + { id:'AST-2025-020', name:'Godrej Steel Almirah', cat:'Furniture', serial:'GJ-SS-2023-012', status:'Active', dept:'Finance', loc:'Finance – Floor 1', assignee:'Shared', purchase:'2021-05-20', cost:22000, value:13200, vendor:'Godrej Interio', warranty:'N/A', depM:'SLM', depR:10, icon:'🗄️', type:'physical' }, + + // Digital Assets (New V1 features) + { id:'AST-2025-021', name:'Microsoft 365 Enterprise', cat:'Software Licenses', serial:'M365-50S-2025', status:'Active', dept:'IT', loc:'Cloud Environment', assignee:'IT Team', purchase:'2025-01-10', cost:180000, value:120000, vendor:'Microsoft India', warranty:'2026-01-10', depM:'SLM', depR:100, icon:'🔑', type:'digital', licenseKey:'M365-XXXX-XXXX-YYYY', seatsTotal:50, seatsAlloc:42, project:'Project Apollo' }, + { id:'AST-2025-022', name:'AWS Production Hosting', cat:'Cloud Subscriptions',serial:'AWS-ACME-PROD', status:'Active', dept:'IT', loc:'AWS Mumbai region', assignee:'Network Team', purchase:'2025-03-01', cost:250000, value:250000, vendor:'Amazon Web Services',warranty:'2026-03-01', depM:'SLM', depR:100, icon:'☁️', type:'digital', billingCycle:'Monthly', provider:'AWS Cloud', project:'Cloud Migration' }, + { id:'AST-2025-023', name:'Adobe Creative Suite', cat:'Software Licenses', serial:'ADOBE-CC-15S', status:'Active', dept:'Marketing', loc:'Cloud Environment', assignee:'Sneha Patel', purchase:'2024-07-20', cost:85000, value:17000, vendor:'Adobe Systems', warranty:'2025-07-20', depM:'SLM', depR:100, icon:'🔑', type:'digital', licenseKey:'ADOB-CREA-FLOW-1111', seatsTotal:15, seatsAlloc:12, project:'Acme Website Redesign' }, + { id:'AST-2025-024', name:'GitHub Enterprise Server', cat:'Software Licenses', serial:'GHUB-ENT-50S', status:'Active', dept:'IT', loc:'Local VM', assignee:'Priya Kumar', purchase:'2025-02-10', cost:90000, value:90000, vendor:'GitHub Inc', warranty:'2026-02-10', depM:'SLM', depR:100, icon:'🔑', type:'digital', licenseKey:'GHUB-9999-8888-7777', seatsTotal:50, seatsAlloc:48, project:'Cloud Migration' } ], users: [ - { id:'u001', name:'Arjun Sharma', email:'arjun.sharma@acmecorp.com', role:'Asset Manager', dept:'IT', status:'Active', lastLogin:'2025-05-28 09:12', av:'AS', color:'#6366F1' }, - { id:'u002', name:'Priya Kumar', email:'priya.kumar@acmecorp.com', role:'IT Head', dept:'IT', status:'Active', lastLogin:'2025-05-28 08:45', av:'PK', color:'#10B981' }, - { id:'u003', name:'Rahul Mehta', email:'rahul.mehta@acmecorp.com', role:'Finance Head', dept:'Finance', status:'Active', lastLogin:'2025-05-27 17:30', av:'RM', color:'#F59E0B' }, - { id:'u004', name:'Anita Singh', email:'anita.singh@acmecorp.com', role:'HR Manager', dept:'HR', status:'Active', lastLogin:'2025-05-28 10:02', av:'AS', color:'#A855F7' }, - { id:'u005', name:'Vikram Reddy', email:'vikram.reddy@acmecorp.com', role:'Operations Head', dept:'Operations',status:'Active', lastLogin:'2025-05-26 14:20', av:'VR', color:'#06B6D4' }, - { id:'u006', name:'Sneha Patel', email:'sneha.patel@acmecorp.com', role:'Marketing Lead', dept:'Marketing', status:'Active', lastLogin:'2025-05-28 11:00', av:'SP', color:'#EF4444' }, - { id:'u007', name:'Deepak Joshi', email:'deepak.joshi@acmecorp.com', role:'Admin Officer', dept:'Admin', status:'Active', lastLogin:'2025-05-27 09:30', av:'DJ', color:'#3B82F6' }, - { id:'u008', name:'Kavya Nair', email:'kavya.nair@acmecorp.com', role:'Asset Coordinator',dept:'IT', status:'Active', lastLogin:'2025-05-28 09:55', av:'KN', color:'#10B981' }, - { id:'u009', name:'Raj Patel', email:'raj.patel@acmecorp.com', role:'Sales Executive', dept:'Marketing', status:'Inactive',lastLogin:'2025-05-20 16:10', av:'RP', color:'#6366F1' }, - { id:'u010', name:'System Admin', email:'admin@acmecorp.com', role:'Super Admin', dept:'IT', status:'Active', lastLogin:'2025-05-28 07:00', av:'SA', color:'#F59E0B' } + { id:'u001', name:'Arjun Sharma', email:'arjun.sharma@acmecorp.com', role:'Asset Manager', dept:'IT', status:'Active', lastLogin:'2026-06-04 09:12', av:'AS', color:'#6366F1' }, + { id:'u002', name:'Priya Kumar', email:'priya.kumar@acmecorp.com', role:'IT Head', dept:'IT', status:'Active', lastLogin:'2026-06-04 08:45', av:'PK', color:'#10B981' }, + { id:'u003', name:'Rahul Mehta', email:'rahul.mehta@acmecorp.com', role:'Finance Head', dept:'Finance', status:'Active', lastLogin:'2026-06-03 17:30', av:'RM', color:'#F59E0B' }, + { id:'u004', name:'Anita Singh', email:'anita.singh@acmecorp.com', role:'HR Manager', dept:'HR', status:'Active', lastLogin:'2026-06-04 10:02', av:'AS', color:'#A855F7' }, + { id:'u005', name:'Vikram Reddy', email:'vikram.reddy@acmecorp.com', role:'Operations Head', dept:'Operations',status:'Active', lastLogin:'2026-06-02 14:20', av:'VR', color:'#06B6D4' }, + { id:'u006', name:'Sneha Patel', email:'sneha.patel@acmecorp.com', role:'Marketing Lead', dept:'Marketing', status:'Active', lastLogin:'2026-06-04 11:00', av:'SP', color:'#EF4444' }, + { id:'u007', name:'Deepak Joshi', email:'deepak.joshi@acmecorp.com', role:'Admin Officer', dept:'Admin', status:'Active', lastLogin:'2026-06-03 09:30', av:'DJ', color:'#3B82F6' }, + { id:'u008', name:'Kavya Nair', email:'kavya.nair@acmecorp.com', role:'Asset Coordinator',dept:'IT', status:'Active', lastLogin:'2026-06-04 09:55', av:'KN', color:'#10B981' }, + { id:'u009', name:'Raj Patel', email:'raj.patel@acmecorp.com', role:'Sales Executive', dept:'Marketing', status:'Inactive',lastLogin:'2026-05-20 16:10', av:'RP', color:'#6366F1' }, + { id:'u010', name:'System Admin', email:'admin@acmecorp.com', role:'Super Admin', dept:'IT', status:'Active', lastLogin:'2026-06-04 07:00', av:'SA', color:'#F59E0B' } ], tickets: [ - { id:'TKT-001', title:'Laptop keyboard not working', asset:'AST-2025-001', assetName:'Dell Latitude 5540', priority:'High', status:'In Progress', assignedTo:'Kavya Nair', created:'2025-05-26', dept:'IT', category:'Hardware Failure' }, - { id:'TKT-002', title:'AC not cooling – HR floor', asset:'AST-2025-005', assetName:'Daikin 1.5T Split AC', priority:'Critical', status:'In Progress', assignedTo:'External AMC', created:'2025-05-27', dept:'HR', category:'Performance Issue' }, - { id:'TKT-003', title:'Printer paper jam frequent', asset:'AST-2025-002', assetName:'HP LaserJet Pro M404', priority:'Medium', status:'Open', assignedTo:'Unassigned', created:'2025-05-28', dept:'Finance', category:'Mechanical Issue' }, - { id:'TKT-004', title:'Projector lamp replacement', asset:'AST-2025-007', assetName:'Epson EB-2250U Projector', priority:'Low', status:'Pending Parts', assignedTo:'Kavya Nair', created:'2025-05-22', dept:'Admin', category:'Consumable Replacement' }, - { id:'TKT-005', name:'Photocopier not turning on', asset:'AST-2025-016', assetName:'Ricoh Aficio Photocopier', priority:'High', status:'Open', assignedTo:'Unassigned', created:'2025-05-28', dept:'Admin', category:'Electrical Issue' }, - { id:'TKT-006', title:'Network switch port failure', asset:'AST-2025-008', assetName:'Cisco Catalyst 9300', priority:'Critical', status:'Resolved', assignedTo:'IT Team', created:'2025-05-24', dept:'IT', category:'Network Issue' }, - { id:'TKT-007', title:'UPS battery replacement due', asset:'AST-2025-012', assetName:'APC Smart UPS 3KVA', priority:'High', status:'Pending Parts', assignedTo:'Vendor', created:'2025-05-25', dept:'IT', category:'Battery Replacement' }, - { id:'TKT-008', title:'Server fan making loud noise', asset:'AST-2025-004', assetName:'Dell PowerEdge R740', priority:'Medium', status:'In Progress', assignedTo:'Dell Support',created:'2025-05-27', dept:'IT', category:'Hardware Issue' } + { id:'TKT-001', title:'Laptop keyboard not working', asset:'AST-2025-001', assetName:'Dell Latitude 5540', priority:'High', status:'In Progress', assignedTo:'Kavya Nair', created:'2026-05-26', dept:'IT', category:'Hardware Failure' }, + { id:'TKT-002', title:'AC not cooling – HR floor', asset:'AST-2025-005', assetName:'Daikin 1.5T Split AC', priority:'Critical', status:'In Progress', assignedTo:'External AMC', created:'2026-05-27', dept:'HR', category:'Performance Issue' }, + { id:'TKT-003', title:'Printer paper jam frequent', asset:'AST-2025-002', assetName:'HP LaserJet Pro M404', priority:'Medium', status:'Open', assignedTo:'Unassigned', created:'2026-06-02', dept:'Finance', category:'Mechanical Issue' }, + { id:'TKT-004', title:'Projector lamp replacement', asset:'AST-2025-007', assetName:'Epson EB-2250U Projector', priority:'Low', status:'Pending Parts', assignedTo:'Kavya Nair', created:'2026-05-22', dept:'Admin', category:'Consumable Replacement' }, + { id:'TKT-005', title:'Photocopier not turning on', asset:'AST-2025-016', assetName:'Ricoh Aficio Photocopier', priority:'High', status:'Open', assignedTo:'Unassigned', created:'2026-06-04', dept:'Admin', category:'Electrical Issue' }, + { id:'TKT-006', title:'Network switch port failure', asset:'AST-2025-008', assetName:'Cisco Catalyst 9300', priority:'Critical', status:'Resolved', assignedTo:'IT Team', created:'2026-05-24', dept:'IT', category:'Network Issue' }, + { id:'TKT-007', title:'UPS battery replacement due', asset:'AST-2025-012', assetName:'APC Smart UPS 3KVA', priority:'High', status:'Pending Parts', assignedTo:'Vendor', created:'2026-05-25', dept:'IT', category:'Battery Replacement' }, + { id:'TKT-008', title:'Server fan making loud noise', asset:'AST-2025-004', assetName:'Dell PowerEdge R740', priority:'Medium', status:'In Progress', assignedTo:'Dell Support',created:'2026-05-27', dept:'IT', category:'Hardware Issue' } ], purchaseRequests: [ - { id:'PR-2025-001', item:'Dell Laptop i7 Gen 13', qty:5, estCost:425000, dept:'IT', requester:'Priya Kumar', status:'Approved', date:'2025-05-10', justification:'New developer hires – Q2 onboarding', poRef:'PO-2025-001' }, - { id:'PR-2025-002', item:'Office Chairs – Mesh Type', qty:20, estCost:280000, dept:'Admin', requester:'Deepak Joshi', status:'Pending', date:'2025-05-20', justification:'Old chairs worn out, ergonomic upgrade', poRef:null }, - { id:'PR-2025-003', item:'TP-Link WAP EAP670', qty:8, estCost:96000, dept:'IT', requester:'Kavya Nair', status:'Approved', date:'2025-05-18', justification:'Wi-Fi dead zones on floor 3 and 4', poRef:'PO-2025-002' }, - { id:'PR-2025-004', item:'Epson Projector Lamp Kit', qty:2, estCost:14000, dept:'Admin', requester:'Deepak Joshi', status:'Pending', date:'2025-05-25', justification:'TKT-004 – Lamp life expired', poRef:null }, - { id:'PR-2025-005', item:'UPS Replacement Batteries', qty:1, estCost:18000, dept:'IT', requester:'Arjun Sharma', status:'Submitted', date:'2025-05-27', justification:'TKT-007 – Battery at 15% health', poRef:null }, - { id:'PR-2025-006', item:'Ricoh Toner Cartridges', qty:10, estCost:22000, dept:'Admin', requester:'Deepak Joshi', status:'Submitted', date:'2025-05-28', justification:'Stock depleted – photocopier usage high', poRef:null }, - { id:'PR-2025-007', item:'iPad Pro 12.9" M4', qty:3, estCost:195000, dept:'Marketing', requester:'Sneha Patel', status:'Rejected', date:'2025-05-15', justification:'Field sales presentations & demos', poRef:null }, - { id:'PR-2025-008', item:'Cisco IP Phones 8841', qty:15, estCost:277500, dept:'HR', requester:'Anita Singh', status:'Draft', date:'2025-05-28', justification:'Office expansion – new HR team seats', poRef:null } + { id:'PR-2025-001', item:'Dell Laptop i7 Gen 13', qty:5, estCost:425000, dept:'IT', requester:'Priya Kumar', status:'Approved', date:'2026-05-10', justification:'New developer hires – Q2 onboarding', poRef:'PO-2025-001' }, + { id:'PR-2025-002', item:'Office Chairs – Mesh Type', qty:20, estCost:280000, dept:'Admin', requester:'Deepak Joshi', status:'Pending', date:'2026-05-20', justification:'Old chairs worn out, ergonomic upgrade', poRef:null }, + { id:'PR-2025-003', item:'TP-Link WAP EAP670', qty:8, estCost:96000, dept:'IT', requester:'Kavya Nair', status:'Approved', date:'2026-05-18', justification:'Wi-Fi dead zones on floor 3 and 4', poRef:'PO-2025-002' }, + { id:'PR-2025-004', item:'Epson Projector Lamp Kit', qty:2, estCost:14000, dept:'Admin', requester:'Deepak Joshi', status:'Pending', date:'2026-05-25', justification:'TKT-004 – Lamp life expired', poRef:null }, + { id:'PR-2025-005', item:'UPS Replacement Batteries', qty:1, estCost:18000, dept:'IT', requester:'Arjun Sharma', status:'Submitted', date:'2026-06-02', justification:'TKT-007 – Battery at 15% health', poRef:null }, + { id:'PR-2025-006', item:'Ricoh Toner Cartridges', qty:10, estCost:22000, dept:'Admin', requester:'Deepak Joshi', status:'Submitted', date:'2026-06-03', justification:'Stock depleted – photocopier usage high', poRef:null }, + { id:'PR-2025-007', item:'iPad Pro 12.9" M4', qty:3, estCost:195000, dept:'Marketing', requester:'Sneha Patel', status:'Rejected', date:'2026-05-15', justification:'Field sales presentations & demos', poRef:null }, + { id:'PR-2025-008', item:'Cisco IP Phones 8841', qty:15, estCost:277500, dept:'HR', requester:'Anita Singh', status:'Draft', date:'2026-06-04', justification:'Office expansion – new HR team seats', poRef:null } ], vendors: [ @@ -85,7 +98,9 @@ const AMS = { { id:'v003', name:'Cisco Systems India', contact:'Arun Kumar', email:'arun.k@cisco.com', phone:'+91-80-4156-7890', cat:'Networking', gst:'29AAACI0141G1ZM', rating:4.8, status:'Active', contracts:4 }, { id:'v004', name:'Daikin Aircon India', contact:'Ravi Shenoy', email:'ravi.s@daikin.in', phone:'+91-80-2222-3456', cat:'HVAC', gst:'29AACCD0524P1ZF', rating:3.9, status:'Active', contracts:1 }, { id:'v005', name:'Godrej Interio', contact:'Priya Menon', email:'priya.m@godrej.com', phone:'+91-22-6796-5000', cat:'Furniture', gst:'27AAACG0534E1ZD', rating:4.0, status:'Active', contracts:1 }, - { id:'v006', name:'Epson India Pvt. Ltd.', contact:'Kiran Shah', email:'kiran.s@epson.in', phone:'+91-80-4600-1234', cat:'AV Equipment', gst:'29AAACE0149N1Z8', rating:4.3, status:'Active', contracts:2 } + { id:'v006', name:'Epson India Pvt. Ltd.', contact:'Kiran Shah', email:'kiran.s@epson.in', phone:'+91-80-4600-1234', cat:'AV Equipment', gst:'29AAACE0149N1Z8', rating:4.3, status:'Active', contracts:2 }, + { id:'v007', name:'Microsoft India', contact:'Rajiv Kaul', email:'r.kaul@microsoft.com', phone:'+91-80-4000-8888', cat:'Software', gst:'29AAACM0281F1ZH', rating:4.7, status:'Active', contracts:2 }, + { id:'v008', name:'Amazon Web Services', contact:'Sanjay Shah', email:'sanjshah@amazon.com', phone:'+91-80-4999-5555', cat:'Cloud Infra', gst:'29AAACA0182E1ZO', rating:4.9, status:'Active', contracts:1 } ], categories: [ @@ -101,15 +116,17 @@ const AMS = { { id:'c10', name:'Vehicles', icon:'🚗', count:8, depM:'WDV', depR:15, life:8, parent:'Fleet', minStock:1 }, { id:'c11', name:'HVAC', icon:'❄️', count:45, depM:'SLM', depR:15, life:7, parent:'Building Assets', minStock:2 }, { id:'c12', name:'Power Equipment', icon:'🔋', count:22, depM:'SLM', depR:25, life:4, parent:'Electrical', minStock:2 }, - { id:'c13', name:'Storage', icon:'💾', count:14, depM:'SLM', depR:20, life:5, parent:'IT Equipment', minStock:2 } + { id:'c13', name:'Storage', icon:'💾', count:14, depM:'SLM', depR:20, life:5, parent:'IT Equipment', minStock:2 }, + { id:'c14', name:'Software Licenses',icon:'🔑', count:3, depM:'SLM', depR:100,life:1, parent:'Digital Assets', minStock:0 }, + { id:'c15', name:'Cloud Subscriptions',icon:'☁️', count:1, depM:'SLM', depR:100,life:1, parent:'Digital Assets', minStock:0 } ], departments: [ - { id:'d1', name:'Information Technology', code:'IT', head:'Priya Kumar', assetCount:384, headcount:45 }, - { id:'d2', name:'Finance & Accounts', code:'FIN', head:'Rahul Mehta', assetCount:156, headcount:23 }, + { id:'d1', name:'Information Technology', code:'IT', head:'Priya Kumar', assetCount:387, headcount:45 }, + { id:'d2', name:'Finance & Accounts', code:'FIN', head:'Rahul Mehta', assetCount:157, headcount:23 }, { id:'d3', name:'Human Resources', code:'HR', head:'Anita Singh', assetCount:112, headcount:18 }, { id:'d4', name:'Operations', code:'OPS', head:'Vikram Reddy', assetCount:298, headcount:67 }, - { id:'d5', name:'Marketing', code:'MKT', head:'Sneha Patel', assetCount:187, headcount:31 }, + { id:'d5', name:'Marketing', code:'MKT', head:'Sneha Patel', assetCount:189, headcount:31 }, { id:'d6', name:'Administration', code:'ADMIN', head:'Deepak Joshi', assetCount:110, headcount:12 } ], @@ -127,16 +144,16 @@ const AMS = { amcContracts: [ { id:'AMC-001', vendor:'Daikin Aircon India', scope:'25 AC units – Annual Maintenance', value:180000, start:'2025-04-01', end:'2026-03-31', status:'Active', nextService:'2025-07-01' }, { id:'AMC-002', vendor:'Dell India Pvt. Ltd.', scope:'Server Infra – 24×7 Onsite Support',value:450000, start:'2025-01-01', end:'2025-12-31', status:'Active', nextService:'2025-06-15' }, - { id:'AMC-003', vendor:'Cisco Systems India', scope:'Network Infrastructure AMC', value:280000, start:'2024-07-01', end:'2025-06-30', status:'Expiring',nextService:'2025-06-01' }, + { id:'AMC-003', vendor:'Cisco Systems India', scope:'Network Infrastructure AMC', value:280000, start:'2025-07-01', end:'2026-06-30', status:'Active', nextService:'2025-09-01' }, { id:'AMC-004', vendor:'Godrej Security', scope:'Physical Access Control Systems', value:95000, start:'2025-03-01', end:'2026-02-28', status:'Active', nextService:'2025-09-01' } ], pmSchedule: [ - { id:'PM-001', asset:'Daikin 1.5T Split AC', assetId:'AST-2025-005', freq:'Quarterly', lastDone:'2025-02-15', nextDue:'2025-05-15', status:'Overdue', assignee:'Daikin AMC Team' }, - { id:'PM-002', asset:'Dell PowerEdge R740 Server', assetId:'AST-2025-004', freq:'Monthly', lastDone:'2025-04-28', nextDue:'2025-05-28', status:'Due Today', assignee:'IT Team' }, - { id:'PM-003', asset:'Honda City (Company Car)', assetId:'AST-2025-014', freq:'Quarterly', lastDone:'2025-03-01', nextDue:'2025-06-01', status:'Upcoming', assignee:'Honda Service' }, - { id:'PM-004', asset:'APC Smart UPS 3KVA', assetId:'AST-2025-012', freq:'Half-Yearly',lastDone:'2024-12-10',nextDue:'2025-06-10', status:'Upcoming', assignee:'IT Team' }, - { id:'PM-005', asset:'Ricoh Aficio Photocopier', assetId:'AST-2025-016', freq:'Quarterly', lastDone:'2025-01-20', nextDue:'2025-04-20', status:'Overdue', assignee:'Ricoh Service' } + { id:'PM-001', asset:'Daikin 1.5T Split AC', assetId:'AST-2025-005', freq:'Quarterly', lastDone:'2026-02-15', nextDue:'2026-05-15', status:'Overdue', assignee:'Daikin AMC Team' }, + { id:'PM-002', asset:'Dell PowerEdge R740 Server', assetId:'AST-2025-004', freq:'Monthly', lastDone:'2026-04-28', nextDue:'2026-05-28', status:'Overdue', assignee:'IT Team' }, + { id:'PM-003', asset:'Honda City (Company Car)', assetId:'AST-2025-014', freq:'Quarterly', lastDone:'2026-03-01', nextDue:'2026-06-01', status:'Upcoming', assignee:'Honda Service' }, + { id:'PM-004', asset:'APC Smart UPS 3KVA', assetId:'AST-2025-012', freq:'Half-Yearly',lastDone:'2025-12-10',nextDue:'2026-06-10', status:'Upcoming', assignee:'IT Team' }, + { id:'PM-005', asset:'Ricoh Aficio Photocopier', assetId:'AST-2025-016', freq:'Quarterly', lastDone:'2026-01-20', nextDue:'2026-04-20', status:'Overdue', assignee:'Ricoh Service' } ], activityFeed: [ @@ -159,6 +176,53 @@ const AMS = { ] }; +// ── LocalStorage Initialization ────────────────────────────── +let storeData = localStorage.getItem('AMS_STORE'); +if (!storeData) { + localStorage.setItem('AMS_STORE', JSON.stringify(defaultData)); + storeData = JSON.stringify(defaultData); +} +window.AMS = JSON.parse(storeData); + +// ── Theme bootstrap (light default, dark optional, persisted) ───── +(function applySavedTheme() { + const saved = localStorage.getItem('AMS_THEME') || 'light'; + document.documentElement.setAttribute('data-theme', saved); +})(); + +// Save back to LocalStorage +window.AMS.save = function() { + recomputeStats(); + const cleanData = Object.assign({}, window.AMS); + delete cleanData.save; + delete cleanData.recompute; + localStorage.setItem('AMS_STORE', JSON.stringify(cleanData)); +}; + +// ── Derive stats from live data so every screen stays consistent ── +function recomputeStats() { + const A = window.AMS; + if (!A || !A.assets) return; + const s = A.stats; + s.total = A.assets.length; + s.active = A.assets.filter(a => a.status === 'Active').length; + s.maintenance = A.assets.filter(a => a.status === 'Under Maintenance').length; + s.idle = A.assets.filter(a => a.status === 'Idle').length; + s.disposed = A.assets.filter(a => a.status === 'Disposed').length; + s.totalValue = A.assets.reduce((t, a) => t + (a.cost || 0), 0); + s.netValue = A.assets.reduce((t, a) => t + (a.value || 0), 0); + s.depreciated = s.totalValue - s.netValue; + s.pendingTickets = (A.tickets || []).filter(t => !['Resolved','Closed'].includes(t.status)).length; + s.pendingPRs = (A.purchaseRequests || []).filter(p => ['Pending','Submitted','Draft'].includes(p.status)).length; + s.expiringAMC = (A.amcContracts || []).filter(c => c.status === 'Active').length; + // Keep per-category counts aligned with actual assets + (A.categories || []).forEach(c => { + c.count = A.assets.filter(a => a.cat === c.name).length; + }); +} +window.AMS.recompute = recomputeStats; +recomputeStats(); + // ── Helper Functions ────────────────────────────────────────── function fmt(n, cur='₹') { if (n >= 1e7) return `${cur}${(n/1e7).toFixed(2)}Cr`; diff --git a/js/sidebar.js b/js/sidebar.js index de93c9e5..30841a47 100644 --- a/js/sidebar.js +++ b/js/sidebar.js @@ -1,91 +1,74 @@ -// js/sidebar.js — shared sidebar & topbar HTML injector -// Include this after data.js and app.js in every authenticated page. -// Call: renderShell(pageTitle, pageSubtitle) inside before main content. +// ================================================================ +// AMS — Shared Sidebar (single source of truth) +// Include AFTER data.js and BEFORE app.js on every authenticated +// page. Renders into
    `; - const topbarHTML = ` -
    -
    -
    ${pageTitle}${pageSubtitle?`${pageSubtitle}`:''}
    -
    - -
    - - - 🚪 -
    -
    `; + if (window.lucide) lucide.createIcons(); + } - document.body.innerHTML = sidebarHTML + `
    ${topbarHTML}
    ` + document.body.innerHTML; -} - -function markAllRead() { - if (window.AMS) AMS.notifications.forEach(n => n.read = true); - populateNotifBadge(); - renderNotifPanel(); - showToast('All caught up!','All notifications marked as read','success'); -} + window.renderSidebar = renderSidebar; + // Placeholder is already in the DOM (script runs at end of ). + renderSidebar(); +})(); diff --git a/maintenance.html b/maintenance.html index 8cbd5a57..a0f5d5e7 100644 --- a/maintenance.html +++ b/maintenance.html @@ -8,33 +8,14 @@
    - +
    Maintenance Management
    - 🚪 +
    @@ -59,7 +40,7 @@
    -
    🔍
    +
    @@ -118,27 +99,25 @@