From e2ee72f29c097ba64f68ed5134b266acf9b723a8 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 Signed-off-by: Terran McCanna Signed-off-by: Kathy Lussier --- .../src/templates/staff/circ/patron/index.tt2 | 5 +++ .../templates/staff/circ/patron/t_surveys.tt2 | 27 +++++++++++++++ .../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 7e16ec442a..c1b81961e1 100644 --- a/Open-ILS/src/templates/staff/circ/patron/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2 @@ -157,6 +157,11 @@ angular.module('egCoreMod').run(['egStrings', function(s) { [% l('Statistical Categories') %] +
  • + + [% 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 1dc380f89b..e075c4f6f8 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 @@ -214,6 +214,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'}); }) @@ -1633,6 +1639,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.43.2