432 lines
16 KiB
PHP
432 lines
16 KiB
PHP
|
||
|
||
<?php
|
||
|
||
$EmpId = '';
|
||
$FirstName = '';
|
||
$LastName = '';
|
||
$ContactNo = '';
|
||
$EmailId = '';
|
||
$Role = '';
|
||
$Department = '';
|
||
$Designation = '';
|
||
$RoleName = '';
|
||
if(!empty($EmpRole))
|
||
{
|
||
foreach ($EmpRole as $Er)
|
||
{
|
||
$Role = $Er->roleId;
|
||
$RoleName = $Er->role;
|
||
}
|
||
}
|
||
|
||
if(!empty($EmpList))
|
||
{
|
||
foreach ($EmpList as $Emp)
|
||
{
|
||
$EmpId = $Emp->EmpID;
|
||
$FirstName = $Emp->FirstName;
|
||
$LastName = $Emp->LastName;
|
||
$ContactNo = $Emp->ContactNumber;
|
||
$EmailId = $Emp->EmailId;
|
||
|
||
$Department = $Emp->DepartmentName;
|
||
$Designation = $Emp->Designation;
|
||
|
||
}
|
||
}
|
||
|
||
?>
|
||
|
||
<div class="content-wrapper" style="min-height: 537px;">
|
||
<!-- Content Header (Page header) -->
|
||
<section class="content-header">
|
||
<h1>
|
||
<center>Siddharth Industries - Edit 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 id="content"></div>
|
||
<div class="box box-primary">
|
||
|
||
<!-- form start -->
|
||
|
||
<form role="form" action="<?php echo base_url() ?>editUser" method="post" id="editUser" role="form">
|
||
<div class="box-body">
|
||
<div class="row">
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="fname">Employee ID</label>
|
||
<input type="text" class="form-control required" value="<?php echo $EmpId ?>" readonly id="EmpList" name="EmpList" maxlength="128">
|
||
</div>
|
||
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="fname">First Name</label>
|
||
<input type="text" class="form-control required" value="<?php echo $FirstName ?>" 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" value="<?php echo $LastName ?>" 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 " value="<?php echo $Designation ?>" 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" value="<?php echo $Department ?>" 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 email" value="<?php echo $EmailId ?>" 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" value="<?php echo $ContactNo ?>" 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" 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 equalTo" id="cpassword" name="cpassword" maxlength="10">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-md-2">
|
||
<div class="form-group" style="display:none;">
|
||
<label for="role">Role</label>
|
||
<select class="form-control required" id="role" name="role">
|
||
<option value="<?php echo $Role ?>"><?php echo $RoleName ?></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($Departmentlist);
|
||
|
||
if(!empty($Departmentlist))
|
||
{
|
||
foreach ($Departmentlist 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';
|
||
//print_r($AccessDept);
|
||
|
||
if(!empty($AccessDept))
|
||
{
|
||
foreach ($AccessDept as $SID):
|
||
if($SID->AssDep == '1')
|
||
{
|
||
$option[$SID->AssDep] = "01-System Administrator";
|
||
}
|
||
|
||
else
|
||
{
|
||
$option[$SID->AssDep] = $SID->AssDep.' '.' - '.' '.$SID->DepartmentName;
|
||
}
|
||
endforeach;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
echo form_multiselect('selectDistriList[]', $option,set_value('selectDistriList[]'),'id="selectDistriList"','size="10"');
|
||
|
||
?>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
|
||
</div><!-- /.box-body -->
|
||
|
||
<div class="box-footer" style="text-align:right">
|
||
<input type="hidden" name="txtSelectedDepartment" id="txtSelectedDepartment" />
|
||
|
||
<input type="hidden" name="txtEmpid" id="txtEmpid" value="<?php echo $EmpId?>" />
|
||
|
||
|
||
<input type="submit" class="btn btn-primary" value="Submit" />
|
||
<input type="reset" class="btn btn-primary" value="Cancel" />
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<?php
|
||
$this->load->helper('form');
|
||
$error = $this->session->flashdata('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>
|
||
|
||
</section>
|
||
</div>
|
||
|
||
<script src="<?php echo base_url(); ?>assets/js/editUser.js" type="text/javascript"></script>
|
||
|
||
<script type="text/javascript">
|
||
|
||
|
||
|
||
|
||
$('#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 Eid= $('#txtEmpid').val();
|
||
var tempText = $('#distriList option:selected').text();
|
||
|
||
var o = new Option(tempText,tempSelect);
|
||
var hidval = tempSelect;
|
||
var orgVal = $('#txtSelectedDepartment').val();
|
||
//salert(orgVal);
|
||
var Selectedval = ''
|
||
|
||
if(orgVal != '')
|
||
{
|
||
Selectedval = orgVal + ':' + hidval;
|
||
}
|
||
else
|
||
{
|
||
Selectedval = hidval
|
||
}
|
||
$('#txtSelectedDepartment').val(Selectedval);
|
||
|
||
var Department= $('#txtSelectedDepartment').val();
|
||
|
||
|
||
$(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");
|
||
|
||
|
||
|
||
$('#content').loader('show');
|
||
$.ajax({
|
||
data:{Eid:Eid,Department:Department},
|
||
|
||
type:"POST",
|
||
url:"<?php echo base_url() ?>user/Adduserdepartment",
|
||
success:function(data) {
|
||
if(data)
|
||
{
|
||
$('#content').loader('hide');
|
||
alert(data);
|
||
$('#txtSelectedDepartment').val('');
|
||
$('#txtRowCount').val('');
|
||
|
||
//window.location = baseurl + 'CostCenter/CostListing';
|
||
}
|
||
|
||
}
|
||
});
|
||
//$('#content').loader('hide');
|
||
|
||
|
||
|
||
tempSelect = '';
|
||
tempText = '';
|
||
Selectedval = '';
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
}
|
||
else {
|
||
alert("Before add please select any position.");
|
||
}
|
||
});
|
||
|
||
|
||
|
||
|
||
$('#removePop').click(function () {
|
||
if ($('#selectDistriList option:selected').val() != null) {
|
||
if($('#selectDistriList option:selected').val() == 0){
|
||
//alert('cannot removed');
|
||
}
|
||
else{
|
||
var tempSelect = $('#selectDistriList option:selected').val();
|
||
|
||
var Eid= $('#txtEmpid').val();
|
||
|
||
|
||
$('#selectDistriList option:selected').remove().appendTo('#distriList');
|
||
$("#selectDistriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
|
||
$("#distriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
|
||
|
||
$("#distriList").val(tempSelect);
|
||
$('#txtSelectedDepartment').val(tempSelect);
|
||
tempSelect = '';
|
||
|
||
var Department= $('#txtSelectedDepartment').val();
|
||
|
||
|
||
$('#content').loader('show');
|
||
$.ajax({
|
||
data:{Eid:Eid,Department:Department},
|
||
type:"POST",
|
||
url:"<?php echo base_url() ?>user/Deleteuserdepartment",
|
||
success:function(data) {
|
||
if(data)
|
||
{
|
||
$('#content').loader('hide');
|
||
alert(data);
|
||
$('#txtSelectedDepartment').val('');
|
||
$('#txtRowCount').val('');
|
||
|
||
//window.location = baseurl + 'CostCenter/CostListing';
|
||
}
|
||
|
||
}
|
||
});
|
||
//$('#content').loader('hide');
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
}
|
||
|
||
else
|
||
{
|
||
alert("Before remove please select any position.");
|
||
}
|
||
});
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</script>>
|