Ext.onReady(function(){ ExtVS.V.sTplName = 'hotel_search'; ExtVS.V.sPlatformId = 'hotel_search_platform'; ExtVS.V.sRequestName = 'json_request_hotel_search'; ExtVS.V.bUserInner = false; ExtVS.V.UserVars = {"success":true,"results":5,"data":{"SProfitCentreCode":null,"SUserCode":null,"AgentCode":"9500009","ContractId":"802040","CurrencyName":"RUB"},"message":"User Vars Data"}; ExtVS.V.TplVars = {"success":true,"results":6,"data":{"SCRIPT_NAME":"\/source_new\/platform.js.php","lang":"en","xUserMenu":false,"user":{"name":"\u041e\u0431\u0449\u0438\u0435 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u044b","login":"WWW","phone":"","email":"","currency":"RUB","currency_code":"2","manager":"ELENA CHEREPANOVA","manager_email":"E.CHEREPANOVA@ACASE.RU","agent_name":"Academservice-Online","contract_number":"","fax":"","contract_date":" . . ","prepayment":"1","user_type":"buyer","inner":false,"private":false,"provide_ref_num":"2","product_code":"004340-0001-0001","product_name":"Hotel Reservation","secret":"DePolLrelku8y878","payment_system":"2","default":true,"agn":true,"fit":false,"ViewFullPrice":"2","SProfitCenterCode":null,"SProfitCenterName":null,"SUserCode":null,"SUserName":null,"ContractNumber":"","ContractDate":" . . ","ContractId":"802040","AgentCode":"9500009","order_access":false},"engine":{"favIcon":"http:\/\/www.acase.ru\/favicon.ico","css":"","js":"","host":"","imageServer":"","name":"acase","realBooking":false},"showBookMarks":false},"message":"Template Vars Data"}; ExtVS.V.LanVars = {"success":true,"results":233,"data":{"self":"{0}","date_format":"DD.MM.YYYY","bookmarkthispage":"Bookmark this page to:","main_page":"Home","catalog":"Online catalogue","cities":"Cities","citiesHotels":"{0} Hotels","citiesHotels2":"{0} Hotels","gmap":"Map","map":"Map","cityGuide":"{0} guide","cityGmap":"{0} hotels on a map","agent_login":"Login","countries":"Countries","country":"Country","city":"City","hotels":"Hotels","hotel":"Hotel","catalog_hotels":"Hotels catalogue","hotel_news":"Hotel News","about":"About us","more":"Zoom in","small":"Zoom out","noaccess_head":"Access denied","noaccess_unfortunately":"Access denied!","noaccess_contact_manager":"To get the authorization please contact you manager.","priceandavalability":"Price and availability","mapnotsearchcountry":"Geographical coordinates are not found.","mapnotsearchcity":"Geographical coordinates are not found.","mapnotsearchhotel":"Geographical coordinates are not found.","hotellist_select_city":"Select city","hotellist_select_country":"Select country","footer_copyrigth":"\u00a9 \u00abAcademservice\u00bb, 1990-{0}.","footer_fax":"Fax: +7 (495) 662-43-62","num_mbt":"Register tour operator`s number MBT 000001","hoteldescription_tb_map":"{0} location scheme","hoteldescription_tb_gmap":"Hotel {0} on a {1} map","hoteldescription_tb_photo":"{0} photoes","hoteldescription_tb_vh":"{0} virtual tour","hoteldescription_tb_price":"{0} prices","hotelsearch_room_avail":"Rooms Available","print_page":"print this page","index_news":"News","index_guests":"Guests of Academservice","index_archiv_news":"News Archive","session_wheretopayname_1":"Prepayment to {0} before arrival","session_wheretopayname_2":"Payment in the hotel on arrival","session_wheretopayname_3":"Payment to {0} according to the agreement","btn_booking":"Book now","btn_cancel":"Cancel","btn_back":"Back","btn_next":"Next","btn_2basket":"To basket","btn_change":"Change","btn_change_room_dates":"Change Arrival\/Departure dates and Room type","btn_change_order":"Change booking","btn_change_preferences":"Change preferences","btn_change_service":"Change service","btn_clear_cart":"Clear basket","btn_complete_order":"Proceed to booking","btn_delete":"Delete","btn_delete_service":"Delete service","btn_dontsave_order":"Do not save the booking","btn_edit":"Edit","btn_continue":"Continue","btn_hotelsincity":"View hotels in the city","btn_login":"Login","btn_mail":"Send by e-mail","btn_priceandavailability":"View prices and availability","btn_refresh":"Check prices and availability","btn_register":"Register","btn_save_change":"Save changes","btn_save_order":"Save booking","btn_search_orders":"Search","btn_select":"Search","btn_send":"Send","btn_unregister":"Unregister","btn_view":"Show hotels","btn_book_the_hotel":"Book the Hotel","btn_confirm":"Confirm changes in the booking","btn_confirm_cancel":"Confirm cancellation of the booking","wait":"Please wait, recalculating values...","order_status71":"Cancelled","bookagent_status_work":"Request sent","phone4all":"Hotel Reservation Centre Phone","leftnav_help":"Help","leftnav_profile":"My preferences","leftnav_basket":"My basket","leftnav_orders":"My bookings","leftnav_order":"Booking","leftnav_findorder":"Find booking","leftnav_pricelist":"Prices","leftnav_logout":"Logout","change_booking":"Change booking","private_person":"Private person","profile_youreghow":"You are logged in as:","inner_user":"Academservice's user","editorder_order_num":"Booking {0}","editorder_not_found":"Booking {0} not found!","editorder_msg1":"Please complete working with the current booking before making new booking!","editorder_msg2":"For correction of existed booking complete the work with the current booking!","recovery_success":"Password was sended successfully!","mainpage_h1":"Online Hotels Booking","hotels_freesale":"Free Sale hotels","hotels_allhotels":"Hotels catalogue","hotelsearch_onlyfreesale":"Hotels on Free Sale only","index_popcities":"Popular destinations","on_request":"on request","online_info":"Online booking","comis":"Commission","deleted":"Cancelled!","changed":"Changed!","penalty":"Penalties:","reason":"Reason","ratename":"at \"{0}\" rate","allotmentname":"from \"{0}\" allotment","select":"Select...","rss_news":"Academservice's News","engine_powered":"Powered by Academservice Booking Engine<\/a>","map_link":"View full map","inner_profitcentre":"Department","inner_suser":"Operator","inner_agent":"Agent","inner_contract":"Contract","inner_contact":"Recipient","inner_profitcentre_err":"Please specify: Department!","inner_suser_err":"Please specify: Operator!","inner_agent_err":"Please specify: Agent!","inner_contract_err":"Please specify: Contract!","phone":"Phone:<\/b> {0}","availabrooms":"{0} room(s) available","priceandavailability":"Hotel booking","hoteladdress":"Hotel address:<\/b> {0}","acaserank":"Rank \"{0}\"","hotelname":"Hotel {0}","citycentre":"City centre:<\/b> {0}","underground":"Nearest metro station:<\/b> {0}","descriptions":"Landmarks:<\/b> {0}","rooms_floors":"Number of rooms\/floors:<\/b> {0}\/{1}","year_built":"Year built:<\/b> {0}","year_built_reconstructed":"Year built\/reconstructed:<\/b> {0}\/{1}","airport":"Airport:<\/b> {0}","railway_station":"Railway Station:<\/b> {0}","riverport":"River terminal:<\/b> {0}","seaport":"Sea terminal:<\/b> {0}","hotelphoto":"Hotel {0} photo","hotelschema":"Hotel {0} location scheme","hoteldescription_addnote":"Please be aware that information on services may be changed or updated by hotels without prior notice.","hotel_rate":"Hotels category","hotel_services":"Hotels services","off_certificate":"Official certificate","off_certificate_no":"No official certificate","priceload":"Download prices","hoteldescription_besteastern":"Member of "Best Eurasian Hotels" project","virtual":"Virtual tour","hoteldescription_hotel":"Hotel {0}","hoteldescription_hotel_desc":"Hotel description {0}","hoteldescription_hotel_description":"Description","hoteldescription_classification":"Rank \u00ab{0}\u00bb","hotel_search":"Hotels in Russia, CIS and Baltic","hotelsearch_search":"Search","hotelsearch_result":"Search results","hotelsearch_1":"One guest","hotelsearch_2":"Two guests","hotelsearch_other_city":"Another city","hotelsearch_type":"Guests per room","hotelsearch_fullprice":"Total price","hotelsearch_in":"Arrival","hotelsearch_out":"Departure","hotelsearch_date":"Accommodation dates\\:","hotelsearch_onlyfreesale2":"Search hotels on Free Sale only","hotelsearch_freesale":"Free Sale:","hotelsearch_selectcity":"City:","hotelsearch_price_from":"from","hotelsearch_price_to":"to","hotelsearch_rate":"Category:","hotelsearch_rate_star_any":"Any","hotelsearch_rate_star_1":"1 star","hotelsearch_rate_star_2":"2 stars","hotelsearch_rate_star_3":"3 stars","hotelsearch_rate_star_4":"4 stars","hotelsearch_rate_star_5":"5 stars","hotelsearch_found":"Hotels found: {0}","hotelsearch_err_emptycity":"Please select a city","hotelsearch_err_arrdate":"The arrival date should be greater or equal to current date","hotelsearch_err_depdate":"The departure date should be greater to arrival date","hotelsearch_err_empty_dates":"Please specify accommodation dates!","hotelsearch_err_empty_arrdate":"Please specify the arrival date!","hotelsearch_err_empty_depdate":"Please specify the departure date!","hotelsearch_err_invalid_arrdate":"Invalid arrival date format! (ex.: {0})","hotelsearch_err_invalid_depdate":"Invalid departure date format! (ex.: {0})","hotelsearch_err_negativeprice":"The price could not be negative","hotelsearch_err_maxprice":"The maximum price should be greater then minimum price","hotelsearch_err_durstay":"Maximum allowable duration of stay is {0} nights!","hotelsearch_err_notfound":"Hotels corresponding your request are not found!","hotelsearch_clearfiltr_hotelname":"Hotel search was not limited by the name!","hotelsearch_clearfiltr_price":"Hotel search was not limited by the price!","hotelsearch_clearfiltr_freesale":"The search was not limited by hotels on free sale only!","hotelsearch_clearfiltr_pricefreesale":"The search was not limited by the price and hotels on free sale only!","hotelsearch_addresult":"The following hotels do not fully match your search criteria!","rate_description":"Rate description","fullprice":"Total price of accommodation","hotel_btn_search":"Hotel search","hotel_addfiltr_search":"Advanced Search","roomtype":"Room type","commission":"Commission","meal":"Meal","availability":"Availability","booknow":"Book Now","title_search":"Hotel search.","title_search_ecndt":"10th european conference on Non-Destructive Testing. Hotel search.","period":"Period","curr":"Currency","pr":"Rates","comm":"Comments","one_pax":"1 pax","two_pax":"2 pax","free":"Free Sale","req":"On Request","req2":"On request","close":"Stop Sale","hotelsearch_quantity_of_nights":"Quantity of nights","hotelsearch_process_data":"Data is processed, please wait...","hotelsearch_range_ismoved":"the range of dates is automatically displaced","hotelsearch_attention":"Attention!","hotelsearch_tooltip_city_hotel":"Enter the name or choose from the list...","hotelsearch_disabled_hotel":"Attention, choose the city!","hotelsearch_obligatory":"The fields marked with a symbol *<\/span> are obligatory for filling","hotelsearch_obligatory_is_empty":"Not all obligatory fields are filled!","hotelsearch_err_durstay_limit":"Maximum allowable duration of stay is 31 nights!","hotel_search_ds":"Hotels worldwide","hotel_search_a":"Russian hotels","hotelsearch_wait":"Search in progress!Please wait for result...<\/b>"},"message":"Config Vars Data"}; var fPanelInit = function( config ){ var fServicesGridInit = function( config ){ var oServicesGridCfg = { itemId: 'servicesGrid', name: 'amenitylistgrid', store: { xtype: '-store', autoLoad: true, baseParams: { "typeRequest": "amenity" }, reader: { fields: [ 'Code', 'Name' ], idProperty: 'Code' } }, cm: new Ext.grid.ColumnModel({ defaults: { menuDisabled: true }, columns: [ { id: 'Code', dataIndex: 'Name' } ] }) }; var oServicesGrid = Ext.create( Ext.apply( oServicesGridCfg, config || {} ), '-multigridpanel' ); return oServicesGrid; }; var fFormPanelInit = function( config ){ /* Функция обновления store для поля "список отелей". ------------------------------------------------------------------- */ ExtVS.F.updateHotelList = function( oCombo, record, bHotelSelectAction ) { oCombo.setValue( record.data['Name'] ); oCombo.ownerCt.getComponent('cityCode').setValue( record.data['Code'] ); var oForm = oCombo.ownerCt.ownerCt; var oAdvanceSearch = oForm.find( 'itemId', 'advanceSearch' ); var oHotelCombo = oAdvanceSearch[0].getComponent('hotelList'); var oHotelStore = oHotelCombo.getStore(); oHotelCombo.emptyText = ''; oHotelCombo.setDisabled( false ); oHotelCombo.clearValue(); oHotelStore.setBaseParam( 'query', '' ) oHotelStore.setBaseParam( 'code', record.data['Code'] ); oHotelStore.load({ callback: function( r, options, success ) { if ( bHotelSelectAction && ExtVS.V.SesVars && ExtVS.V.SesVars.data['HotelCode'] && !Ext.isEmpty( ExtVS.V.SesVars.data['HotelCode'] ) && ( ExtVS.V.SesVars.data['HotelCode'] != 0 ) ) { oHotelCombo.setValue( ExtVS.V.SesVars.data['HotelCode'] ); oHotelCombo.ownerCt.getComponent('category').setDisabled( true ); oHotelCombo.ownerCt.getComponent('servicesPanel').setDisabled( true ); } else { oHotelCombo.fireEvent('keyup', oHotelCombo); } } }); }; var aFormItems = []; if ( ExtVS.V.bUserInner ) { aFormItems.push({ width: 220, fieldLabel: ExtVS.V.LanVars.data['inner_profitcentre'] + '*', xtype: '-dependentcombo', itemId: 'profitCenterX', name: 'profitCenterX', store: { baseParams: { typeRequest: 'profitcenter' } }, standartStore: true, disabled: false, //hasUndefined: true, //undefinedKey: 0, style: { background: 'transparent url("/extjs3/resources/images/default/grid/row-over.gif") 0 0 repeat-x' }, defaultVarName: 'SProfitCentreCode', dependTo: 'SUserX' }); aFormItems.push({ width: 220, fieldLabel: ExtVS.V.LanVars.data['inner_suser'] + '*', xtype: '-dependentcombo', itemId: 'SUserX', name: 'SUserX', store: { baseParams: { typeRequest: 'suser', newtype: 'ProfitCenter' } }, standartStore: true, //hasUndefined: true, //undefinedKey: 0, style: { background: 'transparent url("/extjs3/resources/images/default/grid/row-over.gif") 0 0 repeat-x' }, defaultVarName: 'SUserCode', dependTo: 'AgentX' }); aFormItems.push({ width: 220, fieldLabel: ExtVS.V.LanVars.data['inner_agent'] + '*', xtype: '-dependentcombo', itemId: 'AgentX', name: 'AgentX', fields: [ 'Code', 'InternalName', 'Name' ], displayField: 'InternalName', store: { baseParams: { typeRequest: 'agent', newtype: 'SUser' } }, standartStore: true, //hasUndefined: true, //undefinedKey: 0, editable: true, defaultVarName: 'AgentCode', dependTo: 'BuyerX' }); aFormItems.push({ width: 220, fieldLabel: ExtVS.V.LanVars.data['inner_contract'] + '*', xtype: '-dependentcombo', disabledClass: '', fields: [ 'Code', //'Number', //'Date', { name: 'Contract', convert: function(v, record){ return record.Number + ' ' + record.Date; } } ], displayField: 'Contract', itemId: 'BuyerX', name: 'BuyerX', store: { baseParams: { typeRequest: 'buyer', newtype: 'Agent' } }, standartStore: true, //hideTrigger: true, //readOnly: true, style: { background: 'transparent url("/extjs3/resources/images/default/grid/row-over.gif") 0 0 repeat-x', color: 'black', opacity: 1 }, defaultVarName: 'ContractId' }); aFormItems.push({ xtype: 'spacer', height: 15 }); } aFormItems.push({ xtype: 'hidden', itemId: 'cityCode', name: 'cityCode', value: ExtVS.V.nCityCode || '' }); if ( !ExtVS.V.nCityCode ) { aFormItems.push({ width: 220, fieldLabel: ExtVS.V.LanVars.data['city'] + '*', xtype: '-combo', itemId: 'cityList', name: 'cityList', displayField: 'FullName', valueField: 'Code', hiddenName: 'cityList', fields: [ 'Code', 'FullName', 'Name' ], standartStore: true, store: { baseParams: { "typeRequest": "cities" } }, listeners: { select: function( combo, record, index ) { ExtVS.F.updateHotelList( combo, record ); combo.validate(); }, afterrender: function( combo ){ var nDefaultCityCode = ( ExtVS.V.SesVars && ExtVS.V.SesVars.data['CityCode'] ) ? ExtVS.V.SesVars.data['CityCode'] : 2; ExtVS.F.forceSetValueByStore( combo, nDefaultCityCode, ExtVS.F.updateHotelList ); } } }); } aFormItems.push({ xtype: '-datefield', itemId: 'arrival', name: 'startdate', fieldLabel: ExtVS.V.LanVars.data['hotelsearch_in'] + '*' }); aFormItems.push({ xtype: '-datefield', itemId: 'departure', name: 'enddate', fieldLabel: ExtVS.V.LanVars.data['hotelsearch_out'] + '*' }); aFormItems.push({ style: 'width: auto; padding: 3px 3px 3px 0; font: 12px/20px tahoma,arial,helvetica,sans-serif', itemId: 'dateText', fieldLabel: ExtVS.V.LanVars.data['hotelsearch_quantity_of_nights'], xtype: 'label' }); aFormItems.push({ width: 220, fieldLabel: ExtVS.V.LanVars.data['hotelsearch_type'], name: 'placing', xtype: 'combo', store: new Ext.data.ArrayStore({ fields: ['Code', 'Name'], data: [ [ 1, ExtVS.V.LanVars.data['hotelsearch_1'] ], [ 2, ExtVS.V.LanVars.data['hotelsearch_2'] ] ] }), listeners: { render: function( combo ){ var nDefaultPlacing = ( ExtVS.V.SesVars && ExtVS.V.SesVars.data['NumberOfGuests'] ) ? ExtVS.V.SesVars.data['NumberOfGuests'] : 1; combo.setValue( nDefaultPlacing ); } }, editable: false, style: { background: 'transparent url("/extjs3/resources/images/default/grid/row-over.gif") 0 0 repeat-x' }, displayField: 'Name', valueField: 'Code', hiddenName: 'numberofguests', typeAhead: true, mode: 'local', forceSelection: true, triggerAction: 'all' }); aFormItems.push({ fieldLabel: ExtVS.V.LanVars.data['hotelsearch_onlyfreesale'], name: 'freesale', xtype: '-checkbox', listeners: { render: function( combo ){ var nDefaultPlacing = ( ExtVS.V.SesVars && ExtVS.V.SesVars.data['FreeSale'] ) ? ExtVS.V.SesVars.data['FreeSale'] : false; if ( nDefaultPlacing ) { combo.setValue( nDefaultPlacing ); } } } }); aFormItems.push({ labelStyle: 'width: auto; font-size: 11px; color: gray;', labelSeparator: '', fieldLabel: ExtVS.V.LanVars.data['hotelsearch_obligatory'], xtype: 'label' }); aFormItems.push({ xtype: '-fieldset', collapsed: true, itemId: 'advanceSearch', title: ExtVS.V.LanVars.data['hotel_addfiltr_search'], items: [ { width: 220, xtype: '-combo', itemId: 'hotelList', name: 'hotelList', disabled: true, fieldLabel: ExtVS.V.LanVars.data['hotel'], hiddenName: 'hotelCode', hasUndefined: true, undefinedText: ExtVS.V.LanVars.data['hotelsearch_rate_star_any'], standartStore: true, store: { baseParams: { "typeRequest": "hotels" } }, listeners: { select: function( combo, record, index ) { //combo.validate(); бессмысленно! combo.ownerCt.getComponent('category').setDisabled( true ); combo.ownerCt.getComponent('servicesPanel').setDisabled( true ); }, valid: function( combo ) { if ( !combo.getStore().data.length ) { combo.ownerCt.getComponent('category').setDisabled( false ); combo.ownerCt.getComponent('servicesPanel').setDisabled( false ); //combo.markInvalid(); } }, keyup: function( combo, e ) { // Если передается e, то произошло нажатие, иначе - fireEvent. var sHotelField = ( e ) ? combo.getEl().dom : combo; if ( sHotelField.value.trim() == '' ) { combo.clearValue(); combo.ownerCt.getComponent('category').setDisabled( false ); combo.ownerCt.getComponent('servicesPanel').setDisabled( false ); } } } }, { layout: 'column', width: ExtVS.V.nCityCode && ExtVS.V.bHasInfo ? 220 : 350, border: false, bodyStyle: 'background: transparent;', itemId: 'fullprice', fieldLabel: ExtVS.V.LanVars.data['fullprice'] + ' (' + ExtVS.V.UserVars.data['CurrencyName'] + ')', items:[{ columnWidth: .5, layout: 'form', border: false, bodyStyle: 'background: transparent;', defaults: { labelSeparator: '', labelStyle: 'color: #004685;', //width: 80, anchor: '95%', xtype: 'numberfield', submitValue: false }, items: [ { fieldLabel: ExtVS.V.LanVars.data['hotelsearch_price_from'], itemId: 'priceFrom', name: 'pricefrom', listeners: { render: function( oField ){ new Ext.KeyMap( oField.getEl(), { key: 109, fn: function(){ oField.setValue( oField.value || oField.getValue() ); } }, 'keyup'); if ( ( ExtVS.V.SesVars && ExtVS.V.SesVars.data['PriceFrom'] ) ) if ( ExtVS.V.SesVars.data['PriceFrom'] != 0 ) oField.setValue( ExtVS.V.SesVars.data['PriceFrom'] ); } } },{ fieldLabel: ExtVS.V.LanVars.data['hotelsearch_price_to'], itemId: 'priceTo', name: 'priceto', listeners: { render: function( oField ){ if ( ( ExtVS.V.SesVars && ExtVS.V.SesVars.data['PriceTo'] ) ) if ( ExtVS.V.SesVars.data['PriceTo'] != 0 ) oField.setValue( ExtVS.V.SesVars.data['PriceTo'] ); } } } ] }] }, { width: 220, fieldLabel: ExtVS.V.LanVars.data['hotel_rate'], itemId: 'category', name: 'category', xtype: '-checkboxgroup', items: [ { boxLabel: ExtVS.V.LanVars.data['hotelsearch_rate_star_any'], xmlname: 'StarsAny', name: 'stars_any', width: 120 }, { boxLabel: ExtVS.V.LanVars.data['hotelsearch_rate_star_3'], xmlname: 'Stars3', name: 'stars_3' }, { boxLabel: ExtVS.V.LanVars.data['hotelsearch_rate_star_5'], xmlname: 'Stars5', name: 'stars_5' }, { boxLabel: ExtVS.V.LanVars.data['hotelsearch_rate_star_2'], xmlname: 'Stars2', name: 'stars_2' }, { boxLabel: ExtVS.V.LanVars.data['hotelsearch_rate_star_4'], xmlname: 'Stars4', name: 'stars_4' }, { boxLabel: ExtVS.V.LanVars.data['hotelsearch_rate_star_1'], xmlname: 'Stars1', name: 'stars_1' } ] } ] }); var oFormPanelCfg = { itemId: 'searchFormPanel', baseCls: 'form-panel-base-cls', items: [{ xtype: '-fieldset', itemId: 'defaultSearch', items: aFormItems }], standardSubmit: true, url: '/online/' + ExtVS.V.TplVars.data['lang'] + '-hotelsearch.jsp', footerCssClass: 'my-x-panel-footer' }; var oFormPanel = Ext.create( Ext.apply( oFormPanelCfg, config || {} ), '-formpanel' ); return oFormPanel; }; /* Инициализация объекта формы поиска из "ответа" ajax-запроса */ var aFormPanelCfg = ( ExtVS.V.nCityCode ) ? {labelAlign: ( ExtVS.V.bHasInfo ) ? 'top' : 'left'} : {}; var oFormPanel = fFormPanelInit( Ext.apply( aFormPanelCfg, config || {} ) ); Ext.Ajax.on('requestcomplete', function( conn, response, options ){ if ( options.url.search( ExtVS.V.sRequestName ) === -1 && options.params['typeRequest'] == 'currencyname' ) { return; } if ( response.responseText.search( 'success' ) !== -1 ) { var oResponseData = Ext.decode( response.responseText ); if ( oResponseData['success'] === false ) { ExtVS.F.createMessage({ msg: oResponseData['message'] }); } } }); /* Инициализация объекта списка услуг гостиницы из "ответа" ajax-запроса */ var aServicesGridCfg = { border: false, region: 'south', height: 126, hideHeaders: true }; var oServicesGrid = fServicesGridInit( aServicesGridCfg ); /* Инициализация объекта панели списка услуг гостиницы */ var oServicesPanelCfg = { xtype: 'panel', itemId: 'servicesPanel', monitorResize: true, autoWidth: true, height: 172, border: false, layout: 'border', bodyStyle: { border: '1px solid #B5B8C8' }, items: [ { itemId: 'detailPanel', region: 'center', border: false, monitorResize: true, autoScroll: true, bodyStyle: { background: '#ffffff', padding: '3px 7px', font: '11px/13px arial,tahoma,helvetica,sans-serif', borderBottom: '1px solid #B5B8C8' }, html: '' + ExtVS.V.LanVars.data['hotel_services'] + ':' }, { xtype: 'hidden', itemId: 'amenitylist', name: 'amenitylist', value: '' }, oServicesGrid ] }; /* Начальное присвоение объектов элементов формы переменным ------------------------------------------------------------------- */ /* Основной fieldset формы */ var oDefaultSearch = oFormPanel.getComponent('defaultSearch'); if ( ExtVS.V.bUserInner ) { var oProfit = oDefaultSearch.getComponent('profitCenterX'); var oUser = oDefaultSearch.getComponent('SUserX'); var oAgent = oDefaultSearch.getComponent('AgentX'); var oBuyer = oDefaultSearch.getComponent('BuyerX'); oBuyer.getStore().on('load', function( oStore, oRecord, oOptions ) { var oFullPrice = this.ownerCt.getComponent('advanceSearch').getComponent('fullprice'); Ext.Ajax.request({ method: 'GET', url: '/source_new/' + ExtVS.V.sRequestName + '.jsp', params: { typeRequest: 'currencyname' }, success: function( o, s, r ) { if ( o.responseText.search( 'success' ) !== -1 ) { var oResponseData = Ext.decode( o.responseText ); oFullPrice.label.dom.innerHTML = ExtVS.V.LanVars.data['fullprice'] + ' (' + oResponseData['data'] + ')'; } } }); }, oAgent); } var oCityCode = oDefaultSearch.getComponent('cityCode'); var oCityList = oDefaultSearch.getComponent('cityList'); var oArrival = oDefaultSearch.getComponent('arrival'); var oDeparture = oDefaultSearch.getComponent('departure'); var oDateText = oDefaultSearch.getComponent('dateText'); /* Cкрытый fieldset формы */ var oAdvanceSearch = oDefaultSearch.getComponent('advanceSearch'); var oHotelList = oAdvanceSearch.getComponent('hotelList'); var oPriceFrom = oAdvanceSearch.find('itemId','priceFrom')[0]; var oPriceTo = oAdvanceSearch.find('itemId','priceTo')[0]; var oServicesPanel = oAdvanceSearch.add( oServicesPanelCfg ); var oAmenityList = oServicesPanel.getComponent('amenitylist'); var oServicesSelModel = oServicesGrid.getSelectionModel(); /* Проверка значений перед событием "Submit" */ oFormPanel.getForm().on('beforesubmit', function( oForm ){ switch ( true ) { case ExtVS.V.bUserInner && Ext.isEmpty( oProfit.getValue() ): case ExtVS.V.bUserInner && Ext.isEmpty( oUser.getValue() ): case ExtVS.V.bUserInner && Ext.isEmpty( oAgent.getValue() ): case ExtVS.V.bUserInner && Ext.isEmpty( oBuyer.getValue() ): ExtVS.F.createMessage({ msg: ExtVS.V.LanVars.data['hotelsearch_obligatory_is_empty'] }); return true; break; case Ext.isEmpty( oCityCode.getValue() ): case Ext.isEmpty( oArrival.getValue() ): case Ext.isEmpty( oDeparture.getValue() ): ExtVS.F.createMessage({ msg: ExtVS.V.LanVars.data['hotelsearch_obligatory_is_empty'] }); return true; break; case parseInt( oPriceFrom.getValue(), 10 ) < 0: case parseInt( oPriceTo.getValue(), 10 ) < 0: ExtVS.F.createMessage({ width: 420, msg: ExtVS.V.LanVars.data['hotelsearch_err_negativeprice'] + '!' }); return true; break; } return false; }, oFormPanel); /* Действия с панелью оповещения при выделении строк грида списка услуг */ oServicesSelModel.on('selectionchange', function( selModel ) { var aDetailPanel = selModel.grid.ownerCt.find( 'itemId', 'detailPanel' ); var sServicesText = '' + ExtVS.V.LanVars.data['hotel_services'] + ': ', i = 0; var aSelections = selModel.getSelections(); var sAmenityValue = ''; Ext.each(aSelections, function( item, index, allItems ){ if ( index ) { sServicesText += ', '; } sServicesText += item.data['Name']; sAmenityValue += item.data['Code'] + '#'; }); oAmenityList.setValue( sAmenityValue ); var oServicesTpl = new Ext.Template( sServicesText ); oServicesTpl.overwrite( aDetailPanel[0].body, sServicesText ); }); if ( ExtVS.V.SesVars ) { switch ( true ) { case !Ext.isEmpty( ExtVS.V.SesVars.data['AmenityList'] ): case !Ext.isEmpty( ExtVS.V.SesVars.data['Stars1'] ): case !Ext.isEmpty( ExtVS.V.SesVars.data['Stars2'] ): case !Ext.isEmpty( ExtVS.V.SesVars.data['Stars3'] ): case !Ext.isEmpty( ExtVS.V.SesVars.data['Stars4'] ): case !Ext.isEmpty( ExtVS.V.SesVars.data['Stars5'] ): case !Ext.isEmpty( ExtVS.V.SesVars.data['PriceFrom'] ) && ( ExtVS.V.SesVars.data['PriceFrom'] != 0 ): case !Ext.isEmpty( ExtVS.V.SesVars.data['PriceTo'] ) && ( ExtVS.V.SesVars.data['PriceTo'] != 0 ): case !ExtVS.V.nCityCode && !Ext.isEmpty( ExtVS.V.SesVars.data['HotelCode'] ) && ( ExtVS.V.SesVars.data['HotelCode'] != 0 ): oAdvanceSearch.expand( false ); break; } } /* Проверка возвращенных данных для полей "Город" и "Гостиница" */ oHotelList.getStore().on('load', function( store, records, options ){ oHotelList.validate(); }); if ( !ExtVS.V.nCityCode ) { oCityList.getStore().on('load', function( store, records, options ){ if ( !records.length ) { ExtVS.F.toClearADependentField( oHotelList, ExtVS.V.LanVars.data['hotelsearch_disabled_hotel'] ); oHotelList.fireEvent('keyup', oHotelList); oCityList.ownerCt.getComponent('cityCode').setValue( '' ); } }); oCityList.on('keyup', function( combo, e ) { if ( e.getKey() != Ext.EventObject.ENTER ) { oCityList.ownerCt.getComponent('cityCode').setValue( '' ); } var oCityField = ( e ) ? combo.getEl().dom : combo; // Если передается e, то произошло нажатие, иначе - fireEvent. if ( oCityField.value.trim() == '' ) { ExtVS.F.toClearADependentField( oHotelList, ExtVS.V.LanVars.data['hotelsearch_disabled_hotel'] ); oHotelList.fireEvent('keyup', oHotelList); } }); } else { oHotelList.getStore().setBaseParam( 'code', ExtVS.V.nCityCode ); oHotelList.setDisabled( false ); } /* Определение диапазона дат */ ExtVS.F.addDateRangeListeners( oArrival, oDeparture, oDateText ); /* Возвращение объекта формы */ return oFormPanel; }; fPanelInit({renderTo: ExtVS.V.sPlatformId}); });