From e0a43202fc49f347ab6f755b46aae5467fbcca85 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 28 Nov 2017 18:09:58 +0530 Subject: [PATCH 1/9] batchfile --- .../controllers/Batch_Controller.php | 115 +++++++++ Apollo/api/application/models/Batch_model.php | 111 +++++++++ Apollo/assets/js/controllers/batchCtrl.js | 208 ++++++++++++++++ Apollo/assets/views/batch.html | 229 ++++++++++++++++++ 4 files changed, 663 insertions(+) create mode 100644 Apollo/api/application/controllers/Batch_Controller.php create mode 100644 Apollo/api/application/models/Batch_model.php create mode 100644 Apollo/assets/js/controllers/batchCtrl.js create mode 100644 Apollo/assets/views/batch.html diff --git a/Apollo/api/application/controllers/Batch_Controller.php b/Apollo/api/application/controllers/Batch_Controller.php new file mode 100644 index 00000000..09156b66 --- /dev/null +++ b/Apollo/api/application/controllers/Batch_Controller.php @@ -0,0 +1,115 @@ +methods['addBatchDetails_get']['limit'] = 500; // 500 requests per hour per user/key + $this->methods['addBatchDetails_post']['limit'] = 100; // 100 requests per hour per user/key + $this->methods['addBatchDetails_delete']['limit'] = 50; // 50 requests per hour per user/key + $this->methods['getBatchDetails_post']['limit'] = 500; // 50 requests per hour per user/key + $this->methods['updateBatchDetails_post']['limit'] = 500;// 500 requests per hour per user/key + // load the model + $this->load->model('Batch_model', 'batch_model'); + + } + + /* + * This method used to add batch details + * created by srk + * */ + + public function addBatchDetails_post() + { + + $details['BatchCode'] = $this->post('batchcode'); + $details['BatchName'] = $this->post('batcheName'); + $details['UniversityID'] = $this->post('universityName'); + $details['CreatedBy'] = $this->post('createdBy'); + $details['IsActive'] = $this->post('status'); + $batchDetails = $this->batch_model->addBatch($details);// Check if the users data store contains users (in case the database result returns NULL) + if ($batchDetails) + { + $batchDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($batchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'Something went wrong.please try again!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + + } + /* + * get Batch details + * created by srk + * */ + public function getBatchDetails_post() + { + $requestedBy = $this->post('requestedBy'); + $getBatch = $this->batch_model->getBatch($requestedBy); + if ($getBatch) + { + $getBatch['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getBatch, 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 + } + + + } + /* + * update the batch details + * created by srk + * */ + public function updateBatchDetails_post() + { + $details['BatchCode'] = $this->post('batchCode'); + $details['BatchName'] = $this->post('batchName'); + $details['IsActive'] = $this->post('status'); + $details['UpdatedBy'] = $this->post('updatedBy'); + $details['UpdatedOn'] = date("Y-m-d", time()); + $updateDetails = $this->batch_model->updateBatch($details);// Check if the users data store contains users (in case the database result returns NULL) + + if ($updateDetails) + { + $updateDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'Something went wrong.please try again!', + '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/Batch_model.php b/Apollo/api/application/models/Batch_model.php new file mode 100644 index 00000000..e827cad0 --- /dev/null +++ b/Apollo/api/application/models/Batch_model.php @@ -0,0 +1,111 @@ +db->select('BatchCode'); + $this->db->where('BatchCode', $arrayDetails['BatchCode']); + if($this->db->get(T_BATCHMASTER)->first_row()){ + $result['batchStatus'] = false; + $result['message'] = "This batch Code is already exist!"; + } else { + $this->db->insert(T_BATCHMASTER, $arrayDetails); + if ($this->db->affected_rows() == '1') { + + $result['batchStatus'] = true; + $result['message'] = "Successfully Batch details added"; + } else { + $result['batchStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + return $result; + + } + + + /* + * Get batch details + * parama id + * created by srk + * */ + + public function getBatch() + { + $this->db->select('CU.BatchCode,CU.BatchName,CU.IsActive,US.UniversityID,US.UniversityName'); + $this->db->from(T_BATCHMASTER.' as CU'); + $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID'); + $this->db->order_by('CU.CreatedOn','DESC'); + $batchDetails = $this->db->get(); + + if($batchDetails->result()){ + + $result['batchStatus'] = true; + $result['details'] = $batchDetails->result(); + } + else { + $result['batchStatus'] = false; + $result['message'] = "No records found!"; + } + + $result['universityDetails'] = $this->getUniversityDetails(); + + return $result; + + } + + /* + * update batch details + * created by Srk + * */ + public function updateBatch($arrayDetails=null) + { + $this->db->where('BatchCode',$arrayDetails['BatchCode']); + $upateStatus=$this->db->update(T_BATCHMASTER, $arrayDetails); + if($upateStatus){ + + $result['batchStatus'] = true; + $result['message'] = "Successfully Batch details updated"; + } + + else { + $result['batchStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + + } + + + return $result; + + } + /* + * Get university details + * created by Srk + * */ + public function getUniversityDetails()//doubt + { + $this->db->select('UniversityID,UniversityName'); + $this->db->order_by('UniversityID','ASC'); + $this->db->order_by('IsActive','1'); + $universityDetails = $this->db->get(UNIVERSITY); + return $universityDetails->result(); + } + + + +} \ No newline at end of file diff --git a/Apollo/assets/js/controllers/batchCtrl.js b/Apollo/assets/js/controllers/batchCtrl.js new file mode 100644 index 00000000..3dc68394 --- /dev/null +++ b/Apollo/assets/js/controllers/batchCtrl.js @@ -0,0 +1,208 @@ +'use strict'; +/** + * controllers for ng-table + * Simple table with sorting and filtering on AngularJS + */ + +app.controller('batchCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { + $scope.myModel = { + "batchCode": "", + "batchName": "", + "universityName":"", + "switchsetting": true + }; + + + /* + * edit batch details + * created by subaram + * */ + $scope.editId = -1; + $scope.setEditId = function (pid) { + + $scope.editId = pid; + $scope.viewId = -1; + }; + + /* + * cancel edit div + * created by subaram + * */ + $scope.cancel = function () { + $scope.init(); + $scope.editId = -1; + + }; + + // sorting function for table params + $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 + } + + /* + * Submit,update and reset batch details + * @params myModel + * created by subaram + * */ + $scope.batchForm = { + + submit: function (form, myModel,loading) { + var firstError = null; + if (form.$invalid) { + var field = null, firstError = null; + for (field in form) { + if (field[0] != '$') { + if (firstError === null && !form[field].$valid) { + firstError = form[field].$name; + } + if (form[field].$pristine) { + form[field].$dirty = true; + } + } + } + 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 { + + $scope.ldloading1 = {}; + + $scope.ldloading1[loading.replace('-', '_')] = true; + + + var addBatch = { + method: 'POST', + url: apiPoint.url + 'addBatchDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + batchcode: myModel.batchCode, + batcheName: myModel.batchName, + universityName: myModel.universityName, + status: myModel.switchsetting, + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(addBatch).then(function (response) { + if (response.data.status==200 && response.data.batchStatus) { + $scope.ldloading1[loading.replace('-', '_')] = false; + 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.myModel = angular.copy($scope.master); + form.$setPristine(true); + } + }; + /* + * update the batch details + * created by subaram + * */ + $scope.updateBatch = function (myModel, form, loading) { + + var firstError = null; + if (form.$invalid) { + var field = null, firstError = null; + for (field in form) { + if (field[0] != '$') { + if (firstError === null && !form[field].$valid) { + firstError = form[field].$stop_name; + } + + if (form[field].$pristine) { + form[field].$dirty = true; + } + } + } + angular.element('.ng-invalid[name=' + firstError + ']').focus(); + } else { + $scope.ldloading = {}; + + $scope.ldloading[loading.replace('-', '_')] = true; + + + var update = { + method: 'POST', + url: apiPoint.url + 'updateBatchDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + batchCode: myModel.BatchCode, + batchName: myModel.BatchName, + status: myModel.IsActive, + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(update).then(function (response) { + if (response.data.status==200 && response.data.batchStatus) { + $scope.ldloading[loading.replace('-', '_')] = false; + $scope.editId = -1; + $scope.init(); + swal("Success!", response.data.message, "success"); + + + } else { + $scope.ldloading[loading.replace('-', '_')] = false; + swal("Failed!", response.data.message, "error"); + } + }); + } + }; + /* + *get Batch details when page loading called from view file + * + * created by Srk + * */ + $scope.loader=''; + + $scope.emptyData=''; + + $rootScope.init = function () { + + var getBranch = { + method: 'POST', + url: apiPoint.url + 'getBatchDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + + $http(getBranch).then(function (response) { + if (response.data.status==200 && response.data.batchStatus) { + + $scope.emptyData=true; + $scope.loader=true; + + $scope.data = response.data.details; + + $scope.university=response.data.universityDetails; + + + + } else { + $scope.emptyData=false; + $scope.loader=false; + $scope.university=response.data.universityDetails; + + } + }); + }; + + + + +}]); diff --git a/Apollo/assets/views/batch.html b/Apollo/assets/views/batch.html new file mode 100644 index 00000000..1cc22c06 --- /dev/null +++ b/Apollo/assets/views/batch.html @@ -0,0 +1,229 @@ + + +
+
+
+

+ +
+
+
+
+ + +
+
+ + +
+
+
+ +
Please Wait...
+
+
+ +
+

oops! No + records found...

+
+
+
+ +
+ +

+
+ + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Batch Code + + Batch Name + + University Name + + Action
{{p.BatchCode}}{{p.BatchName}}{{p.UniversityName}} + + + + +
+ + +
+
+ +
+
+
+ + +
+ + + +
+
+
+ +
+
+ + Add New Batch Details + + +
+
+ + + + Batch code is required + Invalid course id + +
+ + +
+ + + + Batch name is required + Invalid batch name + + +
+ +
+ + + University is required + +
+
+ +
+
+ + +
+
+ + +
+ + +
+ + +
+
+ +
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + From 95c1c4fb162cc6046a4047cfa1bf41c262dc3696 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 28 Nov 2017 19:55:48 +0530 Subject: [PATCH 2/9] changes in course --- Apollo/assets/views/editCourseDetails.html | 150 +++++++++++++++++++-- 1 file changed, 137 insertions(+), 13 deletions(-) diff --git a/Apollo/assets/views/editCourseDetails.html b/Apollo/assets/views/editCourseDetails.html index 1ca7643d..4121cd6a 100644 --- a/Apollo/assets/views/editCourseDetails.html +++ b/Apollo/assets/views/editCourseDetails.html @@ -57,23 +57,147 @@ ng-if="Form.university.$dirty && Form.university.$invalid">University is required - -
+
-
- - - -
-
- - -
- + + Fees is required +
+ + +
+
+
+ +
+
+ + + + Enter a valid name +
+
+ + Enter a valid amount + +
+ +
+ + +
+
+
+
+
+
+ + + + Enter a valid amount + +
+ + + +
+ + + + Enter a valid amount + +
+
+
+ +
+ + + + Enter a valid amount + +
+
+ + + + Enter a valid amount + +
+
+ +
+
+ + + + Enter a valid amount + +
+
+ +
+ + + +
+
+ + +
+ +
+ + +
+
From 9407d9f5646cfe199c921669ed2939d5c9c050fe Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 28 Nov 2017 19:57:22 +0530 Subject: [PATCH 3/9] changes in course --- Apollo/assets/views/courseDetails.html | 227 +++++++++++++++++++++++-- 1 file changed, 209 insertions(+), 18 deletions(-) diff --git a/Apollo/assets/views/courseDetails.html b/Apollo/assets/views/courseDetails.html index 95fb91b8..37a2382d 100644 --- a/Apollo/assets/views/courseDetails.html +++ b/Apollo/assets/views/courseDetails.html @@ -82,7 +82,7 @@ {{p.UniversityName}} - + @@ -93,8 +93,8 @@ - - + @@ -124,7 +124,7 @@
-
+
@@ -134,6 +134,21 @@
+
+ + + University is required + +
Course id is required @@ -158,7 +173,7 @@ Course name is required @@ -167,23 +182,194 @@
-
+ ng-class="{'has-error':Form.fees.$dirty && Form.fees.$invalid, 'has-success':Form.fees.$valid}"> - University is required - + ng-if="Form.fees.$dirty && Form.fees.$invalid">Fees is required +
-
+ +
+
+
+
+
+ + + Program is required + +
+ + + + + + +
+ + + + Sem/Year is required + Invalid Sem/Year name +
+ +
+ + + + Fees amount is required + Enter a valid amount + +
+
+
+
+
+ + +
+
+
+ +
+
+ + + + Enter a valid name +
+
+ + + + Enter a valid amount + +
+ +
+ +
+
+ +
+
+
+
+ + + + Enter a valid amount + +
+ + + +
+ + + + Enter a valid amount + +
+
+
+ +
+ + + + Enter a valid amount + +
+
+ + + + Enter a valid amount + +
+
+ +
+
+ + + + Enter a valid amount + +
+
@@ -205,19 +391,24 @@
+ +
+
+ +
- - From 66a6f96b9f72a63e72593d0f3e66ecec4f723c79 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 28 Nov 2017 19:57:38 +0530 Subject: [PATCH 4/9] changes in course --- .../api/application/models/Course_model.php | 138 ++++++++++++++++-- 1 file changed, 128 insertions(+), 10 deletions(-) diff --git a/Apollo/api/application/models/Course_model.php b/Apollo/api/application/models/Course_model.php index 1379ccb4..569a8e45 100644 --- a/Apollo/api/application/models/Course_model.php +++ b/Apollo/api/application/models/Course_model.php @@ -15,7 +15,7 @@ class Course_model extends CI_Model { * created by kms * */ - public function addCourse($arrayDetails=null) + public function addCourse($arrayDetails=null,$jsonData=null) { $this->db->select('CourseID'); @@ -26,9 +26,30 @@ class Course_model extends CI_Model { } else { $this->db->insert(COURSE, $arrayDetails); if ($this->db->affected_rows() == '1') { + if($jsonData){ + foreach($jsonData as $row){ + + $insertFeesArray['CourseID'] =$arrayDetails['CourseID']; + $insertFeesArray['ProgramType'] =$row['program']; + $insertFeesArray['FeesType'] =$arrayDetails['FeesType']; + $insertFeesArray['FeesAmount'] =$row['FeesAmount']; + $insertFeesArray['Sem_Year'] =$row['FeesName']; + $insertFeesArray['UpdatedOn'] =$arrayDetails['CreatedOn']; + $insertFeesArray['UpdatedBy'] =$arrayDetails['CreatedBy']; + $this->db->insert(COURSE_FEES, $insertFeesArray); + } + + $result['courseStatus'] = true; + $result['message'] = "Successfully course details added"; + } + else{ + $this -> db -> where('CourseID', $arrayDetails['CourseID']); + $this -> db -> delete('COURSE'); + $result['courseStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + - $result['courseStatus'] = true; - $result['message'] = "Successfully course details added"; } else { $result['courseStatus'] = false; $result['message'] = "Something went wrong.please try again"; @@ -47,7 +68,7 @@ class Course_model extends CI_Model { public function getCourse() { - $this->db->select('CU.CourseID,CU.CourseName,CU.IsActive,US.UniversityID,US.UniversityName'); + $this->db->select('CU.CourseID,CU.CourseName,CU.FeesType,CU.PC,CU.DC,CU.TC,CU.MC,CU.OtherFees,CU.IsActive,US.UniversityID,US.UniversityName'); $this->db->from(COURSE.' as CU'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID'); $this->db->order_by('CourseID','DESC'); @@ -56,7 +77,23 @@ class Course_model extends CI_Model { if($courseDetails->result()){ $result['courseStatus'] = true; - $result['details'] = $courseDetails->result(); + + foreach ($courseDetails->result() as $row){ + $fetchData['CourseID']=$row->CourseID; + $fetchData['CourseName']=$row->CourseName; + $fetchData['FeesType']=$row->FeesType; + $fetchData['PC']=$row->PC; + $fetchData['DC']=$row->DC; + $fetchData['TC']=$row->TC; + $fetchData['MC']=$row->MC; + $fetchData['OtherFees']=$row->OtherFees; + $fetchData['IsActive']=$row->IsActive; + $fetchData['UniversityID']=$row->UniversityID; + $fetchData['UniversityName']=$row->UniversityName; + $fetchData['feesStructures'] = $this->getCourseFeesDetails($row->CourseID); + $storeCourseArray[]=$fetchData; + } + $result['details'] = $storeCourseArray; } else { $result['courseStatus'] = false; @@ -64,6 +101,7 @@ class Course_model extends CI_Model { } $result['universityDetails'] = $this->getUniversityDetails(); + $result['feesDetails'] = $this->getFeesDetails(); return $result; @@ -73,14 +111,29 @@ class Course_model extends CI_Model { * update course details * created by kms * */ - public function updateCourse($arrayDetails=null) + public function updateCourse($arrayDetails=null,$jsonData=null) { $this->db->where('CourseID',$arrayDetails['CourseID']); $upateStatus=$this->db->update(COURSE, $arrayDetails); - if($upateStatus){ + if($upateStatus) { - $result['courseStatus'] = true; - $result['message'] = "Successfully course details updated"; + if ($jsonData) { + foreach ($jsonData as $row) { + $updateFeesArray['ID'] = $row['ID']; + $updateFeesArray['CourseID'] = $arrayDetails['CourseID']; + // $insertFeesArray['ProgramType'] =$row['program']; + //$insertFeesArray['FeesType'] =$arrayDetails['FeesType']; + $updateFeesArray['FeesAmount'] = $row['FeesAmount']; + $updateFeesArray['Sem_Year'] = $row['Sem_Year']; + $updateFeesArray['UpdatedOn'] = $arrayDetails['UpdatedOn']; + $updateFeesArray['UpdatedBy'] = $arrayDetails['UpdatedBy']; + $this->db->where('ID', $updateFeesArray['ID']); + $this->db->update(COURSE_FEES, $updateFeesArray); + } + + $result['courseStatus'] = true; + $result['message'] = "Successfully course details updated"; + } } else { @@ -101,10 +154,75 @@ class Course_model extends CI_Model { { $this->db->select('UniversityID,UniversityName'); $this->db->order_by('UniversityID','ASC'); - $this->db->order_by('IsActive','1'); + $this->db->where('IsActive','1'); $universityDetails = $this->db->get(UNIVERSITY); return $universityDetails->result(); } + /* + * get fees details + * created by kms + * */ + public function getFeesDetails() + { + $this->db->select('ListCode,ListName'); + $this->db->order_by('ListCode','ASC'); + $this->db->where('IsActive','1'); + $this->db->where('ListGroup','3'); + $feesDetails = $this->db->get(PICK_LIST_DETAILS); + if($feesDetails){ + $result_fees = array(); + foreach ($feesDetails->result() as $row) + { + $list_array['ListCode'] = $row->ListCode; + $list_array['ListName'] = $row->ListName; + if($row->ListCode=='F001'){ + $list_array['programType']=$this->getFeesProgram('4'); + + } + else if($row->ListCode=='F002'){ + $list_array['programType']=$this->getFeesProgram('5'); + } + else{ + $list_array['programType']=""; + } + $result_fees[]=$list_array; + } + + } + else{ + $result_fees[]=""; + } + return $result_fees; + } + /* + * get fees type + * created by kms + * */ + public function getFeesProgram($programType=null) + { + $this->db->select('ListCode,ListName'); + $this->db->order_by('ListCode','ASC'); + $this->db->where('IsActive','1'); + $this->db->where('ListGroup',$programType); + $feesDetails = $this->db->get(PICK_LIST_DETAILS); + return $feesDetails->result(); + } + + /* + * get course fees details + * created by kms + * */ + + public function getCourseFeesDetails($courseID=null){ + $this->db->select('ID,CourseID,ProgramType,FeesAmount,Sem_Year,PLD.ListName as programName'); + $this->db->order_by('ID','ASC'); + $this->db->where('CourseID',$courseID); + $this->db->from(COURSE_FEES.' as CF'); + $this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = CF.ProgramType'); + $feesDetails = $this->db->get(); + return $feesDetails->result(); + } + From cc9685f39efd28812a14e1c9741bbc4911058ac8 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 28 Nov 2017 19:57:56 +0530 Subject: [PATCH 5/9] changes in course --- Apollo/assets/js/controllers/courseCtrl.js | 131 ++++++++++++++++++--- 1 file changed, 117 insertions(+), 14 deletions(-) diff --git a/Apollo/assets/js/controllers/courseCtrl.js b/Apollo/assets/js/controllers/courseCtrl.js index ea6c7410..291c8016 100644 --- a/Apollo/assets/js/controllers/courseCtrl.js +++ b/Apollo/assets/js/controllers/courseCtrl.js @@ -9,18 +9,37 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab "courseCode": "", "courseName": "", "universityName":"", - "switchsetting": true + "switchsetting": true, + "ListName": "", + "programListName":"", + "semYear":"", + "feesAmount":"", + "provFess":"", + "transferAmount":"", + "degreeAmount":"", + "migrationAmount":"", + "otherAmount":"" + }; + $rootScope.myModel1 = { + "ListName": "", + "programListName":"" }; + + /* - * edit branch details + * edit course details * created by kms * */ $scope.editId = -1; - $scope.setEditId = function (pid) { - + $rootScope.setEditId = function (pid,p) { + // find index for fees type drop down list + for(var i in $scope.feesDetails) { + if($scope.feesDetails[i].ListCode==p.FeesType){ + $rootScope.myModel1.ListName=$scope.feesDetails[i]; + } + } $scope.editId = pid; - $scope.viewId = -1; }; /* @@ -28,7 +47,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab * created by kms * */ $scope.cancel = function () { - $scope.init(); + $rootScope.init(); $scope.editId = -1; }; @@ -45,7 +64,8 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab * created by kms * */ $scope.courseForm = { - submit: function (form, myModel,loading) { + submit: function (form, myModel,loading,addMoreItems) { + var firstError = null; if (form.$invalid) { var field = null, firstError = null; @@ -62,6 +82,27 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab 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 { + if(myModel.programListName=='P001'){ + $scope.addMoreItems.push({ + program: myModel.programListName, + FeesName: 'Regular', + FeesAmount: myModel.feesAmount + }); + } + else if(myModel.programListName=='P002'){ + $scope.addMoreItems.push({ + program: myModel.programListName, + FeesName: 'Lateral Entry', + FeesAmount: myModel.feesAmount + }); + } + else if(myModel.programListName=='Y001'){ + $scope.addMoreItems.push({ + program: myModel.programListName, + FeesName: myModel.semYear, + FeesAmount: myModel.feesAmount + }); + } $scope.ldloading1 = {}; @@ -76,9 +117,16 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab }, data: { courseID: myModel.courseCode, - courseName: myModel.courseName, + courseName: myModel.courseName, universityName: myModel.universityName, + feesType:myModel.ListName.ListCode, status: myModel.switchsetting, + provFess:myModel.provFess, + transferAmount:myModel.transferAmount, + degreeAmount:myModel.degreeAmount, + migrationAmount:myModel.migrationAmount, + otherAmount:myModel.otherAmount, + feesAmounts:$scope.addMoreItems, createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID } }; @@ -97,7 +145,9 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab } }, reset: function (form) { - + $scope.addMoreItems = []; + $scope.myModel.ListName=$scope.feesDetails[0]; + $scope.myModel.programListName=$scope.myModel.ListName.programType[0].ListCode; $scope.myModel = angular.copy($scope.master); form.$setPristine(true); } @@ -107,7 +157,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab * created by kms * */ $scope.updateCourse = function (myModel, form, loading) { - + console.log(form); var firstError = null; if (form.$invalid) { var field = null, firstError = null; @@ -138,8 +188,14 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab data: { courseCode: myModel.CourseID, courseName: myModel.CourseName, + provFess:myModel.PC, + transferAmount:myModel.TC, + degreeAmount:myModel.DC, + migrationAmount:myModel.MC, + otherAmount:myModel.OtherFees, + feesAmounts:myModel.feesStructures, status: myModel.IsActive, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID } }; $http(update).then(function (response) { @@ -147,7 +203,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab $scope.ldloading[loading.replace('-', '_')] = false; swal("Success!", response.data.message, "success"); $scope.editId = -1; - $scope.init(); + $rootScope.init(); } else { $scope.ldloading[loading.replace('-', '_')] = false; @@ -166,7 +222,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab $scope.emptyData=''; $rootScope.init = function () { - + $scope.loader=''; var getBranch = { method: 'POST', url: apiPoint.url + 'getCourseDetails/', @@ -184,7 +240,9 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab $scope.data = response.data.details; $scope.university=response.data.universityDetails; - + $scope.feesDetails=response.data.feesDetails; + $scope.myModel.ListName=$scope.feesDetails[0]; + $scope.myModel.programListName=$scope.myModel.ListName.programType[0].ListCode; } else { @@ -196,6 +254,51 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab }); }; + /* + * get fees type drop down + * created by kms + * */ + + $scope.getFeesProgram = function () { + $scope.myModel.programListName=$scope.myModel.ListName.programType[0].ListCode; + $scope.addMoreItems = []; + + } + /* + * get add more fees item array + * created by kms + * */ + $scope.addMoreItems = []; + $rootScope.addMoreFeesItems = function (model,form) { + var firstError = null; + if (form.$invalid) { + var field = null, firstError = null; + for (field in form) { + if (field[0] != '$') { + if (firstError === null && !form[field].$valid) { + firstError = form[field].$stop_name; + } + + if (form[field].$pristine) { + form[field].$dirty = true; + } + } + } + angular.element('.ng-invalid[name=' + firstError + ']').focus(); + } else { + + $scope.addMoreItems.push({ + program: model.programListName, + FeesName: model.semYear, + FeesAmount: model.feesAmount + }); + $scope.myModel.semYear=""; + $scope.myModel.feesAmount=""; + + } + } + + From b0bfc317ab854d13b48841d834b9390effed3e07 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 28 Nov 2017 19:58:17 +0530 Subject: [PATCH 6/9] changes in course --- .../controllers/Course_Controller.php | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Apollo/api/application/controllers/Course_Controller.php b/Apollo/api/application/controllers/Course_Controller.php index 070dcb6b..12984233 100644 --- a/Apollo/api/application/controllers/Course_Controller.php +++ b/Apollo/api/application/controllers/Course_Controller.php @@ -31,13 +31,22 @@ class Course_Controller extends REST_Controller { public function addCourseDetails_post() { - + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['CourseID'] = $this->post('courseID'); $details['CourseName'] = $this->post('courseName'); $details['UniversityID'] = $this->post('universityName'); + $details['FeesType'] = $this->post('feesType'); + $details['PC'] = $this->post('provFess'); + $details['DC'] = $this->post('degreeAmount'); + $details['TC'] = $this->post('transferAmount'); + $details['MC'] = $this->post('migrationAmount'); + $details['OtherFees'] = $this->post('otherAmount'); $details['CreatedBy'] = $this->post('createdBy'); + $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $details['IsActive'] = $this->post('status'); - $courseDetails = $this->course_model->addCourse($details);// Check if the users data store contains users (in case the database result returns NULL) + $jsonFeesData=$this->post('feesAmounts'); + $courseDetails = $this->course_model->addCourse($details,$jsonFeesData);// Check if the users data store contains users (in case the database result returns NULL) if ($courseDetails) { $courseDetails['status'] = REST_Controller::HTTP_OK; @@ -87,12 +96,20 @@ class Course_Controller extends REST_Controller { * */ public function updateCourseDetails_post() { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['CourseID'] = $this->post('courseCode'); $details['CourseName'] = $this->post('courseName'); $details['IsActive'] = $this->post('status'); + $details['PC'] = $this->post('provFess'); + $details['DC'] = $this->post('degreeAmount'); + $details['TC'] = $this->post('transferAmount'); + $details['MC'] = $this->post('migrationAmount'); + $details['OtherFees'] = $this->post('otherAmount'); $details['UpdatedBy'] = $this->post('updatedBy'); - $details['UpdatedOn'] = date("Y-m-d", time()); - $updateDetails = $this->course_model->updateCourse($details);// Check if the users data store contains users (in case the database result returns NULL) + $details['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + $jsonFeesData=$this->post('feesAmounts'); + $updateDetails = $this->course_model->updateCourse($details,$jsonFeesData);// Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails) { $updateDetails['status'] = REST_Controller::HTTP_OK; From 0453211eddb2fc8495c7b700d2b579edd20005fa Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 28 Nov 2017 20:21:13 +0530 Subject: [PATCH 7/9] changes in batch --- Apollo/assets/js/config.router.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index 4ee2c809..6cf50f12 100644 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -107,8 +107,9 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com } }).state('app.master.batch', { url: '/batch', - templateUrl: "assets/views/ui_links.html", + templateUrl: "assets/views/batch.html", title: 'Batch', + resolve: loadSequence('spin', 'ladda', 'angular-ladda', 'batchCtrl','ngTable'), ncyBreadcrumb: { label: 'Batch' } From 192acd248edc3e3aa461b3ba19db62366d5b78d6 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 28 Nov 2017 20:21:40 +0530 Subject: [PATCH 8/9] changes in course --- Apollo/assets/js/config.constant.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js index 4a44c560..ce06c3a3 100644 --- a/Apollo/assets/js/config.constant.js +++ b/Apollo/assets/js/config.constant.js @@ -95,6 +95,10 @@ app.constant('JS_REQUIRES', { Student * */ 'studentCtrl': 'assets/js/controllers/studentCtrl.js', + /* + * batch + * */ + 'batchCtrl': 'assets/js/controllers/batchCtrl.js', /* From 3d8dc3322ab59472afd6d15a1cb66bce4708dd9a Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 28 Nov 2017 20:21:55 +0530 Subject: [PATCH 9/9] changes in course --- Apollo/assets/views/partials/nav.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Apollo/assets/views/partials/nav.html b/Apollo/assets/views/partials/nav.html index bba8f1e9..b8e5543d 100644 --- a/Apollo/assets/views/partials/nav.html +++ b/Apollo/assets/views/partials/nav.html @@ -43,6 +43,12 @@ ACTIVITY DETAILS + +
  • + + BATCH DETAILS + +
  • BRANCH DETAILS