<% renewable_date = current_license.read_license("renewable_date") %>
<% date_count = (renewable_date.to_date - Date.current).to_i %>
<% day = pluralize( date_count, 'day' )%>

<% if @license_status == 0 %>
  <% text = 'Your license has been expired.' %>
<% else %>
  <% text = "Your license will expire in #{day}." %>
<% end %>
<style>
  .centered {
    position: fixed;
    /*width: 850px;*/

    padding: 10px;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
  }
</style>
<div class="container-fluid">
  <div class="row">
    <div class="col-sm-2"></div>
    <div class="card col-sm-8 centered">
      <div class="card-block">
        <%= link_to origami_dashboard_url do %>
          <img src="/image/logo.png" class="mr-4 mt-2 float-right" style="width: 150px">
        <% end %>
        <h3 class="mt-4 mb-4">Review Your License</h3>
        <% if flash[:message].present? %>
          <p class="text-danger" style="font-weight: bold; font-size: 18px;"><%= flash[:message] %></p>
        <% end %>
        <br>
        <% if text %>
          <h6 class="mb-2"><%= text %></h6><br>
        <% end %>
        <h6 class="mb-2">Call Center Phone No: <a href="tel:+6494461709">+959 445 665 311</a></h6>
        <br>
        <h6>License Info:</h6>
        <br>
        <div class="container">
          <div class="form-group row">
            <label class="card-subtitle mb-2 col-md-4">Business Name:</label>
            <label class="card-subtitle mb-2 "><strong><%= @bis_name %></strong></label>
          </div>

          <div class="form-group row">
            <label class="card-subtitle mb-2 col-md-4">Plan:</label>
            <label class="card-subtitle mb-2 "><strong><%= @plan %></strong></label>
          </div>
        </div>

        <div class="form-group row">
          <label class="card-subtitle mb-2 col-md-4 pl-4">Expired At: </label>
          <label class="card-subtitle mb-2 "><strong><%= @expired_at.to_date.strftime('%B %d, %Y') %></strong></label>
        </div>
      </div>
      <br>
      <div class="col-md-12 mb-2">
        <%= form_with url: review_license_url, local: true do %>
          <%= submit_tag 'Review Licese', class: 'btn btn-primary btn-lg float-right m-l-10 m-r-5' %>
          <%= link_to 'Go To Home', root_url, class: 'btn btn-default btn-lg float-right' %>
        <% end %>
      </div>
    </div>
    <div class="col-sm-2"></div>
  </div>
</div>

<script>
  $(document).ready(function() {
    $('.alert-danger, .navbar').hide()
    $('html, section').css('background-color', '#61B8C9')
    // $('html').css('overflow-x', 'hidden')
    $('section.content').css('margin', '70px 0 0 0')
  })
</script>
