Bug 33945: (QA follow-up) Don't show delay message on patron details page
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / concerns.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% USE TablesSettings %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Catalog concerns &rsaquo; Cataloging &rsaquo; Koha</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9
10 <body id="cat_concerns" class="cat">
11     [% INCLUDE 'header.inc' %]
12     [% INCLUDE 'cataloging-search.inc' %]
13
14     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
15         <ol>
16             <li>
17                 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
18             </li>
19             <li>
20                 <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
21             </li>
22             <li>
23                 <a href="#" aria-current="page">
24                     Catalog concerns
25                 </a>
26             </li>
27         </ol>
28     </nav>
29
30     <div class="main container-fluid">
31         <div class="row">
32             <div class="col-sm-10 col-sm-push-2">
33                 <main>
34                     <h1>Concerns</h1>
35
36                     <div class="page-section">
37                         <fieldset class="action" style="cursor:pointer;">
38                             <a id="hideResolved"><i class="fa fa-minus-square"></i> Hide resolved</a>
39                             | <a id="showAll"><i class="fa fa-bars"></i> Show all</a>
40                         </fieldset>
41
42                         <table id="table_concerns">
43                             <thead>
44                                 <tr>
45                                     <th>Reported</th>
46                                     <th>Details</th>
47                                     <th>Title</th>
48                                     <th>Status</th>
49                                     <th data-class-name="actions noExport">Actions</th>
50                                 </tr>
51                             </thead>
52                         </table>
53                     </div>
54                 </main>
55             </div> <!-- /.col-sm-10.col-sm-push-2 -->
56
57             <div class="col-sm-2 col-sm-pull-10">
58                 <aside>
59                     [% INCLUDE 'cat-menu.inc' %]
60                 </aside>
61             </div> <!-- /.col-sm-2.col-sm-pull-10 -->
62         </div> <!-- /.row -->
63
64         [% INCLUDE 'modals/display_ticket.inc' %]
65
66 [% MACRO jsinclude BLOCK %]
67     [% INCLUDE 'datatables.inc' %]
68     [% INCLUDE 'columns_settings.inc' %]
69     [% INCLUDE 'js-date-format.inc' %]
70     [% INCLUDE 'js-patron-format.inc' %]
71     [% INCLUDE 'js-biblio-format.inc' %]
72     <script>
73         $(document).ready(function() {
74
75             logged_in_user_borrowernumber = [% logged_in_user.borrowernumber | html %];
76
77             var table_settings = [% TablesSettings.GetTableSettings('cataloguing', 'concerns', 'table_concerns', 'json') | $raw %];
78
79             var filtered = false;
80             let additional_filters = {
81                 resolved_date: function(){
82                     if ( filtered ) {
83                         return { "=": null };
84                     } else {
85                         return;
86                     }
87                 }
88             };
89
90             var tickets_url = '/api/v1/tickets';
91             var tickets = $("#table_concerns").kohaTable({
92                 "ajax": {
93                     "url": tickets_url
94                 },
95                 "embed": [
96                     "reporter",
97                     "resolver",
98                     "biblio",
99                     "updates+count",
100                 ],
101                 'emptyTable': '<div class="dialog message">' + _("Congratulations, there are no catalog concerns.") + '</div>',
102                 "columnDefs": [{
103                     "targets": [0, 1, 2, 3],
104                     "render": function(data, type, row, meta) {
105                         if (type == 'display') {
106                             if (data != null) {
107                                 return data.escapeHtml();
108                             } else {
109                                 return "";
110                             }
111                         }
112                         return data;
113                     }
114                 }],
115                 "columns": [{
116                         "data": "reported_date:reporter.firstname",
117                         "render": function(data, type, row, meta) {
118                             let reported = '<span class="date clearfix">' + $datetime(row.reported_date) + '</span>';
119                             reported += '<span class="reporter clearfix">' + $patron_to_html(row.reporter, {
120                                 display_cardnumber: false,
121                                 url: true
122                             }) + '</span>';
123                             return reported;
124                         },
125                         "searchable": true,
126                         "orderable": true
127                     },
128                     {
129                         "data": "title:body",
130                         "render": function(data, type, row, meta) {
131                             let resolved = ( row.resolved_date ) ? true : false;
132                             let result = '<a role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="'+resolved+'">' + row.title + '</a>';
133                             if (row.updates_count) {
134                                 result += '<span class="pull-right"><a role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="'+resolved+'"><i class="fa fa-comment" aria-hidden="true"></i> ' + row.updates_count + '</a></span>';
135                             }
136                             result += '<div id="detail_' + row.ticket_id + '" class="hidden">' + row.body + '</div>';
137                             return result;
138                         },
139                         "searchable": true,
140                         "orderable": true
141                     },
142                     {
143                         "data": "biblio.title",
144                         "render": function(data, type, row, meta) {
145                             return $biblio_to_html(row.biblio, {
146                                 link: 1
147                             });
148                         },
149                         "searchable": true,
150                         "orderable": true
151                     },
152                     {
153                         "data": "resolver.firstname:resolver.surname:resolved_date",
154                         "render": function(data, type, row, meta) {
155                             let result = '';
156                             if (row.resolved_date) {
157                                 result += _("Resolved by:") + ' <span>' + $patron_to_html(row.resolver, {
158                                     display_cardnumber: false,
159                                     url: true
160                                 }) + '</span>';
161                                 result += '<span class="clearfix">' + $datetime(row.resolved_date) + '</span>';
162                             } else {
163                                 result += _("Open");
164                             }
165                             return result;
166                         },
167                         "searchable": true,
168                         "orderable": true
169                     },
170                     {
171                         "data": function(row, type, val, meta) {
172                             let resolved = ( row.resolved_date ) ? true : false;
173                             let result = '<a class="btn btn-default btn-xs" role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="'+resolved+'"><i class="fa fa-eye" aria-hidden="true"></i> ' + _("Details") + '</a>';
174                             return result;
175                         },
176                         "searchable": false,
177                         "orderable": false
178                     },
179                 ]
180             }, table_settings, 1, additional_filters);
181
182             $('#hideResolved').on("click", function() {
183                 filtered = true;
184                 tickets.DataTable().draw();
185             });
186
187             $('#showAll').on("click", function() {
188                 filtered = false;
189                 tickets.DataTable().draw();
190             });
191         });
192     </script>
193     [% Asset.js("js/modals/display_ticket.js") | $raw %]
194 [% END %]
195 [% INCLUDE 'intranet-bottom.inc' %]