View | Details | Raw Unified | Return to bug 37050
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-4 / +23 lines)
Lines 877-883 Link Here
877
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
877
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
878
                                                [% IF (sql_param.select_multiple) %]
878
                                                [% IF (sql_param.select_multiple) %]
879
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]" multiple>
879
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]" multiple>
880
                                                        <option value="null" hidden></option>
881
                                                [% ELSE %]
880
                                                [% ELSE %]
882
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]">
881
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]">
883
                                                [% END %]
882
                                                [% END %]
Lines 1564-1574 Link Here
1564
    [% Asset.css("lib/codemirror/highlight.css") | $raw %]
1563
    [% Asset.css("lib/codemirror/highlight.css") | $raw %]
1565
    [% Asset.js( "js/mana.js" ) | $raw %]
1564
    [% Asset.js( "js/mana.js" ) | $raw %]
1566
    [% Asset.js("js/form-submit.js") | $raw %]
1565
    [% Asset.js("js/form-submit.js") | $raw %]
1566
    [% INCLUDE 'select2.inc' %]
1567
1567
    <script>
1568
    <script>
1568
1569
1569
        //  if the report param form has multiselects override default form submission
1570
        //  if the report param form has multiselects override default form submission
1570
        if( $('#report_param_form').find('select[multiple]').length ) {
1571
        if( $('#report_param_form').find('select[multiple]').length ) {
1571
            $('#report_param_form').find('select[multiple]').each( function (i) {
1572
            $('#report_param_form').find('select[multiple]').each( function (i) {
1573
                $(this).prepend('<option hidden></option>');
1572
                $(this).on('change', function() {
1574
                $(this).on('change', function() {
1573
                    var $selected = $(this).val().join('\n');
1575
                    var $selected = $(this).val().join('\n');
1574
                    $(this).find('option:first').val($selected);
1576
                    $(this).find('option:first').val($selected);
Lines 1577-1584 Link Here
1577
1579
1578
            $('#report_param_form').on('submit', function(e) {
1580
            $('#report_param_form').on('submit', function(e) {
1579
                $('#report_param_form').find('select[multiple]').each( function (i) {
1581
                $('#report_param_form').find('select[multiple]').each( function (i) {
1580
                    var $selected = $('option:first', this).val();
1582
                    if( $(this).find('option:selected').length ) {
1581
                    $(this).val($selected);
1583
                        var $selected = $('option:first', this).val();
1584
                        $(this).val($selected);
1585
                    }
1586
                    else {
1587
                        let values = $.map( $(this).find('option'), function(o) {
1588
                            return $(o).val();
1589
                        }).slice(1).join('\n');
1590
                        $(this).find('option:first').val(values).prop('selected', true);
1591
                    }
1582
                });
1592
                });
1583
            });
1593
            });
1584
        }
1594
        }
Lines 2295-2300 Link Here
2295
                $("#limit").val( limit );
2305
                $("#limit").val( limit );
2296
                $("#limitselect").submit();
2306
                $("#limitselect").submit();
2297
            });
2307
            });
2308
2309
            // Apply select2 to all select fields having a "multiple" attribute
2310
            let selectFields = document.querySelectorAll('select[multiple]');
2311
            selectFields.forEach((selectField) => {
2312
                selectField.style.minWidth = '320px';
2313
                $(selectField).select2({
2314
                    closeOnSelect: false,
2315
                });
2316
            });
2317
2298
        });
2318
        });
2299
2319
2300
        $("#toggle_auto_links").on("click", function(e){
2320
        $("#toggle_auto_links").on("click", function(e){
2301
- 

Return to bug 37050