From 929e1d76d7369477bc4f61d8b62a8a3733ede9c1 Mon Sep 17 00:00:00 2001 From: resicovenba Date: Wed, 6 Dec 2017 19:03:33 +0530 Subject: [PATCH] employee image upload --- Apollo/api/application/config/routes.php | 3 + .../controllers/Employee_Controller.php | 414 +++++++++------ .../api/application/models/Employee_model.php | 169 ++++-- Apollo/assets/js/controllers/employeeCtrl.js | 489 +++++++----------- Apollo/assets/js/controllers/sessionCtrl.js | 1 + Apollo/assets/views/editEmployeeDetails.html | 78 +++ Apollo/assets/views/employeeDetails.html | 64 ++- Apollo/assets/views/partials/top-navbar.html | 5 +- Apollo/images/default.jpeg | Bin 0 -> 3209 bytes Apollo/images/employee/default.jpeg | Bin 0 -> 3209 bytes 10 files changed, 717 insertions(+), 506 deletions(-) create mode 100644 Apollo/images/default.jpeg create mode 100644 Apollo/images/employee/default.jpeg diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index dce50cd0..99149df3 100644 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -77,6 +77,9 @@ $route['chkUpdateEmpExistDetail'] = 'Employee_Controller/check_update_exist'; $route['updateEmpExistDetail'] = 'Employee_Controller/updateEmployee'; $route['getEmpBranchDetails'] = 'Employee_Controller/getEmpBranchDetails'; $route['updateEmpBranchDetail'] = 'Employee_Controller/updateEmpBranchDetail'; +$route['updateEmpImgExistDetail'] = 'Employee_Controller/updateEmployeeImage'; +$route['insertEmployeeImage'] = 'Employee_Controller/addEmployeeImage'; + // call tracking $route['getTrackingLeadDetails'] = 'Call_Tracking_Controller/getTrackingLeadDetails'; $route['addLeadTrackingDetails'] = 'Call_Tracking_Controller/addLeadTrackingDetails'; diff --git a/Apollo/api/application/controllers/Employee_Controller.php b/Apollo/api/application/controllers/Employee_Controller.php index e6fe3092..94d59a71 100644 --- a/Apollo/api/application/controllers/Employee_Controller.php +++ b/Apollo/api/application/controllers/Employee_Controller.php @@ -43,7 +43,6 @@ class Employee_Controller extends REST_Controller { $this->methods['updateEmpBranchDetail_post']['limit'] = 100; // load the employee model $this->load->model('Employee_model', 'employee_model'); - } //This method used to get employee Details @@ -112,16 +111,16 @@ class Employee_Controller extends REST_Controller { // get branch details public function getMasterBranchDetails_post () { - $reqRoleID = $this->post('reqRoleID'); - $reqUserID = $this->post('reqUserID'); - $resMasterBranchDetails = $this->employee_model->get_req_master_branch_detail( $reqRoleID, $reqUserID );// Check if the employee exist - if ($resMasterBranchDetails) + $reqRoleID = $this->post('reqRoleID'); + $reqUserID = $this->post('reqUserID'); + $resMasterBranchDetails = $this->employee_model->get_req_master_branch_detail( $reqRoleID, $reqUserID );// Check if the employee exist + if ($resMasterBranchDetails) { $resMasterBranchDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($resMasterBranchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } - else + else { // Set the response and exit $this->response([ @@ -133,16 +132,16 @@ class Employee_Controller extends REST_Controller { // check exist values details public function check_exist_post() { - $data = $this->post('data'); - $checkData = $this->post('check'); - $checkRes = $this->employee_model->check_exist( $data, $checkData );// Check if the employee exist - if ($checkRes) + $data = $this->post('data'); + $checkData = $this->post('check'); + $checkRes = $this->employee_model->check_exist( $data, $checkData );// Check if the employee exist + if ($checkRes) { $checkRes['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($checkRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } - else + else { // Set the response and exit $this->response([ @@ -152,142 +151,261 @@ class Employee_Controller extends REST_Controller { } } - // add employee + // add employee with image public function addEmployee_post() { - $data = $this->post('data'); - $createdBy = $this->post('createdBy'); + $data = $this->post('data'); + $createdBy = $this->post('createdBy'); - $req['StaffID'] = $data['employeeId']; - $req['Firstname'] = $data['firstname']; - $req['Lastname'] = $data['lastname']; - $req['Fathername'] = $data['fathername']; - $req['EmailID'] = $data['emailId']; - $req['MotherName'] = $data['mothername']; - $req['MobileNumber'] = $data['primaryPhone']; - $req['AlternateNumber'] = $data['secondaryPhone']; - $req['Gender'] = $data['gender']; - $req['DOB'] = $data['dateofbirth']; - // $req['DOB'] = $data['dateofbirth']; - $req['PresentAddress'] = $data['address2']; - $req['PermanentAddress'] = $data['address1']; - $req['AadharNumber'] = $data['aadharNumber']; - $req['OtherID'] = $data['otherId']; - $req['OtherIDDetails'] = $data['otherIdDetails']; - $req['Qualification'] = $data['qualificaion']; - $req['BranchCode'] = $data['homeBranch']; - $req['IsActive'] = $data['switchsetting']; - $req['DOJ'] = $data['dateofjoining']; - // $req['DOJ'] = $data['dateofjoining']; - $req['ListCode'] = $data['role']; - $req['CreatedBy'] = $createdBy; - // print_r($req);exit(); - $employeeAdd = $this->employee_model->add_employee( $req, $createdBy );// Check if the employee exist - if ($employeeAdd) - { - $employeeAdd['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($employeeAdd, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No users were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code - } + $imagename = ''; + $size = ''; + $imageSource = ''; + + $req['StaffID'] = $data['employeeId']; + $req['Firstname'] = $data['firstname']; + $req['Lastname'] = $data['lastname']; + $req['Fathername'] = $data['fathername']; + $req['EmailID'] = $data['emailId']; + $req['MotherName'] = $data['mothername']; + $req['MobileNumber'] = $data['primaryPhone']; + $req['AlternateNumber'] = $data['secondaryPhone']; + $req['Gender'] = $data['gender']; + $req['DOB'] = $data['dateofbirth']; + // $req['DOB'] = $data['dateofbirth']; + $req['PresentAddress'] = $data['address2']; + $req['PermanentAddress'] = $data['address1']; + $req['AadharNumber'] = $data['aadharNumber']; + $req['OtherID'] = $data['otherId']; + $req['OtherIDDetails'] = $data['otherIdDetails']; + $req['Qualification'] = $data['qualificaion']; + $req['BranchCode'] = $data['homeBranch']; + $req['IsActive'] = $data['switchsetting']; + $req['DOJ'] = $data['dateofjoining']; + // $req['DOJ'] = $data['dateofjoining']; + $req['ListCode'] = $data['role']; + $req['CreatedBy'] = $createdBy; + // print_r($req);exit(); + $employeeAdd = $this->employee_model->add_employee( $req, $createdBy, $imagename, $imageSource, $size );// Check if the employee exist + if ($employeeAdd) + { + $employeeAdd['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($employeeAdd, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No users were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + // add employee with image + public function addEmployeeImage_post() { + // print_r($this->post('idProof'));exit(); + $imagename = $_FILES['idProof']['name']; + + $size = $_FILES['idProof']['size']; + $imageSource = $_FILES['idProof']['tmp_name']; + // echo $size;exit(); + $data= $this->post('data'); + $createdBy= $this->post('createdBy'); + $temp = json_decode($data, true); + + $req['StaffID'] = $temp['employeeId']; + $req['Firstname'] = $temp['firstname']; + $req['Lastname'] = $temp['lastname']; + $req['Fathername'] = $temp['fathername']; + $req['EmailID'] = $temp['emailId']; + $req['MotherName'] = $temp['mothername']; + $req['MobileNumber'] = $temp['primaryPhone']; + $req['AlternateNumber'] = $temp['secondaryPhone']; + $req['Gender'] = $temp['gender']; + $req['DOB'] = $temp['dateofbirth']; + // $req['DOB'] = $data['dateofbirth']; + $req['PresentAddress'] = $temp['address2']; + $req['PermanentAddress'] = $temp['address1']; + $req['AadharNumber'] = $temp['aadharNumber']; + $req['OtherID'] = $temp['otherId']; + $req['OtherIDDetails'] = $temp['otherIdDetails']; + $req['Qualification'] = $temp['qualificaion']; + $req['BranchCode'] = $temp['homeBranch']; + $req['IsActive'] = $temp['switchsetting']; + $req['DOJ'] = $temp['dateofjoining']; + // $req['DOJ'] = $data['dateofjoining']; + $req['ListCode'] = $temp['role']; + $req['CreatedBy'] = $createdBy; + + $employeeAdd = $this->employee_model->add_employee( $req, $createdBy, $imagename, $imageSource, $size );// Check if the employee exist + if ($employeeAdd) + { + $employeeAdd['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($employeeAdd, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No users were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } public function check_update_exist_post() { - $exceptId = $this->post('exceptId'); - $datas = $this->post('datas'); - $checkFor = $this->post('check'); + $exceptId = $this->post('exceptId'); + $datas = $this->post('datas'); + $checkFor = $this->post('check'); - $checkRes = $this->employee_model->check_update_exist( $exceptId, $datas, $checkFor );// Check if the employee exist - if ($checkRes) - { - $checkRes['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($checkRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No users were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code - } + $checkRes = $this->employee_model->check_update_exist( $exceptId, $datas, $checkFor );// Check if the employee exist + if ($checkRes) + { + $checkRes['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($checkRes, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No users were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } - - // update employee details - public function updateEmployee_post () { - $data = $this->post('data'); - $updatedBy = $this->post('updatedBy'); - $updateStaff = $data['StaffID']; - $req['Firstname'] = $data['Firstname']; - $req['Lastname'] = $data['Lastname']; - $req['Fathername'] = $data['Fathername']; - $req['EmailID'] = $data['EmailID']; - $req['MotherName'] = $data['MotherName']; - $req['MobileNumber'] = $data['MobileNumber']; - $req['AlternateNumber'] = $data['AlternateNumber']; - $req['Gender'] = $data['Gender']; - // $req['DOB'] = date('d-m-Y', strtotime($data['DOB']) ); - $req['DOB'] = $data['DOB']; - $req['PresentAddress'] = $data['PresentAddress']; - $req['PermanentAddress'] = $data['PermanentAddress']; - $req['AadharNumber'] = $data['AadharNumber']; - $req['OtherID'] = $data['OtherID']; - $req['OtherIDDetails'] = $data['OtherIDDetails']; - $req['Qualification'] = $data['Qualification']; - // $req['BranchCode'] = $data['BranchCode']; - $req['IsActive'] = $data['IsActive']; - // $req['DOJ'] = date('d-m-Y', strtotime($data['DOJ']) ); - $req['DOJ'] = $data['DOJ']; - // $req['ListCode'] = $data['ListCode']; - $req['UpdatedBy'] = $updatedBy; - $date = date('Y-m-d H:i:s'); - $req['UpdatedOn'] = $date; - // print_r($req);exit(); - $employeeUpdate = $this->employee_model->update_employee( $req, $updateStaff );// Check if the employee exist - if ($employeeUpdate) - { - $employeeUpdate['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($employeeUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No users were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code - } + // update employee with image + public function updateEmployeeImage_post() { + + $imagename = $_FILES['idProof']['name']; + $size = $_FILES['idProof']['size']; + $imageSource = $_FILES['idProof']['tmp_name']; + + $temp= $this->post('data'); + $createdBy= $this->post('createdBy'); + $data = json_decode($temp, true); + + $updatedBy = $this->post('updatedBy'); + $updateStaff = $data['StaffID']; + + $req['Firstname'] = $data['Firstname']; + $req['Lastname'] = $data['Lastname']; + $req['Fathername'] = $data['Fathername']; + $req['EmailID'] = $data['EmailID']; + $req['MotherName'] = $data['MotherName']; + $req['MobileNumber'] = $data['MobileNumber']; + $req['AlternateNumber'] = $data['AlternateNumber']; + $req['Gender'] = $data['Gender']; + // $req['DOB'] = date('d-m-Y', strtotime($data['DOB']) ); + $req['DOB'] = $data['DOB']; + $req['PresentAddress'] = $data['PresentAddress']; + $req['PermanentAddress'] = $data['PermanentAddress']; + $req['AadharNumber'] = $data['AadharNumber']; + $req['OtherID'] = $data['OtherID']; + $req['OtherIDDetails'] = $data['OtherIDDetails']; + $req['Qualification'] = $data['Qualification']; + // $req['ProfilePicPath'] = $data['ProfilePicPath']; + // $req['BranchCode'] = $data['BranchCode']; + $req['IsActive'] = $data['IsActive']; + // $req['DOJ'] = date('d-m-Y', strtotime($data['DOJ']) ); + $req['DOJ'] = $data['DOJ']; + // $req['ListCode'] = $data['ListCode']; + $req['UpdatedBy'] = $updatedBy; + $date = date('Y-m-d H:i:s'); + $req['UpdatedOn'] = $date; + // print_r($req);exit(); + $employeeUpdate = $this->employee_model->update_employee( $req, $updateStaff, $imagename, $imageSource, $size );// Check if the employee exist + if ($employeeUpdate) + { + $employeeUpdate['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($employeeUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No users were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + // update employee details without image + public function updateEmployee_post () { + $data = $this->post('data'); + $updatedBy = $this->post('updatedBy'); + $updateStaff = $data['StaffID']; + + $imagename = ''; + $size = ''; + $imageSource = ''; + + $req['Firstname'] = $data['Firstname']; + $req['Lastname'] = $data['Lastname']; + $req['Fathername'] = $data['Fathername']; + $req['EmailID'] = $data['EmailID']; + $req['MotherName'] = $data['MotherName']; + $req['MobileNumber'] = $data['MobileNumber']; + $req['AlternateNumber'] = $data['AlternateNumber']; + $req['Gender'] = $data['Gender']; + // $req['DOB'] = date('d-m-Y', strtotime($data['DOB']) ); + $req['DOB'] = $data['DOB']; + $req['PresentAddress'] = $data['PresentAddress']; + $req['PermanentAddress'] = $data['PermanentAddress']; + $req['AadharNumber'] = $data['AadharNumber']; + $req['OtherID'] = $data['OtherID']; + $req['OtherIDDetails'] = $data['OtherIDDetails']; + $req['Qualification'] = $data['Qualification']; + $req['ProfilePicPath'] = $data['ProfilePicPath']; + // $req['BranchCode'] = $data['BranchCode']; + $req['IsActive'] = $data['IsActive']; + // $req['DOJ'] = date('d-m-Y', strtotime($data['DOJ']) ); + $req['DOJ'] = $data['DOJ']; + // $req['ListCode'] = $data['ListCode']; + $req['UpdatedBy'] = $updatedBy; + $date = date('Y-m-d H:i:s'); + $req['UpdatedOn'] = $date; + // print_r($req);exit(); + $employeeUpdate = $this->employee_model->update_employee( $req, $updateStaff, $imagename, $imageSource, $size );// Check if the employee exist + if ($employeeUpdate) + { + $employeeUpdate['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($employeeUpdate, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No users were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } // get employee branch details public function getEmpBranchDetails_post() { - $staffID = $this->post('staffID'); - $employeeBranch = $this->employee_model->get_employee_branch( $staffID );// Check if the employee exist - if ($employeeBranch) - { - $employeeBranch['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($employeeBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No users were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code - } + $staffID = $this->post('staffID'); + $employeeBranch = $this->employee_model->get_employee_branch( $staffID );// Check if the employee exist + if ($employeeBranch) + { + $employeeBranch['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($employeeBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No users were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } // update employee branch @@ -300,20 +418,20 @@ class Employee_Controller extends REST_Controller { $date = date('Y-m-d H:i:s'); $req['UpdatedOn'] = $date; - $updateBranch = $this->employee_model->upate_employee_branch( $empFor, $reqBanch, $req, $req['UpdatedBy'], $req['UpdatedOn'] );// Check if the employee exist - if ($updateBranch) - { - $updateBranch['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($updateBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No users were found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code - } + $updateBranch = $this->employee_model->upate_employee_branch( $empFor, $reqBanch, $req, $req['UpdatedBy'], $req['UpdatedOn'] );// Check if the employee exist + if ($updateBranch) + { + $updateBranch['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateBranch, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No users were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } } } diff --git a/Apollo/api/application/models/Employee_model.php b/Apollo/api/application/models/Employee_model.php index ecd4e866..5952b1be 100644 --- a/Apollo/api/application/models/Employee_model.php +++ b/Apollo/api/application/models/Employee_model.php @@ -254,27 +254,70 @@ class Employee_model extends CI_Model } // add employee - public function add_employee($empArr, $createdBy) + public function add_employee($empArr, $createdBy, $imageName, $imageSource, $imageSize) { - $this->db->insert(STAFF, $empArr); - if ($this->db->affected_rows() == '1') { - $branchArr['StaffID'] = $empArr['StaffID']; - $branchArr['BranchCode'] = $empArr['BranchCode']; - $branchArr['IsActive'] = $empArr['IsActive']; - $branchArr['CreatedBy'] = $createdBy; - $this->db->insert(STAFF_BRANCH, $branchArr); + if( $imageSource == '') { // add employee without image + $imageNameDb = 'default.jpeg'; + $empArr['ProfilePicPath'] = "employee/".$imageNameDb; + $this->db->insert(STAFF, $empArr); if ($this->db->affected_rows() == '1') { - $loginArr['StaffID'] = $empArr['StaffID']; - $loginArr['ListCode'] = $empArr['ListCode']; - $loginArr['MobileNumber'] = $empArr['MobileNumber']; - $loginArr['EmailId'] = $empArr['EmailID']; - $loginArr['IsActive'] = $empArr['IsActive']; - $loginArr['CreatedBy'] = $createdBy; - $loginArr['Password'] = ENCR_PASSWORD; - $this->db->insert(LOGIN, $loginArr); + $branchArr['StaffID'] = $empArr['StaffID']; + $branchArr['BranchCode'] = $empArr['BranchCode']; + $branchArr['IsActive'] = $empArr['IsActive']; + $branchArr['CreatedBy'] = $createdBy; + $this->db->insert(STAFF_BRANCH, $branchArr); if ($this->db->affected_rows() == '1') { - $result['addEmpStatus'] = true; - $result['message'] = "Successfully employee details added"; + $loginArr['StaffID'] = $empArr['StaffID']; + $loginArr['ListCode'] = $empArr['ListCode']; + $loginArr['MobileNumber'] = $empArr['MobileNumber']; + $loginArr['EmailId'] = $empArr['EmailID']; + $loginArr['IsActive'] = $empArr['IsActive']; + $loginArr['CreatedBy'] = $createdBy; + $loginArr['Password'] = ENCR_PASSWORD; + $this->db->insert(LOGIN, $loginArr); + if ($this->db->affected_rows() == '1') { + $result['addEmpStatus'] = true; + $result['message'] = "Successfully employee details added"; + } else { + $result['addEmpStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['addEmpStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['addEmpStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { // add employee with image + $target = "../images/employee/"; + $getUploadStatus = $this->upload_image($imageSource, $imageSize, $target); + $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; + $empArr['ProfilePicPath'] = "employee/".$imageNameDb; + $this->db->insert(STAFF, $empArr); + if ($this->db->affected_rows() == '1') { + $branchArr['StaffID'] = $empArr['StaffID']; + $branchArr['BranchCode'] = $empArr['BranchCode']; + $branchArr['IsActive'] = $empArr['IsActive']; + $branchArr['CreatedBy'] = $createdBy; + $this->db->insert(STAFF_BRANCH, $branchArr); + if ($this->db->affected_rows() == '1') { + $loginArr['StaffID'] = $empArr['StaffID']; + $loginArr['ListCode'] = $empArr['ListCode']; + $loginArr['MobileNumber'] = $empArr['MobileNumber']; + $loginArr['EmailId'] = $empArr['EmailID']; + $loginArr['IsActive'] = $empArr['IsActive']; + $loginArr['CreatedBy'] = $createdBy; + $loginArr['Password'] = ENCR_PASSWORD; + $this->db->insert(LOGIN, $loginArr); + if ($this->db->affected_rows() == '1') { + $result['addEmpStatus'] = true; + $result['message'] = "Successfully employee details added"; + } else { + $result['addEmpStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } } else { $result['addEmpStatus'] = false; $result['message'] = "Something went wrong.please try again"; @@ -283,9 +326,6 @@ class Employee_model extends CI_Model $result['addEmpStatus'] = false; $result['message'] = "Something went wrong.please try again"; } - } else { - $result['addEmpStatus'] = false; - $result['message'] = "Something went wrong.please try again"; } return $result; } @@ -332,28 +372,55 @@ class Employee_model extends CI_Model } // update employee personal details - public function update_employee($empArr, $updateFor) + public function update_employee($empArr, $updateFor, $imageName, $imageSource, $imageSize) { - $this->db->where('StaffID', $updateFor); - $this->db->update(STAFF, $empArr); - if ($this->db->affected_rows() == '1') { - $mobile = $empArr['MobileNumber']; - $email = $empArr['EmailID']; - $active = $empArr['IsActive']; - $updatedBy = $empArr['UpdatedBy']; - $updatedOn = $empArr['UpdatedOn']; - $sql = "UPDATE ".LOGIN." SET MobileNumber='$mobile', EmailId='$email', IsActive='$active', UpdatedBy='$updatedBy', UpdatedOn='$updatedOn' WHERE StaffID='$updateFor'"; - if($this->db->query($sql) == '1'){ - $result['addEmpStatus'] = true; - $result['message'] = "Successfully employee details Updated"; + if( $imageSource == '') { // update Employee without image + $this->db->where('StaffID', $updateFor); + $this->db->update(STAFF, $empArr); + if ($this->db->affected_rows() == '1') { + $mobile = $empArr['MobileNumber']; + $email = $empArr['EmailID']; + $active = $empArr['IsActive']; + $updatedBy = $empArr['UpdatedBy']; + $updatedOn = $empArr['UpdatedOn']; + $sql = "UPDATE ".LOGIN." SET MobileNumber='$mobile', EmailId='$email', IsActive='$active', UpdatedBy='$updatedBy', UpdatedOn='$updatedOn' WHERE StaffID='$updateFor'"; + if($this->db->query($sql) == '1'){ + $result['updateEmpStatus'] = true; + $result['message'] = "Successfully employee details Updated"; + } else { + $result['updateEmpStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { + $result['updateEmpStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } else { // update employee with image + $target = "../images/employee/"; + $getUploadStatus = $this->upload_image($imageSource, $imageSize, $target); + $imageNameDb = $getUploadStatus['status'] == true ? $getUploadStatus['imageName'] : $getUploadStatus['imageName'] = 'default.jpeg'; + $empArr['ProfilePicPath'] = "employee/".$imageNameDb; + $this->db->where('StaffID', $updateFor); + $this->db->update(STAFF, $empArr); + if ($this->db->affected_rows() == '1') { + $mobile = $empArr['MobileNumber']; + $email = $empArr['EmailID']; + $active = $empArr['IsActive']; + $updatedBy = $empArr['UpdatedBy']; + $updatedOn = $empArr['UpdatedOn']; + $sql = "UPDATE ".LOGIN." SET MobileNumber='$mobile', EmailId='$email', IsActive='$active', UpdatedBy='$updatedBy', UpdatedOn='$updatedOn' WHERE StaffID='$updateFor'"; + if($this->db->query($sql) == '1'){ + $result['updateEmpStatus'] = true; + $result['message'] = "Successfully employee details Updated"; + } else { + $result['updateEmpStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } } else { - $result['addEmpStatus'] = false; - $result['message'] = "Something went wrong.please try again"; + $result['updateEmpStatus'] = false; + $result['message'] = "Something went wrong.please try again"; } - } else { - $result['updateEmpStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } + } return $result; } @@ -412,14 +479,16 @@ class Employee_model extends CI_Model // echo $this->db->affected_rows();exit(); // update role to login table if ($this->db->affected_rows() == '1') { - $branchCode = $this->get_branch_code($reqBanch['BranchCode'][0]); + // $branchCode = $this->get_branch_code($reqBanch['BranchCode'][0]); + $branchCode = $reqBanch['BranchCode'][0]; $sql = "UPDATE ".STAFF." SET BranchCode='$branchCode' WHERE StaffID='$empFor'"; // update branch to staff table if ($this->db->query($sql) == '1') { $this->db->where('StaffID', $empFor); $this->db->delete(STAFF_BRANCH); foreach($reqBanch['BranchCode'] as $something) { - $branchCode = $this->get_branch_code($something); + // $branchCode = $this->get_branch_code($something); + $branchCode = $something; $sql1 = "INSERT INTO ".STAFF_BRANCH." (StaffID, BranchCode, IsActive, CreatedBy, CreatedOn, UpdatedBy, UpdatedOn) VALUES ('$empFor', '$branchCode', '1','$createby', '$createon', '$createby', '$createon')"; // update branch to staff_branch table @@ -496,4 +565,20 @@ class Employee_model extends CI_Model $roleDetails = $this->db->get()->first_row(); return $roleDetails->StaffID; } + + // image upload in taget path + public function upload_image( $imageSource, $size, $target ) { + $key2 = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 12); + $new_regNo = "Dri_" . $key2 . "." . 'jpeg'; + $targetPlace = $target . $new_regNo; + // echo $targetPlace;exit(); + if(!move_uploaded_file($imageSource , $targetPlace)) + { + return $result['status'] = false; + } else { + $result['status'] = true; + $result['imageName'] = $new_regNo; + return $result; + } + } } \ No newline at end of file diff --git a/Apollo/assets/js/controllers/employeeCtrl.js b/Apollo/assets/js/controllers/employeeCtrl.js index 7911e2eb..bd0ff24a 100644 --- a/Apollo/assets/js/controllers/employeeCtrl.js +++ b/Apollo/assets/js/controllers/employeeCtrl.js @@ -4,20 +4,20 @@ * Simple table with sorting and filtering on AngularJS */ -app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$http",'fileUpload', "API_POINTS", "$state", '$rootScope', '$cookies', 'md5', 'ipCookie', '$timeout', '$window', "flowFactory", function ($scope, toaster, $filter, ngTableParams, $http, fileUpload, apiPoint, $state, $rootScope, $cookies, md5, ipCookie, $timeout, $window, flowFactory) { - +app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$http", "API_POINTS", "$state", '$rootScope', '$cookies', 'md5', 'ipCookie', '$timeout', '$window', "flowFactory", function ($scope, toaster, $filter, ngTableParams, $http, apiPoint, $state, $rootScope, $cookies, md5, ipCookie, $timeout, $window, flowFactory) { + // $scope.removeImage = function () { // $scope.noImage = true; // }; // $scope.obj = new Flow(); - + // if ($scope.userInfo.avatar == '') { // $scope.noImage = true; // } - - - + + + /** * staff details capture * by : kdk @@ -166,9 +166,11 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ $scope.branchEditLoading = false; $scope.empBranchs = response.data.branch_details; $scope.branchArr = []; + $scope.BranchName = ''; angular.forEach($scope.empBranchs, function (item, index) { // alert(item.BranchName); - $scope.branchArr.push(item.BranchName); + $scope.BranchName = item.BranchName + '-' + item.BranchCode; + $scope.branchArr.push($scope.BranchName); }); $scope.empBranchDetails = { arr: $scope.branchArr, @@ -216,9 +218,11 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ if (response.data.MeasterBranchDetailStatus == true) { $scope.branchDetails = response.data.branch_details; $scope.branchDetailsName = []; + $scope.BranchName = ''; angular.forEach($scope.branchDetails, function (item, index) { - // alert(item.BranchName); - $scope.branchDetailsName.push(item.BranchName); + // alert(item.BranchName); + $scope.BranchName = item.BranchName + '-' + item.BranchCode; + $scope.branchDetailsName.push($scope.BranchName); }); } else { } @@ -292,6 +296,49 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ }); } + + //--------------------------------------------------------------> + // getting for image to show + //--------------------------------------------------------------> + + $scope.stepsModel = []; + $scope.imageUpload = function (event) { + var files = event.target.files; //FileList object + + for (var i = 0; i < files.length; i++) { + var file = files[i]; + var reader = new FileReader(); + reader.onload = $scope.imageIsLoaded; + reader.readAsDataURL(file); + } + } + + $scope.imageIsLoaded = function (e) { + $scope.$apply(function () { + // $scope.stepsModel.push(e.target.result); + $scope.stepsModel[0] = e.target.result; + }); + } + + + //an array of files selected + $scope.files = []; + + //listen for the file selected event + $scope.$on("fileSelected", function (event, args) { + $scope.$apply(function () { + //add the file object to the scope's files collection + $scope.files[0] = args.file; + }); + }); + + + // reset image + $scope.resetImage = function () { + $scope.files.length = 0; + $scope.stepsModel.length = 0; + } + // add empolyee $scope.employeeForm = { submit: function (form, myModel) { @@ -314,6 +361,8 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ angular.element('.ng-invalid[name=' + firstError + ']').focus(); // swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); } else { + + // alert($scope.files); // alert($scope.myModel.dateofbirth); var formate = "dd-MM-yyyy"; // var date = $filter('date')(new Date($scope.myModel.dateofbirth), formate); @@ -321,30 +370,55 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ $scope.myModel.dateofbirth = $filter('date')(new Date($scope.myModel.dateofbirth), formate); $scope.myModel.dateofjoining = $filter('date')(new Date($scope.myModel.dateofjoining), formate); // alert($scope.myModel.dateofbirth) - var req = { - method: 'POST', - url: apiPoint.url + 'insertEmployee/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - data: $scope.myModel, - createdBy: localDetails.localUserID, - } - }; - $http(req).then(function (response) { - if (response.data.addEmpStatus == true) { - swal("Success!", response.data.message, "success"); - $state.go($state.current, {}, { reload: true }); - } else { - // $scope.ldloading1[loading.replace('-', '_')] = false; - swal("Failed!", response.data.message, "error"); - } - }); + + var idProof = $scope.files[0]; + if (idProof !== undefined) { + var formData = new FormData(); + var idProof = $scope.files[0]; + // alert(idProof); + formData.append("data", JSON.stringify($scope.myModel)); + formData.append("createdBy", localDetails.localUserID); + formData.append('idProof', idProof); + + $http.post(apiPoint.url + 'insertEmployeeImage/', formData, { + transformRequest: angular.identity, + headers: { 'Content-Type': undefined, 'Process-Data': false }, + }).success(function (data) { + if (data.addEmpStatus == true) { + swal("Success!", data.message, "success"); + $state.go($state.current, {}, { reload: true }); + } else { + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", data.message, "error"); + } + }); + } else { + var req = { + method: 'POST', + url: apiPoint.url + 'insertEmployee/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: $scope.myModel, + createdBy: localDetails.localUserID, + }, + }; + $http(req).then(function (response) { + if (response.data.addEmpStatus == true) { + swal("Success!", response.data.message, "success"); + $state.go($state.current, {}, { reload: true }); + } else { + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", response.data.message, "error"); + } + }); + } } }, reset: function (form) { - + $scope.files.length = 0; + $scope.stepsModel.length = 0; // $scope.myModel = angular.copy($scope.master); form.$setPristine(true); $scope.myModel = { @@ -419,11 +493,11 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ }); } - $scope.hidden_DOB= ''; - $scope.hidden_DOJ= ''; + $scope.hidden_DOB = ''; + $scope.hidden_DOJ = ''; $scope.updateEmpDetails = function (form, p, hide_dob, hide_doj) { - + var firstError = null; if (form.$invalid) { var field = null, firstError = null; @@ -448,28 +522,54 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ p.IsActive = p.IsActive === true ? 1 : 0; p.DOB = p.DOB == hide_dob ? p.DOB : $filter('date')(new Date(p.DOB), formate); p.DOJ = p.DOJ == hide_doj ? p.DOJ : $filter('date')(new Date(p.DOJ), formate); - - var req = { - method: 'POST', - url: apiPoint.url + 'updateEmpExistDetail/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - data: p, - updatedBy: localDetails.localUserID, - } - }; - $http(req).then(function (response) { - if (response.data.updateEmpStatus = true) { - swal("Success!", response.data.message, "success"); - $scope.getEmployeeList(); - $scope.editId = -1; - } else { - // $scope.ldloading1[loading.replace('-', '_')] = false; - swal("Failed!", response.data.message, "error"); - } - }); + var idProof = $scope.files[0]; + // alert(idProof); + // alert(p.ProfilePicPath); + if (idProof === undefined) { + var req = { + method: 'POST', + url: apiPoint.url + 'updateEmpExistDetail/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: p, + updatedBy: localDetails.localUserID, + } + }; + $http(req).then(function (response) { + if (response.data.updateEmpStatus = true) { + swal("Success!", response.data.message, "success"); + $scope.getEmployeeList(); + $scope.editId = -1; + } else { + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", response.data.message, "error"); + } + }); + } else { + // update with image + var formData = new FormData(); + var idProof = $scope.files[0]; + // alert(idProof); + formData.append("data", JSON.stringify(p)); + formData.append("updatedBy", localDetails.localUserID); + formData.append('idProof', idProof); + + $http.post(apiPoint.url + 'updateEmpImgExistDetail/', formData, { + transformRequest: angular.identity, + headers: { 'Content-Type': undefined, 'Process-Data': false }, + }).success(function (data) { + if (data.updateEmpStatus == true) { + swal("Success!", data.message, "success"); + $scope.getEmployeeList(); + $scope.editId = -1; + } else { + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", data.message, "error"); + } + }); + } } } @@ -494,11 +594,18 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ } else { // alert(JSON.stringify(p)); // alert(JSON.stringify(empRole)); - // alert(JSON.stringify(empBranchs)); + + $scope.arr1 = []; + + angular.forEach(empBranchs.arr, function (item) { + var newString = item.split("-").pop(); + $scope.arr1.push(newString); + }); + // alert(JSON.stringify($scope.arr1)); $scope.sendBranchData = { 'empFor': p.StaffID, 'updateRole': empRole.ListCode, - 'updateBranch': empBranchs.arr, + 'updateBranch': $scope.arr1, 'updateBy': localDetails.localUserID } // p.IsActive = p.IsActive === true ? 1 : 0; @@ -526,266 +633,22 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ } } - - - $scope.uploadFile = function () { - -alert(); - - // var customer_name = $scope.customer_name; - // console.log(customer_name); - - // var userId = $scope.userId; - // console.log(userId); - - // var cafNo = $scope.cafNo; - // console.log(cafNo); - - // var primaryEmail = $scope.primaryEmail; - // console.log(primaryEmail); - - // var primaryPhone = $scope.primaryPhone; - // console.log(primaryPhone); - - // var presentAddress = $scope.presentAddress; - // console.log(presentAddress); - - // var createdBy = localStorage.getItem('id'); - // // console.log('Id is '); - // console.log(createdBy); - - // var idProof = $scope.idProof; - // console.log('Id Proof is '); - // console.dir(idProof); - - // var addressProof = $scope.addressProof; - // console.log('address Proof is '); - // console.dir(addressProof); - - // var cafForm = $scope.cafForm; - // console.log('caf Form is '); - // console.dir(cafForm); - - var uploadUrl = apiPoint.url + "addschoolimage.php"; - - fileUpload.uploadFileToUrl(customer_name, userId, cafNo, primaryEmail, primaryPhone, presentAddress, createdBy, idProof, addressProof, cafForm, uploadUrl); - - - - - }; - }]); - -'use strict'; -/** - * controllers used for the dashboard - */ - -app.directive('fileModel', ['$parse', function ($parse) { +// file upload directive +app.directive('fileUpload', function () { return { - restrict: 'A', - link: function (scope, element, attrs) { - var model = $parse(attrs.fileModel); - var modelSetter = model.assign; - - element.bind('change', function () { - scope.$apply(function () { - modelSetter(scope, element[0].files[0]); - }); + scope: true, //create a new scope + link: function (scope, el, attrs) { + el.bind('change', function (event) { + var files = event.target.files; + //iterate files since 'multiple' may be specified on the element + for (var i = 0; i < files.length; i++) { + //emit event upward + scope.$emit("fileSelected", { file: files[i] }); + } }); } }; -}]); +}); -// We can write our own fileUpload service to reuse it in the controller -app.service('fileUpload', ['$http', '$state', function ($http, $state) { - this.uploadFileToUrl = function (customer_name, userId, cafNo, primaryEmail, primaryPhone, presentAddress, createdBy, idProof, addressProof, cafForm, uploadUrl) { - var fd = new FormData(); - fd.append('customer_name', customer_name); - fd.append('userId', userId); - fd.append('cafNo', cafNo); - fd.append('primaryEmail', primaryEmail); - fd.append('primaryPhone', primaryPhone); - fd.append('presentAddress', presentAddress); - fd.append('createdBy', createdBy); - fd.append('idProof', idProof); - fd.append('addressProof', addressProof); - fd.append('cafForm', cafForm); - $http.post(uploadUrl, fd, { - transformRequest: angular.identity, - headers: {'Content-Type': undefined, 'Process-Data': false}, - - }) - .success(function (data) { - if (data.status == true) { - console.log("Success"); - swal("Success!", "Profile image is updated successfully!", "success"); - $state.go($state.current, {}, {reload: true}); - }else if(data.status_1 == true){ - swal("Success!", "school logo is updated successfully!", "success"); - $state.go($state.current, {}, {reload: true}); - }else if(data.status_2 == false){ - swal("Failed!", "Select Image for uploading!", "error"); - }else if(data.status_3 == false){ - swal("Failed!", "Image Size Should Be Less Than 5 Mb!", "error"); - } - else if(data.status_4 == false){ - swal("Failed!", "Image Size Should Be More Than 50 Kb!", "error"); - }else{ - swal("Failed!", "Image uploading has failed!", "error"); - } - }); - } - - -}]); - -app.controller('tarrifimage', ['$scope', '$state', '$http', 'fileUpload', 'API_POINTS', 'ngTableParams', '$filter', function ($scope, $state, $http, fileUpload, apiPoint, ngTableParams, $filter) { - - - $scope.idProof_check = false; - $scope.customerID = ''; - $scope.customerCafNo = ''; - $scope.new_id_form = ''; - - - $scope.address_check = false; - $scope.custID = ''; - $scope.cusCafNo = ''; - - - $scope.checked_check = false; - $scope.cafFormId = ''; - $scope.cafFormNo = ''; - $scope.customerId = ''; - $scope.new_caf_form = ''; - - //$scope.uploadFile = function () { - // - // - // var idProof = $scope.idProof; - // console.log('Id Proof is '); - // console.dir(idProof); - // - // - // - // - // var uploadUrl = apiPoint.url + "addimage.php"; - // - // fileUpload.uploadFileToUrl( idProof, uploadUrl); - //}; - - $scope.uploadFile_1 = function () { - -//alert(idProof); - - var customer_name = $scope.customer_name; - console.log(customer_name); - - var userId = $scope.userId; - console.log(userId); - - var cafNo = $scope.cafNo; - console.log(cafNo); - - var primaryEmail = $scope.primaryEmail; - console.log(primaryEmail); - - var primaryPhone = $scope.primaryPhone; - console.log(primaryPhone); - - var presentAddress = $scope.presentAddress; - console.log(presentAddress); - - var createdBy = localStorage.getItem('id'); - // console.log('Id is '); - console.log(createdBy); - - var idProof = $scope.idProof; - console.log('Id Proof is '); - console.dir(idProof); - - var addressProof = $scope.addressProof; - console.log('address Proof is '); - console.dir(addressProof); - - var cafForm = $scope.cafForm; - console.log('caf Form is '); - console.dir(cafForm); - - var uploadUrl = apiPoint.url + "addschoolimage.php"; - - fileUpload.uploadFileToUrl(customer_name, userId, cafNo, primaryEmail, primaryPhone, presentAddress, createdBy, idProof, addressProof, cafForm, uploadUrl); - - - - - }; - $scope.uploadFile = function () { - -//alert(idProof); - - var customer_name = $scope.customer_name; - console.log(customer_name); - - var userId = $scope.userId; - console.log(userId); - - var cafNo = $scope.cafNo; - console.log(cafNo); - - var primaryEmail = $scope.primaryEmail; - console.log(primaryEmail); - - var primaryPhone = $scope.primaryPhone; - console.log(primaryPhone); - - var presentAddress = $scope.presentAddress; - console.log(presentAddress); - - var createdBy = localStorage.getItem('id'); - // console.log('Id is '); - console.log(createdBy); - - var idProof = $scope.idProof; - console.log('Id Proof is '); - console.dir(idProof); - - var addressProof = $scope.addressProof; - console.log('address Proof is '); - console.dir(addressProof); - - var cafForm = $scope.cafForm; - console.log('caf Form is '); - console.dir(cafForm); - - var uploadUrl = apiPoint.url + "addprofileimage.php"; - - fileUpload.uploadFileToUrl(customer_name, userId, cafNo, primaryEmail, primaryPhone, presentAddress, createdBy, idProof, addressProof, cafForm, uploadUrl); - - - - - }; - $scope.viewId = -1; - $scope.viewMore = function (pid) { - $scope.viewId = pid; - $scope.editId = -1; - }; - - - $scope.editId = -1; - - $scope.setEditId = function (pid) { - - $scope.editId = pid; - - }; -}]); - - -/** - * Created by ws040 on 10/1/17. - */ diff --git a/Apollo/assets/js/controllers/sessionCtrl.js b/Apollo/assets/js/controllers/sessionCtrl.js index 73d2bcc4..27b42a35 100644 --- a/Apollo/assets/js/controllers/sessionCtrl.js +++ b/Apollo/assets/js/controllers/sessionCtrl.js @@ -82,6 +82,7 @@ app.controller('topnavCtrl', ["$scope", "$http", "API_POINTS", "$localStorage", * Get Top Nav user details */ $scope.resultData = response.data.details; + $scope.loginImage = $scope.resultData.ProfilePicPath; $scope.loginUser = { 'staffID': $scope.resultData.StaffID, 'fName': $scope.resultData.Firstname, diff --git a/Apollo/assets/views/editEmployeeDetails.html b/Apollo/assets/views/editEmployeeDetails.html index 00546de4..66f092da 100644 --- a/Apollo/assets/views/editEmployeeDetails.html +++ b/Apollo/assets/views/editEmployeeDetails.html @@ -387,6 +387,84 @@ --> +
+ + +
+ +
+
+
+
+ +
+
Update Profile Picture
+
+ +
+ +
+
+ + +
+
+ +
+ + + +
+
+ + +
+
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+
+ diff --git a/Apollo/assets/views/employeeDetails.html b/Apollo/assets/views/employeeDetails.html index 8ff2661d..78203fc7 100644 --- a/Apollo/assets/views/employeeDetails.html +++ b/Apollo/assets/views/employeeDetails.html @@ -420,7 +420,63 @@ - +
+
+
+
+ +
+ + +
+
+
Profile Picture
+
+ +
+
+ + + +
+
+ + +
+
+ +
+
+
+
+ + + +
+ + + +
+
+
+
+
@@ -443,6 +499,10 @@
+ + - \ No newline at end of file + + + diff --git a/Apollo/assets/views/partials/top-navbar.html b/Apollo/assets/views/partials/top-navbar.html index 6f4c8e01..7801319d 100644 --- a/Apollo/assets/views/partials/top-navbar.html +++ b/Apollo/assets/views/partials/top-navbar.html @@ -149,7 +149,10 @@