Skip to content

Commit 324eafc

Browse files
#11 Developed the views of students and subjects with a similar design (for now= that users (teachers and students)
1 parent 6a43535 commit 324eafc

17 files changed

+1061
-156
lines changed

SMS-Front-End/app/index2.html

-152
This file was deleted.

SMS-Front-End/app/js/main/main.module.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//teaching -> Teaching module
88

99

10-
angular.module('main', ['ngMaterial', 'ui.router', 'teachers', 'subjects', 'classes', 'associations', 'imparts', 'ngResource']);
10+
angular.module('main', ['ngMaterial', 'ui.router', 'teachers', 'students', 'subjects', 'classes', 'associations', 'imparts', 'ngResource']);
1111

1212

1313

@@ -18,9 +18,16 @@ angular.module('main').config(function($stateProvider, $urlRouterProvider){
1818
$stateProvider
1919

2020
.state('home', { url: '/home', templateUrl: 'app/views/home.html'})
21+
2122
.state('teachers', { url: '/teachers', templateUrl: 'app/views/teaching/teachers/teachersList.html'})
2223
.state('teachersProfile', {url: '/teachers/:teacherId', templateUrl: 'app/views/teaching/teachers/teachersProfile.html'})
2324

25+
.state('students', { url: '/students', templateUrl: 'app/views/teaching/students/studentsList.html'})
26+
.state('studentsProfile', {url: '/students/:studentId', templateUrl: 'app/views/teaching/students/studentsProfile.html'})
27+
28+
.state('subjects', { url: '/subjects', templateUrl: 'app/views/teaching/subjects/subjectsList.html'})
29+
.state('subjectsProfile', {url: '/subjects/:subjectId', templateUrl: 'app/views/teaching/subjects/subjectsProfile.html'})
30+
2431
})
2532

2633

@@ -99,11 +106,11 @@ angular.module('main').controller('AppCtrl', function($scope, $mdSidenav, $mdMed
99106
}, {
100107
name: 'Estudiantes',
101108
icon: 'settings',
102-
link: '.home'
109+
link: '.students'
103110
}, {
104111
name: 'Asignaturas',
105112
icon: 'settings',
106-
link: '.home'
113+
link: '.subjects'
107114
}, {
108115
name: 'Grupos',
109116
icon: 'settings',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
angular.module('students')
2+
.controller('newStudentDialogController',function($scope, $mdDialog, StudentsService){
3+
4+
var vm = this;
5+
6+
activate();
7+
vm.closeDialog = closeDialog;
8+
vm.saveStudent = saveStudent
9+
10+
vm.teacher = new StudentsService();
11+
12+
13+
///////////////////////////////////////////////////////////
14+
function activate() {
15+
console.log('Activating newStudentDialogController controller.')
16+
}
17+
18+
// Function to close the dialog
19+
function closeDialog() {
20+
$mdDialog.cancel();
21+
}
22+
23+
function saveStudent(){
24+
console.log('Calling save student function.')
25+
vm.teacher.$save(function(){
26+
console.log('Save successfully');
27+
$mdDialog.cancel();
28+
});
29+
}
30+
31+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// A module without dependencies, with name "teachers"
2+
angular.module('students', ['md.data.table'])
3+
.config(function(){
4+
console.log('Activating students module.');
5+
6+
})
7+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
angular.module('students')
2+
.factory("StudentsService",
3+
function($resource) {
4+
5+
var restPath = 'http://localhost:8001/entities/student/';
6+
7+
return $resource(restPath + ':id', {id: '@_id'}, {
8+
'getSubjects': {
9+
method: 'GET',
10+
url: restPath + ':id' + '/subject',
11+
isArray: true
12+
},
13+
'getClasses': {
14+
method: 'GET',
15+
url: restPath + ':id' + '/class',
16+
isArray: true
17+
}
18+
});
19+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
3+
angular.module('students')
4+
.controller('studentsListController',function($scope, $mdDialog, StudentsService){
5+
6+
var vm = this;
7+
8+
vm.defaultAvatar = 'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcThQiJ2fHMyU37Z0NCgLVwgv46BHfuTApr973sY7mao_C8Hx_CDPrq02g'
9+
vm.openNewStudentDialog = openNewStudentDialog;
10+
11+
activate();
12+
13+
///////////////////////////////////////////////////////////
14+
function activate() {
15+
console.log('Activating studentsListController controller.')
16+
17+
vm.studentsList = StudentsService.query({}, function(){
18+
console.log(vm.studentsList)
19+
}, function(){
20+
console.log('Any problem found when was retrieved the student list.')
21+
})
22+
23+
}
24+
25+
function openNewStudentDialog(){
26+
console.log('Open new Student Dialog')
27+
28+
$mdDialog.show({
29+
locals: {parentScope: $scope, parentController: vm},
30+
controller: 'newStudentDialogController',
31+
controllerAs: 'vm',
32+
templateUrl: 'app/views/teaching/students/newStudentDialog.html'
33+
})
34+
.then(function () {
35+
36+
}, function () {
37+
38+
});
39+
}
40+
41+
42+
43+
});
44+
45+
//angular.module('teachers').controller('teachersListController', ['$scope', function($scope) {}]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
angular.module('students')
2+
.controller('studentsProfileController',function($scope, $resource, $stateParams, $mdDialog, StudentsService){
3+
4+
var vm = this;
5+
6+
vm.studentId = $stateParams.studentId
7+
8+
// Functions associations
9+
//vm.addRelation = addRelation;
10+
11+
vm.defaultAvatar = 'https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcThQiJ2fHMyU37Z0NCgLVwgv46BHfuTApr973sY7mao_C8Hx_CDPrq02g'
12+
13+
14+
vm.student = StudentsService.get({id: vm.studentId}, function(){
15+
console.log(vm.student)
16+
17+
}, function(){
18+
console.log('Student not found')
19+
vm.student = null;
20+
})
21+
22+
/*
23+
vm.teacherSubjects = StudentsService.getSubjects({id: vm.teacherId}, function(){
24+
console.log('Teachers subjects')
25+
console.log(vm.teacherSubjects)
26+
})
27+
28+
vm.teacherClasses = StudentsService.getClasses({id: vm.teacherId}, function(){
29+
console.log('Teachers classes')
30+
console.log(vm.teacherClasses)
31+
})
32+
*/
33+
34+
/*
35+
vm.teacher = {
36+
"name": "El nombre",
37+
"surname": "Los apellidos",
38+
"locality": "Granada",
39+
"email": "correo@gmail.com",
40+
"asignaturas":{
41+
"num": 2,
42+
"items": [{
43+
"name": "francés",
44+
"idAsignatura": 324
45+
},{
46+
"name": "francés",
47+
"idAsignatura": 324
48+
}
49+
]
50+
}
51+
}*/
52+
53+
activate();
54+
55+
///////////////////////////////////////////////////////////
56+
function activate() {
57+
console.log('Activating studentsProfileController controller.')
58+
59+
}
60+
61+
62+
63+
/**
64+
* Open the dialog to add a relation to this teacher.
65+
* The add action is done in addUserToProjectController
66+
67+
function addRelation() {
68+
69+
$mdDialog.show({
70+
locals: {parentScope: $scope, parentController: vm},
71+
controller: 'addRelationController',
72+
controllerAs: 'vm',
73+
templateUrl: 'app/views/teaching/utils/addRelationTemplate.html'
74+
})
75+
.then(function () {
76+
77+
}, function () {
78+
79+
});
80+
}*/
81+
82+
83+
84+
});

0 commit comments

Comments
 (0)