<?php
		defined('BASEPATH') OR exit('No direct script access allowed');
	$this->load->view("admin_includes/head");
	$this->load->view("admin_includes/header");
	$this->load->view("admin_includes/main_sidebar");
?>
	
     <div class="page-wrapper">
       
            <div class="container-fluid">
                <div class="row">
                    <div class="col s12 l12">
                        <div class="card">
                            <div class="card-content">
                                <h5 class="card-title activator">New Packages</h5>
                 	<form action="<?php echo base_url(); ?>index.php/save_package" class="form-horizontal" id="block-validate" method="POST" enctype="multipart/form-data" >
						<div class="form-body">
							<div class="divider"></div>
							<div class="card-content">
								<h6 class="font-medium">Personal Info</h6>
								<div class="row">
									<div class="col s12 m6 l6">
										<div class="input-field">
											<input id="fname" name="package_name" required  type="text">
											<label for="f-name1">Package Name</label>
										</div>
									</div>
								
								</div>
								<div class="row">
									<div class="col s12 m6 l6">
										<div class="input-field">
											<input id="user_limit" onkeypress="return isNumber(event);" required name="user_limit" type="text">
											<label for="clinic_name">User Min Limit	</label>
										</div>
									</div>
									<div class="col s12 m6 l6">
										<div class="input-field">
											<input id="per_user_cost" onkeypress="return isNumber(event);" name="per_user_cost" type="text">
											<label for="nname">Per User Cost</label>
										</div>
									</div>
								</div>
							</div>
							<div class="divider"></div>
							<div class="card-content">
								
								<div class="row">
								  <h6 class="font-medium">Duration Info</h6>    
									<div class="col s12 m6 l6">
										<div class="input-field">
											<input type="text" id="duration" onkeypress="return isNumber(event);" required name="duration">
											<label for="bio">Duration 	</label>
											
										</div>
									</div>
									<div class="col s12 m6 l6">
										<div class="input-field">
											 <select name="duration_type" id="duration_type">
											 <option value=""></option>
											 <option value="months">Month</option>
											 <option value="year">Year</option>
											 </select>
											<label for="l-name2">duration_type</label>
										</div>
									</div>
								</div>
								
						
							 <div class="row">
									<div class="col s12">
										<div class="input-field">
											<textarea id="package_desc" name="package_desc" class="materialize-textarea"></textarea>
											<label for="bio">Package Description</label>
										</div>
									</div>
								</div>
							</div>
							<div class="divider"></div>
							<div class="card-content">
								<div class="form-action">
									<button class="btn waves-effect waves-light cyan" type="submit" name="add_package_btn" value="add_package_btn">Save
									</button>
									 
								</div>
							</div>
						</div>
					</form> 
					</div>
                         </div>
                    </div>
                  </div>
           </div>
          </div>
    
<?php
	$this->load->view("admin_includes/footer");
?>				
</div><!-- ./wrapper -->	
 <script>
    $(function() {
     $("#formValidate").validate({
            rules: {
                package_name: {
                    required: true
				},
                per_user_cost: {
                    required: true,
                } 
            },
            //For custom messages
            messages: {
                package_name: {
                    required: "Enter a Package Name"
                }, per_user_cost: {
                    required: "Enter a User Cost"
                }
            },
            errorElement: 'div',
            errorPlacement: function(error, element) {
                var placement = $(element).data('error');
                if (placement) {
                    $(placement).append(error)
                } else {
                    error.insertAfter(element);
                }
            },
            invalidHandler: function(e, validator) {
                var errors = validator.numberOfInvalids();
                if (errors) {
                    $('.error-alert-bar').show();
                }
            },
        });
    });
    </script>