Bug 21049: Fix value of material select for Rancor 007 widget
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / mana.inc
1 <script>
2 //<![CDATA[
3 $(document).ready(function() {
4     function mana_increment(mana_id, resource, fieldvalue, stepvalue = 1) {
5         $.ajax( {
6             type: "POST",
7             url: "/cgi-bin/koha/svc/mana/increment",
8             data: {id: mana_id, resource: resource, field: fieldvalue, step: stepvalue},
9             datatype: "json",
10         })
11     }
12
13     function mana_comment( target_id, manamsg, resource_type ) {
14         $.ajax( {
15             type: "POST",
16             url: "/cgi-bin/koha/svc/mana/share",
17             data: {message: manamsg, resource: resource_type , resource_id: target_id},
18             datatype: "json",
19         })
20     }
21
22     $(document).on('click', 'ul li.mana-comment', function() {
23         id = $(this).attr('data-id');
24         mana_increment(id, 'resource_comment', 'nb');
25     });
26
27     $(document).on('click', 'ul li.mana-other-comment', function() {
28         $('#mana-comment-box').modal('show');
29     });
30
31     $(document).on('click', '#mana-send-comment', function() {
32         var resource_type = $('#mana-resource').val();
33         var resource_id = $('#mana-resource-id').val();
34         var comment = $("#mana-comment").val();
35         mana_comment(resource_id, comment, resource_type);
36         $("#mana-comment-box").modal("hide");
37     });
38
39     $(document).on('click', '#mana-comment-close', function() {
40         $("#mana-comment-box").modal("hide");
41     });
42 });
43 //]]>
44 </script>