2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Frequencies › Serials › Koha</title>
4 [% INCLUDE 'doc-head-close.inc' %]
7 <body id="ser_subscription_frequencies" class="ser">
8 [% WRAPPER 'header.inc' %]
9 [% INCLUDE 'serials-search.inc' %]
12 [% BLOCK translate_frequnit %]
14 [% CASE 'day' %]<span> day</span>
15 [% CASE 'week' %]<span> week</span>
16 [% CASE 'month' %]<span> month</span>
17 [% CASE 'year' %]<span> year</span>
21 [% WRAPPER 'sub-header.inc' %]
22 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
25 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
28 <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a>
31 <a href="#" aria-current="page">Frequencies</a>
37 <div class="main container-fluid">
39 <div class="col-sm-10 col-sm-push-2">
42 [% IF (new or modify) %]
44 <h1>New frequency</h1>
46 <h1>Edit frequency: [% description | html %]</h1>
48 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" id="add_frequency_form" method="post">
50 <input type="hidden" name="id" value="[% id | html %]" />
51 <input type="hidden" name="op" value="savemod" />
53 <input type="hidden" name="op" value="savenew" />
55 <fieldset class="rows">
58 <label class="required" for="description">Description: </label>
59 <input type="text" id="description" name="description" value="[% description | html %]" class="required" required="required" /> <span class="required">Required</span>
62 <label for="unit">Unit: </label>
63 <select id="unit" name="unit">
64 <option value="">None</option>
65 [% FOREACH unit IN units_loop %]
66 [% IF (unit.selected) %]
67 <option selected="selected" value="[% unit.val | html %]">
69 <option value="[% unit.val | html %]">
71 [% PROCESS translate_frequnit frequnit=unit.val %]
76 <li><span class="hint">Note: one of the two following fields must be equal to 1</span></li>
78 <label for="issuesperunit">Issues per unit: </label>
80 <input type="text" id="issuesperunit" name="issuesperunit" value="1" size="3" />
82 <input type="text" id="issuesperunit" name="issuesperunit" value="[% issuesperunit | html %]" size="3" />
86 <label for="unitsperissue">Units per issue: </label>
88 <input type="text" id="unitsperissue" name="unitsperissue" value="1" size="3" />
90 <input type="text" id="unitsperissue" name="unitsperissue" value="[% unitsperissue | html %]" size="3" />
94 <label for="displayorder">Display order: </label>
95 <input type="text" id="displayorder" name="displayorder" value="[% displayorder | html %]" size="3" />
99 <fieldset class="action">
100 <input type="submit" value="Save" />
101 <a href="/cgi-bin/koha/serials/subscription-frequencies.pl" class="cancel">Cancel</a>
106 <div id="toolbar" class="btn-toolbar">
107 <a class="btn btn-default" id="newfrequency" href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=new"><i class="fa fa-plus"></i> New frequency</a>
112 <div class="dialog alert">
114 This frequency is still used by [% subscriptions.size | html %]
115 subscription(s). Do you still want to delete it?
117 <p><a href="#" id="show_blocking_subs">Show subscriptions</a></p>
118 <ul id="blocking_subs" style="display:none">
119 [% FOREACH sub IN subscriptions %]
120 <li style="list-style-type:none">
121 <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid | uri %]">[% sub.title | html %]</a>
126 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
127 <input type="hidden" name="op" value="del" />
128 <input type="hidden" name="confirm" value="1" />
129 <input type="hidden" name="frequencyid" value="[% frequencyid | html %]" />
130 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
132 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
133 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
138 [% IF (frequencies_loop.size) %]
139 <table id="frequenciest">
144 <th>Issues per unit</th>
145 <th>Units per issue</th>
146 <th>Display order</th>
147 <th class="noExport">Actions</th>
151 [% FOREACH frequency IN frequencies_loop %]
153 <td>[% frequency.description | html %]</td>
154 <td>[% PROCESS translate_frequnit frequnit=frequency.unit %]</td>
155 <td>[% frequency.issuesperunit | html %]</td>
156 <td>[% frequency.unitsperissue | html %]</td>
157 <td>[% frequency.displayorder | html %]</td>
159 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=modify&frequencyid=[% frequency.id | html %]"><i class="fa fa-pencil"></i> Edit</a>
160 <a class="delete_frequency btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-frequencies.pl?op=del&frequencyid=[% frequency.id | html %]"><i class="fa fa-trash"></i> Delete</a>
167 <p>There is no defined frequency.</p>
172 </div> <!-- /.col-sm-10.col-sm-push-2 -->
174 <div class="col-sm-2 col-sm-pull-10">
176 [% INCLUDE 'serials-menu.inc' %]
178 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
179 </div> <!-- /.row -->
181 [% MACRO jsinclude BLOCK %]
183 function confirmDelete() {
184 return confirm(_("Are you sure you want to delete this subscription frequency?"));
187 function check_form() {
188 var description = $("#description").val();
189 var unit = $("#unit").val();
190 var issuesperunit = $("#issuesperunit").val();
191 var unitsperissue = $("#unitsperissue").val();
192 var alert_msg = _("Some fields are not valid:") + "\n";
195 if(description.length == 0) {
196 alert_msg += "\t - " + _("Description is required");
199 if(unit.length > 0) {
200 if(isNaN(issuesperunit) || issuesperunit == 0) {
201 alert_msg += "\n\t - " + _("Issues per unit is required")
202 + " " + _("(must be a number greater than 0)");
205 if(isNaN(unitsperissue) || unitsperissue == 0) {
206 alert_msg += "\n\t - " + _("Units per issue is required")
207 + " " + _("(must be a number greater than 0)");
210 if(issuesperunit > 1 && unitsperissue > 1) {
211 alert_msg += "\n\t - " + _("One of 'issues per unit' and 'units per issue' must be equal to 1");
224 $(document).ready(function() {
225 $("#issuesperunit").change(function() {
226 var value = $(this).val();
227 if(!isNaN(value) && value > 1) {
228 $("#unitsperissue").val(1);
231 $("#unitsperissue").change(function() {
232 var value = $(this).val();
233 if(!isNaN(value) && value > 1) {
234 $("#issuesperunit").val(1);
237 $(".delete_frequency").on("click",function(){
238 return confirmDelete();
240 $("#add_frequency_form").on("submit",function(){
243 $("#show_blocking_subs").on("click",function(e){
245 $("#blocking_subs").show();
251 [% INCLUDE 'intranet-bottom.inc' %]