2017-03-21 09:39:48 +00:00
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "client_management/backend" %>
2017-03-10 06:53:25 +00:00
<% end %>
2017-03-21 09:39:48 +00:00
2017-10-09 09:44:59 +00:00
<div class="contract-wrapper">
<div class="page-contract page-client contract-section">
<div class="info-contract">
<h3 class="sub-title">Contract Info</h3>
2017-03-29 07:09:14 +00:00
<div class="line-content">
2017-10-09 09:44:59 +00:00
<span class="header-line">Contract Id :</span>
<span class="content-line"><%= @contract.uid %></span>
2017-03-29 07:09:14 +00:00
</div>
2017-03-21 09:39:48 +00:00
<div class="line-content">
2017-10-09 09:44:59 +00:00
<span class="header-line">Contract Date :</span>
<span class="content-line"><%= @contract.created_at.strftime("%Y-%m-%d") %></span>
2017-03-21 09:39:48 +00:00
</div>
<div class="line-content">
2017-10-09 09:44:59 +00:00
<span class="header-line">Confirmed :</span>
<span class="content-line">
<%= (@contract.is_confirmed? ? "<span class='label label-success'>Yes</span>" : "<span class='label label-important'>No</span>").html_safe %>
</span>
2017-03-21 09:39:48 +00:00
</div>
2017-10-09 09:44:59 +00:00
<% if !@contract.contract_purchase.nil? %>
<div class="line-content">
<span class="header-line">Payment Status :</span>
<span class="content-line">
<% if @contract.contract_purchase.cleared? %>
<span class="label label-success">Cleared</span>
<% else %>
<span class="label label-important">Pending</span>
<% end %>
</span>
</div>
<% end %>
</div>
<div class="info-contract-request">
<h3 class="sub-title">Request</h3>
2017-03-21 09:39:48 +00:00
<div class="line-content">
2017-10-09 09:44:59 +00:00
<span class="header-line">Type :</span>
<span class="content-line"><%= @site_request.get_request_type %></span>
2017-03-21 09:39:48 +00:00
</div>
</div>
2017-10-09 09:44:59 +00:00
<% if @site_request.type == "existing" %>
<div class="info-contract-detail">
<h3 class="sub-title">Site Details</h3>
<div class="line-content">
<span class="header-line">Site ID :</span>
<span class="content-line"><%= @site_request.get_site.uid %></span>
</div>
<div class="line-content">
<span class="header-line">Site Name : </span>
<span class="content-line"><%= @site_request.get_site.title %></span>
</div>
<div class="line-content">
<span class="header-line">Site Domain : </span>
<span class="content-line"><%= @site_request.get_site.site_domain %></span>
</div>
2017-03-21 09:39:48 +00:00
</div>
2017-03-10 06:53:25 +00:00
<% end %>
2017-10-09 09:44:59 +00:00
<div class="info-contract-file">
<h3 class="sub-title">Contract Files</h3>
<% if !@contract.contract_file.url.nil? %>
<div class="line-content">
<span class="header-line">Contract :</span>
<span class="content-line"><a href="<%= @contract.contract_file.url %>" target="_blank">Download</a></span>
</div>
<% end %>
<% if !@contract.signed_contract_file.url.nil? %>
<div class="line-content">
<span class="header-line">Signed Contract :</span>
<span class="content-line"><a href="<%= @contract.signed_contract_file.url %>" target="_blank">Download</a></span>
2017-03-21 09:39:48 +00:00
</div>
<% end %>
2017-10-09 09:44:59 +00:00
</div>
<div class="info-contract-quatation">
<h3 class="sub-title">Quotaion</h3>
<div class="line-content qt">
<span class="header-line">Item</span>
<span class="content-line">Cost in NTD.</span>
</div>
<% total_amount = 0 %>
<% ["new_site_cost","hosting_with_rulingdigital_cost","service_cost","option_module_cost","customized_module_cost","template_cost","customized_template_cost","rwd_cost"].each do |attrib| %>
<% amount = @contract.send(attrib.to_sym) %>
<% if amount > 0 %>
<div class="line-content qt">
<span class="header-line">
<%= t("client_management.#{attrib}") %>
<% if attrib == "option_module_cost" %>
<ol class="custom-module">
<% rsm = RegisteredModule.find(@site_request.optional_modules) %>
<% rsm.each do |rs|%>
<li><%= rs.name %></li>
<% end %>
</ol>
<% end %>
<% if attrib == "service_cost" %>
for <%= @site_request.maintenance_years rescue 1 %> year(s)
<% end %>
</span>
<span class="content-line"><%= amount %></span>
</div>
<% total_amount = total_amount + amount %>
<% end %>
<% end %>
<% if !@contract.other.nil? || @contract.other_cost > 0 %>
<div class="line-content qt">
<span class="header-line">
Other Requirements
<div class="requirement-text">
<%= nl2br(@contract.other) %>
</div>
</span>
<span class="content-line"><%= @contract.other_cost %></span>
</div>
<% total_amount = total_amount + @contract.other_cost %>
<% end %>
<div class="line-content qt hr">
<span class="header-line">Total :</span>
<span class="content-line"><%= total_amount.to_s %></span>
</div>
</div>
<div class="info-contract-file-upload">
<div class="line-content file">
<%= form_for @contract, :url => {:action => "update_contract"}, :html => {:class => "form-horizontal"} do |f| %>
<span class="header-line">Signed Contract File :</span>
<span class="content-line">
<%= f.file_field :signed_contract_file, :class => "file-box" %>
<%= f.submit "Upload", :class => "btn btn-primary" %>
2017-03-29 07:09:14 +00:00
</span>
2017-10-09 09:44:59 +00:00
<% end %>
2017-03-29 07:09:14 +00:00
</div>
2017-03-21 09:39:48 +00:00
</div>
2017-10-09 09:44:59 +00:00
<div class="line-content buttons">
<a class="btn btn-info pull-right" href="<%= completed_requests_admin_client_managements_path(:page => params[:page]) %>">Back</a>
</div>
2017-03-21 09:39:48 +00:00
</div>
2017-10-09 09:44:59 +00:00
<div class="contract-actions contract-section">
<h3 class="action-heading">Actions</h3>
<ul>
2017-03-21 09:39:48 +00:00
<% if !@contract.is_confirmed? %>
2017-10-09 09:44:59 +00:00
<li>
<a href="<%= edit_contract_admin_client_management_path(@contract.id) %>"><i class="icons-pencil"></i> Edit Contract</a>
</li>
<li>
<a href="<%= confirm_contract_admin_client_management_path(@contract.id, :confirm => "true") %>" ><i class="icons-checkmark"></i> Confirm Contract</a>
</li>
2017-03-21 09:39:48 +00:00
<% else %>
2017-10-09 09:44:59 +00:00
<% if @contract.contract_purchase.nil? %>
<li>
<a href="<%= make_purchase_admin_client_management_path(@contract.id) %>" id="make-purchase-btn"><i class="icons-cart"></i> Make Purchase</a>
</li>
<li>
<a href="<%= confirm_contract_admin_client_management_path(@contract.id, :confirm => "false") %>"><i class="icons-cross"></i> Un-Confirm Contract</a>
</li>
<% else %>
<li>
<a href="<%= receipts_admin_client_management_path(@contract.contract_purchase.id) %>"><i class="icons-credit-card" aria-hidden="true"></i> Receipts</a>
</li>
<% end %>
<li>
<a href="<%= project_dashboard_admin_client_management_path(@site_request.id) %>"><i class="icons-gauge"></i> Dashboard</a>
</li>
2017-03-29 07:09:14 +00:00
<% end %>
2017-10-09 09:44:59 +00:00
<% if !@contract.site_request.site_timeline.nil? %>
<li>
<a href="<%= edit_timeline_admin_client_management_path(@contract.site_request.site_timeline.id) %>"><i class="icons-flow-line"></i> Timeline</a>
</li>
<% end %>
<li>
<a href="#"><i class="icons-export"></i> Export Contract</a>
</li>
</ul>
2017-03-21 09:39:48 +00:00
</div>
</div>
2017-10-09 09:44:59 +00:00
2017-03-29 07:09:14 +00:00
<script type="text/javascript">
$("#make-purchase-btn").on("click",function(){
if(!confirm("Once you create a purchase, you cannot un-confirm or edit this contract. Continue to create a purchase for this contract?")){
return false;
}
})
</script>