From de0d85c093a5240ad49a9de7da78e6c293034573 Mon Sep 17 00:00:00 2001 From: resicovenba Date: Thu, 23 Nov 2017 19:25:35 +0530 Subject: [PATCH] add university --- Apollo/api/application/config/routes.php | 4 +- .../controllers/University_Controller.php | 64 +- .../application/models/University_model.php | 30 +- .../assets/js/controllers/universityCtrl.js | 59 +- Apollo/assets/views/dashboard.html | 677 +----------------- Apollo/assets/views/university.html | 6 +- 6 files changed, 173 insertions(+), 667 deletions(-) diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index a4247a73..83e5cd2b 100644 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -78,7 +78,9 @@ $route['addLeadTrackingDetails'] = 'Call_Tracking_Controller/addLeadTrackingDeta $route['getTrackingDetails'] = 'Call_Tracking_Controller/getTrackingDetails'; $route['updateFollowupDetails'] = 'Call_Tracking_Controller/updateFollowupDetails'; $route['loadFollowupDetails'] = 'Call_Tracking_Controller/loadFollowupDetails'; -$route['getUniversity'] = 'University_Controller/getUniversity'; +$route['insertUniversity'] = 'University_Controller/insertUniversity'; +$route['getUniversity'] = 'University_Controller/getUniversity'; +$route['chkUnivIdExistDetail'] = 'University_Controller/chkUnivIdExistDetail'; $route['updateUniversityDetail'] = 'University_Controller/updateUniversityDetail'; $route['getCourseDetails'] = 'Course_Controller/getCourseDetails'; $route['addCourseDetails'] = 'Course_Controller/addCourseDetails'; diff --git a/Apollo/api/application/controllers/University_Controller.php b/Apollo/api/application/controllers/University_Controller.php index 2d35e64c..9da2bf8b 100644 --- a/Apollo/api/application/controllers/University_Controller.php +++ b/Apollo/api/application/controllers/University_Controller.php @@ -28,13 +28,14 @@ class University_Controller extends REST_Controller { { // Construct the parent class parent::__construct(); - $this->methods['getUniversity_post']['limit'] = 100; - // load the employee model + $this->methods['getUniversity_post']['limit'] = 100; + $this->methods['chkUnivIdExistDetail_post']['limit'] = 100; + // load the university model $this->load->model('University_model', 'university_model'); } + // get university details public function getUniversity_post() { - $reqData = $this->post('data'); $loginUserId = $reqData['localUserID']; $loginUserBranchId = $reqData['localBranchID']; @@ -57,6 +58,7 @@ class University_Controller extends REST_Controller { } + //update university details public function updateUniversityDetail_post() { $reqData = $this->post('data'); @@ -89,4 +91,60 @@ class University_Controller extends REST_Controller { } } + + // check university details exist + public function chkUnivIdExistDetail_post() { + + $data = $this->post('data'); + $check = $this->post('check'); + + $checkUnivExist = $this->university_model->check_Univ_Exist($data, $check);// Check if the employee exist + if ($checkUnivExist) + { + $checkUnivExist['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($checkUnivExist, 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 + } + + } + + // insert university details + public function insertUniversity_post() { + $reqData = $this->post('data'); + $req['CreatedBy'] = $this->post('createdBy'); + $date = date('Y-m-d H:i:s'); + $req['CreatedOn'] = $date; + $req['UniversityName']= $reqData['UniversityName']; + $req['UniversityShortName']= $reqData['UniversityShortName']; + $req['MobileNumber']= $reqData['MobileNumber']; + $req['EmailID']= $reqData['EmailID']; + $req['Address']= $reqData['Address']; + $req['IsActive']= $reqData['switchsetting']; + $req['UniversityID']= $reqData['UniversityID']; + + $insertUniv = $this->university_model->insert_Univ($req);// Check if the employee exist + if ($insertUniv) + { + $insertUniv['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($insertUniv, 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/University_model.php b/Apollo/api/application/models/University_model.php index 7b80f5d7..7d570ecd 100644 --- a/Apollo/api/application/models/University_model.php +++ b/Apollo/api/application/models/University_model.php @@ -19,7 +19,6 @@ class University_model extends CI_Model */ // get university list - public function get_university_list() { $this->db->select('*'); $this->db->order_by('CreatedOn', 'DESC'); @@ -36,6 +35,7 @@ class University_model extends CI_Model return $results; } + // update univesity details public function update_university_details($updateFor, $Arr) { $this->db->where('UniversityID', $updateFor); $this->db->update(UNIVERSITY, $Arr); @@ -48,5 +48,33 @@ class University_model extends CI_Model } return $result; } + + // check exist details + public function check_Univ_Exist($data, $check) { + // check update for mobile number + $this->db->select('*'); + $this->db->from(UNIVERSITY); + $this->db->where('UniversityID', $data); + if ($this->db->get()->first_row()) { + $result['existUniv'] = true; + $result['message'] = "This University Id is already exist!"; + } else { + $result['existUniv'] = false; + } + return $result; + } + + // add university details + public function insert_Univ($arr) { + $this->db->insert(UNIVERSITY, $arr); + if ($this->db->affected_rows() == '1') { + $result['addUniv'] = true; + $result['message'] = "Successfully University details added"; + } else { + $result['addUniv'] = false; + $result['message'] = "Something went wrong.please try again"; + } + return $result; + } } \ No newline at end of file diff --git a/Apollo/assets/js/controllers/universityCtrl.js b/Apollo/assets/js/controllers/universityCtrl.js index 2928919e..34e8b793 100644 --- a/Apollo/assets/js/controllers/universityCtrl.js +++ b/Apollo/assets/js/controllers/universityCtrl.js @@ -74,7 +74,7 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams } }; $http(checkReq).then(function (response) { - if (response.data.existEmpId == true) { + if (response.data.existUniv === true) { swal("Warning!", response.data.message, "warning"); $scope.myModel.UniversityID = ''; } else { @@ -134,4 +134,61 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams } } + // add university + $scope.universityForm = { + submit: function (form, myModel) { + 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 { + $scope.myModel.switchsetting = $scope.myModel.switchsetting === true ? 1 : 0; + var req = { + method: 'POST', + url: apiPoint.url + 'insertUniversity/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + data: $scope.myModel, + createdBy: localDetails.localUserID, + } + }; + $http(req).then(function (response) { + if (response.data.addUniv == true) { + swal("Success!", response.data.message, "success"); + $state.go($state.current, {}, { reload: true }); + } else { + // $scope.ldloading1[loading.replace('-', '_')] = false; + swal("Failed!", response.data.message, "error"); + } + }); + } + }, + reset: function (form) { + + // $scope.myModel = angular.copy($scope.master); + form.$setPristine(true); + $scope.myModel = { + 'UniversityID': '', + 'UniversityName': '', + 'UniversityShortName': '', + 'MobileNumber': '', + 'EmailID': '', + 'Address': '', + }; + } + } + }]); diff --git a/Apollo/assets/views/dashboard.html b/Apollo/assets/views/dashboard.html index 18cddc1e..2c8d547a 100644 --- a/Apollo/assets/views/dashboard.html +++ b/Apollo/assets/views/dashboard.html @@ -1,676 +1,37 @@ + + +

{{ mainTitle }}

- overview & stats -
-
- - -
    -
  • -
    - -
    -
    - 18304 -

    - Sales -

    -
    -
  • -
  • -
    - -
    -
    - $3,833 -

    - Earnings -

    -
    -
  • -
  • -
    - -
    -
    - $848 -

    - Referrals -

    -
    -
  • -
- -
+ +
-
-
+
-

Manage Users

-

- To add users, you need to be signed in as the super user. -

- +

Something awesome is coming soon

+

We are building something very cool stay turned and be patient. your patience will be well paid

+
-
-
-
- -

Manage Orders

-

- The Manage Orders tool provides a view of all your orders. -

-

- - view more - -

-
-
-
-
-
-
- -

Manage Database

-

- Store, modify, and extract information from your database. -

- -
-
-
-
-
+
-
-
-
-
-
-
-
-

Visits

- -
-
-
- -
- -
-
-
-
-
-
-
-
-
-
-
-

Acquisition

-
-
-

26

visitors on-line -
-
-

15

- - Direct -
-
-

7

- - Sites -
-
-

4

- - Search -
-
-
-
-
- 26% -
- Mac OS X -
-
-
- 62% -
- Windows -
-
-
- 12% -
- Other OS -
-
-
- -
- -
-
-
-
-
-
-
-
-
-
- - -
-
-
-
-
-
-

Monthly Statistics

- based on the major browsers -
- - - - - This Month - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1Google Chrome4909
2Mozilla Firefox3857
3Safari1789
4Internet Explorer612
-
-
- - - Last Month - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1Google Chrome5228
2Mozilla Firefox2853
3Safari1948
4Internet Explorer456
-
-
-
-
-
-
-
-
-
-

New Users

-
-
- -
-
- {{total}} - Acquisition -
-
-
-
-
-
- -
-
-
-
- - -
-
-
-
-
-

Users

-
-
-
- -

Peter Clark UI Designer

-
- on-line -
-
-
-
- -
-
- -
-
- 544 -
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
imageUI DesignerPeter Clark -
imageContent DesignerNicole Bell -
imageVisual DesignerSteven Thompson -
imageSenior DesignerKenneth Ross -
imageWeb EditorElla Patterson -
-
-
- -
- - - - - - - - - - - - - - - - - - -
imageVisual DesignerSteven Thompson -
imageSenior DesignerKenneth Ross -
imageWeb EditorElla Patterson -
-
-
-
-
-
-
-
-
-
-

Specialization

-
-
- -
- -
-
-
-
-
- -
-
-
-
- - -
-
-
-
- -
-
-
-
-
-
Today
-

$1,450

- 253 Sales -
-
- -
- 1 hour ago -
-
-
-
-
-
-
-
Today
-

$1,450

- 253 Sales -
-
- -
- 1 hour ago -
-
-
-
-
-
-
-
-
-

Activities

-
-
-
    -
  • -
    -
    - 2 minutes ago -
    -

    - - Steven - - has completed his account. -

    -
    -
  • -
  • -
    -
    - 12:30 -
    -

    - Staff Meeting -

    -
    -
  • -
  • -
    -
    - 11:11 -
    -

    - Completed new layout. -

    -
    -
  • -
  • -
    -
    - Thu, 12 Jun -
    -

    - Contacted - - Microsoft - - for license upgrades. -

    -
    -
  • -
  • -
    -
    - Tue, 10 Jun -
    -

    - Started development new site -

    -
    -
  • -
  • -
    -
    - Sun, 11 Apr -
    -

    - Lunch with - - Nicole - - . -

    -
    -
  • -
  • -
    -
    - Wed, 25 Mar -
    -

    - server Maintenance. -

    -
    -
  • -
-
-
-
-
- -
-
-
-

Chat

-
-
-
- -
-
- -
-
-
-
-
- + + + \ No newline at end of file diff --git a/Apollo/assets/views/university.html b/Apollo/assets/views/university.html index 093b5de4..a0ddc1e6 100644 --- a/Apollo/assets/views/university.html +++ b/Apollo/assets/views/university.html @@ -121,7 +121,7 @@ - university Id + University Id Invalid university Id @@ -176,7 +176,7 @@ Address is required -
+