diff --git a/Apollo/api/application/controllers/Course_Controller.php b/Apollo/api/application/controllers/Course_Controller.php index 1648d776..9187a8d1 100755 --- a/Apollo/api/application/controllers/Course_Controller.php +++ b/Apollo/api/application/controllers/Course_Controller.php @@ -58,7 +58,10 @@ class Course_Controller extends REST_Controller { if($jsonLateralFeesData['FeesAmount'] != 0 AND $jsonLateralFeesData['FeesAmount'] != '' AND $jsonLateralFeesData['FeesAmount'] != 'undefined'){ array_push($jsonSemFeesData,$jsonLateralFeesData); } - $courseDetails = $this->course_model->addCourse($details,$jsonSemFeesData);// Check if the users data store contains users (in case the database result returns NULL) + // get subject details + $subjectDetails=$this->post('subjects'); + + $courseDetails = $this->course_model->addCourse($details,$jsonSemFeesData,$subjectDetails);// Check if the users data store contains users (in case the database result returns NULL) if ($courseDetails) { $courseDetails['status'] = REST_Controller::HTTP_OK; @@ -104,8 +107,8 @@ class Course_Controller extends REST_Controller { } public function getCourseUnivFeesDetails_post() { - $requestedBy = $this->post('requestedBy'); - $getCourseUnivFee = $this->course_model->getCourseUnivFeesTypes($requestedBy); + $requestedBy = $this->post('requestedBy'); + $getCourseUnivFee = $this->course_model->getCourseUnivFeesTypes($requestedBy); if ($getCourseUnivFee) { @@ -158,7 +161,14 @@ class Course_Controller extends REST_Controller { } - $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData,$existCourseID);// Check if the users data store contains users (in case the database result returns NULL) + // update course subject details + $subjectDetails['UniversityID'] = $this->post('universityID'); + $subjectDetails['CourseID'] = $this->post('courseID'); + $subjectDetails['Subjects'] = $this->post('subjects'); + $subjectDetails['UpdatedBy'] = $this->post('updatedBy'); + $subjectDetails['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + + $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData,$subjectDetails);// Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails) { $updateDetails['status'] = REST_Controller::HTTP_OK; diff --git a/Apollo/api/application/models/Course_model.php b/Apollo/api/application/models/Course_model.php index 89bd4b12..03935f7f 100755 --- 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,$jsonSemFeesData=null) + public function addCourse($arrayDetails=null,$jsonSemFeesData=null,$subjectDetails=null) { $this->db->select('CourseCode'); @@ -40,6 +40,10 @@ class Course_model extends CI_Model { $this->db->insert(COURSE_FEES, $insertFeesArray); } + if($subjectDetails){ + $this->insertCourseSubjects($arrayDetails,$insert_id,$subjectDetails); + } + $result['courseStatus'] = true; $result['message'] = "Successfully course details added"; } @@ -95,6 +99,7 @@ class Course_model extends CI_Model { $fetchData['UniversityID']=$row->UniversityID; $fetchData['UniversityName']=$row->UniversityName; $fetchData['feesStructures'] = $this->getCourseFeesDetails($row->CourseID); + $fetchData['existSubjects'] = $this->getExistCourseSubjectDetails($row->CourseID); // print_r($fetchData);exit(); $storeCourseArray[]=$fetchData; } @@ -123,7 +128,7 @@ class Course_model extends CI_Model { * update course details * created by kms * */ - public function updateCourse($arrayDetails=null,$jsonData=null) + public function updateCourse($arrayDetails=null,$jsonData=null,$subjectDetails=null) { $this->db->select('CourseCode'); $this->db->where('CourseCode', $arrayDetails['CourseCode']); @@ -158,6 +163,9 @@ class Course_model extends CI_Model { } } + // update course subject details + $this->updateCourseSubjcetDetails($subjectDetails); + $result['courseStatus'] = true; $result['message'] = "Successfully course details updated"; @@ -261,14 +269,104 @@ class Course_model extends CI_Model { * created by kms * */ public function getSubjectDetails(){ - $this->db->select('UniversityID,UniversityName'); - $this->db->order_by('UniversityID','ASC'); + $this->db->select('SubjectID,SubjectCode,SubjectName'); + $this->db->order_by('SubjectID','DESC'); $this->db->where('IsActive','1'); - $universityDetails = $this->db->get(SUBJE); - return $universityDetails->result(); + $subjectDetails = $this->db->get(SUBJECTMASTER); + return $subjectDetails->result(); } + /* + *Insert course sujects + * created by kms + * */ + public function insertCourseSubjects($details=null,$courseID=null,$subjects=null){ + $insertSubject['UniversityID'] = $details['UniversityID']; + $insertSubject['CourseID'] = $courseID; + if ($subjects){ + foreach ($subjects as $row){ + $insertSubject['SubjectID'] = $row['SubjectID']; + $insertSubject['IsActive'] = true; + $insertSubject['CreatedBy'] = $details['CreatedBy']; + $insertSubject['CreatedOn'] = $details['CreatedOn']; + $this->db->insert(COURSESUBJECT, $insertSubject); + } + } + return true; + } + /* + * get exist Course subject details + * created by kms + * */ + public function getExistCourseSubjectDetails($courseID=null){ + $this->db->select('CSU.SubjectID,SM.SubjectCode,SM.SubjectName'); + $this->db->order_by('CSID','ASC'); + $this->db->where('CSU.CourseID',$courseID); + $this->db->where('CSU.IsActive','1'); + $this->db->where('SM.IsActive','1'); + $this->db->from(COURSESUBJECT.' as CSU'); + $this->db->join(SUBJECTMASTER.' as SM', 'SM.SubjectID = CSU.SubjectID'); + $subDetails = $this->db->get(); + return $subDetails->result(); + } + + /* + * update course subject details + * created by kms + * */ + public function updateCourseSubjcetDetails($sujects=null){ + $deactiveStatus['IsActive']=false; + $deactiveStatus['UpdatedBy']=$sujects['UpdatedBy']; + $deactiveStatus['UpdatedOn']=$sujects['UpdatedOn']; + $this->db->where('CourseID ',$sujects['CourseID']); + $this->db->where('UniversityID ',$sujects['UniversityID']); + $updateCourseSubjectDeactive = $this->db->update(COURSESUBJECT, $deactiveStatus); + + if($updateCourseSubjectDeactive){ + + if($sujects['Subjects']){ + + foreach ($sujects['Subjects'] as $srow){ + $this->db->select('CSID'); + $this->db->where('CourseID',$sujects['CourseID']); + $this->db->where('UniversityID',$sujects['UniversityID']); + $this->db->where('SubjectID',$srow); + if($this->db->get(COURSESUBJECT)->first_row()){ + $existStatusUpdate['IsActive']=true; + $existStatusUpdate['UpdatedBy']=$sujects['UpdatedBy']; + $existStatusUpdate['UpdatedOn']=$sujects['UpdatedOn']; + $this->db->where('CourseID',$sujects['CourseID']); + $this->db->where('UniversityID',$sujects['UniversityID']); + $this->db->where('SubjectID',$srow); + $this->db->update(COURSESUBJECT, $existStatusUpdate); + } + else{ + $update_array["UniversityID"]=$sujects['UniversityID']; + $update_array["CourseID"]=$sujects['CourseID']; + $update_array["SubjectID"]=$srow; + + $update_array["IsActive"]=true; + $update_array["CreatedBy"]=$sujects['UpdatedBy']; + $update_array["CreatedOn"]=$sujects['UpdatedOn']; + $this->db->insert(COURSESUBJECT, $update_array); + + } + + } + } + /* else{ + $activateStatus['IsActive']=true; + $this->db->where('CourseID ',$sujects['CourseID']); + $this->db->where('UniversityID ',$sujects['UniversityID']); + $this->db->update(COURSESUBJECT, $activateStatus); + + }*/ + + } + + return true; + } } \ No newline at end of file diff --git a/Apollo/api/application/models/Subject_model.php b/Apollo/api/application/models/Subject_model.php index 37f3d269..d4e185a9 100644 --- a/Apollo/api/application/models/Subject_model.php +++ b/Apollo/api/application/models/Subject_model.php @@ -15,12 +15,12 @@ class Subject_model extends CI_Model $this->db->select('SubjectCode'); $this->db->where('SubjectCode',$arrayDetails['SubjectCode']); - if($this->db->get('T_SubjectMaster')->first_row()){ + if($this->db->get(SUBJECTMASTER)->first_row()){ $result['SubjectStatus']=false; $result['message']="This subject code already exists"; }else{ - $this->db->insert('T_SubjectMaster',$arrayDetails); + $this->db->insert(SUBJECTMASTER,$arrayDetails); if ($this->db->affected_rows() == '1') { $result['SubjectStatus']=true; @@ -45,12 +45,12 @@ public function updateSubject($arrayDetails=null,$SubjectID=null) $this->db->select('SubjectCode'); $this->db->where('SubjectCode',$arrayDetails['SubjectCode']); $this->db->where('SubjectCode !=', $arrayDetails['SubjectCode']); - if($this->db->get('T_SubjectMaster')->first_row()){ + if($this->db->get(SUBJECTMASTER)->first_row()){ $result['SubjectStatus']=false; $result['message']="This subject code is already exists"; }else{ $this->db->where('SubjectID',$SubjectID); - $upateStatus=$this->db->update('T_SubjectMaster', $arrayDetails); + $upateStatus=$this->db->update(SUBJECTMASTER, $arrayDetails); @@ -82,7 +82,7 @@ public function updateSubject($arrayDetails=null,$SubjectID=null) { $this->db->select('*'); $this->db->order_by('CreatedOn','DESC'); - $subjectDetails = $this->db->get('T_SubjectMaster'); + $subjectDetails = $this->db->get(SUBJECTMASTER); if($subjectDetails->result()){ @@ -99,23 +99,4 @@ public function updateSubject($arrayDetails=null,$SubjectID=null) } - - - - - - - - - - - - - - - - - - - } \ No newline at end of file diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json index bb9a7af0..e6df1a77 100755 --- a/Apollo/assets/i18n/en.json +++ b/Apollo/assets/i18n/en.json @@ -72,7 +72,8 @@ "DAYBOOKMASTER":"INCOME/EXPENSE HEADS", "CENTERMASTER": "CENTER DETAILS", "SUBJECTMASTER":"SUBJECT MASTER", - "SESSIONMASTER":"SESSION DETAILS" + "SESSIONMASTER":"SESSION DETAILS", + "SESSIONSCHEDULE": "SESSION SCHEDULE" }, "student": { "MAIN": "STUDENTS", diff --git a/Apollo/assets/js/config.constant.js b/Apollo/assets/js/config.constant.js index 6c991692..37647774 100755 --- a/Apollo/assets/js/config.constant.js +++ b/Apollo/assets/js/config.constant.js @@ -165,7 +165,10 @@ app.constant('JS_REQUIRES', { 'centerCtrl':'assets/js/controllers/centerCtrl.js', //SUBJECT MASTER 'subjectCtrl':'assets/js/controllers/subjectCtrl.js', + // session master 'sessionMasterCtrl':'assets/js/controllers/sessionMasterCtrl.js', + // session sechdule + 'sessionScheduleCtrl':'assets/js/controllers/sessionScheduleCtrl.js', //*** Filters diff --git a/Apollo/assets/js/config.router.js b/Apollo/assets/js/config.router.js index 9662985f..302d1f85 100755 --- a/Apollo/assets/js/config.router.js +++ b/Apollo/assets/js/config.router.js @@ -228,6 +228,14 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com ncyBreadcrumb: { label: 'Session Master' }, + }).state('app.master.sessionSchedule', { + url: '/session schedule', + templateUrl: "assets/views/sessionSchedule.html", + resolve: loadSequence('ui.select','sessionScheduleCtrl','ngTable', 'ladda', 'angular-ladda','spin'), + title: 'Session Schedule', + ncyBreadcrumb: { + label: 'Session Schedule' + }, }).state('app.student', { url: '/student', template: '
STUDENT DETAILS
', diff --git a/Apollo/assets/js/controllers/courseCtrl.js b/Apollo/assets/js/controllers/courseCtrl.js index 8ad67ac0..530fa905 100755 --- a/Apollo/assets/js/controllers/courseCtrl.js +++ b/Apollo/assets/js/controllers/courseCtrl.js @@ -85,6 +85,17 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab } }); + + // get exist subject details + $scope.editSubject = []; + angular.forEach(p.existSubjects, function (values, keys) { + + $scope.editSubject.push(values.SubjectID); + }) + $scope.viewSubject = { + list: $scope.editSubject, + } + $scope.editId = pid; }; @@ -173,7 +184,8 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab semFeesAmounts:$scope.addMoreItems, createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, specilization1:myModel.specilization1, - specilization2:myModel.specilization2 + specilization2:myModel.specilization2, + subjects:myModel.subject } }; $http(addCourse).then(function (response) { @@ -206,7 +218,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab * update the course details * created by kms * */ - $scope.updateCourse = function (myModel, form,regular,lateral,semYear, loading) { + $scope.updateCourse = function (myModel, form,regular,lateral,semYear, loading,subjects) { var firstError = null; if (form.$invalid) { var field = null, firstError = null; @@ -246,6 +258,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab }, data: { courseID: myModel.CourseID, + universityID: myModel.UniversityID, courseCode: myModel.CourseCode, courseName: myModel.CourseName, provFess:myModel.PC, @@ -261,7 +274,8 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, specilization1:myModel.Specilization1, specilization2:myModel.Specilization2, - existCourseID:myModel.CourseID + existCourseID:myModel.CourseID, + subjects:subjects.list } }; $http(update).then(function (response) { @@ -374,6 +388,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab }; function getUniversity_FeesDetails() { + $scope.subjectDetails=[]; var getCourseUnivFee = { method: 'POST', url: apiPoint.url + 'getCourseUnivFeesDetails/', @@ -388,11 +403,19 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab if (response.data.status==200 && response.data.courseStatus) { $scope.university=response.data.universityDetails; + $scope.subjectDetails=[]; $scope.feesDetails=response.data.feesDetails; $scope.myModel.ListName=$scope.feesDetails[0]; $scope.myModel.programListName=$scope.myModel.ListName.programType[0].ListCode; + angular.forEach(response.data.subjectetails, function (values, keys) { + $scope.subData = { + SubjectID: values.SubjectID, + SubjectName: values.SubjectCode +'-'+values.SubjectName + }; + $scope.subjectDetails.push($scope.subData); + }) // single sitting regular course details in model $scope.myModelRegular = { diff --git a/Apollo/assets/views/centerMaster.html b/Apollo/assets/views/centerMaster.html index d3bd11be..73899891 100644 --- a/Apollo/assets/views/centerMaster.html +++ b/Apollo/assets/views/centerMaster.html @@ -139,11 +139,11 @@ + ng-model="myModel.centerCode" ng-pattern="" required/> Center code is required Invalid Center Code + ng-if="Form.centerCode.$dirty && Form.centerCode.$error.pattern">Invalid center code @@ -160,7 +160,7 @@ Center name is required Invalid Center name + ng-if="Form.centerName.$dirty && Form.centerName.$error.pattern">Invalid center name @@ -227,7 +227,7 @@ - + diff --git a/Apollo/assets/views/courseDetails.html b/Apollo/assets/views/courseDetails.html index d1554e98..d1fa6a51 100755 --- a/Apollo/assets/views/courseDetails.html +++ b/Apollo/assets/views/courseDetails.html @@ -261,8 +261,33 @@ +
+
+ + + + + {{$item.SubjectName}} + + + {{sub.SubjectName}} + + + + + + +
+ +
@@ -280,7 +305,7 @@ @@ -339,7 +364,7 @@ - diff --git a/Apollo/assets/views/editCenterDetails.html b/Apollo/assets/views/editCenterDetails.html index 24ac7c53..af9650d2 100644 --- a/Apollo/assets/views/editCenterDetails.html +++ b/Apollo/assets/views/editCenterDetails.html @@ -9,16 +9,16 @@
+ ng-class="{'has-error':Form.centercode.$dirty && Form.centercode.$invalid, 'has-success':Form.centercode.$valid}"> + ng-model="p.CenterCode" ng-pattern="" required/> Center Code is required + ng-if="Form.centercode.$dirty && Form.centercode.$error.required">Center code is required Invalid center Code @@ -31,13 +31,13 @@ Center Name - Center Code is required + ng-if="Form.centerName.$dirty && Form.centerName.$error.required">Center name is required Invalid center Code + ng-if="Form.centerName.$dirty && Form.centerName.$error.pattern">Invalid center name
diff --git a/Apollo/assets/views/editCourseDetails.html b/Apollo/assets/views/editCourseDetails.html index cfa0c87a..83f8123a 100755 --- a/Apollo/assets/views/editCourseDetails.html +++ b/Apollo/assets/views/editCourseDetails.html @@ -124,6 +124,33 @@
+
+
+ + + + + {{$item.SubjectName}} + + + {{sub.SubjectName}} + + + + + + + + +
+ +
@@ -346,7 +373,7 @@
- diff --git a/Apollo/assets/views/editSubjectDetails.html b/Apollo/assets/views/editSubjectDetails.html index 6baf3b0f..eb97b8f5 100644 --- a/Apollo/assets/views/editSubjectDetails.html +++ b/Apollo/assets/views/editSubjectDetails.html @@ -22,9 +22,9 @@ ng-model="p.SubjectCode" ng-pattern="" required /> SubjectCode is required + ng-if="Form.SubjectCode.$dirty && Form.SubjectCode.$error.required">Subject code is required Enter a valid SubjectCode + ng-if="Form.SubjectCode.$dirty && Form.SubjectCode.$error.pattern">Enter a valid subject code
SubjectName is required + ng-if="Form.SubjectName.$dirty && Form.SubjectName.$error.required">Subject name is required Invalid SubjectName name + ng-if="Form.SubjectName.$dirty && Form.SubjectName.$error.pattern">Invalid subject name