Merge branch 'dev_partners' into develop

dev_local
daiao 6 years ago
commit aa13f63e90

@ -254,7 +254,10 @@ class CollegesController < ApplicationController
def manager_auth
# unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?)
unless (User.current.admin? || DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? || (User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0))
unless (User.current.admin? ||
DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present? ||
(User.current.user_extensions.try(:school_id) == @department.school_id && User.current.user_extensions.try(:identity) == 0) ||
@department.school.try(:partner_id) == User.current.partner_id)
render_403
end
end

@ -1185,6 +1185,7 @@ end
@menu_type = 6
@sub_type = 3
@partners = Partner.includes(:school).order("created_at desc")
@partners = @partners.where("concat(schools.name) like ? ", "%#{params[:search]}%") unless params[:search].blank?
@current_partner = nil
if params[:partner]
@ -1256,7 +1257,7 @@ end
customer = Customer.where(id: params[:customer]).first
@current_partner = customer.partner
customer.school.update_attributes(:customer_id => nil)
customer.destroy if customer && @current_partner
customer.destroy
end
end
@ -1293,13 +1294,14 @@ end
if school_ids.length > 0
school_ids.each do |s|
school = School.where("id = ?",s).first
if school.present?
if school.present? && school.partner_id.nil?
partner = Partner.new(name: school.name)
partner.save
school.update_attributes(:partner_id => partner.id)
end
end
end
render :json => {status: 1, message: "创建成功!"}
end

@ -57,8 +57,6 @@
<% end %>
<li><%= link_to '我的项目', user_path(User.current, :type => 'a_project') %></li>
<li><a>客户管理</a></li>
<% if User.current.department_members.count > 0 %>
<li><%= link_to '学院统计', statistics_college_path(User.current.department_members.first.try(:department)) %></li>
<% end %>

@ -61,7 +61,7 @@
s_html = s_html+ "<p class='clearfix mt5'>" +
" <span class='fl with70'>" +
" <span>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_'"+array["school"]["id"]+"'class='magic-checkbox'>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_"+array["school"]["id"]+"' class='magic-checkbox'>" +
" <label for='school_'"+array["school"]["id"]+">"+array["school"]["name"]+"</label>" +
" </span>\n" +
" </span>\n" +

@ -60,7 +60,7 @@
$.each(members,function (index,array) {
s_html = s_html+ "<p class='clearfix'>" +
" <span class='fl edu-txt-w90'>" +
" <input type='checkbox' name='partner_member[]' value='"+array["id"]+"' id='user_'"+array["id"]+"'class='magic-checkbox'>" +
" <input type='checkbox' name='partner_member[]' value='"+array["id"]+"' id='user_"+array["id"]+"' class='magic-checkbox'>" +
" <label for='user_'"+array["id"]+">"+array["real_name"]+"</label>" +
" </span>\n" +
"<span class='fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer'>"+array["identity"]+"</span>" +

@ -59,7 +59,7 @@
s_html = s_html+ "<p class='clearfix mt5'>" +
" <span class='fl with70'>" +
" <span>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_'"+array["school"]["id"]+"'class='magic-checkbox'>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_"+array["school"]["id"]+"' class='magic-checkbox'>" +
" <label for='school_'"+array["school"]["id"]+">"+array["school"]["name"]+"</label>" +
" </span>\n" +
" </span>\n" +

@ -1,7 +1,7 @@
<div class="mt20">
<div class="clearfix edu-back-white padding20-30">
<input class="fl task-form-20 task-height-30" placeholder="输入合作伙伴名称进行搜索">
<a href="javascript:void(0)" class="fl task-btn task-btn-orange ml10">搜索</a>
<input class="fl task-form-20 task-height-30" placeholder="输入合作伙伴名称进行搜索" id="partner_search">
<a href="javascript:void(0)" class="fl task-btn task-btn-orange ml10" onclick="submit_search_partner()">搜索</a>
<a href="javascript:void(0)" class="fl task-btn ml10">清除</a>
</div>
<div class="clearfix mt20">
@ -50,4 +50,8 @@
$(this).addClass("active");
})
})
function submit_search_partner(){
$.get("/managements/partners?search="+$("#partner_search").val());
}
</script>
Loading…
Cancel
Save