total student get for dashboard- backend

This commit is contained in:
resicovenba 2017-11-30 18:17:44 +05:30
parent 9993e7cb25
commit e784725a16
6 changed files with 180 additions and 12 deletions

View File

@ -479,6 +479,7 @@ $config['compress_output'] = FALSE;
|
*/
$config['time_reference'] = 'local';
date_default_timezone_set('Asia/Kolkata');
/*
|--------------------------------------------------------------------------

View File

@ -122,6 +122,8 @@ $route['updateAnnouncementDetails'] = 'Announcement_Controller/updateAnnouncemen
// dash board
$route['getDashboardCallTrack'] = 'Call_Tracking_Controller/getDashboardCallTrack';
$route['getTotalStudent'] = 'Dashboard_Controller/getTotalStudent';
$route['getTotalEmployee'] = 'Dashboard_Controller/getTotalEmployee';

View File

@ -0,0 +1,74 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require_once APPPATH . '/libraries/REST_Controller.php';
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author
* @license MIT
* @link
*/
class Dashboard_Controller extends REST_Controller {
/*
* get Dashboard details
* kdk
* params:
*
* */
function __construct()
{
// Construct the parent class
parent::__construct();
// Configure limits on our controller methods
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
// load the dashboard model
$this->load->model('Dashboard_model', 'dashboard_model');
}
public function getTotalStudent_post() {
$data = $this->post('data');
$totalStudents = $this->dashboard_model->get_total_students( $data );// Check if the employee exist
if ($totalStudents) {
$totalStudents['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($totalStudents, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
public function getTotalEmployee_post() {
$data = $this->post('data');
$totalEmployee = $this->dashboard_model->get_total_employee( $data );// Check if the employee exist
if ($totalEmployee) {
$totalEmployee['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($totalEmployee, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'No users were found',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}

View File

@ -0,0 +1,53 @@
<?php
/**
* Date: 11/9/17
* Time: 5:28 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Dashboard_model extends CI_Model
{
/*
* dashboard model
*
*/
/*
* get Dashboard Details
*/
// get total number of students
public function get_total_students($data) {
// print_r($data);exit();
$sql = "SELECT * from ".STUDENTS."";
$count = $this->db->query($sql);
if( $count->num_rows() > 0) {
$result['status'] = true;
$result['total_student'] = $count->num_rows();
$result['message'] = "Total Number of Students";
} else {
$result['status'] = true;
$result['total_student'] = $count->num_rows();
$result['message'] = "No student exist";
}
return $result;
}
// get total number of employees
public function get_total_employee($data) {
// print_r($data);exit();
$sql = "SELECT * from ".STAFF."";
$count = $this->db->query($sql);
if( $count->num_rows() > 0) {
$result['status'] = true;
$result['total_employee'] = $count->num_rows();
$result['message'] = "Total Number of Employee";
} else {
$result['status'] = true;
$result['total_employee'] = $count->num_rows();
$result['message'] = "No Employee exist";
}
return $result;
}
}

View File

@ -45,14 +45,24 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
'enrollmentid': ''
};
$scope.addStudentView = function () {
$scope.myModelCourse = {
$scope.myModelCourseAdd = {
'university': '',
'course': '',
'batch': '',
'dateofjoining': '',
'enrollmentid': ''
};
$scope.addStudentView = function () {
// $scope.myModelCourseAdd = {
// 'university': '',
// 'course': '',
// 'batch': '',
// 'dateofjoining': '',
// 'enrollmentid': ''
// };
// $scope.courseDataAdd = '';
// $scope.batchDataAdd = '';
}
@ -359,6 +369,34 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
});
}
$scope.onSlecetUnivAdd = function () {
$scope.courseDataAdd = '';
$scope.batchDataAdd = '';
$scope.myModelCourseAdd.course = '';
$scope.myModelCourseAdd.batch = '';
$scope.courseLoading = true;
var univListreq = {
method: 'POST',
url: apiPoint.url + 'getCourseBatchForUniv/',
headers: {
'Content-Type': 'application/json'
},
data: {
data: $scope.myModelCourseAdd.university
}
};
$http(univListreq).then(function (response) {
if (response.data.courseStatus) {
$scope.courseLoading = false;
$scope.courseDataAdd = response.data.course_details;
$scope.batchDataAdd = response.data.batch_details;
} else {
$scope.courseLoading = false;
}
});
}
// check mobile number existing
$scope.checkMobileExist = function () {
var checkReq = {
@ -405,7 +443,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
// add student
$scope.studentFORM = {
submit: function (form, myModel, myModelCourse) {
submit: function (form, myModel, myModelCourseAdd) {
var firstError = null;
if (form.$invalid) {
var field = null, firstError = null;
@ -435,7 +473,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
},
data: {
data: $scope.myModel,
coursedata: $scope.myModelCourse,
coursedata: $scope.myModelCourseAdd,
loginBranch: localDetails.localBranchID,
createdBy: localDetails.localUserID,
}

View File

@ -412,8 +412,8 @@
University <span class="symbol required"></span>
</label>
<select class="form-control" tabindex="25" class="cs-select cs-skin-elastic" name="university" ng-model="myModelCourse.university"
ng-change="onSlecetUniv()" required>
<select class="form-control" tabindex="25" class="cs-select cs-skin-elastic" name="university" ng-model="myModelCourseAdd.university"
ng-change="onSlecetUnivAdd()" required>
<option value="" disabled selected>Select University</option>
<option ng-repeat="item in universityData" value="{{item.UniversityID}}">{{item.UniversityName}}</option>
</select>
@ -429,10 +429,10 @@
<span style="padding: auto 0; color: #007AFF; font-weight: bold;">fetching...</span>
</div>
<div ng-if="courseLoading == false">
<select class="form-control" tabindex="26" name="course" ng-model="myModelCourse.course" class="cs-select cs-skin-elastic"
<select class="form-control" tabindex="26" name="course" ng-model="myModelCourseAdd.course" class="cs-select cs-skin-elastic"
required>
<option value="" disabled selected>Select Course</option>
<option ng-repeat="item in courseData" value="{{item.CourseID}}">{{item.CourseName}}</option>
<option ng-repeat="item in courseDataAdd" value="{{item.CourseID}}">{{item.CourseName}}</option>
</select>
</div>
<span class="error text-small block" ng-if="Form.course.$dirty && Form.course.$error.required">Course is required</span>
@ -448,10 +448,10 @@
<span style="padding: auto 0; color: #007AFF; font-weight: bold;">fetching...</span>
</div>
<div ng-if="courseLoading == false">
<select class="form-control" tabindex="26" name="batch" ng-model="myModelCourse.batch" class="cs-select cs-skin-elastic"
<select class="form-control" tabindex="26" name="batch" ng-model="myModelCourseAdd.batch" class="cs-select cs-skin-elastic"
required>
<option value="" disabled selected>Select Batch</option>
<option ng-repeat="item in batchData" value="{{item.BatchCode}}">{{item.BatchName}}</option>
<option ng-repeat="item in batchDataAdd" value="{{item.BatchCode}}">{{item.BatchName}}</option>
</select>
</div>
<span class="error text-small block" ng-if="Form.batch.$dirty && Form.batch.$error.required">Batch is required</span>
@ -464,7 +464,7 @@
Enrollment ID
</label>
<input type="text" name="enrollmentid" tabindex="27" placeholder="Enter Entollment ID" class="form-control"
ng-model="myModelCourse.enrollmentid"
ng-model="myModelCourseAdd.enrollmentid"
/>
<span class="error text-small block" ng-if="Form.enrollmentid.$dirty && Form.enrollmentid.$error.required">Enrollment ID required</span>
</div>
@ -479,7 +479,7 @@
/*top: -225px !important;*/
}
</style>
<input type="text" tabindex="28" class="form-control" ng-click="startOpen = !startOpen" datepicker-popup="dd-MM-yyyy" ng-model="myModelCourse.dateofjoining"
<input type="text" tabindex="28" class="form-control" ng-click="startOpen = !startOpen" datepicker-popup="dd-MM-yyyy" ng-model="myModelCourseAdd.dateofjoining"
is-open="startOpen" ng-init="startOpen = false" name="dateofjoining" datepicker-options="dateOptions"
placeholder="Select Date of Joining" close-text="Close" required="required" datepicker-position="top"/>