<?php
$pgMod="enquirydetail";
$pgAct="view";

//echo "<pre>";print_r($_SESSION);echo "</pre>";


if(isset($_GET['action']) && trim($_GET['action'])!='')
	$pgAct=strtolower($_GET['action']);

if($pgAct=="delete" && isset($_GET['id']) && trim($_GET['id'])!='')
{
	$res=$db->delete("complain","where  id='".$_GET['id']."'");
	if(!is_null($res)) { $_SESSION['msg']='Deleted Successfully'; }
	else { array_push($alert_err,$db->getErMsg()); }
	redirect(URL_ADMIN_HOME.getQueryString(array("src"=>"Enquiry", "page_id"=>$pgMod)));
} 
if(isset($_SESSION['msg']) && $_SESSION['msg']!="")
{
	?>
	<div class="alert alert-success">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-thumbs-up-alt"></i> <b>complain</b><?php echo $_SESSION['msg'] ?></i>
	</div>
	<?php
	unset($_SESSION["msg"]);
}
if(is_array($alert_err) && count($alert_err)>0)
{
	?>
	<div class="alert alert-error">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-warning-sign"></i> <b>complain</b> <?php echo $alert_err[0] ?></i>
	</div>
	<?php
}
else{
?>
	<div class="row-fluid"><div class="span12"><div class="top-bar">
    <h3><i class="icon-eye-open"></i> <?php echo ucwords($pgAct." ".$pgMod); ?></h3>
    </div>
    <div class="well no-padding">
	<?php
	$aryPgAct=array("src"=>"Enquiry", "page_id"=>$pgMod,"action"=>"add");
	$aryList=$db->getRow("SELECT * FROM enquiry where id =".$_GET['id']); $i=0;

//echo "<pre>";print_r($aryList);exit;

	if(is_array($aryList) && count($aryList)>0)
	{
		?>
        <table class="table" id="example">
            
          <form method="post">  
            
            <tbody>
            <?php $aryList;
			 $i++; 
	
			
            ?>
                <tr>
                    
                    <td style="width:20%"> Enquiry by </td>
                    
                    <td><?php echo   $aryList['name'];	?>
</td>
                    
                </tr>
                <tr>
                    
                    <td> Detail  </td>
                    
                    <td><?php echo  $aryList['detail'];	?>
</td>
                    
                </tr>
                
                <tr>
                    
                    <td> Reply </td>
                    
                    <td><textarea name='reply' rows='8'  style="resize:none;width:85%" ></textarea>
</td>
                    
                </tr>
<!--btn-->                
                <tr>
                
                    
                    <td colspan="2" >
                    
					<?php $aryPgAct['action']="edit"; ?>
<input type="hidden" name="complain_id" value="$aryList['id']"  >

                         <a style="float:left" href="<?php echo URL_ADMIN_HOME.getQueryString($aryPgAct); ?>"><button type="submit" name="submit" class="btn btn-info">Submit</button></a>
                    <?php $aryPgAct['action']="delete"; ?>
                         <a href="javascript:;" onclick="del('<?php echo URL_ADMIN_HOME.getQueryString($aryPgAct); ?>')" class="confirmation"><button type="button" class="btn btn-danger">Delete</button></a>  

                    </td>
					
                    
                
                </tr>
            <?php  ?>
            </tbody>
           
          </form>  
            
            <tfoot>
                <tr>
                    <th></th>
                    <th colspan="2"></th>
                </tr>
            </tfoot> 
            
        </table>
		<?php
	}
	else{
		?>
        <div class="alert alert-info">
          <a class="close" data-dismiss="alert">×</a>
          <i class="icon icon-warning-sign"></i> <b>complain</b> Record not found </i>
        </div>
        <?php
	} 
	?>
	</div></div></div>
	<?php
}
?>
<!-- / Forms -->