diff --git a/app/controllers/cooperates_controller.rb b/app/controllers/cooperates_controller.rb
index 8a014d62..12467a36 100644
--- a/app/controllers/cooperates_controller.rb
+++ b/app/controllers/cooperates_controller.rb
@@ -23,7 +23,7 @@ class CooperatesController < ApplicationController
def find_partner
@partner = Partner.find_by_id(params[:id])
- render_404 if @partner.nil? || @partner.status == -1
+ render_404 if @partner.nil?
rescue ActiveRecord::RecordNotFound
render_404
end
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index daecbe75..8ff3e358 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -1251,6 +1251,15 @@ end
end
end
+ def delete_customers
+ if params[:customer]
+ customer = Customer.where(id: params[:customer]).first
+ @current_partner = customer.partner
+ customer.school.update_attributes(:customer_id => nil)
+ customer.destroy if customer && @current_partner
+ end
+ end
+
def all_partners
@search = params[:search]
@province = params[:province]
diff --git a/app/views/managements/_partner_customer_list.html.erb b/app/views/managements/_partner_customer_list.html.erb
new file mode 100644
index 00000000..4720fc96
--- /dev/null
+++ b/app/views/managements/_partner_customer_list.html.erb
@@ -0,0 +1,20 @@
+
+ 序号
+ 客户名称
+ +添加
+ 添加时间
+
+<% @current_partner.try(:customers).try(:each) do |customer| %>
+
+ <%= customer.school.id %>
+ <%= customer.school.name %>
+
+ 删除
+
+
+ <%= format_time customer.created_at %>
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/managements/delete_customers.js.erb b/app/views/managements/delete_customers.js.erb
new file mode 100644
index 00000000..6c72d223
--- /dev/null
+++ b/app/views/managements/delete_customers.js.erb
@@ -0,0 +1 @@
+$("#partner_customer_list").html("<%= j(render :partial => "partner_customer_list") %>")
\ No newline at end of file
diff --git a/app/views/managements/partners.html.erb b/app/views/managements/partners.html.erb
index 0f1af899..824c6093 100644
--- a/app/views/managements/partners.html.erb
+++ b/app/views/managements/partners.html.erb
@@ -33,27 +33,8 @@
-
-
- 序号
- 客户名称
- +添加
- 添加时间
-
- <% @current_partner.try(:customers).try(:each) do |customer| %>
-
- <%= customer.school.id %>
- <%= customer.school.name %>
-
- 删除
-
-
- <%= format_time customer.created_at %>
-
-
- <% end %>
-
+
+ <%= render :partial => "partner_customer_list" %>
diff --git a/config/routes.rb b/config/routes.rb
index ff0be82f..3acb9123 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -713,6 +713,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
post 'delete_subject_level'
post 'update_level_for_subject'
post :add_customers
+ delete :delete_customers
get :customers_list
end
end