ria/app/Views/editOld.php
2024-08-27 11:31:42 +05:30

300 lines
12 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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-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">Edit User <?= ' - '.$EmpId; ?> Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>userListing">&nbsp;&nbsp;<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">
<form role="form" action="<?php echo base_url() ?>editUser" method="post" id="editUser">
<div class="box-body">
<div class="form-row">
<div class="col-md-3">
<label class="col-form-label" for="EmpList">Employee ID</label>
<input type="text" class="form-control required" value="<?php echo $EmpId ?>" readonly id="EmpList" name="EmpList" maxlength="128">
</div>
<div class="col-md-3">
<label class="col-form-label" for="FirstName">First Name</label>
<input type="text" class="form-control required" value="<?php echo $FirstName ?>" 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" value="<?php echo $LastName ?>" 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" value="<?php echo $Designation ?>" readonly id="Designation" name="Designation" maxlength="128">
</div>
</div>
<div class="form-row">
<div class="col-md-3">
<label class="col-form-label" for="Department">Department</label>
<input type="text" class="form-control required" value="<?php echo $Department ?>" readonly id="Department" name="Department" minlength="10" maxlength="10">
</div>
<div class="col-md-3">
<label for="MailID">Email address</label>
<input type="text" class="form-control required email" value="<?php echo $EmailId ?>" readonly id="MailID" name="MailID" maxlength="128">
</div>
<div class="col-md-3">
<label for="ContactNo">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 class="col-md-3">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" required name="password" maxlength="10">
</div>
</div>
<div class="form-row">
<div class="col-md-3">
<label for="cpassword">Confirm Password</label>
<input type="password" class="form-control equalTo" id="cpassword" name="cpassword" maxlength="10">
</div>
</div>
</div>
<div class="form-group text-right mt-3">
<input type="hidden" name="txtSelectedDepartment" id="txtSelectedDepartment">
<input type="hidden" name="txtEmpid" id="txtEmpid" value="<?php echo $EmpId ?>">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white;margin-right: 15px;" value="Reset">
<input type="submit" class="btn btn-success" value="Submit">
</div>
</form>
<?php
$listErrors = session()->getFlashdata('listErrors');
if ($listErrors) {
?>
<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>
<?php } ?>
<?php
$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>
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
<script src="<?php echo base_url(); ?>public/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>>