diff --git a/frontend/src/pages/TourDetailPage.tsx b/frontend/src/pages/TourDetailPage.tsx index f853a39..f20a1c1 100644 --- a/frontend/src/pages/TourDetailPage.tsx +++ b/frontend/src/pages/TourDetailPage.tsx @@ -178,6 +178,8 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => { const [selectedMember, setSelectedMember] = useState(null); const [isMemberDetailOpen, setIsMemberDetailOpen] = useState(false); const [joinRequests, setJoinRequests] = useState([]); + const [titleInput, setTitleInput] = useState(currentTour?.title ?? ''); + const [descriptionInput, setDescriptionInput] = useState(currentTour?.description ?? ''); // State cho input số lượng người tham gia const [adultCountInput, setAdultCountInput] = useState(currentTour?.adultCount ?? 0); const [childCountInput, setChildCountInput] = useState(currentTour?.childCount ?? 0); @@ -340,18 +342,20 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => { }; // Hàm xử lý cập nhật số lượng người tham gia - const handleUpdateParticipantCounts = async () => { + const handleUpdateTourInfo = async () => { if (!currentTour) return; try { await updateTourDetails(currentTour.id, { + title: titleInput, + description: descriptionInput, adultCount: adultCountInput, childCount: childCountInput, childDiscount: childDiscountInput, }); - notificationModal.openModal('Thành công', 'Đã cập nhật số lượng người tham gia.', 'success'); + notificationModal.openModal('Thành công', 'Đã cập nhật thông tin chuyến đi.', 'success'); fetchTour(currentTour.id); // Re-fetch tour để cập nhật lại các tính toán liên quan } catch (error: any) { - notificationModal.openModal('Lỗi', error.message || 'Không thể cập nhật số lượng người tham gia.', 'error'); + notificationModal.openModal('Lỗi', error.message || 'Không thể cập nhật thông tin.', 'error'); } }; // Xác định Điểm xuất phát và Điểm kết thúc hiển thị dưới widget tài chính @@ -428,6 +432,14 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {

{tourInfo.title}

+ + {currentTour?.description && ( +

+ + {currentTour.description} +

+ )} + {/* Dòng tóm tắt Lộ trình */}
Lộ trình: @@ -819,13 +831,43 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
- {canEdit && ( // Chỉ OWNER và MANAGER mới có thể chỉnh sửa phần này + {canEdit && (
+
+ +

Thông tin cơ bản

+
+ +
+ {isOwner && ( + <> +
+ + setTitleInput(e.target.value)} + className="w-full px-4 py-3 bg-gray-50 border border-gray-100 rounded-2xl focus:ring-2 focus:ring-blue-500 outline-none transition-all text-sm font-bold" + placeholder="Nhập tên chuyến đi..." + /> +
+
+ +