student details add course

This commit is contained in:
resicovenba 2017-11-28 20:49:00 +05:30
parent 90732920e5
commit bc1a10306f
4 changed files with 44 additions and 41 deletions

View File

@ -82,8 +82,8 @@ class Student_Controller extends REST_Controller {
} }
public function getStudentCourseDetails_post() { public function getStudentCourseDetails_post() {
$studentID = $this->post('studentID'); $studentCourseID = $this->post('studentcourseId');
$studentCourse = $this->student_model->get_student_course( $studentID );// Check if the employee exist $studentCourse = $this->student_model->get_student_course( $studentCourseID );// Check if the employee exist
if ($studentCourse) if ($studentCourse)
{ {
$studentCourse['status'] = REST_Controller::HTTP_OK; $studentCourse['status'] = REST_Controller::HTTP_OK;

View File

@ -111,10 +111,10 @@ class Student_model extends CI_Model
} }
// get student course details // get student course details
public function get_student_course($studentId) { public function get_student_course($studentcourseId) {
$this->db->select('*'); $this->db->select('*');
$this->db->from(STUDENTCOURSE); $this->db->from(STUDENTCOURSE);
$this->db->where('StudentID', $studentId); $this->db->where('ID', $studentcourseId);
$courseDetails = $this->db->get(); $courseDetails = $this->db->get();
$checkArr = $courseDetails->result(); $checkArr = $courseDetails->result();
if (count($checkArr) > 0) { if (count($checkArr) > 0) {

View File

@ -70,6 +70,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
} }
} }
$scope.getStudentList = function () { $scope.getStudentList = function () {
$scope.loader = true; $scope.loader = true;
var empListreq = { var empListreq = {
@ -102,7 +103,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
} }
$scope.setEditCourseId = function (id) { $scope.setEditCourseId = function (id) {
$scope.stucour = '';
$scope.list = false; $scope.list = false;
$scope.getStudentCourseList(id); $scope.getStudentCourseList(id);
// $scope.getStudentCourseDetails(id); // $scope.getStudentCourseDetails(id);
@ -119,6 +120,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
$scope.getStudentCourseList = function(studentId) { $scope.getStudentCourseList = function(studentId) {
$scope.list = true; $scope.list = true;
$scope.courseEdit = false;
var req = { var req = {
method: 'POST', method: 'POST',
url: apiPoint.url + 'getStudentCourseList/', url: apiPoint.url + 'getStudentCourseList/',
@ -133,13 +135,14 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
if (response.data.stuCourseDetails) { if (response.data.stuCourseDetails) {
$scope.courseEditLoading = false; $scope.courseEditLoading = false;
$scope.studentCourseList = response.data.course_details; $scope.studentCourseList = response.data.course_details;
$scope.stucour = $scope.studentCourse[0]; // $scope.stucour = $scope.studentCourse[0];
} else { } else {
} }
}); });
} }
$scope.getStudentCourseDetails = function (studentId) { $scope.getStudentCourseDetails = function (studentcourseID) {
$scope.stucour = '';
$scope.list = false; $scope.list = false;
$scope.courseEdit = true; $scope.courseEdit = true;
var req = { var req = {
@ -149,7 +152,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
data: { data: {
studentID: studentId studentcourseId: studentcourseID
} }
}; };
$http(req).then(function (response) { $http(req).then(function (response) {
@ -157,15 +160,6 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
$scope.courseEditLoading = false; $scope.courseEditLoading = false;
$scope.studentCourse = response.data.course_details; $scope.studentCourse = response.data.course_details;
$scope.stucour = $scope.studentCourse[0]; $scope.stucour = $scope.studentCourse[0];
// $scope.branchArr = [];
// angular.forEach($scope.empBranchs, function (item, index) {
// // alert(item.BranchName);
// $scope.branchArr.push(item.BranchName);
// });
// $scope.empBranchDetails = {
// arr: $scope.branchArr,
// }
// $scope.empRoleDetail = response.data.role_details[0];
} else { } else {
} }
}); });

View File

@ -33,14 +33,23 @@
<td>{{s.CourseName}}</td> <td>{{s.CourseName}}</td>
<td>{{s.BatchName}}</td> <td>{{s.BatchName}}</td>
<td>{{s.DOJ}}</td> <td>{{s.DOJ}}</td>
<td ng-click="getStudentCourseDetails(s.StudentID)">Edit</td> <td ng-click="getStudentCourseDetails(s.ID)">Edit</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="row">
<div class="col-md-12">
<div class="pull-right">
<button type="reset" class="btn btn-warning btn-wide" tabindex="9" ng-click="cancel()">
Cancel
</button>
</div>
</div>
</div>
</div> </div>
<!--list of course details : end--> <!--list of course details : end-->
<pre> {{studentCourse | json }} </pre> <!--<pre> {{studentCourse | json }} </pre>-->
<!--Edit course details : Start--> <!--Edit course details : Start-->
<div ng-if='courseEdit === true'> <div ng-if='courseEdit === true'>
<div class="row"> <div class="row">