-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated Index & Show Views Integrated Courses Correlatives New Integrated Students Courses View
- Loading branch information
1 parent
092c171
commit fc098b3
Showing
24 changed files
with
510 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,17 @@ | ||
'use strict'; | ||
|
||
define(['paw'], function(paw) { | ||
paw.controller('AdminsShowCtrl', ['$routeParams', function($routeParams) { | ||
define(['paw','services/Admins','services/Paths'], function(paw) { | ||
paw.controller('AdminsShowCtrl', ['$routeParams', 'Admins', '$log', 'Paths', function($routeParams, Admins, $log, Paths) { | ||
var _this = this; | ||
var dni = $routeParams.adminDni; // For future Service calls | ||
|
||
this.admin = { | ||
firstName: 'Matías', | ||
lastName: 'Mercado', | ||
email: 'mmercado@itba.edu.ar', | ||
genre: 'Masculino', | ||
dni: '38917403', | ||
birthday: '1995-05-04', | ||
address: { | ||
country: 'Argentina', | ||
city: 'Buenos Aires', | ||
neighborhood: 'Almagro', | ||
number: '682', | ||
street: 'Corrientes', | ||
floor: '2', | ||
door: 'A', | ||
telephone: '1544683390', | ||
zipCode: '1100' | ||
Admins.get(dni).then(function(admin) { | ||
_this.admin = admin; | ||
}, function(response) { | ||
$log.info('Response status: ' + response.status); | ||
if (response.status === 404) { | ||
Paths.get().notFound().go(); | ||
} | ||
}; | ||
}); | ||
}]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,40 @@ | ||
'use strict'; | ||
|
||
define(['paw'], function(paw) { | ||
paw.controller('CoursesShowCtrl', ['$routeParams', function($routeParams) { | ||
define(['paw','services/Courses','services/Paths', 'controllers/modals/DeleteCorrelativeController'], function(paw) { | ||
paw.controller('CoursesShowCtrl', ['$routeParams', 'Courses', '$log', 'Paths', function($routeParams, Courses, $log, Paths) { | ||
var _this = this; | ||
var courseId = $routeParams.courseId; // For future Service calls | ||
var courseId = $routeParams.courseId; | ||
|
||
this.formatDate = function(finalExamDate) { | ||
var date = finalExamDate.split('T')[0]; | ||
var time = finalExamDate.split('T')[1]; | ||
return date.split('-')[2] + '/' + date.split('-')[1] + '/' + date.split('-')[0] + ' ' + time; | ||
}; | ||
|
||
this.course = { | ||
courseId: '93.42', | ||
credits: 6, | ||
name: 'Física II', | ||
semester: 3, | ||
correlatives: [ | ||
{ | ||
'courseId': '93.41', | ||
'credits': 6, | ||
'name': 'Física I', | ||
'semester': 2 | ||
}, | ||
{ | ||
'courseId': '93.17', | ||
'credits': 6, | ||
'name': 'Matemática I', | ||
'semester': 1 | ||
} | ||
], | ||
finalInscriptions: [ | ||
{ | ||
id: '1', | ||
courseId: '93.42', | ||
vacancy: '12', | ||
maxVacancy: '50', | ||
finalExamDate: '2017-01-20T18:45', | ||
state: 'OPEN' | ||
}, | ||
{ | ||
id: '2', | ||
courseId: '93.42', | ||
vacancy: '6', | ||
maxVacancy: '50', | ||
finalExamDate: '2017-02-15T14:00', | ||
state: 'CLOSED' | ||
} | ||
] | ||
this.getCorrelativePath = function(correlativeId) { | ||
return Paths.get().courses({courseId: correlativeId}).path; | ||
}; | ||
this.getFinalInscriptionPath = function(finalInscriptionId) { | ||
return Paths.get().courses({courseId: courseId}).finals({inscriptionId: finalInscriptionId}).path; | ||
}; | ||
|
||
Courses.get(courseId).then(function(course) { | ||
_this.course = course; | ||
_this.course.getList('correlatives').then(function(correlatives) { | ||
_this.course.correlatives = correlatives; | ||
}); | ||
_this.course.getList('finalInscriptions').then(function(finalInscriptions) { | ||
_this.course.finalInscriptions = finalInscriptions; | ||
}); | ||
}, function(response) { | ||
$log.info('Response status: ' + response.status); | ||
if (response.status === 404) { | ||
Paths.get().notFound().go(); | ||
} | ||
}); | ||
|
||
// this.getFinalInscriptionPath = function(finalInscriptionId) { | ||
// return Paths.get().courses({courseId: courseId}).path; | ||
// }; | ||
}]); | ||
}); |
70 changes: 70 additions & 0 deletions
70
app/scripts/controllers/modals/AddCorrelativeController.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
'use strict'; | ||
|
||
define(['paw', 'services/modalFactory', 'services/Courses', 'services/flashMessages'], function(paw) { | ||
paw.controller('AddCorrelativeController', | ||
['modalFactory', '$log', 'Courses', '$route', 'flashMessages', | ||
function (modalFactory, $log, Courses, $route, flashMessages) { | ||
var modalTemplateUrl = 'views/modals/add_correlative.html'; | ||
var onSuccess = function(result) { | ||
Courses.addCorrelative(result.courseId, result.correlativeId) | ||
.then(function(response) { | ||
flashMessages.setSuccess('i18nAddCorrelativeSuccess'); | ||
$route.reload(); | ||
}, function(response) { | ||
flashMessages.setError('i18nFormErrors'); | ||
$log.warn('[ERROR] - Response: ' + JSON.stringify(response)); | ||
$route.reload(); | ||
}); | ||
}; | ||
|
||
var onFailure = function(msg) { | ||
$log.info(msg); | ||
}; | ||
|
||
this.open = function (size, courseId, courseName, correlativeId, correlativeName) { | ||
var resolve = getResolve(courseId, courseName, correlativeId, correlativeName); | ||
modalFactory.create(size, 'AddCorrelativeModalInstanceController', modalTemplateUrl, resolve, onSuccess, onFailure); | ||
}; | ||
}]); | ||
|
||
paw.controller('AddCorrelativeModalInstanceController', | ||
function($uibModalInstance, courseId, courseName, correlativeId, correlativeName) { | ||
this.courseId = courseId; | ||
this.courseName = courseName; | ||
this.correlativeId = correlativeId; | ||
this.correlativeName = correlativeName; | ||
|
||
var _this = this; | ||
|
||
this.ok = function () { | ||
$uibModalInstance.close({ | ||
courseId: courseId, | ||
courseName: courseName, | ||
correlativeId: correlativeId, | ||
correlativeName: correlativeName | ||
}); | ||
}; | ||
|
||
this.cancel = function () { | ||
$uibModalInstance.dismiss('Add correlative modal dismissed at: ' + new Date()); | ||
}; | ||
}); | ||
|
||
function getResolve(courseId, courseName, correlativeId, correlativeName) { | ||
return { | ||
courseId: function () { | ||
return courseId; | ||
}, | ||
courseName: function () { | ||
return courseName; | ||
}, | ||
correlativeId: function () { | ||
return correlativeId; | ||
}, | ||
correlativeName: function () { | ||
return correlativeName; | ||
} | ||
}; | ||
}; | ||
} | ||
); |
70 changes: 70 additions & 0 deletions
70
app/scripts/controllers/modals/DeleteCorrelativeController.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
'use strict'; | ||
|
||
define(['paw', 'services/modalFactory', 'services/Courses', 'services/flashMessages'], function(paw) { | ||
paw.controller('DeleteCorrelativeController', | ||
['modalFactory', '$log', 'Courses', '$route', 'flashMessages', | ||
function (modalFactory, $log, Courses, $route, flashMessages) { | ||
var modalTemplateUrl = 'views/modals/delete_correlative.html'; | ||
var onSuccess = function(result) { | ||
Courses.deleteCorrelative(result.courseId, result.correlativeId) | ||
.then(function(response) { | ||
flashMessages.setSuccess('i18nDeleteCorrelativeSuccess'); | ||
$route.reload(); | ||
}, function(response) { | ||
flashMessages.setError('i18nFormErrors'); | ||
$log.warn('[ERROR] - Response: ' + JSON.stringify(response)); | ||
$route.reload(); | ||
}); | ||
}; | ||
|
||
var onFailure = function(msg) { | ||
$log.info(msg); | ||
}; | ||
|
||
this.open = function (size, courseId, courseName, correlativeId, correlativeName) { | ||
var resolve = getResolve(courseId, courseName, correlativeId, correlativeName); | ||
modalFactory.create(size, 'DeleteCorrelativeModalInstanceController', modalTemplateUrl, resolve, onSuccess, onFailure); | ||
}; | ||
}]); | ||
|
||
paw.controller('DeleteCorrelativeModalInstanceController', | ||
function($uibModalInstance, courseId, courseName, correlativeId, correlativeName) { | ||
this.courseId = courseId; | ||
this.courseName = courseName; | ||
this.correlativeId = correlativeId; | ||
this.correlativeName = correlativeName; | ||
|
||
var _this = this; | ||
|
||
this.ok = function () { | ||
$uibModalInstance.close({ | ||
courseId: courseId, | ||
courseName: courseName, | ||
correlativeId: correlativeId, | ||
correlativeName: correlativeName | ||
}); | ||
}; | ||
|
||
this.cancel = function () { | ||
$uibModalInstance.dismiss('Delete correlative modal dismissed at: ' + new Date()); | ||
}; | ||
}); | ||
|
||
function getResolve(courseId, courseName, correlativeId, correlativeName) { | ||
return { | ||
courseId: function () { | ||
return courseId; | ||
}, | ||
courseName: function () { | ||
return courseName; | ||
}, | ||
correlativeId: function () { | ||
return correlativeId; | ||
}, | ||
correlativeName: function () { | ||
return correlativeName; | ||
} | ||
}; | ||
}; | ||
} | ||
); |
Oops, something went wrong.