<?php
$atts = array(
              'width'      => '600',
              'height'     => '600',
              'scrollbars' => 'yes',
              'status'     => 'no',
              'resizable'  => 'no',
              'screenx'    => '20',
              'screeny'    => '50',
    'class'=>'btn btn-primary'
            );
?>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <div class="panel panel-primary">
        <div class="panel panel-heading">Edit Attendee</div>
        <div class="panel-body">
            <?php echo form_open('admin/editAttendee2'); ?>
            <div class="input-group" style="margin-bottom: 10px !important;">
                <span class="input-group-addon">Transaction Id</span>
                <input type="text" name="transId" required class="form-control" />
            </div>
 <div class="input-group" style="margin-bottom: 10px !important;">
                <span class="input-group-addon">Name</span>
                <input type="text" name="app_name" class="form-control" />
            </div>
              <div class="input-group" style="margin-bottom: 10px !important;">
                
                  <input type="submit" value="Search" class="btn btn-primary" />
            </div>
            <?php echo form_close(); ?>
            <hr />
                    <?php echo form_open('admin/updateAttendee'); 
                    if(empty($transaction)){
                        echo "<pre><span>Invalid Transaction Id</span></pre>";
                    }else{
                    foreach($transaction as $row){}
                    }
                    ?>
<div class="row" style="margin-bottom:10px !important;">
                          <div class="col-sm-6" style="margin-bottom:10px !important;">
                            <div class="input-group">
                                <span class="input-group-addon">NIQS Membership Number</span>
                                <input type="text" class="form-control" name="niqsNo" id="niqsNo" value="<?php echo $row['memberNo']; ?>" />
                            </div>
                        </div>
                        <div class="col-sm-6" >
                            <div class="input-group">
                                <span class="input-group-addon">Select Category</span>
                                <select class="form-control" required="required" name="category" id='category'>
                                    <option value="">Select Category</option>
                                    <?php foreach ($categories as $c) { ?>
                                        <option value="<?php echo $c['cat_id']; ?>" <?php if ($row['confCatID'] == $c['cat_id']) echo 'selected'; ?> ><?php echo $c['cat_name']; ?>
                                        </option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                      
                    </div>
            <div class="input-group" style="margin-bottom: 10px !important;">
                <span class="input-group-addon">Name</span>
                <input type="hidden" name="confID" value="<?php echo $row['confID']; ?>" />
                <input type="text" name="name" id="name" required class="form-control" value="<?php echo $row['confName']; ?>" />
            </div>
            <div class="input-group" style="margin-bottom: 10px !important;">
                <span class="input-group-addon">Email</span>
                <input type="email" name="email" id="email" required class="form-control" value="<?php echo $row['confEmail']; ?>" />
            </div>
            <div class="input-group" style="margin-bottom: 10px !important;">
                <span class="input-group-addon">Phone</span>
                <input type="number" name="phone" id="phone" required class="form-control" value="<?php echo $row['confPhone']; ?>" />
            </div>
<div class="input-group" style="margin-bottom: 10px !important;">
                <span class="input-group-addon">Amount</span>
<input type="hidden" name="transId" value="<?php echo $row['transID']; ?>" />
                <input type="text" name="amount" id="amount" required class="form-control" value="<?php echo $row['transAmount']; ?>" />
            </div>
<div class="input-group" style="margin-bottom: 10px !important;">
                <span class="input-group-addon">Receipt Number</span>
                <input type="text" name="formNo" id="formNo" required class="form-control" value="<?php echo $row['confAuthNum']; ?>" />
            </div>
              <div class="input-group" style="margin-bottom: 10px !important;">
                
                  <input type="submit" value="Update" class="btn btn-primary" />
            </div>
                  
<?php echo form_close(); ?>
                </div>
    </div>
    
</div>

<script src="<?php echo base_url('assets/js/jquery-1.11.js');?>" type="text/javascript"></script>
<script>
            $(document).ready(function() {
                
                $("#niqsNo").change(function() {
                    var niqsNo = $("#niqsNo").val();
                    dis_url = <?php echo "'" . site_url('admin/getMemberDetails') . "'"; ?> + '/' + niqsNo;
                    $.getJSON(dis_url, function(data) {
                                $.each(data, function(index) {
                                    //alert(data[index].memberName);
                                    $("#category").val(data[index].memberGrade);
                                    $("#phone").val(data[index].memberPhone);
                                    $("#email").val(data[index].memberEmail);
				    $("#name").val(data[index].memberSurname + ' ' + data[index].memberOthernames);
var category = $("#category").val();
                    if (category == 1){
                        $("#amount").val(40000);
                    } else if (category == 2){
                        $("#amount").val(35000);
                    }
                     else if (category == 3){
                        $("#amount").val(27750);
                    }
                     else if (category == 4){
                        $("#amount").val(27750);
                    }
                     else if (category == 5){
                        $("#amount").val(15000);
                    }else if (category == 6){
                        $("#amount").val(50000);
                    } else if (category == 7){
                        $("#amount").val(0);
                    }
                                });
                            })
           
                })
        $("#category").change(function() {
            var category = $(this).find(":selected").val(); 
           if (category == 1){
                $("#amount").val(40000);
            } else if (category == 2){
                $("#amount").val(35000);
            }
             else if (category == 3){
                $("#amount").val(27750);
            }
             else if (category == 4){
                $("#amount").val(27750);
            }
             else if (category == 5){
                $("#amount").val(15000);
            }else if (category == 6){
                $("#amount").val(50000);
            } else if (category == 7){
                $("#amount").val(0);
            }
        })
			
            })
        </script>
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

