<commit_before>odoo.define('website_event_compassion.group_visit_registration_step1', function (require) {
    'use strict';

    var animation = require('web_editor.snippets.animation');

    animation.registry.group_visit_step1 = animation.Class.extend({
        selector: '.cms_form_group_visit_registration',

        /**
         * Called when widget is started.
         */
        start: function () {
            // Trigger on hide or show double room field based on room type selected
            var double_field_div = $('div.field-double_room_person');
            var radio_field = $('input[type=radio][name=single_double_room]');
            radio_field.change(function() {
                if (this.value == 'single') {
                    double_field_div.find('input').val('');
                    double_field_div.hide();
                }
                else if (this.value == 'double') {
                    double_field_div.show();
                }
            });
            if (radio_field.val() == 'single') {
                double_field_div.hide();
            }
        },
    });
});
<commit_msg>CO-2338 FIX javascript hiding the double room field<commit_after>odoo.define('website_event_compassion.group_visit_registration_step1', function (require) {
    'use strict';

    var animation = require('web_editor.snippets.animation');

    animation.registry.group_visit_step1 = animation.Class.extend({
        selector: '.cms_form_group_visit_registration',

        /**
         * Called when widget is started.
         */
        start: function () {
            // Trigger on hide or show double room field based on room type selected
            var double_field_div = $('div.field-double_room_person');
            var radio_field = $('input[type=radio][name=single_double_room]');
            radio_field.change(function() {
                if (this.value == 'single') {
                    double_field_div.find('input').val('');
                    double_field_div.hide();
                }
                else if (this.value == 'double') {
                    double_field_div.show();
                }
            });
            // Hide the field if default value is single
            var checked_field = $('input[type=radio][name=single_double_room]:checked');
            if (checked_field.val() == 'single') {
                double_field_div.hide();
            }
        },
    });
});

{'fraction_non_alphanumeric': 0.12027914614121511, 'fraction_numerical': 0.003284072249589491, 'mean_word_length': 1.901190476190476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3752653', 'n_tokens_mistral': 668, 'n_tokens_neox': 623, 'n_words': 124}