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 / +22 lines)
Lines 882-888 Link Here
882
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
882
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
883
                                                [% IF (sql_param.select_multiple) %]
883
                                                [% IF (sql_param.select_multiple) %]
884
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]" multiple>
884
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]" multiple>
885
                                                        <option value="null" hidden></option>
886
                                                [% ELSE %]
885
                                                [% ELSE %]
887
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]">
886
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]">
888
                                                [% END %]
887
                                                [% END %]
Lines 1567-1578 Link Here
1567
    [% Asset.js( "lib/codemirror/highlight.js" ) | $raw %]
1566
    [% Asset.js( "lib/codemirror/highlight.js" ) | $raw %]
1568
    [% Asset.css("lib/codemirror/highlight.css") | $raw %]
1567
    [% Asset.css("lib/codemirror/highlight.css") | $raw %]
1569
    [% Asset.js( "js/mana.js" ) | $raw %]
1568
    [% Asset.js( "js/mana.js" ) | $raw %]
1569
    [% INCLUDE 'select2.inc' %]
1570
1570
1571
    <script>
1571
    <script>
1572
1572
1573
        //  if the report param form has multiselects override default form submission
1573
        //  if the report param form has multiselects override default form submission
1574
        if( $('#report_param_form').find('select[multiple]').length ) {
1574
        if( $('#report_param_form').find('select[multiple]').length ) {
1575
            $('#report_param_form').find('select[multiple]').each( function (i) {
1575
            $('#report_param_form').find('select[multiple]').each( function (i) {
1576
                $(this).prepend('<option hidden></option>');
1576
                $(this).on('change', function() {
1577
                $(this).on('change', function() {
1577
                    var $selected = $(this).val().join('\n');
1578
                    var $selected = $(this).val().join('\n');
1578
                    $(this).find('option:first').val($selected);
1579
                    $(this).find('option:first').val($selected);
Lines 1581-1588 Link Here
1581
1582
1582
            $('#report_param_form').on('submit', function(e) {
1583
            $('#report_param_form').on('submit', function(e) {
1583
                $('#report_param_form').find('select[multiple]').each( function (i) {
1584
                $('#report_param_form').find('select[multiple]').each( function (i) {
1584
                    var $selected = $('option:first', this).val();
1585
                    if( $(this).find('option:selected').length ) {
1585
                    $(this).val($selected);
1586
                        var $selected = $('option:first', this).val();
1587
                        $(this).val($selected);
1588
                    }
1589
                    else {
1590
                        let values = $.map( $(this).find('option'), function(o) {
1591
                            return $(o).val();
1592
                        }).slice(1).join('\n');
1593
                        $(this).find('option:first').val(values).prop('selected', true);
1594
                    }
1586
                });
1595
                });
1587
            });
1596
            });
1588
        }
1597
        }
Lines 2306-2311 Link Here
2306
                $("#limit").val( limit );
2315
                $("#limit").val( limit );
2307
                $("#limitselect").submit();
2316
                $("#limitselect").submit();
2308
            });
2317
            });
2318
2319
            // Apply select2 to all select fields having a "multiple" attribute
2320
            let selectFields = document.querySelectorAll('select[multiple]');
2321
            selectFields.forEach((selectField) => {
2322
                selectField.style.minWidth = '320px';
2323
                $(selectField).select2({
2324
                    closeOnSelect: false,
2325
                });
2326
            });
2327
2309
        });
2328
        });
2310
2329
2311
        $("#toggle_auto_links").on("click", function(e){
2330
        $("#toggle_auto_links").on("click", function(e){
2312
- 

Return to bug 37050