Basic Info
<% if @customer.id_type == "nationalid" %>
ID Number: <%= @customer.idnumber %>
<% else %>
Passport Number: <%= @customer.idnumber %>
<% end %>
Email: <%= @customer.email %>
Phone / Mobile: <%= [@customer.phone, @customer.mobile_1, @customer.mobile_2].compact.join(" / ") %>
City: <%= @customer.city %>
Address: <%= [@customer.address_1, @customer.address_2, @customer.customer_address].compact.join(", ") %>
Country: <%= @customer.country %>
Stand Number: <%= @customer.stand_number %>
Customer Type: <%= @customer.customer_type&.name %>
Customer Group: <%= @customer.customer_group&.name %>
Individual? <%= @customer.is_individual ? "Yes" : "No" %>
Employment & Financial
Employment Type: <%= @customer.employment_type %>
Employer Name: <%= @customer.employer_name %>
Salary: <%= number_to_currency(@customer.salary) %>
Referral: <%= @customer.referral %>
Other Details
DOB: <%= @customer.dob %>
Sex: <%= @customer.sex ? "Male" : "Female" %>
Registration Date: <%= @customer.registration_date %>
File Number: <%= @customer.file_number %>
VAT Number: <%= @customer.vat_number %>
TIN Number: <%= @customer.tin_number %>
Prefix No: <%= @customer.prefix_no %>
Country Based: <%= @customer.country_based %>
API Customer ID: <%= @customer.api_customerid %>
Representatives
<% if @customer.representatives.any? %> <% @customer.representatives.each do |rep| %>
Representative: <%= rep.firstname %> <%= rep.lastname %>

firstname: <%= rep.firstname %>

lastname: <%= rep.lastname %>

Relationship: <%= rep.relationship %>

<% if rep.id_number.present? %>
ID Number/ Passport Number: <%= rep.id_number %>
<% end %>
Uploaded Documents (<%= rep.documents.count %>)
<% if rep.documents.any? %>
<% rep.documents.each do |document| %> <% file = document.file; next unless file.attached? %> <% icon_class = if file.image? "fa-file-image text-primary" elsif file.content_type.include?("pdf") "fa-file-pdf text-danger" elsif file.content_type.include?("word") "fa-file-word text-info" else "fa-file text-muted" end %>

<%= document.title.presence || file.filename.to_s %>

<% if file.image? %> <%= image_tag file, class: "img-fluid rounded shadow-sm document-thumbnail", data: { bs_toggle: "modal", bs_target: "#previewModal-#{document.id}" } %> <% elsif file.content_type.include?("pdf") %>

View PDF Preview

<% else %>

Preview not available for this file type.

<% end %>
<%= link_to "🔍 Preview", "#", class: "btn btn-outline-secondary btn-sm", data: { bs_toggle: "modal", bs_target: "#previewModal-#{document.id}" } %> <%= link_to "⬇ Download", rails_blob_url(file, disposition: "attachment"), class: "btn btn-primary btn-sm", target: "_blank" %>
<% end %>
<% else %>

No documents uploaded for this representative.

<% end %>
<% end %> <% else %>

No representatives.

<% end %>
Next of Kin
<% if @customer.next_of_kins.any? %> <% @customer.next_of_kins.each do |nok| %> <% end %>
Name Relation Mobile Email Immediate? Active?
<%= [nok.firstname, nok.lastname].compact.join(" ") %> <%= nok.relation %> <%= nok.mobile_1 %> <%= nok.email %> <%= nok.immediate ? "Yes" : "No" %> <%= nok.active ? "Yes" : "No" %>
<% else %>

No next of kin recorded.

<% end %>
Customer Documents
<% if @customer.documents.any? %>
<% @customer.documents.each do |document| %> <% file = document.file; next unless file.attached? %> <% icon_class = if file.image? "fa-file-image text-primary" elsif file.content_type.include?("pdf") "fa-file-pdf text-danger" elsif file.content_type.include?("word") "fa-file-word text-info" else "fa-file text-muted" end %> <% end %>
Type Title Preview Uploaded At Download
<%= document.title.presence || file.filename.to_s %> <% if file.image? || file.content_type.include?("pdf") %> <% else %> N/A <% end %> <%= document.created_at.strftime("%d %b %Y %H:%M") %> <%= link_to "⬇ Download", rails_blob_url(file, disposition: "attachment"), class: "btn btn-primary btn-sm", target: "_blank" %>
<% else %>

No documents available for this customer.

<% end %>
Proofs of Payment
<% if @proof_of_payments.any? %>
<% @proof_of_payments.each do |proof| %> <% file = proof.file; next unless file.attached? %> <% icon_class = if file.image? "fa-file-image text-primary" elsif file.content_type.include?("pdf") "fa-file-pdf text-danger" elsif file.content_type.include?("word") "fa-file-word text-info" else "fa-file text-muted" end %> <% end %>
Type Comment Preview Uploaded At Download
<%= proof.comment %> <% if file.image? || file.content_type.include?("pdf") %> <% else %> N/A <% end %> <%= proof.created_at.strftime("%d %b %Y %H:%M") %> <%= link_to "⬇ Download", rails_blob_url(file, disposition: "attachment"), class: "btn btn-primary btn-sm", target: "_blank" %>
<% else %>

No proofs of payment uploaded.

<% end %>