Files
MASA/app/partials/report/section_report.controller.js

59 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

2016-04-11 00:05:59 -04:30
(function(){
'use strict';
angular
.module('app.reports')
.controller('SectionReportCtrl', SectionReportCtrl)
SectionReportCtrl.$inject =
2016-05-20 23:00:34 -04:00
['$scope', '$state', 'professors', '$modal', 'profesorSeleccionado', 'selectedCourse', 'selectedSection', 'authentication'];
function SectionReportCtrl($scope, $state, professors, $modal, profesorSeleccionado, selectedCourse, selectedSection, authentication) {
2016-04-11 00:05:59 -04:30
var vm = this;
2016-05-20 23:00:34 -04:00
var user = authentication.currentUser();
var professorid = user._id;
2016-04-11 00:05:59 -04:30
vm.section = [];
vm.professor = null;
professors.get({ id: professorid },
function (successResult){
vm.professor = successResult;
angular.forEach (vm.professor.courses,
function (value, key){
if (value._id == selectedCourse._id ) {
2016-04-27 20:34:27 -04:30
vm.course = value.name;
2016-04-11 00:05:59 -04:30
vm.index = key;
vm.section = value.sections;
}
});
},
function (){
console.log("Error al obtener los datos.");
});
vm.back = function (index) {
$state.go('courseReport');
};
vm.sectionReport = function (index) {
selectedSection._id = vm.section[index]._id;
selectedCourse.index = vm.index;
$state.go('sectionAssist');
};
vm.listStudents = function (index) {
selectedSection._id = vm.section[index]._id;
selectedCourse.index = vm.index;
$state.go('studentReport');
};
$scope.ok = function () {
$scope.modalInstance.dismiss('cancel');
};
$scope.cancel = function () {
$scope.modalInstance.dismiss('cancel');
};
};
})();