190 lines
9.3 KiB
PHP
Executable File
190 lines
9.3 KiB
PHP
Executable File
<style>
|
||
.pad {
|
||
padding-bottom: 1%;
|
||
}
|
||
|
||
.badge {
|
||
color: red;
|
||
background-color: #fff;
|
||
}
|
||
</style>
|
||
|
||
<div class="content-page">
|
||
<div class="content">
|
||
<!-- Start Content-->
|
||
<div class="container-fluid">
|
||
<!-- start page title -->
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="page-title-box page-title-box-alt">
|
||
<h4 class="page-title">Add Department Details</h4>
|
||
<a class="btn btn-secondary" href="<?php echo base_url(); ?>departmentListing"><span class="bold">Back</span></a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- end page title -->
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="card">
|
||
<div class="card-body" style="padding: 1rem 2rem !important;">
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<form role="form" id="adddepartment" action="<?php echo base_url() ?>savedepartment" method="post">
|
||
<div class="box-body">
|
||
<!-- Supplier Information -->
|
||
<div class="col-md-12" style="margin-bottom: 27px;">
|
||
<legend style="margin-left:-10px;color: #4f7c97;">Department Information</legend>
|
||
<div class="form-row" style="margin-top:10px">
|
||
<div class="col-md-4">
|
||
<label class="col-form-label" for="DepartmentName">Department Name<span class="badge">*</span></label>
|
||
<input type="text" name="DepartmentName" id="DepartmentName" class="form-control" required>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<label class="col-form-label" for="HeadDepartment">Head Department<span class="badge">*</span></label>
|
||
<select class="form-control required" id="HeadDept" name="HeadDept">
|
||
<option value="-1" required>Select Department Code</option>
|
||
<?php
|
||
if (!empty($depcode)) {
|
||
foreach ($depcode as $DC) {
|
||
?>
|
||
<option value="<?php echo $DC->DEPCode ?>"><?php echo $DC->DEPCode . " - " . $DC->DepartmentName ?></option>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
|
||
</select>
|
||
</div>
|
||
<div class="col-md-4 d-flex align-items-center">
|
||
<input type="hidden"
|
||
value="1"
|
||
id="IsActive" name="IsActive" style="margin-top: 16px;">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-12 text-right">
|
||
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
|
||
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
|
||
</div>
|
||
</div>
|
||
</form>
|
||
<div class="col-md-4">
|
||
<?php
|
||
helper('form');
|
||
$error = session()->getFlashdata('error');
|
||
if ($error) {
|
||
?>
|
||
<div class="alert alert-danger alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||
<?php echo session()->getFlashdata('error'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
<?php
|
||
$success = session()->getFlashdata('success');
|
||
if ($success) {
|
||
?>
|
||
<div class="alert alert-success alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||
<?php echo session()->getFlashdata('success'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
|
||
?> </div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- end row -->
|
||
</div>
|
||
</div> <!-- end card -->
|
||
</div><!-- end col -->
|
||
</div>
|
||
<!-- end row -->
|
||
</div> <!-- container -->
|
||
</div> <!-- content -->
|
||
</div>
|
||
|
||
<script>
|
||
// function blockKeyPress(evt)
|
||
// {
|
||
// var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||
// alert(charCode);
|
||
// if(charCode == 8 || charCode == 46 )
|
||
//
|
||
// {
|
||
// return false;
|
||
// }
|
||
// else
|
||
// {
|
||
// return false;
|
||
// }
|
||
// }
|
||
|
||
// function isNumberKey(evt)
|
||
// {
|
||
// var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||
// if (charCode != 46 && charCode > 31
|
||
// && (charCode < 48 || charCode > 57))
|
||
// return false;
|
||
//
|
||
// return true;
|
||
// }
|
||
|
||
|
||
// function onlyAlphabets(evt) {
|
||
// var charCode;
|
||
// if (window.event)
|
||
// charCode = window.event.keyCode; //for IE
|
||
// else
|
||
// charCode = evt.which; //for firefox
|
||
// if (charCode == 32) //for <space> symbol
|
||
// return true;
|
||
// if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
||
// return false;
|
||
// if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
||
// return false;
|
||
// if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
||
// return false;
|
||
// return true;
|
||
// }
|
||
</script>
|
||
|
||
<script>
|
||
|
||
$("#DepartmentName").on('change',function(){
|
||
let departmentName = $("#DepartmentName").val();
|
||
$('#loader').show();
|
||
$.ajax({
|
||
type:"POST",
|
||
data:{departmentName},
|
||
url:"<?php echo base_url();?>checkDepartmentName",
|
||
success:function(data){
|
||
|
||
if(data && data.length >0){
|
||
let isActive = data[0].IsActive;
|
||
if(isActive == 1){
|
||
alert("Department name already Exists ..!! ");
|
||
}else{
|
||
alert("Department Name already Existing in the deleted section.!!");
|
||
}
|
||
window.location.reload();
|
||
}
|
||
|
||
},
|
||
error:function(error){
|
||
console.log("error occured..!!")
|
||
console.error(error);
|
||
},
|
||
complete:function(){
|
||
$('#loader').hide();
|
||
console.log("ajax call is completed..!!")
|
||
}
|
||
|
||
})
|
||
|
||
})
|
||
|
||
</script>
|