/****************************************************** * コンストラクタ ******************************************************/ function ReserveModule(frm){ this.form = $("#"+frm); //予約モジュールのフォームの参照 this.toAndFromCondition = $("[name='toAndFromCondition']",this.form); //往復・片道ラジオボタン this.departurePulldown = $("[name='departureCity']",this.form); //出発地プルダウン this.arrivalPulldown = $("[name='arrivalCity']",this.form); //到着地プルダウン this.arrivalConteiner = $("#"+ frm + "_arrivalConteiner"); //到着地プルダウンを格納するDIV this.outwardMonth = $("[name='flightMonth']",this.form); //出発月プルダウン this.outwardDate = $("[name='flightDay']",this.form); //出発日プルダウン this.homewardMonth = $("[name='returnFlightMonth']",this.form); //復路月プルダウン this.homewardDate = $("[name='returnFlightDay']",this.form); //復路日プルダウン this.homewardContainer = $("#"+ frm + "_homewardDateContainer"); //復路日時プルダウンを格納するDIV this.nowObject = new Date(); //現在日付 //現在日付をセットする this.nowObject.setFullYear(2024); this.nowObject.setMonth(3); this.nowObject.setDate(28); this.nextYearHolder = null; //プルダウンメニューで翌年またぎになった時に一時的に使用 this.dateRelationFlag = false; //往路日付に連動して復路の日付を設定する際のフラグ変数 //出発日 日付のvalueを都度保持する this.outwardDateValHolder = "01"; //復路 出発日付のvalueを都度保持する this.homewardDateValHolder = "01"; //空港の一覧を保持する 路線の組み合わせを示すfrom配列は、接続元の空港を示す。from配列内の位置はairPorts配列内の位置と同じ。1になっている空港より接続を表す //乗継便は2を入力する *2016/06/23 SST T.SAITO this.airPorts = [ {id:0,name:"札幌(新千歳)", from:[0,0,0,1,0,0,1,0,2,0,0,0,2,0,0],value:"SPK"}, {id:1,name:"青森", from:[0,0,0,0,0,2,0,0,1,2,2,0,2,2,0],value:"AOJ"}, {id:2,name:"花巻", from:[0,0,0,0,0,2,0,0,1,2,2,2,2,2,0],value:"HNA"}, {id:3,name:"山形", from:[1,0,0,0,0,0,0,0,1,2,2,2,2,2,0],value:"GAJ"}, {id:4,name:"仙台", from:[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0],value:"SDJ"}, {id:5,name:"新潟", from:[0,0,0,0,0,0,0,0,1,0,2,2,1,2,0],value:"KIJ"}, {id:6,name:"松本", from:[1,0,0,0,0,0,0,0,0,0,0,0,1,0,0],value:"MMJ"}, {id:7,name:"静岡", from:[0,0,0,0,0,0,0,0,0,1,0,0,1,0,1],value:"FSZ"}, {id:8,name:"名古屋(小牧)", from:[2,1,1,1,0,1,0,0,0,1,1,1,1,1,0],value:"NKM"}, {id:9,name:"出雲", from:[0,2,2,0,1,0,0,1,1,0,2,2,2,2,0],value:"IZO"}, {id:10,name:"高知", from:[0,2,2,2,0,2,0,0,1,2,0,0,0,2,0],value:"KCZ"}, {id:11,name:"北九州", from:[0,0,0,0,0,0,0,0,1,0,0,0,0,0,0],value:"KKJ"}, {id:12,name:"福岡", from:[2,2,2,2,0,1,1,1,1,2,0,0,0,0,0],value:"FUK"}, {id:13,name:"熊本", from:[0,2,2,2,0,0,0,0,1,0,2,0,0,0,0],value:"KMJ"}, {id:14,name:"鹿児島", from:[0,0,0,0,0,0,0,1,0,0,0,0,0,0,0],value:"KOJ"} ]; //初期化開始 this.init(); } /************************************************************* //メソッドを定義 *************************************************************/ //初期化 各パーツにイベントを設定 ReserveModule.prototype.init = function(){ //往復、片道設定後 this.toAndFromCondition.bind("change", $.proxy(function(event){ this.onTypeChange(); },this)); //往路空港選択後 this.departurePulldown.bind("change", $.proxy(function(event){ this.updateArrivalPD(); },this)); //出発月の変更イベント this.outwardMonth.bind("change", $.proxy(function(event){ this.outwardDateValHolder = this.outwardDate.val(); this.homewardDateValHolder = this.homewardDate.val(); this.onArriveMonthChange(); this.setReturnDate(); this.outwardDate.val(this.outwardDateValHolder); this.homewardDate.val(this.homewardDateValHolder); },this)); //出発日の変更イベント this.outwardDate.bind("change", $.proxy(function(event){ this.setReturnDate(); },this)); //復路 出発月の変更イベント this.homewardMonth.bind("change", $.proxy(function(event){ if(this.dateRelationFlag==false){ this.homewardDateValHolder = this.homewardDate.val(); this.onReturnMonthChange(); this.homewardDate.val(this.homewardDateValHolder); } },this)); //往路プルダウン作成→復路プルダウン更新 this.initDeparturePD(); //月プルダウン作成 this.createMonthPullDown(); this.updateDayPullDown(this.nowObject.getFullYear(),this.nowObject.getMonth()+1); this.updateReturnDayPullDown(this.nowObject.getFullYear(),this.nowObject.getMonth()+1); this.setNowDatePD(); this.setReturnDate(); } /* 往復プルダウンを初期作成します */ ReserveModule.prototype.initDeparturePD = function(){ this.departurePulldown.html(""); for(i=0; i').attr({ value: this.airPorts[i].value }).text( this.airPorts[i].name )); this.departurePulldown.width(); /* if(i != 2){ this.departurePulldown.append($('