Bug 19036: Add ability to auto generate a number for account credits
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / apikeys.tt
blob3285dc15e0f25fad6e457fa6b124acef5e4a7045
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE Asset %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Patrons &rsaquo; API Keys</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9 <body id="pat_apikeys" class="pat">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'patron-search.inc' %]
13 <div id="breadcrumbs">
14     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
15     &rsaquo;
16     <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
17     &rsaquo;
18     API Keys for [% INCLUDE 'patron-title.inc' %]
19 </div>
21 <div class="main container-fluid">
22     <div class="row">
23         <div class="col-sm-10 col-sm-push-2">
24             <main>
26                 [% INCLUDE 'members-toolbar.inc' %]
28                 <h1>API keys for [% INCLUDE 'patron-title.inc' %]</h1>
29                 <form id="add-api-key" action="/cgi-bin/koha/members/apikeys.pl" method="post" style="display:none">
30                     <input type="hidden" name="patron_id" value="[% patron.id | html %]" />
31                     <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
32                     <input type="hidden" name="op" value="generate" />
33                     <fieldset class="brief">
34                         <legend>Generate new client id/secret pair</legend>
35                         <ol>
36                             <li>
37                                 <label for="description">Description: </label>
38                                 <input type="text" name="description" />
39                                 <input type="submit" value="Save" />
40                                 <a href="#" class="cancel toggle_element" data-element="#add-api-key">Cancel</a>
41                             </li>
42                         </ol>
43                     </fieldset>
44                 </form>
46                 <div id="keys">
47                     [% IF api_keys && api_keys.size > 0 %]
48                         <p>
49                             <button class="btn btn-default toggle_element" type="submit" id="show-api-form" data-element="#add-api-key"><i class="fa fa-plus"></i> Generate a new client id/key pair</button>
50                         </p>
51                         <table>
52                             <thead>
53                                 <tr>
54                                     <th>Description</th>
55                                     <th>Client ID</th>
56                                     <th>Secret</th>
57                                     <th>Active</th>
58                                     <th>Actions</th>
59                                 </tr>
60                             </thead>
61                             <tbody>
62                                 [% FOREACH key IN api_keys %]
63                                     <tr>
64                                         <td>[% key.description | html %]</td>
65                                         <td>[% key.client_id | html %]</td>
66                                         <td>[% key.secret | html %]</td>
67                                         <td>[% IF key.active %]Yes[% ELSE %]No[% END %]</td>
68                                         <td>
69                                             <form action="/cgi-bin/koha/members/apikeys.pl" method="post">
70                                                 <input type="hidden" name="patron_id" value="[% patron.id | html %]" />
71                                                 <input type="hidden" name="key" value="[% key.id | html %]" />
72                                                 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
73                                                 <input type="hidden" name="op" value="delete" />
74                                                 <button class="btn btn-default btn-xs delete" type="submit"><i class="fa fa-trash"></i> Delete</button>
75                                             </form>
76                                             <form action="/cgi-bin/koha/members/apikeys.pl" method="post">
77                                                 <input type="hidden" name="patron_id" value="[% patron.id | html %]" />
78                                                 <input type="hidden" name="key" value="[% key.id | html %]" />
79                                                 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
80                                                 [% IF key.active %]
81                                                     <input type="hidden" name="op" value="revoke" />
82                                                     <button class="btn btn-default btn-xs" type="submit"><i class="fa fa-remove"></i> Revoke</button>
83                                                 [% ELSE %]
84                                                     <input type="hidden" name="op" value="activate" />
85                                                     <button class="btn btn-default btn-xs" type="submit"><i class="fa fa-play"></i> Activate</button>
86                                                 [% END %]
87                                             </form>
88                                         </td>
89                                     </tr>
90                                 [% END %]
91                             </tbody>
92                         </table>
93                     [% ELSE %]
94                         <div class="dialog message">No keys defined for the current patron. <a href="#" class="toggle_element" data-element="#add-api-key" id="show-api-form"><i class="fa fa-plus"></i> Generate a new client id/secret pair</div>
95                     [% END %]
96                 </div>
97             </main>
98         </div> <!-- /.col-sm-10.col-sm-push-2 -->
100         <div class="col-sm-2 col-sm-pull-10">
101             <aside>
102                 [% INCLUDE 'circ-menu.inc' %]
103             </aside>
104         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
105     </div> <!-- /.row -->
108 [% MACRO jsinclude BLOCK %]
109     [% INCLUDE 'str/members-menu.inc' %]
110     [% Asset.js("js/members-menu.js") | $raw %]
111     <script>
112         $(document).ready(function(){
113             $(".delete").on("click", function(e){
114                 return confirmDelete(_("Are you sure you want to delete this key?"));
115             });
116         });
117     </script>
118 [% END %]
120 [% INCLUDE 'intranet-bottom.inc' %]