modification for frontend

This commit is contained in:
Harry Bomrah 2017-03-27 15:15:25 +08:00
parent afcca1c365
commit 708831e333
13 changed files with 95 additions and 34 deletions

View File

@ -3,9 +3,14 @@ $('.select-site').on('change', function (e) {
var valueSelected = this.value;
// console.log(optionSelected+', '+valueSelected);
if ( valueSelected == "newsite" ) {
$('.box-check-host').slideDown();
}else {
$('.box-check-host').slideUp();
$('#new-site-box').slideDown();
$('#maintenance-box').slideUp();
}else if(valueSelected == "") {
$('#new-site-box').slideUp();
$('#maintenance-box').slideUp();
}else{
$('#new-site-box').slideUp();
$('#maintenance-box').slideDown();
}
});

View File

@ -6,6 +6,8 @@ class SiteRequest
field :site_id
field :host_with_rulingdigital, type: Boolean, default: false
field :server_details
field :maintenance, type: Boolean, default: false
field :maintenance_years, type: Integer
field :optional_modules, type: Array, default: []
field :custom_module, type: Boolean, default: false
field :custom_module_details

View File

@ -8,6 +8,18 @@
<span class="content-line"><a href="<%= @site_request.get_site.site_domain %>" target="_blank"><%= @site_request.get_site.site_domain %></a>
</span>
</div>
<% if @site_request.maintenance %>
<div class="line-content">
<span class="header-line">Site maintenance : </span>
<span class="content-line"><span class="label label-success">Yes</span></a>
</span>
</div>
<div class="line-content">
<span class="header-line">Number of years : </span>
<span class="content-line"><%= @site_request.maintenance_years %></a>
</span>
</div>
<% end %>
<% else %>
<% if @site_request.host_with_rulingdigital %>
<div class="line-content">

View File

@ -21,11 +21,17 @@
</div>
<% end %>
<% end %>
<div class="line-content">
<% if @site_request.type == "existing" && @site_request.maintenance %>
<div class="line-content">
<span class="header-line"><%= f.label :service_cost, "Maintenance Cost for #{@site_request.maintenance_years} year(s):" %></span>
<span class="content-line"><%= f.number_field :service_cost, :min => "0" %></span>
</div>
<% elsif @site_request.type == "newsite" %>
<div class="line-content">
<span class="header-line"><%= f.label :service_cost, "Maintainance Cost:" %></span>
<span class="content-line"><%= f.number_field :service_cost, :min => "0" %></span>
</div>
</div>
<% end %>
<% if !@site_request.optional_modules.blank? %>
<div class="line-content">
@ -96,7 +102,7 @@
<div class="line-content">
<span class="header-line">Total Amount :</span>
<span class="content-line"><%= @contract.new_record? ? 0 : @contract.total_amount %> NTD.</span>
<span class="content-line"><span id="total-amount"><%= @contract.new_record? ? 0 : @contract.total_amount %></span> NTD.</span>
</div>
<% if @contract.new_record? %>
<%= f.hidden_field :site_request, :value => @site_request.id.to_s %>

View File

@ -84,6 +84,9 @@
<% 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>

View File

@ -11,7 +11,19 @@
<span class="header-detail">Site Domain : </span>
<span class="content-detail"><a href="http://<%= @site_request.get_site.site_domain %>" target="_blank"><%= @site_request.get_site.site_domain %></a></span>
</div>
<% else %>
<% if @site_request.maintenance %>
<div class="line-detail">
<span class="header-detail">Site maintenance : </span>
<span class="content-detail"><span class="label label-success">Yes</span></a>
</span>
</div>
<div class="line-detail">
<span class="header-detail">Number of years : </span>
<span class="content-detail"><%= @site_request.maintenance_years %></a>
</span>
</div>
<% end %>
<% else %>
<% if @site_request.host_with_rulingdigital %>
<div class="line-detail">
<span class="header-detail">Host with RulingDigital : </span>

View File

@ -35,7 +35,17 @@
<div class="line-add">
<%= f.label :site_id, "Select or Create" %>
<%= f.select :site_id, @user_sites, {:prompt => "------Select or Create------"}, {:class => "form-control select-site"} %>
<div class="box-check-host">
<div class="box-check-host" id="maintenance-box">
<div class="line-check-host">
<%= f.label :maintenance, "Renew my maintenance" %>
<%= f.check_box :maintenance %>
</div>
<div class="line-check-host">
<%= f.label :maintenance_years, "Year(s): " %>
<%= f.select :maintenance_years, options_for_select((1..5).collect{|i|[i,i]}), :class=>"form-control" %>
</div>
</div>
<div class="box-check-host" id="new-site-box">
<span class="text-check">Do you want to host with RulingDigital?</span>
<div class="line-check-host">
<%= f.radio_button :host_with_rulingdigital, "1", {:class => "radio-check"} %>
@ -136,3 +146,9 @@
</div>
<script type="text/javascript" src="/assets/client_management/add_new_site.js"></script>
<script type="text/javascript">
<% if params[:site].present? %>
$("#site_request_site_id").val("<%= params[:site] %>")
$("#maintenance-box").slideDown();
<% end %>
</script>

View File

@ -18,9 +18,9 @@
<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">
<input type="submit" value="Filter" class="btn btn-success">
<% if params[:q].present? %>
<a href="/cpanel/contracts">Clear</a>
<a href="/cpanel/contracts" class="btn btn-gray">Clear</a>
<% end %>
</form>
</div>

View File

@ -2,7 +2,7 @@
<ul class="list-sidebar">
<li class="item-sidebar"><a class="btn-sidebar" href="<%= sites_path %>"><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/site/<%= @site.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa fa-credit-card-alt" aria-hidden="true"></i><%= t("client_management.payments") %></a></li>
</ul>
<% end %>

View File

@ -11,7 +11,7 @@
<ul class="list-sidebar">
<li class="item-sidebar"><a class="btn-sidebar" href="<%= sites_path %>"><i class="fa fa-home" aria-hidden="true"></i><%= t("client_management.my_sites") %></a></li>
<li class="item-sidebar active"><a class="btn-sidebar" href="/cpanel/site/<%= @site.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa fa-credit-card-alt" aria-hidden="true"></i><%= t("client_management.payments") %></a></li>
</ul>
<% end %>

View File

@ -88,7 +88,12 @@
</ol>
</span>
<% else %>
<span class="header-detail"><%= t("client_management.#{attrib}") %></span>
<span class="header-detail">
<%= t("client_management.#{attrib}") %>
<% if attrib == "service_cost" %>
for <%= @site_request.maintenance_years rescue 1 %> year(s)
<% end %>
</span>
<% end %>
<span class="content-detail"><%= amount %></span>
</div>

View File

@ -2,7 +2,7 @@
<ul class="list-sidebar">
<li class="item-sidebar"><a class="btn-sidebar" href="<%= sites_path %>"><i class="fa fa-home" aria-hidden="true"></i><%= t("client_management.my_sites") %></a></li>
<li class="item-sidebar active"><a class="btn-sidebar" href="/cpanel/site/<%= @site.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa fa-credit-card-alt" aria-hidden="true"></i><%= t("client_management.payments") %></a></li>
</ul>
<% end %>

View File

@ -11,7 +11,7 @@
<ul class="list-sidebar">
<li class="item-sidebar"><a class="btn-sidebar" href="<%= sites_path %>"><i class="fa fa-home" aria-hidden="true"></i><%= t("client_management.my_sites") %></a></li>
<li class="item-sidebar active"><a class="btn-sidebar" href="/cpanel/site/<%= @site.uid %>"><i class="fa fa-envelope" aria-hidden="true"></i><%= t("client_management.tickets") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="<%= cpanel_add_new_site_path(:site => @site.id) %>"><i class="fa fa-server" aria-hidden="true"></i><%= t("client_management.services") %></a></li>
<li class="item-sidebar"><a class="btn-sidebar" href="#"><i class="fa fa fa-credit-card-alt" aria-hidden="true"></i><%= t("client_management.payments") %></a></li>
</ul>
<% end %>