fix reject trial auth feature issue

dev_partners
p31729568 6 years ago
parent 9c3fdd0c08
commit 1fa27ae9d3

@ -3511,6 +3511,8 @@ end
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) 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.where(:id => apply_action.user_id).first.update_attributes(:certification => (params[:type] == "1" ? 2 : 1))
if params[:reject_type] != "revocation"
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'") user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user) @authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user)
@autu_count = @authorizations.count @autu_count = @authorizations.count
@ -3519,6 +3521,7 @@ end
@autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1 @autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1
@offset ||= @autu_pages.offset @offset ||= @autu_pages.offset
@authorizations = paginateHelper @authorizations, @limit @authorizations = paginateHelper @authorizations, @limit
end
respond_to do |format| respond_to do |format|
format.js format.js
end end

@ -1,6 +1,6 @@
<div class="modal reject-auth-modal" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: 100;display: none;"> <div class="modal reject-auth-modal" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: 100;display: none;">
<div class="mask" style="position: absolute;width: 100%;height: 100%;background:rgba(0,0,0,1);opacity:0.5;"></div> <div class="mask" style="position: absolute;width: 100%;height: 100%;background:rgba(0,0,0,1);opacity:0.5;"></div>
<div class="task-popup" style="width:600px;position: relative;margin: 100px auto 0;border-radius:10px;"> <div class="task-popup" style="width:600px;position: relative;margin: 80px auto 0;border-radius:10px;">
<div class=" task-popup-title clearfix task-popup-bggrey"> <div class=" task-popup-title clearfix task-popup-bggrey">
<%= title %> <%= title %>
</div> </div>
@ -62,6 +62,8 @@
<textarea class="remarktextarea fl panel-box-sizing candiate_answer" name="reject_description" placeholder="为选择的撤销原因补充备注说明...."></textarea> <textarea class="remarktextarea fl panel-box-sizing candiate_answer" name="reject_description" placeholder="为选择的撤销原因补充备注说明...."></textarea>
</li> </li>
<li class="ml20 error color-red" style="display: none;"></li>
<li class="clearfix mt20 edu-txt-center mb20"> <li class="clearfix mt20 edu-txt-center mb20">
<a href="javascript:void(0);" class="task-btn mr10 cancel-btn">取消</a> <a href="javascript:void(0);" class="task-btn mr10 cancel-btn">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20 submit-btn">确定</a> <a href="javascript:void(0);" class="task-btn task-btn-orange ml20 submit-btn">确定</a>
@ -77,11 +79,24 @@
var modal = $(".modal.reject-auth-modal"); var modal = $(".modal.reject-auth-modal");
var form = modal.find("#reject-auth-form"); var form = modal.find("#reject-auth-form");
var applyIdInput = form.find("input[name='apply_id']"); var applyIdInput = form.find("input[name='apply_id']");
var error = modal.find(".error");
modal.on('click', '.submit-btn', function(){ modal.on('click', '.submit-btn', function(){
if (!formValid()) { return; }
form.submit(); form.submit();
}); });
var formValid = function () {
error.html("").hide();
console.log("a========", form.find("input[name='reasons[]']:checked").length, form.find("textarea[name='reject_description']").val())
if (form.find("input[name='reasons[]']:checked").length == 0 || form.find("textarea[name='reject_description']").val() == '') {
error.html("原因和说明不能为空,请完善后再确认提交").show();
return false;
}
return true;
};
var hideRejectModalFunc = function(){ var hideRejectModalFunc = function(){
applyIdInput.val(''); applyIdInput.val('');
form.find("textarea[name='reject_description']").val(''); form.find("textarea[name='reject_description']").val('');

Loading…
Cancel
Save