532 lines
18 KiB
HTML
532 lines
18 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Admin Panel - Alberta Influence Campaign Tool</title>
|
|
<link rel="icon" href="data:,">
|
|
<link rel="stylesheet" href="css/styles.css">
|
|
<style>
|
|
.admin-container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 2rem;
|
|
}
|
|
|
|
.admin-header {
|
|
background: #2c3e50;
|
|
color: white;
|
|
padding: 2rem 0;
|
|
margin-bottom: 2rem;
|
|
text-align: center;
|
|
}
|
|
|
|
.admin-nav {
|
|
display: flex;
|
|
background: #34495e;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.nav-btn {
|
|
flex: 1;
|
|
padding: 1rem;
|
|
background: none;
|
|
border: none;
|
|
color: white;
|
|
cursor: pointer;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.nav-btn:hover {
|
|
background: #3498db;
|
|
}
|
|
|
|
.nav-btn.active {
|
|
background: #3498db;
|
|
}
|
|
|
|
.tab-content {
|
|
display: none;
|
|
}
|
|
|
|
.tab-content.active {
|
|
display: block;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.form-row {
|
|
display: flex;
|
|
gap: 1rem;
|
|
align-items: flex-end;
|
|
}
|
|
|
|
.form-grid {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.checkbox-group {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 0.5rem;
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
.checkbox-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.campaign-card {
|
|
border: 1px solid #ddd;
|
|
border-radius: 8px;
|
|
padding: 1.5rem;
|
|
margin-bottom: 1rem;
|
|
background: white;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.campaign-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.campaign-header h3 {
|
|
margin: 0;
|
|
color: #2c3e50;
|
|
}
|
|
|
|
.status-badge {
|
|
padding: 0.25rem 0.75rem;
|
|
border-radius: 20px;
|
|
font-size: 0.8rem;
|
|
font-weight: bold;
|
|
text-transform: uppercase;
|
|
}
|
|
|
|
.status-draft {
|
|
background: #f39c12;
|
|
color: white;
|
|
}
|
|
|
|
.status-active {
|
|
background: #27ae60;
|
|
color: white;
|
|
}
|
|
|
|
.status-paused {
|
|
background: #e74c3c;
|
|
color: white;
|
|
}
|
|
|
|
.status-archived {
|
|
background: #95a5a6;
|
|
color: white;
|
|
}
|
|
|
|
.campaign-meta {
|
|
color: #666;
|
|
font-size: 0.9rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.campaign-meta p {
|
|
margin: 0.25rem 0;
|
|
}
|
|
|
|
.campaign-actions {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.btn {
|
|
padding: 0.75rem 1.5rem;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
font-size: 0.9rem;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #3498db;
|
|
color: white;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: #95a5a6;
|
|
color: white;
|
|
}
|
|
|
|
.btn-danger {
|
|
background: #e74c3c;
|
|
color: white;
|
|
}
|
|
|
|
.btn:hover {
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 3rem;
|
|
color: #666;
|
|
}
|
|
|
|
.loading {
|
|
text-align: center;
|
|
padding: 2rem;
|
|
}
|
|
|
|
.spinner {
|
|
border: 4px solid #f3f3f3;
|
|
border-radius: 50%;
|
|
border-top: 4px solid #3498db;
|
|
width: 40px;
|
|
height: 40px;
|
|
animation: spin 1s linear infinite;
|
|
margin: 0 auto 1rem;
|
|
}
|
|
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
.hidden {
|
|
display: none !important;
|
|
}
|
|
|
|
.message-success {
|
|
background: #d4edda;
|
|
color: #155724;
|
|
border: 1px solid #c3e6cb;
|
|
padding: 1rem;
|
|
border-radius: 4px;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.message-error {
|
|
background: #f8d7da;
|
|
color: #721c24;
|
|
border: 1px solid #f5c6cb;
|
|
padding: 1rem;
|
|
border-radius: 4px;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.analytics-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 1rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.analytics-stat {
|
|
background: #f8f9fa;
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
text-align: center;
|
|
}
|
|
|
|
.analytics-stat h3 {
|
|
font-size: 2rem;
|
|
margin: 0 0 0.5rem 0;
|
|
color: #3498db;
|
|
}
|
|
|
|
.modal-overlay {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: rgba(0,0,0,0.7);
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.modal-content {
|
|
background: white;
|
|
padding: 2rem;
|
|
border-radius: 8px;
|
|
max-width: 600px;
|
|
width: 90%;
|
|
max-height: 80vh;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.modal-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 1rem;
|
|
padding-bottom: 1rem;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.modal-close {
|
|
background: none;
|
|
border: none;
|
|
font-size: 1.5rem;
|
|
cursor: pointer;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.admin-nav {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.form-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.campaign-actions {
|
|
justify-content: center;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="admin-header">
|
|
<div class="admin-container">
|
|
<h1>Campaign Admin Panel</h1>
|
|
<p>Manage your influence campaigns</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="admin-container">
|
|
<!-- Navigation -->
|
|
<nav class="admin-nav">
|
|
<button class="nav-btn active" data-tab="campaigns">Campaigns</button>
|
|
<button class="nav-btn" data-tab="create">Create Campaign</button>
|
|
<button class="nav-btn" data-tab="edit">Edit Campaign</button>
|
|
</nav>
|
|
|
|
<!-- Success/Error Messages -->
|
|
<div id="message-container" class="hidden"></div>
|
|
|
|
<!-- Campaigns Tab -->
|
|
<div id="campaigns-tab" class="tab-content active">
|
|
<div class="form-row" style="align-items: center; margin-bottom: 2rem;">
|
|
<h2 style="margin: 0;">Active Campaigns</h2>
|
|
<button class="btn btn-primary" data-action="create-campaign">Create New Campaign</button>
|
|
</div>
|
|
|
|
<div id="campaigns-loading" class="loading hidden">
|
|
<div class="spinner"></div>
|
|
<p>Loading campaigns...</p>
|
|
</div>
|
|
|
|
<div id="campaigns-list" class="campaign-list">
|
|
<!-- Campaigns will be loaded here -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Create Campaign Tab -->
|
|
<div id="create-tab" class="tab-content">
|
|
<h2>Create New Campaign</h2>
|
|
|
|
<form id="create-campaign-form">
|
|
<div class="form-grid">
|
|
<div class="form-group">
|
|
<label for="create-title">Campaign Title *</label>
|
|
<input type="text" id="create-title" name="title" required
|
|
placeholder="Save Alberta Parks">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="create-description">Description</label>
|
|
<textarea id="create-description" name="description" rows="3"
|
|
placeholder="A brief description of the campaign"></textarea>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="create-email-subject">Email Subject *</label>
|
|
<input type="text" id="create-email-subject" name="email_subject" required
|
|
placeholder="Protect Alberta's Provincial Parks">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="create-email-body">Email Body *</label>
|
|
<textarea id="create-email-body" name="email_body" rows="8" required
|
|
placeholder="Dear [Representative Name],
|
|
|
|
I am writing as your constituent to express my concern about...
|
|
|
|
Sincerely,
|
|
[Your Name]"></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="create-call-to-action">Call to Action</label>
|
|
<textarea id="create-call-to-action" name="call_to_action" rows="3"
|
|
placeholder="Join thousands of Albertans in protecting our provincial parks. Send an email to your representatives today!"></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Campaign Settings</label>
|
|
<div class="checkbox-group">
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="create-allow-smtp" name="allow_smtp_email" checked>
|
|
<label for="create-allow-smtp">Allow SMTP Email Sending</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="create-allow-mailto" name="allow_mailto_link" checked>
|
|
<label for="create-allow-mailto">Allow Mailto Links</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="create-collect-info" name="collect_user_info" checked>
|
|
<label for="create-collect-info">Collect User Information</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="create-show-count" name="show_email_count" checked>
|
|
<label for="create-show-count">Show Email Count</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Target Government Levels</label>
|
|
<div class="checkbox-group">
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="create-federal" name="target_government_levels" value="Federal" checked>
|
|
<label for="create-federal">Federal (MPs)</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="create-provincial" name="target_government_levels" value="Provincial" checked>
|
|
<label for="create-provincial">Provincial (MLAs)</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="create-municipal" name="target_government_levels" value="Municipal" checked>
|
|
<label for="create-municipal">Municipal (Mayors, Councillors)</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="create-school" name="target_government_levels" value="School Board">
|
|
<label for="create-school">School Board</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<button type="submit" class="btn btn-primary">Create Campaign</button>
|
|
<button type="button" class="btn btn-secondary" data-action="cancel-create">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Edit Campaign Tab -->
|
|
<div id="edit-tab" class="tab-content">
|
|
<h2>Edit Campaign</h2>
|
|
|
|
<form id="edit-campaign-form">
|
|
<div class="form-grid">
|
|
<div class="form-group">
|
|
<label for="edit-title">Campaign Title *</label>
|
|
<input type="text" id="edit-title" name="title" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="edit-status">Status</label>
|
|
<select id="edit-status" name="status">
|
|
<option value="draft">Draft</option>
|
|
<option value="active">Active</option>
|
|
<option value="paused">Paused</option>
|
|
<option value="archived">Archived</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="edit-description">Description</label>
|
|
<textarea id="edit-description" name="description" rows="3"></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="edit-email-subject">Email Subject *</label>
|
|
<input type="text" id="edit-email-subject" name="email_subject" required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="edit-email-body">Email Body *</label>
|
|
<textarea id="edit-email-body" name="email_body" rows="8" required></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="edit-call-to-action">Call to Action</label>
|
|
<textarea id="edit-call-to-action" name="call_to_action" rows="3"></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Campaign Settings</label>
|
|
<div class="checkbox-group">
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="edit-allow-smtp" name="allow_smtp_email">
|
|
<label for="edit-allow-smtp">Allow SMTP Email Sending</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="edit-allow-mailto" name="allow_mailto_link">
|
|
<label for="edit-allow-mailto">Allow Mailto Links</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="edit-collect-info" name="collect_user_info">
|
|
<label for="edit-collect-info">Collect User Information</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="edit-show-count" name="show_email_count">
|
|
<label for="edit-show-count">Show Email Count</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Target Government Levels</label>
|
|
<div class="checkbox-group">
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="edit-federal" name="target_government_levels" value="Federal">
|
|
<label for="edit-federal">Federal (MPs)</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="edit-provincial" name="target_government_levels" value="Provincial">
|
|
<label for="edit-provincial">Provincial (MLAs)</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="edit-municipal" name="target_government_levels" value="Municipal">
|
|
<label for="edit-municipal">Municipal (Mayors, Councillors)</label>
|
|
</div>
|
|
<div class="checkbox-item">
|
|
<input type="checkbox" id="edit-school" name="target_government_levels" value="School Board">
|
|
<label for="edit-school">School Board</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<button type="submit" class="btn btn-primary">Update Campaign</button>
|
|
<button type="button" class="btn btn-secondary" data-action="cancel-edit">Cancel</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="js/api-client.js"></script>
|
|
<script src="js/auth.js"></script>
|
|
<script src="js/admin.js"></script>
|
|
|
|
</body>
|
|
</html> |