
Ext.namespace("Ext.hansub.camping");

Ext.hansub.camping.MyCampingReservationInfoPanel = function(config) {
	
	this.config = config;

	
	Ext.hansub.camping.MyCampingReservationInfoPanel.superclass.constructor.call(this, this.config);

	// render event
	this.on('render', this.init, this);
	 
   
};

Ext.extend(Ext.hansub.camping.MyCampingReservationInfoPanel, Ext.Panel, {
	

	init : function(){
		
		
	  //camping_user_id가 넘어온 경우
	  //alert(this.config.camping_user_uid);
		if(this.config.camping_user_uid){
			Ext.Ajax.request({
				url: './src/api/Interface.php',
				params:{
					'class':'Camping',
	    			method:'getCampingUserInfo',
	    			html:'true',
	    			camping_user_id:this.config.camping_user_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(){		
		//<img onLoad='cvi_corner.add(this, { radius:5});' src='./images/story/thumbnails/"+value+"' width='90'>
		
		//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 border=0 width=100% border='1'>" +
				 					"<tr>" +
				 					"	<td width=1 bgcolor='#15428B'>" +
				 					"		<div><img src='"+this.config.data.userimage+"'></div>" +
				 					"	</td>" +
				 					"	<td class='myInfoHead' >" +
				 					"		<b><div class='mycamping'>'" +this.config.camping_list_name + "' 예약  시스템  (관리자 :"+this.config.data.name+")</div></b> " +
				 					"		<div style='font-size: 8pt;padding-top:5px;padding-left:10px;'> + 캠핑지도 정복율 <font color=red>"+this.config.data.conqueror_rate+"</font>% : 전국 <b>"+this.config.data.total_count+"</b>개의 캠핑장 중 <b>"+this.config.data.conqueror_count+"</b>개의 캠핑장을 정복</div>" +
				 					"		<div style='font-size: 8pt;padding-top:5px;padding-left:10px;'> + 다음  캠핑예정지 : <b>"+this.config.data.nextcampingjang+"</b> + <b>"+this.config.data.hobby+"</b></div>"+
				 					"		<div style='font-size: 8pt;padding-bottom:5px;padding-top:5px;padding-left:10px;padding-right:80px;'><img src=./images/icons/comment.gif><b>"+this.config.data.description+"</b></div>"+
				 					"	</td>" +
				 					"</tr>" +
				 					"<tr>" +
				 					"	<td colspan='2' height='1' bgcolor='#8db2e3' style='border-bottom-width:2; border-bottom-color:#eeeeee; border-bottom-style:solid;'></td>" +
				 					"</tr>"+
				 					"</table>"
		);
		
		tpl.overwrite(this.body, this.config.data);
	}
	
});

