client_management/app/views/admin/client_managements/see_contract.html.erb

163 lines
6.1 KiB
Plaintext
Raw Normal View History

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "client_management/backend" %>
<% end %>
<div class="page-contract page-client">
<div class="info-contract">
<h3 class="sub-title">Contract Info</h3>
<div class="line-content">
<span class="header-line">Contract Id :</span>
<span class="content-line"><%= @contract.uid %></span>
</div>
<div class="line-content">
<span class="header-line">Contract Date :</span>
<span class="content-line"><%= @contract.created_at.strftime("%Y-%m-%d") %></span>
</div>
<div class="line-content">
<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>
</div>
2017-03-29 07:09:14 +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>
<div class="line-content">
<span class="header-line">Type :</span>
<span class="content-line"><%= @site_request.get_request_type %></span>
</div>
</div>
<% 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>
</div>
<% end %>
<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>
</div>
<% end %>
</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 %>
2017-03-27 07:15:25 +00:00
<% 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 %>
2017-03-29 07:09:14 +00:00
<% if !@contract.other.nil? || @contract.other_cost > 0 %>
<div class="line-content qt">
<span class="header-line">
2017-04-10 08:21:41 +00:00
Other Requirements
<div class="requirement-text">
<%= nl2br(@contract.other) %>
</div>
2017-03-29 07:09:14 +00:00
</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" %>
</span>
<% end %>
</div>
</div>
<div class="info-contract-buttons">
<div class="line-content button">
<% if !@contract.is_confirmed? %>
<a href="<%= edit_contract_admin_client_management_path(@contract.id) %>" class="btn btn-warning">Edit Contract</a>
<a href="<%= confirm_contract_admin_client_management_path(@contract.id, :confirm => "true") %>" class="btn btn-success">Confirm Contract</a>
<% else %>
2017-03-29 07:09:14 +00:00
<% if @contract.contract_purchase.nil? %>
<a href="<%= make_purchase_admin_client_management_path(@contract.id) %>" class="btn btn-warning" id="make-purchase-btn">Make Purchase</a>
<a href="<%= confirm_contract_admin_client_management_path(@contract.id, :confirm => "false") %>" class="btn btn-danger">Un-Confirm Contract</a>
<% else %>
<a href="<%= receipts_admin_client_management_path(@contract.contract_purchase.id) %>" class="btn btn-warning">Receipts</a>
<% end %>
<% end %>
<a href="#" class="btn btn-info">Export Contract</a>
<a href="<%= admin_client_managements_completed_requests_path(:page => params[:page]) %>" class="btn">Back</a>
</div>
</div>
</div>
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>