fea/nhat-dat-11042026-merge #1

Closed
minhnhat wants to merge 27 commits from UKSOURCE/cms.hailearning.edu.vn:fea/nhat-dat-11042026-merge into fea/nhat-13042028-merge-kiet-thien
11 changed files with 228 additions and 95 deletions
Showing only changes of commit 48a230105c - Show all commits

View File

@@ -27,6 +27,9 @@ const HeroSlideSchema = new Schema(
const HeroSchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
// Background for whole hero section
backgroundImage: { type: String, default: "" },
@@ -56,6 +59,9 @@ const WhyChooseUsItemSchema = new Schema(
const WhyChooseUsSchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
heading: { type: String, default: "" },
subheading: { type: String, default: "" },
description: { type: String, default: "" },
@@ -81,6 +87,9 @@ const VisaSolutionItemSchema = new Schema(
const VisaSolutionsSchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
heading: { type: String, default: "" },
subheading: { type: String, default: "" },
items: { type: [VisaSolutionItemSchema], default: [] },
@@ -101,6 +110,9 @@ const VisaCountrySchema = new Schema(
const VisaCountriesSchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
heading: { type: String, default: "" },
subheading: { type: String, default: "" },
description: { type: String, default: "" },
@@ -124,6 +136,9 @@ const TestimonialSchema = new Schema(
const TestimonialsSchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
heading: { type: String, default: "" },
subheading: { type: String, default: "" },
videoUrl: { type: String, default: "" },
@@ -135,6 +150,9 @@ const TestimonialsSchema = new Schema(
const VideoGallerySchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
heading: { type: String, default: "" },
videoUrl: { type: String, default: "" },
thumbnail: { type: String, default: "" },
@@ -152,6 +170,9 @@ const FaqItemSchema = new Schema(
const FaqSchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
heading: { type: String, default: "" },
subheading: { type: String, default: "" },
description: { type: String, default: "" },
@@ -173,6 +194,9 @@ const AchievementItemSchema = new Schema(
const AchievementsSchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
heading: { type: String, default: "" },
subheading: { type: String, default: "" },
items: { type: [AchievementItemSchema], default: [] },
@@ -212,6 +236,9 @@ const BrandsSchema = new Schema(
const PartnersSchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
visaConsultancy: { type: VisaConsultancySchema, default: () => ({}) },
brands: { type: BrandsSchema, default: () => ({}) },
},
@@ -237,6 +264,9 @@ const BlogPreviewItemSchema = new Schema(
const BlogPreviewSchema = new Schema(
{
// Toggle visibility on frontend
enabled: { type: Boolean, default: true },
heading: { type: String, default: "" },
subheading: { type: String, default: "" },
ctaButton: { type: LinkSchema, default: () => ({}) },

View File

@@ -3,8 +3,17 @@
<div class="row g-4">
<!-- Basic Info -->
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="achievementEnabled"
<%=(data.achievements?.enabled !==false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm">
<div class="card-header bg-white">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="fas fa-chart-pie me-2"></i>General Information
</h6>
@@ -13,23 +22,13 @@
<div class="row g-3">
<div class="col-md-6">
<label class="form-label fw-medium">Heading</label>
<input
type="text"
class="form-control"
id="achievementsHeading"
value="<%= data.achievements?.heading || '' %>"
placeholder="e.g., Our Achievements in Numbers"
/>
<input type="text" class="form-control" id="achievementsHeading"
value="<%= data.achievements?.heading || '' %>" placeholder="e.g., Our Achievements in Numbers" />
</div>
<div class="col-md-6">
<label class="form-label fw-medium">Subheading</label>
<input
type="text"
class="form-control"
id="achievementsSubheading"
value="<%= data.achievements?.subheading || '' %>"
placeholder="e.g., Did You Know"
/>
<input type="text" class="form-control" id="achievementsSubheading"
value="<%= data.achievements?.subheading || '' %>" placeholder="e.g., Did You Know" />
</div>
</div>
</div>
@@ -45,54 +44,38 @@
</h6>
</div>
<div class="card-body" id="achievementItemsContainer">
<% for(let i=0; i<4; i++) {
const item = (data.achievements?.items && data.achievements.items[i]) || {};
%>
<div class="card mb-3 bg-light border achievement-item">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="card-title fw-bold mb-0">Achievement #<%= i + 1 %></h6>
</div>
<div class="row g-3">
<div class="col-md-3">
<label class="form-label fw-medium">Value (Number)</label>
<input
type="text"
class="form-control achievement-value"
value="<%= item.value || '' %>"
placeholder="e.g., 95"
/>
<% for(let i=0; i<4; i++) { const item=(data.achievements?.items && data.achievements.items[i]) || {}; %>
<div class="card mb-3 bg-light border achievement-item">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="card-title fw-bold mb-0">Achievement #<%= i + 1 %>
</h6>
</div>
<div class="col-md-3">
<label class="form-label fw-medium">Suffix</label>
<input
type="text"
class="form-control achievement-suffix"
value="<%= item.suffix || '' %>"
placeholder="e.g., %"
/>
</div>
<div class="col-md-6">
<label class="form-label fw-medium">Label</label>
<input
type="text"
class="form-control achievement-label"
value="<%= item.label || '' %>"
placeholder="e.g., Visa Success Rate"
/>
</div>
<div class="col-md-12">
<label class="form-label fw-medium">Description</label>
<textarea
class="form-control achievement-description"
rows="2"
placeholder="Short description of this achievement"
><%= item.description || '' %></textarea>
<div class="row g-3">
<div class="col-md-3">
<label class="form-label fw-medium">Value (Number)</label>
<input type="text" class="form-control achievement-value" value="<%= item.value || '' %>"
placeholder="e.g., 95" />
</div>
<div class="col-md-3">
<label class="form-label fw-medium">Suffix</label>
<input type="text" class="form-control achievement-suffix" value="<%= item.suffix || '' %>"
placeholder="e.g., %" />
</div>
<div class="col-md-6">
<label class="form-label fw-medium">Label</label>
<input type="text" class="form-control achievement-label" value="<%= item.label || '' %>"
placeholder="e.g., Visa Success Rate" />
</div>
<div class="col-md-12">
<label class="form-label fw-medium">Description</label>
<textarea class="form-control achievement-description" rows="2"
placeholder="Short description of this achievement"><%= item.description || '' %></textarea>
</div>
</div>
</div>
</div>
</div>
<% } %>
<% } %>
</div>
</div>
</div>
@@ -102,8 +85,11 @@
<script>
// Đăng ký scraper cho phần achievements
window.homeScrapers = window.homeScrapers || {};
window.homeScrapers.achievements = function() {
window.homeScrapers.achievements = function () {
const items = [];
const enabled = document.getElementById("achievementEnabled")?.checked !== false;
document.querySelectorAll('.achievement-item').forEach(el => {
items.push({
value: el.querySelector('.achievement-value').value,
@@ -116,7 +102,8 @@
return {
heading: document.getElementById('achievementsHeading').value,
subheading: document.getElementById('achievementsSubheading').value,
items: items
items: items,
enabled
};
};
</script>

View File

@@ -3,6 +3,15 @@
<div class="row g-4">
<!-- Basic Info -->
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="blogpreviewEnabled"
<%=(data.blogPreview?.enabled !==false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
@@ -144,6 +153,9 @@
window.homeScrapers = window.homeScrapers || {};
window.homeScrapers.blogPreview = () => {
const selectedIds = [];
const enabled = document.getElementById("blogpreviewEnabled")?.checked !== false;
document.querySelectorAll('.blog-checkbox:checked').forEach(cb => {
selectedIds.push(cb.value);
});
@@ -158,7 +170,8 @@
href: document.getElementById('blogPreviewCtaHref').value
},
selectedBlogIds: selectedIds,
items: [] // Server side will handle full items content
items: [],// Server side will handle full items content
enabled
};
};
</script>

View File

@@ -3,11 +3,24 @@
<div class="row g-4">
<!-- Basic Info -->
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="faqEnabled"
<%= (data.faq?.enabled !== false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm">
<div class="card-header bg-white">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="fas fa-info-circle me-2"></i>Basic Information
</h6>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="faqEnabled"
<%= (data.faq?.enabled !== false ) ? 'checked' : '' %>>
</div>
</div>
<div class="card-body">
<div class="row g-3">
@@ -122,6 +135,8 @@
window.homeScrapers.faq = () => {
const getVal = (id) => (document.getElementById(id)?.value || "").trim();
const enabled = document.getElementById('faqEnabled')?.checked !== false;
const items = [];
document.querySelectorAll(".faq-item").forEach((el, idx) => {
const index = el.getAttribute("data-index") || idx;
@@ -142,7 +157,8 @@
label: getVal("faqCtaLabel"),
href: getVal("faqCtaHref")
},
items
items,
enabled
};
};
</script>

View File

@@ -3,14 +3,20 @@
<div class="row g-4">
<!-- Background Image (section-level) -->
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="heroEnabled"
<%=(data.hero?.enabled !== false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm mb-3">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="fas fa-image me-2"></i>Hero Background
</h6>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="switchCheckChecked" checked>
</div>
</div>
<div class="card-body">
<div class="row g-3">
@@ -173,6 +179,7 @@
const getVal = (id) => (document.getElementById(id)?.value || "").trim();
const backgroundImage = getVal("heroBackgroundImage");
const enabled = document.getElementById("heroEnabled")?.checked !== false;
const slides = [];
const slideEls = document.querySelectorAll(".hero-slide-item");
@@ -208,6 +215,7 @@
const first = slides[0] || {};
return {
enabled,
backgroundImage,
slides,
title: first.title || "",

View File

@@ -3,48 +3,61 @@
<div class="row g-4">
<!-- Visa Consultancy Awards -->
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="partnersEnabled"
<%=(data.partners?.enabled !==false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm">
<div class="card-header bg-white">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="fas fa-award me-2"></i>Awards & Certifications (Fixed 4 Items)
</h6>
</div>
<div class="card-body">
<div id="visaConsultancyContainer">
<% for(let i=0; i<4; i++) {
const item = (data.partners?.visaConsultancy?.items && data.partners.visaConsultancy.items[i]) || {};
%>
<% for(let i=0; i<4; i++) { const item=(data.partners?.visaConsultancy?.items &&
data.partners.visaConsultancy.items[i]) || {}; %>
<div class="card mb-3 bg-light border visa-item">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="card-title fw-bold mb-0">Award #<%= i + 1 %></h6>
<h6 class="card-title fw-bold mb-0">Award #<%= i + 1 %>
</h6>
</div>
<div class="row g-3">
<div class="col-md-8">
<label class="form-label fw-medium">Award Name</label>
<input type="text" class="form-control visa-name" value="<%= item.name || '' %>" placeholder="Award Name" />
<input type="text" class="form-control visa-name" value="<%= item.name || '' %>"
placeholder="Award Name" />
</div>
<div class="col-md-4">
<label class="form-label fw-medium">Year</label>
<input type="text" class="form-control visa-year" value="<%= item.year || '' %>" placeholder="e.g., 2025" />
<input type="text" class="form-control visa-year" value="<%= item.year || '' %>"
placeholder="e.g., 2025" />
</div>
<div class="col-md-12">
<label class="form-label fw-medium">Icon / Logo</label>
<div class="input-group">
<input type="text" class="form-control visa-icon" id="visaIcon_<%= i %>" value="<%= item.icon || '' %>" />
<input type="text" class="form-control visa-icon" id="visaIcon_<%= i %>"
value="<%= item.icon || '' %>" />
<button type="button" class="btn btn-outline-primary btn-upload-image"
data-target-input="visaIcon_<%= i %>" data-image-type="home">
data-target-input="visaIcon_<%= i %>" data-image-type="home">
<i class="fas fa-upload me-1"></i>Upload
</button>
</div>
<div class="mt-2 preview-container">
<img src="<%= item.icon || '' %>" class="img-thumbnail <%= item.icon ? '' : 'd-none' %>" style="height: 60px; object-fit: contain;">
<img src="<%= item.icon || '' %>" class="img-thumbnail <%= item.icon ? '' : 'd-none' %>"
style="height: 60px; object-fit: contain;">
</div>
</div>
</div>
</div>
</div>
<% } %>
<% } %>
</div>
</div>
</div>
@@ -69,24 +82,27 @@
<div class="card-body py-2">
<div class="d-flex justify-content-between align-items-center mb-2">
<span class="small fw-bold">Brand Logo</span>
<button type="button" class="btn btn-link text-danger p-0" onclick="this.closest('.brand-partner-item').remove()">
<button type="button" class="btn btn-link text-danger p-0"
onclick="this.closest('.brand-partner-item').remove()">
<i class="fas fa-times"></i>
</button>
</div>
<div class="input-group input-group-sm">
<input type="text" class="form-control brand-logo-input" id="brandLogo_<%= index %>" value="<%= item.logo || '' %>" />
<input type="text" class="form-control brand-logo-input" id="brandLogo_<%= index %>"
value="<%= item.logo || '' %>" />
<button type="button" class="btn btn-outline-primary btn-upload-image"
data-target-input="brandLogo_<%= index %>" data-image-type="home">
data-target-input="brandLogo_<%= index %>" data-image-type="home">
<i class="fas fa-upload"></i>
</button>
</div>
<div class="mt-2 text-center preview-container">
<img src="<%= item.logo || '' %>" class="img-thumbnail <%= item.logo ? '' : 'd-none' %>" style="height: 50px; object-fit: contain;">
<img src="<%= item.logo || '' %>" class="img-thumbnail <%= item.logo ? '' : 'd-none' %>"
style="height: 50px; object-fit: contain;">
</div>
</div>
</div>
</div>
<% }); %>
<% }); %>
</div>
</div>
</div>
@@ -97,8 +113,11 @@
<script>
// Thu thập dữ liệu partners
window.homeScrapers = window.homeScrapers || {};
window.homeScrapers.partners = function() {
window.homeScrapers.partners = function () {
const visaItems = [];
const enabled = document.getElementById('partnersEnabled')?.checked !== false;
document.querySelectorAll('.visa-item').forEach(el => {
visaItems.push({
name: el.querySelector('.visa-name').value,
@@ -115,7 +134,8 @@
return {
visaConsultancy: { items: visaItems },
brands: { items: brandItems }
brands: { items: brandItems },
enabled
};
};

View File

@@ -3,8 +3,17 @@
<div class="row g-4">
<!-- Basic Info -->
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="testimonialEnabled"
<%=(data.testimonials?.enabled !==false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm">
<div class="card-header bg-white">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="fas fa-info-circle me-2"></i>Basic Information
</h6>
@@ -118,6 +127,8 @@
window.homeScrapers.testimonials = () => {
const getVal = (id) => (document.getElementById(id)?.value || "").trim();
const enabled = document.getElementById("testimonialEnabled")?.checked !== false;
const items = [];
document.querySelectorAll(".testimonial-item").forEach((el, idx) => {
const index = el.getAttribute("data-index") || idx;
@@ -148,6 +159,7 @@
videoUrl: getVal("testimonialsVideoUrl"),
videoThumbnail: getVal("testimonialsVideoThumbnail"),
items,
enabled
};
};

View File

@@ -2,8 +2,18 @@
<div class="tab-pane fade" id="videogallery" role="tabpanel">
<div class="row g-4">
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="videoGalleryEnabled"
<%=(data.videoGallery?.enabled !==false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm">
<div class="card-header bg-white">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="fas fa-video me-2"></i>Video Gallery
</h6>
@@ -50,10 +60,12 @@
window.homeScrapers.videoGallery = () => {
const getVal = (id) => (document.getElementById(id)?.value || "").trim();
const enabled = document.getElementById("videoGalleryEnabled")?.checked !== false;
return {
heading: getVal("videoGalleryHeading"),
videoUrl: getVal("videoGalleryVideoUrl"),
thumbnail: getVal("videoGalleryThumbnail"),
enabled
};
};
</script>

View File

@@ -3,8 +3,17 @@
<div class="row g-4">
<!-- Basic Info -->
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="visaCountriesEnabled"
<%=(data.visaCountries?.enabled !==false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm">
<div class="card-header bg-white">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="fas fa-info-circle me-2"></i>Basic Information
</h6>
@@ -120,6 +129,8 @@
window.homeScrapers.visaCountries = () => {
const getVal = (id) => (document.getElementById(id)?.value || "").trim();
const enabled = document.getElementById("visaCountriesEnabled")?.checked !== false
const visaTypesRaw = getVal("visaCountriesVisaTypes_0");
const visaTypes = visaTypesRaw ? visaTypesRaw.split(",").map((s) => s.trim()).filter(Boolean) : [];
@@ -132,6 +143,7 @@
};
return {
enabled,
heading: getVal("visaCountriesHeading"),
subheading: getVal("visaCountriesSubheading"),
description: getVal("visaCountriesDescription"),

View File

@@ -3,8 +3,17 @@
<div class="row g-4">
<!-- Basic Info -->
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="visaSolutionsEnabled"
<%= (data.visaSolutions?.enabled !== false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm">
<div class="card-header bg-white">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="fas fa-info-circle me-2"></i>Basic Information
</h6>
@@ -86,6 +95,8 @@
window.homeScrapers.visaSolutions = () => {
const getVal = (id) => (document.getElementById(id)?.value || "").trim();
const enabled = document.getElementById("visaSolutionsEnabled")?.checked !== false;
const items = [];
document.querySelectorAll(".visa-solution-item").forEach((el, idx) => {
const index = el.getAttribute("data-index") || idx;
@@ -104,6 +115,7 @@
heading: getVal("visaSolutionsHeading"),
subheading: getVal("visaSolutionsSubheading"),
items,
enabled
};
};

View File

@@ -3,8 +3,17 @@
<div class="row g-4">
<!-- Basic Info -->
<div class="col-md-12">
<div class="card border shadow-sm mb-1">
<div class="card-header bg-white d-flex justify-content-center align-items-center">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="whyChooseUsEnabled"
<%= (data.whyChooseUs.enabled !== false ) ? 'checked' : '' %>>
</div>
</div>
</div>
<div class="card border shadow-sm mb-3">
<div class="card-header bg-white">
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h6 class="mb-0">
<i class="fas fa-info-circle me-2"></i>Basic Information
</h6>
@@ -187,6 +196,7 @@
window.homeScrapers = window.homeScrapers || {};
window.homeScrapers.whyChooseUs = () => {
const getVal = (id) => (document.getElementById(id)?.value || "").trim();
const enabled = document.getElementById("whyChooseUsEnabled")?.checked !== false;
// Collect items
const items = [];
@@ -224,6 +234,7 @@
secondaryImage: getVal("whyChooseUsSecondaryImage"),
items,
features,
enabled,
ctaButton: {
label: getVal("whyChooseUsCtaLabel"),
href: getVal("whyChooseUsCtaHref"),