diff --git a/app/controllers/admin/client_managements_controller.rb b/app/controllers/admin/client_managements_controller.rb
index 73b0e7d..4327c90 100644
--- a/app/controllers/admin/client_managements_controller.rb
+++ b/app/controllers/admin/client_managements_controller.rb
@@ -8,5 +8,22 @@ class Admin::ClientManagementsController < OrbitAdminController
@site_request = SiteRequest.find(params[:id])
@user = @site_request.c_panel_user
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
\ No newline at end of file
diff --git a/app/models/request_contract.rb b/app/models/request_contract.rb
index 1ff9ec8..f6a1405 100644
--- a/app/models/request_contract.rb
+++ b/app/models/request_contract.rb
@@ -2,5 +2,14 @@ class RequestContract
include Mongoid::Document
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
end
\ No newline at end of file
diff --git a/app/views/admin/client_managements/_site_spec.html.erb b/app/views/admin/client_managements/_site_spec.html.erb
index 03ef524..345bd31 100644
--- a/app/views/admin/client_managements/_site_spec.html.erb
+++ b/app/views/admin/client_managements/_site_spec.html.erb
@@ -66,4 +66,4 @@
RWD :
Yes
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/app/views/admin/client_managements/_site_spec_form.html.erb b/app/views/admin/client_managements/_site_spec_form.html.erb
new file mode 100644
index 0000000..4ebc67d
--- /dev/null
+++ b/app/views/admin/client_managements/_site_spec_form.html.erb
@@ -0,0 +1,98 @@
+<% if @site_request.type == "existing" %>
+
+ <%= render :partial => "site_spec_form", :locals => {:f => f} %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/client_managements/show.html.erb b/app/views/admin/client_managements/show.html.erb
index 1d44840..b51f489 100644
--- a/app/views/admin/client_managements/show.html.erb
+++ b/app/views/admin/client_managements/show.html.erb
@@ -52,4 +52,13 @@
<% when "addsites" %>
<%= render :partial => "add_site_spec" %>
<% end %>
-
\ No newline at end of file
+
+
+<% case @site_request.type %>
+<% when "newsite" %>
+ Make Contract
+<% when "existing" %>
+ Make Contract
+<% when "addsites" %>
+ <%= render :partial => "add_site_spec" %>
+<% end %>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 53b6a99..f1a8c2a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -3,7 +3,12 @@ Rails.application.routes.draw do
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do
- resources :client_managements
+ resources :client_managements do
+ member do
+ get "make_contract"
+ post "create_contract"
+ end
+ end
end
scope :cpanel do