updated with timeline and other changes

This commit is contained in:
Harry Bomrah 2017-10-09 17:44:59 +08:00
parent e1bb18976a
commit 5b265bb976
19 changed files with 890 additions and 213 deletions

View File

@ -4,10 +4,16 @@ $('.select-site').on('change', function (e) {
// console.log(optionSelected+', '+valueSelected); // console.log(optionSelected+', '+valueSelected);
if ( valueSelected == "newsite" ) { if ( valueSelected == "newsite" ) {
$('#new-site-box').slideDown(); $('#new-site-box').slideDown();
$("#upgrade-box").slideUp();
$('#maintenance-box').slideUp(); $('#maintenance-box').slideUp();
}else if(valueSelected == "") { }else if(valueSelected == "") {
$('#new-site-box').slideUp(); $('#new-site-box').slideUp();
$('#maintenance-box').slideUp(); $('#maintenance-box').slideUp();
$("#upgrade-box").slideUp();
}else if(valueSelected == "upgrade") {
$('#new-site-box').slideDown();
$("#upgrade-box").slideDown();
$('#maintenance-box').slideUp();
}else{ }else{
$('#new-site-box').slideUp(); $('#new-site-box').slideUp();
$('#maintenance-box').slideDown(); $('#maintenance-box').slideDown();

View File

@ -10,6 +10,7 @@ h1, h2, h3, h4, h5, h6, label, legend {
border: 1px solid #ddd; border: 1px solid #ddd;
margin: 30px 0 30px 15px; margin: 30px 0 30px 15px;
max-width: 1000px; max-width: 1000px;
min-width: 900px;
position: relative; position: relative;
} }
.sub-title { .sub-title {
@ -220,6 +221,54 @@ div .line-content:nth-child(1) {
margin: 0 5px; margin: 0 5px;
} }
.contract-wrapper .contract-actions{
position: fixed;
left: 1150px;
top: 88px;
vertical-align: top;
margin-top: 30px;
padding-bottom: 10px;
background: #fff;
width: 250px;
min-height: 100px;
border: 1px solid #ddd;
margin-left: 20px;
}
/*.contract-wrapper .contract-section{
display: inline-block;
}*/
.contract-actions .action-heading{
margin: 10px 10px;
/*color: #337ab7;*/
font-size: 20px;
font-weight: 400;
text-align: center;
}
.contract-actions ul{
list-style: none;
}
.contract-actions ul li{
font-size: 16px;
margin: 10px 0;
padding-left: 10px;
margin-right: 20px;
padding-bottom: 10px;
border-bottom: 1px dashed #ddd;
}
.contract-actions ul li a{
text-decoration: none;
}
.contract-actions ul li i{
font-size: 18px !important;
vertical-align: middle !important;
}
@media (max-width: 480px) { @media (max-width: 480px) {
.line-content .header-line { .line-content .header-line {
display: block; display: block;

View File

@ -0,0 +1,61 @@
.dashboard-wrapper {
margin: 25px;
#url-box {
border: 1px solid #ddd;
background: #fff;
width: 950px;
height: 45px;
padding:20px 50px 0 50px;
.site-title{
color: #337ab7;
font-size: 22px;
&:after{
margin-left: 30px;
content: "|";
color: #ddd;
}
}
.site-url{
margin-left: 40px;
font-style: italic;
font-size: 18px;
#site-url-edit-box{
display: inline-block;
button{
border: none;
background-color: #fff;
color: #337ab7;
font-size: 18px;
margin-bottom: 4px;
}
}
#edit-url-btn{
margin-left: 5px;
text-decoration: none;
font-size: 14px;
}
}
.request-type{
background-color: #09a231;
padding: 5px;
border-radius: 5px;
color: #fff;
font-size: 15px;
a{
color: #fff;
text-decoration: none;
}
}
}
#dashboard{
margin-top: 30px;
border: 1px solid #ddd;
background: #fff;
width: 950px;
min-height: 545px;
padding:20px 50px 0 50px;
}
}

View File

@ -17,6 +17,7 @@ body {
select.form-control { select.form-control {
background: #fff url(/assets/client_management/arrow.png) no-repeat calc(100% - 10px) 50%; background: #fff url(/assets/client_management/arrow.png) no-repeat calc(100% - 10px) 50%;
padding: 6px 35px 6px 12px; padding: 6px 35px 6px 12px;
height: 40px;
} }
/* line 20, ../sass/default.scss */ /* line 20, ../sass/default.scss */

View File

@ -15,6 +15,36 @@ class Admin::ClientManagementsController < OrbitAdminController
@contract = RequestContract.new @contract = RequestContract.new
end end
def make_timeline
@timeline = SiteTimeline.new
@site_request = SiteRequest.find(params[:id])
@user = @site_request.c_panel_user
end
def edit_timeline
@timeline = SiteTimeline.find(params[:id])
@site_request = @timeline.site_request
@user = @site_request.c_panel_user
end
def create_timeline
timeline = SiteTimeline.new(timeline_params)
timeline.save
redirect_to admin_client_management_path(timeline.site_request.id)
end
def update_timeline
timeline = SiteTimeline.find(params[:id])
timeline.update_attributes(timeline_params)
timeline.save
redirect_to admin_client_management_path(timeline.site_request.id)
end
def project_dashboard
@site_request = SiteRequest.find(params[:id])
end
def complete_request def complete_request
site_request = SiteRequest.find(params[:id]) site_request = SiteRequest.find(params[:id])
site_request.completed = true site_request.completed = true
@ -105,6 +135,12 @@ class Admin::ClientManagementsController < OrbitAdminController
redirect_to receipts_admin_client_management_path(receipt.contract_purchase.id) redirect_to receipts_admin_client_management_path(receipt.contract_purchase.id)
end end
def update_site_request
sr = SiteRequest.find(params[:id])
sr.update_attributes(site_request_params)
render :json => {"success" => true, "url" => sr.new_site_url}.to_json
end
def add_sites def add_sites
sr = SiteRequest.find(params[:id]) sr = SiteRequest.find(params[:id])
sr.update_attributes(site_request_params) sr.update_attributes(site_request_params)
@ -138,4 +174,8 @@ class Admin::ClientManagementsController < OrbitAdminController
params.require(:site_request).permit! params.require(:site_request).permit!
end end
def timeline_params
params.require(:site_timeline).permit!
end
end end

View File

@ -26,6 +26,7 @@ class ClientManagementsController < CPanelController
@newrequest = SiteRequest.new @newrequest = SiteRequest.new
@user_sites = current_cpanel_user.registered_sites.collect{|rs|[rs.title, rs.id.to_s]} @user_sites = current_cpanel_user.registered_sites.collect{|rs|[rs.title, rs.id.to_s]}
@user_sites << ["Create new site", "newsite"] @user_sites << ["Create new site", "newsite"]
@user_sites << ["Upgrade from R2", "upgrade"]
@optional_modules = RegisteredModule.where(:category_id.in => ["54ae569248345219fa080000","54abc1797470006ee0270000"], :approved => true) @optional_modules = RegisteredModule.where(:category_id.in => ["54ae569248345219fa080000","54abc1797470006ee0270000"], :approved => true)
end end
@ -33,6 +34,14 @@ class ClientManagementsController < CPanelController
rs = SiteRequest.new(rs_params) rs = SiteRequest.new(rs_params)
rs.c_panel_user = current_cpanel_user rs.c_panel_user = current_cpanel_user
rs.type = rs.site_id == "newsite" ? "newsite" : "existing" rs.type = rs.site_id == "newsite" ? "newsite" : "existing"
case rs.site_id
when "newsite"
rs.type = "newsite"
when "upgrade"
rs.type = "upgrade"
else
rs.type = "existing"
end
rs.save rs.save
session[:addsitestouser] = true session[:addsitestouser] = true
session[:request_uid] = rs.uid session[:request_uid] = rs.uid

View File

@ -19,18 +19,33 @@ class SiteRequest
field :sites_added, type: Array, default: [] field :sites_added, type: Array, default: []
field :completed, type: Boolean, :default => false field :completed, type: Boolean, :default => false
field :type field :type
field :site_title
field :upgrade_r2_site
field :new_site_url
belongs_to :site_purchase belongs_to :site_purchase
belongs_to :request_contract belongs_to :request_contract
belongs_to :c_panel_user belongs_to :c_panel_user
has_one :site_timeline
def get_site def get_site
self.site_id == "newsite" ? nil : (RegisteredSite.find(self.site_id) rescue nil) self.site_id == "newsite" || self.site_id == "upgrade" ? nil : (RegisteredSite.find(self.site_id) rescue nil)
end
def get_r2_site_link
if self.upgrade_r2_site.starts_with?("http://") || self.upgrade_r2_site.starts_with?("https://")
self.upgrade_r2_site
else
"http://#{self.upgrade_r2_site}"
end
end end
def get_request_type def get_request_type
case self.type case self.type
when "upgrade"
t = "Upgrade"
when "newsite" when "newsite"
t = "New Site" t = "New Site"
when "existing" when "existing"

View File

@ -0,0 +1,41 @@
class SiteTimeline
include Mongoid::Document
include Mongoid::Timestamps
field :test_site_creation_start, type: DateTime
field :test_site_creation_end, type: DateTime
field :test_site_creation_by
field :test_site_creation_completed, type: DateTime
field :template_design_images_start, type: DateTime
field :template_design_images_end, type: DateTime
field :template_design_images_by
field :template_design_images_completed, type: DateTime
field :template_html_css_start, type: DateTime
field :template_html_css_end, type: DateTime
field :template_html_css_by
field :template_html_css_completed, type: DateTime
field :customized_module_start, type: DateTime
field :customized_module_end, type: DateTime
field :customized_module_by
field :customized_module_completed, type: DateTime
field :data_migration_start, type: DateTime
field :data_migration_end, type: DateTime
field :data_migration_by
field :data_migration_completed, type: DateTime
field :site_structure_start, type: DateTime
field :site_structure_end, type: DateTime
field :site_structure_by
field :site_structure_completed, type: DateTime
field :site_migration_start, type: DateTime
field :site_migration_end, type: DateTime
field :site_migration_by
field :site_migration_completed, type: DateTime
belongs_to :site_request
end

View File

@ -5,6 +5,8 @@
<td><%= request.c_panel_user.name %></td> <td><%= request.c_panel_user.name %></td>
<td> <td>
<% case request.type %> <% case request.type %>
<% when "upgrade" %>
<span class="label label-info">Site Upgrade</span>
<% when "newsite" %> <% when "newsite" %>
<span class="label label-success">New Site</span> <span class="label label-success">New Site</span>
<% when "existing" %> <% when "existing" %>

View File

@ -21,6 +21,10 @@
</div> </div>
<% end %> <% end %>
<% else %> <% else %>
<div class="line-content">
<span class="header-line">Site Title :</span>
<span class="content-line"><%= @site_request.site_title %></span>
</div>
<% if @site_request.host_with_rulingdigital %> <% if @site_request.host_with_rulingdigital %>
<div class="line-content"> <div class="line-content">
<span class="header-line">Host with RulingDigital : </span> <span class="header-line">Host with RulingDigital : </span>

View File

@ -0,0 +1,69 @@
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<% end %>
<div class="line-content date-range">
<span class="header-line"><%= f.label :test_site_creation, "Test Site: " %></span>
<span class="content-line">
<%= f.datetime_picker :test_site_creation_start, :format => "yyyy/MM/dd", :label => "Start", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
<%= f.datetime_picker :test_site_creation_end, :format => "yyyy/MM/dd", :label => "End", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
</span>
</div>
<div class="line-content date-range">
<span class="header-line"><%= f.label :template_design_images, "Template Images: " %></span>
<span class="content-line">
<%= f.datetime_picker :template_design_images_start, :format => "yyyy/MM/dd", :label => "Start", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
<%= f.datetime_picker :template_design_images_end, :format => "yyyy/MM/dd", :label => "Start", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
</span>
</div>
<div class="line-content date-range">
<span class="header-line"><%= f.label :template_html_css, "Template HTML & CSS: " %></span>
<span class="content-line">
<%= f.datetime_picker :template_html_css_start, :format => "yyyy/MM/dd", :label => "Start", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
<%= f.datetime_picker :template_html_css_end, :format => "yyyy/MM/dd", :label => "End", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
</span>
</div>
<% if @site_request.custom_module %>
<div class="line-content date-range">
<span class="header-line"><%= f.label :customized_module, "Customized Module: " %></span>
<span class="content-line">
<%= f.datetime_picker :customized_module_start, :format => "yyyy/MM/dd", :label => "Start", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
<%= f.datetime_picker :customized_module_end, :format => "yyyy/MM/dd", :label => "End", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
</span>
</div>
<% end %>
<% if @site_request.type == "upgrade" %>
<div class="line-content date-range">
<span class="header-line"><%= f.label :data_migration, "Data Migrations: " %></span>
<span class="content-line">
<%= f.datetime_picker :data_migration_start, :format => "yyyy/MM/dd", :label => "Start", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
<%= f.datetime_picker :data_migration_end, :format => "yyyy/MM/dd", :label => "End", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
</span>
</div>
<% end %>
<div class="line-content date-range">
<span class="header-line"><%= f.label :site_structure, "Structure & Data Finalizing: " %></span>
<span class="content-line">
<%= f.datetime_picker :site_structure_start, :format => "yyyy/MM/dd", :label => "Start", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
<%= f.datetime_picker :site_structure_end, :format => "yyyy/MM/dd", :label => "End", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
</span>
</div>
<div class="line-content date-range">
<% if @site_request.host_with_rulingdigital %>
<span class="header-line"><%= f.label :site_migration, "DNS Redirect: " %></span>
<% else %>
<span class="header-line"><%= f.label :site_migration, "Site Migration: " %></span>
<% end %>
<span class="content-line">
<%= f.datetime_picker :site_migration_start, :format => "yyyy/MM/dd", :label => "Start", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
<%= f.datetime_picker :site_migration_end, :format => "yyyy/MM/dd", :label => "End", :new_record => @site_request.new_record?, :data=>{"picker-type" => "range", "range" => "end"} %>
</span>
</div>
<div class="line-content button">
<span class="header-line"></span>
<span class="content-line">
<%= f.hidden_field :site_request_id, :value => @site_request.id.to_s %>
<%= f.submit "Save", :class => "btn btn-primary" %>
<a href="<%= admin_client_management_path(@site_request.id) %>" class="btn btn-default">Back</a>
</span>
</div>

View File

@ -0,0 +1,142 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "client_management/backend" %>
<% end %>
<div class="page-client page-contract">
<div class="info-contract">
<h3 class="sub-title">Site Info</h3>
<div class="line-content">
<span class="header-line">Site Id :</span>
<span class="content-line"><%= @site_request.uid %></span>
</div>
<div class="line-content">
<span class="header-line">Site type :</span>
<span class="content-line"><%= @site_request.get_request_type %></span>
</div>
</div>
<div class="info-detail">
<h3 class="sub-title">User Details</h3>
<% if !@user.fullname.nil? %>
<div class="line-content">
<span class="header-line">Name :</span>
<span class="content-line"><%= @user.fullname %></span>
</div>
<% end %>
<div class="line-content">
<span class="header-line">Email :</span>
<span class="content-line"><%= @site_request.c_panel_user.email %></span>
</div>
<% if !@user.phone_number.nil? %>
<div class="line-content">
<span class="header-line">Phone Number :</span>
<span class="content-line"><%= @user.phone_number %></span>
</div>
<% end %>
<% if !@user.address.nil? %>
<div class="line-content">
<span class="header-line">Address :</span>
<span class="content-line"><%= @user.address %></span>
</div>
<% end %>
<% if !@user.registered_site_ids.empty? %>
<div class="line-content">
<span class="header-line">Registered Sites :</span>
<span class="content-line">
<% @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 %>
</span>
</div>
<% end %>
</div>
<div class="info-detail">
<h3 class="sub-title">Timeline</h3>
<div id="timeline-chart" style="height: 300px;">
</div>
</div>
<div class="info-spec" id="timeline-form">
<%= form_for @timeline, :url => {:action => :update_timeline}, :html => {:class => "form-horizontal contract-form"} do |f| %>
<h3 class="sub-title">Timeline</h3>
<%= render :partial => "site_timeline_form", :locals => {:f => f} %>
<% end %>
</div>
</div>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
var chart = null,
dataTable = null,
titles = {
"site_timeline_test_site_creation_end" : "Test Site Creation",
"site_timeline_template_design_images_end" : "Template Images",
"site_timeline_template_html_css_end" : "Template HTML & CSS",
"site_timeline_customized_module_end" : "Customized Module",
"site_timeline_data_migration_end" : "Data Migration",
"site_timeline_site_structure_end" : "Structure & Data Finalizing ",
"site_timeline_site_migration_end" : "Site Migration"
}
google.charts.load("current", {packages:["timeline"]});
google.charts.setOnLoadCallback(drawChart);
var timelineOptions = {
timeline: { showRowLabels: true }
};
function drawChart() {
var container = document.getElementById('timeline-chart');
chart = new google.visualization.Timeline(container);
dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'Term' });
dataTable.addColumn({ type: 'string', id: 'Name' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
// chart.draw(dataTable, timelineOptions);
drawTimline();
}
var dt = [],
counter = 0;
$("#timeline-form input[data-range=end]").on("blur",function(){
var id = $(this).attr("id"),
startdt = new Date($(this).parents(".content-line").find("input[data-range=start]").val()),
enddt = new Date($(this).val());
if(dt.indexOf(id) == -1){
dt.push(id);
counter++;
dataTable.addRow([counter.toString(), titles[id], startdt, enddt]);
}else{
dataTable.setValue(dt.indexOf(id), 2, startdt);
dataTable.setValue(dt.indexOf(id), 3, enddt);
}
chart.draw(dataTable, timelineOptions)
})
var drawTimline = function(){
$(".date-range").each(function(){
var enddp = $(this).find("input[data-range=end]"),
startdp = $(this).find("input[data-range=start]"),
startdt = new Date(startdp.val()),
enddt = new Date(enddp.val()),
id = enddp.attr("id");
if(dt.indexOf(id) == -1){
dt.push(id);
counter++;
dataTable.addRow([counter.toString(), titles[id], startdt, enddt]);
}else{
dataTable.setValue(dt.indexOf(id), 2, startdt);
dataTable.setValue(dt.indexOf(id), 3, enddt);
}
chart.draw(dataTable, timelineOptions)
})
}
</script>

View File

@ -0,0 +1,114 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "client_management/backend" %>
<% end %>
<div class="page-client page-contract">
<div class="info-contract">
<h3 class="sub-title">Site Info</h3>
<div class="line-content">
<span class="header-line">Site Id :</span>
<span class="content-line"><%= @site_request.uid %></span>
</div>
<div class="line-content">
<span class="header-line">Site type :</span>
<span class="content-line"><%= @site_request.get_request_type %></span>
</div>
</div>
<div class="info-detail">
<h3 class="sub-title">User Details</h3>
<% if !@user.fullname.nil? %>
<div class="line-content">
<span class="header-line">Name :</span>
<span class="content-line"><%= @user.fullname %></span>
</div>
<% end %>
<div class="line-content">
<span class="header-line">Email :</span>
<span class="content-line"><%= @site_request.c_panel_user.email %></span>
</div>
<% if !@user.phone_number.nil? %>
<div class="line-content">
<span class="header-line">Phone Number :</span>
<span class="content-line"><%= @user.phone_number %></span>
</div>
<% end %>
<% if !@user.address.nil? %>
<div class="line-content">
<span class="header-line">Address :</span>
<span class="content-line"><%= @user.address %></span>
</div>
<% end %>
<% if !@user.registered_site_ids.empty? %>
<div class="line-content">
<span class="header-line">Registered Sites :</span>
<span class="content-line">
<% @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 %>
</span>
</div>
<% end %>
</div>
<div class="info-detail">
<h3 class="sub-title">Timeline</h3>
<div id="timeline-chart" style="height: 300px;">
</div>
</div>
<div class="info-spec" id="timeline-form">
<%= form_for @timeline, :url => {:action => :create_timeline}, :html => {:class => "form-horizontal contract-form"} do |f| %>
<h3 class="sub-title">Timeline</h3>
<%= render :partial => "site_timeline_form", :locals => {:f => f} %>
<% end %>
</div>
</div>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
var chart = null,
dataTable = null,
titles = {
"site_timeline_test_site_creation_end" : "Test Site Creation",
"site_timeline_template_design_images_end" : "Template Images",
"site_timeline_template_html_css_end" : "Template HTML & CSS",
"site_timeline_customized_module_end" : "Customized Module",
"site_timeline_data_migration_end" : "Data Migration",
"site_timeline_site_structure_end" : "Structure & Data Finalizing ",
"site_timeline_site_migration_end" : "Site Migration"
}
google.charts.load("current", {packages:["timeline"]});
google.charts.setOnLoadCallback(drawChart);
var timelineOptions = {
timeline: { showRowLabels: true }
};
function drawChart() {
var container = document.getElementById('timeline-chart');
chart = new google.visualization.Timeline(container);
dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'Term' });
dataTable.addColumn({ type: 'string', id: 'Name' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
chart.draw(dataTable, timelineOptions);
}
var dt = [],
counter = 0,
date = new Date();
$("#timeline-form input[data-range=end]").on("blur",function(){
var id = $(this).attr("id"),
startdt = new Date($(this).parents(".content-line").find("input[data-range=start]").val()),
enddt = new Date($(this).val());
if(dt.indexOf(id) == -1){
dt.push(id);
counter++;
dataTable.addRow([counter.toString(), titles[id], startdt, enddt]);
}else{
dataTable.setValue(dt.indexOf(id), 2, startdt);
dataTable.setValue(dt.indexOf(id), 3, enddt);
}
chart.draw(dataTable, timelineOptions)
})
</script>

View File

@ -0,0 +1,62 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "client_management/dashboard" %>
<% end %>
<div class="dashboard-wrapper">
<div class="left-side">
<div id="url-box">
<span class="site-title"><%= @site_request.site_title %></span>
<span class="site-url">
<span id="edit-url-box">
<% if @site_request.new_site_url.nil? || @site_request.new_site_url == "" %>
<a href="" id="site-url-tag">Not Available</a>
<% else %>
<a href="<%= @site_request.new_site_url %>" target="_blank" id="site-url-tag"><%= @site_request.new_site_url %></a>
<% end %>
<a href="" id="edit-url-btn"><i class="icons-pencil"></i></a>
</span>
<span id="site-url-edit-box" style="display:none;">
<%= form_for @site_request, :url => {:action => "update_site_request"} do |f| %>
<%= f.text_field :new_site_url, :placeholder => "http://site-abbr.pending.rulingcom.com" %>
<button role="submit"><i class="icons-checkmark"></i></button>
<% end %>
</span>
</span>
<span class="pull-right request-type">
<%= @site_request.get_request_type %>
<% if @site_request.type == "upgrade" %>
<a href="<%= @site_request.upgrade_r2_site %>" target="_blank"><i class="icons-popup"></i></a>
<% end %>
</span>
</div>
<div id="dashboard">
</div>
</div>
</div>
<script type="text/javascript">
$("#edit-url-btn").on("click",function(){
$("#edit-url-box").hide();
$("#site-url-edit-box").show();
$("#site-url-edit-box input[type=text]").focus();
return false;
})
$("#site-url-edit-box form").on("submit",function(){
var form = $(this);
$.ajax({
url : form.attr("action"),
data : form.serialize(),
type : "post",
dataType : "json"
}).done(function(data){
$("#site-url-tag").attr("href", data.url).text(data.url);
$("#site-url-edit-box").hide();
$("#edit-url-box").show();
})
return false;
})
</script>

View File

@ -2,157 +2,182 @@
<%= stylesheet_link_tag "client_management/backend" %> <%= stylesheet_link_tag "client_management/backend" %>
<% end %> <% end %>
<div class="page-contract page-client"> <div class="contract-wrapper">
<div class="info-contract"> <div class="page-contract page-client contract-section">
<h3 class="sub-title">Contract Info</h3> <div class="info-contract">
<div class="line-content"> <h3 class="sub-title">Contract Info</h3>
<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>
<% if !@contract.contract_purchase.nil? %>
<div class="line-content"> <div class="line-content">
<span class="header-line">Payment Status :</span> <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"> <span class="content-line">
<% if @contract.contract_purchase.cleared? %> <%= (@contract.is_confirmed? ? "<span class='label label-success'>Yes</span>" : "<span class='label label-important'>No</span>").html_safe %>
<span class="label label-success">Cleared</span>
<% else %>
<span class="label label-important">Pending</span>
<% end %>
</span> </span>
</div> </div>
<% end %> <% if !@contract.contract_purchase.nil? %>
</div> <div class="line-content">
<div class="info-contract-request"> <span class="header-line">Payment Status :</span>
<h3 class="sub-title">Request</h3> <span class="content-line">
<div class="line-content"> <% if @contract.contract_purchase.cleared? %>
<span class="header-line">Type :</span> <span class="label label-success">Cleared</span>
<span class="content-line"><%= @site_request.get_request_type %></span> <% else %>
</div> <span class="label label-important">Pending</span>
</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 %>
<% if attrib == "service_cost" %>
for <%= @site_request.maintenance_years rescue 1 %> year(s)
<% end %> <% end %>
</span> </span>
<span class="content-line"><%= amount %></span>
</div> </div>
<% total_amount = total_amount + amount %>
<% end %> <% end %>
<% end %> </div>
<% if !@contract.other.nil? || @contract.other_cost > 0 %> <div class="info-contract-request">
<div class="line-content qt"> <h3 class="sub-title">Request</h3>
<span class="header-line"> <div class="line-content">
Other Requirements <span class="header-line">Type :</span>
<div class="requirement-text"> <span class="content-line"><%= @site_request.get_request_type %></span>
<%= nl2br(@contract.other) %>
</div>
</span>
<span class="content-line"><%= @contract.other_cost %></span>
</div> </div>
<% total_amount = total_amount + @contract.other_cost %> </div>
<% 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"> <% if @site_request.type == "existing" %>
<%= form_for @contract, :url => {:action => "update_contract"}, :html => {:class => "form-horizontal"} do |f| %> <div class="info-contract-detail">
<span class="header-line">Signed Contract File :</span> <h3 class="sub-title">Site Details</h3>
<span class="content-line"> <div class="line-content">
<%= f.file_field :signed_contract_file, :class => "file-box" %> <span class="header-line">Site ID :</span>
<%= f.submit "Upload", :class => "btn btn-primary" %> <span class="content-line"><%= @site_request.get_site.uid %></span>
</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 %> <% end %>
</div> </div>
</div>
<div class="info-contract-buttons"> <div class="info-contract-quatation">
<div class="line-content button"> <h3 class="sub-title">Quotaion</h3>
<% if !@contract.is_confirmed? %> <div class="line-content qt">
<a href="<%= edit_contract_admin_client_management_path(@contract.id) %>" class="btn btn-warning">Edit Contract</a> <span class="header-line">Item</span>
<a href="<%= confirm_contract_admin_client_management_path(@contract.id, :confirm => "true") %>" class="btn btn-success">Confirm Contract</a> <span class="content-line">Cost in NTD.</span>
<% else %> </div>
<% if @contract.contract_purchase.nil? %> <% total_amount = 0 %>
<a href="<%= make_purchase_admin_client_management_path(@contract.id) %>" class="btn btn-warning" id="make-purchase-btn">Make Purchase</a> <% ["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| %>
<a href="<%= confirm_contract_admin_client_management_path(@contract.id, :confirm => "false") %>" class="btn btn-danger">Un-Confirm Contract</a> <% amount = @contract.send(attrib.to_sym) %>
<% else %> <% if amount > 0 %>
<a href="<%= receipts_admin_client_management_path(@contract.contract_purchase.id) %>" class="btn btn-warning">Receipts</a> <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 %>
<% 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 %>
<% end %> <% end %>
<a href="#" class="btn btn-info">Export Contract</a> <% if !@contract.other.nil? || @contract.other_cost > 0 %>
<a href="<%= completed_requests_admin_client_managements_path(:page => params[:page]) %>" class="btn">Back</a> <div class="line-content qt">
<span class="header-line">
Other Requirements
<div class="requirement-text">
<%= nl2br(@contract.other) %>
</div>
</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>
<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="line-content buttons">
<a class="btn btn-info pull-right" href="<%= completed_requests_admin_client_managements_path(:page => params[:page]) %>">Back</a>
</div>
</div>
<div class="contract-actions contract-section">
<h3 class="action-heading">Actions</h3>
<ul>
<% if !@contract.is_confirmed? %>
<li>
<a href="<%= edit_contract_admin_client_management_path(@contract.id) %>"><i class="icons-pencil"></i> Edit Contract</a>
</li>
<li>
<a href="<%= confirm_contract_admin_client_management_path(@contract.id, :confirm => "true") %>" ><i class="icons-checkmark"></i> Confirm Contract</a>
</li>
<% else %>
<% if @contract.contract_purchase.nil? %>
<li>
<a href="<%= make_purchase_admin_client_management_path(@contract.id) %>" id="make-purchase-btn"><i class="icons-cart"></i> Make Purchase</a>
</li>
<li>
<a href="<%= confirm_contract_admin_client_management_path(@contract.id, :confirm => "false") %>"><i class="icons-cross"></i> Un-Confirm Contract</a>
</li>
<% else %>
<li>
<a href="<%= receipts_admin_client_management_path(@contract.contract_purchase.id) %>"><i class="icons-credit-card" aria-hidden="true"></i> Receipts</a>
</li>
<% end %>
<li>
<a href="<%= project_dashboard_admin_client_management_path(@site_request.id) %>"><i class="icons-gauge"></i> Dashboard</a>
</li>
<% end %>
<% if !@contract.site_request.site_timeline.nil? %>
<li>
<a href="<%= edit_timeline_admin_client_management_path(@contract.site_request.site_timeline.id) %>"><i class="icons-flow-line"></i> Timeline</a>
</li>
<% end %>
<li>
<a href="#"><i class="icons-export"></i> Export Contract</a>
</li>
</ul>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$("#make-purchase-btn").on("click",function(){ $("#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?")){ if(!confirm("Once you create a purchase, you cannot un-confirm or edit this contract. Continue to create a purchase for this contract?")){

View File

@ -1,86 +1,109 @@
<% content_for :page_specific_css do %> <% content_for :page_specific_css do %>
<%= stylesheet_link_tag "client_management/backend" %> <%= stylesheet_link_tag "client_management/backend" %>
<% end %> <% end %>
<div class="contract-wrapper">
<div class="page-request page-client"> <div class="page-request page-client contract-section">
<div class="info-request"> <div class="info-request">
<h3 class="sub-title"> <h3 class="sub-title">
Request Info Request Info
</h3> </h3>
<div class="line-content"> <div class="line-content">
<span class="header-line">Request ID :</span> <span class="header-line">Request ID :</span>
<span class="content-line"><%= @site_request.uid %></span> <span class="content-line"><%= @site_request.uid %></span>
</div>
<div class="line-content">
<span class="header-line">Request type :</span>
<span class="content-line"><%= @site_request.get_request_type %></span>
</div>
<% if @site_request.type == "upgrade" %>
<div class="line-content">
<span class="header-line">R2 Site :</span>
<span class="content-line"><a href="<%= @site_request.get_r2_site_link %>" target="_blank"><%= @site_request.get_r2_site_link %></a></span>
</div>
<% end %>
</div> </div>
<div class="line-content">
<span class="header-line">Request type :</span> <div class="info-user">
<span class="content-line"><%= @site_request.get_request_type %></span> <h3 class="sub-title">User Details</h3>
<% if !@user.fullname.nil? %>
<div class="line-content">
<span class="header-line">Name :</span>
<span class="content-line"><%= @user.fullname %></span>
</div>
<% end %>
<div class="line-content">
<span class="header-line">Email :</span>
<span class="content-line"><%= @site_request.c_panel_user.email %></span>
</div>
<% if !@user.phone_number.nil? %>
<div class="line-content">
<span class="header-line">Phone Number :</span>
<span class="content-line"><%= @user.phone_number %></span>
</div>
<% end %>
<% if !@user.address.nil? %>
<div class="line-content">
<span class="header-line">Address :</span>
<span class="content-line"><%= @user.address %></span>
</div>
<% end %>
<% if !@user.registered_site_ids.empty? %>
<div class="line-content">
<span class="header-line">Registered Sites :</span>
<span class="content-line">
<% @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 %>
</span>
</div>
<% end %>
</div>
<div class="info-site">
<h3 class="sub-title">Request Specifications</h3>
<% case @site_request.type %>
<% when "newsite", "upgrade" %>
<%= render :partial => "site_spec" %>
<% when "existing" %>
<%= render :partial => "site_spec" %>
<% when "addsites" %>
<%= render :partial => "add_site_spec" %>
<% end %>
</div> </div>
</div> </div>
<div class="contract-actions contract-section">
<div class="info-user"> <h3 class="action-heading">Actions</h3>
<h3 class="sub-title">User Details</h3> <ul>
<% if !@user.fullname.nil? %> <% if @site_request.request_contract.nil? %>
<div class="line-content"> <% case @site_request.type %>
<span class="header-line">Name :</span> <% when "existing","newsite","upgrade" %>
<span class="content-line"><%= @user.fullname %></span> <li>
</div> <a href="<%= make_contract_admin_client_management_path(@site_request.id) %>"><i class="icons-text-2"></i> Contract</a>
<% end %> </li>
<div class="line-content">
<span class="header-line">Email :</span>
<span class="content-line"><%= @site_request.c_panel_user.email %></span>
</div>
<% if !@user.phone_number.nil? %>
<div class="line-content">
<span class="header-line">Phone Number :</span>
<span class="content-line"><%= @user.phone_number %></span>
</div>
<% end %>
<% if !@user.address.nil? %>
<div class="line-content">
<span class="header-line">Address :</span>
<span class="content-line"><%= @user.address %></span>
</div>
<% end %>
<% if !@user.registered_site_ids.empty? %>
<div class="line-content">
<span class="header-line">Registered Sites :</span>
<span class="content-line">
<% @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 %>
</span>
</div>
<% end %>
</div>
<div class="info-site">
<h3 class="sub-title">Request Specifications</h3>
<% case @site_request.type %>
<% when "newsite" %>
<%= render :partial => "site_spec" %>
<% when "existing" %>
<%= render :partial => "site_spec" %>
<% when "addsites" %>
<%= render :partial => "add_site_spec" %>
<% end %>
</div>
<div class="info-button">
<div class="line-content">
<span class="header-line"></span>
<span class="content-line">
<% if @site_request.request_contract.nil? %>
<% case @site_request.type %>
<% when "existing","newsite" %>
<a class="btn btn-primary" href="<%= make_contract_admin_client_management_path(@site_request.id) %>">Make Contract</a>
<% end %>
<% else %>
<% case @site_request.type %>
<% when "existing","newsite" %>
<a class="btn btn-primary" href="<%= see_contract_admin_client_management_path(@site_request.request_contract.id) %>">View Contract</a>
<% end %>
<% end %> <% end %>
</span> <% else %>
</div> <% case @site_request.type %>
<% when "existing","newsite","upgrade" %>
<li>
<a href="<%= see_contract_admin_client_management_path(@site_request.request_contract.id) %>"><i class="icons-text-2"></i> Contract</a>
</li>
<% end %>
<% if @site_request.request_contract.is_confirmed? %>
<li>
<a href="<%= project_dashboard_admin_client_management_path(@site_request.id) %>"><i class="icons-gauge"></i> Dashboard</a>
</li>
<% end %>
<% end %>
<% if @site_request.site_timeline.nil? %>
<li>
<a href="<%= make_timeline_admin_client_management_path(@site_request.id) %>"><i class="icons-flow-line"></i> Timeline</a>
</li>
<% else %>
<li>
<a href="<%= edit_timeline_admin_client_management_path(@site_request.site_timeline.id) %>"><i class="icons-flow-line"></i> Timeline</a>
</li>
<% end %>
</ul>
</div> </div>
</div> </div>

View File

@ -46,6 +46,10 @@
</div> </div>
</div> </div>
<div class="box-check-host" id="new-site-box"> <div class="box-check-host" id="new-site-box">
<div class="line-check-host">
<label for="site_request_site_title" class="text-check">Site title</label>
<%= f.text_field :site_title %>
</div>
<span class="text-check">Do you want to host with RulingDigital?</span> <span class="text-check">Do you want to host with RulingDigital?</span>
<div class="line-check-host"> <div class="line-check-host">
<%= f.radio_button :host_with_rulingdigital, "1", {:class => "radio-check"} %> <%= f.radio_button :host_with_rulingdigital, "1", {:class => "radio-check"} %>
@ -55,7 +59,11 @@
</div> </div>
<div class="line-check-host"> <div class="line-check-host">
<label for="details-host" class="text-check">Please provide server details</label> <label for="details-host" class="text-check">Please provide server details</label>
<%= f.text_area :server_details, :id => "details-host", :cols => "30", :rows => "10", :class => "form-control", :placeholder => "Please provide your server details in detail" %> <%= f.text_area :server_details, :id => "details-host", :cols => "30", :rows => "10", :class => "form-control", :placeholder => "Please provide your server details like server IP, credentials." %>
</div>
<div id="upgrade-box" class="line-check-host" style="display: none;">
<label for="site_request_upgrade_r2_site" class="text-check">R2 Site URL</label>
<%= f.text_field :upgrade_r2_site %>
</div> </div>
</div> </div>
</div> </div>

View File

@ -18,7 +18,7 @@
<div class="cp-addsite-step0"> <div class="cp-addsite-step0">
<a href="<%= cpanel_add_new_site_path %>" class="add-new"> <a href="<%= cpanel_add_new_site_path %>" class="add-new">
<i class="fa fa-plus-circle" aria-hidden="true"></i> <i class="fa fa-plus-circle" aria-hidden="true"></i>
<span>Add New Site</span> <span>Add / Upgrade / Update Site</span>
<i class="fa fa-sp fa-plus-circle" aria-hidden="true"></i> <i class="fa fa-sp fa-plus-circle" aria-hidden="true"></i>
</a> </a>

View File

@ -14,6 +14,10 @@ Rails.application.routes.draw do
get "see_contract" get "see_contract"
patch "update_contract" patch "update_contract"
get "confirm_contract" get "confirm_contract"
get "make_timeline"
get "edit_timeline"
post "create_timeline"
post "update_timeline"
get "make_purchase" get "make_purchase"
patch "add_sites" patch "add_sites"
get "complete_request" get "complete_request"
@ -22,6 +26,8 @@ Rails.application.routes.draw do
get "edit_receipt" get "edit_receipt"
post "create_receipt" post "create_receipt"
patch "update_receipt" patch "update_receipt"
get "project_dashboard"
patch "update_site_request"
end end
collection do collection do
get "completed_requests" get "completed_requests"