|
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 |
}); |