Here's a comprehensive LAPD-style CAD (Computer-Aided Dispatch) simulator in a single HTML file with CSS and JavaScript. This simulation includes core features like active calls, BOLOs, unit management, and an overview dashboard, all stored in localStorage for persistence.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LAPD CAD Simulator</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
margin: 0;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.tabs {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
.tab-button {
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
border-radius: 5px;
}
.tab-button.active {
background-color: #0056b3;
}
.tab-content {
display: none;
background-color: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.tab-content.active {
display: block;
}
.call-list, .bolo-list, .unit-list {
margin-top: 20px;
}
.call-item, .bolo-item, .unit-item {
padding: 10px;
border-bottom: 1px solid #ddd;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
}
.form-group input, .form-group textarea, .form-group select {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
}
button {
padding: 8px 16px;
background-color: #28a745;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button.danger {
background-color: #dc3545;
}
.overview-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
}
.overview-card {
background-color: #f8f9fa;
padding: 15px;
border-radius: 5px;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<h1>LAPD CAD Simulator</h1>
<div class="tabs">
<button class="tab-button active" onclick="showTab('overview')">Overview</button>
<button class="tab-button" onclick="showTab('active-calls')">Active Calls</button>
<button class="tab-button" onclick="showTab('bolos')">BOLOs</button>
<button class="tab-button" onclick="showTab('units')">Units</button>
</div>
<!-- Overview Tab -->
<div id="overview" class="tab-content active">
<h2>System Overview</h2>
<div class="overview-grid">
<div class="overview-card">
<h3>Active Calls</h3>
<p id="active-calls-count">0</p>
</div>
<div class="overview-card">
<h3>Active BOLOs</h3>
<p id="active-bolos-count">0</p>
</div>
<div class="overview-card">
<h3>Units Available</h3>
<p id="units-available-count">0</p>
</div>
</div>
</div>
<!-- Active Calls Tab -->
<div id="active-calls" class="tab-content">
<h2>Active Calls</h2>
<div class="form-group">
<h3>Create New Call</h3>
<form id="call-form">
<div class="form-group">
<label>Call Type</label>
<input type="text" id="call-type" required>
</div>
<div class="form-group">
<label>Location</label>
<input type="text" id="call-location" required>
</div>
<div class="form-group">
<label>Description</label>
<textarea id="call-description" required></textarea>
</div>
<div class="form-group">
<label>Priority</label>
<select id="call-priority">
<option value="1">1 - Emergency</option>
<option value="2">2 - Urgent</option>
<option value="3">3 - Routine</option>
</select>
</div>
<button type="submit">Create Call</button>
</form>
</div>
<div class="call-list" id="call-list"></div>
</div>
<!-- BOLOs Tab -->
<div id="bolos" class="tab-content">
<h2>Be On the Lookout (BOLOs)</h2>
<div class="form-group">
<h3>Create New BOLO</h3>
<form id="bolo-form">
<div class="form-group">
<label>Subject</label>
<input type="text" id="bolo-subject" required>
</div>
<div class="form-group">
<label>Description</label>
<textarea id="bolo-description" required></textarea>
</div>
<button type="submit">Create BOLO</button>
</form>
</div>
<div class="bolo-list" id="bolo-list"></div>
</div>
<!-- Units Tab -->
<div id="units" class="tab-content">
<h2>Unit Management</h2>
<div class="form-group">
<h3>Add New Unit</h3>
<form id="unit-form">
<div class="form-group">
<label>Unit ID</label>
<input type="text" id="unit-id" required>
</div>
<div class="form-group">
<label>Officer Name</label>
<input type="text" id="unit-officer" required>
</div>
<button type="submit">Add Unit</button>
</form>
</div>
<div class="unit-list" id="unit-list"></div>
</div>
</div>
<script>
// Data storage
let cadData = {
calls: [],
bolos: [],
units: []
};
// Load data from localStorage
function loadData() {
const savedData = localStorage.getItem('cadData');
if (savedData) {
cadData = JSON.parse(savedData);
}
updateUI();
}
// Save data to localStorage
function saveData() {
localStorage.setItem('cadData', JSON.stringify(cadData));
updateUI();
}
// Tab management
function showTab(tabId) {
document.querySelectorAll('.tab-content').forEach(tab => {
tab.classList.remove('active');
});
document.querySelectorAll('.tab-button').forEach(button => {
button.classList.remove('active');
});
document.getElementById(tabId).classList.add('active');
document.querySelector(`button[onclick="showTab('${tabId}')"]`).classList.add('active');
}
// Update UI
function updateUI() {
// Update overview
document.getElementById('active-calls-count').textContent = cadData.calls.length;
document.getElementById('active-bolos-count').textContent = cadData.bolos.length;
document.getElementById('units-available-count').textContent = cadData.units.length;
// Update calls list
const callList = document.getElementById('call-list');
callList.innerHTML = '';
cadData.calls.forEach((call, index) => {
const callItem = document.createElement('div');
callItem.className = 'call-item';
callItem.innerHTML = `
<strong>${call.type}</strong> - Priority ${call.priority}<br>
Location: ${call.location}<br>
Description: ${call.description}<br>
<button class="danger" onclick="clearCall(${index})">Clear Call</button>
`;
callList.appendChild(callItem);
});
// Update BOLOs list
const boloList = document.getElementById('bolo-list');
boloList.innerHTML = '';
cadData.bolos.forEach((bolo, index) => {
const boloItem = document.createElement('div');
boloItem.className = 'bolo-item';
boloItem.innerHTML = `
<strong>${bolo.subject}</strong><br>
Description: ${bolo.description}<br>
<button class="danger" onclick="clearBolo(${index})">Clear BOLO</button>
`;
boloList.appendChild(boloItem);
});
// Update units list
const unitList = document.getElementById('unit-list');
unitList.innerHTML = '';
cadData.units.forEach((unit, index) => {
const unitItem = document.createElement('div');
unitItem.className = 'unit-item';
unitItem.innerHTML = `
<strong>${unit.id}</strong> - ${unit.officer}<br>
Status: Available<br>
<button class="danger" onclick="removeUnit(${index})">Remove Unit</button>
`;
unitList.appendChild(unitItem);
});
}
// Call management
document.getElementById('call-form').addEventListener('submit', (e) => {
e.preventDefault();
const newCall = {
type: document.getElementById('call-type').value,
location: document.getElementById('call-location').value,
description: document.getElementById('call-description').value,
priority: document.getElementById('call-priority').value,
timestamp: new Date().toISOString()
};
cadData.calls.push(newCall);
saveData();
e.target.reset();
});
function clearCall(index) {
cadData.calls.splice(index, 1);
saveData();
}
// BOLO management
document.getElementById('bolo-form').addEventListener('submit', (e) => {
e.preventDefault();
const newBolo = {
subject: document.getElementById('bolo-subject').value,
description: document.getElementById('bolo-description').value,
timestamp: new Date().toISOString()
};
cadData.bolos.push(newBolo);
saveData();
e.target.reset();
});
function clearBolo(index) {
cadData.bolos.splice(index, 1);
saveData();
}
// Unit management
document.getElementById('unit-form').addEventListener('submit', (e) => {
e.preventDefault();
const newUnit = {
id: document.getElementById('unit-id').value,
officer: document.getElementById('unit-officer').value,
status: 'available'
};
cadData.units.push(newUnit);
saveData();
e.target.reset();
});
function removeUnit(index) {
cadData.units.splice(index, 1);
saveData();
}
// Initialize
loadData();
</script>
</body>
</html>
Features of this CAD Simulator:
-
Overview Dashboard:
- Displays counts of active calls, active BOLOs, and available units.
- Provides a quick snapshot of system status.
-
Active Calls:
- Create new calls with type, location, description, and priority.
- View all active calls in a list.
- Clear calls when completed.
- Calls are prioritized (1-Emergency, 2-Urgent, 3-Routine).
-
BOLOs (Be On the Lookout):
- Create new BOLOs with subject and description.
- View all active BOLOs.
- Clear BOLOs when no longer relevant.
-
Unit Management:
- Add new units with unit ID and officer name.
- View all available units.
- Remove units from the system.
- Basic status tracking (currently all units are "available").
-
Data Persistence:
- All data (calls, BOLOs, units) is saved to localStorage.
- Data persists between page refreshes.
-
User Interface:
- Tabbed navigation for easy switching between sections.
- Responsive design with a clean, professional look.
- Form validation for required fields.
- Clear visual hierarchy and styling.
How to Use:
- Save this code as an HTML file (e.g.,
cad_simulator.html).
- Open it in a web browser.
- Use the tabs to navigate between sections.
- Create calls, BOLOs, and units using the forms.
- Clear or remove items as needed.
- All data will be saved automatically to localStorage and persist between sessions.
Potential Enhancements:
- Add unit assignment to calls.
- Implement more detailed unit status (e.g., en route, on scene, etc.).
- Add call history logging.
- Implement real-time call updates simulation.
- Add authentication for different user roles (dispatcher, officer, etc.).
- Enhance styling for better mobile responsiveness.
This simulator provides a solid foundation for a police CAD system while keeping everything in a single file for easy deployment and testing.