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