diff --git a/app/assets/javascripts/client_management/add_new_site.js b/app/assets/javascripts/client_management/add_new_site.js index e551244..867c27b 100644 --- a/app/assets/javascripts/client_management/add_new_site.js +++ b/app/assets/javascripts/client_management/add_new_site.js @@ -4,10 +4,16 @@ $('.select-site').on('change', function (e) { // console.log(optionSelected+', '+valueSelected); if ( valueSelected == "newsite" ) { $('#new-site-box').slideDown(); + $("#upgrade-box").slideUp(); $('#maintenance-box').slideUp(); }else if(valueSelected == "") { $('#new-site-box').slideUp(); $('#maintenance-box').slideUp(); + $("#upgrade-box").slideUp(); + }else if(valueSelected == "upgrade") { + $('#new-site-box').slideDown(); + $("#upgrade-box").slideDown(); + $('#maintenance-box').slideUp(); }else{ $('#new-site-box').slideUp(); $('#maintenance-box').slideDown(); diff --git a/app/assets/stylesheets/client_management/backend.css b/app/assets/stylesheets/client_management/backend.css index cadd426..d608e7d 100644 --- a/app/assets/stylesheets/client_management/backend.css +++ b/app/assets/stylesheets/client_management/backend.css @@ -10,6 +10,7 @@ h1, h2, h3, h4, h5, h6, label, legend { border: 1px solid #ddd; margin: 30px 0 30px 15px; max-width: 1000px; + min-width: 900px; position: relative; } .sub-title { @@ -220,6 +221,54 @@ div .line-content:nth-child(1) { 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) { .line-content .header-line { display: block; diff --git a/app/assets/stylesheets/client_management/dashboard.scss b/app/assets/stylesheets/client_management/dashboard.scss new file mode 100644 index 0000000..1e5f206 --- /dev/null +++ b/app/assets/stylesheets/client_management/dashboard.scss @@ -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; + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/client_management/default.css b/app/assets/stylesheets/client_management/default.css index ed617be..82dd9c4 100644 --- a/app/assets/stylesheets/client_management/default.css +++ b/app/assets/stylesheets/client_management/default.css @@ -17,6 +17,7 @@ body { select.form-control { background: #fff url(/assets/client_management/arrow.png) no-repeat calc(100% - 10px) 50%; padding: 6px 35px 6px 12px; + height: 40px; } /* line 20, ../sass/default.scss */ diff --git a/app/controllers/admin/client_managements_controller.rb b/app/controllers/admin/client_managements_controller.rb index 489aec2..1ede14c 100644 --- a/app/controllers/admin/client_managements_controller.rb +++ b/app/controllers/admin/client_managements_controller.rb @@ -15,6 +15,36 @@ class Admin::ClientManagementsController < OrbitAdminController @contract = RequestContract.new 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 site_request = SiteRequest.find(params[:id]) site_request.completed = true @@ -105,6 +135,12 @@ class Admin::ClientManagementsController < OrbitAdminController redirect_to receipts_admin_client_management_path(receipt.contract_purchase.id) 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 sr = SiteRequest.find(params[:id]) sr.update_attributes(site_request_params) @@ -137,5 +173,9 @@ class Admin::ClientManagementsController < OrbitAdminController def site_request_params params.require(:site_request).permit! end + + def timeline_params + params.require(:site_timeline).permit! + end end \ No newline at end of file diff --git a/app/controllers/client_managements_controller.rb b/app/controllers/client_managements_controller.rb index 9eaafab..c4d8f79 100644 --- a/app/controllers/client_managements_controller.rb +++ b/app/controllers/client_managements_controller.rb @@ -26,6 +26,7 @@ class ClientManagementsController < CPanelController @newrequest = SiteRequest.new @user_sites = current_cpanel_user.registered_sites.collect{|rs|[rs.title, rs.id.to_s]} @user_sites << ["Create new site", "newsite"] + @user_sites << ["Upgrade from R2", "upgrade"] @optional_modules = RegisteredModule.where(:category_id.in => ["54ae569248345219fa080000","54abc1797470006ee0270000"], :approved => true) end @@ -33,6 +34,14 @@ class ClientManagementsController < CPanelController rs = SiteRequest.new(rs_params) rs.c_panel_user = current_cpanel_user 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 session[:addsitestouser] = true session[:request_uid] = rs.uid diff --git a/app/models/site_request.rb b/app/models/site_request.rb index cf04ee4..b96a13d 100644 --- a/app/models/site_request.rb +++ b/app/models/site_request.rb @@ -19,18 +19,33 @@ class SiteRequest field :sites_added, type: Array, default: [] field :completed, type: Boolean, :default => false field :type + field :site_title + field :upgrade_r2_site + field :new_site_url belongs_to :site_purchase belongs_to :request_contract belongs_to :c_panel_user + has_one :site_timeline + 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 def get_request_type case self.type + when "upgrade" + t = "Upgrade" when "newsite" t = "New Site" when "existing" diff --git a/app/models/site_timeline.rb b/app/models/site_timeline.rb new file mode 100644 index 0000000..d3795eb --- /dev/null +++ b/app/models/site_timeline.rb @@ -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 \ No newline at end of file diff --git a/app/views/admin/client_managements/_index.html.erb b/app/views/admin/client_managements/_index.html.erb index 8e1ed14..07289ff 100644 --- a/app/views/admin/client_managements/_index.html.erb +++ b/app/views/admin/client_managements/_index.html.erb @@ -5,6 +5,8 @@