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