diff --git a/app/assets/stylesheets/client_management/dashboard.scss b/app/assets/stylesheets/client_management/dashboard.scss index 1e5f206..13d42ef 100644 --- a/app/assets/stylesheets/client_management/dashboard.scss +++ b/app/assets/stylesheets/client_management/dashboard.scss @@ -1,10 +1,23 @@ .dashboard-wrapper { margin: 25px; + .left-side{ + display: inline-block; + width: 65%; + } + .right-side{ + display: inline-block; + width: 32%; + margin-left: 30px; + position: sticky; + position: -webkit-sticky; + vertical-align: top; + top: 100px; + } #url-box { border: 1px solid #ddd; background: #fff; - width: 950px; height: 45px; + width: auto; padding:20px 50px 0 50px; .site-title{ color: #337ab7; @@ -54,8 +67,213 @@ margin-top: 30px; border: 1px solid #ddd; background: #fff; - width: 950px; + // width: calc(100% + 50px); + width: auto; min-height: 545px; - padding:20px 50px 0 50px; + padding:20px 25px 0 25px; + .conversations{ + margin: 15px; + height: 70%; + width: 100%; + h3{ + text-align: center; + color: #8a8a8a; + font-style: italic; + } + .conversation{ + margin-bottom: 25px; + .avatar{ + height: 50px; + width: 50px; + margin-right: 15px; + display: inline-block; + vertical-align: top; + .avatar-name{ + text-align: center; + font-style: italic; + line-height: 14px; + } + .avatar-pic{ + border-radius: 50px; + height: 50px; + width: 50px; + } + } + .message{ + display: inline-block; + background-color: #e7ffc6; + border-radius: 20px; + padding: 20px; + width: calc(100% - 120px); + .date{ + position: relative; + float: right; + vertical-align: top; + margin-right: 20px; + color: #838383; + font-style: italic; + .tagged-user{ + text-align: right; + a{ + text-decoration: none; + .tag-avatar-pic{ + border-radius: 25px; + width: 20px; + height: 20px; + } + } + } + } + .content{ + min-height: 50px; + font-size: 14px; + } + } + &.my{ + .avatar{ + margin-left: 15px; + margin-right: 0px; + } + .message { + text-align: right; + background-color: #ceecff; + .date { + float: left; + margin-left: 20px; + margin-right: 0px; + .tagged-user{ + text-align: left; + } + } + } + } + } + } + .editor-wrapper{ + margin-top: 35px; + padding-top: 20px; + border-top: 1px solid #cecece; + #post-loader{ + text-align: center; + } + .ticket-internal-response-wrap{ + margin-top: 20px; + .ticket-internal-response{ + display: inline-block; + vertical-align: top; + margin: 0∂ 5px 10px 0; + height: 44px; + line-height: 44px; + background: #888888; + color: white; + padding: 0 0.625rem; + font-family: "Roboto", sans-serif; + font-size: 14px; + border-radius: 0.125rem; + } + .ticket-tag-member{ + margin-left: 35px; + display: inline-block; + .select2-container{ + height: 44px; + min-width: 200px; + li.select2-search-choice{ + // height: 40px; + div{ + line-height: 30px; + font-size: 14px; + } + } + } + } + .submit-form-btn{ + display: inline-block; + width: 100%; + input{ + float: right; + } + } + } + } + } +} +#progress-tracker{ + background-color: #fff; + height: 600px; + border: 1px solid #ddd; + h3{ + text-align: center; + color: #8a8a8a; + border-bottom: 1px solid #ddd; + margin: 0 15px; + padding: 10px 0; + } + .departments{ + margin: 15px; + .department{ + margin: 15px 0; + h4{ + font-size: 18px; + } + ul{ + list-style: none; + input{ + display: inline-block; + margin-top: 0; + // vertical-align: top; + } + label{ + font-size: 16px; + display: inline-block; + margin-left: 10px; + } + .strikethrough{ + text-decoration: line-through; + } + span.time{ + margin-left: 20px; + font-size: 16px; + font-style: italic; + &.deadline{ + color: red; + } + &.completed{ + color: green; + } + } + } + } + } +} +.select2-result{ + img { + width: 50px; + } +} +#timeline-box{ + border: 1px solid #ddd; + background: #fff; + width: auto; + min-height: 350px; + padding: 10px 50px 0 50px; + margin-top: 20px; + transition: 0.3s; + &.collapsed{ + min-height: 45px !important; + h3.sub-title{ + border-bottom: none; + } + } + h3.sub-title{ + color: #337ab7; + font-size: 18px; + border-bottom: 1px solid #ddd; + a{ + text-decoration: none; + outline: none; + } + } + #timeline-chart{ + transition: 0.3s; } } \ No newline at end of file diff --git a/app/controllers/admin/client_managements_controller.rb b/app/controllers/admin/client_managements_controller.rb index 1ede14c..ae9791e 100644 --- a/app/controllers/admin/client_managements_controller.rb +++ b/app/controllers/admin/client_managements_controller.rb @@ -43,6 +43,30 @@ class Admin::ClientManagementsController < OrbitAdminController def project_dashboard @site_request = SiteRequest.find(params[:id]) + @members = [] + @project_post = ProjectPost.new + MemberProfile.all.each do |mp| + user = mp.user rescue nil + if !user.nil? && user.id.to_s != current_user.id.to_s + avatar = (mp.avatar.thumb.url == "thumb_person.png" ? "/assets/thumb_person.png" : mp.avatar.thumb.url rescue "/assets/thumb_person.png") + @members << { + "id" => user.id.to_s, + "user_name" => (user.user_name rescue ""), + "avatar" => avatar, + "name" => (mp.name_translations rescue {"en" => "","zh_tw" => ""}) + } + end + end + @timeline = [] + timeline = @site_request.site_timeline + @timeline << [{"test_site_creation_start" => timeline.test_site_creation_start.strftime("%Y-%m-%d"), "test_site_creation_end" => timeline.test_site_creation_end.strftime("%Y-%m-%d")}] if !timeline.test_site_creation_start.nil? + @timeline << [{"template_design_images_start" => timeline.template_design_images_start.strftime("%Y-%m-%d"), "template_design_images_end" => timeline.template_design_images_end.strftime("%Y-%m-%d")}] if !timeline.template_design_images_start.nil? + @timeline << [{"template_html_css_start" => timeline.template_html_css_start.strftime("%Y-%m-%d"), "template_html_css_end" => timeline.template_html_css_end.strftime("%Y-%m-%d")}] if !timeline.template_html_css_start.nil? + @timeline << [{"customized_module_start" => timeline.customized_module_start.strftime("%Y-%m-%d"), "customized_module_end" => timeline.customized_module_end.strftime("%Y-%m-%d")}] if !timeline.customized_module_start.nil? + @timeline << [{"data_migration_start" => timeline.data_migration_start.strftime("%Y-%m-%d"), "data_migration_end" => timeline.data_migration_end.strftime("%Y-%m-%d")}] if !timeline.data_migration_start.nil? + @timeline << [{"site_structure_start" => timeline.site_structure_start.strftime("%Y-%m-%d"), "site_structure_end" => timeline.site_structure_end.strftime("%Y-%m-%d")}] if !timeline.site_structure_start.nil? + @timeline << [{"site_migration_start" => timeline.site_migration_start.strftime("%Y-%m-%d"), "site_migration_end" => timeline.site_migration_end.strftime("%Y-%m-%d")}] if !timeline.site_migration_start.nil? + end def complete_request @@ -160,8 +184,105 @@ class Admin::ClientManagementsController < OrbitAdminController @contracts = RequestContract.all.order_by(:created_at => "desc", :confirmed => 'desc').page(params[:page]).per(10) end + def create_project_post + ppost = ProjectPost.new(project_post_params) + ppost.save + render :partial => "conversation", :object => ppost + end + + def timeline_update + timeline = SiteTimeline.find(params[:id]) + if params[:checked] == "true" + case params[:field] + when "test_site_creation" + timeline.test_site_creation_completed = Time.now + timeline.test_site_creation_by = current_user.id.to_s + time = timeline.test_site_creation_completed.strftime("%Y/%m/%d") + when "template_design_images" + timeline.template_design_images_completed = Time.now + timeline.template_design_images_by = current_user.id.to_s + time = timeline.template_design_images_completed.strftime("%Y/%m/%d") + when "template_html_css" + timeline.template_html_css_completed = Time.now + timeline.template_html_css_by = current_user.id.to_s + time = timeline.template_html_css_completed.strftime("%Y/%m/%d") + when "customized_module" + timeline.customized_module_completed = Time.now + timeline.customized_module_by = current_user.id.to_s + time = timeline.customized_module_completed.strftime("%Y/%m/%d") + when "data_migration" + timeline.data_migration_completed = Time.now + timeline.data_migration_by = current_user.id.to_s + time = timeline.data_migration_completed.strftime("%Y/%m/%d") + when "site_structure" + timeline.site_structure_completed = Time.now + timeline.site_structure_by = current_user.id.to_s + time = timeline.site_structure_completed.strftime("%Y/%m/%d") + when "site_migration" + timeline.site_migration_completed = Time.now + timeline.site_migration_by = current_user.id.to_s + time = timeline.site_migration_completed.strftime("%Y/%m/%d") + when "psd_approval" + timeline.psd_approval_completed = Time.now + time = timeline.psd_approval_completed.strftime("%Y/%m/%d") + when "cutomer_approval" + timeline.cutomer_approval_completed = Time.now + time = timeline.cutomer_approval_completed.strftime("%Y/%m/%d") + when "module_approval" + timeline.module_approval_completed = Time.now + time = timeline.module_approval_completed.strftime("%Y/%m/%d") + end + else + case params[:field] + when "test_site_creation" + timeline.test_site_creation_completed = nil + timeline.test_site_creation_by = nil + time = timeline.test_site_creation_end.strftime("%Y/%m/%d") + when "template_design_images" + timeline.template_design_images_completed = nil + timeline.template_design_images_by = nil + time = timeline.template_design_images_end.strftime("%Y/%m/%d") + when "template_html_css" + timeline.template_html_css_completed = nil + timeline.template_html_css_by = nil + time = timeline.template_html_css_end.strftime("%Y/%m/%d") + when "customized_module" + timeline.customized_module_completed = nil + timeline.customized_module_by = nil + time = timeline.customized_module_end.strftime("%Y/%m/%d") + when "data_migration" + timeline.data_migration_completed = nil + timeline.data_migration_by = nil + time = timeline.data_migration_end.strftime("%Y/%m/%d") + when "site_structure" + timeline.site_structure_completed = nil + timeline.site_structure_by = nil + time = timeline.site_structure_end.strftime("%Y/%m/%d") + when "site_migration" + timeline.site_migration_completed = nil + timeline.site_migration_by = nil + time = timeline.site_migration_end.strftime("%Y/%m/%d") + when "psd_approval" + timeline.psd_approval_completed = nil + time = "" + when "cutomer_approval" + timeline.cutomer_approval_completed = nil + time = "" + when "module_approval" + timeline.module_approval_completed = nil + time = "" + end + end + timeline.save + render :json => {"success" => true, "time" => time, "name" => current_user.name}.to_json + end + private + def project_post_params + params.require(:project_post).permit! + end + def receipt_params params.require(:purchase_receipt).permit! end diff --git a/app/models/project_post.rb b/app/models/project_post.rb new file mode 100644 index 0000000..9372c83 --- /dev/null +++ b/app/models/project_post.rb @@ -0,0 +1,23 @@ +class ProjectPost + include Mongoid::Document + include Mongoid::Timestamps + + field :content + field :user_id + field :user_tags, type: Array, :default => [] + field :internal_response, type: Boolean, :default => true + + belongs_to :site_request + + def my_post?(userid) + self.user_id == userid + end + + def get_user + User.find(self.user_id) rescue nil + end + + def tagged_users + User.find(self.user_tags) rescue [] + end +end \ No newline at end of file diff --git a/app/models/site_request.rb b/app/models/site_request.rb index b96a13d..e02d085 100644 --- a/app/models/site_request.rb +++ b/app/models/site_request.rb @@ -29,6 +29,7 @@ class SiteRequest belongs_to :c_panel_user has_one :site_timeline + has_many :project_posts def get_site self.site_id == "newsite" || self.site_id == "upgrade" ? nil : (RegisteredSite.find(self.site_id) rescue nil) diff --git a/app/models/site_timeline.rb b/app/models/site_timeline.rb index d3795eb..fd980c0 100644 --- a/app/models/site_timeline.rb +++ b/app/models/site_timeline.rb @@ -37,5 +37,9 @@ class SiteTimeline field :site_migration_by field :site_migration_completed, type: DateTime + field :psd_approval_completed, type: DateTime + field :cutomer_approval_completed, type: DateTime + field :module_approval_completed, type: DateTime + belongs_to :site_request end \ No newline at end of file diff --git a/app/views/admin/client_managements/_conversation.html.erb b/app/views/admin/client_managements/_conversation.html.erb new file mode 100644 index 0000000..fd599e8 --- /dev/null +++ b/app/views/admin/client_managements/_conversation.html.erb @@ -0,0 +1,36 @@ +<% + conv_user = conversation.get_user + is_my_post = conversation.my_post?(current_user.id.to_s) + tagged_users = conversation.tagged_users +%> +
"> + <% if !is_my_post %> +
+ "> +
<%= conv_user.name rescue "" %>
+
+ <% end %> +
+
+
<%= conversation.created_at.strftime("%d %b %Y %H:%M")%>
+ <% if !tagged_users.empty? %> +
+ <% tagged_users.each do |user| %> + "> + "> + + <% end %> +
+ <% end %> +
+
+ <%= conversation.content.html_safe %> +
+
+ <% if is_my_post %> +
+ "> +
<%= conv_user.name rescue "" %>
+
+ <% end %> +
\ No newline at end of file diff --git a/app/views/admin/client_managements/_progress_tracker.html.erb b/app/views/admin/client_managements/_progress_tracker.html.erb new file mode 100644 index 0000000..671469d --- /dev/null +++ b/app/views/admin/client_managements/_progress_tracker.html.erb @@ -0,0 +1,125 @@ +
+

Progress Tracker

+
+
+

Server

+
    +
  • + <% if @site_request.site_timeline.test_site_creation_completed == nil %> + + <%= @site_request.site_timeline.test_site_creation_end.strftime("%Y/%m/%d") %> + <% else %> + + <%= @site_request.site_timeline.test_site_creation_completed.strftime("%Y/%m/%d") %> by <%= User.find(@site_request.site_timeline.test_site_creation_by).name rescue "" %> + <% end %> +
  • + <% if @site_request.type == "upgrade" %> +
  • + <% if @site_request.site_timeline.data_migration_completed == nil %> + + <%= @site_request.site_timeline.data_migration_end.strftime("%Y/%m/%d") %> + <% else %> + + <%= @site_request.site_timeline.data_migration_completed.strftime("%Y/%m/%d") %> by <%= User.find(@site_request.site_timeline.data_migration_by).name rescue "" %> + <% end %> +
  • + <% end %> + <% if !@site_request.host_with_rulingdigital %> +
  • + <% if @site_request.site_timeline.site_migration_completed == nil %> + + <%= @site_request.site_timeline.site_migration_end.strftime("%Y/%m/%d") %> + <% else %> + + <%= @site_request.site_timeline.site_migration_completed.strftime("%Y/%m/%d") %> by <%= User.find(@site_request.site_timeline.site_migration_by).name rescue "" %> + <% end %> +
  • + <% else %> +
  • + <% if @site_request.site_timeline.site_migration_completed == nil %> + + <%= @site_request.site_timeline.site_migration_end.strftime("%Y/%m/%d") %> + <% else %> + + <%= @site_request.site_timeline.site_migration_completed.strftime("%Y/%m/%d") %> by <%= User.find(@site_request.site_timeline.site_migration_by).name rescue "" %> + <% end %> +
  • + <% end %> +
+
+
+

Design

+
    +
  • + <% if @site_request.site_timeline.psd_approval_completed == nil %> + + <%= @site_request.site_timeline.template_design_images_end.strftime("%Y/%m/%d") %> + <% else %> + + <%= @site_request.site_timeline.template_design_images_completed.strftime("%Y/%m/%d") %> by <%= User.find(@site_request.site_timeline.template_design_images_by).name rescue "" %> + <% end %> +
  • +
  • + <% if @site_request.site_timeline.psd_approval_completed == nil %> + + <% else %> + <%= @site_request.site_timeline.psd_approval_completed.strftime("%Y/%m/%d") %> + <% end %> +
  • +
  • + <% if @site_request.site_timeline.template_html_css_completed == nil %> + + <%= @site_request.site_timeline.template_html_css_end.strftime("%Y/%m/%d") %> + <% else %> + + <%= @site_request.site_timeline.template_html_css_completed.strftime("%Y/%m/%d") %> by <%= User.find(@site_request.site_timeline.template_html_css_by).name rescue "" %> + <% end %> +
  • +
+
+ <% if @site_request.custom_module %> +
+

R&D

+
    +
  • + <% if @site_request.site_timeline.customized_module_completed == nil %> + + <%= @site_request.site_timeline.customized_module_end.strftime("%Y/%m/%d") %> + <% else %> + + <%= @site_request.site_timeline.customized_module_completed.strftime("%Y/%m/%d") %> by <%= User.find(@site_request.site_timeline.customized_module_by).name rescue "" %> + <% end %> +
  • +
  • + <% if @site_request.site_timeline.module_approval_completed == nil %> + + <% else %> + <%= @site_request.site_timeline.module_approval_completed.strftime("%Y/%m/%d") %> + <% end %> +
  • +
+
+ <% end %> +
+

Customer Service

+
    +
  • + <% if @site_request.site_timeline.site_structure_completed == nil %> + + <%= @site_request.site_timeline.site_structure_end.strftime("%Y/%m/%d") %> + <% else %> + + <%= @site_request.site_timeline.site_structure_completed.strftime("%Y/%m/%d") %> by <%= User.find(@site_request.site_timeline.site_structure_by).name rescue "" %> + <% end %> +
  • +
  • + <% if @site_request.site_timeline.cutomer_approval_completed == nil %> + + <% else %> + <%= @site_request.site_timeline.cutomer_approval_completed.strftime("%Y/%m/%d") %> + <% end %> +
  • +
+
+
+
\ No newline at end of file diff --git a/app/views/admin/client_managements/_timeline_box.html.erb b/app/views/admin/client_managements/_timeline_box.html.erb new file mode 100644 index 0000000..7e444d8 --- /dev/null +++ b/app/views/admin/client_managements/_timeline_box.html.erb @@ -0,0 +1,7 @@ +

+ Timeline + +

+
+ +
\ No newline at end of file diff --git a/app/views/admin/client_managements/project_dashboard.html.erb b/app/views/admin/client_managements/project_dashboard.html.erb index 0d66cc7..aeecbb8 100644 --- a/app/views/admin/client_managements/project_dashboard.html.erb +++ b/app/views/admin/client_managements/project_dashboard.html.erb @@ -1,6 +1,15 @@ +<%= csrf_meta_tag %> <% content_for :page_specific_css do %> <%= stylesheet_link_tag "client_management/dashboard" %> + <%= stylesheet_link_tag "select2/select2" %> <% end %> +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/jquery.form.js" %> + <%= javascript_include_tag "validator" %> + <%= javascript_include_tag "select2/select2.min" %> + <%= javascript_include_tag "jquery.viewport" %> +<% end %> +
@@ -29,13 +38,60 @@ <% end %>
-
- + +
+
+ <% if @site_request.project_posts.count > 0 %> + <%= render :partial => "conversation", :collection => @site_request.project_posts.asc(:created_at) %> + <% else %> +

No posts found

+ <% end %> +
+
+ + <%= form_for @project_post, :url => {:action => "create_project_post"}, :html => {:id => "dashboard-post"} do |f| %> + +
+
+ <%= f.check_box :internal_response %> + <%= f.hidden_field :site_request_id , :value => @site_request.id.to_s %> + <%= f.hidden_field :user_id , :value => current_user.id.to_s %> + Internal Response +
+
+ + +
+
+ +
+
+ <% end %> +
+
+
+
+ <%= render :partial => "progress_tracker" %>
diff --git a/config/routes.rb b/config/routes.rb index db58437..de5d391 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -28,6 +28,8 @@ Rails.application.routes.draw do patch "update_receipt" get "project_dashboard" patch "update_site_request" + post "create_project_post" + post "timeline_update" end collection do get "completed_requests"