forked from UKSOURCE/cms.lams
Refactor: remove unused APIs, controllers, models and data files. Update: icon picker all system, Dashboard, Main UI more respone, Change: Logo, favicon.
This commit is contained in:
+45
-71
@@ -1,11 +1,18 @@
|
||||
<div class="container">
|
||||
<div class="d-flex justify-content-between align-items-center mt-4 mb-4">
|
||||
<div class="d-flex justify-content-between align-items-center mt-4 mb-4 flex-wrap gap-2">
|
||||
<div>
|
||||
<h1 class="h3 mb-0" style="color: var(--primary-dark);">
|
||||
<%= title %>
|
||||
</h1>
|
||||
<p class="text-muted mb-0">Edit content displayed on the Home page</p>
|
||||
</div>
|
||||
<div class="d-flex gap-2">
|
||||
<% if (frontendUrl) { %>
|
||||
<a href="<%= frontendUrl %>" class="btn btn-outline-primary" target="_blank" rel="noopener">
|
||||
<i class="fas fa-external-link-alt me-2"></i>View Home Page
|
||||
</a>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@@ -103,8 +110,16 @@
|
||||
<div class="row g-3">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Icon (FA class)</label>
|
||||
<input type="text" class="form-control" id="floatingBadgeIcon"
|
||||
value="<%= data.hero?.floatingBadge?.icon || '' %>" placeholder="e.g. fa-users">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text icon-preview-cell" style="min-width:38px">
|
||||
<% if (data.hero?.floatingBadge?.icon) { %><i
|
||||
class="<%= data.hero.floatingBadge.icon %>"></i>
|
||||
<% } %>
|
||||
</span>
|
||||
<input type="text" class="form-control" id="floatingBadgeIcon"
|
||||
value="<%= data.hero?.floatingBadge?.icon || '' %>" placeholder="Click to pick..." readonly
|
||||
style="cursor:pointer;background:#fff" onclick="IconPicker.open(this)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Value</label>
|
||||
@@ -200,13 +215,12 @@
|
||||
rows="2"><%= data.programs?.description || '' %></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h6 class="mb-0">Program Items</h6>
|
||||
<button type="button" class="btn btn-outline-primary btn-sm" onclick="addProgramItem()"><i
|
||||
class="fas fa-plus me-1"></i>Add Program</button>
|
||||
</div>
|
||||
<div id="programItemsContainer"></div>
|
||||
<div class="alert alert-info mt-4 mb-0">
|
||||
<i class="fas fa-info-circle me-2"></i>
|
||||
Programs items will automatically display from the Programs table.
|
||||
<a href="/admin/programme" target="_blank" class="fw-bold ms-1">
|
||||
<i class="fas fa-external-link-alt me-1"></i>Manage programs
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -272,7 +286,7 @@
|
||||
let originalFormData = null;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
originalFormData = <%- JSON.stringify(data) %>;
|
||||
originalFormData = <% - JSON.stringify(data) %>;
|
||||
populateAll(originalFormData);
|
||||
|
||||
document.getElementById('homeForm').addEventListener('submit', function (e) {
|
||||
@@ -320,7 +334,6 @@
|
||||
const pr = data.programs || {};
|
||||
setVal('programsHeading', pr.heading);
|
||||
setVal('programsDescription', pr.description);
|
||||
populateProgramItems(pr.items || []);
|
||||
|
||||
// Request Info
|
||||
const ri = data.requestInfo || {};
|
||||
@@ -423,8 +436,16 @@
|
||||
<div class="card-body p-3">
|
||||
<div class="row g-2">
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small">Icon (FA class)</label>
|
||||
<input type="text" class="form-control form-control-sm" data-field="icon" value="${esc(item.icon)}" placeholder="fa-trophy">
|
||||
<label class="form-label small">Icon</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text icon-preview-cell" style="min-width:38px">
|
||||
${item.icon ? `<i class="${esc(item.icon)}"></i>` : ''}
|
||||
</span>
|
||||
<input type="text" class="form-control form-control-sm" data-field="icon"
|
||||
value="${esc(item.icon)}" placeholder="Click to pick..." readonly
|
||||
style="cursor:pointer;background:#fff"
|
||||
onclick="IconPicker.open(this)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small">Title</label>
|
||||
@@ -462,8 +483,16 @@
|
||||
<div class="card-body p-3">
|
||||
<div class="row g-2">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small">Icon (FA class)</label>
|
||||
<input type="text" class="form-control form-control-sm" data-field="icon" value="${esc(item.icon)}" placeholder="fa-laptop-code">
|
||||
<label class="form-label small">Icon</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text icon-preview-cell" style="min-width:38px">
|
||||
${item.icon ? `<i class="${esc(item.icon)}"></i>` : ''}
|
||||
</span>
|
||||
<input type="text" class="form-control form-control-sm" data-field="icon"
|
||||
value="${esc(item.icon)}" placeholder="Click to pick..." readonly
|
||||
style="cursor:pointer;background:#fff"
|
||||
onclick="IconPicker.open(this)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small">Title</label>
|
||||
@@ -524,61 +553,6 @@
|
||||
items.forEach(item => addValuePropStat(item));
|
||||
}
|
||||
|
||||
// ── Program Items ────────────────────────────────────────────────────────
|
||||
function addProgramItem(item = {}) {
|
||||
const idx = Date.now();
|
||||
const c = document.getElementById('programItemsContainer');
|
||||
const html = `
|
||||
<div class="card mb-3 program-item">
|
||||
<div class="card-body p-3">
|
||||
<div class="row g-2">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small">Title</label>
|
||||
<input type="text" class="form-control form-control-sm" data-field="title" value="${esc(item.title)}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small">Category</label>
|
||||
<input type="text" class="form-control form-control-sm" data-field="category" value="${esc(item.category)}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small">Duration</label>
|
||||
<input type="text" class="form-control form-control-sm" data-field="duration" value="${esc(item.duration)}">
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<label class="form-label small">Rating</label>
|
||||
<input type="text" class="form-control form-control-sm" data-field="rating" value="${esc(item.rating)}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small">Student Count</label>
|
||||
<input type="text" class="form-control form-control-sm" data-field="studentCount" value="${esc(item.studentCount)}">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small">Href</label>
|
||||
<input type="text" class="form-control form-control-sm" data-field="href" value="${esc(item.href)}">
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<label class="form-label small">Description</label>
|
||||
<input type="text" class="form-control form-control-sm" data-field="description" value="${esc(item.description)}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label small">Image URL</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" data-field="image" id="progImg_${idx}" value="${esc(item.image)}">
|
||||
<button class="btn btn-outline-primary btn-upload-image" type="button" data-target-input="progImg_${idx}" data-image-type="home"><i class="fas fa-upload"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-link text-danger btn-sm p-0 mt-2" onclick="this.closest('.program-item').remove()"><i class="fas fa-trash me-1"></i>Remove</button>
|
||||
</div>
|
||||
</div>`;
|
||||
c.insertAdjacentHTML('beforeend', html);
|
||||
}
|
||||
|
||||
function populateProgramItems(items) {
|
||||
document.getElementById('programItemsContainer').innerHTML = '';
|
||||
items.forEach(item => addProgramItem(item));
|
||||
}
|
||||
|
||||
// ── Request Info Programs ────────────────────────────────────────────────
|
||||
function addRequestInfoProgram(val = '') {
|
||||
const c = document.getElementById('requestInfoProgramsContainer');
|
||||
|
||||
Reference in New Issue
Block a user