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" class="btn btn-primary" 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 <div class="page-section">
140 <table id="frequenciest">
145 <th>Issues per unit</th>
146 <th>Units per issue</th>
147 <th>Display order</th>
148 <th class="noExport">Actions</th>
152 [% FOREACH frequency IN frequencies_loop %]
154 <td>[% frequency.description | html %]</td>
155 <td>[% PROCESS translate_frequnit frequnit=frequency.unit %]</td>
156 <td>[% frequency.issuesperunit | html %]</td>
157 <td>[% frequency.unitsperissue | html %]</td>
158 <td>[% frequency.displayorder | html %]</td>
160 <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>
161 <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 </div> <!-- /.page-section -->
169 <p>There is no defined frequency.</p>
174 </div> <!-- /.col-sm-10.col-sm-push-2 -->
176 <div class="col-sm-2 col-sm-pull-10">
178 [% INCLUDE 'serials-menu.inc' %]
180 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
181 </div> <!-- /.row -->
183 [% MACRO jsinclude BLOCK %]
185 function confirmDelete() {
186 return confirm(_("Are you sure you want to delete this subscription frequency?"));
189 function check_form() {
190 var description = $("#description").val();
191 var unit = $("#unit").val();
192 var issuesperunit = $("#issuesperunit").val();
193 var unitsperissue = $("#unitsperissue").val();
194 var alert_msg = _("Some fields are not valid:") + "\n";
197 if(description.length == 0) {
198 alert_msg += "\t - " + _("Description is required");
201 if(unit.length > 0) {
202 if(isNaN(issuesperunit) || issuesperunit == 0) {
203 alert_msg += "\n\t - " + _("Issues per unit is required")
204 + " " + _("(must be a number greater than 0)");
207 if(isNaN(unitsperissue) || unitsperissue == 0) {
208 alert_msg += "\n\t - " + _("Units per issue is required")
209 + " " + _("(must be a number greater than 0)");
212 if(issuesperunit > 1 && unitsperissue > 1) {
213 alert_msg += "\n\t - " + _("One of 'issues per unit' and 'units per issue' must be equal to 1");
226 $(document).ready(function() {
227 $("#issuesperunit").change(function() {
228 var value = $(this).val();
229 if(!isNaN(value) && value > 1) {
230 $("#unitsperissue").val(1);
233 $("#unitsperissue").change(function() {
234 var value = $(this).val();
235 if(!isNaN(value) && value > 1) {
236 $("#issuesperunit").val(1);
239 $(".delete_frequency").on("click",function(){
240 return confirmDelete();
242 $("#add_frequency_form").on("submit",function(){
245 $("#show_blocking_subs").on("click",function(e){
247 $("#blocking_subs").show();
253 [% INCLUDE 'intranet-bottom.inc' %]