code merged and requests and contract page for frontend with filter
This commit is contained in:
parent
89e9e7b50a
commit
4895dc03be
|
@ -37,7 +37,7 @@ function goBackTop(txt, speed) {
|
|||
});
|
||||
}
|
||||
|
||||
var constructPagination = function(current_page, total_pages, type){
|
||||
var constructPagination = function(current_page, total_pages){
|
||||
var ul = $("<ul class='pagination'></ul>"),
|
||||
first_li = $("<li class='first'><a data-page='1' href='#'>First</a></li>"),
|
||||
last_li = $("<li class='last'><a data-page='" + total_pages + "' href='#'>Last</a></li>"),
|
||||
|
@ -77,11 +77,7 @@ var constructPagination = function(current_page, total_pages, type){
|
|||
}
|
||||
ul.find("a").on("click",function(){
|
||||
$("*").animate({scrollTop:0}, '300');
|
||||
if(type == "tickets"){
|
||||
getTickets($(this).data("page"));
|
||||
}else if(type == "sites"){
|
||||
getSites($(this).data("page"));
|
||||
}
|
||||
getObjects($(this).data("page"))
|
||||
return false;
|
||||
})
|
||||
paginationArea.show();
|
||||
|
|
|
@ -84,7 +84,7 @@ class Admin::ClientManagementsController < OrbitAdminController
|
|||
end
|
||||
|
||||
def contracts
|
||||
@contracts = RequestContract.all.order_by(:confirmed => 'desc', :created_at => "desc").page(params[:page]).per(10)
|
||||
@contracts = RequestContract.all.order_by(:created_at => "desc", :confirmed => 'desc').page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -181,9 +181,19 @@ class ClientManagementsController < CPanelController
|
|||
end
|
||||
|
||||
def history
|
||||
case params[:type]
|
||||
when nil
|
||||
@objects = SiteRequest.where(:c_panel_user_id => current_cpanel_user.id).desc(:created_at)
|
||||
if !params[:query].present?
|
||||
@objects = SiteRequest.where(:c_panel_user_id => current_cpanel_user.id).desc(:created_at).page(params[:page]).per(15)
|
||||
elsif params[:query] == "addsites"
|
||||
@objects = SiteRequest.where(:type => "addsites", :c_panel_user_id => current_cpanel_user.id).desc(:created_at).page(params[:page]).per(15)
|
||||
else
|
||||
@objects = SiteRequest.where(:site_id => params[:query], :c_panel_user_id => current_cpanel_user.id).desc(:created_at).page(params[:page]).per(15)
|
||||
end
|
||||
if request.xhr?
|
||||
render :partial => "history_partial"
|
||||
else
|
||||
@user_sites = current_cpanel_user.registered_sites.collect{|rs|[rs.title, rs.id.to_s]}
|
||||
@user_sites << ["New site request", "newsite"]
|
||||
@user_sites << ["Addition of sites request", "addsites"]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -191,6 +201,48 @@ class ClientManagementsController < CPanelController
|
|||
@site_request = SiteRequest.where(:uid => params[:request_uid]).first rescue nil
|
||||
end
|
||||
|
||||
def see_contract
|
||||
@contract = RequestContract.where(:uid => params[:contract_uid]).first rescue nil
|
||||
@site_request = @contract.site_request
|
||||
end
|
||||
|
||||
def update_contract
|
||||
contract = RequestContract.where(:uid => params[:contract_uid]).first rescue nil
|
||||
contract.update_attributes(contract_params)
|
||||
redirect_to cpanel_contract_show_path(contract.uid)
|
||||
end
|
||||
|
||||
def cancel_request
|
||||
request = SiteRequest.where(:uid => params[:request_uid]).first rescue nil
|
||||
request.destroy if !request.nil?
|
||||
redirect_to cpanel_myhistory_path(:page => params[:page])
|
||||
end
|
||||
|
||||
def contracts
|
||||
if !params[:query].present?
|
||||
@objects = SiteRequest.any_of({:site_id.in => current_cpanel_user.registered_site_ids.collect{|id| id.to_s}, :request_contract.ne => nil},{:c_panel_user_id => current_cpanel_user.id, :request_contract.ne => nil}).desc(:created_at).page(params[:page]).per(15)
|
||||
else
|
||||
@objects = SiteRequest.where(:site_id => params[:query], :request_contract.ne => nil).desc(:created_at).page(params[:page]).per(15)
|
||||
end
|
||||
if request.xhr?
|
||||
render :partial => "contract_partial"
|
||||
else
|
||||
@user_sites = current_cpanel_user.registered_sites.collect{|rs|[rs.title, rs.id.to_s]}
|
||||
@user_sites << ["New site request", "newsite"]
|
||||
end
|
||||
end
|
||||
|
||||
def confirm_contract
|
||||
contract = RequestContract.where(:uid => params[:contract_uid]).first rescue nil
|
||||
contract.confirmed = true
|
||||
contract.save
|
||||
if params[:ref] == "contract_page"
|
||||
redirect_to cpanel_contract_show_path(contract.uid)
|
||||
else
|
||||
redirect_to cpanel_mycontracts_path(:page => params[:page])
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def is_site_authorized_to_user?
|
||||
|
@ -229,4 +281,8 @@ class ClientManagementsController < CPanelController
|
|||
params.require(:site_request).permit!
|
||||
end
|
||||
|
||||
def contract_params
|
||||
params.require(:request_contract).permit!
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,46 @@
|
|||
<% if !@objects.empty? %>
|
||||
<% @objects.each do |object| %>
|
||||
<% obj = object.request_contract %>
|
||||
<div class="item-history">
|
||||
<% case object.type %>
|
||||
<% when "newsite" %>
|
||||
<span class="site-title-history">
|
||||
<a href="/cpanel/contract/<%= obj.uid %>">New Site</a>
|
||||
<% if obj.confirmed %>
|
||||
<span class="status-detail confirmed">Confirmed</span>
|
||||
<% else %>
|
||||
<span class="status-detail pending">Pending</span>
|
||||
<% end %>
|
||||
</span>
|
||||
<% when "existing" %>
|
||||
<span class="site-title-history">
|
||||
<a href="/cpanel/contract/<%= obj.uid %>">New Request for <strong><%= obj.get_site.title %></strong></a>
|
||||
<% if obj.confirmed %>
|
||||
<span class="status-detail confirmed">Confirmed</span>
|
||||
<% else %>
|
||||
<span class="status-detail pending">Pending</span>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
<div class="info-site">
|
||||
<span class="url-site"><i class="fa fa-hashtag" aria-hidden="true"></i>Contract ID: <%= obj.uid %></a></span>
|
||||
<% if object.type == "existing" %>
|
||||
<span class="url-site"><i class="fa fa-laptop" aria-hidden="true"></i><a href="http://<%= obj.get_site.site_domain %>" target="_blank"><%= obj.get_site.site_domain %></a></span>
|
||||
<% end %>
|
||||
<span class="time-site"><i class="fa fa-clock-o" aria-hidden="true"></i>Time : <%= obj.created_at.strftime("%d %B %Y - %H:%M") %></span>
|
||||
</div>
|
||||
<span class="action-site">
|
||||
<% if !obj.confirmed && !obj.signed_contract_file.url.nil? %>
|
||||
<a href="/cpanel/contract/<%= obj.uid %>/confirm?page=<%= params[:page] %>" class="btn btn-success confrim-btn">Confirm</a>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
<input type="hidden" class="total-pages" value="<%= @objects.total_pages %>">
|
||||
<% else %>
|
||||
<div id="error-msg-area" class="cp-message-box">
|
||||
<div class="message-text">
|
||||
Sorry, we found nothing.
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,42 @@
|
|||
<% if !@objects.empty? %>
|
||||
<% @objects.each do |obj| %>
|
||||
<div class="item-history">
|
||||
<% case obj.type %>
|
||||
<% when "newsite" %>
|
||||
<span class="site-title-history"><a href="/cpanel/request/<%= obj.uid %>">New Site</a></span>
|
||||
<% when "existing" %>
|
||||
<span class="site-title-history"><a href="/cpanel/request/<%= obj.uid %>">New Request for <strong><%= obj.get_site.title %></strong></a></span>
|
||||
<% when "addsites" %>
|
||||
<span class="site-title-history"><a href="/cpanel/request/<%= obj.uid %>">Request for adding sites</a></span>
|
||||
<% end %>
|
||||
<div class="info-site">
|
||||
<span class="url-site"><i class="fa fa-hashtag" aria-hidden="true"></i>Request ID: <%= obj.uid %></a></span>
|
||||
<% if obj.type == "existing" %>
|
||||
<span class="url-site"><i class="fa fa-laptop" aria-hidden="true"></i><a href="http://<%= obj.get_site.site_domain %>" target="_blank"><%= obj.get_site.site_domain %></a></span>
|
||||
<% end %>
|
||||
<span class="time-site"><i class="fa fa-clock-o" aria-hidden="true"></i>Time : <%= obj.created_at.strftime("%d %B %Y - %H:%M") %></span>
|
||||
</div>
|
||||
<% if obj.completed %>
|
||||
<span class="status-detail confirmed">Completed</span>
|
||||
<% else %>
|
||||
<span class="status-detail requested">Requested</span>
|
||||
<% end %>
|
||||
<span class="action-site">
|
||||
<% if !obj.completed %>
|
||||
<a href="<%= cpanel_cancel_request_path(obj.uid, :page => params[:page]) %>" class="btn btn-warning cancel-request-btn">Cancel</a>
|
||||
<% else %>
|
||||
<% if (obj.type == "newsite" || obj.type == "existing") && !obj.request_contract.nil? %>
|
||||
<a href="/cpanel/contract/<%= obj.request_contract.uid %>?page=<%= params[:page] %>" class="btn btn-info">Contract</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
<input type="hidden" class="total-pages" value="<%= @objects.total_pages %>">
|
||||
<% else %>
|
||||
<div id="error-msg-area" class="cp-message-box">
|
||||
<div class="message-text">
|
||||
Sorry, we found nothing.
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,89 @@
|
|||
<% content_for :page_menu do %>
|
||||
<ul class="list-sidebar">
|
||||
<li class="item-sidebar"><a class="btn-sidebar" href="/cpanel/sites"><i class="fa fa-home" aria-hidden="true"></i><%= t("client_management.my_sites") %></a></li>
|
||||
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_myprofile_path %>"><i class="fa fa-address-card" aria-hidden="true"></i><%= t("client_management.profile") %></a></li>
|
||||
<li class="item-sidebar active"><a class="btn-sidebar" href="<%= cpanel_myhistory_path %>"><i class="fa fa-history" aria-hidden="true"></i><%= t("client_management.history") %></a></li>
|
||||
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa-question-circle-o" aria-hidden="true"></i><%= t("client_management.help_and_faq") %></a></li>
|
||||
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa-user-circle-o" aria-hidden="true"></i><%= t("client_management.get_in_contact") %></a></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<section class="cp-content col-md-10">
|
||||
<h2 class="cp-page-title">
|
||||
History
|
||||
</h2>
|
||||
<div class="cp-submenu-box">
|
||||
<a href="<%= cpanel_myhistory_path %>" class="submenu-item">Requests</a>
|
||||
<a href="<%= cpanel_mycontracts_path %>" class="submenu-item active">Contracts</a>
|
||||
<a href="#" class="submenu-item">Purchases</a>
|
||||
<div class="cp-filter-box">
|
||||
<form action="" method="get">
|
||||
<%= select_tag "q", options_for_select(@user_sites, params[:q]), :prompt => "All", :class => "form-control" %>
|
||||
<input type="submit" value="Filter">
|
||||
<% if params[:q].present? %>
|
||||
<a href="/cpanel/contracts">Clear</a>
|
||||
<% end %>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cp-addsite-history">
|
||||
<div class="box-request-history">
|
||||
<h3 class="sub-title">Contracts</h3>
|
||||
<div id="history-loading" class="cp-loading-box" style="display: none;">
|
||||
<span class="loading-text">
|
||||
<%= t("client_management.loading_contracts") %>
|
||||
</span>
|
||||
<i class="fa fa-spinner fa-spin fa-3x fa-fw"></i>
|
||||
</div>
|
||||
<div id="error-msg-area" class="cp-message-box hide">
|
||||
<div class="message-text">
|
||||
Sorry, we found nothing.
|
||||
</div>
|
||||
</div>
|
||||
<div id="history-holder">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cp-pagination" id="pagination-area">
|
||||
<nav aria-label="Page navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script type="text/javascript">
|
||||
$(document).on("click", ".confrim-btn",function(){
|
||||
if(!confirm("Are you sure?")){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
var urlVars = getUrlVars();
|
||||
var pageNo = (urlVars["page"] ? parseInt(urlVars["page"]) : 1),
|
||||
query = urlVars["q"],
|
||||
loader = $("#history-loading"),
|
||||
holder = $("#history-holder"),
|
||||
errorArea = $("#error-msg-area"),
|
||||
paginationArea = $("#pagination-area");
|
||||
|
||||
var getObjects = function(page){
|
||||
pageNo = page;
|
||||
holder.hide();
|
||||
loader.show();
|
||||
paginationArea.hide();
|
||||
$.ajax({
|
||||
url : "/cpanel/contracts",
|
||||
data : {"page" : page, "query" : query},
|
||||
dataType : "html",
|
||||
type : "get"
|
||||
}).done(function(html){
|
||||
setTimeout(function(){
|
||||
holder.html(html).show();
|
||||
loader.hide();
|
||||
var total_pages = parseInt(holder.find("input[type=hidden].total-pages").val());
|
||||
if (total_pages > 1){
|
||||
constructPagination(page, total_pages);
|
||||
}
|
||||
}, 500);
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
getObjects(pageNo);
|
||||
})
|
||||
</script>
|
|
@ -12,51 +12,78 @@
|
|||
History
|
||||
</h2>
|
||||
<div class="cp-submenu-box">
|
||||
<a href="#" class="submenu-item active">Requests</a>
|
||||
<a href="#" class="submenu-item">Contracts</a>
|
||||
<a href="<%= cpanel_myhistory_path %>" class="submenu-item active">Requests</a>
|
||||
<a href="<%= cpanel_mycontracts_path %>" class="submenu-item">Contracts</a>
|
||||
<a href="#" class="submenu-item">Purchases</a>
|
||||
<div class="cp-filter-box">
|
||||
<select name="filter" id="filter" class="form-control">
|
||||
<option value="1">Purchased</option>
|
||||
<option value="2">Contract Confirmed</option>
|
||||
<option value="3">Pending</option>
|
||||
<option value="4">Requested</option>
|
||||
</select>
|
||||
<form action="" method="get">
|
||||
<%= select_tag "q", options_for_select(@user_sites, params[:q]), :prompt => "All", :class => "form-control" %>
|
||||
<input type="submit" value="Filter">
|
||||
<% if params[:q].present? %>
|
||||
<a href="/cpanel/history">Clear</a>
|
||||
<% end %>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cp-addsite-history">
|
||||
<div class="box-request-history">
|
||||
<h3 class="sub-title">Requests</h3>
|
||||
<% @objects.each do |obj| %>
|
||||
<div class="item-history">
|
||||
<% case obj.type %>
|
||||
<% when "newsite" %>
|
||||
<span class="site-title-history"><a href="/cpanel/request/<%= obj.uid %>">New Site</a></span>
|
||||
<% when "existing" %>
|
||||
<span class="site-title-history"><a href="/cpanel/request/<%= obj.uid %>">New Request for <strong><%= obj.get_site.title %></strong></a></span>
|
||||
<% when "addsites" %>
|
||||
<span class="site-title-history"><a href="/cpanel/request/<%= obj.uid %>">Request for adding sites</a></span>
|
||||
<% end %>
|
||||
<div class="info-site">
|
||||
<span class="url-site"><i class="fa fa-hashtag" aria-hidden="true"></i>Request ID: <%= obj.uid %></a></span>
|
||||
|
||||
<% if obj.type == "existing" %>
|
||||
<span class="url-site"><i class="fa fa-laptop" aria-hidden="true"></i><a href="http://<%= obj.get_site.site_domain %>" target="_blank"><%= obj.get_site.site_domain %></a></span>
|
||||
<% end %>
|
||||
<span class="time-site"><i class="fa fa-clock-o" aria-hidden="true"></i>Time : <%= obj.created_at.strftime("%d %B %Y - %H:%M") %></span>
|
||||
</div>
|
||||
<span class="status-detail requested">Requested</span>
|
||||
<span class="action-site">
|
||||
<% if !obj.completed %>
|
||||
<a href="#" class="btn btn-warning">Cancel</a>
|
||||
<% else %>
|
||||
<% if (obj.type == "newsite" || obj.type == "existing") && !obj.request_contract.nil? %>
|
||||
<a href="#" class="btn btn-info">Contract</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div id="history-loading" class="cp-loading-box" style="display: none;">
|
||||
<span class="loading-text">
|
||||
<%= t("client_management.loading_history") %>
|
||||
</span>
|
||||
<i class="fa fa-spinner fa-spin fa-3x fa-fw"></i>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="error-msg-area" class="cp-message-box hide">
|
||||
<div class="message-text">
|
||||
Sorry, we found nothing.
|
||||
</div>
|
||||
</div>
|
||||
<div id="history-holder">
|
||||
</div>
|
||||
</div>
|
||||
<div class="cp-pagination" id="pagination-area">
|
||||
<nav aria-label="Page navigation"></nav>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script type="text/javascript">
|
||||
$(document).on("click", ".cancel-request-btn", function(){
|
||||
if(!confirm("Are you sure?")){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
var urlVars = getUrlVars();
|
||||
var pageNo = (urlVars["page"] ? parseInt(urlVars["page"]) : 1),
|
||||
query = urlVars["q"],
|
||||
loader = $("#history-loading"),
|
||||
holder = $("#history-holder"),
|
||||
errorArea = $("#error-msg-area"),
|
||||
paginationArea = $("#pagination-area");
|
||||
|
||||
var getObjects = function(page){
|
||||
pageNo = page;
|
||||
holder.hide();
|
||||
loader.show();
|
||||
paginationArea.hide();
|
||||
$.ajax({
|
||||
url : "/cpanel/history",
|
||||
data : {"page" : page, "query" : query},
|
||||
dataType : "html",
|
||||
type : "get"
|
||||
}).done(function(html){
|
||||
setTimeout(function(){
|
||||
holder.html(html).show();
|
||||
loader.hide();
|
||||
var total_pages = parseInt(holder.find("input[type=hidden].total-pages").val());
|
||||
if (total_pages > 1){
|
||||
constructPagination(page, total_pages);
|
||||
}
|
||||
}, 500);
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
getObjects(pageNo);
|
||||
})
|
||||
</script>
|
|
@ -67,10 +67,10 @@
|
|||
sitesArea = $("#sites-area"),
|
||||
paginationArea = $("#pagination-area");
|
||||
$(document).ready(function(){
|
||||
getSites(pageNo);
|
||||
getObjects(pageNo);
|
||||
})
|
||||
|
||||
var getSites = function(page){
|
||||
var getObjects = function(page){
|
||||
pageNo = page;
|
||||
sitesArea.hide();
|
||||
siteLoading.show();
|
||||
|
@ -87,7 +87,7 @@
|
|||
$("#total-site-count").text( $("input[type=hidden].total-sites").val());
|
||||
var total_pages = parseInt(sitesArea.find("input[type=hidden].total-pages").val());
|
||||
if (total_pages > 1){
|
||||
constructPagination(page, total_pages, "sites");
|
||||
constructPagination(page, total_pages);
|
||||
}
|
||||
},500)
|
||||
})
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
<% content_for :page_menu do %>
|
||||
<ul class="list-sidebar">
|
||||
<li class="item-sidebar"><a class="btn-sidebar" href="/cpanel/sites"><i class="fa fa-home" aria-hidden="true"></i><%= t("client_management.my_sites") %></a></li>
|
||||
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_myprofile_path %>"><i class="fa fa-address-card" aria-hidden="true"></i><%= t("client_management.profile") %></a></li>
|
||||
<li class="item-sidebar active"><a class="btn-sidebar" href="<%= cpanel_myhistory_path %>"><i class="fa fa-history" aria-hidden="true"></i><%= t("client_management.history") %></a></li>
|
||||
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa-question-circle-o" aria-hidden="true"></i><%= t("client_management.help_and_faq") %></a></li>
|
||||
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa-user-circle-o" aria-hidden="true"></i><%= t("client_management.get_in_contact") %></a></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<section class="cp-content col-md-10">
|
||||
<h2 class="cp-page-title">
|
||||
Contract info
|
||||
</h2>
|
||||
<div class="cp-contract-detail">
|
||||
<div class="sub-title ft">Contract info</div>
|
||||
<div class="line-contract">
|
||||
<span class="header-detail">Contract Number :</span>
|
||||
<span class="content-detail"><%= @contract.uid %></span>
|
||||
</div>
|
||||
<div class="line-contract">
|
||||
<span class="header-detail">Contract Date :</span>
|
||||
<span class="content-detail"><%= @contract.created_at.strftime("%d %B %Y") %></span>
|
||||
</div>
|
||||
<div class="line-contract">
|
||||
<span class="header-detail">Contract Status :</span>
|
||||
<span class="content-detail">
|
||||
<% if @contract.confirmed %>
|
||||
<span class="cf-yes label label-success">Confirmed</span>
|
||||
<% else %>
|
||||
<span class="cf-no label label-danger">Not-Confirmed</span>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="sub-title">Request</div>
|
||||
<div class="line-contract">
|
||||
<span class="header-detail">Type :</span>
|
||||
<span class="content-detail"><%= @site_request.get_request_type %></span>
|
||||
</div>
|
||||
<% if @site_request.type == "existing" %>
|
||||
<div class="sub-title">Site Info</div>
|
||||
<div class="line-contract">
|
||||
<span class="header-detail">Site ID :</span>
|
||||
<span class="content-detail"><%= @site_request.get_site.uid %></span>
|
||||
</div>
|
||||
<div class="line-contract">
|
||||
<span class="header-detail">Site Name :</span>
|
||||
<span class="content-detail"><%= @site_request.get_site.title %></span>
|
||||
</div>
|
||||
<div class="line-contract">
|
||||
<span class="header-detail">Site Domain :</span>
|
||||
<span class="content-detail"><a href="<%= @site_request.get_site.site_domain %>" target="_blank"><%= @site_request.get_site.site_domain %></a></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !@contract.contract_file.url.nil? || !@contract.signed_contract_file.url.nil? %>
|
||||
<div class="sub-title">Contract Files</div>
|
||||
<% if !@contract.contract_file.url.nil? %>
|
||||
<div class="line-contract">
|
||||
<span class="header-detail">Contract :</span>
|
||||
<span class="content-detail"><a href="<%= @contract.contract_file.url %>" target="_blank">Download</a></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if !@contract.signed_contract_file.url.nil? %>
|
||||
<div class="line-contract">
|
||||
<span class="header-detail">Contract Signed :</span>
|
||||
<span class="content-detail"><a href="<%= @contract.signed_contract_file.url %>" target="_blank">Download</a></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="sub-title">Quotaion</div>
|
||||
|
||||
<div class="line-contract qt">
|
||||
<span class="header-detail">Item</span>
|
||||
<span class="content-detail">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-contract qt">
|
||||
<% if attrib == "option_module_cost" %>
|
||||
<span class="header-detail"><%= t("client_management.#{attrib}") %>
|
||||
<ol class="custom-module">
|
||||
<% rsm = RegisteredModule.find(@site_request.optional_modules) %>
|
||||
<% rsm.each do |rs|%>
|
||||
<li><%= rs.name %></li>
|
||||
<% end %>
|
||||
</ol>
|
||||
</span>
|
||||
<% else %>
|
||||
<span class="header-detail"><%= t("client_management.#{attrib}") %></span>
|
||||
<% end %>
|
||||
<span class="content-detail"><%= amount %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<% total_amount = total_amount + amount %>
|
||||
<% end %>
|
||||
|
||||
<div class="line-contract qt hr">
|
||||
<span class="header-detail">Total :</span>
|
||||
<span class="content-detail"><%= total_amount %></span>
|
||||
</div>
|
||||
|
||||
<% if !@contract.confirmed %>
|
||||
<%= form_for @contract, :url => "/cpanel/contract/#{@contract.uid}/update_contract" do |f| %>
|
||||
<div class="line-contract file">
|
||||
<span class="header-detail">Signed Contract File :</span>
|
||||
<span class="content-detail">
|
||||
<%= f.file_field :signed_contract_file, :class=>"file-box" %>
|
||||
<input class="btn btn-primary" name="commit" value="Upload" type="submit">
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="line-contract buttons">
|
||||
<% if !@contract.confirmed && !@contract.signed_contract_file.url.nil? %>
|
||||
<a href="/cpanel/contract/<%= @contract.uid %>/confirm?ref=contract_page&page=<%= params[:page] %>" class="btn btn-success confirm-btn">Confirm Contract</a>
|
||||
<% end %>
|
||||
<div class="pull-right">
|
||||
<a href="#" class="btn btn-info">Export Contract</a>
|
||||
<a href="<%= cpanel_mycontracts_path %>" class="btn btn-gray">Back to Contracts</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script type="text/javascript">
|
||||
$(".confirm-btn").on("click",function(){
|
||||
if(!confirm("Are you sure?")){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
</script>
|
|
@ -70,7 +70,7 @@
|
|||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
getTickets(pageNo);
|
||||
getObjects(pageNo);
|
||||
if(category){
|
||||
$("select#category").val(category);
|
||||
$("#search-clear-btn").removeClass("hide");
|
||||
|
@ -94,7 +94,7 @@
|
|||
dataType : "json"
|
||||
}).done(function(data){
|
||||
if(data.success){
|
||||
getTickets(pageNo);
|
||||
getObjects(pageNo);
|
||||
}else{
|
||||
errorArea.find(".message-text").text("Sorry, we were unable to perform the requested action.");
|
||||
errorArea.removeClass("hide");
|
||||
|
@ -105,7 +105,7 @@
|
|||
return false;
|
||||
})
|
||||
|
||||
var getTickets = function(page){
|
||||
var getObjects = function(page){
|
||||
pageNo = page;
|
||||
ticketsDom.hide();
|
||||
loader.show();
|
||||
|
@ -122,7 +122,7 @@
|
|||
loader.hide();
|
||||
var total_pages = parseInt(ticketsDom.find("input[type=hidden].total-pages").val());
|
||||
if (total_pages > 1){
|
||||
constructPagination(page, total_pages, "tickets");
|
||||
constructPagination(page, total_pages);
|
||||
}
|
||||
}, 500);
|
||||
})
|
||||
|
|
|
@ -45,3 +45,5 @@ en:
|
|||
contract_uid: Contract ID
|
||||
site: Site
|
||||
created_on: Created On
|
||||
loading_history: Loading History
|
||||
loading_contracts: Loading Contracts
|
|
@ -45,3 +45,5 @@ zh_tw:
|
|||
contract_uid: Contract ID
|
||||
site: Site
|
||||
created_on: Created On
|
||||
loading_history: Loading History
|
||||
loading_contracts: Loading Contracts
|
|
@ -40,7 +40,12 @@ Rails.application.routes.draw do
|
|||
|
||||
# history
|
||||
get "history" => "client_managements#history", as: "cpanel_myhistory"
|
||||
get "contracts" => "client_managements#contracts", as: "cpanel_mycontracts"
|
||||
get "request/:request_uid" => "client_managements#see_request"
|
||||
get "contract/:contract_uid" => "client_managements#see_contract", as: "cpanel_contract_show"
|
||||
patch "contract/:contract_uid/update_contract" => "client_managements#update_contract"
|
||||
get "request/:request_uid/cancel" => "client_managements#cancel_request", as: "cpanel_cancel_request"
|
||||
get "contract/:contract_uid/confirm" => "client_managements#confirm_contract"
|
||||
|
||||
# ticket
|
||||
get "site/:site_uid/new_ticket" => "client_managements#new_ticket"
|
||||
|
|
Loading…
Reference in New Issue