Chỉnh sửa ngày của hành trình là ngày của chặng đầu tiên và chặng hoàn thành

This commit is contained in:
2026-06-15 19:57:54 +07:00
parent 4edfd0eb59
commit 879f20985c
+18 -1
View File
@@ -349,6 +349,23 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
const hasFinanceAccess = ['OWNER', 'MANAGER', 'MEMBER'].includes(userRole || ''); const hasFinanceAccess = ['OWNER', 'MANAGER', 'MEMBER'].includes(userRole || '');
// Logic tính toán ngày hiển thị: Ưu tiên ngày của Tour, sau đó đến ngày của các Chặng
const tourDateDisplay = useMemo(() => {
if (currentTour?.startDate && currentTour?.endDate) {
return `${new Date(currentTour.startDate).toLocaleDateString('vi-VN')} - ${new Date(currentTour.endDate).toLocaleDateString('vi-VN')}`;
}
const firstLeg = legs[0];
const lastLeg = legs[legs.length - 1];
const start = firstLeg?.startDate;
const end = lastLeg?.endDate || lastLeg?.startDate;
if (start && end) {
return `${new Date(start).toLocaleDateString('vi-VN')} - ${new Date(end).toLocaleDateString('vi-VN')}`;
} else if (start) {
return `Từ ${new Date(start).toLocaleDateString('vi-VN')}`;
}
return "Chưa xác định ngày";
}, [currentTour, legs]);
const travelQuotes = [ const travelQuotes = [
"Đừng nghe họ nói, hãy tự mình đi xem.", "Đừng nghe họ nói, hãy tự mình đi xem.",
"Thế giới là một cuốn sách, và ai không đi du lịch thì chỉ mới đọc được một trang.", "Thế giới là một cuốn sách, và ai không đi du lịch thì chỉ mới đọc được một trang.",
@@ -360,7 +377,7 @@ export const TourDetailPage = ({ onBack }: { onBack: () => void }) => {
const tourInfo = { const tourInfo = {
title: currentTour?.title || "Hành trình khám phá TP.HCM", title: currentTour?.title || "Hành trình khám phá TP.HCM",
date: currentTour?.startDate ? `${new Date(currentTour.startDate).toLocaleDateString('vi-VN')} - ${new Date(currentTour.endDate).toLocaleDateString('vi-VN')}` : "Chưa xác định ngày", date: tourDateDisplay,
membersCount: currentTour?.participants?.length || 0, membersCount: currentTour?.participants?.length || 0,
budget: currentTour?.totalCost ? `${Number(currentTour.totalCost).toLocaleString()} VND` : "0 VND", budget: currentTour?.totalCost ? `${Number(currentTour.totalCost).toLocaleString()} VND` : "0 VND",
coverImage: currentTour?.photos?.[0]?.imageUrl || "https://images.unsplash.com/photo-1476514525535-07fb3b4ae5f1?q=80&w=2070&auto=format&fit=crop" coverImage: currentTour?.photos?.[0]?.imageUrl || "https://images.unsplash.com/photo-1476514525535-07fb3b4ae5f1?q=80&w=2070&auto=format&fit=crop"