70 lines
2.4 KiB
PHP
70 lines
2.4 KiB
PHP
|
||
<div class="modal-dialog modal-lm">
|
||
<div class="modal-content">
|
||
|
||
<div class="modal-header">
|
||
<h4 class="modal-title" id="myModalLabel2"><?php echo $heading; ?></h4>
|
||
<button type="button" id="close-form" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
|
||
</button>
|
||
</div>
|
||
|
||
<form data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Asset/add_or_edit_LeaveForm">
|
||
<div class="modal-body">
|
||
<div class="x_content">
|
||
<br />
|
||
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
|
||
<input type="hidden" name="id" value="<?php if(isset($leave_data)) { echo $leave_data->id; } ?>">
|
||
<input type="hidden" name="business_id" value="<?php echo user()->business_id; ?>">
|
||
|
||
<div class="form-group row">
|
||
<label class="col-form-label col-md-3 col-sm-3 ">Leave Type<a style="color:red;">*</a></label>
|
||
<div class="col-md-9 col-sm-9 ">
|
||
<input type="text" class="form-control" name="type" value="<?php if(isset($leave_data)) { echo $leave_data->type; } ?>" required>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group row">
|
||
<label class="col-form-label col-md-3 col-sm-3 ">Days<a style="color:red;">*</a></label>
|
||
<div class="col-md-9 col-sm-9 ">
|
||
<input type="text" class="form-control" name="days" value="<?php if(isset($leave_data)) { echo $leave_data->days; } ?>" onkeypress="validateKeyPress(event)" required>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="close-form">Close</button>
|
||
<button type="submit" class="btn btn-primary"><?php echo $submit_button_title; ?></button>
|
||
</div>
|
||
</form>
|
||
|
||
<script>
|
||
function validateKeyPress(event) {
|
||
var key = event.key;
|
||
var allowedCharacters = /^[0-9]$/;
|
||
|
||
if (!allowedCharacters.test(key)) {
|
||
event.preventDefault();
|
||
}
|
||
}
|
||
</script>
|
||
<script>
|
||
document.querySelector('form').addEventListener('submit', function(event) {
|
||
var form = event.target;
|
||
var submitBtn = form.querySelector('button[type="submit"]');
|
||
|
||
if (!form.checkValidity()) {
|
||
form.reportValidity(); // Display validation error messages
|
||
event.preventDefault(); // Prevent form submission if it's not valid
|
||
submitBtn.disabled = false;
|
||
} else {
|
||
submitBtn.disabled = true;
|
||
}
|
||
});
|
||
</script>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|