diff --git a/bower.json b/bower.json index ecb1d32..94849da 100644 --- a/bower.json +++ b/bower.json @@ -22,7 +22,8 @@ "angular-translate": "~2.8.0", "lodash": "~3.10.1", "bootstrap": "~3.3.5", - "angular-google-maps": "~2.2.1" + "angular-google-maps": "~2.2.1", + "angular-smart-table": "~2.1.5" }, "resolutions": { "angular": "1.4.6" diff --git a/index.html b/index.html index 1618154..4e06a5a 100644 --- a/index.html +++ b/index.html @@ -13,10 +13,12 @@ + + diff --git a/js/app.js b/js/app.js index aab9fbd..56fe292 100644 --- a/js/app.js +++ b/js/app.js @@ -2,7 +2,8 @@ angular.module('Come2HelpApp', [ 'ngRoute', 'Come2HelpController', 'uiGmapgoogle-maps', - 'pascalprecht.translate' + 'pascalprecht.translate', + 'smart-table' ]) .config(['$routeProvider', function ($routeProvider) { @@ -15,6 +16,11 @@ angular.module('Come2HelpApp', [ when('/register/done', { templateUrl: 'partials/registerDone.html' }). + when('/organisation/volunteerList', { + templateUrl: 'partials/organisation/volunteerList.html', + controller: 'VolunteerListController', + controllerAs: 'ctrl' + }). otherwise({ redirectTo: '/register' }); diff --git a/js/organisation.js b/js/organisation.js new file mode 100644 index 0000000..bc7df78 --- /dev/null +++ b/js/organisation.js @@ -0,0 +1,24 @@ +angular.module('Come2HelpController').factory('Volunteers', ['$resource', function ($resource) { + return $resource('api/volunteers/:id'); +}]); + +angular.module('Come2HelpController').controller('VolunteerListController', ['Volunteers', 'geocoder', function (Volunteers, geocoder) { + var vm = this; + + vm.volunteers = []; + + vm.search = function () { + var result = geocoder.geocode('Germany, ' + vm.zipCode, function (results) { + var latitude = results.results[0].geometry.location.lat(); + var longitude = results.results[0].geometry.location.lng(); + + Volunteers.query({ + latitude: latitude, + longitude: longitude, + distance: vm.distance * 1000 + }, function (data) { + vm.volunteers = data; + }); + }); + }; +}]); diff --git a/partials/organisation/volunteerList.html b/partials/organisation/volunteerList.html new file mode 100644 index 0000000..b2e8c2a --- /dev/null +++ b/partials/organisation/volunteerList.html @@ -0,0 +1,30 @@ +
{{ 'Given Name' | translate }} | +{{ 'Surname' | translate }} | +{{ 'Zip Code' | translate }} | +{{ 'Phone' | translate }} | +{{ 'E-Mail' | translate }} | +{{ 'Abilities' | translate }} | +
---|---|---|---|---|---|
{{volunteer.givenName}} | +{{volunteer.surname}} | +{{volunteer.address.zipCode}} | +{{volunteer.phone}} | +{{volunteer.email}} | +{{volunteer.abilities}} | +