From 8ef5d7b4987b3c0c24d406f22fa8567548683f28 Mon Sep 17 00:00:00 2001 From: Kyle Huckins Date: Wed, 30 Nov 2016 10:10:48 -0800 Subject: [PATCH] LP#1511358 Patron Survey Interface Add patron survey interface and link to interface in "Other" dropdown beneath Statistical Categories. Display surveys similarly to how notes are displayed, as well as how surveys are displayed in the existing XUL staff client. Signed-off-by: Kyle Huckins Changes to be committed: modified: Open-ILS/src/templates/staff/circ/patron/index.tt2 new file: Open-ILS/src/templates/staff/circ/patron/t_surveys.tt2 modified: Open-ILS/web/js/ui/default/staff/circ/patron/app.js --- Open-ILS/src/templates/staff/circ/patron/index.tt2 | 5 ++++ .../src/templates/staff/circ/patron/t_surveys.tt2 | 27 ++++++++++++++++++ .../web/js/ui/default/staff/circ/patron/app.js | 33 ++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 Open-ILS/src/templates/staff/circ/patron/t_surveys.tt2 diff --git a/Open-ILS/src/templates/staff/circ/patron/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/index.tt2 index 50c8bd782a..273e891bb7 100644 --- a/Open-ILS/src/templates/staff/circ/patron/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2 @@ -154,6 +154,11 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
  • + + [% l('Surveys') %] + +
  • +
  • [% l('Group Member Details') %] diff --git a/Open-ILS/src/templates/staff/circ/patron/t_surveys.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_surveys.tt2 new file mode 100644 index 0000000000..bd059b8f3f --- /dev/null +++ b/Open-ILS/src/templates/staff/circ/patron/t_surveys.tt2 @@ -0,0 +1,27 @@ +
    [% l('Surveys') %]
    +
    +
    +
    +
    [% l('Survey') %] #{{survey.id()}}
    +
    {{survey.description()}}
    +
    +
    + [% l('Required') %] + [% l('OPAC Visible') %] +
    +
    +
    +
    +
    +
      +
    1. {{question.question()}} +
      + [% l('Last Answered on: ') %]{{response.answer_date() | date}} + [% l('Answer: ') %] {{response.answer().answer()}} +
      +
    2. +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index bc2f390393..1187470964 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -208,6 +208,12 @@ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', resolve : resolver }); + $routeProvider.when('/circ/patron/:id/surveys', { + templateUrl: './circ/patron/t_surveys', + controller: 'PatronSurveyCtrl', + resolve : resolver + }); + $routeProvider.otherwise({redirectTo : '/circ/patron/search'}); }) @@ -1606,6 +1612,33 @@ function($scope, $routeParams , $q , egCore , patronSvc) { }); }]) +.controller('PatronSurveyCtrl', + ['$scope','$routeParams','$location','egCore','patronSvc', +function($scope, $routeParams , $location , egCore , patronSvc) { + $scope.initTab('other', $routeParams.id); + var usr_id = $routeParams.id; + var org_ids = egCore.org.fullPath(egCore.auth.user().ws_ou(), true); + $scope.surveys = []; + // fetch the surveys + egCore.pcrud.search('asvr', + {usr : usr_id}, + {flesh : 4, flesh_fields : { + asvr : ['question', 'survey', 'answer'], + asv : ['responses', 'questions'], + asvq : ['responses', 'question'] + }}, + {authoritative : true}) + .then(null, null, function(survey) { + var sameSurveyId = false; + if (survey.survey().id() && $scope.surveys.length > 0) { + for (sid = 0; sid < $scope.surveys.length; sid++) { + if (survey.survey().id() == $scope.surveys[sid].id()) sameSurveyId = true; + } + } + if (!sameSurveyId) $scope.surveys.push(survey.survey()); + }); +}]) + .controller('PatronFetchLastCtrl', ['$scope','$location','egCore', function($scope , $location , egCore) { -- 2.11.0