mods of category optional module and backend
This commit is contained in:
parent
085b9c937a
commit
3591a4c810
|
@ -8,5 +8,22 @@ class Admin::ClientManagementsController < OrbitAdminController
|
||||||
@site_request = SiteRequest.find(params[:id])
|
@site_request = SiteRequest.find(params[:id])
|
||||||
@user = @site_request.c_panel_user
|
@user = @site_request.c_panel_user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def make_contract
|
||||||
|
@site_request = SiteRequest.find(params[:id])
|
||||||
|
@user = @site_request.c_panel_user
|
||||||
|
@new_contract = RequestContract.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_contract
|
||||||
|
RequestContract.create(contract_params)
|
||||||
|
redirect_to admin_client_managements_path
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def contract_params
|
||||||
|
params.require(:request_contract).permit!
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -2,5 +2,14 @@ class RequestContract
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :new_site_cost, type: Integer, :default => 0
|
||||||
|
field :hosting_with_rulingdigital_cost, type: Integer, :default => 0
|
||||||
|
field :service_cost, type: Integer, :default => 0
|
||||||
|
field :option_module_cost, type: Integer, :default => 0
|
||||||
|
field :customized_module_cost, type: Integer, :default => 0
|
||||||
|
field :template_cost, type: Integer, :default => 0
|
||||||
|
field :customized_template_cost, type: Integer, :default => 0
|
||||||
|
field :rwd_cost, type: Integer, :default => 0
|
||||||
|
|
||||||
has_one :site_request
|
has_one :site_request
|
||||||
end
|
end
|
|
@ -66,4 +66,4 @@
|
||||||
<th>RWD : </th>
|
<th>RWD : </th>
|
||||||
<td><span class="label label-success">Yes</span></td>
|
<td><span class="label label-success">Yes</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
<% if @site_request.type == "existing" %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">Site Title :</label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= @site_request.get_site.title %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">Site Domain :</label>
|
||||||
|
<div class="controls">
|
||||||
|
<a href="<%= @site_request.get_site.site_domain %>" target="_blank"><%= @site_request.get_site.site_domain %></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :new_site_cost, "New Site Cost:", :class => "control-label" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.number_field :new_site_cost, :min => "0" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% if @site_request.host_with_rulingdigital %>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :hosting_with_rulingdigital_cost, "Host with RulingDigital:", :class => "control-label" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.number_field :hosting_with_rulingdigital_cost, :min => "0" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :service_cost, "Maintainance Cost:", :class => "control-label" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.number_field :service_cost, :min => "0" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% if !@site_request.optional_modules.blank? %>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :option_module_cost, "Optional Modules Cost:", :class => "control-label" %>
|
||||||
|
<% rsm = RegisteredModule.find(@site_request.optional_modules) %>
|
||||||
|
<div class="controls">
|
||||||
|
<ul>
|
||||||
|
<% rsm.each do |mod| %>
|
||||||
|
<li><span class="label label-info"><%= mod.name %></span></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<%= f.number_field :option_module_cost, :min => "0" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if @site_request.custom_module %>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :customized_module_cost, "Optional Module Cost:", :class => "control-label" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.number_field :customized_module_cost, :min => "0" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if !@site_request.template_number.empty? %>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :template_cost, "Template Cost:", :class => "control-label" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.number_field :template_cost, :min => "0" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if @site_request.custom_template %>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :customized_template_cost, "Customized Template Cost:", :class => "control-label" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.number_field :customized_template_cost, :min => "0" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if @site_request.rwd %>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :rwd_cost, "RWD Cost:", :class => "control-label" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.number_field :rwd_cost, :min => "0" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<div>
|
||||||
|
<h3>Total Amount : <span id="total-amount">0</span> NTD.</h3>
|
||||||
|
</div>
|
||||||
|
<%= f.hidden_field :site_request, :value => @site_request.id.to_s %>
|
||||||
|
<%= f.submit "Submit", :class => "btn btn-primary" %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var costFields = $("form.contract-form input[type=number]"),
|
||||||
|
totalAmountDom = $("#total-amount");
|
||||||
|
costFields.on("change",function(){
|
||||||
|
var totalAmount = 0;
|
||||||
|
$.each(costFields,function(){
|
||||||
|
var amt = ($(this).val() == "" ? 0 : $(this).val());
|
||||||
|
totalAmount += parseInt(amt);
|
||||||
|
})
|
||||||
|
totalAmountDom.text(totalAmount);
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -25,6 +25,9 @@
|
||||||
<td><%= request.created_at.strftime("%y-%m-%d %H:%M") %></td>
|
<td><%= request.created_at.strftime("%y-%m-%d %H:%M") %></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<%= admin_client_management_path(request.id) %>" class="btn btn-info">Details</a>
|
<a href="<%= admin_client_management_path(request.id) %>" class="btn btn-info">Details</a>
|
||||||
|
<% if request.request_contract != nil %>
|
||||||
|
<a href="#" class="btn btn-warning">Contract</a>
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
<style type="text/css">
|
||||||
|
table th{
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<h2>Site Id : <%= @site_request.uid %></h2>
|
||||||
|
<h2>Site type : <%= @site_request.get_site_type %></h2>
|
||||||
|
<table width="100%">
|
||||||
|
<caption><h3>User Details</h3></caption>
|
||||||
|
<% if !@user.fullname.nil? %>
|
||||||
|
<tr>
|
||||||
|
<th>Name :</th>
|
||||||
|
<td><%= @user.fullname %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<th>Email :</th>
|
||||||
|
<td><%= @site_request.c_panel_user.email %></td>
|
||||||
|
</tr>
|
||||||
|
<% if !@user.phone_number.nil? %>
|
||||||
|
<tr>
|
||||||
|
<th>Phone Number :</th>
|
||||||
|
<td><%= @user.phone_number %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% if !@user.address.nil? %>
|
||||||
|
<tr>
|
||||||
|
<th>Address :</th>
|
||||||
|
<td><%= @user.address %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% if !@user.registered_site_ids.empty? %>
|
||||||
|
<tr>
|
||||||
|
<th>Registered Sites :</th>
|
||||||
|
<td>
|
||||||
|
<% @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 %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
<hr>
|
||||||
|
<%= form_for @new_contract, :url => {:action => :create_contract}, :html => {:class => "form-horizontal contract-form"} do |f| %>
|
||||||
|
<h3>Request Specifications</h3>
|
||||||
|
<%= render :partial => "site_spec_form", :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -52,4 +52,13 @@
|
||||||
<% when "addsites" %>
|
<% when "addsites" %>
|
||||||
<%= render :partial => "add_site_spec" %>
|
<%= render :partial => "add_site_spec" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<% case @site_request.type %>
|
||||||
|
<% when "newsite" %>
|
||||||
|
<a class="btn btn-primary" href="<%= make_contract_admin_client_management_path(@site_request.id) %>">Make Contract</a>
|
||||||
|
<% when "existing" %>
|
||||||
|
<a class="btn btn-primary" href="<%= make_contract_admin_client_management_path(@site_request.id) %>">Make Contract</a>
|
||||||
|
<% when "addsites" %>
|
||||||
|
<%= render :partial => "add_site_spec" %>
|
||||||
|
<% end %>
|
|
@ -3,7 +3,12 @@ Rails.application.routes.draw do
|
||||||
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
||||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :client_managements
|
resources :client_managements do
|
||||||
|
member do
|
||||||
|
get "make_contract"
|
||||||
|
post "create_contract"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scope :cpanel do
|
scope :cpanel do
|
||||||
|
|
Loading…
Reference in New Issue