mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 07:38:10 +00:00
Update coachtype id for seat map
This commit is contained in:
@@ -144,8 +144,8 @@ export default function ResultsPage() {
|
|||||||
? (outboundSchedules.length > 0 && inboundSchedules.length > 0)
|
? (outboundSchedules.length > 0 && inboundSchedules.length > 0)
|
||||||
: outboundSchedules.length > 0;
|
: outboundSchedules.length > 0;
|
||||||
|
|
||||||
const handleSelectCoachType = (scheduleId: string, coachTypeCode: string, coachTypeName: string) => {
|
const handleSelectCoachType = (scheduleId: string, coachTypeId: string, coachTypeCode: string, coachTypeName: string) => {
|
||||||
setSelectedCoachTypes(prev => ({ ...prev, [scheduleId]: { id: coachTypeCode, code: coachTypeCode, name: coachTypeName } }));
|
setSelectedCoachTypes(prev => ({ ...prev, [scheduleId]: { id: coachTypeId, code: coachTypeCode, name: coachTypeName } }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelect = (schedule: Schedule, isOutbound: boolean = false) => {
|
const handleSelect = (schedule: Schedule, isOutbound: boolean = false) => {
|
||||||
@@ -158,7 +158,7 @@ export default function ResultsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find the coach type to get pricing info
|
// Find the coach type to get pricing info
|
||||||
const coachType = schedule.coachTypes?.find(ct => ct.coachTypeCode === selectedCoachType.id);
|
const coachType = schedule.coachTypes?.find(ct => ct.coachTypeId === selectedCoachType.id);
|
||||||
const minFare = coachType?.classes.length ? Math.min(...coachType.classes.map(c => c.baseFareMinor)) : 0;
|
const minFare = coachType?.classes.length ? Math.min(...coachType.classes.map(c => c.baseFareMinor)) : 0;
|
||||||
|
|
||||||
const hours = Math.floor((schedule.durationMinutes || 0) / 60);
|
const hours = Math.floor((schedule.durationMinutes || 0) / 60);
|
||||||
@@ -535,14 +535,14 @@ export default function ResultsPage() {
|
|||||||
{coachTypes.length > 0 ? (
|
{coachTypes.length > 0 ? (
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4 pt-2">
|
<div className="grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 gap-4 pt-2">
|
||||||
{coachTypes.map((coachType: any, index: number) => {
|
{coachTypes.map((coachType: any, index: number) => {
|
||||||
const isSelected = selectedCoachType?.id === coachType.coachTypeCode;
|
const isSelected = selectedCoachType?.id === coachType.coachTypeId;
|
||||||
const minPrice = coachType.classes.length ? Math.min(...coachType.classes.map((c: any) => c.baseFareMinor)) : 0;
|
const minPrice = coachType.classes.length ? Math.min(...coachType.classes.map((c: any) => c.baseFareMinor)) : 0;
|
||||||
const CoachIcon = getCoachIcon(coachType.coachTypeName);
|
const CoachIcon = getCoachIcon(coachType.coachTypeName);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
key={coachType.coachId}
|
key={coachType.coachId}
|
||||||
onClick={() => handleSelectCoachType(scheduleId, coachType.coachTypeCode, coachType.coachTypeName)}
|
onClick={() => handleSelectCoachType(scheduleId, coachType.coachTypeId, coachType.coachTypeCode, coachType.coachTypeName)}
|
||||||
className={`group relative w-full p-5 rounded-2xl border-2 text-left transition-all duration-200 ${
|
className={`group relative w-full p-5 rounded-2xl border-2 text-left transition-all duration-200 ${
|
||||||
isSelected
|
isSelected
|
||||||
? 'border-primary bg-gradient-to-br from-primary/8 to-primary/3 dark:from-primary/15 dark:to-primary/5 shadow-lg shadow-primary/20 scale-[1.02]'
|
? 'border-primary bg-gradient-to-br from-primary/8 to-primary/3 dark:from-primary/15 dark:to-primary/5 shadow-lg shadow-primary/20 scale-[1.02]'
|
||||||
|
|||||||
Reference in New Issue
Block a user