362 lines
14 KiB
PHP
Executable File
362 lines
14 KiB
PHP
Executable File
<?php ?>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="content-wrapper" style="min-height: 537px;">
|
||
<!-- Content Header (Page header) -->
|
||
<section class="content-header">
|
||
<h1>
|
||
<center>Siddharth Industries - Add New User</center>
|
||
|
||
</h1>
|
||
|
||
</section>
|
||
|
||
<section class="content">
|
||
<div style="text-align:right;">
|
||
<a href="<?php echo base_url() ?>userListing" class="btn btn-primary" value="Back"/>Back</a>
|
||
</div>
|
||
<br/>
|
||
<div class="row">
|
||
<!-- left column -->
|
||
<div class="col-md-12">
|
||
<!-- general form elements -->
|
||
|
||
|
||
|
||
<div class="box box-primary">
|
||
<!-- /.box-header -->
|
||
<!-- form start -->
|
||
|
||
<form role="form" id="addUser" action="<?php echo base_url() ?>addNewUser" method="post" role="form">
|
||
<div class="box-body">
|
||
<div class="row">
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="fname">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>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="fname">First Name</label>
|
||
<input type="text" class="form-control required" readonly id="FirstName" name="FirstName" maxlength="128">
|
||
</div>
|
||
|
||
</div>
|
||
<div class="col-md-2">
|
||
<div class="form-group">
|
||
<label for="fname">Last Name</label>
|
||
<input type="text" class="form-control required" readonly id="LastName" name="LastName" maxlength="128">
|
||
</div>
|
||
|
||
</div>
|
||
<div class="col-md-2">
|
||
<div class="form-group">
|
||
<label for="email">Designation</label>
|
||
<input type="text" class="form-control required " readonly id="Designation" name="Designation" maxlength="128">
|
||
</div>
|
||
</div>
|
||
<div class="col-md-2">
|
||
<div class="form-group">
|
||
<label for="mobile">Department</label>
|
||
<input type="text" class="form-control required " readonly id="Department" name="Department" minlength="10"maxlength="10">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="row">
|
||
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="email">Email address</label>
|
||
<input type="text" class="form-control required " readonly id="MailID" name="MailID" maxlength="128">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="mobile">Contact Number</label>
|
||
<input type="text" class="form-control required digits" readonly id="ContactNo" name="ContactNo" minlength="10"maxlength="10">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-2">
|
||
<div class="form-group">
|
||
<label for="password">Password</label>
|
||
<input type="password" class="form-control required" id="password" required name="password" maxlength="10">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-2">
|
||
<div class="form-group">
|
||
<label for="cpassword">Confirm Password</label>
|
||
<input type="password" class="form-control required equalTo" required id="cpassword" name="cpassword" maxlength="10">
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="col-md-2" style="display:block;">
|
||
<div class="form-group" style="display:none;">
|
||
<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>
|
||
|
||
|
||
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<div class="col-md-6">
|
||
<div class="col-md-4">
|
||
<label>Department</label>
|
||
<div>
|
||
<?php
|
||
|
||
$options = array("0"=>'Select Department',
|
||
"1"=>'System Administrator');
|
||
//print_r( $Department);
|
||
|
||
if(!empty($Department))
|
||
{
|
||
foreach ($Department as $SID):
|
||
|
||
|
||
$options[$SID->DEPCode] = $SID->DEPCode.' '.' - '.' '.$SID->DepartmentName;
|
||
|
||
endforeach;
|
||
}
|
||
echo form_multiselect('distriList', $options,set_value('distriList'),'id="distriList"' ,'class="form-control required"','required="true"');
|
||
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-4">
|
||
<center>
|
||
<a style="color:white" href="javascript:void(0);" id="addPop"><button type="button" style="margin: 30px 0px 0px 15px;" class="btn btn-primary">Add</button></a><br>
|
||
<!-- <a style="color:white" href="javascript:void(0);" id="removePop"><button type="button" style="margin: 10px 0px 0px 15px;" class="btn btn-primary">Remove</button></a> --><br>
|
||
|
||
</center>
|
||
</div>
|
||
|
||
<div class="col-md-4">
|
||
<b> </b>
|
||
|
||
<?php
|
||
$option["0"] = 'Selected Department';
|
||
echo form_multiselect('selectDistriList[]', $option,set_value('selectDistriList[]'),'id="selectDistriList"','size="10"');
|
||
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<input type="hidden" name="txtSelectedDepartment" id="txtSelectedDepartment" />
|
||
|
||
|
||
<div class="row">
|
||
|
||
|
||
</div>
|
||
|
||
</div><!-- /.box-body -->
|
||
|
||
<div class="box-footer" style="text-align:right">
|
||
<input type="reset" class="btn btn-primary" value="Reset" />
|
||
<input type="submit" class="btn btn-primary" value="Submit" />
|
||
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<?php
|
||
$this->load->helper('form');
|
||
$error = $this->session->flashdata('error');
|
||
|
||
echo $error;
|
||
if($error)
|
||
{
|
||
?>
|
||
<div class="alert alert-danger alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||
<?php echo $this->session->flashdata('error'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
<?php
|
||
$success = $this->session->flashdata('success');
|
||
if($success)
|
||
{
|
||
?>
|
||
<div class="alert alert-success alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||
<?php echo $this->session->flashdata('success'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
</div>
|
||
<script src="<?php echo base_url(); ?>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>
|