<% define_admin_breadcrumbs do %>
  <% add_admin_breadcrumb('操作记录', admins_user_actions_path) %>
<% end %>

<div class="box search-form-container user-list-form">
  <%= form_tag(admins_user_actions_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
    操作类型：
    <% action_type_options = [['自定义',''],['删除用户','DestroyUser'], ['删除项目', 'DestroyProject'], ['删除组织', 'DestroyOrganization']] %>
    <%= select_tag(:action_type_select, options_for_select(action_type_options), class: 'form-control') %>
    <%= text_field_tag(:action_type, params[:action_type], class: 'form-control col-sm-2 ml-3',style: 'display:;', placeholder: '自定义操作类型检索') %>
    <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '操作人用户名/邮箱/手机号检索') %>
    <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
  <% end %>

</div>

<div class="box admin-list-container users-list-container">
  <%= render partial: 'admins/user_actions/user_action_list', locals: { user_actions: @user_actions } %>
</div>

<script>
    $(function () {
        $('#action_type_select').change(function () {
            var switch_value = $(this).val();
            $('#action_type').val(switch_value);
            if (switch_value == ''){
                $('#action_type').show();
            }else{
                $('#action_type').hide();
            }
        })
    })
</script>
