<% content_for :page_specific_css do %>
  <%= stylesheet_link_tag "client_management/backend" %>
<% end %>
<div class="contract-wrapper">
  <div class="page-request page-client contract-section">
    <div class="info-request">
      <h3 class="sub-title">
        Request Info
      </h3>
      <div class="line-content">
      	<span class="header-line">Request ID :</span>
      	<span class="content-line"><%= @site_request.uid %></span>
      </div>
      <div class="line-content">
      	<span class="header-line">Request type :</span>
      	<span class="content-line"><%= @site_request.get_request_type %></span>
      </div>
      <% if @site_request.type == "upgrade" %>
        <div class="line-content">
          <span class="header-line">R2 Site :</span>
          <span class="content-line"><a href="<%= @site_request.get_r2_site_link %>" target="_blank"><%= @site_request.get_r2_site_link %></a></span>
        </div>
      <% end %>
    </div>

    <div class="info-user">
      <h3 class="sub-title">User Details</h3>
      <% if !@user.fullname.nil? %>
        <div class="line-content">
          <span class="header-line">Name :</span>
          <span class="content-line"><%= @user.fullname %></span>
        </div>
      <% end %>
      <div class="line-content">
      <span class="header-line">Email :</span>
      <span class="content-line"><%= @site_request.c_panel_user.email %></span>
      </div>
      <% if !@user.phone_number.nil? %>
        <div class="line-content">
          <span class="header-line">Phone Number :</span>
          <span class="content-line"><%= @user.phone_number %></span>
        </div>
      <% end %>
      <% if !@user.address.nil? %>
        <div class="line-content">
          <span class="header-line">Address :</span>
          <span class="content-line"><%= @user.address %></span>
        </div>
      <% end %>
      <% if !@user.registered_site_ids.empty? %>
        <div class="line-content">
          <span class="header-line">Registered Sites :</span>
          <span class="content-line">
          	<% @user.registered_sites.each do |rs| %>
          		<span class="label label-default"><a style="color:#fff;" href="http://<%= rs.site_domain %>" target="_blank"><%= rs.title %></a></span>
          	<% end %>
          </span>
        </div>
      <% end %>
    </div>

    <div class="info-site">
      <h3 class="sub-title">Request Specifications</h3>
      <% case @site_request.type %>
      <% when "newsite", "upgrade" %>
      	<%= render :partial => "site_spec" %>
      <% when "existing" %>
      	<%= render :partial => "site_spec" %>
      <% when "addsites" %>
      	<%= render :partial => "add_site_spec" %>
      <% end %>
    </div>
  </div>
  <div class="contract-actions contract-section">
    <h3 class="action-heading">Actions</h3>
    <ul>
      <% if @site_request.request_contract.nil? %>
        <% case @site_request.type %>
        <% when "existing","newsite","upgrade" %>
          <li>
            <a href="<%= make_contract_admin_client_management_path(@site_request.id) %>"><i class="icons-text-2"></i> Contract</a>
          </li>
        <% end %>
      <% else %>
        <% case @site_request.type %>
        <% when "existing","newsite","upgrade" %>
          <li>
            <a href="<%= see_contract_admin_client_management_path(@site_request.request_contract.id) %>"><i class="icons-text-2"></i> Contract</a>
          </li>
        <% end %>
        <% if @site_request.request_contract.is_confirmed? %>
          <li>
            <a href="<%= project_dashboard_admin_client_management_path(@site_request.id) %>"><i class="icons-gauge"></i> Dashboard</a>
          </li>
        <% end %>
      <% end %>
      <% if @site_request.site_timeline.nil? %>
        <li>
          <a href="<%= make_timeline_admin_client_management_path(@site_request.id) %>"><i class="icons-flow-line"></i> Timeline</a>
        </li>
      <% else %>
        <li>
          <a href="<%= edit_timeline_admin_client_management_path(@site_request.site_timeline.id) %>"><i class="icons-flow-line"></i> Timeline</a>
        </li>
      <% end %>
    </ul>
  </div>
</div>

