student add details
This commit is contained in:
parent
94bc33327b
commit
fee8aa4cf1
@ -100,7 +100,9 @@ $route['chkStudentExistDetail'] = 'Student_Controller/chkStudentExistDetail';
|
||||
$route['getStudentList'] = 'Student_Controller/getStudentList';
|
||||
$route['updateStudentExistDetail'] = 'Student_Controller/updateStudentExistDetail';
|
||||
$route['chkUpdateStuExistDetail'] = 'Student_Controller/chkUpdateStuExistDetail';
|
||||
$route['getStudentCourseList'] = 'Student_Controller/getStudentCourseList';
|
||||
$route['getStudentCourseDetails'] = 'Student_Controller/getStudentCourseDetails';
|
||||
$route['updateStudentCourseDetail'] = 'Student_Controller/updateStudentCourseDetail';
|
||||
|
||||
|
||||
|
||||
|
||||
@ -61,6 +61,26 @@ class Student_Controller extends REST_Controller {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getStudentCourseList_post() {
|
||||
$studentID = $this->post('studentID');
|
||||
$studentCourse = $this->student_model->get_student_course_list( $studentID );// Check if the employee exist
|
||||
if ($studentCourse)
|
||||
{
|
||||
$studentCourse['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($studentCourse, 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 getStudentCourseDetails_post() {
|
||||
$studentID = $this->post('studentID');
|
||||
$studentCourse = $this->student_model->get_student_course( $studentID );// Check if the employee exist
|
||||
@ -102,6 +122,39 @@ class Student_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function updateStudentCourseDetail_post() {
|
||||
$data = $this->post('data');
|
||||
$updatedBy = $this->post('updatedBy');
|
||||
$id = $data['ID'];
|
||||
|
||||
$req['StudentID'] = $data['StudentID'];
|
||||
$req['UniversityID'] = $data['UniversityID'];
|
||||
$req['CourseID'] = $data['CourseID'];
|
||||
$req['BatchCode'] = $data['BatchCode'];
|
||||
$req['DOJ'] = $data['DOJ'];
|
||||
$req['IsActive'] = $data['IsActive'];
|
||||
$req['BranchID'] = $data['BranchID'];
|
||||
$req['UpdatedBy'] = $updatedBy;
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$req['UpdatedOn'] = $date;
|
||||
|
||||
$studentCourseUpdate = $this->student_model->update_student_course( $req, $id );
|
||||
if ($studentCourseUpdate)
|
||||
{
|
||||
$studentCourseUpdate['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($studentCourseUpdate, 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 updateStudentExistDetail_post(){
|
||||
$data = $this->post('data');
|
||||
$updatedBy = $this->post('updatedBy');
|
||||
|
||||
@ -91,6 +91,24 @@ class Student_model extends CI_Model
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function get_student_course_list($studentId) {
|
||||
$this->db->select('t1.*,t2.UniversityName,t3.CourseName,t4.BatchName');
|
||||
$this->db->from('' . STUDENTCOURSE . ' as t1');
|
||||
$this->db->join('' . UNIVERSITY . ' as t2', 't2.UniversityID = t1.UniversityID', 'LEFT');
|
||||
$this->db->join('' . COURSE . ' as t3', 't3.CourseID = t1.CourseID', 'LEFT');
|
||||
$this->db->join('' . BATCH . ' as t4', 't4.BatchCode = t1.BatchCode', 'LEFT');
|
||||
$this->db->where('StudentID', $studentId);
|
||||
$courseDetails = $this->db->get();
|
||||
$checkArr = $courseDetails->result();
|
||||
if (count($checkArr) > 0) {
|
||||
$result['stuCourseDetails'] = true;
|
||||
$result['course_details'] = $courseDetails->result();
|
||||
} else {
|
||||
$result['stuCourseDetails'] = false;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// get student course details
|
||||
public function get_student_course($studentId) {
|
||||
@ -109,7 +127,6 @@ class Student_model extends CI_Model
|
||||
}
|
||||
|
||||
|
||||
|
||||
//get course for university
|
||||
|
||||
public function get_courseBatch_list($univId) {
|
||||
@ -312,6 +329,32 @@ class Student_model extends CI_Model
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function update_student_course($reqArr, $id) {
|
||||
// print_r($id);
|
||||
// print_r($reqArr);
|
||||
// exit();
|
||||
$this->db->select('*');
|
||||
$this->db->from(STUDENTCOURSE);
|
||||
$this->db->where('StudentID', $reqArr['StudentID']);
|
||||
$this->db->where('CourseID', $reqArr['CourseID']);
|
||||
$this->db->where_not_in('ID', $id);
|
||||
if($this->db->get()->first_row()) {
|
||||
$result['updateStuCourseStatus'] = false;
|
||||
$result['message'] = "This Student Already exist for this course";
|
||||
} else {
|
||||
$this->db->where('ID', $id);
|
||||
$this->db->update(STUDENTCOURSE, $reqArr);
|
||||
if ($this->db->affected_rows() == '1') {
|
||||
$result['updateStuCourseStatus'] = true;
|
||||
$result['message'] = "Successfully Student Course Details Updated";
|
||||
} else {
|
||||
$result['updateStuCourseStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -102,7 +102,10 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
}
|
||||
|
||||
$scope.setEditCourseId = function (id) {
|
||||
$scope.getStudentCourseDetails(id);
|
||||
$scope.stucour = '';
|
||||
$scope.list = false;
|
||||
$scope.getStudentCourseList(id);
|
||||
// $scope.getStudentCourseDetails(id);
|
||||
$scope.editCourseId = id;
|
||||
$scope.editId = -1;
|
||||
$scope.courseEditLoading = true;
|
||||
@ -114,7 +117,31 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
$scope.editCourseId = -1;
|
||||
}
|
||||
|
||||
$scope.getStudentCourseList = function(studentId) {
|
||||
$scope.list = true;
|
||||
var req = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'getStudentCourseList/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
studentID: studentId
|
||||
}
|
||||
};
|
||||
$http(req).then(function (response) {
|
||||
if (response.data.stuCourseDetails) {
|
||||
$scope.courseEditLoading = false;
|
||||
$scope.studentCourseList = response.data.course_details;
|
||||
$scope.stucour = $scope.studentCourse[0];
|
||||
} else {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$scope.getStudentCourseDetails = function (studentId) {
|
||||
$scope.list = false;
|
||||
$scope.courseEdit = true;
|
||||
var req = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'getStudentCourseDetails/',
|
||||
@ -129,6 +156,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
if (response.data.stuCourseDetails) {
|
||||
$scope.courseEditLoading = false;
|
||||
$scope.studentCourse = response.data.course_details;
|
||||
$scope.stucour = $scope.studentCourse[0];
|
||||
// $scope.branchArr = [];
|
||||
// angular.forEach($scope.empBranchs, function (item, index) {
|
||||
// // alert(item.BranchName);
|
||||
@ -166,16 +194,14 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
}
|
||||
|
||||
$scope.onSlecetUnivEdit = function(id) {
|
||||
// $scope.stucour.CourseID = '';
|
||||
// $scope.stucour.UniversityID = '';
|
||||
$scope.myModelCourse.university = id;
|
||||
$scope.onSlecetUniv();
|
||||
}
|
||||
|
||||
$scope.courseData = '';
|
||||
$scope.batchData = '';
|
||||
$scope.courseLoading = false;
|
||||
$scope.onSlecetUniv = function () {
|
||||
$scope.courseData = '';
|
||||
$scope.batchData = '';
|
||||
$scope.myModelCourse.course = '';
|
||||
$scope.myModelCourse.batch = '';
|
||||
$scope.courseLoading = true;
|
||||
@ -200,9 +226,6 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// check mobile number existing
|
||||
$scope.checkMobileExist = function () {
|
||||
var checkReq = {
|
||||
@ -249,7 +272,6 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
|
||||
// add student
|
||||
$scope.studentFORM = {
|
||||
|
||||
submit: function (form, myModel, myModelCourse) {
|
||||
var firstError = null;
|
||||
if (form.$invalid) {
|
||||
@ -295,7 +317,6 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
}
|
||||
},
|
||||
reset: function (form) {
|
||||
|
||||
// $scope.myModel = angular.copy($scope.master);
|
||||
form.$setPristine(true);
|
||||
$scope.myModel = {
|
||||
@ -336,7 +357,6 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
|
||||
// update check mobile exist
|
||||
$scope.updateCheckMobileExist = function (p) {
|
||||
|
||||
var checkReq = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'chkUpdateStuExistDetail/',
|
||||
@ -444,11 +464,11 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
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 {
|
||||
// alert(p.DOB);
|
||||
var formate = "dd-MM-yyyy";
|
||||
var checkDOB = $filter('date')(new Date(p.DOB), formate);
|
||||
p.IsActive = p.IsActive === true ? 1 : 0;
|
||||
p.DOB = checkDOB == "NaN-NaN-0NaN" ? p.DOB : $filter('date')(new Date(p.DOB), formate);
|
||||
var checkDOJ = $filter('date')(new Date(datas.DOJ), formate);
|
||||
datas.IsActive = datas.IsActive === true ? 1 : 0;
|
||||
datas.DOJ = checkDOJ == "NaN-NaN-0NaN" ? datas.DOJ : $filter('date')(new Date(datas.DOJ), formate);
|
||||
|
||||
var req = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'updateStudentCourseDetail/',
|
||||
@ -461,10 +481,10 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
|
||||
}
|
||||
};
|
||||
$http(req).then(function (response) {
|
||||
if (response.data.updateStuStatus = true) {
|
||||
if (response.data.updateStuCourseStatus = true) {
|
||||
swal("Success!", response.data.message, "success");
|
||||
$scope.getStudentList();
|
||||
$scope.editId = -1;
|
||||
$scope.editCourseId = -1;
|
||||
} else {
|
||||
// $scope.ldloading1[loading.replace('-', '_')] = false;
|
||||
swal("Failed!", response.data.message, "error");
|
||||
|
||||
@ -11,10 +11,39 @@
|
||||
<legend>
|
||||
Course Details
|
||||
</legend>
|
||||
<!--list of course details : start-->
|
||||
<div ng-if='list === true'>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>University
|
||||
</th>
|
||||
<th>Course
|
||||
</th>
|
||||
<th>Batch
|
||||
</th>
|
||||
<th>Date of Join
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody ng-repeat="s in studentCourseList">
|
||||
<tr>
|
||||
<td>{{s.UniversityName}}</td>
|
||||
<td>{{s.CourseName}}</td>
|
||||
<td>{{s.BatchName}}</td>
|
||||
<td>{{s.DOJ}}</td>
|
||||
<td ng-click="getStudentCourseDetails(s.StudentID)">Edit</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--list of course details : end-->
|
||||
|
||||
<pre> {{studentCourse | json }} </pre>
|
||||
<!--Edit course details : Start-->
|
||||
<div>
|
||||
<div class="row" ng-repeat="stucour in studentCourse">
|
||||
<div ng-if='courseEdit === true'>
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.univ.$dirty && Form.univ.$invalid, 'has-success':Form.univ.$valid}">
|
||||
<label>
|
||||
University <span class="symbol required"></span>
|
||||
@ -27,42 +56,48 @@
|
||||
</select>
|
||||
<span class="error text-small block" ng-if="Form.univ.$dirty && Form.univ.$error.required">University is required</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.course.$dirty && Form.course.$invalid, 'has-success':Form.course.$valid}">
|
||||
<label>
|
||||
Course <span class="symbol required"></span>
|
||||
</label>
|
||||
<select class="form-control" name="role" ng-model="stucour.CourseID" name="course" class="cs-select cs-skin-elastic" required>
|
||||
<div ng-if="courseLoading == true">
|
||||
<span style="padding: auto 0; color: #007AFF; font-weight: bold;">fetching...</span>
|
||||
</div>
|
||||
<div ng-if="courseLoading == false">
|
||||
<select class="form-control" ng-model="stucour.CourseID" name="course" class="cs-select cs-skin-elastic" required>
|
||||
|
||||
<option value="" disabled selected>Select Course</option>
|
||||
<option ng-repeat="items in courseData" value="{{items.CourseID}}" ng-selected="stucour.CourseID == items.CourseID">{{items.CourseName}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<span class="error text-small block" ng-if="Form.course.$dirty && Form.course.$error.required">Course is required</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.batch.$dirty && Form.batch.$invalid, 'has-success':Form.batch.$valid}">
|
||||
<label>
|
||||
Batch <span class="symbol required"></span>
|
||||
</label>
|
||||
<select class="form-control" name="batch" ng-model="stucour.BatchCode" class="cs-select cs-skin-elastic" required>
|
||||
<div ng-if="courseLoading == true">
|
||||
<span style="padding: auto 0; color: #007AFF; font-weight: bold;">fetching...</span>
|
||||
</div>
|
||||
<div ng-if="courseLoading == false">
|
||||
<select class="form-control" name="batch" ng-model="stucour.BatchCode" class="cs-select cs-skin-elastic" required>
|
||||
|
||||
<option value="" disabled selected>Select Batch</option>
|
||||
<option ng-repeat="items in batchData" value="{{items.BatchCode}}" ng-selected="stucour.BatchCode == items.BatchCode">{{items.BatchName}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<span class="error text-small block" ng-if="Form.batch.$dirty && Form.batch.$error.required">Batch is required</span>
|
||||
</div>
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.enrollId.$dirty && Form.enrollId.$invalid}">
|
||||
<label>
|
||||
Entrollment ID
|
||||
</label> {{ stucour.ID}}
|
||||
|
||||
<input type="text" placeholder="Enter Entrollment ID" tabindex="15" class="form-control" name="enrollId" ng-model="stucour.ID"
|
||||
ng-pattern="/^[a-zA-Z.\s]*$/" />
|
||||
<span class="error text-small block" ng-if="Form.enrollId.$dirty && Form.enrollId.$error.pattern">Invalid Entrollment ID </span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.dateofjoining.$dirty && Form.dateofjoining.$invalid, 'has-success':Form.dateofjoining.$valid}">
|
||||
<label>
|
||||
Date of Joining <span class="symbol required"></span>
|
||||
</label>
|
||||
<!--{{ stucour.DOJ}}-->
|
||||
<input type="text" tabindex="8" class="form-control " ng-click="startOpen = !startOpen" datepicker-popup="dd-MM-yyyy" ng-model="stucour.DOJ"
|
||||
is-open="startOpen" ng-init="startOpen = false" name="dateofjoining" datepicker-options="dateOptions"
|
||||
placeholder="Select Date of Joining" close-text="Close" required="required" max-date="currentDate"
|
||||
@ -70,12 +105,24 @@
|
||||
|
||||
<span class="error text-small block" ng-if="Form.dateofjoining.$dirty && Form.dateofjoining.$error.required">Date of Joining is required</span>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>
|
||||
Active/De-Active
|
||||
</label>
|
||||
<div ng-if="stucour.IsActive==true">
|
||||
<switch ng-model="stucour.IsActive" ng-init="stucour.IsActive = true" class="green"></switch>
|
||||
</div>
|
||||
<div ng-if="stucour.IsActive==false">
|
||||
<switch ng-model="stucour.IsActive" ng-init="stucour.IsActive = false" class="green"></switch>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
<button type="button" ladda="ldloading1.zoom_in" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="updateStudentCourseDetails(Form, studentCourse)">
|
||||
<button type="button" ladda="ldloading1.zoom_in" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="updateStudentCourseDetails(Form, stucour)">
|
||||
Update
|
||||
</button>
|
||||
<button type="reset" class="btn btn-warning btn-wide" tabindex="9" ng-click="cancel()">
|
||||
@ -85,6 +132,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Edit course details : Start-->
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user