'use strict';
angular.module('liberValidApp')
- .controller('ReportCtrl', function ($scope, $http, Report, User, socket, Auth, $cookieStore, Modal) {
+ .controller('ReportCtrl', function ($scope, $http, Report, User, socket, Auth, $cookieStore, Modal, Referential) {
var userId = Auth.getCurrentUser()._id;
// We have to take the token, for download links
$scope.token = $cookieStore.get('token');
+ // Récupération des référentiels
+ $scope.referentials = Referential.query();
+
// Use the Report $resource to fetch all reports
Report.query(function (reports) {
$scope.reports = reports;
tr(ng-repeat='report in reports')
td {{(users | filter: {_id:report.user})[0]["name"]}}
td {{report.filename}}
- td {{report.referential}}
+ td
+ span.label(ng-repeat="ref in referentials", ng-if="report.referential[ref] != 'error'", ng-class="report.referential[ref] == 'valid' ? 'label-success' : 'label-warning'") {{ref}}
td
i.text-success.fa-2x.fa.fa-check(ng-show='report.isGenerated')
i.text-danger.fa-2x.fa.fa-times(ng-show='!report.isGenerated')
.margin-top-50
- margin-top 50px
\ No newline at end of file
+ margin-top 50px
+
+.label
+ margin-left 2px
\ No newline at end of file
var router = express.Router();
-router.get('/', auth.isAuthenticated(), controller.index);
+router.get('/', auth.hasRole('admin'), controller.index);
router.get('/:id', auth.isAuthenticated(), controller.show);
// Upload de la pièce de contenu, et des signatures détachées (optionel)
// Get list of reports
exports.index = function (req, res) {
- var params = {};
- if (!req.query.asAdmin || req.user.role !== 'admin') {
- params.user = req.user._id;
- }
- Report.find(params, function (err, reports) {
+ Report.find(function (err, reports) {
if (err) {
return handleError(res, err);
}