<?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">Add Attendee</div>
        <div class="panel-body">
                    <?php echo form_open('admin/insertDetails'); ?>
                    <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" />
                            </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 echo $c['cat_name']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                      
                    </div>
					<div class="row" style="margin-bottom:10px !important;">
                        <div class="col-sm-12">
                            <div class="input-group">
                                <span class="input-group-addon">Amount</span>
                                <input type="text" class="form-control" required="required" name="amount" id='amount' />
                            </div>
                        </div>
                    </div>
                    <div class="row" style="margin-bottom:10px !important;">
                        <div class="col-sm-12">
                            <div class="input-group">
                                <span class="input-group-addon">Full Name</span>
                                <input type="text" class="form-control" required="required" name="names" id='names' />
                            </div>
                        </div>
                    </div>
                    <div class="row" style="margin-bottom:10px !important;">
                        <div class="col-sm-4" style="margin-bottom:10px !important;">
                            <div class="input-group">
                                <span class="input-group-addon">Phone</span>
                                <input type="text" name="phone" required="required" class="form-control" id='phone'  />
                            </div>
                        </div>
                        <div class="col-sm-8">
                            <div class="input-group">
                                <span class="input-group-addon">Email Address</span>
                                <input type="email" class="form-control" name="email" required="required" id='email' />
                            </div>
                        </div>
                    </div>
                    <div class="row" style="margin-bottom:10px !important;">
                        <div class="col-sm-12">
                            <div class="input-group">
                                <span class="input-group-addon">Company</span>
                                <input type="text" class="form-control" name="company" required="required"  />
                            </div>
                        </div>
                    </div>
                     <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">Receipt No</span>
                                    <input type="text" class="form-control" name="tellerNo" required="required"/>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">Payment Date</span>
                                    <input type="date" name="payDate" required class="form-control" /> 
                                </div>
                            </div>
                        </div>
                        <div class="row" style="margin-bottom:10px !important;">
                            <div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">Payment Mode</span>
                                    <select name="paymode" required class="form-control" > 
										<option value="Cheque">Cheque</option>
										<option value="Online">Online</option>
										<option value="POS">POS</option>
										<option value="Teller">Teller</option>
										<option value="Transfer">Transfer</option>
									</select>
                                </div>
                            </div><br/>
							<div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">Bank</span>
                                    <select name="bank" required class="form-control" > 
										<option value="firstbank">First Bank</option>
										<option value="gtbank">GTBank</option>
										<option value="skye">Skye Bank</option>
										<option value="uba">UBA</option>
										<option value="zenith">Zenith Bank</option>
									</select>
                                </div>
                            </div>
                        </div>
                        <div class="row" style="margin-bottom:10px !important;">
							<div class="col-sm-6">
                                <div class="input-group">
                                    <span class="input-group-addon">Teller No.</span>
                                    <input type="text" name="form_no" class="form-control" /> 
                                </div>
                            </div>
                       
                            <div class="col-sm-4">
                               <input type="submit" class="btn btn-primary" value="Submit" />
                            </div>
                        </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);
				    $("#names").val(data[index].memberSurname + ' ' + data[index].memberOthernames);
var category = $("#category").val();
if (category == 1){
						$("#amount").val(25000);
					} else if (category == 2){
						$("#amount").val(25000);
					}
					 else if (category == 3){
						$("#amount").val(25000);
					}
					 else if (category == 4){
						$("#amount").val(25000);
					}
					 else if (category == 5){
						$("#amount").val(10000);
					}else if (category == 6){
						$("#amount").val(30000);
					}
                                });
                            })
           
                })
				$("#category").change(function() {
                    var category = $(this).find(":selected").val(); 
                    if (category == 1){
						$("#amount").val(25000);
					} else if (category == 2){
						$("#amount").val(25000);
					}
					 else if (category == 3){
						$("#amount").val(25000);
					}
					 else if (category == 4){
						$("#amount").val(25000);
					}
					 else if (category == 5){
						$("#amount").val(10000);
					}else if (category == 6){
						$("#amount").val(30000);
					}
					
                })
			
            })
        </script>
        