<%= @customer.customer_name %>
<% mandatory_docs = @document_verifications.select { |dv| dv.customer_type_requirement.mandatory } %>
<% all_verified = mandatory_docs.all?(&:verified) %>
<% if all_verified && !@customer.verified? %>
<%= button_to "Approve Customer",
approve_admin_portal_customer_path(@customer),
method: :post,
data: { turbo: false },
class: "btn btn-success btn-sm rounded-pill px-3" %>
<% elsif @customer.verified? %>
<%= button_to "Unverify Customer",
unapprove_admin_portal_customer_path(@customer),
method: :post,
data: { turbo: false },
class: "btn btn-warning btn-sm rounded-pill px-3" %>
<% end %>
<% if @customer.verified? %>
✅ Verified
<% else %>
⏳ Pending Verification
<% end %>
<% last_verifier = @customer.customer_document_verifications.where(verified: true).order(verified_at: :desc).first %>
<% if last_verifier.present? %>
Documents verified by <%= last_verifier.verified_by&.email %>
(<%= last_verifier.verified_at&.strftime("%d %b %Y %H:%M") %>)
<% else %>
Documents Not Verified
<% end %>
<% if @customer.verified? && @customer.approved_by.present? %>
Customer approved by <%= @customer.approved_by.email %>
(<%= @customer.approved_at&.strftime("%d %b %Y %H:%M") %>)
<% else %>
Customer Not Approved
<% end %>