2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha › Serials › Frequencies</title>
4 [% INCLUDE 'doc-head-close.inc' %]
7 <body id="ser_subscription_frequencies" class="ser">
8 [% INCLUDE 'header.inc' %]
9 [% INCLUDE 'serials-search.inc' %]
11 [% BLOCK translate_frequnit %]
14 [% CASE 'week' %] week
15 [% CASE 'month' %] month
16 [% CASE 'year' %] year
20 <div id="breadcrumbs">
21 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
22 <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> ›
23 <a href="/cgi-bin/koha/serials/subscription-frequencies.pl">Frequencies</a>
26 <div class="main container-fluid">
28 <div class="col-sm-10 col-sm-push-2">
31 [% IF (new or modify) %]
33 <h1>New frequency</h1>
35 <h1>Edit frequency: [% description | html %]</h1>
37 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" id="add_frequency_form" method="post">
39 <input type="hidden" name="id" value="[% id | html %]" />
40 <input type="hidden" name="op" value="savemod" />
42 <input type="hidden" name="op" value="savenew" />
44 <fieldset class="rows">
47 <label class="required" for="description">Description: </label>
48 <input type="text" id="description" name="description" value="[% description | html %]" class="required" required="required" /> <span class="required">Required</span>
51 <label for="unit">Unit: </label>
52 <select id="unit" name="unit">
53 <option value="">None</option>
54 [% FOREACH unit IN units_loop %]
55 [% IF (unit.selected) %]
56 <option selected="selected" value="[% unit.val | html %]">
58 <option value="[% unit.val | html %]">
60 [% PROCESS translate_frequnit frequnit=unit.val %]
65 <li><span class="hint">Note: one of the two following fields must be equal to 1</span></li>
67 <label for="issuesperunit">Issues per unit: </label>
69 <input type="text" id="issuesperunit" name="issuesperunit" value="1" size="3" />
71 <input type="text" id="issuesperunit" name="issuesperunit" value="[% issuesperunit | html %]" size="3" />
75 <label for="unitsperissue">Units per issue: </label>
77 <input type="text" id="unitsperissue" name="unitsperissue" value="1" size="3" />
79 <input type="text" id="unitsperissue" name="unitsperissue" value="[% unitsperissue | html %]" size="3" />
83 <label for="displayorder">Display order: </label>
84 <input type="text" id="displayorder" name="displayorder" value="[% displayorder | html %]" size="3" />
88 <fieldset class="action">
89 <input type="submit" value="Save" />
90 <a href="/cgi-bin/koha/serials/subscription-frequencies.pl" class="cancel">Cancel</a>
95 <div id="toolbar" class="btn-toolbar">
96 <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>
101 <div class="dialog alert">
103 This frequency is still used by [% subscriptions.size | html %]
104 subscription(s). Do you still want to delete it?
106 <p><a href="#" id="show_blocking_subs">Show subscriptions</a></p>
107 <ul id="blocking_subs" style="display:none">
108 [% FOREACH sub IN subscriptions %]
109 <li style="list-style-type:none">
110 <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid | uri %]">[% sub.title | html %]</a>
115 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
116 <input type="hidden" name="op" value="del" />
117 <input type="hidden" name="confirm" value="1" />
118 <input type="hidden" name="frequencyid" value="[% frequencyid | html %]" />
119 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
121 <form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="get">
122 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
127 [% IF (frequencies_loop.size) %]
128 <table id="frequenciest">
133 <th>Issues per unit</th>
134 <th>Units per issue</th>
135 <th>Display order</th>
140 [% FOREACH frequency IN frequencies_loop %]
142 <td>[% frequency.description | html %]</td>
143 <td>[% PROCESS translate_frequnit frequnit=frequency.unit %]</td>
144 <td>[% frequency.issuesperunit | html %]</td>
145 <td>[% frequency.unitsperissue | html %]</td>
146 <td>[% frequency.displayorder | html %]</td>
148 <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>
149 <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>
156 <p>There is no defined frequency.</p>
161 </div> <!-- /.col-sm-10.col-sm-push-2 -->
163 <div class="col-sm-2 col-sm-pull-10">
165 [% INCLUDE 'serials-menu.inc' %]
167 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
168 </div> <!-- /.row -->
170 [% MACRO jsinclude BLOCK %]
172 function confirmDelete() {
173 return confirm(_("Are you sure you want to delete this subscription frequency?"));
176 function check_form() {
177 var description = $("#description").val();
178 var unit = $("#unit").val();
179 var issuesperunit = $("#issuesperunit").val();
180 var unitsperissue = $("#unitsperissue").val();
181 var alert_msg = _("Some fields are not valid:") + "\n";
184 if(description.length == 0) {
185 alert_msg += "\t - " + _("Description is required");
188 if(unit.length > 0) {
189 if(isNaN(issuesperunit) || issuesperunit == 0) {
190 alert_msg += "\n\t - " + _("Issues per unit is required")
191 + " " + _("(must be a number greater than 0)");
194 if(isNaN(unitsperissue) || unitsperissue == 0) {
195 alert_msg += "\n\t - " + _("Units per issue is required")
196 + " " + _("(must be a number greater than 0)");
199 if(issuesperunit > 1 && unitsperissue > 1) {
200 alert_msg += "\n\t - " + _("One of 'issues per unit' and 'units per issue' must be equal to 1");
213 $(document).ready(function() {
214 $("#issuesperunit").change(function() {
215 var value = $(this).val();
216 if(!isNaN(value) && value > 1) {
217 $("#unitsperissue").val(1);
220 $("#unitsperissue").change(function() {
221 var value = $(this).val();
222 if(!isNaN(value) && value > 1) {
223 $("#issuesperunit").val(1);
226 $(".delete_frequency").on("click",function(){
227 return confirmDelete();
229 $("#add_frequency_form").on("submit",function(){
232 $("#show_blocking_subs").on("click",function(e){
234 $("#blocking_subs").show();
240 [% INCLUDE 'intranet-bottom.inc' %]