forked from UKSOURCE/cms.hailearning.edu.vn
feat: Implement core admin panel functionalities including appointment, contact, and pricing management with associated models, controllers, views, and routes.
This commit is contained in:
@@ -151,6 +151,52 @@ router.get(
|
||||
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(
|
||||
@@ -290,10 +336,10 @@ 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 => {
|
||||
@@ -307,7 +353,7 @@ router.get("/test-images", ensureAuthenticated, (req, res) => {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Locations images
|
||||
if (campLocationData.locations) {
|
||||
campLocationData.locations.forEach(location => {
|
||||
@@ -319,7 +365,7 @@ router.get("/test-images", ensureAuthenticated, (req, res) => {
|
||||
exists: fs.existsSync(path.join(__dirname, '../public', location.imageSrc))
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Program images
|
||||
if (location.programOptions) {
|
||||
location.programOptions.forEach(program => {
|
||||
@@ -335,7 +381,7 @@ router.get("/test-images", ensureAuthenticated, (req, res) => {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
res.render('admin/test-images', {
|
||||
layout: 'layouts/admin',
|
||||
title: 'Test Image Paths',
|
||||
|
||||
@@ -13,7 +13,7 @@ const safetyController = require("../controllers/safetyController");
|
||||
const campLocationController = require("../controllers/campLocationController");
|
||||
// Booking flow removed
|
||||
|
||||
const insuranceController= require("../controllers/insuranceController");
|
||||
const insuranceController = require("../controllers/insuranceController");
|
||||
const termsController = require("../controllers/termsController"); // <-- IMPORT ĐÃ CÓ
|
||||
const activityController = require("../controllers/activityController");
|
||||
const travelController = require("../controllers/travelController");
|
||||
@@ -50,6 +50,18 @@ router.get("/api/footer", footerController.api);
|
||||
// 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);
|
||||
@@ -71,14 +83,14 @@ 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(),
|
||||
|
||||
Reference in New Issue
Block a user