header file changes for system_admin

This commit is contained in:
venbatechnologies@gmail.com 2018-03-12 12:02:30 +05:30
parent 8ab38e6497
commit 48fb603e1c
22 changed files with 1662 additions and 1265 deletions

View File

@ -139,6 +139,7 @@ define('FINANCE', 'DEP10');
define('PURCHASE', 'DEP11');
define('MANAGEMENT', 'DEP12');
define('HR', 'DEP13');
define('SYSTEM_ADMIN', '1');
/* PO Type */
define('REVENUE', 'REVENUE');
define('SERVICE', 'SERVICE');

View File

@ -53,7 +53,7 @@ class Login extends CI_Controller
$this->load->library('form_validation');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|max_length[128]|xss_clean|trim');
$this->form_validation->set_rules('password', 'Password', 'required|max_length[32]|');
$designation='';
$role='';
@ -79,22 +79,24 @@ class Login extends CI_Controller
'name'=>$res->FirstName,
'Designation'=>$res->Designation,
'DEPCode'=>$res->DEPCode,
'HeadDept'=>$res->HeadDept,
'HeadDept'=>$res->HeadDept,
'depaccess'=>$this->login_model->Accessdep($res->EmpID),
'DepartmentName'=>$res->DepartmentName,
'EmpID' => $res->EmpID,
'ProfilePic' =>$res->ProfilePic,
'EmpID' => $res->EmpID,
'ProfilePic' =>$res->ProfilePic,
'isLoggedIn' => TRUE
);
$this->session->set_userdata($sessionArray);
$role=$res->roleId;
$designation=$res->Designation;
$role=$res->roleId;
$designation=$res->Designation;
$DEPCode=$res->DEPCode;
}
if ($role == ROLE_EMPLOYEE && $designation == SECURITY)
if ($DEPCode == SECURITY)
{
redirect('/Addigr');
}
@ -130,4 +132,4 @@ class Login extends CI_Controller
}
?>
?>

View File

@ -20,7 +20,7 @@ class user extends BaseController
$this->load->model('user_model');
$this->load->model('dahsboard_Model');
$this->load->library('form_validation');
/*$this->load->model('costcenter_model');*/
$this->load->model('costcenter_model');
$this->isLoggedIn();
}
@ -31,33 +31,30 @@ class user extends BaseController
public function index()
{
$this->global['pageTitle'] = 'Resico : Dashboard';
$this->load->model('employeedetails_model');
$this->load->model('dahsboard_Model');
$this->load->model('employeedetails_model');
$this->load->model('dahsboard_Model');
$data['EmpCount'] = $this->employeedetails_model->getEmployeeCount();
$data['UserCount'] = $this->dahsboard_Model->getUserCount();
$data['totalpurchaseorder']=$this->dahsboard_Model->totalpurchaseorder();
$data['totalordervalue']=$this->dahsboard_Model->totalordervalue();
$data['pendingpo']=$this->dahsboard_Model->pendingpo();
$data['totalimportpo']=$this->dahsboard_Model->totalimportpo();
$data['details']=$this->dahsboard_Model->reqdetail();
$data['pending_details']=$this->dahsboard_Model->req_pending();
$data['serviceprogress']=$this->dahsboard_Model->serviceprogress();
$data['EmpCount'] = $this->employeedetails_model->getEmployeeCount();
$data['UserCount'] = $this->dahsboard_Model->getUserCount();
$data['totalpurchaseorder']=$this->dahsboard_Model->totalpurchaseorder();
$data['totalordervalue']=$this->dahsboard_Model->totalordervalue();
$data['pendingpo']=$this->dahsboard_Model->pendingpo();
$data['totalimportpo']=$this->dahsboard_Model->totalimportpo();
$data['details']=$this->dahsboard_Model->reqdetail();
$data['pending_details']=$this->dahsboard_Model->req_pending();
$data['serviceprogress']=$this->dahsboard_Model->serviceprogress();
$data['revenueprogress']=$this->dahsboard_Model->revenueprogress();
$data['importprogress']=$this->dahsboard_Model->importprogress();
$data['capitalprogress']=$this->dahsboard_Model->capitalprogress();
//month-wise area chart
//month-wise area chart
$data['getTotalServicePoCount'] = $this->dahsboard_Model->getTotalServicePoCount();
$data['getTotalimportPoCount'] = $this->dahsboard_Model->getTotalimportPoCount();
$data['getTotalcapitalPoCount'] = $this->dahsboard_Model->getTotalcapitalPoCount();
@ -65,12 +62,12 @@ class user extends BaseController
//dashboard pie chart
$data['importbudgt'] = $this->dahsboard_Model->importbudgt();
$data['servicebudgt'] = $this->dahsboard_Model->servicebudgt();
$data['revenuebudgt'] = $this->dahsboard_Model->revenuebudgt();
$data['capitalbud'] = $this->dahsboard_Model->capitalbud();
$data['typebal'] = $this->dahsboard_Model->typebal();
$data['importbudgt'] = $this->dahsboard_Model->importbudgt();
$data['servicebudgt'] = $this->dahsboard_Model->servicebudgt();
$data['revenuebudgt'] = $this->dahsboard_Model->revenuebudgt();
$data['capitalbud'] = $this->dahsboard_Model->capitalbud();
$data['typebal'] = $this->dahsboard_Model->typebal();
/* HR DASHBOARD Controller Start*/
@ -79,6 +76,7 @@ class user extends BaseController
$data['totpay'] = $this->dahsboard_Model->totpay();
$data['totrec'] = $this->dahsboard_Model->totrec();
$data['emplist'] = $this->dahsboard_Model->emplist();
$date = $this->input->post("id");
$dates = date('Y-m');
$date = $dates . '-01';
@ -957,19 +955,19 @@ function attendanceyear($empID ='')
*/
function userListing()
{
if($this->isAdmin() == TRUE)
{
$this->loadThis();
}
else
{
// if($this->isAdmin() == TRUE)
// {
// $this->loadThis();
// }
// else
// {
$data['userRecords'] = $this->user_model->userListing();
$this->global['pageTitle'] = 'Resico : User Listing';
$this->loadViews("users", $this->global, $data, NULL);
}
//}
}
@ -978,22 +976,22 @@ function attendanceyear($empID ='')
*/
function addNew()
{
if($this->isAdmin() == TRUE)
{
$this->loadThis();
}
else
{
// if($this->isAdmin() == TRUE)
// {
// $this->loadThis();
// }
// else
// {
$data['EmpList'] = $this->user_model->getAllEmployees();
$data['roles'] = $this->user_model->getUserRoles();
//$data['Department'] = $this->costcenter_model->getDepartment();
$data['Department'] = $this->costcenter_model->getDepartment();
$this->global['pageTitle'] = 'Resico : Add New User';
$this->loadViews("addNew", $this->global, $data, NULL);
}
//}
}
@ -1051,87 +1049,101 @@ function attendanceyear($empID ='')
*/
function addNewUser()
{
if($this->isAdmin() == TRUE)
{
$this->loadThis();
}
else
{
// if($this->isAdmin() == TRUE)
// {
// $this->loadThis();
// }
// else
// {
$this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS');
$this->form_validation->set_rules('role','role','trim|callback_Role_validate');
$this->form_validation->set_rules('password','Password','required|max_length[20]');
$this->form_validation->set_rules('cpassword','Confirm Password','trim|required|matches[password]|max_length[20]');
if($this->form_validation->run() == FALSE)
{
$this->addNew();
}
else
{
$EmpID = $this->input->post('EmpList');
$roleId = $this->input->post('role');
$password = $this->input->post('password');
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$Createddt = $dt->format('Y-m-d H:i:s');
$email = $this->input->post('MailID');
$userInfo = array('email'=>$email,'EmpID'=>$EmpID,'password'=>getHashedPassword($password),'roleId'=>$roleId,'createdBy'=>$this->vendorId,'createdDtm'=>$Createddt);
$result = $this->user_model->addNewUser($userInfo);
if($result > 0)
{
redirect('userListing','refresh');
echo "<script>alert('New User Created successfully!');</script>";
$this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS');
// $this->form_validation->set_rules('role','role','trim|callback_Role_validate');
$this->form_validation->set_rules('password','Password','required|max_length[20]');
$this->form_validation->set_rules('cpassword','Confirm Password','trim|required|matches[password]|max_length[20]');
}
if($this->form_validation->run() == FALSE)
{
$this->addNew();
}
else
{
redirect('userListing','refresh');
echo "<script>alert('Failiure User Creation!');</script>";
}
$EmpID = $this->input->post('EmpList');
$roleId = '2';
$password = $this->input->post('password');
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$Createddt = $dt->format('Y-m-d H:i:s');
$email = $this->input->post('MailID');
$SelectedDepartment = $this->input->post('txtSelectedDepartment');
$comma_separated = explode(':', $SelectedDepartment);
$userInfo = array('email'=>$email,'EmpID'=>$EmpID,'password'=>getHashedPassword($password),'roleId'=>$roleId,'createdBy'=>$this->vendorId,'createdDtm'=>$Createddt);
$result = $this->user_model->addNewUser($userInfo);
if($SelectedDepartment != '')
{
for ($j = 0; $j < count($comma_separated); $j++)
{
$DeptCode = $comma_separated[$j];
$userdept=array('EmpID'=>$EmpID,'Departmentcode'=>$DeptCode);
$access= $this->user_model->addAccess($userdept);
}
}
if($result > 0)
{
echo "<script>alert('New User Created successfully!');</script>";
redirect('userListing','refresh');
}
else
{
redirect('userListing','refresh');
echo "<script>alert('Failiure User Creation!');</script>";
}
}
//}
}
function Adduserdepartment()
{
$empid= $this->input->post('Eid');
$Depcode= $this->input->post('Department');
$userdept=array('EmpID'=>$empid,'Departmentcode'=>$Depcode);
$access= $this->user_model->addAccess($userdept);
if($access>0)
{
echo "Successfully Added";
}
}
}
function Adduserdepartment()
{
$empid= $this->input->post('Eid');
$Depcode= $this->input->post('Department');
$userdept=array('EmpID'=>$empid,'Departmentcode'=>$Depcode);
$access= $this->user_model->addAccess($userdept);
if($access>0)
function Deleteuserdepartment()
{
echo "Successfully Added";
$empid= $this->input->post('Eid');
$Depcode= $this->input->post('Department');
$userdept=array('EmpID'=>$empid,'Departmentcode'=>$Depcode);
$access= $this->user_model->DeleteAccess($empid,$Depcode);
if($access>0)
{
echo "Successfully Deleted";
}
}
}
function Deleteuserdepartment()
{
$empid= $this->input->post('Eid');
$Depcode= $this->input->post('Department');
$userdept=array('EmpID'=>$empid,'Departmentcode'=>$Depcode);
$access= $this->user_model->DeleteAccess($empid,$Depcode);
if($access>0)
{
echo "Successfully Deleted";
}
}
/**
* This function is used load user edit information
@ -1139,49 +1151,48 @@ function Adduserdepartment()
*/
function editOld($UserId = '')
{
if($this->isAdmin() == TRUE )
{
$this->loadThis();
}
else
{
// if($this->isAdmin() == TRUE )
// {
// $this->loadThis();
// }
// else
// {
if($UserId == '')
{
// redirect('userListing');
}
$Uid = $_GET['UID'];
$Empid = $_GET['EMPID'];//to ask
$data['roles'] = $this->user_model->getUserRoles();
//print_r($data);
$data['EmpList'] = $this->user_model->GetEmployeeDetails($Uid);
//print_r($data);
$data['EmpRole'] = $this->user_model->GetRoleNameByUserID($Uid);
// $data['userInfo'] = $this->user_model->getUserInfo($userId);
$data['Departmentlist'] = $this->costcenter_model->getDepartmentnotadded($Empid);
$data['EmpRole'] = $this->user_model->GetRoleNameByUserID($Uid);
$data['AccessDept'] = $this->costcenter_model ->getaccessDept($Empid);
$this->global['pageTitle'] = 'Resico : Edit User';
$this->loadViews("editOld", $this->global, $data, NULL);
}
}
/**
* This function is used to edit the user information
*/
function editUser()
{
if($this->isAdmin() == TRUE)
{
$this->loadThis();
}
else
{
// if($this->isAdmin() == TRUE)
// {
// $this->loadThis();
// }
// else
// {
$userId = $this->input->post('EmpList');
$this->form_validation->set_rules('EmpList','EmpList','trim|callback_Employee_validateS');
$this->form_validation->set_rules('role','role','trim|callback_Role_validate');
@ -1193,39 +1204,39 @@ function Adduserdepartment()
$this->editOld($userId);
}
else
{
$EmpID = $this->input->post('EmpList');
$role = $this->input->post('role');
$password = $this->input->post('password');
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updatedDate = $dt->format('Y-m-d H:i:s');
// echo $EmpID;
$userInfo = array();
$userInfo = array('password'=>getHashedPassword($password),'roleId'=>$role,'EmpId'=>$EmpID,'updatedDtm'=>$updatedDate);
{
$EmpID = $this->input->post('EmpList');
$role = $this->input->post('role');
$password = $this->input->post('password');
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updatedDate = $dt->format('Y-m-d H:i:s');
// echo $EmpID;
$result = $this->user_model->editUser($userInfo, $EmpID);
$userInfo = array();
$userInfo = array('password'=>getHashedPassword($password),'roleId'=>$role,'EmpId'=>$EmpID,'updatedDtm'=>$updatedDate);
if($result == true)
{
$this->session->set_flashdata('success', 'User updated successfully');
$result = $this->user_model->editUser($userInfo, $EmpID);
if($result == true)
{
$this->session->set_flashdata('success', 'User updated successfully');
}
else
{
$this->session->set_flashdata('error', 'User updation failed');
}
redirect('userListing');
}
else
{
$this->session->set_flashdata('error', 'User updation failed');
}
redirect('userListing');
}
//}
}
}
/**
@ -1246,7 +1257,7 @@ function Adduserdepartment()
echo 'Succssfully change the user status to InAcive';
}
/**
* To load the change password screen
*/
@ -1310,17 +1321,8 @@ function Adduserdepartment()
$this->loadViews("404", $this->global, NULL, NULL);
}
/////////////* this function used to Material Inward Register report controller parts*//////////////////////
function getMaterialInwardRegister()
{
@ -1338,16 +1340,6 @@ function Adduserdepartment()
$this->loadViews("Report_Material_inward_Register", $this->global,$data,NULL);
}
}
?>

View File

@ -16,6 +16,7 @@ class BaseController extends CI_Controller {
protected $HeadDept = '';
protected $DepartmentName = '';
protected $roleText = '';
//Protected depaccess = '';
protected $global = array ();
/**
@ -49,12 +50,14 @@ class BaseController extends CI_Controller {
$this->HeadDept = $this->session->userdata ( 'HeadDept' );
$this->DepartmentName = $this->session->userdata ( 'DepartmentName' );
$this->EmpID = $this->session->userdata ( 'EmpID' );
$this->depaccess = $this->session->userdata ('depaccess');
$this->profilepic = $this->session->userdata ( 'ProfilePic' );
$this->global ['name'] = $this->name;
$this->global ['role'] = $this->role;
$this->global ['role_text'] = $this->roleText;
$this->global ['DEPCode'] = $this->DEPCode;
$this->global ['Designation'] = $this->Designation;
$this->global ['DepAccesslist'] = $this->depaccess;
}
}
@ -84,8 +87,8 @@ class BaseController extends CI_Controller {
* This function is used to load the set of views
*/
function loadThis() {
$this->global ['pageTitle'] = 'Resico Industries : Access Denied';
$this->global ['pageTitle'] = 'Resico : Access Denied';
$this->load->view ( 'includes/header', $this->global );
$this->load->view ( 'access' );
$this->load->view ( 'includes/footer' );
@ -119,8 +122,7 @@ class BaseController extends CI_Controller {
* This function used provide the pagination resources
* @param {string} $link : This is page link
* @param {number} $count : This is page count
* @param {number} $perPage : This is
* records per page limit
* @param {number} $perPage : This is records per page limit
* @return {mixed} $result : This is array of records and pagination data
*/
function paginationCompress($link, $count, $perPage = 10) {

View File

@ -441,5 +441,33 @@ class costcenter_model extends CI_Model
$this->db->update('T_CostCenter_Budget', $Budget);
return TRUE;
}
function getDepartmentnotadded($Empid)
{
$subQuery = 'select Dept.DEPCode,Dept.DepartmentName from T_DepartmentDetails Dept
left join T_AccessDepartments Ass on Ass.Departmentcode= Dept.DEPCode
where Dept.DEPCode not in
(select Ass.Departmentcode from T_AccessDepartments Ass where EmpID=?) group by Dept.DEPCode';
$query = $this->db->query($subQuery, array($Empid));
return $query->result();
}
function getaccessDept($Empid)
{
$this->db->select('Ass.Departmentcode as AssDep,Dep.DepartmentName');
$this->db->from('T_AccessDepartments Ass');
$this->db->join('T_DepartmentDetails Dep', 'Dep.DEPCode = Ass.Departmentcode','left');
$this->db->where('EmpID ',$Empid);
$query = $this->db->get();
return $query->result();
}
}
?>

View File

@ -110,6 +110,19 @@ class Login_model extends CI_Model
return false;
}
}
function Accessdep($EmpID)
{
$this->db->select('Departmentcode as AssDep');
$this->db->from('T_AccessDepartments');
$this->db->where('EmpID', $EmpID);
$query = $this->db->get();
// print_r( $this->db->last_query());
return $query->result();
}
}
?>

View File

@ -82,7 +82,7 @@ class User_model extends CI_Model
* @return number $insert_id : This is last inserted id
*/
function addNewUser($userInfo)
{
{
$this->db->trans_start();
$this->db->insert('tbl_users', $userInfo);
@ -213,6 +213,27 @@ class User_model extends CI_Model
return $query->result();
}
function addAccess($userdept)
{
$this->db->trans_start();
$this->db->insert('T_AccessDepartments', $userdept);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
return $insert_id;
}
function DeleteAccess($empid,$Depcode)
{
$this->db->where("Departmentcode",$Depcode);
$this->db->where("EmpID",$empid);
$this->db->delete('T_AccessDepartments');
return TRUE;
}

View File

@ -17,16 +17,14 @@
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-primary">
<!-- /.box-header -->
<!-- /.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="row">
<div class="col-md-3">
<div class="form-group">
<label for="fname">Employee ID</label>
@ -85,23 +83,41 @@
</div>
</div>
<div class="row">
<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">
<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>
@ -118,20 +134,65 @@
?>
</select>
</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>
</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>&nbsp;</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">
@ -153,6 +214,8 @@
<?php
$this->load->helper('form');
$error = $this->session->flashdata('error');
echo $error;
if($error)
{
?>
@ -176,7 +239,7 @@
<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>
</div>
</section>
@ -226,4 +289,59 @@ else
}
});
$('#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>

View File

@ -1,373 +0,0 @@
<style>
.autocomplete-suggestion{
cursor:pointer;
background-color:skyblue;
/* background-color: darkgrey; */
outline: 1px solid slategrey;
}
</style>
<script type="text/javascript" src="<?php echo base_url();?>assets/Autocomplete/jquery.autocomplete.js"></script>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Siddharth Industries - Add New Material </center>
</h1>
</section>
<section class="content" id="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>rawmaterialdetails/rawmaterialListing" 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">
<!-- form start -->
<form id="addUser" action="<?php echo base_url() ?>rawmaterialdetails/addNewRawMaterial" method="post" role="form">
<div class="box-body">
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<label for="MaterialName">Material Name</label><font color="Red">*</font>
<input type="text" class="form-control required " onkeypress="return BlockSpecial(event);" required id="MaterialName" name="MaterialName" maxlength="255">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="MaterialType">Material Type</label><font color="Red">*</font>
<select class="form-control select2" required id="MaterialType" name="MaterialType">
<option value="" required>Select Material Type</option>
<?php
if(!empty($material))
{
foreach ($material as $SID)
{
?>
<option value="<?php echo $SID->ConfigValue ?>"><?php echo $SID->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3" >
<div class="form-group autoSearch" id="mc">
<label for="Matcate">Material Caterogy</label><font color="Red">*</font>
<input type="text" class="form-control required " required id="MatCate" name="MatCate" maxlength="255" >
<!-- <div id="tagsname"></div> -->
<!-- <input type="text" class="form-control" id="HideMatCate" name="HideMatCate" readonly> -->
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="UOM">Unit of Measurement</label><font color="Red">*</font>
<select class="form-control required select2" id="UOM" name="UOM" >
<option value="" required>Select UOM</option>
<?php
if(!empty($UOM))
{
foreach ($UOM as $SID)
{
?>
<option value="<?php echo $SID->ConfigValue; ?>"><?php echo $SID->ConfigValue ?>
<?php
}
}
?>
</select>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<label for="Assetcode">Asset Code</label>
<select class="form-control select2" id="Assetcode" name="Assetcode" disabled="true">
<option value="0">Select Asset Code</option>
<?php
if(!empty($assetcode))
{
foreach ($assetcode as $AC)
{
?>
<option value="<?php echo $AC->AssetCode ?>"><?php echo $AC->AssetCode ?> - <?php echo $AC->AssetName ?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="Costcenter">Cost Center Code</label>
<select class="form-control select2" id="Costcenter" name="Costcenter" disabled="true">
<option value="0">Select Cost Center</option>
<?php
if(!empty($costcentercode))
{
foreach ($costcentercode as $CC)
{
?>
<option value="<?php echo $CC->CostCenterCode ?>"><?php echo $CC->CostCenterCode ?> - <?php echo $CC->CostCenterName?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="conversionfactor">Conversion Factor</label>
<input type="text" class="form-control" id="conversionfactor" name="conversionfactor" maxlength="255" onkeypress="return onlyAlphabets(event);">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="conversionfactorUOM">Conversion Factor UOM</label>
<select class="form-control select2" id="conversionfactorUOM" name="conversionfactorUOM">
<option value="0">Select Conversion Factor UOM</option>
<?php
if(!empty($cfUOM))
{
foreach ($cfUOM as $cfuom)
{
?>
<option value="<?php echo $cfuom->ConfigValue; ?>"><?php echo $cfuom->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<label for="HSNcode">HSN code</label>
<input type="text" class="form-control" id="HSNcode" onkeypress="return isNumberKey(event)" name="HSNcode" maxlength="8">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="remarks">Remarks</label>
<input type="text" class="form-control" id="remarks" name="remarks" maxlength="255">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="Active">IsActive</label> <br>
<input type="checkbox" id="isactive" name="isactive" >
</div>
</div>
</div>
</div><!-- /.box-body -->
<div class="box-footer" style="text-align:right">
<input type="reset" class="btn btn-primary" value="Reset" />
<input type="submit" onclick="Validate();" value="Submit" class="btn btn-primary">
</div>
</form>
</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>
</div>
</section>
</div>
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>
<script>
//var tempARRAY = [];
$(document).ready(function(){
$("#MaterialType").select2();
// $("#MaterialCategory").select2();
$("#UOM").select2();
$("#Assetcode").select2();
$("#Costcenter").select2();
$("#conversionfactorUOM").select2();
$('#MatCate').autocomplete({
onSearchStart: function (query) {
//alert(query);
$('#MatCate').autocomplete("option", "minLength", 0);
},
serviceUrl: "<?php echo base_url();?>rawmaterialdetails/autocomplete",
onSelect: function (suggestion) {
var data = suggestion.ConfigValue;
var selectedvalue = $('input[name=MatCate]').val();
if(selectedvalue=='Spares')
{
//alert('good');
//$('#contest_numofwinners').hide();
$('#Assetcode').prop('disabled', false);
$('#Costcenter').prop('disabled', false);
}
else{
// // alert('bad');
$('#Assetcode').prop('disabled', 'disabled');
$('#Costcenter').prop('disabled', 'disabled');
}
}
});
});
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 &lt;space&gt; 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;
}
$('#MaterialName').change(function() {
var materialname = $('#MaterialName').val();
//var s = "I am Given String ";
//material = material.replace(/\s*$/,"");
var material = materialname.replace(/ /g,'');
//alert(m.length+" "+m+" "+s+" "+s.length);
$('#content').loader('show');
$.ajax({
data:{id:material},
type:"POST",
url:"<?php echo base_url();?>rawmaterialdetails/checkmaterial",
success:function(data) {
var count = data.length;
//alert(count);
if(count >2 ){
$('#content').loader('hide');
alert('Material name already existed ! ');
dat = JSON.parse(data);
var related_name = "";
$.each(dat,function(i,obj){
related_name += obj.MaterialCode +" - "+ obj.MaterialName+" - "+obj.MaterialType+" - "+obj.Category+"\n";
});
alert("'" + materialname + "' - related materials are , " + " \n \n" + related_name);
$("#MaterialName").focus();
}
else{
$('#content').loader('hide');
// alert("empty data");
}
}
});
});
function Validate()
{
if($("#MaterialName").val().length < 1)
{
alert('Please Enter MaterialName');
$("#MaterialName").focus();
return false;
}
if($("option:selected", $("#UOM")).val() == "")
{
alert('Please Select UOM ');
$("#UOM").focus();
return false;
}
if($("option:selected", $("#MaterialCategory")).val() == "")
{
alert('Please Select Material Category');
$("#MaterialCategory").focus();
return false;
}
if($("option:selected", $("#MaterialType")).val() == "")
{
alert('Please Select Material Type');
$("#MaterialType").focus();
return false;
}
}
</script>

View File

@ -1478,5 +1478,5 @@ collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:
<?php
}
?>
</section>/* "content" section closed*/
</section>
</div>

View File

@ -1,5 +1,3 @@
<?php
$EmpId = '';
@ -35,15 +33,13 @@ if(!empty($EmpList))
}
}
?>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Resico Industries - Edit User </center>
<center>Resico Industries - Edit User</center>
</h1>
</section>
@ -59,7 +55,7 @@ if(!empty($EmpList))
<!-- general form elements -->
<div id="content"></div>
<div class="box box-primary">
<!-- form start -->
@ -115,8 +111,22 @@ if(!empty($EmpList))
<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="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>
@ -133,19 +143,87 @@ if(!empty($EmpList))
?>
</select>
</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>
<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>&nbsp;</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>
@ -153,6 +231,11 @@ if(!empty($EmpList))
</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>
@ -194,3 +277,145 @@ if(!empty($EmpList))
</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>

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@
<td><?php echo $record->DepartmentName ?></td>
<td><?php echo $record->role ?></td>
<td>
<a href="<?php echo base_url().'user/editOld?UID='.$record->userId;?>"><i class="fa fa-pencil"></i>&nbsp;&nbsp;&nbsp;</a>
<a href="<?php echo base_url().'user/editOld?UID='.$record->userId.'&EMPID='.$record->EmpID;?>"><i class="fa fa-pencil"></i>&nbsp;&nbsp;&nbsp;</a>
<a onclick="deleteUser(<?php echo $record->userId;?>)"><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
</tr>

0
uploads/images/avatar.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

BIN
uploads/images/avatar2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
uploads/images/avatar3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
uploads/images/avatar4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
uploads/images/avatar5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

0
uploads/images/user1-128x128.jpg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB