From 05cd6b874beb60e1957804d0d2c63295bff3d42c Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 8 May 2019 10:40:10 +0800 Subject: [PATCH] reject trial authorization modal feature --- app/controllers/managements_controller.rb | 5 +- app/helpers/managements_helper.rb | 4 +- app/models/apply_action.rb | 2 +- .../_reject_authorization_model.html.erb | 95 +++++++++++++++++++ .../_trial_authorization_list.html.erb | 22 ++--- .../_trial_authorization_list_model.html.erb | 69 -------------- .../_trial_authorization_passed_list.html.erb | 35 +++---- .../managements/trial_authorization.html.erb | 31 ------ .../managements/trial_authorization.js.erb | 2 + ...add_reject_description_to_apply_actions.rb | 5 + 10 files changed, 132 insertions(+), 138 deletions(-) create mode 100644 app/views/managements/_reject_authorization_model.html.erb delete mode 100644 app/views/managements/_trial_authorization_list_model.html.erb create mode 100644 db/migrate/20190507090731_add_reject_description_to_apply_actions.rb diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 8abb6c2b..5d245f6c 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -3476,7 +3476,7 @@ end type = params[:type] search = params[:search] if type == "0" - authentication_user = AuthenticationsUsers.where(:user_id => apply_action.user_id).first + authentication_user = AuthenticationsUsers.where(user_id => apply_action.user_id).first if authentication_user.blank? AuthenticationsUsers.create(:user_id => apply_action.user_id, :authentication_id => 1) end @@ -3507,7 +3507,8 @@ end Tiding.create(:user_id => apply_action.user_id, :trigger_user_id => 0, :container_id => apply_action.id, :container_type => 'ApplyAction', :parent_container_id => apply_action.container_id, :parent_container_type => apply_action.container_type, :belong_container_id => apply_action.container_id, :belong_container_type => "User", :tiding_type => "System", :status => type == "0" ? 1 : 2) - apply_action.update_attributes(:status => (params[:type] == "1" ? 2 : 1), :reason => params[:reject_reason], :dealer_id => User.current.id, :noticed => false) + reject_reason = Array(params[:reasons]).join(';') + apply_action.update_attributes(status: (params[:type] == "1" ? 2 : 1), reason: reject_reason, reject_description: params[:reject_description], dealer_id: User.current.id, noticed: false) User.where(:id => apply_action.user_id).first.update_attributes(:certification => (params[:type] == "1" ? 2 : 1)) user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") diff --git a/app/helpers/managements_helper.rb b/app/helpers/managements_helper.rb index 18672057..0fb97d1e 100644 --- a/app/helpers/managements_helper.rb +++ b/app/helpers/managements_helper.rb @@ -4,7 +4,7 @@ module ManagementsHelper def user_phone_addr phone addr = "--" unless phone.nil? - result = MobInfo.lookup(phone[0,7]) + result = nil # MobInfo.lookup(phone[0,7]) if result.present? addr = "#{result[:province]}-#{result[:city]}" end @@ -15,7 +15,7 @@ module ManagementsHelper def user_ip_addr ip addr = "--" unless ip.nil? - result = SM.find_by_ip(ip) + result = nil # SM.find_by_ip(ip) if result.present? addr = "#{result[:province]}-#{result[:city]}" end diff --git a/app/models/apply_action.rb b/app/models/apply_action.rb index f1cff688..ac6e306d 100644 --- a/app/models/apply_action.rb +++ b/app/models/apply_action.rb @@ -1,7 +1,7 @@ # status:0 审核中 1 同意 2 拒绝 3 撤销 class ApplyAction < ActiveRecord::Base default_scope :order => 'updated_at desc' - attr_accessible :container_id, :container_type, :dealer_id, :reason, :user_id, :status, :apply_reason, :noticed, :ip_addr + attr_accessible :container_id, :container_type, :dealer_id, :reason, :user_id, :status, :apply_reason, :noticed, :ip_addr, :reject_description belongs_to :user has_many :tidings, :as => :container, :dependent => :destroy after_create :send_tiding diff --git a/app/views/managements/_reject_authorization_model.html.erb b/app/views/managements/_reject_authorization_model.html.erb new file mode 100644 index 00000000..3aaf2c6c --- /dev/null +++ b/app/views/managements/_reject_authorization_model.html.erb @@ -0,0 +1,95 @@ + + diff --git a/app/views/managements/_trial_authorization_list.html.erb b/app/views/managements/_trial_authorization_list.html.erb index e3b6a57d..0e44ecfd 100644 --- a/app/views/managements/_trial_authorization_list.html.erb +++ b/app/views/managements/_trial_authorization_list.html.erb @@ -10,7 +10,7 @@
  • <%= user.try(:show_real_name) %> <%= time_from_now(authorization.updated_at) %> - 拒绝 + 拒绝 同意
  • @@ -34,16 +34,6 @@
  • 申请理由:<%= authorization.apply_reason %>
  • -
    -
  • - - -
  • -
  • - 确定 - 取消 -
  • -
    @@ -60,7 +50,17 @@ <%= render :partial => "welcome/no_data" %> <% end %> +<%= render(partial: 'managements/reject_authorization_model', locals: { path: trial_authorization_operation_managements_path, title: '拒绝授权', reject_type: '' }) %> + diff --git a/app/views/managements/_trial_authorization_passed_list.html.erb b/app/views/managements/_trial_authorization_passed_list.html.erb index bbba930b..6f31ffc6 100644 --- a/app/views/managements/_trial_authorization_passed_list.html.erb +++ b/app/views/managements/_trial_authorization_passed_list.html.erb @@ -12,7 +12,7 @@ <%= time_from_now(authorization.updated_at) %> <%= authorization.status == 1 ? "已同意" : "已拒绝" %> <% if authorization.status == 1 %> - 撤销授权 + 撤销授权 <% end %>
  • @@ -37,19 +37,9 @@ 申请理由:<%= authorization.apply_reason %>
  • <% if authorization.status == 2 %> -
  • 撤销原因:<%= authorization.reason.blank? ? "空" : authorization.reason %>
  • -
  • 备注说明:<%= authorization.reason.blank? ? "空" : authorization.reason %>
  • +
  • 原因:<%= authorization.reason.blank? ? "空" : authorization.reason %>
  • +
  • 备注说明:<%= authorization.reject_description.blank? ? "空" : authorization.reject_description %>
  • <% end %> -
    -
  • - - -
  • -
  • - 确定 - 取消 -
  • -
    @@ -65,14 +55,15 @@ <% else %> <%= render :partial => "welcome/no_data" %> <% end %> + +<%= render(partial: 'managements/reject_authorization_model', locals: { path: trial_authorization_operation_managements_path, title: '撤销授权', reject_type: 'revocation' }) %> + \ No newline at end of file diff --git a/app/views/managements/trial_authorization.html.erb b/app/views/managements/trial_authorization.html.erb index acdc4d69..ce68834b 100644 --- a/app/views/managements/trial_authorization.html.erb +++ b/app/views/managements/trial_authorization.html.erb @@ -61,37 +61,6 @@