added fix for edit page

This commit is contained in:
rulingcom 2024-04-02 21:51:42 +08:00
parent 06d09747b6
commit b0116e3d5a
1 changed files with 11 additions and 8 deletions

View File

@ -224,10 +224,10 @@
%>
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each_with_index do |rf, idx| %>
<% if(idx == 5) %>
<% if(idx == 6) %>
<div id="optional">
<% end %>
<% if(idx % 5 == 0) && idx != 0 %>
<% if(idx % 6 == 0) && idx != 0 %>
<% group += 1 %>
<% if @seminar_signup.seminar_signup_values[@form_index] && !@seminar_signup.seminar_signup_values[@form_index].value.blank? %>
<div id="group<%= group %>">
@ -241,11 +241,11 @@
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
</div>
<% if(counter % 5 == 0) && idx != 4 %>
<% if(counter % 6 == 0) && idx != 5 %>
<% counter = 0 %>
</div>
<% end %>
<% if(idx == 25) %>
<% if(idx == 30) %>
<div id="optional">
<% end %>
<% @form_index = @form_index +1 %>
@ -452,10 +452,13 @@
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
let currentGroup = 1 + $("#new-seminar-signup div[id^=group]:visible").length;
function showGroup($group){
function showGroup($group, init){
$group.show();
$group.find('.fake-clean-file').remove();
$group.find('input,textarea').attr("required", true);
if(init){
$group.find('input.tick').attr("checked", true);
}
}
function hideGroup($group){
@ -469,11 +472,11 @@
if (currentGroup > 1){
$("#remove-member").show();
for (var i = 1; i < currentGroup; i++){
showGroup($("#group" + i));
for (var i = 1; i <= currentGroup; i++){
showGroup($("#group" + i), true);
}
}
$("input.first-tick").attr("checked",true);
$("#add-member").on("click",function () {
if(currentGroup < 5){
$("#remove-member").show();