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 decribe 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 / +43 lines)
Line 0 Link Here
0
- 
1
$(document).ready(function() {
2
3
    let urlParams = new URLSearchParams(window.location.search);
4
    if ( urlParams.has('modal') ) {
5
        let modal = urlParams.get('modal');
6
        if ( modal == 'concern' ) {
7
            $("#addConcernModal").modal('show');
8
        }
9
    }
10
11
    $('#addConcernModal').on('show.bs.modal', function (e) {
12
        if ( logged_in_user_id === "" ) {
13
            $('#modalAuth').append('<input type="hidden" name="return" value="'+window.location+'&modal=concern" />');
14
            $('#loginModal').modal('show');
15
            return false;
16
        }
17
    });
18
19
    $('#addConcernModal').on('click', '#addConfirm', function(e) {
20
        let concern_title = $('#concern_title').val();
21
        let concern_body = $('#concern_body').val();
22
        let biblio_id = $('#concern_biblio').val();
23
        let reporter_id = $('#concern_reporter').val();
24
25
        params = {
26
            title: concern_title,
27
            body: concern_body,
28
            biblio_id: biblio_id,
29
            reporter_id: reporter_id,
30
        };
31
32
        $.ajax({
33
            url: '/api/v1/public/tickets',
34
            type: 'POST',
35
            data: JSON.stringify(params),
36
            success: function(data) {
37
                $('#addConcernModal').modal('hide');
38
                $('#concern_body').val('');
39
            },
40
            contentType: "json"
41
        });
42
    });
43
});

Return to bug 31028