283 lines
14 KiB
PHP
283 lines
14 KiB
PHP
<div class="content-page">
|
||
<div class="content">
|
||
<!-- Start Content-->
|
||
<div class="container-fluid">
|
||
<!-- start page title -->
|
||
<div class="row">
|
||
<div class="col-6">
|
||
<div class="page-title-box page-title-box-alt">
|
||
<h4 class="page-title">Add User Details</h4>
|
||
</div>
|
||
</div>
|
||
<div class="col-6 text-right">
|
||
<a class="btn btn-cancel" href="<?php echo base_url(); ?>userListing"> <span class="bold">Back</span></a>
|
||
</div>
|
||
</div>
|
||
<!-- end page title -->
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="card">
|
||
<div class="card-body">
|
||
<div class="row">
|
||
<div class="col-12">
|
||
<div class="p-2">
|
||
<form role="form" id="addUser" action="<?php echo base_url() ?>addNewUser" method="post">
|
||
<div class="box-body">
|
||
<!-- Supplier Information -->
|
||
<div class="col-md-12" style="margin-bottom: 27px;">
|
||
<div class="form-row">
|
||
<div class=" col-md-3">
|
||
<label class="col-form-label" for="EmployeeID">Employee ID</label>
|
||
<select class="form-control required select" id="EmpList" name="EmpList">
|
||
<option value="">Select Emp ID</option>
|
||
<?php
|
||
if(!empty($EmpList))
|
||
{
|
||
foreach ($EmpList as $EID)
|
||
{
|
||
$EmpID = $EID->EmpID;
|
||
// if ($_POST['EmpList'] == $EmpID) {
|
||
// echo "<option value=\"".$EmpID."\" selected=\"selected\">".$EmpID.' - '. $EID->FirstName."</option>";
|
||
// } else{
|
||
echo "<option value=\"".$EmpID."\">".$EmpID.' - '. $EID->FirstName ."</option>";
|
||
// }
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<label class="col-form-label" for="FirstName">First Name</label>
|
||
<input type="text" class="form-control required" readonly id="FirstName" name="FirstName" maxlength="128">
|
||
</div>
|
||
<div class="col-md-3">
|
||
<label class="col-form-label" for="LastName">Last Name</label>
|
||
<input type="text" class="form-control required" readonly id="LastName" name="LastName" maxlength="128">
|
||
</div>
|
||
<div class="col-md-3">
|
||
<label class="col-form-label" for="Designation">Designation</label>
|
||
<input type="text" class="form-control required " readonly id="Designation" name="Designation" maxlength="128">
|
||
</div>
|
||
</div>
|
||
<div class="form-row" style="margin-top:20px">
|
||
<div class="col-md-3">
|
||
<label for="Emailaddress">Email address</label>
|
||
<input type="text" class="form-control required " readonly id="MailID" name="MailID" maxlength="128">
|
||
</div>
|
||
<div class="col-md-3">
|
||
<label for="ContactNumber">Contact Number</label>
|
||
<input type="text" class="form-control required digits" readonly id="ContactNo" name="ContactNo" minlength="10"maxlength="10">
|
||
</div>
|
||
<div class="col-md-3">
|
||
<label for="Role">Role</label>
|
||
<select class="form-control required" id="role" name="role">
|
||
<option value="0">Select Role</option>
|
||
<?php
|
||
if(!empty($roles))
|
||
{
|
||
foreach ($roles as $rl)
|
||
{
|
||
?>
|
||
<option value="<?php echo $rl->roleId ?>"><?php echo $rl->role ?></option>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<label for="Department">Department</label>
|
||
<select class="form-control required" id="role" name="role">
|
||
<option value="0">Select Department</option>
|
||
<?php
|
||
if(!empty($departments))
|
||
{
|
||
foreach ($departments as $dt)
|
||
{
|
||
?>
|
||
<option value="<?php echo $dt->departmentId ?>"><?php echo $dt->departments ?></option>
|
||
<?php
|
||
}
|
||
}
|
||
?>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="form-row" style="margin-top:20px">
|
||
|
||
</div>
|
||
<div class="form-row" style="margin-top:20px">
|
||
<div class="col-md-3">
|
||
<label for="Password">Password</label>
|
||
<input type="password" class="form-control required" id="password" required name="password" maxlength="10">
|
||
</div>
|
||
<div class="col-md-3">
|
||
<label for="ConfirmPassword">Confirm Password</label>
|
||
<input type="password" class="form-control required equalTo" required id="cpassword" name="cpassword" maxlength="10">
|
||
</div>
|
||
|
||
</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>
|
||
</div>
|
||
<?php
|
||
$listErrors = session()->getFlashdata('listErrors');
|
||
if($listErrors)
|
||
{
|
||
?>
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<div class="alert alert-danger alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||
<?php echo session()->getFlashdata('listErrors'); ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<?php } ?>
|
||
|
||
</div>
|
||
<?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 } ?>
|
||
<!-- end row -->
|
||
</div>
|
||
</div> <!-- end card -->
|
||
</div><!-- end col -->
|
||
</div>
|
||
<!-- end row -->
|
||
</div> <!-- container -->
|
||
</div> <!-- content -->
|
||
</div>
|
||
|
||
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
|
||
|
||
<script>
|
||
$('#EmpList').select2();
|
||
$('#EmpList').change(function() {
|
||
|
||
var id = $('#EmpList').val();
|
||
|
||
var y = <?php echo json_encode($EmpList, JSON_PRETTY_PRINT) ?>;
|
||
|
||
|
||
|
||
if(id != "0")
|
||
{
|
||
|
||
|
||
$.each(y, function(idx, obj) {
|
||
if(obj.EmpID === id)
|
||
{
|
||
$("#FirstName").val(obj.FirstName);
|
||
$("#LastName").val(obj.LastName);
|
||
|
||
$("#Designation").val(obj.Designation);
|
||
$("#Department").val(obj.DepartmentName);
|
||
$("#MailID").val(obj.EmailId);
|
||
$("#ContactNo").val(obj.ContactNumber);
|
||
}
|
||
|
||
});
|
||
}
|
||
else
|
||
{
|
||
alert('Please select Employee Details');
|
||
$("#FirstName").val('');
|
||
$("#LastName").val('');
|
||
|
||
$("#Designation").val('');
|
||
$("#Department").val('');
|
||
$("#MailID").val('');
|
||
$("#ContactNo").val('');
|
||
return false;
|
||
}
|
||
|
||
});
|
||
|
||
|
||
|
||
|
||
$('#addPop').click(function ()
|
||
{
|
||
if ($('#distriList option:selected').val() != null)
|
||
{
|
||
|
||
if($('#distriList option:selected').val()==0 )
|
||
{
|
||
alert('please select Department');
|
||
}
|
||
|
||
else
|
||
{
|
||
|
||
var tempSelect = $('#distriList option:selected').val();
|
||
var tempText = $('#distriList option:selected').text();
|
||
|
||
var o = new Option(tempText,tempSelect);
|
||
var hidval = tempSelect;
|
||
var orgVal = $('#txtSelectedDepartment').val();
|
||
var Selectedval = ''
|
||
|
||
if(orgVal != '')
|
||
{
|
||
Selectedval = orgVal + ':' + hidval;
|
||
}
|
||
else
|
||
{
|
||
Selectedval = hidval
|
||
}
|
||
$('#txtSelectedDepartment').val(Selectedval);
|
||
|
||
$(o).html(tempText);
|
||
$("#selectDistriList").append(o);
|
||
|
||
|
||
$('#distriList option:selected').remove();
|
||
$("#distriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
|
||
$("#selectDistriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
|
||
|
||
tempSelect = '';
|
||
tempText = '';
|
||
Selectedval = '';
|
||
}
|
||
}
|
||
|
||
else
|
||
{
|
||
alert("Before add please select any position.");
|
||
}
|
||
});
|
||
|
||
|
||
|
||
|
||
|
||
</script>
|