mirror of
https://github.com/SrIzan10/hc-identity-vault.git
synced 2026-05-01 10:45:20 +00:00
237 lines
13 KiB
Plaintext
237 lines
13 KiB
Plaintext
<%= render Components::Window.new("Document Review", close_url: pending_backend_verifications_path, max_width: 1200) do %>
|
|
<div class="padding">
|
|
<div class="grid" style="grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem;">
|
|
<!-- Identity Information -->
|
|
<%= render Components::IdentityReview::BasicDetails.new(@verification.identity) %>
|
|
<!-- Document Information -->
|
|
<% case @verification %>
|
|
<% when Verification::DocumentVerification %>
|
|
<%= render Components::IdentityReview::DocumentInfo.new(@verification) %>
|
|
<% when Verification::AadhaarVerification %>
|
|
<%= render Components::IdentityReview::AadhaarInfo.new(@verification) %>
|
|
<% end %>
|
|
</div>
|
|
<% if @verification.identity.resemblances.any? %>
|
|
<div class="banner warning">
|
|
<h2>heads up!</h2>
|
|
<p>this identity may be a duplicate of another identity.</p>
|
|
<% @verification.identity.resemblances.each do |resemblance| %>
|
|
<%= render Components::Resemblance.new(resemblance) %>
|
|
<% end %>
|
|
Please double-check that they're not the same person before approving.
|
|
</div>
|
|
<% end %>
|
|
<% if @verification.issues.any? %>
|
|
<div class="banner info">
|
|
<h2>hey, just so you know:</h2>
|
|
<b>automated checks noticed:</b>
|
|
<ul>
|
|
<% @verification.issues.each do |issue| %>
|
|
<li><%= issue %></li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
<!-- Document Files -->
|
|
<div class="lowered padding" style="margin-bottom: 2rem;">
|
|
<% if @verification.is_a?(Verification::VouchVerification) %>
|
|
<p>This user has been manually vouched for on <%= @verification.created_at.strftime("%B %d, %Y at %I:%M %p") %></p>
|
|
<% if @verification.evidence.attached? %>
|
|
<h3>Evidence</h3>
|
|
<img src="<%= url_for(@verification.evidence) %>" alt="Vouch evidence" style="max-width: 100%;">
|
|
<% else %>
|
|
<p>No evidence attached.</p>
|
|
<% end %>
|
|
<% else %>
|
|
<%= render Components::BreakTheGlass.new(@relevant_object, auto_break_glass: @verification.pending? ? "to review validity" : nil) do %>
|
|
<% case @relevant_object %>
|
|
<% when Identity::Document %>
|
|
<%= render Components::IdentityReview::DocumentFiles.new(@relevant_object) %>
|
|
<% when Identity::AadhaarRecord %>
|
|
<%= render Components::IdentityReview::AadhaarFull.new(@relevant_object) %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<!-- Verification Actions -->
|
|
<% if @verification.pending? %>
|
|
<div class="lowered padding">
|
|
<h2 style="margin-top: 0;">Verification Decision</h2>
|
|
<div class="grid" style="grid-template-columns: 1fr 1fr 1fr; gap: 2rem;">
|
|
<!-- Approve YSWS Eligible -->
|
|
<div>
|
|
<h3 style="color: #059669;">✅ Approve (YSWS Eligible)</h3>
|
|
<p>Document approved and identity is YSWS eligible.</p>
|
|
<%= form_with url: approve_backend_verification_path(@verification), method: :patch, local: true do |form| %>
|
|
<%= form.hidden_field :ysws_eligible, value: true %>
|
|
<% mdv_tool do %>
|
|
<%= form.submit "Approve (YSWS Eligible)",
|
|
class: "button",
|
|
style: "width: 100%;",
|
|
data: { confirm: "Are you sure you want to approve this document and mark as YSWS eligible?" } %>
|
|
<% if @verification.identity.birthday < 19.years.ago %>
|
|
<p style="color: #f59e0b;">
|
|
⚠️ Warning: <%= @verification.identity.birthday %> is more than 19 years ago.
|
|
</p>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<!-- Approve YSWS Ineligible -->
|
|
<div>
|
|
<h3 style="color: #f59e0b;">✅ Approve (YSWS Ineligible)</h3>
|
|
<p>Document approved but identity is not YSWS eligible.</p>
|
|
<%= form_with url: approve_backend_verification_path(@verification), method: :patch, local: true do |form| %>
|
|
<%= form.hidden_field :ysws_eligible, value: false %>
|
|
<% mdv_tool do %>
|
|
<%= form.submit "Approve (YSWS Ineligible)",
|
|
class: "button",
|
|
style: "width: 100%;",
|
|
data: { confirm: "Are you sure you want to approve this document and mark as YSWS ineligible?" } %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<!-- Reject -->
|
|
<div>
|
|
<h3 style="color: #dc2626;">❌ Reject Document</h3>
|
|
<%= form_with url: reject_backend_verification_path(@verification), method: :patch, local: true do |form| %>
|
|
<% if @verification.identity.under_13? %>
|
|
<div style="background: #fef3c7; border: 1px solid #f59e0b; padding: 1rem; border-radius: 4px; margin-bottom: 1rem;">
|
|
⚠️ <strong>Warning:</strong> The submitted identity is under 13 years old (age <%= @verification.identity.age.round(2) %>). Consider selecting "Submitter is under 13 years old" as the rejection reason.
|
|
</div>
|
|
<% end %>
|
|
<%= form.label :rejection_reason, "Rejection Reason:" %>
|
|
<% if @verification.is_a?(Verification::AadhaarVerification) %>
|
|
<%
|
|
default_selection = if @verification.identity.under_13?
|
|
"under_13"
|
|
elsif @verification.identity.resemblances.any?
|
|
"duplicate"
|
|
else
|
|
nil
|
|
end
|
|
%>
|
|
<%= form.select :rejection_reason,
|
|
grouped_options_for_select([
|
|
[
|
|
"Retry-able Issues (user can resubmit)",
|
|
Verification::AadhaarVerification::RETRYABLE_REJECTION_REASONS.map { |reason| [Verification::AadhaarVerification::REJECTION_REASON_NAMES[reason], reason] }
|
|
],
|
|
[
|
|
"Fatal Issues (makes identity ineligible)",
|
|
Verification::AadhaarVerification::FATAL_REJECTION_REASONS.map { |reason| [Verification::AadhaarVerification::REJECTION_REASON_NAMES[reason], reason] }
|
|
]
|
|
], default_selection),
|
|
{ include_blank: "Select a reason",
|
|
required: true, style: "width: 100%; margin-bottom: 1rem;" } %>
|
|
<% elsif @verification.is_a?(Verification::DocumentVerification) %>
|
|
<%
|
|
default_selection = if @verification.identity.under_13?
|
|
"under_13"
|
|
elsif @verification.identity.resemblances.any?
|
|
"duplicate"
|
|
else
|
|
nil
|
|
end
|
|
%>
|
|
<%= form.select :rejection_reason,
|
|
grouped_options_for_select([
|
|
[
|
|
"Retry-able Issues (user can resubmit)",
|
|
Verification::DocumentVerification::RETRYABLE_REJECTION_REASONS.map { |reason| [Verification::DocumentVerification::REJECTION_REASON_NAMES[reason], reason] }
|
|
],
|
|
[
|
|
"Fatal Issues (makes identity ineligible)",
|
|
Verification::DocumentVerification::FATAL_REJECTION_REASONS.map { |reason| [Verification::DocumentVerification::REJECTION_REASON_NAMES[reason], reason] }
|
|
]
|
|
], default_selection),
|
|
{ include_blank: "Select a reason",
|
|
required: true, style: "width: 100%; margin-bottom: 1rem;" } %>
|
|
<% elsif @verification.is_a?(Verification::VouchVerification) %>
|
|
<p style="color: #059669;">✅ This document has been automatically approved.</p>
|
|
<% end %>
|
|
<%= form.label :rejection_reason_details, "Additional Details (optional):" %>
|
|
<%= form.text_area :rejection_reason_details,
|
|
rows: 3,
|
|
placeholder: "Provide specific feedback to help the user resubmit correctly...",
|
|
style: "width: 100%; margin-bottom: 1rem;" %>
|
|
<%= form.label :internal_rejection_comment, "Internal Rejection Comment (optional):" %>
|
|
<%= form.text_area :internal_rejection_comment,
|
|
rows: 2,
|
|
placeholder: "Internal notes for staff only - not visible to user...",
|
|
style: "width: 100%; margin-bottom: 1rem;" %>
|
|
<% mdv_tool do %>
|
|
<%= form.submit "Reject Document",
|
|
class: "button",
|
|
style: "width: 100%;",
|
|
data: { confirm: "Are you sure you want to reject this document?" } %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<p style="margin-top: 1rem; color: #666; font-size: 0.9em; text-align: center;">
|
|
Current YSWS Status:
|
|
<% if @verification.identity.ysws_eligible.nil? %>
|
|
<span style="color: #f59e0b;">Not Reviewed</span>
|
|
<% elsif @verification.identity.ysws_eligible %>
|
|
<span style="color: #059669;">Eligible</span>
|
|
<% else %>
|
|
<span style="color: #dc2626;">Ineligible</span>
|
|
<% end %>
|
|
</p>
|
|
</div>
|
|
<% else %>
|
|
<div class="lowered padding" style="text-align: center;">
|
|
<h3>Document Already Processed</h3>
|
|
<p>This document has already been <%= @verification.status %>.</p>
|
|
<% if @verification.rejection_reason.present? %>
|
|
<div class="lowered padding" style="margin-top: 1rem; text-align: left;">
|
|
<p style="margin: 0; font-weight: bold;">Rejection Reason:</p>
|
|
<p style="margin: 0.5rem 0;"><%= @verification.rejection_reason_name %></p>
|
|
<% if @verification.rejection_reason_details.present? %>
|
|
<p style="margin: 0; font-weight: bold;">Details:</p>
|
|
<p style="margin: 0.5rem 0;"><%= @verification.rejection_reason_details %></p>
|
|
<% end %>
|
|
<% if @verification.internal_rejection_comment.present? %>
|
|
<p style="margin: 0; font-weight: bold;">Internal Rejection Comment:</p>
|
|
<p style="margin: 0.5rem 0; font-style: italic; color: #666;"><%= @verification.internal_rejection_comment %></p>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<!-- Ignore Verification Section (Super Admin Only) -->
|
|
<% if @verification.ignored_at.blank? %>
|
|
<% super_admin_tool do %>
|
|
<div class="lowered padding" style="margin-top: 2rem;">
|
|
<h3 style="margin-top: 0;">⚠️ Super Admin: Ignore Verification</h3>
|
|
<p>
|
|
This will permanently ignore this verification and exclude it from identity status calculations. This action cannot be undone.
|
|
</p>
|
|
<%= form_with url: ignore_backend_verification_path(@verification), method: :patch, local: true do |f| %>
|
|
<div style="margin-bottom: 1rem;">
|
|
<%= f.label :reason, "Reason for ignoring (required):" %>
|
|
<%= f.text_area :reason, placeholder: "Please provide a detailed reason for ignoring this verification. This will be logged in the audit trail.", rows: 4 %>
|
|
</div>
|
|
<%= f.submit "Ignore Verification", class: "button", data: { confirm: "Are you sure you want to ignore this verification? This action cannot be undone." } %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% elsif @verification.ignored_at.present? %>
|
|
<div class="lowered padding" style="margin-top: 2rem;">
|
|
<h3 style="margin-top: 0;">🚫 Verification Ignored</h3>
|
|
<p style="margin-bottom: 0;">
|
|
<strong>Ignored on:</strong> <%= @verification.ignored_at.strftime("%B %d, %Y at %I:%M %p") %><br>
|
|
<strong>Reason:</strong> <%= @verification.ignored_reason %>
|
|
</p>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="padding">
|
|
<h2>Audit Log</h2>
|
|
<%= render Components::PublicActivity::Container.new(@activities) %>
|
|
</div>
|
|
<%= render Components::Inspector.new(@verification) %>
|
|
<%= render Components::Inspector.new(@relevant_object) %>
|
|
<% end %>
|