From 3a96c6b3a731a4620a34d65e226b4b5da1ceaa6a Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 6 Feb 2018 15:40:53 +0530 Subject: [PATCH] subject and center master --- Apollo/api/application/config/constants.php | 2 + Apollo/api/application/config/routes.php | 13 + .../controllers/Center_Controller.php | 133 ++++ .../controllers/Subject_Controller.php | 182 ++++++ .../api/application/models/Center_model.php | 97 +++ .../api/application/models/Subject_model.php | 227 +++++++ Apollo/assets/i18n/en.json | 4 +- Apollo/assets/js/config.constant.js | 4 + Apollo/assets/js/config.router.js | 21 +- Apollo/assets/js/controllers/centerCtrl.js | 223 +++++++ Apollo/assets/js/controllers/subjectCtrl.js | 586 ++++++++++++++++++ Apollo/assets/views/centerMaster.html | 235 +++++++ Apollo/assets/views/editCenterDetails.html | 102 +++ Apollo/assets/views/editSubjectDetails.html | 277 +++++++++ Apollo/assets/views/partials/nav.html | 10 + Apollo/assets/views/subjectMaster.html | 387 ++++++++++++ 16 files changed, 2501 insertions(+), 2 deletions(-) create mode 100644 Apollo/api/application/controllers/Center_Controller.php create mode 100644 Apollo/api/application/controllers/Subject_Controller.php create mode 100644 Apollo/api/application/models/Center_model.php create mode 100644 Apollo/api/application/models/Subject_model.php create mode 100644 Apollo/assets/js/controllers/centerCtrl.js create mode 100644 Apollo/assets/js/controllers/subjectCtrl.js create mode 100644 Apollo/assets/views/centerMaster.html create mode 100644 Apollo/assets/views/editCenterDetails.html create mode 100644 Apollo/assets/views/editSubjectDetails.html create mode 100644 Apollo/assets/views/subjectMaster.html diff --git a/Apollo/api/application/config/constants.php b/Apollo/api/application/config/constants.php index 06e68d0a..9c545f67 100755 --- a/Apollo/api/application/config/constants.php +++ b/Apollo/api/application/config/constants.php @@ -128,6 +128,8 @@ defined('CERTIFICATION_MASTER') OR define('CERTIFICATION_MASTER','T_Certificatio defined('DAYBOOKMASTER') OR define('DAYBOOKMASTER','T_DayBookMaster'); defined('INCOMEOUTCOMEMASTER') OR define('INCOMEOUTCOMEMASTER','T_Income_Outcome_Master'); defined('FEES_INSTALLMENT') OR define('FEES_INSTALLMENT','T_Fees_Installments'); +defined('CENTER') OR define('CENTER','T_CenterMaster'); + diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index fdcfb814..76939111 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -217,5 +217,18 @@ $route['getCronCall'] = 'Broadcast_Controller/getCronCall'; $route['getSMSSendReportList'] = 'Broadcast_Controller/getSMSSendReportList'; $route['getSMSGroupDetails'] = 'Broadcast_Controller/getSMSGroupDetails'; +//center + +$route['addCenterDetails'] = 'Center_Controller/addCenterDetails'; +$route['updateCenterDetails'] = 'Center_Controller/updateCenterDetails'; +$route['getCenterDetails'] = 'Center_Controller/getCenterDetails'; + +//subject +$route['getSubjectDetails'] = 'Subject_Controller/getSubjectDetails'; +$route['updateSubjectDetails'] = 'Subject_Controller/updateSubjectDetails'; +$route['getUniversity'] = 'Subject_Controller/getUniversity'; +$route['getCourseBatch'] = 'Subject_Controller/getCorsBatch'; +$route['addSubjectDetails'] = 'Subject_Controller/addSubjectDetails'; + diff --git a/Apollo/api/application/controllers/Center_Controller.php b/Apollo/api/application/controllers/Center_Controller.php new file mode 100644 index 00000000..b1c30181 --- /dev/null +++ b/Apollo/api/application/controllers/Center_Controller.php @@ -0,0 +1,133 @@ +methods['addCenterDetails_get']['limit'] = 500; // 500 requests per hour per user/key + $this->methods['addCenterDetails_post']['limit'] = 100; // 100 requests per hour per user/key + $this->methods['addCenterDetails_delete']['limit'] = 50; // 50 requests per hour per user/key + $this->methods['getCenterDetails_post']['limit'] = 500; // 50 requests per hour per user/key + $this->methods['updateCenterDetails_post']['limit'] = 500;// 500 requests per hour per user/key + + // load the model + $this->load->model('Center_model', 'center_model'); + + } + + /* + * Add Center details + * created by srk + * */ + + public function addCenterDetails_post() + { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['CenterCode'] = $this->post('CenterCode'); + $details['CenterName'] = $this->post('CenterName'); + $details['CenterAddress'] = $this->post('Address'); + $details['Comments'] = $this->post('Comments'); + $details['CreatedBy'] = $this->post('createdBy'); + $details['IsActive'] = $this->post('status'); + $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); + + $centerDetails = $this->center_model->addCenter($details);// Check if the users data store contains users (in case the database result returns NULL) + if ($centerDetails) + { + $centerDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($centerDetails, 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 getCenterDetails_post() + { + $requestedBy = $this->post('requestedBy'); + $getCenter = $this->center_model->getCenter($requestedBy); + // print_r($getCenter); + // die; + if ($getCenter) + { + $getCenter['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getCenter, 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 Center details + * created by srk + */ + public function updateCenterDetails_post() + { + + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $details['CenterCode'] = $this->post('CenterCode'); + $details['CenterName'] = $this->post('CenterName'); + $details['CenterAddress'] = $this->post('Address'); + $details['Comments'] = $this->post('Comments'); + $details['IsActive'] = $this->post('status'); + $details['UpdateBy'] = $this->post('updateBy'); + $details['UpdateOn'] = $now->format("Y-m-d H:i:s"); + + + $updateDetails = $this->center_model->updateCenter($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 + } + + + } + + + + + + +} diff --git a/Apollo/api/application/controllers/Subject_Controller.php b/Apollo/api/application/controllers/Subject_Controller.php new file mode 100644 index 00000000..7c48ea35 --- /dev/null +++ b/Apollo/api/application/controllers/Subject_Controller.php @@ -0,0 +1,182 @@ +methods['addSubjectDetails_get']['limit'] = 500; // 500 requests per hour per user/key + $this->methods['addSubjectDetails_post']['limit'] = 100; // 100 requests per hour per user/key + $this->methods['addSubjectDetails_delete']['limit'] = 50; // 50 requests per hour per user/key + $this->methods['getSubjectDetails_post']['limit'] = 500; // 50 requests per hour per user/key + $this->methods['updateSubjectDetails_post']['limit'] = 500;// 500 requests per hour per user/key + + // load the model + $this->load->model('Subject_model', 'subject_model'); + + } + + /* + * This method used to add Subject details + * + * */ + + public function addSubjectDetails_post() + { + + $now = new DateTime(); + $save['UniversityName'] = $this->post('university'); + $save['Course'] = $this->post('course'); + + $save['Batch'] = $this->post('batch'); + $save['Comments'] = $this->post('Comment'); + $save['IsActive'] = 1; + + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + + $save['CreatedBy'] = $this->post('createdBy'); + $save['CreatedOn'] = $now->format('Y-m-d H:i:s'); + //$details['IsActive'] = $this->post('status'); + + + $jsonSemFeesData=$this->post('semFeesAmounts'); + + $subjectDetails = $this->subject_model->addSubject($save,$jsonSemFeesData);// Check if the users data store contains users (in case the database result returns NULL) + + if ($subjectDetails) + { + $subjectDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($subjectDetails, 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 Subject details + * + * */ + public function getSubjectDetails_post() + { + $requestedBy = $this->post('requestedBy'); + + $getSubject = $this->subject_model->getSubject($requestedBy); + + + + if ($getSubject) + { + $getSubject['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getSubject, 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 Subject details + * + * */ + public function updateSubjectDetails_post() + { + $now = new DateTime(); + $now->setTimezone(new DateTimezone('Asia/Kolkata')); + $updateID = $this->post('updateID'); + $save['Comments'] = $this->post('Comments'); + $save['IsActive'] = 1; + $save['UpdatedBy'] = $this->post('updatedBy'); + $save['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + //$details['IsActive'] = $this->post('status'); + $jsonSemFeesData=$this->post('semFeesAmounts'); + + + $updateDetails = $this->subject_model->updateSubject($save,$jsonSemFeesData,$updateID);// 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 + } + + + } + //get university dropdown + public function getUniversity_post() { + $reqData = $this->post('data'); + $getUniversityListDetails = $this->subject_model->get_university_list(); + if ($getUniversityListDetails) + { + $getUniversityListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + + + //get course & Batch dropdown + public function getCorsBatch_post() { + $data = $this->post('data'); + $getCourseBatchListDetails = $this->subject_model->get_courseBatch_list($data);// Check if the employee exist + if ($getCourseBatchListDetails) + { + $getCourseBatchListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getCourseBatchListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were 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/Center_model.php b/Apollo/api/application/models/Center_model.php new file mode 100644 index 00000000..884218cf --- /dev/null +++ b/Apollo/api/application/models/Center_model.php @@ -0,0 +1,97 @@ +db->select('CenterCode'); + $this->db->where('CenterCode', $arrayDetails['CenterCode']); + if($this->db->get(CENTER)->first_row()){ + $result['centerStatus'] = false; + $result['message'] = "This center Code is already exist!"; + } else { + $this->db->insert(CENTER, $arrayDetails); + if ($this->db->affected_rows() == '1') { + + $result['centerStatus'] = true; + $result['message'] = "Successfully center details added"; + } else { + $result['centerStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + } + return $result; + + } + + + /* + * Get batch details + * created by srk + */ + + + + public function getCenter() + { + $this->db->select('*'); + $this->db->order_by('CreatedOn','DESC'); + $centerDetails = $this->db->get(CENTER); + // print_r($centerDetails); + // die; + + if($centerDetails->result()){ + + $result['centerStatus'] = true; + $result['details'] = $centerDetails->result(); + } + else { + $result['centerStatus'] = false; + $result['message'] = "No records found!"; + } + + return $result; + + } + + /* + * update batch details + * created by Srk + */ + public function updateCenter($arrayDetails=null) + { + $this->db->where('CenterCode',$arrayDetails['CenterCode']); + $updateStatus=$this->db->update(CENTER, $arrayDetails); + if($updateStatus){ + + $result['centerStatus'] = true; + $result['message'] = "Successfully Center details updated"; + } + + else { + $result['centerStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + + } + + + return $result; + + } + + +} \ No newline at end of file diff --git a/Apollo/api/application/models/Subject_model.php b/Apollo/api/application/models/Subject_model.php new file mode 100644 index 00000000..27d73a01 --- /dev/null +++ b/Apollo/api/application/models/Subject_model.php @@ -0,0 +1,227 @@ +db->insert('T_SubjectMaster', $save); + $subject_id = $this->db->insert_id(); + if($this->db->affected_rows() == '1'){ + + if($jsonSemFeesData){ + foreach($jsonSemFeesData as $row) + { + + + $insertFeesArray['Subject_ID'] =$subject_id; + $insertFeesArray['Semester'] =$row['Semester']; + $insertFeesArray['SubjectCode'] =$row['SubjectCode']; + $insertFeesArray['SubjectName'] =$row['SubjectName']; + $insertFeesArray['CreatedOn'] =$save['CreatedOn']; + $insertFeesArray['CreatedBy'] =$save['CreatedBy']; + + + $this->db->insert('T_SubjectDetails', $insertFeesArray); + + } + + $result['SubjectStatus'] = true; + $result['message'] = "Successfully Subject details added"; + + + + } else { + $result['SubjectStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + + return $result; + +} + +} +//update subject + +public function updateSubject($save=null,$jsonSemFeesData=null,$updateID=null) +{ + $this->db->where('ID',$updateID); + $upateStatus=$this->db->update('T_SubjectMaster', $save); + + + if($upateStatus) { + + if ($jsonSemFeesData) { + foreach ($jsonSemFeesData as $row) + { + $subID = $row['ID']; + + $updateFeesArray['Subject_ID'] =$updateID; + $updateFeesArray['Semester'] =$row['Semester']; + $updateFeesArray['SubjectCode'] =$row['SubjectCode']; + $updateFeesArray['SubjectName'] =$row['SubjectName']; + $updateFeesArray['UpdatedOn'] = $save['UpdatedOn']; + $updateFeesArray['UpdatedBy'] = $save['UpdatedBy']; + + if($subID!='' OR $subID!=null){ + $this->db->where('ID', $subID); + $this->db->update('T_SubjectDetails', $updateFeesArray); + } + else{ + $this->db->insert('T_SubjectDetails', $updateFeesArray); + } + + } + $result['SubjectStatus'] = true; + $result['message'] = "Successfully subject details updated"; + } + + } + + else { + $result['SubjectStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + + } + + + return $result; + + } + + + + + //get subject details + public function getSubject() + { + $this->db->select('BS.BatchName,CU.ID,CS.CourseName,CU.Comments ,CU.IsActive,US.UniversityName'); + $this->db->from('T_SubjectMaster'.' as CU'); + $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityName'); + $this->db->join(COURSE.' as CS', 'CS.CourseID = CU.Course'); + $this->db->join(BATCH.' as BS', 'BS.BatchCode = CU.Batch'); + + + $this->db->order_by('CU.CreatedOn','DESC'); + $subjectDetails = $this->db->get(); + + if($subjectDetails->result()){ + + $result['SubjectStatus'] = true; + + foreach ($subjectDetails->result() as $row){ + $fetchData['ID']=$row->ID; + $fetchData['CourseName']=$row->CourseName; + $fetchData['BatchName']=$row->BatchName; + + $fetchData['Comments']=$row->Comments; + + $fetchData['IsActive']=$row->IsActive; + + $fetchData['UniversityName']=$row->UniversityName; + $fetchData['feesStructures'] = $this->getSubjectDetails($row->ID); + + $storeSubjectArray[]=$fetchData; + } + $result['details'] = $storeSubjectArray; + } + else { + $result['SubjectStatus'] = false; + $result['message'] = "No records found!"; + } + + + return $result; + } + + + + // public function getUniversityDetails() + // { + // $this->db->select('UniversityID,UniversityName'); + // $this->db->order_by('UniversityID','ASC'); + // $this->db->where('IsActive','1'); + // $universityDetails = $this->db->get(UNIVERSITY); + // return $universityDetails->result(); + // } + + + + public function getSubjectDetails($ID=null) + { + + $this->db->select('ID,Subject_ID,Semester,SubjectCode,SubjectName'); + $this->db->order_by('ID','ASC'); + $this->db->where('Subject_ID',$ID); + $this->db->from('T_SubjectDetails'); + $subjectDetails = $this->db->get(); + return $subjectDetails->result(); + } + + + + + /*** get university list******/ + public function get_university_list() { + $this->db->select('*'); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from(UNIVERSITY); + $this->db->where('IsActive',1); + $univDetails = $this->db->get(); + $universityDetails = $univDetails->result(); + if (count($universityDetails) > 0) { + $results['univList'] = true; + $results['university_details'] = $universityDetails; + } else { + $results['univList'] = false; + $results['message'] = 'No record found'; + } + return $results; + } + + + + + + + /**********get course&Batch for university********/ + + public function get_courseBatch_list($univId) { + $this->db->select('C.CourseID, C.CourseName'); + $this->db->from(COURSE.' as C'); + $this->db->where('UniversityID',$univId); + $this->db->where('IsActive',1); + $courseDetails = $this->db->get(); + if($courseDetails->result()){ + $this->db->select('B.BatchCode, B.BatchName'); + $this->db->from(BATCH.' as B'); + $this->db->where('UniversityID',$univId); + $this->db->where('IsActive',1); + $batchDetails = $this->db->get(); + if( $batchDetails->result()) { + $result['courseStatus'] = true; + $result['course_details'] = $courseDetails->result(); + $result['batch_details'] = $batchDetails->result(); + } else { + $result['courseStatus'] = false; + $result['message'] = "No records found!"; + } + } + else { + $result['courseStatus'] = false; + $result['message'] = "No records found!"; + } + + return $result; + } + + +} \ No newline at end of file diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json index e7646ff2..8dcb611b 100755 --- a/Apollo/assets/i18n/en.json +++ b/Apollo/assets/i18n/en.json @@ -69,7 +69,9 @@ "STATUS": "STATUS", "STUDENTSTATUS": "ACTIVITY STATUS", "CERTIFICATETYPE": "CERTIFICATE TYPE", - "DAYBOOKMASTER":"INCOME/EXPENSE HEADS" + "DAYBOOKMASTER":"INCOME/EXPENSE HEADS", + "CENTERMASTER": "CENTER DETAILS", + "SUBJECTMASTER":"SUBJECT MASTER" }, "student": { "MAIN": "STUDENTS", diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js index 0c199858..9aca019e 100755 --- a/Apollo/assets/js/config.constant.js +++ b/Apollo/assets/js/config.constant.js @@ -161,6 +161,10 @@ app.constant('JS_REQUIRES', { 'sendSMSsuperadminCtrl':'assets/js/controllers/sendSMSsuperadminCtrl.js', 'sendSMSDetailssuperadminCtrl': 'assets/js/controllers/sendSMSDetailssuperadminCtrl.js', 'feesNotification':'assets/js/controllers/feesNotification.js', + //CENTET MASTER + 'centerCtrl':'assets/js/controllers/centerCtrl.js', + //SUBJECT MASTER + 'subjectCtrl':'assets/js/controllers/subjectCtrl.js', //*** Filters diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index b43f7be4..d2b101bc 100755 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -204,7 +204,26 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com ncyBreadcrumb: { label: 'Announcement' }, - }).state('app.student', { + }).state('app.master.centerMaster', { + url: '/center master', + templateUrl: "assets/views/centerMaster.html", + resolve: loadSequence('centerCtrl','ngTable', 'ladda', 'angular-ladda'), + title: 'Center Master', + ncyBreadcrumb: { + label: 'Center Master' + }, + }).state('app.master.subjectMaster', { + url: '/subject master', + templateUrl: "assets/views/subjectMaster.html", + resolve: loadSequence('subjectCtrl','ngTable', 'ladda', 'angular-ladda'), + title: 'Subject Master', + ncyBreadcrumb: { + label: 'Subject Master' + }, + }) + + + .state('app.student', { url: '/student', template: '
STUDENT DETAILS
', title: 'Student', diff --git a/Apollo/assets/js/controllers/centerCtrl.js b/Apollo/assets/js/controllers/centerCtrl.js new file mode 100644 index 00000000..ccafd714 --- /dev/null +++ b/Apollo/assets/js/controllers/centerCtrl.js @@ -0,0 +1,223 @@ +'use strict'; +/** + * controllers for ng-table + * Simple table with sorting and filtering on AngularJS + */ + +app.controller('centerCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { + $scope.myModel = { + "centerCode": "", + "centerName": "", + "Address":"", + "Comment":"", + "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 center details + * @params myModel + * created by subaram + * */ + $scope.centerForm = { + + submit: function (form, myModel,loading) { + var firstError = null; + if (form.$invalid) { //alert("suba") + 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 addCenter = { + method: 'POST', + url: apiPoint.url + 'addCenterDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + CenterCode: myModel.centerCode, + CenterName: myModel.centerName, + Address: myModel.Address, + Comments:myModel.Comment, + status: myModel.switchsetting, + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(addCenter).then(function (response) { + if (response.data.status==200 && response.data.centerStatus) { + $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); + $scope.myModel = { + "centerCode": "", + "centerName": "", + "Address":"", + "Comment":"", + }; + } + }; + + + + + + + /* + * update the center details + * created by subaram + * */ + $scope.updateCenter = 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 + 'updateCenterDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + CenterCode: myModel.CenterCode, + CenterName: myModel.CenterName, + Address: myModel.CenterAddress, + Comments:myModel.Comments, + status: myModel.IsActive, + updateBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(update).then(function (response) { + if (response.data.status==200 && response.data.centerStatus) { + $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 center details when page loading called from view file + * + * created by Srk + * */ + $scope.loader=''; + + $scope.emptyData=''; + + $rootScope.init = function () { + + var getCenter = { + method: 'POST', + url: apiPoint.url + 'getCenterDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + + $http(getCenter).then(function (response) { + if (response.data.status==200 && response.data.centerStatus) { + + $scope.emptyData=true; + $scope.loader=true; + + $scope.data = response.data.details; + + + } else { + $scope.emptyData=false; + $scope.loader=true; + + + } + }); + }; + + + + +}]); diff --git a/Apollo/assets/js/controllers/subjectCtrl.js b/Apollo/assets/js/controllers/subjectCtrl.js new file mode 100644 index 00000000..0b5b16b3 --- /dev/null +++ b/Apollo/assets/js/controllers/subjectCtrl.js @@ -0,0 +1,586 @@ +'use strict'; +/** + * controllers for ng-table + * Simple table with sorting and filtering on AngularJS + */ + +app.controller('subjectCtrl', ["$scope", "$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state",'ipCookie', function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state,ipCookie) { + $scope.myModel = { + + "university": "", + "course": "", + "batch": "", + "comments":"", + "switchsetting": true, + + }; + + + $rootScope.updateMoreItems = []; + $scope.editId = -1; + $rootScope.setEditId = function (pid,p) { + + + $rootScope.updateMoreItems=[]; + // find index for fees type drop down list + + angular.forEach(p.feesStructures, function(value, key){ + $rootScope.updateMoreItems.push({ + "ID":value.ID, + "Semester":value.Semester, + "SubjectCode":value.SubjectCode, + "SubjectName": value. SubjectName, + + + }); + + }); + + $scope.editId = pid; + }; + + + $scope.viewId=-1; + $scope.setEditI = function (pid,p) { + $scope.editId=-1; + $scope.init(); + $scope.viewId=p.ID; + $scope.editId = pid; + } + + + + + /* + * cancel edit div + * + * */ + $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 Subject details + * @params myModel + * + * */ + $scope.subjectFORM = { + submit: function (form, myModel,semYearModel,loading,addMoreItems) { + 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; + $rootScope.addMoreItems.push({ + + + Semester: semYearModel. Semester, + SubjectCode:semYearModel.SubjectCode, + SubjectName:semYearModel.SubjectName + }); + + + var addSubject = { + method: 'POST', + url: apiPoint.url + 'addSubjectDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + university:myModel.university, + course:myModel.course, + batch:myModel.batch, + semFeesAmounts:$rootScope.addMoreItems, + Comment:myModel.Comment, + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + + $http(addSubject).then(function (response) { + if (response.data.status==200 && response.data.SubjectStatus) { + + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Success!", response.data.message, "success"); + $state.go($state.current, {}, {reload: true}); + + } else { + $rootScope.addMoreItems.splice($rootScope.addMoreItems.length-1); + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", response.data.message, "error"); + } + }); + + + } + }, + reset: function (form) { + $rootScope.addMoreItems = []; + + $scope.myModel = angular.copy($scope.master); + form.$setPristine(true); + $scope.myModel = { + + "university": "", + "course": "", + "batch": "", + "comments":"", + "switchsetting": true, + + }; + $scope.myModelSemYear = { + "Semester":"", + "SubjectCode":"", + "SubjectName":"", + }; + + + $rootScope.myModelSemYear1 = { + "Semester":"", + "SubjectCode":"", + "SubjectName":"", + }; + } + }; + + + + $rootScope.addMoreItems = []; + + + $scope.myModelSemYear = { + "Semester":"", + "SubjectCode":"", + "SubjectName":"", + }; + + $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 { + $rootScope.addMoreItems.push({ + + Semester: model.Semester, + SubjectCode:model.SubjectCode, + SubjectName:model.SubjectName + }); + + + $scope.myModelSemYear.Semester=""; + $scope.myModelSemYear.SubjectCode=""; + $scope.myModelSemYear.SubjectName=""; + + + } + } + + + // //alert('Duplicate Semester: ' + checkDuplicateInObject('Semester', $rootScope.addMoreItems)); + // alert('Duplicate SubjectCode: ' + checkDuplicateInObject('SubjectCode', $rootScope.addMoreItems)); + // //alert('DuplicateSubjectName: ' + checkDuplicateInObject('SubjectName', $rootScope.addMoreItems)); + + + // // + + + // if(checkDuplicateInObject('SubjectCode', $rootScope.addMoreItems) === false) { + // $scope.myModelSemYear.SubjectCode=""; + + // }else{ + // $rootScope.addMoreItems.push({ + + // Semester: model.Semester, + // SubjectCode:model.SubjectCode, + // SubjectName:model.SubjectName + // }); + + // } + + // $scope.myModelSemYear.SubjectCode=""; + // $scope.myModelSemYear.Semester=""; + // $scope.myModelSemYear.SubjectName=""; + + // function checkDuplicateInObject(propertyName, inputArray) { + // var seenDuplicate = true, + // testObject = {}; + + // inputArray.map(function(item) { + // var itemPropertyName = item[propertyName]; + // if (itemPropertyName in testObject) { + // testObject[itemPropertyName].duplicate = true; + // item.duplicate = true; + // seenDuplicate = false; + // } + // else { + // testObject[itemPropertyName] = item; + // delete item.duplicate; + // } + // }); + + // return seenDuplicate; + // } + + + // function checkDuplicateInObject(propertyName, inputArray) { + // // alert(JSON.stringify(inputArray)); + // var seenDuplicate = false; + // $rootScope.testObject = {}; + + // // alert(propertyName); + // // if(inputArray.length === 0) { + // // return $rootScope.seenDuplicate = true; + + // // } else{ + // inputArray.map(function(item) { + // alert(JSON.stringify(item)); + // $rootScope.itemPropertyName = item[propertyName]; + // if ($rootScope.itemPropertyName in $rootScope.testObject) { + // $rootScope.testObject[$rootScope.itemPropertyName].duplicate = true; + // item.duplicate = true; + // seenDuplicate = true; + // alert('kd'); + // } + // else { + // $rootScope.testObject[$rootScope.itemPropertyName] = item; + // delete item.duplicate; + // } + // // alert(JSON.stringify($rootScope.testObject)); + // }); + // // } + + + // return seenDuplicate; + // } + + + + + + + ///***updateupdateMoreItems */ + $rootScope.updateMoreItems = []; + + $rootScope.myModelSemYear1 = { + "Semester":"", + "SubjectCode":"", + "SubjectName":"", + }; + $rootScope.updateMoreFeesItems = 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 { + + $rootScope.updateMoreItems.push({ + + ID:"", + Semester: model.Semester, + SubjectCode:model.SubjectCode, + SubjectName:model.SubjectName + + }); + + + } + $scope.myModelSemYear1.ID=""; + $scope.myModelSemYear1.Semester=""; + $scope.myModelSemYear1.SubjectCode=""; + $scope.myModelSemYear1.SubjectName=""; + } + + ////*****update subject details */ + $scope.updateSubject = function (myModel, form,semYear, 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 { + if(semYear. Semester!="" || semYear.SubjectCode!=""|| semYear. SubjectName!=""){ + $rootScope.updateMoreItems.push({ + ID:"", + Semester:semYear. Semester, + SubjectCode:semYear.SubjectCode, + SubjectName: semYear. SubjectName, + + + }); + } + + $scope.ldloading = {}; + + $scope.ldloading[loading.replace('-', '_')] = true; + + + var update = { + method: 'POST', + url: apiPoint.url + 'updateSubjectDetails/', + headers: { + 'Content-Type': 'application/json' + }, + + data: { + + semFeesAmounts:$rootScope.updateMoreItems, + Comments:myModel.Comments, + updateID: myModel.ID, + updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(update).then(function (response) { + if (response.data.status==200 && response.data.SubjectStatus) { + $scope.ldloading[loading.replace('-', '_')] = false; + $rootScope.updateMoreItems=[]; + $rootScope.myModelSemYear1.ID=""; + $rootScope.myModelSemYear1.Semester=""; + $rootScope.myModelSemYear1.SubjectCode=""; + $rootScope.myModelSemYear1.SubjectName=""; + + + + $scope.init(); + $rootScope.updateMoreItems.splice( $rootScope.updateMoreItems.length-1); + swal("Success!", response.data.message, "success"); + + $scope.editId = -1; + + + } else { + $scope.ldloading[loading.replace('-', '_')] = false; + $scope.init(); + swal("Failed!", response.data.message, "error"); + $rootScope.updateMoreItems.splice( $rootScope.updateMoreItems.length-1); + // $rootScope.addMoreItems.splice($rootScope.addMoreItems.length-1); + } + }); + } + }; + + + + + + + +/////**********/// */ + var localDetail = JSON.parse(localStorage.getItem('localObj')); + var localDetails = ipCookie('cookiechk'); + + $scope.init = function () { + $scope.getUniversityList(); + } + //GET UNIVERSITY dETAILS + + $scope.universityData = ''; + $scope.getUniversityList = function () { + var empListreq = { + method: 'POST', + url: apiPoint.url + 'getUniversity/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: localDetails + } + }; + $http(empListreq).then(function (response) { + if (response.data.univList) { + $scope.universityData = response.data.university_details; + } else { + } + }); + } + + + $scope.getUniversityList(); + + + + +//GET COURSE&BATCH + + $scope.courseLoading = false; + $scope.onSlecetUnivAdd = function () { + $scope.courseDataAdd = ''; + $scope.batchDataAdd = ''; + $scope.myModel.course = ''; + $scope.myModel.batch = ''; + $scope.courseLoading = true; + var univListreq = { + method: 'POST', + url: apiPoint.url + 'getCourseBatch/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: $scope.myModel.university + } + }; + $http(univListreq).then(function (response) { + if (response.data.courseStatus) { + $scope.courseLoading = false; + $scope.courseDataAdd = response.data.course_details; + $scope.batchDataAdd = response.data.batch_details; + } else { + $scope.courseLoading = false; + } + }); + } + + + + $scope.loader=''; + + $rootScope.emptyData=''; + + + $scope.init = function () { + + $scope.loader=''; + + var getsubject = { + method: 'POST', + url: apiPoint.url + 'getSubjectDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + + $http(getsubject).then(function (response) { + if (response.data.status==200 && response.data.SubjectStatus) { + + $scope.emptyData=true; + $scope.loader=true; + + $scope.data = response.data.details; +//alert(JSON.stringify( $scope.data )); + /// +// $scope.setModel = { +// "feesType": $scope.data[0], + + +// }; +// //alert(JSON.stringify( $scope.data[0] )); +// // $scope.setTotalAmount=$scope.data[0].PayableFees; + + +// $rootScope.updateMoreItems=[]; + +// if($scope.data[0].feesStructures != '') +// // alert(JSON.stringify($scope.data[0].feesStructures)) + +// { +// $scope.myModelSemYear1.ID=$scope.data[0].feesStructures[$scope.data[0].feesStructures.length-1].ID; +// //alert(JSON.stringify( $scope.myModelSemYear1.ID )); +// $rootScope.myModelSemYear1.Semester=$scope.data[0].feesStructures[$scope.data[0].feesStructures.length-1].Semester; +// //alert(JSON.stringify( $scope.myModelSemYear1.Semester )); +// $rootScope.myModelSemYear1.SubjectCode=$scope.data[0].feesStructures[$scope.data[0].feesStructures.length-1].SubjectCode; +// //alert(JSON.stringify( $scope.myModelSemYear1.SubjectCode )); +// $rootScope.myModelSemYear1.SubjectName=$scope.data[0].feesStructures[$scope.data[0].feesStructures.length-1].SubjectName; +// //alert(JSON.stringify( $scope.myModelSemYear1.SubjectName )); + +// for(var i=0; i < $scope.data[0].feesStructures.length-1; i++){ +// $rootScope.updateMoreItems.push($scope.data[0].feesStructures[i]); +// } +// } +// // alert(JSON.stringify( $scope.data[0].feesStructures[i] )); + + //////////// + + + + + + } else { + $scope.emptyData=false; + $scope.loader=true; + $scope.data = response.data.details; + + + + + } + + }); + + }; + + + + +}]); diff --git a/Apollo/assets/views/centerMaster.html b/Apollo/assets/views/centerMaster.html new file mode 100644 index 00000000..4d657ebf --- /dev/null +++ b/Apollo/assets/views/centerMaster.html @@ -0,0 +1,235 @@ + + +
+
+
+

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

oops! No + records found...

+
+
+
+ +
+ +

+
+ + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Center Code + + Center Name + + Center Address + + CommentsStatus Action
{{p.CenterCode}}{{p.CenterName}}{{p.CenterAddress}}{{p.Comments}} Active De-Active + + + + +
+ + +
+
+ +
+
+
+ + +
+ + + +
+
+
+ +
+
+ + Add New Center Details + + +
+
+ + + + Center code is required + Invalid Center Code + +
+ + +
+ + + + Center name is required + Invalid Center name + + +
+ + + +
+ + + Address is required +
+ +
+ + + Comments is required +
+
+
+ +
+
+ + +
+
+ + +
+ + +
+ + +
+
+ +
+ +
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/Apollo/assets/views/editCenterDetails.html b/Apollo/assets/views/editCenterDetails.html new file mode 100644 index 00000000..75adc124 --- /dev/null +++ b/Apollo/assets/views/editCenterDetails.html @@ -0,0 +1,102 @@ +
+
+
+
+
+ + Update Center Details + + +
+
+ + + + Center Code is required + Invalid center Code + +
+ + +
+ + + + Center Code is required + Invalid center Code + +
+ +
+ + + Address is required +
+
+ + + Comments is required +
+
+ +
+ +
+ + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + +
+
+
+ +
+
+ + +
+ + + + diff --git a/Apollo/assets/views/editSubjectDetails.html b/Apollo/assets/views/editSubjectDetails.html new file mode 100644 index 00000000..f672d245 --- /dev/null +++ b/Apollo/assets/views/editSubjectDetails.html @@ -0,0 +1,277 @@ +
+
+
+
+
+ + Update Subject Details + + + + + + + + + +
+ + + + University name is required + Invalid University name + + +
+ +
+ + + + Course name is required + Invalid course name + + +
+ +
+ + + + Course id is required + Invalid course id + +
+ +
+ + + Comments is required +
+ + + + + + + + +
+ + +
+
+ Subject Add + +
+ + + +
+ + +
+ + + + Sem/Year is required + Invalid Sem/Year name +
+ + + + + + +
+ + + + SubjectCode is required + Enter a valid SubjectCode + +
+
+ + + + Sem/Year is required + Invalid SubjectName name +
+ + + + +
+
+ + +
+
+
+ + + +
+ + + + Enter a valid name +
+
+ + + + Enter a valid amount + +
+
+ + + + Enter a subject valid name +
+ + +
+
+
+
+ +
+
+ + + +
+ + + +
+
+
+ + + + + +
+
+
+ +
+
+ + +
+ + + + diff --git a/Apollo/assets/views/partials/nav.html b/Apollo/assets/views/partials/nav.html index f0cede1d..76beae2d 100755 --- a/Apollo/assets/views/partials/nav.html +++ b/Apollo/assets/views/partials/nav.html @@ -77,6 +77,16 @@ DAY BOOK DETAILS +
  • + + CENTER DETAILS + +
  • +
  • + + SUBJECT DETAILS + +
  • diff --git a/Apollo/assets/views/subjectMaster.html b/Apollo/assets/views/subjectMaster.html new file mode 100644 index 00000000..6c51cacd --- /dev/null +++ b/Apollo/assets/views/subjectMaster.html @@ -0,0 +1,387 @@ + + +
    +
    +
    +

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

    oops! No + records found...

    +
    +
    +
    + +
    + +

    +
    + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    UniversityName + + Course Name + + Batch + + Status
    {{p.UniversityName}}{{p.CourseName}}{{p.BatchName}} Active De-Active + + + +
    + + +
    +
    + + +
    +
    +
    + + + +
    + + + +
    +
    +
    + +
    + + Subject + +
    +
    + + + + University is Required +
    + + + + +
    + + +
    + fetching... +
    +
    + +
    + Course is required + +
    + +
    + + +
    + fetching... +
    +
    + +
    + Batch is required + +
    +
    +
    +
    + + + Comments is required +
    + +
    + +
    + +
    +
    + Subject Add + +
    + + + +
    + + + + + + +
    + + + + Semester is required + Invalid Semester name +
    + + + + + + +
    + + + + SubjectCode is required + Enter a valid SubjectCode + +
    +
    + + + + Sem/Year is required + Invalid SubjectName name +
    + + + + +
    +
    + + +
    +
    +
    + + + +
    + + + + Enter a valid name +
    +
    + + + + Enter a valid amount + +
    +
    + + + + Enter a subject valid name +
    + + +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + + + +
    +
    +
    +
    + +
    +
    +
    +
    + + + +
    + + + + + + + + \ No newline at end of file