From 2f6f169c526ea5eac6f380c0c3c98252ad9c43ab Mon Sep 17 00:00:00 2001 From: gayathri1990 Date: Tue, 29 May 2018 13:52:21 +0530 Subject: [PATCH] batchshedule --- Apollo/api/application/config/routes.php | 5 + .../controllers/HallTickets_Controller.php | 145 +++++ .../application/models/Hallticket_model.php | 214 +++++++ Apollo/assets/i18n/en.json | 2 +- Apollo/assets/js/controllers/schCtrl.js | 566 ++++++++++++++++++ .../assets/views/hallticket/batchshedule.html | 279 +++++++++ .../assets/views/hallticket/editShedule.html | 126 ++++ 7 files changed, 1336 insertions(+), 1 deletion(-) create mode 100644 Apollo/assets/js/controllers/schCtrl.js create mode 100644 Apollo/assets/views/hallticket/batchshedule.html create mode 100644 Apollo/assets/views/hallticket/editShedule.html diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 509d4208..815adbfe 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -260,6 +260,11 @@ $route['getIndividualCourseSemMappingDetails'] = 'HallTickets_Controller/getIndi $route['updateAllSemSubMapping'] = 'HallTickets_Controller/updateAllSemesterSubjectMapping'; $route['getStudentListForHallTicket'] = 'HallTickets_Controller/getStudentListForHallTicket'; $route['getHallTicket'] = 'HallTickets_Controller/getHallTicket'; +///////// +$route['updateSheduleDetails'] = 'HallTickets_Controller/updateSheduleDetails'; +$route['getSheduleDetails'] = 'HallTickets_Controller/getSheduleDetails'; +$route['getUniversityCourseId'] = 'HallTickets_Controller/getUniversityCourseId'; +$route['saveBatchSchedule'] = 'HallTickets_Controller/SaveAllBatchSchedule'; //Reports $route['report_status'] = 'Report/status'; diff --git a/Apollo/api/application/controllers/HallTickets_Controller.php b/Apollo/api/application/controllers/HallTickets_Controller.php index 2907cc0b..c2893633 100755 --- a/Apollo/api/application/controllers/HallTickets_Controller.php +++ b/Apollo/api/application/controllers/HallTickets_Controller.php @@ -22,6 +22,8 @@ class HallTickets_Controller extends REST_Controller { // Configure limits on our controller methods // Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php $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'); @@ -265,6 +267,149 @@ class HallTickets_Controller extends REST_Controller { } } + ////////////////////////////////////////////////////////////////////////// + /* + * get shedule time and date from T_Batch_Schedule_Child + * created by TamilBala + * */ + public function getSheduleDetails_post() + { + + $mapid = $this->post('mapid'); + $subid = $this->post('subid'); + $branchcode = $this->post('branchcode'); + //$getSheduleData = $this->Hallticket_model->getShedules($mapid); + $get_unShedules = $this->Hallticket_model->get_unShedules($mapid,$subid,$branchcode); + //print_r($get_unShedules); + if ($get_unShedules) + { + //echo "model"; + $getSheduleinfo['status'] = REST_Controller::HTTP_OK; + $getSheduleinfo['getunSheduleDetailsinfo']=$get_unShedules; + //print_r($getSheduleinfo['getunSheduleDetailsinfo']); + // Set the response and exit + $this->response($getSheduleinfo, 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 + } + + + } + + + /* + * get universityid and courseid details for Shedule view + * created by TamilBala + * */ + + public function getUniversityCourseId_post() + { + $branchCode = $this->post('branchCode'); + //print_r($branchCode); + $getUnivDetailsid = $this->Hallticket_model->getUniversityid($branchCode); + + if ($getUnivDetailsid) + { + $getUnivinfo['status'] = REST_Controller::HTTP_OK; + $getUnivinfo['getUnivDetailsinfo'] = $getUnivDetailsid; + + // Set the response and exit + $this->response($getUnivinfo, 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 + } + + + } + /* + * save schduledate and time + * created by TamilBala + * */ + public function SaveAllBatchSchedule_post() + { + + + $detailArray = $this->post('scheduleDetails'); + //print_r($detailArray); + $university =$this->post('getuniversityid'); + $courseid= $this->post('getcourseid'); + //echo $courseid; + + + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + + $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); + $CreatedOn = $Cdate->format('Y-m-d H:i:s'); + // echo $courseIDS.'-'.$UniversityID; + + + $schedulemaster = array('UniversityID'=>$university,'CourseID'=>$courseid,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn); + $schedulemasteradd = $this->Hallticket_model->AddBatchScheduleMaster($schedulemaster,$detailArray); + + $SchId = ''; + if(count($schedulemasteradd)>0) + { + $SchId = $schedulemasteradd[0]['SchId']; + } + + + + if((count($schedulemasteradd)>0)) + { + $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); + + } + + } + /* + * update schduledate and time + * created by TamilBala + * */ + public function updateSheduleDetails_post() + { + $schedulearray = $this->post('updatescheduledetails'); + $updateBy = $this->post('createdBy'); + $res = $this->Hallticket_model->scheduleUpdate($schedulearray,$updateBy); + if(count($res) > 0 ) + { + + //$data['semsubstatus'] = true; + $data['status'] = REST_Controller::HTTP_OK;; + //$data['semsubjects'] = $res; + $this->response($data, REST_Controller::HTTP_OK); + } + else + { + $this->response([ + 'message' => 'Something Went Wrong!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + + } } \ No newline at end of file diff --git a/Apollo/api/application/models/Hallticket_model.php b/Apollo/api/application/models/Hallticket_model.php index 4e9314ea..3c84b20c 100755 --- a/Apollo/api/application/models/Hallticket_model.php +++ b/Apollo/api/application/models/Hallticket_model.php @@ -814,7 +814,221 @@ class Hallticket_model extends CI_Model return $studentIDs; } + ////////////////////////////////////////////////////// + +/* + * get university details and course details + * for view shedule + * created by TamilBala + * */ + public function getUniversityid($branchCode) + { + $this->db->distinct(); + $this->db->select('T_Batch_Schedule_Master.UniversityID,T_Batch_Schedule_Master.CourseID,T_Batch_Schedule_Master.SchId,T_UniversityMaster.UniversityName,T_CourseMaster.CourseName,T_CourseMaster.CourseCode,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime,T_Batch_Schedule_Child.SchId,T_SubjectMaster.SubjectName,T_SubjectMaster.SubjectID,T_UniversityMaster.UniversityID,T_SubjectMaster.BranchCode'); + $this->db->from('T_Batch_Schedule_Master'); + $this->db->join('T_UniversityMaster','T_Batch_Schedule_Master.UniversityID=T_UniversityMaster.UniversityID'); + $this->db->join('T_CourseMaster','T_Batch_Schedule_Master.CourseID=T_CourseMaster.CourseID'); + $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Master.SchId=T_Batch_Schedule_Child.SchId'); + $this->db->join('T_SubjectMaster','T_Batch_Schedule_Child.SubjectID=T_SubjectMaster.SubjectID'); + $this->db->where('T_Batch_Schedule_Master.BranchCode',$branchCode); + $this->db->where('T_Batch_Schedule_Master.IsActive',1); + $this->db->group_by('T_CourseMaster.CourseName'); + $result = $this->db->get(); + //print_r($result->result()); + return $result->result(); + } + /* + * get shedule details details + * for edit/view shedule + * created by TamilBala + * */ + public function getShedules($mapid) + { + $this->db->select('T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime,T_SubjectMaster.SubjectName,T_Batch_Schedule_Child.SchChildId,T_Batch_Schedule_Child.SubjectID'); + $this->db->from('T_SubjectMaster'); + $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Child.SubjectID=T_SubjectMaster.SubjectID','left'); + $this->db->where('T_Batch_Schedule_Child.SchId',$mapid); + $result = $this->db->get(); + //print_r($result->result()); + //die(); + return $result->result(); + } + /* + * get shedule details details + * for edit/view shedule + * created by TamilBala + * */ + public function get_unShedules($mapid,$subid,$branchcode) + { + $this->db->select('SM.SubjectName,SM.SubjectID'); + $this->db->from('T_SubjectMaster SM'); + $this->db->where('SM.BranchCode',$branchcode); + $result = $this->db->get(); + if($result->result()){ + $resultShedule['status']=true; + $mastScheduleID=""; + foreach($result->result() as $row) + { + + $this->db->select('T_Batch_Schedule_Child.SchId,T_Batch_Schedule_Child.SubjectID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime,T_Batch_Schedule_Child.SchChildId,T_Batch_Schedule_Child.SchId'); + $this->db->from('T_Batch_Schedule_Master SCM'); + $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Child.SchId = SCM.SchId'); + $this->db->where('T_Batch_Schedule_Child.SchId',$mapid); + $this->db->where('T_Batch_Schedule_Child.SubjectID',$row->SubjectID); + $existsheduledetails = $this->db->get(); + + if($existData=$existsheduledetails->result()) + { + + $fetchData['ID']="1"; + $fetchData['SubjectID']=$row->SubjectID; + $fetchData['SubjectName']=$row->SubjectName; + $fetchData['ScheduleDate']=$existData[0]->ScheduleDate; + $fetchData['FromTime']=$existData[0]->FromTime; + $fetchData['ToTime']=$existData[0]->ToTime; + $fetchData['SchChildId']=$existData[0]->SchChildId; + $fetchData['SchId']=$existData[0]->SchId; + $mastScheduleID=$existData[0]->SchId; + + } + else + { + + $fetchData['SubjectID']=$row->SubjectID; + $fetchData['SubjectName']=$row->SubjectName; + $fetchData['ID']="0"; + $fetchData['ScheduleDate']=""; + $fetchData['FromTime']=""; + $fetchData['ToTime']=""; + $fetchData['SchChildId']=""; + $fetchData['SchId']= $mastScheduleID; + + } + $fetchshedule[]=$fetchData; + } + $resultShedule['scheduleDetails']=$fetchshedule; + } + else{ + $resultShedule['status']=false; + $resultShedule['scheduleDetails']=""; + } + //print_r($resultShedule); + //die(); + return $resultShedule; + } + + /* + * add shedule details + * created by TamilBala + * */ + + + + public function AddBatchScheduleMaster($schedulemaster,$detailArray) + { + + $this->db->trans_start(); + $this->db->insert('T_Batch_Schedule_Master', $schedulemaster); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + // print_r($this->db->last_query()); + if($insert_id>0) + { + $subQuery = 'select max(SchId) as SchId from T_Batch_Schedule_Master'; + + $query = $this->db->query($subQuery); + + + $result = $query->result_array(); + $schid= $result[0]['SchId']; + + // if(($schid != '')||($schid !=0)) + + if(count($result)>0) + { + + foreach($detailArray as $det) + { + + $sudate = $det['scheduleDate']; + $SubDate = date("Y-m-d", strtotime($sudate)); + // $SubDate=$sudate->format('Y-m-d H:i:s'); + $stime = $det['scheduleStart']; + $etime = $det['scheduleEnd']; + $isactive=1; + $subId = $det['subjectID']; + $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); + $CreatedOn = $Cdate->format('Y-m-d H:i:s'); + + $schedulchild = array('SchId'=>$schid,'SubjectID'=>$subId,'SchChildId'=>'','ScheduleDate'=>$SubDate,'FromTime'=>$stime,'ToTime'=>$etime,'IsActive'=>$isactive); + $this->db->trans_start(); + $this->db->insert('T_Batch_Schedule_Child',$schedulchild); + $this->db->trans_complete(); + + } + + } + } + return true; + + } + + /* + * update shedule details + * created by TamilBala + * */ + + + + public function scheduleUpdate($schedulearray,$up) + { + + $MasterID = ""; + foreach($schedulearray as $shed) + { + $ChildID = $shed['schChildId']; + //echo $ChildID; + $sudate = $shed['scheduleDate']; + $SubDate = date("Y-m-d", strtotime($sudate)); + $MasterID = $shed['SchId']; + //echo $SchId; + $SubjectID = $shed['SubjectID']; + $scheduleStart = $shed['scheduleStart']; + $scheduleEnd = $shed['scheduleEnd']; + $isactive=1; + if($ChildID != '') + { + + $schedulchildUpdate = array('ScheduleDate'=>$SubDate,'FromTime'=>$scheduleStart,'ToTime'=>$scheduleEnd); + //print_r($schedulchild); + $this->db->trans_start(); + $this->db->where('T_Batch_Schedule_Child.SchChildId',$ChildID); + $this->db->where('T_Batch_Schedule_Child.SubjectID',$SubjectID); + $this->db->update('T_Batch_Schedule_Child',$schedulchildUpdate); + $this->db->trans_complete(); + + } + else + { + $schedulchildInsert = array('SchId'=>$MasterID,'SubjectID'=>$SubjectID,'ScheduleDate'=>$SubDate,'FromTime'=>$scheduleStart,'ToTime'=>$scheduleEnd,'IsActive'=>$isactive); + $this->db->trans_start(); + $this->db->insert('T_Batch_Schedule_Child',$schedulchildInsert); + $this->db->trans_complete(); + + } + } + + $schedulMaster = array('UpdatedBy'=>$up); + + $this->db->trans_start(); + $this->db->update('T_Batch_Schedule_Master',$schedulMaster); + $this->db->where('T_Batch_Schedule_Master.SchId',$MasterID); + $this->db->trans_complete(); + + return $up; + + } } \ No newline at end of file diff --git a/Apollo/assets/i18n/en.json b/Apollo/assets/i18n/en.json index 3e464028..552930b3 100755 --- a/Apollo/assets/i18n/en.json +++ b/Apollo/assets/i18n/en.json @@ -156,7 +156,7 @@ "hallTicket": { "MAIN": "HALL TICKET", "COURSESEMESTERMAPPING": "COURSE SEMESTER MAPPING", - "BATCHSCHEDULE": "BATCH SCHEDULE", + "BATCHSCHEDULE": "BATCH SCHEDULE", "GENERATEHALLTICKET": "GENERATE HALLTICKET" } } diff --git a/Apollo/assets/js/controllers/schCtrl.js b/Apollo/assets/js/controllers/schCtrl.js new file mode 100644 index 00000000..54a1757f --- /dev/null +++ b/Apollo/assets/js/controllers/schCtrl.js @@ -0,0 +1,566 @@ +'use strict'; +/** + * controllers for ng-table + * Simple table with sorting and filtering on AngularJS + */ +app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { + + $scope.myModel = { + "studentName": "", + "mobileNumber": "", + "universityName":"", + "semsterName":"" + }; + + $scope.myModelAdd = { + "date": "", + "periodStart": "", + "periodEnd":"", + + }; + $scope.details = []; + $scope.viewPage = { + "CourseDetails":[] + }; + + $scope.editId = -1; + $scope.editModel = { + "editSubject": "", + "editScheduleDate": "", + "editFromTime":"", + "editToTime":"", + + }; + $scope.semDropDownShowLoading1 = false; + $scope.semDetailsLoadingStatus1 = false; + $scope.semDetailsLoadingTxt1 = ""; + $scope.setEditId = function (pid,cid,schid,subid,c) { + var branchid=JSON.parse(localStorage.getItem('localObj')).localBranchID; + $scope.semDetailsLoadingStatus1 = true; + $scope.semDetailsLoadingTxt1 = "Loading..."; + //alert(branchid); + //alert(pid); + $scope.editModel.editSubject = c.SubjectName; + $scope.editModel.editScheduleDate = c.ScheduleDate; + $scope.editModel.editFromTime = c.FromTime; + $scope.editModel.editToTime = c.ToTime; + //$scope.localUniversityDetails=""; + //$scope.localUniversityDetails = JSON.parse(localStorage.getItem('localUniversityDetails')); + + + $scope.editId = pid; + $scope.courseCode = cid; + var mappingid = schid; + //alert(mappingid+'n'); + var getsheduledetails = { + method: 'POST', + url: apiPoint.url + 'getSheduleDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + //requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + mapid:mappingid, + subid:subid, + branchcode:branchid, + + + } + }; + $http(getsheduledetails).then(function (response) { + if (response.data.status==200) + { + + $scope.unsheduledetails=response.data.getunSheduleDetailsinfo.scheduleDetails; + + + + } else { + $scope.unsheduledetails=""; + + } + }); + + + + }; + // $scope.details = []; + $scope.cancel = function () { + + $scope.init(); + $scope.editId = -1; + + }; + $scope.semDropDownShow = false; + $scope.semDropDownShowLoading = false; + $scope.saveButtonDisabled = false; + $scope.saveButtonTxt = "SAVE"; + $rootScope.userType = JSON.parse(localStorage.getItem('localObj')).localType; + $scope.semDetailsLoadingStatus = false; + $scope.semDetailsLoadingTxt = ""; + + + $scope.selectedCourseName = []; + $scope.selectedUniversityCourseName = ''; + $scope.selectedSemSubjetcsSem1 = []; + $scope.selectedSemSubjetcsSem2 = []; + $scope.selectedSemSubjetcsSem3 = []; + $scope.selectedSemSubjetcsSem4 = []; + $scope.selectedSemSubjetcsSem5 = []; + $scope.selectedSemSubjetcsSem6 = []; + $scope.selectedSemSubjetcsSem7 = []; + $scope.selectedSemSubjetcsSem8 = []; + $scope.overallSelectedSubjetcs = []; + + // 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 + } + + /* + * init function + * created by TamilBala + * */ + $scope.init = function () { + + var branchid=JSON.parse(localStorage.getItem('localObj')).localBranchID; + //alert(branchid); + $scope.semDetailsLoadingStatus = true; + $scope.semDetailsLoadingTxt = "Loading..."; + + var getUniv = { + method: 'POST', + url: apiPoint.url + 'getUniversityCourseDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID + + } + }; + + + $http(getUniv).then(function (response) { + if (response.data.status==200 && response.data.universityStatus) { + $scope.university=response.data.univerSityDetails; + + + + } else { + + $scope.university=""; + + } + }); + + $scope.selectedCourseNameC = { + list: $scope.selectedCourseName, + } + + /* + * getUnivid function + * created by TamilBala + * */ + + var getUnivid = { + method: 'POST', + url: apiPoint.url + 'getUniversityCourseId/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + //requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:branchid, + + } + }; + $http(getUnivid).then(function (response) { + if (response.data.status==200) + { + + $scope.universitycourse=response.data.getUnivDetailsinfo; + + + + } else { + + + $scope.universitycourse=""; + + } + }); + + + + + } + + + //Assign Courses to Course array for Multiple select + $scope.getuniversity = function(){ + $scope.selectedUniversityCourseName = $scope.myModel.universityName.courseDetails; + if($scope.selectedUniversityCourseName.length == 0){ swal('No Courses Available','','info'); } + $scope.selectedCourseNameC = { + list: $scope.selectedCourseName, + } + + } + + + /* + * get course semester,subjects details + * created by TamilBala + * */ + + var course=''; + $scope.getSemSubDetails = function(UID,COURSES){ + course=COURSES; + //alert(course) + 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(); + + } + else + { + + + if(UID == undefined || UID == '') + { + swal("Select University"); + return false; + } + if(COURSES.list == '') + { + swal("Select Course"); + return false; + } + + $scope.semDropDownShowLoading = false; + $scope.semDropDownShow = false; + $scope.semDropDownShowLoading = true; + var getsubject = { + method: 'POST', + url: apiPoint.url + 'getSemesterSubjectDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + universityID : UID, + courseID : COURSES, + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID + } + }; + $http(getsubject).then(function (response) { + + if(response.data.status == 200) + { + $scope.semDropDownShowLoading = false; + $scope.semDropDownShow = true; + $scope.subjects = [];// For Main Dropdown + $scope.subjectsFromDBtoComapare = []; + //$scope.semesters = response.data.semesterDetails; + $scope.subjectsFromDB = response.data.subjectDetails; //Store Response Data to subjectsFromDB + + angular.forEach($scope.subjectsFromDB,function(value,key){ + $scope.subjects.push({ + "Subject":value, + "ScheduleDate":"", + "ScheduleStartTime":"", + "ScheduleEndTime":"" + });// For Main Dropdown + }); + + + + + } + + + + + + },function(error){ + $scope.semDropDownShowLoading = false; + swal('No Subjetcs Found','','error'); + + } ); + + + + } + } + + /* + * Remove Subjects from Master Subjects Arry + * after selecting subjects for each semester + * created by TamilBala + * */ + $scope.removeSelectedSubjetcs = function(newsublist){ + + //Every time copy all subjetcs from subjectsFromDB to ompare + angular.forEach($scope.subjectsFromDB,function(value,key){ + $scope.subjectsFromDBtoComapare.push(value); + }); + + //For Compare Single Semesters Array and Master Subjetcs Array and remove selected subjects from Master Subjetcs Array + angular.forEach(newsublist,function(value,key){ + angular.forEach($scope.subjects,function(value2,key2){ + + if(value.SubjectID == value2.SubjectID) + { + $scope.subjects.splice(key2,1); + } + + }); + }); + + //For Concat all subjetcs from all semsters. + $scope.overallSelectedSubjetcs=[].concat($scope.selectedSubjetcsSem1C.list,$scope.selectedSubjetcsSem2C.list,$scope.selectedSubjetcsSem3C.list,$scope.selectedSubjetcsSem4C.list,$scope.selectedSubjetcsSem5C.list,$scope.selectedSubjetcsSem6C.list,$scope.selectedSubjetcsSem7C.list,$scope.selectedSubjetcsSem8C.list); + + + //For Compare Over all selected subjects And Master Subjetcs to avoid duplicate. + angular.forEach($scope.overallSelectedSubjetcs,function(value,key){ + + angular.forEach($scope.subjectsFromDBtoComapare,function(value2,key2){ + if(value.SubjectID != value2.SubjectID) + { + + if ($scope.overallSelectedSubjetcs.indexOf(value2) == -1 && $scope.subjects.indexOf(value2) == -1) + { + $scope.subjects.push(value2); + $scope.subjectsFromDBtoComapare.splice(key2,1); + } + + } + + }); + + }); + + $scope.subjectsFromDBtoComapare = []; + + } + + + + var date= ''; + var stime= ''; + var etime=''; + var subjectname= ''; + var subjectcode = ''; + var c=''; + var subid=''; + var subjectId= ''; + $scope.details = []; + + $scope.add= function(index,myModelAdd,p) + { + + var subname = p.SubjectName; + var item=[]; + c = $scope.details.length + 1; + var formate = "dd-MM-yyyy"; + date = $filter('date')(new Date(myModelAdd.date), formate); + stime = myModelAdd.periodStart; + etime = myModelAdd.periodEnd; + subjectname = p.SubjectName; + subjectcode = p.SubjectCode; + subid = p.SubjectID; + + + + item.push({ + + date : date, + stime : stime, + etime : etime, + subjectname : subjectname, + subjectcode : subjectcode, + subjectId : subid + + + }); + + $scope.details.splice(0,0,item); + + + } + + + $scope.saveAll= function(myModel,courseDetails,subjectsDetails) + { + $scope.scheduledDetails=[]; + + angular.forEach(subjectsDetails,function (value) { + if((value.ScheduleDate!='' && value.ScheduleDate!=undefined) && (value.ScheduleStartTime!='' && value.ScheduleStartTime!=undefined) && (value.ScheduleEndTime!='' && value.ScheduleEndTime!=undefined)){ + + $scope.scheduledDetails.push({ + "universityID":myModel.universityName.universityID, + "courseID":courseDetails.list[0], + "subjectID":value.Subject.SubjectID, + "scheduleDate":$filter('date')(value.ScheduleDate, 'dd-MM-yyyy'), + "scheduleStart":value.ScheduleStartTime, + "scheduleEnd":value.ScheduleEndTime, + + }); + + } + }); + var saveAllInfo = { + method: 'POST', + url: apiPoint.url + 'saveBatchSchedule/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + getuniversityid :myModel.universityName.universityID, + getcourseid :courseDetails.list[0], + scheduleDetails : $scope.scheduledDetails, + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID + + + } + }; + + $http(saveAllInfo).then(function(response) + { + //console.log(status); + if (response.data.status==200) + { + swal(" ", "Saved successfully,", "success"); + } + },function(error){ + + swal('Some Thing Went Wrong!','Try Later','error') + + }); + + } + + $scope.updateShedule = function (unsheduledetails) { + + $scope.UpdatescheduledDetails=[]; + + angular.forEach(unsheduledetails,function (value) { + if((value.ScheduleDate!='' && value.ScheduleDate!=undefined) && (value.FromTime!='' && value. FromTime!=undefined) && (value.ToTime!='' && value.ToTime!=undefined)){ + + $scope.UpdatescheduledDetails.push({ + "SchId":value.SchId, + "SubjectID":value.SubjectID, + "schChildId":value.SchChildId, + "scheduleDate":$filter('date')(value.ScheduleDate, 'dd-MM-yyyy'), + "scheduleStart":value.FromTime, + "scheduleEnd":value.ToTime, + + }); + + } + }); + + + + var update = { + method: 'POST', + url: apiPoint.url + 'updateSheduleDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + + updatescheduledetails : $scope.UpdatescheduledDetails, + //status: myModel.IsActive, + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + } + }; + $http(update).then(function (response) { + if (response.data.status==200 ) { + // $scope.ldloading[loading.replace('-', '_')] = false; + //$scope.editId = -1; + $scope.init(); + swal("", "Saved Successfully.", "success"); + + + } else { + $scope.ldloading[loading.replace('-', '_')] = false; + swal("", response.data.message,"error"); + } + }); + }; + + + + + + + + + + + + + + + $scope.addForm ={ + submit:function(myModelAdd,addmoreItem) + { + //alert(); + time = myModelAdd.ScheduleTime; + $scope.details.push({ + time:time}) + + + + + + } + }; + $scope.processDataforViewPage = function() + { + $scope.viewPage.UniversityID = $scope.existSemesterSubjectMapDetails[0].UniversityID; + $scope.viewPage.UniversityName = $scope.existSemesterSubjectMapDetails[0].UniversityName; + var tArry = []; + angular.forEach($scope.existSemesterSubjectMapDetails,function(value,key){ + + if(tArry.indexOf(value.CourseID) == -1) + { + tArry.push(value.CourseID); + var tempArray = {'CourseID':value.CourseID,'CourseCode':value.CourseCode,'CourseName':value.CourseName}; + $scope.viewPage.CourseDetails.push(tempArray); + } + + + }); + + + } + + +$scope.batchschedule={ + submit: function (form, myModelAdd) + { + + + var alldata = $("#batchsch"); + + }, +}; + +}]); diff --git a/Apollo/assets/views/hallticket/batchshedule.html b/Apollo/assets/views/hallticket/batchshedule.html new file mode 100644 index 00000000..97af0a56 --- /dev/null +++ b/Apollo/assets/views/hallticket/batchshedule.html @@ -0,0 +1,279 @@ + + +
+
+
+ +

{{ mainTitle }}

+ + Allocate Batch schedule + +
+
+
+
+ + + +
+ + + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Loading...

+
+ +
+ + + + + +
University NameCourse NameAction
{{c.UniversityName}}{{c.CourseName}} + + + + + + + + + + +
+ + +
+ + + + + + +
+
+
+ +
+ + +
+
+ Search +
+
+ + + + +
+
+ + + + + + + + + + + {{$item.CourseName}} + + + {{x.CourseName}} + + + + +
+
+
+ + +
+ + +
+
+
+

Loading...

+
+ +
+ + +
+
+
+ +
+

Subject

+
+
+

Date

+
+
+

Start Time

+
+
+

End Time

+
+
+ +
+
+ +
+ +
+ + + +
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ + + + +
+
+ +
+ + + +
+ + +
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+ +
+
+
+ + + + + + + + + diff --git a/Apollo/assets/views/hallticket/editShedule.html b/Apollo/assets/views/hallticket/editShedule.html new file mode 100644 index 00000000..c956a906 --- /dev/null +++ b/Apollo/assets/views/hallticket/editShedule.html @@ -0,0 +1,126 @@ +
+
+
+
+
+ + Update Schedule Details + + +
+ +
+ + + + +
+ +
+
+ + + Shedule Date is required. + + +
+ + +
+ + +
+ + +
+
+ + +
+ +
+ + + + +
+
+ + +
+
+ + +
+ +
+ + + + +
+ + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ + + + + + \ No newline at end of file