diff --git a/.env.example b/.env.example
index ad8f4a5..241121b 100644
Binary files a/.env.example and b/.env.example differ
diff --git a/assets/css/components/button.css b/assets/css/components/button.css
index cd54ae7..fdfef3a 100644
--- a/assets/css/components/button.css
+++ b/assets/css/components/button.css
@@ -1,127 +1,123 @@
/**
* CMS Component: Buttons
- * Overrides Bootstrap buttons to match CMS design language
*/
.btn {
- border-radius: var(--border-radius);
- font-weight: var(--font-weight-medium);
- padding: 0.5rem 1.25rem;
- transition: var(--transition-base);
- display: inline-flex;
- align-items: center;
- justify-content: center;
- gap: 0.5rem;
- height: 42px; /* Standardize height */
+ border-radius: var(--border-radius-sm);
+ font-weight: var(--font-weight-medium);
+ font-size: var(--font-size-sm);
+ padding: 0.5rem 1.1rem;
+ transition: var(--transition-base);
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.4rem;
+ height: 38px;
+ letter-spacing: 0.01em;
}
.btn-sm {
- padding: 0.25rem 0.75rem;
- font-size: var(--font-size-sm);
- height: 32px;
+ padding: 0.3rem 0.75rem;
+ font-size: 0.8125rem;
+ height: 30px;
+ border-radius: var(--border-radius-sm);
}
.btn-lg {
- padding: 0.75rem 1.5rem;
- font-size: var(--font-size-lg);
- height: 52px;
+ padding: 0.65rem 1.5rem;
+ font-size: 1rem;
+ height: 46px;
}
-/* Primary Button */
+/* Primary */
.btn-primary {
- background-color: var(--primary-color);
- border-color: var(--primary-color);
- color: var(--text-white);
+ background-color: var(--primary-color);
+ border-color: var(--primary-color);
+ color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
- background-color: var(--primary-dark);
- border-color: var(--primary-dark);
- color: var(--text-white);
- transform: translateY(-1px);
- box-shadow: var(--shadow-md);
+ background-color: var(--primary-light);
+ border-color: var(--primary-light);
+ color: #fff;
+ box-shadow: 0 4px 12px rgba(10,35,71,0.25);
+ transform: translateY(-1px);
+}
+
+/* Accent */
+.btn-accent {
+ background-color: var(--accent-color);
+ border-color: var(--accent-color);
+ color: #fff;
+}
+
+.btn-accent:hover {
+ background-color: var(--accent-light);
+ border-color: var(--accent-light);
+ color: #fff;
+ transform: translateY(-1px);
}
/* Outline Primary */
.btn-outline-primary {
- color: var(--primary-color);
- border-color: var(--primary-color);
+ color: var(--primary-color);
+ border-color: var(--primary-color);
+ background: transparent;
}
.btn-outline-primary:hover {
- background-color: var(--primary-color);
- color: var(--text-white);
+ background-color: var(--primary-color);
+ color: #fff;
+ box-shadow: 0 2px 8px rgba(10,35,71,0.2);
}
-/* White / Icon Button */
+/* Outline Secondary */
+.btn-outline-secondary {
+ color: var(--text-muted);
+ border-color: var(--border-color);
+ background: #fff;
+}
+
+.btn-outline-secondary:hover {
+ background-color: #f8fafc;
+ border-color: #cbd5e1;
+ color: var(--text-main);
+}
+
+/* Outline Danger */
+.btn-outline-danger {
+ color: var(--danger-color);
+ border-color: var(--danger-color);
+ background: transparent;
+}
+
+.btn-outline-danger:hover {
+ background-color: var(--danger-color);
+ color: #fff;
+}
+
+/* White */
.btn-white {
- background-color: var(--bg-card);
- border: 1px solid var(--border-color);
- color: var(--text-main);
+ background-color: #fff;
+ border: 1px solid var(--border-color);
+ color: var(--text-main);
}
.btn-white:hover {
- background-color: #f8f9fa;
- border-color: #dee2e6;
- box-shadow: var(--shadow-sm);
+ background-color: #f8fafc;
+ border-color: #cbd5e1;
+ box-shadow: var(--shadow-sm);
}
-/* Special Button Effects (Shine effect from main.ejs) */
-.btn-shine {
- position: relative;
- overflow: hidden;
+/* Icon button */
+.btn-icon {
+ width: 34px;
+ height: 34px;
+ padding: 0;
+ border-radius: var(--border-radius-sm);
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
}
-.btn-shine::after {
- content: "";
- position: absolute;
- top: 0;
- left: -100%;
- width: 100%;
- height: 100%;
- background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
- transition: all 0.5s ease;
-}
-
-.btn-shine:hover::after {
- left: 100%;
-}
-
-/* Action Button Group (Like Topbar screenshot) */
-.btn-group-action {
- background-color: #fff;
- border: 1px solid var(--border-color);
- border-radius: var(--border-radius-lg);
- box-shadow: var(--shadow-sm);
- overflow: hidden;
- display: inline-flex;
-}
-
-.btn-group-action .btn {
- border: none;
- border-radius: 0;
- padding: 0.5rem 0.85rem;
- background: transparent;
- height: 38px;
- width: 42px;
-}
-
-.btn-group-action .btn:not(:last-child) {
- border-right: 1px solid var(--border-color);
-}
-
-.btn-group-action .btn:hover {
- background-color: #f8f9fa;
- transform: none;
- box-shadow: none;
-}
-
-/* Icon alignment inside buttons */
-.btn i {
- font-size: 0.9em;
-}
-
-/* Icon specific colors for actions */
-.text-action-add { color: #0d6efd !important; }
-.text-action-edit { color: #ffc107 !important; }
-.text-action-delete { color: #dc3545 !important; }
+.btn i { font-size: 0.85em; }
diff --git a/assets/css/components/card.css b/assets/css/components/card.css
index 4765955..c1a981d 100644
--- a/assets/css/components/card.css
+++ b/assets/css/components/card.css
@@ -1,39 +1,130 @@
/**
* CMS Component: Cards
- * Standardizes administrative dashboard cards
*/
.card {
- border: 1px solid var(--border-color);
- border-radius: var(--border-radius);
- box-shadow: var(--shadow-sm);
- transition: var(--transition-base);
- overflow: hidden;
+ border: 1px solid var(--border-color);
+ border-radius: var(--border-radius);
+ box-shadow: var(--shadow-sm);
+ transition: var(--transition-base);
+ overflow: hidden;
+ background: var(--bg-card);
}
-.card:hover {
- box-shadow: var(--shadow-md);
-}
+.card:hover { box-shadow: var(--shadow-md); }
.card-header {
- background-color: #fff;
- border-bottom: 1px solid var(--border-color);
- padding: var(--spacing-3) var(--spacing-4);
- font-weight: var(--font-weight-bold);
+ background-color: #fff;
+ border-bottom: 1px solid var(--border-color);
+ padding: 1rem 1.25rem;
+ font-weight: var(--font-weight-semibold);
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.75rem;
+}
+
+.card-header-title {
+ font-size: 0.9375rem;
+ font-weight: var(--font-weight-semibold);
+ color: var(--text-main);
+ margin: 0;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+}
+
+.card-header-title i {
+ color: var(--accent-color);
+ font-size: 0.9em;
}
.card-title {
- margin-bottom: 0;
- font-size: 1.1rem;
- color: var(--text-main);
+ margin-bottom: 0;
+ font-size: 1rem;
+ color: var(--text-main);
+ font-weight: var(--font-weight-semibold);
}
-.card-body {
- padding: var(--spacing-4);
-}
+.card-body { padding: 1.25rem; }
.card-footer {
- background-color: #fcfcfc;
- border-top: 1px solid var(--border-color);
- padding: var(--spacing-2) var(--spacing-4);
+ background-color: #fafbfc;
+ border-top: 1px solid var(--border-color);
+ padding: 0.75rem 1.25rem;
+}
+
+/* Stat cards — gradient style */
+.stat-card {
+ border-radius: var(--border-radius);
+ padding: 1.35rem 1.4rem 1.1rem;
+ position: relative;
+ overflow: hidden;
+ transition: var(--transition-base);
+ box-shadow: var(--shadow-sm);
+ display: flex;
+ flex-direction: column;
+ gap: 0.25rem;
+ min-height: 110px;
+}
+
+.stat-card:hover {
+ transform: translateY(-3px);
+ box-shadow: var(--shadow-md);
+}
+
+/* Background ghost icon */
+.stat-card::after {
+ content: attr(data-icon);
+ font-family: "Font Awesome 6 Free";
+ font-weight: 900;
+ position: absolute;
+ right: -0.5rem;
+ bottom: -0.75rem;
+ font-size: 5rem;
+ opacity: 0.1;
+ line-height: 1;
+ pointer-events: none;
+}
+
+.stat-card-value {
+ font-size: 2rem;
+ font-weight: var(--font-weight-bold);
+ line-height: 1;
+ color: #fff;
+}
+
+.stat-card-label {
+ font-size: 0.7rem;
+ font-weight: var(--font-weight-semibold);
+ text-transform: uppercase;
+ letter-spacing: 0.07em;
+ color: rgba(255,255,255,0.75);
+ margin-top: 0.15rem;
+}
+
+.stat-card-icon {
+ display: none; /* icon is now the ghost bg */
+}
+
+.stat-card-body { display: contents; }
+
+/* Color variants */
+.stat-card.primary {
+ background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
+}
+.stat-card.accent {
+ background: linear-gradient(135deg, #8a6d3b 0%, var(--accent-color) 100%);
+}
+.stat-card.success {
+ background: linear-gradient(135deg, #145c38 0%, var(--success-color) 100%);
+}
+.stat-card.danger {
+ background: linear-gradient(135deg, #922b21 0%, var(--danger-color) 100%);
+}
+.stat-card.warning {
+ background: linear-gradient(135deg, #b45309 0%, var(--warning-color) 100%);
+}
+.stat-card.info {
+ background: linear-gradient(135deg, #0c5a72 0%, var(--info-color) 100%);
}
diff --git a/assets/css/components/form.css b/assets/css/components/form.css
index 069efd1..40199ac 100644
--- a/assets/css/components/form.css
+++ b/assets/css/components/form.css
@@ -1,50 +1,85 @@
/**
* CMS Component: Forms
- * Standardizes inputs, labels and validation messages
*/
.form-label {
- font-weight: var(--font-weight-medium);
- margin-bottom: var(--spacing-2);
- color: var(--text-main);
- font-size: var(--font-size-sm);
+ font-weight: var(--font-weight-medium);
+ margin-bottom: 0.35rem;
+ color: var(--text-main);
+ font-size: var(--font-size-sm);
}
.form-control, .form-select {
- border-radius: var(--border-radius);
- border: 1px solid var(--border-color);
- padding: 0.6rem 1rem;
- font-size: var(--font-size-base);
- transition: var(--transition-base);
+ border-radius: var(--border-radius-sm);
+ border: 1px solid var(--border-color);
+ padding: 0.5rem 0.875rem;
+ font-size: var(--font-size-sm);
+ color: var(--text-main);
+ background-color: #fff;
+ transition: var(--transition-base);
+ height: 38px;
}
+textarea.form-control { height: auto; }
+
.form-control:focus, .form-select:focus {
- border-color: var(--primary-color);
- box-shadow: 0 0 0 0.2rem rgba(188, 159, 105, 0.15);
- outline: none;
+ border-color: var(--primary-color);
+ box-shadow: 0 0 0 3px rgba(10,35,71,0.08);
+ outline: none;
}
+.form-control::placeholder { color: #94a3b8; }
+
.input-group-text {
- background-color: #f8f9fa;
- border-color: var(--border-color);
- color: var(--text-muted);
+ background-color: #f8fafc;
+ border-color: var(--border-color);
+ color: var(--text-muted);
+ font-size: var(--font-size-sm);
}
-/* Form Helper Text */
.form-text {
- font-size: var(--font-size-xs);
- color: var(--text-muted);
- margin-top: var(--spacing-1);
+ font-size: var(--font-size-xs);
+ color: var(--text-muted);
+ margin-top: 0.3rem;
}
-/* Validation Styles */
.invalid-feedback {
- font-size: var(--font-size-xs);
- font-weight: var(--font-weight-medium);
+ font-size: var(--font-size-xs);
+ font-weight: var(--font-weight-medium);
}
-/* Custom Checkbox/Radio */
.form-check-input:checked {
- background-color: var(--primary-color);
- border-color: var(--primary-color);
+ background-color: var(--primary-color);
+ border-color: var(--primary-color);
+}
+
+/* Section divider in forms */
+.form-section {
+ border-top: 1px solid var(--border-color);
+ padding-top: 1.25rem;
+ margin-top: 0.5rem;
+}
+
+.form-section-title {
+ font-size: var(--font-size-xs);
+ font-weight: var(--font-weight-semibold);
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ color: var(--text-muted);
+ margin-bottom: 1rem;
+}
+
+/* Search bar */
+.search-bar .form-control {
+ padding-left: 2.5rem;
+}
+
+.search-bar .search-icon {
+ position: absolute;
+ left: 0.875rem;
+ top: 50%;
+ transform: translateY(-50%);
+ color: var(--text-muted);
+ font-size: 0.85rem;
+ pointer-events: none;
}
diff --git a/assets/css/components/modal.css b/assets/css/components/modal.css
index 63b0062..14fbb86 100644
--- a/assets/css/components/modal.css
+++ b/assets/css/components/modal.css
@@ -1,45 +1,47 @@
/**
* CMS Component: Modals
- * Standardizes modal spacing and appearance
*/
.modal-content {
- border: none;
- border-radius: var(--border-radius-lg);
- box-shadow: var(--shadow-lg);
+ border: none;
+ border-radius: var(--border-radius-lg);
+ box-shadow: var(--shadow-lg);
+ overflow: hidden;
}
.modal-header {
- border-bottom: 1px solid var(--border-color);
- padding: var(--spacing-4);
- background-color: #fff;
- border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
+ border-bottom: 1px solid var(--border-color);
+ padding: 1.1rem 1.5rem;
+ background-color: #fff;
}
.modal-title {
- font-weight: var(--font-weight-bold);
- color: var(--text-main);
- font-size: 1.15rem;
+ font-weight: var(--font-weight-semibold);
+ color: var(--text-main);
+ font-size: 1rem;
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
}
-.modal-body {
- padding: var(--spacing-4);
-}
+.modal-title i { color: var(--accent-color); }
+
+.modal-body { padding: 1.5rem; }
.modal-footer {
- border-top: 1px solid var(--border-color);
- padding: var(--spacing-3) var(--spacing-4);
- gap: var(--spacing-2);
+ border-top: 1px solid var(--border-color);
+ padding: 0.875rem 1.5rem;
+ gap: 0.5rem;
+ background: #fafbfc;
}
-/* Modal sizing standards */
-.modal-dialog-centered {
- display: flex;
- align-items: center;
- min-height: calc(100% - var(--bs-modal-margin) * 2);
+.modal-backdrop.show { opacity: 0.45; }
+
+/* Confirm modal */
+.modal-confirm .modal-header {
+ background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
+ border-bottom: none;
}
-/* Fix for backdrop issue reported in previous conversations */
-.modal-backdrop.show {
- opacity: 0.5;
-}
+.modal-confirm .modal-title { color: #fff; }
+.modal-confirm .btn-close { filter: invert(1); }
diff --git a/assets/css/components/table.css b/assets/css/components/table.css
index 4aede1d..cc1767a 100644
--- a/assets/css/components/table.css
+++ b/assets/css/components/table.css
@@ -1,62 +1,112 @@
/**
* CMS Component: Tables
- * Standardizes data tables listing
*/
-.table {
- margin-bottom: 0;
-}
+.table { margin-bottom: 0; }
.table thead th {
- background-color: #f8f9fa;
- border-bottom: 2px solid var(--border-color);
- color: var(--text-muted);
- font-weight: var(--font-weight-bold);
- font-size: var(--font-size-xs);
- text-transform: uppercase;
- letter-spacing: 0.025em;
- padding: var(--spacing-3) var(--spacing-4);
+ background-color: #f8fafc;
+ border-bottom: 1px solid var(--border-color);
+ border-top: none;
+ color: var(--text-muted);
+ font-weight: var(--font-weight-semibold);
+ font-size: 0.7rem;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ padding: 0.75rem 1rem;
+ white-space: nowrap;
}
.table tbody td {
- padding: var(--spacing-3) var(--spacing-4);
- vertical-align: middle;
- border-bottom: 1px solid var(--border-color);
+ padding: 0.75rem 1rem;
+ vertical-align: middle;
+ border-bottom: 1px solid var(--border-light);
+ font-size: var(--font-size-sm);
+ color: var(--text-main);
}
-.table-hover tbody tr:hover {
- background-color: rgba(188, 159, 105, 0.05);
-}
+.table tbody tr:last-child td { border-bottom: none; }
-/* Badge in table */
+.table-hover tbody tr:hover { background-color: #f8fafc; }
+
+/* Badges */
.badge {
- padding: 0.4em 0.6em;
- border-radius: var(--border-radius-sm);
- font-weight: var(--font-weight-medium);
+ padding: 0.35em 0.65em;
+ border-radius: var(--border-radius-sm);
+ font-weight: var(--font-weight-medium);
+ font-size: 0.75rem;
+ letter-spacing: 0.01em;
+}
+
+.badge-soft-primary {
+ background-color: var(--primary-soft);
+ color: var(--primary-color);
+ border: 1px solid rgba(10,35,71,0.12);
+}
+
+.badge-soft-accent {
+ background-color: var(--accent-soft);
+ color: #8a6d3b;
+ border: 1px solid rgba(188,159,105,0.2);
}
.bg-soft-success {
- background-color: var(--success-soft);
- color: var(--success-color);
- border: 1px solid rgba(40, 167, 69, 0.2);
+ background-color: var(--success-soft);
+ color: var(--success-color);
+ border: 1px solid rgba(26,122,74,0.15);
}
+
.bg-soft-danger {
- background-color: var(--danger-soft);
- color: var(--danger-color);
- border: 1px solid rgba(220, 53, 69, 0.2);
+ background-color: var(--danger-soft);
+ color: var(--danger-color);
+ border: 1px solid rgba(192,57,43,0.15);
}
+
.bg-soft-warning {
- background-color: var(--warning-soft);
- color: var(--warning-color);
- border: 1px solid rgba(255, 193, 7, 0.2);
+ background-color: var(--warning-soft);
+ color: var(--warning-color);
+ border: 1px solid rgba(217,119,6,0.15);
}
+
.bg-soft-info {
- background-color: var(--info-soft);
- color: var(--info-color);
- border: 1px solid rgba(23, 162, 184, 0.2);
+ background-color: var(--info-soft);
+ color: var(--info-color);
+ border: 1px solid rgba(14,116,144,0.15);
}
+
.bg-soft-secondary {
- background-color: #f8f9fa;
- color: #6c757d;
- border: 1px solid rgba(108, 117, 125, 0.2);
+ background-color: #f1f5f9;
+ color: #64748b;
+ border: 1px solid rgba(100,116,139,0.15);
+}
+
+/* Table action buttons */
+.table-actions {
+ display: flex;
+ gap: 0.35rem;
+ align-items: center;
+}
+
+/* Empty state */
+.empty-state {
+ text-align: center;
+ padding: 3.5rem 1rem;
+}
+
+.empty-state-icon {
+ font-size: 2.5rem;
+ color: #cbd5e1;
+ margin-bottom: 1rem;
+}
+
+.empty-state h5 {
+ color: var(--text-muted);
+ font-weight: var(--font-weight-semibold);
+ margin-bottom: 0.5rem;
+}
+
+.empty-state p {
+ color: var(--text-muted);
+ font-size: var(--font-size-sm);
+ margin-bottom: 1.25rem;
}
diff --git a/assets/css/layout.css b/assets/css/layout.css
index 4b85907..54df78b 100644
--- a/assets/css/layout.css
+++ b/assets/css/layout.css
@@ -1,101 +1,118 @@
/**
* CMS Global Layout
- * Navbar, Footer, and Page structures
*/
+@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
+
body {
- font-family: var(--font-family);
- background-color: var(--bg-body);
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- color: var(--text-main);
+ font-family: var(--font-family);
+ background-color: var(--bg-body);
+ min-height: 100vh;
+ display: flex;
+ flex-direction: column;
+ color: var(--text-main);
}
-main {
- flex: 1;
- padding: var(--spacing-4) 0;
+main { flex: 1; padding: var(--spacing-4) 0; }
+
+/* Page header */
+.page-header { margin-bottom: var(--spacing-4); }
+
+.page-content {
+ background-color: var(--bg-card);
+ padding: var(--spacing-4);
+ border-radius: var(--border-radius);
+ box-shadow: var(--shadow-sm);
}
-/* Navbar Customization */
+/* Navbar */
.navbar {
- background-color: rgba(255, 255, 255, 0.95);
- box-shadow: var(--shadow-header);
- padding: 0.75rem 0;
- transition: var(--transition-base);
+ background-color: rgba(255,255,255,0.97);
+ box-shadow: var(--shadow-header);
+ padding: 0.75rem 0;
+ transition: var(--transition-base);
}
.navbar-brand {
- font-weight: var(--font-weight-bold);
- color: var(--primary-color) !important;
+ font-weight: var(--font-weight-bold);
+ color: var(--primary-color) !important;
}
.nav-link {
- color: var(--text-main);
- font-weight: var(--font-weight-medium);
- padding: 0.5rem 1rem;
- transition: var(--transition-base);
- font-size: 0.95rem;
+ color: var(--text-main);
+ font-weight: var(--font-weight-medium);
+ padding: 0.5rem 1rem;
+ transition: var(--transition-base);
+ font-size: 0.95rem;
}
-.nav-link:hover, .nav-link.active {
- color: var(--primary-color) !important;
-}
+.nav-link:hover, .nav-link.active { color: var(--primary-color) !important; }
-/* Page Containers */
-.page-header {
- margin-bottom: var(--spacing-4);
-}
-
-.page-content {
- background-color: var(--bg-card);
- padding: var(--spacing-4);
- border-radius: var(--border-radius);
- box-shadow: var(--shadow-sm);
-}
-
-/* Footer Customization */
+/* Footer */
footer {
- background: linear-gradient(90deg, var(--primary-dark), var(--primary-color), var(--primary-light), #d4c4a8);
- color: var(--text-white);
- margin-top: auto;
- padding: var(--spacing-4) 0;
+ background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 60%, var(--primary-light) 100%);
+ color: var(--text-white);
+ margin-top: auto;
+ padding: var(--spacing-4) 0;
}
footer a {
- color: rgba(255, 255, 255, 0.8) !important;
- text-decoration: none;
- transition: var(--transition-base);
+ color: rgba(255,255,255,0.75) !important;
+ text-decoration: none;
+ transition: var(--transition-base);
}
-footer a:hover {
- color: var(--text-white) !important;
-}
+footer a:hover { color: var(--text-white) !important; }
-/* Utility: Fixed Bottom Actions (for Forms/Modals) */
-.fixed-bottom-buttons {
- position: fixed;
- bottom: 0;
- right: 0;
- padding: var(--spacing-3);
- z-index: 1000;
- display: flex;
- gap: var(--spacing-2);
-}
-
-/* Dropdown Customization */
+/* Dropdown */
.dropdown-menu {
- border: none;
- box-shadow: var(--shadow-lg);
- border-radius: var(--border-radius);
- margin-top: 0.5rem;
-}
-
-.dropdown-item:hover {
- background-color: var(--primary-soft);
+ border: none;
+ box-shadow: var(--shadow-lg);
+ border-radius: var(--border-radius);
+ margin-top: 0.5rem;
}
+.dropdown-item:hover { background-color: var(--primary-soft); }
.dropdown-item.active {
- background-color: var(--primary-color);
- color: var(--text-white);
+ background-color: var(--primary-color);
+ color: var(--text-white);
}
+
+/* Page title area */
+.page-title-area {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 1.5rem;
+ flex-wrap: wrap;
+ gap: 0.75rem;
+}
+
+.page-title-area h1 {
+ font-size: 1.4rem;
+ font-weight: var(--font-weight-bold);
+ color: var(--primary-color);
+ margin: 0;
+}
+
+.page-title-area .subtitle {
+ font-size: var(--font-size-sm);
+ color: var(--text-muted);
+ margin: 0;
+}
+
+/* Breadcrumb */
+.breadcrumb-area {
+ margin-bottom: 0.25rem;
+}
+
+.breadcrumb {
+ font-size: var(--font-size-xs);
+ margin: 0;
+ padding: 0;
+ background: none;
+}
+
+.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
+.breadcrumb-item a { color: var(--accent-color); text-decoration: none; }
+.breadcrumb-item.active { color: var(--text-muted); }
diff --git a/assets/css/variables.css b/assets/css/variables.css
index afd6358..9ab82dc 100644
--- a/assets/css/variables.css
+++ b/assets/css/variables.css
@@ -1,47 +1,62 @@
/**
* CMS Design System Variables
- * Standardized colors, spacing, and typography
*/
:root {
- /* Primary Colors (Gold/Cinnamon) */
+ /* Primary Colors (Navy) */
--primary-color: #0a2347;
- --primary-rgb: 188, 159, 105;
- --primary-light: #0a2347;
- --primary-dark: #0a2347;
- --primary-soft: rgba(188, 159, 105, 0.1);
+ --primary-rgb: 10, 35, 71;
+ --primary-light: #1a3a6b;
+ --primary-dark: #061529;
+ --primary-soft: rgba(10, 35, 71, 0.07);
+
+ /* Accent (Gold) */
+ --accent-color: #bc9f69;
+ --accent-light: #d4b98a;
+ --accent-soft: rgba(188, 159, 105, 0.12);
/* Secondary Colors */
--secondary-color: #6c757d;
--secondary-soft: rgba(108, 117, 125, 0.1);
/* Status Colors */
- --success-color: #28a745;
- --success-soft: rgba(40, 167, 69, 0.1);
- --warning-color: #ffc107;
- --warning-soft: rgba(255, 193, 7, 0.1);
- --danger-color: #BF3432;
- --danger-soft: rgba(220, 53, 69, 0.1);
- --info-color: #17a2b8;
- --info-soft: rgba(23, 162, 184, 0.1);
+ --success-color: #1a7a4a;
+ --success-soft: rgba(26, 122, 74, 0.1);
+ --warning-color: #d97706;
+ --warning-soft: rgba(217, 119, 6, 0.1);
+ --danger-color: #c0392b;
+ --danger-soft: rgba(192, 57, 43, 0.1);
+ --info-color: #0e7490;
+ --info-soft: rgba(14, 116, 144, 0.1);
/* Neutral Colors / Backgrounds */
- --bg-body: #f5f7fa;
+ --bg-body: #f0f2f7;
--bg-card: #ffffff;
--bg-header: #ffffff;
- --border-color: #e9ecef;
- --text-main: #333333;
- --text-muted: #6c757d;
+ --border-color: #e2e8f0;
+ --border-light: #f1f5f9;
+ --text-main: #1e293b;
+ --text-muted: #64748b;
--text-white: #ffffff;
+ /* Sidebar */
+ --sidebar-bg: #0a2347;
+ --sidebar-text: rgba(255,255,255,0.75);
+ --sidebar-text-active: #ffffff;
+ --sidebar-hover-bg: rgba(255,255,255,0.08);
+ --sidebar-active-bg: rgba(188,159,105,0.18);
+ --sidebar-active-border: #bc9f69;
+ --sidebar-section-color: rgba(188,159,105,0.7);
+
/* Typography */
- --font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
- --font-size-base: 1rem;
+ --font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
+ --font-size-base: 0.9375rem;
--font-size-sm: 0.875rem;
--font-size-xs: 0.75rem;
- --font-size-lg: 1.25rem;
+ --font-size-lg: 1.125rem;
--font-weight-normal: 400;
--font-weight-medium: 500;
+ --font-weight-semibold: 600;
--font-weight-bold: 700;
/* Spacing & Borders */
@@ -51,16 +66,16 @@
--spacing-4: 1.5rem;
--spacing-5: 3rem;
- --border-radius: 8px;
- --border-radius-sm: 4px;
- --border-radius-lg: 12px;
+ --border-radius: 10px;
+ --border-radius-sm: 6px;
+ --border-radius-lg: 14px;
--border-radius-full: 50px;
/* Shadows & Elevation */
- --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
- --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
- --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
- --shadow-header: 0 2px 10px rgba(0, 0, 0, 0.05);
+ --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
+ --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
+ --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
+ --shadow-header: 0 1px 0 rgba(0,0,0,0.06);
/* Transitions */
--transition-base: all 0.2s ease-in-out;
diff --git a/constants/auditAction.js b/constants/auditAction.js
index a7a8fd8..c7f2ea8 100644
--- a/constants/auditAction.js
+++ b/constants/auditAction.js
@@ -64,6 +64,21 @@ const AUDIT_ACTIONS = Object.freeze({
// Video Gallery
UPDATE_VIDEO_GALLERY: "UPDATE_VIDEO_GALLERY",
+ // Degree (legacy)
+ CREATE_DEGREE: "CREATE_DEGREE",
+ UPDATE_DEGREE: "UPDATE_DEGREE",
+ DELETE_DEGREE: "DELETE_DEGREE",
+
+ // Qualification
+ CREATE_QUALIFICATION: "CREATE_QUALIFICATION",
+ UPDATE_QUALIFICATION: "UPDATE_QUALIFICATION",
+ DELETE_QUALIFICATION: "DELETE_QUALIFICATION",
+
+ // Certificate
+ CREATE_CERTIFICATE: "CREATE_CERTIFICATE",
+ UPDATE_CERTIFICATE: "UPDATE_CERTIFICATE",
+ DELETE_CERTIFICATE: "DELETE_CERTIFICATE",
+
// Auth / System
LOGIN: "LOGIN",
LOGOUT: "LOGOUT",
diff --git a/controllers/aboutUsController.js b/controllers/aboutUsController.js
deleted file mode 100644
index b46b1ee..0000000
--- a/controllers/aboutUsController.js
+++ /dev/null
@@ -1,251 +0,0 @@
-const { addBaseUrlToImages } = require("../utils/imageHelper");
-const AboutUs = require("../models/aboutUs");
-const Blog = require("../models/blog");
-const jsonHelper = require("../utils/jsonHelper");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-/**
- * GET /api/about
- * Lấy dữ liệu About Us (Public API cho website và CMS load dữ liệu)
- */
-exports.getAbout = async (req, res) => {
- try {
- // Force no-cache headers
- res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
- res.setHeader("Pragma", "no-cache");
- res.setHeader("Expires", "0");
-
- const data = await AboutUs.getSingle();
- const rawData = data.toObject();
-
- // === Dynamic Blog News Section ===
- const news = rawData.news || {};
- let blogs = [];
-
- // Nếu có chọn blog cụ thể
- if (news.selectedBlogIds && news.selectedBlogIds.length > 0) {
- blogs = await Blog.find({
- _id: { $in: news.selectedBlogIds },
- status: "published",
- }).lean();
-
- // Sắp xếp theo thứ tự đã chọn trong selectedBlogIds
- blogs.sort((a, b) => {
- return (
- news.selectedBlogIds.indexOf(a._id.toString()) -
- news.selectedBlogIds.indexOf(b._id.toString())
- );
- });
- }
-
- // Nếu không chọn hoặc chọn nhưng không đủ, lấy thêm 3 bài mới nhất
- if (blogs.length === 0) {
- blogs = await Blog.find({ status: "published" })
- .sort({ createdAt: -1 })
- .limit(3)
- .lean();
- }
-
- // Map dữ liệu blog sang format mà frontend mong đợi
- news.items = blogs.map((blog) => ({
- title: blog.title,
- category: blog.category && blog.category[0] ? blog.category[0] : "Visa",
- date:
- blog.publishedAt ||
- new Date(blog.createdAt).toLocaleDateString("en-GB", {
- day: "numeric",
- month: "long",
- year: "numeric",
- }),
- comments: blog.commentsCount || 0,
- author: {
- name: blog.author || "Admin",
- avatar: "/assets/img/home-1/news/client.png", // Default avatar
- },
- link: `/blog/${blog.slug}`,
- thumbnail: blog.featuredImage,
- }));
-
- rawData.news = news;
- // ===============================
-
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(rawData, baseUrl);
-
- res.json(processedData);
- } catch (error) {
- console.error("Error getting about data:", error);
- res.status(500).json({
- success: false,
- error: "Failed to get about data",
- });
- }
-};
-
-/**
- * PUT /api/about
- * Cập nhật dữ liệu About Us (Dùng cho AJAX từ CMS)
- */
-exports.updateAbout = async (req, res) => {
- try {
- let updateData = req.body;
-
- // Nếu dữ liệu gửi qua trường aboutJson (dạng string JSON)
- if (updateData.aboutJson && typeof updateData.aboutJson === "string") {
- try {
- updateData = JSON.parse(updateData.aboutJson);
- } catch (e) {
- return res.status(400).json({
- success: false,
- message: "Invalid JSON in aboutJson",
- });
- }
- }
-
- const doc = await AboutUs.getSingle();
-
- // ✅ Capture BEFORE state
- const beforeData = JSON.parse(JSON.stringify(doc.toObject()));
-
- // Use .set() for better handling of nested objects/arrays in Mongoose
- doc.set(updateData);
- await doc.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(doc.toObject()));
-
- // ✅ AUDIT LOGGING - About Us Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "AboutUs",
- documentId: doc._id,
- action: AUDIT_ACTIONS.UPDATE_ABOUT_US,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- console.log(
- `✅ Audit log created for About Us update: ${changes.length} changes`,
- );
- } else {
- console.log("ℹ️ No changes detected for About Us update");
- }
-
- // Fetch fresh data for syncing and returning
- const finalData = await AboutUs.findOne()
- .select("-_id -__v -createdAt -updatedAt")
- .lean();
-
- // Update about.json file to keep it in sync
- jsonHelper.writeJsonFile("about", finalData);
-
- res.json({
- success: true,
- message: "About Us updated successfully",
- data: finalData,
- });
- } catch (error) {
- console.error("Error updating about data:", error);
- res.status(500).json({
- success: false,
- error: "Failed to update about data: " + error.message,
- });
- }
-};
-
-/**
- * Render admin page (Dùng cho Admin UI)
- */
-exports.index = async (req, res) => {
- try {
- const data = await AboutUs.getSingle();
- const rawData = data.toObject();
-
- // Lấy tất cả blog để chọn trong CMS
- const allBlogs = await Blog.find({ status: "published" })
- .sort({ createdAt: -1 })
- .lean();
-
- const activeTab = req.query.activeTab || "hero";
- res.render("admin/aboutUs/index", {
- layout: "layouts/main",
- title: "About Us Management",
- data: rawData,
- allBlogs,
- activeTab,
- user: req.session.user,
- currentPath: req.path,
- frontendUrl: process.env.FRONTEND_URL || "http://localhost:3000",
- backendUrl: process.env.BACKEND_URL || "http://localhost:3001",
- });
- } catch (err) {
- console.error("Error in about index:", err);
- req.flash("error_msg", "Error loading About Us page");
- res.redirect("/admin/dashboard");
- }
-};
-
-/**
- * Update method cho form-based submission (Admin UI - Post fallback)
- */
-exports.update = async (req, res) => {
- try {
- let updateData = req.body;
- if (updateData.aboutJson && typeof updateData.aboutJson === "string") {
- try {
- updateData = JSON.parse(updateData.aboutJson);
- } catch (e) {
- req.flash("error_msg", "Invalid JSON data");
- return res.redirect("/admin/about-us");
- }
- }
-
- const doc = await AboutUs.getSingle();
-
- // ✅ Capture BEFORE state
- const beforeData = JSON.parse(JSON.stringify(doc.toObject()));
-
- doc.set(updateData);
- await doc.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(doc.toObject()));
-
- // ✅ AUDIT LOGGING - About Us Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "AboutUs",
- documentId: doc._id,
- action: AUDIT_ACTIONS.UPDATE_ABOUT_US,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- const finalData = await AboutUs.findOne()
- .select("-_id -__v -createdAt -updatedAt")
- .lean();
- jsonHelper.writeJsonFile("about", finalData);
-
- req.flash("success_msg", "About Us updated successfully");
- const activeTab = req.query.activeTab || "hero";
- res.redirect(`/admin/about-us?activeTab=${activeTab}`);
- } catch (err) {
- console.error("Update error:", err);
- req.flash("error_msg", "Error updating About Us: " + err.message);
- res.redirect("/admin/about-us");
- }
-};
-
-// Aliases for compatibility
-exports.api = exports.getAbout;
-exports.page = exports.getAbout;
-exports.updateAboutUs = exports.updateAbout;
diff --git a/controllers/activityController.js b/controllers/activityController.js
deleted file mode 100644
index 532fffb..0000000
--- a/controllers/activityController.js
+++ /dev/null
@@ -1,1616 +0,0 @@
-const {addBaseUrlToImages} = require("../utils/imageHelper");
-const Activity = require("../models/activity");
-const mongoose = require('mongoose');
-
-// -------------------- Public (API) exports --------------------
-
-// API endpoint: return all active activities as JSON
-exports.api = async (req, res) => {
- try {
- // Return structured response with filters and camps
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
-
- // Get filters document (single doc with isFiltersDoc:true)
- const filtersDoc = await Activity.findOne({ isFiltersDoc: true }).lean();
- const filters = (filtersDoc && Array.isArray(filtersDoc.filters)) ? filtersDoc.filters : [];
-
- // Fetch camps (activities) excluding the filters doc
- const activities = await Activity.find({ isFiltersDoc: { $ne: true }, isActive: true })
- .sort({ order: 1, createdAt: -1 })
- .lean();
-
- const camps = (activities || []).map((activity) => addBaseUrlToImages(activity, baseUrl));
-
- // Get hero data from the first activity (assuming all activities share the same hero)
- const heroRaw = activities.length > 0 && activities[0].hero ? activities[0].hero : {};
- const hero = addBaseUrlToImages(heroRaw, baseUrl);
-
- return res.json({ hero, filter: filters, camps });
- } catch (err) {
- console.error("activity.api error:", err);
- return res.status(500).json({error: "Error loading activities data"});
- }
-};
-
-// API endpoint: return a single activity by ID or link
-exports.apiDetail = async (req, res) => {
- try {
- const {id} = req.params;
-
- // Try to find by ID first, then by link
- let activity;
- if (id.match(/^[0-9a-fA-F]{24}$/)) {
- activity = await Activity.findById(id).lean();
- }
-
- if (!activity) {
- activity = await Activity.findOne({link: `/${id}`}).lean();
- }
-
- if (!activity) {
- return res.status(404).json({error: "Activity not found"});
- }
-
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processed = addBaseUrlToImages(activity, baseUrl);
-
- return res.json(processed);
- } catch (err) {
- console.error("activity.apiDetail error:", err);
- return res.status(500).json({error: "Error loading activity data"});
- }
-};
-
-// -------------------- Admin exports --------------------
-
-// Get default activity data for creating new activity
-const getDefaultActivityData = () => ({
- hero: {
- title: "",
- bannerImage: "",
- },
- name: "",
- price: 0,
- priceText: "",
- season: [],
- age: [12, 18],
- locations: [],
- image: "",
- link: "",
- program: "",
- rating: 4,
- isActive: true,
- order: 0,
-});
-
-// Display activities management page (list)
-exports.index = async (req, res) => {
- try {
- const page = parseInt(req.query.page) || 1;
- const limit = parseInt(req.query.limit) || 20;
- const skip = (page - 1) * limit;
-
- const activitiesPromise = Activity.find({ isFiltersDoc: { $ne: true } })
- .sort({order: 1, createdAt: -1})
- .skip(skip)
- .limit(limit)
- .lean();
-
- const totalPromise = Activity.countDocuments({ isFiltersDoc: { $ne: true } });
- const activePromise = Activity.countDocuments({ isFiltersDoc: { $ne: true }, isActive: true });
-
- // Fetch filters from the consolidated Activity document (isFiltersDoc:true)
- const filtersPromise = Activity.findOne({isFiltersDoc: true}).lean();
-
- // Get all activities with booking sessions for extracting all bookings
- const allActivitiesForBookingsPromise = Activity.find({
- isFiltersDoc: { $ne: true },
- 'bookingSessions.bookingList': { $exists: true, $ne: [] }
- }).lean();
-
- const [activities, total, filtersDoc, activeCount, allActivitiesForBookings] = await Promise.all([
- activitiesPromise,
- totalPromise,
- filtersPromise,
- activePromise,
- allActivitiesForBookingsPromise,
- ]);
-
- // Extract all bookings from bookingSessions.bookingList
- const allBookings = [];
- const bookingCountMap = {};
- const sessionBookingCountMap = {};
-
- allActivitiesForBookings.forEach(activity => {
- const actId = activity._id.toString();
- let activityBookingCount = 0;
- sessionBookingCountMap[actId] = {};
-
- if (activity.bookingSessions && Array.isArray(activity.bookingSessions)) {
- activity.bookingSessions.forEach(session => {
- if (session.bookingList && Array.isArray(session.bookingList)) {
- const sessionBookingCount = session.bookingList.length;
- activityBookingCount += sessionBookingCount;
- sessionBookingCountMap[actId][session.sessionId] = sessionBookingCount;
-
- // Add each booking to allBookings array with activity info
- session.bookingList.forEach(booking => {
- const bookingWithActivityInfo = {
- ...booking,
- activityId: {
- _id: activity._id,
- name: activity.name,
- link: activity.link
- },
- sessionId: session.sessionId,
- createdAt: booking.createdAt || booking.bookingDate || new Date(),
- status: booking.status || booking.bookingStatus || 'pending',
- paymentStatus: booking.paymentStatus || 'pending',
- totalAmount: booking.totalAmount || 0,
- paidAmount: booking.paidAmount || 0
- };
- allBookings.push(bookingWithActivityInfo);
- });
- }
- });
- }
-
- bookingCountMap[actId] = activityBookingCount;
- });
-
- // Sort all bookings by creation date (newest first)
- allBookings.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
-
- // Add booking counts to activities
- const activitiesWithBookings = activities.map(activity => {
- const actId = activity._id.toString();
- return {
- ...activity,
- bookingCount: bookingCountMap[actId] || 0,
- sessionBookingCounts: sessionBookingCountMap[actId] || {}
- };
- });
-
- const filters = (filtersDoc && Array.isArray(filtersDoc.filters)) ? filtersDoc.filters : [];
-
- const totalPages = Math.ceil(total / limit);
-
- // Calculate all bookings stats
- const allBookingsStats = {
- total: allBookings.length,
- confirmed: allBookings.filter(b => b.status === 'confirmed').length,
- pending: allBookings.filter(b => b.status === 'pending').length,
- cancelled: allBookings.filter(b => b.status === 'cancelled').length,
- completed: allBookings.filter(b => b.status === 'completed').length,
- totalRevenue: allBookings.filter(b => b.status !== 'cancelled').reduce((sum, b) => sum + (b.totalAmount || 0), 0)
- };
-
- res.render("admin/activity/index", {
- layout: "layouts/main",
- title: "Activities Management",
- items: activitiesWithBookings,
- filters: filters, // Pass filters to view
- activeCount,
- allBookings: allBookings, // All bookings for the All Bookings tab
- allBookingsStats: allBookingsStats, // Stats for bookings
- pagination: {
- page,
- limit,
- total,
- totalPages,
- hasNext: page < totalPages,
- hasPrev: page > 1,
- },
- frontendUrl:
- process.env.FRONTEND_URL || req.protocol + "://" + req.get("host"),
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (err) {
- console.error(err);
- req.flash("error_msg", "Error loading activities data");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Update activity filters
-exports.updateFilters = async (req, res) => {
- try {
- // Accept filters submitted as an array or as an object with numeric keys
- let filters = req.body.filters;
-
- // If form submission uses `filters[0]`, `filters[1]` style names, Express/body-parser
- // may produce an object with numeric keys rather than a true Array. Normalize it.
- if (!filters) {
- filters = [];
- } else if (!Array.isArray(filters) && typeof filters === 'object') {
- try {
- filters = Object.keys(filters)
- .sort((a, b) => (parseInt(a, 10) || 0) - (parseInt(b, 10) || 0))
- .map((k) => filters[k]);
- } catch (e) {
- filters = [];
- }
- }
-
- // Sanitize and normalize incoming filters robustly
- const sanitizedFilters = [];
- try {
- const iterable = Array.isArray(filters) ? filters : Object.keys(filters || {}).map((k) => filters[k]);
- for (let idx = 0; idx < iterable.length; idx++) {
- const filterData = iterable[idx] || {};
-
- // Items can be JSON string, array, or an object with numeric keys
- let items = filterData.items;
- if (typeof items === 'string') {
- try {
- items = JSON.parse(items);
- } catch (e) {
- items = [];
- }
- }
-
- if (!Array.isArray(items) && typeof items === 'object' && items !== null) {
- // convert object with numeric keys to array
- try {
- items = Object.keys(items)
- .sort((a, b) => (parseInt(a, 10) || 0) - (parseInt(b, 10) || 0))
- .map((k) => items[k]);
- } catch (e) {
- items = [];
- }
- }
-
- if (!Array.isArray(items)) items = [];
-
- const cleanedItems = items
- .map((it) => ({ value: (it && it.value) ? it.value.toString().trim() : "", label: (it && it.label) ? it.label.toString().trim() : "" }))
- .filter((it) => it.value && it.label);
-
- // normalize id to ObjectId when possible
- let subId = filterData._id || filterData.id || undefined;
- if (subId && typeof subId === 'string' && /^[0-9a-fA-F]{24}$/.test(subId)) {
- try {
- subId = mongoose.Types.ObjectId(subId);
- } catch (e) {
- subId = undefined;
- }
- } else {
- subId = undefined; // don't set invalid ids
- }
-
- const label = (filterData.label || '').toString().trim();
- const value = (filterData.value || '').toString().trim();
- const order = parseInt(filterData.order, 10) || idx + 1;
-
- if (!label || !value) continue; // skip invalid
-
- sanitizedFilters.push({ _id: subId, label, value, items: cleanedItems, order });
- }
- } catch (e) {
- console.error('Error normalizing filters payload:', e);
- }
-
- if (!Array.isArray(sanitizedFilters)) {
- req.flash('error_msg', 'Invalid filters payload');
- return res.redirect('/admin/activity');
- }
-
- // Upsert the single filters document in Activities collection
- try {
- // Provide minimal valid fields when inserting a new filters document so
- // schema validators (e.g., age validator) do not fail on upsert.
- const setOnInsert = {
- name: "_filters_doc",
- price: 0,
- priceText: "",
- season: [],
- age: [12, 18],
- locations: [],
- image: "",
- link: "",
- program: "",
- rating: 4,
- isActive: false,
- order: 0,
- isFiltersDoc: true,
- };
-
- const upsertResult = await Activity.findOneAndUpdate(
- { isFiltersDoc: true },
- { $set: { filters: sanitizedFilters }, $setOnInsert: setOnInsert },
- { upsert: true, new: true, setDefaultsOnInsert: true }
- );
-
- req.flash('success_msg', 'Filters updated successfully');
- return res.redirect('/admin/activity');
- } catch (e) {
- console.error('Activity upsert filters error:', e);
- req.flash('error_msg', `Error saving filters: ${e.message || 'Unknown'}`);
- return res.redirect('/admin/activity');
- }
- } catch (err) {
- console.error("Update filters error:", err);
- req.flash("error_msg", `Error updating filters: ${err.message || "Unknown error"}`);
- res.redirect("/admin/activity");
- }
-};
-
-// Update global hero section (admin) - updates filters doc and all activities
-exports.updateHero = async (req, res) => {
- try {
- const titleActivities = (req.body.titleActivities || '').toString().trim();
- const titleBooking = (req.body.titleBooking || '').toString().trim();
- const bannerImageActivities = (req.body.bannerImageActivities || '').toString().trim();
- const bannerImageBooking = (req.body.bannerImageBooking || '').toString().trim();
-
- const hero = {
- titleActivities: titleActivities || 'Activities',
- titleBooking: titleBooking || 'Activities',
- bannerImageActivities: bannerImageActivities || '/uploads/banner/b9.jpg',
- bannerImageBooking: bannerImageBooking || '/uploads/banner/b9.jpg',
- };
-
- // Update all activity docs to keep hero consistent
- await Activity.updateMany({ isFiltersDoc: { $ne: true } }, { $set: { hero } });
-
- // Upsert hero into the filters document as well
- const setOnInsert = {
- name: "_filters_doc",
- price: 0,
- priceText: "",
- season: [],
- age: [12, 18],
- locations: [],
- image: "",
- link: "",
- program: "",
- rating: 4,
- isActive: false,
- order: 0,
- isFiltersDoc: true,
- };
-
- await Activity.findOneAndUpdate(
- { isFiltersDoc: true },
- { $set: { hero }, $setOnInsert: setOnInsert },
- { upsert: true, new: true, setDefaultsOnInsert: true }
- );
-
- req.flash('success_msg', 'Hero updated successfully');
- return res.redirect('/admin/activity');
- } catch (e) {
- console.error('Update hero error:', e);
- req.flash('error_msg', `Error updating hero: ${e.message || 'Unknown'}`);
- return res.redirect('/admin/activity');
- }
-};
-
-// Display create form
-exports.createForm = async (req, res) => {
- try {
- const data = getDefaultActivityData();
-
- res.render("admin/activity/form", {
- layout: "layouts/main",
- title: "Create Activity",
- data,
- isEdit: false,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (err) {
- console.error(err);
- req.flash("error_msg", "Error loading create form");
- res.redirect("/admin/activity");
- }
-};
-
-// Create new activity
-exports.create = async (req, res) => {
- try {
- const activityData = parseActivityFormData(req.body);
-
- const newActivity = new Activity(activityData);
- await newActivity.save();
-
- req.flash("success_msg", "Activity created successfully");
- res.redirect("/admin/activity");
- } catch (err) {
- console.error("Create error:", err);
- req.flash("error_msg", `Create error: ${err.message || "Unknown"}`);
- res.redirect("/admin/activity/create");
- }
-};
-
-// Display edit form
-exports.editForm = async (req, res) => {
- try {
- const activity = await Activity.findById(req.params.id).lean();
-
- if (!activity) {
- req.flash("error_msg", "Activity not found");
- return res.redirect("/admin/activity");
- }
-
- res.render("admin/activity/form", {
- layout: "layouts/main",
- title: "Edit Activity",
- data: activity,
- isEdit: true,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (err) {
- console.error(err);
- req.flash("error_msg", "Error loading edit form");
- res.redirect("/admin/activity");
- }
-};
-
-// Update activity
-exports.update = async (req, res) => {
- try {
- const activity = await Activity.findById(req.params.id);
-
- if (!activity) {
- req.flash("error_msg", "Activity not found");
- return res.redirect("/admin/activity");
- }
-
- const activityData = parseActivityFormData(req.body, activity);
-
- // Force status to active on update (always set isActive true when editing)
- activityData.isActive = true;
-
- await Activity.findByIdAndUpdate(req.params.id, activityData, {new: true});
-
- req.flash("success_msg", "Activity updated successfully");
- return req.session.save(() => res.redirect("/admin/activity"));
- } catch (err) {
- console.error("Update error:", err);
- req.flash("error_msg", `Update error: ${err.message || "Unknown"}`);
- return req.session.save(() =>
- res.redirect(`/admin/activity/${req.params.id}/edit`)
- );
- }
-};
-
-// Delete activity
-exports.delete = async (req, res) => {
- try {
- const activity = await Activity.findById(req.params.id);
-
- if (!activity) {
- req.flash("error_msg", "Activity not found");
- return res.redirect("/admin/activity");
- }
-
- await Activity.findByIdAndDelete(req.params.id);
-
- req.flash("success_msg", "Activity deleted successfully");
- res.redirect("/admin/activity");
- } catch (err) {
- console.error("Delete error:", err);
- req.flash("error_msg", `Delete error: ${err.message || "Unknown"}`);
- res.redirect("/admin/activity");
- }
-};
-
-// Toggle activity status (active/inactive)
-exports.toggleStatus = async (req, res) => {
- try {
- const activity = await Activity.findById(req.params.id);
-
- if (!activity) {
- return res.status(404).json({error: "Activity not found"});
- }
-
- activity.isActive = !activity.isActive;
- await activity.save();
-
- // Return updated global counts so front-end widgets can reflect totals
- const total = await Activity.countDocuments({ isFiltersDoc: { $ne: true } });
- const activeCount = await Activity.countDocuments({ isFiltersDoc: { $ne: true }, isActive: true });
-
- return res.json({
- success: true,
- isActive: activity.isActive,
- message: `Activity ${
- activity.isActive ? "activated" : "deactivated"
- } successfully`,
- total,
- activeCount,
- });
- } catch (err) {
- console.error("Toggle status error:", err);
- return res.status(500).json({error: "Error toggling activity status"});
- }
-};
-
-// Update activity order (for drag & drop reordering)
-exports.updateOrder = async (req, res) => {
- try {
- const {items} = req.body; // Array of { id, order }
-
- if (!Array.isArray(items)) {
- return res.status(400).json({error: "Invalid data format"});
- }
-
- const bulkOps = items.map((item) => ({
- updateOne: {
- filter: {_id: item.id},
- update: {$set: {order: item.order}},
- },
- }));
-
- await Activity.bulkWrite(bulkOps);
-
- return res.json({success: true, message: "Order updated successfully"});
- } catch (err) {
- console.error("Update order error:", err);
- return res.status(500).json({error: "Error updating order"});
- }
-};
-
-// Preview activity
-exports.preview = async (req, res) => {
- try {
- const activity = await Activity.findById(req.params.id).lean();
-
- if (!activity) {
- return res.status(404).json({error: "Activity not found"});
- }
-
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processed = addBaseUrlToImages(activity, baseUrl);
-
- res.json(processed);
- } catch (err) {
- console.error("Preview error:", err);
- res.status(500).json({error: "Error loading preview data"});
- }
-};
-
-// -------------------- Helper functions --------------------
-
-function parseActivityFormData(body, existingActivity = null) {
- // Parse season (can be string or array)
- let season = body.season || [];
- if (typeof season === "string") {
- season = season
- .split(",")
- .map((s) => s.trim())
- .filter(Boolean);
- }
-
- // Parse age range
- let age = [12, 18];
- if (body.ageMin && body.ageMax) {
- age = [parseInt(body.ageMin) || 12, parseInt(body.ageMax) || 18];
- } else if (body.age) {
- try {
- age = JSON.parse(body.age);
- } catch (e) {
- // Keep default
- }
- }
-
- // Parse locations (can be string or array)
- let locations = body.locations || [];
- if (typeof locations === "string") {
- locations = locations
- .split(",")
- .map((s) => s.trim())
- .filter(Boolean);
- }
-
- // Parse campDetail from form data
- let campDetail = {};
- try {
- if (body.campDetail) {
- if (typeof body.campDetail === "string") {
- campDetail = JSON.parse(body.campDetail);
- } else {
- campDetail = body.campDetail;
- }
- }
-
- // Handle individual campDetail fields if sent separately
- // Hero section
- if (body.campDetailHeroTitle || body.campDetailHeroBgImage) {
- campDetail.hero = campDetail.hero || {};
- if (body.campDetailHeroTitle) campDetail.hero.title = body.campDetailHeroTitle.trim();
- if (body.campDetailHeroBgImage) campDetail.hero.bgImage = body.campDetailHeroBgImage.trim();
- }
-
- // Basic Info section
- if (body.campDetailBasicInfoLocation || body.campDetailBasicInfoAgeRange ||
- body.campDetailBasicInfoAccommodationType || body.campDetailBasicInfoCareLevel ||
- body.campDetailBasicInfoLanguages) {
- campDetail.basicInfo = campDetail.basicInfo || {};
- if (body.campDetailBasicInfoLocation) campDetail.basicInfo.location = body.campDetailBasicInfoLocation.trim();
- if (body.campDetailBasicInfoAgeRange) campDetail.basicInfo.ageRange = body.campDetailBasicInfoAgeRange.trim();
- if (body.campDetailBasicInfoAccommodationType) campDetail.basicInfo.accommodationType = body.campDetailBasicInfoAccommodationType.trim();
- if (body.campDetailBasicInfoCareLevel) campDetail.basicInfo.careLevel = body.campDetailBasicInfoCareLevel.trim();
- if (body.campDetailBasicInfoLanguages) campDetail.basicInfo.languages = body.campDetailBasicInfoLanguages.trim();
- }
-
- // Sidebar section
- if (body.campDetailSidebarContactPhone || body.campDetailSidebarContactEmail ||
- body.campDetailSidebarMenuItems || body.campDetailSidebarUpcomingTours) {
- campDetail.sidebar = campDetail.sidebar || {};
-
- // Contact info
- if (body.campDetailSidebarContactPhone || body.campDetailSidebarContactEmail) {
- campDetail.sidebar.contact = campDetail.sidebar.contact || {};
- if (body.campDetailSidebarContactPhone) campDetail.sidebar.contact.phone = body.campDetailSidebarContactPhone.trim();
- if (body.campDetailSidebarContactEmail) campDetail.sidebar.contact.email = body.campDetailSidebarContactEmail.trim();
- }
-
- // Menu items (JSON array)
- if (body.campDetailSidebarMenuItems) {
- try {
- campDetail.sidebar.menuItems = JSON.parse(body.campDetailSidebarMenuItems);
- } catch (e) {
- console.warn("Error parsing sidebar menuItems:", e);
- }
- }
-
- // Upcoming tours (JSON array)
- if (body.campDetailSidebarUpcomingTours) {
- try {
- campDetail.sidebar.upcomingTours = JSON.parse(body.campDetailSidebarUpcomingTours);
- } catch (e) {
- console.warn("Error parsing sidebar upcomingTours:", e);
- }
- }
- }
-
- // Main Gallery section
- if (body.campDetailMainGallerySlides || body.campDetailMainGalleryOverlayLocation ||
- body.campDetailMainGalleryOverlaySeason || body.campDetailMainGalleryOverlayLanguages) {
- campDetail.mainGallery = campDetail.mainGallery || {};
-
- // Gallery slides (JSON array)
- if (body.campDetailMainGallerySlides) {
- try {
- campDetail.mainGallery.slides = JSON.parse(body.campDetailMainGallerySlides);
- } catch (e) {
- console.warn("Error parsing mainGallery slides:", e);
- }
- }
-
- // Overlay info
- if (body.campDetailMainGalleryOverlayLocation || body.campDetailMainGalleryOverlaySeason ||
- body.campDetailMainGalleryOverlayLanguages) {
- campDetail.mainGallery.overlayInfo = campDetail.mainGallery.overlayInfo || {};
- if (body.campDetailMainGalleryOverlayLocation) campDetail.mainGallery.overlayInfo.location = body.campDetailMainGalleryOverlayLocation.trim();
- if (body.campDetailMainGalleryOverlaySeason) campDetail.mainGallery.overlayInfo.season = body.campDetailMainGalleryOverlaySeason.trim();
- if (body.campDetailMainGalleryOverlayLanguages) campDetail.mainGallery.overlayInfo.languages = body.campDetailMainGalleryOverlayLanguages.trim();
- }
- }
-
- // Event Schedule section
- if (body.campDetailEventScheduleStartDate || body.campDetailEventScheduleDuration ||
- body.campDetailEventScheduleTickets) {
- campDetail.eventSchedule = campDetail.eventSchedule || {};
- if (body.campDetailEventScheduleStartDate) campDetail.eventSchedule.startDate = body.campDetailEventScheduleStartDate.trim();
- if (body.campDetailEventScheduleDuration) campDetail.eventSchedule.duration = body.campDetailEventScheduleDuration.trim();
- if (body.campDetailEventScheduleTickets) campDetail.eventSchedule.tickets = body.campDetailEventScheduleTickets.trim();
- }
-
- // Sections - handle both overview individual fields and complete sections JSON
- if (body.campDetailSectionsOverviewIntro || body.campDetailSectionsOverviewMainText ||
- body.campDetailSectionsOverviewFeatures || body.campDetailSectionsOverviewFeatureImage ||
- body.campDetailSections) {
-
- // If complete sections JSON is provided, use it
- if (body.campDetailSections) {
- try {
- campDetail.sections = JSON.parse(body.campDetailSections);
- } catch (e) {
- console.warn("Error parsing complete sections JSON:", e);
- }
- }
-
- // Handle individual overview fields (will override sections JSON if both provided)
- if (body.campDetailSectionsOverviewIntro || body.campDetailSectionsOverviewMainText ||
- body.campDetailSectionsOverviewFeatures || body.campDetailSectionsOverviewFeatureImage) {
- campDetail.sections = campDetail.sections || {};
- campDetail.sections.overview = campDetail.sections.overview || {};
-
- if (body.campDetailSectionsOverviewIntro) campDetail.sections.overview.intro = body.campDetailSectionsOverviewIntro.trim();
- if (body.campDetailSectionsOverviewMainText) campDetail.sections.overview.mainText = body.campDetailSectionsOverviewMainText.trim();
- if (body.campDetailSectionsOverviewFeatureImage) campDetail.sections.overview.featureImage = body.campDetailSectionsOverviewFeatureImage.trim();
-
- // Features array
- if (body.campDetailSectionsOverviewFeatures) {
- try {
- campDetail.sections.overview.features = JSON.parse(body.campDetailSectionsOverviewFeatures);
- } catch (e) {
- console.warn("Error parsing overview features:", e);
- }
- }
- }
- }
-
- // Map tipsImage (sidebar) into campDetail.hero.bgImage when provided
- if (body.tipsImage && typeof body.tipsImage === 'string' && body.tipsImage.trim()) {
- campDetail.hero = campDetail.hero || {};
- campDetail.hero.bgImage = body.tipsImage.trim();
- }
- } catch (e) {
- console.warn("Error parsing campDetail:", e);
- campDetail = {};
- }
-
- // Parse hero section (activities + booking variants)
- const existingHero = existingActivity?.hero || {};
- const hero = {
- titleActivities: body.titleActivities?.trim() || existingHero.titleActivities || "",
- titleBooking: body.titleBooking?.trim() || existingHero.titleBooking || "",
- bannerImageActivities: body.bannerImageActivities?.trim() || existingHero.bannerImageActivities || "",
- bannerImageBooking: body.bannerImageBooking?.trim() || existingHero.bannerImageBooking || "",
- };
-
- // Parse bookingSessions
- let bookingSessions = [];
- try {
- if (body.bookingSessions) {
- if (typeof body.bookingSessions === "string") {
- bookingSessions = JSON.parse(body.bookingSessions);
- } else if (Array.isArray(body.bookingSessions)) {
- bookingSessions = body.bookingSessions;
- } else if (typeof body.bookingSessions === "object") {
- bookingSessions = Object.keys(body.bookingSessions)
- .sort((a, b) => parseInt(a) - parseInt(b))
- .map(k => body.bookingSessions[k]);
- }
- }
-
- // Validate và clean sessions
- bookingSessions = bookingSessions
- .filter(s => s && s.startDate && s.endDate)
- .map((s, index) => ({
- // Auto generate sessionId if not provided
- sessionId: s.sessionId?.trim() || `session-${Date.now()}-${index}`,
- startDate: new Date(s.startDate),
- endDate: new Date(s.endDate),
- overnightStays: parseInt(s.overnightStays) || 14,
- // Spots theo giới tính
- totalMaleSpots: parseInt(s.totalMaleSpots) || 25,
- totalFemaleSpots: parseInt(s.totalFemaleSpots) || 25,
- bookedMaleSpots: parseInt(s.bookedMaleSpots) || 0,
- bookedFemaleSpots: parseInt(s.bookedFemaleSpots) || 0,
- price: s.price ? parseFloat(s.price) : null,
- isActive: s.isActive === true || s.isActive === "true" || s.isActive === "on"
- }));
- } catch (e) {
- console.warn("Error parsing bookingSessions:", e);
- bookingSessions = existingActivity?.bookingSessions || [];
- }
-
- // Determine final image value from various input sources
- const finalImageValue = (function(){
- const img = body.image?.trim() || (body.sidebarImage?.trim() || '') || (body.tipsImage?.trim() || '');
- return img || "";
- })();
-
- // Đồng bộ campDetail.hero.bgImage với main image - 2 trường này luôn giống nhau
- if (finalImageValue && campDetail && campDetail.hero) {
- campDetail.hero.bgImage = finalImageValue;
- } else if (finalImageValue) {
- // Tạo campDetail.hero nếu chưa có và gán bgImage
- campDetail = campDetail || {};
- campDetail.hero = campDetail.hero || {};
- campDetail.hero.bgImage = finalImageValue;
- }
-
- return {
- hero,
- name: body.name?.trim() || "",
- price: Math.max(0, parseFloat(body.price) || 0),
- priceText: body.priceText?.trim() || `from ${body.price || 0} USD`,
- season,
- age,
- locations,
- image: finalImageValue,
- link: body.link?.trim() ? (body.link.trim().startsWith('/') ? body.link.trim() : '/' + body.link.trim()) : "",
- program: body.program?.trim() || "",
- rating: Math.max(1, Math.min(5, parseInt(body.rating) || 4)),
- isActive:
- body.isActive === "true" ||
- body.isActive === true ||
- body.isActive === "on" ||
- body.isActive === 1,
- order: Math.max(0, parseInt(body.order) || 0),
- campDetail: campDetail,
- bookingSessions: bookingSessions,
- };
-}
-
-// -------------------- Booking Submissions Management --------------------
-
-// Get booking count for an activity
-exports.getBookingCount = async (req, res) => {
- try {
- const { id } = req.params;
- const BookingSubmission = require('../models/bookingSubmission');
-
- let count = await BookingSubmission.countDocuments({ activityId: id });
-
- // Fallback to embedded bookingList in Activity if no separate BookingSubmission docs
- if (!count) {
- const activity = await Activity.findById(id).lean();
- if (activity && Array.isArray(activity.bookingSessions)) {
- count = activity.bookingSessions.reduce((sum, s) => {
- return sum + (Array.isArray(s.bookingList) ? s.bookingList.length : 0);
- }, 0);
- }
- }
-
- return res.json({ count });
- } catch (err) {
- console.error("getBookingCount error:", err);
- return res.status(500).json({ error: "Error loading booking count" });
- }
-};
-
-// Get booking submissions for an activity with stats
-exports.getBookingSubmissions = async (req, res) => {
- try {
- const { id } = req.params;
- const BookingSubmission = require('../models/bookingSubmission');
-
- // Get activity with sessions
- const activity = await Activity.findById(id).lean();
- if (!activity) {
- return res.status(404).json({ error: "Activity not found" });
- }
-
- // Get all booking submissions for this activity (separate collection)
- let bookings = await BookingSubmission.find({ activityId: id })
- .sort({ createdAt: -1 })
- .lean();
-
- // Fallback: if there are no BookingSubmission documents, attempt to read embedded bookingList from Activity.bookingSessions
- if ((!bookings || bookings.length === 0) && Array.isArray(activity.bookingSessions)) {
- bookings = [];
- activity.bookingSessions.forEach((session) => {
- if (Array.isArray(session.bookingList)) {
- session.bookingList.forEach((b) => {
- // normalize embedded booking fields to match BookingSubmission shape
- const item = Object.assign({}, b);
- item.sessionId = session.sessionId || item.sessionDate || item.sessionId;
- item.createdAt = item.bookingDate || item.createdAt || new Date();
- // normalize status/payment field names
- item.status = item.status || item.bookingStatus || 'pending';
- item.paymentStatus = item.paymentStatus || item.paymentStatus || 'pending';
- // ensure participantBirthDate is Date
- if (item.participantBirthDate && typeof item.participantBirthDate === 'string') {
- item.participantBirthDate = new Date(item.participantBirthDate);
- }
- bookings.push(item);
- });
- }
- });
- // sort by createdAt desc
- bookings.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
- }
-
- // Calculate statistics
- const stats = {
- total: bookings.length,
- confirmed: bookings.filter(b => b.status === 'confirmed').length,
- pending: bookings.filter(b => b.status === 'pending').length,
- cancelled: bookings.filter(b => b.status === 'cancelled').length,
- completed: bookings.filter(b => b.status === 'completed').length,
- totalRevenue: bookings.filter(b => b.status !== 'cancelled').reduce((sum, b) => sum + (b.totalAmount || 0), 0)
- };
-
- // Create session breakdown
- const sessionBreakdown = {};
- const sessions = activity.bookingSessions || [];
-
- sessions.forEach(session => {
- const sessionBookings = bookings.filter(b => b.sessionId === session.sessionId);
- const totalCapacity = session.totalMaleSpots + session.totalFemaleSpots;
- const bookedCount = sessionBookings.length;
-
- sessionBreakdown[session.sessionId] = {
- sessionName: `${new Date(session.startDate).toLocaleDateString()} - ${new Date(session.endDate).toLocaleDateString()}`,
- dateRange: `${new Date(session.startDate).toLocaleDateString()} - ${new Date(session.endDate).toLocaleDateString()}`,
- totalCapacity,
- bookedCount,
- bookings: sessionBookings.length
- };
- });
-
- // Format sessions for filter dropdown
- const sessionsForFilter = sessions.map(s => ({
- sessionId: s.sessionId,
- sessionName: `${new Date(s.startDate).toLocaleDateString()} - ${new Date(s.endDate).toLocaleDateString()}`
- }));
-
- return res.json({
- bookings,
- stats,
- sessionBreakdown,
- sessions: sessionsForFilter
- });
-
- } catch (err) {
- console.error("getBookingSubmissions error:", err);
- return res.status(500).json({ error: "Error loading booking submissions" });
- }
-};
-
-// Export booking data as CSV
-exports.exportBookingData = async (req, res) => {
- try {
- const { id } = req.params;
- const BookingSubmission = require('../models/bookingSubmission');
-
- const bookings = await BookingSubmission.find({ activityId: id })
- .populate('activityId', 'name')
- .sort({ createdAt: -1 })
- .lean();
-
- if (bookings.length === 0) {
- return res.status(404).json({ error: "No bookings found" });
- }
-
- // CSV headers
- const headers = [
- 'Date Submitted',
- 'Activity',
- 'Session ID',
- 'Participant Name',
- 'Participant Gender',
- 'Participant Birth Date',
- 'Parent Name',
- 'Email',
- 'Phone',
- 'Address',
- 'City',
- 'Country',
- 'Postal Code',
- 'Number of Participants',
- 'Medical Conditions',
- 'Dietary Restrictions',
- 'Special Requests',
- 'Emergency Contact',
- 'Emergency Phone',
- 'Status',
- 'Payment Status',
- 'Total Amount',
- 'Paid Amount'
- ];
-
- // Convert bookings to CSV rows
- const rows = bookings.map(booking => [
- new Date(booking.createdAt).toISOString().split('T')[0],
- booking.activityId?.name || 'Unknown Activity',
- booking.sessionId,
- `${booking.participantFirstName} ${booking.participantLastName}`,
- booking.participantGender,
- new Date(booking.participantBirthDate).toISOString().split('T')[0],
- `${booking.parentFirstName} ${booking.parentLastName}`,
- booking.email,
- booking.phone,
- booking.address,
- booking.city,
- booking.country,
- booking.postalCode,
- booking.numberOfParticipants,
- booking.medicalConditions || '',
- booking.dietaryRestrictions || 'none',
- booking.specialRequests || '',
- booking.emergencyContact,
- booking.emergencyPhone,
- booking.status,
- booking.paymentStatus,
- booking.totalAmount || 0,
- booking.paidAmount || 0
- ]);
-
- // Generate CSV content
- const csvContent = [headers, ...rows]
- .map(row => row.map(field => `"${(field || '').toString().replace(/"/g, '""')}"`).join(','))
- .join('\n');
-
- // Set response headers for CSV download
- res.setHeader('Content-Type', 'text/csv');
- res.setHeader('Content-Disposition', `attachment; filename="bookings_${id}_${new Date().toISOString().split('T')[0]}.csv"`);
-
- return res.send(csvContent);
-
- } catch (err) {
- console.error("exportBookingData error:", err);
- return res.status(500).json({ error: "Error exporting booking data" });
- }
-};
-
-// Export ALL booking data as CSV (across all activities)
-exports.exportAllBookingsData = async (req, res) => {
- try {
- // Get all activities with booking sessions
- const allActivities = await Activity.find({
- isFiltersDoc: { $ne: true },
- 'bookingSessions.bookingList': { $exists: true, $ne: [] }
- }).lean();
-
- // Extract all bookings from bookingSessions.bookingList
- const allBookings = [];
-
- allActivities.forEach(activity => {
- if (activity.bookingSessions && Array.isArray(activity.bookingSessions)) {
- activity.bookingSessions.forEach(session => {
- if (session.bookingList && Array.isArray(session.bookingList)) {
- session.bookingList.forEach(booking => {
- const bookingWithActivityInfo = {
- ...booking,
- activityName: activity.name,
- sessionId: session.sessionId,
- createdAt: booking.createdAt || booking.bookingDate || new Date(),
- status: booking.status || booking.bookingStatus || 'pending',
- paymentStatus: booking.paymentStatus || 'pending',
- totalAmount: booking.totalAmount || 0,
- paidAmount: booking.paidAmount || 0
- };
- allBookings.push(bookingWithActivityInfo);
- });
- }
- });
- }
- });
-
- if (allBookings.length === 0) {
- return res.status(404).json({ error: "No bookings found" });
- }
-
- // Sort by creation date (newest first)
- allBookings.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
-
- // CSV headers
- const headers = [
- 'Date Submitted',
- 'Activity',
- 'Session ID',
- 'Participant Name',
- 'Participant Gender',
- 'Participant Birth Date',
- 'Parent Name',
- 'Email',
- 'Phone',
- 'Address',
- 'City',
- 'Country',
- 'Postal Code',
- 'Number of Participants',
- 'Medical Conditions',
- 'Dietary Restrictions',
- 'Special Requests',
- 'Emergency Contact',
- 'Emergency Phone',
- 'Status',
- 'Payment Status',
- 'Total Amount',
- 'Paid Amount'
- ];
-
- // Convert bookings to CSV rows
- const rows = allBookings.map(booking => [
- new Date(booking.createdAt).toISOString().split('T')[0],
- booking.activityName || 'Unknown Activity',
- booking.sessionId,
- `${booking.participantFirstName} ${booking.participantLastName}`,
- booking.participantGender,
- booking.participantBirthDate ? new Date(booking.participantBirthDate).toISOString().split('T')[0] : '',
- `${booking.parentFirstName} ${booking.parentLastName}`,
- booking.email,
- booking.phone,
- booking.address,
- booking.city,
- booking.country,
- booking.postalCode,
- booking.numberOfParticipants,
- booking.medicalConditions || '',
- booking.dietaryRestrictions || 'none',
- booking.specialRequests || '',
- booking.emergencyContact,
- booking.emergencyPhone,
- booking.status,
- booking.paymentStatus,
- booking.totalAmount || 0,
- booking.paidAmount || 0
- ]);
-
- // Generate CSV content
- const csvContent = [headers, ...rows]
- .map(row => row.map(field => `"${(field || '').toString().replace(/"/g, '""')}"`).join(','))
- .join('\n');
-
- // Set response headers for CSV download
- res.setHeader('Content-Type', 'text/csv');
- res.setHeader('Content-Disposition', `attachment; filename="all_bookings_${new Date().toISOString().split('T')[0]}.csv"`);
-
- return res.send(csvContent);
-
- } catch (err) {
- console.error("exportAllBookingsData error:", err);
- return res.status(500).json({ error: "Error exporting all booking data" });
- }
-};
-
-// Delete a booking submission
-exports.deleteBookingSubmission = async (req, res) => {
- try {
- const { bookingId } = req.params;
- const BookingSubmission = require('../models/bookingSubmission');
-
- const booking = await BookingSubmission.findById(bookingId);
- if (!booking) {
- return res.status(404).json({ error: "Booking not found" });
- }
-
- await BookingSubmission.findByIdAndDelete(bookingId);
-
- return res.json({ message: "Booking deleted successfully" });
-
- } catch (err) {
- console.error("deleteBookingSubmission error:", err);
- return res.status(500).json({ error: "Error deleting booking" });
- }
-};
-
-// -------------------- Camp Session Booking Management --------------------
-
-// Create a new booking directly into camp session
-exports.createSessionBooking = async (req, res) => {
- try {
- const { activityId, sessionId } = req.params;
- const bookingData = req.body;
-
- // Validate required fields
- const requiredFields = [
- 'address', 'agreeTerms', 'city', 'country', 'email', 'emergencyContact',
- 'emergencyPhone', 'numberOfParticipants', 'parentFirstName', 'parentLastName',
- 'participantBirthDate', 'participantFirstName', 'participantGender',
- 'participantLastName', 'phone', 'postalCode'
- ];
-
- for (let field of requiredFields) {
- if (!bookingData[field]) {
- return res.status(400).json({
- error: `Missing required field: ${field}`
- });
- }
- }
-
- // Validate email format
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
- if (!emailRegex.test(bookingData.email)) {
- return res.status(400).json({ error: "Invalid email format" });
- }
-
- // Find the activity
- const activity = await Activity.findById(activityId);
- if (!activity) {
- return res.status(404).json({ error: "Activity not found" });
- }
-
- // Find the specific session
- const sessionIndex = activity.bookingSessions.findIndex(s => s.sessionId === sessionId);
- if (sessionIndex === -1) {
- return res.status(404).json({ error: "Session not found" });
- }
-
- const session = activity.bookingSessions[sessionIndex];
-
- // Check if session is active
- if (!session.isActive) {
- return res.status(400).json({ error: "Session is not active for booking" });
- }
-
- // Check availability based on participant gender
- const participantGender = bookingData.participantGender;
- const numberOfParticipants = parseInt(bookingData.numberOfParticipants) || 1;
-
- let availableSpots = 0;
- if (participantGender === 'male') {
- availableSpots = session.totalMaleSpots - session.bookedMaleSpots;
- } else if (participantGender === 'female') {
- availableSpots = session.totalFemaleSpots - session.bookedFemaleSpots;
- } else {
- // For 'other' gender, check both male and female availability
- const maleAvailable = session.totalMaleSpots - session.bookedMaleSpots;
- const femaleAvailable = session.totalFemaleSpots - session.bookedFemaleSpots;
- availableSpots = Math.max(maleAvailable, femaleAvailable);
- }
-
- if (availableSpots < numberOfParticipants) {
- return res.status(400).json({
- error: `Not enough spots available. Only ${availableSpots} spots left for ${participantGender} participants.`,
- availableSpots
- });
- }
-
- // Generate unique confirmation code
- const confirmationCode = `GG${Date.now()}${Math.random().toString(36).substr(2, 5).toUpperCase()}`;
-
- // Calculate total amount
- const pricePerParticipant = session.price || activity.price || 0;
- const totalAmount = pricePerParticipant * numberOfParticipants;
-
- // Create booking object
- const newBooking = {
- address: bookingData.address.trim(),
- agreeNewsletter: bookingData.agreeNewsletter === true || bookingData.agreeNewsletter === 'true',
- agreeTerms: bookingData.agreeTerms === true || bookingData.agreeTerms === 'true',
- city: bookingData.city.trim(),
- country: bookingData.country.trim(),
- dietaryRestrictions: bookingData.dietaryRestrictions || 'none',
- email: bookingData.email.toLowerCase().trim(),
- emergencyContact: bookingData.emergencyContact.trim(),
- emergencyPhone: bookingData.emergencyPhone.trim(),
- medicalConditions: bookingData.medicalConditions || '',
- numberOfParticipants: numberOfParticipants,
- parentFirstName: bookingData.parentFirstName.trim(),
- parentLastName: bookingData.parentLastName.trim(),
- participantBirthDate: new Date(bookingData.participantBirthDate),
- participantFirstName: bookingData.participantFirstName.trim(),
- participantGender: participantGender,
- participantLastName: bookingData.participantLastName.trim(),
- phone: bookingData.phone.trim(),
- postalCode: bookingData.postalCode.trim(),
- sessionDate: sessionId,
- specialRequests: bookingData.specialRequests || '',
- bookingStatus: 'pending',
- paymentStatus: 'pending',
- totalAmount: totalAmount,
- paidAmount: 0,
- bookingDate: new Date(),
- confirmationCode: confirmationCode,
- adminNotes: ''
- };
-
- // Add booking to session
- if (!activity.bookingSessions[sessionIndex].bookingList) {
- activity.bookingSessions[sessionIndex].bookingList = [];
- }
- activity.bookingSessions[sessionIndex].bookingList.push(newBooking);
-
- // Update booked spots count
- if (participantGender === 'male') {
- activity.bookingSessions[sessionIndex].bookedMaleSpots += numberOfParticipants;
- } else if (participantGender === 'female') {
- activity.bookingSessions[sessionIndex].bookedFemaleSpots += numberOfParticipants;
- } else {
- // For 'other' gender, distribute to the gender with more availability
- const maleAvailable = session.totalMaleSpots - session.bookedMaleSpots;
- const femaleAvailable = session.totalFemaleSpots - session.bookedFemaleSpots;
- if (maleAvailable >= femaleAvailable) {
- activity.bookingSessions[sessionIndex].bookedMaleSpots += numberOfParticipants;
- } else {
- activity.bookingSessions[sessionIndex].bookedFemaleSpots += numberOfParticipants;
- }
- }
-
- // Save the updated activity
- await activity.save();
-
- // Return success response with booking details
- return res.status(201).json({
- message: "Booking created successfully",
- booking: {
- id: activity.bookingSessions[sessionIndex].bookingList[activity.bookingSessions[sessionIndex].bookingList.length - 1]._id,
- confirmationCode: confirmationCode,
- activityName: activity.name,
- sessionId: sessionId,
- participantName: `${bookingData.participantFirstName} ${bookingData.participantLastName}`,
- parentName: `${bookingData.parentFirstName} ${bookingData.parentLastName}`,
- email: bookingData.email,
- totalAmount: totalAmount,
- numberOfParticipants: numberOfParticipants,
- status: 'pending',
- sessionDetails: {
- startDate: session.startDate,
- endDate: session.endDate,
- overnightStays: session.overnightStays
- }
- }
- });
-
- } catch (err) {
- console.error("createSessionBooking error:", err);
- return res.status(500).json({ error: "Error creating booking" });
- }
-};
-
-// Create booking by program (wrapper) - find activity by `program` then delegate
-exports.createSessionBookingByProgram = async (req, res) => {
- try {
- const { program, sessionId } = req.params;
- // Find activity by program field
- const activity = await Activity.findOne({ program: program });
- if (!activity) return res.status(404).json({ error: 'Activity not found for program: ' + program });
-
- // Inject activityId into params and call existing handler
- req.params.activityId = activity._id.toString();
- req.params.sessionId = sessionId;
- return await exports.createSessionBooking(req, res);
- } catch (err) {
- console.error('createSessionBookingByProgram error:', err);
- return res.status(500).json({ error: 'Error creating booking by program' });
- }
-};
-
-// Get all bookings for a specific session
-exports.getSessionBookings = async (req, res) => {
- try {
- const { activityId, sessionId } = req.params;
- const page = parseInt(req.query.page) || 1;
- const limit = parseInt(req.query.limit) || 20;
- const status = req.query.status;
- const search = req.query.search;
-
- // Find the activity
- const activity = await Activity.findById(activityId);
- if (!activity) {
- return res.status(404).json({ error: "Activity not found" });
- }
-
- // Find the specific session
- const session = activity.bookingSessions.find(s => s.sessionId === sessionId);
- if (!session) {
- return res.status(404).json({ error: "Session not found" });
- }
-
- let bookings = session.bookingList || [];
-
- // Apply filters
- if (status) {
- bookings = bookings.filter(b => b.bookingStatus === status);
- }
-
- if (search) {
- const searchLower = search.toLowerCase();
- bookings = bookings.filter(b =>
- b.participantFirstName.toLowerCase().includes(searchLower) ||
- b.participantLastName.toLowerCase().includes(searchLower) ||
- b.parentFirstName.toLowerCase().includes(searchLower) ||
- b.parentLastName.toLowerCase().includes(searchLower) ||
- b.email.toLowerCase().includes(searchLower) ||
- b.confirmationCode.toLowerCase().includes(searchLower)
- );
- }
-
- // Calculate pagination
- const totalBookings = bookings.length;
- const totalPages = Math.ceil(totalBookings / limit);
- const startIndex = (page - 1) * limit;
- const endIndex = startIndex + limit;
- const paginatedBookings = bookings.slice(startIndex, endIndex);
-
- // Calculate statistics
- const stats = {
- total: session.bookingList?.length || 0,
- pending: bookings.filter(b => b.bookingStatus === 'pending').length,
- confirmed: bookings.filter(b => b.bookingStatus === 'confirmed').length,
- cancelled: bookings.filter(b => b.bookingStatus === 'cancelled').length,
- completed: bookings.filter(b => b.bookingStatus === 'completed').length,
- totalRevenue: bookings.filter(b => b.bookingStatus !== 'cancelled').reduce((sum, b) => sum + b.totalAmount, 0),
- paidAmount: bookings.reduce((sum, b) => sum + b.paidAmount, 0)
- };
-
- return res.json({
- bookings: paginatedBookings,
- pagination: {
- currentPage: page,
- totalPages: totalPages,
- totalBookings: totalBookings,
- limit: limit
- },
- session: {
- sessionId: session.sessionId,
- startDate: session.startDate,
- endDate: session.endDate,
- totalMaleSpots: session.totalMaleSpots,
- totalFemaleSpots: session.totalFemaleSpots,
- bookedMaleSpots: session.bookedMaleSpots,
- bookedFemaleSpots: session.bookedFemaleSpots,
- isActive: session.isActive
- },
- stats: stats,
- activity: {
- id: activity._id,
- name: activity.name,
- price: activity.price
- }
- });
-
- } catch (err) {
- console.error("getSessionBookings error:", err);
- return res.status(500).json({ error: "Error retrieving session bookings" });
- }
-};
-
-// Get session bookings by program (wrapper)
-exports.getSessionBookingsByProgram = async (req, res) => {
- try {
- const { program, sessionId } = req.params;
- const activity = await Activity.findOne({ program: program });
- if (!activity) return res.status(404).json({ error: 'Activity not found for program: ' + program });
-
- req.params.activityId = activity._id.toString();
- req.params.sessionId = sessionId;
- return await exports.getSessionBookings(req, res);
- } catch (err) {
- console.error('getSessionBookingsByProgram error:', err);
- return res.status(500).json({ error: 'Error retrieving session bookings by program' });
- }
-};
-
-// Update a specific booking in a session
-exports.updateSessionBooking = async (req, res) => {
- try {
- const { activityId, sessionId, bookingId } = req.params;
- const updateData = req.body;
-
- // Find the activity
- const activity = await Activity.findById(activityId);
- if (!activity) {
- return res.status(404).json({ error: "Activity not found" });
- }
-
- // Find the specific session
- const sessionIndex = activity.bookingSessions.findIndex(s => s.sessionId === sessionId);
- if (sessionIndex === -1) {
- return res.status(404).json({ error: "Session not found" });
- }
-
- // Find the specific booking
- const bookingIndex = activity.bookingSessions[sessionIndex].bookingList.findIndex(
- b => b._id.toString() === bookingId
- );
- if (bookingIndex === -1) {
- return res.status(404).json({ error: "Booking not found" });
- }
-
- const currentBooking = activity.bookingSessions[sessionIndex].bookingList[bookingIndex];
-
- // Update allowed fields
- const allowedUpdates = [
- 'bookingStatus', 'paymentStatus', 'paidAmount', 'adminNotes',
- 'emergencyContact', 'emergencyPhone', 'medicalConditions',
- 'specialRequests', 'dietaryRestrictions'
- ];
-
- for (let field of allowedUpdates) {
- if (updateData[field] !== undefined) {
- activity.bookingSessions[sessionIndex].bookingList[bookingIndex][field] = updateData[field];
- }
- }
-
- // Handle status changes that might affect spot counts
- if (updateData.bookingStatus && updateData.bookingStatus !== currentBooking.bookingStatus) {
- const numberOfParticipants = currentBooking.numberOfParticipants;
- const participantGender = currentBooking.participantGender;
-
- // If booking is being cancelled, free up spots
- if (updateData.bookingStatus === 'cancelled' && currentBooking.bookingStatus !== 'cancelled') {
- if (participantGender === 'male') {
- activity.bookingSessions[sessionIndex].bookedMaleSpots = Math.max(0,
- activity.bookingSessions[sessionIndex].bookedMaleSpots - numberOfParticipants);
- } else if (participantGender === 'female') {
- activity.bookingSessions[sessionIndex].bookedFemaleSpots = Math.max(0,
- activity.bookingSessions[sessionIndex].bookedFemaleSpots - numberOfParticipants);
- }
- }
-
- // If booking is being restored from cancelled, book spots again
- if (currentBooking.bookingStatus === 'cancelled' && updateData.bookingStatus !== 'cancelled') {
- if (participantGender === 'male') {
- const totalMale = activity.bookingSessions[sessionIndex].totalMaleSpots;
- const currentMale = activity.bookingSessions[sessionIndex].bookedMaleSpots;
- if (currentMale + numberOfParticipants > totalMale) {
- return res.status(400).json({
- error: "Not enough male spots available to restore this booking",
- availableSpots: totalMale - currentMale
- });
- }
- activity.bookingSessions[sessionIndex].bookedMaleSpots += numberOfParticipants;
- } else if (participantGender === 'female') {
- const totalFemale = activity.bookingSessions[sessionIndex].totalFemaleSpots;
- const currentFemale = activity.bookingSessions[sessionIndex].bookedFemaleSpots;
- if (currentFemale + numberOfParticipants > totalFemale) {
- return res.status(400).json({
- error: "Not enough female spots available to restore this booking",
- availableSpots: totalFemale - currentFemale
- });
- }
- activity.bookingSessions[sessionIndex].bookedFemaleSpots += numberOfParticipants;
- }
- }
- }
-
- // Save the updated activity
- await activity.save();
-
- return res.json({
- message: "Booking updated successfully",
- booking: activity.bookingSessions[sessionIndex].bookingList[bookingIndex]
- });
-
- } catch (err) {
- console.error("updateSessionBooking error:", err);
- return res.status(500).json({ error: "Error updating booking" });
- }
-};
-
-// Delete a specific booking from a session
-exports.deleteSessionBooking = async (req, res) => {
- try {
- const { activityId, sessionId, bookingId } = req.params;
-
- // Find the activity
- const activity = await Activity.findById(activityId);
- if (!activity) {
- return res.status(404).json({ error: "Activity not found" });
- }
-
- // Find the specific session
- const sessionIndex = activity.bookingSessions.findIndex(s => s.sessionId === sessionId);
- if (sessionIndex === -1) {
- return res.status(404).json({ error: "Session not found" });
- }
-
- // Find the specific booking
- const bookingIndex = activity.bookingSessions[sessionIndex].bookingList.findIndex(
- b => b._id.toString() === bookingId
- );
- if (bookingIndex === -1) {
- return res.status(404).json({ error: "Booking not found" });
- }
-
- const bookingToDelete = activity.bookingSessions[sessionIndex].bookingList[bookingIndex];
-
- // Free up spots if booking is not cancelled
- if (bookingToDelete.bookingStatus !== 'cancelled') {
- const numberOfParticipants = bookingToDelete.numberOfParticipants;
- const participantGender = bookingToDelete.participantGender;
-
- if (participantGender === 'male') {
- activity.bookingSessions[sessionIndex].bookedMaleSpots = Math.max(0,
- activity.bookingSessions[sessionIndex].bookedMaleSpots - numberOfParticipants);
- } else if (participantGender === 'female') {
- activity.bookingSessions[sessionIndex].bookedFemaleSpots = Math.max(0,
- activity.bookingSessions[sessionIndex].bookedFemaleSpots - numberOfParticipants);
- }
- }
-
- // Remove the booking from the array
- activity.bookingSessions[sessionIndex].bookingList.splice(bookingIndex, 1);
-
- // Save the updated activity
- await activity.save();
-
- return res.json({
- message: "Booking deleted successfully",
- deletedBooking: {
- id: bookingId,
- confirmationCode: bookingToDelete.confirmationCode,
- participantName: `${bookingToDelete.participantFirstName} ${bookingToDelete.participantLastName}`
- }
- });
-
- } catch (err) {
- console.error("deleteSessionBooking error:", err);
- return res.status(500).json({ error: "Error deleting booking" });
- }
-};
diff --git a/controllers/appointmentController.js b/controllers/appointmentController.js
deleted file mode 100644
index cfd9b09..0000000
--- a/controllers/appointmentController.js
+++ /dev/null
@@ -1,450 +0,0 @@
-const AppointmentSubmission = require("../models/appointmentSubmission");
-const Appointment = require("../models/appointment");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// ==================== CMS ADMIN FUNCTIONS ====================
-
-// Render admin page for appointment management
-exports.index = async (req, res) => {
- try {
- let appointment = await Appointment.findOne({ name: "default" });
-
- // If no data in DB, try to load from JSON file
- if (!appointment) {
- const fs = require("fs");
- const path = require("path");
- const jsonPath = path.join(__dirname, "../data/appointment.json");
-
- if (fs.existsSync(jsonPath)) {
- const jsonData = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
- appointment = await Appointment.migrateFromJson(jsonData);
- } else {
- // Create default appointment
- appointment = await Appointment.create({
- name: "default",
- hero: {
- title: "Make Appointment",
- backgroundImage: "",
- subtitle: "",
- heading: "",
- description: "",
- },
- visaOptions: [],
- form: {
- heading: "Request Appointment",
- fields: [],
- submitButton: {
- text: "Request Appointment",
- icon: "fa-solid fa-arrow-right",
- buttonClass: "theme-btn",
- },
- },
- });
- }
- }
-
- const { startDate, endDate } = req.query;
- const query = {};
-
- if (startDate || endDate) {
- query.createdAt = {};
- if (startDate) {
- query.createdAt.$gte = new Date(startDate);
- }
- if (endDate) {
- // Set end date to end of day
- const end = new Date(endDate);
- end.setHours(23, 59, 59, 999);
- query.createdAt.$lte = end;
- }
- }
-
- const submissions = await AppointmentSubmission.find(query)
- .sort({ createdAt: -1 })
- .limit(50);
-
- res.render("admin/appointment/index", {
- layout: "layouts/main",
- title: "Appointment Management",
- data: appointment,
- submissions,
- startDate,
- endDate,
- user: req.session.user,
- frontendUrl: process.env.FRONTEND_URL || "http://localhost:3000",
- });
- } catch (err) {
- console.error("Error loading appointment admin page:", err);
- req.flash("error", "Error loading appointment data");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Update appointment data
-exports.update = async (req, res) => {
- try {
- const { hero, visaOptions, form } = req.body;
-
- // Parse JSON strings if needed
- const heroData = typeof hero === "string" ? JSON.parse(hero) : hero;
- const visaOptionsData =
- typeof visaOptions === "string" ? JSON.parse(visaOptions) : visaOptions;
- const formData = typeof form === "string" ? JSON.parse(form) : form;
-
- let appointment = await Appointment.findOne({ name: "default" });
-
- // Capture before state for audit logging
- const beforeState = appointment
- ? JSON.parse(JSON.stringify(appointment.toObject()))
- : null;
-
- if (appointment) {
- appointment.hero = heroData;
- appointment.visaOptions = visaOptionsData;
- appointment.form = formData;
- await appointment.save();
- } else {
- appointment = await Appointment.create({
- name: "default",
- hero: heroData,
- visaOptions: visaOptionsData,
- form: formData,
- });
- }
-
- // Capture after state for audit logging
- const afterState = JSON.parse(JSON.stringify(appointment.toObject()));
-
- // Generate changes diff
- const changes = beforeState ? diffObject(beforeState, afterState) : [];
-
- // Write audit log
- await writeAuditLog({
- model: "Appointment",
- documentId: appointment._id,
- action: AUDIT_ACTIONS.UPDATE_APPOINTMENT,
- before: beforeState,
- after: afterState,
- changes,
- req,
- });
-
- req.flash("success", "Appointment data updated successfully");
- res.redirect("/admin/appointment");
- } catch (err) {
- console.error("Error updating appointment:", err);
- req.flash("error", "Error updating appointment data");
- res.redirect("/admin/appointment");
- }
-};
-
-// API to get appointment data
-exports.getAppointmentData = async (req, res) => {
- try {
- let appointment = await Appointment.findOne({ name: "default" });
-
- if (!appointment) {
- const fs = require("fs");
- const path = require("path");
- const jsonPath = path.join(__dirname, "../data/appointment.json");
-
- if (fs.existsSync(jsonPath)) {
- const jsonData = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
- appointment = await Appointment.migrateFromJson(jsonData);
- }
- }
-
- res.json({
- success: true,
- data: appointment,
- });
- } catch (err) {
- console.error("Error getting appointment data:", err);
- res.status(500).json({
- success: false,
- error: "Error loading appointment data",
- });
- }
-};
-
-// Public API to get appointment page data (for frontend)
-exports.api = async (req, res) => {
- try {
- let appointment = await Appointment.findOne({ name: "default" });
-
- if (!appointment) {
- const fs = require("fs");
- const path = require("path");
- const jsonPath = path.join(__dirname, "../data/appointment.json");
-
- if (fs.existsSync(jsonPath)) {
- const jsonData = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
- appointment = await Appointment.migrateFromJson(jsonData);
- }
- }
-
- if (!appointment) {
- return res.status(404).json({
- success: false,
- error: "Appointment data not found",
- });
- }
-
- res.json({
- success: true,
- data: {
- hero: appointment.hero,
- visaOptions: appointment.visaOptions,
- form: appointment.form,
- },
- });
- } catch (err) {
- console.error("Error getting appointment API data:", err);
- res.status(500).json({
- success: false,
- error: "Error loading appointment data",
- });
- }
-};
-
-// ==================== APPOINTMENT SUBMISSIONS API ====================
-
-// API để submit appointment form (từ frontend)
-exports.submitAppointment = async (req, res) => {
- try {
- const { name, email, phone, address, appointmentDate, message, visaTypes } =
- req.body;
-
- // Validation
- if (!name || !email) {
- return res.status(400).json({
- success: false,
- error: "Name and email are required",
- });
- }
-
- // Create new submission
- const submission = new AppointmentSubmission({
- name: name.trim(),
- email: email.trim().toLowerCase(),
- phone: phone?.trim() || "",
- address: address?.trim() || "",
- appointmentDate: appointmentDate?.trim() || "",
- message: message?.trim() || "",
- visaTypes: Array.isArray(visaTypes) ? visaTypes : [],
- ipAddress: req.ip || req.connection?.remoteAddress || "",
- userAgent: req.get("User-Agent") || "",
- });
-
- await submission.save();
-
- res.status(201).json({
- success: true,
- message:
- "Thank you! Your appointment request has been submitted. We will contact you soon.",
- data: {
- id: submission._id,
- name: submission.name,
- email: submission.email,
- appointmentDate: submission.appointmentDate,
- },
- });
- } catch (err) {
- console.error("Error submitting appointment:", err);
-
- // Handle validation errors
- if (err.name === "ValidationError") {
- const errors = Object.values(err.errors).map((e) => e.message);
- return res.status(400).json({
- success: false,
- error: errors.join(", "),
- });
- }
-
- res.status(500).json({
- success: false,
- error: "Error submitting appointment. Please try again later.",
- });
- }
-};
-
-// API để lấy danh sách appointments (cho admin)
-exports.getAppointments = async (req, res) => {
- try {
- const { status, page = 1, limit = 20 } = req.query;
-
- const query = {};
- if (
- status &&
- ["pending", "confirmed", "completed", "cancelled"].includes(status)
- ) {
- query.status = status;
- }
-
- const skip = (parseInt(page) - 1) * parseInt(limit);
-
- const [appointments, total] = await Promise.all([
- AppointmentSubmission.find(query)
- .sort({ createdAt: -1 })
- .skip(skip)
- .limit(parseInt(limit)),
- AppointmentSubmission.countDocuments(query),
- ]);
-
- res.json({
- success: true,
- data: appointments,
- pagination: {
- page: parseInt(page),
- limit: parseInt(limit),
- total,
- totalPages: Math.ceil(total / parseInt(limit)),
- },
- });
- } catch (err) {
- console.error("Error getting appointments:", err);
- res.status(500).json({
- success: false,
- error: "Error loading appointments",
- });
- }
-};
-
-// API để cập nhật status của appointment
-exports.updateAppointmentStatus = async (req, res) => {
- try {
- const { id } = req.params;
- const { status, notes } = req.body;
-
- const validStatuses = ["pending", "confirmed", "completed", "cancelled"];
- if (!validStatuses.includes(status)) {
- return res.status(400).json({
- success: false,
- error: "Invalid status",
- });
- }
-
- // Get the appointment before update for audit logging
- const beforeAppointment = await AppointmentSubmission.findById(id);
- if (!beforeAppointment) {
- return res.status(404).json({
- success: false,
- error: "Appointment not found",
- });
- }
-
- const beforeState = JSON.parse(
- JSON.stringify(beforeAppointment.toObject()),
- );
-
- const updateData = { status };
- if (notes !== undefined) updateData.notes = notes;
- if (status === "confirmed") updateData.confirmedAt = new Date();
- if (status === "completed") updateData.completedAt = new Date();
-
- const appointment = await AppointmentSubmission.findByIdAndUpdate(
- id,
- updateData,
- { new: true },
- );
-
- // Capture after state for audit logging
- const afterState = JSON.parse(JSON.stringify(appointment.toObject()));
-
- // Generate changes diff
- const changes = diffObject(beforeState, afterState);
-
- // Write audit log
- await writeAuditLog({
- model: "AppointmentSubmission",
- documentId: appointment._id,
- action: AUDIT_ACTIONS.UPDATE_APPOINTMENT_STATUS,
- before: beforeState,
- after: afterState,
- changes,
- req,
- });
-
- res.json({
- success: true,
- data: appointment,
- });
- } catch (err) {
- console.error("Error updating appointment:", err);
- res.status(500).json({
- success: false,
- error: "Error updating appointment",
- });
- }
-};
-
-// API để lấy chi tiết một appointment
-exports.getAppointmentById = async (req, res) => {
- try {
- const { id } = req.params;
- const appointment = await AppointmentSubmission.findById(id);
-
- if (!appointment) {
- return res.status(404).json({
- success: false,
- error: "Appointment not found",
- });
- }
-
- res.json({
- success: true,
- data: appointment,
- });
- } catch (err) {
- console.error("Error getting appointment:", err);
- res.status(500).json({
- success: false,
- error: "Error loading appointment",
- });
- }
-};
-
-// API để xóa appointment
-exports.deleteAppointment = async (req, res) => {
- try {
- const { id } = req.params;
-
- // Get the appointment before deletion for audit logging
- const appointment = await AppointmentSubmission.findById(id);
- if (!appointment) {
- return res.status(404).json({
- success: false,
- error: "Appointment not found",
- });
- }
-
- const beforeState = JSON.parse(JSON.stringify(appointment.toObject()));
-
- // Delete the appointment
- await AppointmentSubmission.findByIdAndDelete(id);
-
- // Write audit log
- await writeAuditLog({
- model: "AppointmentSubmission",
- documentId: appointment._id,
- action: AUDIT_ACTIONS.DELETE_APPOINTMENT,
- before: beforeState,
- after: null,
- changes: [],
- req,
- });
-
- res.json({
- success: true,
- message: "Appointment deleted successfully",
- });
- } catch (err) {
- console.error("Error deleting appointment:", err);
- res.status(500).json({
- success: false,
- error: "Error deleting appointment",
- });
- }
-};
diff --git a/controllers/auditLogController.js b/controllers/auditLogController.js
index 8db4bdb..737e89d 100644
--- a/controllers/auditLogController.js
+++ b/controllers/auditLogController.js
@@ -54,7 +54,7 @@ exports.index = async (req, res) => {
res.render("admin/audit-log/index", {
title: "Audit Logs",
- layout: "layouts/main",
+ layout: "layouts/admin",
auditLogs,
pagination: {
current: page,
@@ -91,7 +91,7 @@ exports.show = async (req, res) => {
res.render("admin/audit-log/show", {
title: "Audit Log Details",
- layout: "layouts/main",
+ layout: "layouts/admin",
auditLog,
currentPath: req.path,
user: req.session.user,
diff --git a/controllers/blogCategoryController.js b/controllers/blogCategoryController.js
deleted file mode 100644
index 52f5086..0000000
--- a/controllers/blogCategoryController.js
+++ /dev/null
@@ -1,342 +0,0 @@
-const BlogCategory = require('../models/blogCategory');
-const slugify = require('slugify');
-
-// -------------------- Admin Controllers --------------------
-
-// Display category management page
-exports.index = async (req, res) => {
- try {
- const categories = await BlogCategory.find()
- .sort({ name: 1 })
- .lean();
-
- res.render('admin/blog/categories/index', {
- layout: 'layouts/main',
- title: 'Blog Categories',
- categories,
- currentPath: req.path,
- user: req.session.user
- });
- } catch (err) {
- console.error('Category index error:', err);
- req.flash('error_msg', 'Error loading categories');
- res.redirect('/admin/dashboard');
- }
-};
-
-// Show create category form
-exports.create = async (req, res) => {
- try {
- res.render('admin/blog/categories/create', {
- layout: 'layouts/main',
- title: 'Create New Category',
- currentPath: req.path,
- user: req.session.user
- });
- } catch (err) {
- console.error('Category create form error:', err);
- req.flash('error_msg', 'Error loading create form');
- res.redirect('/admin/blog/categories');
- }
-};
-
-// Store new category
-exports.store = async (req, res) => {
- try {
- const {
- name,
- description,
- isActive
- } = req.body;
-
- // Generate slug
- const slug = slugify(name, {
- lower: true,
- strict: true,
- locale: 'vi'
- });
-
- // Check if slug exists
- const existingCategory = await BlogCategory.findOne({ slug });
- if (existingCategory) {
- req.flash('error_msg', 'A category with this name already exists');
- return res.redirect('/admin/blog/categories/create');
- }
-
- // Create category data
- const categoryData = {
- name,
- slug,
- description,
- isActive: isActive === 'on'
- };
-
- // Create category
- const category = new BlogCategory(categoryData);
- await category.save();
-
- req.flash('success_msg', 'Category created successfully');
- res.redirect('/admin/blog/categories');
- } catch (err) {
- console.error('Category store error:', err);
- req.flash('error_msg', 'Error creating category');
- res.redirect('/admin/blog/categories/create');
- }
-};
-
-// Show edit category form
-exports.edit = async (req, res) => {
- try {
- const category = await BlogCategory.findById(req.params.id);
-
- if (!category) {
- req.flash('error_msg', 'Category not found');
- return res.redirect('/admin/blog/categories');
- }
-
- res.render('admin/blog/categories/edit', {
- layout: 'layouts/main',
- title: 'Edit Category',
- category,
- currentPath: req.path,
- user: req.session.user
- });
- } catch (err) {
- console.error('Category edit form error:', err);
- req.flash('error_msg', 'Error loading category');
- res.redirect('/admin/blog/categories');
- }
-};
-
-// Update category
-exports.update = async (req, res) => {
- try {
- const category = await BlogCategory.findById(req.params.id);
-
- if (!category) {
- req.flash('error_msg', 'Category not found');
- return res.redirect('/admin/blog/categories');
- }
-
- const {
- name,
- description,
- isActive
- } = req.body;
-
- // Update category data
- category.name = name;
- category.description = description;
- category.isActive = isActive === 'on';
-
- // Generate new slug if name changed
- const newSlug = slugify(name, {
- lower: true,
- strict: true,
- locale: 'vi'
- });
-
- if (newSlug !== category.slug) {
- const existingCategory = await BlogCategory.findOne({
- slug: newSlug,
- _id: { $ne: category._id }
- });
- if (existingCategory) {
- req.flash('error_msg', 'A category with this name already exists');
- return res.redirect(`/admin/blog/categories/${category._id}/edit`);
- }
- category.slug = newSlug;
- }
-
- await category.save();
-
- req.flash('success_msg', 'Category updated successfully');
- res.redirect('/admin/blog/categories');
- } catch (err) {
- console.error('Category update error:', err);
- req.flash('error_msg', 'Error updating category');
- res.redirect(`/admin/blog/categories/${req.params.id}/edit`);
- }
-};
-
-// Delete category
-exports.destroy = async (req, res) => {
- try {
- const category = await BlogCategory.findById(req.params.id);
-
- if (!category) {
- // Check if it's an AJAX request
- const isAjax = req.xhr || req.headers['accept']?.includes('application/json') || req.headers['content-type']?.includes('application/json');
- if (isAjax) {
- return res.status(404).json({
- success: false,
- message: 'Category not found'
- });
- }
- req.flash('error_msg', 'Category not found');
- return res.redirect('/admin/blog/categories');
- }
-
- // Check if category has posts
- const Blog = require('../models/blog');
- const postCount = await Blog.countDocuments({ category: { $in: [category.name] } });
-
- if (postCount > 0) {
- // Check if it's an AJAX request
- const isAjax = req.xhr || req.headers['accept']?.includes('application/json') || req.headers['content-type']?.includes('application/json');
- if (isAjax) {
- return res.status(400).json({
- success: false,
- message: 'Cannot delete category that has blog posts'
- });
- }
- req.flash('error_msg', 'Cannot delete category that has blog posts');
- return res.redirect('/admin/blog/categories');
- }
-
- await BlogCategory.findByIdAndDelete(req.params.id);
-
- // Check if it's an AJAX request
- const isAjax = req.xhr || req.headers['accept']?.includes('application/json') || req.headers['content-type']?.includes('application/json');
- if (isAjax) {
- return res.json({
- success: true,
- message: 'Category deleted successfully'
- });
- }
-
- req.flash('success_msg', 'Category deleted successfully');
- res.redirect('/admin/blog/categories');
- } catch (err) {
- console.error('Category delete error:', err);
-
- // Check if it's an AJAX request
- const isAjax = req.xhr || req.headers['accept']?.includes('application/json') || req.headers['content-type']?.includes('application/json');
- if (isAjax) {
- return res.status(500).json({
- success: false,
- message: 'Error deleting category',
- error: err.message || 'Error deleting category'
- });
- }
-
- req.flash('error_msg', 'Error deleting category');
- res.redirect('/admin/blog/categories');
- }
-};
-
-// -------------------- Public API Controllers --------------------
-
-// Get all active categories
-exports.api = async (req, res) => {
- try {
- const categories = await BlogCategory.getActive();
-
- // Update post counts
- for (const category of categories) {
- await category.updatePostCount();
- }
-
- res.json({
- success: true,
- message: 'Categories fetched successfully',
- data: categories
- });
- } catch (err) {
- console.error('Categories API error:', err);
- res.status(500).json({
- success: false,
- message: 'Error loading categories',
- error: err.message || 'Error loading categories'
- });
- }
-};
-
-// Get category by slug
-exports.apiShow = async (req, res) => {
- try {
- const category = await BlogCategory.findOne({
- slug: req.params.slug,
- isActive: true
- }).lean();
-
- if (!category) {
- return res.status(404).json({
- success: false,
- message: 'Category not found'
- });
- }
-
- res.json({
- success: true,
- message: 'Category fetched successfully',
- data: category
- });
- } catch (err) {
- console.error('Category show API error:', err);
- res.status(500).json({
- success: false,
- message: 'Error loading category',
- error: err.message || 'Error loading category'
- });
- }
-};
-
-// Quick create category (for inline creation in blog form)
-exports.quickCreate = async (req, res) => {
- try {
- const { name, description } = req.body;
-
- if (!name || !name.trim()) {
- return res.status(400).json({
- success: false,
- message: 'Category name is required'
- });
- }
-
- const categoryName = name.trim();
-
- // Generate slug
- const slug = slugify(categoryName, {
- lower: true,
- strict: true,
- locale: 'vi'
- });
-
- // Check if category already exists
- let category = await BlogCategory.findOne({ slug });
-
- if (category) {
- return res.json({
- success: true,
- message: 'Category already exists',
- data: category.toObject()
- });
- }
-
- // Create new category
- category = new BlogCategory({
- name: categoryName,
- slug,
- description: description || '',
- isActive: true
- });
-
- await category.save();
-
- res.json({
- success: true,
- message: 'Category created successfully',
- data: category.toObject()
- });
- } catch (err) {
- console.error('Quick create category error:', err);
- res.status(500).json({
- success: false,
- message: 'Error creating category',
- error: err.message || 'Error creating category'
- });
- }
-};
-
-module.exports = exports;
\ No newline at end of file
diff --git a/controllers/blogController.js b/controllers/blogController.js
deleted file mode 100644
index dbe89ea..0000000
--- a/controllers/blogController.js
+++ /dev/null
@@ -1,901 +0,0 @@
-const Blog = require("../models/blog");
-const BlogCategory = require("../models/blogCategory");
-const BlogTag = require("../models/blogTag");
-const BlogComment = require("../models/blogComment");
-const RecentPost = require("../models/recentPost");
-const { addBaseUrlToImages, getFullImageUrl } = require("../utils/imageHelper");
-const slugify = require("slugify");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// -------------------- Helper Functions --------------------
-
-// Generate slug from title
-const generateSlug = (title) => {
- return slugify(title, {
- lower: true,
- strict: true,
- locale: "vi",
- });
-};
-
-// Update category post counts
-const updateCategoryPostCounts = async () => {
- const categories = await BlogCategory.find();
- for (const category of categories) {
- await category.updatePostCount();
- }
-};
-
-// Update tag post counts
-const updateTagPostCounts = async () => {
- const tags = await BlogTag.find();
- for (const tag of tags) {
- await tag.updatePostCount();
- }
-};
-
-// -------------------- Admin Controllers --------------------
-
-// Display blog management page
-exports.index = async (req, res) => {
- try {
- const page = parseInt(req.query.page) || 1;
- const limit = parseInt(req.query.limit) || 10;
- const skip = (page - 1) * limit;
-
- // Build filter
- const filter = {};
- if (req.query.status) {
- filter.status = req.query.status;
- }
- if (req.query.category) {
- filter.category = req.query.category;
- }
- if (req.query.search) {
- filter.$or = [
- { title: { $regex: req.query.search, $options: "i" } },
- { excerpt: { $regex: req.query.search, $options: "i" } },
- ];
- }
-
- // Get blogs with pagination
- const blogs = await Blog.find(filter)
- .sort({ createdAt: -1 })
- .skip(skip)
- .limit(limit)
- .lean();
-
- const totalBlogs = await Blog.countDocuments(filter);
- const totalPages = Math.ceil(totalBlogs / limit);
-
- // Get categories for filter
- const categories = await BlogCategory.getActive();
-
- const frontendUrl = process.env.FRONTEND_URL || "http://localhost:3000";
- const backendUrl = process.env.BACKEND_URL || "http://localhost:3001";
-
- res.render("admin/blog/index", {
- layout: "layouts/main",
- title: "Blog Management",
- blogs,
- categories,
- frontendUrl,
- backendUrl,
- getFullImageUrl, // Truyền helper function vào template
- pagination: {
- current: page,
- total: totalPages,
- limit,
- totalItems: totalBlogs,
- },
- query: req.query,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (err) {
- console.error("Blog index error:", err);
- req.flash("error_msg", "Error loading blogs");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Show create blog form
-exports.create = async (req, res) => {
- try {
- const categories = await BlogCategory.getActive();
- const tags = await BlogTag.getActive();
-
- const frontendUrl = process.env.FRONTEND_URL || "http://localhost:3000";
- const backendUrl = process.env.BACKEND_URL || "http://localhost:3001";
-
- res.render("admin/blog/create", {
- layout: "layouts/main",
- title: "Create New Blog Post",
- categories,
- tags,
- currentPath: req.path,
- user: req.session.user,
- frontendUrl,
- backendUrl,
- getFullImageUrl, // Truyền helper function vào template
- });
- } catch (err) {
- console.error("Blog create form error:", err);
- req.flash("error_msg", "Error loading create form");
- res.redirect("/admin/blog");
- }
-};
-
-// Store new blog
-exports.store = async (req, res) => {
- try {
- const {
- title,
- excerpt,
- content,
- category,
- tags,
- status,
- isFeatured,
- author,
- galleryImages,
- quote,
- contentAfterQuote,
- } = req.body;
-
- // Generate slug
- const slug = generateSlug(title);
-
- // Check if slug exists
- const existingBlog = await Blog.findOne({ slug });
- if (existingBlog) {
- req.flash("error_msg", "A blog post with this title already exists");
- return res.redirect("/admin/blog/create");
- }
-
- // Create blog data
- const blogData = {
- title,
- slug,
- excerpt,
- content,
- category: category
- ? Array.isArray(category)
- ? category
- : [category]
- : [], // Array categories
- tags: tags ? (Array.isArray(tags) ? tags : [tags]) : [],
- status: status || "published",
- isFeatured: isFeatured === "on",
- author: author || "Admin",
- galleryImages: galleryImages
- ? Array.isArray(galleryImages)
- ? galleryImages
- : [galleryImages]
- : [],
- quote: quote || "",
- contentAfterQuote: contentAfterQuote || "",
- };
-
- // Handle featured image - using featuredImageUrl from form (uploaded via AJAX)
- if (req.body.featuredImageUrl) {
- blogData.featuredImage = req.body.featuredImageUrl;
- }
-
- // Create blog
- const blog = new Blog(blogData);
- await blog.save();
-
- // AUDIT LOGGING - Blog Created
- await writeAuditLog({
- model: "Blog",
- documentId: blog._id,
- action: AUDIT_ACTIONS.CREATE_BLOG,
- before: null, // No before state for CREATE
- after: JSON.parse(JSON.stringify(blog.toObject())),
- changes: [], // No changes for CREATE
- req,
- });
-
- // Update counts
- await updateCategoryPostCounts();
- await updateTagPostCounts();
- await RecentPost.syncFromBlogs();
-
- req.flash("success_msg", "Blog post created successfully");
- res.redirect("/admin/blog");
- } catch (err) {
- console.error("Blog store error:", err);
- req.flash("error_msg", "Error creating blog post");
- res.redirect("/admin/blog/create");
- }
-};
-
-// Show edit blog form
-exports.edit = async (req, res) => {
- try {
- const blog = await Blog.findById(req.params.id);
-
- if (!blog) {
- req.flash("error_msg", "Blog post not found");
- return res.redirect("/admin/blog");
- }
-
- const categories = await BlogCategory.getActive();
- const tags = await BlogTag.getActive();
-
- // Get all comments for this blog post (including pending, approved, rejected)
- const allComments = await BlogComment.find({ postId: blog._id })
- .sort({ createdAt: -1 })
- .lean();
-
- // Organize comments with replies
- const parentComments = allComments.filter((c) => !c.parentId);
- const commentsWithReplies = parentComments.map((parent) => {
- const replies = allComments.filter(
- (c) => c.parentId && c.parentId.toString() === parent._id.toString(),
- );
- return {
- ...parent,
- replies: replies,
- };
- });
-
- const frontendUrl = process.env.FRONTEND_URL || "http://localhost:3000";
- const backendUrl = process.env.BACKEND_URL || "http://localhost:3001";
-
- res.render("admin/blog/edit", {
- layout: "layouts/main",
- title: "Edit Blog Post",
- blog,
- categories,
- tags,
- comments: commentsWithReplies,
- commentsCount: allComments.length,
- currentPath: req.path,
- user: req.session.user,
- frontendUrl,
- backendUrl,
- getFullImageUrl, // Truyền helper function vào template
- });
- } catch (err) {
- console.error("Blog edit form error:", err);
- req.flash("error_msg", "Error loading blog post");
- res.redirect("/admin/blog");
- }
-};
-
-// Update blog
-exports.update = async (req, res) => {
- try {
- const blog = await Blog.findById(req.params.id);
-
- if (!blog) {
- req.flash("error_msg", "Blog post not found");
- return res.redirect("/admin/blog");
- }
-
- // Capture BEFORE state
- const beforeData = JSON.parse(JSON.stringify(blog.toObject()));
-
- const {
- title,
- excerpt,
- content,
- category,
- tags,
- status,
- isFeatured,
- author,
- galleryImages,
- quote,
- contentAfterQuote,
- } = req.body;
-
- // Update blog data
- blog.title = title;
- blog.excerpt = excerpt;
- blog.content = content;
- blog.category = category
- ? Array.isArray(category)
- ? category
- : [category]
- : []; // Array categories
- blog.tags = tags ? (Array.isArray(tags) ? tags : [tags]) : [];
- blog.status = status || "published";
- blog.isFeatured = isFeatured === "on";
- blog.author = author || "Admin";
- blog.galleryImages = galleryImages
- ? Array.isArray(galleryImages)
- ? galleryImages
- : [galleryImages]
- : [];
- blog.quote = quote || "";
- blog.contentAfterQuote = contentAfterQuote || "";
-
- // Handle featured image - using featuredImageUrl from form (uploaded via AJAX)
- if (req.body.featuredImageUrl) {
- blog.featuredImage = req.body.featuredImageUrl;
- }
-
- // Generate new slug if title changed
- const newSlug = generateSlug(title);
- if (newSlug !== blog.slug) {
- const existingBlog = await Blog.findOne({
- slug: newSlug,
- _id: { $ne: blog._id },
- });
- if (existingBlog) {
- req.flash("error_msg", "A blog post with this title already exists");
- return res.redirect(`/admin/blog/${blog._id}/edit`);
- }
- blog.slug = newSlug;
- }
-
- await blog.save();
-
- // Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(blog.toObject()));
-
- // AUDIT LOGGING - Blog Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Blog",
- documentId: blog._id,
- action: AUDIT_ACTIONS.UPDATE_BLOG,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- // Update counts
- await updateCategoryPostCounts();
- await updateTagPostCounts();
- await RecentPost.syncFromBlogs();
-
- req.flash("success_msg", "Blog post updated successfully");
- res.redirect("/admin/blog");
- } catch (err) {
- console.error("Blog update error:", err);
- req.flash("error_msg", "Error updating blog post");
- res.redirect(`/admin/blog/${req.params.id}/edit`);
- }
-};
-
-// Delete blog
-exports.destroy = async (req, res) => {
- try {
- const blog = await Blog.findById(req.params.id);
-
- if (!blog) {
- req.flash("error_msg", "Blog post not found");
- return res.redirect("/admin/blog");
- }
-
- // ✅ Capture BEFORE state
- const beforeData = JSON.parse(JSON.stringify(blog.toObject()));
-
- await Blog.findByIdAndDelete(req.params.id);
-
- // ✅ AUDIT LOGGING - Blog Deleted
- await writeAuditLog({
- model: "Blog",
- documentId: req.params.id,
- action: AUDIT_ACTIONS.DELETE_BLOG,
- before: beforeData,
- after: null, // No after state for DELETE
- changes: [],
- req,
- });
-
- // Update counts
- await updateCategoryPostCounts();
- await updateTagPostCounts();
- await RecentPost.syncFromBlogs();
-
- req.flash("success_msg", "Blog post deleted successfully");
- res.redirect("/admin/blog");
- } catch (err) {
- console.error("Blog delete error:", err);
- req.flash("error_msg", "Error deleting blog post");
- res.redirect("/admin/blog");
- }
-};
-
-// -------------------- Public API Controllers --------------------
-
-// Get all published blogs for frontend
-exports.api = async (req, res) => {
- try {
- const page = parseInt(req.query.page) || 1;
- const limit = parseInt(req.query.limit) || 10;
- const skip = (page - 1) * limit;
-
- // Build filter
- const filter = { status: "published" };
-
- if (req.query.category) {
- filter.category = { $in: [req.query.category] }; // Tìm trong array categories
- }
-
- if (req.query.tag) {
- filter.tags = { $in: [req.query.tag] }; // Tìm trong array tags
- }
-
- if (req.query.search) {
- filter.$or = [
- { title: { $regex: req.query.search, $options: "i" } },
- { excerpt: { $regex: req.query.search, $options: "i" } },
- ];
- }
-
- // Get blogs
- const blogs = await Blog.find(filter)
- .sort({ createdAt: -1 })
- .skip(skip)
- .limit(limit)
- .lean();
-
- const totalBlogs = await Blog.countDocuments(filter);
-
- // Add base URL to images
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedBlogs = blogs.map((blog) =>
- addBaseUrlToImages(blog, baseUrl),
- );
-
- res.json({
- success: true,
- message: "Blogs fetched successfully",
- data: {
- blogs: processedBlogs,
- pagination: {
- current: page,
- total: Math.ceil(totalBlogs / limit),
- limit,
- totalItems: totalBlogs,
- },
- },
- });
- } catch (err) {
- console.error("Blog API error:", err);
- res.status(500).json({
- success: false,
- message: "Error loading blogs",
- error: err.message || "Error loading blogs",
- });
- }
-};
-
-// Get single blog by slug
-exports.apiShow = async (req, res) => {
- try {
- const blog = await Blog.findOne({
- slug: req.params.slug,
- status: "published",
- }).lean();
-
- if (!blog) {
- return res.status(404).json({
- success: false,
- message: "Blog post not found",
- });
- }
-
- // Get comments for this post (parent comments only)
- const parentComments = await BlogComment.getApprovedByPost(blog._id);
-
- // Get replies for each parent comment
- const commentsWithReplies = await Promise.all(
- parentComments.map(async (parentComment) => {
- const replies = await BlogComment.getReplies(parentComment._id);
- return {
- ...parentComment.toObject(),
- replies: replies.map((reply) => reply.toObject()),
- };
- }),
- );
-
- // Flatten comments array (parent + replies)
- const allComments = commentsWithReplies.flatMap((comment) => [
- comment,
- ...comment.replies,
- ]);
-
- // Add comments to blog
- blog.comments = allComments;
- // Keep commentsCount in sync for frontend
- blog.commentsCount = allComments.length;
-
- // Add base URL to images
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedBlog = addBaseUrlToImages(blog, baseUrl);
-
- res.json({
- success: true,
- message: "Blog post fetched successfully",
- data: processedBlog,
- });
- } catch (err) {
- console.error("Blog show API error:", err);
- res.status(500).json({
- success: false,
- message: "Error loading blog post",
- error: err.message || "Error loading blog post",
- });
- }
-};
-
-// Create a comment (no moderation for now: default approved)
-exports.apiCreateComment = async (req, res) => {
- try {
- const {
- authorName,
- authorEmail,
- authorPhone,
- authorAddress,
- authorDate,
- content,
- parentId,
- } = req.body || {};
-
- if (!authorName || !String(authorName).trim()) {
- return res.status(400).json({
- success: false,
- message: "authorName is required",
- });
- }
-
- if (!content || !String(content).trim()) {
- return res.status(400).json({
- success: false,
- message: "content is required",
- });
- }
-
- const blog = await Blog.findOne({
- slug: req.params.slug,
- status: "published",
- }).lean();
- if (!blog) {
- return res.status(404).json({
- success: false,
- message: "Blog post not found",
- });
- }
-
- // If replying, ensure parent exists and belongs to same post
- let parentObjectId = null;
- if (parentId) {
- const parent = await BlogComment.findOne({
- _id: parentId,
- postId: blog._id,
- }).lean();
- if (!parent) {
- return res.status(400).json({
- success: false,
- message: "Invalid parentId",
- });
- }
- parentObjectId = parentId;
- }
-
- const newComment = await BlogComment.create({
- postId: blog._id,
- authorName: String(authorName).trim(),
- ...(authorEmail ? { authorEmail: String(authorEmail).trim() } : {}),
- ...(authorPhone ? { authorPhone: String(authorPhone).trim() } : {}),
- ...(authorAddress ? { authorAddress: String(authorAddress).trim() } : {}),
- ...(authorDate ? { authorDate: String(authorDate).trim() } : {}),
- content: String(content).trim(),
- parentId: parentObjectId,
- status: "approved",
- });
-
- // Keep counter roughly correct (also counts replies)
- await Blog.updateOne({ _id: blog._id }, { $inc: { commentsCount: 1 } });
-
- return res.json({
- success: true,
- message: "Comment created successfully",
- data: newComment.toJSON(),
- });
- } catch (err) {
- console.error("Create comment API error:", err);
- return res.status(500).json({
- success: false,
- message: "Error creating comment",
- error: err.message || "Error creating comment",
- });
- }
-};
-
-// Get featured blogs
-exports.apiFeatured = async (req, res) => {
- try {
- const limit = parseInt(req.query.limit) || 3;
-
- const blogs = await Blog.getFeatured().limit(limit).lean();
-
- // Add base URL to images
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("port")}`;
- const processedBlogs = blogs.map((blog) =>
- addBaseUrlToImages(blog, baseUrl),
- );
-
- res.json({
- success: true,
- message: "Featured blogs fetched successfully",
- data: processedBlogs,
- });
- } catch (err) {
- console.error("Featured blogs API error:", err);
- res.status(500).json({
- success: false,
- message: "Error loading featured blogs",
- error: err.message || "Error loading featured blogs",
- });
- }
-};
-
-// Get recent blogs
-exports.apiRecent = async (req, res) => {
- try {
- const limit = parseInt(req.query.limit) || 5;
-
- // Try to get from RecentPost first
- let recentPosts = await RecentPost.getRecent(limit);
-
- // If no recent posts, sync from blogs
- if (recentPosts.length === 0) {
- await RecentPost.syncFromBlogs(limit);
- recentPosts = await RecentPost.getRecent(limit);
- }
-
- // Add base URL to images
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedPosts = recentPosts.map((post) =>
- addBaseUrlToImages(post, baseUrl),
- );
-
- res.json({
- success: true,
- message: "Recent blogs fetched successfully",
- data: processedPosts,
- });
- } catch (err) {
- console.error("Recent blogs API error:", err);
- res.status(500).json({
- success: false,
- message: "Error loading recent blogs",
- error: err.message || "Error loading recent blogs",
- });
- }
-};
-
-// Get categories of a specific blog post
-exports.apiCategories = async (req, res) => {
- try {
- const mongoose = require("mongoose");
- let query;
-
- // Check if it's a valid ObjectId
- if (mongoose.Types.ObjectId.isValid(req.params.id)) {
- query = { _id: req.params.id };
- } else {
- query = { slug: req.params.id };
- }
-
- query.status = "published";
-
- const blog = await Blog.findOne(query).lean();
-
- if (!blog) {
- return res.status(404).json({
- success: false,
- message: "Blog post not found",
- });
- }
-
- // Get category details
- const BlogCategory = require("../models/blogCategory");
- const categories = await BlogCategory.find({
- name: { $in: blog.category },
- isActive: true,
- }).lean();
-
- res.json({
- success: true,
- message: "Blog categories fetched successfully",
- data: categories,
- });
- } catch (err) {
- console.error("Blog categories API error:", err);
- res.status(500).json({
- success: false,
- message: "Error loading blog categories",
- error: err.message || "Error loading blog categories",
- });
- }
-};
-
-// Get tags of a specific blog post
-exports.apiTags = async (req, res) => {
- try {
- const mongoose = require("mongoose");
- let query;
-
- // Check if it's a valid ObjectId
- if (mongoose.Types.ObjectId.isValid(req.params.id)) {
- query = { _id: req.params.id };
- } else {
- query = { slug: req.params.id };
- }
-
- query.status = "published";
-
- const blog = await Blog.findOne(query).lean();
-
- if (!blog) {
- return res.status(404).json({
- success: false,
- message: "Blog post not found",
- });
- }
-
- // Get tag details
- const BlogTag = require("../models/blogTag");
- const tags = await BlogTag.find({
- name: { $in: blog.tags },
- isActive: true,
- }).lean();
-
- res.json({
- success: true,
- message: "Blog tags fetched successfully",
- data: tags,
- });
- } catch (err) {
- console.error("Blog tags API error:", err);
- res.status(500).json({
- success: false,
- message: "Error loading blog tags",
- error: err.message || "Error loading blog tags",
- });
- }
-};
-
-// -------------------- Comment Management Controllers --------------------
-
-// Approve a comment
-exports.approveComment = async (req, res) => {
- try {
- const { blogId, commentId } = req.params;
-
- const blog = await Blog.findById(blogId);
- if (!blog) {
- return res.status(404).json({
- success: false,
- message: "Blog post not found",
- });
- }
-
- const comment = await BlogComment.findById(commentId);
- if (!comment || comment.postId.toString() !== blogId) {
- return res.status(404).json({
- success: false,
- message: "Comment not found",
- });
- }
-
- comment.status = "approved";
- await comment.save();
-
- res.json({
- success: true,
- message: "Comment approved successfully",
- });
- } catch (err) {
- console.error("Approve comment error:", err);
- res.status(500).json({
- success: false,
- message: "Error approving comment",
- error: err.message || "Error approving comment",
- });
- }
-};
-
-// Reject a comment
-exports.rejectComment = async (req, res) => {
- try {
- const { blogId, commentId } = req.params;
-
- const blog = await Blog.findById(blogId);
- if (!blog) {
- return res.status(404).json({
- success: false,
- message: "Blog post not found",
- });
- }
-
- const comment = await BlogComment.findById(commentId);
- if (!comment || comment.postId.toString() !== blogId) {
- return res.status(404).json({
- success: false,
- message: "Comment not found",
- });
- }
-
- comment.status = "rejected";
- await comment.save();
-
- res.json({
- success: true,
- message: "Comment rejected successfully",
- });
- } catch (err) {
- console.error("Reject comment error:", err);
- res.status(500).json({
- success: false,
- message: "Error rejecting comment",
- error: err.message || "Error rejecting comment",
- });
- }
-};
-
-// Delete a comment
-exports.deleteComment = async (req, res) => {
- try {
- const { blogId, commentId } = req.params;
-
- const blog = await Blog.findById(blogId);
- if (!blog) {
- return res.status(404).json({
- success: false,
- message: "Blog post not found",
- });
- }
-
- const comment = await BlogComment.findById(commentId);
- if (!comment || comment.postId.toString() !== blogId) {
- return res.status(404).json({
- success: false,
- message: "Comment not found",
- });
- }
-
- // Delete the comment and all its replies
- await BlogComment.deleteMany({
- $or: [{ _id: commentId }, { parentId: commentId }],
- });
-
- // Update blog comment count
- const remainingComments = await BlogComment.countDocuments({
- postId: blogId,
- });
- await Blog.updateOne({ _id: blogId }, { commentsCount: remainingComments });
-
- res.json({
- success: true,
- message: "Comment deleted successfully",
- });
- } catch (err) {
- console.error("Delete comment error:", err);
- res.status(500).json({
- success: false,
- message: "Error deleting comment",
- error: err.message || "Error deleting comment",
- });
- }
-};
-
-module.exports = exports;
diff --git a/controllers/blogTagController.js b/controllers/blogTagController.js
deleted file mode 100644
index 6daeb6b..0000000
--- a/controllers/blogTagController.js
+++ /dev/null
@@ -1,358 +0,0 @@
-const BlogTag = require('../models/blogTag');
-const slugify = require('slugify');
-
-// -------------------- Admin Controllers --------------------
-
-// Display tag management page
-exports.index = async (req, res) => {
- try {
- const tags = await BlogTag.find()
- .sort({ name: 1 })
- .lean();
-
- res.render('admin/blog/tags/index', {
- layout: 'layouts/main',
- title: 'Blog Tags',
- tags,
- currentPath: req.path,
- user: req.session.user
- });
- } catch (err) {
- console.error('Tag index error:', err);
- req.flash('error_msg', 'Error loading tags');
- res.redirect('/admin/dashboard');
- }
-};
-
-// Show create tag form
-exports.create = async (req, res) => {
- try {
- res.render('admin/blog/tags/create', {
- layout: 'layouts/main',
- title: 'Create New Tag',
- currentPath: req.path,
- user: req.session.user
- });
- } catch (err) {
- console.error('Tag create form error:', err);
- req.flash('error_msg', 'Error loading create form');
- res.redirect('/admin/blog/tags');
- }
-};
-
-// Store new tag
-exports.store = async (req, res) => {
- try {
- const {
- name,
- isActive
- } = req.body;
-
- // Generate slug
- const slug = slugify(name, {
- lower: true,
- strict: true,
- locale: 'vi'
- });
-
- // Check if slug exists
- const existingTag = await BlogTag.findOne({ slug });
- if (existingTag) {
- req.flash('error_msg', 'A tag with this name already exists');
- return res.redirect('/admin/blog/tags/create');
- }
-
- // Create tag data
- const tagData = {
- name,
- slug,
- isActive: isActive === 'on'
- };
-
- // Create tag
- const tag = new BlogTag(tagData);
- await tag.save();
-
- req.flash('success_msg', 'Tag created successfully');
- res.redirect('/admin/blog/tags');
- } catch (err) {
- console.error('Tag store error:', err);
- req.flash('error_msg', 'Error creating tag');
- res.redirect('/admin/blog/tags/create');
- }
-};
-
-// Show edit tag form
-exports.edit = async (req, res) => {
- try {
- const tag = await BlogTag.findById(req.params.id);
-
- if (!tag) {
- req.flash('error_msg', 'Tag not found');
- return res.redirect('/admin/blog/tags');
- }
-
- res.render('admin/blog/tags/edit', {
- layout: 'layouts/main',
- title: 'Edit Tag',
- tag,
- currentPath: req.path,
- user: req.session.user
- });
- } catch (err) {
- console.error('Tag edit form error:', err);
- req.flash('error_msg', 'Error loading tag');
- res.redirect('/admin/blog/tags');
- }
-};
-
-// Update tag
-exports.update = async (req, res) => {
- try {
- const tag = await BlogTag.findById(req.params.id);
-
- if (!tag) {
- req.flash('error_msg', 'Tag not found');
- return res.redirect('/admin/blog/tags');
- }
-
- const {
- name,
- isActive
- } = req.body;
-
- // Update tag data
- tag.name = name;
- tag.isActive = isActive === 'on';
-
- // Generate new slug if name changed
- const newSlug = slugify(name, {
- lower: true,
- strict: true,
- locale: 'vi'
- });
-
- if (newSlug !== tag.slug) {
- const existingTag = await BlogTag.findOne({
- slug: newSlug,
- _id: { $ne: tag._id }
- });
- if (existingTag) {
- req.flash('error_msg', 'A tag with this name already exists');
- return res.redirect(`/admin/blog/tags/${tag._id}/edit`);
- }
- tag.slug = newSlug;
- }
-
- await tag.save();
-
- req.flash('success_msg', 'Tag updated successfully');
- res.redirect('/admin/blog/tags');
- } catch (err) {
- console.error('Tag update error:', err);
- req.flash('error_msg', 'Error updating tag');
- res.redirect(`/admin/blog/tags/${req.params.id}/edit`);
- }
-};
-
-// Delete tag
-exports.destroy = async (req, res) => {
- try {
- const tag = await BlogTag.findById(req.params.id);
-
- if (!tag) {
- // Check if it's an AJAX request
- const isAjax = req.xhr || req.headers['accept']?.includes('application/json') || req.headers['content-type']?.includes('application/json');
- if (isAjax) {
- return res.status(404).json({
- success: false,
- message: 'Tag not found'
- });
- }
- req.flash('error_msg', 'Tag not found');
- return res.redirect('/admin/blog/tags');
- }
-
- // Check if tag has posts
- const Blog = require('../models/blog');
- const postCount = await Blog.countDocuments({ tags: { $in: [tag.name] } });
-
- if (postCount > 0) {
- // Check if it's an AJAX request
- const isAjax = req.xhr || req.headers['accept']?.includes('application/json') || req.headers['content-type']?.includes('application/json');
- if (isAjax) {
- return res.status(400).json({
- success: false,
- message: 'Cannot delete tag that is used in blog posts'
- });
- }
- req.flash('error_msg', 'Cannot delete tag that is used in blog posts');
- return res.redirect('/admin/blog/tags');
- }
-
- await BlogTag.findByIdAndDelete(req.params.id);
-
- // Check if it's an AJAX request
- const isAjax = req.xhr || req.headers['accept']?.includes('application/json') || req.headers['content-type']?.includes('application/json');
- if (isAjax) {
- return res.json({
- success: true,
- message: 'Tag deleted successfully'
- });
- }
-
- req.flash('success_msg', 'Tag deleted successfully');
- res.redirect('/admin/blog/tags');
- } catch (err) {
- console.error('Tag delete error:', err);
-
- // Check if it's an AJAX request
- const isAjax = req.xhr || req.headers['accept']?.includes('application/json') || req.headers['content-type']?.includes('application/json');
- if (isAjax) {
- return res.status(500).json({
- success: false,
- message: 'Error deleting tag',
- error: err.message || 'Error deleting tag'
- });
- }
-
- req.flash('error_msg', 'Error deleting tag');
- res.redirect('/admin/blog/tags');
- }
-};
-
-// -------------------- Public API Controllers --------------------
-
-// Get all active tags
-exports.api = async (req, res) => {
- try {
- const tags = await BlogTag.getActive();
-
- // Update post counts
- for (const tag of tags) {
- await tag.updatePostCount();
- }
-
- res.json({
- success: true,
- message: 'Tags fetched successfully',
- data: tags
- });
- } catch (err) {
- console.error('Tags API error:', err);
- res.status(500).json({
- success: false,
- message: 'Error loading tags',
- error: err.message || 'Error loading tags'
- });
- }
-};
-
-// Get popular tags
-exports.apiPopular = async (req, res) => {
- try {
- const limit = parseInt(req.query.limit) || 10;
- const tags = await BlogTag.getPopular(limit);
-
- res.json({
- success: true,
- message: 'Popular tags fetched successfully',
- data: tags
- });
- } catch (err) {
- console.error('Popular tags API error:', err);
- res.status(500).json({
- success: false,
- message: 'Error loading popular tags',
- error: err.message || 'Error loading popular tags'
- });
- }
-};
-
-// Get tag by slug
-exports.apiShow = async (req, res) => {
- try {
- const tag = await BlogTag.findOne({
- slug: req.params.slug,
- isActive: true
- }).lean();
-
- if (!tag) {
- return res.status(404).json({
- success: false,
- message: 'Tag not found'
- });
- }
-
- res.json({
- success: true,
- message: 'Tag fetched successfully',
- data: tag
- });
- } catch (err) {
- console.error('Tag show API error:', err);
- res.status(500).json({
- success: false,
- message: 'Error loading tag',
- error: err.message || 'Error loading tag'
- });
- }
-};
-
-// Quick create tag (for inline creation in blog form)
-exports.quickCreate = async (req, res) => {
- try {
- const { name } = req.body;
-
- if (!name || !name.trim()) {
- return res.status(400).json({
- success: false,
- message: 'Tag name is required'
- });
- }
-
- const tagName = name.trim();
-
- // Generate slug
- const slug = slugify(tagName, {
- lower: true,
- strict: true,
- locale: 'vi'
- });
-
- // Check if tag already exists
- let tag = await BlogTag.findOne({ slug });
-
- if (tag) {
- return res.json({
- success: true,
- message: 'Tag already exists',
- data: tag.toObject()
- });
- }
-
- // Create new tag
- tag = new BlogTag({
- name: tagName,
- slug,
- isActive: true
- });
-
- await tag.save();
-
- res.json({
- success: true,
- message: 'Tag created successfully',
- data: tag.toObject()
- });
- } catch (err) {
- console.error('Quick create tag error:', err);
- res.status(500).json({
- success: false,
- message: 'Error creating tag',
- error: err.message || 'Error creating tag'
- });
- }
-};
-
-module.exports = exports;
\ No newline at end of file
diff --git a/controllers/bookingController.js b/controllers/bookingController.js
deleted file mode 100644
index ccca6fb..0000000
--- a/controllers/bookingController.js
+++ /dev/null
@@ -1,549 +0,0 @@
-const fs = require('fs');
-const path = require('path');
-const { addBaseUrlToImages } = require("../utils/imageHelper");
-const Booking = require("../models/booking");
-
-// -------------------- Public helpers --------------------
-const getBookingData = async () => {
- const booking = await Booking.findOne().sort({ updatedAt: -1 });
- return booking ? (booking.toObject ? booking.toObject() : booking) : null;
-};
-
-// Load static booking JSON from `data/booking.json` (if present)
-const loadStaticBooking = () => {
- try {
- const p = path.join(__dirname, '..', 'data', 'booking.json');
- if (!fs.existsSync(p)) return null;
- const raw = fs.readFileSync(p, 'utf8');
- return JSON.parse(raw);
- } catch (e) {
- console.error('booking.loadStaticBooking error:', e && e.message);
- return null;
- }
-};
-
-// Normalize booking shape: ensure configuration exists with discounts/vouchers
-const normalizeBookingShape = (booking) => {
- if (!booking || typeof booking !== 'object') return booking;
- const b = JSON.parse(JSON.stringify(booking));
-
- if (!b.configuration || typeof b.configuration !== 'object') {
- b.configuration = { currency: 'USD', discounts: [], vouchers: [] };
- }
-
- // Ensure configuration.discounts and configuration.vouchers exist
- if (!Array.isArray(b.configuration.discounts)) {
- b.configuration.discounts = [];
- }
- if (!Array.isArray(b.configuration.vouchers)) {
- b.configuration.vouchers = [];
- }
-
- return b;
-};
-
-// Deep merge: properties from `overrides` replace / merge into `base`.
-const deepMerge = (base, overrides) => {
- if (overrides === undefined) return base;
- if (base === undefined || base === null) return overrides;
- if (Array.isArray(overrides)) return overrides;
- if (typeof overrides !== 'object' || overrides === null) return overrides;
- const out = Object.assign({}, base);
- Object.keys(overrides).forEach((k) => {
- if (Array.isArray(overrides[k]) || typeof overrides[k] !== 'object' || overrides[k] === null) {
- out[k] = overrides[k];
- } else {
- out[k] = deepMerge(base[k], overrides[k]);
- }
- });
- return out;
-};
-
-// Ensure booking data fields have the expected shapes to avoid runtime errors
-const sanitizeBookingData = (raw) => {
- const defaults = {
- hero: { title: '', backgroundImage: '' },
- searchBar: { locationLabel: '', holidaySeasonLabel: '', searchButtonText: '' },
- filterPanel: {
- title: '',
- priceTitle: '',
- priceLabel: '',
- pricePlaceholder: '',
- priceMin: 0,
- priceMax: 0,
- ageTitle: '',
- ageMin: 0,
- ageMax: 0,
- ageSelectPlaceholder: '',
- activitiesTitle: '',
- ratingTitle: '',
- ratingOptions: [],
- resetButtonText: ''
- },
- programs: [],
- holidays: [],
- locations: [],
- camps: [],
- configuration: { currency: 'USD', discounts: [], vouchers: [] },
- formSteps: [],
- validation: {}
- };
-
- if (!raw || typeof raw !== 'object') return defaults;
-
- // Use raw data first, then fill in missing fields with defaults
- const safe = Object.assign({}, raw);
-
- // Ensure nested objects/arrays have correct types (use raw data if valid, otherwise defaults)
- safe.hero = (safe.hero && typeof safe.hero === 'object') ? safe.hero : defaults.hero;
- safe.searchBar = (safe.searchBar && typeof safe.searchBar === 'object') ? safe.searchBar : defaults.searchBar;
- safe.filterPanel = (safe.filterPanel && typeof safe.filterPanel === 'object') ? safe.filterPanel : defaults.filterPanel;
-
- if (!Array.isArray(safe.filterPanel.ratingOptions)) safe.filterPanel.ratingOptions = defaults.filterPanel.ratingOptions;
-
- safe.programs = Array.isArray(safe.programs) ? safe.programs : defaults.programs;
- safe.holidays = Array.isArray(safe.holidays) ? safe.holidays : defaults.holidays;
- safe.locations = Array.isArray(safe.locations) ? safe.locations : defaults.locations;
- safe.camps = Array.isArray(safe.camps) ? safe.camps : defaults.camps;
-
- // Ensure configuration has proper structure
- if (!safe.configuration || typeof safe.configuration !== 'object') {
- safe.configuration = defaults.configuration;
- }
- if (!Array.isArray(safe.configuration.discounts)) {
- safe.configuration.discounts = defaults.configuration.discounts;
- }
- if (!Array.isArray(safe.configuration.vouchers)) {
- safe.configuration.vouchers = defaults.configuration.vouchers;
- }
-
- // Ensure formSteps and validation have correct types
- safe.formSteps = Array.isArray(safe.formSteps) ? safe.formSteps : defaults.formSteps;
- safe.validation = (safe.validation && typeof safe.validation === 'object' && !Array.isArray(safe.validation)) ? safe.validation : defaults.validation;
-
- return safe;
-};
-
-// Safe JSON parse with better error handling - handles double-encoded JSON and JS object notation
-const safeParse = (value, fieldName = 'unknown') => {
- // If already an object or array, return as-is
- if (typeof value === 'object' && value !== null) {
- return value;
- }
-
- // If string, try to parse
- if (typeof value === 'string') {
- try {
- let cleaned = value.trim();
-
- // Check if it looks like JavaScript object notation (has single quotes or unquoted keys)
- if (cleaned.includes("'") || /\{\s*\w+:/.test(cleaned)) {
- console.warn(`safeParse: Converting JS notation to JSON for "${fieldName}"`);
-
- // Aggressive conversion approach
- cleaned = cleaned
- .replace(/'/g, '"') // Replace ALL single quotes with double quotes
- .replace(/\r?\n|\r/g, ' ') // Remove all newlines
- .replace(/\s+/g, ' ') // Normalize multiple spaces to single space
- .replace(/,(\s*[}\]])/g, '$1') // Remove trailing commas before } or ]
- .replace(/([{,]\s*)(\w+):/g, '$1"$2":'); // Quote unquoted object keys
- }
-
- // Try parsing
- let parsed = JSON.parse(cleaned);
-
- // If result is still a string, try parsing again (double-encoded)
- if (typeof parsed === 'string') {
- console.warn(`safeParse: Double-encoded JSON detected for "${fieldName}"`);
- parsed = JSON.parse(parsed);
- }
-
- return parsed;
- } catch (e) {
- console.error(`safeParse: Failed to parse field "${fieldName}"`, {
- error: e.message,
- valuePreview: value.substring(0, 200)
- });
-
- throw new Error(`Invalid JSON format for field: ${fieldName}. Error: ${e.message}`);
- }
- }
-
- // For other types, return empty array or object
- console.warn(`safeParse: Unexpected type for field "${fieldName}": ${typeof value}`);
- return Array.isArray(value) ? [] : {};
-};
-
-// Validate booking data structure
-const validateBookingData = (data) => {
- const errors = [];
-
- // Check required fields
- if (!data.hero || typeof data.hero !== 'object') {
- errors.push('Hero data is required and must be an object');
- }
-
- if (!data.searchBar || typeof data.searchBar !== 'object') {
- errors.push('SearchBar data is required and must be an object');
- }
-
- if (!data.filterPanel || typeof data.filterPanel !== 'object') {
- errors.push('FilterPanel data is required and must be an object');
- }
-
- // Validate arrays
- if (data.programs && !Array.isArray(data.programs)) {
- errors.push('Programs must be an array');
- }
-
- if (data.holidays && !Array.isArray(data.holidays)) {
- errors.push('Holidays must be an array');
- }
-
- if (data.locations && !Array.isArray(data.locations)) {
- errors.push('Locations must be an array');
- }
-
- if (data.camps && !Array.isArray(data.camps)) {
- errors.push('Camps must be an array');
- }
-
- // Validate configuration structure
- if (data.configuration) {
- if (typeof data.configuration !== 'object') {
- errors.push('Configuration must be an object');
- } else {
- if (data.configuration.discounts && !Array.isArray(data.configuration.discounts)) {
- errors.push('Configuration.discounts must be an array');
- }
- if (data.configuration.vouchers && !Array.isArray(data.configuration.vouchers)) {
- errors.push('Configuration.vouchers must be an array');
- }
- }
- }
-
- // Validate formSteps and validation structure if provided
- if (data.formSteps && !Array.isArray(data.formSteps)) {
- errors.push('formSteps must be an array');
- }
-
- if (data.validation && (typeof data.validation !== 'object' || Array.isArray(data.validation))) {
- errors.push('validation must be an object');
- }
-
- return {
- isValid: errors.length === 0,
- errors
- };
-};
-
-// -------------------- Public endpoints --------------------
-// Public endpoint: return Booking JSON
-exports.page = async (req, res) => {
- try {
- const dbBooking = await getBookingData();
- const staticBooking = loadStaticBooking();
-
- // Normalize shapes so `configuration.discounts`/`configuration.vouchers` exist
- const normStatic = normalizeBookingShape(staticBooking);
- const normDb = normalizeBookingShape(dbBooking);
-
- // Build final payload according to BOOKING_MODE env var
- const finalBooking = getFinalBooking(normStatic, normDb);
-
- if (!finalBooking) {
- return res.status(404).json({
- error: "No booking data found",
- message: "Please configure booking data in admin panel"
- });
- }
-
- const baseUrl = process.env.BACKEND_URL || `${req.protocol}://${req.get('host')}`;
- const processed = addBaseUrlToImages(finalBooking, baseUrl);
-
- return res.json(processed);
- } catch (err) {
- console.error("booking.page error:", err);
- return res.status(500).json({
- error: "Error loading booking data",
- message: process.env.NODE_ENV === 'development' ? err.message : undefined
- });
- }
-};
-
-
-// API endpoint to return booking JSON
-exports.api = async (req, res) => {
- try {
- const dbBooking = await getBookingData();
- const staticBooking = loadStaticBooking();
-
- // Normalize shapes so `configuration.discounts`/`configuration.vouchers` exist
- const normStatic = normalizeBookingShape(staticBooking);
- const normDb = normalizeBookingShape(dbBooking);
-
- const finalBooking = getFinalBooking(normStatic, normDb);
-
- if (!finalBooking) {
- return res.status(404).json({
- error: "No booking data found",
- message: "Please configure booking data in admin panel"
- });
- }
-
- const baseUrl = process.env.BACKEND_URL || `${req.protocol}://${req.get('host')}`;
- const processed = addBaseUrlToImages(finalBooking, baseUrl);
-
- return res.json(processed);
- } catch (err) {
- console.error("booking.api error:", err);
- return res.status(500).json({
- error: "Error loading booking data",
- message: process.env.NODE_ENV === 'development' ? err.message : undefined
- });
- }
-};
-
-// -------------------- Admin endpoints --------------------
-// Display Booking management page
-exports.index = async (req, res) => {
- try {
- const dbBooking = await getBookingData();
- const staticBooking = loadStaticBooking();
-
- // Merge static booking with DB data (use same merge logic as public endpoints)
- const normStatic = normalizeBookingShape(staticBooking);
- const normDb = normalizeBookingShape(dbBooking);
- const mergedData = getFinalBooking(normStatic, normDb);
-
- // Normalize again after merge to ensure discounts/vouchers are synced to top-level
- const data = normalizeBookingShape(mergedData);
-
- // Sanitize data to ensure nested fields are objects/arrays (fixes malformed DB entries)
- const safeData = sanitizeBookingData(data);
-
- res.render("admin/booking/index", {
- layout: "layouts/main",
- title: "Booking Management",
- data: safeData,
- frontendUrl: process.env.FRONTEND_URL || req.protocol + "://" + req.get("host"),
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (err) {
- console.error("booking.index error:", err);
- req.flash("error_msg", "Error loading booking page");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Update booking data
-exports.update = async (req, res) => {
- try {
- const { id } = req.params;
- // ADD THIS DEBUG LOG
- console.log('=== RAW REQUEST BODY ===');
- console.log('Discounts type:', typeof req.body.discounts);
- console.log('Discounts first 500 chars:', req.body.discounts?.substring(0, 500));
- console.log('Vouchers type:', typeof req.body.vouchers);
- console.log('Vouchers first 500 chars:', req.body.vouchers?.substring(0, 500));
- console.log('========================');
- const {
- hero,
- searchBar,
- filterPanel,
- programs,
- holidays,
- locations,
- camps,
- discounts,
- vouchers,
- formSteps,
- validation: validationRaw
- } = req.body;
-
- // Parse JSON strings
- const errors = [];
- let updateData = {};
-
- try {
- console.log('Raw discounts from req.body:', typeof discounts, discounts);
- console.log('Raw vouchers from req.body:', typeof vouchers, vouchers);
-
- const parsedDiscounts = safeParse(discounts, 'discounts');
- const parsedVouchers = safeParse(vouchers, 'vouchers');
-
- console.log('Parsed discounts:', typeof parsedDiscounts, Array.isArray(parsedDiscounts), parsedDiscounts);
- console.log('Parsed vouchers:', typeof parsedVouchers, Array.isArray(parsedVouchers), parsedVouchers);
-
- updateData = {
- hero: safeParse(hero, 'hero'),
- searchBar: safeParse(searchBar, 'searchBar'),
- filterPanel: safeParse(filterPanel, 'filterPanel'),
- programs: safeParse(programs, 'programs'),
- holidays: safeParse(holidays, 'holidays'),
- locations: safeParse(locations, 'locations'),
- camps: safeParse(camps, 'camps'),
- formSteps: safeParse(formSteps, 'formSteps'),
- validation: safeParse(validationRaw, 'validation'),
- configuration: {
- currency: 'USD',
- discounts: parsedDiscounts,
- vouchers: parsedVouchers
- }
- };
- } catch (parseError) {
- console.error('booking.update: Parse error', parseError);
- req.flash("error_msg", `Data processing error: ${parseError.message}`);
- return req.session.save(() => res.redirect("/admin/booking"));
- }
-
- // Validate data structure
- const validation = validateBookingData(updateData);
- if (!validation.isValid) {
- console.error('booking.update: Validation failed', validation.errors);
- req.flash("error_msg", `Validation failed: ${validation.errors[0]}`);
- return req.session.save(() => res.redirect("/admin/booking"));
- }
-
- console.log('Final updateData keys:', Object.keys(updateData));
- console.log('updateData.discounts:', updateData.discounts);
- console.log('updateData.configuration:', updateData.configuration);
-
- // CRITICAL: Remove any top-level discounts/vouchers to prevent schema conflicts
- // These should ONLY exist in configuration object
- delete updateData.discounts;
- delete updateData.vouchers;
-
- // Update or create booking document
- let result;
- try {
- if (id && id !== 'undefined') {
- result = await Booking.findByIdAndUpdate(
- id,
- {
- ...updateData,
- $unset: { discounts: "", vouchers: "" } // Remove old top-level fields
- },
- {
- new: true,
- runValidators: false, // TẮT validator để tránh lỗi cast
- strict: false // TẮT strict mode
- }
- );
-
- if (!result) {
- req.flash("error_msg", "Booking document not found");
- return req.session.save(() => res.redirect("/admin/booking"));
- }
- } else {
- // Upsert: update existing or create new
- result = await Booking.findOneAndUpdate(
- {},
- {
- ...updateData,
- $unset: { discounts: "", vouchers: "" } // Remove old top-level fields
- },
- {
- upsert: true,
- new: true,
- runValidators: false, // TẮT validator
- strict: false // TẮT strict mode
- }
- );
- }
-
- req.flash("success_msg", "Booking data updated successfully");
- return req.session.save(() => res.redirect("/admin/booking"));
- } catch (dbError) {
- console.error("booking.update: Database error", dbError);
- req.flash("error_msg", `Database error: ${dbError.message || "Unknown"}`);
- return req.session.save(() => res.redirect("/admin/booking"));
- }
- } catch (err) {
- console.error("booking.update error:", err);
- req.flash("error_msg", `Update error: ${err.message || "Unknown"}`);
- return req.session.save(() => res.redirect("/admin/booking"));
- }
-};
-
-// Booking selection mode: 'merge' (default) = static base, DB overrides;
-// 'static' = use `data/booking.json` only; 'db' = use DB only.
-const getFinalBooking = (staticBooking, dbBooking) => {
- const mode = (process.env.BOOKING_MODE || 'merge').toLowerCase();
- if (mode === 'static') return staticBooking || dbBooking || null;
- if (mode === 'db') return dbBooking || staticBooking || null;
- // default: merge static (base) with DB overrides
- // If both static and db present, attempt to map DB primitive lists (e.g. ["915"]) to
- // full objects from the static file (e.g. {id:"915", name:..., type:...}).
- const mapDbPrimitivesToObjects = (db, stat) => {
- if (!db || !stat) return db;
- const dbCfg = db.configuration || {};
- const statCfg = stat.configuration || {};
-
- console.log('DB discounts/vouchers:', db.discounts, db.vouchers);
- console.log('DB config:', dbCfg.discounts, dbCfg.vouchers);
- console.log('Static config:', statCfg.discounts, statCfg.vouchers);
-
- // Handle legacy: if top-level discounts/vouchers exist as strings, migrate to configuration
- if (Array.isArray(db.discounts) && db.discounts.length > 0 && (!dbCfg.discounts || dbCfg.discounts.length === 0)) {
- const statDiscountById = {};
- if (statCfg.discounts) {
- statCfg.discounts.forEach(d => { if (d && d.id) statDiscountById[String(d.id)] = d; });
- }
- if (typeof db.discounts[0] === 'string') {
- dbCfg.discounts = db.discounts.map(s => statDiscountById[String(s)] || { id: s, name: '', type: 'percentage', value: 0 });
- } else {
- dbCfg.discounts = db.discounts;
- }
- }
-
- if (Array.isArray(db.vouchers) && db.vouchers.length > 0 && (!dbCfg.vouchers || dbCfg.vouchers.length === 0)) {
- const statVouchByCode = {};
- if (statCfg.vouchers) {
- statCfg.vouchers.forEach(v => { if (v && v.validCodes) statVouchByCode[String(v.validCodes)] = v; });
- }
- if (typeof db.vouchers[0] === 'string') {
- dbCfg.vouchers = db.vouchers.map(s => statVouchByCode[String(s)] || { validCodes: s, type: 'percentage', value: 0 });
- } else {
- dbCfg.vouchers = db.vouchers;
- }
- }
-
- // If DB configuration still empty, use static data
- if (Array.isArray(dbCfg.discounts) && dbCfg.discounts.length === 0 && statCfg.discounts && statCfg.discounts.length > 0) {
- dbCfg.discounts = statCfg.discounts;
- } else if (Array.isArray(dbCfg.discounts) && dbCfg.discounts.length > 0 && typeof dbCfg.discounts[0] === 'string') {
- // Map string IDs to full objects from static
- const statDiscountById = {};
- if (statCfg.discounts) {
- statCfg.discounts.forEach(d => { if (d && d.id) statDiscountById[String(d.id)] = d; });
- }
- dbCfg.discounts = dbCfg.discounts.map(s => statDiscountById[String(s)] || { id: s, name: '', type: 'percentage', value: 0 });
- }
-
- if (Array.isArray(dbCfg.vouchers) && dbCfg.vouchers.length === 0 && statCfg.vouchers && statCfg.vouchers.length > 0) {
- dbCfg.vouchers = statCfg.vouchers;
- } else if (Array.isArray(dbCfg.vouchers) && dbCfg.vouchers.length > 0 && typeof dbCfg.vouchers[0] === 'string') {
- // Map string codes to full objects from static
- const statVouchByCode = {};
- if (statCfg.vouchers) {
- statCfg.vouchers.forEach(v => { if (v && v.validCodes) statVouchByCode[String(v.validCodes)] = v; });
- }
- dbCfg.vouchers = dbCfg.vouchers.map(s => statVouchByCode[String(s)] || { validCodes: s, type: 'percentage', value: 0 });
- }
-
- return Object.assign({}, db, { configuration: dbCfg });
- };
-
- const mappedDb = mapDbPrimitivesToObjects(dbBooking, staticBooking);
- const merged = staticBooking ? deepMerge(staticBooking, mappedDb || {}) : (mappedDb || null);
-
- // Clean up: remove top-level discounts/vouchers after migrating to configuration
- if (merged) {
- delete merged.discounts;
- delete merged.vouchers;
- }
-
- return merged;
-};
\ No newline at end of file
diff --git a/controllers/bookingSubmissionController.js b/controllers/bookingSubmissionController.js
deleted file mode 100644
index d488174..0000000
--- a/controllers/bookingSubmissionController.js
+++ /dev/null
@@ -1,558 +0,0 @@
-const BookingSubmission = require('../models/bookingSubmission');
-const Activity = require('../models/activity');
-
-// API endpoint để tạo booking submission mới
-exports.submitBooking = async (req, res) => {
- try {
- const {
- activityId,
- sessionId,
- parentFirstName,
- parentLastName,
- email,
- phone,
- address,
- city,
- country,
- postalCode,
- participantFirstName,
- participantLastName,
- participantBirthDate,
- participantGender,
- numberOfParticipants,
- medicalConditions,
- dietaryRestrictions,
- specialRequests,
- emergencyContact,
- emergencyPhone,
- agreeTerms,
- agreeNewsletter
- } = req.body;
-
- // Validate required fields
- if (!activityId || !sessionId || !parentFirstName || !parentLastName ||
- !email || !phone || !address || !city || !country || !postalCode ||
- !participantFirstName || !participantLastName || !participantBirthDate ||
- !participantGender || !emergencyContact || !emergencyPhone || !agreeTerms) {
- return res.status(400).json({
- error: 'Missing required fields',
- message: 'Please fill in all required fields'
- });
- }
-
- // Verify activity exists
- const activity = await Activity.findById(activityId);
- if (!activity) {
- return res.status(404).json({
- error: 'Activity not found',
- message: 'The selected activity does not exist'
- });
- }
-
- // Verify session exists and is active
- const session = activity.bookingSessions?.find(s => s.sessionId === sessionId);
- if (!session) {
- return res.status(404).json({
- error: 'Session not found',
- message: 'The selected session does not exist'
- });
- }
-
- if (!session.isActive) {
- return res.status(400).json({
- error: 'Session not available',
- message: 'The selected session is no longer available for booking'
- });
- }
-
- // Check availability based on participant gender
- const currentBookings = await BookingSubmission.countDocuments({
- activityId,
- sessionId,
- participantGender,
- status: { $in: ['pending', 'confirmed'] }
- });
-
- const availableSpots = participantGender === 'male'
- ? session.totalMaleSpots - session.bookedMaleSpots
- : session.totalFemaleSpots - session.bookedFemaleSpots;
-
- if (currentBookings >= availableSpots) {
- return res.status(400).json({
- error: 'Session full',
- message: `No more spots available for ${participantGender} participants in this session`
- });
- }
-
- // Calculate total amount based on activity price and number of participants
- const totalAmount = (activity.price || 0) * (parseInt(numberOfParticipants) || 1);
-
- // Create booking submission
- const bookingSubmission = new BookingSubmission({
- activityId,
- sessionId,
- parentFirstName: parentFirstName.trim(),
- parentLastName: parentLastName.trim(),
- email: email.toLowerCase().trim(),
- phone: phone.trim(),
- address: address.trim(),
- city: city.trim(),
- country: country.trim(),
- postalCode: postalCode.trim(),
- participantFirstName: participantFirstName.trim(),
- participantLastName: participantLastName.trim(),
- participantBirthDate: new Date(participantBirthDate),
- participantGender,
- numberOfParticipants: parseInt(numberOfParticipants) || 1,
- medicalConditions: (medicalConditions || '').trim(),
- dietaryRestrictions: dietaryRestrictions || 'none',
- specialRequests: (specialRequests || '').trim(),
- emergencyContact: emergencyContact.trim(),
- emergencyPhone: emergencyPhone.trim(),
- agreeTerms: Boolean(agreeTerms),
- agreeNewsletter: Boolean(agreeNewsletter),
- totalAmount,
- status: 'pending',
- paymentStatus: 'pending'
- });
-
- await bookingSubmission.save();
-
- // Update session booked spots
- const updateField = participantGender === 'male' ? 'bookingSessions.$.bookedMaleSpots' : 'bookingSessions.$.bookedFemaleSpots';
- await Activity.updateOne(
- { _id: activityId, 'bookingSessions.sessionId': sessionId },
- { $inc: { [updateField]: 1 } }
- );
-
- // Populate activity info for response
- await bookingSubmission.populate('activityId', 'name price');
-
- return res.status(201).json({
- success: true,
- message: 'Booking submitted successfully',
- booking: {
- id: bookingSubmission._id,
- activityName: bookingSubmission.activityId.name,
- sessionId: bookingSubmission.sessionId,
- participantName: `${bookingSubmission.participantFirstName} ${bookingSubmission.participantLastName}`,
- totalAmount: bookingSubmission.totalAmount,
- status: bookingSubmission.status
- }
- });
-
- } catch (error) {
- console.error('submitBooking error:', error);
-
- // Handle validation errors
- if (error.name === 'ValidationError') {
- const validationErrors = Object.values(error.errors).map(err => err.message);
- return res.status(400).json({
- error: 'Validation failed',
- message: validationErrors.join(', ')
- });
- }
-
- return res.status(500).json({
- error: 'Server error',
- message: 'An error occurred while processing your booking. Please try again.'
- });
- }
-};
-
-// API endpoint để lấy thông tin session availability
-exports.getSessionAvailability = async (req, res) => {
- try {
- const { activityId, sessionId } = req.params;
-
- const activity = await Activity.findById(activityId);
- if (!activity) {
- return res.status(404).json({ error: 'Activity not found' });
- }
-
- const session = activity.bookingSessions?.find(s => s.sessionId === sessionId);
- if (!session) {
- return res.status(404).json({ error: 'Session not found' });
- }
-
- // Get current booking counts
- const maleBookings = await BookingSubmission.countDocuments({
- activityId,
- sessionId,
- participantGender: 'male',
- status: { $in: ['pending', 'confirmed'] }
- });
-
- const femaleBookings = await BookingSubmission.countDocuments({
- activityId,
- sessionId,
- participantGender: 'female',
- status: { $in: ['pending', 'confirmed'] }
- });
-
- return res.json({
- sessionId,
- isActive: session.isActive,
- startDate: session.startDate,
- endDate: session.endDate,
- overnightStays: session.overnightStays,
- price: session.price || activity.price,
- availability: {
- male: {
- total: session.totalMaleSpots,
- booked: maleBookings,
- available: Math.max(0, session.totalMaleSpots - maleBookings)
- },
- female: {
- total: session.totalFemaleSpots,
- booked: femaleBookings,
- available: Math.max(0, session.totalFemaleSpots - femaleBookings)
- }
- }
- });
-
- } catch (error) {
- console.error('getSessionAvailability error:', error);
- return res.status(500).json({ error: 'Error loading session availability' });
- }
-};
-
-// API endpoint để lấy tất cả sessions có sẵn cho một activity
-exports.getAvailableSessions = async (req, res) => {
- try {
- const { activityId } = req.params;
-
- const activity = await Activity.findById(activityId);
- if (!activity) {
- return res.status(404).json({ error: 'Activity not found' });
- }
-
- const sessions = activity.bookingSessions || [];
- const availableSessions = [];
-
- for (const session of sessions) {
- if (!session.isActive) continue;
-
- // Get current booking counts
- const maleBookings = await BookingSubmission.countDocuments({
- activityId,
- sessionId: session.sessionId,
- participantGender: 'male',
- status: { $in: ['pending', 'confirmed'] }
- });
-
- const femaleBookings = await BookingSubmission.countDocuments({
- activityId,
- sessionId: session.sessionId,
- participantGender: 'female',
- status: { $in: ['pending', 'confirmed'] }
- });
-
- const maleAvailable = Math.max(0, session.totalMaleSpots - maleBookings);
- const femaleAvailable = Math.max(0, session.totalFemaleSpots - femaleBookings);
-
- // Only include sessions that have available spots
- if (maleAvailable > 0 || femaleAvailable > 0) {
- availableSessions.push({
- sessionId: session.sessionId,
- startDate: session.startDate,
- endDate: session.endDate,
- overnightStays: session.overnightStays,
- price: session.price || activity.price,
- availability: {
- male: {
- total: session.totalMaleSpots,
- booked: maleBookings,
- available: maleAvailable
- },
- female: {
- total: session.totalFemaleSpots,
- booked: femaleBookings,
- available: femaleAvailable
- }
- }
- });
- }
- }
-
- return res.json({
- activityId,
- activityName: activity.name,
- sessions: availableSessions
- });
-
- } catch (error) {
- console.error('getAvailableSessions error:', error);
- return res.status(500).json({ error: 'Error loading available sessions' });
- }
-};
-
-// API endpoint để cập nhật booking submission
-exports.updateBookingSubmission = async (req, res) => {
- try {
- const { bookingId } = req.params;
- const updateData = req.body;
-
- // Find the booking
- let booking = await BookingSubmission.findById(bookingId);
-
- // If not found as a separate document, try to find it as an embedded booking in Activity.bookingSessions
- let activityContaining = null;
- let sessionIndex = -1;
- let bookingIndex = -1;
- if (!booking) {
- activityContaining = await Activity.findOne({ 'bookingSessions.bookingList._id': bookingId });
- if (!activityContaining) {
- return res.status(404).json({
- error: 'Booking not found',
- message: 'The booking submission does not exist'
- });
- }
-
- // locate the exact session and booking positions
- for (let si = 0; si < activityContaining.bookingSessions.length; si++) {
- const bl = activityContaining.bookingSessions[si].bookingList || [];
- const bi = bl.findIndex(b => b._id && b._id.toString() === bookingId.toString());
- if (bi !== -1) {
- sessionIndex = si;
- bookingIndex = bi;
- break;
- }
- }
-
- if (sessionIndex === -1 || bookingIndex === -1) {
- return res.status(404).json({ error: 'Booking not found', message: 'The booking submission does not exist' });
- }
-
- booking = activityContaining.bookingSessions[sessionIndex].bookingList[bookingIndex];
- }
-
- // Define allowed fields to update
- const allowedUpdates = [
- 'status',
- 'paymentStatus',
- 'paidAmount',
- 'totalAmount',
- 'adminNotes',
- 'emergencyContact',
- 'emergencyPhone',
- 'medicalConditions',
- 'dietaryRestrictions',
- 'specialRequests'
- ];
-
- // Build update object with only allowed fields
- const updateFields = {};
- for (const field of allowedUpdates) {
- if (updateData[field] !== undefined) {
- updateFields[field] = updateData[field];
- }
- }
-
- if (Object.keys(updateFields).length === 0) {
- return res.status(400).json({
- error: 'No valid fields to update',
- message: 'Please provide at least one valid field to update'
- });
- }
-
- // If booking is a separate document, update the BookingSubmission collection
- if (activityContaining === null) {
- const updatedBooking = await BookingSubmission.findByIdAndUpdate(
- bookingId,
- updateFields,
- { new: true, runValidators: true }
- ).populate('activityId', 'name price');
-
- return res.json({
- success: true,
- message: 'Booking updated successfully',
- booking: updatedBooking
- });
- }
-
- // Otherwise update the embedded booking in the Activity document
- const currentBooking = activityContaining.bookingSessions[sessionIndex].bookingList[bookingIndex];
-
- // Handle status updates and spot adjustments
- const newStatus = updateData.status || updateData.bookingStatus;
- const currentStatus = currentBooking.status || currentBooking.bookingStatus;
-
- // Apply allowed updates to the embedded booking
- const allowedEmbeddedUpdates = [
- 'status', 'bookingStatus', 'paymentStatus', 'paidAmount', 'totalAmount', 'adminNotes',
- 'emergencyContact', 'emergencyPhone', 'medicalConditions', 'dietaryRestrictions', 'specialRequests'
- ];
-
- for (const field of allowedEmbeddedUpdates) {
- if (updateData[field] !== undefined) {
- if (field === 'status') {
- activityContaining.bookingSessions[sessionIndex].bookingList[bookingIndex].status = updateData.status;
- activityContaining.bookingSessions[sessionIndex].bookingList[bookingIndex].bookingStatus = updateData.status;
- } else {
- activityContaining.bookingSessions[sessionIndex].bookingList[bookingIndex][field] = updateData[field];
- }
- }
- }
-
- // If status change affects spots, adjust counts
- if (newStatus && newStatus !== currentStatus) {
- const numberOfParticipants = currentBooking.numberOfParticipants || 1;
- const participantGender = currentBooking.participantGender;
-
- // If booking is being cancelled, free up spots
- if (newStatus === 'cancelled' && currentStatus !== 'cancelled') {
- if (participantGender === 'male') {
- activityContaining.bookingSessions[sessionIndex].bookedMaleSpots = Math.max(0, activityContaining.bookingSessions[sessionIndex].bookedMaleSpots - numberOfParticipants);
- } else if (participantGender === 'female') {
- activityContaining.bookingSessions[sessionIndex].bookedFemaleSpots = Math.max(0, activityContaining.bookingSessions[sessionIndex].bookedFemaleSpots - numberOfParticipants);
- }
- }
-
- // If restoring from cancelled, ensure capacity then book spots
- if (currentStatus === 'cancelled' && newStatus !== 'cancelled') {
- if (participantGender === 'male') {
- const totalMale = activityContaining.bookingSessions[sessionIndex].totalMaleSpots;
- const currentMale = activityContaining.bookingSessions[sessionIndex].bookedMaleSpots;
- if (currentMale + numberOfParticipants > totalMale) {
- return res.status(400).json({ error: "Not enough male spots available to restore this booking" });
- }
- activityContaining.bookingSessions[sessionIndex].bookedMaleSpots += numberOfParticipants;
- } else if (participantGender === 'female') {
- const totalFemale = activityContaining.bookingSessions[sessionIndex].totalFemaleSpots;
- const currentFemale = activityContaining.bookingSessions[sessionIndex].bookedFemaleSpots;
- if (currentFemale + numberOfParticipants > totalFemale) {
- return res.status(400).json({ error: "Not enough female spots available to restore this booking" });
- }
- activityContaining.bookingSessions[sessionIndex].bookedFemaleSpots += numberOfParticipants;
- }
- }
- }
-
- await activityContaining.save();
-
- return res.json({
- success: true,
- message: 'Embedded booking updated successfully',
- booking: activityContaining.bookingSessions[sessionIndex].bookingList[bookingIndex]
- });
-
- } catch (error) {
- console.error('updateBookingSubmission error:', error);
-
- // Handle validation errors
- if (error.name === 'ValidationError') {
- const validationErrors = Object.values(error.errors).map(err => err.message);
- return res.status(400).json({
- error: 'Validation failed',
- message: validationErrors.join(', ')
- });
- }
-
- return res.status(500).json({
- error: 'Server error',
- message: 'An error occurred while updating the booking'
- });
- }
-};
-
-// API endpoint để xóa booking submission
-exports.deleteBookingSubmission = async (req, res) => {
- try {
- const { bookingId } = req.params;
-
- // Find and delete the booking
- let booking = await BookingSubmission.findById(bookingId);
-
- // If not found in separate collection, try to delete embedded booking in Activity
- if (!booking) {
- const activityContaining = await Activity.findOne({ 'bookingSessions.bookingList._id': bookingId });
- if (!activityContaining) {
- return res.status(404).json({
- error: 'Booking not found',
- message: 'The booking submission does not exist'
- });
- }
-
- // locate session and booking
- let sessionIndex = -1;
- let bookingIndex = -1;
- for (let si = 0; si < activityContaining.bookingSessions.length; si++) {
- const bl = activityContaining.bookingSessions[si].bookingList || [];
- const bi = bl.findIndex(b => b._id && b._id.toString() === bookingId.toString());
- if (bi !== -1) {
- sessionIndex = si;
- bookingIndex = bi;
- break;
- }
- }
-
- if (sessionIndex === -1 || bookingIndex === -1) {
- return res.status(404).json({ error: 'Booking not found', message: 'The booking submission does not exist' });
- }
-
- const bookingToDelete = activityContaining.bookingSessions[sessionIndex].bookingList[bookingIndex];
-
- // Free up spots if booking is not cancelled
- if ((bookingToDelete.bookingStatus || bookingToDelete.status) !== 'cancelled') {
- const numberOfParticipants = bookingToDelete.numberOfParticipants || 1;
- const participantGender = bookingToDelete.participantGender;
-
- if (participantGender === 'male') {
- activityContaining.bookingSessions[sessionIndex].bookedMaleSpots = Math.max(0, activityContaining.bookingSessions[sessionIndex].bookedMaleSpots - numberOfParticipants);
- } else if (participantGender === 'female') {
- activityContaining.bookingSessions[sessionIndex].bookedFemaleSpots = Math.max(0, activityContaining.bookingSessions[sessionIndex].bookedFemaleSpots - numberOfParticipants);
- }
- }
-
- // Remove booking and save
- activityContaining.bookingSessions[sessionIndex].bookingList.splice(bookingIndex, 1);
- await activityContaining.save();
-
- return res.json({
- success: true,
- message: 'Embedded booking deleted successfully',
- booking: {
- id: bookingId,
- participantName: `${bookingToDelete.participantFirstName} ${bookingToDelete.participantLastName}`,
- email: bookingToDelete.email
- }
- });
- }
-
- // Store info for session spot adjustment
- const { activityId, sessionId, participantGender, numberOfParticipants } = booking;
-
- // Delete the booking
- await BookingSubmission.findByIdAndDelete(bookingId);
-
- // Update session booked spots (decrease the count)
- if (booking.status !== 'cancelled') {
- const updateField = participantGender === 'male'
- ? 'bookingSessions.$.bookedMaleSpots'
- : 'bookingSessions.$.bookedFemaleSpots';
-
- await Activity.updateOne(
- { _id: activityId, 'bookingSessions.sessionId': sessionId },
- { $inc: { [updateField]: -numberOfParticipants } }
- );
- }
-
- return res.json({
- success: true,
- message: 'Booking deleted successfully',
- booking: {
- id: bookingId,
- participantName: `${booking.participantFirstName} ${booking.participantLastName}`,
- email: booking.email
- }
- });
-
- } catch (error) {
- console.error('deleteBookingSubmission error:', error);
- return res.status(500).json({
- error: 'Server error',
- message: 'An error occurred while deleting the booking'
- });
- }
-};
\ No newline at end of file
diff --git a/controllers/certificateController.js b/controllers/certificateController.js
new file mode 100644
index 0000000..3d4f3f1
--- /dev/null
+++ b/controllers/certificateController.js
@@ -0,0 +1,161 @@
+const path = require('path');
+const Certificate = require('../models/certificate');
+const Department = require('../models/department');
+const Level = require('../models/level');
+const writeAuditLog = require('../audit/writeAuditLog');
+const AUDIT_ACTIONS = require('../constants/auditAction');
+
+function normalizePath(filePath) {
+ if (!filePath) return undefined;
+ return path.basename(filePath.replace(/\\/g, '/'));
+}
+
+// GET /admin/certificate
+exports.index = async (req, res) => {
+ try {
+ const { search, status } = req.query;
+ const filter = {};
+ if (search) {
+ filter.$or = [
+ { certification_number: { $regex: search, $options: 'i' } },
+ { student_name: { $regex: search, $options: 'i' } }
+ ];
+ }
+ if (status) filter.status = status;
+
+ const [certificates, departments, levels] = await Promise.all([
+ Certificate.find(filter).populate('department level').sort({ createdAt: -1 }),
+ Department.find(), Level.find()
+ ]);
+
+ res.render('admin/certificate/index', {
+ certificates, departments, levels, query: req.query,
+ user: req.session.user, layout: 'layouts/admin', title: 'Certificates'
+ });
+ } catch (err) {
+ console.error(err);
+ req.flash('error', 'Error loading certificates');
+ res.redirect('/admin/dashboard');
+ }
+};
+
+// GET /admin/certificate/create
+exports.createForm = async (req, res) => {
+ try {
+ const [departments, levels] = await Promise.all([Department.find(), Level.find()]);
+ res.render('admin/certificate/create', {
+ departments, levels, user: req.session.user,
+ layout: 'layouts/admin', title: 'Create Certificate'
+ });
+ } catch (err) {
+ req.flash('error', 'Error'); res.redirect('/admin/certificate');
+ }
+};
+
+// POST /admin/certificate/create
+exports.create = async (req, res) => {
+ try {
+ const data = { ...req.body };
+ const imgPath = req.files?.certificate_image?.[0]?.path;
+ if (imgPath) data.certificate_image = normalizePath(imgPath);
+
+ const cert = new Certificate(data);
+ await cert.save();
+ await writeAuditLog({ model: 'Certificate', documentId: cert._id, action: AUDIT_ACTIONS.CREATE_CERTIFICATE, before: null, after: cert.toObject(), req });
+
+ req.flash('success', 'Certificate created');
+ res.redirect('/admin/certificate');
+ } catch (err) {
+ console.error(err);
+ try {
+ const [departments, levels] = await Promise.all([Department.find(), Level.find()]);
+ res.render('admin/certificate/create', {
+ error: err.message, formData: req.body, departments, levels,
+ user: req.session.user, layout: 'layouts/admin', title: 'Create Certificate'
+ });
+ } catch { req.flash('error', err.message); res.redirect('/admin/certificate'); }
+ }
+};
+
+// GET /admin/certificate/:id/edit
+exports.editForm = async (req, res) => {
+ try {
+ const cert = await Certificate.findById(req.params.id).populate('department level');
+ if (!cert) { req.flash('error', 'Not found'); return res.redirect('/admin/certificate'); }
+ const [departments, levels] = await Promise.all([Department.find(), Level.find()]);
+ res.render('admin/certificate/edit', {
+ cert, departments, levels, user: req.session.user,
+ layout: 'layouts/admin', title: 'Edit Certificate'
+ });
+ } catch (err) {
+ req.flash('error', 'Error'); res.redirect('/admin/certificate');
+ }
+};
+
+// POST /admin/certificate/:id/edit
+exports.update = async (req, res) => {
+ try {
+ const cert = await Certificate.findById(req.params.id);
+ if (!cert) { req.flash('error', 'Not found'); return res.redirect('/admin/certificate'); }
+ const before = cert.toObject();
+
+ const fields = ['certification_number','student_name','program_name','department','level',
+ 'issued_date','status','passport_number','address'];
+ fields.forEach(f => { if (req.body[f] !== undefined) cert[f] = req.body[f]; });
+
+ const imgPath = req.files?.certificate_image?.[0]?.path;
+ if (imgPath) cert.certificate_image = normalizePath(imgPath);
+
+ await cert.save();
+ await writeAuditLog({ model: 'Certificate', documentId: cert._id, action: AUDIT_ACTIONS.UPDATE_CERTIFICATE, before, after: cert.toObject(), req });
+
+ req.flash('success', 'Certificate updated');
+ res.redirect('/admin/certificate');
+ } catch (err) {
+ req.flash('error', err.message); res.redirect('back');
+ }
+};
+
+// POST /admin/certificate/:id/delete
+exports.destroy = async (req, res) => {
+ try {
+ const cert = await Certificate.findById(req.params.id);
+ if (!cert) { req.flash('error', 'Not found'); return res.redirect('/admin/certificate'); }
+ await writeAuditLog({ model: 'Certificate', documentId: cert._id, action: AUDIT_ACTIONS.DELETE_CERTIFICATE, before: cert.toObject(), after: null, req });
+ await cert.deleteOne();
+ req.flash('success', 'Certificate deleted');
+ res.redirect('/admin/certificate');
+ } catch (err) {
+ req.flash('error', 'Error deleting'); res.redirect('/admin/certificate');
+ }
+};
+
+// GET /api/verify-certificate/:cert_id?api_key=xxx
+exports.apiVerify = async (req, res) => {
+ try {
+ const cert = await Certificate.findOne({
+ certification_number: { $regex: new RegExp('^' + req.params.cert_id + '$', 'i') }
+ }).populate('department level');
+
+ if (!cert) return res.status(404).json({ error: 'Certificate not found' });
+ if (cert.status === 'revoked') return res.status(404).json({ error: 'Certificate has been revoked' });
+
+ const baseUrl = `${req.protocol}://${req.get('host')}`;
+ const buildUrl = (f) => f ? [`${baseUrl}/secure-files/${path.basename(f)}?api_key=${req.query.api_key}`] : undefined;
+
+ const response = {
+ full_name: cert.student_name,
+ certification_title: cert.program_name,
+ certificate_id: cert.certification_number,
+ };
+ if (cert.passport_number) response.passport_number = cert.passport_number;
+ if (cert.address) response.address = cert.address;
+ const imgs = buildUrl(cert.certificate_image);
+ if (imgs) response.certificate_image = imgs;
+
+ return res.json(response);
+ } catch (err) {
+ console.error(err);
+ return res.status(500).json({ error: 'Internal server error' });
+ }
+};
diff --git a/controllers/contactController.js b/controllers/contactController.js
deleted file mode 100644
index ecd4ea3..0000000
--- a/controllers/contactController.js
+++ /dev/null
@@ -1,388 +0,0 @@
-const { addBaseUrlToImages } = require("../utils/imageHelper");
-const Contact = require("../models/contact");
-const ContactSubmission = require("../models/contactSubmission");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// Get contact data from MongoDB
-const getContactData = async () => {
- const contact = await Contact.findOne({ name: "default" });
- if (!contact) {
- return null;
- }
- return contact.toObject();
-};
-
-// API to get contact data
-exports.api = async (req, res) => {
- try {
- const contact = await getContactData();
- if (!contact) {
- return res.status(404).json({ error: "Contact data not found" });
- }
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(contact, baseUrl);
- res.json(processedData);
- } catch (err) {
- console.error("API Error:", err);
- res.status(500).json({ error: "Error loading contact data" });
- }
-};
-
-// API để lấy toàn bộ contact data
-exports.getContactData = async (req, res) => {
- try {
- const contactData = await getContactData();
- if (!contactData) {
- return res.status(404).json({ error: "Contact data not found" });
- }
- res.json(contactData);
- } catch (error) {
- console.error("Error getting contact data:", error);
- res.status(500).json({ error: "Error loading contact data" });
- }
-};
-
-// Render admin view
-exports.index = async (req, res) => {
- try {
- const data = (await getContactData()) || {
- hero: {
- title: "Contact Us",
- backgroundImage: "",
- overlayColor: "rgba(0, 0, 0, 0)",
- sectionClass: "",
- titleClass: "",
- enableScrollspy: false,
- backgroundPosition: "center",
- },
- contactCards: [],
- map: {
- coordinates: { lat: 0, lng: 0 },
- zoom: 15,
- location: "",
- markerTitle: "",
- embedUrl: "",
- tileLayer: {
- url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
- attribution: "",
- maxZoom: 18,
- minZoom: 0,
- },
- },
- form: {
- sectionLabel: "",
- heading: "",
- description: "",
- fields: [],
- submitButton: {
- text: "Send Message",
- icon: "fa-solid fa-arrow-right",
- buttonClass: "theme-btn style-2",
- },
- },
- };
-
- const { startDate, endDate } = req.query;
- const query = {};
-
- if (startDate || endDate) {
- query.createdAt = {};
- if (startDate) {
- query.createdAt.$gte = new Date(startDate);
- }
- if (endDate) {
- // Set end date to end of day
- const end = new Date(endDate);
- end.setHours(23, 59, 59, 999);
- query.createdAt.$lte = end;
- }
- }
-
- const submissions = await ContactSubmission.find(query)
- .sort({ createdAt: -1 })
- .limit(50);
- const frontendUrl = process.env.FRONTEND_URL;
-
- res.render("admin/contact/index", {
- title: "Contact Management",
- layout: "layouts/main",
- data,
- submissions,
- startDate,
- endDate,
- frontendUrl,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (error) {
- console.error("Error in contact index:", error);
- req.flash("error_msg", "An error occurred while loading the page");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Cập nhật dữ liệu contact
-exports.update = async (req, res) => {
- try {
- const { hero, contactCards, map, form } = req.body;
-
- // Parse JSON strings nếu cần
- const parseJson = (data) => {
- if (!data) return null;
- if (typeof data === "string") {
- try {
- return JSON.parse(data);
- } catch (e) {
- return null;
- }
- }
- return data;
- };
-
- const heroData = parseJson(hero);
- const contactCardsData = parseJson(contactCards);
- const mapData = parseJson(map);
- const formData = parseJson(form);
-
- // Tìm hoặc tạo contact
- let contact = await Contact.findOne({ name: "default" });
-
- // ✅ Capture BEFORE state
- const beforeData = contact
- ? JSON.parse(JSON.stringify(contact.toObject()))
- : {};
-
- if (!contact) {
- // Tạo mới với default values
- contact = new Contact({
- name: "default",
- hero: heroData || {
- title: "Contact Us",
- backgroundImage: "",
- overlayColor: "rgba(0, 0, 0, 0)",
- sectionClass: "",
- titleClass: "",
- enableScrollspy: false,
- backgroundPosition: "center",
- },
- contactCards: (contactCardsData || []).map((card) => ({
- ...card,
- iconType: card.iconType || "",
- iconSource:
- card.iconSource ||
- (card.iconType && card.iconType.startsWith("/uploads/")
- ? "image"
- : "fontawesome"),
- })),
- map: mapData || {
- coordinates: { lat: 0, lng: 0 },
- zoom: 15,
- location: "",
- markerTitle: "",
- embedUrl: "",
- tileLayer: {
- url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
- attribution: "",
- maxZoom: 18,
- minZoom: 0,
- },
- },
- form: formData || {
- sectionLabel: "",
- heading: "",
- description: "",
- fields: [],
- submitButton: {
- text: "Send Message",
- icon: "fa-solid fa-arrow-right",
- buttonClass: "theme-btn style-2",
- },
- },
- });
- } else {
- // Cập nhật dữ liệu
- if (heroData) contact.hero = heroData;
- if (contactCardsData && Array.isArray(contactCardsData)) {
- // Đảm bảo mỗi card có iconType và iconSource
- contact.contactCards = contactCardsData.map((card) => ({
- ...card,
- iconType: card.iconType || "",
- iconSource:
- card.iconSource ||
- (card.iconType && card.iconType.startsWith("/uploads/")
- ? "image"
- : "fontawesome"),
- }));
- }
- if (mapData) contact.map = mapData;
- if (formData) contact.form = formData;
- }
-
- await contact.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(contact.toObject()));
-
- // ✅ AUDIT LOGGING - Contact Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Contact",
- documentId: contact._id,
- action: AUDIT_ACTIONS.UPDATE_CONTACT,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash("success_msg", "Contact updated successfully");
- res.redirect("/admin/contact");
- } catch (err) {
- console.error("Error updating contact:", err);
- req.flash("error_msg", err.message || "Error updating contact");
- res.redirect("/admin/contact");
- }
-};
-
-// API để submit contact form (từ frontend)
-exports.submitForm = async (req, res) => {
- try {
- const { name, email, phone, address, date, message } = req.body;
-
- // Validation
- if (!name || !email) {
- return res.status(400).json({
- success: false,
- error: "Name and email are required",
- });
- }
-
- // Create new submission
- const submission = new ContactSubmission({
- name: name.trim(),
- email: email.trim().toLowerCase(),
- phone: phone?.trim() || "",
- address: address?.trim() || "",
- date: date?.trim() || "",
- message: message?.trim() || "",
- ipAddress: req.ip || req.connection?.remoteAddress || "",
- userAgent: req.get("User-Agent") || "",
- });
-
- await submission.save();
-
- res.status(201).json({
- success: true,
- message: "Thank you for contacting us! We will get back to you soon.",
- data: {
- id: submission._id,
- name: submission.name,
- email: submission.email,
- },
- });
- } catch (err) {
- console.error("Error submitting contact form:", err);
-
- // Handle validation errors
- if (err.name === "ValidationError") {
- const errors = Object.values(err.errors).map((e) => e.message);
- return res.status(400).json({
- success: false,
- error: errors.join(", "),
- });
- }
-
- res.status(500).json({
- success: false,
- error: "Error submitting form. Please try again later.",
- });
- }
-};
-
-// API để lấy danh sách submissions (cho admin)
-exports.getSubmissions = async (req, res) => {
- try {
- const { status, page = 1, limit = 20 } = req.query;
-
- const query = {};
- if (status && ["pending", "read", "replied", "archived"].includes(status)) {
- query.status = status;
- }
-
- const skip = (parseInt(page) - 1) * parseInt(limit);
-
- const [submissions, total] = await Promise.all([
- ContactSubmission.find(query)
- .sort({ createdAt: -1 })
- .skip(skip)
- .limit(parseInt(limit)),
- ContactSubmission.countDocuments(query),
- ]);
-
- res.json({
- success: true,
- data: submissions,
- pagination: {
- page: parseInt(page),
- limit: parseInt(limit),
- total,
- totalPages: Math.ceil(total / parseInt(limit)),
- },
- });
- } catch (err) {
- console.error("Error getting submissions:", err);
- res.status(500).json({
- success: false,
- error: "Error loading submissions",
- });
- }
-};
-
-// API để cập nhật status của submission
-exports.updateSubmissionStatus = async (req, res) => {
- try {
- const { id } = req.params;
- const { status, notes } = req.body;
-
- const validStatuses = ["pending", "read", "replied", "archived"];
- if (!validStatuses.includes(status)) {
- return res.status(400).json({
- success: false,
- error: "Invalid status",
- });
- }
-
- const updateData = { status };
- if (notes !== undefined) updateData.notes = notes;
- if (status === "replied") updateData.repliedAt = new Date();
-
- const submission = await ContactSubmission.findByIdAndUpdate(
- id,
- updateData,
- { new: true },
- );
-
- if (!submission) {
- return res.status(404).json({
- success: false,
- error: "Submission not found",
- });
- }
-
- res.json({
- success: true,
- data: submission,
- });
- } catch (err) {
- console.error("Error updating submission:", err);
- res.status(500).json({
- success: false,
- error: "Error updating submission",
- });
- }
-};
diff --git a/controllers/dashboardController.js b/controllers/dashboardController.js
index 3677f24..ea718be 100644
--- a/controllers/dashboardController.js
+++ b/controllers/dashboardController.js
@@ -1,17 +1,54 @@
-const { readJsonFile } = require('../utils/jsonHelper');
+const Qualification = require('../models/qualification');
+const Certificate = require('../models/certificate');
-// Hiển thị dashboard
exports.getDashboard = async (req, res) => {
try {
+ const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
+
+ const [
+ qualificationCount,
+ certificationCount,
+ activeQual,
+ revokedQual,
+ activeCert,
+ revokedCert,
+ recentQual,
+ recentCert,
+ recentQualifications,
+ recentCertificates
+ ] = await Promise.all([
+ Qualification.countDocuments(),
+ Certificate.countDocuments(),
+ Qualification.countDocuments({ status: 'active' }),
+ Qualification.countDocuments({ status: 'revoked' }),
+ Certificate.countDocuments({ status: 'active' }),
+ Certificate.countDocuments({ status: 'revoked' }),
+ Qualification.countDocuments({ createdAt: { $gte: thirtyDaysAgo } }),
+ Certificate.countDocuments({ createdAt: { $gte: thirtyDaysAgo } }),
+ Qualification.find().sort({ createdAt: -1 }).limit(5).populate('department level'),
+ Certificate.find().sort({ createdAt: -1 }).limit(5).populate('department level')
+ ]);
+
res.render('admin/dashboard', {
- title: 'Dashboard',
- user: req.session.user
+ qualificationCount,
+ certificationCount,
+ total: qualificationCount + certificationCount,
+ activeCount: activeQual + activeCert,
+ revokedCount: revokedQual + revokedCert,
+ recentCount: recentQual + recentCert,
+ recentQualifications,
+ recentCertificates,
+ user: req.session.user,
+ layout: 'layouts/admin',
+ title: 'Dashboard'
});
} catch (err) {
console.error(err);
res.render('admin/dashboard', {
- title: 'Dashboard',
- user: req.session.user
+ qualificationCount: 0, certificationCount: 0,
+ total: 0, activeCount: 0, revokedCount: 0, recentCount: 0,
+ recentQualifications: [], recentCertificates: [],
+ user: req.session.user, layout: 'layouts/admin', title: 'Dashboard'
});
}
-};
\ No newline at end of file
+};
diff --git a/controllers/degreeController.js b/controllers/degreeController.js
new file mode 100644
index 0000000..b3eb5ea
--- /dev/null
+++ b/controllers/degreeController.js
@@ -0,0 +1,261 @@
+const path = require('path');
+const Degree = require('../models/degree');
+const Department = require('../models/department');
+const Level = require('../models/level');
+const writeAuditLog = require('../audit/writeAuditLog');
+const AUDIT_ACTIONS = require('../constants/auditAction');
+
+// Helper: store only filename, served via /secure-files/ route
+function normalizePath(filePath) {
+ if (!filePath) return undefined;
+ return path.basename(filePath.replace(/\\/g, '/'));
+}
+
+// GET /admin/degree
+exports.index = async (req, res) => {
+ try {
+ const { search, type, department, level, status } = req.query;
+ const filter = {};
+ if (search) {
+ filter.$or = [
+ { qualification_number: { $regex: search, $options: 'i' } },
+ { certification_number: { $regex: search, $options: 'i' } },
+ { student_name: { $regex: search, $options: 'i' } }
+ ];
+ }
+ if (type) filter.type = type;
+ if (department) filter.department = department;
+ if (level) filter.level = level;
+ if (status) filter.status = status;
+
+ const [degrees, departments, levels] = await Promise.all([
+ Degree.find(filter).populate('department level').sort({ createdAt: -1 }),
+ Department.find(),
+ Level.find()
+ ]);
+
+ res.render('admin/degree/index', {
+ degrees, departments, levels,
+ query: req.query,
+ user: req.session.user,
+ layout: 'layouts/admin',
+ title: 'Quản lý Văn bằng'
+ });
+ } catch (err) {
+ console.error('degreeController.index error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi tải danh sách văn bằng');
+ res.redirect('/admin/dashboard');
+ }
+};
+
+// GET /admin/degree/create
+exports.createForm = async (req, res) => {
+ try {
+ const [departments, levels] = await Promise.all([Department.find(), Level.find()]);
+ res.render('admin/degree/create', {
+ departments, levels,
+ user: req.session.user,
+ layout: 'layouts/admin',
+ title: 'Tạo Văn bằng mới'
+ });
+ } catch (err) {
+ console.error('degreeController.createForm error:', err);
+ req.flash('error', 'Đã xảy ra lỗi');
+ res.redirect('/admin/degree');
+ }
+};
+
+// POST /admin/degree/create
+exports.create = async (req, res) => {
+ try {
+ const degreeData = { ...req.body };
+ const degreeImagePath = req.files?.degree_image?.[0]?.path;
+ const certificateImagePath = req.files?.certificate_image?.[0]?.path;
+ if (degreeImagePath) degreeData.degree_image = normalizePath(degreeImagePath);
+ if (certificateImagePath) degreeData.certificate_image = normalizePath(certificateImagePath);
+
+ const degree = new Degree(degreeData);
+ await degree.save();
+
+ await writeAuditLog({
+ model: 'Degree', documentId: degree._id,
+ action: AUDIT_ACTIONS.CREATE_DEGREE,
+ before: null, after: degree.toObject(), req
+ });
+
+ req.flash('success', 'Degree created');
+ res.redirect('/admin/degree');
+ } catch (err) {
+ console.error('degreeController.create error:', err);
+ try {
+ const [departments, levels] = await Promise.all([Department.find(), Level.find()]);
+ res.render('admin/degree/create', {
+ error: err.message, formData: req.body,
+ departments, levels,
+ user: req.session.user,
+ layout: 'layouts/admin',
+ title: 'Tạo Văn bằng mới'
+ });
+ } catch (renderErr) {
+ req.flash('error', err.message);
+ res.redirect('/admin/degree');
+ }
+ }
+};
+
+// GET /admin/degree/:id/edit
+exports.editForm = async (req, res) => {
+ try {
+ const degree = await Degree.findById(req.params.id).populate('department level');
+ if (!degree) {
+ req.flash('error', 'Degree not found');
+ return res.redirect('/admin/degree');
+ }
+ const [departments, levels] = await Promise.all([Department.find(), Level.find()]);
+ res.render('admin/degree/edit', {
+ degree, departments, levels,
+ user: req.session.user,
+ layout: 'layouts/admin',
+ title: 'Chỉnh sửa Văn bằng'
+ });
+ } catch (err) {
+ console.error('degreeController.editForm error:', err);
+ req.flash('error', 'Đã xảy ra lỗi');
+ res.redirect('/admin/degree');
+ }
+};
+
+// POST /admin/degree/:id/edit
+exports.update = async (req, res) => {
+ try {
+ const degree = await Degree.findById(req.params.id);
+ if (!degree) {
+ req.flash('error', 'Degree not found');
+ return res.redirect('/admin/degree');
+ }
+ const beforeData = degree.toObject();
+ const fields = [
+ 'qualification_number', 'certification_number', 'student_name', 'program_name',
+ 'type', 'department', 'level', 'issued_date', 'status',
+ 'passport_number', 'address', 'topic_name', 'topic_short_desc'
+ ];
+ fields.forEach(field => { if (req.body[field] !== undefined) degree[field] = req.body[field]; });
+
+ const degreeImagePath = req.files?.degree_image?.[0]?.path;
+ const certificateImagePath = req.files?.certificate_image?.[0]?.path;
+ if (degreeImagePath) degree.degree_image = normalizePath(degreeImagePath);
+ if (certificateImagePath) degree.certificate_image = normalizePath(certificateImagePath);
+
+ await degree.save();
+ await writeAuditLog({
+ model: 'Degree', documentId: degree._id,
+ action: AUDIT_ACTIONS.UPDATE_DEGREE,
+ before: beforeData, after: degree.toObject(), req
+ });
+
+ req.flash('success', 'Degree updated');
+ res.redirect('/admin/degree');
+ } catch (err) {
+ console.error('degreeController.update error:', err);
+ req.flash('error', err.message);
+ res.redirect('back');
+ }
+};
+
+// POST /admin/degree/:id/delete
+exports.destroy = async (req, res) => {
+ try {
+ const degree = await Degree.findById(req.params.id);
+ if (!degree) {
+ req.flash('error', 'Degree not found');
+ return res.redirect('/admin/degree');
+ }
+ await writeAuditLog({
+ model: 'Degree', documentId: degree._id,
+ action: AUDIT_ACTIONS.DELETE_DEGREE,
+ before: degree.toObject(), after: null, req
+ });
+ await degree.deleteOne();
+ req.flash('success', 'Degree deleted');
+ res.redirect('/admin/degree');
+ } catch (err) {
+ console.error('degreeController.destroy error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi xóa văn bằng');
+ res.redirect('/admin/degree');
+ }
+};
+
+// ─── Public API ───────────────────────────────────────────────────────────────
+
+function buildSecureUrl(req, filename) {
+ if (!filename) return undefined;
+ const baseUrl = `${req.protocol}://${req.get('host')}`;
+ const name = path.basename(filename);
+ return `${baseUrl}/secure-files/${name}?api_key=${req.query.api_key}`;
+}
+
+// GET /api/verify-degree/:degree_id?api_key=xxx
+// Lookup by qualification_number — returns degree fields + topic_name if PhD
+exports.apiGetByQualification = async (req, res) => {
+ try {
+ const degree = await Degree.findOne({
+ qualification_number: { $regex: new RegExp('^' + req.params.degree_id + '$', 'i') }
+ }).populate('department level');
+
+ if (!degree) return res.status(404).json({ error: 'Degree not found' });
+ if (degree.status === 'revoked') return res.status(404).json({ error: 'Degree has been revoked' });
+
+ const imageUrl = buildSecureUrl(req, degree.degree_image);
+
+ const response = {
+ full_name: degree.student_name,
+ program_name: degree.program_name,
+ degree_id: degree.qualification_number,
+ };
+
+ if (degree.passport_number) response.passport_number = degree.passport_number;
+ if (degree.address) response.address = degree.address;
+ if (imageUrl) response.degree_image = [imageUrl];
+
+ // topic_name present → PhD view; absent → MBA/Master view
+ if (degree.topic_name) {
+ response.topic_name = degree.topic_name;
+ if (degree.topic_short_desc) response.topic_short_desc = degree.topic_short_desc;
+ }
+
+ return res.json(response);
+ } catch (err) {
+ console.error('apiGetByQualification error:', err);
+ return res.status(500).json({ error: 'Internal server error' });
+ }
+};
+
+// GET /api/verify-certificate/:cert_id?api_key=xxx
+// Lookup by certification_number — returns certificate fields (no topic_name)
+exports.apiGetByCertification = async (req, res) => {
+ try {
+ const degree = await Degree.findOne({
+ certification_number: { $regex: new RegExp('^' + req.params.cert_id + '$', 'i') }
+ }).populate('department level');
+
+ if (!degree) return res.status(404).json({ error: 'Certificate not found' });
+ if (degree.status === 'revoked') return res.status(404).json({ error: 'Certificate has been revoked' });
+
+ const imageUrl = buildSecureUrl(req, degree.certificate_image);
+
+ const response = {
+ full_name: degree.student_name,
+ certification_title: degree.program_name,
+ certificate_id: degree.certification_number,
+ };
+
+ if (degree.passport_number) response.passport_number = degree.passport_number;
+ if (degree.address) response.address = degree.address;
+ if (imageUrl) response.certificate_image = [imageUrl];
+
+ return res.json(response);
+ } catch (err) {
+ console.error('apiGetByCertification error:', err);
+ return res.status(500).json({ error: 'Internal server error' });
+ }
+};
diff --git a/controllers/departmentController.js b/controllers/departmentController.js
new file mode 100644
index 0000000..385e2b7
--- /dev/null
+++ b/controllers/departmentController.js
@@ -0,0 +1,79 @@
+const Department = require('../models/department');
+const Degree = require('../models/degree');
+
+// GET /admin/department
+exports.index = async (req, res) => {
+ try {
+ const departments = await Department.find();
+ res.render('admin/department/index', {
+ departments,
+ user: req.session.user,
+ layout: 'layouts/admin',
+ title: 'Quản lý Khoa/Bộ môn'
+ });
+ } catch (err) {
+ console.error('departmentController.index error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi tải danh sách khoa/bộ môn');
+ res.redirect('/admin/dashboard');
+ }
+};
+
+// POST /admin/department/create
+exports.create = async (req, res) => {
+ try {
+ const { name } = req.body;
+ const slug = name.toLowerCase().trim().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
+
+ const existing = await Department.findOne({ slug });
+ if (existing) {
+ req.flash('error', 'Department already exists');
+ return res.redirect('back');
+ }
+
+ await Department.create({ name, slug });
+ req.flash('success', 'Department created');
+ res.redirect('/admin/department');
+ } catch (err) {
+ console.error('departmentController.create error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi tạo khoa/bộ môn');
+ res.redirect('back');
+ }
+};
+
+// POST /admin/department/:id/edit
+exports.update = async (req, res) => {
+ try {
+ const { id } = req.params;
+ const { name } = req.body;
+ const slug = name.toLowerCase().trim().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
+
+ await Department.findByIdAndUpdate(id, { name, slug });
+ req.flash('success', 'Department updated');
+ res.redirect('/admin/department');
+ } catch (err) {
+ console.error('departmentController.update error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi cập nhật khoa/bộ môn');
+ res.redirect('back');
+ }
+};
+
+// POST /admin/department/:id/delete
+exports.destroy = async (req, res) => {
+ try {
+ const { id } = req.params;
+ const count = await Degree.countDocuments({ department: id });
+
+ if (count > 0) {
+ req.flash('error', 'Cannot delete: Department is referenced by existing degrees');
+ return res.redirect('back');
+ }
+
+ await Department.findByIdAndDelete(id);
+ req.flash('success', 'Department deleted');
+ res.redirect('/admin/department');
+ } catch (err) {
+ console.error('departmentController.destroy error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi xóa khoa/bộ môn');
+ res.redirect('back');
+ }
+};
diff --git a/controllers/faqController.js b/controllers/faqController.js
deleted file mode 100644
index ffec4b7..0000000
--- a/controllers/faqController.js
+++ /dev/null
@@ -1,154 +0,0 @@
-const Home = require("../models/home");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// Helper to get FAQ data from Home model
-const getFaqData = async () => {
- const home = await Home.findOne().sort({ updatedAt: -1 });
- if (!home || !home.faq) {
- return {
- heading: "",
- subheading: "",
- description: "",
- items: [],
- ctaButton: { label: "", href: "" },
- };
- }
- return home.faq.toObject ? home.faq.toObject() : home.faq;
-};
-
-// API to get FAQ data for frontend
-exports.api = async (req, res) => {
- try {
- const faqData = await getFaqData();
- return res.json(faqData);
- } catch (err) {
- console.error("API Error:", err);
- res.status(500).json({ error: "Error loading FAQ data" });
- }
-};
-
-// Method for legacy route compatibility or internal use
-exports.getFAQData = async (req, res) => {
- return exports.api(req, res);
-};
-
-// Render admin view
-exports.index = async (req, res) => {
- try {
- const data = await getFaqData();
- // Ensure default structure if data is partial
- const safeData = {
- heading: data.heading || "",
- subheading: data.subheading || "",
- description: data.description || "",
- ctaButton: data.ctaButton || { label: "", href: "" },
- items: data.items || [],
- };
-
- const frontendUrl = process.env.FRONTEND_URL;
-
- res.render("admin/home/faq/index", {
- title: "FAQ Section Management",
- layout: "layouts/main",
- data: safeData,
- frontendUrl,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (error) {
- console.error("Error in FAQ index:", error);
- req.flash("error_msg", "An error occurred while loading the page");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Update FAQ data
-exports.update = async (req, res) => {
- try {
- const { heading, subheading, description, ctaLabel, ctaHref, items } =
- req.body;
-
- let parsedItems = [];
- if (items) {
- try {
- parsedItems = typeof items === "string" ? JSON.parse(items) : items;
- } catch (e) {
- console.error("Error parsing items JSON:", e);
- parsedItems = [];
- }
- }
-
- let home = await Home.findOne().sort({ updatedAt: -1 });
- if (!home) {
- home = new Home({});
- }
-
- // ✅ Capture BEFORE state
- const beforeData = home.faq
- ? JSON.parse(
- JSON.stringify(home.faq.toObject ? home.faq.toObject() : home.faq),
- )
- : {};
-
- const updatedFaqData = {
- heading: heading || "",
- subheading: subheading || "",
- description: description || "",
- ctaButton: {
- label: ctaLabel || "",
- href: ctaHref || "",
- },
- items: parsedItems.map((item) => ({
- question: item.question || "",
- answer: item.answer || "",
- })),
- };
-
- home.faq = updatedFaqData;
- await home.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(updatedFaqData));
-
- // ✅ AUDIT LOGGING - FAQ Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Home",
- documentId: home._id,
- action: AUDIT_ACTIONS.UPDATE_FAQ,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash("success_msg", "FAQ section updated successfully");
- res.redirect("/admin/home/faq");
- } catch (err) {
- console.error("Error updating FAQ:", err);
- req.flash("error_msg", err.message || "Error updating FAQ");
- res.redirect("/admin/home/faq");
- }
-};
-
-// Placeholder methods to prevent route crashes if routes are not cleaned up immediately
-exports.addFAQ = (req, res) =>
- res.status(404).json({ error: "Endpoint deprecated" });
-exports.updateFAQItem = (req, res) =>
- res.status(404).json({ error: "Endpoint deprecated" });
-exports.deleteFAQItem = (req, res) =>
- res.status(404).json({ error: "Endpoint deprecated" });
-exports.addFAQSection = (req, res) =>
- res.status(404).json({ error: "Endpoint deprecated" });
-exports.updateFAQSection = (req, res) =>
- res.status(404).json({ error: "Endpoint deprecated" });
-exports.deleteFAQSection = (req, res) =>
- res.status(404).json({ error: "Endpoint deprecated" });
-exports.reorderFAQSection = (req, res) =>
- res.status(404).json({ error: "Endpoint deprecated" });
-exports.updateSidebarNav = (req, res) =>
- res.status(404).json({ error: "Endpoint deprecated" });
diff --git a/controllers/footerController.js b/controllers/footerController.js
deleted file mode 100644
index 3f0212e..0000000
--- a/controllers/footerController.js
+++ /dev/null
@@ -1,169 +0,0 @@
-const { addBaseUrlToImages } = require("../utils/imageHelper");
-const Footer = require("../models/footer");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// GET /api/footer - Public API cho website và CMS load dữ liệu
-exports.getFooter = async (req, res) => {
- try {
- const footer = await Footer.getSingle();
- const processedData = addBaseUrlToImages(footer.toObject());
-
- res.json(processedData);
- } catch (error) {
- console.error("Error getting footer:", error);
- res.status(500).json({
- error: "Failed to get footer data",
- });
- }
-};
-
-// PUT /api/admin/footer - Update toàn bộ footer cho CMS
-exports.updateFooter = async (req, res) => {
- try {
- let updateData = req.body;
-
- console.log("=== FOOTER UPDATE REQUEST RECEIVED ===");
- console.log("Raw body:", JSON.stringify(req.body, null, 2));
-
- // Nếu có footerJson, parse nó (tương tự Header logic)
- if (updateData.footerJson && typeof updateData.footerJson === "string") {
- try {
- const parsedData = JSON.parse(updateData.footerJson);
- console.log("✓ Parsed footerJson successfully:", parsedData);
- updateData = parsedData;
- } catch (e) {
- console.error("✗ Error parsing footerJson:", e.message);
- return res.status(400).json({
- success: false,
- message: "Invalid JSON in footerJson: " + e.message,
- });
- }
- }
-
- // Lấy footer hiện tại hoặc tạo mới (giống Header logic)
- let footer = await Footer.findOne();
-
- if (!footer) {
- console.log("No existing footer found, creating new one");
- footer = new Footer(updateData);
- await footer.save();
- console.log("✓ Footer created:", footer._id);
- } else {
- console.log("✓ Found existing footer:", footer._id);
- // Merge với dữ liệu cũ thay vì overwrite (giống Header)
- Object.assign(footer, updateData);
- await footer.save();
- console.log("✓ Footer updated successfully");
- }
-
- const processedData = addBaseUrlToImages(footer.toObject());
-
- console.log("Updated footer data:", JSON.stringify(processedData, null, 2));
-
- res.json({
- success: true,
- message: "Footer updated successfully",
- data: processedData,
- });
- } catch (error) {
- console.error("✗ Error updating footer:", error);
- res.status(500).json({
- success: false,
- error: "Failed to update footer: " + error.message,
- });
- }
-};
-
-// Render admin view (giữ lại cho UI hiện tại)
-exports.index = async (req, res) => {
- try {
- const data = await Footer.getSingle();
- const processedData = addBaseUrlToImages(data.toObject());
-
- res.render("admin/footer/index", {
- title: "Footer Management",
- data: processedData,
- });
- } catch (error) {
- console.error("Error in footer index:", error);
- req.flash("error_msg", "An error occurred while loading the page");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Update method cho form hiện tại (giống Header pattern)
-exports.update = async (req, res) => {
- try {
- let updateData = req.body;
-
- console.log("=== FOOTER FORM UPDATE REQUEST RECEIVED ===");
- console.log("Raw body:", JSON.stringify(req.body, null, 2));
-
- // Nếu có footerJson, parse nó (giống Header logic)
- if (updateData.footerJson && typeof updateData.footerJson === "string") {
- try {
- const parsedData = JSON.parse(updateData.footerJson);
- console.log("✓ Parsed footerJson successfully:", parsedData);
- updateData = parsedData;
- } catch (e) {
- console.error("✗ Error parsing footerJson:", e.message);
- req.flash("error_msg", "Invalid JSON in footerJson: " + e.message);
- return res.redirect("/admin/footer");
- }
- }
-
- // Lấy footer hiện tại hoặc tạo mới (giống Header)
- let footer = await Footer.findOne();
-
- // ✅ Capture BEFORE state
- const beforeData = footer
- ? JSON.parse(JSON.stringify(footer.toObject()))
- : {};
-
- if (!footer) {
- console.log("No existing footer found, creating new one");
- footer = new Footer(updateData);
- await footer.save();
- console.log("✓ Footer created:", footer._id);
- req.flash("success_msg", "Footer created successfully");
- } else {
- console.log("✓ Found existing footer:", footer._id);
- // Merge với dữ liệu cũ (giống Header)
- Object.assign(footer, updateData);
- await footer.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(footer.toObject()));
-
- // ✅ AUDIT LOGGING - Footer Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Footer",
- documentId: footer._id,
- action: AUDIT_ACTIONS.UPDATE_FOOTER,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- console.log("✓ Footer updated successfully");
- req.flash("success_msg", "Footer updated successfully");
- }
-
- const activeTab = req.body.activeTab || "about";
- res.redirect(`/admin/footer?activeTab=${activeTab}`);
- } catch (err) {
- console.error("✗ Error updating footer:", err);
- req.flash("error_msg", err.message || "Error updating footer");
- res.redirect("/admin/footer");
- }
-};
-
-// Legacy API endpoints (giữ lại cho tương thích)
-exports.api = exports.getFooter;
-exports.getFooterData = exports.getFooter;
diff --git a/controllers/formController.js b/controllers/formController.js
deleted file mode 100644
index b31ca98..0000000
--- a/controllers/formController.js
+++ /dev/null
@@ -1,44 +0,0 @@
-const fs = require('fs').promises;
-const path = require('path');
-
-const formController = {
- // Display form management page
- index: async (req, res) => {
- try {
- res.render('admin/form/index', {
- layout: 'layouts/admin',
- title: 'Quản lý Form',
- user: req.session.user,
- });
- } catch (error) {
- console.error('Error loading form management page:', error);
- res.status(500).render('error', {
- message: 'Lỗi khi tải trang quản lý form',
- error: error
- });
- }
- },
-
- // Update default form settings
- updateDefaultForm: async (req, res) => {
- try {
- const formData = req.body;
-
- // Here you would typically save form configuration to database or file
- // For now, just return success response
-
- res.json({
- success: true,
- message: 'Cập nhật form thành công'
- });
- } catch (error) {
- console.error('Error updating form:', error);
- res.status(500).json({
- success: false,
- message: 'Lỗi khi cập nhật form'
- });
- }
- }
-};
-
-module.exports = formController;
\ No newline at end of file
diff --git a/controllers/headerController.js b/controllers/headerController.js
deleted file mode 100644
index a237ffb..0000000
--- a/controllers/headerController.js
+++ /dev/null
@@ -1,437 +0,0 @@
-const Header = require("../models/header");
-const HeaderMenu = require("../models/headerMenu");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-/**
- * Helper function to build a tree structure (Mirroring logic in headerMenuController)
- */
-const buildTree = (items, parentId = null) => {
- const branch = [];
- const children = items.filter(
- (item) =>
- String(item.parentId) === String(parentId) ||
- (item.parentId === null && parentId === null),
- );
-
- for (const child of children) {
- const item = child.toObject ? child.toObject() : { ...child };
- const subChildren = buildTree(items, item._id);
- item.children = subChildren.length > 0 ? subChildren : [];
- branch.push(item);
- }
-
- return branch.sort((a, b) => a.order - b.order);
-};
-
-// Admin: Render header management page
-exports.index = async (req, res) => {
- try {
- const header = await Header.findOne().sort({ order: 1 });
-
- // Prepare data for view
- const data = header
- ? {
- topbar: {
- contactInfo: {
- phone: header.top?.phone || "",
- email: header.top?.email || "",
- location: header.top?.location || "",
- },
- socialLinks: header.top?.socialLinks || [],
- },
- logo: header.logo?.light || "",
- }
- : {
- topbar: {
- contactInfo: {
- phone: "",
- email: "",
- location: "",
- },
- socialLinks: [],
- },
- logo: "",
- };
-
- const activeTab = req.query.tab || "topbar";
-
- // Always fetch menu items to ensure they are available even if the user
- // switches tabs client-side
- const items = await HeaderMenu.find().sort({ order: 1 });
- const menuData = {
- flat: items,
- tree: buildTree(items),
- };
-
- res.render("admin/header/index", {
- layout: "layouts/main",
- title: "Header Management",
- user: req.session.user || null,
- data: data,
- activeTab: activeTab,
- menuData: menuData,
- });
- } catch (error) {
- console.error("Error loading header management:", error);
- res.status(500).render("page/error", {
- title: "Error",
- message: "Failed to load header management page",
- });
- }
-};
-
-// Admin: Get all headers (API)
-exports.getAll = async (req, res) => {
- try {
- const headers = await Header.find().sort({ order: 1 });
- res.json({
- success: true,
- data: headers,
- });
- } catch (error) {
- res.status(500).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Admin: Get single header
-exports.show = async (req, res) => {
- try {
- const header = await Header.findById(req.params.id);
- if (!header) {
- return res.status(404).json({
- success: false,
- message: "Header not found",
- });
- }
- res.json({
- success: true,
- data: header,
- });
- } catch (error) {
- res.status(500).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Admin: Create header
-exports.store = async (req, res) => {
- try {
- const { top, offcanvas, menu, logo, ctaButton, status, order } = req.body;
-
- const header = new Header({
- top,
- offcanvas,
- menu,
- logo,
- ctaButton,
- status: status || "active",
- order: order || 1,
- });
-
- await header.save();
- res.status(201).json({
- success: true,
- message: "Header created successfully",
- data: header,
- });
- } catch (error) {
- res.status(400).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Admin: Update header
-exports.update = async (req, res) => {
- try {
- let { top, topbarJson, offcanvas, menu, logo, ctaButton, status, order } =
- req.body;
-
- console.log("=== UPDATE REQUEST RECEIVED ===");
- console.log("Raw body:", JSON.stringify(req.body, null, 2));
- console.log("topbarJson type:", typeof topbarJson);
- console.log("topbarJson value:", topbarJson);
-
- // Nếu có topbarJson, parse nó
- if (topbarJson && typeof topbarJson === "string") {
- try {
- const parsedData = JSON.parse(topbarJson);
- console.log("✓ Parsed topbarJson successfully:", parsedData);
- // Chuyển đổi từ topbarData sang top format
- top = {
- phone: parsedData.contactInfo?.phone || "",
- email: parsedData.contactInfo?.email || "",
- location: parsedData.contactInfo?.location || "",
- socialLinks: parsedData.socialLinks || [],
- };
-
- if (logo) {
- updateData.logo = logoData;
- }
-
- console.log(
- "Preparing to update header with data:",
- JSON.stringify(updateData, null, 2),
- );
-
- const updatedHeader = await Header.findByIdAndUpdate(
- headerId,
- updateData,
- { new: true, runValidators: true },
- );
-
- if (!updatedHeader) {
- console.error("✗ Header not found with ID:", headerId);
- return res.status(404).json({
- success: false,
- message: "Header not found",
- });
- }
- res.json({
- success: true,
- message: "Header updated successfully",
- data: updatedHeader,
- });
- } catch (error) {
- console.error("✗ Error updating header:", error);
- res.status(400).json({
- success: false,
- message: error.message,
- });
- }
- }
-
- // Nếu không có id, tìm header đầu tiên hoặc tạo mới
- let headerId = req.params.id;
-
- if (!headerId) {
- // Tìm header đầu tiên
- let header = await Header.findOne().sort({ order: 1 });
- if (!header) {
- console.log("No existing header found, creating new one");
- // Tạo header mới nếu chưa có
- header = new Header({
- top,
- offcanvas,
- menu,
- logo: logo ? { light: logo } : {},
- ctaButton,
- status: status || "active",
- order: order || 1,
- });
- await header.save();
- console.log("✓ Header created:", header._id);
- return res.json({
- success: true,
- message: "Header created successfully",
- data: header,
- });
- }
- headerId = header._id;
- console.log("✓ Found existing header:", headerId);
- }
-
- // Chuẩn bị dữ liệu logo - merge với dữ liệu cũ
- let logoData = {};
- if (logo) {
- // Nếu có logo mới, lấy dữ liệu cũ và update light
- const existingHeader = await Header.findById(headerId);
- logoData = {
- light: logo,
- dark: existingHeader?.logo?.dark || "",
- alt: existingHeader?.logo?.alt || "",
- };
- }
-
- const updateData = {
- top,
- offcanvas,
- menu,
- ctaButton,
- status,
- order,
- };
-
- if (logo) {
- updateData.logo = logoData;
- }
-
- console.log(
- "Preparing to update header with data:",
- JSON.stringify(updateData, null, 2),
- );
-
- // ✅ Capture BEFORE state
- const beforeHeader = await Header.findById(headerId);
- const beforeData = beforeHeader
- ? JSON.parse(JSON.stringify(beforeHeader.toObject()))
- : {};
-
- const updatedHeader = await Header.findByIdAndUpdate(headerId, updateData, {
- new: true,
- runValidators: true,
- });
-
- if (!updatedHeader) {
- console.error("✗ Header not found with ID:", headerId);
- return res.status(404).json({
- success: false,
- message: "Header not found",
- });
- }
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(updatedHeader.toObject()));
-
- // ✅ AUDIT LOGGING - Header Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Header",
- documentId: updatedHeader._id,
- action: AUDIT_ACTIONS.UPDATE_HEADER,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- console.log("✓ Header updated successfully:", updatedHeader._id);
- console.log("Updated header data:", JSON.stringify(updatedHeader, null, 2));
-
- res.json({
- success: true,
- message: "Header updated successfully",
- data: updatedHeader,
- });
- } catch (error) {
- console.error("✗ Error updating header:", error);
- res.status(400).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Admin: Update status
-exports.updateStatus = async (req, res) => {
- try {
- const { status } = req.body;
-
- if (!["active", "inactive"].includes(status)) {
- return res.status(400).json({
- success: false,
- message: "Invalid status",
- });
- }
-
- const header = await Header.findByIdAndUpdate(
- req.params.id,
- { status },
- { new: true },
- );
-
- if (!header) {
- return res.status(404).json({
- success: false,
- message: "Header not found",
- });
- }
-
- res.json({
- success: true,
- message: "Header status updated",
- data: header,
- });
- } catch (error) {
- res.status(500).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Admin: Delete header
-exports.destroy = async (req, res) => {
- try {
- const header = await Header.findByIdAndDelete(req.params.id);
-
- if (!header) {
- return res.status(404).json({
- success: false,
- message: "Header not found",
- });
- }
-
- res.json({
- success: true,
- message: "Header deleted successfully",
- });
- } catch (error) {
- res.status(500).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Public API: Get active header
-exports.api = async (req, res) => {
- try {
- const header = await Header.findOne({ status: "active" }).sort({
- order: 1,
- });
-
- if (!header) {
- return res.status(404).json({
- success: false,
- message: "No active header found",
- });
- }
-
- res.json({
- success: true,
- data: header,
- });
- } catch (error) {
- res.status(500).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Public API: Get menu tree structure
-exports.getMenuTreeAPI = async (req, res) => {
- try {
- const header = await Header.findOne({ status: "active" }).sort({
- order: 1,
- });
-
- if (!header || !header.menu) {
- return res.status(404).json({
- success: false,
- message: "No active menu found",
- });
- }
-
- res.json({
- success: true,
- data: header.menu,
- });
- } catch (error) {
- res.status(500).json({
- success: false,
- message: error.message,
- });
- }
-};
diff --git a/controllers/headerMenuController.js b/controllers/headerMenuController.js
deleted file mode 100644
index 0c1ddfb..0000000
--- a/controllers/headerMenuController.js
+++ /dev/null
@@ -1,205 +0,0 @@
-const HeaderMenu = require("../models/headerMenu");
-const slugify = require("slugify");
-
-/**
- * Helper: Build tree structure from flat array
- */
-const buildMenuTree = (items, parentId = null, isPublic = false) => {
- const branch = [];
- const children = items.filter(
- (item) => String(item.parentId) === String(parentId) || (item.parentId === null && parentId === null),
- );
-
- for (const child of children) {
- const item = child.toObject ? child.toObject() : { ...child };
-
- // Clean data for public API if requested
- let cleanItem = item;
- if (isPublic) {
- cleanItem = {
- id: item._id,
- title: item.title,
- url: item.url,
- type: item.type,
- };
- }
-
- const subChildren = buildMenuTree(items, item._id, isPublic);
- cleanItem.children = subChildren.length > 0 ? subChildren : [];
- branch.push(cleanItem);
- }
- return branch.sort((a, b) => a.order - b.order);
-};
-
-/**
- * Helper: Recursive delete children
- */
-const deleteRecursive = async (parentId) => {
- const children = await HeaderMenu.find({ parentId });
- for (const child of children) {
- await deleteRecursive(child._id);
- await HeaderMenu.findByIdAndDelete(child._id);
- }
-};
-
-// 1. Render Menu Tab logic
-exports.index = async (req, res) => {
- try {
- const items = await HeaderMenu.find().sort({ order: 1 });
- const menuTree = buildMenuTree(items);
- return { menuTree, flatItems: items };
- } catch (error) {
- console.error("Error fetching menu items:", error);
- throw error;
- }
-};
-
-// 2. Create Menu Item
-exports.store = async (req, res) => {
- try {
- console.log("=== BACKEND: store hit ===");
- console.log("Body:", req.body);
- const { title, url, parentId, order, status, type } = req.body;
- const slug = slugify(title, { lower: true, strict: true });
-
- const newItem = new HeaderMenu({
- title,
- slug,
- url,
- parentId: parentId || null,
- order: order || 0,
- status: status || "active",
- type: type || "internal",
- });
-
- const savedItem = await newItem.save();
- console.log("=== MENU CREATED ===", savedItem);
-
- // Return JSON for AJAX requests
- if (req.xhr || req.headers.accept?.indexOf("json") > -1) {
- return res.json({ success: true, message: "Menu item created successfully", data: savedItem });
- }
-
- req.flash("success_msg", "Menu item created successfully");
- res.redirect("/admin/header?tab=menu");
- } catch (error) {
- console.error("=== CREATE MENU ERROR ===", error);
-
- // Return JSON for AJAX requests
- if (req.xhr || req.headers.accept?.indexOf("json") > -1) {
- return res.status(400).json({ success: false, message: error.message });
- }
-
- req.flash("error_msg", "Failed to create menu item: " + error.message);
- res.redirect("/admin/header?tab=menu");
- }
-};
-
-// 3. Update Menu Item
-exports.update = async (req, res) => {
- try {
- const { id } = req.params;
- console.log("=== BACKEND: update hit ===", { id });
- console.log("Body:", req.body);
- const { title, url, parentId, order, status, type } = req.body;
-
- const updateData = {
- url,
- parentId: parentId || null,
- order,
- status,
- type,
- };
-
- if (title) {
- updateData.title = title;
- updateData.slug = slugify(title, { lower: true, strict: true });
- }
-
- const updated = await HeaderMenu.findByIdAndUpdate(id, updateData, { new: true });
-
- if (!updated) {
- console.log("=== UPDATE MENU NOT FOUND ===", id);
-
- // Return JSON for AJAX requests
- if (req.xhr || req.headers.accept?.indexOf("json") > -1) {
- return res.status(404).json({ success: false, message: "Menu item not found" });
- }
-
- req.flash("error_msg", "Menu item not found");
- } else {
- console.log("=== MENU UPDATED ===", updated);
-
- // Return JSON for AJAX requests
- if (req.xhr || req.headers.accept?.indexOf("json") > -1) {
- return res.json({ success: true, message: "Menu item updated successfully", data: updated });
- }
-
- req.flash("success_msg", "Menu item updated successfully");
- }
- res.redirect("/admin/header?tab=menu");
- } catch (error) {
- console.error("=== UPDATE MENU ERROR ===", error);
-
- // Return JSON for AJAX requests
- if (req.xhr || req.headers.accept?.indexOf("json") > -1) {
- return res.status(400).json({ success: false, message: error.message });
- }
-
- req.flash("error_msg", "Update failed: " + error.message);
- res.redirect("/admin/header?tab=menu");
- }
-};
-
-// 4. Delete Menu Item (Cascade delete children)
-exports.destroy = async (req, res) => {
- try {
- const { id } = req.body;
- const menuId = id || req.params.id;
- console.log("=== BACKEND: destroy hit ===", { menuId, body: req.body });
-
- await deleteRecursive(menuId);
- await HeaderMenu.findByIdAndDelete(menuId);
-
- console.log("=== MENU DELETED ===", menuId);
- req.flash("success_msg", "Menu item and its sub-menu deleted successfully");
- res.redirect("/admin/header?tab=menu");
- } catch (error) {
- console.error("=== DELETE MENU ERROR ===", error);
- req.flash("error_msg", "Delete failed: " + error.message);
- res.redirect("/admin/header?tab=menu");
- }
-};
-
-// 5. Reorder Menu
-exports.reorder = async (req, res) => {
- try {
- const { items } = req.body; // Array of { id, order, parentId }
-
- if (items && Array.isArray(items)) {
- const bulkOps = items.map((item) => ({
- updateOne: {
- filter: { _id: item.id },
- update: { order: item.order, parentId: item.parentId || null },
- },
- }));
- await HeaderMenu.bulkWrite(bulkOps);
- return res.json({ success: true, message: "Reordered successfully" });
- }
-
- res.status(400).json({ success: false, message: "Invalid data" });
- } catch (error) {
- res.status(500).json({ success: false, message: error.message });
- }
-};
-
-// Public API: Get active menu as clean tree
-exports.api = async (req, res) => {
- try {
- const items = await HeaderMenu.find({ status: "active" }).sort({ order: 1 });
- const tree = buildMenuTree(items, null, true);
- res.json({ success: true, data: tree });
- } catch (error) {
- res.status(500).json({ success: false, message: error.message });
- }
-};
diff --git a/controllers/homeController.js b/controllers/homeController.js
deleted file mode 100644
index e070c6c..0000000
--- a/controllers/homeController.js
+++ /dev/null
@@ -1,249 +0,0 @@
-const { addBaseUrlToImages, getFullImageUrl } = require("../utils/imageHelper");
-const Home = require("../models/home");
-const Blog = require("../models/blog");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// Các hàm hỗ trợ
-const getHomeDoc = async () => Home.findOne().sort({ updatedAt: -1 });
-const getHomeData = async () => (await getHomeDoc())?.toObject() || {};
-
-const getDefaultHomeData = () => ({
- hero: {
- backgroundImage: "",
- slides: [],
- title: "",
- subtitle: "",
- description: "",
- heroImage: "",
- videoUrl: "",
- primaryButton: {},
- secondaryButton: {},
- },
- whyChooseUs: {
- heading: "",
- subheading: "",
- description: "",
- highlightWord: "",
- mainImage: "",
- secondaryImage: "",
- items: [],
- features: [],
- ctaButton: {},
- },
- visaSolutions: { heading: "", subheading: "", items: [] },
- visaCountries: {
- heading: "",
- subheading: "",
- description: "",
- countries: [],
- ctaButton: {},
- },
- testimonials: {
- heading: "",
- subheading: "",
- videoUrl: "",
- videoThumbnail: "",
- items: [],
- },
- videoGallery: { heading: "", videoUrl: "", thumbnail: "" },
- faq: {
- heading: "",
- subheading: "",
- description: "",
- ctaButton: {},
- items: [],
- },
- achievements: { heading: "", subheading: "", items: [] },
- partners: { visaConsultancy: { items: [] }, brands: { items: [] } },
- blogPreview: {
- heading: "Latest Insights & Updates",
- subheading: "Visa Tips & Guides",
- ctaButton: { label: "View All Articles", href: "/blog" },
- items: [],
- selectedBlogIds: [], // Array of manually selected blog IDs
- },
-});
-
-// Admin: Xem trang quản lý
-exports.index = async (req, res) => {
- try {
- let data = await getHomeData();
- const defaults = getDefaultHomeData();
-
- // Merge dữ liệu mặc định cho tất cả các phần
- const sections = Object.keys(defaults);
- sections.forEach((s) => {
- data[s] = data[s] || defaults[s];
- });
-
- const frontendUrl = process.env.FRONTEND_URL || "http://localhost:3000";
- const backendUrl = process.env.BACKEND_URL || "http://localhost:3001";
-
- // Lấy tất cả blog để chọn trong CMS
- const allBlogs = await Blog.find({ status: "published" })
- .sort({ createdAt: -1 })
- .lean();
-
- return res.render("admin/home/index", {
- layout: "layouts/main",
- title: "Home Management",
- data,
- allBlogs,
- frontendUrl,
- backendUrl,
- getFullImageUrl,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (err) {
- console.error("Home index error:", err);
- req.flash("error_msg", "Error loading home data");
- return req.session.save(() => res.redirect("/admin/dashboard"));
- }
-};
-
-// Admin: Cập nhật dữ liệu (tập trung vào achievements, partners; các phần khác giữ nguyên nếu không có dữ liệu mới)
-exports.update = async (req, res) => {
- try {
- const sections = [
- "hero",
- "whyChooseUs",
- "visaSolutions",
- "visaCountries",
- "testimonials",
- "videoGallery",
- "faq",
- "achievements",
- "partners",
- "blogPreview",
- ];
-
- let doc = await getHomeDoc();
- const beforeData = doc ? JSON.parse(JSON.stringify(doc.toObject())) : {};
-
- if (!doc) {
- doc = new Home({});
- }
-
- let hasChanges = false;
- const updatedSections = [];
-
- for (const section of sections) {
- if (req.body[section]) {
- try {
- const payload = JSON.parse(req.body[section]);
- // Gán trực tiếp vào doc, Mongoose sẽ tự check schema
- doc[section] = payload;
- doc.markModified(section);
- hasChanges = true;
- updatedSections.push(section);
- } catch (e) {
- console.error(`Invalid JSON for ${section}:`, e);
- }
- }
- }
-
- if (!hasChanges) {
- req.flash("info_msg", "No changes were made");
- return req.session.save(() => res.redirect("/admin/home"));
- }
-
- await doc.save();
- const afterData = JSON.parse(JSON.stringify(doc.toObject()));
-
- // ✅ AUDIT LOGGING - Home Update
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Home",
- documentId: doc._id,
- action: AUDIT_ACTIONS.UPDATE_HOME,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash("success_msg", "Home page configuration has been updated!");
- return req.session.save(() => res.redirect("/admin/home"));
- } catch (err) {
- console.error("Home update error:", err);
- req.flash("error_msg", `Update error: ${err.message}`);
- return req.session.save(() => res.redirect("/admin/home"));
- }
-};
-
-// Public API// API lấy danh sách blog cho CMS
-exports.apiGetBlogs = async (req, res) => {
- try {
- const blogs = await Blog.find({ status: "published" })
- .sort({ createdAt: -1 })
- .select("title slug featuredImage author publishedAt")
- .lean();
- res.json(blogs);
- } catch (err) {
- res.status(500).json({ error: err.message });
- }
-};
-exports.api = async (req, res) => {
- try {
- let data = await getHomeData();
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
-
- // === Xử lý Blog Preview động ===
- const blogPreview = data.blogPreview || {};
- let blogs = [];
-
- // Nếu có chọn blog cụ thể
- if (blogPreview.selectedBlogIds && blogPreview.selectedBlogIds.length > 0) {
- blogs = await Blog.find({
- _id: { $in: blogPreview.selectedBlogIds },
- status: "published",
- }).lean();
-
- // Sắp xếp theo thứ tự đã chọn trong selectedBlogIds
- blogs.sort((a, b) => {
- return (
- blogPreview.selectedBlogIds.indexOf(a._id.toString()) -
- blogPreview.selectedBlogIds.indexOf(b._id.toString())
- );
- });
- }
-
- // Nếu không chọn hoặc chọn nhưng không đủ, lấy thêm 3 bài mới nhất (hoặc bù vào)
- if (blogs.length === 0) {
- blogs = await Blog.find({ status: "published" })
- .sort({ createdAt: -1 })
- .limit(3)
- .lean();
- }
-
- // Map dữ liệu blog sang format mà frontend mong đợi
- blogPreview.items = blogs.map((blog) => ({
- title: blog.title,
- excerpt: blog.excerpt,
- category: blog.category && blog.category[0] ? blog.category[0] : "Visa",
- date: blog.publishedAt || blog.createdAt,
- author: {
- name: blog.author || "Admin",
- avatar: "", // Frontend đang tự xử lý hoặc dùng logo hệ thống
- },
- comments: blog.commentsCount || 0,
- link: `/blog/${blog.slug}`,
- thumbnail: blog.featuredImage,
- }));
-
- data.blogPreview = blogPreview;
- // ===============================
-
- const processed = addBaseUrlToImages(data, baseUrl);
- return res.json(processed);
- } catch (err) {
- console.error("Home API error:", err);
- return res.status(500).json({ error: "Error loading home data" });
- }
-};
diff --git a/controllers/insuranceController.js b/controllers/insuranceController.js
deleted file mode 100644
index ba4a790..0000000
--- a/controllers/insuranceController.js
+++ /dev/null
@@ -1,539 +0,0 @@
-const Insurance = require("../models/insurance");
-const { addBaseUrlToImages } = require("../utils/imageHelper");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// API để lấy insurance data (cho frontend)
-exports.api = async (req, res) => {
- try {
- const language = req.query.lang || "en";
-
- // Sử dụng getDefault để đảm bảo luôn có data
- const insurance = await Insurance.getDefault(language);
-
- // Trả về data với cấu trúc mới
- const insuranceData = insurance.toObject();
-
- // Sử dụng helper để thêm base URL vào đường dẫn ảnh
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(insuranceData, baseUrl);
-
- // Trả về trực tiếp hero, page, content (không wrap trong object)
- res.json({
- hero: processedData.hero,
- page: processedData.page,
- content: processedData.content,
- });
- } catch (error) {
- console.error("API Error:", error);
- res.status(500).json({
- success: false,
- error: "Error loading insurance data",
- message: error.message,
- });
- }
-};
-
-// API để lấy toàn bộ insurance data (cho admin)
-exports.getInsuranceData = async (req, res) => {
- try {
- const language = req.query.lang || "en";
- const insurance = await Insurance.findOne({
- name: "default",
- language: language,
- });
-
- if (!insurance) {
- return res.status(404).json({
- success: false,
- error: "Insurance data not found",
- });
- }
-
- const insuranceData = insurance.toObject();
-
- // Thêm base URL vào đường dẫn ảnh
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(insuranceData, baseUrl);
-
- res.json({
- success: true,
- data: processedData,
- });
- } catch (error) {
- console.error("Error getting insurance data:", error);
- res.status(500).json({
- success: false,
- error: "Error loading insurance data",
- });
- }
-};
-
-// API để lấy data theo ngôn ngữ
-exports.getByLanguage = async (req, res) => {
- try {
- const language = req.params.lang || "en";
-
- const insurance = await Insurance.findOne({
- name: "default",
- language: language,
- });
-
- if (!insurance) {
- return res.status(404).json({
- success: false,
- error: "Insurance data not found",
- });
- }
-
- const insuranceData = insurance.toObject();
-
- // Thêm base URL vào đường dẫn ảnh
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(insuranceData, baseUrl);
-
- res.json({
- success: true,
- data: {
- hero: processedData.hero,
- page: processedData.page,
- content: processedData.content,
- },
- });
- } catch (error) {
- console.error("Error getting insurance by language:", error);
- res.status(500).json({
- success: false,
- error: "Error loading insurance data",
- });
- }
-};
-
-// Render admin view
-exports.index = async (req, res) => {
- try {
- // Luôn đảm bảo có default data
- const insurance = await Insurance.getDefault("en");
- const data = insurance.toObject();
-
- const frontendUrl = process.env.FRONTEND_URL || "http://localhost:3000";
-
- res.render("admin/insurance/index", {
- title: "Insurance Management",
- layout: "layouts/main",
- data,
- frontendUrl,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (error) {
- console.error("Error in insurance index:", error);
- req.flash("error_msg", "An error occurred while loading the page");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Seed data từ JSON file (cấu trúc mới)
-exports.seed = async (req, res) => {
- try {
- const fs = require("fs").promises;
- const path = require("path");
-
- // Đọc file JSON
- const jsonPath = path.join(__dirname, "../data/insurance.json");
- const jsonData = JSON.parse(await fs.readFile(jsonPath, "utf8"));
-
- console.log("Seeding insurance from JSON...");
-
- // Migrate từ cấu trúc cũ sang mới
- const insurance = await Insurance.migrateFromJson(jsonData, "en");
-
- res.json({
- success: true,
- message: "Insurance data seeded successfully",
- data: {
- id: insurance._id,
- hero: insurance.hero,
- page: insurance.page,
- content: insurance.content,
- },
- });
- } catch (error) {
- console.error("Error seeding insurance:", error);
- res.status(500).json({
- success: false,
- error: error.message || "Error seeding insurance data",
- });
- }
-};
-
-// API preview cho admin (tạo HTML preview)
-exports.preview = async (req, res) => {
- try {
- const { hero, page, content } = req.body;
-
- // Parse JSON strings
- const parseJson = (data) => {
- if (!data) return null;
- if (typeof data === "string") {
- try {
- return JSON.parse(data);
- } catch (e) {
- console.error("JSON parse error:", e);
- return null;
- }
- }
- return data;
- };
-
- const heroData = parseJson(hero) || {};
- const pageData = parseJson(page) || {};
- const contentData = parseJson(content) || {};
-
- // Thêm base URL vào đường dẫn ảnh cho preview
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedHeroData = addBaseUrlToImages(heroData, baseUrl);
-
- // Render preview HTML
- const html = `
-
-
-
-
-
- ${pageData.title || "Insurance Preview"}
-
-
-
-
-
-
-
${heroData.title || "Insurance"}
-
${heroData.subtitle || ""}
-
-
-
-
-
-
-
-
- ${renderContentItems(contentData.content || [])}
-
-
-
-
- `;
-
- res.send(html);
- } catch (error) {
- console.error("Error generating preview:", error);
- res.status(500).send("Error generating preview");
- }
-};
-
-// Helper function để render content items
-function renderContentItems(contentItems) {
- if (!Array.isArray(contentItems) || contentItems.length === 0) {
- return "No content available.
";
- }
-
- return contentItems
- .map((item) => {
- switch (item.type) {
- case "header":
- return `${item.text} `;
-
- case "paragraph":
- return `${item.text}
`;
-
- case "section":
- return `
-
-
${item.title}
-
${item.content}
-
- `;
-
- case "list":
- const listItems = (item.items || [])
- .map((li) => `${li} `)
- .join("");
- return ``;
-
- case "note":
- return `${item.text}
`;
-
- case "embed":
- if (item.source === "youtube") {
- return `
-
-
- ${item.caption ? `
${item.caption}
` : ""}
-
- `;
- }
- return "";
-
- default:
- return "";
- }
- })
- .join("");
-}
-
-// API để tạo insurance mới (cho các ngôn ngữ khác)
-exports.create = async (req, res) => {
- try {
- const { hero, page, content, language } = req.body;
-
- if (!language) {
- return res.status(400).json({
- success: false,
- error: "Language is required",
- });
- }
-
- // Kiểm tra đã tồn tại chưa
- const existing = await Insurance.findOne({
- name: "default",
- language: language,
- });
- if (existing) {
- return res.status(400).json({
- success: false,
- error: "Insurance already exists for this language",
- });
- }
-
- // Parse JSON nếu cần
- const parseJson = (data) => {
- if (!data) return null;
- if (typeof data === "string") {
- try {
- return JSON.parse(data);
- } catch (e) {
- console.error("JSON parse error:", e);
- return null;
- }
- }
- return data;
- };
-
- const insurance = new Insurance({
- name: "default",
- language: language,
- hero: parseJson(hero) || {},
- page: parseJson(page) || {},
- content: parseJson(content) || {},
- version: "2.0.0",
- isActive: true,
- migratedFromOldStructure: false,
- });
-
- await insurance.save();
-
- res.json({
- success: true,
- message: "Insurance created successfully for language: " + language,
- data: insurance,
- });
- } catch (error) {
- console.error("Error creating insurance:", error);
- res.status(500).json({
- success: false,
- error: error.message || "Error creating insurance",
- });
- }
-};
-
-// Cập nhật dữ liệu insurance (CẬP NHẬT CẤU TRÚC MỚI)
-exports.update = async (req, res) => {
- try {
- const { hero, page, content } = req.body;
-
- // Parse JSON strings
- const parseJson = (data) => {
- if (!data) return null;
- if (typeof data === "string") {
- try {
- return JSON.parse(data);
- } catch (e) {
- console.error("JSON parse error:", e);
- return null;
- }
- }
- return data;
- };
-
- // Parse all data với cấu trúc mới
- const heroData = parseJson(hero) || {};
- const pageData = parseJson(page) || {};
- const contentData = parseJson(content) || {};
-
- // Normalize embed blocks (convert YouTube watch URLs to /embed/ URLs)
- function extractYouTubeId(url) {
- const regex =
- /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/;
- const match = url.match(regex);
- return match ? match[1] : null;
- }
-
- if (contentData && Array.isArray(contentData.content)) {
- contentData.content.forEach((item) => {
- if (item.type === "embed" && item.source === "youtube") {
- if (item.url && item.url.includes("watch?v=")) {
- const videoId = extractYouTubeId(item.url);
- if (videoId) {
- item.url = `https://www.youtube.com/embed/${videoId}`;
- item.videoId = videoId;
- }
- }
- if (item.embed && item.embed.includes("watch?v=")) {
- const videoId = extractYouTubeId(item.embed);
- if (videoId) {
- item.embed = `https://www.youtube.com/embed/${videoId}`;
- item.videoId = videoId;
- }
- }
- }
- });
- }
-
- // Tìm hoặc tạo insurance
- let insurance = await Insurance.findOne({
- name: "default",
- language: "en",
- });
-
- // ✅ Capture BEFORE state
- const beforeData = insurance
- ? JSON.parse(
- JSON.stringify(insurance.toObject ? insurance.toObject() : insurance),
- )
- : {};
-
- if (!insurance) {
- insurance = new Insurance({
- name: "default",
- language: "en",
- hero: heroData,
- page: pageData,
- content: contentData,
- version: "2.0.0",
- isActive: true,
- });
- } else {
- insurance.hero = heroData;
- insurance.page = pageData;
- insurance.content = contentData;
- insurance.version = "2.0.0";
- }
-
- await insurance.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(
- JSON.stringify(insurance.toObject ? insurance.toObject() : insurance),
- );
-
- // ✅ AUDIT LOGGING - Insurance Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Insurance",
- documentId: insurance._id,
- action: AUDIT_ACTIONS.UPDATE_INSURANCE,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash("success_msg", "Insurance updated successfully");
- res.redirect("/admin/insurance");
- } catch (err) {
- console.error("Error updating insurance:", err);
- req.flash("error_msg", err.message || "Error updating insurance");
- res.redirect("/admin/insurance");
- }
-};
-
-// API để xóa insurance (theo ngôn ngữ)
-exports.delete = async (req, res) => {
- try {
- const language = req.params.lang;
-
- if (!language) {
- return res.status(400).json({
- success: false,
- error: "Language parameter is required",
- });
- }
-
- // Không cho phép xóa tiếng Anh mặc định
- if (language === "en") {
- return res.status(400).json({
- success: false,
- error: "Cannot delete default English insurance data",
- });
- }
-
- const result = await Insurance.deleteOne({
- name: "default",
- language: language,
- });
-
- if (result.deletedCount === 0) {
- return res.status(404).json({
- success: false,
- error: "Insurance not found for this language",
- });
- }
-
- res.json({
- success: true,
- message: "Insurance deleted successfully for language: " + language,
- });
- } catch (error) {
- console.error("Error deleting insurance:", error);
- res.status(500).json({
- success: false,
- error: error.message || "Error deleting insurance",
- });
- }
-};
diff --git a/controllers/levelController.js b/controllers/levelController.js
new file mode 100644
index 0000000..87bdf0c
--- /dev/null
+++ b/controllers/levelController.js
@@ -0,0 +1,76 @@
+const Level = require('../models/level');
+const Degree = require('../models/degree');
+
+// GET /admin/level
+exports.index = async (req, res) => {
+ try {
+ const levels = await Level.find();
+ res.render('admin/level/index', {
+ levels,
+ user: req.session.user,
+ layout: 'layouts/admin',
+ title: 'Quản lý Cấp độ'
+ });
+ } catch (err) {
+ console.error('levelController.index error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi tải danh sách cấp độ');
+ res.redirect('/admin/dashboard');
+ }
+};
+
+// POST /admin/level/create
+exports.create = async (req, res) => {
+ try {
+ const { type } = req.body;
+
+ if (!type) {
+ req.flash('error', 'Type is required');
+ return res.redirect('back');
+ }
+
+ await Level.create({ type });
+ req.flash('success', 'Level created');
+ res.redirect('/admin/level');
+ } catch (err) {
+ console.error('levelController.create error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi tạo cấp độ');
+ res.redirect('back');
+ }
+};
+
+// POST /admin/level/:id/edit
+exports.update = async (req, res) => {
+ try {
+ const { id } = req.params;
+ const { type } = req.body;
+
+ await Level.findByIdAndUpdate(id, { type });
+ req.flash('success', 'Level updated');
+ res.redirect('/admin/level');
+ } catch (err) {
+ console.error('levelController.update error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi cập nhật cấp độ');
+ res.redirect('back');
+ }
+};
+
+// POST /admin/level/:id/delete
+exports.destroy = async (req, res) => {
+ try {
+ const { id } = req.params;
+ const count = await Degree.countDocuments({ level: id });
+
+ if (count > 0) {
+ req.flash('error', 'Cannot delete: Level is referenced by existing degrees');
+ return res.redirect('back');
+ }
+
+ await Level.findByIdAndDelete(id);
+ req.flash('success', 'Level deleted');
+ res.redirect('/admin/level');
+ } catch (err) {
+ console.error('levelController.destroy error:', err);
+ req.flash('error', 'Đã xảy ra lỗi khi xóa cấp độ');
+ res.redirect('back');
+ }
+};
diff --git a/controllers/pageController.js b/controllers/pageController.js
deleted file mode 100644
index 03daf3a..0000000
--- a/controllers/pageController.js
+++ /dev/null
@@ -1,228 +0,0 @@
-const { readJsonFile, writeJsonFile } = require('../utils/jsonHelper');
-const slugify = require('slugify');
-
-// Hiển thị tất cả các trang
-exports.getAllPages = async (req, res) => {
- try {
- const content = readJsonFile('content');
- const pages = content.pages || [];
-
- res.render('admin/pages/index', {
- title: 'Quản lý trang',
- pages
- });
- } catch (err) {
- console.error(err);
- req.flash('error_msg', 'Error loading page list');
- res.redirect('/admin/dashboard');
- }
-};
-
-// Hiển thị form tạo trang mới
-exports.getAddPage = (req, res) => {
- res.render('admin/pages/add', {
- title: 'Thêm trang mới'
- });
-};
-
-// Xử lý tạo trang mới
-exports.addPage = async (req, res) => {
- try {
- const { title, content } = req.body;
-
- // Kiểm tra dữ liệu
- if (!title || !content) {
- req.flash('error_msg', 'Please fill in all required fields');
- return res.redirect('/admin/pages/add');
- }
-
- // Tạo slug từ tiêu đề
- const slug = slugify(title, {
- lower: true,
- strict: true,
- locale: 'vi'
- });
-
- // Lấy dữ liệu hiện tại
- const contentData = readJsonFile('content');
- const pages = contentData.pages || [];
-
- // Kiểm tra slug đã tồn tại chưa
- const existingPage = pages.find(page => page.slug === slug);
- if (existingPage) {
- req.flash('error_msg', 'This title is already in use. Please choose a different title.');
- return res.redirect('/admin/pages/add');
- }
-
- // Tạo trang mới
- const newPage = {
- id: Date.now().toString(), // Sử dụng timestamp làm ID
- title,
- slug,
- content,
- createdAt: new Date().toISOString(),
- updatedAt: new Date().toISOString()
- };
-
- // Thêm trang mới vào danh sách
- pages.push(newPage);
- contentData.pages = pages;
-
- // Lưu lại dữ liệu
- writeJsonFile('content', contentData);
-
- req.flash('success_msg', 'New page created successfully');
- res.redirect('/admin/pages');
- } catch (err) {
- console.error(err);
- req.flash('error_msg', 'Error creating new page');
- res.redirect('/admin/pages/add');
- }
-};
-
-// Hiển thị form chỉnh sửa trang
-exports.getEditPage = async (req, res) => {
- try {
- const pageId = req.params.id;
- const contentData = readJsonFile('content');
- const pages = contentData.pages || [];
-
- const page = pages.find(p => p.id === pageId);
-
- if (!page) {
- req.flash('error_msg', 'Page not found');
- return res.redirect('/admin/pages');
- }
-
- res.render('admin/pages/edit', {
- title: 'Chỉnh sửa trang',
- page
- });
- } catch (err) {
- console.error(err);
- req.flash('error_msg', 'Error loading page');
- res.redirect('/admin/pages');
- }
-};
-
-// Xử lý chỉnh sửa trang
-exports.updatePage = async (req, res) => {
- try {
- const pageId = req.params.id;
- const { title, content } = req.body;
-
- // Kiểm tra dữ liệu
- if (!title || !content) {
- req.flash('error_msg', 'Please fill in all required fields');
- return res.redirect(`/admin/pages/edit/${pageId}`);
- }
-
- // Lấy dữ liệu hiện tại
- const contentData = readJsonFile('content');
- const pages = contentData.pages || [];
-
- // Tìm trang cần cập nhật
- const pageIndex = pages.findIndex(p => p.id === pageId);
-
- if (pageIndex === -1) {
- req.flash('error_msg', 'Page not found');
- return res.redirect('/admin/pages');
- }
-
- const page = pages[pageIndex];
-
- // Kiểm tra nếu tiêu đề thay đổi thì cập nhật slug
- let newSlug = page.slug;
- if (page.title !== title) {
- newSlug = slugify(title, {
- lower: true,
- strict: true,
- locale: 'vi'
- });
-
- // Kiểm tra slug đã tồn tại chưa (trừ trang hiện tại)
- const existingPage = pages.find(p => p.slug === newSlug && p.id !== pageId);
- if (existingPage) {
- req.flash('error_msg', 'This title is already in use. Please choose a different title.');
- return res.redirect(`/admin/pages/edit/${pageId}`);
- }
- }
-
- // Cập nhật thông tin trang
- pages[pageIndex] = {
- ...page,
- title,
- slug: newSlug,
- content,
- updatedAt: new Date().toISOString()
- };
-
- // Lưu lại dữ liệu
- contentData.pages = pages;
- writeJsonFile('content', contentData);
-
- req.flash('success_msg', 'Page updated successfully');
- res.redirect('/admin/pages');
- } catch (err) {
- console.error(err);
- req.flash('error_msg', 'Error updating page');
- res.redirect(`/admin/pages/edit/${req.params.id}`);
- }
-};
-
-// Xử lý xóa trang
-exports.deletePage = async (req, res) => {
- try {
- const pageId = req.params.id;
-
- // Lấy dữ liệu hiện tại
- const contentData = readJsonFile('content');
- const pages = contentData.pages || [];
-
- // Lọc bỏ trang cần xóa
- contentData.pages = pages.filter(p => p.id !== pageId);
-
- // Lưu lại dữ liệu
- writeJsonFile('content', contentData);
-
- req.flash('success_msg', 'Page deleted successfully');
- res.redirect('/admin/pages');
- } catch (err) {
- console.error(err);
- req.flash('error_msg', 'Error deleting page');
- res.redirect('/admin/pages');
- }
-};
-
-// Hiển thị trang theo slug
-exports.getPageBySlug = async (req, res) => {
- try {
- const { slug } = req.params;
-
- // Lấy dữ liệu từ content.json
- const contentData = readJsonFile('content');
- const pages = contentData.pages || [];
-
- // Tìm trang theo slug
- const page = pages.find(p => p.slug === slug);
-
- if (!page) {
- return res.status(404).render('page/not-found', {
- title: 'Page Not Found',
- message: 'The page you are looking for does not exist or has been deleted.'
- });
- }
-
- // Hiển thị trang
- res.render('page/view', {
- title: page.title,
- page
- });
- } catch (err) {
- console.error(err);
- res.status(500).render('page/error', {
- title: 'Error',
- message: 'An error occurred while loading the page. Please try again later.'
- });
- }
-};
\ No newline at end of file
diff --git a/controllers/pricingController.js b/controllers/pricingController.js
deleted file mode 100644
index d362c3c..0000000
--- a/controllers/pricingController.js
+++ /dev/null
@@ -1,229 +0,0 @@
-const Pricing = require("../models/pricing");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// ==================== CMS ADMIN FUNCTIONS ====================
-
-// Render admin page for pricing management
-exports.index = async (req, res) => {
- try {
- let pricing = await Pricing.findOne({ name: "default" });
-
- // If no data in DB, try to load from JSON file
- if (!pricing) {
- const fs = require("fs");
- const path = require("path");
- const jsonPath = path.join(__dirname, "../data/pricing.json");
-
- if (fs.existsSync(jsonPath)) {
- const jsonData = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
- pricing = await Pricing.migrateFromJson(jsonData);
- } else {
- // Create default pricing
- pricing = await Pricing.create({
- name: "default",
- hero: {
- title: "Pricing Plan",
- backgroundImage: "/assets/img/inner-page/breadcrumb.jpg",
- shapeImage: "/assets/img/inner-page/shape.png",
- breadcrumb: [
- { text: "Home", link: "/" },
- { text: "Pricing Plan", link: "" },
- ],
- },
- pricingSection: {
- subtitle: "pricing plan",
- heading: "Flexible Plans to Suit Every Traveler",
- description:
- "Choose the plan that fits your visa needs and enjoy expert guidance every step of the way.",
- },
- plans: {
- monthly: [],
- yearly: [],
- },
- testimonials: {
- subtitle: "What Our Clients Say",
- heading: "Immigration Success Stories",
- buttonText: "View All Review",
- buttonLink: "/contact",
- buttonIcon: "fa-solid fa-arrow-right",
- image: "",
- items: [],
- },
- });
- }
- }
-
- res.render("admin/pricing/index", {
- layout: "layouts/main",
- title: "Pricing Management",
- data: pricing,
- user: req.session.user,
- frontendUrl: process.env.FRONTEND_URL || "http://localhost:3000",
- });
- } catch (err) {
- console.error("Error loading pricing admin page:", err);
- req.flash("error", "Error loading pricing data");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Update pricing data
-exports.update = async (req, res) => {
- try {
- const { hero, pricingSection, plans, testimonials } = req.body;
-
- // Parse JSON strings if needed
- const heroData = typeof hero === "string" ? JSON.parse(hero) : hero;
- const pricingSectionData =
- typeof pricingSection === "string"
- ? JSON.parse(pricingSection)
- : pricingSection;
- const plansData = typeof plans === "string" ? JSON.parse(plans) : plans;
- const testimonialsData =
- typeof testimonials === "string"
- ? JSON.parse(testimonials)
- : testimonials;
-
- let pricing = await Pricing.findOne({ name: "default" });
-
- // ✅ Capture BEFORE state
- const beforeData = pricing
- ? JSON.parse(JSON.stringify(pricing.toObject()))
- : {};
-
- if (pricing) {
- pricing.hero = heroData;
- pricing.pricingSection = pricingSectionData;
- pricing.plans = plansData;
- pricing.testimonials = testimonialsData;
- await pricing.save();
- } else {
- pricing = await Pricing.create({
- name: "default",
- hero: heroData,
- pricingSection: pricingSectionData,
- plans: plansData,
- testimonials: testimonialsData,
- });
- }
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(pricing.toObject()));
-
- // ✅ AUDIT LOGGING - Pricing Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Pricing",
- documentId: pricing._id,
- action: AUDIT_ACTIONS.UPDATE_PRICING,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash("success", "Pricing data updated successfully");
- res.redirect("/admin/pricing");
- } catch (err) {
- console.error("Error updating pricing:", err);
- req.flash("error", "Error updating pricing data");
- res.redirect("/admin/pricing");
- }
-};
-
-// API to get pricing data (admin)
-exports.getPricingData = async (req, res) => {
- try {
- let pricing = await Pricing.findOne({ name: "default" });
-
- if (!pricing) {
- const fs = require("fs");
- const path = require("path");
- const jsonPath = path.join(__dirname, "../data/pricing.json");
-
- if (fs.existsSync(jsonPath)) {
- const jsonData = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
- pricing = await Pricing.migrateFromJson(jsonData);
- }
- }
-
- res.json({
- success: true,
- data: pricing,
- });
- } catch (err) {
- console.error("Error getting pricing data:", err);
- res.status(500).json({
- success: false,
- error: "Error loading pricing data",
- });
- }
-};
-
-// Public API to get pricing page data (for frontend)
-exports.api = async (req, res) => {
- try {
- let pricing = await Pricing.findOne({ name: "default" });
-
- if (!pricing) {
- const fs = require("fs");
- const path = require("path");
- const jsonPath = path.join(__dirname, "../data/pricing.json");
-
- if (fs.existsSync(jsonPath)) {
- const jsonData = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
- pricing = await Pricing.migrateFromJson(jsonData);
- }
- }
-
- if (!pricing) {
- return res.status(404).json({
- success: false,
- error: "Pricing data not found",
- });
- }
-
- const backendUrl = process.env.BACKEND_URL || "http://localhost:3001";
-
- const getFullUrl = (path) => {
- if (!path || path.startsWith("http")) return path;
- return `${backendUrl}${path.startsWith("/") ? "" : "/"}${path}`;
- };
-
- // Convert to plain object to modify properties safely
- const pricingData = pricing.toObject ? pricing.toObject() : pricing;
-
- if (pricingData.hero) {
- pricingData.hero.backgroundImage = getFullUrl(
- pricingData.hero.backgroundImage,
- );
- pricingData.hero.shapeImage = getFullUrl(pricingData.hero.shapeImage);
- }
-
- if (pricingData.testimonials) {
- pricingData.testimonials.image = getFullUrl(
- pricingData.testimonials.image,
- );
- }
-
- res.json({
- success: true,
- data: {
- hero: pricingData.hero,
- pricingSection: pricingData.pricingSection,
- plans: pricingData.plans,
- testimonials: pricingData.testimonials,
- },
- });
- } catch (err) {
- console.error("Error getting pricing API data:", err);
- res.status(500).json({
- success: false,
- error: "Error loading pricing data",
- });
- }
-};
diff --git a/controllers/qualificationController.js b/controllers/qualificationController.js
new file mode 100644
index 0000000..b28e5f9
--- /dev/null
+++ b/controllers/qualificationController.js
@@ -0,0 +1,165 @@
+const path = require('path');
+const Qualification = require('../models/qualification');
+const Department = require('../models/department');
+const Level = require('../models/level');
+const writeAuditLog = require('../audit/writeAuditLog');
+const AUDIT_ACTIONS = require('../constants/auditAction');
+
+function normalizePath(filePath) {
+ if (!filePath) return undefined;
+ return path.basename(filePath.replace(/\\/g, '/'));
+}
+
+// GET /admin/qualification
+exports.index = async (req, res) => {
+ try {
+ const { search, status } = req.query;
+ const filter = {};
+ if (search) {
+ filter.$or = [
+ { qualification_number: { $regex: search, $options: 'i' } },
+ { student_name: { $regex: search, $options: 'i' } }
+ ];
+ }
+ if (status) filter.status = status;
+
+ const [qualifications, departments, levels] = await Promise.all([
+ Qualification.find(filter).populate('department level').sort({ createdAt: -1 }),
+ Department.find(), Level.find()
+ ]);
+
+ res.render('admin/qualification/index', {
+ qualifications, departments, levels, query: req.query,
+ user: req.session.user, layout: 'layouts/admin', title: 'Qualifications'
+ });
+ } catch (err) {
+ console.error(err);
+ req.flash('error', 'Error loading qualifications');
+ res.redirect('/admin/dashboard');
+ }
+};
+
+// GET /admin/qualification/create
+exports.createForm = async (req, res) => {
+ try {
+ const [departments, levels] = await Promise.all([Department.find(), Level.find()]);
+ res.render('admin/qualification/create', {
+ departments, levels, user: req.session.user,
+ layout: 'layouts/admin', title: 'Create Qualification'
+ });
+ } catch (err) {
+ req.flash('error', 'Error'); res.redirect('/admin/qualification');
+ }
+};
+
+// POST /admin/qualification/create
+exports.create = async (req, res) => {
+ try {
+ const data = { ...req.body };
+ const imgPath = req.files?.degree_image?.[0]?.path;
+ if (imgPath) data.degree_image = normalizePath(imgPath);
+
+ const qual = new Qualification(data);
+ await qual.save();
+ await writeAuditLog({ model: 'Qualification', documentId: qual._id, action: AUDIT_ACTIONS.CREATE_QUALIFICATION, before: null, after: qual.toObject(), req });
+
+ req.flash('success', 'Qualification created');
+ res.redirect('/admin/qualification');
+ } catch (err) {
+ console.error(err);
+ try {
+ const [departments, levels] = await Promise.all([Department.find(), Level.find()]);
+ res.render('admin/qualification/create', {
+ error: err.message, formData: req.body, departments, levels,
+ user: req.session.user, layout: 'layouts/admin', title: 'Create Qualification'
+ });
+ } catch { req.flash('error', err.message); res.redirect('/admin/qualification'); }
+ }
+};
+
+// GET /admin/qualification/:id/edit
+exports.editForm = async (req, res) => {
+ try {
+ const qual = await Qualification.findById(req.params.id).populate('department level');
+ if (!qual) { req.flash('error', 'Not found'); return res.redirect('/admin/qualification'); }
+ const [departments, levels] = await Promise.all([Department.find(), Level.find()]);
+ res.render('admin/qualification/edit', {
+ qual, departments, levels, user: req.session.user,
+ layout: 'layouts/admin', title: 'Edit Qualification'
+ });
+ } catch (err) {
+ req.flash('error', 'Error'); res.redirect('/admin/qualification');
+ }
+};
+
+// POST /admin/qualification/:id/edit
+exports.update = async (req, res) => {
+ try {
+ const qual = await Qualification.findById(req.params.id);
+ if (!qual) { req.flash('error', 'Not found'); return res.redirect('/admin/qualification'); }
+ const before = qual.toObject();
+
+ const fields = ['qualification_number','student_name','program_name','department','level',
+ 'issued_date','status','passport_number','address','topic_name','topic_short_desc'];
+ fields.forEach(f => { if (req.body[f] !== undefined) qual[f] = req.body[f]; });
+
+ const imgPath = req.files?.degree_image?.[0]?.path;
+ if (imgPath) qual.degree_image = normalizePath(imgPath);
+
+ await qual.save();
+ await writeAuditLog({ model: 'Qualification', documentId: qual._id, action: AUDIT_ACTIONS.UPDATE_QUALIFICATION, before, after: qual.toObject(), req });
+
+ req.flash('success', 'Qualification updated');
+ res.redirect('/admin/qualification');
+ } catch (err) {
+ req.flash('error', err.message); res.redirect('back');
+ }
+};
+
+// POST /admin/qualification/:id/delete
+exports.destroy = async (req, res) => {
+ try {
+ const qual = await Qualification.findById(req.params.id);
+ if (!qual) { req.flash('error', 'Not found'); return res.redirect('/admin/qualification'); }
+ await writeAuditLog({ model: 'Qualification', documentId: qual._id, action: AUDIT_ACTIONS.DELETE_QUALIFICATION, before: qual.toObject(), after: null, req });
+ await qual.deleteOne();
+ req.flash('success', 'Qualification deleted');
+ res.redirect('/admin/qualification');
+ } catch (err) {
+ req.flash('error', 'Error deleting'); res.redirect('/admin/qualification');
+ }
+};
+
+// GET /api/verify-degree/:degree_id?api_key=xxx
+exports.apiVerify = async (req, res) => {
+ try {
+ const qual = await Qualification.findOne({
+ qualification_number: { $regex: new RegExp('^' + req.params.degree_id + '$', 'i') }
+ }).populate('department level');
+
+ if (!qual) return res.status(404).json({ error: 'Degree not found' });
+ if (qual.status === 'revoked') return res.status(404).json({ error: 'Degree has been revoked' });
+
+ const baseUrl = `${req.protocol}://${req.get('host')}`;
+ const buildUrl = (f) => f ? [`${baseUrl}/secure-files/${path.basename(f)}?api_key=${req.query.api_key}`] : undefined;
+
+ const response = {
+ full_name: qual.student_name,
+ program_name: qual.program_name,
+ degree_id: qual.qualification_number,
+ };
+ if (qual.passport_number) response.passport_number = qual.passport_number;
+ if (qual.address) response.address = qual.address;
+ const imgs = buildUrl(qual.degree_image);
+ if (imgs) response.degree_image = imgs;
+ if (qual.topic_name) {
+ response.topic_name = qual.topic_name;
+ if (qual.topic_short_desc) response.topic_short_desc = qual.topic_short_desc;
+ }
+
+ return res.json(response);
+ } catch (err) {
+ console.error(err);
+ return res.status(500).json({ error: 'Internal server error' });
+ }
+};
diff --git a/controllers/safetyController.js b/controllers/safetyController.js
deleted file mode 100644
index 953faa6..0000000
--- a/controllers/safetyController.js
+++ /dev/null
@@ -1,197 +0,0 @@
-const Safety = require("../models/safety");
-const { addBaseUrlToImages } = require("../utils/imageHelper");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// Lấy dữ liệu Safety từ MongoDB
-const getSafetyData = async () => {
- const safety = await Safety.findOne().sort({ updatedAt: -1 });
- if (!safety) {
- return null;
- }
- return safety.toObject();
-};
-
-// API endpoint cho frontend
-exports.api = async (req, res) => {
- try {
- const safety = await getSafetyData();
- if (!safety) {
- return res.status(404).json({ error: "Safety data not found" });
- }
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(safety, baseUrl);
- res.json(processedData);
- } catch (err) {
- console.error("Safety API error:", err);
- res.status(500).json({ error: "Error loading safety data" });
- }
-};
-
-// Hiển thị danh sách Safety cho admin
-exports.index = async (req, res) => {
- try {
- const items = await Safety.find().sort({ updatedAt: -1 }).limit(10);
- // Lấy bản ghi mới nhất hoặc object rỗng nếu chưa có dữ liệu
- const latest = items && items.length > 0 ? items[0] : null;
- const data = latest
- ? latest.toObject
- ? latest.toObject()
- : latest
- : {
- hero: { title: "", banner: "" },
- approach: {},
- approachImgs: [],
- approachStats: [],
- approachFeatures: [],
- approachCards: [],
- philosophy: {},
- philosophyCards: [],
- security: {},
- securityCards: [],
- };
- res.render("admin/safety/index", {
- layout: "layouts/main",
- title: "Safety Management",
- items,
- data,
- frontendUrl:
- process.env.FRONTEND_URL || req.protocol + "://" + req.get("host"),
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (err) {
- console.error(err);
- req.flash("error_msg", "Error loading Safety data");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Hiển thị form tạo mới Safety
-exports.createForm = async (req, res) => {
- try {
- res.render("admin/safety/create", {
- layout: "layouts/main",
- title: "Create Safety",
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (err) {
- console.error(err);
- req.flash("error_msg", "Error loading create form");
- res.redirect("/admin/safety");
- }
-};
-
-// Tạo mới Safety
-exports.create = async (req, res) => {
- try {
- const safetyData = req.body; // Tùy chỉnh parse nếu cần
- const newSafety = new Safety(safetyData);
- await newSafety.save();
- req.flash("success_msg", "Safety created successfully");
- res.redirect("/admin/safety");
- } catch (err) {
- console.error("Create error:", err);
- req.flash("error_msg", `Create error: ${err.message || "Unknown"}`);
- res.redirect("/admin/safety/create");
- }
-};
-
-// Cập nhật Safety
-exports.update = async (req, res) => {
- try {
- const { hero, approach, philosophy, security } = req.body;
-
- // Parse JSON strings
- const parseJson = (data) => {
- if (!data) return null;
- if (typeof data === "string") {
- try {
- return JSON.parse(data);
- } catch (e) {
- return null;
- }
- }
- return data;
- };
-
- const heroData = parseJson(hero);
- const approachData = parseJson(approach);
- const philosophyData = parseJson(philosophy);
- const securityData = parseJson(security);
-
- // Tìm hoặc tạo safety record
- const items = await Safety.find().sort({ updatedAt: -1 }).limit(1);
- let safety = items && items.length > 0 ? items[0] : null;
-
- // ✅ Capture BEFORE state
- const beforeData = safety
- ? JSON.parse(JSON.stringify(safety.toObject ? safety.toObject() : safety))
- : {};
-
- if (!safety) {
- // Tạo mới
- safety = new Safety({
- hero: heroData || { title: "", banner: "" },
- approach: approachData || {},
- philosophy: philosophyData || {},
- security: securityData || {},
- });
- } else {
- // Cập nhật
- if (heroData) safety.hero = heroData;
- if (approachData) safety.approach = approachData;
- if (philosophyData) safety.philosophy = philosophyData;
- if (securityData) safety.security = securityData;
- }
-
- await safety.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(
- JSON.stringify(safety.toObject ? safety.toObject() : safety),
- );
-
- // ✅ AUDIT LOGGING - Safety Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Safety",
- documentId: safety._id,
- action: AUDIT_ACTIONS.UPDATE_SAFETY,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash("success_msg", "Safety updated successfully");
- res.redirect("/admin/safety");
- } catch (err) {
- console.error("Update error:", err);
- req.flash("error_msg", `Update error: ${err.message || "Unknown"}`);
- res.redirect("/admin/safety");
- }
-};
-
-// Xóa Safety
-exports.delete = async (req, res) => {
- try {
- const safety = await Safety.findById(req.params.id);
- if (!safety) {
- req.flash("error_msg", "Safety record not found");
- return res.redirect("/admin/safety");
- }
- await Safety.findByIdAndDelete(req.params.id);
- req.flash("success_msg", "Safety record deleted successfully");
- res.redirect("/admin/safety");
- } catch (err) {
- console.error("Delete error:", err);
- req.flash("error_msg", `Delete error: ${err.message || "Unknown"}`);
- res.redirect("/admin/safety");
- }
-};
diff --git a/controllers/serviceController.js b/controllers/serviceController.js
deleted file mode 100644
index 9c25c63..0000000
--- a/controllers/serviceController.js
+++ /dev/null
@@ -1,396 +0,0 @@
-const { getServiceData } = require("../services/service.service");
-const Service = require("../models/service");
-const { addBaseUrlToImages, getFullImageUrl } = require("../utils/imageHelper");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-const slugify = require("slugify");
-
-// Admin page - Service list
-exports.index = async (req, res) => {
- try {
- const data = await getServiceData();
- console.log(data.services.items.image);
- res.render("admin/service/index", {
- title: "Service Management",
- data,
- layout: "layouts/main",
- getFullImageUrl, // Truyền helper function vào view
- });
- } catch (err) {
- console.error(err);
- req.flash("error_msg", "Error loading service data");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Admin page - Service edit
-exports.edit = async (req, res) => {
- try {
- const { slug } = req.params;
- const data = await getServiceData();
-
- const service = data.services?.items?.find((item) => item.slug === slug);
- if (!service) {
- req.flash("error_msg", "Service not found");
- return res.redirect("/admin/service");
- }
-
- res.render("admin/service/edit", {
- title: `Edit Service - ${service.name}`,
- service,
- layout: "layouts/main",
- getFullImageUrl,
- });
- } catch (err) {
- console.error(err);
- req.flash("error_msg", "Error loading service for editing");
- res.redirect("/admin/service");
- }
-};
-
-// Update single service
-exports.updateService = async (req, res) => {
- try {
- const { slug } = req.params;
- const currentData = await getServiceData();
-
- const serviceIndex = currentData.services?.items?.findIndex(
- (item) => item.slug === slug,
- );
- if (serviceIndex === -1) {
- req.flash("error_msg", "Service not found");
- return res.redirect("/admin/service");
- }
-
- const oldItem = JSON.parse(
- JSON.stringify(currentData.services.items[serviceIndex]),
- );
-
- // Update service data
- const updatedData = { ...currentData.toObject?.() };
- updatedData.services.items[serviceIndex] = {
- ...updatedData.services.items[serviceIndex],
- name: req.body.name,
- slug: req.body.slug,
- description: req.body.description,
- image: req.body.image,
- layout: req.body.layout,
- };
-
- if (currentData._id) {
- await Service.findByIdAndUpdate(currentData._id, updatedData);
- } else {
- await Service.create(updatedData);
- }
- const newItem = updatedData.services.items[serviceIndex];
-
- const changes = diffObject(oldItem, newItem);
- console.log("USER:", req.session?.user || req.user || "No user found");
-
- await writeAuditLog({
- model: "Service",
- documentId: currentData._id,
- action: AUDIT_ACTIONS.UPDATE_SERVICE,
- before: oldItem,
- after: newItem,
- changes,
- req,
- });
- req.flash("success_msg", "Service updated successfully");
- res.redirect("/admin/service");
- } catch (err) {
- console.error(err);
- req.flash("error_msg", err.message);
- res.redirect("/admin/service");
- }
-};
-
-// Admin page - Service details
-exports.details = async (req, res) => {
- try {
- const { slug } = req.params;
- const data = await getServiceData();
-
- const service = data.services?.items?.find((item) => item.slug === slug);
- if (!service) {
- req.flash("error_msg", "Service not found");
- return res.redirect("/admin/service");
- }
-
- res.render("admin/service/details", {
- title: `Service Details - ${service.name}`,
- service,
- layout: "layouts/main",
- getFullImageUrl, // Truyền helper function vào view
- });
- } catch (err) {
- console.error(err);
- req.flash("error_msg", "Error loading service details");
- res.redirect("/admin/service");
- }
-};
-
-// Update service list
-exports.update = async (req, res) => {
- try {
- const currentData = await getServiceData();
- const sections = [
- "pageTitle",
- "services",
- "destinations",
- "visas",
- "reviews",
- ];
-
- let updatedData = { ...currentData.toObject?.() };
- let hasChanges = false;
-
- sections.forEach((section) => {
- if (!req.body[section]) return;
-
- const newData = JSON.parse(req.body[section]);
- if (JSON.stringify(newData) !== JSON.stringify(currentData[section])) {
- updatedData[section] = newData;
- hasChanges = true;
- }
- });
-
- if (!hasChanges) {
- req.flash("info_msg", "No changes were made");
- return res.redirect("/admin/service");
- }
-
- if (currentData._id) {
- await Service.findByIdAndUpdate(currentData._id, updatedData);
- } else {
- await Service.create(updatedData);
- }
-
- req.flash("success_msg", "Service updated successfully");
- res.redirect("/admin/service");
- } catch (err) {
- console.error(err);
- req.flash("error_msg", err.message);
- res.redirect("/admin/service");
- }
-};
-
-// Update service details
-exports.updateDetails = async (req, res) => {
- try {
- const { slug } = req.params;
- const currentData = await getServiceData();
-
- const serviceIndex = currentData.services?.items?.findIndex(
- (item) => item.slug === slug,
- );
- if (serviceIndex === -1) {
- req.flash("error_msg", "Service not found");
- return res.redirect("/admin/service");
- }
- const beforeDetails = JSON.parse(
- JSON.stringify(currentData.services.items[serviceIndex].details || {}),
- );
- // Parse features and FAQ from JSON strings
- const features = req.body.features ? JSON.parse(req.body.features) : [];
- const faq = req.body.faq ? JSON.parse(req.body.faq) : [];
-
- // Update service details
- const updatedData = { ...currentData.toObject?.() };
- const updatedDetails = {
- title: req.body.title,
- description: req.body.description,
- mainImage: req.body.mainImage,
- overviewTitle: req.body.overviewTitle,
- overviewDescription: req.body.overviewDescription,
- additionalDescription: req.body.additionalDescription,
- keyFeaturesTitle: req.body.keyFeaturesTitle,
- keyFeaturesImage: req.body.keyFeaturesImage,
- features,
- faqTitle: req.body.faqTitle,
- faqImage: req.body.faqImage,
- faq,
- };
-
- updatedData.services.items[serviceIndex].details = updatedDetails;
- if (currentData._id) {
- await Service.findByIdAndUpdate(currentData._id, updatedData);
- } else {
- await Service.create(updatedData);
- }
- const changes = diffObject(beforeDetails, updatedDetails);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Service",
- documentId: currentData._id,
- action: AUDIT_ACTIONS.UPDATE_SERVICE_DETAILS,
- before: beforeDetails,
- after: updatedDetails,
- changes,
- req,
- });
- }
-
- req.flash("success_msg", "Service details updated successfully");
- res.redirect(`/admin/service/${slug}/details`);
- } catch (err) {
- console.error(err);
- req.flash("error_msg", err.message);
- res.redirect("/admin/service");
- }
-};
-
-// API endpoint
-exports.api = async (req, res) => {
- try {
- const serviceData = await getServiceData();
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
-
- const processedData = addBaseUrlToImages(serviceData, baseUrl);
- res.json(processedData);
- } catch (err) {
- res.status(500).json({ error: "Error loading service data" });
- }
-};
-
-/**
- * Get service details by slug - API endpoint
- */
-exports.getServiceBySlug = async (req, res) => {
- try {
- const { slug } = req.params;
-
- const serviceDoc = await Service.findOne().lean();
-
- if (!serviceDoc) {
- return res.status(404).json({
- success: false,
- message: "Service data not found",
- });
- }
-
- // Find service by slug
- const service = serviceDoc.services?.items?.find(
- (item) => item.slug === slug,
- );
-
- if (!service) {
- return res.status(404).json({
- success: false,
- message: `Service with slug '${slug}' not found`,
- });
- }
-
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
-
- // Return service details in the expected format
- const responseData = {
- pageTitle: serviceDoc.pageTitle,
- breadcrumb: {
- ...serviceDoc.breadcrumb,
- title: "Service Details",
- items: [
- { label: "Home", href: "/" },
- { label: "Services", href: "/services" },
- { label: service.name, href: `/services/${slug}` },
- ],
- },
- serviceDetails: {
- content: service.details,
- keyFeatures: {
- title: service.details.keyFeaturesTitle || "Key Features",
- sideImage: service.details.keyFeaturesImage || "img/default.jpg",
- items: service.details.features || [],
- },
- faq: {
- title: service.details.faqTitle || "Frequently Asked Questions",
- sideImage: service.details.faqImage || "img/default.jpg",
- items: service.details.faq || [],
- },
- },
- };
-
- const processedData = addBaseUrlToImages(responseData, baseUrl);
- res.json(processedData);
- } catch (error) {
- console.error("Error fetching service by slug:", error);
- res.status(500).json({
- success: false,
- message: "Internal server error",
- error: error.message,
- });
- }
-};
-
-/**
- * Generate slug from text - API endpoint
- */
-exports.generateSlug = async (req, res) => {
- try {
- const { text } = req.body;
-
- if (!text || typeof text !== "string") {
- return res.status(400).json({
- success: false,
- message: "Text is required",
- });
- }
-
- // Generate slug using slugify library with Vietnamese support
- const slug = slugify(text, {
- lower: true,
- strict: true,
- locale: "vi",
- });
-
- res.json({
- success: true,
- slug: slug,
- });
- } catch (error) {
- console.error("Error generating slug:", error);
- res.status(500).json({
- success: false,
- message: "Internal server error",
- error: error.message,
- });
- }
-};
-
-/**
- * Get all service slugs - API endpoint
- */
-exports.getServiceSlugs = async (req, res) => {
- try {
- const serviceDoc = await Service.findOne().lean();
-
- if (!serviceDoc?.services?.items) {
- return res.json({
- success: true,
- slugs: [],
- });
- }
-
- const slugs = serviceDoc.services.items.map((item) => ({
- slug: item.slug,
- name: item.name,
- id: item.id,
- }));
-
- res.json({
- success: true,
- slugs,
- });
- } catch (error) {
- console.error("Error fetching service slugs:", error);
- res.status(500).json({
- success: false,
- message: "Internal server error",
- error: error.message,
- });
- }
-};
diff --git a/controllers/settingController.js b/controllers/settingController.js
deleted file mode 100644
index 71a6561..0000000
--- a/controllers/settingController.js
+++ /dev/null
@@ -1,56 +0,0 @@
-const { readJsonFile, writeJsonFile } = require('../utils/jsonHelper');
-
-// Hiển thị cài đặt
-exports.getSettings = async (req, res) => {
- try {
- // Lấy cài đặt từ file content.json
- const content = readJsonFile('content');
- const settings = content.settings || {
- siteName: 'CMS-SIMS',
- description: 'Hệ thống quản lý nội dung đơn giản'
- };
-
- res.render('admin/settings', {
- title: 'Cài đặt hệ thống',
- settings
- });
- } catch (err) {
- console.error(err);
- req.flash('error_msg', 'Error loading settings');
- res.redirect('/admin/dashboard');
- }
-};
-
-// Cập nhật cài đặt
-exports.updateSettings = async (req, res) => {
- try {
- const { siteName, description } = req.body;
-
- // Kiểm tra dữ liệu
- if (!siteName) {
- req.flash('error_msg', 'Website name cannot be empty');
- return res.redirect('/admin/settings');
- }
-
- // Lấy dữ liệu hiện tại
- const content = readJsonFile('content');
-
- // Cập nhật thông tin
- content.settings = {
- ...content.settings,
- siteName,
- description,
- updatedAt: new Date().toISOString()
- };
-
- // Lưu lại dữ liệu
- writeJsonFile('content', content);
-
- req.flash('success_msg', 'Settings updated successfully');
- res.redirect('/admin/settings');
- } catch (err) {
- console.error(err);
- req.flash('error_msg', 'Error updating settings');
- res.redirect('/admin/settings');
- }
-};
\ No newline at end of file
diff --git a/controllers/socialLinkController.js b/controllers/socialLinkController.js
deleted file mode 100644
index 4308cf3..0000000
--- a/controllers/socialLinkController.js
+++ /dev/null
@@ -1,321 +0,0 @@
-const Header = require("../models/header");
-
-// Get all social links
-exports.index = async (req, res) => {
- try {
- const header = await Header.findOne({ status: "active" }).sort({ order: 1 });
-
- if (!header) {
- return res.status(404).json({
- success: false,
- message: "No active header found",
- });
- }
-
- res.json({
- success: true,
- data: header.top?.socialLinks || [],
- });
- } catch (error) {
- res.status(500).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Get single social link by platform
-exports.show = async (req, res) => {
- try {
- const { platform } = req.params;
- const header = await Header.findOne({ status: "active" }).sort({ order: 1 });
-
- if (!header) {
- return res.status(404).json({
- success: false,
- message: "No active header found",
- });
- }
-
- const socialLink = header.top?.socialLinks?.find((link) => link.platform === platform);
-
- if (!socialLink) {
- return res.status(404).json({
- success: false,
- message: "Social link not found",
- });
- }
-
- res.json({
- success: true,
- data: socialLink,
- });
- } catch (error) {
- res.status(500).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Create social link
-exports.store = async (req, res) => {
- try {
- let { platform, url, icon } = req.body;
-
- // Convert platform to lowercase
- platform = platform.toLowerCase().trim();
- url = url.trim();
- icon = icon ? icon.trim() : null;
-
- console.log("Creating social link:", { platform, url, icon });
-
- // Validate required fields
- if (!platform || !url) {
- console.log("Validation failed: platform or url missing");
- return res.status(400).json({
- success: false,
- message: "Platform and URL are required",
- });
- }
-
- // Validate platform is in enum
- const validPlatforms = ["linkedin", "twitter", "instagram", "youtube", "facebook"];
- if (!validPlatforms.includes(platform)) {
- console.log("Invalid platform:", platform);
- return res.status(400).json({
- success: false,
- message: `Invalid platform. Must be one of: ${validPlatforms.join(", ")}`,
- });
- }
-
- // Find header
- let header = await Header.findOne({ status: "active" }).sort({ order: 1 });
-
- if (!header) {
- console.log("No active header found");
- return res.status(404).json({
- success: false,
- message: "No active header found",
- });
- }
-
- console.log("Found header:", header._id);
-
- // Check if platform already exists
- const existingLink = header.top?.socialLinks?.find((link) => link.platform === platform);
-
- if (existingLink) {
- console.log("Platform already exists:", platform);
- return res.status(400).json({
- success: false,
- message: `Social link for ${platform} already exists`,
- });
- }
-
- // Add new social link
- if (!header.top) {
- header.top = {};
- }
- if (!header.top.socialLinks) {
- header.top.socialLinks = [];
- }
-
- // Calculate next order number
- const maxOrder =
- header.top.socialLinks.length > 0 ? Math.max(...header.top.socialLinks.map((link) => link.order || 0)) : 0;
-
- header.top.socialLinks.push({
- platform,
- url,
- icon: icon || `fa-brands fa-${platform}`,
- order: maxOrder + 1,
- });
-
- console.log("Saving header with new social link");
- await header.save();
-
- console.log("Social link created successfully");
- res.status(201).json({
- success: true,
- message: "Social link created successfully",
- data: header.top.socialLinks[header.top.socialLinks.length - 1],
- });
- } catch (error) {
- console.error("Error creating social link:", error);
- res.status(400).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Update social link
-exports.update = async (req, res) => {
- try {
- let { platform } = req.params;
- let { url, icon } = req.body;
-
- // Convert to lowercase
- platform = platform.toLowerCase().trim();
- url = url.trim();
- icon = icon ? icon.trim() : null;
-
- // Validate required fields
- if (!url) {
- return res.status(400).json({
- success: false,
- message: "URL is required",
- });
- }
-
- // Find header
- const header = await Header.findOne({ status: "active" }).sort({ order: 1 });
-
- if (!header) {
- return res.status(404).json({
- success: false,
- message: "No active header found",
- });
- }
-
- // Find and update social link
- const socialLink = header.top?.socialLinks?.find((link) => link.platform === platform);
-
- if (!socialLink) {
- return res.status(404).json({
- success: false,
- message: "Social link not found",
- });
- }
-
- socialLink.url = url;
- if (icon) {
- socialLink.icon = icon;
- }
-
- await header.save();
-
- res.json({
- success: true,
- message: "Social link updated successfully",
- data: socialLink,
- });
- } catch (error) {
- res.status(400).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Delete social link
-exports.destroy = async (req, res) => {
- try {
- let { platform } = req.params;
-
- // Convert to lowercase
- platform = platform.toLowerCase().trim();
-
- console.log("Deleting social link:", platform);
-
- // Find header
- const header = await Header.findOne({ status: "active" }).sort({ order: 1 });
-
- if (!header) {
- console.log("No active header found");
- return res.status(404).json({
- success: false,
- message: "No active header found",
- });
- }
-
- // Find and remove social link
- const index = header.top?.socialLinks?.findIndex((link) => link.platform === platform);
-
- if (index === -1 || index === undefined) {
- console.log("Social link not found:", platform);
- return res.status(404).json({
- success: false,
- message: "Social link not found",
- });
- }
-
- const deletedLink = header.top.socialLinks.splice(index, 1);
-
- console.log("Saving header after delete");
- await header.save();
-
- console.log("Social link deleted successfully");
- res.json({
- success: true,
- message: "Social link deleted successfully",
- data: deletedLink[0],
- });
- } catch (error) {
- console.error("Error deleting social link:", error);
- res.status(500).json({
- success: false,
- message: error.message,
- });
- }
-};
-
-// Bulk update social links (used for reordering and batch updates)
-exports.reorder = async (req, res) => {
- try {
- const { socialLinks } = req.body;
-
- if (!Array.isArray(socialLinks)) {
- return res.status(400).json({
- success: false,
- message: "socialLinks must be an array",
- });
- }
-
- // Find header
- let header = await Header.findOne({ status: "active" }).sort({ order: 1 });
-
- if (!header) {
- return res.status(404).json({
- success: false,
- message: "No active header found",
- });
- }
-
- // Validate all social links
- for (const link of socialLinks) {
- if (!link.platform || !link.url) {
- return res.status(400).json({
- success: false,
- message: "Each social link must have platform and url",
- });
- }
- }
-
- // Update social links with order field
- if (!header.top) {
- header.top = {};
- }
-
- header.top.socialLinks = socialLinks.map((link, index) => ({
- platform: link.platform,
- url: link.url,
- icon: link.icon || `fa-brands fa-${link.platform}`,
- order: link.order || index + 1, // Use provided order or calculate from index
- }));
-
- await header.save();
-
- res.json({
- success: true,
- message: "Social links updated successfully",
- data: header.top.socialLinks,
- });
- } catch (error) {
- res.status(400).json({
- success: false,
- message: error.message,
- });
- }
-};
diff --git a/controllers/termsController.js b/controllers/termsController.js
deleted file mode 100644
index 79bd924..0000000
--- a/controllers/termsController.js
+++ /dev/null
@@ -1,574 +0,0 @@
-// controllers/termsController.js
-const Terms = require("../models/terms");
-const { addBaseUrlToImages } = require("../utils/imageHelper"); // Import helper
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// API để lấy terms data (cho frontend)
-exports.api = async (req, res) => {
- try {
- const language = req.query.lang || "en";
-
- // Sử dụng getDefault để đảm bảo luôn có data
- const terms = await Terms.getDefault(language);
-
- // Trả về data với cấu trúc mới
- const termsData = terms.toObject();
-
- // Sử dụng helper để thêm base URL vào đường dẫn ảnh
- // Truyền baseUrl từ request hoặc từ environment
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(termsData, baseUrl);
-
- res.json({
- success: true,
- data: {
- hero: processedData.hero,
- page: processedData.page,
- content: processedData.content,
- },
- });
- } catch (error) {
- console.error("API Error:", error);
- res.status(500).json({
- success: false,
- error: "Error loading terms data",
- message: error.message,
- });
- }
-};
-
-// API để lấy toàn bộ terms data (cho admin)
-exports.getTermsData = async (req, res) => {
- try {
- const language = req.query.lang || "en";
- const terms = await Terms.findOne({ name: "default", language: language });
-
- if (!terms) {
- return res.status(404).json({
- success: false,
- error: "Terms data not found",
- });
- }
-
- const termsData = terms.toObject();
-
- // Thêm base URL vào đường dẫn ảnh
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(termsData, baseUrl);
-
- res.json({
- success: true,
- data: processedData,
- });
- } catch (error) {
- console.error("Error getting terms data:", error);
- res.status(500).json({
- success: false,
- error: "Error loading terms data",
- });
- }
-};
-
-// API để lấy data theo ngôn ngữ
-exports.getByLanguage = async (req, res) => {
- try {
- const language = req.params.lang || "en";
-
- const terms = await Terms.findOne({ name: "default", language: language });
-
- if (!terms) {
- return res.status(404).json({
- success: false,
- error: "Terms data not found for language: " + language,
- });
- }
-
- const termsData = terms.toObject();
-
- // Thêm base URL vào đường dẫn ảnh
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(termsData, baseUrl);
-
- res.json({
- success: true,
- data: {
- hero: processedData.hero,
- page: processedData.page,
- content: processedData.content,
- },
- });
- } catch (error) {
- console.error("Error getting terms by language:", error);
- res.status(500).json({
- success: false,
- error: "Error loading terms data",
- });
- }
-};
-
-// Render admin view (không cần thêm baseUrl ở đây vì dùng trong CMS)
-exports.index = async (req, res) => {
- try {
- // Luôn đảm bảo có default data
- const terms = await Terms.getDefault("en");
- const data = terms.toObject();
-
- const frontendUrl = process.env.FRONTEND_URL || "http://localhost:3000";
-
- res.render("admin/terms/index", {
- title: "Terms & Conditions Management",
- layout: "layouts/main",
- data, // Không cần addBaseUrlToImages cho admin view
- frontendUrl,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (error) {
- console.error("Error in terms index:", error);
- req.flash("error_msg", "An error occurred while loading the page");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Cập nhật dữ liệu terms (CẬP NHẬT CẤU TRÚC MỚI)
-exports.update = async (req, res) => {
- try {
- const { hero, page, content } = req.body;
-
- // Parse JSON strings
- const parseJson = (data) => {
- if (!data) return null;
- if (typeof data === "string") {
- try {
- return JSON.parse(data);
- } catch (e) {
- console.error("JSON parse error:", e);
- return null;
- }
- }
- return data;
- };
-
- // Parse all data với cấu trúc mới
- const heroData = parseJson(hero) || {};
- const pageData = parseJson(page) || {};
- const contentData = parseJson(content) || {};
-
- // Normalize embed blocks (convert YouTube watch URLs to /embed/ URLs)
- function extractYouTubeId(url) {
- if (!url || typeof url !== "string") return null;
- // common YouTube URL patterns
- const m = url.match(
- /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:watch\?v=|embed\/|v\/|shorts\/))([A-Za-z0-9_-]{11})/,
- );
- return m ? m[1] : null;
- }
-
- // Trong exports.update
- if (contentData && Array.isArray(contentData.content)) {
- contentData.content = contentData.content.map((item) => {
- if (item && item.type === "embed") {
- let embedUrl = item.embed || item.url || item.source || "";
-
- // Luôn chuyển đổi sang embed URL nếu là watch URL
- if (embedUrl.includes("youtube.com/watch")) {
- const videoId = extractYouTubeId(embedUrl);
- if (videoId) {
- item.embed = `https://www.youtube.com/embed/${videoId}`;
- item.videoId = videoId;
- }
- }
- // Đảm bảo có videoId
- else if (embedUrl && !item.videoId) {
- const videoId = extractYouTubeId(embedUrl);
- if (videoId) {
- item.videoId = videoId;
- }
- }
- }
- return item;
- });
- }
-
- // Tìm hoặc tạo terms
- let terms = await Terms.findOne({ name: "default", language: "en" });
-
- // ✅ Capture BEFORE state
- const beforeData = terms
- ? JSON.parse(JSON.stringify(terms.toObject ? terms.toObject() : terms))
- : {};
-
- if (!terms) {
- // Tạo mới với cấu trúc mới
- terms = new Terms({
- name: "default",
- language: "en",
- hero: heroData,
- page: pageData,
- content: contentData,
- version: "2.0.0",
- isActive: true,
- migratedFromOldStructure: false,
- });
- } else {
- // Update existing với cấu trúc mới
- terms.hero = heroData;
- terms.page = pageData;
- terms.content = contentData;
- terms.version = "2.0.0";
- terms.migratedFromOldStructure = false;
- terms.updatedAt = new Date();
- }
-
- await terms.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(
- JSON.stringify(terms.toObject ? terms.toObject() : terms),
- );
-
- // ✅ AUDIT LOGGING - Terms Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Terms",
- documentId: terms._id,
- action: AUDIT_ACTIONS.UPDATE_TERMS,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash("success_msg", "Terms & Conditions updated successfully");
- res.redirect("/admin/terms-conditions");
- } catch (err) {
- console.error("Error updating terms:", err);
- req.flash("error_msg", err.message || "Error updating terms");
- res.redirect("/admin/terms-conditions");
- }
-};
-
-// Seed data từ JSON file mới (cấu trúc mới)
-exports.seed = async (req, res) => {
- try {
- const fs = require("fs").promises;
- const path = require("path");
-
- // Đọc file JSON
- const jsonPath = path.join(__dirname, "../data/terms-conditions.json");
- const jsonData = JSON.parse(await fs.readFile(jsonPath, "utf8"));
-
- console.log("Seeding from JSON...");
- console.log("JSON structure keys:", Object.keys(jsonData));
-
- // Kiểm tra cấu trúc JSON
- let terms;
- if (jsonData.hero && jsonData.page && jsonData.content) {
- // Cấu trúc mới
- console.log("Using new structure (hero, page, content)");
- terms = await Terms.migrateFromNewJson(jsonData, "en");
- } else if (jsonData.hero && jsonData.termsHeader && jsonData.sections) {
- // Cấu trúc cũ
- console.log("Using old structure, converting to new...");
- terms = await Terms.migrateFromJson(jsonData, "en");
- } else {
- throw new Error("Unknown JSON structure");
- }
-
- res.json({
- success: true,
- message: "Terms data seeded successfully",
- data: {
- id: terms._id,
- hero: terms.hero,
- page: terms.page,
- content: terms.content,
- },
- });
- } catch (error) {
- console.error("Error seeding terms:", error);
- res.status(500).json({
- success: false,
- error: error.message || "Error seeding terms data",
- });
- }
-};
-
-// API preview cho admin (tạo HTML preview)
-exports.preview = async (req, res) => {
- try {
- const { hero, page, content } = req.body;
-
- // Parse JSON strings
- const parseJson = (data) => {
- if (!data) return null;
- if (typeof data === "string") {
- try {
- return JSON.parse(data);
- } catch (e) {
- console.error("JSON parse error:", e);
- return null;
- }
- }
- return data;
- };
-
- const heroData = parseJson(hero) || {};
- const pageData = parseJson(page) || {};
- const contentData = parseJson(content) || {};
-
- // Thêm base URL vào đường dẫn ảnh cho preview
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedHeroData = addBaseUrlToImages(heroData, baseUrl);
-
- // Render preview HTML
- const html = `
-
-
-
-
-
- ${pageData.title || "Terms & Conditions Preview"}
-
-
-
-
-
-
-
${heroData.title || "Terms & Conditions"}
-
-
-
-
-
-
-
-
- ${renderContentItems(contentData.content || [])}
-
-
-
-
- `;
-
- res.send(html);
- } catch (error) {
- console.error("Error generating preview:", error);
- res.status(500).send("Error generating preview");
- }
-};
-
-// Helper function để render content items
-function renderContentItems(contentItems) {
- if (!Array.isArray(contentItems) || contentItems.length === 0) {
- return "No content available.
";
- }
-
- return contentItems
- .map((item) => {
- switch (item.type) {
- case "paragraph":
- return ``;
-
- case "section":
- let html = ``;
- html += `
${item.title || ""} `;
- html += `
${item.content || ""}
`;
-
- if (item.subsections && item.subsections.length > 0) {
- item.subsections.forEach((subsection) => {
- if (subsection.type === "cancellation_table") {
- html += `
${subsection.title || ""} `;
- if (subsection.items && subsection.items.length > 0) {
- html += "
";
- subsection.items.forEach((listItem) => {
- html += `${listItem} `;
- });
- html += " ";
- }
- } else if (subsection.type === "cancellation_section") {
- html += `
${subsection.title || ""} `;
- if (subsection.items && subsection.items.length > 0) {
- html += "
";
- subsection.items.forEach((listItem) => {
- html += `${listItem} `;
- });
- html += " ";
- }
- } else if (subsection.type === "note") {
- html += `
${subsection.text || ""}
`;
- }
- });
- }
-
- html += `
`;
- return html;
-
- case "note":
- return `${item.text || ""}
`;
- case "embed":
- // Support several embed shapes: { embed }, { url }, { source }, { videoId }
- const embedSrc =
- item.embed ||
- item.url ||
- item.source ||
- (item.videoId
- ? `https://www.youtube.com/embed/${item.videoId}`
- : "");
- if (!embedSrc) return `Invalid embed
`;
- return ``;
-
- default:
- return `Unknown content type: ${item.type}
`;
- }
- })
- .join("");
-}
-
-// API để tạo terms mới (cho các ngôn ngữ khác)
-exports.create = async (req, res) => {
- try {
- const { hero, page, content, language } = req.body;
-
- if (!language) {
- return res.status(400).json({
- success: false,
- error: "Language is required",
- });
- }
-
- // Kiểm tra đã tồn tại chưa
- const existing = await Terms.findOne({
- name: "default",
- language: language,
- });
- if (existing) {
- return res.status(400).json({
- success: false,
- error: "Terms already exists for language: " + language,
- });
- }
-
- // Parse JSON nếu cần
- const parseJson = (data) => {
- if (!data) return null;
- if (typeof data === "string") {
- try {
- return JSON.parse(data);
- } catch (e) {
- console.error("JSON parse error:", e);
- return null;
- }
- }
- return data;
- };
-
- const terms = new Terms({
- name: "default",
- language: language,
- hero: parseJson(hero) || {},
- page: parseJson(page) || {},
- content: parseJson(content) || {},
- version: "2.0.0",
- isActive: true,
- migratedFromOldStructure: false,
- });
-
- await terms.save();
-
- res.json({
- success: true,
- message: "Terms created successfully for language: " + language,
- data: terms,
- });
- } catch (error) {
- console.error("Error creating terms:", error);
- res.status(500).json({
- success: false,
- error: error.message || "Error creating terms",
- });
- }
-};
-
-// API để xóa terms (theo ngôn ngữ)
-exports.delete = async (req, res) => {
- try {
- const language = req.params.lang;
-
- if (!language) {
- return res.status(400).json({
- success: false,
- error: "Language is required",
- });
- }
-
- // Không cho phép xóa tiếng Anh mặc định
- if (language === "en") {
- return res.status(400).json({
- success: false,
- error: "Cannot delete default English terms",
- });
- }
-
- const result = await Terms.deleteOne({
- name: "default",
- language: language,
- });
-
- if (result.deletedCount === 0) {
- return res.status(404).json({
- success: false,
- error: "Terms not found for language: " + language,
- });
- }
-
- res.json({
- success: true,
- message: "Terms deleted successfully for language: " + language,
- });
- } catch (error) {
- console.error("Error deleting terms:", error);
- res.status(500).json({
- success: false,
- error: error.message || "Error deleting terms",
- });
- }
-};
diff --git a/controllers/testimonialController.js b/controllers/testimonialController.js
deleted file mode 100644
index cb447cc..0000000
--- a/controllers/testimonialController.js
+++ /dev/null
@@ -1,138 +0,0 @@
-const { addBaseUrlToImages } = require("../utils/imageHelper");
-const Home = require("../models/home");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// Get testimonial data from Home model
-const getTestimonialData = async () => {
- const home = await Home.findOne().sort({ updatedAt: -1 });
- if (!home || !home.testimonials) {
- return null;
- }
- return home.testimonials.toObject
- ? home.testimonials.toObject()
- : home.testimonials;
-};
-
-// API to get testimonial data
-exports.api = async (req, res) => {
- try {
- const testimonial = await getTestimonialData();
- if (!testimonial) {
- return res.status(404).json({ error: "Testimonial data not found" });
- }
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(testimonial, baseUrl);
- res.json(processedData);
- } catch (err) {
- console.error("API Error:", err);
- res.status(500).json({ error: "Error loading testimonial data" });
- }
-};
-
-// Render admin view
-exports.index = async (req, res) => {
- try {
- const data = (await getTestimonialData()) || {
- heading: "Student Reviews & Testimonials",
- subheading: "What Our Students Say",
- videoUrl: "",
- videoThumbnail: "",
- items: [],
- };
-
- const frontendUrl = process.env.FRONTEND_URL;
-
- res.render("admin/home/testimonial/index", {
- title: "Testimonials Management",
- layout: "layouts/main",
- data,
- frontendUrl,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (error) {
- console.error("Error in testimonial index:", error);
- req.flash("error_msg", "An error occurred while loading the page");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Cập nhật dữ liệu testimonial (chỉ update phần testimonials của Home)
-exports.update = async (req, res) => {
- try {
- const { heading, subheading, videoUrl, videoThumbnail, items } = req.body;
-
- // Parse JSON strings nếu cần
- const parseJson = (data) => {
- if (!data) return null;
- if (typeof data === "string") {
- try {
- return JSON.parse(data);
- } catch (e) {
- return null;
- }
- }
- return data;
- };
-
- const itemsData = parseJson(items);
-
- // Tìm hoặc tạo Home document
- let home = await Home.findOne().sort({ updatedAt: -1 });
-
- if (!home) {
- home = new Home({});
- }
-
- // ✅ Capture BEFORE state
- const beforeData = home.testimonials
- ? JSON.parse(
- JSON.stringify(
- home.testimonials.toObject
- ? home.testimonials.toObject()
- : home.testimonials,
- ),
- )
- : {};
-
- const updatedTestimonialData = {
- heading: heading || "Student Reviews & Testimonials",
- subheading: subheading || "What Our Students Say",
- videoUrl: videoUrl || "",
- videoThumbnail: videoThumbnail || "",
- items: itemsData || [],
- };
-
- // Cập nhật chỉ phần testimonials
- home.testimonials = updatedTestimonialData;
-
- await home.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(updatedTestimonialData));
-
- // ✅ AUDIT LOGGING - Testimonial Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Home",
- documentId: home._id,
- action: AUDIT_ACTIONS.UPDATE_TESTIMONIAL,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash("success_msg", "Testimonials updated successfully");
- res.redirect("/admin/home/testimonials");
- } catch (err) {
- console.error("Error updating testimonials:", err);
- req.flash("error_msg", err.message || "Error updating testimonials");
- res.redirect("/admin/home/testimonials");
- }
-};
diff --git a/controllers/travelController.js b/controllers/travelController.js
deleted file mode 100644
index 834dde8..0000000
--- a/controllers/travelController.js
+++ /dev/null
@@ -1,290 +0,0 @@
-const Travel = require("../models/travel");
-const { addBaseUrlToImages } = require("../utils/imageHelper");
-const fs = require("fs").promises;
-const path = require("path");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-/**
- * Hàm Helper: Trích xuất ID YouTube từ nhiều định dạng link khác nhau
- */
-function extractYouTubeId(url) {
- if (!url || typeof url !== "string") return null;
- // Hỗ trợ: watch?v=, embed/, youtu.be/, shorts/
- const regex =
- /(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:watch\?v=|embed\/|v\/|shorts\/))([A-Za-z0-9_-]{11})/;
- const match = url.match(regex);
- return match ? match[1] : null;
-}
-
-/**
- * Hàm Helper: Làm sạch danh sách blocks của Editor.js
- * Loại bỏ duplicate video (vừa embed vừa text link) và paragraph rỗng
- */
-function sanitizeContentBlocks(blocks) {
- if (!blocks || !Array.isArray(blocks)) return [];
-
- const seenVideoIds = new Set();
-
- // Bước 1: Duyệt qua để chuẩn hóa block embed và lấy danh sách ID video
- const processedBlocks = blocks.map((block) => {
- if (block.type === "embed") {
- const url = block.data.source || block.data.embed || "";
- const videoId = extractYouTubeId(url);
- if (videoId) {
- seenVideoIds.add(videoId);
- // Cập nhật lại data chuẩn cho Editor.js
- block.data.embed = `https://www.youtube.com/embed/${videoId}`;
- block.data.source = url;
- block.data.videoId = videoId;
- block.data.service = "youtube";
- }
- }
- return block;
- });
-
- // Bước 2: Lọc bỏ paragraph rác
- return processedBlocks.filter((block) => {
- if (block.type === "paragraph") {
- const text = (block.data?.text || "").trim();
-
- // Xóa paragraph rỗng
- if (text === "" || text === " " || text === " ") return false;
-
- // Xóa paragraph nếu nó chỉ chứa 1 link YouTube đã được embed ở trên
- const videoIdInText = extractYouTubeId(text);
- if (videoIdInText && seenVideoIds.has(videoIdInText)) {
- console.log(
- `[Sanitizer] Removed duplicate text link for video: ${videoIdInText}`,
- );
- return false;
- }
- }
- return true;
- });
-}
-
-// GET: Show travel editor
-exports.index = async (req, res) => {
- try {
- const travel = await Travel.findOne();
-
- if (!travel) {
- return res.render("admin/travel/index", {
- title: "Travel Management",
- data: {
- page: {
- title: "Travel Information",
- description: "",
- metadata: { title: "", description: "" },
- },
- hero: { title: "Travel Information", backgroundImage: "" },
- content: { blocks: [] },
- enableScrollspy: false,
- },
- message: "No travel data found. Please run migration first.",
- });
- }
-
- res.render("admin/travel/index", {
- title: "Travel Management",
- data: travel,
- });
- } catch (error) {
- console.error("Error loading travel page:", error);
- res.status(500).send("Error loading travel page");
- }
-};
-
-// POST: Update travel information
-exports.update = async (req, res) => {
- try {
- const { page, hero, content, enableScrollspy } = req.body;
-
- // Get current data for before state
- const currentTravel = await Travel.findOne();
-
- // ✅ Capture BEFORE state
- const beforeData = currentTravel
- ? JSON.parse(
- JSON.stringify(
- currentTravel.toObject ? currentTravel.toObject() : currentTravel,
- ),
- )
- : {};
-
- const updateData = {};
-
- if (page) updateData.page = JSON.parse(page);
- if (hero) updateData.hero = JSON.parse(hero);
-
- if (content) {
- let contentObj = JSON.parse(content);
- // Áp dụng bộ lọc dọn dẹp nội dung
- contentObj.blocks = sanitizeContentBlocks(contentObj.blocks);
- updateData.content = contentObj;
- }
-
- if (enableScrollspy !== undefined) {
- updateData.enableScrollspy =
- enableScrollspy === "true" || enableScrollspy === true;
- }
-
- const updatedTravel = await Travel.findOneAndUpdate({}, updateData, {
- upsert: true,
- new: true,
- });
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(
- JSON.stringify(
- updatedTravel.toObject ? updatedTravel.toObject() : updatedTravel,
- ),
- );
-
- // ✅ AUDIT LOGGING - Travel Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Travel",
- documentId: updatedTravel._id,
- action: AUDIT_ACTIONS.UPDATE_TRAVEL,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash(
- "success",
- "Travel information updated and sanitized successfully",
- );
- res.redirect("/admin/travel");
- } catch (error) {
- console.error("Error updating travel:", error);
- req.flash("error", "Error updating travel information");
- res.redirect("/admin/travel");
- }
-};
-
-// GET: Travel data API (Sử dụng cho Frontend/Public)
-exports.api = exports.getTravelData = async (req, res) => {
- try {
- const travel = await Travel.findOne();
- if (!travel) {
- return res.status(404).json({ error: "Travel data not found" });
- }
-
- const travelObj = travel.toObject();
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processed = addBaseUrlToImages(travelObj, baseUrl);
-
- return res.json({
- success: true,
- data: {
- hero: processed.hero,
- page: processed.page,
- content: processed.content,
- enableScrollspy: processed.enableScrollspy,
- },
- });
- } catch (error) {
- console.error("Error fetching travel data:", error);
- res.status(500).json({ error: "Internal server error" });
- }
-};
-
-// POST: Preview travel
-exports.preview = async (req, res) => {
- try {
- const { content, pageTitle, heroTitle, heroBackgroundImage, pageYear } =
- req.body;
-
- // Preview cũng cần được sanitize để hiển thị đúng thực tế khi lưu
- let contentObj = JSON.parse(content);
- contentObj.blocks = sanitizeContentBlocks(contentObj.blocks);
-
- const previewData = {
- page: {
- title: pageTitle || "Travel Information",
- year: pageYear || "",
- },
- hero: {
- title: heroTitle || "Travel Information",
- backgroundImage: heroBackgroundImage || "",
- },
- content: contentObj,
- enableScrollspy: false,
- };
-
- res.render("page/travel", {
- title: "Travel Preview",
- data: previewData,
- });
- } catch (error) {
- console.error("Error generating preview:", error);
- res.status(500).send("Error generating preview");
- }
-};
-
-// GET: Seed/Import from JSON
-exports.seed = async (req, res) => {
- try {
- const jsonPath = path.join(__dirname, "../data/travel.json");
- const jsonData = await fs.readFile(jsonPath, "utf-8");
- const jsonTravelData = JSON.parse(jsonData);
-
- let contentBlocks = [];
-
- // Trường hợp JSON đã có định dạng bài viết (blog format)
- if (
- Array.isArray(jsonTravelData.posts) &&
- jsonTravelData.posts.length > 0
- ) {
- const firstPost = jsonTravelData.posts[0];
- contentBlocks =
- firstPost.content && firstPost.content.blocks
- ? firstPost.content.blocks
- : [];
- }
- // Trường hợp format cũ (legacy)
- else {
- // ... (Logic chuyển đổi legacy format giữ nguyên nhưng bọc qua sanitize)
- // Ví dụ: push các header, paragraph từ locations vào contentBlocks
- }
-
- // Luôn làm sạch dữ liệu trước khi seed vào DB
- const cleanedBlocks = sanitizeContentBlocks(contentBlocks);
-
- const travelData = {
- page: {
- title:
- jsonTravelData.page?.title || "Go and Grow Camp Travel Information",
- year: jsonTravelData.page?.year || "",
- metadata: {
- title: "Travel Guide - Go and Grow Camp",
- description:
- "Everything you need to know about traveling to our camps",
- },
- },
- hero: {
- title: jsonTravelData.hero?.title || "Travel Information",
- backgroundImage: jsonTravelData.hero?.backgroundImage || "",
- },
- content: { blocks: cleanedBlocks },
- enableScrollspy: true,
- };
-
- await Travel.findOneAndUpdate({}, travelData, { upsert: true, new: true });
-
- req.flash("success", "Travel data seeded and sanitized successfully");
- res.redirect("/admin/travel");
- } catch (error) {
- console.error("Error seeding travel data:", error);
- req.flash("error", "Failed to seed travel data");
- res.redirect("/admin/travel");
- }
-};
diff --git a/controllers/uploadController.js b/controllers/uploadController.js
deleted file mode 100644
index ef6f4c8..0000000
--- a/controllers/uploadController.js
+++ /dev/null
@@ -1,228 +0,0 @@
-const path = require('path');
-const fs = require('fs');
-const jsonHelper = require('../utils/jsonHelper');
-
-// Controller xử lý upload ảnh
-const uploadController = {
- // Upload ảnh và trả về đường dẫn
- uploadImage: async (req, res) => {
- try {
- if (!req.file) {
- return res.status(400).json({ success: false, error: 'No file was uploaded' });
- }
-
- // Lấy loại ảnh từ query params
- const imageType = req.query.imageType || 'general';
-
- // Tạo đường dẫn tương đối để lưu vào database
- const relativePath = `/uploads/${imageType}/${req.file.filename}`;
- const baseUrl = process.env.BACKEND_URL || `${req.protocol}://${req.get('host')}`;
- const fullUrl = `${baseUrl}${relativePath}`;
-
- // Kiểm tra nếu file đã tồn tại từ trước
- const fileAlreadyExists = req.fileAlreadyExists || false;
-
- // Nếu client yêu cầu cập nhật trực tiếp file JSON (ví dụ activities.json),
- // thì đồng bộ camps.image và camps.camp-detail.hero.bgImage
- try {
- const jsonFile = req.body && req.body.jsonFile;
- const campLink = req.body && req.body.campLink;
-
- if (jsonFile && campLink) {
- // Đọc JSON và cập nhật camp có link khớp
- const jsonFilePath = require('path').join(__dirname, '../data', jsonFile);
- const jsonData = jsonHelper.readJsonFile(jsonFilePath);
-
- if (jsonData && Array.isArray(jsonData.camps)) {
- // campLink có thể được gửi không có dấu / đầu, chuẩn hóa
- const normalizedLink = campLink.startsWith('/') ? campLink : `/${campLink}`;
-
- const camp = jsonData.camps.find(c => (c.link || '').toString() === normalizedLink || (c.link || '').toString() === campLink);
- if (camp) {
- // Đồng bộ camps.image và camps.camp-detail.hero.bgImage - 2 trường này luôn giống nhau
- camp.image = relativePath;
-
- // Đảm bảo camp-detail.hero tồn tại và sync bgImage
- if (!camp['camp-detail']) camp['camp-detail'] = {};
- if (!camp['camp-detail'].hero) camp['camp-detail'].hero = {};
- camp['camp-detail'].hero.bgImage = relativePath;
-
- // Lưu thay đổi
- jsonHelper.writeJsonFile(jsonFilePath, jsonData);
- }
- }
- }
- } catch (e) {
- console.warn('Failed to update JSON file after upload:', e && e.message ? e.message : e);
- }
-
- return res.status(200).json({
- success: true,
- path: relativePath,
- url: fullUrl,
- reused: fileAlreadyExists,
- message: fileAlreadyExists ? 'Using existing file' : 'File uploaded successfully'
- });
- } catch (error) {
- console.error('Error uploading image:', error);
- return res.status(500).json({ success: false, error: 'Server error while uploading image' });
- }
- },
-
- // Cập nhật đường dẫn ảnh trong file JSON
- updateImagePath: async (req, res) => {
- try {
- const { jsonFile, jsonPath, newImagePath } = req.body;
-
- if (!jsonFile || !jsonPath || !newImagePath) {
- return res.status(400).json({
- success: false,
- message: 'Missing required information (jsonFile, jsonPath, newImagePath)'
- });
- }
-
- // Đọc file JSON
- const jsonFilePath = path.join(__dirname, '../data', jsonFile);
- const jsonData = jsonHelper.readJsonFile(jsonFilePath);
-
- // Cập nhật đường dẫn ảnh theo jsonPath
- // jsonPath có định dạng như "banner.image" hoặc "partners[0].logo"
- const pathParts = jsonPath.split('.');
- let current = jsonData;
-
- // Duyệt qua các phần của path trừ phần cuối
- for (let i = 0; i < pathParts.length - 1; i++) {
- const part = pathParts[i];
-
- // Kiểm tra nếu là mảng (ví dụ: partners[0])
- if (part.includes('[') && part.includes(']')) {
- const arrName = part.substring(0, part.indexOf('['));
- const index = parseInt(part.substring(part.indexOf('[') + 1, part.indexOf(']')));
-
- if (!current[arrName] || !Array.isArray(current[arrName])) {
- return res.status(400).json({
- success: false,
- message: `Array ${arrName} not found in data`
- });
- }
-
- current = current[arrName][index];
- } else {
- if (!current[part]) {
- return res.status(400).json({
- success: false,
- message: `Property ${part} not found in data`
- });
- }
-
- current = current[part];
- }
- }
-
- // Cập nhật giá trị
- const lastPart = pathParts[pathParts.length - 1];
- current[lastPart] = newImagePath;
-
- // Lưu lại file JSON
- jsonHelper.writeJsonFile(jsonFilePath, jsonData);
-
- return res.status(200).json({
- success: true,
- message: 'Image path updated successfully',
- data: { jsonPath, newImagePath }
- });
- } catch (error) {
- console.error('Error updating image path:', error);
- return res.status(500).json({ success: false, message: 'Server error while updating image path' });
- }
- },
-
- // Xóa ảnh
- deleteImage: async (req, res) => {
- try {
- const { imagePath } = req.body;
-
- if (!imagePath) {
- return res.status(400).json({ success: false, message: 'Missing image path to delete' });
- }
-
- // Chuyển đổi đường dẫn tương đối thành đường dẫn tuyệt đối
- const fullPath = path.join(__dirname, '../public', imagePath);
-
- // Kiểm tra xem file có tồn tại không
- if (!fs.existsSync(fullPath)) {
- return res.status(404).json({ success: false, message: 'Image file not found' });
- }
-
- // Xóa file
- fs.unlinkSync(fullPath);
-
- return res.status(200).json({
- success: true,
- message: 'Image deleted successfully',
- data: { imagePath }
- });
- } catch (error) {
- console.error('Error deleting image:', error);
- return res.status(500).json({ success: false, message: 'Server error while deleting image' });
- }
- },
-
- // List images in a folder
- listImages: async (req, res) => {
- try {
- const imageType = req.query.imageType || 'general';
- const dirPath = path.join(__dirname, '../public/uploads', imageType);
-
- if (!fs.existsSync(dirPath)) {
- return res.status(200).json({ success: true, images: [] });
- }
-
- const files = fs.readdirSync(dirPath).filter(f => !f.startsWith('.'));
-
- const images = files.map(name => ({
- name,
- path: `/uploads/${imageType}/${name}`,
- url: (process.env.BACKEND_URL || `${req.protocol}://${req.get('host')}`) + `/uploads/${imageType}/${name}`
- }));
-
- return res.status(200).json({ success: true, images });
- } catch (error) {
- console.error('Error listing images:', error);
- return res.status(500).json({ success: false, error: 'Server error while listing images' });
- }
- },
-
- // Upload video
- uploadVideo: async (req, res) => {
- try {
- if (!req.file) {
- return res.status(400).json({ success: false, error: 'No file was uploaded' });
- }
-
- // Kiểm tra loại file
- const fileType = req.file.mimetype;
- if (!fileType.startsWith('video/')) {
- // Xóa file nếu không phải video
- fs.unlinkSync(req.file.path);
- return res.status(400).json({ success: false, error: 'Uploaded file is not a video' });
- }
-
- // Tạo đường dẫn tương đối để lưu vào database
- const relativePath = `/uploads/videos/${req.file.filename}`;
- const baseUrl = process.env.BACKEND_URL || `${req.protocol}://${req.get('host')}`;
- const fullUrl = `${baseUrl}${relativePath}`;
-
- return res.status(200).json({
- success: true,
- path: relativePath,
- url: fullUrl
- });
- } catch (error) {
- console.error('Error uploading video:', error);
- return res.status(500).json({ success: false, error: 'Server error while uploading video' });
- }
- }
-};
-
-module.exports = uploadController;
\ No newline at end of file
diff --git a/controllers/videoGalleryController.js b/controllers/videoGalleryController.js
deleted file mode 100644
index 7487812..0000000
--- a/controllers/videoGalleryController.js
+++ /dev/null
@@ -1,119 +0,0 @@
-const { addBaseUrlToImages } = require("../utils/imageHelper");
-const Home = require("../models/home");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-
-// Get videoGallery data from Home model
-const getVideoGalleryData = async () => {
- const home = await Home.findOne().sort({ updatedAt: -1 });
- if (!home || !home.videoGallery) {
- return null;
- }
- return home.videoGallery.toObject
- ? home.videoGallery.toObject()
- : home.videoGallery;
-};
-
-// API to get videoGallery data
-exports.api = async (req, res) => {
- try {
- const videoGallery = await getVideoGalleryData();
- if (!videoGallery) {
- return res.status(404).json({ error: "Video Gallery data not found" });
- }
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(videoGallery, baseUrl);
- res.json(processedData);
- } catch (err) {
- console.error("API Error:", err);
- res.status(500).json({ error: "Error loading video gallery data" });
- }
-};
-
-// Render admin view
-exports.index = async (req, res) => {
- try {
- const data = (await getVideoGalleryData()) || {
- heading: "",
- videoUrl: "",
- thumbnail: "",
- };
-
- const frontendUrl = process.env.FRONTEND_URL;
-
- res.render("admin/home/videoGallery/index", {
- title: "Video Gallery Management",
- layout: "layouts/main",
- data,
- frontendUrl,
- currentPath: req.path,
- user: req.session.user,
- });
- } catch (error) {
- console.error("Error in videoGallery index:", error);
- req.flash("error_msg", "An error occurred while loading the page");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Cập nhật dữ liệu videoGallery
-exports.update = async (req, res) => {
- try {
- const { heading, videoUrl, thumbnail } = req.body;
-
- // Tìm hoặc tạo Home document
- let home = await Home.findOne().sort({ updatedAt: -1 });
-
- if (!home) {
- home = new Home({});
- }
-
- // ✅ Capture BEFORE state
- const beforeData = home.videoGallery
- ? JSON.parse(
- JSON.stringify(
- home.videoGallery.toObject
- ? home.videoGallery.toObject()
- : home.videoGallery,
- ),
- )
- : {};
-
- const updatedVideoGalleryData = {
- heading: heading || "",
- videoUrl: videoUrl || "",
- thumbnail: thumbnail || "",
- };
-
- // Cập nhật chỉ phần videoGallery
- home.videoGallery = updatedVideoGalleryData;
-
- await home.save();
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(updatedVideoGalleryData));
-
- // ✅ AUDIT LOGGING - Video Gallery Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Home",
- documentId: home._id,
- action: AUDIT_ACTIONS.UPDATE_VIDEO_GALLERY,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- }
-
- req.flash("success_msg", "Video Gallery updated successfully");
- res.redirect("/admin/home/video-gallery");
- } catch (err) {
- console.error("Error updating video gallery:", err);
- req.flash("error_msg", err.message || "Error updating video gallery");
- res.redirect("/admin/home/video-gallery");
- }
-};
diff --git a/controllers/visaController.js b/controllers/visaController.js
deleted file mode 100644
index d20aa1c..0000000
--- a/controllers/visaController.js
+++ /dev/null
@@ -1,695 +0,0 @@
-// controllers/visaController.js
-
-const addBaseUrlToImages = (data, baseUrl) => {
- if (!data) return data;
-
- // Nếu là mảng, duyệt từng phần tử
- if (Array.isArray(data)) {
- return data.map((item) => addBaseUrlToImages(item, baseUrl));
- }
-
- // Nếu là object, duyệt từng key
- if (typeof data === "object") {
- const newObj = {};
- for (const [key, value] of Object.entries(data)) {
- // Kiểm tra nếu key là các trường chứa ảnh và value là string
- const imageKeys = ["icon", "mainImage", "bannerImage", "image"];
-
- if (
- imageKeys.includes(key) &&
- typeof value === "string" &&
- !value.startsWith("http")
- ) {
- newObj[key] = `${baseUrl}/${value}`
- .replace(/\/+/g, "/")
- .replace(":/", "://");
- }
- // Xử lý riêng cho mảng gallery (mảng các chuỗi)
- else if (key === "gallery" && Array.isArray(value)) {
- newObj[key] = value.map((img) =>
- img.startsWith("http")
- ? img
- : `${baseUrl}/${img}`.replace(/\/+/g, "/").replace(":/", "://"),
- );
- }
- // Nếu là object hoặc mảng con khác, đệ quy tiếp
- else if (typeof value === "object" && value !== null) {
- newObj[key] = addBaseUrlToImages(value, baseUrl);
- } else {
- newObj[key] = value;
- }
- }
- return newObj;
- }
- return data;
-};
-const Visa = require("../models/visa");
-const slugify = require("slugify");
-const writeAuditLog = require("../audit/writeAuditLog");
-const diffObject = require("../audit/diffObject");
-const AUDIT_ACTIONS = require("../constants/auditAction");
-const createSlug = (text) => {
- return slugify(text, {
- lower: true,
- strict: true,
- locale: "en",
- trim: true,
- });
-};
-// -------------------- Helper Functions --------------------
-
-// Get visa data from MongoDB
-const getVisaData = async () => {
- const visa = await Visa.findOne().sort({ updatedAt: -1 });
- return visa || {};
-};
-
-// Get default visa data structure (updated to match new JSON)
-const getDefaultVisaData = () => ({
- hero: {
- title: "Visa Service",
- summaryList: [],
- },
-});
-
-// Helper function: Generate next country ID
-const getNextCountryId = (countries) => {
- if (!Array.isArray(countries) || countries.length === 0) return 1;
- return Math.max(...countries.map((c) => c.id || 0)) + 1;
-};
-
-// -------------------- Admin Exports --------------------
-
-// Display visa management page
-exports.index = async (req, res) => {
- try {
- // Fetch Visa data
- let data = await getVisaData();
-
- // If no data exists, use default
- if (!data || Object.keys(data).length === 0) {
- data = getDefaultVisaData();
- } else {
- // Merge with defaults to ensure all fields exist
- const defaultData = getDefaultVisaData();
-
- // Ensure hero section exists with defaults
- data.hero = data.hero || defaultData.hero;
- data.hero.title = data.hero.title || "Visa Service";
- data.hero.summaryList = data.hero.summaryList || [];
- }
-
- const frontendUrl = process.env.FRONTEND_URL || "http://localhost:3000";
-
- res.render("admin/visa/index", {
- layout: "layouts/main",
- title: "Visa Management",
- data,
- frontendUrl,
- currentPath: req.path,
- user: req.session.user,
- });
- // return res.json(data);
- } catch (err) {
- console.error("Visa index error:", err);
- req.flash("error_msg", "Error loading visa data");
- res.redirect("/admin/dashboard");
- }
-};
-
-// Get single country for edit
-exports.getCountry = async (req, res) => {
- console.log("--------------------------------------------------");
- console.log("🚀 [GET] Request nhận được tại /visa/edit/:id");
-
- try {
- const { id } = req.params;
- console.log("📍 ID từ Params (URL):", id, "| Kiểu dữ liệu:", typeof id);
-
- const visaData = await getVisaData();
-
- // Kiểm tra cấu trúc dữ liệu tổng
- if (!visaData) {
- console.error("❌ Lỗi: Hàm getVisaData() trả về null/undefined");
- return res.status(404).json({ error: "Dữ liệu gốc không tồn tại" });
- }
-
- if (!visaData.hero || !visaData.hero.summaryList) {
- console.error("❌ Lỗi: Cấu trúc visaData.hero.summaryList không hợp lệ");
- return res
- .status(404)
- .json({ error: "Không tìm thấy danh sách quốc gia" });
- }
-
- console.log(
- "📊 Tổng số quốc gia hiện có trong mảng:",
- visaData.hero.summaryList.length,
- );
-
- // 2. Tìm quốc gia theo ID
- const targetId = parseInt(id);
- console.log("🔍 Đang tìm kiếm Quốc gia có ID (sau khi parse):", targetId);
-
- const country = visaData.hero.summaryList.find((c) => {
- // Log từng phần tử để kiểm tra kiểu dữ liệu của c.id trong DB
- // console.log(`Checking country: ${c.name} | ID in DB: ${c.id} (${typeof c.id})`);
- return c.id === targetId;
- });
-
- if (!country) {
- console.warn(`⚠️ Không tìm thấy quốc gia nào khớp với ID: ${targetId}`);
- // In ra danh sách ID hiện có để so sánh
- const existingIds = visaData.hero.summaryList.map((c) => c.id);
- console.log("🆔 Các ID hiện có trong Database:", existingIds);
-
- return res.status(404).json({
- success: false,
- error: `Không tìm thấy quốc gia có ID: ${id}`,
- });
- }
-
- console.log("✅ Tìm thấy dữ liệu quốc gia:", country.name);
-
- // 3. Trả về dữ liệu
- res.json({
- success: true,
- country: country,
- });
- } catch (err) {
- console.error("🔴 Lỗi nghiêm trọng tại getCountry Controller:", err);
- res.status(500).json({ error: "Lỗi hệ thống khi tải thông tin quốc gia" });
- }
-};
-
-// Update visa data (hero title only)
-exports.update = async (req, res) => {
- try {
- // Get current data
- const currentData = await getVisaData();
-
- // ✅ Capture BEFORE state
- const beforeData = currentData
- ? JSON.parse(
- JSON.stringify(
- currentData.toObject ? currentData.toObject() : currentData,
- ),
- )
- : {};
-
- // Create updated data object
- const updatedData = {
- ...(currentData.toObject ? currentData.toObject() : currentData),
- };
-
- // Ensure hero structure exists
- updatedData.hero = updatedData.hero || {
- title: "Visa Service",
- summaryList: [],
- };
-
- // Update hero title
- if (req.body.heroTitle) {
- updatedData.hero.title = req.body.heroTitle;
- }
-
- // Update or create document
- try {
- let savedData;
- if (currentData._id) {
- savedData = await Visa.findByIdAndUpdate(currentData._id, updatedData, {
- new: true,
- });
- } else {
- savedData = await Visa.create(updatedData);
- }
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(JSON.stringify(savedData.toObject()));
-
- // ✅ AUDIT LOGGING - Visa Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Visa",
- documentId: savedData._id,
- action: AUDIT_ACTIONS.UPDATE_VISA,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- console.log(
- `✅ Audit log created for Visa update: ${changes.length} changes`,
- );
- } else {
- console.log("ℹ️ No changes detected for Visa update");
- }
-
- req.flash("success_msg", "Visa data updated successfully");
- return req.session.save(() => res.redirect("/admin/visa"));
- } catch (dbError) {
- console.error("Database error:", dbError);
- req.flash("error_msg", `Database error: ${dbError.message || "Unknown"}`);
- return req.session.save(() => res.redirect("/admin/visa"));
- }
- } catch (err) {
- console.error("Update error:", err);
- req.flash("error_msg", `Update error: ${err.message || "Unknown"}`);
- return req.session.save(() => res.redirect("/admin/visa"));
- }
-};
-
-// Add new country
-exports.addCountry = async (req, res) => {
- try {
- let visaData = await getVisaData();
-
- // Initialize hero structure if not exist
- if (!visaData.hero || !visaData.hero.summaryList) {
- visaData = getDefaultVisaData();
- }
-
- // ✅ Capture BEFORE state
- const beforeData = JSON.parse(
- JSON.stringify(visaData.toObject ? visaData.toObject() : visaData),
- );
-
- // Validate required fields
- if (!req.body.name) {
- return res.status(400).json({ error: "Name is required" });
- }
- const finalSlug = req.body.slug
- ? createSlug(req.body.slug)
- : createSlug(req.body.name);
-
- // Parse services array
- let services = [];
- if (req.body.services) {
- if (typeof req.body.services === "string") {
- try {
- services = JSON.parse(req.body.services);
- } catch (e) {
- services = [req.body.services];
- }
- } else if (Array.isArray(req.body.services)) {
- services = req.body.services;
- }
- }
-
- // Parse detailedView if provided (optional)
- let detailedView = null;
- if (req.body.detailedView) {
- try {
- detailedView =
- typeof req.body.detailedView === "string"
- ? JSON.parse(req.body.detailedView)
- : req.body.detailedView;
- } catch (e) {
- console.warn("Could not parse detailedView, creating without it");
- }
- }
-
- // Create new country object
- const newCountry = {
- id: req.body.id || getNextCountryId(visaData.hero.summaryList),
- name: req.body.name,
- slug: finalSlug,
- icon: req.body.icon || "",
- services: services,
- ...(detailedView && { detailedView }),
- };
-
- // Add new country to summaryList
- visaData.hero.summaryList.push(newCountry);
-
- // Update database
- const updatedData = {
- ...(visaData.toObject ? visaData.toObject() : visaData),
- };
-
- let savedData;
- if (visaData._id) {
- savedData = await Visa.findByIdAndUpdate(visaData._id, updatedData, {
- new: true,
- });
- } else {
- savedData = await Visa.create(updatedData);
- }
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(
- JSON.stringify(savedData.toObject ? savedData.toObject() : savedData),
- );
-
- // ✅ AUDIT LOGGING - Visa Country Added
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Visa",
- documentId: savedData._id,
- action: AUDIT_ACTIONS.UPDATE_VISA,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- console.log(
- `✅ Audit log created for Visa country addition: ${changes.length} changes`,
- );
- }
-
- console.log(`✅ Country "${newCountry.name}" added successfully`);
- res.json({
- success: true,
- message: `Country "${newCountry.name}" added successfully`,
- country: newCountry,
- });
- } catch (err) {
- console.error("Add country error:", err);
- res.status(500).json({ error: err.message });
- }
-};
-
-// Update single country
-exports.updateCountry = async (req, res) => {
- try {
- // 1. Lấy ID từ params (URL)
- const { id } = req.params;
- let visaData = await getVisaData();
-
- if (!visaData || !visaData.hero || !visaData.hero.summaryList) {
- return res
- .status(400)
- .json({ error: "Cấu trúc dữ liệu Visa không hợp lệ" });
- }
-
- // ✅ Capture BEFORE state
- const beforeData = JSON.parse(
- JSON.stringify(visaData.toObject ? visaData.toObject() : visaData),
- );
-
- // 2. Tìm index theo ID (Chuyển về Number để so sánh chính xác)
- const countryIndex = visaData.hero.summaryList.findIndex(
- (c) => c.id === parseInt(id),
- );
-
- if (countryIndex === -1) {
- return res
- .status(404)
- .json({ error: `Không tìm thấy quốc gia có ID: ${id}` });
- }
-
- const currentCountry = visaData.hero.summaryList[countryIndex];
- let finalSlug = currentCountry.slug;
- if (req.body.name) {
- // Nếu name thay đổi, ta có thể cập nhật lại slug (tùy nhu cầu SEO)
- // Ở đây ưu tiên: Nếu có slug mới truyền lên thì dùng, không thì tạo từ name mới
- finalSlug = req.body.slug
- ? createSlug(req.body.slug)
- : createSlug(req.body.name);
- }
- // 3. Xử lý dữ liệu từ req.body
- // Vì Client đã gửi JSON stringify, ta lấy trực tiếp hoặc parse nếu cần
- let services = req.body.services;
- if (typeof services === "string") {
- try {
- services = JSON.parse(services);
- } catch (e) {
- services = [services];
- }
- }
-
- let detailedView = req.body.detailedView;
- if (typeof detailedView === "string") {
- try {
- detailedView = JSON.parse(detailedView);
- } catch (e) {
- detailedView = currentCountry.detailedView;
- }
- }
-
- // 4. Cập nhật Object quốc gia
- const updatedCountry = {
- ...currentCountry, // Giữ các trường cũ
- id: parseInt(id), // Đảm bảo ID không đổi
- name: req.body.name || currentCountry.name,
- slug: finalSlug,
- icon: req.body.icon || currentCountry.icon,
- services: Array.isArray(services) ? services : currentCountry.services,
- detailedView: detailedView || currentCountry.detailedView,
- };
-
- // 5. Cập nhật vào mảng chính
- visaData.hero.summaryList[countryIndex] = updatedCountry;
-
- // 6. Lưu vào Database
- if (visaData.markModified) {
- // Bắt buộc với Mongoose khi thay đổi nội dung bên trong Array/Object
- visaData.markModified("hero.summaryList");
- }
-
- let savedData;
- if (visaData._id) {
- savedData = await visaData.save(); // Sử dụng save() trực tiếp nếu visaData là Mongoose Document
- } else {
- savedData = await Visa.create(visaData);
- }
-
- // ✅ Capture AFTER state
- const afterData = JSON.parse(
- JSON.stringify(savedData.toObject ? savedData.toObject() : savedData),
- );
-
- // ✅ AUDIT LOGGING - Visa Country Updated
- const changes = diffObject(beforeData, afterData);
- if (changes.length > 0) {
- await writeAuditLog({
- model: "Visa",
- documentId: savedData._id,
- action: AUDIT_ACTIONS.UPDATE_VISA,
- before: beforeData,
- after: afterData,
- changes,
- req,
- });
- console.log(
- `✅ Audit log created for Visa country update: ${changes.length} changes`,
- );
- }
-
- console.log(
- `✅ Country "${updatedCountry.name}" updated successfully by ID: ${id}`,
- );
- res.json({
- success: true,
- message: `Quốc gia "${updatedCountry.name}" đã được cập nhật thành công`,
- country: updatedCountry,
- });
- } catch (err) {
- console.error("Update country error:", err);
- res.status(500).json({ error: err.message });
- }
-};
-
-// Delete country
-exports.deleteCountry = async (req, res) => {
- try {
- // 1. Lấy id từ params
- const { id } = req.params;
- let visaData = await getVisaData();
-
- if (!visaData || !visaData.hero || !visaData.hero.summaryList) {
- return res
- .status(400)
- .json({ success: false, error: "Cấu trúc dữ liệu Visa không hợp lệ" });
- }
-
- // 2. Tìm index theo ID (Chuyển về Number để so sánh chính xác)
- const countryIndex = visaData.hero.summaryList.findIndex(
- (c) => c.id === parseInt(id),
- );
-
- if (countryIndex === -1) {
- return res.status(404).json({
- success: false,
- error: `Không tìm thấy quốc gia có ID: ${id}`,
- });
- }
-
- // 3. Xóa phần tử khỏi mảng
- const deletedCountry = visaData.hero.summaryList[countryIndex];
- visaData.hero.summaryList.splice(countryIndex, 1);
-
- // 4. Cập nhật vào Database
- if (visaData.markModified) {
- visaData.markModified("hero.summaryList");
- }
-
- if (visaData._id) {
- await visaData.save();
- } else {
- await Visa.create(visaData);
- }
-
- console.log(`✅ Deleted Successfully: "${deletedCountry.name}"`);
- return res.json({
- success: true,
- message: `Country "${deletedCountry.name}" Deleted Successfully`,
- });
- } catch (err) {
- console.error("❌ Error Delete:", err);
- return res.status(500).json({ success: false, error: err.message });
- }
-};
-
-// -------------------- Public API Exports --------------------
-
-// API to get all visa data for frontend
-exports.api = async (req, res) => {
- try {
- const visaData = await getVisaData();
- if (!visaData) {
- return res.status(404).json({
- success: false,
- error: "Visa data not found",
- data: null,
- });
- }
- const heroData = visaData?.hero;
-
- // 2. Lấy riêng phần hero (Dùng biến mới, không gán đè vào const)
- const processedData = heroData;
-
- return res.json({
- success: true,
- hero: processedData,
- });
- } catch (err) {
- console.error("Visa API error:", err);
- res.status(500).json({
- success: false,
- error: "Error loading visa data",
- });
- }
-};
-
-// API to get all countries (summaryList only)
-exports.apiCountries = async (req, res) => {
- try {
- const visaData = await getVisaData();
-
- if (!visaData || !visaData.hero || !visaData.hero.summaryList) {
- return res.status(404).json({
- success: false,
- error: "Countries data not found",
- data: null,
- });
- }
-
- // 1. Lọc bỏ 'viewDetail' khỏi từng quốc gia trong danh sách
- const filteredCountries = visaData.hero.summaryList.map((item) => {
- // Tách detailedView ra, gom phần còn lại vào countryInfo
- const { detailedView, ...countryInfo } = item;
-
- return {
- ...countryInfo,
- // Lấy mainImage từ sâu bên trong detailedView và gán vào key mới
- mainImage: detailedView?.activeCountry?.mainImage || "",
- };
- });
-
- // 2. Gắn baseUrl vào ảnh cho danh sách đã lọc
- const processedData = filteredCountries;
-
- return res.json({
- success: true,
- data: processedData, // Lúc này data chỉ chứa thông tin quốc gia, không có viewDetail
- });
- } catch (err) {
- console.error("Countries API error:", err);
- res.status(500).json({
- success: false,
- error: "Error loading countries data",
- });
- }
-};
-
-// API to get single country by slug
-exports.apiCountry = async (req, res) => {
- try {
- const { slug } = req.params;
- const visaData = await getVisaData();
-
- if (!visaData || !visaData.hero || !visaData.hero.summaryList) {
- return res.status(404).json({
- success: false,
- error: "Visa data not found",
- data: null,
- });
- }
-
- // 1. Tìm quốc gia khớp với slug
- const country = visaData.hero.summaryList.find((c) => c.slug === slug);
-
- // 2. Kiểm tra nếu không thấy quốc gia hoặc quốc gia đó không có viewDetail
- if (!country || !country.viewDetail) {
- return res.status(404).json({
- success: false,
- error: `Detailed information for country "${slug}" not found`,
- data: null,
- });
- }
- // 3. Chỉ lấy phần chi tiết (detailed view)
- // Lưu ý: Chúng ta copy ra object mới để tránh tham chiếu dữ liệu gốc
- const detailedData = JSON.parse(JSON.stringify(country.viewDetail));
-
- // 4. Gắn baseUrl vào các ảnh nằm trong phần chi tiết này
- const processedData = detailedData;
-
- return res.json({
- success: true,
- data: processedData,
- });
- } catch (err) {
- console.error("Visa country API error:", err);
- res.status(500).json({
- success: false,
- error: "Error loading country detailed data",
- });
- }
-};
-
-// API to get hero data (title + summaryList)
-exports.apiHero = async (req, res) => {
- try {
- const visaData = await getVisaData();
-
- // 1. Kiểm tra dữ liệu gốc
-
- if (!visaData || !visaData.hero) {
- return res.status(404).json({
- success: false,
- error: "Hero data not found",
- data: null,
- });
- }
- const { summaryList, ...heroData } = JSON.parse(
- JSON.stringify(visaData.hero),
- );
-
- const baseUrl =
- process.env.BACKEND_URL || `${req.protocol}://${req.get("host")}`;
- const processedData = addBaseUrlToImages(heroData, baseUrl);
-
- return res.json({
- success: true,
- data: processedData,
- });
- } catch (err) {
- console.error("Visa hero API error:", err);
- res.status(500).json({
- success: false,
- error: "Error loading hero data",
- });
- }
-};
diff --git a/data/Countries.json b/data/Countries.json
deleted file mode 100644
index 638f898..0000000
--- a/data/Countries.json
+++ /dev/null
@@ -1,114 +0,0 @@
-{
- "countries": [
- {
- "id": 1,
- "name": "France",
- "icon": "assets/img/home-2/visa/03.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 2,
- "name": "UK",
- "icon": "assets/img/home-2/visa/11.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 3,
- "name": "Canada",
- "icon": "assets/img/home-2/visa/02.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 4,
- "name": "Germany",
- "icon": "assets/img/home-2/visa/12.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 5,
- "name": "Spain",
- "icon": "assets/img/home-2/visa/13.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 6,
- "name": "South Korea",
- "icon": "assets/img/home-2/visa/14.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 7,
- "name": "Japan",
- "icon": "assets/img/home-2/visa/15.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 8,
- "name": "Croatia",
- "icon": "assets/img/home-2/visa/16.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 9,
- "name": "England",
- "icon": "assets/img/home-2/visa/17.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 10,
- "name": "Indonesia",
- "icon": "assets/img/home-2/visa/18.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- }
- ]
-}
diff --git a/data/Countrydetails.json b/data/Countrydetails.json
deleted file mode 100644
index 3943e29..0000000
--- a/data/Countrydetails.json
+++ /dev/null
@@ -1,146 +0,0 @@
-{
- "countryDetails": {
- "id": 1,
- "name": "United States of America",
- "title": "COUNTRY USA",
- "mainImage": "assets/img/inner-page/country-details/details-1.jpg",
- "description": "The United States is one of the most popular destinations for international students and immigrants, offering world-class universities, diverse cultural experiences, and countless career opportunities. With top-ranked education systems, advanced research facilities, and a welcoming environment for skilled professionals, the USA is ideal for those seeking growth and global exposure.",
- "additionalInfo": "Our consultancy provides complete guidance for study visas, work permits, and permanent residency pathways tailored to your goals.",
- "tagline": "Over the last 35 Years we made an impact that is strong & we have long way to go.",
- "visaTypes": [
- {
- "category": "Tourist & Work",
- "items": [
- {
- "title": "Tourist Visa",
- "description": "Broad term that can refer to various aspects of interconnectedness"
- },
- {
- "title": "Work Permit",
- "description": "Broad term that can refer to various aspects of interconnectedness"
- }
- ]
- },
- {
- "category": "Student & Family",
- "items": [
- {
- "title": "Student",
- "description": "Broad term that can refer to various aspects of interconnectedness"
- },
- {
- "title": "Tourist Visa",
- "description": "Broad term that can refer to various aspects of interconnectedness"
- }
- ]
- }
- ],
- "visaProcess": [
- {
- "number": "01",
- "title": "Consultation & Eligibility Check",
- "description": "Our experts review your profile and visa requirements."
- },
- {
- "number": "02",
- "title": "Application Preparation",
- "description": "We help with document collection, form filling, and statement drafting."
- },
- {
- "number": "03",
- "title": "Submission",
- "description": "Visa application is submitted online with required fees."
- },
- {
- "number": "04",
- "title": "Interview Guidance",
- "description": "Get training and mock sessions for embassy interview."
- },
- {
- "number": "05",
- "title": "Approval & Travel",
- "description": "Once approved, we provide travel and pre-departure guidance."
- }
- ],
- "images": [
- "assets/img/inner-page/country-details/details-2.jpg",
- "assets/img/inner-page/country-details/details-3.png"
- ],
- "visaCategories": [
- "Student Visa (F1, M1, J1)",
- "Work Visa (H1B, L1)",
- "Tourist Visa (B1/B2)",
- "Family/Spouse Visa (K1, IR1, F2A)",
- "Green Card / Immigrant Visa"
- ],
- "serviceOptions": [
- {
- "number": "01",
- "title": "Consultation & Eligibility Check",
- "description": "Our experts review your profile and visa requirements."
- },
- {
- "number": "02",
- "title": "Application Preparation",
- "description": "We help with document collection, form filling, and statement drafting."
- },
- {
- "number": "03",
- "title": "Submission",
- "description": "Visa application is submitted online with required fees."
- },
- {
- "number": "04",
- "title": "Interview Guidance",
- "description": "Get training and mock sessions for embassy interview."
- },
- {
- "number": "05",
- "title": "Approval & Travel",
- "description": "Once approved, we provide travel and pre-departure guidance."
- }
- ]
- },
- "relatedCountries": [
- {
- "id": 1,
- "name": "Canada",
- "icon": "assets/img/inner-page/country-details/01.png"
- },
- {
- "id": 2,
- "name": "USA",
- "icon": "assets/img/inner-page/country-details/02.png"
- },
- {
- "id": 3,
- "name": "USA",
- "icon": "assets/img/inner-page/country-details/03.png"
- },
- {
- "id": 4,
- "name": "Saint Helena",
- "icon": "assets/img/inner-page/country-details/05.png"
- },
- {
- "id": 5,
- "name": "Iran",
- "icon": "assets/img/inner-page/country-details/06.png"
- },
- {
- "id": 6,
- "name": "Spain",
- "icon": "assets/img/inner-page/country-details/07.png"
- },
- {
- "id": 7,
- "name": "Japan",
- "icon": "assets/img/inner-page/country-details/08.png"
- }
- ],
- "contactInfo": {
- "phone": "+009 438 222 9540",
- "email": "infor@xridergamil.com",
- "location": "Toronto, Montreal, City 2026"
- }
-}
diff --git a/data/about.json b/data/about.json
deleted file mode 100644
index 246a6c7..0000000
--- a/data/about.json
+++ /dev/null
@@ -1,91 +0,0 @@
-{
- "hero": {
- "title": "About Us",
- "breadcrumb": [
- "Home",
- "About Us"
- ],
- "backgroundImage": "/uploads/about/breadcrumb.jpg"
- },
- "intro": {
- "subheading": "Company Intro",
- "heading": "Building Pathways to Your Immigration Success",
- "description": "We provide expert guidance, personalized solutions, and transparent processes to help you achieve your immigration goals. Our dedicated team ensures a smooth journey, building pathways to your international success.",
- "image": "/uploads/about/businessman.jpg"
- },
- "mission": {
- "subheading": "About Our Consultancy",
- "heading": "Turning Study Abroad Dreams Into Reality",
- "description": "We guide students with expert visa consulting, ensuring a smooth process from application to approval, turning study abroad aspirations into life-changing opportunities for a brighter future.",
- "images": {
- "main": "/uploads/about/375x419.jpg",
- "secondary": "/uploads/about/375x419.jpg",
- "bgShape": "/assets/img/home-1/about/Vector.png",
- "planeShape": "/assets/img/home-1/about/plane.png",
- "topShape": "/assets/img/home-1/about/shape.png",
- "globeShape": "/assets/img/home-1/about/globe.png"
- },
- "items": [
- {
- "icon": "/assets/img/home-1/icon/01.svg",
- "label": "Global Reach",
- "description": "Expanding Opportunities Worldwide"
- },
- {
- "icon": "/assets/img/home-1/icon/01.svg",
- "label": "Global Reach",
- "description": "Expanding Opportunities Worldwide"
- }
- ],
- "features": [
- "Fastest Visa form processing with skilled immigration agents",
- "Partnership with International Educational Institutions"
- ],
- "ctaButton": {
- "label": "Get Started",
- "href": "/about"
- }
- },
- "features": {
- "backgroundImage": "/assets/img/home-2/feature/bg-shape.png",
- "subheading": "Your Travel Made Easy",
- "heading": "Smooth Visa Journey Guaranteed",
- "description": "We provide expert guidance for every visa application, ensuring smooth processing, personalized support, and reliable assistance",
- "image": "/uploads/about/686x906.jpg",
- "items": [
- {
- "icon": "/assets/img/home-2/icon/01.png",
- "title": "Expert Consultants",
- "description": "Skilled and knowledgeable visa advisors. Skilled and knowledgeable visa advisors."
- },
- {
- "icon": "/assets/img/home-2/icon/01.png",
- "title": "Personalized Support",
- "description": "Skilled and knowledgeable visa advisors. Skilled and knowledgeable visa advisors."
- },
- {
- "icon": "/assets/img/home-2/icon/01.png",
- "title": "Transparent Process",
- "description": "Skilled and knowledgeable visa advisors. Skilled and knowledgeable visa advisors."
- }
- ],
- "ctaButton": {
- "label": "Get Started Today",
- "href": "/contact"
- }
- },
- "news": {
- "subheading": "Visa Tips & Guides",
- "heading": "Latest Insights & Updates",
- "ctaButton": {
- "label": "view all articles",
- "href": "/blog"
- },
- "selectedBlogIds": [
- "69857d6c6d04fed459107944",
- "69857d6c6d04fed459107942",
- "69857d6c6d04fed459107940"
- ],
- "items": []
- }
-}
\ No newline at end of file
diff --git a/data/activities.json b/data/activities.json
deleted file mode 100644
index 08cb503..0000000
--- a/data/activities.json
+++ /dev/null
@@ -1,6762 +0,0 @@
-{
- "hero":[
- {
- "titleActivities": "Activities",
- "titleBooking": "Booking",
-
- "bannerImageActivities": "/uploads/banner/b9.jpg",
- "bannerImageBooking": "/uploads/banner/b13.jpg"
-
- }
- ],
- "filter": [
- {
- "label": "Activities",
- "value": "activities",
- "items": [
- {
- "value": "adventure",
- "label": "Adventure, Sports & Creative"
- },
- {
- "value": "arts-crafts",
- "label": "Arts & Crafts"
- },
- {
- "value": "climbing",
- "label": "Climbing"
- },
- {
- "value": "dancing",
- "label": "Dancing"
- },
- {
- "value": "diving",
- "label": "Diving"
- },
- {
- "value": "englisch-camps",
- "label": "Englischcamps"
- },
- {
- "value": "englisch-toefl",
- "label": "Englisch TOEFL©"
- },
- {
- "value": "fishing",
- "label": "Fishing"
- },
- {
- "value": "german-camps",
- "label": "German Camps"
- },
- {
- "value": "horseback",
- "label": "Horseback Riding"
- },
- {
- "value": "husky",
- "label": "Husky Camp"
- },
- {
- "value": "icit",
- "label": "International Counsellor in Training (ICIT)"
- },
- {
- "value": "lifeguarding",
- "label": "Lifeguarding"
- },
- {
- "value": "language",
- "label": "Language"
- },
- {
- "value": "leadership",
- "label": "Leadership"
- },
- {
- "value": "multi-water",
- "label": "Multi Water Adventure"
- },
- {
- "value": "sailing",
- "label": "Sailing"
- },
- {
- "value": "skating",
- "label": "Skating"
- },
- {
- "value": "soccer",
- "label": "Soccer"
- },
- {
- "value": "space",
- "label": "Space Exploration"
- },
- {
- "value": "spanish",
- "label": "Spanishcourse"
- },
- {
- "value": "survival",
- "label": "Survival"
- },
- {
- "value": "swimming",
- "label": "Swimming"
- },
- {
- "value": "tennis",
- "label": "Tennis"
- },
- {
- "value": "windsurf",
- "label": "Windsurfing"
- }
- ]
- },
- {
- "label": "Holiday Season",
- "value": "holidays",
- "items": [
- {
- "value": "autumn",
- "label": "Autumn"
- },
- {
- "value": "spring",
- "label": "Spring"
- },
- {
- "value": "summer",
- "label": "Summer"
- }
- ]
- },
- {
- "label": "Location",
- "value": "locations",
- "items": [
- {
- "value": "philippines",
- "label": "Philippines"
- },
- {
- "value": "vietnam",
- "label": "Vietnam"
- },
- {
- "value": "portugal",
- "label": "Portugal"
- },
- {
- "value": "china",
- "label": "China"
- },
- {
- "value": "thailand",
- "label": "Thailand"
- },
- {
- "value": "malaysia",
- "label": "Malaysia"
- },
- {
- "value": "holiday",
- "label": "Holiday"
- }
- ]
- }
- ],
- "camps": [
- {
- "name": "Adventure, Sports & Creative",
- "price": 395,
- "priceText": "from 395 USD",
- "season": [
- "spring",
- "summer",
- "autumn"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "thailand"
- ],
- "image": "/uploads/activity/bg-ad1.png",
- "link": "/adventure-sports-creative",
- "program": "adventure",
- "rating": 5,
- "camp-detail": {
- "hero": {
- "title": "Adventure, Sports & Creative Camps in Germany",
- "bgImage": "/uploads/activity/bg-ad1.png"
- },
- "basicInfo": {
- "location": "Germany",
- "ageRange": "7 - 17 years\nSeparated by age groups",
- "accommodationType": "Tent & Cabin/House",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nGER & EN"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Volcanoes and Waterfalls",
- "rating": 4.9,
- "reviews": 25,
- "location": "Hilo, Hawaii",
- "price": 1500,
- "originalPrice": 1800,
- "image": "https://images.unsplash.com/photo-1542259009477-d625272157b7?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Exploring the Fjords",
- "rating": 4.9,
- "reviews": 28,
- "location": "Bergen, Norway",
- "price": 1900,
- "originalPrice": 2200,
- "image": "https://images.unsplash.com/photo-1530789253388-582c481c54b0?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Safari in Style",
- "rating": 4.9,
- "reviews": 35,
- "location": "Okavango Delta, Botswana",
- "price": 4500,
- "originalPrice": 5000,
- "image": "https://images.unsplash.com/photo-1516426122078-c23e76319801?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Cherry Blossom Tour",
- "rating": 4.8,
- "reviews": 22,
- "location": "Kyoto, Japan",
- "price": 1200,
- "originalPrice": 1800,
- "image": "https://images.unsplash.com/photo-1522383225653-ed111181a951?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Camp tent"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Archery"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Cabin"
- }
- ],
- "overlayInfo": {
- "location": "Thailand",
- "season": "Spring, Summer, Autumn",
- "languages": "GER & EN "
- }
- },
- "eventSchedule": {
- "startDate": "06/15/2024",
- "duration": "7 Days 6 Nights",
- "tickets": "$48/50"
- },
- "sections": {
- "overview": {
- "intro": "Nestled in the lush landscapes of Madridejos, Cebu Island, the Exploration Camp offers a vibrant mix of adventure, nature, and community. Campers wake up to tropical surroundings, enjoy engaging activities, and explore the beauty of the island while building friendships and unforgettable memories.",
- "mainText": "The Exploration Camp offers young explorers aged 12 to 18 a chance to experience nature, culture and people against the picturesque scenes of the Philippines. Aiming to inspire, challenge and nurture a love of learning in each and every child, the camp combines outdoor adventures, engaging creative projects and incredible group efforts – all within a spirited international setting.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, open to all levels",
- "Outdoor, sports, creative & evening activities",
- "Cool, impactful excursions and trips",
- "2 English-speaking camp environment",
- "Dorm accommodation with full board",
- "24/7 care from GGCamp teamers",
- "Digital Detox: phones only during siesta",
- "Arrival/departure shuttle service"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Your stay at Exploration Camp in Cebu City comes with more than just a place to spend your summer—it's a complete experience designed for learning, adventure, connection, and community. From the moment you arrive, every detail is taken care of. Explore the stunning island of Cebu, just a short walk from a quaint fishing village with traditional farms and charming timber framed homes. Enjoy activities across our expansive campgrounds, from kayaking and bouncing on water trampolines to building rafts and conquering the high ropes course. With fellow campers from around the world, you can improve your English skills, forge lasting friendships, and immerse yourself in the authentic spirit of camp.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Camp Life – Like a Little Village!",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "At our international summer camp in Lower Saxony, you can choose between our cozy tent village or the comfy Adventure Lodges – it all depends on your sense of adventure!"
- ],
- "outroText": [
- "🏕️ Tent Village: Spacious tents for 6–7 campers with wooden floors and a loft area – the ultimate outdoor experience under the stars.",
- "🏡 Adventure Lodges: Comfortable cabins with 4–8 beds, storage shelves, and seating areas. (Please note: staying in a lodge comes at an extra charge.)"
- ],
- "details": [
- "Restroom and shower facilities are also separated by gender and always close by.",
- "Best of all: Our teamers live right next door – they're available for you 24/7!",
- "Good to know:",
- "For tents, bring your own sleeping bag and sleeping mat.",
- "For lodges, bring a fitted sheet and either a sleeping bag or bedding set (available for rent if needed).",
- "You can choose your preferred accommodation during the booking process – secure your spot now!"
- ],
- "principles": [
- "Junior (7–12 years)",
- " Senior (12–15 years)",
- " Senior Plus (15–17 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "A Full Day of Adventure, Sports & Creativity!",
- "introText": [
- "\"Adventure, Sports & Creativity\" is the base program at our Lüneburger Heide Camp – no extra booking needed! If you don't choose an additional profile like Horseback Riding or Survival, this is your go-to for an action-packed and varied camp experience."
- ],
- "quote": "",
- "outroText": [
- "Learn English – Without Even Trying!",
- "Our international team brings the real camp spirit – full of energy, adventure, and fun. And the best part? English becomes a natural part of the day – whether you're playing sports, doing creative projects, or chilling by the campfire.",
- "Friendships That Last!",
- "Shared adventures create real connections – and many campers already plan their return together for next summer. These are friendships that stick!"
- ],
- "mainHeading": "Every morning, you get to pick a new exciting activity – whatever you're in the mood for!",
- "principles": [
- "Outdoor Action & Adventure: High ropes course, archery, raft building, or survival training – challenge your limits!",
- "Sports & Movement: Soccer, volleyball, basketball, or splashing around in the lake – get moving and have fun!",
- " Creativity & Chill: Crafts, painting, reading, or baking – perfect for relaxing moments at camp."
- ],
- "footerText": [
- "There's no room for boredom here – every day brings fresh adventures, new sports challenges, and creative highlights just for you!"
- ]
- },
- "meals": {
- "title": "Meal On Site",
- "description": "Indulge in three scrumptious meals each day—fresh, diverse, and absolutely delightful! Whether you have a vegetarian, gluten-free, or lactose-free diet, simply inform us in advance, and we'll take care of your needs.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Start your day with a hearty buffet of fresh bread, seasonal fruits, muesli, milk , juice, and tea—perfect fuel for all your exciting activities"
- },
- {
- "title": "Lunch",
- "desc": "Feast on warm, delicious dishes made entirely from scratch, featuring seafood, meats, vegetables, and rice to satisfy every appetite and keep you energized"
- },
- {
- "title": "Dinner",
- "desc": "Savor authentic local flavors with carefully prepared meals, served fresh to delight your taste buds after a full day of adventure and exploration."
- },
- {
- "title": "Snacks and Refreshments",
- "desc": "Stay energized with fresh fruits, afternoon treats, and plenty of water throughout the day, keeping you ready for every experience"
- }
- ],
- "footer": "And the highlight? Everything is made from scratch—no instant meals here! Enjoy authentic dishes that not only taste incredible but also provide you with a true taste of local cuisine to fuel your adventures!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Cared for Around the Clock!",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our experienced and passionate teamers are there for you 24/7 – full of energy, positivity, and always ready to listen. Whether it's a quick question or a bigger worry, you can count on them anytime.",
- "The best part?",
- "Our team comes from all over the world and brings that true international camp spirit – that's why we speak both English and German!"
- ],
- "footerText": [
- "This way, you'll naturally pick up both languages – while playing sports, chatting by the campfire, or just hanging out.",
- "Our supervision ratio is between 1:7 and 1:10, so you're always in good hands with our all-around care package!"
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Whether it's everyday bumps and scrapes to unexpected emergencies, our International Insurance Package gives your child all-round protection. Covering accidents, health issues, and other unforeseen events, it ensures peace of mind for parents while keeping children safe and supported throughout their entire journey.",
- "package": {
- "title": "Camp Insurance Package",
- "desc": "With this, every risk is going to be covered, and participants will stay completely safe the entire time they are in camp.",
- "items": [
- "Accidents and medical visits are covered",
- "Protection against property damage",
- "Price: Depending on the camping trip selected"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Our promise ensures a full refund for cancellations due to illness or unforeseen events before camp starts, giving you peace of mind and flexible plans.",
- "items": [
- "Valid until one week before camp",
- "Covers cancellations for illness, accidents, or exams",
- "Refund applies to the full program cost"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Arts & Crafts",
- "price": 500,
- "priceText": "from 500 USD",
- "season": [
- "spring",
- "summer",
- "autumn"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "vietnam"
- ],
- "image": "/uploads/banner/b6.jpg",
- "link": "/arts-crafts",
- "program": "arts-crafts",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "Arts & Crafts Camp in Vietnam",
- "bgImage": "/uploads/banner/b6.jpg"
- },
- "basicInfo": {
- "location": "Vietnam",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Dormitory & Bungalow",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & VN"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Ceramic Workshop Retreat",
- "rating": 4.8,
- "reviews": 32,
- "location": "Hanoi, Vietnam",
- "price": 1200,
- "originalPrice": 1500,
- "image": "https://images.unsplash.com/photo-1565193566173-7a0ee3dbe261?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Traditional Art Experience",
- "rating": 4.9,
- "reviews": 28,
- "location": "Hoi An, Vietnam",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1460661419201-fd4cecdf8a8b?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Painting & Nature Tour",
- "rating": 4.7,
- "reviews": 24,
- "location": "Da Lat, Vietnam",
- "price": 1100,
- "originalPrice": 1400,
- "image": "https://images.unsplash.com/photo-1513364776144-60967b0f800f?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Textile Art Discovery",
- "rating": 4.8,
- "reviews": 19,
- "location": "Sapa, Vietnam",
- "price": 1300,
- "originalPrice": 1600,
- "image": "https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Arts studio"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Crafts workshop"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Creative space"
- }
- ],
- "overlayInfo": {
- "location": "Vietnam",
- "season": "Spring, Summer, Autumn",
- "languages": "EN & VN"
- }
- },
- "eventSchedule": {
- "startDate": "07/01/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$50/55"
- },
- "sections": {
- "overview": {
- "intro": "Immerse yourself in the vibrant world of arts and crafts at our creative camp in Vietnam. Surrounded by stunning landscapes and rich cultural heritage, campers explore various artistic mediums while developing their creative skills and self-expression.",
- "mainText": "The Arts & Crafts Camp invites young artists aged 12 to 18 to explore their creativity in the beautiful setting of Vietnam. From traditional Vietnamese crafts to modern art techniques, campers discover new ways to express themselves while learning about local culture and making lasting friendships.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all skill levels welcome",
- "Painting, sculpture, ceramics & textile arts",
- "Traditional Vietnamese craft workshops",
- "Professional artist mentorship",
- "Comfortable dormitory accommodation",
- "24/7 care from experienced teamers",
- "Art exhibition at camp conclusion",
- "All materials and supplies included"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Arts & Crafts Camp is nestled in the picturesque countryside of Vietnam, offering the perfect blend of natural beauty and cultural richness. The serene environment provides endless inspiration for artistic creation. Campers can explore local villages, visit traditional artisan workshops, and draw inspiration from the stunning Vietnamese landscapes that have inspired artists for centuries.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Creative Living Spaces",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in our comfortable dormitories or charming bungalows, designed to inspire creativity and foster community among fellow artists."
- ],
- "outroText": [
- "🎨 Art Dormitory: Spacious rooms for 4-6 campers with dedicated art corners and natural lighting for sketching.",
- "🏡 Creative Bungalows: Private cabins for 2-4 campers with verandas overlooking gardens. (Additional charge applies)"
- ],
- "details": [
- "Clean restroom and shower facilities nearby, separated by gender.",
- "Teamers are always available for support, 24/7!",
- "Good to know:",
- "Bring your sketchbook and favorite art supplies.",
- "All major materials are provided by the camp.",
- "Choose your accommodation during booking!"
- ],
- "principles": [
- "Junior Artists (12–14 years)",
- "Teen Creators (14–16 years)",
- "Senior Artists (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Unleash Your Creative Potential!",
- "introText": [
- "Our Arts & Crafts program offers a comprehensive creative experience, combining traditional techniques with modern artistic expression in a supportive and inspiring environment."
- ],
- "quote": "",
- "outroText": [
- "Learn from Professional Artists!",
- "Our team includes experienced artists and craftspeople who share their passion and expertise with campers.",
- "Create Your Portfolio!",
- "Throughout the camp, you'll build a collection of artwork to take home and showcase at our final exhibition."
- ],
- "mainHeading": "Each day brings new creative adventures and artistic discoveries!",
- "principles": [
- "Visual Arts: Painting, drawing, watercolors, and mixed media – explore various techniques!",
- "Handicrafts: Ceramics, pottery, jewelry making, and textile arts – create beautiful handmade pieces!",
- "Cultural Arts: Learn traditional Vietnamese crafts and art forms – connect with local heritage!"
- ],
- "footerText": [
- "Every day offers fresh inspiration, new techniques to master, and opportunities to express your unique artistic vision!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy delicious Vietnamese cuisine prepared fresh daily. We accommodate all dietary requirements – just let us know in advance, and our kitchen team will take care of everything.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Start your creative day with a nutritious buffet featuring Vietnamese and international options, fresh fruits, and energizing beverages."
- },
- {
- "title": "Lunch",
- "desc": "Refuel with authentic Vietnamese dishes, including pho, spring rolls, and rice dishes prepared with fresh local ingredients."
- },
- {
- "title": "Dinner",
- "desc": "End your day with a satisfying meal featuring a variety of Vietnamese specialties and international favorites."
- },
- {
- "title": "Snacks and Refreshments",
- "desc": "Stay energized with fresh fruits, Vietnamese treats, and plenty of water throughout your creative sessions."
- }
- ],
- "footer": "All meals are prepared fresh using local ingredients, giving you an authentic taste of Vietnamese cuisine while fueling your creative adventures!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Expert Artists & Caring Mentors",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our team consists of professional artists, craft specialists, and experienced camp counselors who are passionate about nurturing young creative talents.",
- "Every instructor brings expertise in their artistic field, combined with a love for teaching and mentoring young artists."
- ],
- "footerText": [
- "With a camper-to-staff ratio of 1:6, every participant receives personalized attention and guidance.",
- "Our bilingual team ensures clear communication and a welcoming environment for all campers."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Your child's safety and wellbeing are our top priorities. Our comprehensive insurance package covers all activities and provides peace of mind for parents throughout the camp duration.",
- "package": {
- "title": "Camp Insurance Package",
- "desc": "Complete coverage for all camp activities, ensuring participants are protected throughout their creative journey.",
- "items": [
- "Full accident and medical coverage",
- "Protection for art supplies and personal belongings",
- "Price varies based on camp duration selected"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation policy with full refund for qualifying circumstances, giving you peace of mind when booking.",
- "items": [
- "Valid until one week before camp start",
- "Covers illness, family emergencies, and unforeseen events",
- "Full refund of program fees"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Climbing",
- "price": 515,
- "priceText": "from 515 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "philippines"
- ],
- "image": "/uploads/banner/b1.jpg",
- "link": "/climbing",
- "program": "climbing",
- "rating": 5,
- "camp-detail": {
- "hero": {
- "title": "Climbing Camp in Philippines",
- "bgImage": "/uploads/banner/b1.jpg"
- },
- "basicInfo": {
- "location": "Philippines",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Mountain Lodge & Cabin",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & FIL"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Rock Climbing Adventure",
- "rating": 4.9,
- "reviews": 45,
- "location": "Cebu, Philippines",
- "price": 1600,
- "originalPrice": 1900,
- "image": "https://images.unsplash.com/photo-1522163182402-834f871fd851?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Mountain Peak Challenge",
- "rating": 4.8,
- "reviews": 38,
- "location": "Palawan, Philippines",
- "price": 1800,
- "originalPrice": 2100,
- "image": "https://images.unsplash.com/photo-1564769662533-4f00a87b4056?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Bouldering Basics",
- "rating": 4.7,
- "reviews": 29,
- "location": "Baguio, Philippines",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1601024445121-e5b82f020549?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Cliff Expedition",
- "rating": 4.9,
- "reviews": 52,
- "location": "El Nido, Philippines",
- "price": 2000,
- "originalPrice": 2400,
- "image": "https://images.unsplash.com/photo-1508138221679-760a23a2285b?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Climbing wall"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Rock face"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Mountain view"
- }
- ],
- "overlayInfo": {
- "location": "Philippines",
- "season": "Summer",
- "languages": "EN & FIL"
- }
- },
- "eventSchedule": {
- "startDate": "06/20/2024",
- "duration": "8 Days 7 Nights",
- "tickets": "$52/55"
- },
- "sections": {
- "overview": {
- "intro": "Challenge yourself at our Climbing Camp in the stunning Philippines! With world-class climbing routes and breathtaking limestone cliffs, campers develop strength, technique, and confidence while exploring some of Asia's most spectacular climbing destinations.",
- "mainText": "The Climbing Camp offers young adventurers aged 12 to 18 an unforgettable experience in the Philippines' premier climbing locations. From beginner bouldering to advanced rope techniques, our certified instructors guide campers through progressive skill-building in a safe and encouraging environment.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all skill levels from beginner to advanced",
- "Indoor and outdoor climbing training",
- "Certified climbing instructors",
- "Top-quality climbing equipment provided",
- "Comfortable lodge accommodation",
- "24/7 supervision and care",
- "Skill certification upon completion",
- "Island exploration excursions"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Climbing Camp is located in the heart of the Philippines' most spectacular climbing region. The dramatic limestone formations and tropical scenery create an unforgettable backdrop for your climbing adventure. Between climbs, explore pristine beaches, crystal-clear waters, and lush tropical forests that make this region a paradise for outdoor enthusiasts.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Rest & Recharge After Your Climbs",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "After challenging climbs, relax in our comfortable mountain lodges or cozy cabins, designed for climbers to rest and prepare for the next adventure."
- ],
- "outroText": [
- "🏔️ Mountain Lodge: Shared rooms for 4-6 climbers with gear storage and drying areas for equipment.",
- "🏡 Climber Cabins: Private cabins for 2-4 campers with stunning mountain views. (Additional charge applies)"
- ],
- "details": [
- "Modern restroom and shower facilities with hot water.",
- "Equipment storage and maintenance area available.",
- "Experienced staff on-site 24/7!",
- "Good to know:",
- "All climbing gear is provided – just bring comfortable activewear.",
- "Personal climbing shoes available for rental or bring your own.",
- "Secure your preferred accommodation during booking!"
- ],
- "principles": [
- "Junior Climbers (12–14 years)",
- "Teen Climbers (14–16 years)",
- "Advanced Climbers (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Reach New Heights Every Day!",
- "introText": [
- "Our comprehensive climbing program takes you from fundamental techniques to advanced skills, with certified instructors guiding your progress every step of the way."
- ],
- "quote": "",
- "outroText": [
- "Safety First, Always!",
- "Every session begins with safety briefings and equipment checks. Our instructors maintain strict safety protocols while keeping the fun alive.",
- "Build Lifelong Skills!",
- "The confidence, problem-solving, and perseverance you develop through climbing will serve you well beyond the walls."
- ],
- "mainHeading": "Progressive skill development tailored to your level!",
- "principles": [
- "Fundamentals: Knots, belaying, climbing techniques, and safety protocols – build your foundation!",
- "Technical Skills: Lead climbing, multi-pitch routes, and outdoor climbing transitions – level up!",
- "Adventure Climbing: Real rock experiences on natural formations – apply your skills in nature!"
- ],
- "footerText": [
- "Each day brings new challenges, new achievements, and the thrill of conquering heights you never thought possible!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Fuel your climbing adventures with nutritious, energy-packed meals. Our kitchen understands the nutritional needs of active climbers and prepares balanced meals to keep you performing at your best.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "High-protein breakfast options including eggs, local breads, tropical fruits, and energy-boosting smoothies to start your climbing day."
- },
- {
- "title": "Lunch",
- "desc": "Hearty Filipino cuisine with grilled meats, fresh vegetables, and rice dishes to refuel after morning climbs."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying dinners featuring local seafood, barbecue, and traditional Filipino favorites to recover and recharge."
- },
- {
- "title": "Snacks and Refreshments",
- "desc": "Energy bars, fresh fruits, electrolyte drinks, and healthy snacks available throughout your climbing sessions."
- }
- ],
- "footer": "All meals are designed to support your active lifestyle, with options for various dietary requirements. Let us know your needs in advance!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Certified Instructors & Safety Experts",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our climbing team consists of internationally certified instructors with years of experience in both competitive and recreational climbing.",
- "Every instructor holds valid certifications and maintains current first aid and rescue qualifications."
- ],
- "footerText": [
- "With a camper-to-instructor ratio of 1:4 during climbing activities, every participant receives personalized attention and coaching.",
- "Safety is our absolute priority – our team conducts regular equipment inspections and maintains emergency response protocols."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Climbing involves inherent risks, which is why we provide comprehensive insurance coverage for all participants. Our insurance package is specifically designed for adventure sports and climbing activities.",
- "package": {
- "title": "Adventure Sports Insurance",
- "desc": "Specialized coverage for climbing activities, ensuring complete protection during all camp sessions.",
- "items": [
- "Full coverage for climbing-related accidents",
- "Equipment damage protection",
- "Emergency evacuation coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation options for unforeseen circumstances, with full refund eligibility under qualifying conditions.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical emergencies and unforeseen events",
- "Full program fee refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Dancing",
- "price": 520,
- "priceText": "from 520 USD",
- "season": [
- "summer",
- "autumn"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "malaysia"
- ],
- "image": "/uploads/banner/b4.jpg",
- "link": "/dancing",
- "program": "dancing",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "Dancing Camp in Malaysia",
- "bgImage": "/uploads/banner/b4.jpg"
- },
- "basicInfo": {
- "location": "Malaysia",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Dance Studio Resort",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & MY"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Hip Hop Intensive",
- "rating": 4.9,
- "reviews": 42,
- "location": "Kuala Lumpur, Malaysia",
- "price": 1300,
- "originalPrice": 1600,
- "image": "https://images.unsplash.com/photo-1547153760-18fc86324498?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Contemporary Dance Workshop",
- "rating": 4.8,
- "reviews": 35,
- "location": "Penang, Malaysia",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1508700929628-666bc8bd84ea?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Street Dance Festival",
- "rating": 4.7,
- "reviews": 28,
- "location": "Johor Bahru, Malaysia",
- "price": 1200,
- "originalPrice": 1500,
- "image": "https://images.unsplash.com/photo-1524594152303-9fd13543fe6e?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Traditional Dance Experience",
- "rating": 4.8,
- "reviews": 31,
- "location": "Malacca, Malaysia",
- "price": 1100,
- "originalPrice": 1400,
- "image": "https://images.unsplash.com/photo-1504609813442-a8924e83f76e?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Dance studio"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Performance"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Practice session"
- }
- ],
- "overlayInfo": {
- "location": "Malaysia",
- "season": "Summer, Autumn",
- "languages": "EN & MY"
- }
- },
- "eventSchedule": {
- "startDate": "07/10/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$52/58"
- },
- "sections": {
- "overview": {
- "intro": "Express yourself through movement at our Dancing Camp in Malaysia! From contemporary to hip-hop, traditional to modern styles, campers explore diverse dance forms in state-of-the-art studios while developing technique, artistry, and confidence.",
- "mainText": "The Dancing Camp brings together young dancers aged 12 to 18 for an immersive dance experience in vibrant Malaysia. With professional choreographers from around the world, campers learn multiple dance styles, collaborate on group performances, and discover their unique artistic voice through movement.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all experience levels welcome",
- "Multiple dance styles: contemporary, hip-hop, jazz & more",
- "Professional choreographers and instructors",
- "Air-conditioned dance studios with mirrors",
- "Resort-style accommodation",
- "24/7 supervision and support",
- "End-of-camp showcase performance",
- "Video recording of your performances"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Dancing Camp is located in a modern resort facility in Malaysia, featuring professional-grade dance studios and beautiful surroundings. The campus includes multiple air-conditioned studios with sprung floors, full-length mirrors, and professional sound systems. Between sessions, enjoy the resort's amenities including pools, gardens, and recreational areas.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Comfort for Dancers",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Rest and recover in our comfortable resort accommodations, designed with dancers' needs in mind – close to studios and featuring all the amenities you need."
- ],
- "outroText": [
- "💃 Dancer Dorms: Shared rooms for 4-6 dancers with en-suite bathrooms and stretching space.",
- "🌟 Premium Suites: Private rooms for 2 campers with additional amenities. (Additional charge applies)"
- ],
- "details": [
- "All rooms are air-conditioned with comfortable beds.",
- "Stretching areas and recovery spaces available.",
- "Staff available around the clock!",
- "Good to know:",
- "Bring comfortable dance wear and appropriate shoes for different styles.",
- "Laundry facilities available for dance clothes.",
- "Select your preferred room during the booking process!"
- ],
- "principles": [
- "Junior Dancers (12–14 years)",
- "Teen Performers (14–16 years)",
- "Advanced Dancers (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Dance Your Heart Out!",
- "introText": [
- "Our comprehensive dance program offers training in multiple styles, choreography workshops, and performance opportunities, all guided by professional dancers and choreographers."
- ],
- "quote": "",
- "outroText": [
- "Learn from the Best!",
- "Our instructors include professional dancers, choreographers, and performers with experience on international stages.",
- "Perform with Confidence!",
- "The camp culminates in a spectacular showcase where you'll perform choreography you've learned and created."
- ],
- "mainHeading": "Explore diverse dance styles and find your groove!",
- "principles": [
- "Contemporary & Jazz: Fluid movements, emotional expression, and technical foundations – expand your artistry!",
- "Hip-Hop & Street: Urban styles, grooves, and freestyle – bring the energy!",
- "Choreography & Creation: Learn to create your own pieces and collaborate with others!"
- ],
- "footerText": [
- "Every day brings new choreography, new challenges, and new opportunities to grow as a dancer and performer!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Fuel your dancing with nutritious, dancer-friendly meals prepared fresh daily. Our menu is designed to support high-energy activities while being delicious and satisfying.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Energy-boosting breakfast with options including fresh fruits, whole grains, proteins, and refreshing beverages."
- },
- {
- "title": "Lunch",
- "desc": "Balanced Malaysian and international cuisine with lean proteins, vegetables, and complex carbohydrates."
- },
- {
- "title": "Dinner",
- "desc": "Delicious evening meals featuring a variety of Asian and Western dishes to refuel after a day of dancing."
- },
- {
- "title": "Snacks and Refreshments",
- "desc": "Healthy snacks, fresh fruits, and hydrating drinks available between dance sessions."
- }
- ],
- "footer": "All meals cater to dancers' nutritional needs, with vegetarian, halal, and other dietary options available upon request!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Professional Dancers & Caring Mentors",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our dance team includes professional choreographers, experienced dance instructors, and dedicated camp counselors who create a supportive and inspiring environment.",
- "Instructors bring diverse backgrounds in contemporary, hip-hop, jazz, and traditional dance forms."
- ],
- "footerText": [
- "With a camper-to-instructor ratio of 1:8, dancers receive personalized attention and feedback to improve their skills.",
- "Our bilingual staff ensures clear instruction and a welcoming atmosphere for all participants."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Dance involves physical activity, and we ensure all participants are fully covered. Our comprehensive insurance protects campers during all dance activities and camp events.",
- "package": {
- "title": "Dance Camp Insurance",
- "desc": "Complete coverage for all dance-related activities, ensuring peace of mind for parents and protection for participants.",
- "items": [
- "Medical coverage for dance-related injuries",
- "Personal belongings protection",
- "Coverage for all camp activities"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation policy with refund options for qualifying circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical issues and emergencies",
- "Full refund of program fees available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Diving",
- "price": 1190,
- "priceText": "from 1190 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "philippines"
- ],
- "image": "/uploads/banner/b2.jpg",
- "link": "/diving",
- "program": "diving",
- "rating": 5,
- "camp-detail": {
- "hero": {
- "title": "Diving Camp in Philippines",
- "bgImage": "/uploads/banner/b2.jpg"
- },
- "basicInfo": {
- "location": "Philippines",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Beach Resort & Dive Center",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & FIL"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Coral Reef Discovery",
- "rating": 4.9,
- "reviews": 56,
- "location": "Cebu, Philippines",
- "price": 2200,
- "originalPrice": 2600,
- "image": "https://images.unsplash.com/photo-1544551763-46a013bb70d5?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Tropical Marine Adventure",
- "rating": 4.9,
- "reviews": 48,
- "location": "Palawan, Philippines",
- "price": 2400,
- "originalPrice": 2800,
- "image": "https://images.unsplash.com/photo-1559827260-dc66d52bef19?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Whale Shark Experience",
- "rating": 5,
- "reviews": 62,
- "location": "Oslob, Philippines",
- "price": 2600,
- "originalPrice": 3000,
- "image": "https://images.unsplash.com/photo-1560275619-4662e36fa65c?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Underwater Photography",
- "rating": 4.8,
- "reviews": 34,
- "location": "Bohol, Philippines",
- "price": 2100,
- "originalPrice": 2500,
- "image": "https://images.unsplash.com/photo-1546026423-cc4642628d2b?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Underwater scene"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Diving gear"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Beach resort"
- }
- ],
- "overlayInfo": {
- "location": "Philippines",
- "season": "Summer",
- "languages": "EN & FIL"
- }
- },
- "eventSchedule": {
- "startDate": "06/25/2024",
- "duration": "12 Days 11 Nights",
- "tickets": "$119/125"
- },
- "sections": {
- "overview": {
- "intro": "Dive into adventure at our Diving Camp in the Philippines! Explore some of the world's most biodiverse marine environments, earn your diving certification, and discover the wonders of the underwater world in crystal-clear tropical waters.",
- "mainText": "The Diving Camp offers young ocean enthusiasts aged 12 to 18 an extraordinary opportunity to learn scuba diving in the Philippines – consistently ranked among the world's top diving destinations. With PADI-certified instructors, campers progress from pool training to open water dives, exploring vibrant coral reefs and encountering incredible marine life.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, beginners to certified divers",
- "PADI certification courses available",
- "Certified dive instructors (1:4 ratio)",
- "All diving equipment provided",
- "Beachfront resort accommodation",
- "24/7 supervision and safety protocols",
- "Marine biology education sessions",
- "Underwater photography introduction"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Diving Camp is situated on a pristine beach in the Philippines, with direct access to world-renowned dive sites. The Coral Triangle, where the Philippines is located, contains the highest concentration of marine species on Earth. Campers will explore colorful coral gardens, encounter tropical fish, sea turtles, and possibly whale sharks in the crystal-clear waters of this tropical paradise.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Beachfront Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay at our beautiful beachfront resort with direct access to the dive center. Fall asleep to the sound of waves and wake up ready for underwater adventures."
- ],
- "outroText": [
- "🏖️ Beach Bungalows: Shared rooms for 4-6 divers with ocean views and outdoor rinse stations for gear.",
- "🌴 Premium Cottages: Private beachfront cottages for 2 campers with enhanced amenities. (Additional charge applies)"
- ],
- "details": [
- "All accommodations feature air conditioning and comfortable beds.",
- "Dive equipment storage and rinse facilities provided.",
- "Dive shop on-site for any needs!",
- "Good to know:",
- "Bring swimwear, reef-safe sunscreen, and a sense of adventure.",
- "Personal dive equipment can be rented if needed.",
- "Reserve your preferred bungalow during booking!"
- ],
- "principles": [
- "Junior Divers (12–14 years)",
- "Teen Divers (14–16 years)",
- "Advanced Divers (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Explore the Underwater World!",
- "introText": [
- "Our comprehensive diving program follows PADI standards, taking campers from their first breath underwater to certified open water diver status, with opportunities for advanced training."
- ],
- "quote": "",
- "outroText": [
- "Earn Your Certification!",
- "Complete your PADI Open Water Diver certification during camp – a globally recognized credential that opens up the underwater world for life.",
- "Conservation Matters!",
- "Learn about marine conservation and coral reef protection as part of your diving education."
- ],
- "mainHeading": "From pool training to open water adventures!",
- "principles": [
- "Pool Training: Master essential skills in confined water – buoyancy, breathing, safety procedures!",
- "Open Water Dives: Experience the thrill of diving in the ocean among incredible marine life!",
- "Specialty Sessions: Underwater photography, night diving introduction, and marine biology!"
- ],
- "footerText": [
- "Every dive brings new discoveries – from tiny nudibranchs to majestic sea turtles, the underwater world never stops amazing!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy fresh, delicious meals at our beachfront restaurant. Our menu features both local Filipino cuisine and international options, with an emphasis on fresh seafood and tropical fruits.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Start your diving day with a hearty breakfast featuring fresh fruits, eggs, local breads, and energizing beverages."
- },
- {
- "title": "Lunch",
- "desc": "Refuel after morning dives with grilled seafood, Filipino favorites, and refreshing tropical dishes."
- },
- {
- "title": "Dinner",
- "desc": "End your day with a satisfying dinner featuring fresh catches, barbecue, and authentic island cuisine."
- },
- {
- "title": "Snacks and Refreshments",
- "desc": "Stay hydrated with fresh coconuts, tropical juices, and healthy snacks throughout the day."
- }
- ],
- "footer": "For diving, proper hydration and nutrition are essential. Our kitchen ensures you're fueled for every underwater adventure!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "PADI Professionals & Marine Experts",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our dive team consists of PADI-certified instructors and divemasters with extensive experience teaching young divers.",
- "Safety is our top priority – all instructors maintain current certifications in dive instruction, first aid, and emergency oxygen provision."
- ],
- "footerText": [
- "With a strict 1:4 instructor-to-diver ratio during all dives, every camper receives personalized attention and guidance.",
- "Our team includes marine biologists who add educational depth to every underwater experience."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Scuba diving requires specialized insurance coverage. Our comprehensive dive insurance package is included in your camp fee and provides world-class protection for all diving activities.",
- "package": {
- "title": "Dive Accident Insurance",
- "desc": "Comprehensive coverage specifically designed for scuba diving activities, including emergency services.",
- "items": [
- "Hyperbaric chamber treatment coverage",
- "Emergency evacuation and medical transport",
- "Dive equipment coverage"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for medical or unforeseen circumstances, including dive medical clearance issues.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical clearance failures",
- "Full program fee refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Englisch TOEFL®",
- "price": 1290,
- "priceText": "from 1290 USD",
- "season": [
- "spring",
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "malaysia"
- ],
- "image": "/uploads/banner/b1.jpg",
- "link": "/englisch-toefl",
- "program": "englisch-toefl",
- "rating": 5,
- "camp-detail": {
- "hero": {
- "title": "English TOEFL® Camp in Malaysia",
- "bgImage": "/uploads/banner/b1.jpg"
- },
- "basicInfo": {
- "location": "Malaysia",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Language Campus & Dormitory",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "English Immersion"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "TOEFL Intensive Prep",
- "rating": 4.9,
- "reviews": 67,
- "location": "Kuala Lumpur, Malaysia",
- "price": 2100,
- "originalPrice": 2500,
- "image": "https://images.unsplash.com/photo-1523050854058-8df90110c9f1?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Academic English Bootcamp",
- "rating": 4.8,
- "reviews": 54,
- "location": "Penang, Malaysia",
- "price": 1900,
- "originalPrice": 2300,
- "image": "https://images.unsplash.com/photo-1434030216411-0b793f4b4173?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Speaking & Listening Focus",
- "rating": 4.9,
- "reviews": 42,
- "location": "Langkawi, Malaysia",
- "price": 1800,
- "originalPrice": 2200,
- "image": "https://images.unsplash.com/photo-1503676260728-1c00da094a0b?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Writing Excellence Program",
- "rating": 4.7,
- "reviews": 38,
- "location": "Ipoh, Malaysia",
- "price": 1700,
- "originalPrice": 2000,
- "image": "https://images.unsplash.com/photo-1456513080510-7bf3a84b82f8?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Classroom"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Study session"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Campus"
- }
- ],
- "overlayInfo": {
- "location": "Malaysia",
- "season": "Spring, Summer",
- "languages": "English"
- }
- },
- "eventSchedule": {
- "startDate": "07/05/2024",
- "duration": "14 Days 13 Nights",
- "tickets": "$129/135"
- },
- "sections": {
- "overview": {
- "intro": "Prepare for academic success at our English TOEFL® Camp in Malaysia! With intensive test preparation, English immersion, and engaging activities, campers boost their language skills while having fun in a supportive international environment.",
- "mainText": "The English TOEFL® Camp offers students aged 12 to 18 comprehensive preparation for the TOEFL® examination while developing practical English communication skills. Our certified instructors combine rigorous academic training with engaging activities that make language learning enjoyable and effective.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all English levels welcome",
- "Certified TOEFL® preparation instructors",
- "Small class sizes (max 12 students)",
- "Full-length practice tests included",
- "Modern campus accommodation",
- "24/7 English immersion environment",
- "Score improvement guarantee",
- "College counseling sessions available"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our English TOEFL® Camp is located on a modern language campus in Malaysia, designed specifically for intensive language learning. The campus features state-of-the-art classrooms, a well-stocked library, computer labs for practice tests, and comfortable common areas for student interaction. Malaysia's English-speaking environment provides additional immersion opportunities.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Study-Friendly Environment",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our campus dormitories are designed for focused study with quiet hours, comfortable study desks, and all the amenities students need for academic success."
- ],
- "outroText": [
- "📚 Student Dormitory: Shared rooms for 2-4 students with individual study desks and excellent lighting.",
- "🎓 Premium Single Rooms: Private rooms for focused study. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning, WiFi, and comfortable beds.",
- "Quiet study areas and library access available 24/7.",
- "Academic support staff always available!",
- "Good to know:",
- "Bring your laptop or tablet for practice tests and homework.",
- "All study materials are provided by the program.",
- "Reserve your preferred room type during registration!"
- ],
- "principles": [
- "Intermediate Level (12–14 years)",
- "Upper-Intermediate (14–16 years)",
- "Advanced Preparation (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Comprehensive TOEFL® Preparation!",
- "introText": [
- "Our intensive program covers all four TOEFL® sections – Reading, Listening, Speaking, and Writing – with proven strategies, extensive practice, and personalized feedback from certified instructors."
- ],
- "quote": "",
- "outroText": [
- "Master Test Strategies!",
- "Learn time management, question-type strategies, and scoring criteria directly from experienced TOEFL® preparation specialists.",
- "Track Your Progress!",
- "Regular diagnostic tests help identify areas for improvement, ensuring measurable score gains throughout the camp."
- ],
- "mainHeading": "Intensive preparation meets engaging learning!",
- "principles": [
- "Morning Sessions: Intensive skill-building in reading, listening, speaking, and writing!",
- "Afternoon Practice: Full-length section tests and targeted practice exercises!",
- "Evening Activities: Fun English activities, conversation clubs, and cultural experiences!"
- ],
- "footerText": [
- "Every day brings you closer to your target score while building confidence in your English abilities!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Our campus cafeteria serves nutritious, brain-boosting meals designed to support intensive study. All meals are included, with plenty of healthy options to keep students energized and focused.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Start your study day with a nutritious breakfast including proteins, whole grains, fresh fruits, and energizing beverages."
- },
- {
- "title": "Lunch",
- "desc": "Refuel with balanced meals featuring Asian and Western options, plenty of vegetables, and brain-healthy foods."
- },
- {
- "title": "Dinner",
- "desc": "Enjoy satisfying dinners with diverse menu options to reward your day of hard work and study."
- },
- {
- "title": "Study Snacks",
- "desc": "Healthy snacks, fresh fruits, and beverages available during study sessions and breaks."
- }
- ],
- "footer": "Good nutrition supports better learning! Our meals are designed to fuel academic success while satisfying diverse tastes."
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Expert Instructors & Academic Support",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our teaching team consists of certified TOEFL® preparation instructors with extensive experience helping students achieve their target scores.",
- "Instructors hold advanced degrees in English education and TESOL, with years of experience in test preparation."
- ],
- "footerText": [
- "With a student-to-teacher ratio of 1:8, every participant receives personalized attention and individual feedback.",
- "Academic counselors are available for college guidance and study planning support."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "All participants are covered by our comprehensive camp insurance, ensuring peace of mind for parents while students focus on their academic goals.",
- "package": {
- "title": "Academic Camp Insurance",
- "desc": "Full coverage for all camp activities, medical needs, and personal belongings during your stay.",
- "items": [
- "Comprehensive medical coverage",
- "Personal belongings protection",
- "Study materials replacement coverage"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation policy for unforeseen circumstances, including academic conflicts.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and academic emergencies",
- "Full program fee refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Englischcamps",
- "price": 530,
- "priceText": "from 530 USD",
- "season": [
- "spring",
- "summer",
- "autumn"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "philippines",
- "thailand"
- ],
- "image": "/uploads/activity/b5.jpg",
- "link": "/englischcamps",
- "program": "englisch-camps",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "English Language Camp in Philippines & Thailand",
- "bgImage": "/uploads/activity/b5.jpg"
- },
- "basicInfo": {
- "location": "Philippines & Thailand",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Campus & Resort",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "English Immersion"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "English Adventure Philippines",
- "rating": 4.8,
- "reviews": 48,
- "location": "Cebu, Philippines",
- "price": 1500,
- "originalPrice": 1800,
- "image": "https://images.unsplash.com/photo-1529156069898-49953e39b3ac?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Beach English Camp",
- "rating": 4.9,
- "reviews": 52,
- "location": "Phuket, Thailand",
- "price": 1600,
- "originalPrice": 1900,
- "image": "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Cultural English Exchange",
- "rating": 4.7,
- "reviews": 39,
- "location": "Manila, Philippines",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1517486808906-6ca8b3f04846?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "English & Adventure Thailand",
- "rating": 4.8,
- "reviews": 45,
- "location": "Chiang Mai, Thailand",
- "price": 1550,
- "originalPrice": 1850,
- "image": "https://images.unsplash.com/photo-1528164344705-47542687000d?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Language class"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Group activity"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Cultural experience"
- }
- ],
- "overlayInfo": {
- "location": "Philippines & Thailand",
- "season": "Spring, Summer, Autumn",
- "languages": "English"
- }
- },
- "eventSchedule": {
- "startDate": "06/15/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$53/58"
- },
- "sections": {
- "overview": {
- "intro": "Immerse yourself in English at our dynamic language camps in the Philippines and Thailand! Combining classroom learning with real-world practice and exciting activities, campers rapidly improve their English skills while making international friends.",
- "mainText": "The English Language Camp offers students aged 12 to 18 a complete immersion experience in English-speaking environments. Our unique approach combines structured lessons with adventure activities, cultural experiences, and constant opportunities to practice English in authentic situations.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all English levels welcome",
- "Qualified native-speaking instructors",
- "Full English immersion environment",
- "Adventure activities in English",
- "Comfortable camp accommodation",
- "24/7 care and language support",
- "Certificate of completion",
- "Cultural exchange activities"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our English camps are located in beautiful tropical settings in the Philippines and Thailand. Both locations offer stunning natural environments perfect for language learning and adventure activities. The English-friendly environments in both countries provide excellent opportunities for practical language use beyond the classroom.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Comfortable & Social Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in comfortable shared accommodations designed to maximize English practice through social interaction with roommates from around the world."
- ],
- "outroText": [
- "🌍 International Dorms: Shared rooms with students from different countries – more chances to practice English!",
- "🏠 Comfort Cabins: Semi-private rooms for 2-3 students. (Additional charge applies)"
- ],
- "details": [
- "All accommodations are clean, safe, and comfortable.",
- "English-speaking environment 24/7!",
- "Staff available around the clock!",
- "Good to know:",
- "Bring an open mind and willingness to practice English.",
- "All levels are welcome – support is always available.",
- "Choose your location preference during booking!"
- ],
- "principles": [
- "Starter (12–14 years)",
- "Intermediate (14–16 years)",
- "Advanced (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Learn English the Fun Way!",
- "introText": [
- "Our program combines interactive classroom sessions with practical English use in real-life activities, making language learning engaging, effective, and fun."
- ],
- "quote": "",
- "outroText": [
- "Practice Through Activities!",
- "Every activity – from sports to crafts to excursions – is conducted in English, providing natural learning opportunities all day long.",
- "Build Real Confidence!",
- "By the end of camp, you'll have the confidence to communicate in English in any situation."
- ],
- "mainHeading": "English learning through total immersion!",
- "principles": [
- "Morning Classes: Interactive grammar, vocabulary, speaking, and listening sessions!",
- "Afternoon Activities: Sports, games, and adventures – all in English!",
- "Evening Fun: Movies, campfires, talent shows, and social activities – English 24/7!"
- ],
- "footerText": [
- "Every moment is an opportunity to improve your English – and have amazing fun doing it!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy delicious meals featuring local and international cuisine. Mealtimes are also English practice times – our staff encourage conversation in English at all meals!",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Energizing breakfast with local and Western options to start your day of English adventures."
- },
- {
- "title": "Lunch",
- "desc": "Delicious lunch featuring fresh, local ingredients prepared in various international styles."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying dinners with diverse options, enjoyed with your new international friends."
- },
- {
- "title": "Snacks and Refreshments",
- "desc": "Fresh fruits, snacks, and drinks available throughout the day."
- }
- ],
- "footer": "Mealtimes are social times! Practice your English while enjoying great food with friends from around the world."
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Native Speakers & Language Experts",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our team includes native English-speaking instructors with TEFL/TESOL certifications and experience teaching young learners.",
- "Activity leaders and counselors maintain the English-only environment while providing friendly support."
- ],
- "footerText": [
- "With a camper-to-staff ratio of 1:8, every student receives personal attention and language support.",
- "Staff are trained to encourage English use in a supportive, fun way."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "All campers are covered by comprehensive insurance throughout their stay, ensuring parents' peace of mind while students focus on learning and fun.",
- "package": {
- "title": "Language Camp Insurance",
- "desc": "Full coverage for all camp activities and medical needs during your English adventure.",
- "items": [
- "Comprehensive medical coverage",
- "Personal belongings protection",
- "All activities covered"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation options for unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and family emergencies",
- "Full refund of program fees"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Fishing",
- "price": 580,
- "priceText": "from 580 USD",
- "season": [
- "spring",
- "summer",
- "autumn"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "vietnam"
- ],
- "image": "/uploads/activity/b6.jpg",
- "link": "/fishing",
- "program": "fishing",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "Fishing Camp in Vietnam",
- "bgImage": "/uploads/activity/b6.jpg"
- },
- "basicInfo": {
- "location": "Vietnam",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Lakeside Lodge & Cabin",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & VN"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Lake Fishing Adventure",
- "rating": 4.8,
- "reviews": 34,
- "location": "Da Lat, Vietnam",
- "price": 1100,
- "originalPrice": 1400,
- "image": "https://images.unsplash.com/photo-1504309092620-4d0ec726efa4?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "River Fishing Experience",
- "rating": 4.7,
- "reviews": 28,
- "location": "Mekong Delta, Vietnam",
- "price": 1200,
- "originalPrice": 1500,
- "image": "https://images.unsplash.com/photo-1532015917327-c9ca18dfa9af?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Traditional Fishing Camp",
- "rating": 4.9,
- "reviews": 31,
- "location": "Hoi An, Vietnam",
- "price": 1150,
- "originalPrice": 1450,
- "image": "https://images.unsplash.com/photo-1516747773440-c28f1cf48b2c?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Fly Fishing Workshop",
- "rating": 4.6,
- "reviews": 22,
- "location": "Sapa, Vietnam",
- "price": 1300,
- "originalPrice": 1600,
- "image": "https://images.unsplash.com/photo-1535530992830-e25d07cfa780?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Lake scene"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Fishing"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Nature"
- }
- ],
- "overlayInfo": {
- "location": "Vietnam",
- "season": "Spring, Summer, Autumn",
- "languages": "EN & VN"
- }
- },
- "eventSchedule": {
- "startDate": "06/20/2024",
- "duration": "8 Days 7 Nights",
- "tickets": "$58/62"
- },
- "sections": {
- "overview": {
- "intro": "Experience the peaceful art of fishing at our camp in Vietnam! Surrounded by stunning natural landscapes, campers learn various fishing techniques while developing patience, respect for nature, and outdoor skills.",
- "mainText": "The Fishing Camp welcomes young anglers aged 12 to 18 to discover the joys of fishing in Vietnam's beautiful lakes and rivers. From beginner lessons to advanced techniques, our experienced guides teach everything from casting to catch-and-release practices, all while fostering a deep appreciation for aquatic ecosystems.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all experience levels welcome",
- "Expert fishing guides and instructors",
- "All fishing equipment provided",
- "Multiple fishing techniques taught",
- "Lakeside accommodation",
- "24/7 supervision and care",
- "Ecology and conservation education",
- "Nature exploration activities"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Fishing Camp is nestled beside a pristine lake in the highlands of Vietnam, offering perfect conditions for learning and enjoying fishing. The camp is surrounded by mountains, forests, and abundant wildlife. Between fishing sessions, explore hiking trails, observe local bird species, and enjoy the tranquility of nature.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Lakeside Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Rest in our comfortable lakeside lodges with views of the water. Wake up to misty mornings and the promise of great fishing!"
- ],
- "outroText": [
- "🎣 Angler's Lodge: Shared rooms for 4-6 campers with direct access to fishing spots.",
- "🏡 Private Cabin: Lakefront cabins for 2-3 campers with premium views. (Additional charge applies)"
- ],
- "details": [
- "All accommodations include comfortable beds and storage for fishing gear.",
- "Rod storage and tackle areas available.",
- "Experienced staff on-site 24/7!",
- "Good to know:",
- "All fishing equipment is provided – just bring your enthusiasm!",
- "Warm layers recommended for early morning fishing sessions.",
- "Book your preferred accommodation during registration!"
- ],
- "principles": [
- "Junior Anglers (12–14 years)",
- "Teen Fishers (14–16 years)",
- "Advanced Anglers (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Master the Art of Fishing!",
- "introText": [
- "Our comprehensive fishing program teaches everything from basic casting to advanced techniques, with emphasis on patience, technique, and respect for aquatic life."
- ],
- "quote": "",
- "outroText": [
- "Learn From the Best!",
- "Our guides have decades of experience and share their passion for fishing with enthusiasm and patience.",
- "Respect for Nature!",
- "We teach catch-and-release practices and environmental stewardship as part of responsible angling."
- ],
- "mainHeading": "From first cast to experienced angler!",
- "principles": [
- "Fundamentals: Casting techniques, knot tying, bait selection – build your foundation!",
- "Advanced Skills: Reading water, fly fishing, lure fishing – expand your abilities!",
- "Nature Connection: Fish ecology, conservation, and responsible fishing practices!"
- ],
- "footerText": [
- "Every day on the water brings new lessons, new experiences, and the peaceful joy of fishing!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy hearty Vietnamese cuisine prepared fresh daily. Our kitchen uses local ingredients, and you might even get to cook your own catch with supervision!",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Early morning fuel with pho, banh mi, fresh fruits, and hot beverages before dawn fishing sessions."
- },
- {
- "title": "Lunch",
- "desc": "Delicious Vietnamese dishes with rice, fresh vegetables, and protein to keep you energized."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying evening meals featuring local specialties, sometimes including fresh-caught fish!"
- },
- {
- "title": "Snacks and Refreshments",
- "desc": "Trail mix, fresh fruits, and drinks to keep you going during long fishing sessions."
- }
- ],
- "footer": "Experience authentic Vietnamese cuisine while enjoying the peaceful atmosphere of lakeside dining!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Expert Guides & Patient Teachers",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our fishing guides are experienced anglers with years of local knowledge and a passion for teaching young people.",
- "All guides hold water safety certifications and first aid training."
- ],
- "footerText": [
- "With a camper-to-guide ratio of 1:6 during fishing activities, every participant receives personalized instruction.",
- "Our bilingual team ensures clear communication and a supportive learning environment."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "All water-based activities require proper insurance coverage. Our comprehensive package ensures participants are protected during all fishing and outdoor activities.",
- "package": {
- "title": "Outdoor Activity Insurance",
- "desc": "Full coverage for all fishing and outdoor activities included in the camp program.",
- "items": [
- "Water activity coverage",
- "Equipment damage protection",
- "Medical coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation policy for unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and family emergencies",
- "Full program fee refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "German Camps",
- "price": 610,
- "priceText": "from 610 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "thailand",
- "vietnam"
- ],
- "image": "/uploads/activity/b7.jpg",
- "link": "/german-camps",
- "program": "german-camps",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "German Language Camp in Thailand & Vietnam",
- "bgImage": "/uploads/activity/b7.jpg"
- },
- "basicInfo": {
- "location": "Thailand & Vietnam",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Campus & Resort",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "German & English"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "German Intensive Thailand",
- "rating": 4.8,
- "reviews": 38,
- "location": "Chiang Mai, Thailand",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1527004013197-933c4bb611b3?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "German Beach Camp",
- "rating": 4.7,
- "reviews": 32,
- "location": "Phuket, Thailand",
- "price": 1500,
- "originalPrice": 1800,
- "image": "https://images.unsplash.com/photo-1519125323398-675f0ddb6308?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "German Adventure Vietnam",
- "rating": 4.9,
- "reviews": 41,
- "location": "Hanoi, Vietnam",
- "price": 1350,
- "originalPrice": 1650,
- "image": "https://images.unsplash.com/photo-1557804506-669a67965ba0?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "German Cultural Exchange",
- "rating": 4.8,
- "reviews": 29,
- "location": "Da Nang, Vietnam",
- "price": 1450,
- "originalPrice": 1750,
- "image": "https://images.unsplash.com/photo-1528164344705-47542687000d?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Language class"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Group activity"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Cultural event"
- }
- ],
- "overlayInfo": {
- "location": "Thailand & Vietnam",
- "season": "Summer",
- "languages": "German & EN"
- }
- },
- "eventSchedule": {
- "startDate": "07/01/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$61/65"
- },
- "sections": {
- "overview": {
- "intro": "Lerne Deutsch auf eine ganz neue Art! Our German Language Camp combines intensive language learning with exciting adventures in Thailand and Vietnam, making language acquisition fun, effective, and memorable.",
- "mainText": "The German Language Camp offers students aged 12 to 18 an immersive German learning experience in beautiful Southeast Asian settings. Native German-speaking instructors lead interactive lessons, while activities and excursions provide endless opportunities for practical language use.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all German levels welcome",
- "Native German-speaking instructors",
- "Small interactive class sizes",
- "Daily conversation practice",
- "Comfortable campus accommodation",
- "24/7 care and language support",
- "Certificate of completion",
- "Cultural activities and excursions"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our German camps are located in beautiful destinations in Thailand and Vietnam, offering unique cultural experiences alongside language learning. The combination of tropical beauty and modern facilities creates the perfect environment for learning German while enjoying adventure and new experiences.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Comfortable Learning Environment",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in comfortable campus accommodations designed for language learning – practice German with roommates and staff in a supportive environment."
- ],
- "outroText": [
- "🇩🇪 Language Dorms: Shared rooms with German-speaking environment and study areas.",
- "🏠 Premium Rooms: Semi-private accommodation for focused learners. (Additional charge applies)"
- ],
- "details": [
- "All accommodations feature modern amenities and comfortable beds.",
- "German-speaking environment encouraged throughout!",
- "Staff available 24/7 for support!",
- "Good to know:",
- "Bring enthusiasm for learning German!",
- "All learning materials are provided.",
- "Select your preferred location during booking!"
- ],
- "principles": [
- "Anfänger/Beginner (12–14 years)",
- "Mittelstufe/Intermediate (14–16 years)",
- "Fortgeschritten/Advanced (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Deutsch Lernen mit Spaß!",
- "introText": [
- "Our program combines structured German lessons with practical application through activities, games, and cultural experiences – learning German has never been so enjoyable!"
- ],
- "quote": "",
- "outroText": [
- "Muttersprachliche Lehrer!",
- "Learn from native German speakers who bring language and culture to life through engaging, interactive teaching methods.",
- "Praktische Anwendung!",
- "Every activity is an opportunity to practice German – from sports to crafts to evening entertainment."
- ],
- "mainHeading": "Immersive German learning experience!",
- "principles": [
- "Morgenunterricht: Interactive grammar, vocabulary, and conversation classes!",
- "Nachmittagsaktivitäten: Sports, games, and adventures – all in German!",
- "Abendprogramm: Movies, campfires, games, and cultural activities in German!"
- ],
- "footerText": [
- "Jeden Tag wird dein Deutsch besser! Every day brings improvement, confidence, and fun!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Guten Appetit! Enjoy delicious local and international cuisine at mealtimes. Meals are also German practice opportunities – our staff encourage German conversation at the table!",
- "items": [
- {
- "title": "Frühstück (Breakfast)",
- "desc": "Start your learning day with a nutritious breakfast featuring local and Western options."
- },
- {
- "title": "Mittagessen (Lunch)",
- "desc": "Delicious lunch with fresh local ingredients and international variety."
- },
- {
- "title": "Abendessen (Dinner)",
- "desc": "Satisfying dinner with diverse menu options enjoyed with your German-speaking friends."
- },
- {
- "title": "Snacks und Getränke",
- "desc": "Fresh fruits, snacks, and beverages available throughout the day."
- }
- ],
- "footer": "Mahlzeiten sind Deutschübungen! Practice your German vocabulary while enjoying great food!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Native Speakers & Language Experts",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our team consists of native German-speaking instructors with TEFL/DaF certifications and experience teaching young learners.",
- "All staff maintain a German-speaking environment while providing supportive, encouraging instruction."
- ],
- "footerText": [
- "With a student-to-teacher ratio of 1:8, every camper receives personal attention and language support.",
- "Our multilingual staff can assist when needed while encouraging maximum German practice."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "All campers are covered by comprehensive insurance throughout their language learning adventure, ensuring peace of mind for parents.",
- "package": {
- "title": "Language Camp Insurance",
- "desc": "Full coverage for all camp activities and medical needs during your German learning experience.",
- "items": [
- "Comprehensive medical coverage",
- "Personal belongings protection",
- "All activities covered"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for unforeseen circumstances with full refund options.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and family emergencies",
- "Full program fee refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Horseback Riding",
- "price": 620,
- "priceText": "from 620 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "portugal"
- ],
- "image": "/uploads/activity/b8.jpg",
- "link": "/horseback-riding",
- "program": "horseback",
- "rating": 5,
- "camp-detail": {
- "hero": {
- "title": "Horseback Riding Camp in Portugal",
- "bgImage": "/uploads/activity/b8.jpg"
- },
- "basicInfo": {
- "location": "Portugal",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Equestrian Estate & Lodge",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & PT"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Lusitano Horse Experience",
- "rating": 5,
- "reviews": 48,
- "location": "Alentejo, Portugal",
- "price": 1800,
- "originalPrice": 2200,
- "image": "https://images.unsplash.com/photo-1553284965-83fd3e82fa5a?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Trail Riding Adventure",
- "rating": 4.9,
- "reviews": 42,
- "location": "Sintra, Portugal",
- "price": 1700,
- "originalPrice": 2000,
- "image": "https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Dressage Basics",
- "rating": 4.8,
- "reviews": 35,
- "location": "Cascais, Portugal",
- "price": 1900,
- "originalPrice": 2300,
- "image": "https://images.unsplash.com/photo-1449495169669-7b118f960251?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Beach Horse Riding",
- "rating": 4.9,
- "reviews": 52,
- "location": "Algarve, Portugal",
- "price": 1650,
- "originalPrice": 1950,
- "image": "https://images.unsplash.com/photo-1534307671554-9a6d81f4d629?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Horse riding"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Stables"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Trail ride"
- }
- ],
- "overlayInfo": {
- "location": "Portugal",
- "season": "Summer",
- "languages": "EN & PT"
- }
- },
- "eventSchedule": {
- "startDate": "07/01/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$62/68"
- },
- "sections": {
- "overview": {
- "intro": "Experience the magic of horseback riding at our equestrian camp in beautiful Portugal! From beginner lessons to advanced riding skills, campers develop a deep connection with horses while exploring stunning Portuguese countryside.",
- "mainText": "The Horseback Riding Camp offers young horse enthusiasts aged 12 to 18 a complete equestrian experience in Portugal, home to the legendary Lusitano horses. Under the guidance of certified riding instructors, campers learn riding fundamentals, horse care, and develop lasting bonds with these magnificent animals.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all riding levels welcome",
- "Certified equestrian instructors",
- "Beautiful Lusitano and mixed breed horses",
- "All riding equipment provided",
- "Equestrian estate accommodation",
- "24/7 supervision and care",
- "Trail rides through Portuguese countryside",
- "Horse care and stable management lessons"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Horseback Riding Camp is located on a beautiful equestrian estate in Portugal, featuring professional stables, indoor and outdoor arenas, and miles of scenic trails. The rolling hills, cork oak forests, and traditional Portuguese landscape provide the perfect backdrop for your equestrian adventure.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Estate Living Near the Stables",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in our charming lodge accommodations on the equestrian estate, just steps away from the stables where you can visit your equine friends."
- ],
- "outroText": [
- "🐴 Rider's Lodge: Shared rooms for 4-6 riders with views of pastures and paddocks.",
- "🏡 Estate Cottage: Private cottages for 2-3 campers with enhanced comfort. (Additional charge applies)"
- ],
- "details": [
- "All accommodations are clean, comfortable, and close to stables.",
- "Boot room for storing riding gear and boots.",
- "Staff available around the clock!",
- "Good to know:",
- "Bring long pants suitable for riding and closed-toe shoes.",
- "Helmets and riding boots available for use.",
- "Reserve your preferred accommodation during booking!"
- ],
- "principles": [
- "Beginner Riders (12–14 years)",
- "Intermediate Riders (14–16 years)",
- "Advanced Riders (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Ride, Learn, and Bond with Horses!",
- "introText": [
- "Our comprehensive equestrian program covers riding skills, horse care, and horsemanship, creating well-rounded riders who understand and respect these beautiful animals."
- ],
- "quote": "",
- "outroText": [
- "Complete Horsemanship!",
- "Beyond riding, you'll learn grooming, tacking, feeding, and stable management – developing a complete understanding of horse care.",
- "Trail Adventures!",
- "Experience the thrill of riding through Portuguese countryside, beaches, and forests on memorable trail rides."
- ],
- "mainHeading": "From the ground up – complete equestrian education!",
- "principles": [
- "Arena Sessions: Balance, position, gaits, and control in safe, structured lessons!",
- "Horse Care: Grooming, tacking, feeding, and understanding horse behavior!",
- "Trail Riding: Explore beautiful Portuguese landscapes on horseback!"
- ],
- "footerText": [
- "Every day strengthens your bond with horses and your skills as a rider!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy delicious Portuguese cuisine prepared fresh on the estate. Our meals feature local ingredients and traditional recipes, giving you a true taste of Portugal.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Hearty breakfast with fresh bread, local cheeses, fruits, and eggs to fuel your morning ride."
- },
- {
- "title": "Lunch",
- "desc": "Traditional Portuguese lunch with grilled meats, seafood, fresh salads, and local dishes."
- },
- {
- "title": "Dinner",
- "desc": "Family-style dinners featuring Portuguese favorites and fresh, local ingredients."
- },
- {
- "title": "Rider's Snacks",
- "desc": "Fresh fruits, energy bars, and beverages available between riding sessions."
- }
- ],
- "footer": "Experience authentic Portuguese hospitality and cuisine on our beautiful equestrian estate!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Expert Equestrians & Caring Staff",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our team includes certified riding instructors, experienced stable hands, and caring counselors who share a passion for horses and teaching.",
- "All instructors hold recognized equestrian qualifications and first aid certifications."
- ],
- "footerText": [
- "With a rider-to-instructor ratio of 1:4 during lessons, every camper receives personalized attention and coaching.",
- "Our bilingual team ensures clear instruction and creates a welcoming atmosphere for all participants."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Horseback riding requires specialized insurance coverage. Our comprehensive equestrian insurance protects all participants during riding activities and horse care.",
- "package": {
- "title": "Equestrian Activity Insurance",
- "desc": "Specialized coverage for all horseback riding activities and related camp programs.",
- "items": [
- "Full coverage for riding-related accidents",
- "Personal liability protection",
- "Medical evacuation coverage"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation policy with refund options for qualifying circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical issues and emergencies",
- "Full refund of program fees available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Husky Camp",
- "price": 525,
- "priceText": "from 525 USD",
- "season": [
- "spring",
- "summer",
- "autumn"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "china"
- ],
- "image": "/uploads/activity/b9.jpg",
- "link": "/husky-camp",
- "program": "husky",
- "rating": 5,
- "camp-detail": {
- "hero": {
- "title": "Husky Camp in China",
- "bgImage": "/uploads/activity/b9.jpg"
- },
- "basicInfo": {
- "location": "China",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Mountain Lodge & Cabin",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & CN"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Husky Trekking Adventure",
- "rating": 5,
- "reviews": 58,
- "location": "Harbin, China",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1605568427561-40dd23c2acea?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Dog Sledding Experience",
- "rating": 4.9,
- "reviews": 45,
- "location": "Inner Mongolia, China",
- "price": 1500,
- "originalPrice": 1800,
- "image": "https://images.unsplash.com/photo-1551632811-561732d1e306?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Husky Training Camp",
- "rating": 4.8,
- "reviews": 38,
- "location": "Changbai Mountain, China",
- "price": 1350,
- "originalPrice": 1650,
- "image": "https://images.unsplash.com/photo-1568572933382-74d440642117?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Arctic Dogs Adventure",
- "rating": 4.9,
- "reviews": 52,
- "location": "Mohe, China",
- "price": 1600,
- "originalPrice": 1900,
- "image": "https://images.unsplash.com/photo-1547407139-3c921a66005c?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Huskies"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Sled dogs"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Mountain camp"
- }
- ],
- "overlayInfo": {
- "location": "China",
- "season": "Spring, Summer, Autumn",
- "languages": "EN & CN"
- }
- },
- "eventSchedule": {
- "startDate": "06/25/2024",
- "duration": "8 Days 7 Nights",
- "tickets": "$52/56"
- },
- "sections": {
- "overview": {
- "intro": "Experience the incredible bond between humans and huskies at our unique camp in China! Work alongside these amazing sled dogs, learn about their care, and enjoy outdoor adventures in breathtaking mountain landscapes.",
- "mainText": "The Husky Camp offers animal lovers aged 12 to 18 an extraordinary opportunity to connect with Siberian and Alaskan huskies. Campers learn about dog behavior, training, mushing traditions, and responsible animal care while forming unforgettable bonds with these friendly, energetic dogs.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all experience levels welcome",
- "Professional husky handlers and trainers",
- "Daily interaction with trained huskies",
- "Learn dog care and training basics",
- "Mountain lodge accommodation",
- "24/7 supervision and care",
- "Hiking and trekking with huskies",
- "Photography opportunities with dogs"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Husky Camp is located in the scenic mountains of northern China, where the climate and terrain are perfect for these arctic-heritage dogs. The camp features professional dog facilities, hiking trails, and stunning natural scenery. Campers experience the beauty of Chinese mountain landscapes while bonding with our pack of friendly huskies.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Cozy Mountain Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in our warm, cozy mountain lodges surrounded by beautiful nature. Rest well after exciting days with the huskies!"
- ],
- "outroText": [
- "🐺 Musher's Lodge: Shared rooms for 4-6 campers with views of the husky kennel area.",
- "🏔️ Mountain Cabin: Private cabins for 2-3 campers with fireplace and enhanced comfort. (Additional charge applies)"
- ],
- "details": [
- "All accommodations feature heating and comfortable beds.",
- "Boot and gear drying facilities available.",
- "Staff available 24/7!",
- "Good to know:",
- "Bring warm layers – mornings can be cool in the mountains.",
- "Comfortable outdoor clothing essential.",
- "Reserve your preferred accommodation during booking!"
- ],
- "principles": [
- "Junior Mushers (12–14 years)",
- "Teen Handlers (14–16 years)",
- "Advanced Mushers (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Bond with Amazing Huskies!",
- "introText": [
- "Our program combines husky care, outdoor adventures, and education about these remarkable dogs, creating meaningful connections between campers and animals."
- ],
- "quote": "",
- "outroText": [
- "Learn from Expert Handlers!",
- "Our experienced mushers and dog trainers share their knowledge and passion for these incredible animals.",
- "Unforgettable Memories!",
- "The bond you form with huskies and the adventures you share will stay with you forever."
- ],
- "mainHeading": "Every day is an adventure with huskies!",
- "principles": [
- "Husky Care: Feeding, grooming, and understanding husky behavior and needs!",
- "Outdoor Adventures: Hiking and trekking with huskies through beautiful trails!",
- "Training Basics: Learn how mushers communicate with and train sled dogs!"
- ],
- "footerText": [
- "Experience the joy, energy, and friendship of these amazing dogs every single day!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy hearty, warming meals designed for active outdoor adventures. Our kitchen serves nutritious Chinese and international dishes that fuel your adventures with the huskies.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Filling breakfast with hot porridge, eggs, breads, and warming beverages to start your day with the dogs."
- },
- {
- "title": "Lunch",
- "desc": "Substantial Chinese and international dishes with plenty of protein and vegetables."
- },
- {
- "title": "Dinner",
- "desc": "Comforting evening meals with local specialties and international favorites after a day outdoors."
- },
- {
- "title": "Trail Snacks",
- "desc": "Energy-packed snacks and hot drinks for outdoor activities and husky adventures."
- }
- ],
- "footer": "Our meals are designed to keep you energized for adventures with the huskies – hearty, healthy, and delicious!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Expert Handlers & Animal Lovers",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our team includes professional husky handlers, experienced trainers, and caring counselors who love working with both dogs and young people.",
- "All staff are trained in animal handling and first aid."
- ],
- "footerText": [
- "With a camper-to-staff ratio of 1:6, every participant receives personal attention and guidance with the dogs.",
- "Our bilingual team ensures clear communication and creates a welcoming, safe environment."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Working with animals requires appropriate insurance coverage. Our comprehensive package protects all participants during husky activities and outdoor adventures.",
- "package": {
- "title": "Animal Activity Insurance",
- "desc": "Complete coverage for all activities involving huskies and outdoor adventures.",
- "items": [
- "Animal-related activity coverage",
- "Outdoor adventure protection",
- "Medical coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation options for unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and family emergencies",
- "Full program fee refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "International Counsellor in Training (ICIT)",
- "price": 995,
- "priceText": "from 995 USD",
- "season": [
- "summer"
- ],
- "age": [
- 16,
- 18
- ],
- "locations": [
- "thailand",
- "malaysia"
- ],
- "image": "/uploads/activity/b10.jpg",
- "link": "/international-counsellor-in-training-icit",
- "program": "icit",
- "rating": 5,
- "camp-detail": {
- "hero": {
- "title": "International Counsellor in Training (ICIT) in Thailand & Malaysia",
- "bgImage": "/uploads/activity/b10.jpg"
- },
- "basicInfo": {
- "location": "Thailand & Malaysia",
- "ageRange": "16 - 18 years\nAdvanced Leadership Program",
- "accommodationType": "Leadership Center & Campus",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "English Immersion"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Leadership Intensive Thailand",
- "rating": 5,
- "reviews": 62,
- "location": "Chiang Mai, Thailand",
- "price": 2200,
- "originalPrice": 2600,
- "image": "https://images.unsplash.com/photo-1522071820081-009f0129c71c?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Counselor Skills Malaysia",
- "rating": 4.9,
- "reviews": 55,
- "location": "Kuala Lumpur, Malaysia",
- "price": 2100,
- "originalPrice": 2500,
- "image": "https://images.unsplash.com/photo-1528901166007-3784c7dd3653?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Team Building Adventure",
- "rating": 4.9,
- "reviews": 48,
- "location": "Phuket, Thailand",
- "price": 2000,
- "originalPrice": 2400,
- "image": "https://images.unsplash.com/photo-1517048676732-d65bc937f952?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Future Leaders Program",
- "rating": 5,
- "reviews": 42,
- "location": "Langkawi, Malaysia",
- "price": 2300,
- "originalPrice": 2700,
- "image": "https://images.unsplash.com/photo-1552664730-d307ca884978?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Team building"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Leadership activity"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Group session"
- }
- ],
- "overlayInfo": {
- "location": "Thailand & Malaysia",
- "season": "Summer",
- "languages": "English"
- }
- },
- "eventSchedule": {
- "startDate": "07/01/2024",
- "duration": "14 Days 13 Nights",
- "tickets": "$99/105"
- },
- "sections": {
- "overview": {
- "intro": "Take the next step in your camp journey with our International Counsellor in Training program! Designed for experienced campers aged 16-18, the ICIT program develops leadership skills while preparing participants for future roles as camp counselors.",
- "mainText": "The ICIT program offers mature teens aged 16 to 18 an advanced leadership experience across Thailand and Malaysia. Participants develop essential skills in communication, problem-solving, group dynamics, and child development while gaining hands-on experience supporting younger campers and learning from experienced counselors.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 16–18, prior camp experience preferred",
- "Comprehensive leadership training",
- "Hands-on counselor experience",
- "Child development education",
- "International certification recognized",
- "24/7 mentorship and support",
- "Future employment opportunities",
- "Resume-building experience"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "The ICIT program takes place across two locations – Thailand and Malaysia – giving participants exposure to different camp settings and cultural contexts. Both locations feature professional training facilities, leadership centers, and opportunities to practice skills with younger campers in real camp environments.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Leadership Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "ICIT participants stay in designated leadership areas, separate from younger campers, with additional responsibility and privileges appropriate to their training role."
- ],
- "outroText": [
- "🎓 ICIT Quarters: Shared rooms for 2-4 participants with study and meeting spaces.",
- "🏢 Leadership Suite: Enhanced accommodations with additional amenities. (Additional charge applies)"
- ],
- "details": [
- "All accommodations feature air conditioning and comfortable beds.",
- "Private meeting spaces for ICIT activities.",
- "Mentors available for guidance and support!",
- "Good to know:",
- "Bring a positive attitude and willingness to learn and lead.",
- "Professional attire required for some sessions.",
- "Choose your preferred location during registration!"
- ],
- "principles": [
- "First-Year ICIT (16–17 years)",
- "Advanced ICIT (17–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Become a Future Leader!",
- "introText": [
- "Our comprehensive ICIT curriculum combines leadership theory with practical experience, preparing participants for counselor roles and developing skills valuable in any career path."
- ],
- "quote": "",
- "outroText": [
- "Learn from Experienced Counselors!",
- "Shadow and learn from our senior staff who share their experience, techniques, and passion for youth development.",
- "Earn Your Certification!",
- "Successfully complete the program and receive an internationally recognized certificate qualifying you for future counselor positions."
- ],
- "mainHeading": "From camper to leader – your journey continues!",
- "principles": [
- "Leadership Training: Communication, conflict resolution, decision-making, and team dynamics!",
- "Practical Experience: Assist with activities, support younger campers, lead small groups!",
- "Professional Development: Child safety, diversity training, and career preparation!"
- ],
- "footerText": [
- "This program opens doors to future camp employment and builds leadership skills for life!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "ICIT participants enjoy the same excellent meals as all campers, with additional responsibility for modeling good dining hall behavior and occasionally assisting with meal supervision.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Energizing breakfast to fuel your leadership day with healthy options and energizing beverages."
- },
- {
- "title": "Lunch",
- "desc": "Delicious lunch featuring Asian and international cuisine with balanced nutrition."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying evening meals enjoyed with fellow ICIT participants and mentors."
- },
- {
- "title": "Study Snacks",
- "desc": "Snacks and beverages available during evening sessions and planning meetings."
- }
- ],
- "footer": "Meals are community time – practice your leadership and build relationships with fellow future counselors!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Experienced Mentors & Leaders",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "The ICIT program is led by our most experienced senior counselors and leadership trainers, who serve as mentors and role models.",
- "All ICIT mentors have extensive experience in youth development and camp leadership."
- ],
- "footerText": [
- "With a participant-to-mentor ratio of 1:6, every ICIT receives personalized guidance and feedback.",
- "Ongoing mentorship continues even after the program ends for those pursuing camp career paths."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "All ICIT participants are covered by comprehensive insurance throughout the program, including enhanced coverage appropriate for leadership training activities.",
- "package": {
- "title": "ICIT Program Insurance",
- "desc": "Complete coverage for all leadership training activities and camp experiences.",
- "items": [
- "Full medical coverage",
- "Professional liability awareness training",
- "All program activities covered"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation options for this advanced program.",
- "items": [
- "Valid until two weeks before program start",
- "Covers medical and emergency situations",
- "Partial or full refund depending on timing"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Leadership",
- "price": 1185,
- "priceText": "from 1185 USD",
- "season": [
- "summer"
- ],
- "age": [
- 16,
- 18
- ],
- "locations": [
- "philippines"
- ],
- "image": "/uploads/activity/b11.jpg",
- "link": "/senior-plus-leadership",
- "program": "leadership",
- "rating": 5,
- "camp-detail": {
- "hero": {
- "title": "Senior Plus Leadership Camp in Philippines",
- "bgImage": "/uploads/activity/b11.jpg"
- },
- "basicInfo": {
- "location": "Philippines",
- "ageRange": "16 - 18 years\nAdvanced Leadership Program",
- "accommodationType": "Leadership Retreat Center",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "English Immersion"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Executive Leadership Summit",
- "rating": 5,
- "reviews": 45,
- "location": "Cebu, Philippines",
- "price": 2400,
- "originalPrice": 2800,
- "image": "https://images.unsplash.com/photo-1519389950473-47ba0277781c?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Outdoor Leadership Challenge",
- "rating": 4.9,
- "reviews": 38,
- "location": "Palawan, Philippines",
- "price": 2300,
- "originalPrice": 2700,
- "image": "https://images.unsplash.com/photo-1521737711867-e3b97375f902?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Social Entrepreneurship",
- "rating": 4.9,
- "reviews": 32,
- "location": "Manila, Philippines",
- "price": 2200,
- "originalPrice": 2600,
- "image": "https://images.unsplash.com/photo-1553877522-43269d4ea984?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Adventure Leadership",
- "rating": 5,
- "reviews": 41,
- "location": "Baguio, Philippines",
- "price": 2500,
- "originalPrice": 2900,
- "image": "https://images.unsplash.com/photo-1542744173-8e7e53415bb0?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Leadership workshop"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Team challenge"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Adventure activity"
- }
- ],
- "overlayInfo": {
- "location": "Philippines",
- "season": "Summer",
- "languages": "English"
- }
- },
- "eventSchedule": {
- "startDate": "07/05/2024",
- "duration": "14 Days 13 Nights",
- "tickets": "$118/125"
- },
- "sections": {
- "overview": {
- "intro": "Unlock your leadership potential at our Senior Plus Leadership Camp in the Philippines! This advanced program challenges teens to develop critical thinking, communication, and leadership skills through adventure, teamwork, and real-world challenges.",
- "mainText": "The Senior Plus Leadership Camp is designed for ambitious young people aged 16 to 18 who want to develop the skills that set future leaders apart. Through adventure challenges, team projects, community service, and expert-led workshops, participants discover their leadership style and build confidence to make a difference.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 16–18, leadership-focused program",
- "Expert leadership facilitators",
- "Adventure-based leadership challenges",
- "Community service project included",
- "Premium retreat center accommodation",
- "24/7 mentorship and support",
- "Leadership certification awarded",
- "University preparation elements"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Leadership Camp is held at a premier retreat center in the Philippines, featuring modern conference facilities, outdoor adventure areas, and comfortable accommodations. The stunning natural surroundings of the Philippines provide the perfect backdrop for transformative experiences, while nearby communities offer opportunities for meaningful service projects.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Executive-Style Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in our premium retreat center with executive-style accommodations, reflecting the professional development focus of this program."
- ],
- "outroText": [
- "🎯 Leader's Suite: Shared rooms for 2-3 participants with study desks and meeting areas.",
- "⭐ Executive Room: Private rooms for focused reflection and planning. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning, modern amenities, and comfortable beds.",
- "Conference rooms available for team projects and meetings.",
- "Mentors available for guidance 24/7!",
- "Good to know:",
- "Business casual attire required for some sessions.",
- "Bring a journal for reflection and planning exercises.",
- "Reserve your accommodation during registration!"
- ],
- "principles": [
- "Emerging Leaders (16–17 years)",
- "Senior Leaders (17–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Develop the Leader Within!",
- "introText": [
- "Our leadership curriculum combines theory and practice, using adventure challenges, team projects, and real-world applications to develop effective, ethical leaders."
- ],
- "quote": "",
- "outroText": [
- "Learn from Accomplished Leaders!",
- "Our facilitators include successful entrepreneurs, community leaders, and professional leadership coaches who share their journeys and insights.",
- "Make a Real Impact!",
- "Your community service project creates lasting positive change while developing your leadership skills in action."
- ],
- "mainHeading": "Lead yourself, lead others, lead change!",
- "principles": [
- "Self-Leadership: Self-awareness, emotional intelligence, goal setting, and personal effectiveness!",
- "Team Leadership: Communication, conflict resolution, motivation, and team dynamics!",
- "Changemaking: Social entrepreneurship, community impact, and sustainable leadership!"
- ],
- "footerText": [
- "Leave camp with the confidence, skills, and vision to lead in whatever path you choose!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy premium dining at our retreat center. Meals are designed for networking and discussion, with some sessions combining dining with group conversations and guest speaker events.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Full breakfast buffet with healthy options to fuel your leadership journey."
- },
- {
- "title": "Lunch",
- "desc": "Professional lunch service featuring Filipino and international cuisine."
- },
- {
- "title": "Dinner",
- "desc": "Evening dining occasions with themed discussions and networking opportunities."
- },
- {
- "title": "Refreshments",
- "desc": "Healthy snacks and beverages available during sessions, breaks, and meetings."
- }
- ],
- "footer": "Dining is learning time! Practice professional networking and leadership communication during meals."
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Distinguished Facilitators & Mentors",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our leadership team includes professional facilitators, successful business leaders, and certified coaches with expertise in youth leadership development.",
- "Many facilitators are accomplished leaders in their fields who volunteer their time to inspire the next generation."
- ],
- "footerText": [
- "With a participant-to-facilitator ratio of 1:5, you receive personalized feedback and mentorship throughout the program.",
- "Alumni mentorship connects you with past participants who are now making impact in their communities."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "All leadership program participants are covered by comprehensive insurance for all activities, including adventure-based challenges and community service projects.",
- "package": {
- "title": "Leadership Program Insurance",
- "desc": "Premium coverage for all leadership activities, adventure challenges, and service projects.",
- "items": [
- "Full medical coverage",
- "Adventure activity protection",
- "Community service project coverage"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation policy for this premium program.",
- "items": [
- "Valid until two weeks before program start",
- "Covers medical and academic conflicts",
- "Partial or full refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Lifeguarding",
- "price": 580,
- "priceText": "from 580 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "malaysia"
- ],
- "image": "/uploads/activity/b12.jpg",
- "link": "/lifeguarding",
- "program": "lifeguarding",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "Lifeguarding Camp in Malaysia",
- "bgImage": "/uploads/activity/b12.jpg"
- },
- "basicInfo": {
- "location": "Malaysia",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Beach Resort & Training Center",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & MY"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Beach Lifeguard Training",
- "rating": 4.9,
- "reviews": 42,
- "location": "Langkawi, Malaysia",
- "price": 1300,
- "originalPrice": 1600,
- "image": "https://images.unsplash.com/photo-1544551763-46a013bb70d5?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Pool Rescue Certification",
- "rating": 4.8,
- "reviews": 38,
- "location": "Penang, Malaysia",
- "price": 1200,
- "originalPrice": 1500,
- "image": "https://images.unsplash.com/photo-1576013551627-0cc20b96c2a7?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Water Safety Intensive",
- "rating": 4.9,
- "reviews": 35,
- "location": "Kuala Lumpur, Malaysia",
- "price": 1250,
- "originalPrice": 1550,
- "image": "https://images.unsplash.com/photo-1530549387789-4c1017266635?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "First Aid & Rescue",
- "rating": 4.7,
- "reviews": 29,
- "location": "Kota Kinabalu, Malaysia",
- "price": 1150,
- "originalPrice": 1450,
- "image": "https://images.unsplash.com/photo-1571019613454-1cb2f99b2d8b?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Lifeguard training"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Pool rescue"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Beach safety"
- }
- ],
- "overlayInfo": {
- "location": "Malaysia",
- "season": "Summer",
- "languages": "EN & MY"
- }
- },
- "eventSchedule": {
- "startDate": "06/20/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$58/62"
- },
- "sections": {
- "overview": {
- "intro": "Learn essential water safety and rescue skills at our Lifeguarding Camp in Malaysia! Train with certified instructors in pool and beach environments while earning recognized certifications that could save lives.",
- "mainText": "The Lifeguarding Camp offers young people aged 12 to 18 comprehensive training in water safety, rescue techniques, and first aid. Under the guidance of certified lifeguard instructors, campers develop the skills and confidence to respond to water emergencies while enjoying the beautiful beaches of Malaysia.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, strong swimmers",
- "Certified lifeguard instructors",
- "Pool and beach training environments",
- "First aid and CPR certification",
- "Beach resort accommodation",
- "24/7 supervision and care",
- "Recognized rescue certifications",
- "Physical fitness training included"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Lifeguarding Camp is located at a beach resort in Malaysia with access to both pool and ocean training environments. The warm tropical waters and beautiful beaches provide ideal conditions for learning water rescue techniques. Modern training facilities ensure safe, effective skill development.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Beachside Training Base",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay at our beach resort with easy access to training facilities. Get plenty of rest between intensive training sessions!"
- ],
- "outroText": [
- "🏊 Swimmer's Quarters: Shared rooms for 4-6 campers near the pool and beach.",
- "🌊 Beachfront Room: Premium rooms with ocean views. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning and drying areas for swimwear.",
- "Outdoor rinse facilities for after training.",
- "Medical support and staff available 24/7!",
- "Good to know:",
- "Bring multiple swimsuits and comfortable athletic wear.",
- "Strong swimming ability required for this program.",
- "Reserve your accommodation during booking!"
- ],
- "principles": [
- "Junior Lifeguards (12–14 years)",
- "Teen Rescuers (14–16 years)",
- "Advanced Lifeguards (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Learn to Save Lives!",
- "introText": [
- "Our lifeguarding program combines water rescue techniques, first aid training, and physical conditioning to prepare participants for real-world emergency response."
- ],
- "quote": "",
- "outroText": [
- "Earn Real Certifications!",
- "Complete the program and earn recognized certifications in lifeguarding, first aid, and CPR.",
- "Skills for Life!",
- "The water safety and rescue skills you learn could save someone's life – including your own."
- ],
- "mainHeading": "Train like a professional lifeguard!",
- "principles": [
- "Water Rescue: Swimming rescues, spinal injury management, and victim recovery techniques!",
- "First Aid & CPR: Essential emergency response skills and cardiac resuscitation!",
- "Physical Training: Endurance swimming, strength, and fitness for rescue readiness!"
- ],
- "footerText": [
- "Graduate with the knowledge, skills, and confidence to make a difference in water emergencies!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Fuel your training with nutritious meals designed for athletic performance. Our kitchen understands the energy demands of intensive water training and prepares balanced meals accordingly.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "High-energy breakfast with proteins, carbohydrates, and fruits to fuel morning training sessions."
- },
- {
- "title": "Lunch",
- "desc": "Balanced Malaysian and international meals with recovery nutrition in mind."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying evening meals to recover from intensive training and prepare for the next day."
- },
- {
- "title": "Training Snacks",
- "desc": "Energy snacks and electrolyte drinks available during and after training sessions."
- }
- ],
- "footer": "Proper nutrition is essential for athletic training. Our meals support your lifeguard fitness goals!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Certified Lifeguard Trainers",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our instructors are certified lifeguard trainers with real-world rescue experience and a passion for teaching water safety.",
- "All instructors maintain current certifications in lifeguarding, first aid, and emergency response."
- ],
- "footerText": [
- "With a camper-to-instructor ratio of 1:5 during water training, every participant receives close supervision and coaching.",
- "Safety officers are present during all water activities to ensure a secure training environment."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Water-based training requires comprehensive insurance coverage. Our package protects all participants during training activities in both pool and ocean environments.",
- "package": {
- "title": "Water Training Insurance",
- "desc": "Specialized coverage for all lifeguarding training activities and water-based sessions.",
- "items": [
- "Water activity coverage",
- "Training injury protection",
- "Medical coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for medical or swimming ability reasons.",
- "items": [
- "Valid until one week before camp start",
- "Covers swim test failures and medical issues",
- "Full program refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Multi Water Adventure",
- "price": 990,
- "priceText": "from 990 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "philippines"
- ],
- "image": "/uploads/activity/b13.jpg",
- "link": "/multi-water-adventure",
- "program": "multi-water",
- "rating": 1,
- "camp-detail": {
- "hero": {
- "title": "Multi Water Adventure Camp in Philippines",
- "bgImage": "/uploads/activity/b13.jpg"
- },
- "basicInfo": {
- "location": "Philippines",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Island Resort & Beach Cabin",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & FIL"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Island Hopping Adventure",
- "rating": 4.9,
- "reviews": 52,
- "location": "Palawan, Philippines",
- "price": 2200,
- "originalPrice": 2600,
- "image": "https://images.unsplash.com/photo-1544551763-46a013bb70d5?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Water Sports Intensive",
- "rating": 4.8,
- "reviews": 45,
- "location": "Boracay, Philippines",
- "price": 2100,
- "originalPrice": 2500,
- "image": "https://images.unsplash.com/photo-1502680390469-be75c86b636f?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Tropical Adventure Camp",
- "rating": 4.9,
- "reviews": 48,
- "location": "Cebu, Philippines",
- "price": 2000,
- "originalPrice": 2400,
- "image": "https://images.unsplash.com/photo-1533124646944-3e9c53e63c53?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Kayak & Snorkel Experience",
- "rating": 4.7,
- "reviews": 38,
- "location": "Siargao, Philippines",
- "price": 1900,
- "originalPrice": 2300,
- "image": "https://images.unsplash.com/photo-1530549387789-4c1017266635?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Kayaking"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Snorkeling"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Beach activity"
- }
- ],
- "overlayInfo": {
- "location": "Philippines",
- "season": "Summer",
- "languages": "EN & FIL"
- }
- },
- "eventSchedule": {
- "startDate": "06/25/2024",
- "duration": "12 Days 11 Nights",
- "tickets": "$99/105"
- },
- "sections": {
- "overview": {
- "intro": "Dive into the ultimate water adventure at our Multi Water Adventure Camp in the Philippines! Experience kayaking, snorkeling, paddleboarding, and more in some of the world's most beautiful tropical waters.",
- "mainText": "The Multi Water Adventure Camp offers water enthusiasts aged 12 to 18 an action-packed experience in the Philippines' stunning islands and seas. From paddling through pristine lagoons to snorkeling colorful coral reefs, campers try a variety of water sports while building skills, confidence, and unforgettable memories.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, swimmers of all levels",
- "Multiple water sports: kayaking, SUP, snorkeling & more",
- "Certified water sports instructors",
- "All equipment provided",
- "Island resort accommodation",
- "24/7 supervision and water safety",
- "Island exploration excursions",
- "Marine life education"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Multi Water Adventure Camp is based in the stunning island archipelago of the Philippines, offering access to crystal-clear waters, pristine beaches, and incredible marine biodiversity. The warm tropical climate and calm seas provide perfect conditions for a variety of water activities and exploration.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Island Paradise Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in beautiful beach cabins or island resort rooms just steps from the water. Fall asleep to ocean sounds and wake up ready for aquatic adventures!"
- ],
- "outroText": [
- "🏝️ Beach Cabin: Shared cabins for 4-6 campers with direct beach access.",
- "🌴 Island Suite: Premium beachfront rooms for 2-3 campers. (Additional charge applies)"
- ],
- "details": [
- "All accommodations feature fans/AC and comfortable beds.",
- "Outdoor rinse stations for after water activities.",
- "Water safety staff on duty 24/7!",
- "Good to know:",
- "Bring swimsuits, reef-safe sunscreen, and water shoes.",
- "All water sports equipment is provided.",
- "Book your island accommodation during registration!"
- ],
- "principles": [
- "Junior Adventurers (12–14 years)",
- "Teen Explorers (14–16 years)",
- "Advanced Water Sports (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Explore Every Wave and Current!",
- "introText": [
- "Our multi-sport program introduces campers to a variety of water activities, from paddling sports to underwater exploration, all taught by certified instructors."
- ],
- "quote": "",
- "outroText": [
- "Try Everything!",
- "This is your chance to discover which water sports you love – we offer instruction in multiple disciplines.",
- "Explore the Marine World!",
- "Learn about marine ecosystems while snorkeling and paddling through some of the world's most biodiverse waters."
- ],
- "mainHeading": "A new water adventure every day!",
- "principles": [
- "Paddling Sports: Kayaking, stand-up paddleboarding, and outrigger canoeing!",
- "Underwater Exploration: Snorkeling, freediving basics, and marine life discovery!",
- "Beach & Water Fun: Swimming, beach games, and tropical water activities!"
- ],
- "footerText": [
- "Every day brings new water adventures – discover your passion for the ocean!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy fresh island cuisine featuring local seafood, tropical fruits, and international favorites. Our beachside meals are the perfect fuel for your water adventures.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Tropical breakfast with fresh fruits, eggs, local breads, and refreshing juices."
- },
- {
- "title": "Lunch",
- "desc": "Beach-side lunch featuring grilled seafood, Filipino dishes, and refreshing salads."
- },
- {
- "title": "Dinner",
- "desc": "Sunset dinners with fresh catches, barbecue, and authentic island cuisine."
- },
- {
- "title": "Beach Snacks",
- "desc": "Fresh coconuts, tropical fruits, and hydrating drinks between activities."
- }
- ],
- "footer": "Island fresh cuisine to fuel your adventures – enjoy the taste of tropical paradise!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Water Sports Experts & Safety Team",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our team includes certified instructors in various water sports, experienced boat handlers, and trained water safety personnel.",
- "All staff hold current lifeguarding certifications and first aid training."
- ],
- "footerText": [
- "With strict water safety ratios of 1:4 during activities, every participant is closely supervised.",
- "Safety boats and personnel are present during all open-water activities."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Multi-sport water activities require comprehensive coverage. Our insurance package protects participants during all water-based activities.",
- "package": {
- "title": "Water Sports Insurance",
- "desc": "Complete coverage for all water-based activities and excursions included in the program.",
- "items": [
- "All water activities covered",
- "Equipment use protection",
- "Emergency evacuation included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for medical or swimming ability issues.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and ability concerns",
- "Full refund of program fees"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Sailing",
- "price": 990,
- "priceText": "from 990 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "thailand"
- ],
- "image": "/uploads/activity/b14.jpg",
- "link": "/sailing",
- "program": "sailing",
- "rating": 2,
- "camp-detail": {
- "hero": {
- "title": "Sailing Camp in Thailand",
- "bgImage": "/uploads/activity/b14.jpg"
- },
- "basicInfo": {
- "location": "Thailand",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Marina Resort & Yacht Club",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & TH"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Dinghy Sailing Course",
- "rating": 4.9,
- "reviews": 48,
- "location": "Phuket, Thailand",
- "price": 2100,
- "originalPrice": 2500,
- "image": "https://images.unsplash.com/photo-1534447677768-be436bb09401?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Catamaran Experience",
- "rating": 4.8,
- "reviews": 42,
- "location": "Koh Samui, Thailand",
- "price": 2200,
- "originalPrice": 2600,
- "image": "https://images.unsplash.com/photo-1500930287596-c1ecaa373bb2?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Island Sailing Expedition",
- "rating": 5,
- "reviews": 55,
- "location": "Krabi, Thailand",
- "price": 2400,
- "originalPrice": 2800,
- "image": "https://images.unsplash.com/photo-1508739773434-c26b3d09e071?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Racing Fundamentals",
- "rating": 4.7,
- "reviews": 35,
- "location": "Pattaya, Thailand",
- "price": 1900,
- "originalPrice": 2300,
- "image": "https://images.unsplash.com/photo-1540946485063-a40da27545f8?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Sailing"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Yacht"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Marina"
- }
- ],
- "overlayInfo": {
- "location": "Thailand",
- "season": "Summer",
- "languages": "EN & TH"
- }
- },
- "eventSchedule": {
- "startDate": "07/01/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$99/105"
- },
- "sections": {
- "overview": {
- "intro": "Catch the wind at our Sailing Camp in Thailand! Learn to sail in the stunning Andaman Sea, from basic boat handling to advanced sailing techniques, all in one of the world's most beautiful sailing destinations.",
- "mainText": "The Sailing Camp offers young sailors aged 12 to 18 comprehensive sailing instruction in the tropical waters of Thailand. From first-time sailors to those seeking advanced skills, our certified instructors provide progressive training on dinghies, catamarans, and keelboats in ideal sailing conditions.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all skill levels from beginner to advanced",
- "Certified sailing instructors (RYA/IYT)",
- "Multiple boat types available",
- "Progressive skill-based curriculum",
- "Marina resort accommodation",
- "24/7 supervision and water safety",
- "Sailing certification available",
- "Island sailing excursions"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Sailing Camp is based at a premier marina in Thailand, offering access to some of the world's best sailing waters. The Andaman Sea provides consistent trade winds, warm temperatures, and stunning scenery with limestone islands and pristine beaches. Between sailing sessions, explore the marina, nearby beaches, and local culture.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Marina-Side Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay at our marina resort overlooking the yacht harbor. Watch the boats and prepare for your next sailing adventure!"
- ],
- "outroText": [
- "⛵ Sailor's Lodge: Shared rooms for 4-6 campers with marina views.",
- "🌅 Marina Suite: Premium waterfront rooms for 2-3 campers. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning and comfortable beds.",
- "Sailing gear storage and drying areas available.",
- "Marina facilities and yacht club access included!",
- "Good to know:",
- "Bring swimwear, sailing gloves optional, and reef-safe sunscreen.",
- "All sailing equipment and life jackets provided.",
- "Reserve your marina accommodation during booking!"
- ],
- "principles": [
- "Beginner Sailors (12–14 years)",
- "Intermediate Sailors (14–16 years)",
- "Advanced Sailors (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Master the Art of Sailing!",
- "introText": [
- "Our progressive sailing curriculum takes you from understanding wind and boats to confidently sailing solo, with opportunities for racing and overnight expeditions."
- ],
- "quote": "",
- "outroText": [
- "Earn Your Sailing Certificate!",
- "Complete the program and receive an internationally recognized sailing certification.",
- "Sail Thailand's Paradise!",
- "Progress to island expeditions, sailing to stunning destinations with your new skills."
- ],
- "mainHeading": "From shore to sea – become a confident sailor!",
- "principles": [
- "Fundamentals: Boat parts, rigging, wind awareness, and basic sailing maneuvers!",
- "Skill Building: Tacking, gybing, points of sail, and crew coordination!",
- "Advanced Sailing: Racing techniques, seamanship, and multi-day expeditions!"
- ],
- "footerText": [
- "Every day on the water builds confidence, skill, and an unforgettable connection to sailing!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy delicious Thai and international cuisine at our marina restaurant. Fresh seafood, local specialties, and international favorites fuel your sailing adventures.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Energizing breakfast with Thai and Western options to fuel your morning sailing session."
- },
- {
- "title": "Lunch",
- "desc": "Fresh and light Thai cuisine with seafood, salads, and satisfying dishes."
- },
- {
- "title": "Dinner",
- "desc": "Sunset dinners at the marina featuring Thai specialties and fresh catches."
- },
- {
- "title": "Sailing Snacks",
- "desc": "Sandwiches, fruits, and drinks available for on-water sailing sessions."
- }
- ],
- "footer": "Dine with views of the marina and enjoy the sailor's lifestyle in tropical Thailand!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Professional Sailing Instructors",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our sailing team includes RYA and IYT certified instructors with extensive sailing and teaching experience.",
- "All instructors hold current marine safety certifications and first aid training."
- ],
- "footerText": [
- "With an instructor-to-student ratio of 1:4 on the water, every sailor receives personalized attention and coaching.",
- "Safety boats accompany all sailing sessions for immediate response capability."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Sailing activities require specialized marine insurance. Our comprehensive package covers all sailing activities and water-based excursions.",
- "package": {
- "title": "Marine Activity Insurance",
- "desc": "Complete coverage for all sailing activities, boat use, and water-based excursions.",
- "items": [
- "Sailing and boat activity coverage",
- "Personal accident protection",
- "Marine rescue coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and emergency situations",
- "Full refund of program fees"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Skating",
- "price": 420,
- "priceText": "from 420 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "vietnam"
- ],
- "image": "/uploads/activity/b15.jpg",
- "link": "/skating",
- "program": "skating",
- "rating": 3,
- "camp-detail": {
- "hero": {
- "title": "Skating Camp in Vietnam",
- "bgImage": "/uploads/activity/b15.jpg"
- },
- "basicInfo": {
- "location": "Vietnam",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Sports Campus & Dormitory",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & VN"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Skateboard Fundamentals",
- "rating": 4.8,
- "reviews": 45,
- "location": "Ho Chi Minh City, Vietnam",
- "price": 1100,
- "originalPrice": 1400,
- "image": "https://images.unsplash.com/photo-1564982752979-3f7bc974d29a?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Street Skating Course",
- "rating": 4.7,
- "reviews": 38,
- "location": "Hanoi, Vietnam",
- "price": 1050,
- "originalPrice": 1350,
- "image": "https://images.unsplash.com/photo-1579721859550-ce3a0f9d4f48?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Roller Skating Workshop",
- "rating": 4.9,
- "reviews": 42,
- "location": "Da Nang, Vietnam",
- "price": 1000,
- "originalPrice": 1300,
- "image": "https://images.unsplash.com/photo-1551698618-1dfe5d97d256?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Inline Skating Adventure",
- "rating": 4.6,
- "reviews": 29,
- "location": "Nha Trang, Vietnam",
- "price": 1080,
- "originalPrice": 1380,
- "image": "https://images.unsplash.com/photo-1560188892-1e82f893dae7?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Skateboarding"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Skate park"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Practice session"
- }
- ],
- "overlayInfo": {
- "location": "Vietnam",
- "season": "Summer",
- "languages": "EN & VN"
- }
- },
- "eventSchedule": {
- "startDate": "06/25/2024",
- "duration": "8 Days 7 Nights",
- "tickets": "$42/46"
- },
- "sections": {
- "overview": {
- "intro": "Shred and roll at our Skating Camp in Vietnam! Whether you prefer skateboarding, inline skating, or roller skating, our professional coaches help you develop skills, style, and confidence on wheels.",
- "mainText": "The Skating Camp welcomes young skaters aged 12 to 18 for an action-packed experience in Vietnam. Our campus features quality skate facilities including ramps, rails, and smooth surfaces for all skating styles. From beginners learning balance to advanced skaters perfecting tricks, everyone progresses at their own pace.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all skill levels welcome",
- "Professional skating coaches",
- "Skateboarding, inline & roller skating",
- "Modern skate park facilities",
- "Sports campus accommodation",
- "24/7 supervision and care",
- "Safety gear provided",
- "Video analysis of techniques"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Skating Camp is located on a modern sports campus in Vietnam featuring dedicated skate facilities. The campus includes an indoor and outdoor skate park with ramps, half-pipes, rails, and smooth concrete areas. Between sessions, enjoy the campus amenities and explore local Vietnamese culture.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Skater-Friendly Campus",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in comfortable campus dormitories close to the skate facilities. Rest up and get ready to shred!"
- ],
- "outroText": [
- "🛹 Skater Dorms: Shared rooms for 4-6 campers with gear storage areas.",
- "🏢 Premium Rooms: Smaller rooms for 2-3 campers. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning and comfortable beds.",
- "Secure equipment storage areas available.",
- "Staff available around the clock!",
- "Good to know:",
- "Bring your own skateboard or use camp-provided equipment.",
- "All safety gear is provided – helmets, pads, wrist guards.",
- "Reserve your room during registration!"
- ],
- "principles": [
- "Beginner Skaters (12–14 years)",
- "Intermediate Skaters (14–16 years)",
- "Advanced Skaters (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Progress at Your Own Pace!",
- "introText": [
- "Our skating program caters to all levels and styles, with professional coaches providing personalized instruction and progressive skill development."
- ],
- "quote": "",
- "outroText": [
- "Find Your Style!",
- "Whether you're into street skating, park, or freestyle, our coaches help you develop your unique skating identity.",
- "Film Your Progress!",
- "We capture your sessions on video for technique analysis and to create lasting memories of your achievements."
- ],
- "mainHeading": "Build skills, confidence, and style!",
- "principles": [
- "Fundamentals: Balance, pushing, stopping, and turning – build your foundation!",
- "Skill Development: Tricks, drops, ramps, and rails – challenge yourself!",
- "Style & Expression: Develop your personal skating style and creative expression!"
- ],
- "footerText": [
- "Every session brings new challenges, new achievements, and new friends who share your passion for skating!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Fuel your skating with nutritious Vietnamese and international cuisine. Our cafeteria serves balanced meals designed for active athletes.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Energizing breakfast with Vietnamese and Western options to start your skating day."
- },
- {
- "title": "Lunch",
- "desc": "Fresh and satisfying Vietnamese cuisine with plenty of energy-boosting foods."
- },
- {
- "title": "Dinner",
- "desc": "Delicious evening meals to recover and refuel after a day of skating."
- },
- {
- "title": "Skater Snacks",
- "desc": "Energy snacks, fresh fruits, and drinks available during session breaks."
- }
- ],
- "footer": "Good nutrition supports athletic performance. Our meals are designed to keep you energized for skating!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Professional Skating Coaches",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our coaching team includes experienced skaters and certified instructors who are passionate about sharing their skills with young people.",
- "All coaches are trained in first aid and skate-specific injury prevention."
- ],
- "footerText": [
- "With a camper-to-coach ratio of 1:6, every skater receives personalized attention and progression guidance.",
- "Our bilingual team ensures clear instruction and a welcoming environment for all participants."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Skating involves physical activity with fall risk. Our insurance package covers all skating activities and provides comprehensive protection for participants.",
- "package": {
- "title": "Action Sports Insurance",
- "desc": "Complete coverage for skating activities, falls, and related camp programs.",
- "items": [
- "Skating injury coverage",
- "Equipment protection",
- "Medical coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and family emergencies",
- "Full refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Soccer",
- "price": 495,
- "priceText": "from 495 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "malaysia"
- ],
- "image": "/uploads/activity/b16.jpg",
- "link": "/soccer",
- "program": "soccer",
- "rating": 3,
- "camp-detail": {
- "hero": {
- "title": "Soccer Camp in Malaysia",
- "bgImage": "/uploads/activity/b16.jpg"
- },
- "basicInfo": {
- "location": "Malaysia",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Sports Academy & Dormitory",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & MY"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Skills Intensive Camp",
- "rating": 4.9,
- "reviews": 62,
- "location": "Kuala Lumpur, Malaysia",
- "price": 1300,
- "originalPrice": 1600,
- "image": "https://images.unsplash.com/photo-1574629810360-7efbbe195018?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Goalkeeper Specialist",
- "rating": 4.8,
- "reviews": 38,
- "location": "Penang, Malaysia",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1517927033932-b3d18e61fb3a?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Tactical Training",
- "rating": 4.7,
- "reviews": 45,
- "location": "Johor Bahru, Malaysia",
- "price": 1250,
- "originalPrice": 1550,
- "image": "https://images.unsplash.com/photo-1431324155629-1a6deb1dec8d?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Elite Development",
- "rating": 5,
- "reviews": 52,
- "location": "Selangor, Malaysia",
- "price": 1500,
- "originalPrice": 1800,
- "image": "https://images.unsplash.com/photo-1579952363873-27f3bade9f55?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Soccer match"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Training session"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Team photo"
- }
- ],
- "overlayInfo": {
- "location": "Malaysia",
- "season": "Summer",
- "languages": "EN & MY"
- }
- },
- "eventSchedule": {
- "startDate": "06/20/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$49/52"
- },
- "sections": {
- "overview": {
- "intro": "Take your game to the next level at our Soccer Camp in Malaysia! Train like a pro with qualified coaches, develop technical skills, and compete in matches while making friends from around the world.",
- "mainText": "The Soccer Camp offers young players aged 12 to 18 intensive football training in a professional academy setting in Malaysia. Our certified coaches focus on technical skills, tactical understanding, physical fitness, and mental strength to develop complete players who love the beautiful game.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all skill levels welcome",
- "Licensed FA-qualified coaches",
- "Professional training facilities",
- "Position-specific training available",
- "Academy dormitory accommodation",
- "24/7 supervision and care",
- "Daily matches and tournaments",
- "Video analysis sessions"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Soccer Camp is based at a professional football academy in Malaysia, featuring world-class training facilities. The campus includes multiple natural grass and artificial turf pitches, a fully equipped gymnasium, and analysis rooms. The tropical climate allows for year-round outdoor training in excellent conditions.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Academy Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Experience life as a football academy player in our modern dormitories, designed for athletes with recovery and preparation in mind."
- ],
- "outroText": [
- "⚽ Player Dorms: Shared rooms for 4-6 players with kit storage and relaxation areas.",
- "🏅 Elite Rooms: Premium rooms for 2-3 players with enhanced amenities. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning and comfortable beds.",
- "Kit washing and boot room facilities available.",
- "Physio and medical support on site!",
- "Good to know:",
- "Bring your own boots – we recommend studs and turfs.",
- "Training kit is provided for camp activities.",
- "Reserve your accommodation during registration!"
- ],
- "principles": [
- "Junior Players (12–14 years)",
- "Development Players (14–16 years)",
- "Advanced Players (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Train Like a Pro!",
- "introText": [
- "Our comprehensive training program develops all aspects of the modern footballer – technical skills, tactical intelligence, physical conditioning, and mental strength."
- ],
- "quote": "",
- "outroText": [
- "Learn from the Best!",
- "Our coaching team includes UEFA and AFC licensed coaches with professional playing and coaching experience.",
- "Compete Every Day!",
- "Applied training through daily small-sided games and full matches reinforces skills in competitive situations."
- ],
- "mainHeading": "Develop every aspect of your game!",
- "principles": [
- "Technical Skills: Ball mastery, passing, shooting, dribbling – perfect your fundamentals!",
- "Tactical Understanding: Positioning, movement, team play, and game intelligence!",
- "Physical & Mental: Fitness, agility, confidence, and competitive mentality!"
- ],
- "footerText": [
- "Every session brings improvement – return home a more complete player ready to excel in your team!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Fuel your performance with athlete-focused nutrition. Our kitchen prepares meals designed for football players, with the right balance of carbohydrates, proteins, and nutrients for training and recovery.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "High-energy breakfast with proteins, carbohydrates, and fruits to fuel morning training sessions."
- },
- {
- "title": "Lunch",
- "desc": "Recovery-focused lunch with Malaysian and international options, balanced for athlete needs."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying evening meals to repair and rebuild after intensive training days."
- },
- {
- "title": "Training Snacks",
- "desc": "Energy snacks, recovery drinks, and hydration available during and after sessions."
- }
- ],
- "footer": "Proper nutrition is crucial for athletic performance. Our sport-science-based menu supports your training goals!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Licensed Coaches & Support Staff",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our coaching team includes AFC and UEFA licensed coaches with professional experience at elite levels.",
- "Support staff includes physiotherapists, fitness coaches, and goalkeeper specialists."
- ],
- "footerText": [
- "With a player-to-coach ratio of 1:8, every footballer receives personalized attention and feedback.",
- "Video analysis helps players understand their development and areas for improvement."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Football involves physical contact and injury risk. Our comprehensive sports insurance protects all participants during training, matches, and camp activities.",
- "package": {
- "title": "Sports Activity Insurance",
- "desc": "Complete coverage for all football activities and related camp programs.",
- "items": [
- "Football injury coverage",
- "Physiotherapy treatment included",
- "Medical coverage for all activities"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for injury or unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers injury and medical issues",
- "Full refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Space Exploration",
- "price": 595,
- "priceText": "from 595 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "china"
- ],
- "image": "/uploads/activity/b17.jpg",
- "link": "/space-exploration",
- "program": "space",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "Space Exploration Camp in China",
- "bgImage": "/uploads/activity/b17.jpg"
- },
- "basicInfo": {
- "location": "China",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Space Center Campus",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & CN"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Astronaut Training Experience",
- "rating": 5,
- "reviews": 68,
- "location": "Beijing, China",
- "price": 1800,
- "originalPrice": 2200,
- "image": "https://images.unsplash.com/photo-1446776811953-b23d57bd21aa?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Rocket Science Workshop",
- "rating": 4.9,
- "reviews": 52,
- "location": "Shanghai, China",
- "price": 1700,
- "originalPrice": 2100,
- "image": "https://images.unsplash.com/photo-1517976487492-5750f3195933?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Telescope & Stargazing",
- "rating": 4.8,
- "reviews": 45,
- "location": "Xi'an, China",
- "price": 1500,
- "originalPrice": 1900,
- "image": "https://images.unsplash.com/photo-1419242902214-272b3f66ee7a?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Mars Mission Simulation",
- "rating": 4.9,
- "reviews": 58,
- "location": "Wuhan, China",
- "price": 1900,
- "originalPrice": 2300,
- "image": "https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Space center"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Telescope"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Rocket model"
- }
- ],
- "overlayInfo": {
- "location": "China",
- "season": "Summer",
- "languages": "EN & CN"
- }
- },
- "eventSchedule": {
- "startDate": "07/05/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$59/65"
- },
- "sections": {
- "overview": {
- "intro": "Blast off into the wonders of the universe at our Space Exploration Camp in China! Experience astronaut training simulations, build rockets, explore the night sky, and learn about humanity's journey to the stars.",
- "mainText": "The Space Exploration Camp offers young scientists aged 12 to 18 an immersive journey into astronomy, space science, and astronautics. From planetarium visits to hands-on rocket building, telescope observations to mission simulations, campers explore the cosmos while developing STEM skills and scientific thinking.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all interest levels welcome",
- "Professional astronomers and educators",
- "Planetarium and observatory visits",
- "Model rocket building and launching",
- "Space Center campus accommodation",
- "24/7 supervision and care",
- "Night sky observation sessions",
- "STEM certificate of completion"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Space Exploration Camp is based at a dedicated science and space education center in China. The facility includes a planetarium, telescope observatory, spacecraft simulators, and hands-on science labs. The location features minimal light pollution for optimal stargazing conditions and access to China's space exploration heritage.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Space Center Campus Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay on the space center campus in comfortable, modern dormitories designed for young scientists and explorers."
- ],
- "outroText": [
- "🚀 Explorer Dorms: Shared rooms for 4-6 campers with astronomy-themed decor.",
- "🌟 Astronaut Quarters: Premium rooms for 2-3 campers with stargazing terrace access. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning and comfortable beds.",
- "Evening observatory access for stargazing.",
- "Science library and resource center available!",
- "Good to know:",
- "Bring warm layers for cool evening observation sessions.",
- "Notebooks and writing materials recommended.",
- "Reserve your space quarters during registration!"
- ],
- "principles": [
- "Junior Explorers (12–14 years)",
- "Teen Scientists (14–16 years)",
- "Advanced Astronomers (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Explore the Final Frontier!",
- "introText": [
- "Our comprehensive space science program combines lectures, hands-on projects, observations, and simulations to ignite a lifelong passion for space exploration."
- ],
- "quote": "",
- "outroText": [
- "Learn from Real Scientists!",
- "Our educators include astronomers, aerospace engineers, and space enthusiasts who bring the wonder of the cosmos to life.",
- "Build and Launch!",
- "Design and build your own model rocket, then experience the thrill of launch day!"
- ],
- "mainHeading": "From Earth to the stars – an incredible journey!",
- "principles": [
- "Astronomy: Stars, planets, galaxies, and cosmic phenomena – explore the universe!",
- "Space Science: Rockets, satellites, space missions, and astronaut training!",
- "Hands-On Projects: Rocket building, telescope use, and planetarium experiences!"
- ],
- "footerText": [
- "Leave camp with a deeper understanding of the universe and your place in the cosmic story!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Enjoy nutritious Chinese and international cuisine in our campus cafeteria. Special 'astronaut food' experiences are included as part of the space exploration theme!",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Energizing breakfast with Chinese and Western options to fuel your day of exploration."
- },
- {
- "title": "Lunch",
- "desc": "Delicious campus meals featuring Chinese cuisine and international options."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying evening meals before evening observation sessions and activities."
- },
- {
- "title": "Space Snacks",
- "desc": "Including real freeze-dried astronaut food experiences and healthy regular snacks!"
- }
- ],
- "footer": "Experience eating like an astronaut while learning about the challenges of food in space!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Scientists & Space Educators",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our team includes astronomers, physics educators, and space science enthusiasts with degrees and experience in their fields.",
- "All staff are passionate about sharing the wonder of space with young people."
- ],
- "footerText": [
- "With a camper-to-educator ratio of 1:8, every participant receives personalized attention and can ask all their cosmic questions.",
- "Our bilingual team ensures understanding for speakers of all language backgrounds."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "All space camp activities are covered by comprehensive insurance, including rocket launches (conducted under strict safety protocols) and all educational activities.",
- "package": {
- "title": "STEM Camp Insurance",
- "desc": "Complete coverage for all space camp activities and educational programs.",
- "items": [
- "All activities coverage",
- "Equipment use protection",
- "Medical coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation policy for unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and family emergencies",
- "Full refund of program fees"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Spanish Camps",
- "price": 595,
- "priceText": "from 595 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "portugal"
- ],
- "image": "/uploads/banner/b14.jpg",
- "link": "/spanish-camps",
- "program": "spanish",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "Spanish Language Camp in Portugal",
- "bgImage": "/uploads/banner/b14.jpg"
- },
- "basicInfo": {
- "location": "Portugal",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Language School Campus",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Spanish & English"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Spanish Intensive Lisboa",
- "rating": 4.9,
- "reviews": 48,
- "location": "Lisbon, Portugal",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1555881400-74d7acaacd8b?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Conversation & Culture",
- "rating": 4.8,
- "reviews": 42,
- "location": "Porto, Portugal",
- "price": 1350,
- "originalPrice": 1650,
- "image": "https://images.unsplash.com/photo-1558642452-9d2a7deb7f62?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Spanish Beach Camp",
- "rating": 4.9,
- "reviews": 52,
- "location": "Algarve, Portugal",
- "price": 1450,
- "originalPrice": 1750,
- "image": "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Medieval Spanish Tours",
- "rating": 4.7,
- "reviews": 35,
- "location": "Sintra, Portugal",
- "price": 1300,
- "originalPrice": 1600,
- "image": "https://images.unsplash.com/photo-1548625149-fc4a29cf7092?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Spanish class"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Cultural activity"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Portugal scenery"
- }
- ],
- "overlayInfo": {
- "location": "Portugal",
- "season": "Summer",
- "languages": "Spanish & EN"
- }
- },
- "eventSchedule": {
- "startDate": "07/01/2024",
- "duration": "12 Days 11 Nights",
- "tickets": "$59/65"
- },
- "sections": {
- "overview": {
- "intro": "¡Aprende español! Our Spanish Language Camp in Portugal offers immersive Spanish learning in a beautiful Iberian Peninsula setting. Combine language classes with cultural experiences and make friends from around the world.",
- "mainText": "The Spanish Language Camp welcomes students aged 12 to 18 for an intensive yet fun Spanish learning experience. Native Spanish-speaking instructors lead interactive classes while excursions and activities provide constant opportunities for real-world practice in this bilingual region where Spanish and Portuguese cultures meet.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all Spanish levels welcome",
- "Native Spanish-speaking instructors",
- "Small interactive class sizes",
- "Cultural excursions included",
- "Campus accommodation",
- "24/7 care and language support",
- "Certificate of achievement",
- "Iberian cultural experiences"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Spanish Camp is located on a beautiful language school campus in Portugal, near the Spanish border. The Iberian Peninsula setting means easy access to Spanish culture while enjoying Portugal's stunning scenery. Excursions cross into Spain for authentic immersion experiences, combining the best of both Iberian cultures.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Language Campus Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay on our language school campus in comfortable dormitories designed for language learners, with plenty of social spaces for practicing Spanish with new friends."
- ],
- "outroText": [
- "🇪🇸 Language Dorms: Shared rooms with Spanish-speaking environment encouraged.",
- "🏠 Premium Rooms: Semi-private rooms for focused learners. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning and comfortable beds.",
- "Common rooms for socializing and language practice.",
- "Spanish-speaking staff encourage immersion!",
- "Good to know:",
- "Bring enthusiasm for speaking Spanish!",
- "All textbooks and materials are provided.",
- "Select your room preference during booking!"
- ],
- "principles": [
- "Principiante/Beginner (12–14 years)",
- "Intermedio/Intermediate (14–16 years)",
- "Avanzado/Advanced (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "¡Vamos a Aprender Español!",
- "introText": [
- "Our Spanish program combines structured classroom learning with immersive cultural experiences, making language acquisition natural, effective, and enjoyable."
- ],
- "quote": "",
- "outroText": [
- "¡Profesores Nativos!",
- "Learn from native Spanish speakers who bring language and culture to life through engaging activities.",
- "¡Práctica Real!",
- "Every activity and excursion is an opportunity to practice Spanish in authentic situations."
- ],
- "mainHeading": "Immersive Spanish learning experience!",
- "principles": [
- "Clases Matutinas: Interactive grammar, vocabulary, and conversation classes!",
- "Actividades: Games, sports, and creative activities – all in Spanish!",
- "Excursiones: Cultural trips to experience Spanish-speaking environments!"
- ],
- "footerText": [
- "¡Cada día tu español mejora! Every day your Spanish improves through immersion and fun!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "¡Buen provecho! Enjoy delicious Iberian cuisine featuring both Spanish and Portuguese influences. Mealtimes are Spanish conversation times!",
- "items": [
- {
- "title": "Desayuno (Breakfast)",
- "desc": "Spanish-style breakfast with churros, fresh bread, fruits, and energizing beverages."
- },
- {
- "title": "Almuerzo (Lunch)",
- "desc": "Traditional Iberian cuisine with tapas, paella, and fresh Mediterranean dishes."
- },
- {
- "title": "Cena (Dinner)",
- "desc": "Satisfying evening meals featuring Spanish and Portuguese favorites."
- },
- {
- "title": "Meriendas",
- "desc": "Afternoon snacks and refreshments in the Spanish tradition."
- }
- ],
- "footer": "¡Las comidas son clase también! Meals are learning opportunities – practice ordering and conversing in Spanish!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Native Spanish Teachers & Staff",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our teaching team consists of native Spanish speakers with qualifications in teaching Spanish as a foreign language.",
- "All staff maintain a Spanish-speaking environment while providing supportive, encouraging instruction."
- ],
- "footerText": [
- "With a student-to-teacher ratio of 1:8, every camper receives personal attention and language support.",
- "Our multilingual staff ensure all students feel supported while maximizing Spanish practice."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "All campers are covered by comprehensive insurance throughout their Spanish learning adventure, including all excursions and activities.",
- "package": {
- "title": "Language Camp Insurance",
- "desc": "Full coverage for all camp activities, excursions, and medical needs.",
- "items": [
- "Comprehensive medical coverage",
- "Excursion and travel protection",
- "Personal belongings coverage"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation policy for unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and family emergencies",
- "Full refund of program fees"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Survival",
- "price": 495,
- "priceText": "from 495 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "vietnam"
- ],
- "image": "/uploads/activity/b7.jpg",
- "link": "/survival",
- "program": "survival",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "Survival Camp in Vietnam",
- "bgImage": "/uploads/activity/b7.jpg"
- },
- "basicInfo": {
- "location": "Vietnam",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Wilderness Camp & Shelter Building",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & VN"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Jungle Survival Basics",
- "rating": 4.9,
- "reviews": 52,
- "location": "Cat Tien, Vietnam",
- "price": 1200,
- "originalPrice": 1500,
- "image": "https://images.unsplash.com/photo-1504280390367-361c6d9f38f4?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Mountain Survival Skills",
- "rating": 4.8,
- "reviews": 45,
- "location": "Sapa, Vietnam",
- "price": 1300,
- "originalPrice": 1600,
- "image": "https://images.unsplash.com/photo-1475924156734-496f6cac6ec1?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Bushcraft Adventure",
- "rating": 4.9,
- "reviews": 48,
- "location": "Ba Vi, Vietnam",
- "price": 1150,
- "originalPrice": 1450,
- "image": "https://images.unsplash.com/photo-1510312305653-8ed496efae75?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Wilderness Navigation",
- "rating": 4.7,
- "reviews": 38,
- "location": "Phong Nha, Vietnam",
- "price": 1250,
- "originalPrice": 1550,
- "image": "https://images.unsplash.com/photo-1478827536114-da961b7f86d2?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Wilderness camp"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Fire making"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Shelter building"
- }
- ],
- "overlayInfo": {
- "location": "Vietnam",
- "season": "Summer",
- "languages": "EN & VN"
- }
- },
- "eventSchedule": {
- "startDate": "06/25/2024",
- "duration": "8 Days 7 Nights",
- "tickets": "$49/55"
- },
- "sections": {
- "overview": {
- "intro": "Test your limits and learn wilderness skills at our Survival Camp in Vietnam! From shelter building to fire craft, navigation to foraging, campers develop resilience, self-reliance, and a deep connection with nature.",
- "mainText": "The Survival Camp challenges young adventurers aged 12 to 18 to step out of their comfort zones and master essential wilderness skills. Under the guidance of experienced survival instructors, campers learn to thrive in the jungle, building confidence and capabilities that extend far beyond the wilderness.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, no prior experience needed",
- "Certified survival and bushcraft instructors",
- "Progressive skill-building curriculum",
- "Shelter building and fire craft",
- "Wilderness navigation training",
- "24/7 supervision and safety support",
- "Tropical jungle environment",
- "Team challenges and solo experiences"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Survival Camp is located in the lush tropical forests of Vietnam, providing an authentic wilderness environment for learning survival skills. The diverse terrain includes jungle, streams, and varied landscapes that offer the perfect classroom for outdoor education. Safe base camps provide security while allowing genuine wilderness immersion.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Wilderness Living Experience",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Experience progressive wilderness living – from comfortable base camp to shelters you build yourself! This is part of the survival learning experience."
- ],
- "outroText": [
- "🏕️ Base Camp: Start in comfortable tents with essential amenities as you learn skills.",
- "🌿 Wilderness Nights: Progress to sleeping in shelters you construct – the ultimate survival experience!"
- ],
- "details": [
- "Base camp provides secure, comfortable starting point.",
- "Emergency shelter always available for safety.",
- "Experienced staff supervise all wilderness experiences!",
- "Good to know:",
- "Bring sturdy outdoor clothing and footwear.",
- "All survival gear and tools are provided.",
- "Be prepared for challenging but rewarding experiences!"
- ],
- "principles": [
- "Junior Survivors (12–14 years)",
- "Teen Bushcraft (14–16 years)",
- "Advanced Survival (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Master Wilderness Skills!",
- "introText": [
- "Our survival program builds skills progressively, from fundamental techniques to complex challenges, developing confident, capable young people."
- ],
- "quote": "",
- "outroText": [
- "Learn from Survival Experts!",
- "Our instructors have extensive wilderness experience and passion for teaching outdoor skills.",
- "Build Real Confidence!",
- "The challenges you overcome in the wilderness translate to confidence in all areas of life."
- ],
- "mainHeading": "From beginner to wilderness-capable!",
- "principles": [
- "Fire & Shelter: Fire-making techniques and shelter construction – the survival essentials!",
- "Navigation & Foraging: Map and compass skills, natural navigation, edible plants!",
- "Challenges & Expeditions: Apply your skills in team challenges and overnight experiences!"
- ],
- "footerText": [
- "Leave camp with skills, confidence, and memories of overcoming challenges in the wild!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Experience a range of meals from base camp cooking to outdoor food preparation. Part of survival training includes learning to prepare simple outdoor meals!",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Hearty breakfast to fuel your survival training day – prepared at base camp or over campfire."
- },
- {
- "title": "Lunch",
- "desc": "Trail lunch and field rations during outdoor training and expeditions."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying camp dinner including some meals you help prepare over fire."
- },
- {
- "title": "Trail Food",
- "desc": "High-energy snacks and hydration for training activities and expeditions."
- }
- ],
- "footer": "Part of survival is learning to prepare food in the field – you'll cook some of your own meals as part of training!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Expert Survival Instructors",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our team includes certified survival instructors and bushcraft experts with extensive wilderness experience.",
- "All staff hold wilderness first aid certifications and emergency response training."
- ],
- "footerText": [
- "With a camper-to-instructor ratio of 1:5, every participant receives close supervision and personalized coaching.",
- "Safety personnel are always available for any wilderness emergency."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Wilderness activities require comprehensive outdoor activity insurance. Our package covers all survival training activities and outdoor experiences.",
- "package": {
- "title": "Wilderness Activity Insurance",
- "desc": "Complete coverage for all survival training and outdoor adventure activities.",
- "items": [
- "Outdoor activity coverage",
- "Wilderness emergency response",
- "Medical evacuation included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for medical or personal reasons.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and family emergencies",
- "Full refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Swimming",
- "price": 495,
- "priceText": "from 495 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "philippines"
- ],
- "image": "/uploads/activity/b18.jpg",
- "link": "/swimming",
- "program": "swimming",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "Swimming Camp in Philippines",
- "bgImage": "/uploads/activity/b18.jpg"
- },
- "basicInfo": {
- "location": "Philippines",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Aquatic Center & Resort",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & FIL"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Competitive Swim Training",
- "rating": 4.9,
- "reviews": 58,
- "location": "Manila, Philippines",
- "price": 1300,
- "originalPrice": 1600,
- "image": "https://images.unsplash.com/photo-1530549387789-4c1017266635?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Stroke Technique Intensive",
- "rating": 4.8,
- "reviews": 45,
- "location": "Cebu, Philippines",
- "price": 1250,
- "originalPrice": 1550,
- "image": "https://images.unsplash.com/photo-1575429198097-0414ec08e8cd?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Open Water Swimming",
- "rating": 4.9,
- "reviews": 42,
- "location": "Boracay, Philippines",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1560090995-01632a28895b?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Learn to Swim Program",
- "rating": 4.7,
- "reviews": 38,
- "location": "Baguio, Philippines",
- "price": 1100,
- "originalPrice": 1400,
- "image": "https://images.unsplash.com/photo-1519315901367-f34ff9154487?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Swimming pool"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Training session"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Beach swimming"
- }
- ],
- "overlayInfo": {
- "location": "Philippines",
- "season": "Summer",
- "languages": "EN & FIL"
- }
- },
- "eventSchedule": {
- "startDate": "06/20/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$49/55"
- },
- "sections": {
- "overview": {
- "intro": "Make a splash at our Swimming Camp in the Philippines! Whether you're learning to swim or training for competition, our certified coaches help you improve technique, build endurance, and develop confidence in the water.",
- "mainText": "The Swimming Camp offers young swimmers aged 12 to 18 professional coaching in the beautiful Philippines. From beginners building water confidence to competitive swimmers perfecting strokes, our program caters to all levels with certified instructors and excellent facilities.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all swimming levels",
- "Certified swimming coaches",
- "Olympic-size pool facilities",
- "Stroke technique analysis",
- "Resort accommodation",
- "24/7 supervision and water safety",
- "Open water swimming introduction",
- "Video analysis of technique"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Swimming Camp is based at a premier aquatic center in the Philippines with Olympic-standard facilities. The complex features a 50-meter pool, training pools, and access to supervised open water swim areas. The tropical climate ensures warm water and perfect swimming conditions year-round.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Swimmer's Resort Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in comfortable resort accommodation just steps from the aquatic center. Rest and recover between training sessions!"
- ],
- "outroText": [
- "🏊 Swimmer's Lodge: Shared rooms for 4-6 swimmers with gear drying areas.",
- "🌴 Poolside Suite: Premium rooms for 2-3 campers with enhanced amenities. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning and comfortable beds.",
- "Swimsuit drying and cap/goggle storage available.",
- "Physio and massage services available!",
- "Good to know:",
- "Bring multiple swimsuits, caps, and goggles.",
- "All training equipment is provided.",
- "Reserve your accommodation during registration!"
- ],
- "principles": [
- "Learn to Swim (12–14 years)",
- "Intermediate Swimmers (14–16 years)",
- "Competitive Training (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Improve Every Stroke!",
- "introText": [
- "Our comprehensive swimming program develops technique, endurance, and speed across all four competitive strokes, with personalized coaching for every skill level."
- ],
- "quote": "",
- "outroText": [
- "Technique-Focused Coaching!",
- "Our coaches use video analysis and one-on-one instruction to refine your technique in every stroke.",
- "Build Confidence & Stamina!",
- "Progressive training builds both water confidence and swimming endurance."
- ],
- "mainHeading": "From water confidence to competitive swimming!",
- "principles": [
- "Stroke Technique: Perfect your freestyle, backstroke, breaststroke, and butterfly!",
- "Starts & Turns: Master racing starts and efficient turns!",
- "Endurance & Speed: Build swimming fitness and race strategy!"
- ],
- "footerText": [
- "Every lap brings improvement – leave camp a stronger, faster, more confident swimmer!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Fuel your swimming with athlete-focused nutrition. Our kitchen prepares balanced meals designed for swimmers' unique energy and recovery needs.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "High-energy breakfast with carbohydrates, proteins, and fruits to fuel morning training."
- },
- {
- "title": "Lunch",
- "desc": "Recovery-focused Filipino and international cuisine with balanced nutrition."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying evening meals to repair muscles and prepare for the next day's training."
- },
- {
- "title": "Poolside Snacks",
- "desc": "Energy drinks, fruits, and recovery snacks available between pool sessions."
- }
- ],
- "footer": "Swimmers have unique nutritional needs. Our menu is designed to optimize training and recovery!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Professional Swimming Coaches",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our coaching team includes certified swimming instructors with competitive coaching experience and expertise in stroke technique development.",
- "All coaches hold current lifeguarding certifications and first aid training."
- ],
- "footerText": [
- "With a swimmer-to-coach ratio of 1:6, every participant receives personalized attention and technique feedback.",
- "Lifeguards are present during all pool sessions for additional safety."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Swimming activities require proper water safety coverage. Our insurance protects all participants during pool training, open water sessions, and all camp activities.",
- "package": {
- "title": "Aquatic Sports Insurance",
- "desc": "Complete coverage for all swimming activities and water-based training.",
- "items": [
- "Pool and open water coverage",
- "Training injury protection",
- "Medical coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for medical or ability concerns.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical issues and ability concerns",
- "Full refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Tennis",
- "price": 495,
- "priceText": "from 495 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "malaysia"
- ],
- "image": "/uploads/activity/b15.jpg",
- "link": "/tennis",
- "program": "tennis",
- "rating": 4,
- "camp-detail": {
- "hero": {
- "title": "Tennis Camp in Malaysia",
- "bgImage": "/uploads/activity/b15.jpg"
- },
- "basicInfo": {
- "location": "Malaysia",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Tennis Academy & Resort",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & MY"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Intensive Tennis Training",
- "rating": 4.9,
- "reviews": 52,
- "location": "Kuala Lumpur, Malaysia",
- "price": 1400,
- "originalPrice": 1700,
- "image": "https://images.unsplash.com/photo-1622279457486-62dcc4a431d6?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Beginner Tennis Academy",
- "rating": 4.8,
- "reviews": 45,
- "location": "Penang, Malaysia",
- "price": 1250,
- "originalPrice": 1550,
- "image": "https://images.unsplash.com/photo-1551773188-0801da12ddae?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Match Play Intensive",
- "rating": 4.8,
- "reviews": 42,
- "location": "Langkawi, Malaysia",
- "price": 1500,
- "originalPrice": 1800,
- "image": "https://images.unsplash.com/photo-1545809074-59472b3f5ecc?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Junior Development Camp",
- "rating": 4.7,
- "reviews": 38,
- "location": "Johor Bahru, Malaysia",
- "price": 1300,
- "originalPrice": 1600,
- "image": "https://images.unsplash.com/photo-1595435934249-5df7ed86e1c0?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Tennis court"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Training session"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Match play"
- }
- ],
- "overlayInfo": {
- "location": "Malaysia",
- "season": "Summer",
- "languages": "EN & MY"
- }
- },
- "eventSchedule": {
- "startDate": "06/25/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$49/55"
- },
- "sections": {
- "overview": {
- "intro": "Ace your game at our Tennis Camp in Malaysia! Train on professional courts with certified coaches who help you develop technique, tactics, and match play skills in a fun, encouraging environment.",
- "mainText": "The Tennis Camp offers young players aged 12 to 18 intensive coaching in Malaysia's premier tennis facilities. Whether you're picking up a racket for the first time or competing at junior level, our coaches provide personalized instruction to help you reach your potential on the court.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all skill levels welcome",
- "Certified professional tennis coaches",
- "Multiple court surfaces available",
- "Technical and tactical training",
- "Academy resort accommodation",
- "24/7 supervision and care",
- "Daily match play and tournaments",
- "Video analysis sessions"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Tennis Camp is based at a professional tennis academy in Malaysia, featuring multiple courts on various surfaces. The facility includes hard courts, covered courts for rain protection, and excellent supporting facilities. The tropical climate is ideal for year-round tennis, with covered courts ensuring training continues in any weather.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Academy Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay on campus in comfortable accommodation designed for tennis players, with easy access to courts and training facilities."
- ],
- "outroText": [
- "🎾 Player Dorms: Shared rooms for 4-6 players with racket storage.",
- "🏆 Elite Rooms: Premium rooms for 2-3 players with enhanced amenities. (Additional charge applies)"
- ],
- "details": [
- "All rooms feature air conditioning and comfortable beds.",
- "Racket stringing and equipment shop on site.",
- "Physio and sports massage available!",
- "Good to know:",
- "Bring your own racket or use academy equipment.",
- "Extra strings and grips available for purchase.",
- "Reserve your accommodation during registration!"
- ],
- "principles": [
- "Beginner Players (12–14 years)",
- "Intermediate Players (14–16 years)",
- "Advanced Players (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Develop Your Complete Game!",
- "introText": [
- "Our comprehensive tennis program develops all aspects of the modern game – groundstrokes, net play, serving, and tactical awareness – through expert coaching and plenty of match play."
- ],
- "quote": "",
- "outroText": [
- "Technical Excellence!",
- "Our coaches break down each stroke to build technically sound, powerful, and consistent shots.",
- "Match Play Focus!",
- "Daily match play and tournaments help you apply your skills in competitive situations."
- ],
- "mainHeading": "From fundamentals to match winning!",
- "principles": [
- "Stroke Production: Perfect your forehand, backhand, serve, and volleys!",
- "Movement & Fitness: Footwork, agility, and tennis-specific conditioning!",
- "Tactics & Match Play: Singles and doubles strategies, point construction!"
- ],
- "footerText": [
- "Every session builds your skills – return home a more complete tennis player!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Fuel your tennis with athlete-focused nutrition. Our kitchen prepares balanced meals designed for the energy demands of intensive tennis training.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "High-energy breakfast with carbohydrates, proteins, and fruits to power morning training."
- },
- {
- "title": "Lunch",
- "desc": "Balanced Malaysian and international meals for recovery and afternoon sessions."
- },
- {
- "title": "Dinner",
- "desc": "Satisfying evening meals to repair and prepare for the next day on court."
- },
- {
- "title": "Court-side Snacks",
- "desc": "Energy bars, fruits, and sports drinks available during training breaks."
- }
- ],
- "footer": "Tennis requires sustained energy. Our nutrition plan keeps you performing at your best on court!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Professional Tennis Coaches",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our coaching team includes certified professionals with competitive playing experience and expertise in junior player development.",
- "Coaches are trained in the latest tennis methodology and use video analysis for effective feedback."
- ],
- "footerText": [
- "With a player-to-coach ratio of 1:4 on court, every player receives personalized attention and instruction.",
- "Hitting partners and ball machine practice supplement coach-led sessions."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Tennis is a physically demanding sport. Our insurance protects all participants during training, match play, and all camp activities.",
- "package": {
- "title": "Sports Activity Insurance",
- "desc": "Complete coverage for all tennis activities and related camp programs.",
- "items": [
- "Tennis injury coverage",
- "Physiotherapy access",
- "Medical coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for injury or unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers injury and medical issues",
- "Full refund available"
- ]
- }
- }
- }
- }
- },
- {
- "name": "Windsurfing",
- "price": 990,
- "priceText": "from 990 USD",
- "season": [
- "summer"
- ],
- "age": [
- 12,
- 18
- ],
- "locations": [
- "thailand"
- ],
- "image": "/uploads/activity/b13.jpg",
- "link": "/windsurfing",
- "program": "windsurf",
- "rating": 5,
- "camp-detail": {
- "hero": {
- "title": "Windsurfing Camp in Thailand",
- "bgImage": "/uploads/activity/b13.jpg"
- },
- "basicInfo": {
- "location": "Thailand",
- "ageRange": "12 - 18 years\nSeparated by age groups",
- "accommodationType": "Beach Resort & Water Sports Center",
- "careLevel": "Around-the-Clock Care & All Meals Included",
- "languages": "Bilingual\nEN & TH"
- },
- "sidebar": {
- "contact": {
- "phone": "+(123)-456-789",
- "email": "hello@ggcamp.org"
- },
- "menuItems": [
- {
- "name": "Overview",
- "href": "#overview"
- },
- {
- "name": "Location",
- "href": "#location"
- },
- {
- "name": "Accommodation Options",
- "href": "#accommodation"
- },
- {
- "name": "Program",
- "href": "#program"
- },
- {
- "name": "Meals On Site",
- "href": "#meals"
- },
- {
- "name": "Team and Supervision",
- "href": "#team"
- },
- {
- "name": "Coverage and Insurance",
- "href": "#coverage"
- }
- ],
- "upcomingTours": [
- {
- "id": 1,
- "title": "Beginner Windsurfing Course",
- "rating": 4.9,
- "reviews": 52,
- "location": "Phuket, Thailand",
- "price": 2100,
- "originalPrice": 2500,
- "image": "https://images.unsplash.com/photo-1505118380757-91f5f5632de0?w=400&h=300&fit=crop"
- },
- {
- "id": 2,
- "title": "Intermediate Windsurfing",
- "rating": 4.8,
- "reviews": 45,
- "location": "Koh Samui, Thailand",
- "price": 2200,
- "originalPrice": 2600,
- "image": "https://images.unsplash.com/photo-1515722661952-9893f0251db6?w=400&h=300&fit=crop"
- },
- {
- "id": 3,
- "title": "Advanced Wind Techniques",
- "rating": 5,
- "reviews": 48,
- "location": "Hua Hin, Thailand",
- "price": 2400,
- "originalPrice": 2800,
- "image": "https://images.unsplash.com/photo-1538428494232-9c0d8a3ab403?w=400&h=300&fit=crop"
- },
- {
- "id": 4,
- "title": "Island Windsurfing Safari",
- "rating": 4.9,
- "reviews": 42,
- "location": "Krabi, Thailand",
- "price": 2300,
- "originalPrice": 2700,
- "image": "https://images.unsplash.com/photo-1517649763962-0c623066013b?w=400&h=300&fit=crop"
- }
- ]
- },
- "mainGallery": {
- "slides": [
- {
- "url": "/uploads/banner/b1.jpg",
- "alt": "Windsurfing"
- },
- {
- "url": "/uploads/banner/b2.jpg",
- "alt": "Beach"
- },
- {
- "url": "/uploads/banner/b3.jpg",
- "alt": "Equipment"
- }
- ],
- "overlayInfo": {
- "location": "Thailand",
- "season": "Summer",
- "languages": "EN & TH"
- }
- },
- "eventSchedule": {
- "startDate": "06/25/2024",
- "duration": "10 Days 9 Nights",
- "tickets": "$99/105"
- },
- "sections": {
- "overview": {
- "intro": "Catch the wind at our Windsurfing Camp in Thailand! Learn to harness the power of wind and waves in the stunning Andaman Sea, from first-time board standing to advanced planing and maneuvers.",
- "mainText": "The Windsurfing Camp offers young water sports enthusiasts aged 12 to 18 an exhilarating introduction to windsurfing in Thailand's ideal conditions. With consistent trade winds, warm water, and certified instructors, campers progress rapidly while enjoying one of the world's most exciting water sports.",
- "featuresTitle": "Key features",
- "features": [
- "Ages 12–18, all skill levels from beginner to advanced",
- "Certified windsurfing instructors",
- "Modern equipment for all conditions",
- "Progressive skill-based curriculum",
- "Beach resort accommodation",
- "24/7 supervision and water safety",
- "International certification available",
- "Beach lifestyle and activities"
- ],
- "featureImage": "/uploads/banner/b4.jpg"
- },
- "location": {
- "title": "Location",
- "description": "Our Windsurfing Camp is located on a beautiful beach in Thailand, known for excellent and consistent wind conditions. The shallow, warm waters provide safe learning conditions for beginners, while stronger winds offshore challenge advanced sailors. The stunning tropical setting makes every session an adventure.",
- "images": [
- "/uploads/banner/b5.jpg",
- "/uploads/banner/b6.jpg"
- ]
- },
- "accommodation": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Accommodation Options",
- "subtitle": "Beachfront Living",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Stay in comfortable beach resort accommodation just steps from the windsurfing center. Watch the conditions from your room and be first on the water!"
- ],
- "outroText": [
- "🏄 Windsurfer's Bungalow: Shared beachfront cabins for 4-6 campers.",
- "🌊 Beach Suite: Premium beachfront rooms for 2-3 campers. (Additional charge applies)"
- ],
- "details": [
- "All accommodations feature fans/AC and comfortable beds.",
- "Outdoor gear rinse and drying areas available.",
- "Equipment storage at the water sports center!",
- "Good to know:",
- "Bring swimwear, reef-safe sunscreen, and beach footwear.",
- "All windsurfing equipment is provided.",
- "Reserve your beach accommodation during booking!"
- ],
- "principles": [
- "Beginner Windsurfers (12–14 years)",
- "Intermediate Sailors (14–16 years)",
- "Advanced Riders (16–18 years)"
- ]
- },
- "program": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Program",
- "subtitle": "Ride the Wind!",
- "introText": [
- "Our progressive windsurfing program takes you from understanding equipment to riding confidently, with opportunities for certification and advanced techniques."
- ],
- "quote": "",
- "outroText": [
- "Perfect Conditions!",
- "Thailand's consistent winds and warm waters provide ideal learning conditions throughout the season.",
- "Earn Your Certificate!",
- "Progress through levels and earn your internationally recognized windsurfing certification."
- ],
- "mainHeading": "From beach start to full planing!",
- "principles": [
- "Fundamentals: Board balance, sail control, and basic sailing techniques!",
- "Intermediate Skills: Beach starts, harness use, and directional control!",
- "Advanced Techniques: Planing, foot straps, and high-performance sailing!"
- ],
- "footerText": [
- "Every session on the water builds skills and confidence – feel the thrill of gliding with the wind!"
- ]
- },
- "meals": {
- "title": "Meals On Site",
- "description": "Fuel your windsurfing with delicious Thai and international cuisine. Our beach restaurant serves nutritious meals designed for active water sports participants.",
- "items": [
- {
- "title": "Breakfast",
- "desc": "Energizing breakfast with Thai and Western options to fuel morning sessions on the water."
- },
- {
- "title": "Lunch",
- "desc": "Fresh Thai seafood and international dishes to refuel after morning windsurfing."
- },
- {
- "title": "Dinner",
- "desc": "Sunset dinners at the beach restaurant featuring authentic Thai cuisine."
- },
- {
- "title": "Beach Snacks",
- "desc": "Fresh coconuts, tropical fruits, and hydrating drinks between sessions."
- }
- ],
- "footer": "Enjoy the beach lifestyle with delicious food and beautiful sunset views after windsurfing!"
- },
- "team": {
- "heroImage": "/uploads/banner/b9.jpg",
- "title": "Team and Supervision",
- "subtitle": "Certified Windsurfing Instructors",
- "quote": "",
- "mainHeading": "",
- "introText": [
- "Our windsurfing team includes internationally certified instructors with years of teaching and sailing experience.",
- "All instructors hold water safety certifications and are trained in rescue techniques."
- ],
- "footerText": [
- "With a camper-to-instructor ratio of 1:4 on the water, every participant receives personalized coaching.",
- "Safety boats accompany all sessions for immediate assistance if needed."
- ]
- },
- "insurance": {
- "title": "Coverage and Insurance",
- "description": "Water sports require comprehensive coverage. Our insurance package protects all participants during windsurfing sessions and related activities.",
- "package": {
- "title": "Water Sports Insurance",
- "desc": "Complete coverage for all windsurfing activities and water-based sessions.",
- "items": [
- "Windsurfing activity coverage",
- "Equipment use protection",
- "Water rescue coverage included"
- ]
- },
- "cancellation": {
- "title": "Travel Cancellation Guarantee",
- "desc": "Flexible cancellation for unforeseen circumstances.",
- "items": [
- "Valid until one week before camp start",
- "Covers medical and emergency situations",
- "Full refund of program fees"
- ]
- }
- }
- }
- }
- }
- ]
-}
diff --git a/data/appointment.json b/data/appointment.json
deleted file mode 100644
index a8f2cf2..0000000
--- a/data/appointment.json
+++ /dev/null
@@ -1,77 +0,0 @@
-{
- "hero": {
- "title": "Make Appointment",
- "backgroundImage": "/assets/img/inner-page/breadcrumb.jpg",
- "subtitle": "About Our Consultancy",
- "heading": "Want to meet us for your need?",
- "description": "24/7 customer support is always ready to answer all your questions"
- },
- "visaOptions": [
- "Canada Immigration",
- "Tourist Visa",
- "Medical Visa",
- "Coaching",
- "Student Visa",
- "Spouse Visa",
- "Job Opportunity",
- "Exam"
- ],
- "form": {
- "heading": "Request Appointment",
- "fields": [
- {
- "name": "name",
- "label": "Your Name",
- "type": "text",
- "placeholder": "Your name",
- "required": true,
- "colClass": "col-lg-4"
- },
- {
- "name": "email",
- "label": "Your Email",
- "type": "email",
- "placeholder": "Your email",
- "required": true,
- "colClass": "col-lg-4"
- },
- {
- "name": "phone",
- "label": "Your Phone",
- "type": "tel",
- "placeholder": "Phone Number",
- "required": false,
- "colClass": "col-lg-4"
- },
- {
- "name": "address",
- "label": "Your Address",
- "type": "text",
- "placeholder": "Your address",
- "required": false,
- "colClass": "col-lg-6"
- },
- {
- "name": "appointmentDate",
- "label": "Appointment Date",
- "type": "date",
- "placeholder": "",
- "required": false,
- "colClass": "col-lg-6"
- },
- {
- "name": "message",
- "label": "Your Message",
- "type": "textarea",
- "placeholder": "Type your message",
- "required": false,
- "colClass": "col-lg-12"
- }
- ],
- "submitButton": {
- "text": "Request Appointment",
- "icon": "fa-solid fa-arrow-right",
- "buttonClass": "theme-btn"
- }
- }
-}
\ No newline at end of file
diff --git a/data/blog.json b/data/blog.json
deleted file mode 100644
index fbd7181..0000000
--- a/data/blog.json
+++ /dev/null
@@ -1,284 +0,0 @@
-{
- "categories": [
- {
- "name": "Permanent Residency (PR)",
- "slug": "permanent-residency-pr",
- "description": "Information about permanent residency programs and requirements"
- },
- {
- "name": "Immigration Policy Updates",
- "slug": "immigration-policy-updates",
- "description": "Latest updates on immigration policies and regulations"
- },
- {
- "name": "Scholarships & Grants",
- "slug": "scholarships-grants",
- "description": "Scholarship opportunities and grant programs for international students"
- },
- {
- "name": "Citizenship & Naturalization",
- "slug": "citizenship-naturalization",
- "description": "Guide to citizenship and naturalization processes"
- },
- {
- "name": "Visa Interview Preparation",
- "slug": "visa-interview-preparation",
- "description": "Tips and guidance for preparing visa interviews"
- }
- ],
- "tags": [
- {
- "name": "WorkVisa",
- "slug": "work-visa"
- },
- {
- "name": "FamilyVisa",
- "slug": "family-visa"
- },
- {
- "name": "StudentVisa",
- "slug": "student-visa"
- },
- {
- "name": "VisaUpdates",
- "slug": "visa-updates"
- },
- {
- "name": "TravelVisa",
- "slug": "travel-visa"
- },
- {
- "name": "StudyAbroad",
- "slug": "study-abroad"
- }
- ],
- "posts": [
- {
- "title": "Work Visa vs. Student Visa Which is Right for You?",
- "slug": "work-visa-vs-student-visa-which-is-right-for-you",
- "excerpt": "Choosing between a work visa and a student visa depends on your career and academic goals. A student visa allows you to pursue higher education abroad, gain international exposure, and sometimes work part-time while studying. On the other hand, a work visa is for professionals seeking employment opportunities and long-term career growth in another country.",
- "content": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"Choosing between a work visa and a student visa is one of the most critical decisions you'll make when planning your international journey. This decision will shape not only your immediate experience abroad but also your long-term career trajectory, financial situation, and potential pathways to permanent residency. Understanding the fundamental differences, benefits, and requirements of each visa type is essential for making an informed choice that aligns with your personal and professional goals.\"},\"id\":\"2du9ld0ziiq778kwm2d6yk\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"A student visa is designed for individuals who wish to pursue higher education in a foreign country. This visa type provides access to world-class universities, cultural exposure, and global networking opportunities that can significantly enhance your academic and personal development. With a student visa, you typically gain access to educational institutions that offer cutting-edge research facilities, diverse academic programs, and internationally recognized degrees. Many countries also allow student visa holders to work part-time during their studies, which can help offset living expenses while providing valuable international work experience. However, the primary focus remains on academics and personal growth, with strict regulations on working hours and employment types.\"},\"id\":\"n1bz5qaw0segwiuoezsrcl\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"On the other hand, a work visa is perfect for professionals who want to establish themselves in a career overseas immediately. Work visas provide direct access to job markets, stable income from day one, and often serve as a pathway to permanent residency. These visas are typically designed for skilled professionals who can contribute to the host country's economy, bringing specialized knowledge, technical expertise, or filling critical skill shortages. Work visa holders enjoy the benefits of full-time employment, professional development opportunities, and the ability to build a career in an international context. Many work visa programs also allow for family members to accompany the primary applicant, making it an attractive option for those looking to relocate with their loved ones.\"},\"id\":\"24x8enid6ydhool9kwqfvt\"},{\"type\":\"header\",\"data\":{\"text\":\"Key Factors to Consider\",\"level\":3},\"id\":\"aw0woml416s8nzx9l7waq7\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"When deciding between a work visa and student visa, several key factors should guide your decision. First, consider your financial situation. Student visas require proof of sufficient funds to cover tuition fees and living expenses, which can be substantial depending on the country and institution. Work visas, conversely, provide immediate income but may require you to secure employment before applying, which can be challenging from abroad. Your career stage also matters significantly. If you're early in your career or looking to change fields, a student visa might provide the education and credentials you need. If you're an established professional with in-demand skills, a work visa could be the faster route to international experience and career advancement.\"},\"id\":\"unrc4o8vjywzdo8j98zzh\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Your long-term goals are perhaps the most important consideration. If permanent residency is your ultimate objective, research which visa type offers the most straightforward pathway in your target country. Some countries offer post-graduation work permits that allow students to transition to work visas after completing their studies, effectively combining the benefits of both options. Language proficiency requirements also vary between visa types, with work visas often requiring higher levels of professional language skills, while student visas may offer language preparation programs as part of the educational experience.\"},\"id\":\"s686pwd50va4isrdbmdawd\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Ultimately, the choice between a work visa and student visa comes down to your personal aspirations, financial capacity, career objectives, and long-term vision. If education, exploration, and academic achievement are your priorities, a student visa offers an enriching experience that can open doors to future opportunities. If career advancement, immediate professional growth, and financial stability are your primary goals, a work visa provides a direct path to international career success. Many successful international professionals have taken both paths at different stages of their careers, using education to build foundational knowledge and work visas to apply that knowledge in professional settings.\"},\"id\":\"6orypfkkmv74xymytdxgg5\"}],\"time\":1770262297198,\"version\":\"2.28.2\"}",
- "category": [
- "Immigration Policy Updates",
- "Visa Interview Preparation"
- ],
- "tags": [
- "WorkVisa",
- "FamilyVisa",
- "StudentVisa"
- ],
- "author": "Admin",
- "status": "published",
- "publishedAt": "11 March 2025",
- "isFeatured": true,
- "featuredImage": "img/inner-page/news-details/details-1.jpg",
- "galleryImages": [
- "img/inner-page/news-details/details-2.jpg",
- "img/inner-page/news-details/details-3.jpg"
- ],
- "quote": "This blog really helped me understand the difference between student and work visas. The explanations were clear and practical.",
- "contentAfterQuote": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"The decision-making process can be overwhelming, but understanding these fundamental differences will help you choose the path that best aligns with your goals. Remember that both visa types offer unique opportunities for personal and professional growth, and many people successfully transition from one to the other as their circumstances and objectives evolve. Consulting with immigration experts and researching country-specific requirements will further help you make an informed decision that sets you on the right path toward your international aspirations.\"},\"id\":\"dnr5ao91qioq6pvzr7yse9\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "commentsCount": 2
- },
- {
- "title": "How to Avoid Common Mistakes in Visa Applications",
- "slug": "how-to-avoid-common-mistakes-in-visa-applications",
- "excerpt": "Navigating the visa application process can be complex and overwhelming. Many applicants make avoidable mistakes that lead to delays, rejections, or additional costs. Understanding these common pitfalls and learning how to prevent them is crucial for a successful visa application.",
- "content": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"Applying for a visa is a meticulous process that requires attention to detail, thorough preparation, and strict adherence to guidelines. Unfortunately, many applicants fall into common traps that can derail their applications, resulting in frustrating delays, costly rejections, or missed opportunities. Understanding these frequent mistakes and learning how to avoid them can significantly improve your chances of approval and save you time, money, and stress.\"},\"id\":\"v11gtdsu85ss2drtwlsxmo\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"One of the most critical mistakes applicants make is submitting incomplete documentation. Visa applications require a comprehensive set of documents, and missing even a single required item can result in immediate rejection or significant delays. Common missing documents include recent bank statements, proof of accommodation, travel insurance, employment letters, academic transcripts, or passport copies. To avoid this, create a detailed checklist based on the official requirements for your specific visa type and country. Double-check each document before submission, ensuring all pages are included, documents are properly certified or notarized where required, and translations are provided for non-English documents.\"},\"id\":\"n7yupg3d6om6ctkqja03d3\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Incorrect or inconsistent information is another major cause of visa rejections. Many applicants provide information that doesn't match across different documents, such as different dates of employment, varying addresses, or inconsistent personal details. Immigration officers carefully cross-reference all information, and discrepancies raise red flags that can lead to suspicion of fraud. Always ensure that your name, date of birth, passport number, and other personal details are identical across all documents. Review your application multiple times, and consider having a second person review it for consistency before submission.\"},\"id\":\"49vpndxe1xenwhzxrqa3ui\"},{\"type\":\"header\",\"data\":{\"text\":\"Financial Documentation Errors\",\"level\":3},\"id\":\"umaa4m4qw48gjgjsz8epj5\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Financial proof is one of the most scrutinized aspects of visa applications, and mistakes here are particularly costly. Many applicants fail to provide sufficient evidence of financial stability, submit outdated bank statements, or don't clearly demonstrate the source of their funds. Some applicants make the error of depositing large sums of money just before applying, which can appear suspicious. Instead, maintain consistent account balances over several months, provide detailed bank statements covering the required period, and clearly document the source of all funds. If someone else is sponsoring your trip, ensure their financial documents are complete and include a proper sponsorship letter explaining the relationship and commitment.\"},\"id\":\"o5wydwmzx7jgurfuquuvv7\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Missing deadlines is another common but easily avoidable mistake. Visa processing times vary significantly, and failing to apply early enough can result in missing important dates like school start dates, job start dates, or travel plans. Research typical processing times for your visa type and country, and apply well in advance. Keep in mind that peak seasons can significantly extend processing times, and some countries require appointments that may be booked weeks in advance. Set reminders for important dates, track your application status regularly, and have contingency plans in case of delays.\"},\"id\":\"z6bnunk4jgwy06wcpsq9j\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Poor interview preparation is particularly problematic for visas that require interviews. Many applicants arrive unprepared, unable to clearly articulate their travel purpose, answer questions about their itinerary, or explain their financial situation. Practice answering common interview questions, prepare a clear and concise explanation of your travel purpose, and bring all required documents to the interview. Dress professionally, arrive early, and maintain a confident but respectful demeanor. Remember that the interview is your opportunity to clarify any questions and demonstrate your genuine intentions.\"},\"id\":\"sgdtcacli1kk7v0o8q7vr\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Finally, many applicants fail to seek professional help when needed. While it's possible to complete visa applications independently, complex cases, previous rejections, or specific circumstances may benefit from professional guidance. Immigration consultants understand the nuances of different visa types, stay updated with policy changes, and can help identify potential issues before they become problems. However, always ensure you're working with licensed and reputable consultants, as fraudulent services can cause serious problems.\"},\"id\":\"swsr2kbx5sy3ek9ph2x1\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "category": [
- "Visa Interview Preparation"
- ],
- "tags": [
- "WorkVisa",
- "StudentVisa",
- "VisaUpdates"
- ],
- "author": "Admin",
- "status": "published",
- "publishedAt": "11 March 2025",
- "isFeatured": false,
- "featuredImage": "img/inner-page/news-details/details-1.jpg",
- "galleryImages": [
- "img/inner-page/news-details/details-2.jpg",
- "img/inner-page/news-details/details-3.jpg"
- ],
- "quote": "The most common mistake I see is applicants rushing through their application without double-checking every detail. Taking the time to review your documents thoroughly can save you months of delays and additional costs.",
- "contentAfterQuote": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"By being methodical, organized, and attentive to detail, you can navigate the visa application process successfully. Remember that immigration officers are looking for complete, accurate, and consistent information. When in doubt, seek clarification from official sources or professional consultants rather than making assumptions. The investment in getting your application right the first time pays dividends in saved time, money, and stress.\"},\"id\":\"zfjo97ecblbwf9ptglwh5\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "commentsCount": 0
- },
- {
- "title": "The Role of Immigration Consultants in Your Journey",
- "slug": "the-role-of-immigration-consultants-in-your-journey",
- "excerpt": "Immigration consultants play a vital role in guiding applicants through complex visa processes, offering expert advice, and ensuring successful outcomes for study, work, or permanent residency applications abroad.",
- "content": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"Navigating the immigration process can be one of the most challenging and stressful experiences in your life. With constantly changing policies, complex requirements, extensive documentation, and high stakes, having expert guidance can make the difference between success and failure. Immigration consultants serve as knowledgeable guides, strategic advisors, and supportive partners throughout your journey, helping you navigate the intricate landscape of international migration with confidence and clarity.\"},\"id\":\"7xgdhicna6mxp7hf2yvm9l\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"One of the primary roles of immigration consultants is to provide expert knowledge and up-to-date information about visa requirements, policies, and procedures. Immigration laws and regulations change frequently, and what was true last year may no longer apply today. Professional consultants stay current with these changes through continuous education, professional development, and direct engagement with immigration authorities. They understand the nuances of different visa categories, eligibility requirements, processing times, and country-specific regulations that can be overwhelming for individuals to navigate alone.\"},\"id\":\"7qeapt7vooghxez5hx2t25\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Consultants also play a crucial role in helping you choose the right visa pathway for your specific situation. With numerous visa types available, each with different requirements, benefits, and pathways to permanent residency, selecting the most appropriate option can be confusing. An experienced consultant will assess your qualifications, goals, financial situation, and personal circumstances to recommend the best visa strategy. They can identify alternative pathways you might not have considered, such as post-graduation work permits, skilled migration programs, or family sponsorship options that could be more suitable for your long-term objectives.\"},\"id\":\"8qdftl40lv9ddf5eu00ak\"},{\"type\":\"header\",\"data\":{\"text\":\"Document Preparation and Review\",\"level\":3},\"id\":\"x7wp7f3b9rn8kduauqr2f\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Perhaps one of the most valuable services consultants provide is assistance with document preparation and review. Visa applications require extensive documentation, and even minor errors can lead to rejection. Consultants help you understand exactly which documents are needed, how they should be formatted, what certifications or translations are required, and how to present them effectively. They review your completed application before submission, identifying potential issues, inconsistencies, or missing information that could cause problems. This thorough review process significantly reduces the risk of rejection and saves you from costly mistakes.\"},\"id\":\"qadgxknegwibxd0va3kb38\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Immigration consultants also provide strategic guidance throughout the application process. They help you understand timelines, plan your application strategy, and coordinate multiple steps that need to happen in sequence. For example, they might advise you on when to take language tests, when to gather financial documents, or when to schedule medical examinations to ensure everything aligns properly with your application timeline. They can also help you prepare for interviews, providing practice questions, coaching on how to present yourself, and guidance on what to expect during the process.\"},\"id\":\"2dlqbtku473brc07teduyt\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"When complications arise, consultants are invaluable in helping you navigate challenges. Whether you've received a request for additional information, faced a rejection, or encountered unexpected delays, consultants can help you understand what went wrong, develop a strategy to address the issue, and guide you through appeals or reapplication processes. They understand the common reasons for rejections and can help you strengthen your application for resubmission.\"},\"id\":\"svrar6s50x887iaz9m7qj\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Beyond the technical aspects, consultants also provide emotional support and peace of mind during what can be an anxiety-inducing process. They serve as a reliable point of contact who understands your situation, can answer your questions promptly, and provide reassurance when you're feeling uncertain. This support can be particularly valuable when dealing with language barriers, cultural differences, or when you're far from home and feeling isolated.\"},\"id\":\"3geo1bw3vsj20j622aeg5x\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"However, it's important to choose your consultant carefully. Look for licensed, registered, or certified consultants with proven track records. Check their credentials, read reviews from previous clients, and ensure they have experience with your specific visa type and destination country. Be wary of consultants who make unrealistic promises or charge fees that seem too good to be true. A reputable consultant will provide honest assessments, clear fee structures, and realistic expectations about your chances of success.\"},\"id\":\"18pgruj0x13liukcd4u28\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "category": [
- "Immigration Policy Updates"
- ],
- "tags": [
- "VisaUpdates"
- ],
- "author": "Admin",
- "status": "published",
- "publishedAt": "11 March 2025",
- "isFeatured": false,
- "featuredImage": "img/inner-page/news-details/details-1.jpg",
- "galleryImages": [
- "img/inner-page/news-details/details-2.jpg",
- "img/inner-page/news-details/details-3.jpg"
- ],
- "quote": "Working with an immigration consultant transformed my entire experience. Their expertise and guidance gave me confidence throughout the process, and I'm certain I wouldn't have been successful without their help.",
- "contentAfterQuote": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"The value of professional immigration consulting extends far beyond just filling out forms correctly. Consultants provide strategic guidance, emotional support, and peace of mind during one of life's most significant transitions. While the upfront cost may seem significant, the potential savings from avoiding mistakes, rejections, and delays often far outweigh the investment. For anyone navigating complex immigration processes, especially those with previous rejections, unique circumstances, or tight timelines, professional consultation can be the difference between success and failure.\"},\"id\":\"s2lthyy3iobl7t41cct4gi\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "commentsCount": 0
- },
- {
- "title": "Latest Immigration Policy Updates You Should Know",
- "slug": "latest-immigration-policy-updates-you-should-know",
- "excerpt": "Stay informed with the latest immigration policy updates, ensuring you understand new rules, visa requirements, and opportunities that impact your study, work, or migration journey abroad.",
- "content": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"Immigration policies are constantly evolving, with governments around the world regularly updating regulations, requirements, and pathways to reflect changing economic needs, security concerns, and international relations. Staying informed about these updates is crucial for anyone planning to study, work, or migrate abroad, as policy changes can significantly impact eligibility, processing times, costs, and available opportunities. Being proactive about understanding these changes can help you make informed decisions, take advantage of new opportunities, and avoid unexpected complications.\"},\"id\":\"jpzre22voon4x2hvd0h2cv\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"One of the most significant trends in recent immigration policy updates has been the expansion of post-graduation work rights for international students. Many countries, including Canada, Australia, and the United Kingdom, have extended the duration of post-graduation work permits, making it easier for students to gain valuable work experience and transition to permanent residency. These changes recognize the value that international students bring to host countries and provide clearer pathways from education to employment to settlement. For prospective students, these updates make studying abroad even more attractive, as they offer better long-term prospects beyond just obtaining a degree.\"},\"id\":\"3sd02alt73cnt6vhs29qfq\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Another important development has been the introduction and expansion of digital nomad visas and remote work programs. Countries like Portugal, Estonia, and several Caribbean nations have created specific visa categories for remote workers, recognizing the growing trend of location-independent employment. These programs typically offer longer stays than tourist visas, simplified application processes, and sometimes pathways to longer-term residency. For professionals who can work remotely, these new visa options open up exciting possibilities for international experience without the traditional constraints of work visas tied to specific employers or locations.\"},\"id\":\"s2fb9alvapsrsxe1twozi\"},{\"type\":\"header\",\"data\":{\"text\":\"Skilled Migration Program Updates\",\"level\":3},\"id\":\"yy0m9pfvyuj3bwd35673x9\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Many countries have also updated their skilled migration programs to better address labor market needs. Points-based systems have been refined to prioritize certain occupations, language proficiency requirements have been adjusted, and new pathways have been created for specific industries facing skill shortages. Countries like Australia and Canada regularly update their occupation lists, adding or removing professions based on current economic needs. These updates can significantly impact your eligibility for skilled migration programs, making it important to stay current with these changes if you're considering this pathway.\"},\"id\":\"goptt045816goq9pzyygrw\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Processing time improvements have been another focus of recent policy updates. Several countries have invested in digitalization and streamlined processes to reduce application backlogs and improve efficiency. Online application systems have been enhanced, biometric requirements have been updated, and some countries have introduced priority processing options for certain visa types. However, it's important to note that processing times can still vary significantly based on application volume, complexity, and individual circumstances. Always check current processing times when planning your application timeline.\"},\"id\":\"0airny0j4xgcitod0ncpq8\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Fee structures have also been updated in many countries, with some increases reflecting the costs of enhanced security measures, improved processing systems, and expanded services. Some countries have introduced new fee categories, such as priority processing fees or fees for additional services. Understanding these fee structures is important for budgeting your immigration journey, as costs can add up quickly when including application fees, biometric fees, medical examination costs, and other associated expenses.\"},\"id\":\"sciwsih5lthdpamp5zqjj\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Family sponsorship programs have seen updates as well, with some countries expanding eligibility criteria, adjusting income requirements, or changing processing priorities. These changes can affect your ability to sponsor family members or be sponsored by family members already living abroad. Understanding these updates is crucial if family reunification is part of your immigration goals.\"},\"id\":\"c3n0sacpivbmphj2755tw\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"To stay informed about these updates, regularly check official government immigration websites, subscribe to official newsletters or updates, and consider consulting with licensed immigration professionals who stay current with policy changes. Many consultants and immigration law firms provide regular updates through blogs, newsletters, or social media. Additionally, join relevant online communities or forums where members share updates and experiences, though always verify information through official sources.\"},\"id\":\"pusw144ai9btiv1rsi1c4m\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "category": [
- "Immigration Policy Updates"
- ],
- "tags": [
- "VisaUpdates"
- ],
- "author": "Admin",
- "status": "published",
- "publishedAt": "11 March 2025",
- "isFeatured": false,
- "featuredImage": "img/inner-page/news-details/details-1.jpg",
- "galleryImages": [
- "img/inner-page/news-details/details-2.jpg",
- "img/inner-page/news-details/details-3.jpg"
- ],
- "quote": "Staying updated with immigration policy changes is crucial. What worked for a friend last year might not work for you today. Always check the latest official requirements before starting your application.",
- "contentAfterQuote": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"The immigration landscape is constantly evolving, and what seems like a minor policy change can have significant implications for your application. By staying informed, you can position yourself to take advantage of new opportunities, avoid unexpected complications, and make decisions based on current information rather than outdated advice. Consider setting up alerts for immigration news, following official government social media accounts, and maintaining relationships with immigration professionals who can provide timely updates relevant to your situation.\"},\"id\":\"7g4tsxxpuokxvk6a6zk4z\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "commentsCount": 0
- },
- {
- "title": "Top Countries for Higher Education in 2025",
- "slug": "top-countries-for-higher-education-in-2025",
- "excerpt": "Discover the best countries for international students seeking quality higher education, excellent career opportunities, and a vibrant cultural experience.",
- "content": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"Choosing the right country for higher education is one of the most important decisions you'll make, as it will shape not only your academic experience but also your career prospects, personal growth, and potentially your future residency options. With so many excellent destinations available, understanding what each country offers can help you make an informed choice that aligns with your academic goals, career aspirations, financial situation, and personal preferences.\"},\"id\":\"ke56l2vnpoxsu9ejzes1\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Canada continues to rank among the top destinations for international students, and for good reason. The country offers world-class universities, a welcoming multicultural environment, and excellent post-graduation work opportunities. Canadian institutions are known for their high academic standards, innovative research programs, and strong connections to industry. The Post-Graduation Work Permit Program allows graduates to work in Canada for up to three years, providing valuable experience and a pathway to permanent residency through programs like Express Entry. Additionally, Canada's quality of life, safety, and natural beauty make it an attractive destination for students seeking both academic excellence and a high standard of living.\"},\"id\":\"cbmaakecfle5a1doh31\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Australia has long been a favorite destination for international students, offering a combination of excellent education, beautiful landscapes, and a relaxed lifestyle. Australian universities consistently rank among the world's best, with particular strengths in fields like engineering, medicine, business, and environmental sciences. The country's Temporary Graduate visa allows students to stay and work after graduation, and Australia's skilled migration programs offer clear pathways to permanent residency for graduates in high-demand fields. The country's diverse culture, English-speaking environment, and strong support services for international students make it an appealing choice for many.\"},\"id\":\"essd9f5cpcsuxec94e5tkn\"},{\"type\":\"header\",\"data\":{\"text\":\"United Kingdom and European Options\",\"level\":3},\"id\":\"ceelpgrt3esq8gtzplp1j\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"The United Kingdom remains a prestigious destination for higher education, home to some of the world's most renowned universities including Oxford, Cambridge, and Imperial College London. While Brexit has brought changes to visa requirements and fees, the UK still offers excellent educational opportunities and a rich cultural experience. The Graduate Route visa allows international students to stay and work for up to two years after graduation, providing opportunities to gain work experience and potentially transition to longer-term visas. The UK's historical significance, cultural richness, and proximity to Europe continue to attract students despite higher costs.\"},\"id\":\"k5vk97gasfr77hx7bc4b2d\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Germany has emerged as an increasingly popular destination, particularly for students interested in engineering, technology, and sciences. One of the most attractive aspects of studying in Germany is that many public universities charge no or very low tuition fees, even for international students. This makes high-quality education accessible to a broader range of students. Germany's strong economy, excellent job prospects for graduates, and central location in Europe make it an attractive option. The country also offers good post-graduation work opportunities and pathways to permanent residency for skilled professionals.\"},\"id\":\"yqtv8cn100m4009o2koqn8\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"The United States continues to attract the largest number of international students globally, offering unparalleled diversity in educational institutions, programs, and opportunities. From prestigious Ivy League universities to innovative state schools and specialized institutions, the US provides options for every academic interest and budget. The Optional Practical Training program allows graduates to work for up to three years in their field of study, and the country's strong economy offers excellent career prospects. However, the US also has higher costs and more complex visa processes compared to some other destinations.\"},\"id\":\"4ljwyb5qjjia67yt22vj0k\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Other notable destinations include the Netherlands, known for its innovative teaching methods and strong English-taught programs; New Zealand, offering excellent quality of life and post-graduation work rights; and Singapore, a hub for business and technology education in Asia. Each country offers unique advantages, whether it's lower costs, specific academic strengths, cultural experiences, or post-graduation opportunities.\"},\"id\":\"9hr4duci0phubgfs9otf28\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"When choosing a country, consider factors beyond just university rankings. Think about language requirements, cost of living, climate, cultural fit, post-graduation work rights, pathways to permanent residency, and your long-term career goals. Research scholarship opportunities, as many countries offer financial support for international students. Consider the support services available for international students, including orientation programs, career services, and cultural integration support. Ultimately, the best country for you is one that offers the right combination of academic excellence, career opportunities, cultural fit, and personal growth experiences that align with your goals and values.\"},\"id\":\"z7mdlruj78qy4ux15skdvh\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "category": [
- "Scholarships & Grants"
- ],
- "tags": [
- "StudentVisa",
- "StudyAbroad"
- ],
- "author": "Admin",
- "status": "published",
- "publishedAt": "March 26, 2025",
- "isFeatured": false,
- "featuredImage": "img/inner-page/news-details/details-1.jpg",
- "galleryImages": [
- "img/inner-page/news-details/details-2.jpg",
- "img/inner-page/news-details/details-3.jpg"
- ],
- "quote": "Choosing Canada for my studies was the best decision I've made. The quality of education, post-graduation opportunities, and welcoming environment exceeded all my expectations.",
- "contentAfterQuote": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"Remember that the best country for higher education is ultimately the one that aligns with your personal goals, values, and circumstances. While rankings and statistics provide valuable information, your personal fit with the academic culture, lifestyle, and opportunities in each country matters just as much. Take time to research thoroughly, speak with current students or alumni if possible, and consider visiting your top choices before making a final decision. Your education abroad is not just about obtaining a degree—it's about personal growth, cultural immersion, and building a foundation for your future career.\"},\"id\":\"qfj5mdgc9dgpfxsngtvgis\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "commentsCount": 0
- },
- {
- "title": "The Benefits of Hiring a Visa Consultant",
- "slug": "the-benefits-of-hiring-a-visa-consultant",
- "excerpt": "Learn how professional visa consultants can help streamline your application process, increase approval chances, and save you time and stress.",
- "content": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"Navigating the visa application process can be overwhelming, with complex requirements, extensive documentation, and high stakes. While it's possible to complete visa applications independently, hiring a professional visa consultant can provide significant advantages that often justify the investment. Understanding these benefits can help you decide whether professional assistance is right for your situation.\"},\"id\":\"f3xxdhe7c5r7142d9pf4wt\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"One of the most valuable benefits of working with a visa consultant is their expert knowledge and experience. Professional consultants have extensive experience with various visa types, understand the nuances of different requirements, and stay current with frequently changing policies and regulations. They've seen countless applications, understand what works and what doesn't, and can identify potential issues before they become problems. This expertise is particularly valuable for complex cases, previous rejections, or situations that don't fit standard application patterns. Consultants can help you understand which visa type is best for your situation, identify alternative pathways you might not have considered, and develop a strategic approach to your application.\"},\"id\":\"yp60oe9uvc8avg33hha4i\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Consultants also provide significant time savings. The visa application process involves extensive research, document gathering, form completion, and coordination of multiple steps. A consultant can handle much of this work for you, allowing you to focus on other important aspects of your preparation, such as language tests, financial planning, or career preparation. They know exactly what documents are needed, where to get them, how they should be formatted, and what certifications are required. This efficiency can be particularly valuable if you're working full-time, have family responsibilities, or are dealing with tight deadlines.\"},\"id\":\"jhemwk6ts67kf7mqxl2b8\"},{\"type\":\"header\",\"data\":{\"text\":\"Increased Approval Chances\",\"level\":3},\"id\":\"ejfit80gosiz1bvxmsc4ks\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Perhaps the most important benefit is the potential to significantly increase your chances of approval. Consultants understand common reasons for rejections and can help you avoid these pitfalls. They review your application thoroughly before submission, identifying inconsistencies, missing information, or weak points that could cause problems. They can help you strengthen your application by highlighting your strongest qualifications, addressing potential concerns proactively, and ensuring all requirements are met comprehensively. For applications that require interviews, consultants provide valuable preparation and coaching that can make a significant difference in the outcome.\"},\"id\":\"483m12cv2j4tmwgk8rk7fi\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Professional consultants also provide peace of mind during what can be an anxiety-inducing process. Having an expert guide you through each step, answer your questions promptly, and provide reassurance when you're uncertain can significantly reduce stress. They serve as a reliable point of contact who understands your situation and can provide support throughout the process. This emotional support can be particularly valuable when dealing with language barriers, cultural differences, or when you're feeling overwhelmed by the complexity of the process.\"},\"id\":\"cp7y1tb5ihwi1yxvxqzjm\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Consultants can also help you save money in the long run. While there's an upfront cost to hiring a consultant, their expertise can help you avoid costly mistakes that could lead to rejections, delays, or the need to reapply. A rejected application often means losing application fees, time, and potentially missing important deadlines. Consultants can help you get it right the first time, potentially saving you significant money and time. They can also help you identify cost-saving opportunities, such as fee waivers or programs with lower costs that might be suitable for your situation.\"},\"id\":\"lempi5u2ogmoap6wxc1v6\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"When complications arise, consultants are invaluable in helping you navigate challenges. Whether you've received a request for additional information, faced a rejection, or encountered unexpected delays, consultants can help you understand what went wrong, develop a strategy to address the issue, and guide you through appeals or reapplication processes. They understand the system, know how to communicate effectively with immigration authorities, and can advocate on your behalf when necessary.\"},\"id\":\"t30n1u7ixxq14eyr8be9ytg\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"However, it's important to choose your consultant carefully. Look for licensed, registered, or certified consultants with proven track records. Check their credentials, read reviews from previous clients, and ensure they have experience with your specific visa type and destination country. Be wary of consultants who make unrealistic promises or charge fees that seem too good to be true. A reputable consultant will provide honest assessments, clear fee structures, and realistic expectations about your chances of success. Remember that while consultants can significantly improve your chances, they cannot guarantee approval, as final decisions rest with immigration authorities.\"},\"id\":\"554es8szzl5gxcx6sbqltq\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "category": [
- "Visa Interview Preparation"
- ],
- "tags": [
- "WorkVisa",
- "StudentVisa",
- "TravelVisa"
- ],
- "author": "Admin",
- "status": "published",
- "publishedAt": "March 26, 2025",
- "isFeatured": false,
- "featuredImage": "img/inner-page/news-details/details-1.jpg",
- "galleryImages": [
- "img/inner-page/news-details/details-2.jpg",
- "img/inner-page/news-details/details-3.jpg"
- ],
- "quote": "Hiring a visa consultant was worth every penny. They caught several potential issues in my application that I would have missed, and their interview preparation gave me the confidence I needed to succeed.",
- "contentAfterQuote": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"The decision to hire a consultant is a personal one that depends on your circumstances, confidence level, and the complexity of your case. For straightforward applications with clear requirements, you may feel comfortable proceeding independently. However, for complex cases, previous rejections, or when the stakes are particularly high, professional guidance can provide invaluable peace of mind and significantly improve your chances of success. Remember that consultants are not just for fixing problems—they can also help you optimize your application from the start, potentially saving you time and money in the long run.\"},\"id\":\"hwjv6r2pw7e3k3dgml07w8\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "commentsCount": 0
- },
- {
- "title": "How to Prepare for Your Immigration Interview",
- "slug": "how-to-prepare-for-your-immigration-interview",
- "excerpt": "Essential tips and strategies to help you prepare effectively for your immigration interview and increase your chances of success.",
- "content": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"The immigration interview is often the final and most critical step in the visa application process. This face-to-face meeting with an immigration officer can determine whether your application is approved or denied, making thorough preparation essential. While the thought of an interview can be nerve-wracking, understanding what to expect and preparing effectively can significantly increase your confidence and chances of success.\"},\"id\":\"ax5rxel90hnzhdn42am31\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"The first step in preparing for your immigration interview is understanding its purpose. Immigration officers conduct interviews to verify the information in your application, assess your genuine intentions, evaluate your eligibility, and ensure you meet all requirements. They want to confirm that you're a legitimate applicant with honest intentions, sufficient financial resources, and a clear purpose for your visit or stay. Understanding this purpose helps you prepare appropriate responses and present yourself in a way that addresses their concerns effectively.\"},\"id\":\"28jbvdmn25mtexgaky85t\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Thoroughly reviewing your application is crucial. You should be able to recall and discuss every detail in your application confidently and accurately. Immigration officers may ask about any information you've provided, including dates, addresses, employment history, educational background, financial details, or travel history. Inconsistencies between your interview responses and your application can raise red flags and lead to suspicion. Review your application multiple times, create notes or flashcards if needed, and practice explaining key aspects of your application clearly and concisely.\"},\"id\":\"ouxn8jhxg2ev1z3bn0sw\"},{\"type\":\"header\",\"data\":{\"text\":\"Document Preparation\",\"level\":3},\"id\":\"aruay0fj66frn3ih2bund\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Organizing your documents is another critical aspect of preparation. Bring all original documents that support your application, including passports, birth certificates, educational certificates, employment letters, bank statements, accommodation confirmations, and any other relevant paperwork. Organize these documents in a logical order, perhaps using a folder with tabs or dividers, so you can quickly locate any document the officer requests. Bring multiple copies of important documents, as officers may want to keep copies. Ensure all documents are current, properly certified or notarized where required, and in good condition.\"},\"id\":\"6sk73b4cyo9gi6crl1srg9\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Practicing common interview questions is essential for building confidence and ensuring you can provide clear, concise, and accurate responses. Common questions include: Why do you want to visit or study in this country? What are your plans during your stay? How will you support yourself financially? What ties do you have to your home country? What are your long-term goals? Practice answering these questions out loud, either alone or with a friend or family member. Focus on being clear, honest, and concise. Avoid memorizing scripted answers, as they can sound rehearsed and insincere. Instead, understand the key points you want to convey and practice expressing them naturally.\"},\"id\":\"wznskp0c9o5ghdcju23le\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Preparing for potential difficult questions is also important. Officers may ask about gaps in your employment history, previous visa rejections, criminal records, or other sensitive topics. Prepare honest, clear explanations for any potential concerns. If you have a previous rejection, be ready to explain what changed or how you've addressed the previous concerns. If you have employment gaps, prepare a clear explanation. Honesty is crucial, as providing false information can have serious consequences, including permanent bans from entering the country.\"},\"id\":\"hgkebxp228iz8ynej9vjh\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"Dress professionally and appropriately for your interview. While you don't need to wear formal business attire, you should present yourself in a clean, neat, and professional manner. Your appearance creates a first impression and demonstrates that you take the process seriously. Arrive early to allow time for security checks, finding the correct office, and settling your nerves. Being late can create a negative impression and add unnecessary stress.\"},\"id\":\"8t1otteynk49qyxpsfsal\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"During the interview, maintain eye contact, speak clearly and confidently, and listen carefully to questions before responding. Take your time to think before answering if needed, as it's better to provide a thoughtful response than a rushed one. Be honest and straightforward, avoiding unnecessary details that might confuse or raise additional questions. If you don't understand a question, politely ask for clarification rather than guessing what was asked. Stay calm and composed, even if you feel nervous, as confidence and composure can positively influence the officer's assessment.\"},\"id\":\"olu57x72rc8jvyw8dx88f\"},{\"type\":\"paragraph\",\"data\":{\"text\":\"After the interview, follow any instructions provided by the officer, such as submitting additional documents or checking your application status online. Be patient, as processing times can vary. If your application is approved, congratulations! If it's not approved, try to understand the reasons provided, as this information can be valuable if you decide to reapply or appeal the decision.\"},\"id\":\"35ob7d2olnfj6vdojrid4q\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "category": [
- "Visa Interview Preparation"
- ],
- "tags": [
- "WorkVisa",
- "StudentVisa",
- "FamilyVisa"
- ],
- "author": "Admin",
- "status": "published",
- "publishedAt": "March 26, 2025",
- "isFeatured": false,
- "featuredImage": "img/inner-page/news-details/details-1.jpg",
- "galleryImages": [
- "img/inner-page/news-details/details-2.jpg",
- "img/inner-page/news-details/details-3.jpg"
- ],
- "quote": "Preparation is everything. I spent weeks practicing interview questions and organizing my documents, and it made all the difference. The officer could tell I was well-prepared and confident.",
- "contentAfterQuote": "{\"blocks\":[{\"type\":\"paragraph\",\"data\":{\"text\":\"Remember that the interview is your opportunity to bring your application to life and demonstrate your genuine intentions. While thorough preparation is essential, also remember to be yourself and answer questions honestly and naturally. The immigration officer wants to see a real person with legitimate goals, not a rehearsed script. Approach the interview with confidence, respect, and clarity, and you'll be well-positioned for success. If you're well-prepared, organized, and genuine, you've done everything you can to present your best case.\"},\"id\":\"vuekmo28aygrpghckin3ei\"}],\"time\":1770262297199,\"version\":\"2.28.2\"}",
- "commentsCount": 0
- }
- ],
- "recentPosts": [
- {
- "title": "Top Countries for Higher Education in 2025",
- "slug": "top-countries-for-higher-education-in-2025",
- "thumbnail": "img/inner-page/news-details/post-1.jpg",
- "publishedAt": "March 26, 2025"
- },
- {
- "title": "The Benefits of Hiring a Visa Consultant",
- "slug": "the-benefits-of-hiring-a-visa-consultant",
- "thumbnail": "img/inner-page/news-details/post-2.jpg",
- "publishedAt": "March 26, 2025"
- },
- {
- "title": "How to Prepare for Your Immigration Interview",
- "slug": "how-to-prepare-for-your-immigration-interview",
- "thumbnail": "img/inner-page/news-details/post-3.jpg",
- "publishedAt": "March 26, 2025"
- }
- ],
- "comments": [
- {
- "postSlug": "work-visa-vs-student-visa-which-is-right-for-you",
- "authorName": "Frank Flores",
- "authorAvatar": "img/inner-page/news-details/comment-1.png",
- "content": "This article was incredibly helpful in clarifying the differences between work and student visas. I've been struggling to decide which path to take, and the detailed comparison of financial requirements, career implications, and long-term goals really helped me understand what's best for my situation. The section on post-graduation work permits was particularly insightful.",
- "createdAt": "February 10, 2024",
- "status": "approved",
- "parentAuthorName": null
- },
- {
- "postSlug": "work-visa-vs-student-visa-which-is-right-for-you",
- "authorName": "Charlie Tushar",
- "authorAvatar": "img/inner-page/news-details/comment-2.png",
- "content": "As someone who went through both processes, I can confirm that this article accurately captures the key considerations. I started with a student visa and later transitioned to a work visa, and the article's explanation of how these pathways can complement each other is spot on. Great resource for anyone making this important decision.",
- "createdAt": "February 10, 2024",
- "status": "approved",
- "parentAuthorName": null
- },
- {
- "postSlug": "work-visa-vs-student-visa-which-is-right-for-you",
- "authorName": "Fatma Sariqul",
- "authorAvatar": "img/inner-page/news-details/comment-3.png",
- "content": "I completely agree with Frank's comment. The financial planning section was especially valuable. I wish I had read this before starting my application process. The article does a great job of explaining not just the differences, but also the practical implications of each choice.",
- "createdAt": "February 10, 2024",
- "status": "approved",
- "parentAuthorName": "Frank Flores"
- }
- ]
-}
\ No newline at end of file
diff --git a/data/booking.json b/data/booking.json
deleted file mode 100644
index ccb2965..0000000
--- a/data/booking.json
+++ /dev/null
@@ -1,690 +0,0 @@
-{
- "hero": {
- "title": "Booking",
- "backgroundImage": "/uploads/booking/b13.jpg"
- },
- "searchBar": {
- "locationLabel": "Location",
- "holidaySeasonLabel": "Holiday Season",
- "searchButtonText": "Search"
- },
- "filterPanel": {
- "title": "FIND YOUR CAMP!",
- "priceTitle": "Price",
- "priceLabel": "Maximum Price (USD)",
- "pricePlaceholder": "Enter max price",
- "priceMin": 0,
- "priceMax": 2000,
- "activitiesTitle": "Activities",
- "ageTitle": "AGE",
- "ageSelectPlaceholder": "Select age",
- "ageMin": 7,
- "ageMax": 18,
- "ratingTitle": "RATING WISE",
- "ratingOptions": [
- { "value": "", "label": "All Ratings" },
- { "value": "5", "label": "5 Stars" },
- { "value": "4", "label": "4 Stars & Up" },
- { "value": "3", "label": "3 Stars & Up" },
- { "value": "2", "label": "2 Stars & Up" },
- { "value": "1", "label": "1 Star & Up" }
- ],
- "resetButtonText": "Reset"
- },
- "programs": [
- { "value": "adventure", "label": "Adventure, Sports & Creative" },
- { "value": "arts-crafts", "label": "Arts & Crafts" },
- { "value": "climbing", "label": "Climbing" },
- { "value": "dancing", "label": "Dancing" },
- { "value": "diving", "label": "Diving" },
- { "value": "englisch-camps", "label": "Englischcamps" },
- { "value": "englisch-toefl", "label": "Englisch TOEFL©" },
- { "value": "fishing", "label": "Fishing" },
- { "value": "german-camps", "label": "German Camps" },
- { "value": "horseback", "label": "Horseback Riding" },
- { "value": "husky", "label": "Husky Camp" },
- { "value": "icit", "label": "International Counsellor in Training (ICIT)" },
- { "value": "lifeguarding", "label": "Lifeguarding" },
- { "value": "language", "label": "Language" },
- { "value": "leadership", "label": "Leadership" },
- { "value": "multi-water", "label": "Multi Water Adventure" },
- { "value": "sailing", "label": "Sailing" },
- { "value": "skating", "label": "Skating" },
- { "value": "soccer", "label": "Soccer" },
- { "value": "space", "label": "Space Exploration" },
- { "value": "spanish", "label": "Spanishcourse" },
- { "value": "survival", "label": "Survival" },
- { "value": "swimming", "label": "Swimming" },
- { "value": "tennis", "label": "Tennis" },
- { "value": "windsurf", "label": "Windsurfing" }
- ],
- "holidays": [
- { "value": "autumn", "label": "Autumn" },
- { "value": "spring", "label": "Spring" },
- { "value": "summer", "label": "Summer" }
- ],
- "locations": [
- { "value": "philippines", "label": "Philippines" },
- { "value": "vietnam", "label": "Vietnam" },
- { "value": "portugal", "label": "Portugal" },
- { "value": "china", "label": "China" },
- { "value": "thailand", "label": "Thailand" },
- { "value": "malaysia", "label": "Malaysia" },
- { "value": "holiday", "label": "Holiday" }
- ],
- "camps": [
- {
- "name": "Adventure, Sports & Creative",
- "price": 395,
- "priceText": "from 395 USD",
- "season": ["spring", "summer", "autumn"],
- "age": [12, 18],
- "locations": ["thailand"],
- "image": "/uploads/booking/00_Abenteuercamp-Hike-533b20fa.jpg",
- "link": "/activities/adventure-sports-creative",
- "program": "adventure",
- "rating": 5
- },
- {
- "name": "Arts & Crafts",
- "price": 500,
- "priceText": "from 500 USD",
- "season": ["spring", "summer", "autumn"],
- "age": [12, 18],
- "locations": ["vietnam"],
- "image": "/uploads/booking/01-Kreativprogramm-in-der-Ferienfreizeit-c6e95722.jpg",
- "link": "/activities/arts-crafts",
- "program": "arts-crafts",
- "rating": 4
- },
- {
- "name": "Climbing",
- "price": 515,
- "priceText": "from 515 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["philippines"],
- "image": "/uploads/booking/00-Kletterkurs_Sommercamp_Bayern-40f1bd8d.jpg",
- "link": "/activities/climbing",
- "program": "climbing",
- "rating": 5
- },
- {
- "name": "Dancing",
- "price": 520,
- "priceText": "from 520 USD",
- "season": ["summer", "autumn"],
- "age": [12, 18],
- "locations": ["malaysia"],
- "image": "/uploads/booking/00-Tanzen-im-Feriencamp-c1834fc7.jpg",
- "link": "/activities/dancing",
- "program": "dancing",
- "rating": 4
- },
- {
- "name": "Diving",
- "price": 1190,
- "priceText": "from 1190 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["philippines"],
- "image": "/uploads/booking/01-Tauchkurs-im-Sommercamp-3309e219.jpg",
- "link": "/activities/diving",
- "program": "diving",
- "rating": 5
- },
- {
- "name": "Englisch TOEFL®",
- "price": 1290,
- "priceText": "from 1290 USD",
- "season": ["spring", "summer"],
- "age": [12, 18],
- "locations": ["malaysia"],
- "image": "/uploads/booking/07-Language-Camps-by-Camp-Adventure-b9f01b6a.jpg",
- "link": "/activities/englisch-toefl",
- "program": "englisch-toefl",
- "rating": 5
- },
- {
- "name": "Englischcamps",
- "price": 530,
- "priceText": "from 530 USD",
- "season": ["spring", "summer", "autumn"],
- "age": [12, 18],
- "locations": ["philippines", "thailand"],
- "image": "/uploads/booking/00-Language-Camps-by-Camp-Adventure-add7aa60.jpg",
- "link": "/activities/englischcamps",
- "program": "englisch-camps",
- "rating": 4
- },
- {
- "name": "Fishing",
- "price": 580,
- "priceText": "from 580 USD",
- "season": ["spring", "summer", "autumn"],
- "age": [12, 18],
- "locations": ["vietnam"],
- "image": "/uploads/booking/01-Angeln-im-Ferienlager-02243939.jpg",
- "link": "/activities/fishing",
- "program": "fishing",
- "rating": 4
- },
- {
- "name": "German Camps",
- "price": 610,
- "priceText": "from 610 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["thailand", "vietnam"],
- "image": "/uploads/booking/Deutschcamps-in-Deutschland-0ed3ea07.jpg",
- "link": "/activities/german-camps",
- "program": "german-camps",
- "rating": 4
- },
- {
- "name": "Horseback Riding",
- "price": 620,
- "priceText": "from 620 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["portugal"],
- "image": "/uploads/booking/00-Reiten-Sommercamp-Ausritt-6930f841.jpg",
- "link": "/activities/horseback-riding",
- "program": "horseback",
- "rating": 5
- },
- {
- "name": "Husky Camp",
- "price": 525,
- "priceText": "from 525 USD",
- "season": ["spring", "summer", "autumn"],
- "age": [12, 18],
- "locations": ["china"],
- "image": "/uploads/booking/00-Husky20Camp_sommercamp20mit20Hunden-9c098a17.jpg",
- "link": "/activities/husky-camp",
- "program": "husky",
- "rating": 5
- },
- {
- "name": "International Counsellor in Training (ICIT)",
- "price": 995,
- "priceText": "from 995 USD",
- "season": ["summer"],
- "age": [16, 18],
- "locations": ["thailand", "malaysia"],
- "image": "/uploads/booking/00-INTERNATIONAL20COUNSELOR20IN20TRAINING_teambuilding-3b91547c.jpg",
- "link": "/activities/international-counsellor-in-training-icit",
- "program": "icit",
- "rating": 5
- },
- {
- "name": "Leadership",
- "price": 1185,
- "priceText": "from 1185 USD",
- "season": ["summer"],
- "age": [16, 18],
- "locations": ["philippines"],
- "image": "/uploads/booking/00-Leadership-Camp-0d21c60a.jpg",
- "link": "/activities/senior-plus-leadership",
- "program": "leadership",
- "rating": 5
- },
- {
- "name": "Lifeguarding",
- "price": 580,
- "priceText": "from 580 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["malaysia"],
- "image": "/uploads/booking/00-Rettungsschwimmen-Feriencamp-6a364891.jpg",
- "link": "/activities/lifeguarding",
- "program": "lifeguarding",
- "rating": 4
- },
- {
- "name": "Multi Water Adventure",
- "price": 990,
- "priceText": "from 990 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["philippines"],
- "image": "/uploads/booking/00-Multi-Water-Adventure-im-Sommercamp-a47c08a3.jpg",
- "link": "/activities/multi-water-adventure",
- "program": "multi-water",
- "rating": 1
- },
- {
- "name": "Sailing",
- "price": 990,
- "priceText": "from 990 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["thailand"],
- "image": "/uploads/booking/01-Segeln-im-Sommercamp-in-Spanien-e9d06b28.jpg",
- "link": "/activities/sailing",
- "program": "sailing",
- "rating": 2
- },
- {
- "name": "Skating",
- "price": 420,
- "priceText": "from 420 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["vietnam"],
- "image": "/uploads/booking/00-Skaten im Sommercamp-8240a4c7.jpg",
- "link": "/activities/skating",
- "program": "skating",
- "rating": 3
- },
- {
- "name": "Soccer",
- "price": 495,
- "priceText": "from 495 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["malaysia"],
- "image": "/uploads/booking/00-Soccer-Camps-543a1625.jpg",
- "link": "/activities/soccer",
- "program": "soccer",
- "rating": 3
- },
- {
- "name": "Space Exploration",
- "price": 595,
- "priceText": "from 595 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["china"],
- "image": "/uploads/booking/00-Space-Exploration-Sommer-Camp-599962e5.jpg",
- "link": "/activities/space-exploration",
- "program": "space",
- "rating": 4
- },
- {
- "name": "Spanish Camps",
- "price": 595,
- "priceText": "from 595 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["portugal"],
- "image": "/uploads/booking/Spanischcamp-in-Spanien-d118b0e9.jpg",
- "link": "/activities/spanish-camps",
- "program": "spanish",
- "rating": 4
- },
- {
- "name": "Survival",
- "price": 495,
- "priceText": "from 495 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["vietnam"],
- "image": "/uploads/booking/03-Walsrode-Survival-e00c16d7.jpg",
- "link": "/activities/survival",
- "program": "survival",
- "rating": 4
- },
- {
- "name": "Swimming",
- "price": 495,
- "priceText": "from 495 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["philippines"],
- "image": "/uploads/booking/Schwimmen_camp-98f48b76.jpg",
- "link": "/activities/swimming",
- "program": "swimming",
- "rating": 4
- },
- {
- "name": "Tennis",
- "price": 495,
- "priceText": "from 495 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["malaysia"],
- "image": "/uploads/booking/00-Tenniscamp-57cd2c79.jpg",
- "link": "/activities/tennis",
- "program": "tennis",
- "rating": 4
- },
- {
- "name": "Windsurfing",
- "price": 990,
- "priceText": "from 990 USD",
- "season": ["summer"],
- "age": [12, 18],
- "locations": ["thailand"],
- "image": "/uploads/booking/00-Windsurfen-im-Sommercamp-ac31b126.jpg",
- "link": "/activities/windsurfing",
- "program": "windsurf",
- "rating": 5
- }
- ],
- "formSteps": [
- {
- "step": 1,
- "title": "Participant Information",
- "sections": [
- {
- "id": "logistics",
- "fields": [
- {
- "name": "accommodation",
- "label": "Accommodation",
- "type": "select",
- "required": true,
- "options": [
- {
- "value": "a1",
- "label": "Accommodation in tiny houses/huts in the Adventure Camp",
- "price": 10
- }
- ]
- },
- {
- "name": "transferTo",
- "label": "Getting there",
- "type": "select",
- "required": true,
- "options": [
- {
- "value": "3",
- "label": "Self-organized Arrival (4-6 pm)",
- "price": 0
- },
- {
- "value": "351",
- "label": "Shuttle Plattling - Meeting Point: Train Station platform 5 (at 3:30 pm)",
- "price": 45
- }
- ]
- },
- {
- "name": "transferFrom",
- "label": "Departure",
- "type": "select",
- "required": true,
- "options": [
- {
- "value": "3",
- "label": "Self-organized Pick-up",
- "price": 0
- },
- {
- "value": "351",
- "label": "Shuttle Plattling - Train Station",
- "price": 45
- }
- ]
- },
- {
- "name": "activities",
- "label": "Activity Profile",
- "type": "select",
- "required": true,
- "options": [
- {
- "value": "195",
- "label": "Adventure, Sports and Creative (Basic profile)",
- "price": 0
- }
- ]
- },
- {
- "name": "addons",
- "label": "Additional addons",
- "type": "checkbox-group",
- "required": false,
- "options": [
- {
- "value": "8",
- "label": "Travel Cancellation Guarantee (one week)",
- "price": 45
- }
- ]
- }
- ]
- },
- {
- "id": "personal_details",
- "fields": [
- {
- "name": "firstName",
- "label": "First name",
- "type": "text",
- "required": true
- },
- {
- "name": "lastName",
- "label": "Last name",
- "type": "text",
- "required": true
- },
- {
- "name": "birthday",
- "label": "Birthday",
- "type": "date",
- "required": true
- },
- {
- "name": "gender",
- "label": "Gender",
- "type": "select",
- "required": true,
- "options": [
- {
- "value": "female",
- "label": "Female"
- },
- {
- "value": "male",
- "label": "Male"
- },
- {
- "value": "divers",
- "label": "Non binary"
- }
- ]
- },
- {
- "name": "nationality",
- "label": "Nationality",
- "type": "select",
- "required": true,
- "options": [
- {
- "value": "Germany",
- "label": "Germany"
- },
- {
- "value": "United States",
- "label": "United States"
- },
- {
- "value": "United Kingdom",
- "label": "United Kingdom"
- },
- {
- "value": "France",
- "label": "France"
- },
- {
- "value": "Spain",
- "label": "Spain"
- }
- ]
- },
- {
- "name": "lodgingPartner",
- "label": "Lodging partner",
- "type": "text",
- "required": false
- }
- ]
- }
- ]
- },
- {
- "step": 2,
- "title": "Guardian Information",
- "sections": [
- {
- "id": "guardian_details",
- "fields": [
- {
- "name": "customerGender",
- "label": "Salutation",
- "type": "select",
- "required": false,
- "options": [
- {
- "value": "female",
- "label": "Mrs"
- },
- {
- "value": "male",
- "label": "Mr"
- },
- {
- "value": "divers",
- "label": "Non binary"
- }
- ]
- },
- {
- "name": "customerFirstName",
- "label": "First name",
- "type": "text",
- "required": true
- },
- {
- "name": "customerLastName",
- "label": "Last name",
- "type": "text",
- "required": true
- },
- {
- "name": "customerEmail",
- "label": "E-Mail",
- "type": "email",
- "required": true
- },
- {
- "name": "customerPhone",
- "label": "Phone",
- "type": "tel",
- "required": true
- },
- {
- "name": "customerStreet",
- "label": "Street & Number",
- "type": "text",
- "required": true
- },
- {
- "name": "customerZip",
- "label": "Zip",
- "type": "text",
- "required": true
- },
- {
- "name": "customerCity",
- "label": "City",
- "type": "text",
- "required": true
- },
- {
- "name": "customerCountry",
- "label": "Country",
- "type": "select",
- "required": true,
- "options": [
- {
- "value": "Germany",
- "label": "Germany"
- },
- {
- "value": "United States",
- "label": "United States"
- },
- {
- "value": "United Kingdom",
- "label": "United Kingdom"
- },
- {
- "value": "France",
- "label": "France"
- },
- {
- "value": "Spain",
- "label": "Spain"
- }
- ]
- }
- ]
- }
- ]
- }
- ],
- "validation": {
- "step1Required": [
- "accommodation",
- "transferTo",
- "transferFrom",
- "activities",
- "firstName",
- "lastName",
- "birthday",
- "gender",
- "nationality"
- ],
- "step2Required": [
- "customerFirstName",
- "customerLastName",
- "customerEmail",
- "customerPhone",
- "customerStreet",
- "customerZip",
- "customerCity",
- "customerCountry"
- ]
- },
- "configuration": {
- "currency": "USD",
- "discounts": [
- {
- "id": "915",
- "name": "Sibling or Returning Camper Discount",
- "type": "percentage",
- "value": 0.05,
- "description": "This discount is granted if your child has attended a Camp Adventure program before or if you register siblings."
- },
- {
- "id": "9152",
- "name": "Sibling or Returning Camper Discount",
- "type": "percentage",
- "value": 0.05,
- "description": "This discount is granted if your child has attended a Camp Adventure program before or if you register siblings."
- }
- ],
- "vouchers": [
- {
- "validCodes": "SUMMER2026",
- "type": "percentage",
- "value": 0.1
- },
- {
- "validCodes": "SUMMER2027",
- "type": "percentage",
- "value": 0.05
- },
- {
- "validCodes": "CAMP50",
- "type": "fixed",
- "value": 50
- }
- ]
- }
-}
diff --git a/data/contact.json b/data/contact.json
deleted file mode 100644
index 474c9e1..0000000
--- a/data/contact.json
+++ /dev/null
@@ -1,119 +0,0 @@
-{
- "hero": {
- "title": "CONTACT US",
- "backgroundImage": "/assets/img/inner-page/breadcrumb.jpg",
- "overlayColor": "rgba(0, 0, 0, 0)",
- "sectionClass": "breadcrumb-wrapper fix bg-cover",
- "titleClass": "breadcrumb-title",
- "enableScrollspy": false,
- "backgroundPosition": "center"
- },
- "contactCards": [
- {
- "type": "location",
- "title": "Location",
- "content": [
- "43 Sardinella, 3nd Land Walk,",
- "Orchard view, London, UK"
- ],
- "iconType": "fa-solid fa-location-dot",
- "iconSource": "fontawesome"
- },
- {
- "type": "email",
- "title": "Email Address",
- "content": [
- "supportinfo@gmail.com",
- "arluxhotelinfo.com"
- ],
- "iconType": "fa-solid fa-envelope",
- "iconSource": "fontawesome"
- },
- {
- "type": "phone",
- "title": "Phone Number",
- "content": [
- "+880 123 427 00",
- "+000 938 809 12"
- ],
- "iconType": "fa-solid fa-phone",
- "iconSource": "fontawesome"
- }
- ],
- "map": {
- "coordinates": {
- "lat": -37.81450084255415,
- "lng": 144.9618311901502
- },
- "zoom": 15,
- "location": "Envato, Melbourne, Australia",
- "markerTitle": "Our Office",
- "embedUrl": "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6678.7619084840835!2d144.9618311901502!3d-37.81450084255415!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6ad642b4758afc1d%3A0x3119cc820fdfc62e!2sEnvato!5e0!3m2!1sen!2sbd!4v1641984054261!5m2!1sen!2sbd",
- "tileLayer": {
- "url": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
- "attribution": "",
- "maxZoom": 18,
- "minZoom": 0
- }
- },
- "form": {
- "sectionLabel": "",
- "heading": "Send Us Message",
- "description": "Have questions about visas or immigration? Send us a message today and our expert team will respond quickly.",
- "fields": [
- {
- "name": "name",
- "label": "Your Name",
- "type": "text",
- "placeholder": "Your name",
- "required": true,
- "colClass": "col-lg-4"
- },
- {
- "name": "email",
- "label": "Your Email",
- "type": "email",
- "placeholder": "Your email",
- "required": true,
- "colClass": "col-lg-4"
- },
- {
- "name": "phone",
- "label": "Your Phone",
- "type": "tel",
- "placeholder": "Phone Number",
- "required": true,
- "colClass": "col-lg-4"
- },
- {
- "name": "address",
- "label": "Your Address",
- "type": "text",
- "placeholder": "Address Now",
- "required": false,
- "colClass": "col-lg-6"
- },
- {
- "name": "date",
- "label": "Your Date",
- "type": "date",
- "placeholder": "Date",
- "required": false,
- "colClass": "col-lg-6"
- },
- {
- "name": "message",
- "label": "Your Message",
- "type": "textarea",
- "placeholder": "Type your message",
- "required": false,
- "colClass": "col-lg-12"
- }
- ],
- "submitButton": {
- "text": "SEND MESSAGE",
- "icon": "fa-solid fa-arrow-right",
- "buttonClass": "theme-btn style-2"
- }
- }
-}
\ No newline at end of file
diff --git a/data/dataheader.json b/data/dataheader.json
deleted file mode 100644
index 3984dae..0000000
--- a/data/dataheader.json
+++ /dev/null
@@ -1,61 +0,0 @@
-[
- {
- "title": "Academics",
- "url": "/academics/",
- "children": [
- {
- "title": "Foundations",
- "url": "/academics/foundations/",
- "children": [],
- "programmes": [
- {
- "title": "Pre-A",
- "url": "/academics/foundations/PAF1000/"
- },
- {
- "title": "Pre-U",
- "url": "/academics/foundations/PUF1000/"
- }
- ]
- },
- {
- "title": "Undergraduate",
- "url": "/academics/undergraduate/",
- "children": [],
- "programmes": [
-
- ]
- },
- {
- "title": "Postgraduate",
- "url": "/academics/postgraduate/",
- "children": [],
- "programmes": [
-
- ]
- },
- {
- "title": "Global Education",
- "url": "/academics/global-education/",
- "children": [
- {
- "title": "Postgraduate Online",
- "url": "/academics/postgraduate-online/",
- "children": [],
- "programmes": [
- {
- "title": "Accounting and Finance",
- "url": "/academics/postgraduate-online/GE7002/"
- },
- {
- "title": "International Business Law",
- "url": "/academics/postgraduate-online/GE7008/"
- },
- ]
- }
- ]
- }
- ]
- }
-
-]
\ No newline at end of file
diff --git a/data/faq-data.json b/data/faq-data.json
deleted file mode 100644
index 8146100..0000000
--- a/data/faq-data.json
+++ /dev/null
@@ -1,234 +0,0 @@
-{
- "hero": {
- "title": "Go and Grow Camp",
- "backgroundImage": "/uploads/home/b2.jpg",
- "overlayColor": "rgba(0, 0, 0, 0)",
- "sectionClass": "uk-section-secondary uk-section-overlap uk-preserve-color uk-light",
- "titleClass": "uk-heading-large uk-text-center !text-[5vw]",
- "enableScrollspy": true,
- "backgroundPosition": "top-center"
- },
-
- "sidebarNav": [
- {
- "id": "general-information",
- "label": "General Information"
- },
- {
- "id": "camps",
- "label": "Camps"
- },
- {
- "id": "camp-routine",
- "label": "Camp Routine"
- },
- {
- "id": "camp-counselors",
- "label": "Camp Counselors"
- },
- {
- "id": "camp-rules",
- "label": "Camp Rules"
- },
- {
- "id": "safety",
- "label": "Safety"
- },
- {
- "id": "accommodation-catering",
- "label": "Accommodation & Catering"
- },
- {
- "id": "transfers-shuttles",
- "label": "Transfers & Shuttles"
- }
- ],
-
- "contactBox": {
- "title": "Let's plan your perfect nature escape",
- "phone": {
- "icon": "phone",
- "text": "+(123)-456-789"
- },
- "email": {
- "icon": "email",
- "text": "hello@ggcamp.org"
- }
- },
-
- "faqSections": [
- {
- "id": "general-information",
- "title": "General Information",
- "faqs": [
- {
- "title": "What are FAQ?",
- "description": "FAQ are the initials for \"Frequently Asked Questions\".\n\nThe FAQ have been compiled by us over a long period of time and are intended to help give a general overview of our camps and clarify questions that arise before booking a camp."
- },
- {
- "title": "General booking process",
- "description": "Once the booking has been confirmed by us, you will receive an e-mail requesting a deposit. As soon as we have received this, you will receive an e-mail with a payment confirmation.\nPlease have a look at the welcome package, which will reach you by e-mail with the Last Travel Information. This contains information that applies to the camp you have booked.\n\nStep 1: Registration\nStep 2: Receipt of registration confirmation, total invoice and deposit request (e-mail)\nStep 3: Deposit of USD 50 (due within 7 days after booking)\nStep 4: Receiving an email with the latest important travel information, a packing list, addresses and important emergency phone numbers plus remaining payment request about 3-4 weeks before the camp starts."
- },
- {
- "title": "Terms & Conditions",
- "description": "Our Terms & Conditions can be found in our official documents section."
- },
- {
- "title": "Where can I find a packing guide for Camps?",
- "description": "Just click here to download our packing list."
- },
- {
- "title": "Where can I find contact information from Camps and addresses?",
- "description": "Here you can find all the necessary information if you want to drive to our camps or send something. If you want to send something please ALWAYS include the full name of your child on the letter/package and please only send it at the time when your kids are staying in camp as we cannot store it for a longer period of time.\n\nWalsrode/Lüneburger Heide - Germany:\nCamp Adventure, Vethem 58, 29664 Walsrode, Germany\nwalsrode@campadventure.de\n\nRegen/Bavarian Forest - Germany:\nCamp Adventure, Badstrasse 18, 94209 Regen\nregen@campadventure.de\n\nBarcelona - Spain:\nBISC International Sailing Center, c/o Camp Adventure, Parc del Fòrum Sota plaça fotovoltàica, 08930 Sant Adrià de Besòs, Barcelona, Spain\nbarcelona@campadventure.de\n\nBath - England:\nUniversity of Bath, c/o Camp Adventure, Claverton Down, Bath BA2 7AY, England\nengland@campadventure.de\n\nRossall - England:\nRossall School, Broadway, Fleetwood, Lancashire FY7 8JW, England\nengland@campadventure.de"
- }
- ]
- },
- {
- "id": "camps",
- "title": "Camps",
- "faqs": [
- {
- "title": "Where do kids and camp counselors come from?",
- "description": "Camp Adventure attaches great importance to internationality. The participants and supervisors in our camps come from many different countries. Last year, for example, we had participants from over 60 different countries and counselors from 25 different nations. Of course, we don't know where they will come from this year. So we are at least as excited as you are.\n\nThrough our office in Hamburg and our branch office in Canada, we reach motivated and committed counselors from all over the world. Canadian and Australian teamers can therefore be found as well as German or Spanish teamers.\n\nDue to the different experiences and cultural backgrounds an indescribably fantastic, international atmosphere is created."
- },
- {
- "title": "Which languages are spoken in camp?",
- "description": "The main language in all our camps is English. In addition, there is the language of the country in which the camp takes place. As we have our headquarters in Germany, German teamers are always present in all camps in Germany. All announcements and explanations are here therefore always in German and English. Of course, all our teamers with their different nationalities are also available for individual translations."
- },
- {
- "title": "Are there problems if children have low language skills?",
- "description": "No, because there are usually more participants and team members who speak the same language. We know from experience that children are excellent at communicating nonverbally. They often need a few days to warm up to it, but are then very open to other children as well."
- },
- {
- "title": "Are girls and boys separated?",
- "description": "Girls and boys are accommodated separately in the dormitories/tents. The program is completely mixed."
- },
- {
- "title": "How big are the camps? How high is the caregiver ratio?",
- "description": "Capacities range from around 30 participants in smaller language camps to a maximum of about 400 children in our camp Lueneburger Heide. However, the maximum capacity is not reached every week. However, a minimum number of participants must be guaranteed in order to run the camp.\n\nIt is important to us that all children are always grouped in small groups of 5-8, with a counselor as a contact person. This way homesickness doesn't stand a chance and despite the size of the camp in their group family, they experience a strong bond on which they can count on!"
- },
- {
- "title": "Should 12-year-olds go to Junior Camp or Senior Camp?",
- "description": "This question is not easy to answer and depends on the individual stage of development of your child. Therefore, as parents, we leave you the opportunity to decide for yourself. In the Junior Camp they belong to the older ones and can explore a lot in a playful way. In the Senior Camp they are the younger ones, who have role models through the older ones, whom they can emulate."
- }
- ]
- },
- {
- "id": "camp-routine",
- "title": "Camp Routine",
- "faqs": [
- {
- "title": "How is the choice of activities/courses in the camps made?",
- "description": "If your child would like to participate in a paid additional course (e.g. horse riding, language course, Survival etc.), this must be booked in advance when registering. In principle, no extra additional courses have to be booked. A program with a variety of activities is of course available to the participants in all camps. The various activities can be chosen by the participants on site in the respective camps. We present the offers to the participants, so that everyone gets an insight into the different courses. The children can then register in the lists of the respective courses."
- },
- {
- "title": "What is a hike?",
- "description": "The hike is a 1-3 day walking tour, in which all participants of the Adventure Camp who stay 2 weeks in the camp take part. On this hike the participants will not spend the night in a tent, but either in the open air or under a self-made shelter e.g. from tarpaulins. They will of course be accompanied by their teamers. The hike is a very special experience and a highlight for all participants. For this hike the participants need sturdy shoes and a big backpack."
- },
- {
- "title": "Can I wash my clothes during the camp?",
- "description": "In principle, participants should bring sufficient clothing and change of clothes for the entire camp period.\n\nOnly in the camps in Lüneburger Heide and Bayerischer Wald a laundry service will be offered for kids staying three weeks or more, which means that a laundry bag (approx. 3 kg) will be washed in the laundry centre of the next village at a price of USD 45. This service can be booked upon registration for three-week camps. Please note that the laundry will be done either after one week or after two weeks."
- },
- {
- "title": "Anti Homesick Adviser",
- "description": "Dear parents\n\nNow it's almost time: In summer your child travels for the first time with Camp Adventure. Maybe it will be the first time that he travels alone without parents or relatives. As we are getting more and more questions, we have decided to put together a small package for you parents with little tips from experts to make everything as easy as possible for you and your child. Follow our tips and your child will have a fantastic holiday, have many new experiences and make friends from all over the world! All these tips have been developed together with the International Camping Fellowship. And the more you think your child will be a \"homesick candidate\" - or your child even claims to be one - the more you consider the following tips."
- }
- ]
- },
- {
- "id": "camp-counselors",
- "title": "Camp Counselors - Our Teamers",
- "faqs": [
- {
- "title": "Who are the camp counselors?",
- "description": "Every year our team is made up of an international mix. The non-profit association Camp Europe e.V. with headquarters in Hamburg and a branch office in Canada takes care of the acquisition of national and international applicants. Since we have about 50% German-speaking children, there are also German carers in every location. But many also come from other countries, such as England, Spain, Canada and Australia, to name just a few."
- },
- {
- "title": "How are the teamers trained?",
- "description": "All counselors go through an extensive application process. For a successful application, not only an interesting curriculum vitae and a minimum age of 19 years are sufficient! We conduct a personal interview with each individual in which our employees get a first impression of the applicant.\n\nBefore the camp season, everyone, both the first supervisors (teamers) as well as many recomers, complete a one-week training in which they are prepared for their assignment by trained coaches. They must have a first aid certificate, which may not be older than two years, as well as an internationally flawless police clearance certificate. We know how important the teamers are for a great camp and therefore select them very conscientiously."
- }
- ]
- },
- {
- "id": "camp-rules",
- "title": "Camp Rules",
- "faqs": [
- {
- "title": "Drugs, Alcohol & Camp?",
- "description": "From our point of view an absolutely unacceptable and indiscutable combination! Due to our cooperation with the association \"Keine Macht den Drogen\" (No power to drugs) and our common opinion that all kinds of drugs do not belong in the hands of children & teenagers, any possession or consumption of drugs is forbidden for teenagers and children in the camp and also outside the camp.\n\nViolations can lead to exclusion or even to criminal charges. The term \"drugs\" also includes cigarettes and alcohol! Through our varied activities, we offer a much better alternative! We would like to make it clear from the outset that we are also against any form of discrimination or \"putting down\". This is - just like violence - immediately prevented by us, in order to offer each young person a relaxed and joyful time in the camp."
- },
- {
- "title": "Should I call my kid or write an old-fashioned letter?",
- "description": "We ask all parents to write to their child at least once. This is especially useful at the beginning, as it is a particularly upsetting experience for every child and every teenager when most of the participants receive a letter, but they do not.\n\nPlease note that there is NO public \"camp phone\" available for incoming or outgoing calls. If your child doesn't bring her/his own phone, she/he won't be able to call you. In case of any problems, we will of course contact you immediately.\n\nIf your child brings a mobile phone, we will collect it on arrival and store it with the valuables. Your child's Teamer may hand it over during the phone time after lunch. Please keep in mind: no news is good news (the location manager will contact you if it is necessary due to homesickness or illness). We kindly ask you not to call the office in Hamburg to ask about your kid's health and wellbeing, nor if you would like to know why your child hasn't called you yet. Please use our camp email service for such enquiries.\n\nOur recommendation is the following:\nWe recommend not to call your child (even if he or she has a mobile phone with him or her) and not to tell him or her to call you. Telephoning can in our experience promote homesickness very strongly and your child will be cured thereby if completely immersed in camp life! At noon after lunch, if absolutely necessary, your child can pick up his or her mobile phone from the counselors until the start of next program and make phone calls. Instead, you are welcome to bring a pre-stamped and addressed envelope with you. We will then make sure that your child has enough time to write letters. Since letters and postcards often arrive late at the camps, we also offer the e-mail service. You can send your child max. ONE email per day directly to the camp, which we then print out and give to your child. There is no way for them to reply, but your child will be happy to receive a small message from home. You can find the postal and email address in the info package of the booked camp."
- },
- {
- "title": "Are there any prohibited items?",
- "description": "Yes, there are. Not allowed are pocket knives with lockable blades, all weapons, lighters and matches (danger of fire in the forest!). Drugs of any kind, including alcohol and cigarettes, are also included."
- }
- ]
- },
- {
- "id": "safety",
- "title": "Safety",
- "faqs": [
- {
- "title": "Electronic equipment and valuables",
- "description": "We recommend that you do not take an MP3 player, e-book, tablet, etc. or any valuables with you. On the one hand we do not assume any liability and on the other hand there are no possibilities to charge the devices. We are of the opinion that the camp time is a special experience for the participants if they do not have the headphones in their ears all the time or are busy with their mobile phones. Instead they have the chance to deal with other topics and they find time to dedicate themselves to the new people in the camp."
- },
- {
- "title": "How do you provide safety for the kids?",
- "description": "Before our camp counselors start working with us, we check their police clearance certificates. You must be at least 19 years old to work for us as a teamer. They must also have a \"First Aid Certificate\", which must not be older than two years. In the camps we try to make sure that only adults from our camp or familiar faces are on the campground and that all our carers look after strangers.\n\nWe have many different camp sites. Some of them are fenced in, others are not. There are no armed guards or the like in our camps, as we believe that these conditions create a very insecure feeling. We do not have a high security zone in Germany, Northern Ireland or England, but we keep our eyes open and do everything we can to ensure that all participants have a great time."
- },
- {
- "title": "Insurance in case of illness?",
- "description": "If your child should fall ill during the camp and medical help is required, he or she will of course be taken to the doctor by our carers and cared for there as well. It is therefore necessary for each participant to take their insurance card with them to the camp. We offer all participants the possibility of taking out liability, casualty & health insurance for travel abroad with us. This covers all costs in case of illness and prevents international children in particular from having to \"advance\" their own cash. You can find more detailed information on insurance in our documents section."
- }
- ]
- },
- {
- "id": "accommodation-catering",
- "title": "Accommodation & Catering",
- "faqs": [
- {
- "title": "How's the food at the camps?",
- "description": "Full board for the entire duration of the camp is of course already included in the camp price. In addition, water and fruit are available for the participants around the clock. For us it is a matter of course to provide one variant for vegetarians and one pork-free with each meal. In case of special allergies or intolerances of your children let us know in advance and we will try to find a solution."
- },
- {
- "title": "How is my child accommodated in the camp?",
- "description": "In our Adventure Camp Bayerischer Wald and our Camp Lueneburger Heide, the Juniors (7-12) and the Seniors (12-16) can choose between tents and huts.\n\nThe tents are equipped with a floor and a wooden platform, up to 7 children can share one tent. The participants can make themselves comfortable with sleeping bag and sleeping mat. The wooden huts are equipped with bunk beds and can accommodate 4-8 children. At the other locations, participants will be accommodated in shared rooms in youth hostels, sports centres or boarding schools of private schools. You will find detailed information about the accommodation on the individual camp pages."
- }
- ]
- },
- {
- "id": "transfers-shuttles",
- "title": "Transfers & Shuttles",
- "faqs": [
- {
- "title": "Entry regulations/Travel Consent for group flights",
- "description": "All parents need to fill this out and bring it to camp:\n\nBelow is a summary of the travel requirements for minors from various EU countries traveling with Camp Adventure on group flights. Please note that regulations can change, so it's essential to consult the official resources provided for the most up-to-date information."
- },
- {
- "title": "Which transfers are offered?",
- "description": "The respective transfer possibilities depend on the period and venue of the camp. Check directly on the respective camp page under \"Arrival & Departure Services\"."
- },
- {
- "title": "Where can I find the exact arrival and departure times?",
- "description": "Information about the different arrival and departure times can be found on the respective camp page under \"Arrival & Departure Services\"."
- },
- {
- "title": "How do the transfer costs come about?",
- "description": "When booking a train or air trip, the indicated price includes the arrival and departure as well as the accompaniment by a supervisor."
- },
- {
- "title": "Where can I find the address/driving directions from the camp?",
- "description": "You will receive the exact address and directions of the camp with the Last Travel Information about 3-4 weeks before the camp starts."
- }
- ]
- }
- ],
-
- "video": {
- "url": "https://www.youtube.com/embed/3NtE5wSwYTo?list=PLSOedrxa1c-bxvH6uuz_oZdIfJkov66wB&disablekb=1",
- "title": "Anti Homesickness Adviser"
- }
-}
\ No newline at end of file
diff --git a/data/footer.json b/data/footer.json
deleted file mode 100644
index 5a617f5..0000000
--- a/data/footer.json
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "top": {
- "bgImage": "/assets/img/home-1/footer-bg.jpg",
- "phone": {
- "display": "+84 961 83 4040",
- "href": "tel:+84961834040"
- },
- "address": "734 Luy Ban Bich St, Tan Thanh Ward, Tan Phu Dist, HCMC",
- "logo": {
- "src": "/assets/img/logo/white-logo.svg",
- "alt": "logo",
- "href": "/"
- },
- "menuLinks": [
- {
- "label": "Home",
- "href": "/"
- },
- {
- "label": "About Us",
- "href": "/about"
- },
- {
- "label": "Visa",
- "href": "/country-details"
- },
- {
- "label": "Pages",
- "href": "/news-details"
- },
- {
- "label": "Article",
- "href": "/news"
- },
- {
- "label": "Contact Us",
- "href": "/contact"
- }
- ],
- "socialLinks": [
- {
- "icon": "fa-brands fa-twitter",
- "href": "#"
- },
- {
- "icon": "fa-brands fa-instagram",
- "href": "#"
- },
- {
- "icon": "fa-brands fa-linkedin",
- "href": "#"
- },
- {
- "icon": "fa-brands fa-youtube",
- "href": "#"
- }
- ]
- },
- "bottom": {
- "copyright": {
- "text": "Copyright©",
- "brand": "GRAMENTHEME",
- "rights": "All Rights Reserved."
- },
- "menuLinks": [
- {
- "label": "Terms & Conditions",
- "href": "/contact"
- },
- {
- "label": "Privacy Policy",
- "href": "/contact"
- },
- {
- "label": "Contact Us",
- "href": "/contact"
- }
- ]
- }
-}
diff --git a/data/header-menu.json b/data/header-menu.json
deleted file mode 100644
index af22c79..0000000
--- a/data/header-menu.json
+++ /dev/null
@@ -1,159 +0,0 @@
-[
- {
- "label": "Home",
- "slug": "home",
- "href": "/",
- "type": "internal",
- "order": 1,
- "isActive": true,
- "children": []
- },
- {
- "label": "About Us",
- "slug": "about-us",
- "href": "/about",
- "type": "internal",
- "order": 2,
- "isActive": true,
- "children": []
- },
- {
- "label": "Pages",
- "slug": "pages",
- "href": "#",
- "type": "internal",
- "order": 3,
- "isActive": true,
- "children": [
- {
- "label": "Services",
- "slug": "services",
- "href": "/services",
- "type": "internal",
- "order": 1,
- "isActive": true,
- "children": [
- {
- "label": "Service List",
- "slug": "service-list",
- "href": "/service",
- "type": "internal",
- "order": 1,
- "isActive": true
- },
- {
- "label": "Service Details",
- "slug": "service-details",
- "href": "/service-details",
- "type": "internal",
- "order": 2,
- "isActive": true
- }
- ]
- },
- {
- "label": "Country List",
- "slug": "country-list",
- "href": "/country-list",
- "type": "internal",
- "order": 2,
- "isActive": true,
- "children": [
- {
- "label": "Country List",
- "slug": "country-list-all",
- "href": "/country-list",
- "type": "internal",
- "order": 1,
- "isActive": true
- },
- {
- "label": "Country Details",
- "slug": "country-details",
- "href": "/country-details",
- "type": "internal",
- "order": 2,
- "isActive": true
- }
- ]
- },
- {
- "label": "Our Pricing",
- "slug": "pricing",
- "href": "/pricing",
- "type": "internal",
- "order": 3,
- "isActive": true
- },
- {
- "label": "Appointment",
- "slug": "appointment",
- "href": "/appointment",
- "type": "internal",
- "order": 4,
- "isActive": true
- },
- {
- "label": "FAQ",
- "slug": "faq",
- "href": "/faq",
- "type": "internal",
- "order": 5,
- "isActive": true
- }
- ]
- },
- {
- "label": "VISA",
- "slug": "visa",
- "href": "#",
- "type": "internal",
- "order": 4,
- "isActive": true,
- "children": [
- {
- "label": "Visa List",
- "slug": "visa-list",
- "href": "/visa-list",
- "type": "internal",
- "order": 1,
- "isActive": true
- },
- {
- "label": "Visa Details",
- "slug": "visa-details",
- "href": "/visa-details",
- "type": "internal",
- "order": 2,
- "isActive": true
- }
- ]
- },
- {
- "label": "Blog",
- "slug": "blog",
- "href": "/blog",
- "type": "internal",
- "order": 5,
- "isActive": true,
- "children": []
- },
- {
- "label": "Contact Us",
- "slug": "contact-us",
- "href": "/contact",
- "type": "internal",
- "order": 6,
- "isActive": true,
- "children": []
- },
- {
- "label": "External Portal",
- "slug": "external-portal",
- "href": "https://partner.hailearning.edu.vn",
- "type": "external",
- "order": 7,
- "isActive": false,
- "children": []
- }
-]
diff --git a/data/header.json b/data/header.json
deleted file mode 100644
index 925b0b4..0000000
--- a/data/header.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
- "top": {
- "phone": "+09 378 357 5222",
- "email": "info@hailearning.edu.vn",
- "location": "69 Street, 5th Avenue LA, United States",
- "socialLinks": [
- {
- "platform": "linkedin",
- "url": "https://linkedin.com",
- "icon": "fa-brands fa-linkedin"
- },
- {
- "platform": "twitter",
- "url": "https://twitter.com",
- "icon": "fa-brands fa-twitter"
- },
- {
- "platform": "instagram",
- "url": "https://instagram.com",
- "icon": "fa-brands fa-instagram"
- },
- {
- "platform": "youtube",
- "url": "https://youtube.com",
- "icon": "fa-brands fa-youtube"
- }
- ],
- "languages": [
- {
- "name": "English",
- "value": "1"
- },
- {
- "name": "Bangla",
- "value": "2"
- },
- {
- "name": "Hindi",
- "value": "3"
- }
- ]
- },
- "offcanvas": {
- "description": "Nullam dignissim, ante scelerisque the is euismod fermentum odio sem semper the is erat, a feugiat leo urna eget eros. Duis Aenean a imperdiet risus.",
- "contactInfo": {
- "address": "Main Street, Melbourne, Australia",
- "email": "info@hailearning.edu.vn",
- "workingHours": "Mod-Friday, 09am - 05pm",
- "phone": "+09 378 357 5222"
- }
- }
-}
diff --git a/data/home.json b/data/home.json
deleted file mode 100644
index 0d4df4a..0000000
--- a/data/home.json
+++ /dev/null
@@ -1,334 +0,0 @@
-{
- "hero": {
- "title": "From Application to Visa – We’ve Got You Covered",
- "subtitle": "Global Education Simplified",
- "description": "We guide you through every step of the education visa process, from initial application to final approval, ensuring a smooth, hassle-free journey.",
- "primaryButton": {
- "label": "Apply now",
- "href": "/contact"
- },
- "secondaryButton": {
- "label": "Book Free Consultation",
- "href": "/contact"
- },
- "backgroundImage": "/assets/img/home-1/hero/bg.jpg",
- "videoUrl": "https://www.youtube.com/watch?v=Cn4G2lZ_g2I"
- },
- "whyChooseUs": {
- "heading": "Turning Study Abroad Dreams Into Reality",
- "subheading": "About Our Consultancy",
- "description": "We guide students with expert visa consulting, ensuring a smooth process from application to approval, turning study abroad aspirations into life-changing opportunities for a brighter future.",
- "items": [
- {
- "icon": "/assets/img/home-1/icon/01.svg",
- "title": "Global Reach",
- "description": "Expanding Opportunities Worldwide"
- },
- {
- "icon": "/assets/img/home-1/icon/01.svg",
- "title": "Expert Guidance",
- "description": "Professional Support Every Step"
- }
- ],
- "features": [
- "Fastest Visa form processing with skilled immigration agents",
- "Partnership with International Educational Institutions"
- ],
- "ctaButton": {
- "label": "Get Started",
- "href": "/about"
- }
- },
- "visaSolutions": {
- "heading": "Comprehensive Visa Solutions",
- "subheading": "Our Expert Services",
- "items": [
- {
- "number": "01",
- "title": "Student Visa Guidance",
- "description": "Assistance with admission, documentation, and visa application.Assistance",
- "link": "/services/student-visa"
- },
- {
- "number": "02",
- "title": "PTE Exam Preparation",
- "description": "We provide expert guidance and personalized support throughout the education visa process,",
- "link": "/services/pte-exam"
- },
- {
- "number": "03",
- "title": "University Selection Assistance",
- "description": "We provide expert guidance and personalized support throughout the education visa process,",
- "link": "/services/university-selection"
- },
- {
- "number": "04",
- "title": "IELTS Exam Preparation",
- "description": "We provide expert guidance and personalized support throughout the education visa process,",
- "link": "/services/ielts-exam"
- }
- ]
- },
- "visaCountries": {
- "heading": "Visa & VISAWAY Services To UK",
- "subheading": "UK. United Kingdom",
- "description": "The Express Entry program is designed for skilled workers who wish to immigrate to Canada. It includes the Federal Skilled Worker Program, the Federal Skilled…",
- "countries": [
- {
- "name": "United Kingdom",
- "code": "UK",
- "flag": "/assets/img/home-1/feature/shape.png",
- "link": "/country-details/uk",
- "visaTypes": [
- "Visitor Visa",
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Business Visa",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "name": "United States",
- "code": "US",
- "flag": "/assets/img/flags/us.png",
- "link": "/country-details/us",
- "visaTypes": [
- "Student Visa F-1",
- "Work Visa H1-B",
- "Tourist Visa B-2"
- ]
- },
- {
- "name": "Canada",
- "code": "CA",
- "flag": "/assets/img/flags/canada.png",
- "link": "/country-details/canada",
- "visaTypes": [
- "Study Permit",
- "Work Permit",
- "Express Entry"
- ]
- },
- {
- "name": "Australia",
- "code": "AU",
- "flag": "/assets/img/flags/australia.png",
- "link": "/country-details/australia",
- "visaTypes": [
- "Student Visa 500",
- "Skilled Migration",
- "Working Holiday"
- ]
- },
- {
- "name": "Germany",
- "code": "DE",
- "flag": "/assets/img/flags/germany.png",
- "link": "/country-details/germany",
- "visaTypes": [
- "Student Visa",
- "Job Seeker Visa",
- "EU Blue Card"
- ]
- }
- ],
- "ctaButton": {
- "label": "Get Started",
- "href": "/contact"
- }
- },
- "testimonials": {
- "heading": "Student Reviews & Testimonials",
- "subheading": "What Our Students Say",
- "videoUrl": "https://www.youtube.com/watch?v=Cn4G2lZ_g2I",
- "videoThumbnail": "/assets/img/home-1/testimonial/01.jpg",
- "items": [
- {
- "name": "Sohel Tanvir",
- "role": "Student",
- "country": "Canada",
- "rating": 5,
- "comment": "Professional and reliable service. They explained each step clearly, prepared my documents, and supported me during the interview. My visa approval came faster than expected.",
- "avatar": "/assets/img/home-1/testimonial/client.png"
- },
- {
- "name": "Ayesha Rahman",
- "role": "Student",
- "country": "UK. United Kingdom",
- "rating": 5,
- "comment": "The consultancy guided me from start to finish, making my study abroad journey smooth and stress-free. Thanks to their expert support, I secured my visa successfully.",
- "avatar": "/assets/img/home-1/testimonial/client-2.png"
- },
- {
- "name": "Michael Chen",
- "role": "Graduate Student",
- "country": "Australia",
- "rating": 5,
- "comment": "Outstanding service from beginning to end. The team was knowledgeable, responsive, and made the entire visa process seamless. Highly recommend to anyone planning to study abroad.",
- "avatar": "/assets/img/home-1/testimonial/client.png"
- }
- ]
- },
- "videoGallery": {
- "heading": "VIDEO PLAY GALLERY",
- "videoUrl": "https://ex-coders.com/vdo/visa.mp4",
- "thumbnail": "/assets/img/home-1/feature/text.png"
- },
- "faq": {
- "heading": "Got Questions? We've Got Answers",
- "subheading": "Visa FAQs",
- "description": "We understand students often have many questions about studying abroad. Our experts provide clear.",
- "ctaButton": {
- "label": "contact us",
- "href": "/contact"
- },
- "items": [
- {
- "question": "How long does the student visa process usually take?",
- "answer": "The student visa process typically takes 4-8 weeks depending on the country and time of year. We recommend starting the application process at least 3 months before your intended travel date to ensure sufficient time for document preparation and processing."
- },
- {
- "question": "Do you assist with scholarship applications as well?",
- "answer": "Yes, we guide students in identifying suitable scholarships, preparing strong applications, and increasing chances of securing financial aid for their studies abroad."
- },
- {
- "question": "Will you guide me in preparing for the visa interview?",
- "answer": "Absolutely! We provide comprehensive visa interview preparation, including mock interviews, document review, and tips on how to answer common questions confidently and effectively."
- },
- {
- "question": "Do you offer post-arrival support for students?",
- "answer": "Yes, we provide post-arrival support including airport pickup coordination, accommodation assistance, university orientation guidance, and ongoing support throughout your study period."
- },
- {
- "question": "What documents are required for a student visa application?",
- "answer": "Required documents typically include a valid passport, university acceptance letter, proof of financial support, academic transcripts, language proficiency test scores, and health insurance. We provide a complete checklist tailored to your destination country."
- }
- ]
- },
- "achievements": {
- "heading": "Our Achievements in Numbers",
- "subheading": "Did You Know",
- "items": [
- {
- "value": "1000",
- "suffix": "k+",
- "label": "Students Guided",
- "description": "Successfully assisted over a thousand students worldwide."
- },
- {
- "value": "50",
- "suffix": "+",
- "label": "Countries Covered",
- "description": "Helping students apply to universities in more than 50 countries."
- },
- {
- "value": "95",
- "suffix": "%",
- "label": "Visa Success Rate",
- "description": "Inspired students to reach their goals globally"
- },
- {
- "value": "10",
- "suffix": "+",
- "label": "Years of Experience",
- "description": "Trusted experts in global education consulting."
- }
- ]
- },
- "partners": {
- "visaConsultancy": {
- "heading": "Our Achievements & Awards",
- "items": [
- {
- "name": "Best Visa Consultancy",
- "icon": "/assets/img/home-1/feature/icon-1.png",
- "year": "2025"
- },
- {
- "name": "Visa Success Award",
- "icon": "/assets/img/home-1/feature/icon-2.png",
- "year": "2025"
- },
- {
- "name": "Innovation Award",
- "icon": "/assets/img/home-1/feature/icon-3.png",
- "year": "2025"
- },
- {
- "name": "Global Education Partner",
- "icon": "/assets/img/home-1/feature/icon-4.png",
- "year": "2025"
- }
- ]
- },
- "brands": {
- "items": [
- {
- "logo": "/assets/img/home-1/brand/01.png"
- },
- {
- "logo": "/assets/img/home-1/brand/02.png"
- },
- {
- "logo": "/assets/img/home-1/brand/03.png"
- },
- {
- "logo": "/assets/img/home-1/brand/04.png"
- },
- {
- "logo": "/assets/img/home-1/brand/05.png"
- }
- ]
- }
- },
- "blogPreview": {
- "heading": "Latest Insights & Updates",
- "subheading": "Visa Tips & Guides",
- "ctaButton": {
- "label": "view all articles",
- "href": "/blog"
- },
- "items": [
- {
- "title": "Step-by-Step Guide to Applying for a Student Visa",
- "excerpt": "Learn the complete process of applying for a student visa, from gathering documents to attending your interview. Our comprehensive guide covers everything you need to know.",
- "category": "Student Visa",
- "date": "2025-08-20",
- "author": {
- "name": "Sohel",
- "avatar": "/assets/img/home-1/news/client.png"
- },
- "comments": 8,
- "link": "/blog/step-by-step-guide-student-visa",
- "thumbnail": "/assets/img/home-1/news/news-1.jpg"
- },
- {
- "title": "Tips to Prepare Financial Documents for Visa Approval",
- "excerpt": "Financial documentation is crucial for visa approval. Discover expert tips on preparing bank statements, sponsorship letters, and proof of funds that meet embassy requirements.",
- "category": "IELTS / TOEFL",
- "date": "2025-08-20",
- "author": {
- "name": "Sohel",
- "avatar": "/assets/img/home-1/news/client.png"
- },
- "comments": 8,
- "link": "/blog/financial-documents-visa-approval",
- "thumbnail": "/assets/img/home-1/news/news-2.jpg"
- },
- {
- "title": "Post-Arrival Guide What Every Student Should Know",
- "excerpt": "Moving to a new country can be overwhelming. Our post-arrival guide helps international students navigate accommodation, banking, healthcare, and cultural adaptation successfully.",
- "category": "Study Abroad",
- "date": "2025-08-20",
- "author": {
- "name": "Sohel",
- "avatar": "/assets/img/home-1/news/client.png"
- },
- "comments": 8,
- "link": "/blog/post-arrival-guide-students",
- "thumbnail": "/assets/img/home-1/news/news-3.jpg"
- }
- ]
- }
-}
diff --git a/data/insurance.json b/data/insurance.json
deleted file mode 100644
index 0592cd0..0000000
--- a/data/insurance.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "hero": {
- "title": "Insurance & Travel Cancellation Guarantee",
- "subtitle": "Comprehensive coverage for your peace of mind",
- "backgroundImage": "/uploads/banner/b13.jpg",
- "sectionClass": "uk-section-default uk-section-overlap uk-preserve-color uk-light uk-position-relative",
- "backgroundClasses": "uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-section-xlarge",
- "overlayStyle": {
- "backgroundColor": "rgba(0, 0, 0, 0)"
- },
- "titleClass": "text-white text-[5vw] uk-text-center",
- "subtitleClass": "uk-panel font-[Raleway] italic text-[1.5vw] uk-margin uk-text-center",
- "enableScrollspy": true
- },
- "page": {
- "title": "Insurance & Travel Information",
- "divider": true,
- "sectionClass": "uk-section-default uk-section-overlap uk-section",
- "titleClass": "text-[2.5vw] text-[#292c3d] uk-text-left@m uk-text-center",
- "dividerClass": "uk-divider-small uk-text-left@m uk-text-center"
- },
- "content": {
- "sectionClass": "uk-section-muted uk-section-overlap uk-section",
- "textClass": "uk-panel uk-margin text-[1vw]",
- "content": [
- {
- "type": "header",
- "level": 2,
- "text": "Our Go and Grow Camp Insurance Package"
- },
- {
- "type": "paragraph",
- "text": "Liability, casualty and health insurance"
- },
- {
- "type": "paragraph",
- "text": "Price: USD 45 per person/trip"
- },
- {
- "type": "paragraph",
- "text": "It only takes one mouse-click to book our comprehensive holiday insurance package for travels abroad, which includes a liability, casualty and health insurance for the entire duration of your journey. This ensures that your child is well insured in the unlikely event of an accident, a doctor's visit, a stay at the hospital or a misfortune causing damage to external property."
- },
- {
- "type": "paragraph",
- "text": "The insurance covers the whole duration of the trip, including the days of arrival and departure."
- },
- {
- "type": "paragraph",
- "text": "Please note that all participants without an EU insurance card/private health insurance or without a travel insurance package have to be prepared to cover the costs for medical treatment themselves. Go and Grow Camp does not provide any advance payment for doctor's bills. Non EU residents who do not book our insurance package have to submit a confirmation of their travel insurance."
- },
- {
- "type": "header",
- "level": 2,
- "text": "Go and Grow Camp Travel Cancellation Guarantee"
- },
- {
- "type": "paragraph",
- "text": "It only takes one mouse-click to book our comprehensive holiday insurance package for travels abroad, which includes a liability, casualty and health insurance for the entire duration of your journey. This ensures that your child is well insured in the unlikely event of an accident, a doctor's visit, a stay at the hospital or a misfortune causing damage to external property."
- },
- {
- "type": "paragraph",
- "text": "The insurance covers the whole duration of the trip, including the days of arrival and departure."
- },
- {
- "type": "paragraph",
- "text": "Please note that all participants without an EU insurance card/private health insurance or without a travel insurance package have to be prepared to cover the costs for medical treatment themselves. Go and Grow Camp does not provide any advance payment for doctor's bills. Non EU residents who do not book our insurance package have to submit a confirmation of their travel insurance."
- },
- {
- "type": "header",
- "level": 2,
- "text": "Go and Grow Camp - Cooperations & Memberships"
- }
- ]
- }
-}
diff --git a/data/menu-header.json b/data/menu-header.json
deleted file mode 100644
index 13ad560..0000000
--- a/data/menu-header.json
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "menus": [
- {
- "menuid": "info",
- "parent": null,
- "title": "Info",
- "url": "#",
- "order": 0,
- "type": "static"
- },
- {
- "menuid": "info-about-us",
- "parent": "info",
- "title": "About us",
- "url": "/info/about-us",
- "order": 0,
- "type": "page"
- },
- {
- "menuid": "info-safety",
- "parent": "info",
- "title": "Safety",
- "url": "/info/safety",
- "order": 1,
- "type": "page"
- },
- {
- "menuid": "info-faq",
- "parent": "info",
- "title": "FAQ",
- "url": "/info/faq",
- "order": 2,
- "type": "page"
- },
- {
- "menuid": "info-terms-conditions",
- "parent": "info",
- "title": "Terms & Conditions",
- "url": "/info/terms-conditions",
- "order": 3,
- "type": "page"
- },
- {
- "menuid": "info-insurance",
- "parent": "info",
- "title": "Insurance",
- "url": "/info/insurance",
- "order": 4,
- "type": "page"
- },
- {
- "menuid": "info-travel-documents",
- "parent": "info",
- "title": "Travel Documents",
- "url": "/info/travel-documents",
- "order": 5,
- "type": "page"
- },
- {
- "menuid": "camp-locations",
- "parent": null,
- "title": "Camp Locations",
- "url": "/destinations",
- "order": 1,
- "type": "static"
- },
- {
- "menuid": "activities",
- "parent": null,
- "title": "Activities",
- "url": "/activities",
- "order": 2,
- "type": "static"
- },
- {
- "menuid": "blog",
- "parent": null,
- "title": "Blog",
- "url": "/blog",
- "order": 3,
- "type": "static"
- },
- {
- "menuid": "contact-us",
- "parent": null,
- "title": "Contact US",
- "url": "/contact-us",
- "order": 4,
- "type": "static"
- },
- {
- "menuid": "booking",
- "parent": null,
- "title": "Booking",
- "url": "/booking",
- "order": 5,
- "type": "static"
- }
- ]
-}
diff --git a/data/pricing.json b/data/pricing.json
deleted file mode 100644
index db531a8..0000000
--- a/data/pricing.json
+++ /dev/null
@@ -1,118 +0,0 @@
-{
- "hero": {
- "title": "Pricing Plan",
- "backgroundImage": "/assets/img/inner-page/breadcrumb.jpg",
- "shapeImage": "/assets/img/inner-page/shape.png",
- "breadcrumb": [
- {
- "text": "Home",
- "link": "/"
- },
- {
- "text": "Pricing Plan",
- "link": ""
- }
- ]
- },
- "pricingSection": {
- "subtitle": "pricing plan",
- "heading": "Flexible Plans to Suit Every Traveler",
- "description": "Choose the plan that fits your visa needs and enjoy expert guidance every step of the way."
- },
- "plans": {
- "monthly": [
- {
- "name": "Basic Plan",
- "price": "32",
- "period": "mo",
- "currency": "$",
- "buttonText": "Get Started Today",
- "buttonLink": "/pricing",
- "buttonIcon": "fa-solid fa-arrow-right",
- "style": "default",
- "features": [
- "Everything in Basic Plan",
- "Visa Interview Preparation",
- "Priority Processing Support",
- "Phone & Email Assistance",
- "Step-by-Step Application Support"
- ]
- },
- {
- "name": "Premium Plan",
- "price": "32",
- "period": "mo",
- "currency": "$",
- "buttonText": "Get Started Today",
- "buttonLink": "/pricing",
- "buttonIcon": "fa-solid fa-arrow-right",
- "style": "style-2",
- "features": [
- "Everything in Basic Plan",
- "Visa Interview Preparation",
- "Priority Processing Support",
- "Phone & Email Assistance",
- "Step-by-Step Application Support"
- ]
- }
- ],
- "yearly": [
- {
- "name": "Basic Plan",
- "price": "32",
- "period": "mo",
- "currency": "$",
- "buttonText": "Get Started Today",
- "buttonLink": "/pricing",
- "buttonIcon": "fa-solid fa-arrow-right",
- "style": "default",
- "features": [
- "Everything in Basic Plan",
- "Visa Interview Preparation",
- "Priority Processing Support",
- "Phone & Email Assistance",
- "Step-by-Step Application Support"
- ]
- },
- {
- "name": "Premium Plan",
- "price": "32",
- "period": "mo",
- "currency": "$",
- "buttonText": "Get Started Today",
- "buttonLink": "/pricing",
- "buttonIcon": "fa-solid fa-arrow-right",
- "style": "style-2",
- "features": [
- "Everything in Basic Plan",
- "Visa Interview Preparation",
- "Priority Processing Support",
- "Phone & Email Assistance",
- "Step-by-Step Application Support"
- ]
- }
- ]
- },
- "testimonials": {
- "subtitle": "What Our Clients Say",
- "heading": "Immigration Success Stories",
- "buttonText": "View All Review",
- "buttonLink": "/contact",
- "buttonIcon": "fa-solid fa-arrow-right",
- "image": "/assets/img/home-3/test-thumb.jpg",
- "items": [
- {
- "name": "Mohammed Ali",
- "role": "Family Visa",
- "rating": 5,
- "content": "The team provided exceptional guidance throughout my immigration process. Their expertise, personalized support, and attention to detail ensured a smooth, stress-free experience and successful visa approval."
- },
- {
- "name": "Mohammed Ali",
- "role": "Family Visa",
- "rating": 5,
- "content": "The team provided exceptional guidance throughout my immigration process. Their expertise, personalized support, and attention to detail ensured a smooth, stress-free experience and successful visa approval."
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/data/safety.json b/data/safety.json
deleted file mode 100644
index 14286fc..0000000
--- a/data/safety.json
+++ /dev/null
@@ -1,212 +0,0 @@
-{
- "hero": {
- "title": "Safety",
- "banner": "/uploads/banner/b13.jpg"
- },
- "approach":{
- "badge": "OUR APPROACH",
- "title": "Learning, Comfort, and Confidence in Every Step",
- "description": "Our camp philosophy ensures that every experience is exciting, engaging, and safe. We combine the thrill of outdoor exploration with a secure, well-managed environment where campers can grow, connect, and enjoy every moment.",
- "imgs":
- {
- "img1": "/uploads/safety/pic1.jpg",
- "img2": "/uploads/safety/pic2.jpg"
- },
- "stats":{
- "count": "1,200+",
- "label": "Happy Glampers Hosted",
- "avatars": [
- "https://i.pravatar.cc/100?img=1",
- "https://i.pravatar.cc/100?img=5",
- "https://i.pravatar.cc/100?img=8"
- ]
- },
- "features":[
- {
- "text":"Community built on trust and respect"
- },
- {
- "text":"Shared responsibility for a safe environment"
- },
- {
- "text":"Zero tolerance for discrimination or abuse"
- },
- {
- "text":"Staff trained and supervised around the clock"
- }
- ],
- "cards":[
- {
- "title":"Camp Protection",
- "content":"Comprehensive measures ensure every camper is safe, including trained staff, strict supervision, and clear emergency protocols throughout their stay."
- },
- {
- "title":"Peace of Mind",
- "content":"Parents and campers can feel confident knowing that safety, well-being, and support are prioritized at all times."
- }
- ]
- },
- "philosophy":{
- "title":"Go and Grow Camp",
- "subtitle":"Our Philosophy",
- "cards":[
- {
- "title":"Community",
- "content":"What is most important for us at camp is the community. We want everyone – participants, teamers and camp directors, no matter from which country or what culture – to have an unforgettable time and every single one of us helps to reach this goal.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Responsibility",
- "content":"We want everyone to help shape the daily life at camp. Besides playing this of course also includes social coexistence. Together with us your children keep the camp clean. This means cleaning the dishes and wiping the tables after a meals, as well as keeping the camp and sanitary facilities clean and tidying up the tents and huts together. All this of course, in a manner appropriate to the age of your children. This is how we, in shared responsibility, make everybody feel comfortable.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Internationality",
- "content":"At camp new friendships arise even though some campers live thousands of kilometers apart. Our experienced campers immediately include newcomers because this is what they love camp for – they come to make new friends and meet their fellow camp mates again. After our camp season many parents tell us about mutual visits – some went to France, Spain or Canada. They also tell us about the increased motivation of their children to pay a little more attention to the language lessons at school so conversations at camp next summer become easier.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Log off, get outside",
- "content":"We want all campers to have a relaxed holiday. Mobile phones are especially counterproductive to reach this goal. Therefore, our camps are mobile-free zones and we would like your children to hand over their phones and all other electronic devices to our teamers on the day of arrival so they can really relax. This also means that your children cannot be reached by phone outside the daily telephone hour which is after lunch.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"No power to drugs",
- "content":"For legal reasons, as a result of our cooperation with the organization 'No power to drugs' and by our conviction that drugs don't belong into the hands of children and young adults, it is strictly forbidden for all campers to possess or consume any kind of drugs including cigarettes and alcoholic drinks. Non-compliance with this rule will lead to the suspension from camp or even criminal charges. It is our belief that with all our activities and the great atmosphere at camp, we offer much better alternatives anyway!",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Dealing with discrimination",
- "content":"We would like to point out that we do not accept any form of discrimination, bullying or violence so that all campers can enjoy a happy, relaxed and safe holiday at camp.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- }
-
- ]
- },
- "security":{
- "title":"Go and Grow Camp",
- "subtitle":"Security Concept",
- "cards":[
- {
- "title":"Background Check",
- "content":"Every counselor, chef, teamer or helper that enters our camps has to be registrated, complete a background check, as well as have references. That's why parents are only allowed on the camp site on the day of arrival and departure and not during the week. We want to make sure that we have checked and know every adult who is with us at camp.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Education",
- "content":"Each counselor must complete an almost two-week training course with us, from early in the morning until late in the evening includes so many lessons that the number of hours even corresponds to the basic study in educational sciences. Here we focus on the areas of safety, accident prevention, child psychology and needs as well as the various safety aspects in the field of experiential education.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Crisis Intervention",
- "content":"If something should happen, it is not only important to provide first aid for the affected person, but also to care for the other children and adolescents. We have a specially trained team for crisis intervention, which then provides immediate care and can thus prevent possible traumatisation due to the experience.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Nightwatch",
- "content":"All our camps are also supervised at night by the counselors/teamers. On the one hand we want to prevent visitors from coming to the site - which has not happened until today - and on the other hand we want to be there for the children if they wake up at night and get homesick or have to go to the toilet. The nightwatch patrols the area and is otherwise reachable at a central place for the children. Some of our locations - e.g. the headquarters in Walsrode - are also video-monitored and fenced in.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Caregiver Key",
- "content":"No safety without sufficient staff! We are the leaders in Germany with our great caregiver key. There are no camps that have a key worse than 1:6-1:8, which means that one caregiver is responsible for a maximum of 6-8 children. In the junior camps we also use our CIT (Counselor in Training), so that we often reach a key of only 1:4. We know that this key can seem exaggerated, but we want to guarantee the highest possible safety and we firmly believe that this is exactly what our high level of caregiver commitment leads to.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Cooperation",
- "content":"Cooperation with the independent representative for questions of sexual child abuse via our umbrella organisation Reisenetz e.V.: Go and Grow Camp was one of the first tour operators for children and young people to develop a protection concept that prevents sexual abuse among children and young people. Today, this concept is considered important by many other tour operators, also due to our personal commitment in various associations and professional circles. Of course, the background check and the '6-eyes principle', which states that a child must never be alone with a caregiver, is also an essential part of our protection concept. The most important thing, however, is to create an 'open system' in which everyone knows that sexual abuse should not be a taboo subject, but that simple instruments such as a grievance box and feedback system can immediately address grievances and that they do not have to be denied.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Quality",
- "content":"As a member of the quality committee of the professional association for children and youth travel 'Reisenetz', our managing director Jan Vieth is responsible for further developing and checking the quality guidelines of the entire industry. As Germany's ambassador to the ICF, he is also kept up to date on improvements in camp and training quality worldwide and adapts these as quickly as possible to our own camps.",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"Accessibility",
- "content":"Of course, all parents receive a number from us, which allows them to reach us 24 hours a day in an emergency. If an emergency occurs at your home, you can inform us immediately and we can decide together how, when and whether to inform your child",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- },
- {
- "title":"In case of emergency",
- "content":"Every caregiver has a valid first aid certificate and can help if necessary",
- "author":{
- "avt":"https://i.pravatar.cc/150?img=12",
- "name":"abc",
- "role":"customer",
- "rating":"5"
- }
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/data/service.json b/data/service.json
deleted file mode 100644
index aed5488..0000000
--- a/data/service.json
+++ /dev/null
@@ -1,363 +0,0 @@
-{
- "pageTitle": "Visaway – Immigration & Visa Consulting HTML Template",
-
- "services": {
- "title": {
- "subTitle": "What We Offer",
- "mainTitle": "Our Immigration Services"
- },
- "items": [
- {
- "slug": "immigration-appeal",
- "name": "Immigration Appeal & Legal Support",
- "description": "Our experts provide professional guidance for immigration appeals and legal matters, helping clients overcome visa rejections with personalized strategies and strong case representation.",
- "image": "/img/home-3/service/01.jpg",
- "layout": "left",
- "details": {
- "title": "Immigration Appeal & Legal Support",
- "description": "Our experts provide professional guidance for immigration appeals and legal matters, helping clients overcome visa rejections with personalized strategies and strong case representation. We analyze your case thoroughly and develop custom strategies to maximize your chances of success.",
- "mainImage": "/img/inner-page/service-details/details-1.jpg",
- "overviewTitle": "Service Overview",
- "overviewDescription": "Our Immigration Appeal & Legal Support service is designed to help clients navigate complex immigration challenges. We provide expert legal guidance, case analysis, and strategic representation to maximize your chances of success. With our expert consultants, personalized approach, and global network, we ensure a smooth transition for every client.",
- "additionalDescription": "From start to finish, we are committed to turning your immigration challenges into success stories through professional legal representation and strategic planning.",
- "keyFeaturesTitle": "Key Features",
- "keyFeaturesImage": "/img/inner-page/service-details/details-2.jpg",
- "features": [
- {
- "title": "Personalized Guidance",
- "description": "Tailored support for each client's specific legal situation and requirements."
- },
- {
- "title": "Expert Legal Team",
- "description": "Experienced immigration lawyers with proven track records in appeals."
- },
- {
- "title": "Case Analysis & Strategy",
- "description": "Thorough case review and development of winning appeal strategies."
- },
- {
- "title": "Document Preparation",
- "description": "Professional preparation of all legal documents and supporting evidence."
- },
- {
- "title": "Court Representation",
- "description": "Expert representation in immigration courts and tribunals."
- },
- {
- "title": "Success Monitoring",
- "description": "Regular updates and monitoring throughout the appeal process."
- }
- ],
- "faqTitle": "Frequently Asked Question",
- "faqImage": "/img/inner-page/service-details/details-3.jpg",
- "faq": [
- {
- "id": "faq-appeal-1",
- "question": "01. What are the chances of a successful appeal?",
- "answer": "Success rates vary by case type and circumstances, but our experienced legal team significantly improves your chances through thorough case analysis and strategic representation tailored to your specific situation.",
- "isExpanded": false
- },
- {
- "id": "faq-appeal-2",
- "question": "02. How long does the appeal process take?",
- "answer": "Appeal timelines vary by jurisdiction and case complexity, typically ranging from 6-18 months. We keep you informed throughout the process and work to expedite where possible.",
- "isExpanded": false
- },
- {
- "id": "faq-appeal-3",
- "question": "03. What documents do I need for an appeal?",
- "answer": "Required documents vary by case but typically include the original decision, supporting evidence, and legal submissions. We provide a comprehensive checklist and assist with document preparation.",
- "isExpanded": false
- },
- {
- "id": "faq-appeal-4",
- "question": "04. Do you handle all types of immigration appeals?",
- "answer": "Yes, we handle various types of immigration appeals including visa refusals, deportation orders, and residency rejections. Our team has expertise across all immigration categories.",
- "isExpanded": false
- }
- ]
- }
- },
- {
- "slug": "scholarship-guidance",
- "name": "Scholarship & Study Grant Guidance",
- "description": "We help students unlock opportunities to study abroad with the right financial support. Our expert advisors guide you in finding scholarships, grants, and funding options that match your academic background, chosen destination, and career goals.",
- "image": "/img/home-3/service/02.jpg",
- "layout": "right",
- "details": {
- "title": "Scholarship & Study Grant Guidance",
- "description": "We help students unlock opportunities to study abroad with the right financial support. Our expert advisors guide you in finding scholarships, grants, and funding options that match your academic background, chosen destination, and career goals. From preparing strong applications to meeting eligibility criteria, we ensure you maximize your chances of securing financial aid.",
- "mainImage": "/img/inner-page/service-details/details-1.jpg",
- "overviewTitle": "Service Overview",
- "overviewDescription": "Our Education Visa Consultancy is dedicated to guiding students in achieving their study abroad dreams. We provide complete support including university selection, application assistance, scholarship guidance, visa documentation, and interview preparation. With our expert consultants, personalized approach, and global network, we ensure a smooth transition for every student.",
- "additionalDescription": "From start to finish, we are committed to turning your education journey into a successful international experience.",
- "keyFeaturesTitle": "Key Features",
- "keyFeaturesImage": "/img/inner-page/service-details/details-2.jpg",
- "features": [
- {
- "title": "Personalized Guidance",
- "description": "Tailored support for each student's goals and requirements."
- },
- {
- "title": "Target Audience & Persona Development",
- "description": "Experienced team with global education and visa knowledge."
- },
- {
- "title": "Scholarship & Grant Assistance",
- "description": "Helping students secure financial aid opportunities."
- },
- {
- "title": "Visa Application Support",
- "description": "Step-by-step guidance for smooth visa processing."
- },
- {
- "title": "Interview Preparation",
- "description": "Coaching for successful student visa interviews."
- },
- {
- "title": "Documentation Assistance",
- "description": "Accurate and complete paperwork for faster approvals."
- }
- ],
- "faqTitle": "Frequently Asked Question",
- "faqImage": "/img/inner-page/service-details/details-3.jpg",
- "faq": [
- {
- "id": "faq-scholarship-1",
- "question": "01. Do you assist with university selection?",
- "answer": "Absolutely! We identify suitable scholarships, guide application processes, and maximize your chances of receiving financial aid.",
- "isExpanded": false
- },
- {
- "id": "faq-scholarship-2",
- "question": "02. Can you help with scholarship applications?",
- "answer": "Absolutely! We identify suitable scholarships, guide application processes, and maximize your chances of receiving financial aid.",
- "isExpanded": true
- },
- {
- "id": "faq-scholarship-3",
- "question": "03. How long does the visa process take?",
- "answer": "Absolutely! We identify suitable scholarships, guide application processes, and maximize your chances of receiving financial aid.",
- "isExpanded": false
- },
- {
- "id": "faq-scholarship-4",
- "question": "04. Is post-arrival support available?",
- "answer": "Absolutely! We identify suitable scholarships, guide application processes, and maximize your chances of receiving financial aid.",
- "isExpanded": false
- }
- ]
- }
- },
- {
- "slug": "permanent-residency",
- "name": "Permanent Residency (PR) Services",
- "description": "Our PR services guide clients through every step of the residency process, including documentation, eligibility assessment, and application support, ensuring a smooth and successful approval.",
- "image": "/img/home-3/service/03.jpg",
- "layout": "left",
- "details": {
- "title": "Permanent Residency (PR) Services",
- "description": "Our PR services guide clients through every step of the residency process, including documentation, eligibility assessment, and application support, ensuring a smooth and successful approval.",
- "mainImage": "/img/inner-page/service-details/details-1.jpg",
- "overviewTitle": "Service Overview",
- "overviewDescription": "Our Permanent Residency services provide comprehensive support for individuals seeking to establish permanent residence in their chosen country. We handle all aspects of the PR application process with expertise and care.",
- "additionalDescription": "Our experienced team ensures that your PR application is handled professionally and efficiently, maximizing your chances of approval.",
- "keyFeaturesTitle": "Key Features",
- "keyFeaturesImage": "/img/inner-page/service-details/details-2.jpg",
- "features": [
- {
- "title": "Eligibility Assessment",
- "description": "Comprehensive evaluation of your PR eligibility and options."
- },
- {
- "title": "Points Calculation",
- "description": "Accurate calculation and optimization of your points score."
- },
- {
- "title": "Document Verification",
- "description": "Thorough verification and preparation of all required documents."
- },
- {
- "title": "Application Tracking",
- "description": "Regular updates and tracking of your PR application status."
- },
- {
- "title": "Interview Preparation",
- "description": "Coaching and preparation for PR interviews if required."
- },
- {
- "title": "Post-Approval Support",
- "description": "Guidance on next steps after PR approval and settlement."
- }
- ],
- "faqTitle": "Frequently Asked Question",
- "faqImage": "/img/inner-page/service-details/details-3.jpg",
- "faq": [
- {
- "id": "faq-pr-1",
- "question": "01. How long does the PR process take?",
- "answer": "Processing times vary by country and program, typically ranging from 12-24 months. We provide realistic timelines based on current processing standards.",
- "isExpanded": false
- },
- {
- "id": "faq-pr-2",
- "question": "02. What documents are required for PR application?",
- "answer": "Document requirements vary by country but typically include educational credentials, work experience, language test results, and medical examinations. We provide a complete checklist.",
- "isExpanded": true
- },
- {
- "id": "faq-pr-3",
- "question": "03. Can I include my family in the PR application?",
- "answer": "Yes, most PR programs allow you to include your spouse and dependent children. We help you understand family inclusion requirements and processes.",
- "isExpanded": false
- },
- {
- "id": "faq-pr-4",
- "question": "04. What happens if my PR application is rejected?",
- "answer": "If rejected, we analyze the reasons and explore options including appeals, reapplication, or alternative immigration pathways to achieve your goals.",
- "isExpanded": false
- }
- ]
- }
- },
- {
- "slug": "citizenship-naturalization",
- "name": "Citizenship & Naturalization Guidance",
- "description": "We provide expert guidance for citizenship and naturalization processes, assisting clients with documentation, eligibility, and legal procedures to achieve a smooth and successful application.",
- "image": "/img/home-3/service/04.jpg",
- "layout": "right",
- "details": {
- "title": "Citizenship & Naturalization Guidance",
- "description": "We provide expert guidance for citizenship and naturalization processes, assisting clients with documentation, eligibility, and legal procedures to achieve a smooth and successful application.",
- "mainImage": "/img/inner-page/service-details/details-1.jpg",
- "overviewTitle": "Service Overview",
- "overviewDescription": "Our Citizenship & Naturalization service helps individuals navigate the complex process of becoming a citizen. We provide step-by-step guidance, documentation support, and legal expertise throughout the entire process.",
- "additionalDescription": "With our comprehensive approach, we make the path to citizenship clear, manageable, and successful for every client.",
- "keyFeaturesTitle": "Key Features",
- "keyFeaturesImage": "/img/inner-page/service-details/details-2.jpg",
- "features": [
- {
- "title": "Citizenship Test Preparation",
- "description": "Comprehensive preparation for citizenship knowledge tests."
- },
- {
- "title": "Language Requirements",
- "description": "Guidance on meeting language proficiency requirements."
- },
- {
- "title": "Residency Verification",
- "description": "Assistance with proving residency and physical presence requirements."
- },
- {
- "title": "Application Processing",
- "description": "Complete support throughout the citizenship application process."
- },
- {
- "title": "Interview Coaching",
- "description": "Preparation and coaching for citizenship interviews."
- },
- {
- "title": "Ceremony Preparation",
- "description": "Support and guidance for the citizenship ceremony process."
- }
- ],
- "faqTitle": "Frequently Asked Question",
- "faqImage": "/img/inner-page/service-details/details-3.jpg",
- "faq": [
- {
- "id": "faq-citizenship-1",
- "question": "What are the basic requirements for citizenship?",
- "answer": "Requirements typically include permanent residency, physical presence, language proficiency, and knowledge of the country's history and government. Specific requirements vary by country.",
- "isExpanded": false
- },
- {
- "id": "faq-citizenship-2",
- "question": "How do I prepare for the citizenship test?",
- "answer": "We provide comprehensive study materials, practice tests, and coaching sessions to help you prepare for both the knowledge test and language requirements.",
- "isExpanded": false
- },
- {
- "id": "faq-citizenship-3",
- "question": "How long does the citizenship process take?",
- "answer": "Processing times vary by country but typically range from 12-24 months from application to ceremony. We help you understand specific timelines for your situation.",
- "isExpanded": false
- },
- {
- "id": "faq-citizenship-4",
- "question": "Can I maintain dual citizenship?",
- "answer": "Dual citizenship policies vary by country. We help you understand the implications and requirements for maintaining multiple citizenships if applicable.",
- "isExpanded": false
- }
- ]
- }
- }
- ]
- },
-
- "destinations": {
- "backgroundImage": "/img/home-3/choose-us/bg.png",
- "title": {
- "subTitle": "Countries we offer",
- "mainTitle": "Choose Your Immigration Destination"
- }
- },
-
- "visas": {
- "items": [
- {
- "id": "family-visa",
- "number": "01",
- "name": "Family Visa",
- "description": "Our Family Visa services help reunite loved ones by providing expert guidance.",
- "buttonText": "service _ 02",
- "buttonLink": "service-details.html"
- },
- {
- "id": "student-visa",
- "number": "02",
- "name": "Student Visa",
- "description": "We provide expert guidance for student visa applications.",
- "buttonText": "service _ 02",
- "buttonLink": "service-details.html"
- },
- {
- "id": "work-visa",
- "number": "03",
- "name": "Work Visa",
- "description": "Collaboratively disintermediate one to one functionalities and long term.",
- "buttonText": "service _ 02",
- "buttonLink": "service-details.html"
- }
- ]
- },
-
- "reviews": {
- "title": {
- "subTitle": "What Our Clients Say",
- "mainTitle": "Immigration Success Stories"
- },
- "thumb": "/img/home-3/test-thumb.jpg",
- "items": [
- {
- "id": "client-review-1",
- "rating": 5,
- "content": "The team provided exceptional guidance throughout my immigration process.",
- "author": {
- "name": "Mohammed Ali,",
- "type": "Family Visa"
- },
- "icon": "fa-solid fa-quote-right"
- },
- {
- "id": "client-review-2",
- "rating": 5,
- "content": "Their expertise and personalized support ensured a smooth visa approval.",
- "author": {
- "name": "Sarah Johnson,",
- "type": "Student Visa"
- },
- "icon": "fa-solid fa-quote-right"
- }
- ]
- }
-}
diff --git a/data/terms-conditions.json b/data/terms-conditions.json
deleted file mode 100644
index 98df5d5..0000000
--- a/data/terms-conditions.json
+++ /dev/null
@@ -1,152 +0,0 @@
-{
- "hero": {
- "title": "Frequently Asked Questions",
- "backgroundImage": "/uploads/terms/faqimage.jpg",
- "sectionClass": "uk-section-default uk-section-overlap uk-preserve-color uk-light uk-position-relative",
- "backgroundClasses": "uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-section-xlarge",
- "overlayStyle": {
- "backgroundColor": "rgba(0, 0, 0, 0)"
- },
- "titleClass": "text-white text-[5vw] uk-text-center",
- "enableScrollspy": true
- },
-
- "page": {
- "title": "Terms & Conditions Go and Grow Camp e.K.",
- "divider": true,
- "sectionClass": "uk-section-default uk-section-overlap uk-section",
- "titleClass": "text-[2.5vw] text-[#292c3d] uk-text-left@m uk-text-center",
- "dividerClass": "uk-divider-small uk-text-left@m uk-text-center"
- },
-
- "content": {
- "sectionClass": "uk-section-muted uk-section-overlap uk-section",
- "textClass": "uk-panel uk-margin text-[1vw]",
- "content": [
- {
- "type": "paragraph",
- "text": "This is an English translation of the original and legally binding German document \"Allgemeine Geschäftsbedingungen Go and Grow Camp e.K.\", which can be viewed at https://www.campadventure.de/de/infos/agb . This translation is for your information only and is not legally binding."
- },
- {
- "type": "paragraph",
- "text": "Go and Grow Camp e.K. is the tour operator for individuals, for camps in Germany, England and Northern Ireland. "
- },
- {
- "type": "paragraph",
- "text": "GUARANTEE: All participants are protected in accordance with the legal regulations governing tour operators in Germany. As per §651, any payments made towards the travel price are insured against insolvency by tourVers."
- },
- {
- "type": "paragraph",
- "text": "The following terms and conditions of travel apply to package travel contracts, to which the §§ 651a ff BGB regulations relating to travel contracts apply. The provisions, in so far as these have been effectively agreed, become part of the contract formed between the traveler and tour operator. They supplement and complete the legal regulations of §§ 651 a to y BGB and Articles 250 und 252 EGBGB."
- },
- {
- "type": "section",
- "title": "1. Conclusion of the travel contract",
- "content": "By registering for travel, the traveler submits a binding offer to conclude the travel agreement. Registrations can be made verbally, by telephone, in writing, by email or by electronic means, such as the internet booking system \"Book a Camp\". The contract comes into effect once a declaration of acceptance has been received. The tour operator will provide the traveler with a booking confirmation in line with legal requirements in a durable medium, unless the traveler is entitled to a travel confirmation in paper form under Article 250 § 6 Paragraph 1 Clause 2 EGBG. If the registration is made electronically, the contract is concluded once the traveler has received confirmation from the tour operator in a durable medium. If the corresponding travel confirmation is displayed directly after using the \"place a binding order\" button, the contract comes into effect upon display of this confirmation. The traveler will receive travel documents 2-3 weeks before the start of the trip. Any additional agreements, arrangements and wishes must be confirmed by us in writing, otherwise the services laid out in the contract apply. The traveler is liable for all contractual obligations of travelers that he registers, just as he is for his own, provided that he has assumed this obligation through an explicit and separate declaration. Should the contents of the booking confirmation deviate from the content of the booking, this constitutes a new offer, to which the tour operator is bound for a period of 10 days. The contract takes effect on the basis of this new offer, provided that the tour operator has indicated the changes relating to this new offer and has fulfilled his precontractual information duties and that the traveler gives the tour operator express consent, either through explicit declaration or deposit, within the commitment period. Pursuant to the legal regulation § 312 g Para. 2, Clause 1 Nr. 9 BGB and relating to all of the above-mentioned booking types, no right of withdrawal exists for distance contracts after contract conclusion. However, withdrawal from the contract on the basis of § 651 h BGB is possible at any time."
- },
- {
- "type": "section",
- "title": "2. Terms of payment",
- "content": "Go and Grow Camp e.K. shall only request or accept payments towards the travel price before the completion of the trip if the traveler has been provided with a guarantee certificate, stating the name and contact details of the credit institution, in accordance with § 651 r Abs. 4 BGB. A deposit of USD 50 per participant is due within one week of registration and after the issue of a guarantee certificate. The outstanding balance must be transferred, without specific request, no later than four weeks before the start of the trip, provided that the guarantee certificate has been issued and that the tour operator has not exercised its right of withdrawal on the grounds stated in Point 7. If, even after notification, the specified deposit sum is not payed, or the travel price has not been paid in full, prior to the commencement of the trip, although the tour operator is ready to provide the contractual services, has fulfilled all legal obligations and the client has no legal or contractual right of retention, the tour operator is entitled to withdraw from the travel contract after issuing a reminder with a deadline and to charge cancellation fees to the traveler."
- },
- {
- "type": "section",
- "title": "3. Services and service modifications",
- "content": "a) Our services are defined in our service descriptions and general program information found on the website https://www.campadventure.de/en/ and in the information given in the travel confirmation. Any additional agreements affecting the scope of the contractual services must be confirmed by us in written form. b) Luggage will be transported without any additional fee, as long as it does not exceed the norms, here defined as a maximum of 1 suitcase and 1 piece of hand luggage per person. c) External services arranged by us as part of the journey are not part of the initial travel contract, as long as these services are clearly marked as such with the identity and address of the contractual partner in the travel information and travel confirmation, such that the traveler can recognize that these are not part of the travel services offered by the tour operator. d) Any modifications to and deviations from the essential travel services agreed upon in the travel contract that become necessary after conclusion of the contract and are made in good faith, are permissible as long as the modifications and deviations are not substantial and do not impact the overall arrangement of the booked trip. e) The tour operator is obliged to inform the traveler of the reasons for a permissible modification to the essential travel service immediately, clearly, understandably and in a durable medium. f) In the event of a substantial change to an essential travel service or a deviation from special provisions stipulated in the contract for a traveler, the traveler is entitled to withdraw from the contract or demand another journey of at least equivalent value by the deadline specified at the same time as the contract change. This only applies if the tour operator is in a position to offer such a trip without any extra cost to the traveler. The traveler is free to decide whether to respond to the communication or not. The traveler is obliged to exercise these rights after being notified of the change. If the traveler does not respond by the specified deadline or at all, the communicated changes will be understood to be accepted. Any warranty claims remain unaffected, in so far as the modified services are deficient."
- },
- {
- "type": "section",
- "title": "4. Customer cancellation",
- "content": "The traveler is advised to communicate cancellation in a durable medium. Should the traveler withdraw from the travel contract before the start of the trip, or should he not begin the trip, the tour operator may claim fair compensation, provided it is not responsible for the withdrawal and that no exceptional circumstances have arisen at the destination or in the immediate vicinity, which have a significant effect on the execution of the trip or the transportation of persons to the destination. The compensation value is based on the travel price less the value of the costs saved by the tour operator and the sum that the tour operator is able to earn through alternative use of its services. The standard rates are based on the time period between the notice of cancellation and the start of the trip, as well as the expected saved expenses and the possible sum resulting from any other use of travel services. Upon receipt of notice of cancellation, compensation is calculated according to a sliding percentage scale, as follows (cancellation costs per person):",
- "subsections": [
- {
- "type": "cancellation_table",
- "title": "Standard Cancellation Fees",
- "items": [
- "cancellation up to 60 days before the beginning of the trip – USD 50/100",
- "cancellation up to 31 days before the beginning of the trip – 30% of travel costs, USD 50 minimum",
- "cancellation up to 14 days before the beginning of the trip – 50% of travel costs, USD 50 minimum",
- "cancellation up to 1 day before the beginning of the trip – 80% of travel costs, USD 50 minimum",
- "cancellation on the day of arrival or later – 90% of travel costs"
- ]
- },
- {
- "type": "cancellation_section",
- "title": "Cancellation policy for school groups:",
- "items": [
- "A correction of student numbers up to 10% students is free of charge. Any higher alteration of numbers will lead to an extra cost.",
- "Cancellation till 60 days before start of the trip: the fee will be 20% of the total price.",
- "Cancellation till 30 days before start of the trip: the fee will be 40% of the total price.",
- "Cancellation till 14 days before start of the trip: the fee will be 60% of the total price.",
- "Cancellation till 1 day before start of the trip: the fee will be 90% of the total price.",
- "Any later cancellations till the day before the trip: the fee will be 100% of the total price."
- ]
- },
- {
- "type": "note",
- "text": "In any event, it is up to the customer to demonstrate that compensation owed to the tour operator is significantly lower that the cancellation fee claimed. The tour operator reserves the right, by way of deviation from the above charges, to claim a higher, individually calculated compensation sum, insofar as it can prove that significantly greater expenses than the relevant flat rate were incurred. In this case, the tour operator is required to calculate and prove these extra costs, taking into account the costs saved by the tour operator and the sum that the tour operator is able to earn through alternative use of the services. Following cancellation, the tour operator is obliged to issue a refund immediately, but in any case within 14 days of receipt of the notice of cancellation. § 651 e BGB remains unaffected by the above conditions. It is recommended that travelers take out cancellation insurance."
- }
- ]
- },
- {
- "type": "section",
- "title": "5. Modifications at the traveler's request",
- "content": "After conclusion of the contract the traveler may not change travel dates, the destination, starting location, accommodation or mode of transport. This does not apply if the change to the booking is necessary because the tour operator provided the traveler due to inadequate or false precontractual information provided by the tour operator, as per Art. 250 § 3 EGBGB. In this case, travel may be rebooked at no extra cost. Should the traveler demand changes or rebooking after conclusion of the contract, up to 32 days before departure, the tour operator is entitled to charge a processing fee of USD 20, unless the tour operator demonstrates that higher compensation is due, the sum of which is based on the travel price minus the costs saved by the tour operator and the sum that the tour operator is able to earn through alternative use of its services. Requests to change bookings after this period can only be honored, if at all, by withdrawing from the travel contract and simultaneously reregistering, as per Section 4. This does not apply to requests only resulting in minor additional costs."
- },
- {
- "type": "section",
- "title": "6. Disruption by the traveler",
- "content": "If the traveler continuously disrupts the travel program, despite warnings from the tour operator, or behaves contrary to the contract, such that immediate termination of the contract is justified, the tour operator may cancel the travel contract without notification. This also applies when the traveler does not consider reasonable and well-founded instructions. In such cases, the tour operator is entitled to retain the full travel price, minus the costs saved by the tour operator and the sum that the tour operator is able to earn through alternative use of the unused service, including any sums credited to it by service providers, so the daily rate can be reduced by 20% as a result of savings made by services not provided. Compensation claims remain unaffected. This shall not apply if such behavior contrary to the terms of the contract is a result of a breach of information duties on the part of the tour operator."
- },
- {
- "type": "section",
- "title": "7. Minimum number of participants",
- "content": "If the number of participants registered for our holiday camps our transfer services is less than 10-60 participants (depending on the trip), the tour operator may withdraw from the travel contract up to 6 weeks before the start of the trip. The tour operator must have stated the minimum number of participants for the relevant trip and the latest date by which the traveler must be informed of cancellation in the travel information and must also have clearly stated the minimum number of participants and the latest possible date of withdrawal in the travel confirmation. If it is evident at an earlier stage that the minimum number of participants will not be reached, the tour operator is obliged to inform the traveler immediately. If the trip does not take place for this reason, the tour operator is obliged to issue a refund of any payments made on the travel price immediately and in any case within 14 days of notice of withdrawal."
- },
- {
- "type": "section",
- "title": "8. Warranty and remedy",
- "content": "Should services not be rendered according to the contract, the traveler is entitled to claim legal warranty rights for a reduction in the trip price, according to § 651 m BGB, provided that the traveler has not failed in his contractual duties to report any faults to the tour operator which may have occurred during the provision of services. In the event of a defect during the tour, the traveler can only remedy the defect himself or, in the case of a considerable defect, as described in § 651 i Abs. 2 BGB, cancel the trip, according to § 651 l BGB, as long as the tour operator has been given an adequate time to remedy the defect. A deadline need not be defined if remedial action is impossible or rejected by the tour operator or if immediate remedial action or termination is justified due to particular interests of the client. The traveler is obliged to inform the tour operator of any defect immediately and on the spot. Defects should be reported to the tour manager of the tour operator, to the contact person at the contact address or the tour operator directly. Should a representative of the tour operator not be available or contractually obliged, the tour operator must be informed of any defects relating to the trip at the following address: Go and Grow Camp e.K., Museumstr. 39, 22765 Hamburg. It is recommended that such notifications are made in a durable medium. In accordance with § 651 j BGB, claims shall lapse two years after the final day of the trip, as defined by the contract. We refer to the mutual assistance clause under § 651 q BGB, according to which the traveler is entitled to adequate assistance, notably through the provision of appropriate information concerning healthcare services, local authorities and consular assistance, as well as support in establishing communication links and in the search for other travel options, without delay in the event of § 651 k Para. 4 BGB or if the traveler faces difficulties for other reasons. § 651 k Para. 3 BGB remains unaffected."
- },
- {
- "type": "section",
- "title": "9. Traveler's duty of cooperation",
- "content": "The passenger is obliged to cooperate within the framework of legal regulations and to avoid or minimize potential damages. In the case of travel involving minors, it is the person with the supervisory role and not the tour operator, who is liable for any damages that arise. A violation of regulations may result in exclusion from the trip, as stipulated in Point 6 \"Disruption by the traveler\". Destruction, loss, damage or delay of baggage must be communicated to the transport company immediately. The transport company is required to issue written confirmation. In the case of no notification, there is a danger of losing the right to claims. The tour operator recommends that damage or delay in delivery when travelling by air is urgently and immediately reported to the relevant airline on the spot by means of a property irregularity report (P.I.R.). As a rule, airlines refuse to provide compensation if a property irregularity report has not been completed. The property irregularity report must be submitted within 7 days for lost luggage and within 21 days of delivery of delayed luggage. Otherwise, loss, damage or misdirection of baggage must be reported to the tour operator or to the local representative of the operator. This does not release the traveler from providing the airline with a property irregularity report within the above-mentioned periods."
- },
- {
- "type": "section",
- "title": "10. Limitation of liability",
- "content": "The tour operator's contractual liability for damages, not including damage to the body, nor damage caused by the negligence of the tour operator, is limited to three times the tour price. Any claims under international agreements or on legal regulations based on these remain unaffected by this limitation. We are not liable for service disruptions, personal injury or property damage in connection with third party services that are explicitly designated as such in the travel description and travel confirmation, where the name and address of the contract partner are given, in such a way that the traveler can clearly recognize that these are not an integral part of the travel services offered by the tour operator and that these are chosen separately. This applies in particular to additional programs over the course of the trip. §§ 651 b, 651 c, 651 w und 651 y remain unaffected. The tour operator is however liable if and insofar as the traveler suffers damages as a result of the failure of the tour operator to fulfill its information, clarification and organization obligations."
- },
- {
- "type": "section",
- "title": "11. Passport, visa and health requirements",
- "content": "The tour operator will inform the customer of any important changes to the general regulations contained in the travel announcement before the start of the trip. Before conclusion of the contract, the tour operator will inform the traveler of visa requirements and health formalities applicable to the destination country, including approximate periods for obtaining the necessary visa and will inform the traveler of any changes to these before the start of the trip. The tour operator shall not be liable for the timely issue and acquisition of necessary visas from the relevant diplomatic representation, if the traveler has charged the tour operator with the procurement of visas, unless the tour operator neglected its duties or is responsible for the delay. The traveler is responsible for compliance with all regulations important for the operation of the tour. The traveler is responsible for obtaining and carrying the necessary travel documents, any necessary vaccinations and for adhering to customs and foreign exchange regulations. Any disadvantages arising from failure to comply with these regulations, including but not limited to the payment of cancellation fees, shall be at the traveler's cost. This does not apply if the tour operator has not provided information, or if the information provided proves to be insufficient or false."
- },
- {
- "type": "section",
- "title": "12. Data protection",
- "content": "The protection of clients' privacy and personal data is very important to Go and Grow Camp. Go and Grow Camp collects and processes data according to legal regulations. Personal data is only stored when necessary for the performance of booked services or to comply with legal regulations."
- },
- {
- "type": "section",
- "title": "13. Place of jurisdiction",
- "content": "The entire legal and contractual relationship between the travel operator and travelers with no general place of residence or registered office in Germany shall be governed exclusively by German law, on the proviso that, should the traveler have a general place of residence in another country in accordance with Art. 6 Para. 2 of the Rome I Regulation, they are also protected by any mandatory rules of law in that country, which would not otherwise apply. The traveler can take legal action against the tour operator only at its registered office. Should the travel operator take legal action against the traveler, the domicile of the traveler is decisive, unless action is directed against registered traders or persons who have changed their residence or customary place of abode to a foreign country or whose residence or customary place of abode is not known at the time when legal action is brought. In such cases, the registered office of the tour operator is decisive. With respect to the law concerning consumer dispute resolution, the tour operator advises that it will not take part in any voluntary dispute settlement. Should the tour operator be obliged to take part in a dispute settlement after the printing of these travel conditions, the tour operator will inform the traveler of this in appropriate form. In relation to all travel contracts concluded electronically, the tour operator refers to the European online dispute resolution platform http://ec.europa.eu/consumers/odr/ ."
- },
- {
- "type": "section",
- "title": "14. Identity of the operating airline",
- "content": "Should the travel contract include transport by plane, the traveler will be informed of the identity and name(s) of the operating airline(s) providing all air transport services as part of the booked trip. Should the identity of the airline(s) be undetermined at the time of booking, the tour operator will inform the traveler of the airline or airlines that are most likely to operate the flight or flights and will inform the traveler immediately, as soon as this is determined. The tour operator must inform the traveler immediately if the airline is changed. The tour operator must take all appropriate steps to ensure that the customer is informed of the change as quickly as possible. The list of airlines on the EU blacklist can be found here: https://ec.europa.eu/transport/modes/air/safety/air-ban/search_en "
- },
- {
- "type": "section",
- "title": "15. Invalidity of individual terms",
- "content": "The invalidity of individual terms does not render other conditions or the contract as a whole invalid. 16. VAT Exemption in accordance with § 4 Nr. 23 UstG, Go and Grow Camp e.K. is exempt from sales tax for all child and youth travel."
- },
- {
- "type": "paragraph",
- "text": "Last updated: August 2018"
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/data/travel.json b/data/travel.json
deleted file mode 100644
index 92f4ffe..0000000
--- a/data/travel.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "hero": {
- "title": "Go and Grow Camp\nLast travel informations",
- "backgroundImage": "/uploads/banner/b18.jpg"
- },
- "page": {
- "type": "blog",
- "title": "Go and Grow Camp - Travel",
- "year": "2026"
- },
- "posts": [
- {
- "id": "travel-info-2026",
- "title": "Travel Information — Go and Grow Camp 2026",
- "slug": "travel-information-2026",
- "date": "2026-01-01",
- "author": "Go and Grow Camp",
- "excerpt": "Summary of important travel details, arrival/departure times and contact points.",
- "coverImage": "/uploads/banner/b18.jpg",
- "categories": ["Travel", "Info"],
- "tags": ["travel", "camp", "2026"],
- "content": {
- "blocks": [
- {
- "type": "paragraph",
- "data": {
- "text": "Our entire team is looking forward to an exciting and adventurous holiday camp with you. Below you will find a summary of all the important information about our adventure, sports and language camps. If you have any further questions, please contact us at office@campadventure.de"
- }
- }
- ]
- }
- }
- ]
-}
diff --git a/data/visa.json b/data/visa.json
deleted file mode 100644
index f39e1d5..0000000
--- a/data/visa.json
+++ /dev/null
@@ -1,300 +0,0 @@
-{
- "hero": {
- "title": "Visa Service",
- "summaryList": [
- {
- "id": 1,
- "name": "France",
- "slug": "france",
- "icon": "/img/home-2/visa/03.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ],
- "detailedView": {
- "activeCountry": {
- "id": 1,
- "name": "United States of America ",
- "title": "COUNTRY USA",
- "mainImage": "/img/inner-page/country-details/details-1.jpg",
- "description": "The United States is one of the most popular destinations for international students and immigrants, offering world-class universities, diverse cultural experiences, and countless career opportunities...",
- "additionalInfo": "Our consultancy provides complete guidance for study visas, work permits, and permanent residency pathways tailored to your goals.",
- "tagline": "Over the last 35 Years we made an impact that is strong & we have long way to go.",
- "visaTypes": [
- {
- "category": "Tourist & Work",
- "items": [
- {
- "title": "Tourist Visa",
- "description": "Broad term that can refer to various aspects of interconnectedness"
- },
- {
- "title": "Work Permit",
- "description": "Broad term that can refer to various aspects of interconnectedness"
- }
- ]
- },
- {
- "category": "Student & Family",
- "items": [
- {
- "title": "Student",
- "description": "Broad term that can refer to various aspects of interconnectedness"
- },
- {
- "title": "Tourist Visa",
- "description": "Broad term that can refer to various aspects of interconnectedness"
- }
- ]
- }
- ],
- "visaProcess": {
- "title": "USA Visa Process",
- "steps": [
- {
- "number": "01",
- "title": "Consultation & Eligibility Check",
- "description": "Our experts review your profile and visa requirements."
- },
- {
- "number": "02",
- "title": "Application Preparation",
- "description": "We help with document collection, form filling, and statement drafting."
- },
- {
- "number": "03",
- "title": "Submission",
- "description": "Visa application is submitted online with required fees."
- },
- {
- "number": "04",
- "title": "Interview Guidance",
- "description": "Get training and mock sessions for embassy interview."
- },
- {
- "number": "05",
- "title": "Approval & Travel",
- "description": "Once approved, we provide travel and pre-departure guidance."
- }
- ]
- },
- "gallery": [
- "/img/inner-page/country-details/details-2.jpg",
- "/img/inner-page/country-details/details-3.png"
- ],
- "visaCategories": {
- "title": "Types of USA Visas",
- "steps": [
- [
- "Student Visa (F1, M1, J1)",
- "Work Visa (H1B, L1)",
- "Tourist Visa (B1/B2)"
- ],
- [
- "Family/Spouse Visa (K1, IR1, F2A)",
- "Green Card / Immigrant Visa"
- ]
- ]
- },
- "visaService": {
- "title": "Our USA Visa Service Options",
- "steps": [
- {
- "number": "01",
- "title": "Consultation & Eligibility Check",
- "description": "Our experts review your profile and visa requirements."
- },
- {
- "number": "02",
- "title": "Application Preparation",
- "description": "We help with document collection, form filling, and statement drafting."
- },
- {
- "number": "03",
- "title": "Submission",
- "description": "Visa application is submitted online with required fees."
- },
- {
- "number": "04",
- "title": "Interview Guidance",
- "description": "Get training and mock sessions for embassy interview."
- },
- {
- "number": "05",
- "title": "Approval & Travel",
- "description": "Once approved, we provide travel and pre-departure guidance."
- }
- ]
- }
- },
- "relatedCountries": [
- {
- "id": 1,
- "name": "Canada",
- "icon": "/img/inner-page/country-details/01.png"
- },
- {
- "id": 2,
- "name": "USA",
- "icon": "/img/inner-page/country-details/02.png"
- },
- {
- "id": 3,
- "name": "USA",
- "icon": "/img/inner-page/country-details/03.png"
- },
- {
- "id": 4,
- "name": "Saint Helena",
- "icon": "/img/inner-page/country-details/05.png"
- },
- {
- "id": 5,
- "name": "Iran",
- "icon": "/img/inner-page/country-details/06.png"
- },
- {
- "id": 6,
- "name": "Spain",
- "icon": "/img/inner-page/country-details/07.png"
- },
- {
- "id": 7,
- "name": "Japan",
- "icon": "/img/inner-page/country-details/08.png"
- }
- ],
- "contactInfo": {
- "img": "/img/inner-page/country-details/bg.jpg",
- "sectionTitle": "Visa & Immigration",
- "helpText": "Need Help? Book Lab Visit",
- "phone": {
- "label": "Call Us",
- "value": "+009 438 222 9540",
- "link": "tel:+0094382229540"
- },
- "email": {
- "label": "Mail Us",
- "value": "infor@xridergamil.com",
- "link": "mailto:infor@xridergamil.com"
- },
- "location": {
- "label": "Location",
- "address": "Toronto, Montreal, City 2026"
- }
- }
- }
- },
- {
- "id": 2,
- "name": "UK",
- "slug": "uk",
- "icon": "/img/home-2/visa/11.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 3,
- "name": "Canada",
- "slug": "canada",
- "icon": "/img/home-2/visa/02.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 4,
- "name": "Germany",
- "slug": "germany",
- "icon": "/img/home-2/visa/12.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 5,
- "name": "Spain",
- "slug": "spain",
- "icon": "/img/home-2/visa/13.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 6,
- "name": "South Korea",
- "slug": "south-korea",
- "icon": "/img/home-2/visa/14.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 7,
- "name": "Japan",
- "slug": "japan",
- "icon": "/img/home-2/visa/15.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 8,
- "name": "Croatia",
- "slug": "croatia",
- "icon": "/img/home-2/visa/16.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 9,
- "name": "England",
- "slug": "england",
- "icon": "/img/home-2/visa/17.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- },
- {
- "id": 10,
- "name": "Indonesia",
- "slug": "indonesia",
- "icon": "/img/home-2/visa/18.png",
- "services": [
- "Student Visa & Admission",
- "Work Visa – H1B",
- "Work permit for Canada",
- "Student Visa for Canada"
- ]
- }
- ]
- }
-}
diff --git a/middleware/apiKey.js b/middleware/apiKey.js
new file mode 100644
index 0000000..f2c3dc2
--- /dev/null
+++ b/middleware/apiKey.js
@@ -0,0 +1,17 @@
+/**
+ * API Key middleware
+ * Validates the api_key query parameter against process.env.API_KEY
+ * Spec: GET /api/verify-degree/{id}?api_key={API_KEY}
+ */
+
+function validateApiKey(req, res, next) {
+ const apiKey = req.query.api_key;
+
+ if (!apiKey || apiKey !== process.env.API_KEY) {
+ return res.status(401).json({ error: 'Unauthorized - Invalid API key' });
+ }
+
+ next();
+}
+
+module.exports = { validateApiKey };
diff --git a/middleware/upload.js b/middleware/upload.js
index 7808000..260864d 100644
--- a/middleware/upload.js
+++ b/middleware/upload.js
@@ -155,8 +155,44 @@ async function convertToWebp(req, res, next) {
}
+// Storage cho degree images — lưu ngoài public/ để không serve trực tiếp
+const degreeStorage = multer.diskStorage({
+ destination: function (req, file, cb) {
+ const uploadPath = path.join(__dirname, '../private/uploads/degree');
+ if (!fs.existsSync(uploadPath)) {
+ fs.mkdirSync(uploadPath, { recursive: true });
+ }
+ cb(null, uploadPath);
+ },
+ filename: function (req, file, cb) {
+ const ext = path.extname(file.originalname);
+ cb(null, `degree-${Date.now()}-${Math.round(Math.random() * 1e9)}${ext}`);
+ }
+});
+
+// Lọc file chỉ cho phép ảnh degree
+const degreeFileFilter = (req, file, cb) => {
+ const allowedMimes = ['image/jpeg', 'image/png', 'image/webp'];
+ if (allowedMimes.includes(file.mimetype)) {
+ cb(null, true);
+ } else {
+ cb(new Error('Only image/jpeg, image/png, image/webp files are allowed!'));
+ }
+};
+
+// Cấu hình upload degree
+const uploadDegree = multer({
+ storage: degreeStorage,
+ limits: { fileSize: 5 * 1024 * 1024 }, // 5MB per file
+ fileFilter: degreeFileFilter
+}).fields([
+ { name: 'degree_image', maxCount: 1 },
+ { name: 'certificate_image', maxCount: 1 }
+]);
+
module.exports = {
upload,
uploadVideo,
- convertToWebp
-};
\ No newline at end of file
+ convertToWebp,
+ uploadDegree
+};
\ No newline at end of file
diff --git a/models/aboutUs.js b/models/aboutUs.js
deleted file mode 100644
index d72dc07..0000000
--- a/models/aboutUs.js
+++ /dev/null
@@ -1,108 +0,0 @@
-const mongoose = require("mongoose");
-
-const aboutUsSchema = new mongoose.Schema(
- {
- hero: {
- title: String,
- breadcrumb: [String],
- backgroundImage: String,
- },
- intro: {
- subheading: String,
- heading: String,
- description: String,
- image: String,
- },
- mission: {
- subheading: String,
- heading: String,
- description: String,
- images: {
- main: String,
- secondary: String,
- bgShape: String,
- planeShape: String,
- topShape: String,
- globeShape: String,
- },
- items: [
- new mongoose.Schema(
- {
- icon: String,
- label: String,
- description: String,
- },
- { _id: false },
- ),
- ],
- features: [String],
- ctaButton: {
- label: String,
- href: String,
- },
- },
- features: {
- backgroundImage: String,
- subheading: String,
- heading: String,
- description: String,
- image: String,
- items: [
- new mongoose.Schema(
- {
- icon: String,
- title: String,
- description: String,
- },
- { _id: false },
- ),
- ],
- ctaButton: {
- label: String,
- href: String,
- },
- },
- news: {
- subheading: String,
- heading: String,
- ctaButton: {
- label: String,
- href: String,
- },
- selectedBlogIds: [{ type: mongoose.Schema.Types.ObjectId, ref: "Blog" }],
- // Deprecated: items field kept for backward compatibility during migration
- items: [
- new mongoose.Schema(
- {
- title: String,
- category: String,
- date: String,
- comments: Number,
- author: {
- name: String,
- avatar: String,
- },
- link: String,
- thumbnail: String,
- },
- { _id: false },
- ),
- ],
- },
- },
- {
- timestamps: true,
- collection: "aboutus",
- },
-);
-
-// Static method để đảm bảo luôn chỉ có 1 bản ghi duy nhất (Singleton)
-aboutUsSchema.statics.getSingle = async function () {
- let doc = await this.findOne();
- if (!doc) {
- doc = await this.create({});
- }
- return doc;
-};
-
-module.exports = mongoose.model("AboutUs", aboutUsSchema);
diff --git a/models/activity.js b/models/activity.js
deleted file mode 100644
index 2c62e7e..0000000
--- a/models/activity.js
+++ /dev/null
@@ -1,194 +0,0 @@
-const mongoose = require("mongoose");
-
-const activitySchema = new mongoose.Schema(
- {
- // Hero section for activity page header (supports Activities and Booking variants)
- hero: {
- titleActivities: {
- type: String,
- trim: true,
- default: ''
- },
- titleBooking: {
- type: String,
- trim: true,
- default: ''
- },
- bannerImageActivities: {
- type: String,
- trim: true,
- default: ''
- },
- bannerImageBooking: {
- type: String,
- trim: true,
- default: ''
- },
- },
- name: {
- type: String,
- required: true,
- trim: true,
- },
- price: {
- type: Number,
- required: true,
- min: 0,
- },
- priceText: {
- type: String,
- trim: true,
- },
- season: [
- {
- type: String,
- enum: ["spring", "summer", "autumn", "winter"],
- },
- ],
- age: {
- type: [Number],
- validate: {
- validator: function (v) {
- return v.length === 2 && v[0] <= v[1];
- },
- message: "Age must be an array of [minAge, maxAge]",
- },
- },
- locations: [
- {
- type: String,
- trim: true,
- },
- ],
- image: {
- type: String,
- trim: true,
- },
- link: {
- type: String,
- trim: true,
- },
- // Global filters document (single document in Activity collection)
- filters: [
- {
- label: { type: String, required: true, trim: true },
- value: { type: String, required: true, trim: true },
- items: [
- {
- value: { type: String, required: true },
- label: { type: String, required: true },
- },
- ],
- order: { type: Number, default: 0 },
- },
- ],
- program: {
- type: String,
- trim: true,
- },
- rating: {
- type: Number,
- min: 1,
- max: 5,
- default: 4,
- },
- isActive: {
- type: Boolean,
- default: true,
- },
- order: {
- type: Number,
- default: 0,
- },
- // marker for the single document that stores global filters
- isFiltersDoc: {
- type: Boolean,
- default: false,
- },
- // Rich camp details from camp-detail field in activities.json
- campDetail: {
- type: mongoose.Schema.Types.Mixed,
- default: {},
- },
- // Booking sessions - các đợt booking với thông số riêng
- bookingSessions: [
- {
- sessionId: { type: String, required: true },
- startDate: { type: Date, required: true },
- endDate: { type: Date, required: true },
- overnightStays: { type: Number, required: true, default: 14 },
- // Spots theo giới tính
- totalMaleSpots: { type: Number, default: 25 },
- totalFemaleSpots: { type: Number, default: 25 },
- bookedMaleSpots: { type: Number, default: 0 },
- bookedFemaleSpots: { type: Number, default: 0 },
- price: { type: Number },
- isActive: { type: Boolean, default: true },
- // Danh sách booking cho session này
- bookingList: [
- {
- address: { type: String, required: true },
- agreeNewsletter: { type: Boolean, default: false },
- agreeTerms: { type: Boolean, required: true },
- city: { type: String, required: true },
- country: { type: String, required: true },
- dietaryRestrictions: {
- type: String,
- enum: ['none', 'vegetarian', 'vegan', 'halal', 'kosher', 'gluten-free', 'other'],
- default: 'none'
- },
- email: {
- type: String,
- required: true,
- lowercase: true,
- trim: true
- },
- emergencyContact: { type: String, required: true },
- emergencyPhone: { type: String, required: true },
- medicalConditions: { type: String, default: '' },
- numberOfParticipants: { type: Number, required: true, min: 1 },
- parentFirstName: { type: String, required: true, trim: true },
- parentLastName: { type: String, required: true, trim: true },
- participantBirthDate: { type: Date, required: true },
- participantFirstName: { type: String, required: true, trim: true },
- participantGender: {
- type: String,
- enum: ['male', 'female', 'other'],
- required: true
- },
- participantLastName: { type: String, required: true, trim: true },
- phone: { type: String, required: true },
- postalCode: { type: String, required: true },
- sessionDate: { type: String, required: true }, // sessionId reference
- specialRequests: { type: String, default: '' },
- // Thêm các trường quản lý
- bookingStatus: {
- type: String,
- enum: ['pending', 'confirmed', 'cancelled', 'completed'],
- default: 'pending'
- },
- paymentStatus: {
- type: String,
- enum: ['pending', 'partial', 'paid', 'refunded'],
- default: 'pending'
- },
- totalAmount: { type: Number, default: 0 },
- paidAmount: { type: Number, default: 0 },
- bookingDate: { type: Date, default: Date.now },
- confirmationCode: { type: String, unique: true },
- adminNotes: { type: String, default: '' }
- }
- ]
- }
- ],
- },
- {timestamps: true}
-);
-
-// Add index for better query performance
-activitySchema.index({name: 1});
-activitySchema.index({isActive: 1, order: 1});
-activitySchema.index({season: 1});
-activitySchema.index({locations: 1});
-
-module.exports = mongoose.model("Activity", activitySchema);
diff --git a/models/appointment.js b/models/appointment.js
deleted file mode 100644
index 4416f0a..0000000
--- a/models/appointment.js
+++ /dev/null
@@ -1,206 +0,0 @@
-const mongoose = require("mongoose");
-
-// Clear cache
-if (mongoose.models.Appointment) {
- delete mongoose.models.Appointment;
-}
-if (mongoose.connection.models.Appointment) {
- delete mongoose.connection.models.Appointment;
-}
-
-// Schema cho hero section
-const heroSchema = new mongoose.Schema(
- {
- title: {
- type: String,
- trim: true,
- default: "Make Appointment",
- },
- backgroundImage: {
- type: String,
- trim: true,
- default: "",
- },
- subtitle: {
- type: String,
- trim: true,
- default: "",
- },
- heading: {
- type: String,
- trim: true,
- default: "",
- },
- description: {
- type: String,
- trim: true,
- default: "",
- },
- },
- { _id: false }
-);
-
-// Schema cho form field
-const formFieldSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- required: true,
- trim: true,
- },
- label: {
- type: String,
- trim: true,
- default: "",
- },
- type: {
- type: String,
- required: true,
- trim: true,
- enum: ["text", "email", "tel", "textarea", "date", "select"],
- },
- placeholder: {
- type: String,
- trim: true,
- default: "",
- },
- required: {
- type: Boolean,
- default: false,
- },
- colClass: {
- type: String,
- trim: true,
- default: "col-lg-12",
- },
- },
- { _id: false }
-);
-
-// Schema cho submit button
-const submitButtonSchema = new mongoose.Schema(
- {
- text: {
- type: String,
- required: true,
- trim: true,
- default: "Request Appointment",
- },
- icon: {
- type: String,
- trim: true,
- default: "fa-solid fa-arrow-right",
- },
- buttonClass: {
- type: String,
- trim: true,
- default: "theme-btn",
- },
- },
- { _id: false }
-);
-
-// Schema cho form
-const formSchema = new mongoose.Schema(
- {
- heading: {
- type: String,
- trim: true,
- default: "Request Appointment",
- },
- fields: {
- type: [formFieldSchema],
- default: [],
- },
- submitButton: {
- type: submitButtonSchema,
- default: () => ({}),
- },
- },
- { _id: false }
-);
-
-// Main Appointment Schema
-const appointmentSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- default: "default",
- unique: true,
- },
- hero: {
- type: heroSchema,
- default: () => ({}),
- },
- visaOptions: {
- type: [String],
- default: [],
- },
- form: {
- type: formSchema,
- default: () => ({}),
- },
- },
- {
- timestamps: true,
- }
-);
-
-// Migration method to import data from JSON
-appointmentSchema.statics.migrateFromJson = async function (jsonData) {
- try {
- // Check if default appointment exists
- const existingAppointment = await this.findOne({ name: "default" });
-
- // Process data from JSON
- const processedData = {
- hero: {
- title: jsonData.hero?.title || "Make Appointment",
- backgroundImage: jsonData.hero?.backgroundImage || "",
- subtitle: jsonData.hero?.subtitle || "",
- heading: jsonData.hero?.heading || "",
- description: jsonData.hero?.description || "",
- },
- visaOptions: Array.isArray(jsonData.visaOptions) ? jsonData.visaOptions : [],
- form: {
- heading: jsonData.form?.heading || "Request Appointment",
- fields: (jsonData.form?.fields || []).map((field) => ({
- name: field.name || "",
- label: field.label || "",
- type: field.type || "text",
- placeholder: field.placeholder || "",
- required: field.required || false,
- colClass: field.colClass || "col-lg-12",
- })),
- submitButton: {
- text: jsonData.form?.submitButton?.text || "Request Appointment",
- icon: jsonData.form?.submitButton?.icon || "fa-solid fa-arrow-right",
- buttonClass: jsonData.form?.submitButton?.buttonClass || "theme-btn",
- },
- },
- };
-
- if (existingAppointment) {
- // Update existing appointment
- existingAppointment.hero = processedData.hero;
- existingAppointment.visaOptions = processedData.visaOptions;
- existingAppointment.form = processedData.form;
- await existingAppointment.save();
- console.log("Appointment data updated successfully");
- return existingAppointment;
- } else {
- // Create new appointment
- const newAppointment = await this.create({
- name: "default",
- ...processedData,
- });
- console.log("Appointment data imported successfully");
- return newAppointment;
- }
- } catch (error) {
- console.error("Error migrating appointment data:", error);
- throw error;
- }
-};
-
-module.exports = mongoose.model("Appointment", appointmentSchema);
diff --git a/models/appointmentSubmission.js b/models/appointmentSubmission.js
deleted file mode 100644
index 6987f90..0000000
--- a/models/appointmentSubmission.js
+++ /dev/null
@@ -1,83 +0,0 @@
-const mongoose = require("mongoose");
-
-/**
- * Schema for Appointment Submissions
- * Stores appointment requests from users
- */
-const appointmentSubmissionSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- required: [true, "Name is required"],
- trim: true,
- maxlength: [100, "Name cannot exceed 100 characters"],
- },
- email: {
- type: String,
- required: [true, "Email is required"],
- trim: true,
- lowercase: true,
- match: [/^\S+@\S+\.\S+$/, "Please enter a valid email"],
- },
- phone: {
- type: String,
- trim: true,
- default: "",
- },
- address: {
- type: String,
- trim: true,
- default: "",
- },
- appointmentDate: {
- type: String,
- trim: true,
- default: "",
- },
- message: {
- type: String,
- trim: true,
- default: "",
- },
- visaTypes: {
- type: [String],
- default: [],
- },
- status: {
- type: String,
- enum: ["pending", "confirmed", "completed", "cancelled"],
- default: "pending",
- },
- notes: {
- type: String,
- trim: true,
- default: "",
- },
- confirmedAt: {
- type: Date,
- default: null,
- },
- completedAt: {
- type: Date,
- default: null,
- },
- ipAddress: {
- type: String,
- default: "",
- },
- userAgent: {
- type: String,
- default: "",
- },
- },
- {
- timestamps: true,
- }
-);
-
-// Index for faster queries
-appointmentSubmissionSchema.index({ status: 1, createdAt: -1 });
-appointmentSubmissionSchema.index({ email: 1 });
-appointmentSubmissionSchema.index({ appointmentDate: 1 });
-
-module.exports = mongoose.model("AppointmentSubmission", appointmentSubmissionSchema);
diff --git a/models/blog.js b/models/blog.js
deleted file mode 100644
index 83b7503..0000000
--- a/models/blog.js
+++ /dev/null
@@ -1,148 +0,0 @@
-const mongoose = require('mongoose');
-
-const blogSchema = new mongoose.Schema({
- // Basic blog information
- title: {
- type: String,
- required: true,
- trim: true
- },
- slug: {
- type: String,
- required: true,
- unique: true,
- trim: true
- },
- excerpt: {
- type: String,
- required: true,
- maxlength: 500
- },
- content: {
- type: mongoose.Schema.Types.Mixed, // Có thể là string HTML hoặc JSON EditorJS
- required: true
- },
-
- // Media
- featuredImage: {
- type: String,
- default: ''
- },
- galleryImages: [{
- type: String
- }], // Mảng URL ảnh cho gallery (details-2, details-3)
-
- // Author and publishing
- author: {
- type: String,
- default: 'Admin'
- },
- publishedAt: {
- type: String, // Format: "11 March 2025"
- default: function() {
- return new Date().toLocaleDateString('en-GB', {
- day: 'numeric',
- month: 'long',
- year: 'numeric'
- });
- }
- },
-
- // Categorization (simple strings, no references)
- category: [{
- type: String // ["Visa", "Travel", ...] - Một bài có thể thuộc nhiều category
- }],
- tags: [{
- type: String // ["WorkVisa", "StudentVisa", ...]
- }],
-
- // Status and features
- status: {
- type: String,
- enum: ['draft', 'published'],
- default: 'published'
- },
- isFeatured: {
- type: Boolean,
- default: false
- },
-
- // Comments count (có thể fake trước)
- commentsCount: {
- type: Number,
- default: 0
- },
-
- // Quote/Sidebar section
- quote: {
- type: String,
- default: '',
- trim: true
- },
-
- // Content after quote
- contentAfterQuote: {
- type: String,
- default: '',
- trim: true
- }
-}, {
- timestamps: true
-});
-
-// Indexes
-blogSchema.index({ status: 1, createdAt: -1 });
-blogSchema.index({ category: 1, status: 1 });
-blogSchema.index({ isFeatured: 1, status: 1 });
-blogSchema.index({ tags: 1, status: 1 });
-
-// Remove __v from JSON output
-blogSchema.set('toJSON', {
- transform: function(doc, ret) {
- delete ret.__v;
- return ret;
- }
-});
-
-// Pre-save middleware
-blogSchema.pre('save', function(next) {
- // Auto-generate slug if not provided
- if (!this.slug && this.title) {
- this.slug = this.title
- .toLowerCase()
- .replace(/[^a-z0-9\s-]/g, '')
- .replace(/\s+/g, '-')
- .replace(/-+/g, '-')
- .trim('-');
- }
-
- next();
-});
-
-// Static methods
-blogSchema.statics.getPublished = function() {
- return this.find({ status: 'published' }).sort({ createdAt: -1 });
-};
-
-blogSchema.statics.getFeatured = function() {
- return this.find({
- status: 'published',
- isFeatured: true
- }).sort({ createdAt: -1 });
-};
-
-blogSchema.statics.getByCategory = function(category) {
- return this.find({
- status: 'published',
- category: { $in: [category] } // Tìm trong array categories
- }).sort({ createdAt: -1 });
-};
-
-blogSchema.statics.getByTag = function(tag) {
- return this.find({
- status: 'published',
- tags: tag
- }).sort({ createdAt: -1 });
-};
-
-module.exports = mongoose.model('Blog', blogSchema);
\ No newline at end of file
diff --git a/models/blogCategory.js b/models/blogCategory.js
deleted file mode 100644
index 66d1b6a..0000000
--- a/models/blogCategory.js
+++ /dev/null
@@ -1,75 +0,0 @@
-const mongoose = require('mongoose');
-
-const blogCategorySchema = new mongoose.Schema({
- name: {
- type: String,
- required: true,
- trim: true,
- unique: true // "Permanent Residency (PR)"
- },
- slug: {
- type: String,
- required: true,
- unique: true,
- trim: true // "permanent-residency"
- },
- postCount: {
- type: Number,
- default: 0 // "(04)"
- },
- description: {
- type: String,
- default: ''
- },
- isActive: {
- type: Boolean,
- default: true
- }
-}, {
- timestamps: true
-});
-
-// Indexes
-blogCategorySchema.index({ isActive: 1, name: 1 });
-
-// Remove __v from JSON output
-blogCategorySchema.set('toJSON', {
- transform: function(doc, ret) {
- delete ret.__v;
- return ret;
- }
-});
-
-// Pre-save middleware
-blogCategorySchema.pre('save', function(next) {
- // Auto-generate slug if not provided
- if (!this.slug && this.name) {
- this.slug = this.name
- .toLowerCase()
- .replace(/[^a-z0-9\s-]/g, '')
- .replace(/\s+/g, '-')
- .replace(/-+/g, '-')
- .trim('-');
- }
-
- next();
-});
-
-// Static methods
-blogCategorySchema.statics.getActive = function() {
- return this.find({ isActive: true }).sort({ name: 1 });
-};
-
-// Method to update post count
-blogCategorySchema.methods.updatePostCount = async function() {
- const Blog = require('./blog');
- const count = await Blog.countDocuments({
- category: { $in: [this.name] }, // Tìm trong array categories
- status: 'published'
- });
- this.postCount = count;
- await this.save();
- return count;
-};
-
-module.exports = mongoose.model('BlogCategory', blogCategorySchema);
\ No newline at end of file
diff --git a/models/blogComment.js b/models/blogComment.js
deleted file mode 100644
index 8b6995d..0000000
--- a/models/blogComment.js
+++ /dev/null
@@ -1,104 +0,0 @@
-const mongoose = require('mongoose');
-
-const blogCommentSchema = new mongoose.Schema({
- postId: {
- type: mongoose.Schema.Types.ObjectId,
- ref: 'Blog',
- required: true
- },
- authorName: {
- type: String,
- required: true,
- trim: true // "Frank Flores"
- },
- authorEmail: {
- type: String,
- default: '',
- trim: true
- },
- authorPhone: {
- type: String,
- default: '',
- trim: true
- },
- authorAddress: {
- type: String,
- default: '',
- trim: true
- },
- authorDate: {
- type: String,
- default: '',
- trim: true
- },
- authorAvatar: {
- type: String,
- default: '' // "/assets/img/inner-page/news-details/comment-1.png"
- },
- content: {
- type: String,
- required: true,
- trim: true
- },
- parentId: {
- type: mongoose.Schema.Types.ObjectId,
- ref: 'BlogComment',
- default: null // Cho threaded comments (reply)
- },
- status: {
- type: String,
- enum: ['pending', 'approved', 'rejected'],
- default: 'pending'
- }
-}, {
- timestamps: true // Vẫn giữ timestamps cho admin quản lý
-});
-
-// Indexes
-blogCommentSchema.index({ postId: 1, status: 1, createdAt: -1 });
-blogCommentSchema.index({ parentId: 1 });
-blogCommentSchema.index({ status: 1 });
-
-// Remove __v from JSON output
-blogCommentSchema.set('toJSON', {
- transform: function(doc, ret) {
- delete ret.__v;
- return ret;
- }
-});
-
-// Static methods
-blogCommentSchema.statics.getApprovedByPost = function(postId) {
- return this.find({
- postId: postId,
- status: 'approved',
- parentId: null // Chỉ lấy comments gốc, không lấy replies
- }).sort({ createdAt: -1 });
-};
-
-blogCommentSchema.statics.getReplies = function(parentId) {
- return this.find({
- parentId: parentId,
- status: 'approved'
- }).sort({ createdAt: 1 }); // Replies sắp xếp theo thời gian tăng dần
-};
-
-blogCommentSchema.statics.getByStatus = function(status) {
- return this.find({ status: status })
- .populate('postId', 'title slug')
- .sort({ createdAt: -1 });
-};
-
-// Method to approve comment
-blogCommentSchema.methods.approve = function() {
- this.status = 'approved';
- return this.save();
-};
-
-// Method to reject comment
-blogCommentSchema.methods.reject = function() {
- this.status = 'rejected';
- return this.save();
-};
-
-module.exports = mongoose.model('BlogComment', blogCommentSchema);
\ No newline at end of file
diff --git a/models/blogTag.js b/models/blogTag.js
deleted file mode 100644
index 9d89ebe..0000000
--- a/models/blogTag.js
+++ /dev/null
@@ -1,77 +0,0 @@
-const mongoose = require('mongoose');
-
-const blogTagSchema = new mongoose.Schema({
- name: {
- type: String,
- required: true,
- trim: true,
- unique: true // "WorkVisa"
- },
- slug: {
- type: String,
- required: true,
- unique: true,
- trim: true // "work-visa"
- },
- postCount: {
- type: Number,
- default: 0
- },
- isActive: {
- type: Boolean,
- default: true
- }
-}, {
- timestamps: true
-});
-
-// Indexes
-blogTagSchema.index({ isActive: 1, name: 1 });
-
-// Remove __v from JSON output
-blogTagSchema.set('toJSON', {
- transform: function(doc, ret) {
- delete ret.__v;
- return ret;
- }
-});
-
-// Pre-save middleware
-blogTagSchema.pre('save', function(next) {
- // Auto-generate slug if not provided
- if (!this.slug && this.name) {
- this.slug = this.name
- .toLowerCase()
- .replace(/[^a-z0-9\s-]/g, '')
- .replace(/\s+/g, '-')
- .replace(/-+/g, '-')
- .trim('-');
- }
-
- next();
-});
-
-// Static methods
-blogTagSchema.statics.getActive = function() {
- return this.find({ isActive: true }).sort({ name: 1 });
-};
-
-blogTagSchema.statics.getPopular = function(limit = 10) {
- return this.find({ isActive: true })
- .sort({ postCount: -1, name: 1 })
- .limit(limit);
-};
-
-// Method to update post count
-blogTagSchema.methods.updatePostCount = async function() {
- const Blog = require('./blog');
- const count = await Blog.countDocuments({
- tags: { $in: [this.name] }, // Tìm trong array tags
- status: 'published'
- });
- this.postCount = count;
- await this.save();
- return count;
-};
-
-module.exports = mongoose.model('BlogTag', blogTagSchema);
\ No newline at end of file
diff --git a/models/booking.js b/models/booking.js
deleted file mode 100644
index a447c35..0000000
--- a/models/booking.js
+++ /dev/null
@@ -1,106 +0,0 @@
-const mongoose = require("mongoose");
-
-// Clear cache
-if (mongoose.models.Booking) {
- delete mongoose.models.Booking;
-}
-if (mongoose.connection.models.Booking) {
- delete mongoose.connection.models.Booking;
-}
-
-const bookingSchema = new mongoose.Schema(
- {
- hero: {
- title: String,
- backgroundImage: String,
- },
-
- searchBar: {
- locationLabel: String,
- holidaySeasonLabel: String,
- searchButtonText: String,
- },
-
- filterPanel: {
- title: String,
- priceTitle: String,
- priceLabel: String,
- pricePlaceholder: String,
- priceMin: Number,
- priceMax: Number,
- activitiesTitle: String,
- ageTitle: String,
- ageSelectPlaceholder: String,
- ageMin: Number,
- ageMax: Number,
- ratingTitle: String,
- ratingOptions: [
- {
- value: String,
- label: String,
- },
- ],
- resetButtonText: String,
- },
-
- programs: [
- {
- value: String,
- label: String,
- },
- ],
-
- holidays: [
- {
- value: String,
- label: String,
- },
- ],
-
- locations: [
- {
- value: String,
- label: String,
- },
- ],
-
- camps: [
- {
- name: String,
- price: Number,
- priceText: String,
- season: [String],
- age: [Number],
- locations: [String],
- image: String,
- link: String,
- program: String,
- rating: Number,
- },
- ],
-
- // Configuration - Dùng Mixed type để chấp nhận bất kỳ structure nào
- configuration: mongoose.Schema.Types.Mixed,
-
- formSteps: [
- {
- step: Number,
- title: String,
- sections: [
- {
- id: String,
- fields: [mongoose.Schema.Types.Mixed],
- },
- ],
- },
- ],
-
- validation: mongoose.Schema.Types.Mixed,
- },
- {
- timestamps: true,
- strict: false
- }
-);
-
-module.exports = mongoose.model("Booking", bookingSchema);
\ No newline at end of file
diff --git a/models/bookingSubmission.js b/models/bookingSubmission.js
deleted file mode 100644
index 9e10e59..0000000
--- a/models/bookingSubmission.js
+++ /dev/null
@@ -1,200 +0,0 @@
-const mongoose = require("mongoose");
-
-// Clear cache
-if (mongoose.models.BookingSubmission) {
- delete mongoose.models.BookingSubmission;
-}
-if (mongoose.connection.models.BookingSubmission) {
- delete mongoose.connection.models.BookingSubmission;
-}
-
-const bookingSubmissionSchema = new mongoose.Schema(
- {
- // Liên kết với activity và session
- activityId: {
- type: mongoose.Schema.Types.ObjectId,
- ref: 'Activity',
- required: true
- },
- sessionId: {
- type: String,
- required: true
- },
-
- // Thông tin người đăng ký
- parentFirstName: {
- type: String,
- required: true,
- trim: true
- },
- parentLastName: {
- type: String,
- required: true,
- trim: true
- },
- email: {
- type: String,
- required: true,
- trim: true,
- lowercase: true
- },
- phone: {
- type: String,
- required: true,
- trim: true
- },
-
- // Thông tin địa chỉ
- address: {
- type: String,
- required: true,
- trim: true
- },
- city: {
- type: String,
- required: true,
- trim: true
- },
- country: {
- type: String,
- required: true,
- trim: true
- },
- postalCode: {
- type: String,
- required: true,
- trim: true
- },
-
- // Thông tin người tham gia
- participantFirstName: {
- type: String,
- required: true,
- trim: true
- },
- participantLastName: {
- type: String,
- required: true,
- trim: true
- },
- participantBirthDate: {
- type: Date,
- required: true
- },
- participantGender: {
- type: String,
- enum: ['male', 'female', 'other'],
- required: true
- },
- numberOfParticipants: {
- type: Number,
- required: true,
- min: 1
- },
-
- // Thông tin y tế và đặc biệt
- medicalConditions: {
- type: String,
- trim: true,
- default: ''
- },
- dietaryRestrictions: {
- type: String,
- enum: ['none', 'vegetarian', 'vegan', 'halal', 'kosher', 'gluten-free', 'other'],
- default: 'none'
- },
- specialRequests: {
- type: String,
- trim: true,
- default: ''
- },
-
- // Thông tin liên hệ khẩn cấp
- emergencyContact: {
- type: String,
- required: true,
- trim: true
- },
- emergencyPhone: {
- type: String,
- required: true,
- trim: true
- },
-
- // Điều khoản và thông báo
- agreeTerms: {
- type: Boolean,
- required: true,
- default: false
- },
- agreeNewsletter: {
- type: Boolean,
- default: false
- },
-
- // Trạng thái đăng ký
- status: {
- type: String,
- enum: ['pending', 'confirmed', 'cancelled', 'completed'],
- default: 'pending'
- },
-
- // Ghi chú admin
- adminNotes: {
- type: String,
- trim: true,
- default: ''
- },
-
- // Thông tin thanh toán
- paymentStatus: {
- type: String,
- enum: ['pending', 'partial', 'paid', 'refunded'],
- default: 'pending'
- },
- totalAmount: {
- type: Number,
- default: 0
- },
- paidAmount: {
- type: Number,
- default: 0
- }
- },
- {
- timestamps: true,
- toJSON: { virtuals: true },
- toObject: { virtuals: true }
- }
-);
-
-// Virtual để tính tuổi của participant
-bookingSubmissionSchema.virtual('participantAge').get(function() {
- if (this.participantBirthDate) {
- const today = new Date();
- const birthDate = new Date(this.participantBirthDate);
- let age = today.getFullYear() - birthDate.getFullYear();
- const monthDiff = today.getMonth() - birthDate.getMonth();
- if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
- age--;
- }
- return age;
- }
- return 0;
-});
-
-// Virtual để lấy thông tin activity
-bookingSubmissionSchema.virtual('activity', {
- ref: 'Activity',
- localField: 'activityId',
- foreignField: '_id',
- justOne: true
-});
-
-// Index for better performance
-bookingSubmissionSchema.index({ activityId: 1, sessionId: 1 });
-bookingSubmissionSchema.index({ email: 1 });
-bookingSubmissionSchema.index({ status: 1 });
-bookingSubmissionSchema.index({ createdAt: -1 });
-
-module.exports = mongoose.model("BookingSubmission", bookingSubmissionSchema);
\ No newline at end of file
diff --git a/models/certificate.js b/models/certificate.js
new file mode 100644
index 0000000..89a0c9e
--- /dev/null
+++ b/models/certificate.js
@@ -0,0 +1,32 @@
+const mongoose = require('mongoose');
+
+const certificateSchema = new mongoose.Schema({
+ certification_number: {
+ type: String, required: true, unique: true, trim: true
+ },
+ student_name: {
+ type: String, required: true, trim: true
+ },
+ program_name: {
+ type: String, required: true, trim: true
+ },
+ department: {
+ type: mongoose.Schema.Types.ObjectId, ref: 'Department', required: true
+ },
+ level: {
+ type: mongoose.Schema.Types.ObjectId, ref: 'Level', required: true
+ },
+ issued_date: {
+ type: Date, required: true
+ },
+ status: {
+ type: String, enum: ['active', 'revoked'], default: 'active'
+ },
+ // Optional personal info
+ passport_number: { type: String, trim: true },
+ address: { type: String, trim: true },
+ // Document image
+ certificate_image: { type: String }
+}, { timestamps: true });
+
+module.exports = mongoose.model('Certificate', certificateSchema);
diff --git a/models/contact.js b/models/contact.js
deleted file mode 100644
index 26df236..0000000
--- a/models/contact.js
+++ /dev/null
@@ -1,423 +0,0 @@
-const mongoose = require("mongoose");
-
-// Schema cho hero section
-const heroSchema = new mongoose.Schema(
- {
- title: {
- type: String,
- required: true,
- trim: true,
- },
- backgroundImage: {
- type: String,
- trim: true,
- default: "",
- },
- overlayColor: {
- type: String,
- trim: true,
- default: "rgba(0, 0, 0, 0)",
- },
- sectionClass: {
- type: String,
- trim: true,
- default: "",
- },
- titleClass: {
- type: String,
- trim: true,
- default: "",
- },
- enableScrollspy: {
- type: Boolean,
- default: false,
- },
- backgroundPosition: {
- type: String,
- trim: true,
- default: "center",
- },
- },
- { _id: false }
-);
-
-// Schema cho contact card
-const contactCardSchema = new mongoose.Schema(
- {
- type: {
- type: String,
- required: true,
- trim: true,
- enum: [
- "phone",
- "email",
- "location",
- "hours",
- "website",
- "social",
- "custom",
- ],
- },
- title: {
- type: String,
- required: true,
- trim: true,
- },
- content: {
- type: [String],
- default: [],
- },
- iconType: {
- type: String,
- required: false,
- trim: true,
- default: "",
- },
- iconSource: {
- type: String,
- required: false,
- trim: true,
- enum: ["fontawesome", "image"],
- default: "fontawesome",
- },
- },
- { _id: false }
-);
-
-// Schema cho map coordinates
-const coordinatesSchema = new mongoose.Schema(
- {
- lat: {
- type: Number,
- required: true,
- },
- lng: {
- type: Number,
- required: true,
- },
- },
- { _id: false }
-);
-
-// Schema cho tile layer
-const tileLayerSchema = new mongoose.Schema(
- {
- url: {
- type: String,
- required: true,
- trim: true,
- },
- attribution: {
- type: String,
- trim: true,
- default: "",
- },
- maxZoom: {
- type: Number,
- default: 18,
- },
- minZoom: {
- type: Number,
- default: 0,
- },
- },
- { _id: false }
-);
-
-// Schema cho map
-const mapSchema = new mongoose.Schema(
- {
- coordinates: {
- type: coordinatesSchema,
- required: true,
- },
- zoom: {
- type: Number,
- default: 15,
- },
- location: {
- type: String,
- required: true,
- trim: true,
- },
- markerTitle: {
- type: String,
- trim: true,
- default: "",
- },
- embedUrl: {
- type: String,
- trim: true,
- default: "",
- },
- tileLayer: {
- type: tileLayerSchema,
- required: true,
- },
- },
- { _id: false }
-);
-
-// Schema cho form field
-const formFieldSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- required: true,
- trim: true,
- },
- label: {
- type: String,
- trim: true,
- default: "",
- },
- type: {
- type: String,
- required: true,
- trim: true,
- enum: ["text", "email", "tel", "textarea", "programme", "date"],
- },
- placeholder: {
- type: String,
- trim: true,
- default: "",
- },
- required: {
- type: Boolean,
- default: false,
- },
- colClass: {
- type: String,
- trim: true,
- default: "col-lg-12",
- },
- programmeName: {
- type: String,
- trim: true,
- default: "",
- },
- },
- { _id: false }
-);
-
-// Schema cho submit button
-const submitButtonSchema = new mongoose.Schema(
- {
- text: {
- type: String,
- required: true,
- trim: true,
- },
- icon: {
- type: String,
- trim: true,
- default: "fa-solid fa-arrow-right",
- },
- buttonClass: {
- type: String,
- trim: true,
- default: "theme-btn style-2",
- },
- },
- { _id: false }
-);
-
-// Schema cho form
-const formSchema = new mongoose.Schema(
- {
- sectionLabel: {
- type: String,
- trim: true,
- default: "",
- },
- heading: {
- type: String,
- trim: true,
- default: "",
- },
- description: {
- type: String,
- trim: true,
- default: "",
- },
- fields: {
- type: [formFieldSchema],
- default: [],
- },
- submitButton: {
- type: submitButtonSchema,
- required: true,
- },
- },
- { _id: false }
-);
-
-// Main Contact Schema
-const contactSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- default: "default",
- unique: true,
- },
- hero: {
- type: heroSchema,
- required: true,
- },
- contactCards: {
- type: [contactCardSchema],
- default: [],
- },
- map: {
- type: mapSchema,
- required: true,
- },
- form: {
- type: formSchema,
- required: true,
- },
- },
- {
- timestamps: true,
- }
-);
-
-// Mapping iconType cũ sang Font Awesome icon mới
-const iconTypeMapping = {
- phone: "fas fa-phone",
- email: "fas fa-envelope",
- location: "fas fa-map-marker-alt",
- clock: "fas fa-clock",
- hours: "fas fa-clock",
-};
-
-// Tạo migration script để import dữ liệu từ contact-data.json
-contactSchema.statics.migrateFromJson = async function (jsonData) {
- try {
- // Kiểm tra xem đã có contact mặc định chưa
- const existingContact = await this.findOne({ name: "default" });
-
- // Xử lý và chuẩn hóa dữ liệu từ JSON
- const processedData = {
- hero: {
- title: jsonData.hero?.title || "Contact Us",
- backgroundImage: jsonData.hero?.backgroundImage || "",
- overlayColor: jsonData.hero?.overlayColor || "rgba(0, 0, 0, 0)",
- sectionClass: jsonData.hero?.sectionClass || "",
- titleClass: jsonData.hero?.titleClass || "",
- enableScrollspy: jsonData.hero?.enableScrollspy || false,
- backgroundPosition: jsonData.hero?.backgroundPosition || "center",
- },
- contactCards: (jsonData.contactCards || []).map((card) => {
- let iconType = card.iconType || "";
- let iconSource = card.iconSource;
-
- // Nếu không có iconSource, tự động detect từ iconType
- if (!iconSource) {
- // Nếu iconType là image path (bắt đầu bằng /uploads/ hoặc http)
- if (
- iconType.startsWith("/uploads/") ||
- iconType.startsWith("http://") ||
- iconType.startsWith("https://")
- ) {
- iconSource = "image";
- } else {
- // Nếu iconType là string cũ (phone, email, location, clock)
- iconSource = "fontawesome";
- // Map iconType cũ sang Font Awesome icon mới
- if (iconTypeMapping[iconType]) {
- iconType = iconTypeMapping[iconType];
- } else if (
- iconType &&
- !iconType.startsWith("fas ") &&
- !iconType.startsWith("fab ")
- ) {
- // Nếu iconType không phải là Font Awesome class hợp lệ, thử map
- iconType = iconTypeMapping[iconType] || iconType;
- }
- }
- } else {
- // Nếu đã có iconSource nhưng iconType là string cũ, map sang Font Awesome
- if (
- iconSource === "fontawesome" &&
- iconType &&
- !iconType.startsWith("fas ") &&
- !iconType.startsWith("fab ") &&
- iconTypeMapping[iconType]
- ) {
- iconType = iconTypeMapping[iconType];
- }
- }
-
- return {
- type: card.type || "custom",
- title: card.title || "",
- content: Array.isArray(card.content) ? card.content : [],
- iconType: iconType,
- iconSource: iconSource || "fontawesome",
- };
- }),
- map: {
- coordinates: {
- lat: jsonData.map?.coordinates?.lat || 0,
- lng: jsonData.map?.coordinates?.lng || 0,
- },
- zoom: jsonData.map?.zoom || 15,
- location: jsonData.map?.location || "",
- markerTitle: jsonData.map?.markerTitle || "",
- embedUrl: jsonData.map?.embedUrl || "",
- tileLayer: {
- url:
- jsonData.map?.tileLayer?.url ||
- "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
- attribution: jsonData.map?.tileLayer?.attribution || "",
- maxZoom: jsonData.map?.tileLayer?.maxZoom || 18,
- minZoom: jsonData.map?.tileLayer?.minZoom || 0,
- },
- },
- form: {
- sectionLabel: jsonData.form?.sectionLabel || "",
- heading: jsonData.form?.heading || "",
- description: jsonData.form?.description || "",
- fields: (jsonData.form?.fields || []).map((field) => ({
- name: field.name || "",
- label: field.label || "",
- type: field.type || "text",
- placeholder: field.placeholder || "",
- required: field.required || false,
- colClass: field.colClass || "col-lg-12",
- programmeName: field.programmeName || "",
- })),
- submitButton: {
- text: jsonData.form?.submitButton?.text || "Send Message",
- icon: jsonData.form?.submitButton?.icon || "fa-solid fa-arrow-right",
- buttonClass: jsonData.form?.submitButton?.buttonClass || "theme-btn style-2",
- },
- },
- };
-
- if (existingContact) {
- // Cập nhật contact hiện có với dữ liệu đã xử lý
- existingContact.hero = processedData.hero;
- existingContact.contactCards = processedData.contactCards;
- existingContact.map = processedData.map;
- existingContact.form = processedData.form;
- await existingContact.save();
- console.log("Contact data updated successfully");
- return existingContact;
- } else {
- // Tạo contact mới với dữ liệu đã xử lý
- const newContact = await this.create({
- name: "default",
- ...processedData,
- });
- console.log("Contact data imported successfully");
- return newContact;
- }
- } catch (error) {
- console.error("Error migrating contact data:", error);
- throw error;
- }
-};
-
-module.exports = mongoose.model("Contact", contactSchema);
diff --git a/models/contactSubmission.js b/models/contactSubmission.js
deleted file mode 100644
index ce7f5b9..0000000
--- a/models/contactSubmission.js
+++ /dev/null
@@ -1,74 +0,0 @@
-const mongoose = require("mongoose");
-
-/**
- * Schema for Contact Form Submissions
- * Stores user inquiries from the contact form
- */
-const contactSubmissionSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- required: [true, "Name is required"],
- trim: true,
- maxlength: [100, "Name cannot exceed 100 characters"],
- },
- email: {
- type: String,
- required: [true, "Email is required"],
- trim: true,
- lowercase: true,
- match: [/^\S+@\S+\.\S+$/, "Please enter a valid email"],
- },
- phone: {
- type: String,
- trim: true,
- default: "",
- },
- address: {
- type: String,
- trim: true,
- default: "",
- },
- date: {
- type: String,
- trim: true,
- default: "",
- },
- message: {
- type: String,
- trim: true,
- default: "",
- },
- status: {
- type: String,
- enum: ["pending", "read", "replied", "archived"],
- default: "pending",
- },
- notes: {
- type: String,
- trim: true,
- default: "",
- },
- repliedAt: {
- type: Date,
- default: null,
- },
- ipAddress: {
- type: String,
- default: "",
- },
- userAgent: {
- type: String,
- default: "",
- },
- },
- {
- timestamps: true,
- }
-);
-
-// Index for faster queries
-contactSubmissionSchema.index({ status: 1, createdAt: -1 });
-contactSubmissionSchema.index({ email: 1 });
-
-module.exports = mongoose.model("ContactSubmission", contactSubmissionSchema);
diff --git a/models/degree.js b/models/degree.js
new file mode 100644
index 0000000..df04dd4
--- /dev/null
+++ b/models/degree.js
@@ -0,0 +1,88 @@
+const mongoose = require('mongoose');
+
+const degreeSchema = new mongoose.Schema({
+ // Required fields
+ qualification_number: {
+ type: String,
+ required: true,
+ unique: true,
+ trim: true
+ },
+ student_name: {
+ type: String,
+ required: true,
+ trim: true
+ },
+ program_name: {
+ type: String,
+ required: true,
+ trim: true
+ },
+ type: {
+ type: String,
+ required: true,
+ enum: ['qualification', 'certification']
+ },
+ department: {
+ type: mongoose.Schema.Types.ObjectId,
+ ref: 'Department',
+ required: true
+ },
+ level: {
+ type: mongoose.Schema.Types.ObjectId,
+ ref: 'Level',
+ required: true
+ },
+ issued_date: {
+ type: Date,
+ required: true
+ },
+ status: {
+ type: String,
+ enum: ['active', 'revoked'],
+ default: 'active'
+ },
+
+ // Optional fields
+ certification_number: {
+ type: String,
+ trim: true,
+ },
+ passport_number: {
+ type: String,
+ trim: true
+ },
+ address: {
+ type: String,
+ trim: true
+ },
+ topic_name: {
+ type: String,
+ trim: true
+ },
+ topic_short_desc: {
+ type: String,
+ trim: true
+ },
+ degree_image: {
+ type: String
+ },
+ certificate_image: {
+ type: String
+ }
+}, {
+ timestamps: true
+});
+
+// Indexes
+degreeSchema.index({ certification_number: 1 }, { unique: true, sparse: true });
+
+// Pre-save hook: certification type requires certification_number
+degreeSchema.pre('save', function (next) {
+ if (this.type === 'certification' && !this.certification_number) {
+ return next(new Error('certification_number is required for certification type'));
+ }
+ next();
+});
+
+module.exports = mongoose.model('Degree', degreeSchema);
diff --git a/models/faq.js b/models/faq.js
deleted file mode 100644
index 77e0619..0000000
--- a/models/faq.js
+++ /dev/null
@@ -1,222 +0,0 @@
-const mongoose = require('mongoose');
-
-const faqItemSchema = new mongoose.Schema({
- title: {
- type: String,
- required: true
- },
- description: {
- type: String,
- required: true
- }
-}, { _id: true });
-
-const faqSectionSchema = new mongoose.Schema({
- id: {
- type: String,
- required: true
- },
- title: {
- type: String,
- required: true
- },
- faqs: [faqItemSchema]
-}, { _id: true });
-
-const sidebarNavSchema = new mongoose.Schema({
- id: {
- type: String,
- required: true
- },
- label: {
- type: String,
- required: true
- }
-});
-
-const heroSchema = new mongoose.Schema({
- title: String,
- backgroundImage: String,
- overlayColor: String,
- sectionClass: String,
- titleClass: String,
- enableScrollspy: Boolean,
- backgroundPosition: String
-});
-
-const contactBoxSchema = new mongoose.Schema({
- title: String,
- phone: {
- icon: String,
- text: String
- },
- email: {
- icon: String,
- text: String
- }
-});
-
-const videoSchema = new mongoose.Schema({
- url: String,
- title: String
-});
-
-const faqSchema = new mongoose.Schema({
- name: {
- type: String,
- default: 'default',
-
- },
- hero: heroSchema,
- sidebarNav: [sidebarNavSchema],
- contactBox: contactBoxSchema,
- faqSections: [faqSectionSchema],
- video: videoSchema
-}, {
- timestamps: true
-});
-
-// Virtual property để tính tổng số FAQ items
-faqSchema.virtual('totalFaqs').get(function() {
- return this.faqSections.reduce((total, section) => {
- return total + (section.faqs ? section.faqs.length : 0);
- }, 0);
-});
-
-// Static method: Lấy FAQ mặc định
-faqSchema.statics.getDefault = async function() {
- let faq = await this.findOne({ name: 'default' });
-
- // Nếu không có, tạo mới
- if (!faq) {
- faq = new this({
- name: 'default',
- hero: {
- title: 'Frequently Asked Questions',
- backgroundImage: 'yootheme/cache/18/faqs_header_new.jpg',
- overlayColor: 'rgba(0, 0, 0, 0)',
- sectionClass: 'uk-section-secondary uk-section-overlap uk-preserve-color uk-light',
- titleClass: 'uk-heading-large uk-text-center !text-[5vw]',
- enableScrollspy: true,
- backgroundPosition: 'top-center'
- },
- sidebarNav: [
- { id: 'general-information', label: 'General Information' }
- ],
- contactBox: {
- title: 'Let\'s plan your perfect nature escape',
- phone: { icon: 'phone', text: '+(123)-456-789' },
- email: { icon: 'email', text: 'hello@ggcamp.org' }
- },
- faqSections: [
- {
- id: 'general-information',
- title: 'General Information',
- faqs: [
- {
- title: 'Sample FAQ Question',
- description: 'This is a sample FAQ answer. Please update with your actual content.'
- }
- ]
- }
- ]
- });
- await faq.save();
- }
-
- return faq;
-};
-
-// Static method: Import từ JSON
-faqSchema.statics.importFromJson = async function(data) {
- let faq = await this.findOne({ name: 'default' });
-
- // Đảm bảo có name
- const faqData = {
- name: 'default',
- ...data
- };
-
- if (!faq) {
- faq = new this(faqData);
- } else {
- // Update các trường
- Object.keys(faqData).forEach(key => {
- faq[key] = faqData[key];
- });
- }
-
- await faq.save();
- return faq;
-};
-
-// Method: Thêm FAQ vào section
-faqSchema.methods.addFaqToSection = async function(sectionId, faqItem) {
- const section = this.faqSections.find(s => s.id === sectionId);
-
- if (!section) {
- throw new Error(`Section with id ${sectionId} not found`);
- }
-
- section.faqs.push(faqItem);
- await this.save();
- return this;
-};
-
-// Method: Update FAQ item
-faqSchema.methods.updateFaqItem = async function(sectionId, faqId, updates) {
- const section = this.faqSections.find(s => s.id === sectionId);
-
- if (!section) {
- throw new Error(`Section with id ${sectionId} not found`);
- }
-
- const faqItem = section.faqs.id(faqId);
-
- if (!faqItem) {
- throw new Error(`FAQ item with id ${faqId} not found in section ${sectionId}`);
- }
-
- if (updates.title !== undefined) faqItem.title = updates.title;
- if (updates.description !== undefined) faqItem.description = updates.description;
-
- await this.save();
- return this;
-};
-
-// Method: Delete FAQ item
-faqSchema.methods.deleteFaqItem = async function(sectionId, faqId) {
- const section = this.faqSections.find(s => s.id === sectionId);
-
- if (!section) {
- throw new Error(`Section with id ${sectionId} not found`);
- }
-
- const faqItem = section.faqs.id(faqId);
-
- if (!faqItem) {
- throw new Error(`FAQ item with id ${faqId} not found in section ${sectionId}`);
- }
-
- section.faqs.pull(faqId);
- await this.save();
- return this;
-};
-
-// Method: Update FAQ section
-faqSchema.methods.updateFaqSection = async function(sectionId, updates) {
- const section = this.faqSections.find(s => s.id === sectionId);
-
- if (!section) {
- throw new Error(`Section with id ${sectionId} not found`);
- }
-
- if (updates.title !== undefined) section.title = updates.title;
-
- await this.save();
- return this;
-};
-
-const FAQ = mongoose.model('FAQ', faqSchema);
-
-module.exports = FAQ;
\ No newline at end of file
diff --git a/models/footer.js b/models/footer.js
deleted file mode 100644
index ade280c..0000000
--- a/models/footer.js
+++ /dev/null
@@ -1,213 +0,0 @@
-const mongoose = require("mongoose");
-
-// Schema cho menu links
-const menuLinkSchema = new mongoose.Schema(
- {
- label: {
- type: String,
- required: true,
- trim: true,
- },
- href: {
- type: String,
- required: true,
- trim: true,
- },
- order: {
- type: Number,
- required: false,
- default: 0,
- },
- },
- { _id: false },
-);
-
-// Schema cho social links
-const socialLinkSchema = new mongoose.Schema(
- {
- icon: {
- type: String,
- required: true,
- trim: true,
- },
- href: {
- type: String,
- required: true,
- trim: true,
- },
- },
- { _id: false },
-);
-
-// Schema cho phone
-const phoneSchema = new mongoose.Schema(
- {
- display: {
- type: String,
- required: false,
- trim: true,
- default: "",
- },
- href: {
- type: String,
- required: false,
- trim: true,
- default: "",
- },
- },
- { _id: false },
-);
-
-// Schema cho logo
-const logoSchema = new mongoose.Schema(
- {
- src: {
- type: String,
- required: false,
- trim: true,
- default: "",
- },
- alt: {
- type: String,
- required: false,
- trim: true,
- default: "",
- },
- href: {
- type: String,
- required: false,
- trim: true,
- default: "/",
- },
- },
- { _id: false },
-);
-
-// Schema cho copyright
-const copyrightSchema = new mongoose.Schema(
- {
- text: {
- type: String,
- required: false,
- trim: true,
- default: "Copyright©",
- },
- brand: {
- type: String,
- required: false,
- trim: true,
- default: "",
- },
- rights: {
- type: String,
- required: false,
- trim: true,
- default: "All Rights Reserved.",
- },
- },
- { _id: false },
-);
-
-// Schema cho top section
-const topSchema = new mongoose.Schema(
- {
- bgImage: {
- type: String,
- required: false,
- trim: true,
- default: "",
- },
- phone: {
- type: phoneSchema,
- default: () => ({ display: "", href: "" }),
- },
- address: {
- type: String,
- required: false,
- trim: true,
- default: "",
- },
- logo: {
- type: logoSchema,
- default: () => ({ src: "", alt: "", href: "/" }),
- },
- menuLinks: {
- type: [menuLinkSchema],
- default: [],
- },
- socialLinks: {
- type: [socialLinkSchema],
- default: [],
- },
- },
- { _id: false },
-);
-
-// Schema cho bottom section
-const bottomSchema = new mongoose.Schema(
- {
- copyright: {
- type: copyrightSchema,
- default: () => ({ text: "Copyright©", brand: "", rights: "All Rights Reserved." }),
- },
- menuLinks: {
- type: [menuLinkSchema],
- default: [],
- },
- },
- { _id: false },
-);
-
-// Main Footer Schema - khớp 100% với footer.json
-const footerSchema = new mongoose.Schema(
- {
- top: {
- type: topSchema,
- default: () => ({
- bgImage: "",
- phone: { display: "", href: "" },
- address: "",
- logo: { src: "", alt: "", href: "/" },
- menuLinks: [],
- socialLinks: [],
- }),
- },
- bottom: {
- type: bottomSchema,
- default: () => ({
- copyright: { text: "Copyright©", brand: "", rights: "All Rights Reserved." },
- menuLinks: [],
- }),
- },
- },
- {
- timestamps: true,
- },
-);
-
-// Static method để lấy hoặc tạo footer duy nhất
-footerSchema.statics.getSingle = async function () {
- let footer = await this.findOne();
- if (!footer) {
- footer = await this.create({});
- }
- return footer;
-};
-
-// Migration method để import từ JSON hiện tại
-footerSchema.statics.migrateFromJson = async function (jsonData) {
- try {
- // Xóa tất cả documents hiện có
- await this.deleteMany({});
-
- // Tạo document mới
- const footer = await this.create(jsonData);
- console.log("Footer data migrated successfully");
- return footer;
- } catch (error) {
- console.error("Error migrating footer data:", error);
- throw error;
- }
-};
-
-module.exports = mongoose.model("Footer", footerSchema);
diff --git a/models/form.js b/models/form.js
deleted file mode 100644
index 7abb0f5..0000000
--- a/models/form.js
+++ /dev/null
@@ -1,51 +0,0 @@
-const mongoose = require('mongoose');
-
-const formSchema = new mongoose.Schema({
- name: {
- type: String,
- required: true,
- trim: true,
- unique: true
- },
- admission: {
- background_image: String,
- title: String,
- year: String,
- description: String,
- form: {
- fields: [{
- type: { type: String },
- placeholder: String
- }],
- button: {
- text: String,
- url: String
- }
- }
- },
- apply: {
- title: String,
- steps: [{
- title: String,
- description: String
- }]
- },
- application_form: {
- title: String,
- question: String,
- button: {
- text: String,
- icon: String,
- url: String
- },
- links: [{
- text: String,
- url: String
- }]
- },
- updatedAt: Date
-}, {
- timestamps: true
-});
-
-module.exports = mongoose.model('Form', formSchema);
\ No newline at end of file
diff --git a/models/header.js b/models/header.js
deleted file mode 100644
index 2c03f58..0000000
--- a/models/header.js
+++ /dev/null
@@ -1,115 +0,0 @@
-const mongoose = require("mongoose");
-
-const socialLinkSchema = new mongoose.Schema(
- {
- platform: {
- type: String,
- required: true,
- enum: ["linkedin", "twitter", "instagram", "youtube", "facebook"],
- },
- url: {
- type: String,
- required: true,
- },
- icon: String,
- order: {
- type: Number,
- default: 0,
- },
- },
- { _id: false },
-);
-
-const languageSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- required: true,
- },
- value: {
- type: String,
- required: true,
- },
- },
- { _id: false },
-);
-
-const menuItemSchema = new mongoose.Schema(
- {
- label: {
- type: String,
- required: true,
- },
- href: {
- type: String,
- required: true,
- },
- icon: String,
- order: {
- type: Number,
- default: 0,
- },
- children: [this],
- },
- { _id: false },
-);
-
-const headerSchema = new mongoose.Schema(
- {
- // Top bar
- top: {
- phone: String,
- email: String,
- location: String,
- socialLinks: [socialLinkSchema],
- languages: [languageSchema],
- },
-
- // Offcanvas
- offcanvas: {
- description: String,
- contactInfo: {
- address: String,
- email: String,
- workingHours: String,
- phone: String,
- },
- },
-
- // Menu
- menu: [menuItemSchema],
-
- // Logo
- logo: {
- light: String,
- dark: String,
- alt: String,
- },
-
- // CTA Button
- ctaButton: {
- label: String,
- href: String,
- style: {
- type: String,
- enum: ["primary", "secondary", "outline"],
- default: "primary",
- },
- },
-
- // Status
- status: {
- type: String,
- enum: ["active", "inactive"],
- default: "active",
- },
-
- order: {
- type: Number,
- default: 1,
- },
- },
- { timestamps: true },
-);
-
-module.exports = mongoose.model("Header", headerSchema);
diff --git a/models/headerMenu.js b/models/headerMenu.js
deleted file mode 100644
index 13c8d3c..0000000
--- a/models/headerMenu.js
+++ /dev/null
@@ -1,48 +0,0 @@
-const mongoose = require('mongoose');
-
-const HeaderMenuSchema = new mongoose.Schema({
- title: {
- type: String,
- required: true,
- trim: true
- },
- slug: {
- type: String,
- required: true,
- trim: true,
- lowercase: true
- },
- url: {
- type: String,
- required: true,
- trim: true
- },
- parentId: {
- type: mongoose.Schema.Types.ObjectId,
- ref: 'HeaderMenu',
- default: null
- },
- order: {
- type: Number,
- default: 0
- },
- status: {
- type: String,
- enum: ['active', 'inactive'],
- default: 'active'
- },
- type: {
- type: String,
- enum: ['internal', 'external'],
- default: 'internal'
- }
-}, {
- timestamps: true
-});
-
-// Indexes for optimization
-HeaderMenuSchema.index({ order: 1 });
-HeaderMenuSchema.index({ status: 1 });
-HeaderMenuSchema.index({ parentId: 1, order: 1 });
-
-module.exports = mongoose.model('HeaderMenu', HeaderMenuSchema);
diff --git a/models/hero.js b/models/hero.js
deleted file mode 100644
index cf8aaf4..0000000
--- a/models/hero.js
+++ /dev/null
@@ -1,96 +0,0 @@
-const mongoose = require('mongoose');
-
-const heroSchema = new mongoose.Schema({
- hero: {
- title: {
- type: String,
- required: true
- },
- description: {
- type: String,
- required: true
- },
- backgroundImage: {
- type: String,
- required: true
- },
- overlayColor: {
- type: String,
- default: 'rgba(0, 0, 0, 0.35)'
- },
- enableScrollspy: {
- type: Boolean,
- default: true
- },
- backgroundPosition: {
- type: String,
- default: 'center center'
- },
- containerStyles: {
- width: { type: String, default: '98%' },
- height: { type: String, default: '130vh' },
- margin: { type: String, default: '0 auto' },
- borderRadius: { type: String, default: '2vw' },
- overflow: { type: String, default: 'hidden' },
- position: { type: String, default: 'relative' },
- top: { type: String, default: '-10vh' }
- },
- titleClass: {
- type: String,
- default: 'uk-heading-large uk-text-center uk-text-white'
- },
- titleStyles: {
- fontSize: { type: String, default: 'clamp(2rem, 5vw, 4.5rem)' },
- fontWeight: { type: String, default: 'bold' },
- lineHeight: { type: String, default: '1.2' },
- marginBottom: { type: String, default: '1.5rem' },
- color: { type: String, default: 'white' },
- textShadow: { type: String, default: '0 2px 10px rgba(0, 0, 0, 0.3)' }
- },
- descriptionClass: {
- type: String,
- default: 'uk-text-white'
- },
- descriptionStyles: {
- fontSize: { type: String, default: 'clamp(1rem, 1.5vw, 1.25rem)' },
- maxWidth: { type: String, default: '800px' },
- margin: { type: String, default: '0 auto 2rem' },
- lineHeight: { type: String, default: '1.6' },
- color: { type: String, default: 'white' },
- textShadow: { type: String, default: '0 1px 5px rgba(0, 0, 0, 0.3)' }
- }
- },
- button: {
- label: {
- type: String,
- default: 'Book Your Adventure'
- },
- href: {
- type: String,
- default: '/booking'
- },
- type: {
- type: String,
- default: 'magic'
- }
- },
- contactBox: {
- enabled: {
- type: Boolean,
- default: true
- },
- position: {
- position: { type: String, default: 'absolute' },
- bottom: { type: String, default: '3rem' },
- left: { type: String, default: '50%' },
- transform: { type: String, default: 'translateX(-50%)' },
- width: { type: String, default: '100%' },
- zIndex: { type: Number, default: 3 },
- padding: { type: String, default: '0 1rem' }
- }
- }
-}, {
- timestamps: true
-});
-
-module.exports = mongoose.model('Hero', heroSchema);
diff --git a/models/home.js b/models/home.js
deleted file mode 100644
index 09d3d52..0000000
--- a/models/home.js
+++ /dev/null
@@ -1,277 +0,0 @@
-const mongoose = require("mongoose");
-
-const { Schema } = mongoose;
-
-// Reusable small schemas
-const LinkSchema = new Schema(
- {
- label: { type: String, default: "" },
- href: { type: String, default: "" },
- },
- { _id: false },
-);
-
-// Hero slide (for multiple hero items in slider)
-const HeroSlideSchema = new Schema(
- {
- title: { type: String, default: "" },
- subtitle: { type: String, default: "" },
- description: { type: String, default: "" },
- primaryButton: { type: LinkSchema, default: () => ({}) },
- secondaryButton: { type: LinkSchema, default: () => ({}) },
- heroImage: { type: String, default: "" },
- videoUrl: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const HeroSchema = new Schema(
- {
- // Background for whole hero section
- backgroundImage: { type: String, default: "" },
-
- // Multiple slides
- slides: { type: [HeroSlideSchema], default: [] },
-
- // Legacy single-slide fields (backward compatible)
- title: { type: String, default: "" },
- subtitle: { type: String, default: "" },
- description: { type: String, default: "" },
- primaryButton: { type: LinkSchema, default: () => ({}) },
- secondaryButton: { type: LinkSchema, default: () => ({}) },
- heroImage: { type: String, default: "" },
- videoUrl: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const WhyChooseUsItemSchema = new Schema(
- {
- icon: { type: String, default: "" },
- title: { type: String, default: "" },
- description: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const WhyChooseUsSchema = new Schema(
- {
- heading: { type: String, default: "" },
- subheading: { type: String, default: "" },
- description: { type: String, default: "" },
- highlightWord: { type: String, default: "" },
- mainImage: { type: String, default: "" },
- secondaryImage: { type: String, default: "" },
- items: { type: [WhyChooseUsItemSchema], default: [] },
- features: { type: [String], default: [] },
- ctaButton: { type: LinkSchema, default: () => ({}) },
- },
- { _id: false },
-);
-
-const VisaSolutionItemSchema = new Schema(
- {
- number: { type: String, default: "" },
- title: { type: String, default: "" },
- description: { type: String, default: "" },
- link: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const VisaSolutionsSchema = new Schema(
- {
- heading: { type: String, default: "" },
- subheading: { type: String, default: "" },
- items: { type: [VisaSolutionItemSchema], default: [] },
- },
- { _id: false },
-);
-
-const VisaCountrySchema = new Schema(
- {
- name: { type: String, default: "" },
- code: { type: String, default: "" },
- flag: { type: String, default: "" },
- link: { type: String, default: "" },
- visaTypes: { type: [String], default: [] },
- },
- { _id: false },
-);
-
-const VisaCountriesSchema = new Schema(
- {
- heading: { type: String, default: "" },
- subheading: { type: String, default: "" },
- description: { type: String, default: "" },
- countries: { type: [VisaCountrySchema], default: [] },
- ctaButton: { type: LinkSchema, default: () => ({}) },
- },
- { _id: false },
-);
-
-const TestimonialSchema = new Schema(
- {
- name: { type: String, default: "" },
- role: { type: String, default: "" },
- country: { type: String, default: "" },
- rating: { type: Number, default: 5 },
- comment: { type: String, default: "" },
- avatar: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const TestimonialsSchema = new Schema(
- {
- heading: { type: String, default: "" },
- subheading: { type: String, default: "" },
- videoUrl: { type: String, default: "" },
- videoThumbnail: { type: String, default: "" },
- items: { type: [TestimonialSchema], default: [] },
- },
- { _id: false },
-);
-
-const VideoGallerySchema = new Schema(
- {
- heading: { type: String, default: "" },
- videoUrl: { type: String, default: "" },
- thumbnail: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const FaqItemSchema = new Schema(
- {
- question: { type: String, default: "" },
- answer: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const FaqSchema = new Schema(
- {
- heading: { type: String, default: "" },
- subheading: { type: String, default: "" },
- description: { type: String, default: "" },
- ctaButton: { type: LinkSchema, default: () => ({}) },
- items: { type: [FaqItemSchema], default: [] },
- },
- { _id: false },
-);
-
-const AchievementItemSchema = new Schema(
- {
- value: { type: String, default: "" },
- suffix: { type: String, default: "" },
- label: { type: String, default: "" },
- description: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const AchievementsSchema = new Schema(
- {
- heading: { type: String, default: "" },
- subheading: { type: String, default: "" },
- items: { type: [AchievementItemSchema], default: [] },
- },
- { _id: false },
-);
-
-const VisaConsultancyItemSchema = new Schema(
- {
- name: { type: String, default: "" },
- icon: { type: String, default: "" },
- year: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const VisaConsultancySchema = new Schema(
- {
- items: { type: [VisaConsultancyItemSchema], default: [] },
- },
- { _id: false },
-);
-
-const BrandItemSchema = new Schema(
- {
- logo: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const BrandsSchema = new Schema(
- {
- items: { type: [BrandItemSchema], default: [] },
- },
- { _id: false },
-);
-
-const PartnersSchema = new Schema(
- {
- visaConsultancy: { type: VisaConsultancySchema, default: () => ({}) },
- brands: { type: BrandsSchema, default: () => ({}) },
- },
- { _id: false },
-);
-
-const BlogPreviewItemSchema = new Schema(
- {
- title: { type: String, default: "" },
- excerpt: { type: String, default: "" },
- category: { type: String, default: "" },
- date: { type: String, default: "" }, // keep as string for easy JSON compatibility (e.g. "2025-08-20")
- author: {
- name: { type: String, default: "" },
- avatar: { type: String, default: "" },
- },
- comments: { type: Number, default: 0 },
- link: { type: String, default: "" },
- thumbnail: { type: String, default: "" },
- },
- { _id: false },
-);
-
-const BlogPreviewSchema = new Schema(
- {
- heading: { type: String, default: "" },
- subheading: { type: String, default: "" },
- ctaButton: { type: LinkSchema, default: () => ({}) },
- items: { type: [BlogPreviewItemSchema], default: [] },
- selectedBlogIds: [{ type: Schema.Types.ObjectId, ref: 'Blog' }],
- },
- { _id: false },
-);
-
-/**
- * Home page content model
- *
- * NOTE:
- * - This schema is based on `hailearning.edu.vn/app/home.json`.
- * - `strict: false` keeps backward compatibility with any existing CMS-only sections
- * (e.g. about/missionVision/programs/newsletter/latestPosts...) that the admin UI might still send.
- */
-const HomeSchema = new Schema(
- {
- hero: { type: HeroSchema, default: () => ({}) },
- whyChooseUs: { type: WhyChooseUsSchema, default: () => ({}) },
- visaSolutions: { type: VisaSolutionsSchema, default: () => ({}) },
- visaCountries: { type: VisaCountriesSchema, default: () => ({}) },
- testimonials: { type: TestimonialsSchema, default: () => ({}) },
- videoGallery: { type: VideoGallerySchema, default: () => ({}) },
- faq: { type: FaqSchema, default: () => ({}) },
- achievements: { type: AchievementsSchema, default: () => ({}) },
- partners: { type: PartnersSchema, default: () => ({}) },
- blogPreview: { type: BlogPreviewSchema, default: () => ({}) },
- },
- {
- timestamps: true,
- strict: false,
- },
-);
-
-module.exports = mongoose.model("Home", HomeSchema);
-
diff --git a/models/insurance.js b/models/insurance.js
deleted file mode 100644
index 813543f..0000000
--- a/models/insurance.js
+++ /dev/null
@@ -1,302 +0,0 @@
-const mongoose = require("mongoose");
-
-// Schema cho content items
-const contentItemSchema = new mongoose.Schema(
- {
- type: {
- type: String,
- enum: ["paragraph", "section", "list", "note", "embed", "header"],
- required: true,
- },
- text: {
- type: String,
- trim: true,
- default: "",
- },
- title: {
- type: String,
- trim: true,
- default: "",
- },
- content: {
- type: String,
- trim: true,
- default: "",
- },
- items: {
- type: [String],
- default: [],
- },
- level: {
- type: Number,
- default: 2,
- },
- // Embed/video fields
- embed: {
- type: String,
- trim: true,
- default: ''
- },
- url: {
- type: String,
- trim: true,
- default: ''
- },
- source: {
- type: String,
- trim: true,
- default: ''
- },
- videoId: {
- type: String,
- trim: true,
- default: ''
- },
- caption: {
- type: String,
- trim: true,
- default: ''
- },
- width: {
- type: Number,
- default: 0
- },
- height: {
- type: Number,
- default: 0
- },
- },
- { _id: false }
-);
-
-// Schema cho overlay style
-const overlayStyleSchema = new mongoose.Schema(
- {
- backgroundColor: {
- type: String,
- trim: true,
- default: "rgba(0, 0, 0, 0)",
- },
- },
- { _id: false }
-);
-
-// Schema cho hero section
-const heroSchema = new mongoose.Schema(
- {
- title: {
- type: String,
- required: true,
- trim: true,
- default: "Insurance & Travel Cancellation Guarantee",
- },
- subtitle: {
- type: String,
- trim: true,
- default: "Comprehensive coverage for your peace of mind",
- },
- backgroundImage: {
- type: String,
- trim: true,
- default: "/uploads/banner/b13.jpg",
- },
- sectionClass: {
- type: String,
- trim: true,
- default: "uk-section-default uk-section-overlap uk-preserve-color uk-light uk-position-relative",
- },
- backgroundClasses: {
- type: String,
- trim: true,
- default: "uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-section-xlarge",
- },
- overlayStyle: {
- type: overlayStyleSchema,
- default: () => ({ backgroundColor: "rgba(0, 0, 0, 0)" }),
- },
- titleClass: {
- type: String,
- trim: true,
- default: "text-white text-[5vw] uk-text-center",
- },
- subtitleClass: {
- type: String,
- trim: true,
- default: "uk-panel font-[Raleway] italic text-[1.5vw] uk-margin uk-text-center",
- },
- enableScrollspy: {
- type: Boolean,
- default: true,
- },
- },
- { _id: false }
-);
-
-// Schema cho page section
-const pageSchema = new mongoose.Schema(
- {
- title: {
- type: String,
- required: true,
- trim: true,
- default: "Insurance & Travel Information",
- },
- divider: {
- type: Boolean,
- default: true,
- },
- sectionClass: {
- type: String,
- trim: true,
- default: "uk-section-default uk-section-overlap uk-section",
- },
- titleClass: {
- type: String,
- trim: true,
- default: "text-[2.5vw] text-[#292c3d] uk-text-left@m uk-text-center",
- },
- dividerClass: {
- type: String,
- trim: true,
- default: "uk-divider-small uk-text-left@m uk-text-center",
- },
- },
- { _id: false }
-);
-
-// Schema cho content section
-const contentSchema = new mongoose.Schema(
- {
- sectionClass: {
- type: String,
- trim: true,
- default: "uk-section-muted uk-section-overlap uk-section",
- },
- textClass: {
- type: String,
- trim: true,
- default: "uk-panel uk-margin text-[1vw]",
- },
- content: {
- type: [contentItemSchema],
- default: [],
- },
- },
- { _id: false }
-);
-
-// Main Insurance Schema - CẤU TRÚC MỚI
-const insuranceSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- default: "default",
- unique: true,
- },
- // 3 PHẦN CHÍNH
- hero: {
- type: heroSchema,
- required: true,
- },
- page: {
- type: pageSchema,
- required: true,
- },
- content: {
- type: contentSchema,
- required: true,
- },
- language: {
- type: String,
- default: "en",
- },
- version: {
- type: String,
- default: "2.0.0",
- },
- isActive: {
- type: Boolean,
- default: true,
- },
- migratedFromOldStructure: {
- type: Boolean,
- default: false,
- },
- },
- {
- timestamps: true,
- }
-);
-
-// Static method: Lấy insurance default
-insuranceSchema.statics.getDefault = async function(language = "en") {
- try {
- let insurance = await this.findOne({ name: "default", language: language });
-
- if (!insurance) {
- // Tạo default data nếu chưa có
- insurance = await this.create({
- name: "default",
- language: language,
- hero: {
- title: "Insurance & Travel Cancellation Guarantee",
- subtitle: "Comprehensive coverage for your peace of mind",
- backgroundImage: "/uploads/banner/b13.jpg",
- },
- page: {
- title: "Insurance & Travel Information",
- divider: true,
- },
- content: {
- content: []
- }
- });
- }
-
- return insurance;
- } catch (error) {
- console.error("Error in getDefault:", error);
- throw error;
- }
-};
-
-// Method để get insurance data
-insuranceSchema.methods.getInsuranceData = function() {
- return this.toObject();
-};
-
-// Migration method - chỉ hỗ trợ cấu trúc mới
-insuranceSchema.statics.migrateFromJson = async function(jsonData, language = "en") {
- try {
- console.log('Migrating insurance from JSON...');
-
- // Xóa document cũ nếu có
- await this.deleteOne({ name: "default", language: language });
-
- // Sử dụng dữ liệu từ JSON trực tiếp
- const processedData = {
- name: "default",
- language: language,
- version: "2.0.0",
- isActive: true,
- hero: jsonData.hero,
- page: jsonData.page,
- content: jsonData.content
- };
-
- // Tạo document mới
- const newInsurance = await this.create(processedData);
- const contentItems = jsonData.content?.content || [];
- console.log(`Insurance data migrated successfully for language: ${language}`);
- console.log(`Total content items: ${contentItems.length}`);
-
- return newInsurance;
- } catch (error) {
- console.error("Error migrating insurance data to new structure:", error);
- throw error;
- }
-};
-
-const Insurance = mongoose.model("Insurance", insuranceSchema);
-
-module.exports = Insurance;
diff --git a/models/level.js b/models/level.js
index 942baec..0a7e939 100644
--- a/models/level.js
+++ b/models/level.js
@@ -1,67 +1,14 @@
const mongoose = require('mongoose');
const levelSchema = new mongoose.Schema({
- brochure: { type: String },
type: {
type: String,
required: true,
+ unique: true,
trim: true
- },
- banner: {
- image: String,
- title: String,
- text: String
- },
- overview: {
- title: String,
- paragraphs: [String],
- contact_info: {
- title: String,
- subtitle: String,
- items: [{
- text: String
- }]
- },
- social_info: {
- title: String,
- social_links: [{
- image: String,
- url: String,
- alt: String
- }],
- apply_button: {
- text: String,
- url: String
- }
- }
- },
- requirements: {
- title: String,
- items: [String]
- },
- action_buttons: {
- title: String,
- buttons: [{
- text: String,
- link: String
- }]
- },
- why_study: {
- title: String,
- items: [{
- number: String,
- title: String,
- text: String
- }]
- },
- // Thêm tham chiếu đến Form
- form: {
- type: mongoose.Schema.Types.ObjectId,
- ref: 'Form'
- },
- updatedAt: Date
+ }
}, {
timestamps: true
});
-module.exports = mongoose.model('Level', levelSchema);
\ No newline at end of file
+module.exports = mongoose.model('Level', levelSchema);
diff --git a/models/menuHeader.js b/models/menuHeader.js
deleted file mode 100644
index 8d3cf2b..0000000
--- a/models/menuHeader.js
+++ /dev/null
@@ -1,185 +0,0 @@
-const mongoose = require('mongoose');
-
-const MenuSchema = new mongoose.Schema({
- menuid: { type: String, required: true, unique: true }, // ID tùy chỉnh
- parent: { type: String, default: null }, // ID menu cha
- title: { type: String, required: true }, // Tên hiển thị
- url: { type: String, default: '' }, // Đường dẫn
- order: { type: Number, default: 0 }, // Thứ tự hiển thị
- type: { type: String, enum: ['static', 'page', 'level'], default: 'static' }, // Loại menu
- fetch: { type: Boolean, default: false }, // Có fetch programme không
- isActive: { type: Boolean, default: true } // Trạng thái hoạt động của menu
-}, { timestamps: false });
-
-// Index để tối ưu query
-MenuSchema.index({ parent: 1, order: 1 });
-MenuSchema.index({ type: 1 });
-
-// Method để lấy menu tree
-MenuSchema.statics.getMenuTree = async function () {
- try {
- const allMenus = await this.find().sort({ order: 1 }).lean();
-
- const menuMap = new Map();
- const rootMenus = [];
-
- // Đưa tất cả menus vào map và xử lý URL dựa trên isActive
- allMenus.forEach(menu => {
- const activeUrl = menu.isActive === false ? '/maintenance/' : menu.url;
- menuMap.set(menu.menuid, {
- ...menu,
- url: activeUrl, // Sử dụng URL đã được xử lý
- children: []
- });
- });
-
- // Xây dựng tree structure
- allMenus.forEach(menu => {
- const menuObj = menuMap.get(menu.menuid);
-
- if (!menu.parent) {
- rootMenus.push(menuObj);
- } else {
- const parent = menuMap.get(menu.parent);
- if (parent) {
- parent.children.push(menuObj);
- }
- }
- });
-
- return rootMenus;
- } catch (error) {
- console.error('Error building menu tree:', error);
- throw error;
- }
-};
-
-// Method để lấy menu tree với programmes
-MenuSchema.statics.getMenuTreeWithProgrammes = async function () {
- try {
- const menuTree = await this.getMenuTree();
-
- // Thêm programmes cho các menu level
- for (const menu of menuTree) {
- await this.addProgrammesToMenu(menu);
- }
-
- return menuTree;
- } catch (error) {
- console.error('Error building menu tree with programmes:', error);
- throw error;
- }
-};
-
-// Method để thêm programmes vào menu
-MenuSchema.statics.addProgrammesToMenu = async function (menuItem) {
- try {
- if (menuItem.type === 'level' && menuItem.fetch) {
- const programmes = await this.getProgrammesByMenuId(menuItem.menuid);
- menuItem.programmes = programmes;
- }
-
- if (menuItem.children && menuItem.children.length > 0) {
- for (const child of menuItem.children) {
- await this.addProgrammesToMenu(child);
- }
- }
- } catch (error) {
- console.error('Error adding programmes to menu:', error);
- throw error;
- }
-};
-
-// Method để lấy programmes theo menu ID
-MenuSchema.statics.getProgrammesByMenuId = async function (menuId) {
- try {
- const Programme = require('./programme');
- const Level = require('./level');
-
- // Sử dụng trực tiếp menuId làm levelType vì menuid đã được đặt đúng khi tạo
- const levelType = menuId;
-
- const level = await Level.findOne({ type: levelType });
- if (!level) return [];
-
- const programmes = await Programme.find({ level: level._id })
- .select('name code level_type')
- .sort({ name: 1 })
- .lean();
-
- return programmes;
- } catch (error) {
- console.error('Error getting programmes by menu ID:', error);
- throw error;
- }
-};
-
-// Method để tạo menu mới
-MenuSchema.statics.createMenu = async function (menuData) {
- try {
- const menu = new this(menuData);
- await menu.save();
- return menu;
- } catch (error) {
- console.error('Error creating menu:', error);
- throw error;
- }
-};
-
-// Method để cập nhật menu
-MenuSchema.statics.updateMenu = async function (menuId, updateData) {
- try {
- const menu = await this.findOneAndUpdate({ menuid: menuId }, updateData, { new: true });
- return menu;
- } catch (error) {
- console.error('Error updating menu:', error);
- throw error;
- }
-};
-
-// Method để xóa menu
-MenuSchema.statics.deleteMenu = async function (menuId) {
- try {
- // Xóa tất cả children trước
- await this.deleteMany({ parent: menuId });
- // Sau đó xóa menu chính
- const result = await this.findOneAndDelete({ menuid: menuId });
- return result;
- } catch (error) {
- console.error('Error deleting menu:', error);
- throw error;
- }
-};
-
-// Method để sắp xếp lại order
-MenuSchema.statics.reorderMenus = async function (parentId, menuIds) {
- try {
- const updates = menuIds.map((menuId, index) => ({
- updateOne: {
- filter: { menuid: menuId },
- update: { order: index }
- }
- }));
-
- await this.bulkWrite(updates);
- console.log('Menus reordered successfully');
- } catch (error) {
- console.error('Error reordering menus:', error);
- throw error;
- }
-};
-
-// Method để lấy URL dựa trên trạng thái isActive
-MenuSchema.methods.getActiveUrl = function () {
- if (this.isActive === false) {
- return '/maintenance/';
- }
- return this.url;
-};
-
-// Method để kiểm tra trạng thái hoạt động
-MenuSchema.methods.isMenuActive = function () {
- return this.isActive !== false;
-};
-
-module.exports = mongoose.model('MenuHeader', MenuSchema);
diff --git a/models/pricing.js b/models/pricing.js
deleted file mode 100644
index 4f9e931..0000000
--- a/models/pricing.js
+++ /dev/null
@@ -1,328 +0,0 @@
-const mongoose = require("mongoose");
-
-// Clear cache
-if (mongoose.models.Pricing) {
- delete mongoose.models.Pricing;
-}
-if (mongoose.connection.models.Pricing) {
- delete mongoose.connection.models.Pricing;
-}
-
-// Schema for breadcrumb item
-const breadcrumbItemSchema = new mongoose.Schema(
- {
- text: {
- type: String,
- trim: true,
- default: "",
- },
- link: {
- type: String,
- trim: true,
- default: "",
- },
- },
- { _id: false }
-);
-
-// Schema for hero section
-const heroSchema = new mongoose.Schema(
- {
- title: {
- type: String,
- trim: true,
- default: "Pricing Plan",
- },
- backgroundImage: {
- type: String,
- trim: true,
- default: "/assets/img/inner-page/breadcrumb.jpg",
- },
- shapeImage: {
- type: String,
- trim: true,
- default: "/assets/img/inner-page/shape.png",
- },
- breadcrumb: {
- type: [breadcrumbItemSchema],
- default: [],
- },
- },
- { _id: false }
-);
-
-// Schema for pricing section header
-const pricingSectionSchema = new mongoose.Schema(
- {
- subtitle: {
- type: String,
- trim: true,
- default: "pricing plan",
- },
- heading: {
- type: String,
- trim: true,
- default: "Flexible Plans to Suit Every Traveler",
- },
- description: {
- type: String,
- trim: true,
- default: "",
- },
- },
- { _id: false }
-);
-
-// Schema for individual plan
-const planSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- trim: true,
- required: true,
- },
- price: {
- type: String,
- trim: true,
- default: "0",
- },
- period: {
- type: String,
- trim: true,
- default: "mo",
- },
- currency: {
- type: String,
- trim: true,
- default: "$",
- },
- buttonText: {
- type: String,
- trim: true,
- default: "Get Started Today",
- },
- buttonLink: {
- type: String,
- trim: true,
- default: "/pricing",
- },
- buttonIcon: {
- type: String,
- trim: true,
- default: "fa-solid fa-arrow-right",
- },
- style: {
- type: String,
- trim: true,
- enum: ["default", "style-2"],
- default: "default",
- },
- features: {
- type: [String],
- default: [],
- },
- },
- { _id: false }
-);
-
-// Schema for plans container
-const plansSchema = new mongoose.Schema(
- {
- monthly: {
- type: [planSchema],
- default: [],
- },
- yearly: {
- type: [planSchema],
- default: [],
- },
- },
- { _id: false }
-);
-
-// Schema for testimonial item
-const testimonialItemSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- trim: true,
- default: "",
- },
- role: {
- type: String,
- trim: true,
- default: "",
- },
- rating: {
- type: Number,
- min: 1,
- max: 5,
- default: 5,
- },
- content: {
- type: String,
- trim: true,
- default: "",
- },
- },
- { _id: false }
-);
-
-// Schema for testimonials section
-const testimonialsSchema = new mongoose.Schema(
- {
- subtitle: {
- type: String,
- trim: true,
- default: "What Our Clients Say",
- },
- heading: {
- type: String,
- trim: true,
- default: "Immigration Success Stories",
- },
- buttonText: {
- type: String,
- trim: true,
- default: "View All Review",
- },
- buttonLink: {
- type: String,
- trim: true,
- default: "/contact",
- },
- buttonIcon: {
- type: String,
- trim: true,
- default: "fa-solid fa-arrow-right",
- },
- image: {
- type: String,
- trim: true,
- default: "",
- },
- items: {
- type: [testimonialItemSchema],
- default: [],
- },
- },
- { _id: false }
-);
-
-// Main Pricing Schema
-const pricingSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- default: "default",
- unique: true,
- },
- hero: {
- type: heroSchema,
- default: () => ({}),
- },
- pricingSection: {
- type: pricingSectionSchema,
- default: () => ({}),
- },
- plans: {
- type: plansSchema,
- default: () => ({}),
- },
- testimonials: {
- type: testimonialsSchema,
- default: () => ({}),
- },
- },
- {
- timestamps: true,
- }
-);
-
-// Migration method to import data from JSON
-pricingSchema.statics.migrateFromJson = async function (jsonData) {
- try {
- // Check if default pricing exists
- const existingPricing = await this.findOne({ name: "default" });
-
- // Process data from JSON
- const processedData = {
- hero: {
- title: jsonData.hero?.title || "Pricing Plan",
- backgroundImage: jsonData.hero?.backgroundImage || "/assets/img/inner-page/breadcrumb.jpg",
- shapeImage: jsonData.hero?.shapeImage || "/assets/img/inner-page/shape.png",
- breadcrumb: (jsonData.hero?.breadcrumb || []).map((item) => ({
- text: item.text || "",
- link: item.link || "",
- })),
- },
- pricingSection: {
- subtitle: jsonData.pricingSection?.subtitle || "pricing plan",
- heading: jsonData.pricingSection?.heading || "Flexible Plans to Suit Every Traveler",
- description: jsonData.pricingSection?.description || "",
- },
- plans: {
- monthly: (jsonData.plans?.monthly || []).map((plan) => ({
- name: plan.name || "",
- price: plan.price || "0",
- period: plan.period || "mo",
- currency: plan.currency || "$",
- buttonText: plan.buttonText || "Get Started Today",
- buttonLink: plan.buttonLink || "/pricing",
- buttonIcon: plan.buttonIcon || "fa-solid fa-arrow-right",
- style: plan.style || "default",
- features: plan.features || [],
- })),
- yearly: (jsonData.plans?.yearly || []).map((plan) => ({
- name: plan.name || "",
- price: plan.price || "0",
- period: plan.period || "mo",
- currency: plan.currency || "$",
- buttonText: plan.buttonText || "Get Started Today",
- buttonLink: plan.buttonLink || "/pricing",
- buttonIcon: plan.buttonIcon || "fa-solid fa-arrow-right",
- style: plan.style || "default",
- features: plan.features || [],
- })),
- },
- testimonials: {
- subtitle: jsonData.testimonials?.subtitle || "What Our Clients Say",
- heading: jsonData.testimonials?.heading || "Immigration Success Stories",
- buttonText: jsonData.testimonials?.buttonText || "View All Review",
- buttonLink: jsonData.testimonials?.buttonLink || "/contact",
- buttonIcon: jsonData.testimonials?.buttonIcon || "fa-solid fa-arrow-right",
- image: jsonData.testimonials?.image || "",
- items: (jsonData.testimonials?.items || []).map((item) => ({
- name: item.name || "",
- role: item.role || "",
- rating: item.rating || 5,
- content: item.content || "",
- })),
- },
- };
-
- if (existingPricing) {
- // Update existing pricing
- existingPricing.hero = processedData.hero;
- existingPricing.pricingSection = processedData.pricingSection;
- existingPricing.plans = processedData.plans;
- existingPricing.testimonials = processedData.testimonials;
- await existingPricing.save();
- console.log("Pricing data updated successfully");
- return existingPricing;
- } else {
- // Create new pricing
- const newPricing = await this.create({
- name: "default",
- ...processedData,
- });
- console.log("Pricing data imported successfully");
- return newPricing;
- }
- } catch (error) {
- console.error("Error migrating pricing data:", error);
- throw error;
- }
-};
-
-module.exports = mongoose.model("Pricing", pricingSchema);
diff --git a/models/qualification.js b/models/qualification.js
new file mode 100644
index 0000000..6dd98cd
--- /dev/null
+++ b/models/qualification.js
@@ -0,0 +1,35 @@
+const mongoose = require('mongoose');
+
+const qualificationSchema = new mongoose.Schema({
+ qualification_number: {
+ type: String, required: true, unique: true, trim: true
+ },
+ student_name: {
+ type: String, required: true, trim: true
+ },
+ program_name: {
+ type: String, required: true, trim: true
+ },
+ department: {
+ type: mongoose.Schema.Types.ObjectId, ref: 'Department', required: true
+ },
+ level: {
+ type: mongoose.Schema.Types.ObjectId, ref: 'Level', required: true
+ },
+ issued_date: {
+ type: Date, required: true
+ },
+ status: {
+ type: String, enum: ['active', 'revoked'], default: 'active'
+ },
+ // Optional personal info
+ passport_number: { type: String, trim: true },
+ address: { type: String, trim: true },
+ // PhD fields — presence of topic_name signals PhD view on frontend
+ topic_name: { type: String, trim: true },
+ topic_short_desc: { type: String, trim: true },
+ // Document image
+ degree_image: { type: String }
+}, { timestamps: true });
+
+module.exports = mongoose.model('Qualification', qualificationSchema);
diff --git a/models/recentPost.js b/models/recentPost.js
deleted file mode 100644
index 6c43272..0000000
--- a/models/recentPost.js
+++ /dev/null
@@ -1,79 +0,0 @@
-const mongoose = require('mongoose');
-
-// Recent Post model - có thể là view hoặc collection riêng để optimize performance
-const recentPostSchema = new mongoose.Schema({
- title: {
- type: String,
- required: true,
- trim: true
- },
- slug: {
- type: String,
- required: true,
- trim: true
- },
- thumbnail: {
- type: String,
- default: '' // Ảnh nhỏ ở sidebar
- },
- publishedAt: {
- type: String, // "March 26, 2025"
- required: true
- },
- // Reference to original blog post
- originalPostId: {
- type: mongoose.Schema.Types.ObjectId,
- ref: 'Blog',
- required: true
- }
-}, {
- timestamps: true
-});
-
-// Indexes
-recentPostSchema.index({ createdAt: -1 });
-recentPostSchema.index({ originalPostId: 1 });
-
-// Remove __v from JSON output
-recentPostSchema.set('toJSON', {
- transform: function(doc, ret) {
- delete ret.__v;
- return ret;
- }
-});
-
-// Static method to sync with Blog posts
-recentPostSchema.statics.syncFromBlogs = async function(limit = 5) {
- const Blog = require('./blog');
-
- // Get recent published blogs
- const recentBlogs = await Blog.find({ status: 'published' })
- .sort({ createdAt: -1 })
- .limit(limit)
- .select('title slug featuredImage publishedAt');
-
- // Clear existing recent posts
- await this.deleteMany({});
-
- // Create new recent posts
- const recentPosts = recentBlogs.map(blog => ({
- title: blog.title,
- slug: blog.slug,
- thumbnail: blog.featuredImage,
- publishedAt: blog.publishedAt,
- originalPostId: blog._id
- }));
-
- if (recentPosts.length > 0) {
- await this.insertMany(recentPosts);
- }
-
- return recentPosts;
-};
-
-// Static method to get recent posts
-recentPostSchema.statics.getRecent = function(limit = 5) {
- return this.find({}).sort({ createdAt: -1 }).limit(limit);
-};
-
-module.exports = mongoose.model('RecentPost', recentPostSchema);
\ No newline at end of file
diff --git a/models/safety.js b/models/safety.js
deleted file mode 100644
index b8a8cd2..0000000
--- a/models/safety.js
+++ /dev/null
@@ -1,76 +0,0 @@
-const mongoose = require("mongoose");
-
-// Schema cho hero section
-const safetySchema = new mongoose.Schema(
- {
- //hero section
- hero: {
- banner: String,
- title: String,
- },
-
- //approach section
- approach: {
- badge: String,
- title:String,
- description:String,
- imgs:{
- img1:String,
- img2:String
- },
- stats:{
- count:String,
- label:String,
- avatars:[String]
- },
- features:[
- {text:String}
- ],
- cards: [
- {
- title: String,
- content: String,
- },
- ],
- },
-
- //philosophy section
- philosophy: {
- title: String,
- subtitle: String,
- cards: [
- {
- title: String,
- content: String,
- author: {
- avt: String,
- name: String,
- role: String,
- rating: String,
- },
- },
- ],
- },
-
- //security section
- security: {
- title: String,
- subtitle: String,
- cards: [
- {
- title: String,
- content: String,
- author: {
- avt: String,
- name: String,
- role: String,
- rating: String,
- },
- },
- ],
- },
-},
-{ timestamps: true }
-);
-
-module.exports = mongoose.model("Safety", safetySchema);
\ No newline at end of file
diff --git a/models/service.js b/models/service.js
deleted file mode 100644
index a1d0f2e..0000000
--- a/models/service.js
+++ /dev/null
@@ -1,118 +0,0 @@
-const mongoose = require("mongoose");
-
-// Define sub-schemas first
-const authorSchema = new mongoose.Schema(
- {
- name: String,
- type: String,
- },
- { _id: false },
-);
-
-const clientReviewSchema = new mongoose.Schema(
- {
- id: String,
- rating: Number,
- content: String,
- author: authorSchema,
- icon: String,
- },
- { _id: false },
-);
-
-const featureSchema = new mongoose.Schema(
- {
- title: String,
- description: String,
- },
- { _id: false },
-);
-
-const faqSchema = new mongoose.Schema(
- {
- id: String,
- question: String,
- answer: String,
- isExpanded: { type: Boolean, default: false },
- },
- { _id: false },
-);
-
-const serviceDetailsSchema = new mongoose.Schema(
- {
- title: String,
- description: String,
- mainImage: String,
- overviewTitle: String,
- overviewDescription: String,
- additionalDescription: String,
- keyFeaturesTitle: String,
- keyFeaturesImage: String,
- features: [featureSchema],
- faqTitle: String,
- faqImage: String,
- faq: [faqSchema],
- },
- { _id: false },
-);
-
-// Main service page schema
-const serviceSchema = new mongoose.Schema(
- {
- pageTitle: String,
-
- // Main services section
- services: {
- title: {
- subTitle: String,
- mainTitle: String,
- },
- items: [
- {
- slug: String,
- name: String,
- description: String,
- image: String,
- layout: String,
- details: serviceDetailsSchema,
- },
- ],
- },
-
- // Destination countries section
- destinations: {
- backgroundImage: String,
- title: {
- subTitle: String,
- mainTitle: String,
- },
- },
-
- // Visa types section
- visas: {
- items: [
- {
- id: String,
- number: String,
- name: String,
- description: String,
- buttonText: String,
- buttonLink: String,
- },
- ],
- },
-
- // Client reviews section
- reviews: {
- title: {
- subTitle: String,
- mainTitle: String,
- },
- thumb: String,
- items: [clientReviewSchema],
- },
- },
- { timestamps: true },
-);
-
-module.exports = mongoose.model("Service", serviceSchema);
diff --git a/models/terms.js b/models/terms.js
deleted file mode 100644
index d967df6..0000000
--- a/models/terms.js
+++ /dev/null
@@ -1,519 +0,0 @@
-// models/terms.js
-const mongoose = require("mongoose");
-
-// Schema cho content items
-const contentItemSchema = new mongoose.Schema(
- {
- type: {
- type: String,
- enum: ["paragraph", "section", "header", "list", "cancellation_table", "cancellation_section", "note", "embed", "image"],
- required: true,
- },
- text: {
- type: String,
- trim: true,
- default: "",
- },
- // Header level (h2, h3, h4, h5, h6)
- level: {
- type: Number,
- min: 1,
- max: 6,
- default: 2,
- },
- title: {
- type: String,
- trim: true,
- default: "",
- },
- content: {
- type: String,
- trim: true,
- default: "",
- },
- subsections: {
- type: [mongoose.Schema.Types.Mixed], // Recursive reference
- default: [],
- },
- items: {
- type: [String],
- default: [],
- },
- // List style (for list type)
- style: {
- type: String,
- enum: ["ordered", "unordered"],
- default: "unordered",
- },
- // Embed/video fields (optional)
- embed: {
- type: String,
- trim: true,
- default: ''
- },
- url: {
- type: String,
- trim: true,
- default: ''
- },
- source: {
- type: String,
- trim: true,
- default: ''
- },
- videoId: {
- type: String,
- trim: true,
- default: ''
- },
- caption: {
- type: String,
- trim: true,
- default: ''
- },
- width: {
- type: Number,
- default: 0
- },
- height: {
- type: Number,
- default: 0
- },
- },
- { _id: false }
-);
-
-// Schema cho overlay style
-const overlayStyleSchema = new mongoose.Schema(
- {
- backgroundColor: {
- type: String,
- trim: true,
- default: "rgba(0, 0, 0, 0)",
- },
- },
- { _id: false }
-);
-
-// Schema cho hero section - CẤU TRÚC MỚI
-const heroSchema = new mongoose.Schema(
- {
- title: {
- type: String,
- required: true,
- trim: true,
- default: "Frequently Asked Questions",
- },
- backgroundImage: {
- type: String,
- trim: true,
- default: "/uploads/terms/faqimage.jpg",
- },
- sectionClass: {
- type: String,
- trim: true,
- default: "uk-section-default uk-section-overlap uk-preserve-color uk-light uk-position-relative",
- },
- backgroundClasses: {
- type: String,
- trim: true,
- default: "uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-section-xlarge",
- },
- overlayStyle: {
- type: overlayStyleSchema,
- default: () => ({ backgroundColor: "rgba(0, 0, 0, 0)" }),
- },
- titleClass: {
- type: String,
- trim: true,
- default: "text-white text-[5vw] uk-text-center",
- },
- enableScrollspy: {
- type: Boolean,
- default: true,
- },
- },
- { _id: false }
-);
-
-// Schema cho page section - CẤU TRÚC MỚI
-const pageSchema = new mongoose.Schema(
- {
- title: {
- type: String,
- required: true,
- trim: true,
- default: "Terms & Conditions Go and Grow Camp e.K.",
- },
- divider: {
- type: Boolean,
- default: true,
- },
- sectionClass: {
- type: String,
- trim: true,
- default: "uk-section-default uk-section-overlap uk-section",
- },
- titleClass: {
- type: String,
- trim: true,
- default: "text-[2.5vw] text-[#292c3d] uk-text-left@m uk-text-center",
- },
- dividerClass: {
- type: String,
- trim: true,
- default: "uk-divider-small uk-text-left@m uk-text-center",
- },
- },
- { _id: false }
-);
-
-// Schema cho content section - CẤU TRÚC MỚI
-const contentSchema = new mongoose.Schema(
- {
- sectionClass: {
- type: String,
- trim: true,
- default: "uk-section-muted uk-section-overlap uk-section",
- },
- textClass: {
- type: String,
- trim: true,
- default: "uk-panel uk-margin text-[1vw]",
- },
- content: {
- type: [contentItemSchema],
- default: [],
- },
- },
- { _id: false }
-);
-
-// Main Terms Schema - CẤU TRÚC MỚI
-const termsSchema = new mongoose.Schema(
- {
- name: {
- type: String,
- default: "default",
- unique: true,
- },
- // CHỈ CÒN 3 PHẦN CHÍNH
- hero: {
- type: heroSchema,
- required: true,
- },
- page: {
- type: pageSchema,
- required: true,
- },
- content: {
- type: contentSchema,
- required: true,
- },
- language: {
- type: String,
- default: "en",
- },
- version: {
- type: String,
- default: "2.0.0", // Tăng version vì cấu trúc thay đổi
- },
- isActive: {
- type: Boolean,
- default: true,
- },
- migratedFromOldStructure: {
- type: Boolean,
- default: false,
- },
- },
- {
- timestamps: true,
- }
-);
-
-// Static method: Lấy terms default - CẬP NHẬT THEO CẤU TRÚC MỚI
-termsSchema.statics.getDefault = async function(language = "en") {
- try {
- let terms = await this.findOne({ name: "default", language: language });
-
- if (!terms) {
- // Tạo terms mặc định theo cấu trúc mới
- terms = new this({
- name: "default",
- language: language,
- hero: {
- title: "Frequently Asked Questions",
- subtitle: "Our Terms & Conditions",
- backgroundImage: "/uploads/terms/faqimage.jpg",
- sectionClass: "uk-section-default uk-section-overlap uk-preserve-color uk-light uk-position-relative",
- backgroundClasses: "uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-section-xlarge",
- overlayStyle: {
- backgroundColor: "rgba(0, 0, 0, 0)"
- },
- titleClass: "text-white text-[5vw] uk-text-center",
- subtitleClass: "uk-panel font-[Raleway] italic text-[1.5vw] uk-margin uk-text-center",
- enableScrollspy: true
- },
- page: {
- title: "Terms & Conditions Go and Grow Camp e.K.",
- divider: true,
- sectionClass: "uk-section-default uk-section-overlap uk-section",
- titleClass: "text-[2.5vw] text-[#292c3d] uk-text-left@m uk-text-center",
- dividerClass: "uk-divider-small uk-text-left@m uk-text-center"
- },
- content: {
- sectionClass: "uk-section-muted uk-section-overlap uk-section",
- textClass: "uk-panel uk-margin text-[1vw]",
- content: [
- {
- type: "paragraph",
- text: "This is an English translation of the original and legally binding German document \"Allgemeine Geschäftsbedingungen Go and Grow Camp e.K.\", which can be viewed at https://www.campadventure.de/de/infos/agb . This translation is for your information only and is not legally binding."
- },
- {
- type: "paragraph",
- text: "Go and Grow Camp e.K. is the tour operator for individuals, for camps in Germany, England and Northern Ireland. "
- },
- {
- type: "paragraph",
- text: "GUARANTEE: All participants are protected in accordance with the legal regulations governing tour operators in Germany. As per §651, any payments made towards the travel price are insured against insolvency by tourVers."
- }
- ]
- },
- version: "2.0.0",
- isActive: true,
- migratedFromOldStructure: false
- });
-
- await terms.save();
- console.log(`Created default terms for language: ${language} (new structure)`);
- }
-
- return terms;
- } catch (error) {
- console.error("Error in getDefault:", error);
- throw error;
- }
-};
-
-// Method để get terms data
-termsSchema.methods.getTermsData = function() {
- return this.toObject();
-};
-
-// Migration method từ JSON CŨ sang cấu trúc MỚI
-termsSchema.statics.migrateFromJson = async function(jsonData, language = "en") {
- try {
- console.log('Migrating from JSON to new structure...');
-
- // Xóa document cũ nếu có
- await this.deleteOne({ name: "default", language: language });
-
- // Chuyển đổi từ cấu trúc cũ sang mới
- const processedData = {
- name: "default",
- language: language,
- version: "2.0.0",
- isActive: true,
- migratedFromOldStructure: true,
-
- hero: {
- title: jsonData.hero?.title || "Go and Grow Camp",
- subtitle: jsonData.hero?.subtitle || "Our Terms & Conditions",
- backgroundImage: jsonData.hero?.backgroundImage || "/uploads/terms/faqimage.jpg",
- sectionClass: "uk-section-default uk-section-overlap uk-preserve-color uk-light uk-position-relative",
- backgroundClasses: "uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-section-xlarge",
- overlayStyle: {
- backgroundColor: jsonData.hero?.overlayColor || "rgba(0, 0, 0, 0)"
- },
- titleClass: "text-white text-[5vw] uk-text-center",
- subtitleClass: "uk-panel font-[Raleway] italic text-[1.5vw] uk-margin uk-text-center",
- enableScrollspy: jsonData.hero?.enableScrollspy || true
- },
-
- page: {
- title: jsonData.termsHeader?.title || "Terms & Conditions Go and Grow Camp e.K.",
- divider: jsonData.termsHeader?.divider !== false,
- sectionClass: jsonData.termsHeader?.sectionClass || "uk-section-default uk-section-overlap uk-section",
- titleClass: jsonData.termsHeader?.titleClass || "text-[2.5vw] text-[#292c3d] uk-text-left@m uk-text-center",
- dividerClass: jsonData.termsHeader?.dividerClass || "uk-divider-small uk-text-left@m uk-text-center"
- },
-
- content: {
- sectionClass: jsonData.layout?.termsSectionClass || "uk-section-muted uk-section-overlap uk-section",
- textClass: jsonData.layout?.textContentClass || "uk-panel uk-margin text-[1vw]",
- content: []
- }
- };
-
- // Chuyển đổi sections cũ sang content mới
- const contentItems = [];
-
- // Thêm disclaimer đầu tiên nếu có
- if (jsonData.disclaimer?.text) {
- contentItems.push({
- type: "paragraph",
- text: jsonData.disclaimer.text
- });
- }
-
- if (jsonData.disclaimer?.importantNote) {
- contentItems.push({
- type: "paragraph",
- text: `${jsonData.disclaimer.importantNote} `
- });
- }
-
- if (jsonData.disclaimer?.legalNote) {
- contentItems.push({
- type: "paragraph",
- text: jsonData.disclaimer.legalNote
- });
- }
-
- // Thêm disclaimer note
- if (jsonData.disclaimer?.note) {
- contentItems.push({
- type: "paragraph",
- text: jsonData.disclaimer.note
- });
- }
-
- // Thêm các sections
- if (jsonData.sections && Array.isArray(jsonData.sections)) {
- jsonData.sections.forEach(section => {
- if (section.title && section.content) {
- const contentItem = {
- type: "section",
- title: section.title,
- content: section.content
- };
-
- // Thêm subsections nếu có
- if (section.subsections && section.subsections.length > 0) {
- contentItem.subsections = section.subsections.map(sub => ({
- type: "note",
- text: sub.content || sub
- }));
- }
-
- // Thêm cancellation fees nếu có
- if (section.fees) {
- contentItem.subsections = contentItem.subsections || [];
-
- // Individual fees
- if (section.fees.individual && section.fees.individual.length > 0) {
- contentItem.subsections.push({
- type: "cancellation_table",
- title: "Standard Cancellation Fees",
- items: section.fees.individual.map(fee => `${fee.period} – ${fee.fee}`)
- });
- }
-
- // School group fees
- if (section.fees.schoolGroups && section.fees.schoolGroups.fees) {
- contentItem.subsections.push({
- type: "cancellation_section",
- title: "Cancellation policy for school groups:",
- items: [
- section.fees.schoolGroups.freeCorrection,
- ...section.fees.schoolGroups.fees.map(fee => `${fee.period}: ${fee.fee}`)
- ]
- });
- }
-
- // Fee note
- if (section.fees.note) {
- contentItem.subsections.push({
- type: "note",
- text: section.fees.note
- });
- }
- }
-
- contentItems.push(contentItem);
- }
- });
- }
-
- // Thêm footer note nếu có
- if (jsonData.footerNote?.text) {
- contentItems.push({
- type: "paragraph",
- text: jsonData.footerNote.text
- });
- }
-
- // Gán content items đã chuyển đổi
- processedData.content.content = contentItems;
-
- // Tạo document mới
- const newTerms = await this.create(processedData);
- console.log(`Terms data migrated to new structure for language: ${language}`);
- console.log(`Total content items: ${contentItems.length}`);
-
- return newTerms;
- } catch (error) {
- console.error("Error migrating terms data to new structure:", error);
- throw error;
- }
-};
-
-// Migration method từ cấu trúc MỚI sang cấu trúc MỚI (dành cho JSON mới)
-termsSchema.statics.migrateFromNewJson = async function(jsonData, language = "en") {
- try {
- console.log('Migrating from new JSON structure...');
-
- // Xóa document cũ nếu có
- await this.deleteOne({ name: "default", language: language });
-
- // Tạo document mới với cấu trúc mới
- const newTerms = await this.create({
- name: "default",
- language: language,
- version: "2.0.0",
- isActive: true,
- migratedFromOldStructure: false,
-
- hero: {
- title: jsonData.hero?.title || "Go and Grow Camp",
- subtitle: jsonData.hero?.subtitle || "Our Terms & Conditions",
- backgroundImage: jsonData.hero?.backgroundImage || "/uploads/terms/faqimage.jpg",
- sectionClass: jsonData.hero?.sectionClass || "uk-section-default uk-section-overlap uk-preserve-color uk-light uk-position-relative",
- backgroundClasses: jsonData.hero?.backgroundClasses || "uk-background-norepeat uk-background-cover uk-background-top-center uk-section uk-section-xlarge",
- overlayStyle: jsonData.hero?.overlayStyle || { backgroundColor: "rgba(0, 0, 0, 0)" },
- titleClass: jsonData.hero?.titleClass || "text-white text-[5vw] uk-text-center",
- subtitleClass: jsonData.hero?.subtitleClass || "uk-panel font-[Raleway] italic text-[1.5vw] uk-margin uk-text-center",
- enableScrollspy: jsonData.hero?.enableScrollspy !== undefined ? jsonData.hero.enableScrollspy : true
- },
-
- page: {
- title: jsonData.page?.title || "Terms & Conditions Go and Grow Camp e.K.",
- divider: jsonData.page?.divider !== undefined ? jsonData.page.divider : true,
- sectionClass: jsonData.page?.sectionClass || "uk-section-default uk-section-overlap uk-section",
- titleClass: jsonData.page?.titleClass || "text-[2.5vw] text-[#292c3d] uk-text-left@m uk-text-center",
- dividerClass: jsonData.page?.dividerClass || "uk-divider-small uk-text-left@m uk-text-center"
- },
-
- content: {
- sectionClass: jsonData.content?.sectionClass || "uk-section-muted uk-section-overlap uk-section",
- textClass: jsonData.content?.textClass || "uk-panel uk-margin text-[1vw]",
- content: jsonData.content?.content || []
- }
- });
-
- console.log(`Terms data created with new structure for language: ${language}`);
- console.log(`Hero title: ${newTerms.hero.title}`);
- console.log(`Page title: ${newTerms.page.title}`);
- console.log(`Content items: ${newTerms.content.content.length}`);
-
- return newTerms;
- } catch (error) {
- console.error("Error creating terms data from new structure:", error);
- throw error;
- }
-};
-
-const Terms = mongoose.model("Terms", termsSchema);
-
-module.exports = Terms;
\ No newline at end of file
diff --git a/models/travel.js b/models/travel.js
deleted file mode 100644
index d903890..0000000
--- a/models/travel.js
+++ /dev/null
@@ -1,45 +0,0 @@
-const mongoose = require("mongoose");
-
-const travelSchema = new mongoose.Schema(
- {
- page: {
- title: {
- type: String,
- default: "Travel Information",
- },
- description: {
- type: String,
- default: "",
- },
- year: {
- type: String,
- default: "",
- },
- metadata: {
- title: String,
- description: String,
- },
- },
- hero: {
- title: {
- type: String,
- default: "Travel Information",
- },
- backgroundImage: {
- type: String,
- default: "",
- },
- },
- content: {
- type: mongoose.Schema.Types.Mixed,
- default: { blocks: [] },
- },
- enableScrollspy: {
- type: Boolean,
- default: false,
- },
- },
- { timestamps: true }
-);
-
-module.exports = mongoose.model("Travel", travelSchema);
diff --git a/models/visa.js b/models/visa.js
deleted file mode 100644
index b0589d1..0000000
--- a/models/visa.js
+++ /dev/null
@@ -1,234 +0,0 @@
-// models/visa.js
-
-const mongoose = require("mongoose");
-
-// ==================== SCHEMAS ====================
-
-// VisaItem Schema
-const VisaItemSchema = new mongoose.Schema(
- {
- title: { type: String, default: "" },
- description: { type: String, default: "" },
- },
- { _id: false },
-);
-
-// VisaTypeCategory Schema
-const VisaTypeCategorySchema = new mongoose.Schema(
- {
- category: { type: String, default: "" },
- items: [VisaItemSchema],
- },
- { _id: false },
-);
-
-// VisaProcessStep Schema
-const VisaProcessStepSchema = new mongoose.Schema(
- {
- number: { type: String, default: "" },
- title: { type: String, default: "" },
- description: { type: String, default: "" },
- },
- { _id: false },
-);
-
-// VisaProcess Schema
-const VisaProcessSchema = new mongoose.Schema(
- {
- title: { type: String, default: "" },
- steps: [VisaProcessStepSchema],
- },
- { _id: false },
-);
-
-// VisaCategory Schema
-const VisaCategorySchema = new mongoose.Schema(
- {
- title: { type: String, default: "" },
- steps: {
- type: [[String]],
- default: [],
- },
- },
- { _id: false },
-);
-
-// VisaService Schema
-const VisaServiceSchema = new mongoose.Schema(
- {
- title: { type: String, default: "" },
- steps: [VisaProcessStepSchema],
- },
- { _id: false },
-);
-
-// RelatedCountry Schema
-const RelatedCountrySchema = new mongoose.Schema(
- {
- id: { type: Number, default: 0 },
- name: { type: String, default: "" },
- icon: { type: String, default: "" },
- },
- { _id: false },
-);
-
-// Phone Schema
-const PhoneSchema = new mongoose.Schema(
- {
- label: { type: String, default: "" },
- value: { type: String, default: "" },
- link: { type: String, default: "" },
- },
- { _id: false },
-);
-
-// Email Schema
-const EmailSchema = new mongoose.Schema(
- {
- label: { type: String, default: "" },
- value: { type: String, default: "" },
- link: { type: String, default: "" },
- },
- { _id: false },
-);
-
-// Location Schema
-const LocationSchema = new mongoose.Schema(
- {
- label: { type: String, default: "" },
- address: { type: String, default: "" },
- },
- { _id: false },
-);
-
-// ContactInfo Schema
-const ContactInfoSchema = new mongoose.Schema(
- {
- img: { type: String, default: "" },
- sectionTitle: { type: String, default: "" },
- helpText: { type: String, default: "" },
-
- phone: {
- type: PhoneSchema,
- default: () => ({}),
- },
- email: {
- type: EmailSchema,
- default: () => ({}),
- },
- location: {
- type: LocationSchema,
- default: () => ({}),
- },
- },
- { _id: false },
-);
-
-// ActiveCountry Schema
-const ActiveCountrySchema = new mongoose.Schema(
- {
- id: { type: Number, default: 0 },
- name: { type: String, default: "" },
- title: { type: String, default: "" },
- mainImage: { type: String, default: "" },
- description: { type: String, default: "" },
- additionalInfo: { type: String, default: "" },
- tagline: { type: String, default: "" },
- visaTypes: [VisaTypeCategorySchema],
- visaProcess: {
- type: VisaProcessSchema,
- default: null,
- },
- gallery: {
- type: [String],
- default: [],
- },
- visaCategories: {
- type: VisaCategorySchema,
- default: null,
- },
- visaService: {
- type: VisaServiceSchema,
- default: null,
- },
- },
- { _id: false },
-);
-
-// DetailedView Schema
-const DetailedViewSchema = new mongoose.Schema(
- {
- activeCountry: {
- type: ActiveCountrySchema,
- default: null,
- },
- relatedCountries: {
- type: [RelatedCountrySchema],
- default: [],
- },
- contactInfo: {
- type: ContactInfoSchema,
- default: null,
- },
- },
- { _id: false },
-);
-
-// ==================== MAIN VISA COUNTRY SCHEMA ====================
-
-// Main VisaCountry Schema (Individual country object)
-const VisaCountrySchema = new mongoose.Schema(
- {
- // Không dùng `index: true` ở đây vì đã tạo index riêng cho hero.summaryList.* bên dưới
- id: { type: Number, required: true },
- name: { type: String, required: true },
- slug: { type: String, required: true },
- icon: { type: String, default: "" },
- services: {
- type: [String],
- default: [],
- },
- detailedView: {
- type: DetailedViewSchema,
- default: null,
- },
- },
- { _id: false },
-);
-
-// ==================== HERO SCHEMA ====================
-
-const HeroSchema = new mongoose.Schema(
- {
- title: { type: String, default: "Visa" },
- summaryList: {
- type: [VisaCountrySchema],
- default: [],
- },
- },
- { _id: false },
-);
-
-// ==================== MAIN VISA SCHEMA ====================
-
-const visaDataSchema = new mongoose.Schema(
- {
- hero: {
- type: HeroSchema,
- default: () => ({ title: "Visa", summaryList: [] }),
- },
- },
- {
- timestamps: true,
- },
-);
-
-// ==================== INDEXES ====================
-
-visaDataSchema.index({ "hero.summaryList.slug": 1 });
-visaDataSchema.index({ "hero.summaryList.id": 1 });
-visaDataSchema.index({ "hero.summaryList.name": 1 });
-
-// ==================== MODEL ====================
-
-module.exports = mongoose.models.Visa || mongoose.model("Visa", visaDataSchema);
diff --git a/package.json b/package.json
index 67a480f..475ea44 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"scripts": {
"start": "node server.js",
"dev": "nodemon server.js",
- "test": "echo \"Error: no test specified\" && exit 1",
+ "test": "jest --testPathPatterns=tests/ --forceExit",
"migrate": "node scripts/migrate-all.js",
"migrate-fresh": "node scripts/migrate-fresh.js",
"migrate-status": "node scripts/migrate-status.js",
@@ -48,6 +48,10 @@
"slugify": "^1.6.6"
},
"devDependencies": {
- "nodemon": "^3.1.14"
+ "fast-check": "^4.6.0",
+ "jest": "^30.3.0",
+ "mongodb-memory-server": "^10.4.3",
+ "nodemon": "^3.1.14",
+ "supertest": "^7.2.2"
}
}
diff --git a/private/uploads/degree/degree-1775888220792-364903341.jpg b/private/uploads/degree/degree-1775888220792-364903341.jpg
new file mode 100644
index 0000000..91c4b7f
Binary files /dev/null and b/private/uploads/degree/degree-1775888220792-364903341.jpg differ
diff --git a/private/uploads/degree/degree-1775888353893-668906545.jpg b/private/uploads/degree/degree-1775888353893-668906545.jpg
new file mode 100644
index 0000000..016e5f3
Binary files /dev/null and b/private/uploads/degree/degree-1775888353893-668906545.jpg differ
diff --git a/private/uploads/degree/degree-1775890059192-65272939.jpg b/private/uploads/degree/degree-1775890059192-65272939.jpg
new file mode 100644
index 0000000..91c4b7f
Binary files /dev/null and b/private/uploads/degree/degree-1775890059192-65272939.jpg differ
diff --git a/private/uploads/degree/degree-1775890091961-13807367.jpg b/private/uploads/degree/degree-1775890091961-13807367.jpg
new file mode 100644
index 0000000..c65e269
Binary files /dev/null and b/private/uploads/degree/degree-1775890091961-13807367.jpg differ
diff --git a/private/uploads/degree/degree-1775890227907-418473699.jpg b/private/uploads/degree/degree-1775890227907-418473699.jpg
new file mode 100644
index 0000000..ed1a322
Binary files /dev/null and b/private/uploads/degree/degree-1775890227907-418473699.jpg differ
diff --git a/public/img/close.png b/public/img/close.png
deleted file mode 100644
index f43edd0..0000000
Binary files a/public/img/close.png and /dev/null differ
diff --git a/public/img/default.jpg b/public/img/default.jpg
deleted file mode 100644
index b0e2512..0000000
Binary files a/public/img/default.jpg and /dev/null differ
diff --git a/public/img/favicon.png b/public/img/favicon.png
deleted file mode 100644
index 820c256..0000000
Binary files a/public/img/favicon.png and /dev/null differ
diff --git a/public/img/header/home-1.jpg b/public/img/header/home-1.jpg
deleted file mode 100644
index f338e40..0000000
Binary files a/public/img/header/home-1.jpg and /dev/null differ
diff --git a/public/img/header/home-2.jpg b/public/img/header/home-2.jpg
deleted file mode 100644
index f338e40..0000000
Binary files a/public/img/header/home-2.jpg and /dev/null differ
diff --git a/public/img/header/home-3.jpg b/public/img/header/home-3.jpg
deleted file mode 100644
index f338e40..0000000
Binary files a/public/img/header/home-3.jpg and /dev/null differ
diff --git a/public/img/home-1/686x906.jpg b/public/img/home-1/686x906.jpg
deleted file mode 100644
index 0f75a17..0000000
Binary files a/public/img/home-1/686x906.jpg and /dev/null differ
diff --git a/public/img/home-1/about/375x419.jpg b/public/img/home-1/about/375x419.jpg
deleted file mode 100644
index 1a73623..0000000
Binary files a/public/img/home-1/about/375x419.jpg and /dev/null differ
diff --git a/public/img/home-1/about/Vector.png b/public/img/home-1/about/Vector.png
deleted file mode 100644
index e69d461..0000000
Binary files a/public/img/home-1/about/Vector.png and /dev/null differ
diff --git a/public/img/home-1/about/about-02.jpg b/public/img/home-1/about/about-02.jpg
deleted file mode 100644
index d9399ee..0000000
Binary files a/public/img/home-1/about/about-02.jpg and /dev/null differ
diff --git a/public/img/home-1/about/about-1.jpg b/public/img/home-1/about/about-1.jpg
deleted file mode 100644
index 7e0555e..0000000
Binary files a/public/img/home-1/about/about-1.jpg and /dev/null differ
diff --git a/public/img/home-1/about/businessman.jpg b/public/img/home-1/about/businessman.jpg
deleted file mode 100644
index f092493..0000000
Binary files a/public/img/home-1/about/businessman.jpg and /dev/null differ
diff --git a/public/img/home-1/about/globe.png b/public/img/home-1/about/globe.png
deleted file mode 100644
index f593f8d..0000000
Binary files a/public/img/home-1/about/globe.png and /dev/null differ
diff --git a/public/img/home-1/about/plane.png b/public/img/home-1/about/plane.png
deleted file mode 100644
index 391ca8c..0000000
Binary files a/public/img/home-1/about/plane.png and /dev/null differ
diff --git a/public/img/home-1/about/shape.png b/public/img/home-1/about/shape.png
deleted file mode 100644
index bacb7da..0000000
Binary files a/public/img/home-1/about/shape.png and /dev/null differ
diff --git a/public/img/home-1/brand/01.png b/public/img/home-1/brand/01.png
deleted file mode 100644
index e7dacce..0000000
Binary files a/public/img/home-1/brand/01.png and /dev/null differ
diff --git a/public/img/home-1/brand/02.png b/public/img/home-1/brand/02.png
deleted file mode 100644
index 1e7389a..0000000
Binary files a/public/img/home-1/brand/02.png and /dev/null differ
diff --git a/public/img/home-1/brand/03.png b/public/img/home-1/brand/03.png
deleted file mode 100644
index 67b7e54..0000000
Binary files a/public/img/home-1/brand/03.png and /dev/null differ
diff --git a/public/img/home-1/brand/04.png b/public/img/home-1/brand/04.png
deleted file mode 100644
index 2c92108..0000000
Binary files a/public/img/home-1/brand/04.png and /dev/null differ
diff --git a/public/img/home-1/brand/05.png b/public/img/home-1/brand/05.png
deleted file mode 100644
index 4869273..0000000
Binary files a/public/img/home-1/brand/05.png and /dev/null differ
diff --git a/public/img/home-1/employee-testimonial-questions.jpeg b/public/img/home-1/employee-testimonial-questions.jpeg
deleted file mode 100644
index c7d4ba5..0000000
Binary files a/public/img/home-1/employee-testimonial-questions.jpeg and /dev/null differ
diff --git a/public/img/home-1/feature/Vector.png b/public/img/home-1/feature/Vector.png
deleted file mode 100644
index 27a6379..0000000
Binary files a/public/img/home-1/feature/Vector.png and /dev/null differ
diff --git a/public/img/home-1/feature/bg-2.jpg b/public/img/home-1/feature/bg-2.jpg
deleted file mode 100644
index b9ce42b..0000000
Binary files a/public/img/home-1/feature/bg-2.jpg and /dev/null differ
diff --git a/public/img/home-1/feature/bg.png b/public/img/home-1/feature/bg.png
deleted file mode 100644
index 4e91bad..0000000
Binary files a/public/img/home-1/feature/bg.png and /dev/null differ
diff --git a/public/img/home-1/feature/icon-1.png b/public/img/home-1/feature/icon-1.png
deleted file mode 100644
index 0d2e628..0000000
Binary files a/public/img/home-1/feature/icon-1.png and /dev/null differ
diff --git a/public/img/home-1/feature/icon-2.png b/public/img/home-1/feature/icon-2.png
deleted file mode 100644
index 734f031..0000000
Binary files a/public/img/home-1/feature/icon-2.png and /dev/null differ
diff --git a/public/img/home-1/feature/icon-3.png b/public/img/home-1/feature/icon-3.png
deleted file mode 100644
index ece75fb..0000000
Binary files a/public/img/home-1/feature/icon-3.png and /dev/null differ
diff --git a/public/img/home-1/feature/icon-4.png b/public/img/home-1/feature/icon-4.png
deleted file mode 100644
index 78d4a9b..0000000
Binary files a/public/img/home-1/feature/icon-4.png and /dev/null differ
diff --git a/public/img/home-1/feature/shape-2.png b/public/img/home-1/feature/shape-2.png
deleted file mode 100644
index 0b5853a..0000000
Binary files a/public/img/home-1/feature/shape-2.png and /dev/null differ
diff --git a/public/img/home-1/feature/shape.png b/public/img/home-1/feature/shape.png
deleted file mode 100644
index 9e644e0..0000000
Binary files a/public/img/home-1/feature/shape.png and /dev/null differ
diff --git a/public/img/home-1/feature/text-2.png b/public/img/home-1/feature/text-2.png
deleted file mode 100644
index 4bb0dec..0000000
Binary files a/public/img/home-1/feature/text-2.png and /dev/null differ
diff --git a/public/img/home-1/feature/text.png b/public/img/home-1/feature/text.png
deleted file mode 100644
index 9708b37..0000000
Binary files a/public/img/home-1/feature/text.png and /dev/null differ
diff --git a/public/img/home-1/feature/video-bg.jpg b/public/img/home-1/feature/video-bg.jpg
deleted file mode 100644
index da3fc82..0000000
Binary files a/public/img/home-1/feature/video-bg.jpg and /dev/null differ
diff --git a/public/img/home-1/footer-bg.jpg b/public/img/home-1/footer-bg.jpg
deleted file mode 100644
index 1c8a33b..0000000
Binary files a/public/img/home-1/footer-bg.jpg and /dev/null differ
diff --git a/public/img/home-1/hero/bg.jpg b/public/img/home-1/hero/bg.jpg
deleted file mode 100644
index df73c05..0000000
Binary files a/public/img/home-1/hero/bg.jpg and /dev/null differ
diff --git a/public/img/home-1/hero/man.png b/public/img/home-1/hero/man.png
deleted file mode 100644
index fa79041..0000000
Binary files a/public/img/home-1/hero/man.png and /dev/null differ
diff --git a/public/img/home-1/hero/sape-2.png b/public/img/home-1/hero/sape-2.png
deleted file mode 100644
index b329ac0..0000000
Binary files a/public/img/home-1/hero/sape-2.png and /dev/null differ
diff --git a/public/img/home-1/hero/shape-3.png b/public/img/home-1/hero/shape-3.png
deleted file mode 100644
index 1d435cd..0000000
Binary files a/public/img/home-1/hero/shape-3.png and /dev/null differ
diff --git a/public/img/home-1/hero/shape-4.png b/public/img/home-1/hero/shape-4.png
deleted file mode 100644
index 5dbc40e..0000000
Binary files a/public/img/home-1/hero/shape-4.png and /dev/null differ
diff --git a/public/img/home-1/hero/shape.png b/public/img/home-1/hero/shape.png
deleted file mode 100644
index a15f99c..0000000
Binary files a/public/img/home-1/hero/shape.png and /dev/null differ
diff --git a/public/img/home-1/hover-bg.jpg b/public/img/home-1/hover-bg.jpg
deleted file mode 100644
index cd5410b..0000000
Binary files a/public/img/home-1/hover-bg.jpg and /dev/null differ
diff --git a/public/img/home-1/icon/01.svg b/public/img/home-1/icon/01.svg
deleted file mode 100644
index 87ac71c..0000000
--- a/public/img/home-1/icon/01.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/public/img/home-1/news/client.png b/public/img/home-1/news/client.png
deleted file mode 100644
index 398078e..0000000
Binary files a/public/img/home-1/news/client.png and /dev/null differ
diff --git a/public/img/home-1/news/connector-852x400.png b/public/img/home-1/news/connector-852x400.png
deleted file mode 100644
index 0e9e71f..0000000
Binary files a/public/img/home-1/news/connector-852x400.png and /dev/null differ
diff --git a/public/img/home-1/news/news-1.jpg b/public/img/home-1/news/news-1.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/img/home-1/news/news-1.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-10.jpg b/public/img/home-1/news/news-10.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/img/home-1/news/news-10.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-11.jpg b/public/img/home-1/news/news-11.jpg
deleted file mode 100644
index e49c218..0000000
Binary files a/public/img/home-1/news/news-11.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-12.jpg b/public/img/home-1/news/news-12.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/img/home-1/news/news-12.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-13.jpg b/public/img/home-1/news/news-13.jpg
deleted file mode 100644
index 850df16..0000000
Binary files a/public/img/home-1/news/news-13.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-14.jpg b/public/img/home-1/news/news-14.jpg
deleted file mode 100644
index 850df16..0000000
Binary files a/public/img/home-1/news/news-14.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-15.jpg b/public/img/home-1/news/news-15.jpg
deleted file mode 100644
index 850df16..0000000
Binary files a/public/img/home-1/news/news-15.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-2.jpg b/public/img/home-1/news/news-2.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/img/home-1/news/news-2.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-3.jpg b/public/img/home-1/news/news-3.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/img/home-1/news/news-3.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-4.jpg b/public/img/home-1/news/news-4.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/img/home-1/news/news-4.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-5.jpg b/public/img/home-1/news/news-5.jpg
deleted file mode 100644
index e49c218..0000000
Binary files a/public/img/home-1/news/news-5.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-6.jpg b/public/img/home-1/news/news-6.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/img/home-1/news/news-6.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-7.jpg b/public/img/home-1/news/news-7.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/img/home-1/news/news-7.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-8.jpg b/public/img/home-1/news/news-8.jpg
deleted file mode 100644
index e49c218..0000000
Binary files a/public/img/home-1/news/news-8.jpg and /dev/null differ
diff --git a/public/img/home-1/news/news-9.jpg b/public/img/home-1/news/news-9.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/img/home-1/news/news-9.jpg and /dev/null differ
diff --git a/public/img/home-1/testimonial/01.jpg b/public/img/home-1/testimonial/01.jpg
deleted file mode 100644
index c5d6375..0000000
Binary files a/public/img/home-1/testimonial/01.jpg and /dev/null differ
diff --git a/public/img/home-1/testimonial/client-2.png b/public/img/home-1/testimonial/client-2.png
deleted file mode 100644
index acf5ec7..0000000
Binary files a/public/img/home-1/testimonial/client-2.png and /dev/null differ
diff --git a/public/img/home-1/testimonial/client.png b/public/img/home-1/testimonial/client.png
deleted file mode 100644
index acf5ec7..0000000
Binary files a/public/img/home-1/testimonial/client.png and /dev/null differ
diff --git a/public/img/home-2/Vector.png b/public/img/home-2/Vector.png
deleted file mode 100644
index 77e135a..0000000
Binary files a/public/img/home-2/Vector.png and /dev/null differ
diff --git a/public/img/home-2/bg.jpg b/public/img/home-2/bg.jpg
deleted file mode 100644
index f96b833..0000000
Binary files a/public/img/home-2/bg.jpg and /dev/null differ
diff --git a/public/img/home-2/feature/01.png b/public/img/home-2/feature/01.png
deleted file mode 100644
index 66e8054..0000000
Binary files a/public/img/home-2/feature/01.png and /dev/null differ
diff --git a/public/img/home-2/feature/02.png b/public/img/home-2/feature/02.png
deleted file mode 100644
index cc69b4b..0000000
Binary files a/public/img/home-2/feature/02.png and /dev/null differ
diff --git a/public/img/home-2/feature/03.png b/public/img/home-2/feature/03.png
deleted file mode 100644
index f41ae69..0000000
Binary files a/public/img/home-2/feature/03.png and /dev/null differ
diff --git a/public/img/home-2/feature/Icon.png b/public/img/home-2/feature/Icon.png
deleted file mode 100644
index 6457445..0000000
Binary files a/public/img/home-2/feature/Icon.png and /dev/null differ
diff --git a/public/img/home-2/feature/Years.png b/public/img/home-2/feature/Years.png
deleted file mode 100644
index 6d17c88..0000000
Binary files a/public/img/home-2/feature/Years.png and /dev/null differ
diff --git a/public/img/home-2/feature/bg-shape.png b/public/img/home-2/feature/bg-shape.png
deleted file mode 100644
index b30ddb9..0000000
Binary files a/public/img/home-2/feature/bg-shape.png and /dev/null differ
diff --git a/public/img/home-2/hero/hero-bg.jpg b/public/img/home-2/hero/hero-bg.jpg
deleted file mode 100644
index b07f499..0000000
Binary files a/public/img/home-2/hero/hero-bg.jpg and /dev/null differ
diff --git a/public/img/home-2/hero/hero.png b/public/img/home-2/hero/hero.png
deleted file mode 100644
index 31b942f..0000000
Binary files a/public/img/home-2/hero/hero.png and /dev/null differ
diff --git a/public/img/home-2/hero/shape.png b/public/img/home-2/hero/shape.png
deleted file mode 100644
index ab0dfe5..0000000
Binary files a/public/img/home-2/hero/shape.png and /dev/null differ
diff --git a/public/img/home-2/icon/01.png b/public/img/home-2/icon/01.png
deleted file mode 100644
index b8fd101..0000000
Binary files a/public/img/home-2/icon/01.png and /dev/null differ
diff --git a/public/img/home-2/icon/02.svg b/public/img/home-2/icon/02.svg
deleted file mode 100644
index 07c9bbc..0000000
--- a/public/img/home-2/icon/02.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/public/img/home-2/news/01.jpg b/public/img/home-2/news/01.jpg
deleted file mode 100644
index f2df409..0000000
Binary files a/public/img/home-2/news/01.jpg and /dev/null differ
diff --git a/public/img/home-2/news/02.jpg b/public/img/home-2/news/02.jpg
deleted file mode 100644
index f2df409..0000000
Binary files a/public/img/home-2/news/02.jpg and /dev/null differ
diff --git a/public/img/home-2/news/03.jpg b/public/img/home-2/news/03.jpg
deleted file mode 100644
index f2df409..0000000
Binary files a/public/img/home-2/news/03.jpg and /dev/null differ
diff --git a/public/img/home-2/service.jpg b/public/img/home-2/service.jpg
deleted file mode 100644
index cc88fc0..0000000
Binary files a/public/img/home-2/service.jpg and /dev/null differ
diff --git a/public/img/home-2/testimonial/01.jpg b/public/img/home-2/testimonial/01.jpg
deleted file mode 100644
index d3c1e79..0000000
Binary files a/public/img/home-2/testimonial/01.jpg and /dev/null differ
diff --git a/public/img/home-2/testimonial/client-1.png b/public/img/home-2/testimonial/client-1.png
deleted file mode 100644
index 200b888..0000000
Binary files a/public/img/home-2/testimonial/client-1.png and /dev/null differ
diff --git a/public/img/home-2/testimonial/client-2.png b/public/img/home-2/testimonial/client-2.png
deleted file mode 100644
index 17b3333..0000000
Binary files a/public/img/home-2/testimonial/client-2.png and /dev/null differ
diff --git a/public/img/home-2/testimonial/client-3.jpg b/public/img/home-2/testimonial/client-3.jpg
deleted file mode 100644
index 17b3333..0000000
Binary files a/public/img/home-2/testimonial/client-3.jpg and /dev/null differ
diff --git a/public/img/home-2/testimonial/client-4.jpg b/public/img/home-2/testimonial/client-4.jpg
deleted file mode 100644
index 17b3333..0000000
Binary files a/public/img/home-2/testimonial/client-4.jpg and /dev/null differ
diff --git a/public/img/home-2/visa/01.png b/public/img/home-2/visa/01.png
deleted file mode 100644
index 34b3ff3..0000000
Binary files a/public/img/home-2/visa/01.png and /dev/null differ
diff --git a/public/img/home-2/visa/02.png b/public/img/home-2/visa/02.png
deleted file mode 100644
index 754622a..0000000
Binary files a/public/img/home-2/visa/02.png and /dev/null differ
diff --git a/public/img/home-2/visa/03.png b/public/img/home-2/visa/03.png
deleted file mode 100644
index e7a0021..0000000
Binary files a/public/img/home-2/visa/03.png and /dev/null differ
diff --git a/public/img/home-2/visa/04.png b/public/img/home-2/visa/04.png
deleted file mode 100644
index 6cd5198..0000000
Binary files a/public/img/home-2/visa/04.png and /dev/null differ
diff --git a/public/img/home-2/visa/05.png b/public/img/home-2/visa/05.png
deleted file mode 100644
index 9b2c39a..0000000
Binary files a/public/img/home-2/visa/05.png and /dev/null differ
diff --git a/public/img/home-2/visa/06.png b/public/img/home-2/visa/06.png
deleted file mode 100644
index 867726d..0000000
Binary files a/public/img/home-2/visa/06.png and /dev/null differ
diff --git a/public/img/home-2/visa/07.png b/public/img/home-2/visa/07.png
deleted file mode 100644
index 7c1fb81..0000000
Binary files a/public/img/home-2/visa/07.png and /dev/null differ
diff --git a/public/img/home-2/visa/08.png b/public/img/home-2/visa/08.png
deleted file mode 100644
index 0c88078..0000000
Binary files a/public/img/home-2/visa/08.png and /dev/null differ
diff --git a/public/img/home-2/visa/09.png b/public/img/home-2/visa/09.png
deleted file mode 100644
index 716ec4f..0000000
Binary files a/public/img/home-2/visa/09.png and /dev/null differ
diff --git a/public/img/home-2/visa/10.png b/public/img/home-2/visa/10.png
deleted file mode 100644
index 4669765..0000000
Binary files a/public/img/home-2/visa/10.png and /dev/null differ
diff --git a/public/img/home-2/visa/11.png b/public/img/home-2/visa/11.png
deleted file mode 100644
index 01a444a..0000000
Binary files a/public/img/home-2/visa/11.png and /dev/null differ
diff --git a/public/img/home-2/visa/12.png b/public/img/home-2/visa/12.png
deleted file mode 100644
index 6a8a5a7..0000000
Binary files a/public/img/home-2/visa/12.png and /dev/null differ
diff --git a/public/img/home-2/visa/13.png b/public/img/home-2/visa/13.png
deleted file mode 100644
index d93066c..0000000
Binary files a/public/img/home-2/visa/13.png and /dev/null differ
diff --git a/public/img/home-2/visa/14.png b/public/img/home-2/visa/14.png
deleted file mode 100644
index c5291bc..0000000
Binary files a/public/img/home-2/visa/14.png and /dev/null differ
diff --git a/public/img/home-2/visa/15.png b/public/img/home-2/visa/15.png
deleted file mode 100644
index 348261c..0000000
Binary files a/public/img/home-2/visa/15.png and /dev/null differ
diff --git a/public/img/home-2/visa/16.png b/public/img/home-2/visa/16.png
deleted file mode 100644
index 1dbad29..0000000
Binary files a/public/img/home-2/visa/16.png and /dev/null differ
diff --git a/public/img/home-2/visa/17.png b/public/img/home-2/visa/17.png
deleted file mode 100644
index 33f8426..0000000
Binary files a/public/img/home-2/visa/17.png and /dev/null differ
diff --git a/public/img/home-2/visa/18.png b/public/img/home-2/visa/18.png
deleted file mode 100644
index 9c602dc..0000000
Binary files a/public/img/home-2/visa/18.png and /dev/null differ
diff --git a/public/img/home-3/about/01.png b/public/img/home-3/about/01.png
deleted file mode 100644
index ef645f8..0000000
Binary files a/public/img/home-3/about/01.png and /dev/null differ
diff --git a/public/img/home-3/about/bg.jpg b/public/img/home-3/about/bg.jpg
deleted file mode 100644
index 8a85f19..0000000
Binary files a/public/img/home-3/about/bg.jpg and /dev/null differ
diff --git a/public/img/home-3/choose-us/01.jpg b/public/img/home-3/choose-us/01.jpg
deleted file mode 100644
index ef9bfa0..0000000
Binary files a/public/img/home-3/choose-us/01.jpg and /dev/null differ
diff --git a/public/img/home-3/choose-us/02.jpg b/public/img/home-3/choose-us/02.jpg
deleted file mode 100644
index ef9bfa0..0000000
Binary files a/public/img/home-3/choose-us/02.jpg and /dev/null differ
diff --git a/public/img/home-3/choose-us/03.jpg b/public/img/home-3/choose-us/03.jpg
deleted file mode 100644
index 7646e03..0000000
Binary files a/public/img/home-3/choose-us/03.jpg and /dev/null differ
diff --git a/public/img/home-3/choose-us/04.jpg b/public/img/home-3/choose-us/04.jpg
deleted file mode 100644
index ef9bfa0..0000000
Binary files a/public/img/home-3/choose-us/04.jpg and /dev/null differ
diff --git a/public/img/home-3/choose-us/05.jpg b/public/img/home-3/choose-us/05.jpg
deleted file mode 100644
index ef9bfa0..0000000
Binary files a/public/img/home-3/choose-us/05.jpg and /dev/null differ
diff --git a/public/img/home-3/choose-us/06.png b/public/img/home-3/choose-us/06.png
deleted file mode 100644
index 82a78b1..0000000
Binary files a/public/img/home-3/choose-us/06.png and /dev/null differ
diff --git a/public/img/home-3/choose-us/07.png b/public/img/home-3/choose-us/07.png
deleted file mode 100644
index c87c92d..0000000
Binary files a/public/img/home-3/choose-us/07.png and /dev/null differ
diff --git a/public/img/home-3/choose-us/bg.png b/public/img/home-3/choose-us/bg.png
deleted file mode 100644
index 0040077..0000000
Binary files a/public/img/home-3/choose-us/bg.png and /dev/null differ
diff --git a/public/img/home-3/choose-us/icon-1.png b/public/img/home-3/choose-us/icon-1.png
deleted file mode 100644
index b18c291..0000000
Binary files a/public/img/home-3/choose-us/icon-1.png and /dev/null differ
diff --git a/public/img/home-3/choose-us/icon-2.png b/public/img/home-3/choose-us/icon-2.png
deleted file mode 100644
index dccc5f0..0000000
Binary files a/public/img/home-3/choose-us/icon-2.png and /dev/null differ
diff --git a/public/img/home-3/choose-us/icon-3.png b/public/img/home-3/choose-us/icon-3.png
deleted file mode 100644
index f58d2b1..0000000
Binary files a/public/img/home-3/choose-us/icon-3.png and /dev/null differ
diff --git a/public/img/home-3/choose-us/pricing-bg.jpg b/public/img/home-3/choose-us/pricing-bg.jpg
deleted file mode 100644
index ca7562d..0000000
Binary files a/public/img/home-3/choose-us/pricing-bg.jpg and /dev/null differ
diff --git a/public/img/home-3/footer.jpg b/public/img/home-3/footer.jpg
deleted file mode 100644
index 0897e64..0000000
Binary files a/public/img/home-3/footer.jpg and /dev/null differ
diff --git a/public/img/home-3/hero/bg.jpg b/public/img/home-3/hero/bg.jpg
deleted file mode 100644
index 7450ff1..0000000
Binary files a/public/img/home-3/hero/bg.jpg and /dev/null differ
diff --git a/public/img/home-3/hero/flag.png b/public/img/home-3/hero/flag.png
deleted file mode 100644
index fd39efd..0000000
Binary files a/public/img/home-3/hero/flag.png and /dev/null differ
diff --git a/public/img/home-3/hero/man.png b/public/img/home-3/hero/man.png
deleted file mode 100644
index 722638d..0000000
Binary files a/public/img/home-3/hero/man.png and /dev/null differ
diff --git a/public/img/home-3/news/01.jpg b/public/img/home-3/news/01.jpg
deleted file mode 100644
index 1b47583..0000000
Binary files a/public/img/home-3/news/01.jpg and /dev/null differ
diff --git a/public/img/home-3/news/02.jpg b/public/img/home-3/news/02.jpg
deleted file mode 100644
index 1b47583..0000000
Binary files a/public/img/home-3/news/02.jpg and /dev/null differ
diff --git a/public/img/home-3/news/03.jpg b/public/img/home-3/news/03.jpg
deleted file mode 100644
index 1b47583..0000000
Binary files a/public/img/home-3/news/03.jpg and /dev/null differ
diff --git a/public/img/home-3/news/04.jpg b/public/img/home-3/news/04.jpg
deleted file mode 100644
index 1b47583..0000000
Binary files a/public/img/home-3/news/04.jpg and /dev/null differ
diff --git a/public/img/home-3/news/client.png b/public/img/home-3/news/client.png
deleted file mode 100644
index 398078e..0000000
Binary files a/public/img/home-3/news/client.png and /dev/null differ
diff --git a/public/img/home-3/service/01.jpg b/public/img/home-3/service/01.jpg
deleted file mode 100644
index b0e2512..0000000
Binary files a/public/img/home-3/service/01.jpg and /dev/null differ
diff --git a/public/img/home-3/service/02.jpg b/public/img/home-3/service/02.jpg
deleted file mode 100644
index b0e2512..0000000
Binary files a/public/img/home-3/service/02.jpg and /dev/null differ
diff --git a/public/img/home-3/service/03.jpg b/public/img/home-3/service/03.jpg
deleted file mode 100644
index b0e2512..0000000
Binary files a/public/img/home-3/service/03.jpg and /dev/null differ
diff --git a/public/img/home-3/service/04.jpg b/public/img/home-3/service/04.jpg
deleted file mode 100644
index b0e2512..0000000
Binary files a/public/img/home-3/service/04.jpg and /dev/null differ
diff --git a/public/img/home-3/test-thumb.jpg b/public/img/home-3/test-thumb.jpg
deleted file mode 100644
index 3dc5da5..0000000
Binary files a/public/img/home-3/test-thumb.jpg and /dev/null differ
diff --git a/public/img/inner-page/404.png b/public/img/inner-page/404.png
deleted file mode 100644
index f7c61d3..0000000
Binary files a/public/img/inner-page/404.png and /dev/null differ
diff --git a/public/img/inner-page/breadcrumb.jpg b/public/img/inner-page/breadcrumb.jpg
deleted file mode 100644
index a6d73a3..0000000
Binary files a/public/img/inner-page/breadcrumb.jpg and /dev/null differ
diff --git a/public/img/inner-page/country-details/01.png b/public/img/inner-page/country-details/01.png
deleted file mode 100644
index cb8e5e7..0000000
Binary files a/public/img/inner-page/country-details/01.png and /dev/null differ
diff --git a/public/img/inner-page/country-details/02.png b/public/img/inner-page/country-details/02.png
deleted file mode 100644
index bbb0006..0000000
Binary files a/public/img/inner-page/country-details/02.png and /dev/null differ
diff --git a/public/img/inner-page/country-details/03.png b/public/img/inner-page/country-details/03.png
deleted file mode 100644
index 191ca85..0000000
Binary files a/public/img/inner-page/country-details/03.png and /dev/null differ
diff --git a/public/img/inner-page/country-details/04.png b/public/img/inner-page/country-details/04.png
deleted file mode 100644
index 2e472e5..0000000
Binary files a/public/img/inner-page/country-details/04.png and /dev/null differ
diff --git a/public/img/inner-page/country-details/05.png b/public/img/inner-page/country-details/05.png
deleted file mode 100644
index 3ac26ae..0000000
Binary files a/public/img/inner-page/country-details/05.png and /dev/null differ
diff --git a/public/img/inner-page/country-details/06.png b/public/img/inner-page/country-details/06.png
deleted file mode 100644
index a78fccc..0000000
Binary files a/public/img/inner-page/country-details/06.png and /dev/null differ
diff --git a/public/img/inner-page/country-details/07.png b/public/img/inner-page/country-details/07.png
deleted file mode 100644
index 9c71239..0000000
Binary files a/public/img/inner-page/country-details/07.png and /dev/null differ
diff --git a/public/img/inner-page/country-details/08.png b/public/img/inner-page/country-details/08.png
deleted file mode 100644
index 8c9da65..0000000
Binary files a/public/img/inner-page/country-details/08.png and /dev/null differ
diff --git a/public/img/inner-page/country-details/bg.jpg b/public/img/inner-page/country-details/bg.jpg
deleted file mode 100644
index be32e48..0000000
Binary files a/public/img/inner-page/country-details/bg.jpg and /dev/null differ
diff --git a/public/img/inner-page/country-details/details-1.jpg b/public/img/inner-page/country-details/details-1.jpg
deleted file mode 100644
index 079bb13..0000000
Binary files a/public/img/inner-page/country-details/details-1.jpg and /dev/null differ
diff --git a/public/img/inner-page/country-details/details-2.jpg b/public/img/inner-page/country-details/details-2.jpg
deleted file mode 100644
index cae3db5..0000000
Binary files a/public/img/inner-page/country-details/details-2.jpg and /dev/null differ
diff --git a/public/img/inner-page/country-details/details-3.png b/public/img/inner-page/country-details/details-3.png
deleted file mode 100644
index cae3db5..0000000
Binary files a/public/img/inner-page/country-details/details-3.png and /dev/null differ
diff --git a/public/img/inner-page/intro.jpg b/public/img/inner-page/intro.jpg
deleted file mode 100644
index 2540cd4..0000000
Binary files a/public/img/inner-page/intro.jpg and /dev/null differ
diff --git a/public/img/inner-page/news-details/comment-1.png b/public/img/inner-page/news-details/comment-1.png
deleted file mode 100644
index e126c86..0000000
Binary files a/public/img/inner-page/news-details/comment-1.png and /dev/null differ
diff --git a/public/img/inner-page/news-details/comment-2.png b/public/img/inner-page/news-details/comment-2.png
deleted file mode 100644
index e126c86..0000000
Binary files a/public/img/inner-page/news-details/comment-2.png and /dev/null differ
diff --git a/public/img/inner-page/news-details/comment-3.png b/public/img/inner-page/news-details/comment-3.png
deleted file mode 100644
index e126c86..0000000
Binary files a/public/img/inner-page/news-details/comment-3.png and /dev/null differ
diff --git a/public/img/inner-page/news-details/details-1.jpg b/public/img/inner-page/news-details/details-1.jpg
deleted file mode 100644
index 850df16..0000000
Binary files a/public/img/inner-page/news-details/details-1.jpg and /dev/null differ
diff --git a/public/img/inner-page/news-details/details-2.jpg b/public/img/inner-page/news-details/details-2.jpg
deleted file mode 100644
index de42f5d..0000000
Binary files a/public/img/inner-page/news-details/details-2.jpg and /dev/null differ
diff --git a/public/img/inner-page/news-details/details-3.jpg b/public/img/inner-page/news-details/details-3.jpg
deleted file mode 100644
index de42f5d..0000000
Binary files a/public/img/inner-page/news-details/details-3.jpg and /dev/null differ
diff --git a/public/img/inner-page/news-details/post-1.jpg b/public/img/inner-page/news-details/post-1.jpg
deleted file mode 100644
index 07b738e..0000000
Binary files a/public/img/inner-page/news-details/post-1.jpg and /dev/null differ
diff --git a/public/img/inner-page/news-details/post-2.jpg b/public/img/inner-page/news-details/post-2.jpg
deleted file mode 100644
index 07b738e..0000000
Binary files a/public/img/inner-page/news-details/post-2.jpg and /dev/null differ
diff --git a/public/img/inner-page/news-details/post-3.jpg b/public/img/inner-page/news-details/post-3.jpg
deleted file mode 100644
index 07b738e..0000000
Binary files a/public/img/inner-page/news-details/post-3.jpg and /dev/null differ
diff --git a/public/img/inner-page/service-details/details-1.jpg b/public/img/inner-page/service-details/details-1.jpg
deleted file mode 100644
index fb9d1ba..0000000
Binary files a/public/img/inner-page/service-details/details-1.jpg and /dev/null differ
diff --git a/public/img/inner-page/service-details/details-2.jpg b/public/img/inner-page/service-details/details-2.jpg
deleted file mode 100644
index 1ad2590..0000000
Binary files a/public/img/inner-page/service-details/details-2.jpg and /dev/null differ
diff --git a/public/img/inner-page/service-details/details-3.jpg b/public/img/inner-page/service-details/details-3.jpg
deleted file mode 100644
index a17639f..0000000
Binary files a/public/img/inner-page/service-details/details-3.jpg and /dev/null differ
diff --git a/public/img/inner-page/shape.png b/public/img/inner-page/shape.png
deleted file mode 100644
index 6527cf6..0000000
Binary files a/public/img/inner-page/shape.png and /dev/null differ
diff --git a/public/img/logo.png b/public/img/logo.png
new file mode 100644
index 0000000..12b982e
Binary files /dev/null and b/public/img/logo.png differ
diff --git a/public/img/logo/black-logo.svg b/public/img/logo/black-logo.svg
deleted file mode 100644
index ec35168..0000000
--- a/public/img/logo/black-logo.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/public/img/logo/logo-hai-learning.png b/public/img/logo/logo-hai-learning.png
deleted file mode 100644
index 5c833be..0000000
Binary files a/public/img/logo/logo-hai-learning.png and /dev/null differ
diff --git a/public/img/logo/white-logo.svg b/public/img/logo/white-logo.svg
deleted file mode 100644
index 486d3ee..0000000
--- a/public/img/logo/white-logo.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/public/js/main.js b/public/js/main.js
index 9f66ccb..edd1370 100644
--- a/public/js/main.js
+++ b/public/js/main.js
@@ -4,7 +4,13 @@
console.log('CMS Admin Main JS loaded');
-// Helper to handle AJAX form submissions with confirmation or loading state
+// Helper to show toast notifications
+function showToast(title, message, type = 'info') {
+ if (typeof window.showToast === 'function') return window.showToast(title, message, type);
+ console.log(`[${type.toUpperCase()}] ${title}: ${message}`);
+}
+
+// Helper to handle AJAX form submissions with optional confirmation and loading state
window.handleFormAjax = async (formEl, options = {}) => {
const {
confirmMessage = null,
diff --git a/public/uploads/about/01.png b/public/uploads/about/01.png
deleted file mode 100644
index cb8e5e7..0000000
Binary files a/public/uploads/about/01.png and /dev/null differ
diff --git a/public/uploads/about/01.svg b/public/uploads/about/01.svg
deleted file mode 100644
index 87ac71c..0000000
--- a/public/uploads/about/01.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/public/uploads/about/02.png b/public/uploads/about/02.png
deleted file mode 100644
index cc69b4b..0000000
Binary files a/public/uploads/about/02.png and /dev/null differ
diff --git a/public/uploads/about/375x419.jpg b/public/uploads/about/375x419.jpg
deleted file mode 100644
index 1a73623..0000000
Binary files a/public/uploads/about/375x419.jpg and /dev/null differ
diff --git a/public/uploads/about/686x906.jpg b/public/uploads/about/686x906.jpg
deleted file mode 100644
index 0f75a17..0000000
Binary files a/public/uploads/about/686x906.jpg and /dev/null differ
diff --git a/public/uploads/about/Vector.png b/public/uploads/about/Vector.png
deleted file mode 100644
index e69d461..0000000
Binary files a/public/uploads/about/Vector.png and /dev/null differ
diff --git a/public/uploads/about/about-02.jpg b/public/uploads/about/about-02.jpg
deleted file mode 100644
index d9399ee..0000000
Binary files a/public/uploads/about/about-02.jpg and /dev/null differ
diff --git a/public/uploads/about/about-1.jpg b/public/uploads/about/about-1.jpg
deleted file mode 100644
index 7e0555e..0000000
Binary files a/public/uploads/about/about-1.jpg and /dev/null differ
diff --git a/public/uploads/about/bg-shape.png b/public/uploads/about/bg-shape.png
deleted file mode 100644
index b30ddb9..0000000
Binary files a/public/uploads/about/bg-shape.png and /dev/null differ
diff --git a/public/uploads/about/breadcrumb.jpg b/public/uploads/about/breadcrumb.jpg
deleted file mode 100644
index a6d73a3..0000000
Binary files a/public/uploads/about/breadcrumb.jpg and /dev/null differ
diff --git a/public/uploads/about/businessman.jpg b/public/uploads/about/businessman.jpg
deleted file mode 100644
index f092493..0000000
Binary files a/public/uploads/about/businessman.jpg and /dev/null differ
diff --git a/public/uploads/about/client.png b/public/uploads/about/client.png
deleted file mode 100644
index 398078e..0000000
Binary files a/public/uploads/about/client.png and /dev/null differ
diff --git a/public/uploads/about/details-1.jpg b/public/uploads/about/details-1.jpg
deleted file mode 100644
index fb9d1ba..0000000
Binary files a/public/uploads/about/details-1.jpg and /dev/null differ
diff --git a/public/uploads/about/footer-bg.jpg b/public/uploads/about/footer-bg.jpg
deleted file mode 100644
index 1c8a33b..0000000
Binary files a/public/uploads/about/footer-bg.jpg and /dev/null differ
diff --git a/public/uploads/about/globe.png b/public/uploads/about/globe.png
deleted file mode 100644
index f593f8d..0000000
Binary files a/public/uploads/about/globe.png and /dev/null differ
diff --git a/public/uploads/about/intro.jpg b/public/uploads/about/intro.jpg
deleted file mode 100644
index 2540cd4..0000000
Binary files a/public/uploads/about/intro.jpg and /dev/null differ
diff --git a/public/uploads/about/news-1.jpg b/public/uploads/about/news-1.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/uploads/about/news-1.jpg and /dev/null differ
diff --git a/public/uploads/about/news-2.jpg b/public/uploads/about/news-2.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/uploads/about/news-2.jpg and /dev/null differ
diff --git a/public/uploads/about/news-3.jpg b/public/uploads/about/news-3.jpg
deleted file mode 100644
index 199f457..0000000
Binary files a/public/uploads/about/news-3.jpg and /dev/null differ
diff --git a/public/uploads/about/plane.png b/public/uploads/about/plane.png
deleted file mode 100644
index 391ca8c..0000000
Binary files a/public/uploads/about/plane.png and /dev/null differ
diff --git a/public/uploads/about/shape.png b/public/uploads/about/shape.png
deleted file mode 100644
index bacb7da..0000000
Binary files a/public/uploads/about/shape.png and /dev/null differ
diff --git a/public/uploads/blog/connector-852x400.png b/public/uploads/blog/connector-852x400.png
deleted file mode 100644
index 0e9e71f..0000000
Binary files a/public/uploads/blog/connector-852x400.png and /dev/null differ
diff --git a/public/uploads/footer/black-logo.svg b/public/uploads/footer/black-logo.svg
deleted file mode 100644
index ec35168..0000000
--- a/public/uploads/footer/black-logo.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/public/uploads/footer/footer-bg.jpg b/public/uploads/footer/footer-bg.jpg
deleted file mode 100644
index 1c8a33b..0000000
Binary files a/public/uploads/footer/footer-bg.jpg and /dev/null differ
diff --git a/public/uploads/footer/white-logo.svg b/public/uploads/footer/white-logo.svg
deleted file mode 100644
index 486d3ee..0000000
--- a/public/uploads/footer/white-logo.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/public/uploads/header/black-logo.svg b/public/uploads/header/black-logo.svg
deleted file mode 100644
index ec35168..0000000
--- a/public/uploads/header/black-logo.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/public/uploads/header/footer-bg.jpg b/public/uploads/header/footer-bg.jpg
deleted file mode 100644
index 1c8a33b..0000000
Binary files a/public/uploads/header/footer-bg.jpg and /dev/null differ
diff --git a/public/uploads/header/white-logo.svg b/public/uploads/header/white-logo.svg
deleted file mode 100644
index 486d3ee..0000000
--- a/public/uploads/header/white-logo.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/public/uploads/layout/white-logo.svg b/public/uploads/layout/white-logo.svg
deleted file mode 100644
index 486d3ee..0000000
--- a/public/uploads/layout/white-logo.svg
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/public/uploads/service/03.jpg b/public/uploads/service/03.jpg
deleted file mode 100644
index 1b47583..0000000
Binary files a/public/uploads/service/03.jpg and /dev/null differ
diff --git a/public/uploads/service/404.png b/public/uploads/service/404.png
deleted file mode 100644
index f7c61d3..0000000
Binary files a/public/uploads/service/404.png and /dev/null differ
diff --git a/public/uploads/service/Dell_Inspiron15.webp b/public/uploads/service/Dell_Inspiron15.webp
deleted file mode 100644
index 00b169d..0000000
Binary files a/public/uploads/service/Dell_Inspiron15.webp and /dev/null differ
diff --git a/public/uploads/service/Learning.jpg b/public/uploads/service/Learning.jpg
deleted file mode 100644
index 2da0dbd..0000000
Binary files a/public/uploads/service/Learning.jpg and /dev/null differ
diff --git a/public/uploads/service/intro.jpg b/public/uploads/service/intro.jpg
deleted file mode 100644
index 2540cd4..0000000
Binary files a/public/uploads/service/intro.jpg and /dev/null differ
diff --git a/public/uploads/service/iphone15.webp b/public/uploads/service/iphone15.webp
deleted file mode 100644
index d158840..0000000
Binary files a/public/uploads/service/iphone15.webp and /dev/null differ
diff --git a/public/uploads/service/smart_samsung_55inch.jpg b/public/uploads/service/smart_samsung_55inch.jpg
deleted file mode 100644
index 07ede78..0000000
Binary files a/public/uploads/service/smart_samsung_55inch.jpg and /dev/null differ
diff --git a/routes/admin.js b/routes/admin.js
index 5dce403..9c8e7ef 100644
--- a/routes/admin.js
+++ b/routes/admin.js
@@ -2,617 +2,58 @@ const express = require("express");
const router = express.Router();
const { ensureAuthenticated } = require("../middleware/auth");
const dashboardController = require("../controllers/dashboardController");
-const uploadController = require("../controllers/uploadController");
-const homeController = require("../controllers/homeController");
-const headerController = require("../controllers/headerController");
-const footerController = require("../controllers/footerController");
-const aboutUsController = require("../controllers/aboutUsController");
-const formController = require("../controllers/formController");
-const contactController = require("../controllers/contactController");
-const pageController = require("../controllers/pageController");
-const settingController = require("../controllers/settingController");
-const faqController = require("../controllers/faqController"); // Thêm import này
-const termsController = require("../controllers/termsController");
-const travelController = require("../controllers/travelController");
-const visaController = require("../controllers/visaController");
-const { upload, uploadVideo, convertToWebp } = require("../middleware/upload");
-const safetyController = require("../controllers/safetyController");
-const insuranceController = require("../controllers/insuranceController");
+const qualificationController = require("../controllers/qualificationController");
+const certificateController = require("../controllers/certificateController");
+const departmentController = require("../controllers/departmentController");
+const levelController = require("../controllers/levelController");
const auditLogController = require("../controllers/auditLogController");
-
-const activityController = require("../controllers/activityController");
-const bookingSubmissionController = require("../controllers/bookingSubmissionController");
-const serviceController = require("../controllers/serviceController");
-const headerMenuController = require("../controllers/headerMenuController");
-
-// Blog controllers
-const blogController = require("../controllers/blogController");
-const blogCategoryController = require("../controllers/blogCategoryController");
-const blogTagController = require("../controllers/blogTagController");
-const socialLinkController = require("../controllers/socialLinkController");
-const testimonialController = require("../controllers/testimonialController");
-const videoGalleryController = require("../controllers/videoGalleryController");
+const { uploadDegree } = require("../middleware/upload");
// Dashboard
router.get("/dashboard", ensureAuthenticated, dashboardController.getDashboard);
-// Home
-router.get("/home", ensureAuthenticated, homeController.index);
-router.post("/home/update", ensureAuthenticated, homeController.update);
-router.get("/home/api/blogs", ensureAuthenticated, homeController.apiGetBlogs);
+// Qualification routes
+router.get("/qualification", ensureAuthenticated, qualificationController.index);
+router.get("/qualification/create", ensureAuthenticated, qualificationController.createForm);
+router.post("/qualification/create", ensureAuthenticated, uploadDegree, qualificationController.create);
+router.get("/qualification/:id/edit", ensureAuthenticated, qualificationController.editForm);
+router.post("/qualification/:id/edit", ensureAuthenticated, uploadDegree, qualificationController.update);
+router.post("/qualification/:id/delete", ensureAuthenticated, qualificationController.destroy);
-// Middleware chuẩn hóa code
-router.param("code", (req, res, next, code) => {
- req.params.code = code.toUpperCase();
- next();
-});
+// Certificate routes
+router.get("/certificate", ensureAuthenticated, certificateController.index);
+router.get("/certificate/create", ensureAuthenticated, certificateController.createForm);
+router.post("/certificate/create", ensureAuthenticated, uploadDegree, certificateController.create);
+router.get("/certificate/:id/edit", ensureAuthenticated, certificateController.editForm);
+router.post("/certificate/:id/edit", ensureAuthenticated, uploadDegree, certificateController.update);
+router.post("/certificate/:id/delete", ensureAuthenticated, certificateController.destroy);
-// About Us
-router.get("/about-us", ensureAuthenticated, aboutUsController.index);
-router.post("/about-us/update", ensureAuthenticated, aboutUsController.update);
+// Department routes
+router.get("/department", ensureAuthenticated, departmentController.index);
+router.post("/department/create", ensureAuthenticated, departmentController.create);
+router.post("/department/:id/edit", ensureAuthenticated, departmentController.update);
+router.post("/department/:id/delete", ensureAuthenticated, departmentController.destroy);
-// Booking admin CRUD removed
-
-// Form Management
-router.get("/form", ensureAuthenticated, formController.index);
-router.post(
- "/form/update",
- ensureAuthenticated,
- formController.updateDefaultForm,
-);
-
-// Upload routes
-router.get("/upload", ensureAuthenticated, (req, res) => {
- res.render("admin/upload/index", {
- layout: "layouts/admin",
- title: "Quản lý Upload Ảnh",
- user: req.session.user,
- });
-});
-router.post(
- "/upload/image",
- ensureAuthenticated,
- upload.single("image"),
- uploadController.uploadImage,
-);
-router.post(
- "/upload/video",
- ensureAuthenticated,
- uploadVideo.single("video"),
- uploadController.uploadVideo,
-);
-router.post(
- "/upload/update-path",
- ensureAuthenticated,
- uploadController.updateImagePath,
-);
-router.post(
- "/upload/delete",
- ensureAuthenticated,
- uploadController.deleteImage,
-);
-
-// Header routes
-router.get("/header", ensureAuthenticated, headerController.index);
-router.post("/header/update", ensureAuthenticated, headerController.update);
-router.get("/header/data", ensureAuthenticated, headerController.api); // Normalized from getHeaderData
-router.patch(
- "/header/:id/status",
- ensureAuthenticated,
- headerController.updateStatus,
-);
-router.delete("/header/:id", ensureAuthenticated, headerController.destroy);
-
-// Header Menu INTEGRATED routes
-router.post(
- "/header/menu/create",
- ensureAuthenticated,
- headerMenuController.store,
-);
-router.post(
- "/header/menu/update/:id",
- ensureAuthenticated,
- headerMenuController.update,
-);
-router.post(
- "/header/menu/delete",
- ensureAuthenticated,
- headerMenuController.destroy,
-);
-router.post(
- "/header/menu/reorder",
- ensureAuthenticated,
- headerMenuController.reorder,
-);
-
-// Social Links routes
-router.get("/social-links", ensureAuthenticated, socialLinkController.index);
-router.post("/social-links", ensureAuthenticated, socialLinkController.store);
-router.put(
- "/social-links/:platform",
- ensureAuthenticated,
- socialLinkController.update,
-);
-router.delete(
- "/social-links/:platform",
- ensureAuthenticated,
- socialLinkController.destroy,
-);
-router.post(
- "/social-links/reorder",
- ensureAuthenticated,
- socialLinkController.reorder,
-);
-
-// Footer routes
-router.get("/footer", ensureAuthenticated, footerController.index);
-router.post("/footer/update", ensureAuthenticated, footerController.update);
-router.get("/footer/data", ensureAuthenticated, footerController.getFooterData);
-
-// Contact routes
-router.get("/contact", ensureAuthenticated, contactController.index);
-router.post("/contact/update", ensureAuthenticated, contactController.update);
-router.get(
- "/contact/data",
- ensureAuthenticated,
- contactController.getContactData,
-);
-
-// Contact submissions management
-router.get(
- "/contact/submissions",
- ensureAuthenticated,
- contactController.getSubmissions,
-);
-router.put(
- "/contact/submissions/:id",
- ensureAuthenticated,
- contactController.updateSubmissionStatus,
-);
-
-// Appointment management
-const appointmentController = require("../controllers/appointmentController");
-router.get(
- "/appointments",
- ensureAuthenticated,
- appointmentController.getAppointments,
-);
-router.get(
- "/appointments/:id",
- ensureAuthenticated,
- appointmentController.getAppointmentById,
-);
-router.put(
- "/appointments/:id",
- ensureAuthenticated,
- appointmentController.updateAppointmentStatus,
-);
-router.delete(
- "/appointments/:id",
- ensureAuthenticated,
- appointmentController.deleteAppointment,
-);
-
-// Appointment CMS page management
-router.get("/appointment", ensureAuthenticated, appointmentController.index);
-router.post(
- "/appointment/update",
- ensureAuthenticated,
- appointmentController.update,
-);
-router.get(
- "/appointment/data",
- ensureAuthenticated,
- appointmentController.getAppointmentData,
-);
-
-// Pricing CMS page management
-const pricingController = require("../controllers/pricingController");
-router.get("/pricing", ensureAuthenticated, pricingController.index);
-router.post("/pricing/update", ensureAuthenticated, pricingController.update);
-router.get(
- "/pricing/data",
- ensureAuthenticated,
- pricingController.getPricingData,
-);
-
-// Activity CRUD routes
-router.get("/activity", ensureAuthenticated, activityController.index);
-router.get(
- "/activity/create",
- ensureAuthenticated,
- activityController.createForm,
-);
-router.post("/activity/create", ensureAuthenticated, activityController.create);
-// Update filters (place before any parameterized /activity/:id routes to avoid route collision)
-router.post(
- "/activity/filters/update",
- ensureAuthenticated,
- activityController.updateFilters,
-);
-// Update hero (global hero section for activities)
-router.post(
- "/activity/hero/update",
- ensureAuthenticated,
- activityController.updateHero,
-);
-router.get(
- "/activity/:id/edit",
- ensureAuthenticated,
- activityController.editForm,
-);
-router.post(
- "/activity/:id/update",
- ensureAuthenticated,
- activityController.update,
-);
-router.post(
- "/activity/:id/delete",
- ensureAuthenticated,
- activityController.delete,
-);
-router.post(
- "/activity/:id/toggle-status",
- ensureAuthenticated,
- activityController.toggleStatus,
-);
-// Update display order
-router.post(
- "/activity/update-order",
- ensureAuthenticated,
- activityController.updateOrder,
-);
-
-// Booking submissions routes
-router.get(
- "/activity/:id/bookings/count",
- ensureAuthenticated,
- activityController.getBookingCount,
-);
-router.get(
- "/activity/:id/bookings",
- ensureAuthenticated,
- activityController.getBookingSubmissions,
-);
-router.get(
- "/activity/:id/bookings/export",
- ensureAuthenticated,
- activityController.exportBookingData,
-);
-// Export all bookings (across all activities)
-router.get(
- "/bookings/export-all",
- ensureAuthenticated,
- activityController.exportAllBookingsData,
-);
-// Update booking submission
-router.put(
- "/bookings/:bookingId",
- ensureAuthenticated,
- bookingSubmissionController.updateBookingSubmission,
-);
-// Delete booking submission
-router.delete(
- "/bookings/:bookingId",
- ensureAuthenticated,
- bookingSubmissionController.deleteBookingSubmission,
-);
-
-// Update filters
-
-// Preview activity
-router.get(
- "/activity/:id/preview",
- ensureAuthenticated,
- activityController.preview,
-);
-
-// FAQ routes
-router.get("/home/faq", ensureAuthenticated, faqController.index);
-router.post("/home/faq/update", ensureAuthenticated, faqController.update);
-router.get("/home/faq/data", ensureAuthenticated, faqController.getFAQData);
-router.get("/home/faq/api", faqController.api);
-
-// Deprecated FAQ API routes removed
-
-// API routes cho quản lý FAQ items (AJAX calls)
-router.post("/faq/api/add-faq", ensureAuthenticated, faqController.addFAQ);
-router.put(
- "/faq/api/update-faq-item/:sectionId/:faqId",
- ensureAuthenticated,
- faqController.updateFAQItem,
-);
-router.delete(
- "/faq/api/delete-faq-item/:sectionId/:faqId",
- ensureAuthenticated,
- faqController.deleteFAQItem,
-);
-router.get("/terms-conditions", ensureAuthenticated, termsController.index);
-router.post("/terms/update", ensureAuthenticated, termsController.update);
-router.get("/terms/data", ensureAuthenticated, termsController.getTermsData);
-router.get("/terms/api", termsController.api);
-router.get("/terms/seed", ensureAuthenticated, termsController.seed);
-
-// Travel routes
-router.get("/travel", ensureAuthenticated, travelController.index);
-router.post("/travel/update", ensureAuthenticated, travelController.update);
-router.post("/travel/preview", ensureAuthenticated, travelController.preview);
-router.get("/travel/data", ensureAuthenticated, travelController.getTravelData);
-router.get("/travel/api", travelController.api);
-router.get("/travel/seed", ensureAuthenticated, travelController.seed);
-
-// Deprecated FAQ API routes removed
-
-// API routes cho quản lý FAQ sections (AJAX calls)
-router.post(
- "/faq/api/add-section",
- ensureAuthenticated,
- faqController.addFAQSection,
-);
-router.put(
- "/faq/api/update-section/:sectionId",
- ensureAuthenticated,
- faqController.updateFAQSection,
-);
-router.delete(
- "/faq/api/delete-section/:sectionId",
- ensureAuthenticated,
- faqController.deleteFAQSection,
-);
-router.post(
- "/faq/api/reorder-sections",
- ensureAuthenticated,
- faqController.reorderFAQSection,
-);
-
-// API routes cho sidebar navigation (AJAX calls)
-router.put(
- "/faq/api/update-sidebar",
- ensureAuthenticated,
- faqController.updateSidebarNav,
-);
-
-// Safety routes
-router.get("/safety", ensureAuthenticated, safetyController.index);
-router.post("/safety/update", ensureAuthenticated, safetyController.update);
-
-//Insurance routes
-router.get("/insurance", ensureAuthenticated, insuranceController.index);
-router.post(
- "/insurance/update",
- ensureAuthenticated,
- insuranceController.update,
-);
-
-// Service routes
-router.get("/service", ensureAuthenticated, serviceController.index);
-router.post("/service/update", ensureAuthenticated, serviceController.update);
-router.post(
- "/service/generate-slug",
- ensureAuthenticated,
- serviceController.generateSlug,
-);
-router.get("/service/:slug/edit", ensureAuthenticated, serviceController.edit);
-router.post(
- "/service/:slug/edit",
- ensureAuthenticated,
- serviceController.updateService,
-);
-router.get(
- "/service/:slug/details",
- ensureAuthenticated,
- serviceController.details,
-);
-router.post(
- "/service/:slug/details/update",
- ensureAuthenticated,
- serviceController.updateDetails,
-);
-
-// Test Image Paths route
-router.get("/test-images", ensureAuthenticated, (req, res) => {
- const fs = require("fs");
- const path = require("path");
- const campLocationData = require("../data/camp-location.json");
-
- // Collect all image paths
- const imagePaths = [];
-
- // Camps images
- if (campLocationData.camps) {
- campLocationData.camps.forEach((camp) => {
- if (camp.image) {
- imagePaths.push({
- type: "Camp",
- name: camp.title,
- path: camp.image,
- exists: fs.existsSync(path.join(__dirname, "../public", camp.image)),
- });
- }
- });
- }
-
- // Locations images
- if (campLocationData.locations) {
- campLocationData.locations.forEach((location) => {
- if (location.imageSrc) {
- imagePaths.push({
- type: "Location",
- name: location.title,
- path: location.imageSrc,
- exists: fs.existsSync(
- path.join(__dirname, "../public", location.imageSrc),
- ),
- });
- }
-
- // Program images
- if (location.programOptions) {
- location.programOptions.forEach((program) => {
- if (program.imageSrc) {
- imagePaths.push({
- type: "Program",
- name: program.title,
- path: program.imageSrc,
- exists: fs.existsSync(
- path.join(__dirname, "../public", program.imageSrc),
- ),
- });
- }
- });
- }
- });
- }
-
- res.render("admin/test-images", {
- layout: "layouts/admin",
- title: "Test Image Paths",
- images: imagePaths,
- user: req.session.user,
- });
-});
-
-// Display visa management page
-router.get("/visa", ensureAuthenticated, visaController.index);
-
-// Get country data for editing
-router.get("/visa/edit/:id", ensureAuthenticated, visaController.getCountry);
-
-// Update hero title
-router.post("/visa/update", ensureAuthenticated, visaController.updateCountry);
-
-// Add new country
-router.post("/visa/add", ensureAuthenticated, visaController.addCountry);
-
-// Update single country
-router.put(
- "/visa/update/:id",
- ensureAuthenticated,
- visaController.updateCountry,
-);
-
-// Delete country
-router.delete(
- "/visa/delete/:id",
- ensureAuthenticated,
- visaController.deleteCountry,
-);
-// Blog routes
-// Blog Management Routes
-router.get("/blog", ensureAuthenticated, blogController.index);
-router.get("/blog/create", ensureAuthenticated, blogController.create);
-router.post("/blog/create", ensureAuthenticated, blogController.store);
-router.get("/blog/:id/edit", ensureAuthenticated, blogController.edit);
-router.post("/blog/:id/edit", ensureAuthenticated, blogController.update);
-router.post("/blog/:id/delete", ensureAuthenticated, blogController.destroy);
-
-// Comment management routes
-router.post(
- "/blog/:blogId/comments/:commentId/approve",
- ensureAuthenticated,
- blogController.approveComment,
-);
-router.post(
- "/blog/:blogId/comments/:commentId/reject",
- ensureAuthenticated,
- blogController.rejectComment,
-);
-router.post(
- "/blog/:blogId/comments/:commentId/delete",
- ensureAuthenticated,
- blogController.deleteComment,
-);
-
-// Blog Categories Management
-router.get(
- "/blog/categories",
- ensureAuthenticated,
- blogCategoryController.index,
-);
-router.get(
- "/blog/categories/create",
- ensureAuthenticated,
- blogCategoryController.create,
-);
-router.post(
- "/blog/categories/create",
- ensureAuthenticated,
- blogCategoryController.store,
-);
-router.get(
- "/blog/categories/:id/edit",
- ensureAuthenticated,
- blogCategoryController.edit,
-);
-router.post(
- "/blog/categories/:id/edit",
- ensureAuthenticated,
- blogCategoryController.update,
-);
-router.post(
- "/blog/categories/:id/delete",
- ensureAuthenticated,
- blogCategoryController.destroy,
-);
-router.post(
- "/blog/categories/quick-create",
- ensureAuthenticated,
- blogCategoryController.quickCreate,
-);
-
-// Blog Tags Management
-router.get("/blog/tags", ensureAuthenticated, blogTagController.index);
-router.get("/blog/tags/create", ensureAuthenticated, blogTagController.create);
-router.post("/blog/tags/create", ensureAuthenticated, blogTagController.store);
-router.get("/blog/tags/:id/edit", ensureAuthenticated, blogTagController.edit);
-router.post(
- "/blog/tags/:id/edit",
- ensureAuthenticated,
- blogTagController.update,
-);
-router.post(
- "/blog/tags/:id/delete",
- ensureAuthenticated,
- blogTagController.destroy,
-);
-router.post(
- "/blog/tags/quick-create",
- ensureAuthenticated,
- blogTagController.quickCreate,
-);
-
-// Testimonials management
-router.get(
- "/home/testimonials",
- ensureAuthenticated,
- testimonialController.index,
-);
-router.post(
- "/home/testimonials/update",
- ensureAuthenticated,
- testimonialController.update,
-);
-
-// Video Gallery management
-router.get(
- "/home/video-gallery",
- ensureAuthenticated,
- videoGalleryController.index,
-);
-router.post(
- "/home/video-gallery/update",
- ensureAuthenticated,
- videoGalleryController.update,
-);
+// Level routes
+router.get("/level", ensureAuthenticated, levelController.index);
+router.post("/level/create", ensureAuthenticated, levelController.create);
+router.post("/level/:id/edit", ensureAuthenticated, levelController.update);
+router.post("/level/:id/delete", ensureAuthenticated, levelController.destroy);
// Audit Log routes
router.get("/audit-logs", ensureAuthenticated, auditLogController.index);
router.get("/audit-logs/:id", ensureAuthenticated, auditLogController.show);
router.get("/audit-logs-api", ensureAuthenticated, auditLogController.api);
-router.post(
- "/audit-logs/cleanup",
- ensureAuthenticated,
- auditLogController.cleanup,
-);
+router.post("/audit-logs/cleanup", ensureAuthenticated, auditLogController.cleanup);
+
+// Protected file preview for admin (session-authenticated)
+const path = require('path');
+const fs = require('fs');
+router.get("/files/:filename", ensureAuthenticated, (req, res) => {
+ const filename = path.basename(req.params.filename);
+ const filePath = path.join(__dirname, '../private/uploads/degree', filename);
+ if (!fs.existsSync(filePath)) return res.status(404).send('File not found');
+ res.sendFile(filePath);
+});
module.exports = router;
diff --git a/routes/index.js b/routes/index.js
index 48e1d8c..28481f0 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -1,195 +1,13 @@
const express = require("express");
-const path = require("path");
const router = express.Router();
-const homeController = require("../controllers/homeController");
-const aboutUsController = require("../controllers/aboutUsController");
-const headerController = require("../controllers/headerController");
-const socialLinkController = require("../controllers/socialLinkController");
-const footerController = require("../controllers/footerController");
-const contactController = require("../controllers/contactController");
-const faqController = require("../controllers/faqController");
-const visaController = require("../controllers/visaController");
-const headerMenuController = require("../controllers/headerMenuController");
-const safetyController = require("../controllers/safetyController");
-// Booking flow removed
+const qualificationController = require("../controllers/qualificationController");
+const certificateController = require("../controllers/certificateController");
+const { validateApiKey } = require("../middleware/apiKey");
-const insuranceController = require("../controllers/insuranceController");
-const termsController = require("../controllers/termsController"); // <-- IMPORT ĐÃ CÓ
-const activityController = require("../controllers/activityController");
-const travelController = require("../controllers/travelController");
-const bookingSubmissionController = require("../controllers/bookingSubmissionController");
+// Public API — spec: GET /api/verify-degree/{degree_id}?api_key={API_KEY}
+router.get("/api/verify-degree/:degree_id", validateApiKey, qualificationController.apiVerify);
-const serviceController = require("../controllers/serviceController");
-// Blog controllers
-const blogController = require("../controllers/blogController");
-const blogCategoryController = require("../controllers/blogCategoryController");
-const blogTagController = require("../controllers/blogTagController");
-
-// Trang chủ
-router.get("/", (req, res) => {
- res.render("index", {
- title: "Welcome",
- layout: "layouts/main",
- });
-});
-
-// API để lấy dữ liệu trang chủ
-router.get("/api/home", homeController.api);
-
-// API để lấy dữ liệu about
-router.get("/api/about", aboutUsController.getAbout);
-router.put("/api/about", aboutUsController.updateAbout);
-
-// Public about-us page and API (legacy support)
-router.get("/about-us", aboutUsController.getAbout);
-router.get("/api/about-us", aboutUsController.getAbout);
-
-// Header API route
-router.get("/api/header", headerController.api);
-
-// Menu Tree API route (for frontend)
-router.get("/api/menu-tree", headerController.getMenuTreeAPI);
-
-// Header Menu New Module API
-router.get("/api/header-menu", headerMenuController.api);
-
-// Social Links API routes
-router.get("/api/social-links", socialLinkController.index);
-router.get("/api/social-links/:platform", socialLinkController.show);
-
-// Footer API routes
-router.get("/api/footer", footerController.getFooter);
-router.put("/api/admin/footer", footerController.updateFooter);
-
-// Contact API route
-router.get("/api/contact", contactController.api);
-
-// Contact form submission (public)
-router.post("/api/contact/submit", contactController.submitForm);
-
-// Appointment API
-const appointmentController = require("../controllers/appointmentController");
-router.get("/api/appointment", appointmentController.api);
-router.post("/api/appointment/submit", appointmentController.submitAppointment);
-
-// Pricing API
-const pricingController = require("../controllers/pricingController");
-router.get("/api/pricing", pricingController.api);
-
-router.get("/api/faq", faqController.api);
-// Safety API route
-router.get("/api/safety", safetyController.api);
-// Activity API routes
-router.get("/api/activities", activityController.api);
-router.get("/api/activities/:id", activityController.apiDetail);
-// Insurance APi route
-router.get("/api/insurance", insuranceController.api);
-
-router.get("/api/terms", termsController.api);
-
-// Travel public page and API
-router.get("/travel", async (req, res) => {
- try {
- const Travel = require("../models/travel");
- const travel = await Travel.findOne();
-
- if (!travel) {
- return res.status(404).render("errors/404", {
- title: "Page Not Found",
- message: "Travel information not found",
- });
- }
-
- res.render("page/travel", {
- title: travel.page.title,
- data: travel.toObject(),
- });
- } catch (error) {
- console.error("Error loading travel page:", error);
- res.status(500).render("errors/500", {
- title: "Server Error",
- message: "Error loading travel page",
- });
- }
-});
-router.get("/api/travel", travelController.api);
-
-// Booking submission APIs (public endpoints)
-router.post("/api/booking/submit", bookingSubmissionController.submitBooking);
-router.get("/api/activity/:activityId/sessions", bookingSubmissionController.getAvailableSessions);
-router.get(
- "/api/activity/:activityId/session/:sessionId/availability",
- bookingSubmissionController.getSessionAvailability,
-);
-
-// Demo booking form
-router.get("/demo/booking-form", (req, res) => {
- res.sendFile(path.join(__dirname, "../views/demo/booking-form.html"));
-});
-
-// Demo session booking API
-router.get("/demo/session-booking-api", (req, res) => {
- res.sendFile(path.join(__dirname, "../views/demo/session-booking-api.html"));
-});
-
-// Blog API Routes
-router.get("/api/blog", blogController.api);
-router.get("/api/blog/featured", blogController.apiFeatured);
-router.get("/api/blog/recent", blogController.apiRecent);
-
-// Blog Categories API (must come before /api/blog/:slug)
-router.get("/api/blog/categories", blogCategoryController.api);
-router.get("/api/blog/categories/:slug", blogCategoryController.apiShow);
-
-// Blog Tags API (must come before /api/blog/:slug)
-router.get("/api/blog/tags", blogTagController.api);
-router.get("/api/blog/tags/popular", blogTagController.apiPopular);
-router.get("/api/blog/tags/:slug", blogTagController.apiShow);
-
-// Blog post specific APIs (must come before /api/blog/:slug)
-router.get("/api/blog/:id/categories", blogController.apiCategories);
-router.get("/api/blog/:id/tags", blogController.apiTags);
-
-// Blog comments (must come before /api/blog/:slug)
-router.post("/api/blog/:slug/comments", blogController.apiCreateComment);
-
-// Blog detail by slug (must come last among blog routes)
-router.get("/api/blog/:slug", blogController.apiShow);
-
-// // API route cho blog detail
-// router.get('/api/blog-detail', blogDetailController.api);
-
-/* CMS - Hailearning
- */
-// service
-router.get("/service", serviceController.index);
-router.post("/service", serviceController.update);
-router.get("/api/service", serviceController.api);
-
-// Service details by slug
-router.get("/api/service/:slug", serviceController.getServiceBySlug);
-
-// Service slugs list
-router.get("/api/service-slugs", serviceController.getServiceSlugs);
-
-router.get("/api/visa", visaController.api);
-router.get("/api/visa/country", visaController.apiCountries);
-
-// Testimonials API
-const testimonialController = require("../controllers/testimonialController");
-router.get("/api/testimonials", testimonialController.api);
-
-// Video Gallery API
-const videoGalleryController = require("../controllers/videoGalleryController");
-router.get("/api/video-gallery", videoGalleryController.api);
-// Test route for footer
-router.get("/test-footer", (req, res) => {
- res.render("test-footer", {
- title: "Footer Test",
- layout: "layouts/main",
- });
-});
+// Public API — spec: GET /api/verify-certificate/{cert_id}?api_key={API_KEY}
+router.get("/api/verify-certificate/:cert_id", validateApiKey, certificateController.apiVerify);
module.exports = router;
-
-
diff --git a/scripts/2025_12_02_114127_contact.js b/scripts/2025_12_02_114127_contact.js
deleted file mode 100644
index c24e849..0000000
--- a/scripts/2025_12_02_114127_contact.js
+++ /dev/null
@@ -1,38 +0,0 @@
-require("dotenv").config();
-const fs = require("fs").promises;
-const path = require("path");
-const connectDB = require("../config/database");
-const Contact = require("../models/contact");
-const mongoose = require("mongoose");
-
-/**
- * Migration: contact
- * Migrate contact data from contact-data.json
- */
-async function migrate() {
- try {
- await connectDB();
-
- // Read contact-data.json file
- const contactJsonPath = path.join(__dirname, "../data/contact.json");
- const contactData = JSON.parse(await fs.readFile(contactJsonPath, "utf8"));
-
- // Migrate data using the model's static method
- await Contact.migrateFromJson(contactData);
-
- console.log("Contact migration completed successfully");
-
- await mongoose.disconnect();
- process.exit(0);
- } catch (error) {
- console.error("Migration error:", error);
- process.exit(1);
- }
-}
-
-// Chạy migration nếu được gọi trực tiếp
-if (require.main === module) {
- migrate();
-}
-
-module.exports = { migrate };
diff --git a/scripts/2026_02_02_131615_service.js b/scripts/2026_02_02_131615_service.js
deleted file mode 100644
index af24f29..0000000
--- a/scripts/2026_02_02_131615_service.js
+++ /dev/null
@@ -1,186 +0,0 @@
-require("dotenv").config();
-const fs = require("fs").promises;
-const path = require("path");
-const mongoose = require("mongoose");
-
-const connectDB = require("../config/database");
-const Service = require("../models/service");
-
-/**
- * Transform service.json data to match Service schema
- */
-function transformServiceData(sourceData) {
- return {
- pageTitle: sourceData.pageTitle || "",
-
- // Breadcrumb navigation section
- breadcrumb: {
- title: sourceData?.breadcrumb?.title || "",
- backgroundImage: sourceData?.breadcrumb?.backgroundImage || "",
- shape: sourceData?.breadcrumb?.shape || "",
- items: Array.isArray(sourceData?.breadcrumb?.items)
- ? sourceData.breadcrumb.items.map((item) => ({
- label: item.label || "",
- href: item.href || "",
- }))
- : [],
- },
-
- // Main services section
- services: {
- title: {
- subTitle: sourceData?.services?.title?.subTitle || "",
- mainTitle: sourceData?.services?.title?.mainTitle || "",
- },
- items: Array.isArray(sourceData?.services?.items)
- ? sourceData.services.items.map((service) => ({
- slug: service.slug || "",
- name: service.name || "",
- description: service.description || "",
- image: service.image || "",
- layout: service.layout || "",
- details: {
- title: service.details?.title || "",
- description: service.details?.description || "",
- mainImage: service.details?.mainImage || "",
- overviewTitle: service.details?.overviewTitle || "",
- overviewDescription: service.details?.overviewDescription || "",
- additionalDescription:
- service.details?.additionalDescription || "",
- keyFeaturesTitle: service.details?.keyFeaturesTitle || "",
- keyFeaturesImage: service.details?.keyFeaturesImage || "",
- features: Array.isArray(service.details?.features)
- ? service.details.features.map((feature) => ({
- icon: feature.icon || "",
- title: feature.title || "",
- description: feature.description || "",
- }))
- : [],
- faqTitle: service.details?.faqTitle || "",
- faqImage: service.details?.faqImage || "",
- faq: Array.isArray(service.details?.faq)
- ? service.details.faq.map((faqItem) => ({
- id: faqItem.id || "",
- question: faqItem.question || "",
- answer: faqItem.answer || "",
- isExpanded: faqItem.isExpanded || false,
- }))
- : [],
- },
- }))
- : [],
- },
-
- // Destination countries section
- destinations: {
- backgroundImage: sourceData?.destinations?.backgroundImage || "",
- title: {
- subTitle: sourceData?.destinations?.title?.subTitle || "",
- mainTitle: sourceData?.destinations?.title?.mainTitle || "",
- },
- items: Array.isArray(sourceData?.destinations?.items)
- ? sourceData.destinations.items.map((country) => ({
- id: country.id || "",
- name: country.name || "",
- description: country.description || "",
- image: country.image || "",
- icon: country.icon || "",
- link: country.link || "",
- }))
- : [],
- },
-
- // Visa types section
- visas: {
- items: Array.isArray(sourceData?.visas?.items)
- ? sourceData.visas.items.map((visa) => ({
- id: visa.id || "",
- number: visa.number || "",
- name: visa.name || "",
- description: visa.description || "",
- buttonText: visa.buttonText || "",
- buttonLink: visa.buttonLink || "",
- }))
- : [],
- },
-
- // Client reviews section
- reviews: {
- title: {
- subTitle: sourceData?.reviews?.title?.subTitle || "",
- mainTitle: sourceData?.reviews?.title?.mainTitle || "",
- },
- viewAllButton: {
- text: sourceData?.reviews?.viewAllButton?.text || "",
- icon: sourceData?.reviews?.viewAllButton?.icon || "",
- link: sourceData?.reviews?.viewAllButton?.link || "",
- },
- thumb: sourceData?.reviews?.thumb || "",
- items: Array.isArray(sourceData?.reviews?.items)
- ? sourceData.reviews.items.map((review) => ({
- id: review.id || "",
- rating: review.rating || 5,
- content: review.content || "",
- author: {
- name: review.author?.name || "",
- type: review.author?.type || "",
- },
- icon: review.icon || "",
- }))
- : [],
- navigation: {
- prevButton: sourceData?.reviews?.navigation?.prevButton || "",
- nextButton: sourceData?.reviews?.navigation?.nextButton || "",
- prevIcon: sourceData?.reviews?.navigation?.prevIcon || "",
- nextIcon: sourceData?.reviews?.navigation?.nextIcon || "",
- },
- },
-
- updatedAt: new Date(),
- };
-}
-
-/**
- * Migration function for service page data
- */
-async function migrateServiceData() {
- try {
- await connectDB();
- console.log("🚀 Starting service page migration...");
-
- // Clear existing service documents
- await Service.deleteMany({});
- console.log("🗑️ Cleared existing service documents");
-
- // Read service.json file
- const serviceJsonPath = path.join(__dirname, "..", "data", "service.json");
- const rawJsonData = await fs.readFile(serviceJsonPath, "utf8");
- const sourceServiceData = JSON.parse(rawJsonData);
-
- // Transform data to match schema
- const transformedServiceData = transformServiceData(sourceServiceData);
-
- // Create new service document
- const newService = new Service(transformedServiceData);
- const savedService = await newService.save();
-
- console.log("✅ Service page migration completed successfully!");
- console.log(`📄 Service document ID: ${savedService._id}`);
-
- await mongoose.disconnect();
- process.exit(0);
- } catch (error) {
- console.error("❌ Service migration error:", error);
- process.exit(1);
- }
-}
-
-// Run migration if called directly
-if (require.main === module) {
- migrateServiceData();
-}
-
-module.exports = {
- migrate: migrateServiceData,
- transformServiceData,
-};
diff --git a/scripts/2026_02_02_170000_blog.js b/scripts/2026_02_02_170000_blog.js
deleted file mode 100644
index 35e1f28..0000000
--- a/scripts/2026_02_02_170000_blog.js
+++ /dev/null
@@ -1,182 +0,0 @@
-require('dotenv').config();
-const fs = require('fs').promises;
-const path = require('path');
-const connectDB = require('../config/database');
-
-/**
- * Migration: create_complete_blog_system
- * Created: 17:00:00 2/2/2026
- * Description: Tạo hoàn chỉnh hệ thống blog với categories, tags, posts và comments
- */
-async function migrate() {
- try {
- // Kết nối database
- await connectDB();
- console.log('🚀 Starting migration: create_complete_blog_system...');
-
- // Import models
- const Blog = require('../models/blog');
- const BlogCategory = require('../models/blogCategory');
- const BlogTag = require('../models/blogTag');
- const BlogComment = require('../models/blogComment');
- const RecentPost = require('../models/recentPost');
-
- console.log('✅ Blog models registered successfully');
-
- // Load complete data
- const dataPath = path.join(__dirname, '..', 'data', 'blog.json');
- const rawData = await fs.readFile(dataPath, 'utf8');
- const data = JSON.parse(rawData);
-
- console.log('📖 Complete blog data loaded from JSON');
-
- // Clear existing data
- console.log('🧹 Clearing existing blog data...');
- await BlogComment.deleteMany({});
- await Blog.deleteMany({});
- await BlogCategory.deleteMany({});
- await BlogTag.deleteMany({});
- await RecentPost.deleteMany({});
- console.log('✅ Existing data cleared');
-
- // 1. Create categories
- console.log('📝 Creating categories...');
- const createdCategories = [];
- for (const categoryData of data.categories) {
- const category = new BlogCategory(categoryData);
- await category.save();
- createdCategories.push(category);
- console.log(`✅ Created category: ${category.name}`);
- }
-
- // 2. Create tags
- console.log('📝 Creating tags...');
- const createdTags = [];
- for (const tagData of data.tags) {
- const tag = new BlogTag(tagData);
- await tag.save();
- createdTags.push(tag);
- console.log(`✅ Created tag: ${tag.name}`);
- }
-
- // 3. Create blog posts
- console.log('📝 Creating blog posts...');
- const createdPosts = [];
- for (const postData of data.posts) {
- const post = new Blog(postData);
- await post.save();
- createdPosts.push(post);
- console.log(`✅ Created blog post: ${post.title}`);
- }
-
- // 4. Create comments
- console.log('💬 Creating comments...');
- let createdCommentsCount = 0;
-
- for (const commentData of data.comments) {
- // Find the blog post by slug
- const blog = await Blog.findOne({
- slug: commentData.postSlug,
- status: 'published'
- });
-
- if (blog) {
- const comment = new BlogComment({
- postId: blog._id,
- authorName: commentData.authorName,
- authorAvatar: commentData.authorAvatar,
- content: commentData.content,
- createdAt: commentData.createdAt,
- status: commentData.status
- });
-
- await comment.save();
- createdCommentsCount++;
- console.log(`✅ Created comment by ${comment.authorName} for: ${blog.title}`);
- } else {
- console.log(`⚠️ Blog post not found for slug: ${commentData.postSlug}`);
- }
- }
-
- // 5. Update category post counts
- console.log('📊 Updating category post counts...');
- for (const category of createdCategories) {
- await category.updatePostCount();
- console.log(`📊 Category "${category.name}": ${category.postCount} posts`);
- }
-
- // 6. Update tag post counts
- console.log('📊 Updating tag post counts...');
- for (const tag of createdTags) {
- await tag.updatePostCount();
- console.log(`📊 Tag "${tag.name}": ${tag.postCount} posts`);
- }
-
- // 7. Update comments count in blog posts
- console.log('📊 Updating comments count in blog posts...');
- const blogs = await Blog.find({ status: 'published' });
-
- for (const blog of blogs) {
- const commentsCount = await BlogComment.countDocuments({
- postId: blog._id,
- status: 'approved'
- });
-
- blog.commentsCount = commentsCount;
- await blog.save();
-
- if (commentsCount > 0) {
- console.log(`📊 Updated comments count for "${blog.title}": ${commentsCount} comments`);
- }
- }
-
- // 8. Sync recent posts
- console.log('🔄 Syncing recent posts...');
- await RecentPost.syncFromBlogs(5);
- const recentPostsCount = await RecentPost.countDocuments();
- console.log(`🔄 Synced ${recentPostsCount} recent posts`);
-
- // Final summary
- console.log('\n🎉 Migration create_complete_blog_system completed successfully!');
- console.log('=' .repeat(60));
- console.log('📊 MIGRATION SUMMARY:');
- console.log(` ✅ Categories: ${createdCategories.length}`);
- console.log(` ✅ Tags: ${createdTags.length}`);
- console.log(` ✅ Blog Posts: ${createdPosts.length}`);
- console.log(` ✅ Comments: ${createdCommentsCount}`);
- console.log(` ✅ Recent Posts: ${recentPostsCount}`);
-
- // Statistics
- const totalPublishedPosts = await Blog.countDocuments({ status: 'published' });
- const totalFeaturedPosts = await Blog.countDocuments({ status: 'published', isFeatured: true });
- const totalApprovedComments = await BlogComment.countDocuments({ status: 'approved' });
-
- console.log('\n📈 SYSTEM STATISTICS:');
- console.log(` 📝 Published Posts: ${totalPublishedPosts}`);
- console.log(` ⭐ Featured Posts: ${totalFeaturedPosts}`);
- console.log(` 💬 Approved Comments: ${totalApprovedComments}`);
-
- console.log('\n🌐 ACCESS POINTS:');
- console.log(' 📱 Admin Panel: http://localhost:3001/admin/blog');
- console.log(' 🔗 API Endpoint: http://localhost:3001/api/blog');
- console.log(' 📊 Categories API: http://localhost:3001/api/blog-categories');
- console.log(' 🏷️ Tags API: http://localhost:3001/api/blog-tags');
-
- console.log('\n✨ Blog system is now ready for use!');
- console.log('=' .repeat(60));
-
- const mongoose = require('mongoose');
- await mongoose.disconnect();
- process.exit(0);
- } catch (error) {
- console.error('❌ Migration error:', error);
- process.exit(1);
- }
-}
-
-// Chạy migration nếu được gọi trực tiếp
-if (require.main === module) {
- migrate();
-}
-
-module.exports = { migrate };
\ No newline at end of file
diff --git a/scripts/2026_02_03_645124_visa.js b/scripts/2026_02_03_645124_visa.js
deleted file mode 100644
index d3c031e..0000000
--- a/scripts/2026_02_03_645124_visa.js
+++ /dev/null
@@ -1,336 +0,0 @@
-// scripts/migrateVisa.js
-
-require("dotenv").config();
-const fs = require("fs").promises;
-const path = require("path");
-const mongoose = require("mongoose");
-const Visa = require("../models/visa");
-
-// 1. Đọc file JSON
-async function loadVisaData() {
- const filePath = path.join(__dirname, "..", "data", "visa.json");
- const raw = await fs.readFile(filePath, "utf8");
- return JSON.parse(raw);
-}
-
-// 2. Hàm Transform: Đổ dữ liệu từ JSON vào đúng Schema
-function transformVisa(sourceData) {
- // JSON có structure hero.title và hero.summaryList
- return {
- hero: {
- title: sourceData.hero?.title || "Visa",
- summaryList: Array.isArray(sourceData.hero?.summaryList)
- ? sourceData.hero.summaryList.map((country) =>
- transformCountry(country),
- )
- : [],
- },
- updatedAt: new Date(),
- };
-}
-
-// Helper function: Transform individual country
-function transformCountry(source) {
- return {
- id: source.id || 0,
- name: source.name || "",
- slug: source.slug || "",
- icon: source.icon || "",
- services: Array.isArray(source.services) ? source.services : [],
- detailedView: source.detailedView
- ? transformDetailedView(source.detailedView)
- : null,
- };
-}
-
-// Helper function: Transform DetailedView
-function transformDetailedView(source) {
- return {
- activeCountry: source.activeCountry
- ? transformActiveCountry(source.activeCountry)
- : null,
- relatedCountries: Array.isArray(source.relatedCountries)
- ? source.relatedCountries.map((country) => ({
- id: country.id || 0,
- name: country.name || "",
- icon: country.icon || "",
- }))
- : [],
- contactInfo: source.contactInfo
- ? transformContactInfo(source.contactInfo)
- : null,
- };
-}
-
-// Helper function: Transform ActiveCountry
-function transformActiveCountry(source) {
- return {
- id: source.id || 0,
- name: source.name || "",
- title: source.title || "",
- mainImage: source.mainImage || "",
- description: source.description || "",
- additionalInfo: source.additionalInfo || "",
- tagline: source.tagline || "",
- visaTypes: Array.isArray(source.visaTypes)
- ? source.visaTypes.map((type) => ({
- category: type.category || "",
- items: Array.isArray(type.items)
- ? type.items.map((item) => ({
- title: item.title || "",
- description: item.description || "",
- }))
- : [],
- }))
- : [],
- visaProcess: source.visaProcess
- ? transformVisaProcess(source.visaProcess)
- : null,
- gallery: Array.isArray(source.gallery) ? source.gallery : [],
- visaCategories: source.visaCategories
- ? transformVisaCategories(source.visaCategories)
- : null,
- visaService: source.visaService
- ? transformVisaService(source.visaService)
- : null,
- };
-}
-
-// Helper function: Transform VisaProcess
-function transformVisaProcess(source) {
- return {
- title: source.title || "",
- steps: Array.isArray(source.steps)
- ? source.steps.map((step) => ({
- number: step.number || "",
- title: step.title || "",
- description: step.description || "",
- }))
- : [],
- };
-}
-
-// Helper function: Transform VisaCategories
-function transformVisaCategories(source) {
- return {
- title: source.title || "",
- steps: Array.isArray(source.steps) ? source.steps : [],
- };
-}
-
-// Helper function: Transform VisaService
-function transformVisaService(source) {
- return {
- title: source.title || "",
- steps: Array.isArray(source.steps)
- ? source.steps.map((step) => ({
- number: step.number || "",
- title: step.title || "",
- description: step.description || "",
- }))
- : [],
- };
-}
-
-// Helper function: Transform ContactInfo
-function transformContactInfo(source) {
- return {
- img: source.img || "",
- sectionTitle: source.sectionTitle || "Visa & Immigration",
- helpText: source.helpText || "Need Help?",
- phone: {
- label: source.phone?.label || "Call Us",
- value: source.phone?.value || "",
- link: source.phone?.link || "",
- },
- email: {
- label: source.email?.label || "Mail Us",
- value: source.email?.value || "",
- link: source.email?.link || "",
- },
- location: {
- label: source.location?.label || "Location",
- address: source.location?.address || "",
- },
- };
-}
-
-// 3. Validate data before migration
-function validateVisaData(visaData) {
- const errors = [];
-
- if (!visaData.hero) {
- errors.push("Missing hero section");
- }
-
- if (!visaData.hero?.title) {
- console.warn("⚠️ Hero title is missing, using default 'Visa'");
- }
-
- if (!Array.isArray(visaData.hero?.summaryList)) {
- errors.push("summaryList must be an array");
- } else if (visaData.hero.summaryList.length === 0) {
- errors.push("summaryList is empty");
- } else {
- // Validate each country
- visaData.hero.summaryList.forEach((country, idx) => {
- if (!country.name || !country.slug) {
- errors.push(`Country at index ${idx}: missing name or slug`);
- }
-
- if (country.detailedView) {
- if (!country.detailedView.activeCountry) {
- console.warn(
- `⚠️ Country "${country.name}" (${idx}): missing activeCountry details`,
- );
- }
- if (!Array.isArray(country.detailedView.relatedCountries)) {
- errors.push(
- `Country "${country.name}" (${idx}): relatedCountries must be array`,
- );
- }
- }
- });
- }
-
- return errors;
-}
-
-// Helper function: Get data summary
-function getDataSummary(visaData) {
- const summary = {
- heroTitle: visaData.hero?.title || "N/A",
- totalCountries: visaData.hero?.summaryList?.length || 0,
- withDetails: 0,
- withoutDetails: 0,
- byCountry: [],
- };
-
- if (visaData.hero?.summaryList) {
- visaData.hero.summaryList.forEach((country) => {
- const hasDetails = !!country.detailedView?.activeCountry;
- const relatedCount = country.detailedView?.relatedCountries?.length || 0;
-
- if (hasDetails) {
- summary.withDetails++;
- } else {
- summary.withoutDetails++;
- }
-
- summary.byCountry.push({
- name: country.name,
- slug: country.slug,
- hasDetails,
- relatedCountries: relatedCount,
- services: country.services?.length || 0,
- });
- });
- }
-
- return summary;
-}
-
-// 4. Chạy Migration
-async function migrate() {
- try {
- // Kết nối DB
- console.log("🔗 Connecting to MongoDB...");
- await mongoose.connect(process.env.MONGODB_URI);
- console.log("✅ Connected to MongoDB\n");
-
- // A. Lấy dữ liệu thô
- console.log("📖 Loading visa data from JSON...");
- const rawData = await loadVisaData();
- console.log("✅ JSON data loaded\n");
-
- // B. Chuẩn hóa dữ liệu theo Schema
- console.log("🔄 Transforming data structure...");
- const visaData = transformVisa(rawData);
- console.log("✅ Data transformation completed\n");
-
- // C. Validate dữ liệu
- console.log("✔️ Validating data structure...");
- const errors = validateVisaData(visaData);
- if (errors.length > 0) {
- console.error("❌ Validation errors found:");
- errors.forEach((err, idx) => console.error(` ${idx + 1}. ${err}`));
- process.exit(1);
- }
- console.log("✅ Data validation passed\n");
-
- // D. Get summary
- const summary = getDataSummary(visaData);
-
- console.log("📊 Migration Summary:");
- console.log(` Hero Title: "${summary.heroTitle}"`);
- console.log(` Total countries: ${summary.totalCountries}`);
- console.log(` With details: ${summary.withDetails}`);
- console.log(` Without details: ${summary.withoutDetails}`);
- console.log(`\n Country Details:`);
-
- summary.byCountry.forEach((country) => {
- const detailBadge = country.hasDetails ? "✅" : "❌";
- const detailText = country.hasDetails
- ? `(${country.relatedCountries} related)`
- : "(basic only)";
- console.log(
- ` ${detailBadge} ${country.name.padEnd(20)} (${country.slug.padEnd(
- 12,
- )}) - ${country.services} services ${detailText}`,
- );
- });
- console.log("");
-
- // E. Lưu vào DB (Upsert: Có rồi thì update, chưa có thì tạo)
- const existingDoc = await Visa.findOne().sort({ updatedAt: -1 });
-
- if (existingDoc) {
- console.log("📝 Updating existing Visa document...");
- console.log(` Document ID: ${existingDoc._id}`);
-
- const updated = await Visa.findByIdAndUpdate(
- existingDoc._id,
- { $set: visaData },
- { new: true },
- );
-
- console.log("✅ Visa document updated successfully");
- console.log(` Updated at: ${updated.updatedAt}`);
- } else {
- console.log("📝 Creating NEW Visa document...");
-
- const newDoc = await Visa.create(visaData);
-
- console.log("✅ Visa document created successfully");
- console.log(` Document ID: ${newDoc._id}`);
- console.log(` Created at: ${newDoc.createdAt}`);
- }
-
- console.log("\n✨ Visa migration completed successfully!");
- } catch (error) {
- console.error("\n❌ Migration failed:");
- console.error(` Error: ${error.message}`);
-
- if (error.name === "ValidationError") {
- console.error("\n Validation Errors:");
- Object.keys(error.errors).forEach((field) => {
- console.error(` - ${field}: ${error.errors[field].message}`);
- });
- }
-
- if (error.stack) {
- console.error("\n📋 Stack trace:");
- console.error(error.stack);
- }
-
- process.exit(1);
- } finally {
- await mongoose.connection.close();
- console.log("\n🔌 MongoDB connection closed");
- process.exit(0);
- }
-}
-
-// Run migration
-console.log("🚀 Starting Visa Migration...\n");
-migrate();
diff --git a/scripts/2026_02_03_appointment.js b/scripts/2026_02_03_appointment.js
deleted file mode 100644
index edf5315..0000000
--- a/scripts/2026_02_03_appointment.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Migration script for Appointment data
- * Imports data from appointment.json to MongoDB
- *
- * Run: node scripts/2026_02_03_appointment.js
- */
-
-require("dotenv").config();
-const mongoose = require("mongoose");
-const fs = require("fs");
-const path = require("path");
-
-// Connect to MongoDB
-const connectDB = async () => {
- try {
- await mongoose.connect(process.env.MONGODB_URI);
- console.log("MongoDB connected successfully");
- } catch (error) {
- console.error("MongoDB connection error:", error);
- process.exit(1);
- }
-};
-
-const runMigration = async () => {
- try {
- await connectDB();
-
- // Load Appointment model
- const Appointment = require("../models/appointment");
-
- // Load JSON data
- const jsonPath = path.join(__dirname, "../data/appointment.json");
-
- if (!fs.existsSync(jsonPath)) {
- console.log("appointment.json not found, creating default data...");
- const defaultData = {
- hero: {
- title: "Make Appointment",
- backgroundImage: "",
- subtitle: "",
- heading: "",
- description: "",
- },
- visaOptions: [],
- form: {
- heading: "Request Appointment",
- fields: [],
- submitButton: {
- text: "Request Appointment",
- icon: "fa-solid fa-arrow-right",
- buttonClass: "theme-btn",
- },
- },
- };
- await Appointment.migrateFromJson(defaultData);
- } else {
- const jsonData = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
- console.log("Loaded appointment.json data");
- await Appointment.migrateFromJson(jsonData);
- }
-
- console.log("✅ Appointment migration completed successfully!");
- } catch (error) {
- console.error("❌ Migration failed:", error);
- } finally {
- await mongoose.connection.close();
- console.log("MongoDB connection closed");
- }
-};
-
-runMigration();
diff --git a/scripts/2026_02_05_120000_footer.js b/scripts/2026_02_05_120000_footer.js
deleted file mode 100644
index 5b8111b..0000000
--- a/scripts/2026_02_05_120000_footer.js
+++ /dev/null
@@ -1,68 +0,0 @@
-const mongoose = require("mongoose");
-const path = require("path");
-const fs = require("fs");
-
-// Import model
-const Footer = require("../models/footer");
-
-/**
- * Migration script để import dữ liệu footer từ JSON
- */
-async function up() {
- try {
- console.log("Starting footer migration...");
-
- // Đọc dữ liệu từ file JSON
- const jsonPath = path.join(__dirname, "../data/footer.json");
-
- if (!fs.existsSync(jsonPath)) {
- throw new Error("Footer JSON file not found");
- }
-
- const footerData = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
-
- // Sử dụng static method từ model để migrate
- const result = await Footer.migrateFromJson(footerData);
-
- console.log("Footer migration completed successfully");
- return result;
- } catch (error) {
- console.error("Footer migration failed:", error);
- throw error;
- }
-}
-
-/**
- * Rollback migration
- */
-async function down() {
- try {
- console.log("Rolling back footer migration...");
-
- // Xóa footer data
- await Footer.deleteMany({});
-
- console.log("Footer rollback completed");
- } catch (error) {
- console.error("Footer rollback failed:", error);
- throw error;
- }
-}
-
-module.exports = { up, down };
-
-// Chạy migration nếu file được gọi trực tiếp
-if (require.main === module) {
- const connectDB = require("../config/database");
-
- connectDB()
- .then(() => up())
- .then(() => {
- console.log("Migration completed successfully");
- process.exit(0);
- })
- .catch((error) => {
- console.error("Migration failed:", error);
- process.exit(1);
- });
-}
diff --git a/scripts/2026_02_05_130000_add_footer_menu_order.js b/scripts/2026_02_05_130000_add_footer_menu_order.js
deleted file mode 100644
index e2c2f2f..0000000
--- a/scripts/2026_02_05_130000_add_footer_menu_order.js
+++ /dev/null
@@ -1,90 +0,0 @@
-const mongoose = require("mongoose");
-const Footer = require("../models/footer");
-const footerData = require("../data/footer.json");
-
-async function addFooterMenuOrder() {
- try {
- console.log("=== Adding order field to Footer Menu Links ===");
-
- // Connect to database
- await mongoose.connect(process.env.MONGODB_URI || "mongodb://localhost:27017/hailearning");
- console.log("✓ Connected to MongoDB");
-
- // Get existing footer or create from JSON
- let footer = await Footer.findOne();
-
- if (!footer) {
- console.log("No existing footer found, creating from JSON data...");
-
- // Add order to bottom menu links
- if (footerData.bottom && footerData.bottom.menuLinks) {
- footerData.bottom.menuLinks = footerData.bottom.menuLinks.map((link, index) => ({
- ...link,
- order: index + 1,
- }));
- }
-
- // Add order to top menu links
- if (footerData.top && footerData.top.menuLinks) {
- footerData.top.menuLinks = footerData.top.menuLinks.map((link, index) => ({
- ...link,
- order: index + 1,
- }));
- }
-
- footer = await Footer.create(footerData);
- console.log("✓ Footer created with order fields");
- } else {
- console.log("Found existing footer, adding order fields...");
-
- // Add order to bottom menu links
- if (footer.bottom && footer.bottom.menuLinks) {
- footer.bottom.menuLinks = footer.bottom.menuLinks.map((link, index) => ({
- label: link.label,
- href: link.href,
- order: link.order || index + 1,
- }));
- }
-
- // Add order to top menu links
- if (footer.top && footer.top.menuLinks) {
- footer.top.menuLinks = footer.top.menuLinks.map((link, index) => ({
- label: link.label,
- href: link.href,
- order: link.order || index + 1,
- }));
- }
-
- await footer.save();
- console.log("✓ Footer updated with order fields");
- }
-
- console.log("Bottom Menu Links with order:");
- footer.bottom.menuLinks.forEach((link, index) => {
- console.log(` ${index + 1}. ${link.label} (order: ${link.order}) -> ${link.href}`);
- });
-
- console.log("=== Footer Menu Order Migration Completed ===");
- } catch (error) {
- console.error("✗ Migration failed:", error);
- throw error;
- } finally {
- await mongoose.disconnect();
- console.log("✓ Disconnected from MongoDB");
- }
-}
-
-// Run migration if called directly
-if (require.main === module) {
- addFooterMenuOrder()
- .then(() => {
- console.log("Migration completed successfully");
- process.exit(0);
- })
- .catch((error) => {
- console.error("Migration failed:", error);
- process.exit(1);
- });
-}
-
-module.exports = addFooterMenuOrder;
diff --git a/scripts/2026_02_05_190000_home.js b/scripts/2026_02_05_190000_home.js
deleted file mode 100644
index b8f4dae..0000000
--- a/scripts/2026_02_05_190000_home.js
+++ /dev/null
@@ -1,47 +0,0 @@
-require("dotenv").config();
-const fs = require("fs").promises;
-const path = require("path");
-const connectDB = require("../config/database");
-
-/**
- * Migration: import_home_content
- * Created: 19:00:00 2026-02-05
- * Description:
- * Import nội dung trang Home từ file JSON (Next.js) vào MongoDB (model Home).
- * Nguồn dữ liệu: hailearning.edu.vn/app/home.json
- */
-async function migrate() {
- try {
- // 1) Connect DB
- await connectDB();
- console.log("🚀 Starting migration: import_home_content...");
-
- // 2) Load model
- const Home = require("../models/home");
- console.log("✅ Home model registered successfully");
-
- // 3) Load JSON data
- const dataPath = path.join(__dirname, "..", "..", "hailearning.edu.vn", "app", "home.json");
- const raw = await fs.readFile(dataPath, "utf8");
- const homeData = JSON.parse(raw);
- console.log("📖 Home data loaded from:", dataPath);
-
- // 4) Clear existing
- console.log("🧹 Clearing existing Home data...");
- await Home.deleteMany({});
- console.log("✅ Existing Home documents cleared");
-
- // 5) Insert new document
- const created = await Home.create(homeData);
- console.log("✅ Home document created with _id:", created._id.toString());
-
- console.log("🎉 Migration import_home_content completed successfully.");
- process.exit(0);
- } catch (err) {
- console.error("❌ Migration failed:", err);
- process.exit(1);
- }
-}
-
-migrate();
-
diff --git a/scripts/2026_02_07_migrate_about_news_to_blog.js b/scripts/2026_02_07_migrate_about_news_to_blog.js
deleted file mode 100644
index 7cce458..0000000
--- a/scripts/2026_02_07_migrate_about_news_to_blog.js
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Migration: Convert About News static items to dynamic Blog selection
- * Date: 2026-02-07
- *
- * This migration:
- * 1. Adds selectedBlogIds field to About news section
- * 2. Keeps existing items for backward compatibility
- * 3. Does NOT delete old data (safe migration)
- */
-
-const mongoose = require("mongoose");
-require("dotenv").config();
-
-const MONGODB_URI = process.env.MONGODB_URI || "mongodb://localhost:27017/SIMS";
-
-async function up() {
- try {
- await mongoose.connect(MONGODB_URI);
- console.log("✓ Connected to MongoDB");
-
- const AboutUs = mongoose.model("AboutUs", new mongoose.Schema({}, { strict: false }));
-
- const doc = await AboutUs.findOne();
-
- if (!doc) {
- console.log("⚠ No About Us document found. Skipping migration.");
- return;
- }
-
- // Check if already migrated
- if (doc.news && doc.news.selectedBlogIds !== undefined) {
- console.log("✓ Migration already applied. Skipping.");
- return;
- }
-
- // Add selectedBlogIds field (empty array by default)
- if (!doc.news) {
- doc.news = {};
- }
-
- doc.news.selectedBlogIds = [];
-
- // Keep existing items for backward compatibility
- // Admin can manually select blogs after migration
-
- await doc.save();
-
- console.log("✓ Migration completed successfully");
- console.log(" - Added selectedBlogIds field to About news section");
- console.log(" - Existing items preserved for backward compatibility");
- console.log(" - Admin can now select blogs from Blog Management");
- } catch (error) {
- console.error("✗ Migration failed:", error);
- throw error;
- }
-}
-
-async function down() {
- try {
- await mongoose.connect(MONGODB_URI);
- console.log("✓ Connected to MongoDB");
-
- const AboutUs = mongoose.model("AboutUs", new mongoose.Schema({}, { strict: false }));
-
- const doc = await AboutUs.findOne();
-
- if (!doc || !doc.news) {
- console.log("⚠ No About Us document found. Skipping rollback.");
- return;
- }
-
- // Remove selectedBlogIds field
- if (doc.news.selectedBlogIds !== undefined) {
- delete doc.news.selectedBlogIds;
- await doc.save();
- console.log("✓ Rollback completed - selectedBlogIds removed");
- } else {
- console.log("✓ Nothing to rollback");
- }
- } catch (error) {
- console.error("✗ Rollback failed:", error);
- throw error;
- }
-}
-
-// Run migration
-if (require.main === module) {
- up()
- .then(() => {
- console.log("\n✓ Migration script completed");
- process.exit(0);
- })
- .catch((error) => {
- console.error("\n✗ Migration script failed:", error);
- process.exit(1);
- });
-}
-
-module.exports = { up, down };
diff --git a/scripts/create-audit-log.js b/scripts/create-audit-log.js
deleted file mode 100644
index 75caf72..0000000
--- a/scripts/create-audit-log.js
+++ /dev/null
@@ -1,29 +0,0 @@
-require("dotenv").config();
-const mongoose = require("mongoose");
-
-async function run() {
- try {
- await mongoose.connect(process.env.MONGODB_URI);
-
- console.log("Connected DB");
-
- const collections = await mongoose.connection.db
- .listCollections({ name: "auditlogs" })
- .toArray();
-
- if (collections.length > 0) {
- console.log("AuditLog collection already exists");
- process.exit(0);
- }
-
- await mongoose.connection.createCollection("auditlogs");
- console.log("AuditLog collection created");
-
- process.exit(0);
- } catch (err) {
- console.error(err);
- process.exit(1);
- }
-}
-
-run();
diff --git a/scripts/make-migration.js b/scripts/make-migration.js
deleted file mode 100644
index b4eda88..0000000
--- a/scripts/make-migration.js
+++ /dev/null
@@ -1,86 +0,0 @@
-const fs = require('fs');
-const path = require('path');
-
-/**
- * Tạo migration file mới với format giống Laravel
- * Format: YYYY_MM_DD_HHMMSS_migration_name.js
- */
-function makeMigration(migrationName) {
- if (!migrationName) {
- console.error('Error: Migration name is required');
- console.log('\nUsage: node scripts/make-migration.js ');
- console.log('Example: node scripts/make-migration.js create_users_table');
- process.exit(1);
- }
-
- // Tạo timestamp theo format Laravel: YYYY_MM_DD_HHMMSS
- const now = new Date();
- const year = now.getFullYear();
- const month = String(now.getMonth() + 1).padStart(2, '0');
- const day = String(now.getDate()).padStart(2, '0');
- const hours = String(now.getHours()).padStart(2, '0');
- const minutes = String(now.getMinutes()).padStart(2, '0');
- const seconds = String(now.getSeconds()).padStart(2, '0');
-
- const timestamp = `${year}_${month}_${day}_${hours}${minutes}${seconds}`;
- const fileName = `${timestamp}_${migrationName}.js`;
- const filePath = path.join(__dirname, fileName);
-
- // Template migration mẫu
- const template = `require('dotenv').config();
-const connectDB = require('../config/database');
-
-/**
- * Migration: ${migrationName}
- * Created: ${now.toLocaleString('vi-VN')}
- */
-async function migrate() {
- try {
- // Kết nối database
- await connectDB();
- console.log('Starting migration: ${migrationName}...');
-
- // TODO: Thêm code migration của bạn ở đây
-
- console.log('Migration ${migrationName} completed successfully!');
-
- const mongoose = require('mongoose');
- await mongoose.disconnect();
- process.exit(0);
- } catch (error) {
- console.error('Migration error:', error);
- process.exit(1);
- }
-}
-
-// Chạy migration nếu được gọi trực tiếp
-if (require.main === module) {
- migrate();
-}
-
-module.exports = { migrate };
-`;
-
- // Kiểm tra file đã tồn tại chưa
- if (fs.existsSync(filePath)) {
- console.error(`Error: Migration file already exists: ${fileName}`);
- process.exit(1);
- }
-
- // Tạo file migration
- try {
- fs.writeFileSync(filePath, template, 'utf8');
- console.log(`Migration created successfully: ${fileName}`);
- console.log(`Path: ${filePath}`);
- } catch (error) {
- console.error('Error creating migration file:', error.message);
- process.exit(1);
- }
-}
-
-// Lấy migration name từ command line arguments
-const migrationName = process.argv[2];
-
-// Chạy hàm tạo migration
-makeMigration(migrationName);
-
diff --git a/scripts/migrate-all.js b/scripts/migrate-all.js
deleted file mode 100644
index 3f97890..0000000
--- a/scripts/migrate-all.js
+++ /dev/null
@@ -1,204 +0,0 @@
-require("dotenv").config();
-const path = require("path");
-const fs = require("fs");
-const {execSync} = require("child_process");
-const connectDB = require("../config/database");
-const migrationHelper = require("../utils/migrationHelper");
-
-/**
- * Tự động phát hiện tất cả các file script trong thư mục scripts
- * Loại trừ các file quản lý migration và file không phải .js
- */
-function discoverMigrations() {
- const scriptsDir = __dirname;
- const files = fs.readdirSync(scriptsDir);
-
- // Danh sách các file quản lý migration cần loại trừ
- const excludeFiles = [
- "migrate-all.js",
- "migrate-status.js",
- "migrate-rollback.js",
- "migrate-fresh.js",
- "make-migration.js",
- ];
-
- const migrations = files
- .filter((file) => {
- // Lấy tất cả file .js, trừ các file quản lý
- return file.endsWith(".js") && !excludeFiles.includes(file);
- })
- .map((file) => {
- // Tạo tên migration từ tên file (bỏ .js)
- const name = file.replace(".js", "");
- return {
- name: name,
- script: file,
- };
- })
- .sort((a, b) => {
- // Sắp xếp theo tên để đảm bảo thứ tự nhất quán
- return a.name.localeCompare(b.name);
- });
-
- return migrations;
-}
-
-// Tự động phát hiện migrations
-const migrations = discoverMigrations();
-
-/**
- * Chạy migration script (suppress output)
- * Sử dụng child_process để chạy script độc lập vì các script tự quản lý DB connection
- * Output từ script sẽ bị suppress để chỉ hiển thị status
- */
-async function runMigrationScript(migration) {
- return new Promise((resolve, reject) => {
- try {
- // Chạy script bằng child_process với stdio: 'pipe' để suppress output
- // Nhưng vẫn capture stderr để có thể hiển thị lỗi nếu cần
- const result = execSync(`node scripts/${migration.script}`, {
- stdio: ["ignore", "pipe", "pipe"], // stdin: ignore, stdout: pipe, stderr: pipe
- cwd: path.join(__dirname, ".."),
- encoding: "utf8",
- });
- resolve();
- } catch (error) {
- // Attach stderr vào error để có thể hiển thị sau
- if (error.stderr) {
- error.stderr = error.stderr;
- }
- reject(error);
- }
- });
-}
-
-/**
- * Hàm chính để chạy tất cả migrations với tracking
- */
-async function runAllMigrations() {
- const mongoose = require("mongoose");
- let ownConn = false;
-
- try {
- const wasConnected = mongoose.connection.readyState === 1;
- await connectDB();
- if (!wasConnected) ownConn = true;
-
- const batch = (await migrationHelper.getLastBatch()) + 1;
- const results = [];
-
- // Kiểm tra và chạy từng migration
- for (let i = 0; i < migrations.length; i++) {
- const migration = migrations[i];
-
- try {
- // Kiểm tra xem migration đã chạy chưa
- const hasRun = await migrationHelper.hasRun(migration.name);
-
- if (hasRun) {
- results.push({name: migration.name, status: "SKIPPED"});
- continue;
- }
-
- // Chạy migration script (output bị suppress)
- await runMigrationScript(migration);
-
- if (mongoose.connection.readyState !== 1) {
- await connectDB();
- }
- await migrationHelper.markAsRun(migration.name, batch);
-
- results.push({name: migration.name, status: "DONE"});
- } catch (error) {
- results.push({
- name: migration.name,
- status: "FAIL",
- error: error.message,
- });
- // Hiển thị bảng kết quả trước khi exit
- displayResults(results);
- console.error(
- `\n❌ Migration "${migration.name}" failed: ${error.message}`
- );
- if (error.stderr) {
- console.error(error.stderr.toString());
- }
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(1);
- }
- }
-
- // Hiển thị bảng kết quả
- displayResults(results);
-
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
-
- process.exit(0);
- } catch (error) {
- console.error("\n❌ Error:", error.message);
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(1);
- }
-}
-
-/**
- * Hiển thị bảng kết quả migration đơn giản
- */
-function displayResults(results) {
- console.log("\nRunning migrations...\n");
-
- // Tìm độ dài tên migration dài nhất để format bảng
- const maxNameLength = Math.max(...results.map((r) => r.name.length), 20);
- const statusWidth = 10;
- const totalWidth = maxNameLength + statusWidth + 7; // 7 = spaces and separators
-
- // Header
- console.log("=".repeat(totalWidth));
- console.log(
- `${"Migration".padEnd(maxNameLength)} | ${"Status".padEnd(statusWidth)}`
- );
- console.log("=".repeat(totalWidth));
-
- // Rows
- results.forEach((result) => {
- let statusText = "";
- if (result.status === "DONE") {
- statusText = "DONE".padEnd(statusWidth);
- } else if (result.status === "SKIPPED") {
- statusText = "SKIPPED".padEnd(statusWidth);
- } else if (result.status === "FAIL") {
- statusText = "FAIL".padEnd(statusWidth);
- }
-
- console.log(`${result.name.padEnd(maxNameLength)} | ${statusText}`);
- });
-
- // Footer
- console.log("=".repeat(totalWidth));
-
- // Summary
- const doneCount = results.filter((r) => r.status === "DONE").length;
- const skippedCount = results.filter((r) => r.status === "SKIPPED").length;
- const failCount = results.filter((r) => r.status === "FAIL").length;
-
- console.log("");
- if (doneCount > 0) {
- console.log(`${doneCount} migration(s) completed`);
- }
- if (skippedCount > 0) {
- console.log(`${skippedCount} migration(s) skipped`);
- }
- if (failCount > 0) {
- console.log(`${failCount} migration(s) failed`);
- }
- console.log("");
-}
-
-// Chạy hàm chính
-runAllMigrations();
diff --git a/scripts/migrate-fresh.js b/scripts/migrate-fresh.js
deleted file mode 100644
index 23e4dbb..0000000
--- a/scripts/migrate-fresh.js
+++ /dev/null
@@ -1,189 +0,0 @@
-require('dotenv').config();
-const path = require("path");
-const fs = require("fs");
-const { execSync } = require("child_process");
-const connectDB = require("../config/database");
-const migrationHelper = require("../utils/migrationHelper");
-
-/**
- * Tự động phát hiện tất cả các file script trong thư mục scripts
- * Loại trừ các file quản lý migration và file không phải .js
- */
-function discoverMigrations() {
- const scriptsDir = __dirname;
- const files = fs.readdirSync(scriptsDir);
-
- // Danh sách các file quản lý migration cần loại trừ
- const excludeFiles = [
- 'migrate-all.js',
- 'migrate-status.js',
- 'migrate-rollback.js',
- 'migrate-fresh.js',
- 'make-migration.js',
- 'MIGRATION_README.md'
- ];
-
- const migrations = files
- .filter(file => {
- // Lấy tất cả file .js, trừ các file quản lý
- return file.endsWith('.js') && !excludeFiles.includes(file);
- })
- .map(file => {
- // Tạo tên migration từ tên file (bỏ .js)
- const name = file.replace('.js', '');
- return {
- name: name,
- script: file
- };
- })
- .sort((a, b) => {
- // Sắp xếp theo tên để đảm bảo thứ tự nhất quán
- return a.name.localeCompare(b.name);
- });
-
- return migrations;
-}
-
-/**
- * Chạy migration script (suppress output)
- * Sử dụng child_process để chạy script độc lập vì các script tự quản lý DB connection
- * Output từ script sẽ bị suppress để chỉ hiển thị status
- */
-async function runMigrationScript(migration) {
- return new Promise((resolve, reject) => {
- try {
- // Chạy script bằng child_process với stdio: 'pipe' để suppress output
- // Nhưng vẫn capture stderr để có thể hiển thị lỗi nếu cần
- const result = execSync(`node scripts/${migration.script}`, {
- stdio: ['ignore', 'pipe', 'pipe'], // stdin: ignore, stdout: pipe, stderr: pipe
- cwd: path.join(__dirname, ".."),
- encoding: 'utf8'
- });
- resolve();
- } catch (error) {
- // Attach stderr vào error để có thể hiển thị sau
- if (error.stderr) {
- error.stderr = error.stderr;
- }
- reject(error);
- }
- });
-}
-
-/**
- * Hiển thị bảng kết quả migration đơn giản
- */
-function displayResults(results) {
- console.log("\nRunning migrations...\n");
-
- // Tìm độ dài tên migration dài nhất để format bảng
- const maxNameLength = Math.max(...results.map(r => r.name.length), 20);
- const statusWidth = 10;
- const totalWidth = maxNameLength + statusWidth + 7; // 7 = spaces and separators
-
- // Header
- console.log("=".repeat(totalWidth));
- console.log(`${'Migration'.padEnd(maxNameLength)} | ${'Status'.padEnd(statusWidth)}`);
- console.log("=".repeat(totalWidth));
-
- // Rows
- results.forEach(result => {
- let statusText = "";
- if (result.status === 'DONE') {
- statusText = "DONE".padEnd(statusWidth);
- } else if (result.status === 'FAIL') {
- statusText = "FAIL".padEnd(statusWidth);
- }
-
- console.log(`${result.name.padEnd(maxNameLength)} | ${statusText}`);
- });
-
- // Footer
- console.log("=".repeat(totalWidth));
-
- // Summary
- const doneCount = results.filter(r => r.status === 'DONE').length;
- const failCount = results.filter(r => r.status === 'FAIL').length;
-
- console.log("");
- if (doneCount > 0) {
- console.log(`${doneCount} migration(s) completed`);
- }
- if (failCount > 0) {
- console.log(`${failCount} migration(s) failed`);
- }
- console.log("");
-}
-
-/**
- * Hàm chính để chạy lại tất cả migrations từ đầu (fresh)
- * Xóa tất cả tracking và chạy lại từ đầu
- */
-async function runFreshMigrations() {
- const mongoose = require('mongoose');
- let ownConn = false;
-
- try {
- const wasConnected = mongoose.connection.readyState === 1;
- await connectDB();
- if (!wasConnected) ownConn = true;
-
- // Tự động phát hiện migrations
- const migrations = discoverMigrations();
-
- // Xóa tất cả tracking migrations
- const Migration = require('../models/migration');
- await Migration.deleteMany({});
-
- const batch = 1; // Batch mới bắt đầu từ 1
- const results = [];
-
- // Chạy từng migration
- for (let i = 0; i < migrations.length; i++) {
- const migration = migrations[i];
-
- try {
- // Chạy migration script (output bị suppress)
- await runMigrationScript(migration);
-
- if (mongoose.connection.readyState !== 1) {
- await connectDB();
- }
- await migrationHelper.markAsRun(migration.name, batch);
-
- results.push({ name: migration.name, status: 'DONE' });
- } catch (error) {
- results.push({ name: migration.name, status: 'FAIL', error: error.message });
- // Hiển thị bảng kết quả trước khi exit
- displayResults(results);
- console.error(`\n❌ Migration "${migration.name}" failed: ${error.message}`);
- if (error.stderr) {
- console.error(error.stderr.toString());
- }
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(1);
- }
- }
-
- // Hiển thị bảng kết quả
- displayResults(results);
-
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
-
- process.exit(0);
- } catch (error) {
- console.error("\n❌ Error:", error.message);
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(1);
- }
-}
-
-// Chạy hàm chính
-runFreshMigrations();
-
diff --git a/scripts/migrate-header-menu.js b/scripts/migrate-header-menu.js
deleted file mode 100644
index cc5b2e2..0000000
--- a/scripts/migrate-header-menu.js
+++ /dev/null
@@ -1,69 +0,0 @@
-const mongoose = require('mongoose');
-const fs = require('fs');
-const path = require('path');
-const dotenv = require('dotenv');
-const HeaderMenu = require('../models/headerMenu');
-
-dotenv.config();
-
-const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/SIMS';
-
-async function connectDB() {
- try {
- await mongoose.connect(MONGODB_URI);
- console.log('✅ MongoDB Connected for Migration');
- } catch (err) {
- console.error('❌ MongoDB Connection Error:', err);
- process.exit(1);
- }
-}
-
-const processMenuItems = async (items, parentId = null) => {
- for (const item of items) {
- console.log(` > Importing: ${item.label}`);
-
- const menuDoc = {
- title: item.label,
- slug: item.slug,
- url: item.href,
- parentId: parentId,
- order: item.order || 0,
- status: item.isActive === false ? "inactive" : "active",
- type: item.type === "external" ? "external" : "internal"
- };
-
- const createdItem = await HeaderMenu.create(menuDoc);
-
- if (item.children && item.children.length > 0) {
- await processMenuItems(item.children, createdItem._id);
- }
- }
-};
-
-async function migrate() {
- await connectDB();
-
- try {
- console.log('--- Starting Header Menu Migration ---');
-
- // 1. Clear existing menu items
- await HeaderMenu.deleteMany({});
- console.log('🗑️ Cleared existing HeaderMenu collection');
-
- // 2. Read JSON data
- const dataPath = path.join(__dirname, '../data/header-menu.json');
- const fileData = fs.readFileSync(dataPath, 'utf8');
- const menuItems = JSON.parse(fileData);
-
- // 3. Recursive import
- await processMenuItems(menuItems);
-
- console.log('--- Migration Completed Successfully ---');
- process.exit(0);
- } catch (error) {
- console.error('❌ Migration Failed:', error);
- process.exit(1);
- }
-}
-
-migrate();
diff --git a/scripts/migrate-header.js b/scripts/migrate-header.js
deleted file mode 100644
index 8a9c06b..0000000
--- a/scripts/migrate-header.js
+++ /dev/null
@@ -1,73 +0,0 @@
-const mongoose = require("mongoose");
-const path = require("path");
-require("dotenv").config({ path: path.join(__dirname, "../.env") });
-
-const Header = require("../models/header");
-const headerData = require("../data/header.json");
-
-const migrateHeader = async () => {
- try {
- const mongoUri = process.env.MONGODB_URI;
- if (!mongoUri) {
- throw new Error("MONGODB_URI not found in environment variables");
- }
- await mongoose.connect(mongoUri);
- console.log("Connected to MongoDB");
-
- // Delete existing header
- await Header.deleteMany({});
- console.log("Cleared existing headers");
-
- // Transform and insert data
- const headerDocument = {
- top: {
- phone: headerData.top?.phone || "",
- email: headerData.top?.email || "",
- location: headerData.top?.location || "",
- socialLinks: (headerData.top?.socialLinks || []).map((link, idx) => ({
- ...link,
- order: idx,
- })),
- languages: headerData.top?.languages || [],
- },
- offcanvas: headerData.offcanvas || {},
- menu: (headerData.menu || []).map((item, idx) => ({
- ...item,
- order: idx,
- children:
- item.children?.map((child, childIdx) => ({
- ...child,
- order: childIdx,
- children:
- child.children?.map((subchild, subIdx) => ({
- ...subchild,
- order: subIdx,
- })) || [],
- })) || [],
- })),
- logo: {
- light: "/assets/img/logo/white-logo.svg",
- dark: "/assets/img/logo/black-logo.svg",
- alt: "Hai Learning",
- },
- ctaButton: {
- label: "Get Started",
- href: "/contact",
- style: "primary",
- },
- status: "active",
- order: 1,
- };
-
- const result = await Header.create(headerDocument);
- console.log("Header migrated successfully:", result._id);
-
- await mongoose.connection.close();
- process.exit(0);
- } catch (error) {
- console.error("Migration error:", error);
- process.exit(1);
- }
-};
-
-migrateHeader();
diff --git a/scripts/migrate-rollback.js b/scripts/migrate-rollback.js
deleted file mode 100644
index 32d6888..0000000
--- a/scripts/migrate-rollback.js
+++ /dev/null
@@ -1,111 +0,0 @@
-require('dotenv').config();
-const connectDB = require('../config/database');
-const migrationHelper = require('../utils/migrationHelper');
-
-/**
- * Rollback một migration cụ thể
- */
-async function rollbackMigration(migrationName) {
- const mongoose = require('mongoose');
- let ownConn = false;
-
- try {
- const wasConnected = mongoose.connection.readyState === 1;
- await connectDB();
- if (!wasConnected) ownConn = true;
-
- const hasRun = await migrationHelper.hasRun(migrationName);
- if (!hasRun) {
- console.log(`⚠️ Migration "${migrationName}" chưa được chạy, không thể rollback.`);
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(0);
- }
-
- const result = await migrationHelper.rollback(migrationName);
- if (result) {
- console.log(`✅ Đã rollback migration: ${migrationName}`);
- } else {
- console.log(`❌ Không thể rollback migration: ${migrationName}`);
- }
-
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- } catch (error) {
- console.error('❌ Lỗi:', error.message);
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(1);
- }
-}
-
-/**
- * Rollback batch cuối cùng
- */
-async function rollbackLastBatch() {
- const mongoose = require('mongoose');
- let ownConn = false;
-
- try {
- const wasConnected = mongoose.connection.readyState === 1;
- await connectDB();
- if (!wasConnected) ownConn = true;
-
- const lastBatch = await migrationHelper.getLastBatch();
- if (lastBatch === 0) {
- console.log('⚠️ Không có batch nào để rollback.');
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(0);
- }
-
- const migrations = await migrationHelper.getMigrationsByBatch(lastBatch);
- if (migrations.length === 0) {
- console.log(`⚠️ Batch ${lastBatch} không có migration nào.`);
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(0);
- }
-
- console.log(`\n🔄 Đang rollback batch ${lastBatch}...`);
- console.log(`📋 Các migration sẽ được rollback:`);
- migrations.forEach(m => {
- console.log(` - ${m.name}`);
- });
-
- const deletedCount = await migrationHelper.rollbackBatch(lastBatch);
- console.log(`\n✅ Đã rollback ${deletedCount} migration(s) trong batch ${lastBatch}`);
-
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- } catch (error) {
- console.error('❌ Lỗi:', error.message);
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(1);
- }
-}
-
-// Xử lý command line arguments
-const args = process.argv.slice(2);
-
-if (args.length === 0) {
- console.log('Usage:');
- console.log(' node scripts/migrate-rollback.js - Rollback một migration cụ thể');
- console.log(' node scripts/migrate-rollback.js --batch - Rollback batch cuối cùng');
- process.exit(0);
-}
-
-if (args[0] === '--batch') {
- rollbackLastBatch();
-} else {
- rollbackMigration(args[0]);
-}
-
diff --git a/scripts/migrate-status.js b/scripts/migrate-status.js
deleted file mode 100644
index e53dc22..0000000
--- a/scripts/migrate-status.js
+++ /dev/null
@@ -1,120 +0,0 @@
-require('dotenv').config();
-const connectDB = require('../config/database');
-const migrationHelper = require('../utils/migrationHelper');
-const path = require('path');
-const fs = require('fs');
-
-/**
- * Tự động phát hiện tất cả các file script trong thư mục scripts
- * Loại trừ các file quản lý migration và file không phải .js
- */
-function discoverMigrations() {
- const scriptsDir = __dirname;
- const files = fs.readdirSync(scriptsDir);
-
- // Danh sách các file quản lý migration cần loại trừ
- const excludeFiles = [
- 'migrate-all.js',
- 'migrate-status.js',
- 'migrate-rollback.js',
- 'migrate-fresh.js',
- 'make-migration.js',
- 'MIGRATION_README.md'
- ];
-
- const migrations = files
- .filter(file => {
- // Lấy tất cả file .js, trừ các file quản lý
- return file.endsWith('.js') && !excludeFiles.includes(file);
- })
- .map(file => file.replace('.js', ''))
- .sort();
-
- return migrations;
-}
-
-// Tự động phát hiện migrations
-const availableMigrations = discoverMigrations();
-
-/**
- * Hiển thị trạng thái của tất cả migrations
- */
-async function showStatus() {
- const mongoose = require('mongoose');
- let ownConn = false;
-
- try {
- const wasConnected = mongoose.connection.readyState === 1;
- await connectDB();
- if (!wasConnected) ownConn = true;
-
- console.log('\nMigration Status:\n');
-
- const ranMigrations = await migrationHelper.getRanMigrations();
- const ranMap = new Map();
- ranMigrations.forEach(m => ranMap.set(m.name, m));
-
- // Tính toán độ rộng cột
- const maxNameLength = Math.max(...availableMigrations.map(name => name.length), 20);
- const statusWidth = 10;
- const batchWidth = 6;
- const ranAtWidth = 20;
- const totalWidth = maxNameLength + statusWidth + batchWidth + ranAtWidth + 11; // 11 = spaces and separators
-
- // Header
- console.log('='.repeat(totalWidth));
- console.log(
- `${'Migration Name'.padEnd(maxNameLength)} | ${'Status'.padEnd(statusWidth)} | ${'Batch'.padEnd(batchWidth)} | Ran At`
- );
- console.log('='.repeat(totalWidth));
-
- let pendingCount = 0;
- let ranCount = 0;
-
- for (const migrationName of availableMigrations) {
- const migration = ranMap.get(migrationName);
- if (migration) {
- const ranAt = new Date(migration.ranAt).toLocaleString('vi-VN');
- console.log(
- `${migrationName.padEnd(maxNameLength)} | ${'Ran'.padEnd(statusWidth)} | ${String(migration.batch).padEnd(batchWidth)} | ${ranAt}`
- );
- ranCount++;
- } else {
- console.log(
- `${migrationName.padEnd(maxNameLength)} | ${'Pending'.padEnd(statusWidth)} | ${'-'.padEnd(batchWidth)} | -`
- );
- pendingCount++;
- }
- }
-
- console.log('='.repeat(totalWidth));
- console.log(`\nSummary:`);
- console.log(` Ran: ${ranCount} migration(s)`);
- console.log(` Pending: ${pendingCount} migration(s)`);
-
- const lastBatch = await migrationHelper.getLastBatch();
- if (lastBatch > 0) {
- console.log(` Last batch: ${lastBatch}`);
- }
-
- console.log('');
-
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- } catch (error) {
- console.error('Error:', error.message);
- if (ownConn && mongoose.connection.readyState === 1) {
- await mongoose.disconnect();
- }
- process.exit(1);
- }
-}
-
-// Chạy nếu được gọi trực tiếp
-if (require.main === module) {
- showStatus();
-}
-
-module.exports = { showStatus };
-
diff --git a/scripts/migrateAboutUs.js b/scripts/migrateAboutUs.js
deleted file mode 100644
index 29b705d..0000000
--- a/scripts/migrateAboutUs.js
+++ /dev/null
@@ -1,48 +0,0 @@
-const mongoose = require("mongoose");
-const dotenv = require("dotenv");
-const fs = require("fs");
-const path = require("path");
-
-// Load environment variables
-dotenv.config();
-
-const AboutUs = require("../models/aboutUs");
-
-const migrate = async () => {
- try {
- console.log("🚀 Starting About Us migration...");
-
- // 1. Connect to MongoDB
- await mongoose.connect(process.env.MONGODB_URI);
- console.log("✅ MongoDB Connected");
-
- // 2. Read about.json from Backend (Source of Truth)
- const jsonPath = path.join(__dirname, "../data/about.json");
- if (!fs.existsSync(jsonPath)) {
- throw new Error(`Source about.json not found at: ${jsonPath}`);
- }
-
- const rawData = fs.readFileSync(jsonPath, "utf8");
- const jsonData = JSON.parse(rawData);
- console.log("✅ Read about.json successfully");
-
- // 3. Delete existing AboutUs documents (Singleton pattern)
- await AboutUs.deleteMany({});
- console.log("✅ Cleared existing AboutUs collection");
-
- // 4. Create new AboutUs document with JSON data
- const newAboutUs = new AboutUs(jsonData);
- await newAboutUs.save();
- console.log("✅ Successfully migrated about.json data to MongoDB");
-
- } catch (error) {
- console.error("❌ Migration failed:", error.message);
- } finally {
- // 5. Close connection
- await mongoose.connection.close();
- console.log("👋 Database connection closed");
- process.exit(0);
- }
-};
-
-migrate();
diff --git a/scripts/seedAbout.js b/scripts/seedAbout.js
deleted file mode 100644
index 3e60620..0000000
--- a/scripts/seedAbout.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const mongoose = require("mongoose");
-const dotenv = require("dotenv");
-const fs = require("fs");
-const path = require("path");
-
-// Load environment variables
-dotenv.config();
-
-const AboutUs = require("../models/aboutUs");
-
-const seedAbout = async () => {
- try {
- console.log("🚀 Starting About section seeding...");
-
- // 1. Connect to MongoDB
- if (!process.env.MONGODB_URI) {
- throw new Error("MONGODB_URI is not defined in environment variables");
- }
- await mongoose.connect(process.env.MONGODB_URI);
- console.log("✅ MongoDB Connected");
-
- // 2. Read about.json (Single Source of Truth)
- const jsonPath = path.join(__dirname, "../data/about.json");
- if (!fs.existsSync(jsonPath)) {
- throw new Error(`Source about.json not found at: ${jsonPath}`);
- }
-
- const rawData = fs.readFileSync(jsonPath, "utf8");
- const jsonData = JSON.parse(rawData);
- console.log("✅ Read data/about.json successfully");
-
- // 3. Upsert logic (Singleton pattern)
- // We look for any existing document and update it, or create a new one if none exists.
- await AboutUs.findOneAndUpdate(
- {},
- jsonData,
- { upsert: true, new: true, setDefaultsOnInsert: true }
- );
-
- console.log("✅ Successfully seeded about.json data to MongoDB (Upserted)");
-
- } catch (error) {
- console.error("❌ Seeding failed:", error.message);
- } finally {
- // 4. Close connection
- await mongoose.connection.close();
- console.log("👋 Database connection closed");
- process.exit(0);
- }
-};
-
-seedAbout();
diff --git a/scripts/update-header-data.js b/scripts/update-header-data.js
deleted file mode 100644
index 0607352..0000000
--- a/scripts/update-header-data.js
+++ /dev/null
@@ -1,106 +0,0 @@
-const mongoose = require("mongoose");
-const path = require("path");
-require("dotenv").config({ path: path.join(__dirname, "../.env") });
-
-const Header = require("../models/header");
-
-async function updateHeaderData() {
- try {
- // Connect to MongoDB
- await mongoose.connect(process.env.MONGODB_URI || "mongodb://localhost:27017/hailearning");
- console.log("Connected to MongoDB");
-
- // Find the first header
- let header = await Header.findOne().sort({ order: 1 });
-
- if (!header) {
- console.log("No header found, creating new one...");
- header = new Header({
- top: {
- phone: "+09 378 357 5222",
- email: "info@hailearning.edu.vn",
- location: "69 Street, 5th Avenue LA, United States",
- socialLinks: [
- {
- platform: "linkedin",
- url: "https://linkedin.com",
- icon: "fa-brands fa-linkedin",
- },
- {
- platform: "twitter",
- url: "https://twitter.com",
- icon: "fa-brands fa-twitter",
- },
- {
- platform: "instagram",
- url: "https://instagram.com",
- icon: "fa-brands fa-instagram",
- },
- {
- platform: "youtube",
- url: "https://youtube.com",
- icon: "fa-brands fa-youtube",
- },
- ],
- languages: [
- { name: "English", value: "1" },
- { name: "Bangla", value: "2" },
- { name: "Hindi", value: "3" },
- ],
- },
- status: "active",
- order: 1,
- });
- } else {
- console.log("Header found, updating...");
- // Update existing header
- header.top = {
- phone: header.top?.phone || "+09 378 357 5222",
- email: header.top?.email || "info@hailearning.edu.vn",
- location: header.top?.location || "69 Street, 5th Avenue LA, United States",
- socialLinks:
- header.top?.socialLinks?.length > 0
- ? header.top.socialLinks
- : [
- {
- platform: "linkedin",
- url: "https://linkedin.com",
- icon: "fa-brands fa-linkedin",
- },
- {
- platform: "twitter",
- url: "https://twitter.com",
- icon: "fa-brands fa-twitter",
- },
- {
- platform: "instagram",
- url: "https://instagram.com",
- icon: "fa-brands fa-instagram",
- },
- {
- platform: "youtube",
- url: "https://youtube.com",
- icon: "fa-brands fa-youtube",
- },
- ],
- languages: header.top?.languages || [
- { name: "English", value: "1" },
- { name: "Bangla", value: "2" },
- { name: "Hindi", value: "3" },
- ],
- };
- }
-
- await header.save();
- console.log("Header updated successfully!");
- console.log("Header data:", JSON.stringify(header, null, 2));
-
- await mongoose.connection.close();
- console.log("Database connection closed");
- } catch (error) {
- console.error("Error updating header:", error);
- process.exit(1);
- }
-}
-
-updateHeaderData();
diff --git a/server.js b/server.js
index 2a187ad..3905493 100644
--- a/server.js
+++ b/server.js
@@ -51,16 +51,8 @@ app.use("/assets/img", express.static(path.join(__dirname, "public", "img")));
app.use(express.static(path.join(__dirname, "public")));
// Serve uploads folder
-app.use(
- "/uploads",
- (req, res, next) => {
- // Cho phép mọi domain truy cập tài nguyên tĩnh
- res.header("Access-Control-Allow-Origin", "*");
- res.header("Access-Control-Allow-Methods", "GET");
- next();
- },
- express.static(path.join(__dirname, "public", "uploads")),
-);
+// REMOVED: public static serve for uploads — degree documents are protected
+// app.use("/uploads", express.static(...)) ← intentionally disabled
// Serve other public files
app.use(express.static(path.join(__dirname, "public")));
@@ -148,6 +140,24 @@ app.use((req, res, next) => {
next();
});
+// Protected file serving — degree/certificate documents require API key
+app.get("/secure-files/:filename", (req, res) => {
+ const apiKey = req.query.api_key;
+ if (!apiKey || apiKey !== process.env.API_KEY) {
+ return res.status(401).json({ error: "Unauthorized - Invalid API key" });
+ }
+
+ const filename = path.basename(req.params.filename); // prevent path traversal
+ const filePath = path.join(__dirname, "private", "uploads", "degree", filename);
+
+ if (!fs.existsSync(filePath)) {
+ return res.status(404).json({ error: "File not found" });
+ }
+
+ res.setHeader("Access-Control-Allow-Origin", FRONTEND_URL || "*");
+ res.sendFile(filePath);
+});
+
// Routes
const authRoutes = require("./routes/auth");
const adminRoutes = require("./routes/admin");
@@ -161,10 +171,7 @@ app.use("/", indexRoutes);
app.use((req, res) => {
res.status(404);
if (req.accepts("html"))
- return res.render("page/404", {
- title: "404 - Page Not Found",
- layout: "layouts/main",
- });
+ return res.render("page/404", { layout: false });
if (req.accepts("json")) return res.json({ error: "Not found" });
res.type("txt").send("Not found");
});
diff --git a/tests/api.property.test.js b/tests/api.property.test.js
new file mode 100644
index 0000000..155f951
--- /dev/null
+++ b/tests/api.property.test.js
@@ -0,0 +1,179 @@
+/**
+ * Property-Based Tests for API endpoints
+ * Feature: degree-management-refactor
+ * Uses: fast-check + mongodb-memory-server + jest + supertest
+ */
+
+const mongoose = require('mongoose');
+const { MongoMemoryServer } = require('mongodb-memory-server');
+const fc = require('fast-check');
+const express = require('express');
+const request = require('supertest');
+
+// Models
+const Degree = require('../models/degree');
+const Department = require('../models/department');
+const Level = require('../models/level');
+
+// Routes
+const indexRoutes = require('../routes/index');
+
+let mongod;
+let app;
+
+// Increase global timeout for slow MongoDB startup and PBT runs
+jest.setTimeout(120000);
+
+// ─── Setup / Teardown ────────────────────────────────────────────────────────
+
+beforeAll(async () => {
+ // Set test API key before anything else
+ process.env.API_KEY = 'test-api-key-12345';
+
+ mongod = await MongoMemoryServer.create();
+ const uri = mongod.getUri();
+ await mongoose.connect(uri);
+
+ // Create a minimal Express app that mounts routes/index.js only
+ app = express();
+ app.use(express.json());
+ app.use(express.urlencoded({ extended: true }));
+ app.use('/', indexRoutes);
+});
+
+afterAll(async () => {
+ await mongoose.disconnect();
+ await mongod.stop();
+});
+
+afterEach(async () => {
+ await Degree.deleteMany({});
+ await Department.deleteMany({});
+ await Level.deleteMany({});
+});
+
+// ─── Seed Helpers ────────────────────────────────────────────────────────────
+
+let _counter = 0;
+function uid() {
+ return `${Date.now()}_${++_counter}_${Math.random().toString(36).slice(2)}`;
+}
+
+async function createDept() {
+ const id = uid();
+ return Department.create({ name: `dept_${id}`, slug: `dept-${id}` });
+}
+
+async function createLevel() {
+ const id = uid();
+ return Level.create({ type: `level_${id}` });
+}
+
+function makeDegreeData(dept, level, overrides = {}) {
+ const id = uid();
+ return {
+ qualification_number: `QN-${id}`,
+ student_name: `Student ${id}`,
+ program_name: `Program ${id}`,
+ type: 'qualification',
+ department: dept._id,
+ level: level._id,
+ issued_date: new Date('2024-01-01'),
+ status: 'active',
+ ...overrides,
+ };
+}
+
+// ─── Property 15: API lookup trả về đúng thông tin Degree ───────────────────
+
+// Feature: degree-management-refactor, Property 15: API lookup trả về đúng thông tin Degree
+test('Property 15: GET /api/degree/:qualificationNumber returns correct Degree fields', async () => {
+ // Validates: Requirements 5.1, 5.2
+ await fc.assert(
+ fc.asyncProperty(
+ fc.record({
+ student_name: fc.string({ minLength: 1, maxLength: 50 }).filter(s => s.trim() === s && s.trim().length > 0),
+ program_name: fc.string({ minLength: 1, maxLength: 50 }).filter(s => s.trim() === s && s.trim().length > 0),
+ }),
+ async ({ student_name, program_name }) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+ const data = makeDegreeData(dept, lvl, { student_name, program_name });
+
+ const saved = await Degree.create(data);
+
+ const res = await request(app)
+ .get(`/api/degree/${saved.qualification_number}`)
+ .set('x-api-key', process.env.API_KEY);
+
+ expect(res.status).toBe(200);
+ expect(res.body.student_name).toBe(student_name);
+ expect(res.body.program_name).toBe(program_name);
+ expect(res.body.type).toBe(data.type);
+ expect(res.body.status).toBe(data.status);
+ expect(res.body.issued_date).toBeDefined();
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 16: API không có API key hợp lệ trả về 401 ────────────────────
+
+// Feature: degree-management-refactor, Property 16: API không có API key hợp lệ trả về 401
+test('Property 16: requests without valid x-api-key return 401', async () => {
+ // Validates: Requirements 5.3, 5.6
+ await fc.assert(
+ fc.asyncProperty(
+ fc.oneof(
+ fc.constant(null), // no header at all
+ fc.string({ minLength: 1, maxLength: 40 }) // random invalid key
+ .filter(s => s !== process.env.API_KEY)
+ ),
+ async (invalidKey) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+ const data = makeDegreeData(dept, lvl);
+ await Degree.create(data);
+
+ let req = request(app).get(`/api/degree/${data.qualification_number}`);
+ if (invalidKey !== null) {
+ req = req.set('x-api-key', invalidKey);
+ }
+
+ const res = await req;
+
+ expect(res.status).toBe(401);
+ expect(res.body).toEqual({ error: 'Unauthorized - Invalid API key' });
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 17: Degree bị thu hồi vẫn trả về với status revoked ───────────
+
+// Feature: degree-management-refactor, Property 17: Degree bị thu hồi vẫn trả về với status revoked
+test('Property 17: revoked Degree is returned by API with status "revoked" (not 404)', async () => {
+ // Validates: Requirements 5.5
+ await fc.assert(
+ fc.asyncProperty(
+ fc.constant(null), // no extra input needed
+ async () => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+ const data = makeDegreeData(dept, lvl, { status: 'revoked' });
+
+ const saved = await Degree.create(data);
+
+ const res = await request(app)
+ .get(`/api/degree/${saved.qualification_number}`)
+ .set('x-api-key', process.env.API_KEY);
+
+ expect(res.status).toBe(200);
+ expect(res.body.status).toBe('revoked');
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
diff --git a/tests/auth-routes.property.test.js b/tests/auth-routes.property.test.js
new file mode 100644
index 0000000..48d010b
--- /dev/null
+++ b/tests/auth-routes.property.test.js
@@ -0,0 +1,212 @@
+/**
+ * Property-Based Tests for auth guard and routes
+ * Feature: degree-management-refactor
+ * Uses: fast-check + jest + supertest (no MongoDB needed)
+ */
+
+const fc = require('fast-check');
+const express = require('express');
+const session = require('express-session');
+const request = require('supertest');
+
+// Routes
+const authRoutes = require('../routes/auth');
+const adminRoutes = require('../routes/admin');
+const indexRoutes = require('../routes/index');
+
+// Middleware
+const { ensureAuthenticated } = require('../middleware/auth');
+
+jest.setTimeout(120000);
+
+// ─── Minimal App Factory ─────────────────────────────────────────────────────
+
+/**
+ * Build a minimal Express app that:
+ * - Uses in-memory session (no MongoDB store)
+ * - Mounts /auth, /admin, / routes
+ * - Has a 404 handler
+ */
+function buildApp() {
+ const app = express();
+
+ app.use(express.json());
+ app.use(express.urlencoded({ extended: true }));
+
+ // In-memory session (no MongoStore needed for auth/route tests)
+ app.use(
+ session({
+ secret: 'test-secret',
+ resave: false,
+ saveUninitialized: false,
+ })
+ );
+
+ // Stub flash so auth routes don't crash
+ app.use((req, res, next) => {
+ req.flash = () => {};
+ next();
+ });
+
+ // Stub res.locals used by views/middleware
+ app.use((req, res, next) => {
+ res.locals.user = null;
+ res.locals.currentPath = req.path;
+ res.locals.frontendUrl = '';
+ next();
+ });
+
+ // Mount routes
+ app.use('/auth', authRoutes);
+ app.use('/admin', adminRoutes);
+ app.use('/', indexRoutes);
+
+ // 404 handler (mirrors server.js)
+ app.use((req, res) => {
+ res.status(404);
+ if (req.accepts('json')) return res.json({ error: 'Not found' });
+ res.type('txt').send('Not found');
+ });
+
+ return app;
+}
+
+// ─── Known route prefixes (whitelist) ────────────────────────────────────────
+
+const KNOWN_PREFIXES = ['/api/degree/', '/api/certificate/', '/admin/', '/auth/'];
+
+function isKnownRoute(path) {
+ return KNOWN_PREFIXES.some((prefix) => path.startsWith(prefix));
+}
+
+// ─── Property 1: Route ngoài phạm vi trả về 404 ──────────────────────────────
+
+// Feature: degree-management-refactor, Property 1: Route ngoài phạm vi trả về 404
+test('Property 1: unknown routes return 404', async () => {
+ // Validates: Requirements 1.3
+ const app = buildApp();
+
+ // Arbitrary: random path segments that don't start with known prefixes
+ const unknownPathArb = fc
+ .array(fc.stringMatching(/^[a-z0-9_-]{1,10}$/), { minLength: 1, maxLength: 4 })
+ .map((parts) => '/' + parts.join('/'))
+ .filter((path) => !isKnownRoute(path));
+
+ await fc.assert(
+ fc.asyncProperty(unknownPathArb, async (path) => {
+ const res = await request(app).get(path).set('Accept', 'application/json');
+ expect(res.status).toBe(404);
+ }),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 11: Authentication guard trên admin routes ─────────────────────
+
+// Feature: degree-management-refactor, Property 11: Authentication guard trên admin routes
+test('Property 11: unauthenticated requests to /admin/* are redirected to /auth/login', async () => {
+ // Validates: Requirements 3.11
+ const app = buildApp();
+
+ // Known admin sub-paths to test
+ const adminSubPathArb = fc
+ .constantFrom(
+ '/admin/dashboard',
+ '/admin/degree',
+ '/admin/degree/create',
+ '/admin/department',
+ '/admin/level',
+ '/admin/audit-logs'
+ );
+
+ await fc.assert(
+ fc.asyncProperty(adminSubPathArb, async (path) => {
+ // No session cookie → not authenticated
+ const res = await request(app).get(path);
+
+ expect(res.status).toBe(302);
+ expect(res.headers.location).toBe('/auth/login');
+ }),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 18: Login, logout, request /admin/* → redirect ─────────────────
+
+// Feature: degree-management-refactor, Property 18: Login, logout, request /admin/* → redirect
+test('Property 18: after logout, requests to /admin/* redirect to /auth/login', async () => {
+ // Validates: Requirements 6.5
+ const app = buildApp();
+
+ const adminSubPathArb = fc.constantFrom(
+ '/admin/dashboard',
+ '/admin/degree',
+ '/admin/department',
+ '/admin/level',
+ '/admin/audit-logs'
+ );
+
+ await fc.assert(
+ fc.asyncProperty(adminSubPathArb, async (path) => {
+ // Step 1: Simulate an authenticated session by injecting isAuthenticated
+ // We do this by adding a one-time setup route that sets the session flag
+ const testApp = express();
+ testApp.use(express.json());
+ testApp.use(express.urlencoded({ extended: true }));
+ testApp.use(
+ session({
+ secret: 'test-secret',
+ resave: false,
+ saveUninitialized: false,
+ })
+ );
+ testApp.use((req, res, next) => {
+ req.flash = () => {};
+ next();
+ });
+ testApp.use((req, res, next) => {
+ res.locals.user = null;
+ res.locals.currentPath = req.path;
+ res.locals.frontendUrl = '';
+ next();
+ });
+
+ // Helper route: sets isAuthenticated = true in session
+ testApp.get('/__test_login', (req, res) => {
+ req.session.isAuthenticated = true;
+ req.session.user = { id: 'test', username: 'testuser' };
+ res.json({ ok: true });
+ });
+
+ // Helper route: destroys session (simulates logout)
+ testApp.get('/__test_logout', (req, res) => {
+ req.session.destroy(() => res.json({ ok: true }));
+ });
+
+ testApp.use('/auth', authRoutes);
+ testApp.use('/admin', adminRoutes);
+ testApp.use('/', indexRoutes);
+
+ testApp.use((req, res) => {
+ res.status(404);
+ if (req.accepts('json')) return res.json({ error: 'Not found' });
+ res.type('txt').send('Not found');
+ });
+
+ const agent = request.agent(testApp);
+
+ // Step 2: Login (set session)
+ await agent.get('/__test_login');
+
+ // Step 3: Logout (destroy session)
+ await agent.get('/__test_logout');
+
+ // Step 4: Request admin route — should redirect to /auth/login
+ const res = await agent.get(path);
+
+ expect(res.status).toBe(302);
+ expect(res.headers.location).toBe('/auth/login');
+ }),
+ { numRuns: 100 }
+ );
+}, 120000);
diff --git a/tests/dashboard-dept-level.property.test.js b/tests/dashboard-dept-level.property.test.js
new file mode 100644
index 0000000..c132f63
--- /dev/null
+++ b/tests/dashboard-dept-level.property.test.js
@@ -0,0 +1,338 @@
+/**
+ * Property-Based Tests: Dashboard, Department, Level, AuditLog
+ * Feature: degree-management-refactor
+ * Uses: fast-check + mongodb-memory-server + jest
+ * Properties: 19, 20, 21, 22, 23, 24
+ */
+
+const mongoose = require('mongoose');
+const { MongoMemoryServer } = require('mongodb-memory-server');
+const fc = require('fast-check');
+
+// Models
+const Degree = require('../models/degree');
+const Department = require('../models/department');
+const Level = require('../models/level');
+const AuditLog = require('../models/auditLog');
+
+// Audit
+const writeAuditLog = require('../audit/writeAuditLog');
+const AUDIT_ACTIONS = require('../constants/auditAction');
+
+let mongod;
+
+jest.setTimeout(120000);
+
+// ─── Setup / Teardown ────────────────────────────────────────────────────────
+
+beforeAll(async () => {
+ mongod = await MongoMemoryServer.create();
+ const uri = mongod.getUri();
+ await mongoose.connect(uri);
+});
+
+afterAll(async () => {
+ await mongoose.disconnect();
+ await mongod.stop();
+});
+
+afterEach(async () => {
+ await Degree.deleteMany({});
+ await Department.deleteMany({});
+ await Level.deleteMany({});
+ await AuditLog.deleteMany({});
+});
+
+// ─── Helpers ─────────────────────────────────────────────────────────────────
+
+let _counter = 0;
+function uid() {
+ return `${Date.now()}_${++_counter}_${Math.random().toString(36).slice(2)}`;
+}
+
+async function createDept(nameSuffix) {
+ const id = nameSuffix || uid();
+ return Department.create({ name: `dept_${id}`, slug: `dept-${id}` });
+}
+
+async function createLevel(typeSuffix) {
+ const id = typeSuffix || uid();
+ return Level.create({ type: `level_${id}` });
+}
+
+function makeDegreeData(dept, level, overrides = {}) {
+ const id = uid();
+ return {
+ qualification_number: `QN-${id}`,
+ student_name: `Student ${id}`,
+ program_name: `Program ${id}`,
+ type: 'qualification',
+ department: dept._id,
+ level: level._id,
+ issued_date: new Date('2024-01-01'),
+ status: 'active',
+ ...overrides,
+ };
+}
+
+// Minimal mock req for writeAuditLog
+function mockReq() {
+ return {
+ session: { user: { id: null } },
+ headers: { 'x-forwarded-for': '127.0.0.1' },
+ ip: '127.0.0.1',
+ };
+}
+
+// ─── Property 19: Dashboard thống kê chính xác ───────────────────────────────
+
+// Feature: degree-management-refactor, Property 19: Dashboard thống kê chính xác
+test('Property 19: dashboard counts match seeded degree data', async () => {
+ // Validates: Requirements 7.1, 7.2, 7.3
+ await fc.assert(
+ fc.asyncProperty(
+ fc.integer({ min: 1, max: 10 }),
+ fc.integer({ min: 0, max: 10 }),
+ async (qualCount, certCount) => {
+ await Degree.deleteMany({});
+ await Department.deleteMany({});
+ await Level.deleteMany({});
+
+ const dept = await createDept();
+ const lvl = await createLevel();
+
+ // Seed qualification degrees (all active)
+ for (let i = 0; i < qualCount; i++) {
+ await Degree.create(makeDegreeData(dept, lvl, { type: 'qualification', status: 'active' }));
+ }
+
+ // Seed certification degrees (half active, half revoked)
+ const certActive = Math.floor(certCount / 2);
+ const certRevoked = certCount - certActive;
+ for (let i = 0; i < certActive; i++) {
+ const id = uid();
+ await Degree.create(makeDegreeData(dept, lvl, {
+ type: 'certification',
+ certification_number: `CN-${id}`,
+ status: 'active',
+ }));
+ }
+ for (let i = 0; i < certRevoked; i++) {
+ const id = uid();
+ await Degree.create(makeDegreeData(dept, lvl, {
+ type: 'certification',
+ certification_number: `CN-${id}`,
+ status: 'revoked',
+ }));
+ }
+
+ const expectedTotal = qualCount + certCount;
+ const expectedQual = qualCount;
+ const expectedCert = certCount;
+ const expectedActive = qualCount + certActive;
+ const expectedRevoked = certRevoked;
+
+ // Run same queries as dashboardController.getDashboard
+ const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
+ const [total, qualificationCount, certificationCount, activeCount, revokedCount, recentCount] =
+ await Promise.all([
+ Degree.countDocuments(),
+ Degree.countDocuments({ type: 'qualification' }),
+ Degree.countDocuments({ type: 'certification' }),
+ Degree.countDocuments({ status: 'active' }),
+ Degree.countDocuments({ status: 'revoked' }),
+ Degree.countDocuments({ createdAt: { $gte: thirtyDaysAgo } }),
+ ]);
+
+ expect(total).toBe(expectedTotal);
+ expect(qualificationCount).toBe(expectedQual);
+ expect(certificationCount).toBe(expectedCert);
+ expect(activeCount).toBe(expectedActive);
+ expect(revokedCount).toBe(expectedRevoked);
+ // All seeded degrees are recent (just created)
+ expect(recentCount).toBe(expectedTotal);
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 20: Tự động sinh slug cho Department ───────────────────────────
+
+// Feature: degree-management-refactor, Property 20: Tự động sinh slug cho Department
+test('Property 20: slug generated from department name is lowercase, spaces replaced with hyphens, no special chars', async () => {
+ // Validates: Requirements 8.2
+ await fc.assert(
+ fc.asyncProperty(
+ // Generate names with letters, spaces, digits — avoid empty after trim
+ fc.stringMatching(/^[a-zA-Z][a-zA-Z0-9 ]{0,28}[a-zA-Z0-9]$/).filter(s => s.trim().length > 0),
+ async (name) => {
+ // Apply same slug logic as departmentController.create
+ const slug = name.toLowerCase().trim().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
+
+ // Verify slug properties
+ expect(slug).toBe(slug.toLowerCase());
+ expect(slug).not.toMatch(/\s/);
+ expect(slug).not.toMatch(/[^a-z0-9-]/);
+ if (name.trim().includes(' ')) {
+ expect(slug).toContain('-');
+ }
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 60000);
+
+// ─── Property 21: Level yêu cầu trường type ──────────────────────────────────
+
+// Feature: degree-management-refactor, Property 21: Level yêu cầu trường type
+test('Property 21: creating Level without type field throws ValidationError', async () => {
+ // Validates: Requirements 8.5
+ await fc.assert(
+ fc.asyncProperty(
+ fc.constant(null),
+ async () => {
+ let threw = false;
+ try {
+ const doc = new Level({});
+ await doc.save();
+ } catch (err) {
+ threw = true;
+ expect(
+ err.name === 'ValidationError' ||
+ (err.message && err.message.toLowerCase().includes('type'))
+ ).toBe(true);
+ }
+ expect(threw).toBe(true);
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 60000);
+
+// ─── Property 22: Referential integrity khi xóa Department/Level ─────────────
+
+// Feature: degree-management-refactor, Property 22: Referential integrity khi xóa Department/Level
+test('Property 22: deleting Department or Level referenced by a Degree is blocked', async () => {
+ // Validates: Requirements 8.6
+ await fc.assert(
+ fc.asyncProperty(
+ fc.boolean(), // true = test Department, false = test Level
+ async (testDepartment) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+
+ // Create a degree referencing both
+ await Degree.create(makeDegreeData(dept, lvl));
+
+ if (testDepartment) {
+ // Simulate departmentController.destroy logic
+ const count = await Degree.countDocuments({ department: dept._id });
+ expect(count).toBeGreaterThan(0);
+ // Deletion should be blocked (count > 0 means we would not delete)
+ const wouldDelete = count === 0;
+ expect(wouldDelete).toBe(false);
+ } else {
+ // Simulate levelController.destroy logic
+ const count = await Degree.countDocuments({ level: lvl._id });
+ expect(count).toBeGreaterThan(0);
+ const wouldDelete = count === 0;
+ expect(wouldDelete).toBe(false);
+ }
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 23: Audit log được ghi sau mỗi CRUD operation ──────────────────
+
+// Feature: degree-management-refactor, Property 23: Audit log được ghi sau mỗi CRUD operation
+test('Property 23: writeAuditLog creates AuditLog with correct action, model, documentId', async () => {
+ // Validates: Requirements 9.1
+ await fc.assert(
+ fc.asyncProperty(
+ fc.constantFrom(
+ AUDIT_ACTIONS.CREATE_DEGREE,
+ AUDIT_ACTIONS.UPDATE_DEGREE,
+ AUDIT_ACTIONS.DELETE_DEGREE
+ ),
+ async (action) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+ const degree = await Degree.create(makeDegreeData(dept, lvl));
+
+ await writeAuditLog({
+ model: 'Degree',
+ documentId: degree._id,
+ action,
+ before: null,
+ after: degree.toObject(),
+ changes: [],
+ req: mockReq(),
+ });
+
+ const log = await AuditLog.findOne({ documentId: degree._id, action });
+ expect(log).not.toBeNull();
+ expect(log.model).toBe('Degree');
+ expect(log.action).toBe(action);
+ expect(log.documentId.toString()).toBe(degree._id.toString());
+
+ // cleanup
+ await AuditLog.deleteMany({ documentId: degree._id });
+ await Degree.deleteOne({ _id: degree._id });
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 24: Audit log hiển thị theo thứ tự thời gian giảm dần ──────────
+
+// Feature: degree-management-refactor, Property 24: Audit log hiển thị theo thứ tự thời gian giảm dần
+test('Property 24: AuditLog.find().sort({ createdAt: -1 }) returns logs in descending order', async () => {
+ // Validates: Requirements 9.2
+ await fc.assert(
+ fc.asyncProperty(
+ fc.integer({ min: 2, max: 8 }),
+ async (n) => {
+ await AuditLog.deleteMany({});
+
+ const dept = await createDept();
+ const lvl = await createLevel();
+ const degree = await Degree.create(makeDegreeData(dept, lvl));
+
+ // Create n audit logs with distinct timestamps (1 second apart)
+ const base = Date.now() - n * 1000;
+ for (let i = 0; i < n; i++) {
+ await AuditLog.create({
+ model: 'Degree',
+ documentId: degree._id,
+ action: AUDIT_ACTIONS.CREATE_DEGREE,
+ before: null,
+ after: null,
+ changes: [],
+ ipAddress: '127.0.0.1',
+ userAgent: '',
+ performedBy: null,
+ createdAt: new Date(base + i * 1000),
+ });
+ }
+
+ const logs = await AuditLog.find().sort({ createdAt: -1 });
+
+ expect(logs.length).toBe(n);
+ for (let i = 0; i < logs.length - 1; i++) {
+ expect(logs[i].createdAt.getTime()).toBeGreaterThanOrEqual(
+ logs[i + 1].createdAt.getTime()
+ );
+ }
+
+ // cleanup
+ await AuditLog.deleteMany({});
+ await Degree.deleteOne({ _id: degree._id });
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
diff --git a/tests/degree.property.test.js b/tests/degree.property.test.js
new file mode 100644
index 0000000..15e9165
--- /dev/null
+++ b/tests/degree.property.test.js
@@ -0,0 +1,325 @@
+/**
+ * Property-Based Tests for Degree model
+ * Feature: degree-management-refactor
+ * Uses: fast-check + mongodb-memory-server + jest
+ */
+
+const mongoose = require('mongoose');
+const { MongoMemoryServer } = require('mongodb-memory-server');
+const fc = require('fast-check');
+
+// Models
+const Degree = require('../models/degree');
+const Department = require('../models/department');
+const Level = require('../models/level');
+
+let mongod;
+
+// Increase global timeout for slow MongoDB startup and PBT runs
+jest.setTimeout(120000);
+
+// ─── Setup / Teardown ────────────────────────────────────────────────────────
+
+beforeAll(async () => {
+ mongod = await MongoMemoryServer.create();
+ const uri = mongod.getUri();
+ await mongoose.connect(uri);
+});
+
+afterAll(async () => {
+ await mongoose.disconnect();
+ await mongod.stop();
+});
+
+afterEach(async () => {
+ await Degree.deleteMany({});
+ await Department.deleteMany({});
+ await Level.deleteMany({});
+});
+
+// ─── Seed Helpers ────────────────────────────────────────────────────────────
+
+let _counter = 0;
+function uid() {
+ return `${Date.now()}_${++_counter}_${Math.random().toString(36).slice(2)}`;
+}
+
+async function createDept() {
+ const id = uid();
+ return Department.create({ name: `dept_${id}`, slug: `dept-${id}` });
+}
+
+async function createLevel() {
+ const id = uid();
+ return Level.create({ type: `level_${id}` });
+}
+
+function makeDegreeData(dept, level, overrides = {}) {
+ const id = uid();
+ return {
+ qualification_number: `QN-${id}`,
+ student_name: `Student ${id}`,
+ program_name: `Program ${id}`,
+ type: 'qualification',
+ department: dept._id,
+ level: level._id,
+ issued_date: new Date('2024-01-01'),
+ ...overrides,
+ };
+}
+
+// ─── Property 2: Validation các trường bắt buộc của Degree ──────────────────
+
+// Feature: degree-management-refactor, Property 2: Validation các trường bắt buộc của Degree
+test('Property 2: saving Degree without each required field throws ValidationError', async () => {
+ // Validates: Requirements 2.1
+ const requiredFields = [
+ 'qualification_number',
+ 'student_name',
+ 'program_name',
+ 'type',
+ 'department',
+ 'level',
+ 'issued_date',
+ ];
+
+ await fc.assert(
+ fc.asyncProperty(
+ fc.constantFrom(...requiredFields),
+ async (missingField) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+ const data = makeDegreeData(dept, lvl);
+ delete data[missingField];
+
+ let threw = false;
+ try {
+ const doc = new Degree(data);
+ await doc.save();
+ } catch (err) {
+ threw = true;
+ // Should be a ValidationError (or pre-save Error for type-related)
+ const isValidation =
+ err.name === 'ValidationError' ||
+ (err.message && err.message.includes('required'));
+ expect(isValidation).toBe(true);
+ }
+ expect(threw).toBe(true);
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 60000);
+
+// ─── Property 3: Conditional validation type-number ─────────────────────────
+
+// Feature: degree-management-refactor, Property 3: Conditional validation type-number
+test('Property 3: certification type without certification_number throws; qualification saves ok', async () => {
+ // Validates: Requirements 2.3, 2.4
+ await fc.assert(
+ fc.asyncProperty(
+ fc.boolean(), // true = certification (should fail), false = qualification (should pass)
+ async (isCertification) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+
+ if (isCertification) {
+ // certification without certification_number → must throw
+ const data = makeDegreeData(dept, lvl, { type: 'certification' });
+ // no certification_number
+ let threw = false;
+ try {
+ const doc = new Degree(data);
+ await doc.save();
+ } catch (err) {
+ threw = true;
+ expect(err.message).toMatch(/certification_number/i);
+ }
+ expect(threw).toBe(true);
+ } else {
+ // qualification without certification_number → must succeed
+ const data = makeDegreeData(dept, lvl, { type: 'qualification' });
+ const doc = new Degree(data);
+ const saved = await doc.save();
+ expect(saved._id).toBeDefined();
+ await Degree.deleteOne({ _id: saved._id });
+ }
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 60000);
+
+// ─── Property 4: Uniqueness của qualification_number ────────────────────────
+
+// Feature: degree-management-refactor, Property 4: Uniqueness của qualification_number
+test('Property 4: two Degrees with same qualification_number → second save throws duplicate key error', async () => {
+ // Validates: Requirements 2.5, 2.7
+ await fc.assert(
+ fc.asyncProperty(
+ fc.string({ minLength: 1, maxLength: 30 }).filter(s => s.trim().length > 0),
+ async (qn) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+
+ const data1 = makeDegreeData(dept, lvl, { qualification_number: `QN-${qn}` });
+ const data2 = makeDegreeData(dept, lvl, { qualification_number: `QN-${qn}` });
+
+ await Degree.create(data1);
+
+ let threw = false;
+ try {
+ await Degree.create(data2);
+ } catch (err) {
+ threw = true;
+ // MongoServerError code 11000 = duplicate key
+ expect(err.code === 11000 || err.name === 'MongoServerError').toBe(true);
+ }
+ expect(threw).toBe(true);
+
+ // cleanup
+ await Degree.deleteMany({ qualification_number: `QN-${qn}` });
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 5: Sparse uniqueness của certification_number ─────────────────
+
+// Feature: degree-management-refactor, Property 5: Sparse uniqueness của certification_number
+test('Property 5: same non-null certification_number → duplicate error; both null → both save ok', async () => {
+ // Validates: Requirements 2.6, 2.7
+ await fc.assert(
+ fc.asyncProperty(
+ fc.boolean(), // true = test duplicate, false = test sparse (both null)
+ async (testDuplicate) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+
+ if (testDuplicate) {
+ const cn = `CN-${uid()}`;
+ const data1 = makeDegreeData(dept, lvl, {
+ type: 'certification',
+ certification_number: cn,
+ });
+ const data2 = makeDegreeData(dept, lvl, {
+ type: 'certification',
+ certification_number: cn,
+ });
+
+ await Degree.create(data1);
+
+ let threw = false;
+ try {
+ await Degree.create(data2);
+ } catch (err) {
+ threw = true;
+ expect(err.code === 11000 || err.name === 'MongoServerError').toBe(true);
+ }
+ expect(threw).toBe(true);
+
+ await Degree.deleteMany({ certification_number: cn });
+ } else {
+ // Both without certification_number (sparse index allows multiple nulls)
+ const data1 = makeDegreeData(dept, lvl, { type: 'qualification' });
+ const data2 = makeDegreeData(dept, lvl, { type: 'qualification' });
+
+ const saved1 = await Degree.create(data1);
+ const saved2 = await Degree.create(data2);
+
+ expect(saved1._id).toBeDefined();
+ expect(saved2._id).toBeDefined();
+
+ await Degree.deleteMany({ _id: { $in: [saved1._id, saved2._id] } });
+ }
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 6: Round-trip tạo Degree ──────────────────────────────────────
+
+// Feature: degree-management-refactor, Property 6: Round-trip tạo Degree
+test('Property 6: save Degree then findById returns matching fields', async () => {
+ // Validates: Requirements 3.5
+ await fc.assert(
+ fc.asyncProperty(
+ fc.record({
+ student_name: fc.string({ minLength: 1, maxLength: 50 }).filter(s => s.trim() === s && s.trim().length > 0),
+ program_name: fc.string({ minLength: 1, maxLength: 50 }).filter(s => s.trim() === s && s.trim().length > 0),
+ }),
+ async ({ student_name, program_name }) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+ const data = makeDegreeData(dept, lvl, { student_name, program_name });
+
+ const saved = await Degree.create(data);
+ const found = await Degree.findById(saved._id);
+
+ expect(found).not.toBeNull();
+ expect(found.qualification_number).toBe(data.qualification_number);
+ expect(found.student_name).toBe(student_name);
+ expect(found.program_name).toBe(program_name);
+ expect(found.type).toBe(data.type);
+ expect(found.department.toString()).toBe(dept._id.toString());
+ expect(found.level.toString()).toBe(lvl._id.toString());
+
+ await Degree.deleteOne({ _id: saved._id });
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 7: Round-trip cập nhật Degree ─────────────────────────────────
+
+// Feature: degree-management-refactor, Property 7: Round-trip cập nhật Degree
+test('Property 7: update student_name then findById returns updated value', async () => {
+ // Validates: Requirements 3.8
+ await fc.assert(
+ fc.asyncProperty(
+ fc.string({ minLength: 1, maxLength: 50 }).filter(s => s.trim() === s && s.trim().length > 0),
+ async (newName) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+ const data = makeDegreeData(dept, lvl);
+
+ const saved = await Degree.create(data);
+ await Degree.findByIdAndUpdate(saved._id, { student_name: newName });
+ const found = await Degree.findById(saved._id);
+
+ expect(found).not.toBeNull();
+ expect(found.student_name).toBe(newName);
+
+ await Degree.deleteOne({ _id: saved._id });
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 8: Round-trip xóa Degree ──────────────────────────────────────
+
+// Feature: degree-management-refactor, Property 8: Round-trip xóa Degree
+test('Property 8: delete Degree then findById returns null', async () => {
+ // Validates: Requirements 3.9
+ await fc.assert(
+ fc.asyncProperty(
+ fc.constant(null), // no extra input needed
+ async () => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+ const data = makeDegreeData(dept, lvl);
+
+ const saved = await Degree.create(data);
+ await Degree.findByIdAndDelete(saved._id);
+ const found = await Degree.findById(saved._id);
+
+ expect(found).toBeNull();
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
diff --git a/tests/search-filter.property.test.js b/tests/search-filter.property.test.js
new file mode 100644
index 0000000..8d98a6b
--- /dev/null
+++ b/tests/search-filter.property.test.js
@@ -0,0 +1,201 @@
+/**
+ * Property-Based Tests for Degree search and filter
+ * Feature: degree-management-refactor
+ * Uses: fast-check + mongodb-memory-server + jest
+ */
+
+const mongoose = require('mongoose');
+const { MongoMemoryServer } = require('mongodb-memory-server');
+const fc = require('fast-check');
+
+// Models
+const Degree = require('../models/degree');
+const Department = require('../models/department');
+const Level = require('../models/level');
+
+let mongod;
+
+jest.setTimeout(120000);
+
+// ─── Setup / Teardown ────────────────────────────────────────────────────────
+
+beforeAll(async () => {
+ mongod = await MongoMemoryServer.create();
+ const uri = mongod.getUri();
+ await mongoose.connect(uri);
+});
+
+afterAll(async () => {
+ await mongoose.disconnect();
+ await mongod.stop();
+});
+
+afterEach(async () => {
+ await Degree.deleteMany({});
+ await Department.deleteMany({});
+ await Level.deleteMany({});
+});
+
+// ─── Seed Helpers ────────────────────────────────────────────────────────────
+
+let _counter = 0;
+function uid() {
+ return `${Date.now()}_${++_counter}_${Math.random().toString(36).slice(2)}`;
+}
+
+async function createDept() {
+ const id = uid();
+ return Department.create({ name: `dept_${id}`, slug: `dept-${id}` });
+}
+
+async function createLevel() {
+ const id = uid();
+ return Level.create({ type: `level_${id}` });
+}
+
+function makeDegreeData(dept, level, overrides = {}) {
+ const id = uid();
+ return {
+ qualification_number: `QN-${id}`,
+ student_name: `Student ${id}`,
+ program_name: `Program ${id}`,
+ type: 'qualification',
+ department: dept._id,
+ level: level._id,
+ issued_date: new Date('2024-01-01'),
+ status: 'active',
+ ...overrides,
+ };
+}
+
+// Arbitraries for safe alphanumeric tokens (no regex special chars)
+const safeToken = fc
+ .string({ minLength: 2, maxLength: 10 })
+ .filter(s => /^[a-zA-Z0-9]+$/.test(s));
+
+// ─── Property 9: Kết quả tìm kiếm khớp với query ────────────────────────────
+
+// Feature: degree-management-refactor, Property 9: Kết quả tìm kiếm khớp với query
+test('Property 9: every search result contains the search term in qualification_number, certification_number, or student_name', async () => {
+ // Validates: Requirements 3.2
+ await fc.assert(
+ fc.asyncProperty(
+ // Generate 1-5 degrees and a search term
+ fc.array(
+ fc.record({
+ type: fc.constantFrom('qualification', 'certification'),
+ suffix: safeToken,
+ }),
+ { minLength: 1, maxLength: 5 }
+ ),
+ safeToken,
+ async (degreeSpecs, searchTerm) => {
+ const dept = await createDept();
+ const lvl = await createLevel();
+
+ // Insert degrees; embed searchTerm into some of them
+ for (let i = 0; i < degreeSpecs.length; i++) {
+ const spec = degreeSpecs[i];
+ const overrides = { type: spec.type };
+
+ // Alternate which field gets the search term
+ if (i % 3 === 0) {
+ overrides.qualification_number = `QN-${searchTerm}-${spec.suffix}`;
+ } else if (i % 3 === 1) {
+ overrides.student_name = `${searchTerm} Student ${spec.suffix}`;
+ } else {
+ // certification type with certification_number containing term
+ overrides.type = 'certification';
+ overrides.certification_number = `CN-${searchTerm}-${spec.suffix}`;
+ }
+
+ if (overrides.type === 'certification' && !overrides.certification_number) {
+ overrides.certification_number = `CN-${uid()}`;
+ }
+
+ await Degree.create(makeDegreeData(dept, lvl, overrides));
+ }
+
+ // Run the same $or $regex query as degreeController.index
+ const filter = {
+ $or: [
+ { qualification_number: { $regex: searchTerm, $options: 'i' } },
+ { certification_number: { $regex: searchTerm, $options: 'i' } },
+ { student_name: { $regex: searchTerm, $options: 'i' } },
+ ],
+ };
+
+ const results = await Degree.find(filter);
+
+ // Every result must contain the search term in at least one of the three fields
+ for (const doc of results) {
+ const term = searchTerm.toLowerCase();
+ const matchesQN = doc.qualification_number
+ ? doc.qualification_number.toLowerCase().includes(term)
+ : false;
+ const matchesCN = doc.certification_number
+ ? doc.certification_number.toLowerCase().includes(term)
+ : false;
+ const matchesSN = doc.student_name
+ ? doc.student_name.toLowerCase().includes(term)
+ : false;
+
+ expect(matchesQN || matchesCN || matchesSN).toBe(true);
+ }
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
+
+// ─── Property 10: Kết quả lọc khớp với filter ───────────────────────────────
+
+// Feature: degree-management-refactor, Property 10: Kết quả lọc khớp với filter
+test('Property 10: every filtered result matches the applied filter value exactly', async () => {
+ // Validates: Requirements 3.3
+ await fc.assert(
+ fc.asyncProperty(
+ // Choose which field to filter on and what value to use
+ fc.record({
+ filterField: fc.constantFrom('type', 'status'),
+ filterValue: fc.constantFrom('qualification', 'certification', 'active', 'revoked'),
+ }),
+ // Generate 2-6 degrees with mixed types and statuses
+ fc.array(
+ fc.record({
+ type: fc.constantFrom('qualification', 'certification'),
+ status: fc.constantFrom('active', 'revoked'),
+ }),
+ { minLength: 2, maxLength: 6 }
+ ),
+ async ({ filterField, filterValue }, degreeSpecs) => {
+ // Skip invalid combinations (e.g. filtering type by 'active')
+ const typeValues = ['qualification', 'certification'];
+ const statusValues = ['active', 'revoked'];
+ if (filterField === 'type' && !typeValues.includes(filterValue)) return;
+ if (filterField === 'status' && !statusValues.includes(filterValue)) return;
+
+ const dept = await createDept();
+ const lvl = await createLevel();
+
+ for (const spec of degreeSpecs) {
+ const overrides = { type: spec.type, status: spec.status };
+ if (spec.type === 'certification') {
+ overrides.certification_number = `CN-${uid()}`;
+ }
+ await Degree.create(makeDegreeData(dept, lvl, overrides));
+ }
+
+ // Apply filter the same way degreeController.index does
+ const filter = { [filterField]: filterValue };
+ const results = await Degree.find(filter);
+
+ // Every result must match the filter value exactly
+ for (const doc of results) {
+ expect(doc[filterField]).toBe(filterValue);
+ }
+ }
+ ),
+ { numRuns: 100 }
+ );
+}, 120000);
diff --git a/views/admin/aboutUs/index.ejs b/views/admin/aboutUs/index.ejs
deleted file mode 100644
index 556b9cd..0000000
--- a/views/admin/aboutUs/index.ejs
+++ /dev/null
@@ -1,967 +0,0 @@
-
-
-
-
- <%= title %>
-
-
Edit content displayed on About Us page
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/views/admin/activity/form.ejs b/views/admin/activity/form.ejs
deleted file mode 100644
index 3b75cf6..0000000
--- a/views/admin/activity/form.ejs
+++ /dev/null
@@ -1,4149 +0,0 @@
-
-
-
-
- <%= title %>
-
-
- <%= isEdit ? 'Update activity details' : 'Create a new activity' %>
-
-
-
-
-
-
-
-
- <% if (!isEdit) { %>
-
-
-
-
-
-
- Hero Title
-
- Title for the activities page header
-
-
-
-
Banner Image
-
-
-
- Upload
-
-
-
-
-
-
-
-
-
- <% } %>
-
-
-
-
-
-
-
- Activity Name *
-
-
-
-
-
Price (USD) *
-
- $
-
-
-
-
-
- Price Text
-
- Leave empty to auto-generate
-
-
-
-
Link/URL Slug
-
- /
-
-
-
-
-
- Program Code
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Available Locations
-
- <% const allLocations=['vietnam', 'thailand' , 'philippines' , 'malaysia' , 'china'
- , 'portugal' ]; %>
- <% allLocations.forEach(loc=> { %>
-
-
- >
-
-
- <%= loc %>
-
-
-
- <% }) %>
-
-
-
-
- Or add custom locations (comma separated)
-
-
-
-
-
-
-
-
-
-
-
-
- Image Path
-
- Path to the main activity image (used in listings)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Hero Title
-
-
-
-
Hero Background Image
-
-
- Upload
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Location
-
-
-
- Age Range
- <%= (data.campDetail && data.campDetail.basicInfo && data.campDetail.basicInfo.ageRange) || '' %>
-
-
- Accommodation Type
-
-
-
- Care Level
-
-
-
- Languages
- <%= (data.campDetail && data.campDetail.basicInfo && data.campDetail.basicInfo.languages) || '' %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Main Gallery
-
-
-
-
-
-
-
Gallery Slides
-
-
-
- Add Slide
-
-
-
<%= JSON.stringify((data.campDetail && data.campDetail.mainGallery && data.campDetail.mainGallery.slides) || [], null, 2) %>
-
Use the editor above to manage slides. JSON is saved automatically.
-
-
- Overlay Location
-
-
-
- Overlay Season
-
-
-
- Overlay Languages
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Manage all camp sections with visual editors. Changes are automatically synchronized to JSON.
-
-
-
-
-
-
- Overview
-
-
-
-
- Location
-
-
-
-
- Accommodation
-
-
-
-
- Program
-
-
-
-
- Meals
-
-
-
-
- Team
-
-
-
-
- Insurance
-
-
-
-
-
-
-
-
-
-
-
-
-
- Introduction
- <%= (data.campDetail && data.campDetail.sections && data.campDetail.sections.overview && data.campDetail.sections.overview.intro) || '' %>
-
-
- Main Text
- <%= (data.campDetail && data.campDetail.sections && data.campDetail.sections.overview && data.campDetail.sections.overview.mainText) || '' %>
-
-
- Features Title
-
-
-
-
-
Feature Image
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Title
-
-
-
- Description
- <%= (data.campDetail && data.campDetail.sections && data.campDetail.sections.location && data.campDetail.sections.location.description) || '' %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Hero Image
-
-
-
-
-
-
-
-
- Title
-
-
-
- Subtitle
-
-
-
- Quote
-
-
-
- Main Heading
-
-
-
-
Introduction Text
-
-
-
- Add Intro Paragraph
-
-
-
-
-
Outro Text
-
-
-
- Add Outro Paragraph
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Hero Image
-
-
-
-
-
-
-
-
- Title
-
-
-
- Subtitle
-
-
-
- Quote
-
-
-
- Main Heading
-
-
-
-
Introduction Text
-
-
-
- Add Intro Paragraph
-
-
-
-
-
Outro Text
-
-
-
- Add Outro Paragraph
-
-
-
-
-
- Footer Text
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Title
-
-
-
- Description
- <%= (data.campDetail && data.campDetail.sections && data.campDetail.sections.meals && data.campDetail.sections.meals.description) || '' %>
-
-
-
- Footer Text
- <%= (data.campDetail && data.campDetail.sections && data.campDetail.sections.meals && data.campDetail.sections.meals.footer) || '' %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Hero Image
-
-
-
-
-
-
-
-
- Title
-
-
-
- Subtitle
-
-
-
- Quote
-
-
-
- Main Heading
-
-
-
-
Introduction Text
-
-
-
- Add Intro Paragraph
-
-
-
-
- Footer Text
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Title
-
-
-
- Description
- <%= (data.campDetail && data.campDetail.sections && data.campDetail.sections.insurance && data.campDetail.sections.insurance.description) || '' %>
-
-
-
-
-
-
Insurance Package
-
-
- Package Title
-
-
-
- Package Description
- <%= (data.campDetail && data.campDetail.sections && data.campDetail.sections.insurance && data.campDetail.sections.insurance.package && data.campDetail.sections.insurance.package.desc) || '' %>
-
-
-
Package Items
-
-
-
- Add Package Item
-
-
-
-
-
-
-
-
-
-
-
Cancellation Policy
-
-
- Cancellation Title
-
-
-
- Cancellation Description
- <%= (data.campDetail && data.campDetail.sections && data.campDetail.sections.insurance && data.campDetail.sections.insurance.cancellation && data.campDetail.sections.insurance.cancellation.desc) || '' %>
-
-
-
Cancellation Items
-
-
-
- Add Cancellation Item
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<%= JSON.stringify((data.campDetail && data.campDetail.sections) || (data['camp-detail'] && data['camp-detail'].sections) || {}, null, 2) %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
No booking sessions yet. Click "Add Session" to create one.
-
-
-
<%= JSON.stringify(data.bookingSessions || []) %>
-
-
-
- <% if (isEdit && data._id) { %>
-
-
-
-
-
-
-
Booking Statistics
-
Overview of all booking submissions for this activity
-
-
-
- Export CSV
-
-
- Refresh
-
-
-
-
-
-
-
-
-
-
Sessions Breakdown
-
-
-
-
-
-
-
-
-
- All Status
- Pending
- Confirmed
- Cancelled
- Completed
-
-
-
-
- All Sessions
-
-
-
-
-
- All Payment Status
- Payment Pending
- Partial Payment
- Paid
- Refunded
-
-
-
-
-
-
-
-
-
-
-
-
- Date
- Session
- Participant
- Parent/Guardian
- Contact
- Gender/Age
- Status
- Payment
- Actions
-
-
-
-
-
- Loading bookings...
-
-
-
-
-
-
-
-
-
-
- <% } %>
-
-
-
-
- Reset
-
-
- Save Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Are you sure you want to delete the booking for " "?
-
This action cannot be undone.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <%
- // Hiển thị camp image: data.image và campDetail.hero.bgImage luôn đồng bộ
- // Ưu tiên data.image (main field), fallback campDetail/camp-detail hero bgImage
- let tipImg = (data && data.image) || (data && data.campDetail && data.campDetail.hero && data.campDetail.hero.bgImage) || (data && data['camp-detail'] && data['camp-detail'].hero && data['camp-detail'].hero.bgImage) || '/images/placeholder.png';
- let tipImgSrc = (tipImg && tipImg.startsWith && (tipImg.startsWith('http') || tipImg.startsWith('/'))) ? tipImg : ('/uploads/activity/' + tipImg);
- %>
-
-
-
-
-
- Upload
-
-
Camp image (synchronized with camp record)
-
-
-
- <% if (isEdit) { %>
-
-
-
-
- Display Order
-
- Lower numbers appear first
-
-
-
-
Status
-
-
-
-
- >
- Active
-
-
-
-
-
-
- ID:
- <%= data._id %>
-
- <% if (data.createdAt) { %>
-
- Created:
-
- <%= new Date(data.createdAt).toLocaleDateString('vi-VN') %>
-
-
- <% } %>
- <% if (data.updatedAt) { %>
-
- Updated:
-
- <%= new Date(data.updatedAt).toLocaleDateString('vi-VN') %>
-
-
- <% } %>
-
-
-
- <% } %>
-
-
-
-
-
\ No newline at end of file
diff --git a/views/admin/activity/index.ejs b/views/admin/activity/index.ejs
deleted file mode 100644
index acae846..0000000
--- a/views/admin/activity/index.ejs
+++ /dev/null
@@ -1,1684 +0,0 @@
-
-
-
-
- <%= title %>
-
-
Manage camp activities and programs
-
-
-
-
-
-
-
-
- Activities List
-
-
-
-
- Filter Settings
-
-
-
-
- All Bookings
- <%= allBookingsStats ? allBookingsStats.total : 0 %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Total Activities
-
- <%= pagination.total %>
-
-
-
-
-
-
-
-
-
-
-
-
-
Active
-
- <%= typeof activeCount !== 'undefined' ? activeCount : (items.filter(i => i.isActive).length) %>
-
-
-
-
-
-
-
-
-
-
-
-
-
Inactive
-
- <%= (typeof activeCount !== 'undefined' && typeof pagination !== 'undefined') ? (pagination.total - activeCount) : items.filter(i => !i.isActive).length %>
-
-
-
-
-
-
-
-
-
-
-
-
-
Pages
-
- <%= pagination.totalPages %>
-
-
-
-
-
-
-
-
-
- <% if (items && items.length > 0 && items[0].hero) { %>
-
-
-
-
-
-
-
-
-
Activities Hero
-
Banner Image
-
-
-
- Upload
-
-
-
Title
-
-
-
-
Booking Hero
-
Banner Image
-
-
-
- Upload
-
-
-
Title
-
-
-
-
-
-
-
- <% if (items[0].hero && (items[0].hero.bannerImageActivities || items[0].hero.bannerImage)) { %>
-
- <% } %>
-
-
-
-
- <% if (items[0].hero && (items[0].hero.bannerImageBooking || items[0].hero.bannerImage)) { %>
-
- <% } %>
-
-
-
-
-
-
-
-
-
- Reset
-
-
- Save Changes
-
-
-
-
-
-
-
- <% } %>
-
-
-
-
-
- <% if (items && items.length> 0) { %>
-
-
-
- <% if (pagination.totalPages> 1) { %>
-
- <% } %>
-
- <% } else { %>
-
-
-
No activities found
-
Get started by creating your first activity
-
- Add First Activity
-
-
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
- <% if (filters && filters.length > 0) { %>
- <% filters.forEach((f, idx) => { %>
-
-
-
-
-
-
-
-
-
-
-
- Filter Options
-
- Add Option
-
-
-
-
-
-
- <% (f.items || []).forEach((item, itemIdx) => { %>
-
- <% }) %>
-
-
-
-
-
<%= JSON.stringify(f.items || []) %>
-
-
- <% }) %>
- <% } %>
-
-
- <% if (!filters || filters.length === 0) { %>
-
- No filters configured yet.
-
- <% } %>
-
-
-
-
- Save Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<%= allBookingsStats ? allBookingsStats.total : 0 %>
- Total Bookings
-
-
-
-
-
-
-
-
<%= allBookingsStats ? allBookingsStats.confirmed : 0 %>
- Confirmed
-
-
-
-
-
-
-
-
<%= allBookingsStats ? allBookingsStats.pending : 0 %>
- Pending
-
-
-
-
-
-
-
-
<%= allBookingsStats ? allBookingsStats.cancelled : 0 %>
- Cancelled
-
-
-
-
-
-
-
-
<%= allBookingsStats ? allBookingsStats.completed : 0 %>
- Completed
-
-
-
-
-
-
-
-
$<%= allBookingsStats ? allBookingsStats.totalRevenue.toLocaleString() : 0 %>
- Revenue
-
-
-
-
-
-
-
-
-
- <% if (allBookings && allBookings.length > 0) { %>
-
-
-
-
- #
- Date
- Activity
- Session
- Participant
- Parent/Guardian
- Contact
- Gender/Age
- Status
- Payment
- Actions
-
-
-
- <% allBookings.forEach((booking, index) => { %>
-
- <%= index + 1 %>
-
- <%= new Date(booking.createdAt).toLocaleDateString('en-GB', {day:'2-digit', month:'short', year:'2-digit'}) %>
-
-
- <% if (booking.activityId) { %>
-
- <%= booking.activityId.name %>
-
- <% } else { %>
- Unknown
- <% } %>
-
-
-
- <%= booking.sessionId ? booking.sessionId.substring(0, 15) + '...' : '-' %>
-
-
-
- <%= booking.participantFirstName %> <%= booking.participantLastName %>
-
- DOB: <%= new Date(booking.participantBirthDate).toLocaleDateString('en-GB') %>
-
-
-
- <%= booking.parentFirstName %> <%= booking.parentLastName %>
-
-
- <%= booking.email %>
- <%= booking.phone %>
-
-
-
- <%= booking.participantGender %>
-
- <%
- const today = new Date();
- const birth = new Date(booking.participantBirthDate);
- let age = today.getFullYear() - birth.getFullYear();
- const monthDiff = today.getMonth() - birth.getMonth();
- if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) age--;
- %>
- <%= age %>y
-
-
-
- <%= booking.status %>
-
-
-
-
- <%= booking.paymentStatus %>
-
-
-
-
- <% if (booking.activityId) { %>
-
-
-
- <% } %>
-
-
-
-
-
-
- <% }) %>
-
-
-
- <% } else { %>
-
-
-
No bookings yet
-
Booking submissions will appear here when customers book activities.
-
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Are you sure you want to delete " "?
-
This action cannot be undone.
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/views/admin/appointment/index.ejs b/views/admin/appointment/index.ejs
deleted file mode 100644
index 707fba1..0000000
--- a/views/admin/appointment/index.ejs
+++ /dev/null
@@ -1,791 +0,0 @@
-
-
-
-
- <%= title %>
-
-
Edit content displayed on Appointment page
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Hero Section
-
-
-
Background Image
-
-
-
- Upload
-
-
-
Recommended size: 1920x1080px
-
-
-
- <% if (data.hero?.backgroundImage) { %>
- <% let heroImgSrc=data.hero.backgroundImage; if (heroImgSrc &&
- !heroImgSrc.startsWith('http://') &&
- !heroImgSrc.startsWith('https://')) {
- heroImgSrc=heroImgSrc.startsWith('/') ? heroImgSrc : '/' +
- heroImgSrc; } %>
-
-
- Image preview
-
- <% } else { %>
-
- Image preview
-
- <% } %>
-
-
-
-
-
- Title
-
-
-
- Subtitle
-
-
-
- Heading
-
-
-
- Description
- <%= data.hero?.description || '' %>
-
-
-
-
-
-
-
-
-
-
-
-
Visa Options
-
- Add Option
-
-
-
These options will appear in the visa type selection
- dropdown on the appointment form.
-
- <% if (data.visaOptions && data.visaOptions.length> 0) { %>
- <% data.visaOptions.forEach((option, index)=> { %>
-
-
-
-
-
-
-
- <% }); %>
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Recent Submissions
-
-
-
-
-
-
- Start Date
-
-
-
- End Date
-
-
-
-
- Filter
-
-
-
-
-
-
-
-
-
- Date
- Name
- Contact
- Appt Date
- Visa Types
- Message
- Status
- Action
-
-
-
- <% if (locals.submissions && submissions.length> 0) { %>
- <% submissions.forEach(submission=> { %>
-
-
- <%= new
- Date(submission.createdAt).toLocaleDateString()
- %>
-
-
- <%= new
- Date(submission.createdAt).toLocaleTimeString([],
- {hour: '2-digit' , minute:'2-digit'}) %>
-
-
-
- <%= submission.name %>
-
-
-
-
-
- <%= submission.appointmentDate || '-' %>
-
-
- <% if (submission.visaTypes &&
- submission.visaTypes.length> 0) { %>
- <% submission.visaTypes.forEach(type=> { %>
-
- <%= type %>
-
- <% }); %>
- <% } else { %>
- -
- <% } %>
-
-
- <% if (submission.message) { %>
-
- <%= submission.message %>
-
- <% } else { %>
- -
- <% } %>
-
-
- <% let statusClass='bg-secondary' ;
- if(submission.status==='pending' )
- statusClass='bg-warning text-dark' ;
- if(submission.status==='confirmed' )
- statusClass='bg-success' ;
- if(submission.status==='completed' )
- statusClass='bg-info text-dark' ;
- if(submission.status==='cancelled' )
- statusClass='bg-danger' ; %>
-
- <%= submission.status %>
-
-
-
-
-
-
-
-
- <% }); %>
- <% } else { %>
-
- No
- submissions found
-
- <% } %>
-
-
-
-
- Showing last 50 submissions
-
-
-
-
-
-
-
-
-
-
-
- Reset
-
-
- Save Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Status
-
- Pending
- Confirmed
- Completed
- Cancelled
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/views/admin/audit-log/index.ejs b/views/admin/audit-log/index.ejs
index 1d18749..c83325f 100644
--- a/views/admin/audit-log/index.ejs
+++ b/views/admin/audit-log/index.ejs
@@ -1,699 +1,243 @@
-
-
-
-
- <%= title %>
-
-
System activity and change tracking
+
+
+
+
Audit Logs
+
System activity and change tracking
+
+
+ Cleanup Old Logs
+
+
+
+
+
+
+
+
+
+ Model
+
+ All Models
+ <% uniqueModels.forEach(model => { %>
+ ><%= model %>
+ <% }); %>
+
-
-
- Cleanup Old Logs
-
+
+ Action
+
+ All Actions
+ <% uniqueActions.forEach(action => { %>
+ ><%= action %>
+ <% }); %>
+
-
-
-
-
-
-
-
- Model
-
- All Models
- <% uniqueModels.forEach(model => { %>
- >
- <%= model %>
-
- <% }); %>
-
-
-
- Action
-
- All Actions
- <% uniqueActions.forEach(action => { %>
- >
- <%= action %>
-
- <% }); %>
-
-
-
- User
-
- All Users
- <% users.forEach(user => { %>
- >
- <%= user.username %>
-
- <% }); %>
-
-
-
- From Date
-
-
-
- To Date
-
-
-
- Items per page
-
- >5 items
- >7 items
- >10 items
- >15 items
- >20 items
-
-
-
-
+
+ User
+
+ All Users
+ <% users.forEach(u => { %>
+ ><%= u.username %>
+ <% }); %>
+
-
+
+ From Date
+
+
+
+ To Date
+
+
+
+ Per page
+
+ >8
+ >15
+ >25
+
+
+
+
+
+
+
-
-
-
- <% if (auditLogs && auditLogs.length > 0) { %>
-
-
-
-
-
- Showing <%= ((pagination.current - 1) * pagination.limit) + 1 %> -
- <%= Math.min(pagination.current * pagination.limit, pagination.totalCount) %>
- of <%= pagination.totalCount %> audit logs
- <% if (pagination.totalCount > pagination.limit) { %>
-
- <%= pagination.total %> pages
-
- <% } %>
-
-
+
+
+
+
+ <% if (auditLogs && auditLogs.length > 0) { %>
+
+
+
+
+ Date / Time
+ Model
+ Action
+ User
+ Changes
+ IP Address
+ Details
+
+
+
+ <% auditLogs.forEach(log => { %>
+
+
+ <%= new Date(log.createdAt).toLocaleDateString('en-GB') %>
+ <%= new Date(log.createdAt).toLocaleTimeString() %>
+
+ <%= log.model %>
+
+ <%
+ let badgeClass = 'badge-soft-primary';
+ if (log.action.includes('CREATE')) badgeClass = 'bg-soft-success';
+ else if (log.action.includes('UPDATE')) badgeClass = 'bg-soft-warning';
+ else if (log.action.includes('DELETE')) badgeClass = 'bg-soft-danger';
+ %>
+ <%= log.action %>
+
+
+ <% if (log.performedBy) { %>
+ <%= log.performedBy.username %>
+ <%= log.performedBy.email %>
+ <% } else { %>
+ System
+ <% } %>
+
+
+ <% if (log.changes && log.changes.length > 0) { %>
+ <%= log.changes.length %> field<%= log.changes.length > 1 ? 's' : '' %>
+
+ <% log.changes.slice(0, 2).forEach(change => { %>
+
<%= change.field %>
+ <% }); %>
+ <% if (log.changes.length > 2) { %>
+
+<%= log.changes.length - 2 %> more
+ <% } %>
-
-
+ <% } else { %>
+ —
+ <% } %>
+
+ <%= log.ipAddress %>
+
+
+
+
+
+
+ <% }); %>
+
+
+
-
-
-
-
-
- Date/Time
- Model
- Action
- User
- Changes
- IP Address
- Actions
-
-
-
- <% auditLogs.forEach((log, index) => { %>
-
-
-
- <%= new Date(log.createdAt).toLocaleDateString() %>
- <%= new Date(log.createdAt).toLocaleTimeString() %>
-
-
-
-
- <%= log.model %>
-
-
-
- <%
- let actionStyle = 'background-color: var(--primary-color); color: white;';
- if (log.action.includes('CREATE')) actionStyle = 'background-color: #28a745; color: white;';
- else if (log.action.includes('UPDATE')) actionStyle = 'background-color: #ffc107; color: #212529;';
- else if (log.action.includes('DELETE')) actionStyle = 'background-color: #dc3545; color: white;';
- %>
-
- <%= log.action %>
-
-
-
- <% if (log.performedBy) { %>
-
- <%= log.performedBy.username %>
- <%= log.performedBy.email %>
-
- <% } else { %>
- System
- <% } %>
-
-
- <% if (log.changes && log.changes.length > 0) { %>
-
- <%= log.changes.length %> field<%= log.changes.length > 1 ? 's' : '' %>
-
-
- <% log.changes.slice(0, 3).forEach(change => { %>
-
- <%= change.field %>
-
- <% }); %>
- <% if (log.changes.length > 3) { %>
-
- +<%= log.changes.length - 3 %> more...
-
- <% } %>
-
- <% } else { %>
- -
- <% } %>
-
-
-
- <%= log.ipAddress %>
-
-
-
-
-
-
- <% }); %>
-
-
-
-
-
-
- <% auditLogs.forEach((log, index) => { %>
-
-
-
-
-
- <%
- let actionStyle = 'background-color: var(--primary-color); color: white;';
- if (log.action.includes('CREATE')) actionStyle = 'background-color: #28a745; color: white;';
- else if (log.action.includes('UPDATE')) actionStyle = 'background-color: #ffc107; color: #212529;';
- else if (log.action.includes('DELETE')) actionStyle = 'background-color: #dc3545; color: white;';
- %>
-
- <%= log.action %>
-
-
- <%= new Date(log.createdAt).toLocaleTimeString() %>
-
-
-
-
-
User:
- <% if (log.performedBy) { %>
-
<%= log.performedBy.username %>
-
<%= log.performedBy.email %>
- <% } else { %>
-
System
- <% } %>
-
-
- <% if (log.changes && log.changes.length > 0) { %>
-
-
Changes:
-
- <%= log.changes.length %> field<%= log.changes.length > 1 ? 's' : '' %>
-
-
- <% log.changes.slice(0, 2).forEach(change => { %>
-
- • <%= change.field %>
-
- <% }); %>
- <% if (log.changes.length > 2) { %>
-
- +<%= log.changes.length - 2 %> more...
-
- <% } %>
-
-
- <% } %>
-
-
-
- IP: <%= log.ipAddress %>
-
-
-
-
-
-
- <% }); %>
-
-
-
- <% if (pagination && pagination.total > 1) { %>
-
-
-
-
-
-
- Page <%= pagination.current %> of <%= pagination.total %>
- (showing <%= ((pagination.current - 1) * pagination.limit) + 1 %> -
- <%= Math.min(pagination.current * pagination.limit, pagination.totalCount) %>
- of <%= pagination.totalCount %> total items)
-
-
-
+
+ <% if (pagination && pagination.total > 1) { %>
+
+
+ Showing <%= ((pagination.current - 1) * pagination.limit) + 1 %>–<%= Math.min(pagination.current * pagination.limit, pagination.totalCount) %> of <%= pagination.totalCount %>
+
+
+
+
-
+ <% } %>
+
+ <% } else { %>
+
+
+
No audit logs found
+
No activity matches your current filters.
+
Clear Filters
+
+ <% } %>
+
-
-
-
-
-
-
-
-
Delete audit logs older than the specified number of days.
-
-
Keep logs for (days):
-
-
Recommended: 90 days for compliance
-
-
-
- Warning: This action cannot be undone. Deleted audit logs will be permanently removed.
-
-
-
-
+
+
+
+
+
+
+ Cleanup Old Audit Logs
+
+
+
+
+
Delete audit logs older than the specified number of days.
+
+
Keep logs for (days)
+
+
Recommended: 90 days for compliance
+
+
+
+ This action cannot be undone. Deleted logs will be permanently removed.
+
+
+
+ Cancel
+ Cleanup
+
+
+
-
-
-.pagination .page-item.active .page-link {
- background-color: var(--primary-color) !important;
- border-color: var(--primary-color) !important;
- color: #fff !important;
- z-index: 3;
- font-weight: 600;
-}
-
-.pagination .page-link:hover {
- color: var(--primary-color) !important;
- background-color: #f8f9fa !important;
- border-color: var(--primary-color) !important;
- text-decoration: none;
-}
-
-.pagination .page-link:focus {
- color: var(--primary-color) !important;
- background-color: #f8f9fa !important;
- border-color: var(--primary-color) !important;
- box-shadow: 0 0 0 0.2rem rgba(var(--primary-color-rgb), 0.25);
- outline: 0;
-}
-
-.pagination .page-item.disabled .page-link {
- color: #6c757d !important;
- background-color: #fff !important;
- border-color: #dee2e6 !important;
-}
-
-/* Ensure pagination text is always visible */
-.pagination .page-link span,
-.pagination .page-link {
- display: inline-block;
- line-height: 1.25;
-}
-
-/* Custom Modal Styles */
-.custom-modal {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 1050;
-}
-
-.custom-modal-overlay {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.5);
-}
-
-.custom-modal-content {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- background-color: white;
- border-radius: 8px;
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
- width: 90%;
- max-width: 500px;
- max-height: 90vh;
- overflow-y: auto;
-}
-
-.custom-modal-header {
- padding: 1rem 1.5rem;
- border-bottom: 1px solid #dee2e6;
- background-color: #fff3cd;
- border-radius: 8px 8px 0 0;
- display: flex;
- justify-content: between;
- align-items: center;
-}
-
-.custom-modal-title {
- margin: 0;
- font-size: 1.1rem;
- font-weight: 600;
- color: #856404;
- flex: 1;
-}
-
-.custom-modal-close {
- background: none;
- border: none;
- font-size: 1.2rem;
- color: #856404;
- cursor: pointer;
- padding: 0;
- width: 30px;
- height: 30px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- transition: background-color 0.2s;
-}
-
-.custom-modal-close:hover {
- background-color: rgba(133, 100, 4, 0.1);
-}
-
-.custom-modal-body {
- padding: 1.5rem;
-}
-
-.custom-modal-footer {
- padding: 1rem 1.5rem;
- border-top: 1px solid #dee2e6;
- background-color: #f8f9fa;
- border-radius: 0 0 8px 8px;
- display: flex;
- justify-content: flex-end;
- gap: 0.5rem;
-}
-
-/* Card View Improvements - Using CSS Grid for better control */
-#cardViewContent {
- display: none !important;
- visibility: hidden !important;
- grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
- gap: 1.5rem;
- padding: 0;
- margin: 0;
-}
-
-#cardViewContent.active {
- display: grid !important;
- visibility: visible !important;
-}
-
-#cardViewContent .card {
- transition: transform 0.2s, box-shadow 0.2s;
- width: 100% !important;
- margin: 0 !important;
-}
-
-#cardViewContent .card:hover {
- transform: translateY(-2px);
- box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
-}
-
-#cardViewContent .card-header {
- background-color: #f8f9fa !important;
- border-bottom: 1px solid #dee2e6;
-}
-
-#cardViewContent .card-footer {
- background-color: #f8f9fa !important;
- border-top: 1px solid #dee2e6;
-}
-
-/* Table View */
-#tableViewContent {
- display: block;
-}
-
-#tableViewContent.hidden {
- display: none !important;
-}
-
-/* Responsive grid adjustments */
-@media (max-width: 1400px) {
- #cardViewContent {
- grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
- }
-}
-
-@media (max-width: 1200px) {
- #cardViewContent {
- grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
- }
-}
-
-@media (max-width: 992px) {
- #cardViewContent {
- grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
- }
-}
-
-@media (max-width: 768px) {
- #cardViewContent {
- grid-template-columns: 1fr !important;
- gap: 1rem !important;
- }
-
- .custom-modal-content {
- width: 95%;
- margin: 1rem;
- }
-}
-
\ No newline at end of file
+
diff --git a/views/admin/audit-log/show.ejs b/views/admin/audit-log/show.ejs
index 75b200c..653b66c 100644
--- a/views/admin/audit-log/show.ejs
+++ b/views/admin/audit-log/show.ejs
@@ -1,314 +1,161 @@
-
-
-
-
- <%= title %>
-
-
Detailed audit log information
-
-
-
-
-
-
-
-
-
-
-
-
-
- Model:
- <%= auditLog.model %>
-
-
- Action:
- <%
- let actionStyle = 'background-color: var(--primary-color); color: white;';
- if (auditLog.action.includes('CREATE')) actionStyle = 'background-color: #28a745; color: white;';
- else if (auditLog.action.includes('UPDATE')) actionStyle = 'background-color: #ffc107; color: #212529;';
- else if (auditLog.action.includes('DELETE')) actionStyle = 'background-color: #dc3545; color: white;';
- %>
- <%= auditLog.action %>
-
-
- Document ID:
- <%= auditLog.documentId %>
-
-
-
-
-
Date & Time:
-
- <%= new Date(auditLog.createdAt).toLocaleDateString() %>
- <%= new Date(auditLog.createdAt).toLocaleTimeString() %>
-
-
-
-
User:
-
- <% if (auditLog.performedBy) { %>
- <%= auditLog.performedBy.username %>
- <%= auditLog.performedBy.email %>
- <% } else { %>
- System
- <% } %>
-
-
-
- IP Address:
- <%= auditLog.ipAddress %>
-
-
-
-
- <% if (auditLog.userAgent) { %>
-
-
User Agent:
-
- <%= auditLog.userAgent %>
-
-
- <% } %>
-
-
-
-
- <% if (auditLog.changes && auditLog.changes.length > 0) { %>
-
-
-
- <% if (user && (user.role === 'admin' || user.role === 'superadmin')) { %>
-
-
-
-
- Field
- Before
- After
-
-
-
- <% auditLog.changes.forEach((change, index) => { %>
-
-
- <%= change.field %>
-
-
-
- <% if (change.before === null || change.before === undefined) { %>
-
null
- <% } else if (typeof change.before === 'object') { %>
-
<%= JSON.stringify(change.before, null, 2) %>
- <% } else { %>
- <%= change.before %>
- <% } %>
-
-
-
-
- <% if (change.after === null || change.after === undefined) { %>
-
null
- <% } else if (typeof change.after === 'object') { %>
-
<%= JSON.stringify(change.after, null, 2) %>
- <% } else { %>
- <%= change.after %>
- <% } %>
-
-
-
- <% }); %>
-
-
-
- <% } else { %>
-
-
- Summary View: Detailed field values are restricted to administrators.
-
-
-
-
-
- Field
- Status
-
-
-
- <% auditLog.changes.forEach((change, index) => { %>
-
-
- <%= change.field %>
-
-
- Modified
-
-
- <% }); %>
-
-
-
- <% } %>
-
-
- <% } %>
-
-
-
-
-
-
-
-
-
- <%= auditLog.changes ? auditLog.changes.length : 0 %>
-
-
Fields Changed
-
-
-
-
- <%= new Date(auditLog.createdAt).toLocaleDateString() === new Date().toLocaleDateString() ? 'Today' : 'Past' %>
-
-
Timing
-
-
-
-
-
-
-
-
-
+
+
+
+
Audit Log Details
+
Detailed activity record
+
+
+ Back
+
-
\ No newline at end of file
+
diff --git a/views/admin/blog/create.ejs b/views/admin/blog/create.ejs
deleted file mode 100644
index 139081b..0000000
--- a/views/admin/blog/create.ejs
+++ /dev/null
@@ -1,1065 +0,0 @@
-
-
-
-
- <%= title %>
-
-
Create a new blog post
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Featured
- Image *
-
-
-
- Upload
-
-
-
Upload a featured image for this blog post or
- enter image URL.
- Recommended size: 852 x 400 px
-
-
-
-
-
-
-
-
-
Title *
-
-
The title will be used to generate the URL slug
- automatically.
-
-
-
-
-
-
-
Content *
-
-
-
Write the main content of the blog post using the
- editor.
-
-
-
-
-
-
-
Gallery Images *
-
Exactly 2 images required (row, 2 columns)
- Recommended size: 410 x 264 px each
-
-
-
-
-
-
-
-
-
Quote/Sidebar
-
-
This will be displayed as a highlighted quote in
- the blog post.
-
-
-
-
-
-
-
Content
- After Quote
-
-
-
Content that appears after the quote section.
-
-
-
-
-
-
-
-
Excerpt *
-
-
- 0 /500 characters
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Categories
-
-
-
- Add
-
-
-
-
Select one or more categories for this blog post.
-
-
-
-
-
Tags
-
-
-
- Add
-
-
-
-
Select one or more tags for this blog post.
-
-
-
-
-
-
-
-
-
-
-
-
- Author
-
-
-
-
- Status
-
- Published
- Draft
-
-
-
-
-
-
-
- Mark as Featured Post
-
-
-
Featured posts can be highlighted on the blog page.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Are you sure you want to delete the category " "?
-
-
- This action cannot be undone.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Are you sure you want to delete the tag " "?
-
-
- This action cannot be undone.
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/views/admin/blog/edit.ejs b/views/admin/blog/edit.ejs
deleted file mode 100644
index f9528c8..0000000
--- a/views/admin/blog/edit.ejs
+++ /dev/null
@@ -1,1776 +0,0 @@
-
-
-
-
- <%= title %>
-
-
Edit blog post
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Featured
- Image *
-
-
-
- Upload
-
-
-
Upload a new featured image or enter image URL.
- Recommended size: 852 x 400 px
-
-
- <% if (blog.featuredImage) { %>
-
- <% } %>
-
-
-
-
-
-
-
-
Title *
-
-
The title will be used to generate the URL slug
- automatically.
-
-
-
-
-
-
-
Content *
-
-
-
Write the main content of the blog post using the
- editor.
-
-
-
-
-
-
-
Gallery Images *
-
Exactly 2 images required (row, 2 columns)
- Recommended size: 410 x 264 px each
-
-
- <% const galleryImages=blog.galleryImages || []; const
- image1=galleryImages[0] || '' ; const image2=galleryImages[1]
- || '' ; %>
-
-
-
-
- Upload
-
-
-
- <% if (image1) { %>
-
- <% } %>
-
-
-
-
-
-
- Upload
-
-
-
- <% if (image2) { %>
-
- <% } %>
-
-
-
-
-
-
-
-
-
-
Quote/Sidebar
-
<%= blog.quote || '' %>
-
This will be displayed as a highlighted quote in
- the blog post.
-
-
-
-
-
-
-
Content
- After Quote
-
-
-
Content that appears after the quote section.
-
-
-
-
-
-
-
-
Excerpt *
-
<%= blog.excerpt || '' %>
-
-
- <%= (blog.excerpt || '' ).length %>
- /500 characters
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Categories
-
-
-
- Add
-
-
-
-
Select one or more categories for this blog post.
-
-
-
-
-
-
Tags
-
-
-
- Add
-
-
-
-
Select one or more tags for this blog post.
-
-
-
-
-
-
-
-
-
-
-
-
- Author
-
-
-
-
- Status
-
- >Published
-
- >Draft
-
-
-
-
-
- >
-
- Mark as Featured Post
-
-
-
Featured posts can be highlighted on the blog
- page.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Are you sure you want to delete the category " "?
-
-
-
- This action cannot be undone.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Are you sure you want to delete the tag " "?
-
-
- This action cannot be undone.
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/views/admin/blog/index.ejs b/views/admin/blog/index.ejs
deleted file mode 100644
index 53257f2..0000000
--- a/views/admin/blog/index.ejs
+++ /dev/null
@@ -1,300 +0,0 @@
-
-
-
-
- <%= title %>
-
-
Manage blog posts and articles
-
-
-
-
-
-
-
-
-
- Search
-
-
-
- Status
-
- All
- >Published
- >Draft
-
-
-
- Category
-
- All Categories
- <% categories.forEach(cat=> { %>
- >
- <%= cat.name %>
-
- <% }); %>
-
-
-
-
-
- Filter
-
-
-
-
-
-
-
-
-
-
- <% if (blogs && blogs.length> 0) { %>
-
-
-
-
- Image
- Title
- Category
- Status
- Author
- Published
- Actions
-
-
-
- <% blogs.forEach((blog, index)=> { %>
-
-
- <% if (blog.featuredImage) { %>
-
- <% } else { %>
-
-
-
- <% } %>
-
-
-
-
- <%= blog.title %>
-
- <% if (blog.isFeatured) { %>
- Featured
- <% } %>
-
-
- <%= blog.excerpt.substring(0, 60) %>...
-
-
-
- <% if (blog.category && blog.category.length> 0) { %>
- <% blog.category.slice(0, 2).forEach(cat=> { %>
-
- <%= cat %>
-
- <% }); %>
- <% if (blog.category.length> 2) { %>
- +<%= blog.category.length - 2 %>
- <% } %>
- <% } else { %>
- -
- <% } %>
-
-
- <% if (blog.status==='published' ) { %>
- Published
- <% } else { %>
- Draft
- <% } %>
-
-
- <%= blog.author || 'Admin' %>
-
-
- <%= blog.publishedAt || '-' %>
-
-
-
- <% if (typeof frontendUrl !=='undefined' ) { %>
-
- View
-
- <% } %>
-
- Edit
-
-
- Delete
-
-
-
-
- <% }); %>
-
-
-
-
-
- <% if (pagination && pagination.total> 1) { %>
-
-
-
- <% } %>
- <% } else { %>
-
-
-
No Blog Posts Found
-
- Create First Blog Post
-
-
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
Are you sure you want to delete the blog post " "?
-
-
-
- This action cannot be
- undone.
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/views/admin/booking/index.ejs b/views/admin/booking/index.ejs
deleted file mode 100644
index 0c86370..0000000
--- a/views/admin/booking/index.ejs
+++ /dev/null
@@ -1,2034 +0,0 @@
-
-
-
-
Booking Management
-
Edit content displayed on Booking page
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Background Image
-
-
-
- Upload
-
-
-
-
- <% if (data.hero?.backgroundImage) { %>
-
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Manage Locations
-
- Add Location
-
-
-
- <% if (data.locations && data.locations.length > 0) { %>
- <% data.locations.forEach((location, index) => { %>
-
-
-
-
- Remove Location
-
-
-
- <% }); %>
- <% } %>
-
-
-
-
-
-
-
Manage Holiday Seasons
-
- Add Holiday
-
-
-
- <% if (data.holidays && data.holidays.length > 0) { %>
- <% data.holidays.forEach((holiday, index) => { %>
-
- <% }); %>
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Price Settings
-
-
-
-
Age Settings
-
-
-
-
Other Settings
-
-
-
-
-
Rating Options
-
- Add Rating Option
-
-
-
-
- <% if (data.filterPanel?.ratingOptions && data.filterPanel.ratingOptions.length > 0) { %>
- <% data.filterPanel.ratingOptions.forEach((option, index) => { %>
-
- <% }); %>
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
-
Programs
-
- Add Program
-
-
-
- <% if (data.programs && data.programs.length > 0) { %>
- <% data.programs.forEach((program, index) => { %>
-
- <% }); %>
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
Camps
-
- Add Camp
-
-
-
- <% if (data.camps && data.camps.length > 0) { %>
- <% data.camps.forEach((camp, index) => { %>
-
-
-
-
- Name
-
-
-
- Price
-
-
-
- Price Text
-
-
-
- Season (comma separated)
-
-
-
- Age (comma separated)
-
-
-
- Locations (comma
- separated)
-
-
-
- Program
-
-
-
- Rating
-
-
-
- Link
-
-
-
-
Image
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Remove Camp
-
-
-
- <% }); %>
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Reset
-
- >
- Save Changes
-
-
- <% if (!data || !data._id) { %>
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/views/admin/certificate/create.ejs b/views/admin/certificate/create.ejs
new file mode 100644
index 0000000..745904a
--- /dev/null
+++ b/views/admin/certificate/create.ejs
@@ -0,0 +1,107 @@
+
+
+
Create Certificate
+
Register a new certificate record
+
+
Back
+
+
+<% if (typeof error !== 'undefined' && error) { %>
+
+ <%= error %>
+
+<% } %>
+
+
+
+
+
+
+
+
+
+
+
+
+ Department *
+
+ -- Select --
+ <% departments.forEach(d => { %>
+ ><%= d.name %>
+ <% }); %>
+
+
+
+ Level *
+
+ -- Select --
+ <% levels.forEach(l => { %>
+ ><%= l.type %>
+ <% }); %>
+
+
+
+ Issue Date *
+
+
+
+ Status
+
+ Active
+ >Revoked
+
+
+
+
+
+
+
+
+
+
+
+
+
Create Certificate
+
Cancel
+
+
+
+
+
diff --git a/views/admin/certificate/edit.ejs b/views/admin/certificate/edit.ejs
new file mode 100644
index 0000000..4af2b51
--- /dev/null
+++ b/views/admin/certificate/edit.ejs
@@ -0,0 +1,107 @@
+
+
+
Edit Certificate
+
<%= cert.certification_number %>
+
+
Back
+
+
+<% if (typeof error !== 'undefined' && error) { %>
+
+ <%= error %>
+
+<% } %>
+
+
+
+
+
+
+
+
+
+
+
+
+ Department *
+
+ -- Select --
+ <% departments.forEach(d => { %>
+ ><%= d.name %>
+ <% }); %>
+
+
+
+ Level *
+
+ -- Select --
+ <% levels.forEach(l => { %>
+ ><%= l.type %>
+ <% }); %>
+
+
+
+ Issue Date *
+
+
+
+ Status
+
+ >Active
+ >Revoked
+
+
+
+
+
+
+
+
+
+
+
+
+ <% if (cert.certificate_image) { %>
+
+
+
+ <% } %>
+
+
Leave empty to keep current image.
+
+
+
+
+
+
diff --git a/views/admin/certificate/index.ejs b/views/admin/certificate/index.ejs
new file mode 100644
index 0000000..376f272
--- /dev/null
+++ b/views/admin/certificate/index.ejs
@@ -0,0 +1,102 @@
+
+
+
Certificates
+
Certificate records
+
+
+ New Certificate
+
+
+
+
+
+
+
+
+
+
+
+ All Status
+ >Active
+ >Revoked
+
+
+
+
+ <% if (query.search || query.status) { %>
+
+ <% } %>
+
+
+
+
+
+
+
+
+
+ <% if (certificates && certificates.length > 0) { %>
+
+
+
+
+ #
+ Certificate No.
+ Full Name
+ Program
+ Department
+ Level
+ Issue Date
+ Status
+ Actions
+
+
+
+ <% certificates.forEach((c, i) => { %>
+
+ <%= i + 1 %>
+ <%= c.certification_number %>
+ <%= c.student_name %>
+ <%= c.program_name %>
+ <%= c.department ? c.department.name : '—' %>
+ <%= c.level ? c.level.type : '—' %>
+ <%= c.issued_date ? new Date(c.issued_date).toLocaleDateString('en-GB') : '—' %>
+
+ <% if (c.status === 'active') { %>
+ Active
+ <% } else { %>
+ Revoked
+ <% } %>
+
+
+
+
+
+ <% }); %>
+
+
+
+ <% } else { %>
+
+
+
No certificates found
+
Create the first certificate record.
+
Create
+
+ <% } %>
+
+
diff --git a/views/admin/contact/index.ejs b/views/admin/contact/index.ejs
deleted file mode 100644
index ba96344..0000000
--- a/views/admin/contact/index.ejs
+++ /dev/null
@@ -1,1665 +0,0 @@
-
-
-
-
- <%= title %>
-
-
Edit content displayed on Contact Us page
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Background Image
-
-
-
- Upload
-
-
-
Recommended size: 1920x1080px
-
-
-
- <% if (data.hero?.backgroundImage) { %>
- <% let heroImgSrc=data.hero.backgroundImage; if (heroImgSrc &&
- !heroImgSrc.startsWith('http://') &&
- !heroImgSrc.startsWith('https://')) {
- heroImgSrc=heroImgSrc.startsWith('/') ? heroImgSrc : '/' +
- heroImgSrc; } %>
-
-
- Image preview
-
- <% } else { %>
-
- Image preview
-
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Map Settings
-
-
- Marker Title
-
-
-
- Location
-
- Enter address - map will be automatically
- shown
-
-
- Google Map Embed URL
-
- Paste embed URL from Google Maps (Share ->
- Embed a map)
-
-
-
- <% if (data.map?.embedUrl) { %>
-
-
- Location: <%=
- data.map?.markerTitle || data.map?.location
- || 'Location' %>
-
- <% } else if (data.map?.location && data.map?.coordinates?.lat
- && data.map?.coordinates?.lng) { %>
- <% var lat=data.map.coordinates.lat; var
- lng=data.map.coordinates.lng; var zoom=data.map.zoom ||
- 15; var markerTitle=data.map.markerTitle ||
- data.map.location; var zoomDelta={ 10: 0.1, 11: 0.05,
- 12: 0.025, 13: 0.0125, 14: 0.006, 15: 0.003, 16: 0.0015,
- 17: 0.00075, 18: 0.000375 }; var delta=zoomDelta[zoom]
- || 0.003; var latDelta=delta; var lngDelta=delta * 1.5;
- %>
-
-
- 📍 <%= markerTitle %>
-
-
- <% } else { %>
- Enter location above to see map preview
- <% } %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Recent Submissions
-
-
-
-
-
-
- Start Date
-
-
-
- End Date
-
-
-
-
- Filter
-
-
-
-
-
-
-
-
-
- Date
- Name
- Email
- Phone
- Message
- Status
- Action
-
-
-
- <% if (locals.submissions && submissions.length> 0) { %>
- <% submissions.forEach(submission=> { %>
-
-
- <%= new
- Date(submission.createdAt).toLocaleDateString()
- %>
- <%= new
- Date(submission.createdAt).toLocaleTimeString([],
- {hour: '2-digit' , minute:'2-digit'}) %>
-
-
- <%= submission.name %>
-
-
- <%= submission.email %>
-
-
- <%= submission.phone || '-' %>
-
-
-
- <%= submission.message %>
-
-
-
- <% let statusClass='bg-secondary' ;
- if(submission.status==='pending' )
- statusClass='bg-warning text-dark' ;
- if(submission.status==='read' )
- statusClass='bg-info text-dark' ;
- if(submission.status==='replied' )
- statusClass='bg-success' ;
- if(submission.status==='archived' )
- statusClass='bg-secondary' ; %>
-
- <%= submission.status %>
-
-
-
-
-
-
-
-
- <% }); %>
- <% } else { %>
-
- No
- submissions found
-
- <% } %>
-
-
-
-
- Showing last 50 submissions
-
-
-
-
-
-
-
-
-
-
-
- Reset
-
-
- Save Changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Status
-
- Pending
- Read
- Replied
- Archived
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/views/admin/dashboard.ejs b/views/admin/dashboard.ejs
index 8725c8f..7d5045c 100644
--- a/views/admin/dashboard.ejs
+++ b/views/admin/dashboard.ejs
@@ -1,456 +1,155 @@
-
-
Dashboard
+
+
+
+
Dashboard
+
ULDP Management System overview
+
+
+
-
-
-
<%= comment.authorName %>
- - <%= new Date(comment.createdAt).toLocaleString() %> - -<%= comment.content %>
-- Replies (<%= comment.replies.length %>) -
-