batchshedule duplicate avoided

This commit is contained in:
gayathri1990 2018-08-23 19:12:26 +05:30
parent 77ddc147e3
commit 44a53ee513
5 changed files with 107 additions and 5 deletions

View File

@ -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';

View File

@ -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()
{

View File

@ -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

View File

@ -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');
} );

View File

@ -16,7 +16,7 @@
}
a {
color: #007AFF;
color: #007AFF;
}
</style>