Skip to content

Commit

Permalink
Created Students Final Inscriptions View (#86)
Browse files Browse the repository at this point in the history
* Created Students Final Inscriptions View
Added style for view
  • Loading branch information
MatiasMercado committed Feb 3, 2017
1 parent 9441df6 commit 756d525
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 7 deletions.
71 changes: 71 additions & 0 deletions app/scripts/controllers/students/StudentsFinalInscriptionsCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
'use strict';

define(['paw'], function(paw) {
paw.controller('StudentsFinalInscriptionsCtrl', ['$routeParams', function($routeParams) {
var _this = this;
var docket = $routeParams.docket; // For future Service calls

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.student = {
docket: '55019',
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'
},
finalInscriptionsAvailable: [
{
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'
}
],
finalInscriptionsTaken: [
{
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'
}
]
};
}]);
});
17 changes: 10 additions & 7 deletions app/scripts/i18n/translations.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ define([], function() {
i18nUnenroll: 'Dar de Baja',
// Students Inscriptions
i18nEnroll: 'Matricularse',
// Final Exams
i18nFinalExams: 'Exámenes Finales',
i18nFinalExamsTaken: 'Exámenes a los que se encuentra inscripto',
i18nVacancy: 'Cupos',
i18nState: 'Estado',
i18nFinalExamDate: 'Fecha del examen',
i18nNoFinalExamsFound: 'No se encontraron fechas de examen final',
i18nInscriptionOpen: 'Abierto',
i18nInscriptionClosed: 'Cerrado',
i18nFinalEnroll: 'Inscribirse',

// Courses Index
i18nCourseId: 'Código',
Expand All @@ -97,13 +107,6 @@ define([], function() {
i18nCorrelatives: 'Correlativas',
i18nDeleteCorrelative: 'Eliminar correlatividad',
i18nNoCorrelativesFound: 'Esta materia no tiene correlativas',
i18nFinalExams: 'Exámenes Finales',
i18nVacancy: 'Cupos',
i18nState: 'Estado',
i18nFinalExamDate: 'Fecha del examen',
i18nNoFinalExamsFound: 'No se encontraron fechas de examen final',
i18nInscriptionOpen: 'Abierto',
i18nInscriptionClosed: 'Cerrado',

// Courses Students Index
i18nQualify: 'Calificar',
Expand Down
5 changes: 5 additions & 0 deletions app/scripts/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ define([], function() {
templateUrl: 'views/courses/new.html',
controller: 'CoursesNewCtrl',
relativePath: '/courses'
},
'/students/:docket/final_inscriptions': {
templateUrl: '/views/students/final_inscriptions.html',
controller: 'StudentsFinalInscriptionsCtrl',
relativePath: '/students'
}
/* ===== yeoman hook ===== */
/* Do not remove these commented lines! Needed for auto-generation */
Expand Down
1 change: 1 addition & 0 deletions app/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ $fa-font-path: '../bower_components/font-awesome/fonts';
@import 'partials/students/inscriptions';
@import 'partials/courses/edit';
@import 'partials/courses/new';
@import 'partials/students/final_inscriptions';
19 changes: 19 additions & 0 deletions app/styles/partials/students/_final_inscriptions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@import 'modules/variables/importer';

.students-final-inscriptions-container {
.table {
.actions-container {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;

.btn {
flex: 1;
min-width: 175px;
max-width: 200px;
margin: 10px;
margin-left: 0;
}
}
}
}
89 changes: 89 additions & 0 deletions app/views/students/final_inscriptions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<div ng-controller='StudentsFinalInscriptionsCtrl as controller' class='students-final-inscriptions-container'>
<!-- Page Heading -->
<div class='page-header break-words'>
<h1 class='inline'>
<span translate='i18nStudents'></span>
</h1>
<h2 class='inline'>
<span> - </span>
<span> {{controller.student.firstName}} {{controller.student.lastName}}</span>
<small> - </small>
<small translate='i18nStudentFinals'></small>
</h2>
</div>
<!-- /Page Heading -->

<!-- Final Exams -->
<h3 translate='i18nFinalExams' class='page-sub-header'></h3>
<div class='table-responsive'>
<table class='table table-hover'>
<thead>
<tr>
<th translate='i18nFinalExamDate'></th>
<th translate='i18nVacancy'></th>
<th translate='i18nState'></th>
<th translate='i18nActions'></th>
</tr>
</thead>
<tbody>
<tr ng-hide='controller.student.finalInscriptionsAvailable.length > 0' class='bg-warning'>
<td colspan='4' class='text-danger text-center' translate='i18nNoFinalExamsFound'></td>
</tr>
<tr ng-repeat='inscription in controller.student.finalInscriptionsAvailable'>
<td>{{controller.formatDate(inscription.finalExamDate)}}</td>
<td>{{ inscription.vacancy }}/{{ inscription.maxVacancy }}</td>
<td ng-show="inscription.state == 'OPEN'" translate='i18nInscriptionOpen'></td>
<td ng-show="inscription.state == 'CLOSED'" translate='i18nInscriptionClosed'></td>
<td class='actions-container'>
<a class='btn btn-default' role='button'>
<span class='fa fa-info-circle' aria-hidden='true'></span>
<span translate='i18nInformation'></span>
</a>
<a class='btn btn-info' role='button'>
<span class='fa fa-list-alt' aria-hidden='true'></span>
<span translate='i18nFinalEnroll'></span>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<!-- /Final Exams -->

<!-- Final Exams Taken -->
<h3 translate='i18nFinalExamsTaken' class='page-sub-header'></h3>
<div class='table-responsive'>
<table class='table table-hover'>
<thead>
<tr>
<th translate='i18nFinalExamDate'></th>
<th translate='i18nVacancy'></th>
<th translate='i18nState'></th>
<th translate='i18nActions'></th>
</tr>
</thead>
<tbody>
<tr ng-hide='controller.student.finalInscriptionsTaken.length > 0' class='bg-warning'>
<td colspan='4' class='text-danger text-center' translate='i18nNoFinalExamsFound'></td>
</tr>
<tr ng-repeat='inscription in controller.student.finalInscriptionsTaken'>
<td>{{controller.formatDate(inscription.finalExamDate)}}</td>
<td>{{ inscription.vacancy }}/{{ inscription.maxVacancy }}</td>
<td ng-show="inscription.state == 'OPEN'" translate='i18nInscriptionOpen'></td>
<td ng-show="inscription.state == 'CLOSED'" translate='i18nInscriptionClosed'></td>
<td class='actions-container'>
<a class='btn btn-default' role='button'>
<span class='fa fa-info-circle' aria-hidden='true'></span>
<span translate='i18nInformation'></span>
</a>
<a class='btn btn-danger' role='button'>
<span class='fa fa-list-alt' aria-hidden='true'></span>
<span translate='i18nUnenroll'></span>
</a>
</td>
</tr>
</tbody>
</table>
</div>
<!-- /Final Exams Taken -->
</div>

0 comments on commit 756d525

Please sign in to comment.