working on supervisors list

parent 40d8ad95
......@@ -224,6 +224,7 @@
"office_not_updated": "Office not updated",
"office_updated": "Office updated",
"offices": "Offices",
"options": "Options",
"own_instructions": "Own method templates",
"own_labels": "Your labels",
"own_pictos": "Your pictograms",
......
......@@ -225,6 +225,7 @@
"office_not_updated": "El gabinete no se ha podido actualizar",
"office_updated": "Gabinete actualizado",
"offices": "Gabinetes",
"options": "Opciones",
"own_instructions": "Plantillas de métodos propias",
"own_labels": "Propias",
"own_pictos": "Propios",
......
......@@ -3,18 +3,33 @@
//--------------------------
// Admin Supervisors Controller
//--------------------------
dashboardControllers.controller('AdminSupervisorsCtrl', function AdminSupervisorsCtrl($scope, $window, $http, config, $translate, ngToast) {
dashboardControllers.controller('SupervisorsCtrl', function SupervisorsCtrl($scope, $window, $http, config, $translate, ngToast) {
// List of supervisors
//Office ID
$http
.get(config.backend+'/office/get/:id/supervisors')
.success(function(data, status, headers, config) {
$scope.supervisors_list = data;
.get(config.backend+'/office/get_all')
.success(function(data, status, headers, config) {
// Add to list
$scope.office = data[0];
$scope.supervisors_list();
console.log($scope.office.id);
})
.error(function(data, status, headers, config) {
$translate('error_downloading_supervisors').then(function (translation) {
ngToast.danger({ content: translation });
});
console.log("Error from API: " + data.error);
});
// List of supervisors
$scope.supervisors_list = function(){
$http
.get(config.backend+'/office/get/' + $scope.office.id + '/supervisors')
.success(function(data, status, headers, config) {
$scope.supervisors_list = data;
})
.error(function(data, status, headers, config) {
$translate('error_downloading_supervisors').then(function (translation) {
ngToast.danger({ content: translation });
});
});
};
});
......@@ -33,7 +33,7 @@
</a>
</li>
<li>
<a class="pointer" role="menuitem" tabindex="0" href="/app/#/supervisors_list">
<a class="pointer" role="menuitem" tabindex="0" href="/app/#/supervisor/list">
<i class="fa fa-users" aria-hidden="true"></i>
{{ 'supervisors' | translate }}
</a>
......
<!-- Supervisors -->
<div class="row">
<div ng-class="{'col-md-12':hidesupervisoradd === true && hidesupervisorupdate === true, 'col-md-8':hidesupervisoradd === false || hidesupervisorupdate === false}">
<h3 translate>supervisors</h3>
</div>
<h3 translate>supervisors</h3>
<div class="row">
<div class="row">
<div class="col-xs-3">
<a ng-click="resetForm(); hidesupervisoradd = false" class="btn btn-success btn-sm" role="button">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> {{ 'add_supervisor' | translate }}
</a>
</div>
<div class="col-xs-6 input-group">
</div>
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">
<div class="col-xs-4 input-group">
<input type="text" ng-model="search_sups" id="search_sups" placeholder="{{ 'filter' | translate }}" class="form-control" aria-describedby="basic-addon2">
<span class="input-group-addon glyphicon glyphicon-search" id="basic-addon2" aria-hidden="true"></span>
</div>
<div class="col-xs-3">
</div>
</div>
<table class="table table-striped">
<tr>
<th translate>name</th>
<th translate>email</th>
<th>Ops</th>
<th translate>options</th>
</tr>
<tr ng-repeat="supervisor in supervisors | filter:search_sups | orderBy: 'name'">
<tr ng-repeat="supervisor in supervisors_list | filter:search_sups | orderBy: 'name'">
<td class="color_blue">{{supervisor.name}} {{supervisor.surname}}</td>
<td>{{supervisor.email}}</td>
<td class="ops">
<a ng-click="update_supervisor(supervisor)" title="{{'edit'|translate}}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
<a ng-click="delete_supervisor(supervisor)" title="{{'delete'|translate}}"><span class="color_red glyphicon glyphicon-remove-circle" aria-hidden="true"></span></a>
</td>
</tr>
</table>
</div>
<!-- Add Supervisor Form -->
<div ng-include="'modules/admin/views/supervisors_add.html'" class="col-md-4" ng-init="hidesupervisoradd = true" ng-hide="hidesupervisoradd"></div>
<!-- Update Supervisor Form -->
<div ng-include="'modules/admin/views/supervisors_update.html'" class="col-md-4" ng-init="hidesupervisorupdate = true" ng-hide="hidesupervisorupdate"></div>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment