File "payment_form_modal.php"

Full Path: /home/ichhrkpd/public_html/application/examples/payment_form_modal.php
File size: 7.14 KB
MIME-type: text/x-php
Charset: utf-8

<?php 
	if(empty($isEdit)){
		$isEdit=false;
		/*
		 <form action="<?php echo base_url()."task/add_subtask2"?>" class="form form-horizontal" method="post">
		 You haven't selected any Members to Pay for. Please make a selection before continuing.
		 */
	}
	

?>
<div class="modal fade" id="paymentModal" role="dialog" data-backdrop="static" data-keyboard="false" aria-labelledby="confirmRequestLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Add Member</h4>
      </div>
      <form id="contactForm" action="<?php echo base_url()."home/add_edit_member"?>" class="contact-form" method="post" role="form">
	      <div class="modal-body">
			<div class="row">
				<div class="col-md-6">
				
					 <div class="form-group">
                          	<label class="control-label" for="first_name"><?php _e("First Name"); ?></label>
                            <input id="first_name" type="text" maxlength="100" name="first_name" class="form-control" placeholder="First Name *" required="required" data-error="First Name is required.">
                            <div id="first_name_err" class="help-block with-errors"></div>
                     </div>	
                     
					 <div class="form-group">
                          	<label class="control-label" for="last_name"><?php _e("Last Name"); ?></label>
                            <input id="last_name" type="text" maxlength="100" name="last_name" class="form-control" placeholder="Last Name *" required="required" data-error="Last Name is required.">
                            <div id="last_name_err" class="help-block with-errors"></div>
                     </div>
                     
                     <div class="form-group">
                          <label class="control-label" for="email"><?php _e("Email"); ?></label>
                          <input id="form_email" type="email" maxlength="100" autocomplete="off" name="email" class="form-control" placeholder="Email *" required="required" data-error="Valid email is required.">
                          <div class="help-block with-errors"></div><div id="check_race_email" style="color: #a94442;"></div>
                          <input type="hidden" name="email_exists" id="email_exists" value="N">
                    </div>
                    
     				<div class="form-group">
      					<label class="control-label" for="sex"><?php _e("Sex"); ?></label>
			      			<select name="sex" id="sex" class="form-control"> 
								<option value="M">Male</option>
								<option value="F">Female</option>
								<option value="X">Mixed</option>
							</select>		      	
				     </div>                     
                    

               </div>
               
               <div class="col-md-6"> 
					<div class="form-group">
                         <label class="control-label" for="age"><?php _e("Age"); ?></label>
                         <input id="age" type="number" min="16" max="999" step="1" maxlength="3" name="age" class="form-control" placeholder="Age *" required="required" data-error="All participants must be at least sixteen (16) years or age to run or walk">
                         <div id="age_err" class="help-block with-errors"></div>
                    </div>
				     
					 <div class="form-group">
                          	<label class="control-label" for="phone"><?php _e("Phone"); ?></label>
                            <input type="tel"  id="phone" maxlength="15" name="phone" class="form-control" placeholder="Phone *" required="required" data-error="Please enter valid number.">
                            <div id="phone_err" class="help-block with-errors"></div>
                     </div>				                          
                    
					 <div class="form-group">
                          	<label class="control-label" for="town"><?php _e("City of Residence"); ?></label>
                            <input id="town" type="text" maxlength="100" name="town" class="form-control" placeholder="City of Residence *" required="required" data-error="City of Residence is required.">
                            <div id="town_err" class="help-block with-errors"></div>
                     </div>
                </div> 
            </div> 
	      </div>
	      
	      <div class="modal-footer">
		      	<input type="hidden" name="isEdit" id="isEdit" value="N">     	
		      	<input type="hidden" name="racer_id" id="racer_id" value="">
		      	<input type="hidden" name="member_id" id="member_id" value="">
		        <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
		        <button type="submit" name="submit" id="submit" class="btn btn-success" id="confirm">Submit</button>
	      </div>
      </form>
    </div>
  </div>
</div>



<script>

$(document).ready(function(){
	$("#phone").mask('(999) 999-9999', {placeholder:'X'});
	
	$("#form_email").keyup(function(){
		var remail = $(this).val();
		var racer_pk = $("#racer_id").val();
		$.ajax({
		type: "POST",
		url: "<?php echo base_url()?>home/checkRacerEmail",
		data:'remail='+$(this).val(),
		data: {remail: remail, racer_pk: racer_pk},
		success: function(data3){
			$("#check_team_email").show();
			if(data3=='Y'){
				$("#check_race_email").html("<p>Email Already Exists!</p>");
				$("#email_exists").val('Y');
			}
			if(data3=='N'){
				$("#check_race_email").html("");
				$("#email_exists").val('N');
			}
			
		}
		});
	});
});


		$('#member_add_edit').on('shown.bs.modal', function (event) {
			  var button = $(event.relatedTarget);
			  tempBtn = button;
			  var rid = button.data('rid');//racer pk
			  var member_id = button.data('member');// returns 'N' when adding
			  var edit = button.data('edit');
			  var modal = $(this);
			  if(edit=='Y'){
				  modal.find('.modal-title').text("Edit Member");
				  $.ajax({
						type:"POST",
						url:"<?php echo base_url()?>home/getRacerData",
						data:{rid:rid},
						dataType:"json",
						success:function(response) {
							modal.find('#isEdit').val('Y');
							modal.find('#racer_id').val(rid);
							modal.find('#member_id').val(member_id);
							modal.find('#first_name').val(response[0].first_name);
							modal.find('#last_name').val(response[0].last_name);
							modal.find('#form_email').val(response[0].email);
							modal.find('#sex').val(response[0].sex);
							modal.find('#age').val(response[0].age);
							modal.find('#phone').val(response[0].phone);
							modal.find('#town').val(response[0].town);
						}
					});
			  } else {
				  modal.find('#member_id').val(member_id);
				  modal.find('#isEdit').val('N');
				}
		});

		$('#contactForm').submit(function() {
		    if ($.trim($("#email_exists").val()) == "Y") {
		        alert('Your email already exists!!');
		        return false;
		    }else{
		    	$body = $("body");
		    	$body.addClass("loading");
		    	return true;
			    }
		});			


</script>