Bug 16239: Update templates
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / add_fields.tt
1 [% USE AuthorisedValues %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Serials &rsaquo; Manage new fields for subscriptions
4   [% IF op == "list" %] &rsaquo; List of fields
5   [% ELSIF op == "add_form" %]
6     [% IF field %] &rsaquo; Modify field
7     [% ELSE %] &rsaquo; Add field
8     [% END %]
9   [% END %]
10 </title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
13 [% INCLUDE "datatables.inc" %]
14 <script type="text/javascript">
15 //<![CDATA[
16   $(document).ready(function(){
17
18     $("#fieldst").dataTable($.extend(true, {}, dataTablesDefaults, {
19         'bAutoWidth': false,
20         'sDom': 't<"bottom pager"ilpf>',
21         'sPaginationType': 'four_button',
22         'aLengthMenu': [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
23         'iDisplayLength': 20,
24         'aaSorting': [[ 0, "asc" ]],
25         "aoColumnDefs": [
26             { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
27         ]
28     }));
29
30     $(".confirmdelete").click(function(){
31       return confirm(_("Are you sure you want to delete this field?"));
32     });
33
34     $("#add_field").on('submit', function(){
35         if ( $("#marcfield").val().length > 0
36             && $("select[name='authorised_value_category']" ).val().length > 0 ) {
37             alert("You cannot select an authorised value category and a marcfield");
38             return false;
39         }
40         return true;
41     });
42   });
43 //]]>
44 </script>
45 </head>
46
47 <body id="ser_add_fields" class="ser">
48   [% INCLUDE 'header.inc' %]
49   [% INCLUDE 'serials-search.inc' %]
50
51   <div id="breadcrumbs">
52     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Manage new fields for subscriptions
53   </div>
54
55   <div id="doc3" class="yui-t2">
56   <div id="bd">
57   <div id="yui-main">
58   <div class="yui-b">
59   [% IF op == 'list' %]
60     <div id="toolbar" class="btn-toolbar">
61       <a class="btn btn-default btn-sm" id="newfields" href="/cgi-bin/koha/serials/add_fields.pl?op=add_form"><i class="fa fa-plus"></i> New fields</a>
62     </div>
63   [% END %]
64
65   [% IF messages %]
66     [% FOR message IN messages %]
67       [% IF message.code == 'insert' %]
68         [% IF message.number > 0 %]
69           <div class="dialog message">Field created.</div>
70         [% ELSE %]
71           <div class="dialog alert">The field could not be created. Perhaps the name already exists?</div>
72         [% END %]
73       [% ELSIF message.code == 'update' %]
74         [% IF message.number > 0 %]
75           <div class="dialog message">Field updated.</div>
76         [% ELSE %]
77           <div class="dialog alert">The field could not be updated. Perhaps the name already exists?</div>
78         [% END %]
79       [% ELSIF message.code == 'delete' %]
80         [% IF message.number > 0 %]
81           <div class="dialog message">Field deleted.</div>
82         [% ELSE %]
83           <div class="dialog alert">The field could not be deleted. Check the log for errors.</div>
84         [% END %]
85       [% END %]
86     [% END %]
87   [% END %]
88
89   [% IF op == 'list' %]
90     <h3>Additional fields for subscriptions</h3>
91     [% IF fields %]
92       <table id="fieldst">
93         <thead>
94           <tr>
95             <th>Name</th>
96             <th>Authorised value category</th>
97             <th>Marc field</th>
98             <th>Searchable</th>
99             <th>Actions</th>
100           </tr>
101         </thead>
102         <tbody>
103           [% FOR field IN fields %]
104             <tr>
105               <td>[% field.name %]</td>
106               <td>[% field.authorised_value_category %]</td>
107               <td>[% field.marcfield %]</td>
108               <td>
109                 [% IF field.searchable %]Yes[% ELSE %]No[% END %]
110               </td>
111               <td class="actions">
112                 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/add_fields.pl?op=add_form&amp;field_id=[% field.id %]"><i class="fa fa-pencil"></i> Edit</a>
113                 <a class="confirmdelete btn btn-default btn-xs" href="/cgi-bin/koha/serials/add_fields.pl?op=delete&amp;field_id=[% field.id %]"><i class="fa fa-trash"></i> Delete</a>
114               </td>
115             </tr>
116           [% END %]
117         </tbody>
118       </table>
119     [% ELSE %]
120       There is no field defined.
121     [% END %]
122   [% ELSIF op == 'add_form' %]
123     [% IF field %]
124       <h3>Modify field</h3>
125     [% ELSE %]
126       <h3>Add field</h3>
127     [% END %]
128     <form action="/cgi-bin/koha/serials/add_fields.pl" name="add_form" id="add_field" method="post">
129       <fieldset class="rows">
130         <ol>
131           <li>
132             <label for="name" class="required">Name: </label>
133             <input type="text" name="name" id="name" value="[% field.name | html %]" class="required" required="required" />
134             <span class="required">Required</span>
135           </li>
136           <li>
137             <label for="av">Authorised value category: </label>
138             <select name="authorised_value_category">
139               <option value="">None</option>
140               [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => field.authorised_value_category ) %]
141             </select>
142           </li>
143           <li>
144             <label for="marcfield">Marc field: </label>
145             <input type="text" name="marcfield" id="marcfield" value="[% field.marcfield| html %]" />
146           </li>
147           <li>
148             <label for="searchable">Searchable: </label>
149             [% IF field.searchable %]
150               <input type="checkbox" name="searchable" id="searchable" checked="checked" />
151             [% ELSE %]
152               <input type="checkbox" name="searchable" id="searchable" />
153             [% END %]
154           </li>
155         </ol>
156       </fieldset>
157       <fieldset class="action">
158         [% IF field %]
159           <input type="hidden" name="field_id" value="[% field.id %]" />
160         [% END %]
161         <input type="hidden" name="op" value="add" />
162         <input type="submit" value="Save" />
163         <a href="/cgi-bin/koha/serials/add_fields.pl" class="cancel">Cancel</a>
164       </fieldset>
165     </form>
166   [% END %]
167
168   </div>
169   </div>
170
171 <div class="yui-b">
172 [% INCLUDE 'serials-menu.inc' %]
173 </div>
174 </div>
175 [% INCLUDE 'intranet-bottom.inc' %]