gitlink-forgeplus/app/views/admins/nps/index.html.erb

45 lines
1.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/姓名/邮箱/手机号检索') %>
<%= 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 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>