/*===================================================== * Script Name: tour_module_common.js * Description: 空席照会モジュール ツアー共通処理 * Version: 1.1 * Last Up Date: 2017/10/31 =====================================================*/ // 定数定義 //--------------------------------------------------------------------各種ドメイン var m_tourModuleCommon_ASW_DOMAIN = 'https://www.ana.co.jp'; //var m_tourModuleCommon_oldBE_DOMAIN = 'https://rps.atour.ana.co.jp'; // 本番のためテスト系では使用しないこと var m_tourModuleCommon_oldBE_DOMAIN = 'https://www.ana.co.jp'; // 暫定対応 var m_tourModuleCommon_CAM_DOMAIN = 'https://cam.ana.co.jp'; ///////////////////////// // 各部品初期化 ///////////////////////// // カレンダー用定義 var m_tourModuleCalendar_commonContoroller = null; if (typeof(m_tourModuleCalendarContoroller) === 'function') { m_tourModuleCalendar_commonContoroller = new m_tourModuleCalendarContoroller(); } // 参加人数モジュールコントローラ var m_tourModuleNumberOfPeople_commonContoroller = null; if (typeof(m_tourModuleNumberOfPeopleContoroller) === 'function') { m_tourModuleNumberOfPeople_commonContoroller = new m_tourModuleNumberOfPeopleContoroller(); } // 部品使用カウンタ var m_tourModuleStayCityRadio_usePartsCount = 1; var m_tourModuleNumberOfPeople_usePartsCount = 1; var m_tourModuleAirport_usePartsCount = 1; var m_tourModuleCalendar_usePartsCount = 1; //AdobeTargetのパラメータ格納 var m_tourModuleCommon_setTargetValue_params; //再検索時のパラメータ格納 var m_tourModuleCommon_setResearchValue_params; //初期値設定 var m_tourModuleCommon_siteType = { site : 'common', module : 'common' }; var m_tourModuleCommon_defaults = { // 都市滞在ラジオボタン部品 m_stayCityCountList : m_inttourModuleDp_stayCityCountList ,m_defStayCityCount : '0' // 座席クラス ,m_defHtmlType : 'sec' ,m_defClassFareList : m_inttourModuleDp_classFareList ,m_defInputObject : '' ,m_defClassFareValue : '0' ,m_changeListEventName : '' ,m_changeListEventObject : '' ,m_selectListObject1 : '' ,m_selectListObject2 : '' // 部屋数部品 ,m_numberOfRoomsList : m_inttourModuleDp_numberOfRoomsList ,m_numberOfRoomsValue : '1' // 参加人数部品 ,moduleNo : '999' }; //カレンダー部品デフォルト設定 var m_tourModuleCalender_siteType = { site : 'common', module : 'calendar' }; var m_tourModuleCalendar_defaults = { name:'cal' // ポップアップカレンダー名 + calendarCount ,id:'calId' // ポップアップカレンダー表示ID + calendarCount ,monthId:'segConditionForm.selectedEmbMonth' // 月プルダウンID ,dayId:'segConditionForm.selectedEmbDay' // 日プルダウンID ,textId:'calTextId' // カレンダー画像ID + calendarCount ,priority:'1' // 表示優先度 ,index:'' ,balloonTitle:'' ,uniqueKey:'' ,dateValueClass : '' ,dateValueName : '' ,inputPlaceholder : '日付を選択してください' ,inputClass : '' ,uniqueKey : 'dummy' ,isRequired : false ,isDisabled : false ,isDispAllOfMonth : false ,prevNextInterval : 1 ,isDispHoliday : true ,defSelectDay : 30 ,boundaryTime : '17:00' ,startDateClass : '' ,middleDateClass : '' ,retDateClass : '' ,areaClass : '' ,retDaysFromStartDate : 2 ,midDaysFromStartDate : 1 ,dispDays : 300 ,selectableDays : 300 ,stayCityCount : undefined ,form_number:0 ,zero_value:0 ,connectionCal:'' ,endDay:0 ,DU:null ,PCLP:null ,isReceiveTrigger:false ,additionalClasses:null ,calendarContoroller:m_tourModuleCalendar_commonContoroller ,sameDayFlag:false } // 参加人数部品各固定値 var m_tourModuleNumberOfPeople_FixedParamsDomId = { dp : 'num_dom_free_balloon', pkg : 'num_dom_pkg_balloon', hotel : 'num_dom_hotel_balloon' }; var m_tourModuleNumberOfPeople_FixedParams = { domtour : { top : { id : m_tourModuleNumberOfPeople_FixedParamsDomId, htmlType : 'domTop' }, sec : { id : m_tourModuleNumberOfPeople_FixedParamsDomId, htmlType : 'domSec' } }, inttour : { top : { id : 'num_int_free_balloon', htmlType : 'intTop' }, sec : { id : 'num_int_free_balloon', htmlType : 'intSec' } } } // 参加人数部品デフォルト設定 var m_tourModuleNumberOfPeople_siteType = { site : 'common', module : 'people' }; var m_tourModuleNumberOfPeople_defaultParams = { name:'peopleCount' // ポップアップ参加人数 + 部品使用カウント ,id: m_tourModuleNumberOfPeople_FixedParams.inttour.sec.id // ポップアップ参加人数表示ID + 部品使用カウント ,className : undefined // ポップアップ参加人数吹き出しclass属性名 ,textId:'m_numberOfPeople_' // 参加人数テキストボックス + 部品使用カウント ,htmlType : m_tourModuleNumberOfPeople_FixedParams.inttour.sec.htmlType // ポップアップ参加人数表示ID + 部品使用カウント ,NPLP : m_inttourModuleNumberOfPeople_NPLP // ,initNum:[ // 部品生成時初期表示値※デフォルト設定なし // // Adult, Child, ChildNoBed, Infant // [ 1, 0, 0, 0 ], // 1部屋目 // [ 1, 0, 0, 0 ], // 2部屋目 // [ 1, 0, 0, 0 ], // 3部屋目 // [ 1, 0, 0, 0 ], // 4部屋目 // [ 1, 0, 0, 0 ], // 5部屋目 // [ 1, 0, 0, 0 ], // 6部屋目 // [ 1, 0, 0, 0 ], // 7部屋目 // [ 1, 0, 0, 0 ] // 8部屋目 // ] ,clearNum:[ // 他要素変更時の選択値再生成用初期値 // Adult, Child, ChildNoBed, Infant [ 1, 0, 0, 0 ], // 1部屋目 [ 1, 0, 0, 0 ], // 2部屋目 [ 1, 0, 0, 0 ], // 3部屋目 [ 1, 0, 0, 0 ], // 4部屋目 [ 1, 0, 0, 0 ], // 5部屋目 [ 1, 0, 0, 0 ], // 6部屋目 [ 1, 0, 0, 0 ], // 7部屋目 [ 1, 0, 0, 0 ] // 8部屋目 ] ,column : [ { name : 'adultNum', sum : true, dispSum : true }, { name : 'childNum', sum : true, dispSum : true }, { name : 'childNoBedNum', dispSum : true }, { name : 'infantNum', dispSum : true }, { name : 'personNum', sumColumn : true } //合計用 ] ,row : [ { name : 'One' }, { name : 'Two' }, { name : 'Three' }, { name : 'Four' }, { name : 'Five' }, { name : 'Six' }, { name : 'Seven' }, { name : 'Eight' } ] ,dispMatrix : [ [ true, true, true, true, false ], [ true, true, true, true, false ], [ true, true, true, true, false ], [ true, true, true, true, false ], [ true, true, true, true, false ], [ true, true, true, true, false ], [ true, true, true, true, false ], [ true, true, true, true, false ] ] ,setDipsRowsObj : undefined ,changeDipsRowsEventName : '' ,notChangeTextValue : '' ,checkValueFunc : undefined ,ctrlDisabled : undefined ,m_tourModuleNumberOfPeopleContoroller:m_tourModuleNumberOfPeople_commonContoroller ,textBoxTemplate : '<%= value %>人' } function m_tourModuleCommon_setTargetValue(options){ // Adobe設定 m_tourModuleCommon_setTargetValue_params = $tour_module_jq.extend(m_tourModuleCommon_setTargetValue_params,options); } function m_tourModuleCommon_getParam(type, options, param){ if(options != undefined && options[param] != undefined){ return options[param]; }else{ if(type.site == 'dom'){ if(undefined !== type.module && 'Main' === type.module){ return m_domTopModuleMain_optionParam_common[param]; }else if(undefined !== type.module && 'tabisaku' === type.module){ return m_domTopModuleDp_optionParam[param]; }else if(undefined !== type.module && 'hotel' === type.module){ return m_domTopModuleHotel_optionParam[param]; }else if(undefined !== type.module && 'car' === type.module){ return m_domTopModuleCar_optionParam[param]; }else if(undefined !== type.module && 'hotel_bulk' === type.module){ return m_domTopModuleHotelBulk_optionParam[param]; } return m_domModule_optionParam[param]; } else if(type.site == 'inttour'){ if(type.module == 'tabisaku'){ return m_inttourModuleDp_defaults[param]; }else if(type.module == 'pack'){ return m_inttourModulePkg_defaults[param]; } } else if(type.site == 'domtourtop'){ if(undefined !== type.module && 'Main' === type.module){ return m_domtourTopModuleMain_optionParam_common[param]; }else if(undefined !== type.module && 'tabisaku' === type.module){ return m_domtourTopModuleDp_optionParam[param]; }else if(undefined !== type.module && 'pack' === type.module){ return m_domtourTopModulePkg_optionParam[param]; }else if(undefined !== type.module && 'hotel' === type.module){ return m_domtourTopModuleHotel_optionParam[param]; }else if(undefined !== type.module && 'car' === type.module){ return m_domtourTopModuleCar_optionParam[param]; }else if(undefined !== type.module && 'traffic' === type.module){ return m_domtourTopModuleTraffic_optionParam[param]; } } else if(undefined !== type.site && 'inttourtop' === type.site){ if(undefined !== type.module && 'Main' === type.module){ return m_tourTopModuleMain_optionParam_common[param]; }else if(undefined !== type.module && 'tabisaku' === type.module){ return m_inttourTopModuleDp_optionParam[param]; }else if(undefined !== type.module && 'pack' === type.module){ return m_inttourTopModulePkg_optionParam[param]; } } else if(type.site == 'tour2nd'){ if(type.module == 'Main'){ return m_tour2ndModuleMain_optionParam_common[param]; }else if(type.module == 'tab'){ return m_tour2ndModuleTab_optionParam[param]; } } else if(type.site == 'domtour2nd'){ if(type.module == 'tab'){ return m_domtour2ndModuleTab_optionParam[param]; }else if(type.module == 'tabisaku'){ return m_domtour2ndModuleDp_optionParam[param]; }else if(type.module == 'pack'){ return m_domtour2ndModulePkg_optionParam[param]; }else if(type.module == 'hotel'){ return m_domtour2ndModuleHotel_optionParam[param]; }else if(type.module == 'car'){ return m_domtour2ndModuleCar_optionParam[param]; }else if(type.module == 'traffic'){ return m_domtour2ndModuleTraffic_optionParam[param]; }else if(type.module == 'bulk'){ return m_domtour2ndModuleBulk_optionParam[param]; }else if(type.module == 'hotel_bulk'){ return m_domtour2ndModuleHotelBulk_optionParam[param]; } } else if(type.site == 'inttour2nd'){ if(type.module == 'tab'){ return m_inttour2ndModuleTab_optionParam[param]; }else if(type.module == 'tabisaku'){ return m_inttour2ndModuleDp_optionParam[param]; }else if(type.module == 'pack'){ return m_inttour2ndModulePkg_optionParam[param]; }else if(type.module == 'option'){ return m_inttour2ndModuleOption_optionParam[param]; } } else if(type.site == 'common'){ if(type.module == 'common'){ return m_tourModuleCommon_defaults[param]; }else if(type.module == 'calendar'){ return m_tourModuleCalendar_defaults[param]; }else if(type.module == 'people'){ return m_tourModuleNumberOfPeople_defaultParams[param]; } } return null; } }; function m_tourModuleCommon_getDefVal(type, list, options, param, defParam){ var optionsVal = ''; if(options != undefined){ optionsVal = options[param]; var defVal = list.find('[value=' + optionsVal + ']'); if(defVal.size() != 0){ return optionsVal; } } if(type.site == 'dom'){ optionsVal = m_domModule_optionParam[defParam]; } else if(type.site == 'intwws'){ optionsVal = m_intwwsModule_optionParam[defParam]; } else if(type.site == 'inttop'){ optionsVal = m_intTopModule_optionParam[defParam]; } else if(type.site == 'wwstop'){ optionsVal = m_wwsTopModule_optionParam[defParam]; } else if(type.site == 'tour2nd'){ if(type.module == 'Main'){ optionsVal = m_tour2ndModuleMain_optionParam_common[defParam]; }else if(type.module == 'tab'){ optionsVal = m_tour2ndModuleTab_optionParam[defParam]; } } else if(type.site == 'domtour2nd'){ if(type.module == 'tab'){ optionsVal = m_domtour2ndModuleTab_optionParam[defParam]; } } else if(type.site == 'inttour2nd'){ if(type.module == 'tab'){ optionsVal = m_inttour2ndModuleTab_optionParam[defParam]; }else if(type.module == 'tabisaku'){ optionsVal = m_inttour2ndModuleDp_optionParam[defParam]; } else if(type.module == 'pack'){ optionsVal = m_inttour2ndModulePkg_optionParam[defParam]; } } else if(undefined !== type.site && 'inttourtop' === type.site){ if(undefined !== type.module && 'Main' === type.module){ optionsVal = m_tourTopModuleMain_optionParam_common[defParam]; }else if(undefined !== type.module && 'tabisaku' === type.module){ optionsVal = m_inttourTopModuleDp_optionParam[defParam]; } else if(undefined !== type.module && 'pack' === type.module){ optionsVal = m_inttourTopModulePkg_optionParam[defParam]; } } var defVal = list.find('[value=' + optionsVal + ']'); if(defVal.size() != 0){ return optionsVal; } if(type.site == 'dom'){ optionsVal = m_domModule_defaults[defParam]; } else if(type.site == 'intwws'){ optionsVal = m_intwwsModule_defaults[defParam]; } else if(type.site == 'inttop'){ optionsVal = m_intTopModule_defaults[defParam]; } else if(type.site == 'wwstop'){ optionsVal = m_wwsTopModule_defaults[defParam]; } else if(type.site == 'tour2nd'){ if(type.module == 'Main'){ optionsVal = m_tour2ndModuleMain_defaults_common[defParam]; }else if(type.module == 'tabSelDomInt'){ optionsVal = m_tour2ndModuleTab_defaults[defParam]; } } else if(type.site == 'domtour2nd'){ if(type.module == 'tab'){ optionsVal = m_domtour2ndModuleTab_defaults[defParam]; } } else if(type.site == 'inttour2nd'){ if(type.module == 'tab'){ optionsVal = m_inttour2ndModuleTab_defaults[defParam]; }else if(type.module == 'tabisaku'){ optionsVal = m_inttour2ndModuleDp_defaults[defParam]; } else if(type.module == 'pack'){ optionsVal = m_inttour2ndModulePkg_defaults[defParam]; } } else if(undefined !== type.site && 'inttourtop' === type.site){ if(undefined !== type.module && 'Main' === type.module){ optionsVal = m_tourTopModuleMain_defaults_common[defParam]; }else if(undefined !== type.module && 'tabisaku' === type.module){ optionsVal = m_inttourTopModuleDp_defaults[defParam]; } else if(undefined !== type.module && 'pack' === type.module){ optionsVal = m_inttourTopModulePkg_defaults[defParam]; } } return optionsVal; }; function m_tourModuleCommon_getListValue(listName, key){ var listValue = listName[key]; if(listValue == undefined){ return ''; } return listValue; }; //////////////////////// // 部品共通 START /////////////////////// // 0埋め function m_tourModuleCommon_zeroPadding(num) { var zeroPadding = ('0' + (num)).slice(-2); return zeroPadding; }; // 部品配置数カウント function m_tourCommonModuleParts_getPartsCount(partsName, moduleNum){ if(partsName === 'stayCityCountRadio'){ return m_tourModuleStayCityRadio_usePartsCount + moduleNum; }else if(partsName === 'm_tourModuleNumberOfPeople'){ return m_tourModuleNumberOfPeople_usePartsCount + moduleNum; }else if(partsName === 'airport'){ return m_tourModuleAirport_usePartsCount + moduleNum; }else if(partsName === 'calendar'){ return m_tourModuleCalendar_usePartsCount + moduleNum; } }; function m_tourCommonModuleParts_setPartsCount(partsName, useCount){ if(partsName === 'stayCityCountRadio'){ m_tourModuleStayCityRadio_usePartsCount += useCount; }else if(partsName === 'm_tourModuleNumberOfPeople'){ m_tourModuleNumberOfPeople_usePartsCount += useCount; }else if(partsName === 'airport'){ m_tourModuleAirport_usePartsCount += useCount; }else if(partsName === 'calendar'){ m_tourModuleCalendar_usePartsCount += useCount; } }; //////////////////////// // 部品共通 END /////////////////////// //////////////////////// // 参加人数処理 START /////////////////////// //参加人数モジュールの生成 function m_tourModuleNumberOfPeople_createParts(options) { // 初期化 var count = m_tourModuleCommon_getParam(m_tourModuleCommon_siteType, options, 'moduleNo'); var column = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'column'); var row = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'row'); var dispMatrix = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'dispMatrix'); // 送信パラメータ用HTML生成 var htmlHidden = ''; for(var pri = 0; pri < row.length; pri++){ for(var pci = 0; pci < column.length; pci++){ // 表示マスまたは合計列の場合はhidden出力 if(dispMatrix[pri][pci] || column[pci].sumColumn){ htmlHidden += '\n'; } } } this.append(htmlHidden); // 参加人数モジュールにhidden要素を連携する準備。行単位で渡す。 options.numberOfPeopleHidden = new Array(row.length); for(var i = 0; i < row.length; i++){ options.numberOfPeopleHidden[i] = this.find('.'+ row[i].name + count); } // 参加人数モジュールに親要素を渡す options.numberOfPeopleParent = this; // 参加人数モジュール呼び出し m_tourModuleNumberOfPeople_setController(options); m_tourModuleNumberOfPeople_setData(this, options); // モジュール使用カウンタ m_tourCommonModuleParts_setPartsCount('m_tourModuleNumberOfPeople', 1); }; //参加人数コントローラーの設定 function m_tourModuleNumberOfPeople_setController(options){ var nopModalId = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'id'); var nopModalClassName = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'className'); var count = m_tourModuleCommon_getParam(m_tourModuleCommon_siteType, options, 'moduleNo'); var clearNum = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'clearNum'); var column = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'column'); var row = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'row'); var dispMatrix = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'dispMatrix'); var setDipsRowsObj = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'setDipsRowsObj'); var nplp = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'NPLP'); var htmlType = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'htmlType'); var changeDipsRowsEventName = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'changeDipsRowsEventName'); var checkValueFunc = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'checkValueFunc'); var ctrlDisabled = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'ctrlDisabled'); var notChangeTextValue = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'notChangeTextValue'); var numberOfPeopleTourParams = {}; $tour_module_jq.extend(numberOfPeopleTourParams, m_tourModuleNumberOfPeople_defaultParams); numberOfPeopleTourParams.NPLP = nplp; numberOfPeopleTourParams.htmlType = htmlType; numberOfPeopleTourParams.numberOfPeopleCount = count; numberOfPeopleTourParams.id = nopModalId; //吹き出しID numberOfPeopleTourParams.id += count; numberOfPeopleTourParams.className = nopModalClassName; //吹き出しclass属性名 numberOfPeopleTourParams.textId += count; //入力項目ID numberOfPeopleTourParams.name += count; numberOfPeopleTourParams.hidden = options.numberOfPeopleHidden; numberOfPeopleTourParams.column = column; numberOfPeopleTourParams.row = row; numberOfPeopleTourParams.dispMatrix = dispMatrix; numberOfPeopleTourParams.dispMatrixFixed = $tour_module_jq.extend(true, {}, dispMatrix); numberOfPeopleTourParams.setDipsRows = setDipsRowsObj; numberOfPeopleTourParams.changeDipsRowsEventName = changeDipsRowsEventName; numberOfPeopleTourParams.notChangeTextValue = notChangeTextValue; numberOfPeopleTourParams.clearValue = clearNum; numberOfPeopleTourParams.checkValueFunc = checkValueFunc; numberOfPeopleTourParams.ctrlDisabled = ctrlDisabled; // 参加人数モジュール生成 var nop = new m_tourModuleNumberOfPeople(numberOfPeopleTourParams); m_tourModuleNumberOfPeople_commonContoroller.addNumberOfPeople(nop); }; //参加人数データの設定 function m_tourModuleNumberOfPeople_setData(target, options){ var initNum = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'initNum'); var clearNum = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'clearNum'); var count = m_tourModuleCommon_getParam(m_tourModuleCommon_siteType, options, 'moduleNo'); var column = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'column'); var row = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'row'); var dispMatrix = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'dispMatrix'); var setDipsRowsObj = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'setDipsRowsObj'); var htmlType = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'htmlType'); var textBoxTemplate = m_tourModuleCommon_getParam(m_tourModuleNumberOfPeople_siteType, options, 'textBoxTemplate'); var inputParams = { parent : target, mumberOfPeopleInitNum : initNum, // hiddenの初期値(優先1) mumberOfPeopleClearNum : clearNum, // hiddenの初期値(優先2) numberOfPeopleCount : count, // 入力フォームID/name番号割り振り numberOfPeopleColumn : column, // hiddenのclass,name属性名生成用配列 numberOfPeopleRow : row, // hiddenのclass,name属性名生成用配列 numberOfPeopleDispMatrixFixed : dispMatrix, // hiddenのclass,name属性名生成用配列 numberOfPeopleDispRooms : setDipsRowsObj, // 部屋数object htmlType : htmlType, // タイプ指定 textBoxTemplate : textBoxTemplate // 入力項目値テキストテンプレート }; $tour_module_jq(options.numberOfPeopleHidden[0][0]).change(inputParams, m_tourModuleNumberOfPeople_updateText); $tour_module_jq(options.numberOfPeopleHidden[0][0]).trigger('change'); }; // 呼び元入力テキスト更新 // 初期表示の場合はhidden値設定 function m_tourModuleNumberOfPeople_updateText(options) { var data = options.data; var parent = data.parent; var sumAll = 0; // 参加人数hidden値よりフォームに出力するテキストの準備 var dispArray = data.numberOfPeopleDispMatrixFixed; var col = data.numberOfPeopleColumn; var row = data.numberOfPeopleRow; var no = data.numberOfPeopleCount; var val = new Array(row.length); for(var ri = 0; ri < row.length; ri++){ val[ri] = new Array(col.length); for(var ci = 0; ci < col.length; ci++){ if(dispArray[ri][ci]){ val[ri][ci] = parent.find('input[name="'+ col[ci].name + row[ri].name +'"]').val(); }else{ val[ri][ci] = '0'; } } } var isEmptyFlg = false; for(var ri = 0; ri < row.length; ri++){ for(var ci = 0; ci < col.length; ci++){ if(_.isEmpty(val[ri][ci])){ isEmptyFlg = true; break; }else{ // 表示かつ合計対象列は加算 if(dispArray[ri][ci] && col[ci].dispSum){ sumAll += parseInt(val[ri][ci]); } } } } if(isEmptyFlg){ // 参加人数hidden値の初期設定 sumAll = 0; dipsRooms = $tour_module_jq(data.numberOfPeopleDispRooms).val(); if(dipsRooms){ dipsRooms = parseInt(dipsRooms); }else{ dipsRooms = row.length; // すべての列を表示する } // 初期値設定 var initNumAarray = data.mumberOfPeopleInitNum; if(initNumAarray !== undefined){ // 初回表示設定ありの場合はテキスト表示変更 isEmptyFlg = false; }else{ initNumAarray = data.mumberOfPeopleClearNum; } // hidden値設定 for(var ri = 0; ri < row.length; ri++){ var sumRowHidden = 0; for(var ci = 0; ci < col.length; ci++){ if(dispArray[ri][ci]){ var mumberOfPeopleNum = initNumAarray[ri][ci]; if(dipsRooms === 0 || dipsRooms < (ri + 1)){ mumberOfPeopleNum = 0; } parent.find('input[name="'+ col[ci].name + row[ri].name +'"]').val(mumberOfPeopleNum); if(col[ci].sum){ sumRowHidden += parseInt(mumberOfPeopleNum); } if(col[ci].dispSum){ sumAll += parseInt(mumberOfPeopleNum); } }else if(col[ci].sumColumn){ parent.find('input[name="'+ col[ci].name + row[ri].name +'"]').val(sumRowHidden); }else{ // 非表示分は0を設定 parent.find('input[name="'+ col[ci].name + row[ri].name +'"]').val(0); } } } } // 入力フォームにテキスト反映 if(!isEmptyFlg){ var numberOfPeopleTextTemplate = _.template(data.textBoxTemplate) var numberOfPeopleTextValue = numberOfPeopleTextTemplate({value : sumAll}); var textId = m_tourModuleNumberOfPeople_defaultParams.textId; var htmlType = data.htmlType; if ((undefined !== htmlType && m_tourModuleNumberOfPeople_FixedParams.inttour.top.htmlType === htmlType) || (undefined !== htmlType && m_tourModuleNumberOfPeople_FixedParams.domtour.top.htmlType === htmlType)){ var result = parent.find('.m_numberOfPeople_text').text(numberOfPeopleTextValue); }else{ var result = parent.find('input[type=text]#'+ textId + no).val(numberOfPeopleTextValue); } if(!result){ parent.find('#'+ textId + no).text(numberOfPeopleTextValue); } } }; //////////////////////// // 参加人数 END /////////////////////// //////////////////////// // 空港一覧部品 START /////////////////////// // 空港一覧入力部品 function m_tourModuleAirportList_createParts(options){ var html = ''; if (undefined !== options.site && "inttourtop" === options.site){ // 海外ツアーTOP if(undefined !== options.isChainStart){ html += '
\n'; }else{ html += '
\n'; } var depDeteId = ''; if(undefined !== options.depDateId && '' !== options.depDateId){ depDeteId = ' id="' + options.depDateId; } html += '
\n'; }else{ html += '\n'; } if (options.dateValueName) { html += '\n'; } else { html += '\n'; } this.append(html); // 必須入力背景色(黄色)の設定 if (options.isRequired) { this.find('.' + options.inputClass).addClass('required'); } // 入力不可の設定 if (options.isDisabled) { this.find('.' + options.inputClass).prop('disabled', true); } // 入力項目AUTO機能開始の設定 if ((undefined !== options.site && "domtourtop" === options.site) && (undefined !== options.isChainStart)) { this.find('#calTextId_tourcommonmoduleparts_' + options.uniqueKey).attr('data-balloon-chain-start', options.isChainStart); } var calHtml = '\n'; this.after(calHtml); PCP_ticket = new m_tourModuleCalendar_propertiesTicket(options); var DU_ticket = new m_tourModuleDateUtil(PCP_ticket, options.boundaryTime); options.targetObject = this; m_tourModuleCalendar_setController(options, DU_ticket); m_tourModuleCalendar_setData(this, options, DU_ticket); } // カレンダーコントローラーの設定 function m_tourModuleCalendar_setController(options, DU_ticket){ var popupCalendarTourCommonModulePartsParams = m_tourModuleCalendar_createPartsParams(options); popupCalendarTourCommonModulePartsParams.DU = DU_ticket; // 行き日付に対する移動日の差分日数を取得 var midDaysFromStartDate = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'midDaysFromStartDate'); // 行き日付に対する帰りの差分日数を取得 popupCalendarTourCommonModulePartsParams.midDaysFromStartDate = midDaysFromStartDate; // 帰り選択日の場合はエリアを参照し中南米とヨーロッパのみ行き+3日、それ以外は行き+2日を設定 var retDaysFromStartDate = m_tourModuleDateUtil.prototype.calcRetDaysFromStartDate(options); popupCalendarTourCommonModulePartsParams.retDaysFromStartDate = retDaysFromStartDate; // カレンダー初期選択日の設定 if (options.defDate) { popupCalendarTourCommonModulePartsParams.defDate = options.defDate; } else { var defDate = m_tourModuleCalender_PCLP.calcDefDate(options); defDateText = defDate.getFullYear() + '/' + ('0' + (defDate.getMonth() + 1)).slice(-2) + '/' + ('0' + defDate.getDate()).slice(-2); popupCalendarTourCommonModulePartsParams.defDate = defDateText; options.defDate = defDateText; } popupCalendarTourCommonModulePartsParams.site = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'site'); popupCalendarTourCommonModulePartsParams.targetObject = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'targetObject'); popupCalendarTourCommonModulePartsParams.dateValueClass = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'dateValueClass'); popupCalendarTourCommonModulePartsParams.dateField = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'dateValueName'); popupCalendarTourCommonModulePartsParams.isModalModule = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'isModalModule'); popupCalendarTourCommonModulePartsParams.isDispAllOfMonth = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'isDispAllOfMonth'); popupCalendarTourCommonModulePartsParams.prevNextInterval = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'prevNextInterval'); popupCalendarTourCommonModulePartsParams.boundaryTime = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'boundaryTime'); popupCalendarTourCommonModulePartsParams.startDateClass = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'startDateClass'); popupCalendarTourCommonModulePartsParams.middleDateClass = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'middleDateClass'); popupCalendarTourCommonModulePartsParams.retDateClass = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'retDateClass'); popupCalendarTourCommonModulePartsParams.areaClass = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'areaClass'); popupCalendarTourCommonModulePartsParams.receiptDisableDays = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'receiptDisableDays'); popupCalendarTourCommonModulePartsParams.maxTravelDays = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'maxTravelDays'); popupCalendarTourCommonModulePartsParams.returnDaysFromDepartureDate = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'returnDaysFromDepartureDate'); popupCalendarTourCommonModulePartsParams.dispDays = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'dispDays'); popupCalendarTourCommonModulePartsParams.dispMonths = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'dispMonths'); popupCalendarTourCommonModulePartsParams.selectableDays = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'selectableDays'); popupCalendarTourCommonModulePartsParams.selectableMonths = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'selectableMonths'); popupCalendarTourCommonModulePartsParams.stayCityCount = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'stayCityCount'); popupCalendarTourCommonModulePartsParams.isReceiveTrigger = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'isReceiveTrigger'); popupCalendarTourCommonModulePartsParams.maxTravelDateClass = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'maxTravelDateClass'); popupCalendarTourCommonModulePartsParams.minTravelDateClass = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'minTravelDateClass'); popupCalendarTourCommonModulePartsParams.additionalClasses = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'additionalClasses'); popupCalendarTourCommonModulePartsParams.sameDayFlag = m_tourModuleCommon_getParam(m_tourModuleCalender_siteType, options, 'sameDayFlag'); var cal = new m_tourModulePopupCalendar(popupCalendarTourCommonModulePartsParams); m_tourModuleCalendar_commonContoroller.addCalendar(cal); }; // カレンダーデータの設定 function m_tourModuleCalendar_setData(target, options, DU_ticket){ var defDate = options.defDate; var defSelectDay = options.defSelectDay; var targetDate = null; // 日付の設定 if (m_tourModuleCalendar_isQueryableDate(defDate, options, DU_ticket)) { // 有効なデフォルト日付が設定されている場合 targetDate = new Date(defDate); } else { // デフォルト targetDate = m_tourModuleCalender_PCLP.calcDefDate(options) } var FormatDate; var fieldDate; if (defDate.length === 10) { FormatDate = m_tourModuleCalender_PCLP.FormatDate(targetDate); fieldDate = targetDate.getFullYear() + ('0'+(targetDate.getMonth()+1)).slice(-2) + ('0'+targetDate.getDate()).slice(-2); } else if (defDate.length === 7) { FormatDate = m_tourModuleCalender_PCLP.FormatMonthText(targetDate); fieldDate = targetDate.getFullYear() + ('0'+(targetDate.getMonth()+1)).slice(-2); } else { FormatDate = m_tourModuleCalender_PCLP.FormatDate(targetDate); fieldDate = targetDate.getFullYear() + ('0'+(targetDate.getMonth()+1)).slice(-2) + ('0'+targetDate.getDate()).slice(-2); } target.find('.' + options.dateValueClass).val(fieldDate); if ("inttourtop" === options.site || "domtourtop" === options.site){ target.find('.' + options.inputClass).text(FormatDate); }else{ target.find('.' + options.inputClass).val(FormatDate); } target.find('.' + options.inputClass).val(FormatDate); target.find('.' + options.inputClass).trigger('change'); }; // 引数の日付が照会可能期間かどうか判定 function m_tourModuleCalendar_isQueryableDate(depDateSlash, options, DU_ticket){ if (!m_tourModuleCalendar_isValidDate(depDateSlash)) { return false; } options.initCheck = options.parent; //初期化用オブジェクト var targetDate = new Date(depDateSlash); if(depDateSlash.length == 7){ // 年月の場合は月末を指定 targetDate = new Date(targetDate.getFullYear(), targetDate.getMonth() + 1, 0); } var referenceableStartDate = m_tourModuleDateUtil.prototype.calcCurrentDate(options.boundaryTime); // 営業日 referenceableStartDate.setDate(referenceableStartDate.getDate() + m_tourModuleDateUtil.prototype.calcReceiptDisableDays(options) + 1); // 営業日+受付終了日+1日 if (targetDate.getTime() < referenceableStartDate.getTime()) { //選択可能開始日より過去だったら照会可能期間外 return false; } var referenceableLastDate = m_tourModuleDateUtil.prototype.calcCurrentDate(options.boundaryTime); // 営業日 if(options.selectableDays){ //選択可能範囲が日指定 referenceableLastDate.setDate(referenceableLastDate.getDate() + options.selectableDays); // 営業日+選択可能制御日 }else{ //選択可能範囲が月指定 referenceableLastDate.setMonth(referenceableLastDate.getMonth() + options.selectableMonths); // 営業日+選択可能制御月 referenceableLastDate.setDate(1); } if (targetDate.getTime() >= referenceableLastDate.getTime()) { //選択可能日数後より未来だったら照会可能期間外 return false; } return true; }; // targetDateが'YYYY/MM/DD'または'YYYY/MM'形式か判定 function m_tourModuleCalendar_isValidDate(targetDate){ var date = new Date(targetDate); if (targetDate.length === 10) { // targetDateが'YYYY/MM/DD'形式か判定 if (targetDate == ( date.getFullYear() + '/' + ('0'+(date.getMonth()+1)).slice(-2) + '/' + ('0'+date.getDate()).slice(-2) ) ) { return true; } } else if (targetDate.length === 7) { // targetDateが'YYYY/MM'形式か判定 if (targetDate == ( date.getFullYear() + '/' + ('0'+(date.getMonth()+1)).slice(-2) ) ) { return true; } } else { // targetDateが'YYYY/MM/DD'形式か判定 if (targetDate == ( date.getFullYear() + '/' + ('0'+(date.getMonth()+1)).slice(-2) + '/' + ('0'+date.getDate()).slice(-2) ) ) { return true; } } return false; }; //////////////////////// // カレンダー部品 END /////////////////////// /////////////////////// // 部屋数部品 START /////////////////////// // 部屋数プルダウン選択肢の設定 function m_tourModuleNumberOfRooms_createParts(options) { var type = m_tourModuleCommon_getParam(m_tourModuleCommon_siteType, options, 'm_defHtmlType'); var listName = m_tourModuleCommon_getParam(m_tourModuleCommon_siteType, options, 'm_numberOfRoomsList'); var selectValue = m_tourModuleCommon_getParam(m_tourModuleCommon_siteType, options, 'm_numberOfRoomsValue'); var html = ''; for(var key in listName) { var date = listName[key]; var codeValue = date['value']; var textValue = date['text']; if(undefined !== type && "inttourtop" === type){ html += ' \n'; html += '