<% content_for :title, "#{@loan_application.product.name} Loan Application" %>

<%= @loan_application.product.name %> Application for <%= @loan_application.customers[0] %>

<%= notice %>

<% unless @loan_application.submitted? %> <%= form_with(model: @loan_application, local: true) do |form| %> <% if @loan_application.errors.any? %>

<%= pluralize(loan_application.errors.count, "error") %> prohibited this loan_application from being saved:

    <% @loan_application.errors.full_messages.each do |message| %>
  • <%= message %>
  • <% end %>
<% end %>
<%= form.label :tenor, "Select the Tenor You Wish to Apply For (Months)", :class=>"lead g-font-size-18--xs" %> <%= form.select :tenor, ["6","12","18","24","48","60"], {:prompt => "Select Tenor"}, class: "form-control" %>

Status

<%= @loan_application.status %>

<% if @loan_application.file.attached? %>

Attachment

<%= link_to(raw("") + " View Order/Invoice", @loan_application.file) %>

<% end %>
<%= submit_tag "Update", :class => "text-uppercase s-btn s-btn--md s-btn--primary-bg g-radius--50 g-padding-x-50--xs g-margin-b-20--xs" %> <% unless @loan_application.status == "SUBMITTED" %> <%= link_to 'Edit', edit_loan_application_path(@loan_application), :class => "text-uppercase s-btn s-btn--md s-btn--primary-bg g-radius--50 g-padding-x-50--xs g-margin-b-20--xs" %> <% end %> <%= link_to 'Amortisation Schedule', amortisation_schedule_loan_applications_path(id: @loan_application), remote: true, :class => "text-uppercase s-btn s-btn--md s-btn--primary-bg g-radius--50 g-padding-x-20--xs g-margin-b-20--xs" %>
<% end %> <% else %>
Loan Amount:

<%= number_to_currency(@loan_application.loan_amount, unit: "#{@loan_application.currency.symbol} ") %>

<% if @loan_application.approved? %> <% end %> <%= link_to 'Amortisation Schedule', amortisation_schedule_loan_applications_path(id: @loan_application), remote: true, :class => "text-uppercase s-btn s-btn--md s-btn--primary-bg g-radius--50 g-padding-y-20--xs g-margin-b-20--xs" %>
<% end %>
<% unless @loan_application.submitted? %>

Loan Amount

<%= number_to_currency(@loan_application.loan_amount, unit: "#{@loan_application.currency.symbol} ") %>

<% end %>

Instalment

<%= number_to_currency(@loan_application.instalment, unit: "#{@loan_application.currency.symbol} ") %>

Purpose of Loan

<%= @loan_application.loan_purpose %>

Pledged Security

<% unless @loan_application.pledged_securities.empty? %><%= "#{@loan_application.pledged_securities[0].security_type} - #{@loan_application.pledged_securities[0].description}" %><% else %>None<% end %>

<% if @loan_application.loan_application_logs.empty? %> <%= link_to 'Submit for Processing', email_loan_applications_path(id: @loan_application), :class => "text-uppercase s-btn s-btn--md s-btn--primary-bg g-radius--50 g-padding-x-50--xs g-margin-b-20--xs" %> <% end %> <% if @loan_application.status != "SUBMITTED" %> <% if @loan_application.completed == true and @loan_application.status == "APPROVED" %> <%= link_to 'Submit Application', application_submission_form_loan_applications_path(id: @loan_application), :class => "text-uppercase s-btn s-btn--md s-btn--primary-bg g-radius--50 g-padding-x-50--xs g-margin-b-20--xs" %> <%= link_to 'Print', print_loan_applications_path(appid: @loan_application.appid, :format => :pdf), :target => "_blank", :class => "text-uppercase s-btn s-btn--md btn-success g-radius--50 g-padding-x-50--xs g-margin-b-20--xs" %> <% elsif @loan_application.completed != true and @loan_application.status == "APPROVED" %> <%= link_to "Complete Application", personal_details_customers_path(id: @loan_application.customer, appid: @loan_application.appid), :class => "text-uppercase s-btn s-btn--md s-btn--primary-bg g-radius--50 g-padding-x-50--xs g-margin-b-20--xs" %> <% elsif @loan_application.status == "COMPLETED" and @loan_application.closed == false %>
This loan application has been successfully completed. Awaiting disbursement
<%= link_to 'Print', print_loan_applications_path(appid: @loan_application.appid, :format => :pdf), :target => "_blank", :class => "text-uppercase s-btn s-btn--md btn-success g-radius--50 g-padding-x-50--xs g-margin-b-20--xs" %> <% elsif @loan_application.status == "DISBURSED" and @loan_application.closed == true %>
This loan application has been successfully disbursed.
<%= link_to 'Print', print_loan_applications_path(appid: @loan_application.appid, :format => :pdf), :target => "_blank", :class => "text-uppercase s-btn s-btn--md btn-success g-radius--50 g-padding-x-50--xs g-margin-b-20--xs" %> <% end %> <% end %>
<% unless @loan_application.loan_application_attachments.empty? %>

Attached Documents

<% @loan_application.loan_application_attachments.each_with_index do |attachment| %> <% end %>
<% if attachment.file.attached? %>

<%= link_to(raw("") + " #{attachment.requirement.description}", attachment.file, target: '_blank') %>

<% end %>
<% end %>