<% Struct.new("Customer", :name, :twitter_handle, :last_login_at, :active) %>
<% customers = [
Struct::Customer.new("Alice Johnson", "alice_j", Time.now - 3600, true),
Struct::Customer.new("Bob Smith", "bob_s", Time.now - 7200, true),
Struct::Customer.new("Charlie Brown", "charlie_b", Time.now - 10800, false)
] %>
<div class="p-4">
<%= render Railsboot::HeaderComponent.new do |header| %>
<% header.with_heading.with_content("All Customers") %>
<% header.with_breadcrumb.with_items([{text: "Main", href: "#"}, {text: "Customers", active: true}]) %>
<% end %>
<div class="row mt-4">
<div class="col-sm-12 col-md-8">
<%= render Railsboot::CardComponent.new do |card| %>
<% card.with_header { render Railsboot::BadgeComponent.new(color: "warning").with_content("#{customers.size} Customers") } %>
<% card.with_body do %>
<%= render Railsboot::TableComponent.new do |table| %>
<% table.with_head do |head| %>
<% head.with_row do |row| %>
<% row.with_cell(tag: "th") { "Name" } %>
<% row.with_cell(tag: "th") { "Status" } %>
<% row.with_cell(tag: "th") { "Twitter" } %>
<% row.with_cell(tag: "th") { "Last Login" } %>
<% end %>
<% end %>
<% table.with_body do |body| %>
<% customers.each do |customer| %>
<% body.with_row do |row| %>
<% row.with_cell { link_to customer.name, "#" } %>
<% row.with_cell do %>
<% if customer.active %>
<%= render Railsboot::BadgeComponent.new(color: "success").with_content("active") %>
<% else %>
<%= render Railsboot::BadgeComponent.new(color: "danger").with_content("inactive") %>
<% end %>
<% end %>
<% row.with_cell { link_to("@" + customer.twitter_handle, "https://twitter.com/#{customer.twitter_handle}") } %>
<% row.with_cell { tag.code l(customer.last_login_at.to_date, format: :long) } %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= render Railsboot::PaginationComponent.new(pagy: Pagy.new(count: 50, page: 1)) %>
<% end %>
<% end %>
</div>
<div class="col-sm-12 col-md-4 mt-4 mt-md-0">
<%= render Railsboot::CardComponent.new do |card| %>
<% card.with_header.with_content("Search") %>
<% card.with_body do %>
<%= form_tag nil, method: :get do %>
<div class="mt-1">
<%= label_tag :text, "Fulltext", class: "form-label" %>
<%= text_field_tag :text, params[:text], placeholder: "Name, Email, etc.", class: "form-control", autocomplete: "off" %>
</div>
<div class="mt-3">
<%= submit_tag "Search", name: nil, class: "btn btn-outline-secondary" %>
</div>
<% end %>
<% end %>
<% end %>
</div>
</div>
</div>