diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index d43f6524..0dde390c 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -295,6 +295,7 @@ $route['updateSessionScheduleDetails'] = 'SessionSchedule_Controller/updateSessi /// halltickets and Exam Attendance $route['getUniversityCourseDetails'] = 'HallTickets_Controller/getUniversityCourseDetails'; $route['getSemesterSubjectDetails'] = 'HallTickets_Controller/getSemesterSubjectDetails'; +$route['getExistingMapping'] = 'HallTickets_Controller/getExistingMapping'; $route['saveAllSemSubMapping'] = 'HallTickets_Controller/saveAllSemesterSubjectMapping'; $route['getAllSemSubjects'] = 'HallTickets_Controller/getAllSemesterSubjects'; $route['getIndividualCourseSemMappingDetails'] = 'HallTickets_Controller/getIndividualCourseSemMappingDetails'; diff --git a/Apollo/api/application/controllers/HallTickets_Controller.php b/Apollo/api/application/controllers/HallTickets_Controller.php index 099f77ce..ab7de366 100755 --- a/Apollo/api/application/controllers/HallTickets_Controller.php +++ b/Apollo/api/application/controllers/HallTickets_Controller.php @@ -24,6 +24,7 @@ class HallTickets_Controller extends REST_Controller { $this->methods['getCourseSubjectDetails_post']['limit'] = 500; // 500 requests per hour per user/key $this->methods['getUniversityCourseDetails_post']['limit'] = 500; // 500 requests per hour per user/key $this->methods['updateSheduleDetails_post']['limit'] = 500; // 500 requests per hour per user/key + // load the model $this->load->model('Hallticket_model', 'Hallticket_model'); @@ -133,7 +134,7 @@ class HallTickets_Controller extends REST_Controller { * get semester and subjects list for sem course mapping * created by velz * */ - public function getSemesterSubjectDetails_post() + public function getSemesterSubjectDetails_post() { $universityID = $this->post('universityID'); $courseIDS = $this->post('courseID'); @@ -167,6 +168,56 @@ class HallTickets_Controller extends REST_Controller { } } + + /* + * get semester and subjects list for sem course mapping + * created by Bala + * */ + public function getExistingMapping_post() + { + $universityID = $this->post('universityID'); + $courseIDS = $this->post('courseID'); + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + $tempCourseArray = array(); + foreach($courseIDS as $val) + { + foreach($val as $v){ + $tempCourseArray[] = $v; + } + //print_r($value); + } + + $data['subjectDetails'] = $this->Hallticket_model->getExistDetails($universityID,$tempCourseArray,$branchId); + // print_r( $data['subjectDetails']); + // die(); + //$data['semesterDetails'] = $this->Hallticket_model->getSemesterDetails($universityID,$tempCourseArray); + //1000 it means already data exist http sents 1000// + + if($data['subjectDetails'] == 1 ) + { + $this->response([ + 'message' => 'Already Exist', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + + else if($data['subjectDetails']) + { + $data['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($data, REST_Controller::HTTP_OK); + } + else{ + + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + + } + + } public function getBatchAndCenterDetails_post() { diff --git a/Apollo/api/application/models/Hallticket_model.php b/Apollo/api/application/models/Hallticket_model.php index 7248a4ea..9d10fa52 100755 --- a/Apollo/api/application/models/Hallticket_model.php +++ b/Apollo/api/application/models/Hallticket_model.php @@ -180,6 +180,56 @@ class Hallticket_model extends CI_Model $courseDetails = $this->db->get('T_CourseMaster'); return $courseDetails->result(); } + + /* + * check existing data,only batchschedule. + * @params university id and CourseID + * created by Bala + * */ + + public function getExistDetails($universityID,$courseIDS,$branchId) + { + // echo $universityID; + // //foreach() + // print_r ($courseIDS); + // die(); + $i=0; + foreach($courseIDS as $c) + { + + // $tempCourseArray= $c['CourseID']; + + $this->db->select ('count(*) as count'); + $this->db->from('T_Batch_Schedule_Master'); + $this->db->where('UniversityID',$universityID); + $this->db->where('CourseID', $c); + $result = $this->db->get(); + $res = $result->result(); + + if($res[0]->count > 0 ) + { + $i++; + } + } + + if( $i > 0 ) + { + return 1; + } + else + { + $this->db->distinct(); + $this->db->select('SubjectID,SubjectCode,SubjectName'); + $this->db->from('T_SubjectMaster'); + //$this->db->join('T_SubjectMaster','T_CourseSubject_Details.SubjectID=T_SubjectMaster.SubjectID'); + $this->db->where('T_SubjectMaster.IsActive','1'); + // $this->db->where('T_CourseSubject_Details.UniversityID',$universityID); + $this->db->where_in('T_SubjectMaster.BranchCode',$branchId); + $result = $this->db->get(); + //echo $this->db->last_query(); + return $result->result(); + } + } /* * get subject details diff --git a/Apollo/assets/js/controllers/schCtrl.js b/Apollo/assets/js/controllers/schCtrl.js index 555194ad..77ee7714 100755 --- a/Apollo/assets/js/controllers/schCtrl.js +++ b/Apollo/assets/js/controllers/schCtrl.js @@ -178,7 +178,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP $scope.semDropDownShowLoading = true; var getsubject = { method: 'POST', - url: apiPoint.url + 'getSemesterSubjectDetails/', + url: apiPoint.url + 'getExistingMapping/', headers: { 'Content-Type': 'application/json' }, @@ -190,7 +190,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP } }; $http(getsubject).then(function (response) { - + console.log(response); if(response.data.status == 200) { $scope.semDropDownShowLoading = false; @@ -220,7 +220,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP },function(error){ $scope.semDropDownShowLoading = false; - swal('No Subjetcs Found','','error'); + swal('Already Exist','','error'); } ); diff --git a/Apollo/assets/views/hallticket/batchshedule.html b/Apollo/assets/views/hallticket/batchshedule.html index e616a9ed..ded78335 100755 --- a/Apollo/assets/views/hallticket/batchshedule.html +++ b/Apollo/assets/views/hallticket/batchshedule.html @@ -16,7 +16,7 @@ } a { - color: #007AFF; + color: #007AFF; }