forked from Gitlink/forgeplus
68 lines
3.6 KiB
Plaintext
68 lines
3.6 KiB
Plaintext
<% define_admin_breadcrumbs do %>
|
||
<% add_admin_breadcrumb('NPS用户调研', admins_nps_path) %>
|
||
<% end %>
|
||
|
||
<div class="box search-form-container user-list-form">
|
||
<%= form_tag(admins_nps_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
||
|
||
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: 'ID/姓名/邮箱/手机号检索') %>
|
||
<label for="done_score">
|
||
是否已打分
|
||
</label>
|
||
<%= check_box_tag("done_score", true, false, id: "done_score", style: 'margin-left: 2px;') %>
|
||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||
|
||
<span style="margin-left: 50px;margin-right: 10px;">NPS系统开关</span>
|
||
<input type="checkbox"
|
||
<% if @on_off_switch %>checked
|
||
<% end %> data-toggle="toggle" data-onstyle="primary" id="nps_toggle" data-on="开" data-off="关" data-size="small">
|
||
|
||
<% end %>
|
||
|
||
</div>
|
||
<div class="box py-0 pt-4 pl-4 daily-school-statistic-title" >
|
||
<p style="font-weight: bold">数据统计:</p>
|
||
<p>
|
||
评分用户数/用户总数:<span class="text-danger"><%= @score_total_count %>/<%= UserNp.count %></span>,
|
||
平均评分:<span class="text-danger"><%= UserNp.where("action_type !='close'").average(:score).to_f.round(1) %></span>,
|
||
<% @user_nps_mid = @score_total_count % 2 == 0 ? @score_total_count / 2 : (@score_total_count + 1) / 2 %>
|
||
评分中位数:<span class="text-danger"><%= UserNp.where("action_type !='close'").order("score").pluck(:score)[@user_nps_mid - 1].to_i %></span>,
|
||
最低评分/评分人数:<span class="text-danger"><%=@min_score.to_i %>/<%= UserNp.where("action_type !='close'").where(score: @min_score).count %></span>,
|
||
最高评分/评分人数:<span class="text-danger"><%=@max_score.to_i %>/<%= UserNp.where("action_type !='close'").where(score: @max_score).count %></span>
|
||
</p>
|
||
<p style="padding-bottom: 10px !important;">
|
||
填写意见用户数/用户总数:<span class="text-danger"><%= UserNp.where("LENGTH(memo) >0").count %>/<%= UserNp.count %></span>,
|
||
期待更加丰富的功能:<span class="text-danger"><%= UserNp.where("memo like '%期待更加丰富的功能%'").count %></span>,
|
||
希望有新手引导:<span class="text-danger"><%= UserNp.where("memo like '%希望有新手引导%'").count %></span>,
|
||
提升用户体验:<span class="text-danger"><%= UserNp.where("memo like '%用户体验需进一步提升%'").count %></span>,
|
||
其他:<span class="text-danger"><%= UserNp.where("action_type !='close'").where("LENGTH(memo) >0").where.not(id: UserNp.where("memo like '%期待更加丰富的功能%' or memo like '%希望有新手引导%' or memo like '%用户体验需进一步提升%' ").ids).count %></span>
|
||
</p>
|
||
</div>
|
||
<div class="box admin-list-container users-list-container">
|
||
<%= render partial: 'admins/nps/user_np_list', locals: { user_nps: @user_nps } %>
|
||
</div>
|
||
|
||
<script>
|
||
$(function () {
|
||
$('#nps_toggle').bootstrapToggle({
|
||
on: '开',
|
||
off: '关'
|
||
});
|
||
$('#nps_toggle').change(function () {
|
||
var switch_value = $(this).prop('checked');
|
||
var url = "/admins/nps/switch_change.json"
|
||
$.ajax({
|
||
method: 'POST',
|
||
dataType: 'json',
|
||
url: url,
|
||
data: {'switch': switch_value},
|
||
success: function () {
|
||
$.notify({message: '操作成功'});
|
||
},
|
||
error: function (res) {
|
||
|
||
}
|
||
});
|
||
})
|
||
})
|
||
</script> |