diff --git a/Apollo/api/application/controllers/HallTickets_Controller.php b/Apollo/api/application/controllers/HallTickets_Controller.php index 7a6e1888..511d6dda 100755 --- a/Apollo/api/application/controllers/HallTickets_Controller.php +++ b/Apollo/api/application/controllers/HallTickets_Controller.php @@ -315,7 +315,13 @@ class HallTickets_Controller extends REST_Controller { $branchId = $this->post('branchId'); $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); $CreatedOn = $Cdate->format('Y-m-d H:i:s'); - foreach($courseArray as $CourseDatialArray) +/////////check semcoursemapping//// + $data['subjectDetails'] = $this->Hallticket_model->getSubjectDetails($universityID,$tempCourseArray,$branchId); + $data['subjectDetails'] = $this->Hallticket_model->getExistDetailsfileupload($university,$courseArray,$branchId); + // print_r( $data['subjectDetails']); + if($data['subjectDetails'] == 1 ) + { + foreach($courseArray as $CourseDatialArray) { $course=$CourseDatialArray; $schedulemaster = array('UniversityID'=>$university,'CourseID'=>$course,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn); @@ -344,7 +350,27 @@ class HallTickets_Controller extends REST_Controller { 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); - } + } + } + + // else if($data['subjectDetails'] == 0) + else + { + $this->response([ + 'message' => 'Please Mapping the course supject!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + // else{ + + // $this->response([ + // 'message' => 'No records found!', + // 'status' => REST_Controller::HTTP_NOT_FOUND + // ], REST_Controller::HTTP_NOT_FOUND); + + // } +///////////////////// + } diff --git a/Apollo/api/application/models/Hallticket_model.php b/Apollo/api/application/models/Hallticket_model.php index b4927b14..b5dc11ca 100755 --- a/Apollo/api/application/models/Hallticket_model.php +++ b/Apollo/api/application/models/Hallticket_model.php @@ -183,19 +183,11 @@ 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) +public function getExistDetailsfileupload($universityID,$courseIDS,$branchId) { - // echo $universityID; - // //foreach() - // print_r ($courseIDS); - // die(); + +// print_r($courseIDS); +// echo $universityID; $i=0; foreach($courseIDS as $c) { @@ -203,9 +195,9 @@ class Hallticket_model extends CI_Model // $tempCourseArray= $c['CourseID']; $this->db->select ('count(*) as count'); - $this->db->from('T_Batch_Schedule_Master'); + $this->db->from('T_SemSubMap_Master'); $this->db->where('UniversityID',$universityID); - $this->db->where('CourseID', $c); + $this->db->where('CourseID',$c); $result = $this->db->get(); $res = $result->result(); @@ -221,18 +213,45 @@ class Hallticket_model extends CI_Model } 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(); - ///////////////////////// + return 0; + } + } + /* + * check existing data,only batchschedule. + * @params university id and CourseID + * created by Bala + * */ + + public function getExistDetails($universityID,$courseIDS,$branchId) + { + + $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); + // $this->db->where('BranchCode',$branchId); + $result = $this->db->get(); + $res = $result->result(); + + if($res[0]->count > 0 ) + { + $i++; + } + } + + if( $i > 0 ) + { + return 1; + } + else + { + foreach($courseIDS as $c) { $this->db->distinct(); diff --git a/Apollo/assets/js/controllers/schCtrl.js b/Apollo/assets/js/controllers/schCtrl.js index 4488829f..c0fd1d9b 100755 --- a/Apollo/assets/js/controllers/schCtrl.js +++ b/Apollo/assets/js/controllers/schCtrl.js @@ -382,9 +382,15 @@ $scope.UploadFileData = function (FileDetails,myModel,courseDetails) { swal("", "Saved Successfully", "success"); $state.go($state.current, {}, {reload: true}); } else { - swal("", "Failed", "error"); + swal("", "Please Mapping the course supject", "error"); + $state.go($state.current, {}, {reload: true}); } - }); + },function(error){ + $scope.semDropDownShowLoading = false; + swal(error.data.message,'','error'); + $state.go($state.current, {}, {reload: true}); + + } ); } // end diff --git a/Apollo/assets/views/hallticket/batchshedule.html b/Apollo/assets/views/hallticket/batchshedule.html index 95385d8f..1e7dc39b 100755 --- a/Apollo/assets/views/hallticket/batchshedule.html +++ b/Apollo/assets/views/hallticket/batchshedule.html @@ -167,8 +167,9 @@

+ Sample Format - +