diff --git a/models/home.js b/models/home.js index 09d3d52..736b683 100644 --- a/models/home.js +++ b/models/home.js @@ -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: () => ({}) }, diff --git a/views/admin/home/sections/achievements.ejs b/views/admin/home/sections/achievements.ejs index 28f4bd5..95b1942 100644 --- a/views/admin/home/sections/achievements.ejs +++ b/views/admin/home/sections/achievements.ejs @@ -3,8 +3,17 @@
+
+
+
+ > +
+
+
+
-
+
General Information
@@ -13,23 +22,13 @@
- +
- +
@@ -45,54 +44,38 @@
- <% for(let i=0; i<4; i++) { - const item = (data.achievements?.items && data.achievements.items[i]) || {}; - %> -
-
-
-
Achievement #<%= i + 1 %>
-
-
-
- - + <% for(let i=0; i<4; i++) { const item=(data.achievements?.items && data.achievements.items[i]) || {}; %> +
+
+
+
Achievement #<%= i + 1 %> +
-
- - -
-
- - -
-
- - +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
- <% } %> + <% } %>
@@ -102,8 +85,11 @@ + \ No newline at end of file diff --git a/views/admin/home/sections/blogPreview.ejs b/views/admin/home/sections/blogPreview.ejs index 342fef7..241b6e0 100644 --- a/views/admin/home/sections/blogPreview.ejs +++ b/views/admin/home/sections/blogPreview.ejs @@ -3,6 +3,15 @@
+
+
+
+ > +
+
+
+
@@ -106,7 +115,7 @@ function toggleBlogSelection(card, blogId) { const checkbox = card.querySelector('.blog-checkbox'); const isChecking = !checkbox.checked; - + if (isChecking) { const checkedCount = document.querySelectorAll('.blog-checkbox:checked').length; if (checkedCount >= 3) { @@ -114,7 +123,7 @@ return; } } - + checkbox.checked = isChecking; handleCheckboxUpdate(card, checkbox.checked); } @@ -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 }; }; diff --git a/views/admin/home/sections/faq.ejs b/views/admin/home/sections/faq.ejs index 7176faf..8be7751 100644 --- a/views/admin/home/sections/faq.ejs +++ b/views/admin/home/sections/faq.ejs @@ -3,11 +3,24 @@
+
+
+
+ > +
+
+
+
-
+
Basic Information
+
+ > +
@@ -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 }; }; \ No newline at end of file diff --git a/views/admin/home/sections/hero.ejs b/views/admin/home/sections/hero.ejs index 60b2adc..d1992ab 100644 --- a/views/admin/home/sections/hero.ejs +++ b/views/admin/home/sections/hero.ejs @@ -3,14 +3,20 @@
+
+
+
+ > +
+
+
+
Hero Background
-
- -
@@ -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 || "", diff --git a/views/admin/home/sections/partners.ejs b/views/admin/home/sections/partners.ejs index 1536ade..5d74cc6 100644 --- a/views/admin/home/sections/partners.ejs +++ b/views/admin/home/sections/partners.ejs @@ -3,48 +3,61 @@
+
+
+
+ > +
+
+
+
-
+
Awards & Certifications (Fixed 4 Items)
- <% 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]) || {}; %>
-
Award #<%= i + 1 %>
+
Award #<%= i + 1 %> +
- +
- +
- -
- +
- <% } %> + <% } %>
@@ -69,24 +82,27 @@
Brand Logo -
- -
- +
- <% }); %> + <% }); %>
@@ -97,8 +113,11 @@ \ No newline at end of file diff --git a/views/admin/home/sections/visaCountries.ejs b/views/admin/home/sections/visaCountries.ejs index 67012ad..ea43bb5 100644 --- a/views/admin/home/sections/visaCountries.ejs +++ b/views/admin/home/sections/visaCountries.ejs @@ -3,8 +3,17 @@
+
+
+
+ > +
+
+
+
-
+
Basic Information
@@ -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"), diff --git a/views/admin/home/sections/visaSolutions.ejs b/views/admin/home/sections/visaSolutions.ejs index 1fefdcb..ce24125 100644 --- a/views/admin/home/sections/visaSolutions.ejs +++ b/views/admin/home/sections/visaSolutions.ejs @@ -3,8 +3,17 @@
+
+
+
+ > +
+
+
+
-
+
Basic Information
@@ -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 }; }; diff --git a/views/admin/home/sections/whyChooseUs.ejs b/views/admin/home/sections/whyChooseUs.ejs index fd98ef3..16cef63 100644 --- a/views/admin/home/sections/whyChooseUs.ejs +++ b/views/admin/home/sections/whyChooseUs.ejs @@ -3,8 +3,17 @@
+
+
+
+ > +
+
+
+
-
+
Basic Information
@@ -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"),