
Ext.namespace("Ext.hansub.camping");

Ext.hansub.camping.CampingInfoPanel = function(config) {
	
	this.config = config;

	
	Ext.hansub.camping.CampingInfoPanel.superclass.constructor.call(this, this.config);
	
	// render event
	this.on('render', this.init, this);
	 
   
};

Ext.extend(Ext.hansub.camping.CampingInfoPanel, Ext.Panel, {
	

	init : function(){
		
		
  //camping_uid가 넘어온 경우
	if(this.config.camping_uid){
		Ext.Ajax.request({
			url: './src/api/Interface.php',
			params:{
					'class':'Camping',
    			method:'getCampingList',
    			html:'true',
    			camping_uid:this.config.camping_uid,
					limit:1
					},
			scope:this,
			success:function(response, options){
				var json = Ext.decode(response.responseText);
				this.config.data = json;
				this.update();
			},
			failure:function(response, options){
				Ext.MessageBox.alert('오류', '서버에 응답이 없습니다. 잠시 후 다시 접근해 주세요.')
			}
		});	

	}
	this.update();
	
},
update:function(){		
		
		
		
		
		
		//
    	//this.detailEl.hide().update("<div class='template_header'>"+this.config.data.name+"</div><pre><div class='template_content'>"+this.config.data.content+"</div></pre>").slideIn('l', {stopFx:true,duration:.5});
		 var tpl = new Ext.Template(
		"<table cellspacing=0 cellpadding='1' border=0 width=100%>"+
		"	<tr class='odd'>"+
		"	<td width='25%' style='border-bottom-width:3; border-bottom-color:#8db2e3; border-bottom-style:solid;' rowspan='2' valign='middle'>"+
		"	            <p align='center'><br><b>&nbsp;<font color=#35517c>"+this.config.data.name+"</font>&nbsp;<br></b>"+this.config.data.tel+"<br><img src=./images/info/star_48.png width=16 height=16><img src=./images/info/star_48.png width=16 height=16><img src=./images/info/star_48.png width=16 height=16><img src=./images/info/star_48.png width=16 height=16><img src=./images/info/star_off_48.png width=16 height=16><b><br></b></td>"+
		"	<td width='75%' class='info'  colspan='7' bgcolor='#F0F0F0' style='border-bottom-width:0; border-bottom-color:rgb(0,102,0); border-bottom-style:solid;'>"+
		"	            <p align='left'>캠핑장주소 : "+this.config.data.address+" / 예약문의 "+
		"	            : "+this.config.data.tel+" / 홈페이지 : <a target=_blank href="+this.config.data.homepage+">"+this.config.data.homepage+ 
		"	            </a>&nbsp;<br></td>"+
		"	</tr>"+
		"	<tr class='odd'>"+
		"	<td width='75%' colspan='7' class='info'  bgcolor='white' style='border-bottom-width:3; border-bottom-color:#8db2e3; border-bottom-style:solid;'>"+
		"	<p><img src=./images/info/sink_"+this.config.data.sink+".png><img src=./images/info/water.png><img src=./images/info/hwater_"+this.config.data.water+".png><img src=./images/info/barbecue_"+this.config.data.barbecue+".png><img src=./images/info/shower_"+this.config.data.shower+".png><img src=./images/info/power_"+this.config.data.power+".png><img src=./images/info/toilet_"+this.config.data.toilet+".png><img src=./images/info/waterplay_"+this.config.data.waterplay+".png><img src=./images/info/internet_"+this.config.data.internet+".png><img src=./images/info/store_"+this.config.data.store+".png></p>"+
		"	</td>"+
		"	</tr>"+
		"	<tr class='even'>"+
		"	<td class='info'  width='25%'>캠핑장 유형</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'>"+this.config.data.location+"</td>"+
		"	<td class='info'  width='25%'>텐트최대수용</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'>"+this.config.data.capacity+" 동</td>"+
		"	<td class='info'  width='25%'>연중휴무</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'>없음</td>"+
		"	<td class='info'  width='25%'>개수대</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.sink+".png width=12 height=12 border=0></td>"+
		"	</tr>"+
		"	<tr class='odd'>"+
		"	<td class='info'  width='25%'>전기지원</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.power+".png width=12 height=12 border=0></td>"+
		"	<td class='info'  width='25%'>온수지원</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.water+".png width=12 height=12 border=0></td>"+
		"	<td class='info'  width='25%'>텐트옆주차</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.withcampingcar+".png width=12 height=12 border=0></td>"+
		"	<td class='info'  width='25%'>매점</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.store+".png width=12 height=12 border=0></td>"+
		"	</tr>"+
		"	<tr class='even'>"+
		"	<td class='info'  width='25%'>샤워시설</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.shower+".png width=12 height=12 border=0></td>"+
		"	<td class='info'  width='25%'>노면타입</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'>"+this.config.data.landtype+"</td>"+
		"	<td class='info'  width='25%'>인터넷</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.internet+".png width=12 height=12 border=0></td>"+
		"	<td class='info'  width='25%'>화로사용</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.barbecue+".png width=12 height=12 border=0></td>"+
		"	</tr>"+
		"	<tr class='odd'>"+
		"	<td class='info'  width='25%'>화장실</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.toilet+".png width=12 height=12 border=0></td>"+
		"	<td class='info'  width='25%'>물놀이</td>"+
		"	<td class='info'  width='8%'>"+
		"	            <p align='center'><img src=./images/info/"+this.config.data.waterplay+".png width=12 height=12 border=0></td>"+
		"	<td class='info'  width='25%'>예약방식</td>"+
		"	<td class='info'  width='30%' colspan=3>"+
		"	            <p align='center'>"+this.config.data.reservationtype+"</td>"+
		"	</tr>"+
//		"	<tr class='odd'>"+
//		"	<td class='info'  width='25%'>요금방식</td>"+
//		"	<td class='info'  width='75%' colspan='7'>"+
//		"	            <p align='left'>1동 12000원</td>"+
//		"	</tr>"+
		"	<tr class='even'>"+
		"	<td class='info'  width='25%'>주변레져환경</td>"+
		"	<td class='info'  width='75%' colspan='7'>"+
		"	            <p align='left'>낚시 :<img src=./images/info/"+this.config.data.fishing+".png width=12 height=12 border=0> , 등산 :<img src=./images/info/"+this.config.data.mountain+".png width=12 height=12 border=0> , MTB :<img src=./images/info/"+this.config.data.mtb+".png width=12 height=12 border=0> , 스키 :<img src=./images/info/"+this.config.data.ski+".png width=12 height=12 border=0> , 수영 :<img src=./images/info/"+this.config.data.swimming+".png width=12 height=12 border=0></td>"+
		"	</tr>"+
		"	<tr class='odd'>"+
		"	<td class='info'  width='25%' style='border-bottom-width:1; border-bottom-color:rgb(53,81,124); border-bottom-style:solid;'>기타정보</td>"+
		"	<td class='info'  width='75%' colspan='7' style='border-bottom-width:1; border-bottom-color:rgb(53,81,124); border-bottom-style:solid;'>"+
		"	            <p align='left'>"+this.config.data.description+"</td>"+
		"	</tr>"+
		"	<p>"+
		"	</table>");
		
		tpl.overwrite(this.body, this.config.data);
	}
	
});

