jQuery(function($){$('.lws_editlist .lws_editlist_modal_form').on('click','.first_group .radiogrid-item',function(){$('.first_group .radiogrid-item').removeClass('selected');$('.lws_woorewards_system_choice').addClass('hidden');$(this).addClass('selected');var key=$(this).data('key');var wrapper=$(this).closest('.lws-editlist-group-wrapper');wrapper.find('.header').html(wrapper.find('.header').data('selected')+"<strong>"+$(this).find(".label").text()+"</strong>");if(wrapper.hasClass('canfold')){wrapper.removeClass('unfolded').addClass('folded')}
var secondgroup=wrapper.parent().find('.second_group');secondgroup.find(".radiogrid-container").addClass("hidden");secondgroup.removeClass("hidden").removeClass('folded');secondgroup.find(`.radiogrid-container[data-key="${key}"]`).removeClass('hidden');var thirdgroup=wrapper.parent().find('.third_group');thirdgroup.addClass('folded')});$('.lws_editlist .lws_editlist_modal_form').on('click','.group-header-line',function(){$('.lws-editlist-group-wrapper').addClass('folded');$(this).closest('.lws-editlist-group-wrapper').removeClass('folded')});$('.lws_editlist .lws_editlist_modal_form').on('click','.second_group .radiogrid-item',function(){$('.second_group .radiogrid-item').removeClass('selected');$('.lws_woorewards_system_choice').addClass('hidden');$(this).addClass('selected');var master=$(this).closest('.lws_editlist_modal_form');var value=$(this).attr('value');var wrapper=$(this).closest('.lws-editlist-group-wrapper');wrapper.find('.header').html(wrapper.find('.header').data('selected')+"<strong>"+$(this).find(".label").text()+"</strong>");if(wrapper.hasClass('canfold')){wrapper.removeClass('unfolded').addClass('folded')}
var thirdgroup=wrapper.parent().find('.third_group');thirdgroup.removeClass("hidden").removeClass('folded');thirdgroup.find("."+value).removeClass('hidden');master.find('.buttons-container').find('.btn-save').prop('disabled',!1);master.find('.lws_woorewards_system_type').val(value)});$('.lws_editlist').on('change','.lws_woorewards_system_type',function(){var master=$(this).closest('.lws_woorewards_system_master').removeClass('initialized');var first_group=master.find('.first_group');var firstheader=first_group.find('.header');firstheader.html(firstheader.data('idle'));var second_group=master.find('.second_group');var secondheader=second_group.find('.header');secondheader.html(secondheader.data('idle'));var third_group=master.find('.third_group');var value=master.find('.lws_woorewards_system_type').val().trim()
var choices=master.find('.lws_woorewards_system_choice').addClass('hidden');var buttons=$(this).closest('.lws_editlist_modal_form').find('.buttons-container');if(master.find('input.lws_woorewards_system_id').val().trim().length){master.removeClass('creation').addClass('edition');first_group.addClass('hidden');second_group.addClass('hidden');third_group.removeClass('hidden').removeClass('folded');buttons.find('.btn-save').prop('disabled',!1);choices.filter('.'+value).removeClass('hidden')}else{master.removeClass('edition').addClass('creation');first_group.removeClass('hidden').removeClass('folded');$('.first_group .radiogrid-item').removeClass('selected');second_group.addClass('hidden');$('.second_group .radiogrid-item').removeClass('selected');third_group.addClass('hidden');buttons.find('.btn-save').prop('disabled',!0)}});$('.lws_editlist').on('change keyup','input.expression_trigger',function(event){let input=$(this);let page=input.closest('.lws_woorewards_system_choice');if(input.val().trim().startsWith('=')){input.data('size',input.attr('size')).data('width',input.css('width'));input.removeAttr('size').css('width','100%');page.find('.hide_if_not_expression').css('display','contents')}else{if(undefined!=input.data('size')&&input.data('size')>0)
input.attr('size',input.data('size'));if(undefined!=input.data('width')&&input.data('width').match(/[1-9]/))
input.css('width',input.data('width'));page.find('.hide_if_not_expression').css('display','none')}})})