1 $(document).ready(function() {
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(/^&/, '?')
10 if (modal == 'concern') {
11 $("#addConcernModal").modal('show');
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');
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();
33 reporter_id: reporter_id,
37 url: '/api/v1/public/tickets',
39 data: JSON.stringify(params),
40 success: function(data) {
41 $('#addConcernModal').modal('hide');
42 $('#concern_body').val('');