From 2137de6889e84bebd3efd0bbeb4e9f02bcab49b3 Mon Sep 17 00:00:00 2001 From: resicovenba Date: Thu, 23 Nov 2017 11:06:31 +0530 Subject: [PATCH] branch getails added --- .../api/application/models/Branch_model.php | 30 ++++++++++++------- .../api/application/models/Employee_model.php | 4 +-- Apollo/assets/js/controllers/employeeCtrl.js | 2 +- Apollo/assets/views/branchDetails.html | 18 +++++------ Apollo/assets/views/editBranchDetails.html | 18 +++++------ .../views/editEmployeeBranchDetails.html | 24 +++++++++++++-- Apollo/assets/views/employeeDetails.html | 4 +-- Apollo/assets/views/partials/nav.html | 12 ++++---- 8 files changed, 70 insertions(+), 42 deletions(-) diff --git a/Apollo/api/application/models/Branch_model.php b/Apollo/api/application/models/Branch_model.php index d42ef7f0..e124c222 100644 --- a/Apollo/api/application/models/Branch_model.php +++ b/Apollo/api/application/models/Branch_model.php @@ -23,20 +23,28 @@ class Branch_model extends CI_Model { if($this->db->get(BRANCH)->first_row()){ $result['BranchStatus'] = false; $result['message'] = "This branch code is already exist!"; - } - else{ - $this->db->insert(BRANCH, $arrayDetails); - if($this->db->affected_rows() == '1'){ + } else { + $this->db->select('BranchName'); + $this->db->where('BranchName', $arrayDetails['BranchName']); + if($this->db->get(BRANCH)->first_row()){ + $result['BranchStatus'] = false; + $result['message'] = "This branch name is already exist!"; + } else{ + $this->db->insert(BRANCH, $arrayDetails); + if($this->db->affected_rows() == '1'){ - $result['branchStatus'] = true; - $result['message'] = "Successfully branch details added"; - } + $result['branchStatus'] = true; + $result['message'] = "Successfully branch details added"; + } + + else { + $result['branchStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } - else { - $result['branchStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } } + return $result; diff --git a/Apollo/api/application/models/Employee_model.php b/Apollo/api/application/models/Employee_model.php index b64de812..df93c5ef 100644 --- a/Apollo/api/application/models/Employee_model.php +++ b/Apollo/api/application/models/Employee_model.php @@ -413,8 +413,8 @@ class Employee_model extends CI_Model $this->db->delete(STAFF_BRANCH); foreach($reqBanch['BranchCode'] as $something) { $branchCode = $this->get_branch_code($something); - $sql1 = "INSERT INTO ".STAFF_BRANCH." (StaffID, BranchCode, IsActive, CreatedBy, CreatedOn) - VALUES ('$empFor', '$branchCode', '1','$createby', '$createon')"; + $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 if ($this->db->query($sql1) == '1') { $result['updateEmpbranchStatus'] = true; diff --git a/Apollo/assets/js/controllers/employeeCtrl.js b/Apollo/assets/js/controllers/employeeCtrl.js index d31fa947..08a84412 100644 --- a/Apollo/assets/js/controllers/employeeCtrl.js +++ b/Apollo/assets/js/controllers/employeeCtrl.js @@ -301,7 +301,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$ // swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); } else { // alert($scope.myModel.dateofbirth); - var formate = "yyyy-MM-dd"; + var formate = "dd-MM-yyyy"; // var date = $filter('date')(new Date($scope.myModel.dateofbirth), formate); $scope.myModel.switchsetting = $scope.myModel.switchsetting === true ? 1 : 0; $scope.myModel.dateofbirth = $filter('date')(new Date($scope.myModel.dateofbirth), formate); diff --git a/Apollo/assets/views/branchDetails.html b/Apollo/assets/views/branchDetails.html index 79d85e8a..0bc7d2f4 100644 --- a/Apollo/assets/views/branchDetails.html +++ b/Apollo/assets/views/branchDetails.html @@ -182,7 +182,7 @@ Branch Code required @@ -200,7 +200,7 @@ Branch Name required @@ -215,7 +215,7 @@ - - Alternate Mobile Number - Landline Number - Address -
- - diff --git a/Apollo/assets/views/editBranchDetails.html b/Apollo/assets/views/editBranchDetails.html index 0db53274..b5b1abf8 100644 --- a/Apollo/assets/views/editBranchDetails.html +++ b/Apollo/assets/views/editBranchDetails.html @@ -16,7 +16,7 @@ Branch Code required @@ -34,7 +34,7 @@ Branch Name required @@ -49,7 +49,7 @@ - - Alternate Mobile Number - Landline Number - Address -
- - diff --git a/Apollo/assets/views/editEmployeeBranchDetails.html b/Apollo/assets/views/editEmployeeBranchDetails.html index 4b293936..889e15a8 100644 --- a/Apollo/assets/views/editEmployeeBranchDetails.html +++ b/Apollo/assets/views/editEmployeeBranchDetails.html @@ -367,6 +367,26 @@ Home Branch is Required
--> + + +
- +
diff --git a/Apollo/assets/views/employeeDetails.html b/Apollo/assets/views/employeeDetails.html index 988b77a9..e7d3d5f2 100644 --- a/Apollo/assets/views/employeeDetails.html +++ b/Apollo/assets/views/employeeDetails.html @@ -25,7 +25,7 @@
-

oops! No +

No records found...

@@ -255,7 +255,7 @@
-
Selected date is: {{myModel.dateofbirth}}
+
-
  • + - +
  • ACTIVITY DETAILS
  • - + -->