Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
262cafb327
@ -0,0 +1,74 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-salesman-channels-index-page').length > 0) {
|
||||
|
||||
// ============= 添加销售人员 ==============
|
||||
var $addMemberModal = $('.admin-add-salesman-channel-user-modal');
|
||||
var $addMemberForm = $addMemberModal.find('.admin-add-salesman-channel-user-form');
|
||||
var $memberSelect = $addMemberModal.find('.salesman-channel-user-select');
|
||||
var $salesmanIdInput = $('.salesman-channel-list-form').find(".btn-primary");
|
||||
|
||||
$addMemberModal.on('show.bs.modal', function(event){
|
||||
var $link = $(event.relatedTarget);
|
||||
// var salesmanId = $link.data('salesman_id');
|
||||
// $salesmanIdInput.val(salesmanId);
|
||||
|
||||
$memberSelect.select2('val', ' ');
|
||||
});
|
||||
|
||||
$memberSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请输入要添加的单位',
|
||||
multiple: true,
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/admins/schools',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { keyword: params.term };
|
||||
},
|
||||
processResults: function(data){
|
||||
return { results: data.schools }
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return '';
|
||||
return $("<span>" + item.name + "</span>");
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
return item.name || '';
|
||||
}
|
||||
});
|
||||
|
||||
$addMemberModal.on('click', '.submit-btn', function(){
|
||||
$addMemberForm.find('.error').html('');
|
||||
|
||||
// var salesmanId = $salesmanIdInput.val();
|
||||
var memberIds = $memberSelect.val();
|
||||
if (memberIds && memberIds.length > 0) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/admins/salesman_channels/batch_add',
|
||||
data: { salesman_id: $salesmanIdInput.data("salesman-id"), school_ids: memberIds },
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$addMemberModal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$addMemberModal.modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,74 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-salesman-customers-index-page').length > 0) {
|
||||
|
||||
// ============= 添加销售人员 ==============
|
||||
var $addMemberModal = $('.admin-add-salesman-customer-user-modal');
|
||||
var $addMemberForm = $addMemberModal.find('.admin-add-salesman-customer-user-form');
|
||||
var $memberSelect = $addMemberModal.find('.salesman-customer-user-select');
|
||||
var $salesmanIdInput = $('.salesman-customer-list-form').find(".btn-primary");
|
||||
|
||||
$addMemberModal.on('show.bs.modal', function(event){
|
||||
var $link = $(event.relatedTarget);
|
||||
// var salesmanId = $link.data('salesman_id');
|
||||
// $salesmanIdInput.val(salesmanId);
|
||||
|
||||
$memberSelect.select2('val', ' ');
|
||||
});
|
||||
|
||||
$memberSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请输入要添加的销售姓名',
|
||||
multiple: true,
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/admins/users',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { name: params.term };
|
||||
},
|
||||
processResults: function(data){
|
||||
return { results: data.users }
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return $("<span>" + item.real_name + " <span class='font-12'>" + item.school_name + ' ' + item.hidden_phone + "</span></span>");
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
return item.real_name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
$addMemberModal.on('click', '.submit-btn', function(){
|
||||
$addMemberForm.find('.error').html('');
|
||||
|
||||
// var salesmanId = $salesmanIdInput.val();
|
||||
var memberIds = $memberSelect.val();
|
||||
if (memberIds && memberIds.length > 0) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/admins/salesman_customers/batch_add',
|
||||
data: { salesman_id: $salesmanIdInput.data("salesman-id"), user_ids: memberIds },
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$addMemberModal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$addMemberModal.modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,99 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-salesmans-index-page').length > 0) {
|
||||
|
||||
// ============= 添加销售人员 ==============
|
||||
var $addMemberModal = $('.admin-add-salesman-user-modal');
|
||||
var $addMemberForm = $addMemberModal.find('.admin-add-salesman-user-form');
|
||||
var $memberSelect = $addMemberModal.find('.salesman-user-select');
|
||||
// var $salesmanIdInput = $addMemberForm.find('input[name="salesman_id"]')
|
||||
|
||||
$addMemberModal.on('show.bs.modal', function(event){
|
||||
var $link = $(event.relatedTarget);
|
||||
// var salesmanId = $link.data('salesman-id');
|
||||
// $salesmanIdInput.val(salesmanId);
|
||||
|
||||
$memberSelect.select2('val', ' ');
|
||||
});
|
||||
|
||||
$memberSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请输入要添加的销售姓名',
|
||||
multiple: true,
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/admins/users',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { name: params.term };
|
||||
},
|
||||
processResults: function(data){
|
||||
return { results: data.users }
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return $("<span>" + item.real_name + " <span class='font-12'>" + item.school_name + ' ' + item.hidden_phone + "</span></span>");
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
return item.real_name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
$addMemberModal.on('click', '.submit-btn', function(){
|
||||
$addMemberForm.find('.error').html('');
|
||||
|
||||
// var salesmanId = $salesmanIdInput.val();
|
||||
var memberIds = $memberSelect.val();
|
||||
if (memberIds && memberIds.length > 0) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/admins/salesmans/batch_add',
|
||||
data: { user_ids: memberIds },
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$addMemberModal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$addMemberModal.modal('hide');
|
||||
}
|
||||
});
|
||||
|
||||
$(".salesman-list-container").on("change", '.salesman-sync-course', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var json = {};
|
||||
$.ajax({
|
||||
url: "/admins/salesmans/" + s_id + "/update_sync_course",
|
||||
type: "POST",
|
||||
dataType:'script',
|
||||
data: json
|
||||
})
|
||||
});
|
||||
|
||||
$(".salesman-list-container").on("change", '.salesman-sync-form', function () {
|
||||
var s_id = $(this).attr("data-id");
|
||||
var s_value = $(this).val();
|
||||
var s_name = $(this).attr("name");
|
||||
var json = {};
|
||||
json[s_name] = s_value;
|
||||
$.ajax({
|
||||
url: "/admins/salesmans/" + s_id,
|
||||
type: "PUT",
|
||||
dataType:'script',
|
||||
data: json
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,28 @@
|
||||
class Admins::SalesmanChannelsController < Admins::BaseController
|
||||
before_action :set_salesman
|
||||
|
||||
def index
|
||||
@channels = SalesmanChannel.all
|
||||
end
|
||||
|
||||
def batch_add
|
||||
channel_ids = @salesman.salesman_channels.pluck(:school_id)
|
||||
school_ids = params[:school_ids] - channel_ids
|
||||
school_ids.each do |school_id|
|
||||
school = School.find_by(id: school_id)
|
||||
next if school.blank?
|
||||
@salesman.salesman_channels.create!(school_id: school.id)
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
@salesman.salesman_channels.find_by!(id: params[:id]).destroy
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_salesman
|
||||
@salesman = Salesman.find params[:salesman_id]
|
||||
end
|
||||
end
|
@ -0,0 +1,28 @@
|
||||
class Admins::SalesmanCustomersController < Admins::BaseController
|
||||
before_action :set_salesman
|
||||
|
||||
def index
|
||||
@customers = @salesman.salesman_customers.includes(:user, :school)
|
||||
end
|
||||
|
||||
def batch_add
|
||||
customer_ids = @salesman.salesman_customers.pluck(:user_id)
|
||||
user_ids = params[:user_ids] - customer_ids
|
||||
user_ids.each do |user_id|
|
||||
user = UserExtension.find_by(user_id: user_id)
|
||||
next if user.blank?
|
||||
@salesman.salesman_customers.create!(user_id: user.user_id, school_id: user.school_id)
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
@salesman.salesman_customers.find_by!(id: params[:id]).destroy
|
||||
end
|
||||
|
||||
private
|
||||
def set_salesman
|
||||
@salesman = Salesman.find params[:salesman_id]
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,29 @@
|
||||
class Admins::SalesmansController < Admins::BaseController
|
||||
before_action :set_salesman, except: [:index, :batch_add]
|
||||
|
||||
def index
|
||||
@salesmans = Salesman.all
|
||||
end
|
||||
|
||||
def destroy
|
||||
@salesman.destroy!
|
||||
end
|
||||
|
||||
# 批量增加销售人员
|
||||
def batch_add
|
||||
salesman_user_ids = Salesman.where(id: params[:user_ids]).pluck(:user_id)
|
||||
user_ids = params[:user_ids] - salesman_user_ids
|
||||
user_ids.each do |user_id|
|
||||
user = User.find_by(id: user_id)
|
||||
next if user.blank?
|
||||
Salesman.create!(user_id: user.id, name: user.real_name)
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
def set_salesman
|
||||
@salesman = Salesman.find params[:id]
|
||||
end
|
||||
|
||||
end
|
@ -1,11 +1,22 @@
|
||||
module Admins::SubjectsHelper
|
||||
def display_subject_status(subject)
|
||||
style =
|
||||
case subject.status
|
||||
case subject.public
|
||||
when 0 then 'text-secondary'
|
||||
when 1 then 'text-warning'
|
||||
when 2 then 'text-success'
|
||||
end
|
||||
raw content_tag(:span, t("subject.status.#{subject.status}"), class: style)
|
||||
|
||||
status =
|
||||
if subject.public == 2
|
||||
"publiced"
|
||||
elsif subject.public == 1
|
||||
"pending"
|
||||
elsif subject.status == 2
|
||||
"processed"
|
||||
else
|
||||
"editing"
|
||||
end
|
||||
raw content_tag(:span, t("subject.public.#{status}"), class: style)
|
||||
end
|
||||
end
|
@ -1,3 +1,4 @@
|
||||
class ItemAnalysis < ApplicationRecord
|
||||
belongs_to :item_bank, touch: true
|
||||
validates :analysis, length: { maximum: 5000, too_long: "不能超过5000个字符" }
|
||||
end
|
||||
|
@ -0,0 +1,7 @@
|
||||
class Salesman < ApplicationRecord
|
||||
belongs_to :user
|
||||
# 渠道
|
||||
has_many :salesman_channels, dependent: :destroy
|
||||
# 客户
|
||||
has_many :salesman_customers, dependent: :destroy
|
||||
end
|
@ -0,0 +1,27 @@
|
||||
class SalesmanChannel < ApplicationRecord
|
||||
belongs_to :salesman, :touch => true, counter_cache: true
|
||||
belongs_to :school
|
||||
|
||||
def school_name
|
||||
school.name
|
||||
end
|
||||
|
||||
def teacher_count
|
||||
UserExtension.where(school_id: school_id).where.not(identity: 1).count
|
||||
end
|
||||
|
||||
def student_count
|
||||
UserExtension.where(school_id: school_id, identity: 1).count
|
||||
end
|
||||
|
||||
def course_count
|
||||
Course.where(school_id: school_id).count
|
||||
end
|
||||
|
||||
def shixuns_count
|
||||
ShixunMember.joins("join user_extensions on user_extensions.user_id = shixun_members.user_id")
|
||||
.where(user_extensions: {school_id: school_id}).pluck(:shixun_id).uniq.count
|
||||
end
|
||||
|
||||
|
||||
end
|
@ -0,0 +1,22 @@
|
||||
class SalesmanCustomer < ApplicationRecord
|
||||
belongs_to :salesman, :touch => true, counter_cache: true
|
||||
belongs_to :school
|
||||
belongs_to :user
|
||||
|
||||
def name
|
||||
user.real_name
|
||||
end
|
||||
|
||||
def school_name
|
||||
school.name
|
||||
end
|
||||
|
||||
def courses_count
|
||||
CourseMember.where(user_id: id).teachers_and_admin.count
|
||||
end
|
||||
|
||||
def shixuns_count
|
||||
ShixunMember.where(user_id: id, role: [1, 2]).count
|
||||
end
|
||||
|
||||
end
|
@ -1,27 +0,0 @@
|
||||
<table class="table table-hover text-center repertoires-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="54%" class="text-left">技术体系</th>
|
||||
<th width="16%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @repertoires.present? %>
|
||||
<% @repertoires.each_with_index do |repertoire, index| %>
|
||||
<tr class="repertoire-item discipline-item-<%= repertoire.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left">
|
||||
<span><%= link_to repertoire.name, admins_sub_repertoires_path(repertoire_id: repertoire), :title => repertoire.name %></span>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to '编辑', edit_admins_repertoire_path(repertoire), remote: true, class: 'action' %>
|
||||
<%= delete_link '删除', admins_repertoire_path(repertoire, element: ".repertoire-item-#{repertoire.id}"), class: 'delete-repertoire-action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,2 @@
|
||||
$.notify({ message: '操作成功' },{ type: 'success' });
|
||||
$("<%= params[:element]%>").remove();
|
@ -0,0 +1,15 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb("#{@salesman.name}的渠道", admins_salesmans_path) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container salesman-channel-list-form rig">
|
||||
<div class="flex-1">
|
||||
<%= javascript_void_link '新增渠道', class: 'btn btn-primary', data: {salesman_id: @salesman.id, toggle: 'modal', target: '.admin-add-salesman-channel-user-modal' } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container salesman-channel-list-container">
|
||||
<%= render(partial: 'admins/salesman_channels/shared/list') %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/salesman_channels/shared/add_salesman_channels_user_modal' %>
|
@ -1,18 +1,25 @@
|
||||
<div class="modal fade admin-edit-repertoire-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade admin-add-salesman-channel-user-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">编辑技术体系</h5>
|
||||
<h5 class="modal-title">添加渠道</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<%= simple_form_for([:admins, repertoire], html: { class: 'admin-edit-repertoire-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
|
||||
<%= f.input :name, as: :string, label: '名称' %>
|
||||
<form class="admin-add-salesman-user-form">
|
||||
<%= hidden_field_tag(:salesman_id, nil) %>
|
||||
|
||||
<div class="form-group d-flex">
|
||||
<label class="col-form-label">单位:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<select id="user_ids" name="user_ids" class="form-control salesman-channel-user-select"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
<% end %>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
@ -0,0 +1,42 @@
|
||||
<table class="table table-hover text-center salesman-channel-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="17%" class="text-left">名称</th>
|
||||
<th width="15%" class="text-left">教师数</th>
|
||||
<th width="15%" class="text-left">学生数</th>
|
||||
<th width="15%">课堂数</th>
|
||||
<th width="15%">实训数</th>
|
||||
<th width="17%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @channels.present? %>
|
||||
<% @channels.each_with_index do |channel, index| %>
|
||||
<tr class="channel-item salesman-channel-item-<%= channel.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left">
|
||||
<span><%= channel.school_name %></span>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
<span><%= channel.teacher_count %></span>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
<span><%= channel.student_count %></span>
|
||||
</td>
|
||||
<td>
|
||||
<%= channel.course_count %>
|
||||
</td>
|
||||
<td>
|
||||
<%= channel.shixuns_count %>
|
||||
</td>
|
||||
<td>
|
||||
<%= delete_link '删除', admins_salesman_channel_path(channel, salesman_id: channel.salesman_id, element: ".salesman-channel-item-#{channel.id}"), class: 'delete-salesman-action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,2 @@
|
||||
$.notify({ message: '操作成功' },{ type: 'success' });
|
||||
$("<%= params[:element]%>").remove();
|
@ -0,0 +1,15 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb("#{@salesman.name}的客户", admins_salesmans_path) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container salesman-customer-list-form rig">
|
||||
<div class="flex-1">
|
||||
<%= javascript_void_link '新增客户', class: 'btn btn-primary', data: {salesman_id: @salesman.id, toggle: 'modal', target: '.admin-add-salesman-customer-user-modal' } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container salesman-customer-list-container">
|
||||
<%= render(partial: 'admins/salesman_customers/shared/list') %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/salesman_customers/shared/add_salesman_customers_user_modal' %>
|
@ -0,0 +1,30 @@
|
||||
<div class="modal fade admin-add-salesman-customer-user-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">添加客户</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="admin-add-salesman-user-form">
|
||||
<%= hidden_field_tag(:salesman_id, nil) %>
|
||||
|
||||
<div class="form-group d-flex">
|
||||
<label class="col-form-label">姓名:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<select id="user_ids" name="user_ids" class="form-control salesman-customer-user-select"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error text-danger"></div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary submit-btn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,38 @@
|
||||
<table class="table table-hover text-center salesman-customer-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="20%" class="text-left">名称</th>
|
||||
<th width="30%" class="text-left">单位</th>
|
||||
<th width="12%" class="text-left">课堂数</th>
|
||||
<th width="12%">实训数</th>
|
||||
<th width="20%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @customers.present? %>
|
||||
<% @customers.each_with_index do |customer, index| %>
|
||||
<tr class="customer-item salesman-customer-item-<%= customer.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left">
|
||||
<span><%= link_to customer.name, user_path(customer), :title => customer.name %></span>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
<span><%= customer.school_name %></span>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
<span><%= customer.courses_count %></span>
|
||||
</td>
|
||||
<td>
|
||||
<%= customer.shixuns_count %>
|
||||
</td>
|
||||
<td>
|
||||
<%= delete_link '删除', admins_salesman_customer_path(customer, salesman_id: customer.salesman_id, element: ".salesman-customer-item-#{customer.id}"), class: 'delete-salesman--action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,2 @@
|
||||
$.notify({ message: '操作成功' },{ type: 'success' });
|
||||
$(".salesman-item-<%= params[:id]%>").remove();
|
@ -0,0 +1,15 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('销售数据列表', admins_salesmans_path) %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container salesman-list-form rig">
|
||||
<div class="flex-1">
|
||||
<%= javascript_void_link '新增销售人员', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-add-salesman-user-modal' } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box admin-list-container salesman-list-container">
|
||||
<%= render(partial: 'admins/salesmans/shared/list') %>
|
||||
</div>
|
||||
|
||||
<%= render 'admins/salesmans/shared/add_salesman_user_modal' %>
|
@ -1,18 +1,20 @@
|
||||
<div class="modal fade admin-create-repertoire-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade admin-add-salesman-user-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">新建课程方向</h5>
|
||||
<h5 class="modal-title">添加销售人员</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="admin-create-repertoire-form" data-url="<%= admins_repertoires_path %>">
|
||||
<form class="admin-add-salesman-user-form">
|
||||
<%= hidden_field_tag(:salesman_id, nil) %>
|
||||
|
||||
<div class="form-group d-flex">
|
||||
<label for="new_mirror_id" class="col-form-label">名称:</label>
|
||||
<div class="w-75 d-flex flex-column">
|
||||
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入名称') %>
|
||||
<label class="col-form-label">姓名:</label>
|
||||
<div class="d-flex flex-column-reverse w-75">
|
||||
<select id="user_ids" name="user_ids" class="form-control salesman-user-select"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,37 @@
|
||||
<table class="table table-hover text-center salesman-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="6%">序号</th>
|
||||
<th width="20%" class="text-left">名称</th>
|
||||
<th width="30%" class="text-left">客户数(点击数字客户列表)</th>
|
||||
<th width="30%" class="text-left">渠道数(点击数字渠道列表)</th>
|
||||
<th width="14%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @salesmans.present? %>
|
||||
<% @salesmans.each_with_index do |salesman, index| %>
|
||||
<tr class="salesman-item salesman-item-<%= salesman.id %>">
|
||||
<td><%= index + 1 %></td>
|
||||
<td class="text-left">
|
||||
<span><%= link_to salesman.name, admins_salesman_path(salesman), :title => salesman.name %></span>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
<span><%= link_to salesman.salesman_customers_count.to_i,
|
||||
admins_salesman_customers_path(salesman_id: salesman), :title => "点击进入客户列表" %></span>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
<span><%= link_to salesman.salesman_channels_count.to_i, admins_salesman_channels_path(salesman_id: salesman),
|
||||
:title => "点击进入渠道列表" %></span>
|
||||
</td>
|
||||
<td>
|
||||
<%= delete_link '删除', admins_salesman_path(salesman, element: ".salesman-item-#{salesman.id}"),
|
||||
class: 'delete-salesman-action' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
@ -0,0 +1,6 @@
|
||||
json.count @total_count
|
||||
json.schools do
|
||||
json.array! @schools.each do |school|
|
||||
json.extract! school, :id, :name
|
||||
end
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
json.status @status
|
||||
json.message @status == 0 ? "已公开过申请,请等待管理员审核" : "公开申请已提交,请等待管理员的审核"
|
@ -1,2 +1,2 @@
|
||||
json.status 1
|
||||
json.status 0
|
||||
json.subject_id @subject.id
|
@ -1,2 +1,2 @@
|
||||
json.status @status
|
||||
json.message @status == 0 ? "已发布过申请,请等待管理员审核" : "发布申请已提交,请等待管理员的审核"
|
||||
json.status 0
|
||||
json.message "发布成功"
|
@ -0,0 +1,11 @@
|
||||
class CreateSalesmen < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :salesmen do |t|
|
||||
t.references :user
|
||||
t.string :name
|
||||
t.integer :salesman_channels_count
|
||||
t.integer :salesman_customers_count
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
class CreateSalesmanChannels < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :salesman_channels do |t|
|
||||
t.references :salesman
|
||||
t.references :school
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
class CreateSalesmanCustomers < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :salesman_customers do |t|
|
||||
t.references :salesman
|
||||
t.references :user
|
||||
t.references :school
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddCodeHaltToCourseGroup < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :course_groups, :invite_code_halt, :boolean, default: false
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddPublicForSubjects < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :subjects, :public, :integer, :default => 0
|
||||
end
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
class MigrateSubjectStatus < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
Subject.unhidden.visible.update_all(public: 2)
|
||||
Subject.where(status: 1, id: ApplyAction.where(container_type: 'ApplySubject', status: 0)
|
||||
.pluck(:container_id)).update_all(status: 2, public: 1)
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue