<?php
include('../include/header.php');
?>

 <!-- Page wrapper  -->
        <div class="page-wrapper" >
            <!-- Bread crumb -->
            <div class="row page-titles">
                <div class="col-md-5 align-self-center">
                    <h3 class="text-primary">Dashboard</h3> </div>
                <div class="col-md-7 align-self-center">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="javascript:void(0)">Home</a></li>
                        <li class="breadcrumb-item active">Add Leave Type</li>
                    </ol>
                </div>
            </div>
            <!-- End Bread crumb -->
            <!-- Container fluid  -->
           <div class="container-fluid">
                <!-- Start Page Content -->
                <div class="row justify-content-center">
                    <div class="col-lg-6">
                        <div class="card">
                            <div class="card-body">
                                <div class="form-validation">
                                    <form class="form-valide" method="post">
                                        <div class="form-group row">
                                            <label class="col-lg-4 col-form-label" for="val-username">Leave Type <span class="text-danger">*</span></label>
                                            <div class="col-lg-6">
                                                <input type="text" class="form-control" id="leave_type" name="leave_type" required placeholder="eg: CL etc">
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-lg-4 col-form-label" for="val-username">Number Of Days <span class="text-danger">*</span></label>
                                            <div class="col-lg-6">
                                                <input type="number" class="form-control" id="num_of_day" name="num_of_day" required >
                                            </div>
                                        </div>
										<div class="form-group row">
                                            <label class="col-lg-4 col-form-label" for="val-username"> Times To Give <span class="text-danger">*</span></label>
                                            <div class="col-lg-6">
                                                <select type="text" class="form-control" id="num_of_time" name="num_of_time" required >
												<option value="">Select</option>
												<option value="once in year">once in year</option>
												<option value="once in month">once in month</option>
												<option value="once in lifetime">once in lifetime</option>
												
												</select>
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <div class="col-lg-8 ml-auto">
                                                <button type="submit" class="btn btn-primary" name="save">Submit</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
                <!-- End PAge Content -->
            </div>
			
<?php
if(isset($_POST['save'])){
 $sql = "INSERT INTO `tbl_leave_type` (`leave_type`, `num_of_day`, `time_to_give`) VALUES ('".$_POST['leave_type']."', '".$_POST['num_of_day']."', '".$_POST['num_of_time']."');";
						$result = $objhr->viewdata($sql);
						echo "<script>alert('added'); location='';</script>";
}
?>
<?php
include('../include/footer.php');
?>