import { makeAutoObservable , runInAction } from "mobx" ;
import { fetchJSON } from '@/utils/request' ;
import { HT _HOST } from "@/config" ;
import { prepareUrl } from '@/utils/commons' ;
class Reservation {
constructor ( root ) {
makeAutoObservable ( this , { rootStore : false } ) ;
this . root = root ;
}
fetchReservationList ( referenceNo , fromDate , thruDate ) {
const fetchUrl = prepareUrl ( HT _HOST + '/service-tourdesign/GetPlanSearchList' )
. append ( 'VEISn' , this . root . authStore . login . travelAgencyId )
. append ( 'GroupNo' , referenceNo )
. append ( 'DateStart' , fromDate )
. append ( 'DataEnd' , thruDate )
. append ( 'ReTotal' , 0 )
. append ( 'PageSize' , 0 )
. append ( 'PageNum' , 0 )
. append ( 'PageIndex' , 1 )
. build ( ) ;
return fetchJSON ( fetchUrl )
. then ( json => {
runInAction ( ( ) => {
if ( json . errcode == 0 ) {
this . reservationList = json . Result . map ( ( data , index ) => {
return {
key : data . vas _gri _sn ,
id : data . vas _gri _sn ,
referenceNumber : data . GriName ,
arrivalDate : data . GetGDate ,
pax : data . PersonNum ,
status : data . GState ,
reservationDate : data . GetGDate ,
guide : data . Guide ,
}
} ) ;
} else {
throw new Error ( json . errmsg + ': ' + json . errcode ) ;
}
} ) ;
} ) ;
}
fetchReservation ( reservationId ) {
const fetchUrl = prepareUrl ( HT _HOST + '/service-tourdesign/GetPlanInfo' )
. append ( 'VEI_SN' , this . root . authStore . login . travelAgencyId )
. append ( 'GRI_SN' , reservationId )
. build ( ) ;
return fetchJSON ( fetchUrl )
. then ( json => {
runInAction ( ( ) => {
if ( json . errcode == 0 ) {
console . info ( json ) ;
// this.reservationList = json.Result.map((data, index) => {
// return {
// key: data.vas_gri_sn,
// id: data.vas_gri_sn,
// referenceNumber: data.GriName,
// arrivalDate: data.GetGDate,
// pax: data.PersonNum,
// status: data.GState,
// reservationDate: data.GetGDate,
// guide: data.Guide,
// }
// });
} else {
throw new Error ( json . errmsg + ': ' + json . errcode ) ;
}
} ) ;
} ) ;
}
reservationList = [ ] ;
customerList = [
{
title : 'Crane / Gemma Chelse' ,
description : 'Gender: Male Nationality: United States Passport: 655844449 Expiration Date: 2030-09-07 Birth Date: 1979-12-23' ,
} ,
{
title : 'McCracken / Ryan Lee' ,
description : 'Gender: Female Nationality: United States Passport: 655844450 Expiration Date: 2030-09-07 Birth Date: 1983-05-17' ,
} ,
{
title : 'Ramlakhan / Darryl' ,
description : 'Gender: Female Nationality: United States Passport: 661810034 Expiration Date: 2026-03-16 Birth Date: 2006-07-12' ,
} ,
{
title : 'Ramlakhan / Reanne' ,
description : 'Gender: Male Nationality: United States Passport: 593422145 Expiration Date: 2023-04-25 Birth Date: 2012-03-26' ,
} ,
{
title : 'Alexander Daich' ,
description : 'Gender: Male Nationality: United States Passport: 593422145 Expiration Date: 2023-04-25 Birth Date: 2012-03-26s' ,
} ,
] ;
itineraryList = [
{
key : '1' ,
day : 'Tue 05-Jul-2022' ,
placeTransport : 'Bangkok to Chiang Mai, PG217 Dep 12:15 - Arr 13:35 (Economy class)' ,
todayActivities : 'Hotel to airport Transfer (Bangkok), Airport to Hotel Transfer (Chiang Mai), Street Food Tour in Chiang Mai (Morning or Afternoon)' ,
accommodation : 'The Rim Resort **** (Dahla Junior Suite)' ,
meals : 'B,D'
} ,
{
key : '2' ,
day : 'Wed 06-Jul-2022' ,
placeTransport : 'Chiang Mai' ,
todayActivities : 'Elephant Jungle Sanctuary Half Day Tour (Private transfer and Join in activity), Chiang Mai City Lifestyle Experiece and Mountain Doi Suthep Half Day Tour with a rickshaw ride' ,
accommodation : 'The Rim Resort **** (Dahla Junior Suite)' ,
meals : 'B'
} ,
{
key : '3' ,
day : 'Thu 07-Jul-2022' ,
placeTransport : 'Chiang Mai to Phuket , VZ414 Dep 10:40 - Arr 12:50 (Economy class)' ,
todayActivities : 'Hotel to airport Transfer (Chiang Mai), Airport to Hotel Transfer (Phuket )' ,
accommodation : 'Pamookkoo Resort **** (Family room)' ,
meals : 'B'
} ,
] ;
}
export default Reservation ;