<? include ("../settings.php"); ?>
<? include ("session.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Delegate Details</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script>
        function frmsubmit(){
            $.ajax({
                type:"POST",
                url:"replace_edit_ajax.php",
                data:$("#delegate").serialize(),//only input
                success: function(response){
                    if (response != "1"){
                        alert(response);
                    }else{
                        alert("Changes saved.");
                        $('#myModal').modal('hide');
                    }
                }
            });
        }
        
    </script>
   </head>
<body>
<div class="well">
<div class="content" bgcolor="#FFFFD0">
<div class="col-12 feature">
<div class="panelCheck">
    <div class="panel-heading">
        <h3 class "panel-title"><strong>Delegate Details - Replacement</strong></h3>
    </div>

    <form name="delegate" id="delegate" method='POST' action="" enctype="multipart/form-data" class="form-horizontal" role="form">
    <center>
       
<?
    $bind = array(
        ":search1" => $_REQUEST['registrant_id']
    );
    $results = $db->select("tbl_registrant as a", "a.registrant_id = :search1", $bind);
    $result = $results[0];
    //<input type='text' class='form-control' id='datevisit' name='datevisit' value="=date("d-m-Y",strtotime ($row['datevisit']));">
?>        
        
<div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title">Delegate to be replaced</h3>
      </div>
      <div class="panel-body">
        <div class='form-group'>
            <label for='registrant_sn' class='col-lg-4 control-label'>Delegate Number</label>
            <div class='col-lg-4  text-left'>
                 <?=$result['registrant_sn'];?>           
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_fullname' class='col-lg-4 control-label'>Name</label>
            <div class='col-lg-4  text-left'>
                 <?=$result['registrant_fullname'];?>           
            </div>
        </div>         
        <div class='form-group'>
            <label for='registrant_organisation' class='col-lg-4 control-label'>Organisation</label>
            <div class='col-lg-4  text-left'>
                 <?=$result['registrant_organisation'];?>          
            </div>
        </div>   
           
    </div>
</div>          
        
<div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title">Delegate's' Particulars</h3>
      </div>
      <div class="panel-body">
        <div class='form-group'>
            <label for='registrant_type' class='col-lg-4 control-label'>Registration Type</label>
            <div class='col-lg-4  text-left'>
                <select class='form-control' id='registrant_type' name='registrant_type'><option value="0">Please Select</option>
                 <?
                    $output = "";
                    $registrant_types = $db->select("tbl_reg_type");
                    foreach ($registrant_types as $registrant_type){
                        echo "<option value='".$registrant_type['reg_type']."'>".$registrant_type['reg_type']."</option>";
                    }
                    echo $output;
                ?>            
                </select>
            </div>
        </div>
            
        <div class='form-group'>
            <label for='registrant_salutation' class='col-lg-4 control-label'>Salutation</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_salutation" id="registrant_salutation">
            </div>
        </div>    
        <div class='form-group'>
            <label for='registrant_fullname' class='col-lg-4 control-label'>Full Name</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_fullname" id="registrant_fullname">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_firstname' class='col-lg-4 control-label'>First Name</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_firstname" id="registrant_firstname">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_lastname' class='col-lg-4 control-label'>Last Name</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_lastname" id="registrant_lastname">
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_designation' class='col-lg-4 control-label'>Designation</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_designation">
            </div>
        </div>
        <div class='form-group'>
            <label for='registrant_organisation' class='col-lg-4 control-label'>Organisation</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_organisation" id="registrant_organisation">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_email' class='col-lg-4 control-label'>Email</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_email" id="registrant_email">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_diet' class='col-lg-4 control-label'>Diet</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_diet" id="registrant_diet">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_badgecolour' class='col-lg-4 control-label'>Badge Colour</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_badgecolour" id="registrant_badgecolour">
            </div>
        </div>
        <div class='form-group'>
            <label for='remarks' class='col-lg-4 control-label'>Remarks</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="remarks" id="remarks">
            </div>
        </div>

		<div class='form-group'>
            <label for='registrant_paid' class='col-lg-4 control-label'>Payment Status</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_paid" id="registrant_paid" value="<?=$result['registrant_paid'];?>">
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_payment_mode' class='col-lg-4 control-label'>Payment Mode</label>
           <div class='col-lg-4  text-left'>
                <select class='form-control' id='registrant_payment_mode' name='registrant_payment_mode'><option value="0">Please Select</option>
                 <?
                    $output = "";
                    $registrant_payment_modes = $db->select("tbl_pay_mode");
                    foreach ($registrant_payment_modes as $registrant_payment_mode){
                        if ($registrant_payment_mode['pay_mode']==$result['registrant_payment_mode'])
                            echo "<option value='".$registrant_payment_mode['pay_mode']."' selected>".$registrant_payment_mode['pay_mode']."</option>";
                        else
                            echo "<option value='".$registrant_payment_mode['pay_mode']."'>".$registrant_payment_mode['pay_mode']."</option>";
                    }
                    echo $output;
                ?>            
                </select>
            </div>
        </div>
		<div class='form-group'>
            <label for='registrant_paid_amount_total' class='col-lg-4 control-label'>Amount</label>
            <div class='col-lg-6 text-left'>
                <input type="text" class="form-control" name="registrant_paid_amount_total" id="registrant_paid_amount_total" value="<?=$result['registrant_paid_amount_total'];?>">
            </div>
        </div>
    </div>       
    <?
        $bind = array(":search1"=>$_REQUEST['registrant_id']);
        $exists = $db->select("tbl_registrant_attendance","registrant_id=:search1",$bind);
        if (count($exists)>0)
            $attendance = "disabled";
        else
            $attendance = "";
    ?>
    <input type="hidden" name="registrant_id" value="<?php echo $result['registrant_id']; ?>">
    <input type="hidden" name="role_id" value="8">
    <input type="button" name="confirm" value="Replace Delegate" class="btn btn-default" onclick="frmsubmit();" <?=$attendance?>>
    <input type="button" value="Close" class="btn btn-default" onclick="$('#myModal').modal('hide')">
    <br><br>        
        
    </center>
    <span>
    </span>
    </form>
</div>
</div>
</div>
</div>
</body>
</html>
    
    

<?

	function cleandata(&$inputarray){
		foreach ($inputarray as $key => $value) {
			if (!is_array($inputarray[$key]))
				$inputarray[$key]=htmlentities($value,ENT_QUOTES);
		}
	}

?>
