app/views/backstage/users/index.html.haml
= render "backstage/header"
.container
.row
.col-lg-12
= title "Users"
.well
= search_form_for [:backstage, @q], builder: SimpleForm::FormBuilder do |f|
.row
.col-lg-3= f.input :first_name_cont, label: "First Name"
.col-lg-3= f.input :last_name_cont, label: 'Last name'
.col-lg-3= f.input :username_cont, label: 'Username'
.col-lg-3= f.input :email_cont, label: 'Email'
.row
.col-lg-3
= f.input :country_code_eq, as: 'country', label: 'Country', iso_codes: true, include_blank: 'ALL'
.col-lg-3
= f.input :workflow_state_eq, collection: User.workflow_spec.state_names, label: "State", include_blank: 'ALL'
.col-lg-3
= f.input :roles_name_eq, collection: Role::AVAILABLE, include_blank: 'ALL'
.col-lg-3.m-auto
= f.submit "Filter", class: 'btn btn-primary'
= page_entries_info @users
%table.table
%thead
%tr
%th= sort_link @q, :id, 'ID'
%th
Name
(#{sort_link @q, :first_name, "First"})
(#{sort_link @q, :last_name, "Last"})
%th= sort_link @q, :email, 'Email'
%th= sort_link @q, :created_at, "Joined"
%th Labs
%th Role
%tbody
- @users.each do |user|
%tr
%td= user.id
%td= link_to user, backstage_user_path(user)
%td= mail_to user.email, user.email
%td= user.created_at
%td= user.employees.count
%td= user.role_names
= paginate @users, theme: 'twitter-bootstrap-4', nav_class: "m-auto pt-3"