--- /dev/null
+<div class="strong-text-2">[% l('Surveys') %]</div>
+<div class="row pad-vert" ng-repeat="survey in surveys">
+ <div class="col-md-12">
+ <div class="row">
+ <div class="col-md-2 strong-text">[% l('Survey') %] #{{survey.id()}}</div>
+ <div class="col-md-6 strong-text">{{survey.description()}}</div>
+ <div class="col-md-4">
+ <div class="pull-right">
+ <span class="pad-horiz alert alert-warning strong-text" ng-if="survey.required() == 't'">[% l('Required') %]</span>
+ <span class="pad-horiz alert alert-info strong-text " ng-if="survey.opac() == 't'">[% l('OPAC Visible') %]</span>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-12 well" style="margin-left:12px">
+ <ol>
+ <li ng-repeat="question in survey.questions()">{{question.question()}}
+ <div class="row" ng-repeat="response in question.responses() | limitTo:-1">
+ <span class="col-md-4">[% l('Last Answered on: ') %]{{response.answer_date() | date}}</span>
+ <span class="col-md-3">[% l('Answer: ') %] <span class="strong-text">{{response.answer().answer()}}</span></span>
+ </div>
+ </li>
+ </ol>
+ </div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
resolve : resolver
});
+ $routeProvider.when('/circ/patron/:id/surveys', {
+ templateUrl: './circ/patron/t_surveys',
+ controller: 'PatronSurveyCtrl',
+ resolve : resolver
+ });
+
$routeProvider.otherwise({redirectTo : '/circ/patron/search'});
})
});
}])
+.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) {