From 06c6dddeeae6485c9d6f921eff43e2f3a6ff5cf6 Mon Sep 17 00:00:00 2001 From: resicovenba Date: Mon, 18 Dec 2017 13:39:58 +0530 Subject: [PATCH] status Updation new files: kdk --- .../controllers/StatusUpdation_Controller.php | 318 ++++++++++++++ .../models/StatusUpdation_model.php | 286 +++++++++++++ .../js/controllers/answerBookletStatusCtrl.js | 336 +++++++++++++++ .../js/controllers/applicationStatusCtrl.js | 336 +++++++++++++++ .../js/controllers/certificationStatusCtrl.js | 387 ++++++++++++++++++ Apollo/assets/js/controllers/studentCtrl.js | 2 +- .../js/controllers/studyMaterialStatusCtrl.js | 332 ++++++++++++++- .../status-update/answer_booklet_status.html | 262 ++++++++++++ .../status-update/application_status.html | 262 ++++++++++++ .../status-update/certification_status.html | 286 +++++++++++++ .../status-update/study_material_status.html | 275 ++++++++++++- 11 files changed, 3059 insertions(+), 23 deletions(-) create mode 100644 Apollo/api/application/controllers/StatusUpdation_Controller.php create mode 100644 Apollo/api/application/models/StatusUpdation_model.php create mode 100644 Apollo/assets/js/controllers/answerBookletStatusCtrl.js create mode 100644 Apollo/assets/js/controllers/applicationStatusCtrl.js create mode 100644 Apollo/assets/js/controllers/certificationStatusCtrl.js create mode 100644 Apollo/assets/views/status-update/answer_booklet_status.html create mode 100644 Apollo/assets/views/status-update/application_status.html create mode 100644 Apollo/assets/views/status-update/certification_status.html diff --git a/Apollo/api/application/controllers/StatusUpdation_Controller.php b/Apollo/api/application/controllers/StatusUpdation_Controller.php new file mode 100644 index 00000000..006dfdcb --- /dev/null +++ b/Apollo/api/application/controllers/StatusUpdation_Controller.php @@ -0,0 +1,318 @@ +methods['getUniversity_post']['limit'] = 100; + $this->methods['chkUnivIdExistDetail_post']['limit'] = 100; + // load the university model + $this->load->model('StatusUpdation_model', 'statusupdation_model'); + } + + // get University, Course, Branch Detailss + public function getUniveCourseBratch_post() { + $reqData = $this->post('data'); + $loginUserId = $reqData['localUserID']; + $loginUserBranchId = $reqData['localBranchID']; + $loginUserType = $reqData['localType']; + $getUniversityListDetails = $this->statusupdation_model->get_university_course_batch();// Check if the employee exist + if ($getUniversityListDetails) + { + $getUniversityListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + // ger Result fot searched keyword details + public function getSearchDetails_post() { + $reqSearchData = $this->post('data'); + $reqData = $this->post('requestDetails'); + // print_r($reqSearchData);exit(); + + $getSearchDetails = $this->statusupdation_model->get_search_result($reqSearchData, $reqData);// Check if the employee exist + if ($getSearchDetails) + { + $getSearchDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getSearchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + // get Sem/year for the respective course + public function getSemYearForCourse_post() { + $reqData = $this->post('data'); + + $getSemYeatList = $this->statusupdation_model->get_semyear_result($reqData);// Check if the employee exist + if ($getSemYeatList) + { + $getSemYeatList['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getSemYeatList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + } + + // update the study material Status + public function updateStudentMaterialStatus_post() { + $reqData = $this->post('data'); + $reqDetails = $this->post('requestDetails'); + + $time = date('Y-m-d H:i:s'); + $dateTime = $time; + + $count = count($reqData); + // echo $reqDetails['localUserID'];exit(); + + for($i=0; $i < $count; $i++) { + $data[] = array( + 'StudentID' => $reqData[$i]['StudentID'], + 'CourseID' => $reqData[$i]['CourseID'], + 'BranchCode' => $reqData[$i]['BranchCode'], + 'ListCode' => $reqData[$i]['ListCode'], + 'SDate' => $reqData[$i]['SDate'], + 'Coursedetail' => $reqData[$i]['Coursedetail'], + 'Comments' => $reqData[$i]['Comments'], + 'CreatedBy' => $reqDetails['localUserID'], + 'CreatedOn' => $dateTime, + ); + } + + $updateStudentMaterialSta = $this->statusupdation_model->update_semyear($data);// Check if the employee exist + if ($updateStudentMaterialSta) + { + $updateStudentMaterialSta['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateStudentMaterialSta, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + // update Answer booklet status + public function updateAnswerBookLetStatus_post() { + $reqData = $this->post('data'); + $reqDetails = $this->post('requestDetails'); + + $time = date('Y-m-d H:i:s'); + $dateTime = $time; + + $count = count($reqData); + // echo $reqDetails['localUserID'];exit(); + + for($i=0; $i < $count; $i++) { + $data[] = array( + 'StudentID' => $reqData[$i]['StudentID'], + 'CourseID' => $reqData[$i]['CourseID'], + 'BranchCode' => $reqData[$i]['BranchCode'], + 'ListCode' => $reqData[$i]['ListCode'], + 'AnsDate' => $reqData[$i]['SDate'], + 'Coursedetail' => $reqData[$i]['Coursedetail'], + 'Comments' => $reqData[$i]['Comments'], + 'CreatedBy' => $reqDetails['localUserID'], + 'CreatedOn' => $dateTime, + ); + } + + $updateAnswerBookletStat = $this->statusupdation_model->update_answerbooklet($data);// Check if the employee exist + if ($updateAnswerBookletStat) + { + $updateAnswerBookletStat['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateAnswerBookletStat, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + // get certification type list + public function getCertificateList_post() { + $reqData = $this->post('data'); + + $certificateList = $this->statusupdation_model->get_certificate_list();// Check if the employee exist + if ($certificateList) + { + $certificateList['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($certificateList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + } + + // update certification status + public function updateCertificationStatus_post() { + $reqData = $this->post('data'); + $reqDetails = $this->post('requestDetails'); + + $time = date('Y-m-d H:i:s'); + $dateTime = $time; + + $count = count($reqData); + // echo $reqDetails['localUserID'];exit(); + + for($i=0; $i < $count; $i++) { + $data[] = array( + 'StudentID' => $reqData[$i]['StudentID'], + 'CourseID' => $reqData[$i]['CourseID'], + 'BranchCode' => $reqData[$i]['BranchCode'], + 'ListCode' => $reqData[$i]['ListCode'], + 'CDate' => $reqData[$i]['SDate'], + 'Coursedetail' => $reqData[$i]['Coursedetail'], + 'Comments' => $reqData[$i]['Comments'], + 'CreatedBy' => $reqDetails['localUserID'], + 'CreatedOn' => $dateTime, + 'CertificationType' => $reqData[$i]['CertificateType'], + 'CertificationNo' =>$reqData[$i]['CertificateNumber'], + ); + } + + $updateCertificateStatus = $this->statusupdation_model->update_certificateStatus($data);// Check if the employee exist + if ($updateCertificateStatus) + { + $updateCertificateStatus['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateCertificateStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + // update application status + public function updateApplicationStatus_post() { + $reqData = $this->post('data'); + $reqDetails = $this->post('requestDetails'); + + $time = date('Y-m-d H:i:s'); + $dateTime = $time; + + $count = count($reqData); + // echo $reqDetails['localUserID'];exit(); + + for($i=0; $i < $count; $i++) { + $data[] = array( + 'StudentID' => $reqData[$i]['StudentID'], + 'CourseID' => $reqData[$i]['StudentID'], + 'BranchCode' => $reqData[$i]['BranchCode'], + 'ListCode' => $reqData[$i]['ListCode'], + 'AppDate' => $reqData[$i]['SDate'], + 'Comments' => $reqData[$i]['Comments'], + 'CreatedBy' => $reqDetails['localUserID'], + 'CreatedOn' => $dateTime, + ); + } + + $updateApplicationStatus = $this->statusupdation_model->update_applicationStatus($data);// Check if the employee exist + if ($updateApplicationStatus) + { + $updateApplicationStatus['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($updateApplicationStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + + // get Status list based on the required activity + public function getStatusListForUpdate_post() { + $reqData = $this->post('data'); + $reqDetails = $this->post('statusFor'); + + $getStatusList = $this->statusupdation_model->get_status_list($reqDetails);// Check if the employee exist + if ($getStatusList) + { + $getStatusList['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getStatusList, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No list were found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + } + +} diff --git a/Apollo/api/application/models/StatusUpdation_model.php b/Apollo/api/application/models/StatusUpdation_model.php new file mode 100644 index 00000000..e5d7ef30 --- /dev/null +++ b/Apollo/api/application/models/StatusUpdation_model.php @@ -0,0 +1,286 @@ +db->select('ListCode, ListName'); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from('T_PickListDetails'); + $this->db->where('ListCode', 'S034'); + $staDetails = $this->db->get(); + $statusDetails = $staDetails->result(); + if (count($statusDetails) > 0) { + $results['statusList'] = true; + $results['statusList_details'] = $statusDetails; + } else { + $results['statusList'] = false; + $results['message'] = 'No record found'; + } + return $results; + } + + // update Application status + public function update_applicationStatus($arr) { + $this->db->insert_batch('T_ApplicationStatus', $arr); + if ($this->db->affected_rows() >= 1) { + $result['addStatus'] = true; + $result['message'] = "Successfully Application Status Updated"; + } else { + $result['addStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + return $result; + } + + // update certificate stauts + public function update_certificateStatus($arr) { + // $dateToMsg = $arr[0]['CDate']; + $this->db->insert_batch('T_CertificationStatus', $arr); + if ($this->db->affected_rows() >= 1) { + if((get_status_name_ListCode($arr[0]['ListCode'] == 'Received' || 'received') || (get_status_name_ListCode($arr[0]['ListCode'] == 'Issued' || 'issued') ) { + $dateToMsg = $arr[0]['CDate']; + $mesg = "Your new password for logging into Apollo student portal is $dateToMsg'. Please change the password as soon as you login."; + $this->smssend($arr, $mesg); + } + $result['addStatus'] = true; + $result['message'] = "Successfully Certification Status Updated"; + } else { + $result['addStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + return $result; + } + + // get certificate list + public function get_certificate_list() { + $this->db->select('*'); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from('T_CertificationMaster'); + $this->db->where('IsActive', 1); + $cerfDetails = $this->db->get(); + $certificateDetails = $cerfDetails->result(); + if (count($certificateDetails) > 0) { + $results['certificateStatus'] = true; + $results['certificate_details'] = $certificateDetails; + } else { + $results['certificateStatus'] = false; + $results['message'] = 'No record found'; + } + return $results; + } + + + // self function for getting registered mobile for sms + public function get_registered_mobile($num) { + $this->db->select('MobileNumber'); + $this->db->from(STUDENTS); + $this->db->where('StudentID', $num); + $roleDetails = $this->db->get()->first_row(); + return $roleDetails->MobileNumber; + } + + // self function for getting the status for the LISTCODE + public function get_status_name_ListCode($listCode) { + $this->db->select('ListName'); + $this->db->from(PICK_LIST_DETAILS); + $this->db->where('ListCode', $listCode); + $statusDetails = $this->db->get()->first_row(); + return $statusDetails->ListName; + } + + // update answer booklet status + public function update_answerbooklet($arr) { + // print_r($arr);exit(); + $this->db->insert_batch('T_AnswerBookletStatus', $arr); + if ($this->db->affected_rows() >= 1) { + // $this->smssend($arr); + $result['addStatus'] = true; + $result['message'] = "Successfully Answer Booklet Status Updated"; + } else { + $result['addStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + return $result; + } + + // update study material status + public function update_semyear($arr) { + + $this->db->insert_batch('T_StudyMaterialStatus', $arr); + if ($this->db->affected_rows() >= 1) { + if((get_status_name_ListCode($arr[0]['ListCode'] == 'Received' || 'received') || (get_status_name_ListCode($arr[0]['ListCode'] == 'Issued' || 'issued') ) { + $dateToMsg = $arr[0]['SDate']; + $mesg = "Your new password for logging into Apollo student portal is $dateToMsg'. Please change the password as soon as you login."; + $this->smssend($arr, $mesg); + } + // $this->smssend($arr); + $result['addStatus'] = true; + $result['message'] = "Successfully Study Material Status Updated"; + } else { + $result['addStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + } + return $result; + } + + // get sem/Year for the course + public function get_semyear_result($reqData) { + $subQuery = "SELECT CF.Sem_Year, CF.ID + FROM ".COURSE_FEES." as CF + WHERE + CF.CourseID = '$reqData' + AND CF.ProgramType ='Y001'"; + + $queryDetails = $this->db->query($subQuery); + $results['semYearResult'] = true; + $results['semYear_result_details'] = $queryDetails->result(); + + return $results; + } + + // get serach result + public function get_search_result($reqData, $req) { + + // print_r($reqData['University']); + // print_r($req); + // exit(); + $University = $reqData['University']; + $Course = $reqData['Course']; + $Batch = $reqData['Batch']; + + $subQuery = "SELECT S.* + FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID + WHERE + SC.UniversityID LIKE '%$University%' + AND SC.CourseID LIKE '%$Course%' + AND SC.BatchCode LIKE '%$Batch%' + AND S.IsActive = '1' + AND SC.IsActive = '1'"; + + $queryDetails = $this->db->query($subQuery); + $results['searchResult'] = true; + $results['search_result_details'] = $queryDetails->result(); + + return $results; + } + + // get list of universities, course, batch + public function get_university_course_batch() { + $this->db->select('t1.UniversityID, t1.UniversityName'); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from(''.UNIVERSITY. ' as t1'); + $this->db->where('IsActive', 1); + // $this->db->join('' . COURSE . ' as t2', 't2.UniversityID = t1.UniversityID', 'LEFT'); + $univDetails = $this->db->get(); + $universityDetails = $univDetails->result(); + $endResult = []; + foreach($universityDetails as $clip){ + // University Details + $resultArr['UniversityID'] = $clip->UniversityID; + $resultArr['UniversityName'] = $clip->UniversityName; + + // Course Details + $this->db->select('t2.CourseID, t2.CourseName'); + $this->db->from(''.COURSE. ' as t2'); + $this->db->where('t2.UniversityID', $clip->UniversityID); + $this->db->where('t2.IsActive', 1); + $courDetails = $this->db->get(); + $courseDetails = $courDetails->result(); + $resultArr['Course'] =$courseDetails; + + // Batch Details + $this->db->select('t3.BatchName, t3.BatchCode'); + $this->db->from(''.BATCH. ' as t3'); + $this->db->where('t3.UniversityID', $clip->UniversityID); + $this->db->where('t3.IsActive', 1); + $batDetails = $this->db->get(); + $batchDetails = $batDetails->result(); + $resultArr['Batch'] =$batchDetails; + array_push($endResult, $resultArr); + } + $results['univList'] = true; + $results['university_details'] = $endResult; + return $results; + } + + + // http://www.24x7sms.com/downloads/24X7SMS_http_API2.0.pdf + // API Key : xegCdYUIMf3 + + // Your new password for logging into Apollo student portal is (Password). Please change the password as soon as you login. + // This is the template to be used. + + public function smssend($arr, $msg) + { + $number =array(); + foreach($arr as $ar){ + $mobi = $this->get_registered_mobile($ar['StudentID']); + array_push($number, "91$mobi"); + } + $mobile = implode(',', $number); + // $message ="Your new password for logging into Apollo student portal is SAMPLE. Please change the password as soon as you login."; + // $mobile = "91$mobile"; + + $message = urlencode($msg); + $ch=curl_init(); + curl_setopt($ch,CURLOPT_URL,"https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=".$mobile."&SenderID=APOLLO&Message=".$message."&ServiceName=TEMPLATE_BASED"); + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + $output =curl_exec($ch); + + // print_r($output);exit(); + curl_close($ch); + return $output; + } + + // public function mailsend() { + // //Load email library + // $this->load->library('email'); + + // //SMTP & mail configuration + // $config = array( + // 'protocol' => 'smtp', + // 'smtp_host' => 'ssl://smtp.example.com', + // 'smtp_port' => 465, + // 'smtp_user' => 'email@example.com', + // 'smtp_pass' => 'email_password', + // 'mailtype' => 'html', + // 'charset' => 'utf-8' + // ); + // $this->email->initialize($config); + // $this->email->set_mailtype("html"); + // $this->email->set_newline("\r\n"); + + // //Email content + // $htmlContent = '

Sending email via SMTP server

'; + // $htmlContent .= '

This email has sent via SMTP server from CodeIgniter application.

'; + + // // Email body load the html template + // // $body = $this->load->view('emails/anillabs.php',$data,TRUE); + + + // $this->email->to('recipient@example.com'); + // $this->email->from('sender@example.com','MyWebsite'); + // $this->email->subject('How to send email via SMTP server in CodeIgniter'); + // $this->email->message($htmlContent); + + // //Send email + // $this->email->send(); + // } + + +} \ No newline at end of file diff --git a/Apollo/assets/js/controllers/answerBookletStatusCtrl.js b/Apollo/assets/js/controllers/answerBookletStatusCtrl.js new file mode 100644 index 00000000..5d5539f3 --- /dev/null +++ b/Apollo/assets/js/controllers/answerBookletStatusCtrl.js @@ -0,0 +1,336 @@ +'use strict'; +/*** controller for Wizard Form example***/ +app.controller('answerBookletStatusCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', function ($scope, toaster, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie) { + + /** + * Answer Booklet status update search + * by : kdk + */ + + + // get local client details + var localDetail = JSON.parse(localStorage.getItem('localObj')); + var localDetails = ipCookie('cookiechk'); + const localUpdateStatus = 'ANSWERBOOKLET_STATUS'; + + $scope.init = function () { + $scope.getUniversityList(); + } + + $scope.searchData = { + 'University': '', + 'Course': '', + 'Batch': '', + 'Mobile': '', + 'Name': '' + } + + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '' + } + + $scope.universityData = ''; + $scope.getUniversityList = function () { + var empListreq = { + method: 'POST', + url: apiPoint.url + 'getUniveCourseBratch/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: localDetails + } + }; + $http(empListreq).then(function (response) { + if (response.data.univList) { + $scope.universityData = response.data.university_details; + } else { + } + }); + }; + + $scope.getUniveId = function (univ) { + let name = JSON.parse(univ); + $scope.searchData.University = name.UniversityID; + $scope.searchData.Course = ''; + $scope.searchData.Batch = ''; + $scope.courseData = name.Course; + $scope.batchData = name.Batch; + $scope.OpenWindowStatus = false; + $scope.getSearch(); + }; + + $scope.getValueChange = function () { + $scope.getSearch(); + } + + // $scope.dealWithItem = function (item) { + // alert(JSON.stringify(item)); + // } + + $scope.searchResultDetails = ''; + $scope.searchLoading = false; + $scope.searchResultLength = 0; + $scope.getSearch = function () { + $scope.OpenWindowStatus = false; + // alert(JSON.stringify($scope.searchData)); + $scope.searchLoading = true; + var getSearchDetails = { + method: 'POST', + url: apiPoint.url + 'getSearchAutoDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: $scope.searchData, + requestDetails: localDetails + } + }; + $http(getSearchDetails).then(function (response) { + if (response.data.searchResult) { + $scope.searchResultStatus = response.data.searchResult; + $scope.searchLoading = false; + let searchResultDetailsBef = response.data.search_result_details; + const filterAddSelect = searchResultDetailsBef.filter(val => { + val['Selected'] = false; + return val; + }); + $scope.searchResultDetails = filterAddSelect; + $scope.searchResultLength = Object.keys($scope.searchResultDetails).length; + } else { + $scope.searchLoading = false; + } + }); + } + + // mobile number search functionlity + $scope.mySearchChangeFunc = function(val) { + if( val > 0) { + $scope.allSelectedHide = true; + $scope.allSelected('undefined'); + $scope.OpenWindowStatus = false; + } else { + $scope.allSelected('undefined'); + $scope.allSelectedHide = false; + } + } + // End: mobile number search functionlity + + // select all or individual functionality + + var getAllSelected = function () { + var selectedItems = $scope.searchResultDetails.filter(function (item) { + return item.Selected; + }); + + return selectedItems.length === $scope.searchResultDetails.length; + } + + var setAllSelected = function (value) { + angular.forEach($scope.searchResultDetails, function (item) { + item.Selected = value; + }); + } + + $scope.allSelected = function (value) { + if (value !== undefined) { + return setAllSelected(value); + } else { + return getAllSelected(); + } + } + + // End: select all or individual functionality + + + // open popup window onselct checkbox + $scope.OpenWindowStatus = false; + $scope.openUpdateWind = function () { + var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + if (item.Selected === true) { return true; } + }); + const courseLocal = $scope.searchData.Course; + $scope.getSemYearList(courseLocal); + $scope.getStatusList(); + // alert($scope.searchData.Course); + if (ItemsSelected.length) { + $scope.OpenWindowStatus = true; + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '' + } + } else { + $scope.OpenWindowStatus = false; + } + } + + // get status list for this activity + $scope.getStatusList = function () { + var getStatusL = { + method: 'POST', + url: apiPoint.url + 'getStatusListForUpdate/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + statusFor: 'studyMaterial', + data: localUpdateStatus + } + }; + $http(getStatusL).then(function (response) { + if (response.data.statusList) { + $scope.statusDetailsList = response.data.statusList_details; + // $scope.searchLoading = false; + } else { + // $scope.searchLoading = false; + } + }); + } + + // get Sem/Year based on the course select + $scope.getSemYearList = function (courseID) { + $scope.semYearList = ''; + if (courseID !== '' && courseID !== undefined) { + var getSemYear = { + method: 'POST', + url: apiPoint.url + 'getSemYearForCourse/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: courseID + } + }; + $http(getSemYear).then(function (response) { + if (response.data.semYearResult) { + $scope.semYearList = response.data.semYear_result_details; + } else { + $scope.semYearList = ''; + } + }); + + } else { + + } + } + + + // $scope.updateItems = function () { + // var studentForUpdate = []; + // var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + // if (item.Selected === true) { + // let getStudentID = new getStudentForUpdateDetails(item.StudentID); + // studentForUpdate.push(getStudentID); + // return true; + // } + // }); + // function getStudentForUpdateDetails(id) { + // this.iD = id; + // } + // alert(JSON.stringify($scope.myStatusModel)); + // alert(JSON.stringify(studentForUpdate)); + // } + + $scope.statusUpdate = { + submit: function (form, myStatusModel) { + 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(); + // swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); + } else { + var studentForUpdate = []; + let formate = "dd-MM-yyyy"; + $scope.myStatusModel.dateOn = $filter('date')(new Date($scope.myStatusModel.dateOn), formate); + var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + if (item.Selected === true) { + let getStudentID = new getStudentForUpdateDetails(item.StudentID); + studentForUpdate.push(getStudentID); + return true; + } + }); + function getStudentForUpdateDetails(id) { + this.StudentID = id; + this.CourseID = $scope.myStatusModel.semYear; + this.BranchCode = localDetails.localBranchID; + this.ListCode = $scope.myStatusModel.staus; + this.SDate = $scope.myStatusModel.dateOn; + this.Coursedetail = id; + this.Comments = $scope.myStatusModel.comment; + } + // alert(JSON.stringify($scope.myStatusModel)); + // alert(JSON.stringify(studentForUpdate)); + + var updateStudyMaterial = { + method: 'POST', + url: apiPoint.url + 'updateAnswerBookLetStatus/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: studentForUpdate, + requestDetails : localDetails + } + }; + $http(updateStudyMaterial).then(function (response) { + if (response.data.addStatus) { + swal("Success!", response.data.message, "success"); + // for success state + $scope.allSelected('undefined'); + $scope.OpenWindowStatus = false; + } else { + swal("Failed!", response.data.message, "error"); + } + }); + } + }, + reset: function (form) { + form.$setPristine(true); + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '' + } + } + } + + + // check unchek for table values + + + + // $scope.CheckUncheckAll = function () { + + // for (var i = 0; i < $scope.searchResultDetails.length; i++) { + // $scope.searchResultDetails[i].Selected = $scope.IsAllChecked; + // } + // }; + + // $scope.CheckUncheckHeader = function () { + // $scope.IsAllChecked = true; + // for (var i = 0; i < $scope.searchResultDetails.length; i++) { + // if (!$scope.searchResultDetails[i].Selected) { + // $scope.IsAllChecked = false; + // break; + // } + // }; + // }; + + // $scope.CheckUncheckHeader(); +}]); diff --git a/Apollo/assets/js/controllers/applicationStatusCtrl.js b/Apollo/assets/js/controllers/applicationStatusCtrl.js new file mode 100644 index 00000000..ed4ea2ad --- /dev/null +++ b/Apollo/assets/js/controllers/applicationStatusCtrl.js @@ -0,0 +1,336 @@ +'use strict'; +/*** controller for Wizard Form example***/ +app.controller('applicationStatusCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', function ($scope, toaster, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie) { + + /** + * Application status update search + * by : kdk + */ + + + // get local client details + var localDetail = JSON.parse(localStorage.getItem('localObj')); + var localDetails = ipCookie('cookiechk'); + const localUpdateStatus = 'APPICATION_STATUS'; + + $scope.init = function () { + $scope.getUniversityList(); + } + + $scope.searchData = { + 'University': '', + 'Course': '', + 'Batch': '', + 'Mobile': '', + 'Name': '' + } + + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '' + } + + $scope.universityData = ''; + $scope.getUniversityList = function () { + var empListreq = { + method: 'POST', + url: apiPoint.url + 'getUniveCourseBratch/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: localDetails + } + }; + $http(empListreq).then(function (response) { + if (response.data.univList) { + $scope.universityData = response.data.university_details; + } else { + } + }); + }; + + $scope.getUniveId = function (univ) { + let name = JSON.parse(univ); + $scope.searchData.University = name.UniversityID; + $scope.searchData.Course = ''; + $scope.searchData.Batch = ''; + $scope.courseData = name.Course; + $scope.batchData = name.Batch; + $scope.OpenWindowStatus = false; + $scope.getSearch(); + }; + + $scope.getValueChange = function () { + $scope.getSearch(); + } + + // $scope.dealWithItem = function (item) { + // alert(JSON.stringify(item)); + // } + + $scope.searchResultDetails = ''; + $scope.searchLoading = false; + $scope.searchResultLength = 0; + $scope.getSearch = function () { + $scope.OpenWindowStatus = false; + // alert(JSON.stringify($scope.searchData)); + $scope.searchLoading = true; + var getSearchDetails = { + method: 'POST', + url: apiPoint.url + 'getSearchAutoDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: $scope.searchData, + requestDetails: localDetails + } + }; + $http(getSearchDetails).then(function (response) { + if (response.data.searchResult) { + $scope.searchResultStatus = response.data.searchResult; + $scope.searchLoading = false; + let searchResultDetailsBef = response.data.search_result_details; + const filterAddSelect = searchResultDetailsBef.filter(val => { + val['Selected'] = false; + return val; + }); + $scope.searchResultDetails = filterAddSelect; + $scope.searchResultLength = Object.keys($scope.searchResultDetails).length; + } else { + $scope.searchLoading = false; + } + }); + } + + // mobile number search functionlity + $scope.mySearchChangeFunc = function(val) { + if( val > 0) { + $scope.allSelectedHide = true; + $scope.allSelected('undefined'); + $scope.OpenWindowStatus = false; + } else { + $scope.allSelected('undefined'); + $scope.allSelectedHide = false; + } + } + // End: mobile number search functionlity + + // select all or individual functionality + + var getAllSelected = function () { + var selectedItems = $scope.searchResultDetails.filter(function (item) { + return item.Selected; + }); + + return selectedItems.length === $scope.searchResultDetails.length; + } + + var setAllSelected = function (value) { + angular.forEach($scope.searchResultDetails, function (item) { + item.Selected = value; + }); + } + + $scope.allSelected = function (value) { + if (value !== undefined) { + return setAllSelected(value); + } else { + return getAllSelected(); + } + } + + // End: select all or individual functionality + + + // open popup window onselct checkbox + $scope.OpenWindowStatus = false; + $scope.openUpdateWind = function () { + var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + if (item.Selected === true) { return true; } + }); + const courseLocal = $scope.searchData.Course; + $scope.getSemYearList(courseLocal); + $scope.getStatusList(); + // alert($scope.searchData.Course); + if (ItemsSelected.length) { + $scope.OpenWindowStatus = true; + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '' + } + } else { + $scope.OpenWindowStatus = false; + } + } + + // get status list for this activity + $scope.getStatusList = function () { + var getStatusL = { + method: 'POST', + url: apiPoint.url + 'getStatusListForUpdate/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + statusFor: 'studyMaterial', + data: localUpdateStatus + } + }; + $http(getStatusL).then(function (response) { + if (response.data.statusList) { + $scope.statusDetailsList = response.data.statusList_details; + // $scope.searchLoading = false; + } else { + // $scope.searchLoading = false; + } + }); + } + + // get Sem/Year based on the course select + $scope.getSemYearList = function (courseID) { + $scope.semYearList = ''; + if (courseID !== '' && courseID !== undefined) { + var getSemYear = { + method: 'POST', + url: apiPoint.url + 'getSemYearForCourse/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: courseID + } + }; + $http(getSemYear).then(function (response) { + if (response.data.semYearResult) { + $scope.semYearList = response.data.semYear_result_details; + } else { + $scope.semYearList = ''; + } + }); + + } else { + + } + } + + + // $scope.updateItems = function () { + // var studentForUpdate = []; + // var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + // if (item.Selected === true) { + // let getStudentID = new getStudentForUpdateDetails(item.StudentID); + // studentForUpdate.push(getStudentID); + // return true; + // } + // }); + // function getStudentForUpdateDetails(id) { + // this.iD = id; + // } + // alert(JSON.stringify($scope.myStatusModel)); + // alert(JSON.stringify(studentForUpdate)); + // } + + $scope.statusUpdate = { + submit: function (form, myStatusModel) { + 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(); + // swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); + } else { + var studentForUpdate = []; + let formate = "dd-MM-yyyy"; + $scope.myStatusModel.dateOn = $filter('date')(new Date($scope.myStatusModel.dateOn), formate); + var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + if (item.Selected === true) { + let getStudentID = new getStudentForUpdateDetails(item.StudentID); + studentForUpdate.push(getStudentID); + return true; + } + }); + function getStudentForUpdateDetails(id) { + this.StudentID = id; + this.CourseID = $scope.myStatusModel.semYear; + this.BranchCode = localDetails.localBranchID; + this.ListCode = $scope.myStatusModel.staus; + this.SDate = $scope.myStatusModel.dateOn; + this.Coursedetail = id; + this.Comments = $scope.myStatusModel.comment; + } + // alert(JSON.stringify($scope.myStatusModel)); + // alert(JSON.stringify(studentForUpdate)); + + var updateStudyMaterial = { + method: 'POST', + url: apiPoint.url + 'updateApplicationStatus/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: studentForUpdate, + requestDetails : localDetails + } + }; + $http(updateStudyMaterial).then(function (response) { + if (response.data.addStatus) { + swal("Success!", response.data.message, "success"); + // for success state + $scope.allSelected('undefined'); + $scope.OpenWindowStatus = false; + } else { + swal("Failed!", response.data.message, "error"); + } + }); + } + }, + reset: function (form) { + form.$setPristine(true); + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '' + } + } + } + + + // check unchek for table values + + + + // $scope.CheckUncheckAll = function () { + + // for (var i = 0; i < $scope.searchResultDetails.length; i++) { + // $scope.searchResultDetails[i].Selected = $scope.IsAllChecked; + // } + // }; + + // $scope.CheckUncheckHeader = function () { + // $scope.IsAllChecked = true; + // for (var i = 0; i < $scope.searchResultDetails.length; i++) { + // if (!$scope.searchResultDetails[i].Selected) { + // $scope.IsAllChecked = false; + // break; + // } + // }; + // }; + + // $scope.CheckUncheckHeader(); +}]); diff --git a/Apollo/assets/js/controllers/certificationStatusCtrl.js b/Apollo/assets/js/controllers/certificationStatusCtrl.js new file mode 100644 index 00000000..d112a302 --- /dev/null +++ b/Apollo/assets/js/controllers/certificationStatusCtrl.js @@ -0,0 +1,387 @@ +'use strict'; +/*** controller for Wizard Form example***/ +app.controller('certificationStatusCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', function ($scope, toaster, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie) { + + /** + * Certification status update search + * by : kdk + */ + + + // get local client details + var localDetail = JSON.parse(localStorage.getItem('localObj')); + var localDetails = ipCookie('cookiechk'); + const localUpdateStatus = 'CERTIFICATION_STATUS'; + + $scope.init = function () { + $scope.getUniversityList(); + $scope.getCertificateList(); + } + + $scope.searchData = { + 'University': '', + 'Course': '', + 'Batch': '', + 'Mobile': '', + 'Name': '' + } + + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '', + 'certificatetype': '', + 'certificateNumber': '' + } + + // get University List + $scope.universityData = ''; + $scope.getUniversityList = function () { + var empListreq = { + method: 'POST', + url: apiPoint.url + 'getUniveCourseBratch/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: localDetails + } + }; + $http(empListreq).then(function (response) { + if (response.data.univList) { + $scope.universityData = response.data.university_details; + } else { + } + }); + }; + + //get certificates List + $scope.getCertificateList = function () { + var getCerfreg = { + method: 'POST', + url: apiPoint.url + 'getCertificateList/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: localDetails + } + }; + $http(getCerfreg).then(function (response) { + if (response.data.certificateStatus) { + $scope.certificateData = response.data.certificate_details; + // alert(JSON.stringify($scope.certificateData)); + } else { + } + }); + }; + + $scope.getUniveId = function (univ) { + let name = JSON.parse(univ); + $scope.searchData.University = name.UniversityID; + $scope.searchData.Course = ''; + $scope.searchData.Batch = ''; + $scope.courseData = name.Course; + $scope.batchData = name.Batch; + $scope.OpenWindowStatus = false; + $scope.getSearch(); + }; + + $scope.getValueChange = function () { + $scope.getSearch(); + } + + // $scope.dealWithItem = function (item) { + // alert(JSON.stringify(item)); + // } + + $scope.searchResultDetails = ''; + $scope.searchLoading = false; + $scope.searchResultLength = 0; + $scope.getSearch = function () { + $scope.OpenWindowStatus = false; + // alert(JSON.stringify($scope.searchData)); + $scope.searchLoading = true; + var getSearchDetails = { + method: 'POST', + url: apiPoint.url + 'getSearchAutoDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: $scope.searchData, + requestDetails: localDetails + } + }; + $http(getSearchDetails).then(function (response) { + if (response.data.searchResult) { + $scope.searchResultStatus = response.data.searchResult; + $scope.searchLoading = false; + let searchResultDetailsBef = response.data.search_result_details; + const filterAddSelect = searchResultDetailsBef.filter(val => { + val['Selected'] = false; + return val; + }); + $scope.searchResultDetails = filterAddSelect; + $scope.searchResultLength = Object.keys($scope.searchResultDetails).length; + } else { + $scope.searchLoading = false; + } + }); + } + + // mobile number search functionlity + $scope.mySearchChangeFunc = function(val) { + if( val > 0) { + $scope.allSelectedHide = true; + $scope.allSelected('undefined'); + $scope.OpenWindowStatus = false; + } else { + $scope.allSelected('undefined'); + $scope.allSelectedHide = false; + } + } + // End: mobile number search functionlity + + // select all or individual functionality + + // var getAllSelected = function () { + // var selectedItems = $scope.searchResultDetails.filter(function (item) { + // return item.Selected; + // }); + + // return selectedItems.length === $scope.searchResultDetails.length; + // } + + // var setAllSelected = function (value) { + // alert(value); + // angular.forEach($scope.searchResultDetails, function (item) { + // item.Selected = value; + // }); + // } + + // $scope.allSelected = function (value) { + // alert(value); + // if (value !== undefined) { + // return setAllSelected(value); + // } else { + // return getAllSelected(); + // } + // } + + //---------------------------------------------------> + + // Select one row in a table once + $scope.setOneSelect = function (value) { + // alert(value.Selected); + angular.forEach($scope.searchResultDetails, function (item) { + item.Selected = value; + }); + value.Selected = true; + $scope.OpenWindowStatus = true; + $scope.openUpdateWind(); + } + + // End: select all or individual functionality + + + // open popup window onselct checkbox + $scope.OpenWindowStatus = false; + $scope.openUpdateWind = function () { + var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + if (item.Selected === true) { return true; } + }); + const courseLocal = $scope.searchData.Course; + $scope.getSemYearList(courseLocal); + $scope.getStatusList(); + // alert($scope.searchData.Course); + if (ItemsSelected.length) { + $scope.OpenWindowStatus = true; + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '', + 'certificatetype': '', + 'certificateNumber': '' + } + } else { + $scope.OpenWindowStatus = false; + } + } + + // get status list for this activity + $scope.getStatusList = function () { + var getStatusL = { + method: 'POST', + url: apiPoint.url + 'getStatusListForUpdate/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + statusFor: 'studyMaterial', + data: localUpdateStatus + } + }; + $http(getStatusL).then(function (response) { + if (response.data.statusList) { + $scope.statusDetailsList = response.data.statusList_details; + // $scope.searchLoading = false; + } else { + // $scope.searchLoading = false; + } + }); + } + + // get Sem/Year based on the course select + $scope.getSemYearList = function (courseID) { + $scope.semYearList = ''; + if (courseID !== '' && courseID !== undefined) { + var getSemYear = { + method: 'POST', + url: apiPoint.url + 'getSemYearForCourse/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: courseID + } + }; + $http(getSemYear).then(function (response) { + if (response.data.semYearResult) { + $scope.semYearList = response.data.semYear_result_details; + } else { + $scope.semYearList = ''; + } + }); + + } else { + + } + } + + + // $scope.updateItems = function () { + // var studentForUpdate = []; + // var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + // if (item.Selected === true) { + // let getStudentID = new getStudentForUpdateDetails(item.StudentID); + // studentForUpdate.push(getStudentID); + // return true; + // } + // }); + // function getStudentForUpdateDetails(id) { + // this.iD = id; + // } + // alert(JSON.stringify($scope.myStatusModel)); + // alert(JSON.stringify(studentForUpdate)); + // } + + // Update the status For Certification + $scope.statusUpdate = { + submit: function (form, myStatusModel) { + 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(); + // swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); + } else { + var studentForUpdate = []; + let formate = "dd-MM-yyyy"; + $scope.myStatusModel.dateOn = $filter('date')(new Date($scope.myStatusModel.dateOn), formate); + var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + if (item.Selected === true) { + let getStudentID = new getStudentForUpdateDetails(item.StudentID); + studentForUpdate.push(getStudentID); + return true; + } + }); + alert(JSON.stringify(studentForUpdate)); + function getStudentForUpdateDetails(id) { + this.StudentID = id; + this.CourseID = $scope.myStatusModel.semYear; + this.BranchCode = localDetails.localBranchID; + this.ListCode = $scope.myStatusModel.staus; + this.SDate = $scope.myStatusModel.dateOn; + this.Coursedetail = id; + this.Comments = $scope.myStatusModel.comment; + this.CertificateType = $scope.myStatusModel.certificatetype; + this.CertificateNumber = $scope.myStatusModel.certificateNumber; + } + // alert(JSON.stringify($scope.myStatusModel)); + // alert(JSON.stringify(studentForUpdate)); + + var updateCertificateStatus = { + method: 'POST', + url: apiPoint.url + 'updateCertificationStatus/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: studentForUpdate, + requestDetails : localDetails + } + }; + $http(updateCertificateStatus).then(function (response) { + if (response.data.addStatus) { + swal("Success!", response.data.message, "success"); + // for success state + // $scope.allSelected('undefined'); + angular.forEach($scope.searchResultDetails, function (item) { + item.Selected = false; + }); + $scope.OpenWindowStatus = false; + } else { + swal("Failed!", response.data.message, "error"); + } + }); + } + }, + reset: function (form) { + form.$setPristine(true); + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '', + 'certificatetype': '', + 'certificateNumber': '' + } + } + } + + + // check unchek for table values + + + + // $scope.CheckUncheckAll = function () { + + // for (var i = 0; i < $scope.searchResultDetails.length; i++) { + // $scope.searchResultDetails[i].Selected = $scope.IsAllChecked; + // } + // }; + + // $scope.CheckUncheckHeader = function () { + // $scope.IsAllChecked = true; + // for (var i = 0; i < $scope.searchResultDetails.length; i++) { + // if (!$scope.searchResultDetails[i].Selected) { + // $scope.IsAllChecked = false; + // break; + // } + // }; + // }; + + // $scope.CheckUncheckHeader(); +}]); diff --git a/Apollo/assets/js/controllers/studentCtrl.js b/Apollo/assets/js/controllers/studentCtrl.js index abd6d383..1533ac1f 100755 --- a/Apollo/assets/js/controllers/studentCtrl.js +++ b/Apollo/assets/js/controllers/studentCtrl.js @@ -74,7 +74,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams", $scope.reverse = !$scope.reverse; //if true make it false and vice versa } - // get local cliend details + // get local client details var localDetail = JSON.parse(localStorage.getItem('localObj')); var localDetails = ipCookie('cookiechk'); diff --git a/Apollo/assets/js/controllers/studyMaterialStatusCtrl.js b/Apollo/assets/js/controllers/studyMaterialStatusCtrl.js index 0c181561..1ef08639 100755 --- a/Apollo/assets/js/controllers/studyMaterialStatusCtrl.js +++ b/Apollo/assets/js/controllers/studyMaterialStatusCtrl.js @@ -1,11 +1,337 @@ 'use strict'; /*** controller for Wizard Form example***/ -app.controller('studyMaterialStatusCtrl', ["$scope", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', function ($scope, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie) { +app.controller('studyMaterialStatusCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', function ($scope, toaster, $filter, ngTableParams, apiPoint, $http, SweetAlert, $state, md5, ipCookie) { /** - * Logined user profile view + * Study material status update search * by : kdk */ - + + // get local client details + var localDetail = JSON.parse(localStorage.getItem('localObj')); + var localDetails = ipCookie('cookiechk'); + const localUpdateStatus = 'STUDY_MATERIAL'; + + $scope.init = function () { + $scope.getUniversityList(); + } + + $scope.searchData = { + 'University': '', + 'Course': '', + 'Batch': '', + 'Mobile': '', + 'Name': '' + } + + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '' + } + + $scope.universityData = ''; + $scope.getUniversityList = function () { + var empListreq = { + method: 'POST', + url: apiPoint.url + 'getUniveCourseBratch/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: localDetails + } + }; + $http(empListreq).then(function (response) { + if (response.data.univList) { + $scope.universityData = response.data.university_details; + } else { + } + }); + }; + + $scope.getUniveId = function (univ) { + let name = JSON.parse(univ); + $scope.searchData.University = name.UniversityID; + $scope.searchData.Course = ''; + $scope.searchData.Batch = ''; + $scope.courseData = name.Course; + $scope.batchData = name.Batch; + $scope.OpenWindowStatus = false; + $scope.getSearch(); + }; + + $scope.getValueChange = function () { + $scope.getSearch(); + } + + // $scope.dealWithItem = function (item) { + // alert(JSON.stringify(item)); + // } + + $scope.searchResultDetails = ''; + $scope.searchLoading = false; + $scope.searchResultLength = 0; + $scope.getSearch = function () { + $scope.OpenWindowStatus = false; + // alert(JSON.stringify($scope.searchData)); + $scope.searchLoading = true; + var getSearchDetails = { + method: 'POST', + url: apiPoint.url + 'getSearchAutoDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: $scope.searchData, + requestDetails: localDetails + } + }; + $http(getSearchDetails).then(function (response) { + if (response.data.searchResult) { + $scope.searchResultStatus = response.data.searchResult; + $scope.searchLoading = false; + let searchResultDetailsBef = response.data.search_result_details; + const filterAddSelect = searchResultDetailsBef.filter(val => { + val['Selected'] = false; + return val; + }); + $scope.searchResultDetails = filterAddSelect; + $scope.searchResultLength = Object.keys($scope.searchResultDetails).length; + } else { + $scope.searchLoading = false; + } + }); + } + + // mobile number search functionlity + $scope.mySearchChangeFunc = function(val) { + if( val > 0) { + $scope.allSelectedHide = true; + $scope.allSelected('undefined'); + $scope.OpenWindowStatus = false; + } else { + $scope.allSelected('undefined'); + $scope.allSelectedHide = false; + $scope.OpenWindowStatus = false; + } + } + // End: mobile number search functionlity + + // select all or individual functionality + + var getAllSelected = function () { + var selectedItems = $scope.searchResultDetails.filter(function (item) { + return item.Selected; + }); + + return selectedItems.length === $scope.searchResultDetails.length; + } + + var setAllSelected = function (value) { + angular.forEach($scope.searchResultDetails, function (item) { + item.Selected = value; + }); + } + + $scope.allSelected = function (value) { + if (value !== undefined) { + return setAllSelected(value); + } else { + return getAllSelected(); + } + } + + // End: select all or individual functionality + + + // open popup window onselct checkbox + $scope.OpenWindowStatus = false; + $scope.openUpdateWind = function () { + var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + if (item.Selected === true) { return true; } + }); + const courseLocal = $scope.searchData.Course; + $scope.getSemYearList(courseLocal); + $scope.getStatusList(); + // alert($scope.searchData.Course); + if (ItemsSelected.length) { + $scope.OpenWindowStatus = true; + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '' + } + } else { + $scope.OpenWindowStatus = false; + } + } + + // get status list for this activity + $scope.getStatusList = function () { + var getStatusL = { + method: 'POST', + url: apiPoint.url + 'getStatusListForUpdate/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + statusFor: 'studyMaterial', + data: localUpdateStatus + } + }; + $http(getStatusL).then(function (response) { + if (response.data.statusList) { + $scope.statusDetailsList = response.data.statusList_details; + // $scope.searchLoading = false; + } else { + // $scope.searchLoading = false; + } + }); + } + + // get Sem/Year based on the course select + $scope.getSemYearList = function (courseID) { + $scope.semYearList = ''; + if (courseID !== '' && courseID !== undefined) { + var getSemYear = { + method: 'POST', + url: apiPoint.url + 'getSemYearForCourse/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: courseID + } + }; + $http(getSemYear).then(function (response) { + if (response.data.semYearResult) { + $scope.semYearList = response.data.semYear_result_details; + } else { + $scope.semYearList = ''; + } + }); + + } else { + + } + } + + + // $scope.updateItems = function () { + // var studentForUpdate = []; + // var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + // if (item.Selected === true) { + // let getStudentID = new getStudentForUpdateDetails(item.StudentID); + // studentForUpdate.push(getStudentID); + // return true; + // } + // }); + // function getStudentForUpdateDetails(id) { + // this.iD = id; + // } + // alert(JSON.stringify($scope.myStatusModel)); + // alert(JSON.stringify(studentForUpdate)); + // } + + $scope.statusUpdate = { + submit: function (form, myStatusModel) { + 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(); + // swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error"); + } else { + var studentForUpdate = []; + let formate = "dd-MM-yyyy"; + $scope.myStatusModel.dateOn = $filter('date')(new Date($scope.myStatusModel.dateOn), formate); + var ItemsSelected = $scope.searchResultDetails.filter(function (item) { + if (item.Selected === true) { + let getStudentID = new getStudentForUpdateDetails(item.StudentID); + studentForUpdate.push(getStudentID); + return true; + } + }); + function getStudentForUpdateDetails(id) { + this.StudentID = id; + this.CourseID = $scope.myStatusModel.semYear; + this.BranchCode = localDetails.localBranchID; + this.ListCode = $scope.myStatusModel.staus; + this.SDate = $scope.myStatusModel.dateOn; + this.Coursedetail = id; + this.Comments = $scope.myStatusModel.comment; + } + // alert(JSON.stringify($scope.myStatusModel)); + // alert(JSON.stringify(studentForUpdate)); + + var updateStudyMaterial = { + method: 'POST', + url: apiPoint.url + 'updateStudentMaterialStatus/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: studentForUpdate, + requestDetails : localDetails + } + }; + $http(updateStudyMaterial).then(function (response) { + if (response.data.addStatus) { + swal("Success!", response.data.message, "success"); + // for success state + $scope.allSelected('undefined'); + $scope.OpenWindowStatus = false; + } else { + swal("Failed!", response.data.message, "error"); + } + }); + } + }, + reset: function (form) { + form.$setPristine(true); + $scope.myStatusModel = { + 'semYear': '', + 'staus': '', + 'dateOn': '', + 'comment': '' + } + } + } + + + // check unchek for table values + + + + // $scope.CheckUncheckAll = function () { + + // for (var i = 0; i < $scope.searchResultDetails.length; i++) { + // $scope.searchResultDetails[i].Selected = $scope.IsAllChecked; + // } + // }; + + // $scope.CheckUncheckHeader = function () { + // $scope.IsAllChecked = true; + // for (var i = 0; i < $scope.searchResultDetails.length; i++) { + // if (!$scope.searchResultDetails[i].Selected) { + // $scope.IsAllChecked = false; + // break; + // } + // }; + // }; + + // $scope.CheckUncheckHeader(); }]); diff --git a/Apollo/assets/views/status-update/answer_booklet_status.html b/Apollo/assets/views/status-update/answer_booklet_status.html new file mode 100644 index 00000000..0a705799 --- /dev/null +++ b/Apollo/assets/views/status-update/answer_booklet_status.html @@ -0,0 +1,262 @@ + +
+
+
+

{{ mainTitle }}

+ +
+
+
+
+ + +
+
+
+ +
+ +
+
+ +
+ + + +
+ + +
+ + + +
+ +
+ + + +
+ + +
+
+
+
+
+
+
+
+ + + +
+ +
+ +
+

fetching...

+
+ +
+ +
+
+

No + records found...

+
+ +
+
+

No + records found...

+
+ +
+ +
+
+
+ +

+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ + First Name + + Last Name + + MobileNumber + + Email ID + +
+ + {{p.Firstname}}{{p.Lastname}}{{p.MobileNumber}}{{p.EmailID}}
+ + +
+
+ +
+
+
+
+
+
+
+
+
+ + + + Sem/Year is Required + +
+
+ + + + Status is Required + +
+ +
+
+ + + + + Date is required. + Enter a Valid Date +
+
+
+
+
+ + +