<?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('welcome/confirm'); ?>
                    <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['confcatID']; ?>"><?php echo $c['confcatName']; ?></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-6" style="margin-bottom:10px !important;">
                            <div class="input-group">
                                <span class="input-group-addon">Grade</span>
                                <select class="form-control" required="required" name="grade" id='grade'>
                                    <option value="">Select Grade</option>
                                    <?php foreach ($grade as $g) { ?>
                                        <option value="<?php echo $g['gradeID']; ?>"><?php echo $g['gradeName']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon">Chapter</span>
                                <select class="form-control" required="required" name="chapter" id='chapter' >
                                    <option value="">Select Chapter</option>
<?php foreach ($state as $s) { ?>
                                        <option value="<?php echo $s['stateid']; ?>"><?php echo $s['state_name']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="row" style="margin-bottom:10px !important;">

                    </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="number" 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>
                    <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-12">
                            <div class="input-group">
                                <span class="input-group-addon">Address</span>
                                <textarea class="form-control" name="address" required="required" rows="5"></textarea>
                            </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">Postal Code</span>
                                <input type="number" class="form-control" name="postal" required="required"  />
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon">Country</span>
                                <select class="form-control" required="required" name="country">
                                    <option value="">Select Country</option>
<?php foreach ($country as $co) { ?>
                                        <option value="<?php echo $co['id']; ?>"><?php echo $co['value']; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="row" style="margin-bottom:10px !important;">
		
                        <div class="col-sm-6">
                            <input type="submit" id="submit" class="btn btn-primary" value="Continue" />
                        </div>
                    </div>
<?php echo form_close(); ?>
                </div>
    </div>
    
</div>
<script src="<?php echo base_url('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('welcome/getMemberDetails') . "'"; ?> + '/' + niqsNo;
                    $.getJSON(dis_url, function(data) {
                                $.each(data, function(index) {
                                    //alert(data[index].memberName);
                                    $("#category").val(data[index].memberGrade);
                                    $("#grade").val(data[index].memberGrade);
                                    $("#phone").val(data[index].memberPhone);
                                    $("#email").val(data[index].memberEmail);
$("#names").val(data[index].memberName);

                                });
                            })
           
                })
				$("#category").change(function() {
                    var category = $(this).find(":selected").val(); //$("#category").val();
                    if (category == 1){
						$("#amount").val(300001);
					} else if (category == 2){
						$("#amount").val(300002);
					}
					 else if (category == 3){
						$("#amount").val(300003);
					}
					 else if (category == 4){
						$("#amount").val(300004);
					}
					 else if (category == 5){
						$("#amount").val(300005);
					}
					 else if (category == 6){
						$("#amount").val(300006);
					}
					 else if (category == 7){
						$("#amount").val(300007);
					}
					 else if (category == 8){
						$("#amount").val(300008);
					}
					 else if (category == 9){
						$("#amount").val(300009);
					}
                })
			
            })
        </script>
        