From 0f7f19fa18bc4e092babe33af1038ab75996b48b Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Thu, 12 Apr 2018 13:56:59 +0530 Subject: [PATCH] status controller updation : kdk --- Apollo/api/application/config/routes.php | 2 + .../controllers/Employee_Controller.php | 3 + .../controllers/Status_Controller.php | 40 ++++ .../api/application/models/Status_model.php | 27 ++- Apollo/assets/js/controllers/statusCtrl.js | 198 ++++++++++------- Apollo/assets/views/status.html | 202 +++++++----------- 6 files changed, 267 insertions(+), 205 deletions(-) diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 32068b4b..e9e8487d 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -159,6 +159,8 @@ $route['getLoginAnnouncementDetails'] = 'Login_Controller/getLoginAnnouncementDe $route['addStatusDetails'] = 'Status_Controller/addStatusDetails'; $route['getStatusDetails'] = 'Status_Controller/getStatusDetails'; $route['updateStatusDetails'] = 'Status_Controller/updateStatusDetails'; +$route['getBranchListStatusUpdate'] = 'Status_Controller/getBranchListStatusUpdate'; +$route['getBranchStatusList'] = 'Status_Controller/getBranchStatusList'; /*get student list for fees update*/ $route['getStudentListFees'] = 'Fees_Status_Controller/getStudentList'; /*get student fees structure for fees update*/ diff --git a/Apollo/api/application/controllers/Employee_Controller.php b/Apollo/api/application/controllers/Employee_Controller.php index 8fab0765..8c2c53e9 100755 --- a/Apollo/api/application/controllers/Employee_Controller.php +++ b/Apollo/api/application/controllers/Employee_Controller.php @@ -258,6 +258,9 @@ class Employee_Controller extends REST_Controller { $req['Qualification'] = $temp['qualificaion']; $req['BranchCode'] = $temp['homeBranch']; $req['IsActive'] = $temp['switchsetting']; + + $req['FinanceModuleAccess'] = $temp['finaceModuleAccess']; + $req['DOJ'] = $temp['dateofjoining']; $req['JobResponsibility'] = $temp['jobResponsibility']; // $req['DOJ'] = $data['dateofjoining']; diff --git a/Apollo/api/application/controllers/Status_Controller.php b/Apollo/api/application/controllers/Status_Controller.php index f0943a01..54880a48 100755 --- a/Apollo/api/application/controllers/Status_Controller.php +++ b/Apollo/api/application/controllers/Status_Controller.php @@ -135,6 +135,46 @@ class Status_Controller extends REST_Controller { } + public function getBranchListStatusUpdate_post() { + $requestedBy = $this->post('requestedBy'); + + $getStatusBranchList = $this->status_model->getStatusBranchList($requestedBy); + if ($getStatusBranchList) + { + $getStatusBranchList['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getStatusBranchList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + public function getBranchStatusList_post() { + $requestedBy = $this->post('requestedBy'); + $branchCode = $this->post('branchCode'); + + $getBranchStatusList = $this->status_model->getBranchStatusList($branchCode); + if ($getBranchStatusList) + { + $getBranchStatusList['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getBranchStatusList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } } \ No newline at end of file diff --git a/Apollo/api/application/models/Status_model.php b/Apollo/api/application/models/Status_model.php index 57f8e738..66272ba7 100755 --- a/Apollo/api/application/models/Status_model.php +++ b/Apollo/api/application/models/Status_model.php @@ -78,8 +78,7 @@ class Status_model extends CI_Model { public function update($arrayDetails=null,$ListCode=null) { - $this->db->select('ListName'); - + $this->db->select('ListName'); $this->db->where('ListName', $arrayDetails['ListName']); $this->db->where_not_in('ListCode', $ListCode); if($this->db->get(PICK_LIST_DETAILS)->first_row()){ @@ -96,13 +95,27 @@ class Status_model extends CI_Model { $result['Status'] = false; $result['message'] = "Something went wrong.please try again"; } - } - - - return $result; - } + public function getStatusBranchList( $id ) { + $this->db->select('BranchCode, BranchName'); + $this->db->from(BRANCH); + $getBranchDetails = $this->db->get(); + $branchDetails = $getBranchDetails->result(); + if (count($branchDetails) > 0) { + $results['branchListStatus'] = true; + $results['branch_list_details'] = $branchDetails; + } else { + $results['branchListStatus'] = false; + $results['message'] = "Branch Is Not Avail."; + } + return $results; + } + + public function getBranchStatusList($branchCode) { +echo $branchCode;exit(); + } + } \ No newline at end of file diff --git a/Apollo/assets/js/controllers/statusCtrl.js b/Apollo/assets/js/controllers/statusCtrl.js index 44f23aca..2a264ef0 100755 --- a/Apollo/assets/js/controllers/statusCtrl.js +++ b/Apollo/assets/js/controllers/statusCtrl.js @@ -4,17 +4,21 @@ * Simple table with sorting and filtering on AngularJS */ // var helloApp = angular.module("helloApp", []); -app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$localStorage", "$http", "$state", function ($scope, toaster, $filter, apiPoint, $localStorage, $http, $state) { +app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$localStorage", "$http", "$state", 'ipCookie', function ($scope, toaster, $filter, apiPoint, $localStorage, $http, $state, ipCookie) { $scope.myModel = { - "StatusName": "", + "StatusName": "", "switchsetting": true - }; - /* - * edit status details - * created by Surendiran - * */ + + // get local client details + var localDetail = JSON.parse(localStorage.getItem('localObj')); + var localDetails = ipCookie('cookiechk'); + + /* + * edit status details + * created by Surendiran + * */ $scope.editId = -1; $scope.setEditId = function (pid) { $scope.editId = pid; @@ -27,21 +31,19 @@ app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$lo * */ $scope.cancel = function () { $scope.init(); - $scope.editId = -1; + $scope.editId = -1; }; // sorting function for table params - $scope.sort = function(keyname){ + $scope.sort = function (keyname) { $scope.sortKey = keyname; //set the sortKey to the param passed $scope.reverse = !$scope.reverse; //if true make it false and vice versa } -$scope.statusForm = { - - submit: function (form, myModel,loading) { - + $scope.statusForm = { + submit: function (form, myModel, loading) { var firstError = null; if (form.$invalid) { var field = null, firstError = null; @@ -63,59 +65,55 @@ $scope.statusForm = { $scope.ldloading1[loading.replace('-', '_')] = true; - - var addstatus = { - method: 'POST', - url: apiPoint.url + 'addStatusDetails/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - statusName: myModel.StatusName, - status: myModel.switchsetting, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID - } - }; - - $http(addstatus).then(function (response) { - if (response.data.status == 200 && response.data.Status) { - $scope.ldloading1[loading.replace('-', '_')] = false; - $scope.init(); - swal(" ", "Status added successfully.", "success"); - $state.go($state.current, {}, { reload: true }); - } else { - $scope.ldloading1[loading.replace('-', '_')] = false; - swal("", "Something went wrong, please try again.", "error"); - } - }); - -} + var addstatus = { + method: 'POST', + url: apiPoint.url + 'addStatusDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + statusName: myModel.StatusName, + status: myModel.switchsetting, + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + + $http(addstatus).then(function (response) { + if (response.data.status == 200 && response.data.Status) { + $scope.ldloading1[loading.replace('-', '_')] = false; + $scope.init(); + swal(" ", "Status added successfully.", "success"); + $state.go($state.current, {}, { reload: true }); + } else { + $scope.ldloading1[loading.replace('-', '_')] = false; + swal("", "Something went wrong, please try again.", "error"); + } + }); + + + } }, - reset: function (form) { + reset: function (form) { $scope.myModel = angular.copy($scope.master); form.$setPristine(true); $scope.myModel = { - "StatusName": "", + "StatusName": "", "switchsetting": true }; } -}; - /* - *get status details when page loading called from view file - * - * - * created by Surendiran - * */ - - $scope.loader=''; - - $scope.emptyData=''; - - + }; + /* + *get status details when page loading called from view file + * + * + * created by Surendiran + * */ + $scope.loader = ''; + $scope.emptyData = ''; $scope.init = function () { var getStatus = { @@ -128,28 +126,48 @@ $scope.statusForm = { requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID } }; - - $http(getStatus).then(function (response) { - if (response.data.status==200 && response.data.Status) { - $scope.emptyData=true; - $scope.loader=true; - - $scope.statusInfo = response.data.details; - - } else { - $scope.emptyData=false; - $scope.loader=true; - $scope.statusInfo=''; + $http(getStatus).then(function (response) { + if (response.data.status == 200 && response.data.Status) { + $scope.emptyData = true; + $scope.loader = true; + + $scope.statusInfo = response.data.details; + + } else { + $scope.emptyData = false; + $scope.loader = true; + + $scope.statusInfo = ''; } }); + + var getBranchList = { + method: 'POST', + url: apiPoint.url + 'getBranchListStatusUpdate/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + + $http(getBranchList).then(function (response) { + if (response.data.branchListStatus == true) { + $scope.branchList = response.data.branch_list_details; + } else { + $scope.branchListMessage = response.data.message; + } + }); + }; - /* - * update the status details - * created by Surendiran - * */ + /* + * update the status details + * created by Surendiran + * */ $scope.updatestatus = function (myModel, form, loading) { var firstError = null; @@ -180,28 +198,50 @@ $scope.statusForm = { 'Content-Type': 'application/json' }, data: { - ListCode: myModel.ListCode, - ListName: myModel.ListName, - status: myModel.IsActive, + ListCode: myModel.ListCode, + ListName: myModel.ListName, + status: myModel.IsActive, updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID } }; $http(update).then(function (response) { - if (response.data.status==200 && response.data.Status) { + if (response.data.status == 200 && response.data.Status) { $scope.ldloading[loading.replace('-', '_')] = false; swal("", "Updated Successfully", "success"); $scope.editId = -1; $scope.init(); - } else { $scope.ldloading[loading.replace('-', '_')] = false; swal("", "Something went wrong, please try again", "error"); } }); - } }; - - + $scope.localBranchDetails = ''; + + $scope.selectBranch = function(branchCode) { + // alert(branchCode); + + var getBranchStatusList = { + method: 'POST', + url: apiPoint.url + 'getBranchStatusList/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: localDetail, + branchCode: branchCode + } + }; + + $http(getBranchStatusList).then(function (response) { + if (response.data.branchListStatus == true) { + $scope.branchList = response.data.branch_list_details; + } else { + $scope.branchListMessage = response.data.message; + } + }); + + } }]); \ No newline at end of file diff --git a/Apollo/assets/views/status.html b/Apollo/assets/views/status.html index ae3e9286..4c44a80b 100755 --- a/Apollo/assets/views/status.html +++ b/Apollo/assets/views/status.html @@ -4,149 +4,113 @@ border-radius: 60px; box-shadow: 0px 0px 2px #007AFF; padding: 0.5em 0.6em; - - }

- - Manage various status for the entire application. - + + Manage various status for the entire application. +
-
-
- Add Status Details -
- -
- + + + +
+ Add Status Details
- -
-
- - +
+ +
+
+ +

-
- - -
- -
- -

-
- - -
- - - - - - - - - - - - - - - - - - - - - - -
Status ID - - - Status Name - - - Status
{{p.ListCode}}{{p.ListName}} Active In-Active - + + + + + + + + + + + + + + + + + + + + +
Status ID + + Status Name + + Status
{{p.ListCode}}{{p.ListName}} Active In-Active + +
+ + + + +
{{ branchList }}
+
+
+
+
+ -
- - + +
+ Loading... +
+
+ + + \ No newline at end of file