|
Line 0
Link Here
|
|
|
1 |
<div id="suggestion_search_modal" class="modal" role="dialog" aria-hidden="true"> |
| 2 |
<div class="modal-dialog modal-lg" style="width: 80%"> |
| 3 |
<div class="modal-content"> |
| 4 |
<div class="modal-header"> |
| 5 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">x</button> |
| 6 |
<h3 id="search_suggestions_label"> |
| 7 |
Search suggestions for order: |
| 8 |
<span id="search_suggestion_modal_title"></span> |
| 9 |
</h3> |
| 10 |
|
| 11 |
</div> |
| 12 |
<div class="modal-body"> |
| 13 |
<div class="suggestions_search"> |
| 14 |
<table id="suggestions_search_table" class="wrap"> |
| 15 |
<thead><tr> |
| 16 |
<th>Title</th> |
| 17 |
<th>Author</th> |
| 18 |
<th>ISBN</th> |
| 19 |
<th>Note</th> |
| 20 |
<th>Publication info</th> |
| 21 |
<th>Suggested by</th> |
| 22 |
<th>Additional info</th> |
| 23 |
<th> </th> |
| 24 |
</tr></thead> |
| 25 |
</table> |
| 26 |
</div> |
| 27 |
</div> |
| 28 |
<div class="modal-footer"> |
| 29 |
<a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Close</a> |
| 30 |
</div> |
| 31 |
</div> |
| 32 |
</div> |
| 33 |
</div> |
| 34 |
|
| 35 |
<script> |
| 36 |
$(document).ready(function(){ |
| 37 |
|
| 38 |
suggestions_table = $("#suggestions_search_table").kohaTable({ |
| 39 |
"ajax": { |
| 40 |
"url": "/api/v1/suggestions" |
| 41 |
}, |
| 42 |
"stateSave": true, |
| 43 |
"columns": [ |
| 44 |
{ |
| 45 |
"data": "title", |
| 46 |
"searchable": true, |
| 47 |
"orderable": true, |
| 48 |
"max-width": "20%", |
| 49 |
}, |
| 50 |
{ |
| 51 |
"data": "author", |
| 52 |
"searchable": true, |
| 53 |
"orderable": true, |
| 54 |
}, |
| 55 |
{ |
| 56 |
"data": "isbn", |
| 57 |
"searchable": true, |
| 58 |
"orderable": true, |
| 59 |
}, |
| 60 |
{ |
| 61 |
"data": "note", |
| 62 |
"searchable": true, |
| 63 |
"orderable": true, |
| 64 |
}, |
| 65 |
{ |
| 66 |
"data": "publisher_code", |
| 67 |
"searchable": true, |
| 68 |
"orderable": true, |
| 69 |
}, |
| 70 |
{ |
| 71 |
"data": "suggested_by", |
| 72 |
"searchable": true, |
| 73 |
"orderable": true, |
| 74 |
}, |
| 75 |
{ |
| 76 |
"data": "status", |
| 77 |
"searchable": true, |
| 78 |
"orderable": true, |
| 79 |
}, |
| 80 |
{ |
| 81 |
"data": "suggestionid", |
| 82 |
"searchable": false, |
| 83 |
"orderable": false, |
| 84 |
"render": function( data, type, row, meta ) { |
| 85 |
let modal_title = $("#search_suggestion_modal_title"); |
| 86 |
let import_id = modal_title.data('import_record_id'); |
| 87 |
console.log(row); |
| 88 |
if( $("input[name^='attach_suggestion_'][value='"+row.suggestion_id+"'").length == 0 ){ |
| 89 |
let add_button = '<a class="btn btn-default btn-xs select_suggestion"'; |
| 90 |
add_button += ' data-suggestionid="' + row.suggestion_id; |
| 91 |
add_button += '" data-title="' + row.title + ' (' + row.suggestion_id + ')' + '">'; |
| 92 |
add_button += 'Select</a>'; |
| 93 |
return add_button; |
| 94 |
} else { |
| 95 |
return ''; |
| 96 |
} |
| 97 |
}, |
| 98 |
}, |
| 99 |
], |
| 100 |
"autoWidth": false, |
| 101 |
}, null, 1); |
| 102 |
|
| 103 |
console.log(suggestions_table); |
| 104 |
}); |
| 105 |
</script> |