unserver-unify
Version:
251 lines (249 loc) • 10.7 kB
HTML
<div ng-controller="surveyDetailCtrl as ctrl">
<div class="col-md-3 hidden-xs">
<div class="profile sidebar no-wrap">
<div class="panel no-bg ongoing margin-bottom-20">
<div class="panel-heading overflow-h">
<h2 class="panel-title heading-sm pull-left">
<i class="fa fa-list">
</i>
<span translate="">
Latest
</span>
</h2>
</div>
<!--detail -->
<ul>
<li class="profile-event" ng-repeat="item in ctrl.displaySurveys | orderBy: -created |limitTo: 3 ">
<div class="overflow-h">
<h3 class="heading-xs">
<!-- <a ui-sref="index.survey.detail({ id: item._id })">
{{ item.name }}
</a> -->
<a ng-if="!item.public && !item.answered" ui-sref=".({ id : item._id ,answered:item.answered,take:true})">
{{item.name}}
</a>
<a ng-if="!item.public && item.answered" ui-sref=".({ id : item._id ,answered:item.answered})">
{{item.name}}
</a>
<a ng-if="item.public" ui-sref=".({ id : item._id,answered:item.answered,take:true })">
{{item.name}}
</a>
<i aria-hidden="true" class="fa fa-user">
</i> ({{item.counter || 0}})
</h3>
<div class="item-date font-12">
<span>
{{ item.created|date:shortDate }}
</span>
</div>
<p style="max-height:36px; overflow: hidden;">
{{ item.description }}
</p>
<a class="color-orange" href="javascript:;" ng-if="!item.answered || item.public" ui-sref=".({id: item._id,answered:item.answered,take:true})" translate="">
Take Survey
<i class="fa fa-angle-right">
</i>
</a>
<a class="pull-left" href="javascript:;" ng-if="item.answered || item.public" ui-sref="^.result({id: item._id,force:true})">
{{'View Result' | translate}}
<i class="fa fa-angle-right">
</i>
</a>
</div>
</li>
</ul>
<div class="clearfix">
</div>
</div>
</div>
<div class="profile sidebar no-wrap">
<div class="panel no-bg ongoing margin-bottom-20">
<div class="panel-heading overflow-h">
<h2 class="panel-title heading-sm pull-left">
<i class="fa fa-list">
</i>
<span translate="">
Most answered
</span>
</h2>
</div>
<ul>
<li class="profile-event" ng-repeat="item in ctrl.displaySurveys | orderBy: -created |limitTo: 3 ">
<div class="overflow-h">
<h3 class="heading-xs">
<a ng-if="!item.public && !item.answered" ui-sref=".({ id : item._id ,answered:item.answered,take:true})">
{{item.name}}
</a>
<a ng-if="!item.public && item.answered" ui-sref=".({ id : item._id ,answered:item.answered})">
{{item.name}}
</a>
<a ng-if="item.public" ui-sref=".({ id : item._id,answered:item.answered,take:true })">
{{item.name}}
</a>
<i aria-hidden="true" class="fa fa-user">
</i> ({{item.counter || 0}})
</h3>
<div class="item-date font-12">
<span>
{{ item.created|date:shortDate }}
</span>
</div>
<p style="max-height:36px; overflow: hidden;">
{{ item.description }}
</p>
<a class="color-orange" href="javascript:;" ng-if="!item.answered || item.public" ui-sref=".({id: item._id,answered:item.answered,take:true})" translate="">
Take Survey
<i class="fa fa-angle-right">
</i>
</a>
<a class="pull-left" href="javascript:;" ng-if="item.answered || item.public" ui-sref="^.result({id: item._id,force:true})">
{{ {eng:'View Result', chn:'显示结果'}| trans}}
<i class="fa fa-angle-right">
</i>
</a>
</div>
</li>
</ul>
<!--div class="profile-event text-center" ng-if="!ctrl.latest||ctrl.latest.length<1" style="color:#e67e22">
No survey to show
</div-->
<div class="clearfix">
</div>
</div>
</div>
</div>
<div class="col-md-9 col-xs-12">
<div class="news-v3 bg-color-white ">
<div class="news-v3-in survey_container">
<h3>
{{ ctrl.item.name }}
</h3>
<p style="font-size: 18px; border-bottom: solid 3px #72c02c; padding-bottom: 10px;">
{{ ctrl.item.description }}
</p>
<div ng-if="(ctrl.item.public&&!ctrl.forceResult)|| (!ctrl.resultFlag&&!ctrl.item.public)">
<div ng-if="ctrl.item.public">
<label class="pull-left" style="line-height: 30px;">
{{'User Name'|translate}}
</label>
<input style="float: left; width: 38.5%;" class="item item-input form-control" ng-model="ctrl.item.username" placeholder="Name" type="text" />
<div class="margin-bottom-30"></div>
</div>
<div ng-repeat="q in ctrl.item.questions">
<div class="headline" ng-if="q.type=='heading'">
<h4 translate="">
{{q.content}}
</h4>
</div>
<div ng-if="q.type!='heading'">
<div class="tag-box tag-box-v2 adjust">
<div class="pull-left">
<b>
Q{{ q.index }}.
</b>
</div>
<div ng-bind-html="q.content">
</div>
</div>
</div>
<!-- SCQ -->
<table class="margin-bottom-20 survey_ans" ng-if="!q.type||q.type=='single'">
<!-- radio SCQ-->
<tr ng-repeat="opt in q.options">
<td align="center" width="30">
{{ numToLetters($index ) }}.
</td>
<td for="opt{{ $index }}">
<input id="opt{{ $index }}" ng-model="q.selection" type="radio" value="{{ opt.text }}" /> {{ opt.text }}
</td>
</tr>
</table>
<!-- MCQ -->
<table ng-if="q.type=='multiple'">
<!-- checkbox MCQ-->
<tr ng-repeat="opt in q.options">
<td align="center" width="30">
{{ numToLetters($index ) }}.
</td>
<td for="opt{{ $index }}">
<input ng-model="opt.selection" type="checkbox" value="{{ opt.text }}" /> {{ opt.text }}
</td>
</tr>
</table>
<!-- FILL -->
<div class="col-md-6 padding-left-0" ng-if="q.type=='fill'">
<input class="form-control" ng-model="q.selection" style="margin-top:15px;" type="text" />
</div>
<div class="col-md-6 padding-left-0" ng-if="q.type=='number'">
<input class="form-control" ng-model="q.selection" style="margin-top:15px;" type="number" />
</div>
<div ng-if="q.type=='rating'" class="col-md-12 padding-left-0 survey_rating">
<span max="5" ng-model="q.selection" class="color-blue" uib-rating="">
</span>
{{ q.selection }}
<span ng-if="!q.selection">
{{'Please Rate it' | translate }} !
</span>
<span class="survey_legend two_step">
<span class="color-red">1: {{'Below Expectation' | translate}}</span>
<span class="color-green">5: {{'Above Expectation' | translate}}</span>
</span>
</div>
<div class="clearfix margin-bottom-20">
</div>
</div>
<div class="clearfix">
</div>
<button class="btn btn-u" ng-click="ctrl.submit()" style="padding:5px 20px" translate="">
Submit
</button>
<button class="btn btn-info" ng-click="ctrl.showresult()" ng-if="ctrl.item.public && ctrl.item.result " style="padding:5px 20px" translate="">
Result
</button>
<div class="clearfix">
</div>
</div>
<!-- result -->
<div class="survey_result" ng-if="ctrl.forceResult||(ctrl.resultFlag&&ctrl.item.result&& !ctrl.item.public)">
<!--div class="survey_result" ng-if="(ctrl.answered )"-->
<div class="row" ng-repeat="q in ctrl.item.questions">
<div class="col-md-12 col-xs-12 margin-bottom-30">
<h2>
Q{{ $index+1 }}.
</h2>
<p ng-bind-html="q.content"></p>
<p class="totalresult" style="margin-bottom:30px">
{{ ctrl.summary[q.index]._total }}
<span translate="">
People Answered
</span>
</p>
<div class="col-md-5 col-xs-12">
<canvas chart-data="ctrl.summary[q.index].data" tc-chartjs-doughnut="">
</canvas>
</div>
<div chart-legend="legend" style="margin-top:20px; float:left;" tc-chartjs-legend="">
</div>
</div>
</div>
<div ng-if="!ctrl.summary">
<div class="alert alert-success">
<strong translate="">Success</strong> {{'Please wait for the result !'| translate}}
</div>
</div>
<div class="clearfix">
</div>
</div>
<div class="survey_result" ng-if="ctrl.resultFlag&&!ctrl.item.result">
<div class="alert alert-info">
<strong translate="">Info</strong> {{'Survey result submited!'| translate}}
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix">
</div>
</div>
</div>
<div class="margin-bottom-30"></div>
</div>
</div>