161 lines
4.2 KiB
PHP
161 lines
4.2 KiB
PHP
|
|
<!-- Body page content -->
|
|
|
|
|
|
|
|
<div class="">
|
|
<div class="page-title">
|
|
|
|
<div class="title_left">
|
|
<h3>Assign Leave</h3>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<div class="clearfix"></div>
|
|
<div class="row">
|
|
<div class="col-md-12 col-sm-12 ">
|
|
<div class="x_panel">
|
|
<div class="x_title">
|
|
|
|
<!-- <h6>General Information</h6> -->
|
|
<div class="clearfix"></div>
|
|
</div>
|
|
<div class="x_content">
|
|
<br />
|
|
<form id="" data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Leave/createLeave" enctype="multipart/form-data">
|
|
|
|
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
|
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="last-name">Employee Name<a style="color:red;">*</a> </label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<select id="emp_id" name="emp_id" required="required" class="form-control" >
|
|
<option value="">--Select--</option>
|
|
<?php foreach ($emp as $key => $value) { ?>
|
|
<option value="<?php echo $value->id; ?>"><?php echo $value->name; ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="last-name">Leave Type<a style="color:red;">*</a> </label>
|
|
<div class="col-md-5 col-sm-5 ">
|
|
<select id="type" name="type" required="required" class="form-control" >
|
|
<option value="">--Select--</option>
|
|
<?php foreach ($leavetype as $key => $value) { ?>
|
|
<option id="<?php echo $value->id; ?>" value="<?php echo $value->type; ?>"><?php echo $value->type; ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Leave Balance</label>
|
|
<div class="col-md-2 col-sm-2 ">
|
|
<input type="text" id="leave_bal" name="" value="" class="form-control " readonly>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="first-name"> From Date<a style="color:red;">*</a> </label>
|
|
<div class="col-md-2 col-sm-2 ">
|
|
<input id="from_date" name="from_date" value="" required="required" class="form-control" type="date" >
|
|
</div>
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="last-name">To Date<a style="color:red;">*</a> </label>
|
|
<div class="col-md-2 col-sm-2 ">
|
|
<input id="to_date" name="to_date" value="" required="required" class="form-control" type="date" >
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="item form-group">
|
|
|
|
<label class="control-label col-md-1 col-sm-1 " for="last-name">Comments</label>
|
|
<div class="col-md-5 col-sm-5">
|
|
<textarea id="comments" name="comments" value="" class="form-control" style="height:100px !important;" type="text" ></textarea>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="ln_solid"></div>
|
|
<div class="item form-group">
|
|
<div class=" offset-md-8">
|
|
<button class="btn btn-secondary" onclick="history.back()">Cancel</button>
|
|
<button class="btn btn-primary" type="reset">Reset</button>
|
|
<button type="submit" class="btn btn-success">Submit</button>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<!-- /Body page content -->
|
|
<script>
|
|
var id;
|
|
|
|
$('#emp_id').on('change', function() {
|
|
id = this.value;
|
|
});
|
|
|
|
|
|
$('#type').on('change',function() {
|
|
// var type_id = this.id;
|
|
var type_id = $('option:selected', this).attr('id');
|
|
if (id)
|
|
{
|
|
$.ajax({
|
|
type: "get",
|
|
url: "<?php echo base_url()?>Leave/get_leave_count/"+id+'_'+type_id,
|
|
success: function(response) {
|
|
response = JSON.parse(response);
|
|
console.log(response);
|
|
if(response.length == 0)
|
|
{
|
|
get_all_count(type_id);
|
|
}
|
|
else
|
|
{
|
|
$('#leave_bal').val(response[0].remaining_days);
|
|
}
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
}
|
|
else
|
|
{
|
|
$('#leave_bal').val("");
|
|
}
|
|
});
|
|
|
|
|
|
function get_all_count(id) {
|
|
$.ajax({
|
|
type: "get",
|
|
url: "<?php echo base_url()?>Leave/get_all_leave_count/"+id,
|
|
success: function(response) {
|
|
response = JSON.parse(response);
|
|
$('#leave_bal').val( response[0].days);
|
|
},
|
|
error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) }
|
|
});
|
|
}
|
|
</script>
|