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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/catalog_concern.inc (+31 lines)
Line 0 Link Here
1
<!-- Add concern modal -->
2
<div class="modal" id="addConcernModal" tabindex="-1" role="dialog" aria-labelledby="addConcernModalLabel" aria-hidden="true">
3
    <div class="modal-dialog modal-lg">
4
        <div class="modal-content">
5
            <div class="modal-header">
6
                <h3 class="modal-title" id="addConcernModalLabel">Report a concern</h3>
7
                <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">
8
                    <span aria-hidden="true">&times;</span>
9
                </button>
10
            </div>
11
            <div class="modal-body">
12
                <fieldset id="concern_fieldset">
13
                    <div class="form-group">
14
                        <label for="concern_title">Title: </label>
15
                        <input type="text" name="concern_title" id="concern_title" required="required"/>
16
                    </div>
17
                    <div class="form-group">
18
                        <label for="concern_body">Please describe your concerns: </label>
19
                        <textarea class="form-control" name="concern_body" id="concern_body" required="required" rows="15"></textarea>
20
                    </div>
21
                </fieldset>
22
            </div>
23
            <div class="modal-footer">
24
                <input type="hidden" name="biblio_id" id="concern_biblio" value="[% biblio.biblionumber | html %]">
25
                <input type="hidden" name="reporter_id" id="concern_reporter" value="[% borrowernumber | html %]">
26
                <button type="submit" id="addConfirm" class="btn btn-primary">Submit</button>
27
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
28
            </div>
29
        </div>
30
    </div>
31
</div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (+3 lines)
Lines 124-129 Link Here
124
[% Asset.js("lib/bootstrap/js/bootstrap.bundle.min.js") | $raw %]
124
[% Asset.js("lib/bootstrap/js/bootstrap.bundle.min.js") | $raw %]
125
[% Asset.js("lib/fontfaceobserver.min.js") | $raw %]
125
[% Asset.js("lib/fontfaceobserver.min.js") | $raw %]
126
[% Asset.js("lib/enquire.min.js") | $raw %]
126
[% Asset.js("lib/enquire.min.js") | $raw %]
127
<script>
128
    let logged_in_user_id = "[% logged_in_user.borrowernumber | html %]";
129
</script>
127
[% Asset.js("js/global.js") | $raw %]
130
[% Asset.js("js/global.js") | $raw %]
128
[% IF ( OPACAmazonCoverImages || SyndeticsCoverImages ) %]
131
[% IF ( OPACAmazonCoverImages || SyndeticsCoverImages ) %]
129
    <script>
132
    <script>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc (+4 lines)
Lines 42-47 Link Here
42
        <li><a class="suggest_for_purchase btn btn-link btn-lg" href="/cgi-bin/koha/opac-suggestions.pl?op=add&biblionumber=[% biblio.biblionumber | url %]"><i class="fa fa-fw fa-gift" aria-hidden="true"></i> Suggest for purchase</a></li>
42
        <li><a class="suggest_for_purchase btn btn-link btn-lg" href="/cgi-bin/koha/opac-suggestions.pl?op=add&biblionumber=[% biblio.biblionumber | url %]"><i class="fa fa-fw fa-gift" aria-hidden="true"></i> Suggest for purchase</a></li>
43
    [% END %]
43
    [% END %]
44
44
45
    [% IF Koha.Preference('OpacCatalogConcerns') %]
46
        <li><a class="report_a_concern btn btn-link btn-lg" href="#" data-toggle="modal" data-target="#addConcernModal"><i class="fa fa-fw fa-warning" aria-hidden="true"></i> Report a concern</a></li>
47
    [% END %]
48
45
    [% IF ( OpacHighlightedWords && query_desc ) %]
49
    [% IF ( OpacHighlightedWords && query_desc ) %]
46
    <li>
50
    <li>
47
        <a href="#" class="highlight_toggle btn btn-link btn-lg" id="highlight_toggle_off"><i class="fa fa-fw fa-pencil" aria-hidden="true"></i> Unhighlight</a>
51
        <a href="#" class="highlight_toggle btn btn-link btn-lg" id="highlight_toggle_off"><i class="fa fa-fw fa-pencil" aria-hidden="true"></i> Unhighlight</a>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (+7 lines)
Lines 1438-1444 Link Here
1438
    </div> <!-- /.modal-dialog -->
1438
    </div> <!-- /.modal-dialog -->
1439
</div> <!-- /.modal -->
1439
</div> <!-- /.modal -->
1440
1440
1441
[% IF Koha.Preference('OpacCatalogConcerns') %]
1442
    [% INCLUDE 'modals/catalog_concern.inc' %]
1443
[% END %]
1444
1441
[% BLOCK jsinclude %]
1445
[% BLOCK jsinclude %]
1446
    [% IF Koha.Preference('OpacCatalogConcerns') %]
1447
        [% Asset.js("js/modals/catalog_concern.js") | $raw %]
1448
    [% END %]
1442
    [% INCLUDE 'datatables.inc' %]
1449
    [% INCLUDE 'datatables.inc' %]
1443
    [% INCLUDE 'columns_settings.inc' %]
1450
    [% INCLUDE 'columns_settings.inc' %]
1444
    [% INCLUDE greybox.inc %]
1451
    [% INCLUDE greybox.inc %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js (-1 / +47 lines)
Line 0 Link Here
0
- 
1
$(document).ready(function() {
2
3
    // Detect that we were redirected here after login and re-open modal
4
    let urlParams = new URLSearchParams(window.location.search);
5
    if (urlParams.has('modal')) {
6
        let modal = urlParams.get('modal');
7
        history.replaceState && history.replaceState(
8
            null, '', location.pathname + location.search.replace(/[\?&]modal=[^&]+/, '').replace(/^&/, '?')
9
        );
10
        if (modal == 'concern') {
11
            $("#addConcernModal").modal('show');
12
        }
13
    }
14
15
    $('#addConcernModal').on('show.bs.modal', function(e) {
16
        if (logged_in_user_id === "") {
17
            $('#modalAuth').append('<input type="hidden" name="return" value="' + window.location.pathname + window.location.search + '&modal=concern" />');
18
            $('#loginModal').modal('show');
19
            return false;
20
        }
21
    });
22
23
    $('#addConcernModal').on('click', '#addConfirm', function(e) {
24
        let concern_title = $('#concern_title').val();
25
        let concern_body = $('#concern_body').val();
26
        let biblio_id = $('#concern_biblio').val();
27
        let reporter_id = $('#concern_reporter').val();
28
29
        params = {
30
            title: concern_title,
31
            body: concern_body,
32
            biblio_id: biblio_id,
33
            reporter_id: reporter_id,
34
        };
35
36
        $.ajax({
37
            url: '/api/v1/public/tickets',
38
            type: 'POST',
39
            data: JSON.stringify(params),
40
            success: function(data) {
41
                $('#addConcernModal').modal('hide');
42
                $('#concern_body').val('');
43
            },
44
            contentType: "json"
45
        });
46
    });
47
});

Return to bug 31028