refactor: update btn on/off tab in home page

This commit is contained in:
Đỗ Minh Nhật
2026-04-10 03:29:00 +07:00
parent fb951cb6ce
commit 48a230105c
11 changed files with 228 additions and 95 deletions

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"),